@stacksjs/stx 0.2.759 → 0.2.761
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-00nz3pas.js +2 -0
- package/dist/{chunk-3nxe5xmy.js → chunk-0fs9kx0h.js} +3 -3
- package/dist/{chunk-42hcspws.js → chunk-0kq0k4pg.js} +2 -2
- package/dist/chunk-0nynnmya.js +2 -0
- package/dist/{chunk-wp9y6x33.js → chunk-0q5dm9r2.js} +5 -5
- package/dist/{chunk-f4gqzg1y.js → chunk-0wj31pqy.js} +2 -2
- package/dist/chunk-13v3vgb6.js +2 -0
- package/dist/chunk-18gazs55.js +2 -0
- package/dist/chunk-1a9h6r9f.js +2 -0
- package/dist/chunk-1p8t2ekg.js +2 -0
- package/dist/chunk-1rcntvgx.js +2 -0
- package/dist/chunk-1w5gtkd6.js +2 -0
- package/dist/{chunk-fpagqrd1.js → chunk-23t9anc0.js} +75 -75
- package/dist/chunk-298gj90a.js +2 -0
- package/dist/{chunk-m5fjhrpd.js → chunk-2cbd1ew6.js} +101 -101
- package/dist/{chunk-h692k9xn.js → chunk-2typf9dh.js} +4 -4
- package/dist/chunk-2wnfqrv5.js +26 -0
- package/dist/chunk-2wq0h5ye.js +2 -0
- package/dist/{chunk-prej5pk6.js → chunk-2zd51tj4.js} +2 -2
- package/dist/chunk-2zg3jmy7.js +2 -0
- package/dist/{chunk-ztdjdxjt.js → chunk-319aez2f.js} +3 -3
- package/dist/{chunk-7g9vd5fv.js → chunk-37y8sg48.js} +2 -2
- package/dist/{chunk-j2mpqa4p.js → chunk-3csfmhg0.js} +2 -2
- package/dist/{chunk-jb1dk0w7.js → chunk-3mz088mb.js} +2 -2
- package/dist/chunk-3wxb7mfb.js +2 -0
- package/dist/{chunk-cehjp06v.js → chunk-42zqmcnc.js} +3 -3
- package/dist/{chunk-5ge5h2y3.js → chunk-45g1w1ct.js} +5 -5
- package/dist/{chunk-89h4snzd.js → chunk-4833k99b.js} +2 -2
- package/dist/{chunk-jevd16gq.js → chunk-48g9wez2.js} +30 -30
- package/dist/{chunk-t5gabs4x.js → chunk-4c0qcjac.js} +2 -2
- package/dist/{chunk-hmae7ha6.js → chunk-4rxmxc1p.js} +2 -2
- package/dist/chunk-4tgn1frg.js +3 -0
- package/dist/chunk-5fg8hqq0.js +2 -0
- package/dist/chunk-5x0g7e9y.js +2 -0
- package/dist/{chunk-83ezv8yz.js → chunk-5yhv5eqq.js} +3 -3
- package/dist/{chunk-6n195hvc.js → chunk-61qh74q1.js} +5 -5
- package/dist/chunk-64pdwfef.js +177 -0
- package/dist/{chunk-mcynmrbe.js → chunk-6fz2n9w6.js} +43 -43
- package/dist/chunk-72ns4q88.js +2 -0
- package/dist/chunk-7fwcnech.js +2 -0
- package/dist/{chunk-x9haxcsj.js → chunk-7y1rpd4g.js} +8 -8
- package/dist/chunk-7z2mebp5.js +2 -0
- package/dist/chunk-803qm5tk.js +2 -0
- package/dist/chunk-86cg9qqm.js +2 -0
- package/dist/{chunk-gs6wc7sr.js → chunk-89801pjp.js} +5 -5
- package/dist/chunk-8h5mqs28.js +2 -0
- package/dist/chunk-8jh2b5k2.js +2 -0
- package/dist/{chunk-yp6w740k.js → chunk-8rk79ha1.js} +2 -2
- package/dist/{chunk-2x112fxs.js → chunk-8vs5y4h7.js} +14 -14
- package/dist/{chunk-kpr09x3g.js → chunk-8y54tpbr.js} +7 -7
- package/dist/{chunk-s4y26fk6.js → chunk-8yyq3nfg.js} +2 -2
- package/dist/chunk-927ta2dn.js +2 -0
- package/dist/chunk-940wny2b.js +2 -0
- package/dist/{chunk-93j4atq9.js → chunk-98t1cv8x.js} +2 -2
- package/dist/{chunk-sgm6tg8h.js → chunk-9k8ztdcc.js} +2 -2
- package/dist/{chunk-4npabwne.js → chunk-9nhyq39s.js} +3 -3
- package/dist/{chunk-gz38jt5j.js → chunk-aa1y9j3p.js} +2 -2
- package/dist/chunk-ad9dt9rk.js +2 -0
- package/dist/chunk-ak4w2emd.js +2 -0
- package/dist/{chunk-tb56j1zt.js → chunk-ak93e1zz.js} +5 -5
- package/dist/{chunk-jt28zh50.js → chunk-b0z2n941.js} +2 -2
- package/dist/{chunk-qwds327k.js → chunk-b51p56k5.js} +2 -2
- package/dist/{chunk-r4sawwmp.js → chunk-b7x8b83z.js} +1 -1
- package/dist/chunk-b8dtz3v8.js +2 -0
- package/dist/{chunk-0e9xdrzx.js → chunk-bjhesw78.js} +8 -8
- package/dist/{chunk-w8p1y4c0.js → chunk-bvctccab.js} +4 -4
- package/dist/chunk-c5tkxjb0.js +2 -0
- package/dist/{chunk-hk98vptc.js → chunk-cdcrd33m.js} +2 -2
- package/dist/chunk-cgh0k52q.js +2 -0
- package/dist/chunk-ctdw7fh4.js +2 -0
- package/dist/{chunk-asp7ett1.js → chunk-dnsf934e.js} +9 -9
- package/dist/{chunk-7r7j7vwt.js → chunk-ds6mbfdq.js} +3 -3
- package/dist/chunk-e2q79dfs.js +2 -0
- package/dist/chunk-e5vn76f5.js +2 -0
- package/dist/{chunk-9s1qnf90.js → chunk-eb6p3p62.js} +2 -2
- package/dist/chunk-emhbj3xd.js +2 -0
- package/dist/{chunk-3cn9y08d.js → chunk-evxp3wmv.js} +7 -7
- package/dist/{chunk-z8k3fx4r.js → chunk-f8p8ggvw.js} +4 -4
- package/dist/chunk-fjfrgef4.js +2 -0
- package/dist/chunk-fke4s0kk.js +33 -0
- package/dist/{chunk-0dkd26t4.js → chunk-frybxj35.js} +7 -7
- package/dist/{chunk-4s9kytdz.js → chunk-fxmc5006.js} +2 -2
- package/dist/chunk-fxnk5ee8.js +2 -0
- package/dist/chunk-fys1patf.js +2 -0
- package/dist/{chunk-6ts3sthp.js → chunk-g4k0svq6.js} +2 -2
- package/dist/chunk-g9efdc5v.js +2 -0
- package/dist/chunk-gpvfswgj.js +2 -0
- package/dist/chunk-hnen9b45.js +2 -0
- package/dist/chunk-jacb7aw1.js +2 -0
- package/dist/{chunk-4zw118tn.js → chunk-jgk5j35w.js} +4 -4
- package/dist/{chunk-geb6zyxg.js → chunk-jn78c13y.js} +13 -13
- package/dist/chunk-jq1698j4.js +2 -0
- package/dist/{chunk-pwmkhs7z.js → chunk-jyp2mmts.js} +2 -2
- package/dist/{chunk-76fcwbe1.js → chunk-jzajpmke.js} +7 -7
- package/dist/chunk-k0jkpw0q.js +2 -0
- package/dist/{chunk-3kfbs0mw.js → chunk-k2ex94n8.js} +1 -1
- package/dist/{chunk-m00c7sh0.js → chunk-k9247v28.js} +1 -1
- package/dist/chunk-kdqnest3.js +2 -0
- package/dist/{chunk-1mfj2j5g.js → chunk-kj9m0vc6.js} +3 -3
- package/dist/chunk-krsg6dgz.js +3 -0
- package/dist/chunk-m5740sd3.js +2 -0
- package/dist/{chunk-myynywry.js → chunk-mdvtermb.js} +2 -2
- package/dist/chunk-mebf9vwb.js +2 -0
- package/dist/chunk-nm2r4se1.js +2 -0
- package/dist/chunk-p2j38381.js +2 -0
- package/dist/{chunk-3ajnrfa2.js → chunk-p88yh4wt.js} +2 -2
- package/dist/{chunk-fjxhga6w.js → chunk-pqbxa0r7.js} +2 -2
- package/dist/chunk-q245q8z1.js +2 -0
- package/dist/{chunk-5q9ss7ty.js → chunk-q3azy64b.js} +4 -4
- package/dist/chunk-qm3jbse5.js +2 -0
- package/dist/{chunk-yftw25sa.js → chunk-qx0np0hy.js} +2 -2
- package/dist/{chunk-qwsgc5rc.js → chunk-qystt1qc.js} +1 -1
- package/dist/{chunk-v20cwjgz.js → chunk-qyzjkvme.js} +6 -6
- package/dist/chunk-r13fwtas.js +2 -0
- package/dist/{chunk-dh9aagwm.js → chunk-r1tp2gnr.js} +1 -1
- package/dist/chunk-r5tsewzd.js +2 -0
- package/dist/{chunk-v2egd4zh.js → chunk-r6yb0540.js} +5 -5
- package/dist/{chunk-pes27snj.js → chunk-r8zhed35.js} +3 -3
- package/dist/{chunk-hmydy949.js → chunk-rh2qth8r.js} +5 -5
- package/dist/chunk-rha8sv1h.js +3 -0
- package/dist/{chunk-vh1d5eqk.js → chunk-t2cq4bpe.js} +6 -6
- package/dist/chunk-tfy1m821.js +2 -0
- package/dist/{chunk-465resq9.js → chunk-tpfxvw4q.js} +17 -17
- package/dist/{chunk-t6qn1374.js → chunk-tshpcvcy.js} +2 -2
- package/dist/{chunk-spjpdymh.js → chunk-ttqs99jj.js} +2 -2
- package/dist/chunk-v1ff2dfp.js +7 -0
- package/dist/chunk-vc3ppphz.js +2 -0
- package/dist/{chunk-x1q2ape8.js → chunk-vv8dn70r.js} +14 -14
- package/dist/{chunk-06zn167b.js → chunk-vvs28yqw.js} +8 -8
- package/dist/chunk-w2pch5xn.js +4 -0
- package/dist/chunk-w512gnft.js +2 -0
- package/dist/{chunk-j4snweyz.js → chunk-wby7qzha.js} +3 -3
- package/dist/{chunk-b6g24qj0.js → chunk-wghtdgwj.js} +2 -2
- package/dist/chunk-wk8y89q2.js +25 -0
- package/dist/{chunk-19safa6y.js → chunk-wmnzapn8.js} +2 -2
- package/dist/chunk-wmxsaxt0.js +2 -0
- package/dist/chunk-wq1vs94k.js +2 -0
- package/dist/chunk-wwnqbv9j.js +3 -0
- package/dist/{chunk-a5d888es.js → chunk-wycrtkw4.js} +6 -6
- package/dist/chunk-x1q7b7jg.js +2 -0
- package/dist/chunk-x1x69g3s.js +2 -0
- package/dist/{chunk-gs373714.js → chunk-x5seqmrv.js} +2 -2
- package/dist/{chunk-r5jytt0f.js → chunk-x7q4tp3f.js} +4 -4
- package/dist/{chunk-bsq9zg9j.js → chunk-xt034729.js} +6 -6
- package/dist/chunk-y5emxzbt.js +2 -0
- package/dist/chunk-y6mqq78g.js +2 -0
- package/dist/{chunk-11kejz35.js → chunk-yh5658q8.js} +1 -1
- package/dist/chunk-yhbsvf65.js +54 -0
- package/dist/{chunk-00ns0516.js → chunk-yjzk7rwt.js} +6 -6
- package/dist/chunk-yn3kff5k.js +2 -0
- package/dist/chunk-ynjm2tm0.js +2 -0
- package/dist/chunk-yp80rx17.js +2 -0
- package/dist/chunk-z5xermzg.js +2 -0
- package/dist/{chunk-j04v4rgf.js → chunk-zhrz4zvw.js} +5 -5
- package/dist/cli.js +20 -20
- package/dist/composable-loader.d.ts +1 -1
- package/dist/composable-loader.js +47 -10
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/message-catalogs.d.ts +39 -0
- package/dist/message-catalogs.js +128 -0
- package/dist/native/compiler/bundle.js +11 -36
- package/dist/native/compiler/html-to-ir.js +32 -0
- package/dist/native/compiler/render-screen.js +1 -1
- package/dist/native/compiler/setup-script.d.ts +1 -0
- package/dist/native/compiler/shared-scripts.js +10 -0
- package/dist/native/runtime/compact-document.d.ts +20 -0
- package/dist/native/runtime/compact-document.js +101 -0
- package/dist/process.d.ts +1 -1
- package/dist/process.js +87 -22
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +14 -14
- package/dist/store-loader.d.ts +27 -3
- package/dist/store-loader.js +144 -4
- package/dist/types/config-types.d.ts +1 -0
- package/package.json +5 -5
- package/dist/chunk-055v5qz2.js +0 -2
- package/dist/chunk-0b7f2mby.js +0 -2
- package/dist/chunk-0j7e56zm.js +0 -2
- package/dist/chunk-0jn79fkt.js +0 -25
- package/dist/chunk-0y44f9rk.js +0 -2
- package/dist/chunk-3h2yz805.js +0 -2
- package/dist/chunk-3jfes9b0.js +0 -2
- package/dist/chunk-4m8bexrn.js +0 -33
- package/dist/chunk-4tz00fkp.js +0 -2
- package/dist/chunk-52q8184e.js +0 -2
- package/dist/chunk-59ytzyp1.js +0 -2
- package/dist/chunk-5ffdtfwg.js +0 -2
- package/dist/chunk-5q551m4w.js +0 -2
- package/dist/chunk-6ndeycxk.js +0 -2
- package/dist/chunk-6xt3kvq1.js +0 -2
- package/dist/chunk-75r09rqt.js +0 -2
- package/dist/chunk-79y41h1d.js +0 -2
- package/dist/chunk-7h5d35bf.js +0 -2
- package/dist/chunk-82ybmdqk.js +0 -2
- package/dist/chunk-8frs2dtp.js +0 -2
- package/dist/chunk-8n2gj4q2.js +0 -11
- package/dist/chunk-8prq9t3b.js +0 -2
- package/dist/chunk-8sxngenk.js +0 -2
- package/dist/chunk-90er677t.js +0 -2
- package/dist/chunk-aakkjjgr.js +0 -2
- package/dist/chunk-abs1k04e.js +0 -2
- package/dist/chunk-c05r0rzw.js +0 -3
- package/dist/chunk-c7yjhjr2.js +0 -2
- package/dist/chunk-cpep999n.js +0 -2
- package/dist/chunk-cvwn6mga.js +0 -2
- package/dist/chunk-davr7z73.js +0 -2
- package/dist/chunk-dqs4bgec.js +0 -2
- package/dist/chunk-e30kgg28.js +0 -2
- package/dist/chunk-e3fkq9gb.js +0 -2
- package/dist/chunk-eab8na0z.js +0 -2
- package/dist/chunk-exg7ry7b.js +0 -2
- package/dist/chunk-f4mmk2cx.js +0 -2
- package/dist/chunk-fhwn8j9p.js +0 -2
- package/dist/chunk-fj105fff.js +0 -2
- package/dist/chunk-g387j1qv.js +0 -2
- package/dist/chunk-gefpzry6.js +0 -2
- package/dist/chunk-ghzycypz.js +0 -2
- package/dist/chunk-gvaee1w0.js +0 -170
- package/dist/chunk-k37472gm.js +0 -2
- package/dist/chunk-k3wnmpt3.js +0 -2
- package/dist/chunk-kb8654dp.js +0 -4
- package/dist/chunk-kfqdx75m.js +0 -2
- package/dist/chunk-mgx71bfg.js +0 -2
- package/dist/chunk-mmhbn7xt.js +0 -2
- package/dist/chunk-mzcbfra0.js +0 -2
- package/dist/chunk-nv9dy71x.js +0 -54
- package/dist/chunk-ny2qzraq.js +0 -2
- package/dist/chunk-pg15tx9c.js +0 -2
- package/dist/chunk-ppc5s12t.js +0 -2
- package/dist/chunk-ptzzpf97.js +0 -2
- package/dist/chunk-qgsrxyh9.js +0 -2
- package/dist/chunk-qmxcs806.js +0 -2
- package/dist/chunk-qn4gt8sx.js +0 -3
- package/dist/chunk-qryg0hgn.js +0 -2
- package/dist/chunk-qt17792g.js +0 -2
- package/dist/chunk-qz9fzz5k.js +0 -2
- package/dist/chunk-rh90yh1c.js +0 -2
- package/dist/chunk-rvc0pb16.js +0 -2
- package/dist/chunk-sj5t0tnv.js +0 -2
- package/dist/chunk-t4mpq6t0.js +0 -3
- package/dist/chunk-tb6jcr2v.js +0 -2
- package/dist/chunk-tn40nh9e.js +0 -3
- package/dist/chunk-xcq41ah8.js +0 -2
- package/dist/chunk-y3jbkk7a.js +0 -2
- package/dist/chunk-yme43vbp.js +0 -2
- package/dist/chunk-yv8jeqdn.js +0 -2
- package/dist/chunk-zq7g0687.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{ni,kc,o,Rt,oe,C,Oe,dn,Ne,pe,X,wr,pn,Ns,Nc,gn,Sr,Ms,Ls,Dc,ci,Mc,Lc,jc,Bc,Me,Le,js,Fe,r,yn,h,p,V,Z,Se,_,T}from"./chunk-2cbd1ew6.js";import{u,f,R,t,ae,q,c,ke,wi,B,xn,vi,Bt,xi,Zc,Er,Qc,ot,el,Tr,tl,Sn,Si,nl,$r,Ar,_e,ki}from"./chunk-tpfxvw4q.js";import{Mt}from"./chunk-x5seqmrv.js";import{wn}from"./chunk-wghtdgwj.js";import{y}from"./chunk-7y1rpd4g.js";import{fr,Cs}from"./chunk-f8p8ggvw.js";import{ac,cc,ur,Ze,lc,P}from"./chunk-vv8dn70r.js";import{Ko,Go,Xo,Jo}from"./chunk-evxp3wmv.js";import{nc,as}from"./chunk-bjhesw78.js";import{rs,ss,os}from"./chunk-yhbsvf65.js";import{ls,Bo,Fo,us,ds,zo}from"./chunk-vvs28yqw.js";import{ns,sr}from"./chunk-wk8y89q2.js";import{Po}from"./chunk-b0z2n941.js";import{se,Do,Mo,Lo}from"./chunk-9k8ztdcc.js";import{ir,be,sc,ar,oc}from"./chunk-frybxj35.js";import{L,Je}from"./chunk-0wj31pqy.js";import{uc,dc}from"./chunk-kj9m0vc6.js";import{E,kn,_i}from"./chunk-rha8sv1h.js";import gs from"fs";import ce from"path";function ut(){return`
|
|
3
3
|
// STX Lifecycle Runtime
|
|
4
4
|
(function() {
|
|
5
5
|
if (typeof window === 'undefined') return;
|
|
@@ -347,7 +347,7 @@ else {
|
|
|
347
347
|
|
|
348
348
|
console.log('[stx] Lifecycle runtime initialized');
|
|
349
349
|
})();
|
|
350
|
-
`}function
|
|
350
|
+
`}function Ke(s){return Symbol(s)}var Rs=Ke("theme"),Ds=Ke("router"),Is=Ke("i18n");import*as pt from"crypto";function dt(s){let e=/\$(\w+)\./g,l=[],a;while((a=e.exec(s))!==null)if(!l.includes(a[1]))l.push(a[1]);return l}function On(){return`stx-${pt.randomBytes(4).toString("hex")}`}function Pn(s){return/\$\w+\./.test(s)}function Ln(s){if(!/\{\{[^}]*\$\w/.test(s)||!/\$\w+\./.test(s))return{html:s,bindings:[],stores:new Set};let e=[],l=new Set,a=/<(\w+)([^>]*?)(\s*\/?>)/g,d=s;return d=d.replace(a,(n,g,v,m)=>{if(["script","style","template"].includes(g.toLowerCase()))return n;if(!v.includes("{{"))return n;let x=[],b=!1,w=v,S=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,k=[...v.matchAll(S)];for(let M of k){let D=M[0],N=M[1],H=M[2];if(Pn(H)){b=!0;let U=H.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(U){let O=U[1];if(x.push({attr:N,expr:O,fullMatch:D,originalAttr:N}),dt(O).forEach((F)=>l.add(F)),N==="text")w=w.replace(D,"");else if(N==="class")w=w.replace(D,'class=""');else if(N==="disabled"||N==="hidden")w=w.replace(D,"");else w=w.replace(D,`${N}=""`)}}}if(!b)return n;let I=w.match(/\bid\s*=\s*"([^"]+)"/),A;if(I)A=I[1];else A=On(),w=` id="${A}"${w}`;for(let M of x)e.push({elementId:A,attribute:M.attr,expression:M.expr,stores:dt(M.expr)});return`<${g}${w}${m}`}),{html:d,bindings:e,stores:l}}function jn(s,e){if(s.length===0)return"";let l=Array.from(e),a=`
|
|
351
351
|
<script>
|
|
352
352
|
(function() {
|
|
353
353
|
'use strict';
|
|
@@ -363,11 +363,11 @@ else {
|
|
|
363
363
|
// Store references for expressions
|
|
364
364
|
// eslint-disable-next-line pickier/no-unused-vars
|
|
365
365
|
var $state = {};
|
|
366
|
-
`;for(let
|
|
366
|
+
`;for(let d of l)a+=` $state.${d} = stores.${d} ? stores.${d}.get() : {};
|
|
367
367
|
`;a+=`
|
|
368
368
|
// Binding update functions
|
|
369
369
|
function updateBindings() {
|
|
370
|
-
`;for(let
|
|
370
|
+
`;for(let d of s){let{elementId:n,attribute:g,expression:v}=d,m=v.replace(/\$(\w+)\./g,"$state.$1.");if(g==="text")a+=` (function() {
|
|
371
371
|
var el = document.getElementById('${n}');
|
|
372
372
|
if (el) {
|
|
373
373
|
try {
|
|
@@ -376,7 +376,7 @@ else {
|
|
|
376
376
|
catch (e) { console.error('Binding error:', e); }
|
|
377
377
|
}
|
|
378
378
|
})();
|
|
379
|
-
`;else if(
|
|
379
|
+
`;else if(g==="html")a+=` (function() {
|
|
380
380
|
var el = document.getElementById('${n}');
|
|
381
381
|
if (el) {
|
|
382
382
|
try {
|
|
@@ -385,7 +385,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
385
385
|
catch (e) { console.error('Binding error:', e); }
|
|
386
386
|
}
|
|
387
387
|
})();
|
|
388
|
-
`;else if(
|
|
388
|
+
`;else if(g==="class")a+=` (function() {
|
|
389
389
|
var el = document.getElementById('${n}');
|
|
390
390
|
if (el) {
|
|
391
391
|
try {
|
|
@@ -414,7 +414,7 @@ else {
|
|
|
414
414
|
catch (e) { console.error('Binding error:', e); }
|
|
415
415
|
}
|
|
416
416
|
})();
|
|
417
|
-
`;else if(
|
|
417
|
+
`;else if(g==="show")a+=` (function() {
|
|
418
418
|
var el = document.getElementById('${n}');
|
|
419
419
|
if (el) {
|
|
420
420
|
try {
|
|
@@ -423,7 +423,7 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
423
423
|
catch (e) { console.error('Binding error:', e); }
|
|
424
424
|
}
|
|
425
425
|
})();
|
|
426
|
-
`;else if(
|
|
426
|
+
`;else if(g==="if")a+=` (function() {
|
|
427
427
|
var el = document.getElementById('${n}');
|
|
428
428
|
if (el) {
|
|
429
429
|
try {
|
|
@@ -438,13 +438,13 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
438
438
|
try {
|
|
439
439
|
var value = ${m};
|
|
440
440
|
if (value === false || value === null || value === undefined) {
|
|
441
|
-
el.removeAttribute('${
|
|
441
|
+
el.removeAttribute('${g}');
|
|
442
442
|
}
|
|
443
443
|
else if (value === true) {
|
|
444
|
-
el.setAttribute('${
|
|
444
|
+
el.setAttribute('${g}', '');
|
|
445
445
|
}
|
|
446
446
|
else {
|
|
447
|
-
el.setAttribute('${
|
|
447
|
+
el.setAttribute('${g}', value);
|
|
448
448
|
}
|
|
449
449
|
}
|
|
450
450
|
catch (e) { console.error('Binding error:', e); }
|
|
@@ -458,14 +458,14 @@ catch (e) { console.error('Binding error:', e); }
|
|
|
458
458
|
// using reactive-bindings stacked another subscription on every store,
|
|
459
459
|
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
460
460
|
var _disposers = [];
|
|
461
|
-
`;for(let
|
|
462
|
-
var _unsub_${
|
|
463
|
-
$state.${
|
|
461
|
+
`;for(let d of l)a+=` if (stores.${d}) {
|
|
462
|
+
var _unsub_${d} = stores.${d}.subscribe(function(state) {
|
|
463
|
+
$state.${d} = state;
|
|
464
464
|
updateBindings();
|
|
465
465
|
});
|
|
466
466
|
// store.subscribe() may return the disposer (preferred) or void; both
|
|
467
467
|
// are tolerated here.
|
|
468
|
-
if (typeof _unsub_${
|
|
468
|
+
if (typeof _unsub_${d} === 'function') _disposers.push(_unsub_${d});
|
|
469
469
|
}
|
|
470
470
|
`;return a+=`
|
|
471
471
|
// Initial update
|
|
@@ -505,10 +505,10 @@ else {
|
|
|
505
505
|
}
|
|
506
506
|
})();
|
|
507
507
|
</script>
|
|
508
|
-
`,a}function
|
|
508
|
+
`,a}function ft(s){let{html:e,bindings:l,stores:a}=Ln(s);if(l.length===0)return s;let d=jn(l,a),n=e.lastIndexOf("</body>");if(n!==-1)return e.slice(0,n)+d+e.slice(n);return e+d}function Nn(s){let e=s.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Hn(e);case"google-analytics":return Bn(e);case"plausible":return Fn(e);case"self-hosted":return qn(e);case"custom":return Un(e);default:return""}}function Hn(s){let e=s.fathom;if(!e?.siteId)return"";let l=e.scriptUrl||"https://cdn.usefathom.com/script.js",a=e.defer!==!1?" defer":"",d=[`data-site="${de(e.siteId)}"`];if(e.honorDnt)d.push('data-honor-dnt="true"');if(e.spa)d.push('data-spa="auto"');if(e.canonical)d.push(`data-canonical="${de(e.canonical)}"`);if(e.auto===!1)d.push('data-auto="false"');return`
|
|
509
509
|
<!-- Fathom Analytics -->
|
|
510
|
-
<script src="${de(l)}" ${
|
|
511
|
-
`}function
|
|
510
|
+
<script src="${de(l)}" ${d.join(" ")}${a}></script>
|
|
511
|
+
`}function Bn(s){let e=s.googleAnalytics;if(!e?.measurementId)return"";let l=de(e.measurementId),a=e.debug?`gtag('config', '${l}', { 'debug_mode': true });`:"";return`
|
|
512
512
|
<!-- Google Analytics -->
|
|
513
513
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${l}"></script>
|
|
514
514
|
<script>
|
|
@@ -518,10 +518,10 @@ else {
|
|
|
518
518
|
gtag('config', '${l}');
|
|
519
519
|
${a}
|
|
520
520
|
</script>
|
|
521
|
-
`}function
|
|
521
|
+
`}function Fn(s){let e=s.plausible;if(!e?.domain)return"";let l=e.scriptUrl||"https://plausible.io/js/script.js",a=[`data-domain="${de(e.domain)}"`],d=l,n=[];if(e.trackLocalhost)n.push("local");if(e.hashMode)n.push("hash");if(n.length>0&&l==="https://plausible.io/js/script.js")d=`https://plausible.io/js/script.${n.join(".")}.js`;return`
|
|
522
522
|
<!-- Plausible Analytics -->
|
|
523
|
-
<script defer data-domain="${de(e.domain)}" src="${de(
|
|
524
|
-
`}function
|
|
523
|
+
<script defer data-domain="${de(e.domain)}" src="${de(d)}"></script>
|
|
524
|
+
`}function qn(s){let e=s.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let l=de(e.siteId),a=de(e.apiEndpoint),d=e.honorDnt?'if(n.doNotTrack==="1")return;':"",n=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",g=e.trackOutboundLinks?`
|
|
525
525
|
d.addEventListener('click',function(e){
|
|
526
526
|
var a=e.target.closest('a');
|
|
527
527
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -534,7 +534,7 @@ else {
|
|
|
534
534
|
'use strict';
|
|
535
535
|
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
536
536
|
var site=s.dataset.site,api=s.dataset.api;
|
|
537
|
-
${
|
|
537
|
+
${d}
|
|
538
538
|
var q=[],sid=Math.random().toString(36).slice(2);
|
|
539
539
|
function t(e,p){
|
|
540
540
|
var x=new XMLHttpRequest();
|
|
@@ -548,21 +548,21 @@ else {
|
|
|
548
548
|
}
|
|
549
549
|
function pv(){t('pageview');}
|
|
550
550
|
${n}
|
|
551
|
-
${
|
|
551
|
+
${g}
|
|
552
552
|
if(d.readyState==='complete')pv();
|
|
553
553
|
else w.addEventListener('load',pv);
|
|
554
554
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
555
555
|
})();
|
|
556
556
|
</script>
|
|
557
|
-
`}function
|
|
557
|
+
`}function Un(s){let e=s.custom;if(!e)return"";if(e.inlineScript)return`
|
|
558
558
|
<!-- Custom Analytics -->
|
|
559
559
|
<script>
|
|
560
560
|
${e.inlineScript}
|
|
561
561
|
</script>
|
|
562
|
-
`;if(!e.scriptUrl)return"";let l=[];if(e.scriptId)l.push(`id="${de(e.scriptId)}"`);if(e.attributes)for(let[
|
|
562
|
+
`;if(!e.scriptUrl)return"";let l=[];if(e.scriptId)l.push(`id="${de(e.scriptId)}"`);if(e.attributes)for(let[d,n]of Object.entries(e.attributes))l.push(`${de(d)}="${de(n)}"`);return`
|
|
563
563
|
<!-- Custom Analytics -->
|
|
564
564
|
<script${l.length>0?` ${l.join(" ")}`:""} src="${de(e.scriptUrl)}" defer></script>
|
|
565
|
-
`}function
|
|
565
|
+
`}function gt(s,e){let l=Nn(e);if(!l)return s;if(!s.includes("</head>")){let a=s.lastIndexOf("</body>");if(a!==-1)return s.slice(0,a)+l+s.slice(a);return s+l}return s.replace("</head>",`${l}</head>`)}function de(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function ht(s){let e=s.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function mt(s){let e=s?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}var Vn=0,zn=0;function yt(s,e){let l=s.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));if(l)return l[1];let a=s.match(new RegExp(`${e}\\s*=\\s*'([^']*)'`,"i"));if(a)return a[1];return null}function Wn(s){let e=[],l=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,a;while((a=l.exec(s))!==null){let[d,n,g]=a,v=a.index,m=yt(g,"x-data");if(!m)continue;let x=`__stx_scope_${Vn++}`,b=yt(g,"x-init"),w=Xn(s,n,v+d.length),S=s.slice(v,w.endIndex),k=Kn(S);e.push({id:x,selector:`[data-stx-scope="${x}"]`,stateExpr:m,initExpr:b,bindings:[],refs:k})}return e}function Xn(s,e,l){let a=1,d=l,n=new RegExp(`<${e}(?:\\s|>)`,"gi"),g=new RegExp(`</${e}>`,"gi"),v=new RegExp(`<${e}[^>]*/\\s*>`,"gi");while(a>0&&d<s.length){n.lastIndex=d,g.lastIndex=d,v.lastIndex=d;let m=n.exec(s),x=g.exec(s),b=v.exec(s);if(b&&b.index<(m?.index??1/0)){d=b.index+b[0].length;continue}if(!x)return{endIndex:s.length};if(m&&m.index<x.index)a++,d=m.index+m[0].length;else{if(a--,a===0)return{endIndex:x.index+x[0].length};d=x.index+x[0].length}}return{endIndex:s.length}}function Kn(s){let e=new Map,l=s.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),a=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,d;while((d=a.exec(l))!==null){let[,n,g]=d,v=Gn(n);e.set(g,v)}return e}function Gn(s){let e=s.match(/\bid\s*=\s*["']([^"']*)["']/);if(e)return e[1];return`__stx_el_${zn++}`}function Jn(){return`
|
|
566
566
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
567
567
|
(function() {
|
|
568
568
|
var style = document.createElement('style');
|
|
@@ -815,36 +815,36 @@ window.__stx_reactive = (function() {
|
|
|
815
815
|
|
|
816
816
|
return { initScope: initScope, reactive: reactive };
|
|
817
817
|
})();
|
|
818
|
-
`}function
|
|
818
|
+
`}function vt(s,e){let l=s.replace(/\{!!([\s\S]*?)!!\}/g,(v,m)=>{try{let x=T(m,e,!0);if(x===void 0)return v;return String(x)}catch{return v}}),a="",d=0,n=null;while(d<l.length){let v=l[d];if(n&&v==="\\"){a+=v+(l[d+1]??""),d+=2;continue}if(v==="{"&&l[d+1]==="{"){let m=l.indexOf("}}",d+2);if(m!==-1){let x=l.slice(d,m+2);a+=g(l.slice(d+2,m),x,n),d=m+2;continue}}if(n){if(v===n)n=null}else if(v==="'"||v==='"'||v==="`")n=v;a+=v,d++}return a;function g(v,m,x){let b;try{b=T(v,e,!0)}catch{return m}if(b===void 0)return m;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 Zn(s,e){if(s.length===0)return"";let l=s.map((a)=>{let d=JSON.stringify(Object.fromEntries(a.refs)),n=vt(a.stateExpr,e),g=a.initExpr?vt(a.initExpr,e):null,v=JSON.stringify(n),m=g?JSON.stringify(g):"null";return`
|
|
819
819
|
(function() {
|
|
820
820
|
var scopeEl = document.querySelector('${a.selector}');
|
|
821
821
|
if (!scopeEl) return;
|
|
822
|
-
var refs = ${
|
|
822
|
+
var refs = ${d};
|
|
823
823
|
__stx_reactive.initScope(scopeEl, ${v}, [], refs, ${m});
|
|
824
824
|
})();`}).join(`
|
|
825
825
|
`);return`
|
|
826
826
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
827
|
-
${
|
|
827
|
+
${Jn()}
|
|
828
828
|
${l}
|
|
829
|
-
</script>`}function
|
|
830
|
-
`+
|
|
831
|
-
${g}`)}function Et(s,e){let l=s;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<script nonce="${e}"${g}>`}),l=l.replace(/<style([^>]*)>/gi,(a,g)=>{if(g.includes("nonce="))return a;return`<style nonce="${e}"${g}>`}),l}function _t(s,e,l,a){let g=s,n=a.csp;if(g=g.replace(/@csp\b/g,()=>{if(!n?.enabled||!n.directives)return"<!-- CSP not configured -->";let d=n.useNonce?Ue(e,n):void 0;return kt(n.directives,d)}),g=g.replace(/@cspNonce\b/g,()=>{if(!n?.enabled||!n.useNonce)return"";return Ue(e,n)}),n?.enabled&&n.useNonce)e.cspNonce=Ue(e,n);return g}import cr from"crypto";var ur=40,Tt="_token",Qe=null;function dr(s=ur){let e=cr.randomBytes(Math.ceil(s/2)).toString("hex").slice(0,s);return Qe=e,e}function fr(){if(!Qe)dr();return Qe}function gr(s=Tt){let e=fr();return`<input type="hidden" name="${s}" value="${e}">`}function Ct(s){return s.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>gr(a||Tt))}async function At(s,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return s;let g=s;for(let n of a.customDirectives){if(!n.name||typeof n.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",n);continue}if(n.hasEndTag)g=await mr(g,n,e,l,a);else g=await hr(g,n,e,l,a)}return g}async function mr(s,e,l,a,g){let{name:n,handler:d}=e,v=`@${n}`,m=`@end${n}`,x=s,b=$t(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${m}`,"g"),w=[],S=b.exec(x);while(S!==null){let[_,D="",A=""]=S,M=S.index||0;try{let I=D?Rt(e,D):[],N=A.trim(),U=await d(N,I,l,a);w.push({original:_,processed:U,startIndex:M})}catch(I){let N=I instanceof Error?I.message:String(I);if(g.debug)console.error(`Error processing custom directive @${n}:`,I);w.push({original:_,processed:c("CustomDirective",`Error in @${n}${D?`(${D})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:M})}S=b.exec(x)}for(let _=w.length-1;_>=0;_--){let{original:D,processed:A}=w[_];x=x.replace(D,A)}return x}async function hr(s,e,l,a,g){let{name:n,handler:d}=e,v=s,m=[],x=[];if(e.rawParams){for(let S of bi(v,$t(`(?<![\\w$@])@${n}\\s*\\(`,"g")))if(S.end!==-1)x.push({fullMatch:S.call,paramString:S.args,startIndex:S.start})}else{let S=$t(`@${n}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");S.lastIndex=0;let _=S.exec(v);while(_!==null)x.push({fullMatch:_[0],paramString:_[1]??"",startIndex:_.index||0}),_=S.exec(v)}for(let{fullMatch:S,paramString:_,startIndex:D}of x)try{let A=Rt(e,_),M=await d("",A,l,a);m.push({original:S,processed:M,startIndex:D})}catch(A){let M=A instanceof Error?A.message:String(A);if(g.debug)console.error(`Error processing custom directive @${n}:`,A);m.push({original:S,processed:c("CustomDirective",`Error in @${n}(${_}): ${M}`,t.EVALUATION_ERROR),startIndex:D})}let b=$t(`@${n}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[S]=w,_=w.index||0;try{let D=await d("",[],l,a);m.push({original:S,processed:D,startIndex:_})}catch(D){let A=D instanceof Error?D.message:String(D);if(g.debug)console.error(`Error processing custom directive @${n}:`,D);m.push({original:S,processed:c("CustomDirective",`Error in @${n}: ${A}`,t.EVALUATION_ERROR),startIndex:_})}w=b.exec(v)}for(let S=m.length-1;S>=0;S--){let{original:_,processed:D}=m[S];v=v.replace(_,D)}return v}function Rt(s,e){return s.rawParams?jt(e):yr(e)}function yr(s){if(!s.trim())return[];let e=[],l="",a=!1,g="";for(let n=0;n<s.length;n++){let d=s[n];if((d==='"'||d==="'")&&(n===0||s[n-1]!=="\\"))if(!a)a=!0,g=d;else if(d===g)a=!1;else l+=d;else if(d===","&&!a)e.push(l.trim()),l="";else l+=d}if(l.trim())e.push(l.trim());return e.map((n)=>{let d=n.trim();if(d.startsWith('"')&&d.endsWith('"')||d.startsWith("'")&&d.endsWith("'"))return d.substring(1,d.length-1);return d})}var Mt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,It=/^[A-Za-z_$][\w$]*$/,vr=new Set(["light","dark","system"]);function we(s,e){if(typeof s!=="string"||s.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function wr(s){if(!s||typeof s!=="object"||Array.isArray(s))throw Error("@appearanceBootstrap expects an options object");let e=s,{appearance:l,colorMode:a}=e;if(we(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(we(a.key,"colorMode.key"),we(a.attribute,"colorMode.attribute"),we(a.default,"colorMode.default"),!It.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!vr.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(l){if(we(l.key,"appearance.key"),we(l.attribute,"appearance.attribute"),we(l.default,"appearance.default"),!It.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((n)=>typeof n!=="string"||n.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function kr(s){return JSON.stringify(s).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Sr(s){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${kr(s)};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 $r(s,e){let l=1,a=null,g=!1;for(let n=e+1;n<s.length;n++){let d=s[n];if(g){g=!1;continue}if(a){if(d==="\\")g=!0;else if(d===a)a=null;continue}if(d==='"'||d==="'"||d==="`"){a=d;continue}if(d==="(")l++;else if(d===")"&&--l===0)return n}return-1}function Ot(s,e){let l=s,a=/@appearanceBootstrap\s*\(/g,g;while((g=a.exec(l))!==null){let n=g.index+g[0].length-1,d=$r(l,n);if(d===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=l.slice(n+1,d).trim(),m=u(`(${v})`,e),x=Sr(wr(m));l=l.slice(0,g.index)+x+l.slice(d+1),a.lastIndex=g.index+x.length}return l}import _r from"crypto";function Q(s){return V(String(s??""))}var Lt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(s,e,l,a){let g=s||e;return l?`${g} ${a}`:g}function ge(s){return String(s).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ce(s,e){if(/\bid\s*=/i.test(s))return"";return` id="${Q(e)}"`}function et(s,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${Q(`${ge(s)}-error`)}"`;return a}function Ar(){return _r.randomUUID()}function ze(s,e){let l=s;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=Ar();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,g)=>{let n=g.toUpperCase();if(g&&!["GET","POST"].includes(n))return`<input type="hidden" name="_method" value="${Q(n)}">`;return a}),l}function Nt(s,e,l=Lt){let a=s;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,n,d,v,m,x="")=>{let b=n||d||"POST",w=v||m||"",S=he(x),_=b.toUpperCase(),D=["GET","POST"].includes(_)?_:"POST",A=`<form method="${Q(D)}" action="${Q(w)}"${S?` ${S}`:""}>`;if(A+=`
|
|
832
|
-
${ze("@csrf",e)}`,!["GET","POST"].includes(
|
|
833
|
-
${ze(`@method('${
|
|
829
|
+
</script>`}function bt(s,e,l){if(!Yn(s))return s;let a=Wn(s);if(a.length===0)return s;let d=Qn(s,a),n=Zn(a,e),g=d.lastIndexOf("</body>");if(g!==-1)d=d.slice(0,g)+n+`
|
|
830
|
+
`+d.slice(g);else d+=n;return d}function Qn(s,e){let l=0,a=s.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(d,n,g)=>{let v=e[l++];if(!v)return d;let m=/data-stx-scope="([^"]*)"/.exec(g);if(m)return v.id=m[1],v.selector=`[data-stx-scope="${v.id}"]`,d;return`<${n} data-stx-scope="${v.id}"${g}>`});return a=a.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),a=a.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),a=a.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),a=a.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),a}function Yn(s){return/x-data\s*=\s*["']/.test(s)}import tr from"fs";import Ge from"path";import{createHighlighter as nr}from"ts-syntax-highlighter";var Qe=new Map;async function Re(s,e={}){try{if(!await r(s))throw Error(`Markdown file not found: ${s}`);let a=(await tr.promises.stat(s)).mtime.getTime();if(e.cache&&Qe.has(s)){let w=Qe.get(s);if(w.updatedAt>=a)return{content:w.content,data:w.data}}let d=await Bun.file(s).text(),{data:n,content:g}=ur(d),v=e.markdown||P.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=Ze(g,{gfm:!0});if(v.syntaxHighlighting?.enabled&&v.syntaxHighlighting?.serverSide)x=await rr(x,v.syntaxHighlighting?.defaultTheme||"github-dark",v.syntaxHighlighting?.highlightUnknownLanguages||!1);let b={content:x,data:n||{}};if(e.cache)Qe.set(s,{...b,updatedAt:a});return b}catch(l){if(e.debug)console.error(`Error reading/parsing markdown file ${s}:`,l);let a=l instanceof Error?l.message:String(l);return{content:h("Markdown File",`Error reading/parsing markdown file: ${a}`,s,"",0,""),data:{}}}}var qe=null;async function rr(s,e,l){let a=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!qe)try{qe=await nr({theme:e||"github-dark",cache:!0})}catch(v){return console.error("Failed to initialize ts-syntax-highlighter:",v),s}let d=async(v,m,x,b)=>{let w=b.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),S=x||(l?"text":"");if(!S)return v;try{if(!qe.getSupportedLanguages().includes(S))return v;return(await qe.highlight(w,S,{theme:e})).html}catch(k){console.error(`Error highlighting code block with language ${x}:`,k)}return v},n=s,g=s.matchAll(a);for(let v of g){let[m,x,b,w]=v,S=await d(m,x,b,w);n=n.replace(m,S)}return n}async function wt(s,e,l="",a={}){return await or(s,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(g,v,m,x)=>{try{let b=v;if(!Ge.isAbsolute(v))b=Ge.resolve(Ge.dirname(l),v);let w={};if(m)try{try{w=JSON.parse(m)}catch{if(a.debug)console.warn("Using safer alternative for parsing JS object literal");let N=m.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let H of N){let U=H.indexOf(":");if(U>0){let O=H.substring(0,U).trim(),j=H.substring(U+1).trim(),F=j.startsWith('"')&&j.endsWith('"'),K=j.startsWith("'")&&j.endsWith("'");if(F||K)j=j.substring(1,j.length-1);w[O]=j}}}}catch(D){if(a.debug)console.error("Error parsing context in @markdown-file directive:",D)}let{content:S,data:k}=await Re(b,a),I={...e,...k,...w},A=S,M=/\{\{([^}]+)\}\}/g;return A=A.replace(M,(D,N)=>{let H=N.trim();return I[H]!==void 0?String(I[H]):D}),A}catch(b){let w=b instanceof Error?b.message:String(b);return h("Markdown File",`Error including markdown file: ${w}`,l,s,x,g)}})}async function or(s,e,l){let a=[],d;while((d=e.exec(s))!==null){let v=d[0],m=d.index,x=d;a.push(l(...x).then((b)=>({match:v,replacement:b,index:m})))}let n=await Promise.all(a);n.sort((v,m)=>m.index-v.index);let g=s;for(let{match:v,replacement:m}of n)g=g.replace(v,()=>m);return g}var xt=new WeakMap;function St(s=16){let e=new Uint8Array(s);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ue(s,e){if(!s)return e?.nonceGenerator?.()??St();let l=xt.get(s);if(!l)l=e?.nonceGenerator?.()??St(),xt.set(s,l);return l}function cr(s,e){let l=[];for(let[a,d]of Object.entries(s)){if(d===void 0||d===null)continue;if(typeof d==="boolean"){if(d)l.push(a);continue}if(Array.isArray(d)){let n=[...d];if(e&&(a==="script-src"||a==="style-src"))n=n.filter((g)=>!g.startsWith("'nonce-")),n.push(`'nonce-${e}'`);if(n.length>0)l.push(`${a} ${n.join(" ")}`)}}return l.join("; ")}function kt(s,e){return`<meta http-equiv="Content-Security-Policy" content="${cr(s,e).replace(/&/g,"&").replace(/"/g,""")}">`}function $t(s,e,l){if(!e.enabled||!e.addMetaTag)return s;if(s.includes('http-equiv="Content-Security-Policy"'))return s;if(!s.includes("<head>")&&!s.includes("<head "))return s;let a=e.useNonce?Ue(l,e):void 0,d=kt(e.directives,a);return s.replace(/<head([^>]*)>/,`<head$1>
|
|
831
|
+
${d}`)}function Et(s,e){let l=s;return l=l.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(a,d)=>{if(d.includes("nonce="))return a;return`<script nonce="${e}"${d}>`}),l=l.replace(/<style([^>]*)>/gi,(a,d)=>{if(d.includes("nonce="))return a;return`<style nonce="${e}"${d}>`}),l}function _t(s,e,l,a){let d=s,n=a.csp;if(d=d.replace(/@csp\b/g,()=>{if(!n?.enabled||!n.directives)return"<!-- CSP not configured -->";let g=n.useNonce?Ue(e,n):void 0;return kt(n.directives,g)}),d=d.replace(/@cspNonce\b/g,()=>{if(!n?.enabled||!n.useNonce)return"";return Ue(e,n)}),n?.enabled&&n.useNonce)e.cspNonce=Ue(e,n);return d}import lr from"crypto";var dr=40,Tt="_token",Ye=null;function pr(s=dr){let e=lr.randomBytes(Math.ceil(s/2)).toString("hex").slice(0,s);return Ye=e,e}function gr(){if(!Ye)pr();return Ye}function mr(s=Tt){let e=gr();return`<input type="hidden" name="${s}" value="${e}">`}function Ct(s){return s.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,l,a)=>mr(a||Tt))}async function At(s,e,l,a){if(!a.customDirectives||a.customDirectives.length===0)return s;let d=s;for(let n of a.customDirectives){if(!n.name||typeof n.handler!=="function"){if(a.debug)console.warn("Invalid custom directive:",n);continue}if(n.hasEndTag)d=await hr(d,n,e,l,a);else d=await yr(d,n,e,l,a)}return d}async function hr(s,e,l,a,d){let{name:n,handler:g}=e,v=`@${n}`,m=`@end${n}`,x=s,b=Rt(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${m}`,"g"),w=[],S=b.exec(x);while(S!==null){let[k,I="",A=""]=S,M=S.index||0;try{let D=I?Dt(e,I):[],N=A.trim(),H=await g(N,D,l,a);w.push({original:k,processed:H,startIndex:M})}catch(D){let N=D instanceof Error?D.message:String(D);if(d.debug)console.error(`Error processing custom directive @${n}:`,D);w.push({original:k,processed:c("CustomDirective",`Error in @${n}${I?`(${I})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:M})}S=b.exec(x)}for(let k=w.length-1;k>=0;k--){let{original:I,processed:A}=w[k];x=x.replace(I,A)}return x}async function yr(s,e,l,a,d){let{name:n,handler:g}=e,v=s,m=[],x=[];if(e.rawParams){for(let S of vi(v,Rt(`(?<![\\w$@])@${n}\\s*\\(`,"g")))if(S.end!==-1)x.push({fullMatch:S.call,paramString:S.args,startIndex:S.start})}else{let S=Rt(`@${n}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");S.lastIndex=0;let k=S.exec(v);while(k!==null)x.push({fullMatch:k[0],paramString:k[1]??"",startIndex:k.index||0}),k=S.exec(v)}for(let{fullMatch:S,paramString:k,startIndex:I}of x)try{let A=Dt(e,k),M=await g("",A,l,a);m.push({original:S,processed:M,startIndex:I})}catch(A){let M=A instanceof Error?A.message:String(A);if(d.debug)console.error(`Error processing custom directive @${n}:`,A);m.push({original:S,processed:c("CustomDirective",`Error in @${n}(${k}): ${M}`,t.EVALUATION_ERROR),startIndex:I})}let b=Rt(`@${n}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[S]=w,k=w.index||0;try{let I=await g("",[],l,a);m.push({original:S,processed:I,startIndex:k})}catch(I){let A=I instanceof Error?I.message:String(I);if(d.debug)console.error(`Error processing custom directive @${n}:`,I);m.push({original:S,processed:c("CustomDirective",`Error in @${n}: ${A}`,t.EVALUATION_ERROR),startIndex:k})}w=b.exec(v)}for(let S=m.length-1;S>=0;S--){let{original:k,processed:I}=m[S];v=v.replace(k,I)}return v}function Dt(s,e){return s.rawParams?Bt(e):vr(e)}function vr(s){if(!s.trim())return[];let e=[],l="",a=!1,d="";for(let n=0;n<s.length;n++){let g=s[n];if((g==='"'||g==="'")&&(n===0||s[n-1]!=="\\"))if(!a)a=!0,d=g;else if(g===d)a=!1;else l+=g;else if(g===","&&!a)e.push(l.trim()),l="";else l+=g}if(l.trim())e.push(l.trim());return e.map((n)=>{let g=n.trim();if(g.startsWith('"')&&g.endsWith('"')||g.startsWith("'")&&g.endsWith("'"))return g.substring(1,g.length-1);return g})}var It=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Ot=/^[A-Za-z_$][\w$]*$/,br=new Set(["light","dark","system"]);function we(s,e){if(typeof s!=="string"||s.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function xr(s){if(!s||typeof s!=="object"||Array.isArray(s))throw Error("@appearanceBootstrap expects an options object");let e=s,{appearance:l,colorMode:a}=e;if(we(e.storageKey,"storageKey"),l!==void 0&&(!l||typeof l!=="object"||Array.isArray(l)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!a||typeof a!=="object"||Array.isArray(a))throw Error("@appearanceBootstrap colorMode must be an object");if(we(a.key,"colorMode.key"),we(a.attribute,"colorMode.attribute"),we(a.default,"colorMode.default"),!Ot.test(a.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!It.test(a.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!br.has(a.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let d=null;if(l){if(we(l.key,"appearance.key"),we(l.attribute,"appearance.attribute"),we(l.default,"appearance.default"),!Ot.test(l.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!It.test(l.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(l.allowed)||l.allowed.length===0||l.allowed.some((n)=>typeof n!=="string"||n.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!l.allowed.includes(l.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");d={key:l.key,attribute:l.attribute,allowed:[...new Set(l.allowed)],default:l.default}}return{storageKey:e.storageKey,appearance:d,colorMode:{key:a.key,attribute:a.attribute,default:a.default},respectExisting:e.respectExisting===!0}}function kr(s){return JSON.stringify(s).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function _r(s){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${kr(s)};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(s,e){let l=1,a=null,d=!1;for(let n=e+1;n<s.length;n++){let g=s[n];if(d){d=!1;continue}if(a){if(g==="\\")d=!0;else if(g===a)a=null;continue}if(g==='"'||g==="'"||g==="`"){a=g;continue}if(g==="(")l++;else if(g===")"&&--l===0)return n}return-1}function Pt(s,e){let l=s,a=/@appearanceBootstrap\s*\(/g,d;while((d=a.exec(l))!==null){let n=d.index+d[0].length-1,g=Cr(l,n);if(g===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=l.slice(n+1,g).trim(),m=u(`(${v})`,e),x=_r(xr(m));l=l.slice(0,d.index)+x+l.slice(g+1),a.lastIndex=d.index+x.length}return l}import Rr from"crypto";function Q(s){return V(String(s??""))}var jt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(s,e,l,a){let d=s||e;return l?`${d} ${a}`:d}function ge(s){return String(s).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ce(s,e){if(/\bid\s*=/i.test(s))return"";return` id="${Q(e)}"`}function et(s,e,l){if(!e)return"";let a="";if(!/\baria-invalid\s*=/i.test(l))a+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(l))a+=` aria-describedby="${Q(`${ge(s)}-error`)}"`;return a}function Mr(){return Rr.randomUUID()}function ze(s,e){let l=s;return l=l.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let a=Mr();e.csrf={token:a}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),l=l.replace(/@method\(['"]([^'"]+)['"]\)/g,(a,d)=>{let n=d.toUpperCase();if(d&&!["GET","POST"].includes(n))return`<input type="hidden" name="_method" value="${Q(n)}">`;return a}),l}function Nt(s,e,l=jt){let a=s;return a=a.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(d,n,g,v,m,x="")=>{let b=n||g||"POST",w=v||m||"",S=he(x),k=b.toUpperCase(),I=["GET","POST"].includes(k)?k:"POST",A=`<form method="${Q(I)}" action="${Q(w)}"${S?` ${S}`:""}>`;if(A+=`
|
|
832
|
+
${ze("@csrf",e)}`,!["GET","POST"].includes(k))A+=`
|
|
833
|
+
${ze(`@method('${k}')`,e)}`;return A}),a=a.replace(/@endform/g,"</form>"),a=a.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(d,n,g,v,m,x="")=>{let b=n||g||"",w=v||m||"",S=he(x),k=Pe(b,e),I=k!==void 0&&k!==null?k:w||"",A=S.match(/type=['"]([^'"]+)['"]/i),M=A?A[1]:"text",D=je(b,e),N=S.match(/class=['"]([^'"]+)['"]/i),H=Ve(N?N[1]:"",l.input,D,l.inputError),U=S.replace(/class=['"][^'"]+['"]/i,"");return U=U.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Q(M)}" name="${Q(b)}"${Ce(S,ge(b))} value="${Q(I)}" class="${H}"${et(b,D,S)}${U?` ${U}`:""}>`}),a=a.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(d,n,g="",v="")=>{let m=he(g),x=Pe(n,e)||v.trim(),b=je(n,e),w=m.match(/class=['"]([^'"]+)['"]/i),S=Ve(w?w[1]:"",l.input,b,l.inputError),k=m.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Q(n)}"${Ce(m,ge(n))} class="${S}"${et(n,b,m)}${k?` ${k}`:""}>${Q(x)}</textarea>`}),a=a.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(d,n,g="",v)=>{let m=he(g),x=Pe(n,e),b=je(n,e),w=m.match(/class=['"]([^'"]+)['"]/i),S=Ve(w?w[1]:"",l.input,b,l.inputError),k=m.replace(/class=['"][^'"]+['"]/i,""),I=v;if(x!==void 0)I=v.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(A,M,D)=>{if((Array.isArray(x)?x.some((H)=>String(H)===D):String(x)===D)&&!M.includes("selected"))return M.replace(/(<option)/,"$1 selected");return A});return`<select name="${Q(n)}"${Ce(m,ge(n))} class="${S}"${et(n,b,m)}${k?` ${k}`:""}>${I}</select>`}),a=a.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(d,n,g,v="")=>{let m=g===void 0?"1":g,x=g===void 0?ge(n):`${ge(n)}-${ge(m)}`,b=he(v),w=Pe(n,e),S=w!==void 0&&(Array.isArray(w)?w.some((M)=>String(M)===m):w===!0||String(w)===m),k=b.match(/class=['"]([^'"]+)['"]/i),I=k?k[1]:l.checkInput,A=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Q(n)}"${Ce(b,x)} value="${Q(m)}" class="${I}"${S?" checked":""}${A?` ${A}`:""}>`}),a=a.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(d,n,g,v="")=>{let m=he(v),x=Pe(n,e),b=x!==void 0&&x===g,w=m.match(/class=['"]([^'"]+)['"]/i),S=w?w[1]:l.checkInput,k=m.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Q(n)}"${Ce(m,`${ge(n)}-${ge(g)}`)} value="${Q(g)}" class="${S}"${b?" checked":""}${k?` ${k}`:""}>`}),a=a.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(d,n,g="")=>{let v=he(g),m=v.match(/accept=['"]([^'"]+)['"]/i),x=m?m[1]:"",b=v.includes("multiple"),w=je(n,e),S=v.match(/class=['"]([^'"]+)['"]/i),k=Ve(S?S[1]:"",l.input,w,l.inputError),I=v.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),A=[`<input type="file" name="${Q(n)}"${Ce(v,ge(n))}`,`class="${k}"`];if(x)A.push(`accept="${Q(x)}"`);if(b)A.push("multiple");if(I)A.push(I);return`${A.join(" ")}>`}),a=a.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(d,n,g="",v)=>{let m=he(g),x=m.match(/class=['"]([^'"]+)['"]/i),b=x?x[1]:l.label,w=m.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Q(ge(n))}" class="${b}"${w?` ${w}`:""}>${v}</label>`}),a}function Ht(s,e,l=jt){return s.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(a,d,n)=>{try{if(je(d,e)){let g=n.replace(/\{\{([^}]+)\}\}/g,(v,m,x)=>{let b=(w)=>Z(n,x,String(w??""),!1,v.length);try{if(m.trim()==="$message"||m.trim()==="message")return b(Lt(d,e));if(m.trim().includes("errors.first")||m.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return b(e.errors.first(d));return b(Lt(d,e))}let w=m.trim();if(f(w)){let S=u(w,e);return S!==void 0?b(S):w}return w}catch{return m}});return`<div id="${Q(`${ge(d)}-error`)}" role="alert">${g}</div>`}return""}catch(g){return console.error("Error processing @error directive:",g),a}})}function je(s,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(s);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,s);return!1}function Lt(s,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(s);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,s)){let l=e.errors[s];return Array.isArray(l)?l[0]:String(l)}return""}function Pe(s,e){let l;if(e.old&&typeof e.old==="function")return e.old(s);if(e.old&&typeof e.old==="object")return e.old[s];if(s.endsWith("[]")){let a=s.slice(0,-2);if(l=e[a],l!==void 0)return l}return e[s]}function he(s){if(!s.trim())return"";let e=[],l=s.trim(),a=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,d;while((d=a.exec(l))!==null){let[,n,,g]=d;e.push(`${n}="${g.trim()}"`)}return e.join(" ")}import*as tt from"path";async function Ft(s,e,l=""){if(tt.basename(l)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,s.replace(/@js[\s\S]*?@endjs/g,"");return Ut(s,e,l,"@js","@endjs")}async function qt(s,e,l=""){if(tt.basename(l)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((n)=>({...n,displayName:`User ${n.id}: ${n.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return s.replace(/@ts[\s\S]*?@endts/g,"")}return Ut(s,e,l,"@ts","@endts")}async function Ut(s,e,l,a,d){let n=s,g=Rt(`${a}([\\s\\S]*?)${d}`,"g"),v=[],m;while((m=g.exec(s))!==null)v.push({fullMatch:m[0],content:m[1]||"",index:m.index});for(let{fullMatch:x,content:b,index:w}of v)try{let S={...e,global:e},k=Object.keys(S),I=Object.values(S),A=b.trim();if(a==="@ts")A=A.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let D=(A.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((j)=>j.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),N=D.length>0?`return { ${D.join(", ")} };`:"return {};",H=`
|
|
834
834
|
${A}
|
|
835
835
|
${N}
|
|
836
|
-
`,O=Function(...
|
|
836
|
+
`,O=Function(...k,H)(...I);if(O&&typeof O==="object")Object.assign(e,O);n=n.replace(x,"")}catch(S){console.error(`Error executing ${a} code block in ${l}:`,S);let k=S instanceof Error?S.message:String(S),I=h(`${a} Directive`,`Error executing code: ${k}`,l,s,w,x);console.error(I),n=n.replace(x,"")}return n}function Dr(s,e="_method"){let l=s.toUpperCase();if(l==="GET"||l==="POST")return"";return`<input type="hidden" name="${e}" value="${l}">`}function Vt(s){return s.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,l,a,d,n)=>Dr(a,n||"_method"))}async function zt(s,e,l,a,d){if(!a.middleware||a.middleware.length===0)return s;let n=s,g=a.middleware.filter((v)=>v.timing===d);if(g.length===0)return n;for(let v of g){if(!v.name||typeof v.handler!=="function"){if(a.debug)console.warn("Invalid middleware:",v);continue}try{let m=await v.handler(n,e,l,a);if(typeof m==="string")n=m;else if(a.debug)console.warn(`Middleware ${v.name} did not return a string`)}catch(m){if(a.debug)console.error(`Error in middleware ${v.name}:`,m);if(a.debug){let x=h("Middleware",`Error in middleware '${v.name}': ${m instanceof Error?m.message:String(m)}`,l,s);n=n.replace(/<body[^>]*>/,`$&
|
|
837
837
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${p(x)}</div>
|
|
838
|
-
`)}}}return n}async function
|
|
839
|
-
`,A=`${
|
|
840
|
-
@endforeach`;e=e.slice(0,w.outerStart)+A+e.slice(w.outerEnd),l=w.outerStart+
|
|
838
|
+
`)}}}return n}async function Wt(s,e,l,a){return zt(s,e,l,a,"before")}async function Xt(s,e,l,a){return zt(s,e,l,a,"after")}function Kt(s){return s.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,l,a,d,n)=>{try{let g=d?R(d,{}):{};return fr(a,g,n==="true")}catch(g){return console.error(`Error processing @route directive: ${g}`),"#route-error"}})}var He={patterns:[],exact:{}};async function Gt(s,e){let l=s.split("/").pop()?.split(".")[0]||"";if(He.exact[s])for(let a of He.exact[s])await Promise.resolve(a(e,s));if(He.exact[l])for(let a of He.exact[l])await Promise.resolve(a(e,s));for(let{pattern:a,callback:d}of He.patterns)if(a.test(s)||a.test(l))await Promise.resolve(d(e,s))}var Ir=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Or=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(s,e){let l=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;l.lastIndex=e;let a=l.exec(s);if(!a)return null;let d=/\/\s*>$/.test(a[0])||a[1]===a[1].toLowerCase()&&Ir.has(a[1]),n=d?a[2].replace(/\/\s*$/,""):a[2];return{full:a[0],tag:a[1],attrs:n,selfClosing:d,start:a.index,end:a.index+a[0].length}}function Pr(s,e,l){let a=1,d=l,n=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),g=new RegExp(`</${e}\\s*>`,"gi");while(a>0&&d<s.length){n.lastIndex=d,g.lastIndex=d;let v=n.exec(s),m=g.exec(s);if(!m)return-1;if(v&&v.index<m.index)a++,d=v.index+v[0].length;else{if(a--,a===0)return m.index+m[0].length;d=m.index+m[0].length}}return-1}function xe(s,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let l=Pr(s,e.tag,e.end);if(l===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:l,innerHTML:s.slice(e.end,l-`</${e.tag}>`.length)}}function Jt(s,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(s)||s.includes(` ${e}=`)||s.includes(` ${e} `)||s.trimEnd().endsWith(` ${e}`)}function Be(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=s.match(new RegExp(`${l}="([^"]*)"`,"s"))||s.match(new RegExp(`${l}='([^']*)'`,"s"));return a?a[1]:null}function ye(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return s.replace(new RegExp(`\\s*${l}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${l}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${l}(?=\\s|$|>|/)`,"g"),"")}function Ae(s,e,l){let a=e.selfClosing?" /":"",d=`<${e.tag}${l}${a}>`;return s.slice(0,e.start)+d+s.slice(e.end)}function Lr(s){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(s)}function jr(s){let e=s,l=0;while(l<e.length){let a=$e(e,l);if(!a)break;let d=Be(a.attrs,"v-for");if(d===null){l=a.end;continue}let n=d.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!n){l=a.end;continue}let g=n[1].trim(),v=n[2].trim(),m;if(g.includes(",")){let M=g.split(",").map((H)=>H.trim()),D=M[0],N=M[1];m=`${v} as ${N} => ${D}`}else m=`${v} as ${g}`;let x=ye(a.attrs,"v-for"),b=ye(x,":key").replace(/\s*v-bind:key="[^"]*"/g,""),w=xe(e,a),S=e.slice(w.outerStart,w.outerEnd),k=Ae(S,{...a,start:0,end:a.end-a.start},b),I=`@foreach(${m})
|
|
839
|
+
`,A=`${I}${k}
|
|
840
|
+
@endforeach`;e=e.slice(0,w.outerStart)+A+e.slice(w.outerEnd),l=w.outerStart+I.length}return e}function Nr(s){let e=s,l=0;while(l<e.length){let a=$e(e,l);if(!a)break;let d=Be(a.attrs,"v-if");if(d===null){l=a.end;continue}let n=[],g=xe(e,a),v=ye(a.attrs,"v-if"),m=Ae(e.slice(g.outerStart,g.outerEnd),{...a,start:0,end:a.end-a.start},v);n.push({type:"if",expr:d,outerStart:g.outerStart,outerEnd:g.outerEnd,element:m,parsedTag:a});let x=g.outerEnd,b=!0;while(b){let A=e.slice(x).match(/^\s*/),M=A?A[0].length:0,D=$e(e,x+M);if(!D){b=!1;break}let N=Be(D.attrs,"v-else-if"),H=Jt(D.attrs,"v-else");if(N!==null){let U=xe(e,D),O=ye(D.attrs,"v-else-if"),j=Ae(e.slice(U.outerStart,U.outerEnd),{...D,start:0,end:D.end-D.start},O);n.push({type:"else-if",expr:N,outerStart:x,outerEnd:U.outerEnd,element:j,parsedTag:D}),x=U.outerEnd}else if(H){let U=xe(e,D),O=ye(D.attrs,"v-else"),j=Ae(e.slice(U.outerStart,U.outerEnd),{...D,start:0,end:D.end-D.start},O);n.push({type:"else",outerStart:x,outerEnd:U.outerEnd,element:j,parsedTag:D}),b=!1}else b=!1}let w=[];for(let A of n)if(A.type==="if")w.push(`@if(${A.expr})
|
|
841
841
|
${A.element}`);else if(A.type==="else-if")w.push(`@elseif(${A.expr})
|
|
842
842
|
${A.element}`);else w.push(`@else
|
|
843
843
|
${A.element}`);w.push("@endif");let S=w.join(`
|
|
844
|
-
`),
|
|
845
|
-
${Ae(
|
|
846
|
-
@endonce`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),l=n.outerStart+m.length}return e}function
|
|
847
|
-
<meta name="stx-build" content="${e}">`}var
|
|
844
|
+
`),k=n[0].outerStart,I=n[n.length-1].outerEnd;e=e.slice(0,k)+S+e.slice(I),l=k+S.length}return e}function Hr(s){return s.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Br(s){let e=s,l=0;while(l<e.length){let a=$e(e,l);if(!a)break;let d=Or.has(a.tag),n=a.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(v,m,x)=>{let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(m);if(!b||!x||!/^["']/.test(x))return v;let w=b[1]||"modelValue",S=b[2];if(d&&!b[1])return`@model${S}=${x}`;let k=x[0],I=x.slice(1,-1),A=`:${w}=${x} @update:${w}=${k}${I} = $event${k}`;if(S){let M=b[1]?`${w}Modifiers`:"modelModifiers",D=S.slice(1).split(".").map((N)=>`${N}: true`).join(", ");A+=` :${M}="{ ${D} }"`}return A});if(n===a.attrs){l=a.end;continue}let g=Ae(a.full,{...a,start:0,end:a.full.length},n);e=e.slice(0,a.start)+g+e.slice(a.end),l=a.start+g.length}return e}function Fr(s){return s.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function qr(s){return s.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Ur(s){let e=s,l=0;while(l<e.length){let a=$e(e,l);if(!a)break;let d=Be(a.attrs,"v-html");if(d===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let n=xe(e,a),g=ye(a.attrs,"v-html"),v=a.selfClosing?" /":"",m=`<${a.tag}${g}${v}>{!! ${d} !!}</${a.tag}>`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),l=n.outerStart+m.length}return e}function Vr(s){let e=s,l=0;while(l<e.length){let a=$e(e,l);if(!a)break;let d=Be(a.attrs,"v-text");if(d===null){l=a.end;continue}if(a.selfClosing){l=a.end;continue}let n=xe(e,a),g=ye(a.attrs,"v-text"),v=a.selfClosing?" /":"",m=`<${a.tag}${g}${v}>{{ ${d} }}</${a.tag}>`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),l=n.outerStart+m.length}return e}function zr(s){return s.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 Wr(s){let e=s,l=0;while(l<e.length){let a=$e(e,l);if(!a)break;if(!Jt(a.attrs,"v-once")){l=a.end;continue}let d=ye(a.attrs,"v-once"),n=xe(e,a),g=e.slice(n.outerStart,n.outerEnd),m=`@once
|
|
845
|
+
${Ae(g,{...a,start:0,end:a.end-a.start},d)}
|
|
846
|
+
@endonce`;e=e.slice(0,n.outerStart)+m+e.slice(n.outerEnd),l=n.outerStart+m.length}return e}function Xr(s){return s.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function Kr(s){return s.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 Zt(s){if(!Lr(s))return s;let e=s;return e=jr(e),e=Nr(e),e=Wr(e),e=Fr(e),e=qr(e),e=Br(e),e=Hr(e),e=Kr(e),e=Ur(e),e=Vr(e),e=zr(e),e=Xr(e),e}function We(s){return s.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"]),Gr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Qt(s,e){let l=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(s),a=l?l[1]:s,d=u(a,e);if(d&&typeof d==="string")return d;let n=a.trim();return nt.has(n)?n:null}function Yt(s){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(s);return e?e[1]:s}function en(s,e,l){let a=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),d=a?`<${s} ${a}>`:`<${s}>`;if(Gr.has(s))return a?`<${s} ${a}>`:`<${s}>`;return`${d}${l}</${s}>`}async function tn(s,e,l,a,d){let n=s,g=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,v=[],m;while((m=g.exec(n))!==null)v.push({full:m[0],expr:m[1],attrs:m[2],slotContent:m[3],index:m.index});for(let x=v.length-1;x>=0;x--){let b=v[x];try{let w=Qt(b.expr,e);if(!w||typeof w!=="string"){let N=`<!-- dynamic component: could not resolve "${We(Yt(b.expr))}" -->`;n=n.slice(0,b.index)+N+n.slice(b.index+b.full.length);continue}if(nt.has(w)){let N=en(w,b.attrs,b.slotContent);n=n.slice(0,b.index)+N+n.slice(b.index+b.full.length);continue}let S=b.attrs.trim(),k={},I=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,A;while((A=I.exec(S))!==null){let N=A[1]||A[2],H=A[3];if(A[1])try{k[N]=u(H,e)}catch{k[N]=H}else k[N]=H}let M=a.componentsDir||"components",D=await Fe(w,k,b.slotContent,M,e,l,a,new Set,d??new Set);n=n.slice(0,b.index)+D+n.slice(b.index+b.full.length)}catch(w){let S=w instanceof Error?w.message:String(w),k=`<!-- dynamic component error: ${We(S)} -->`;n=n.slice(0,b.index)+k+n.slice(b.index+b.full.length)}}return n=await Jr(n,e,l,a,d),n}async function Jr(s,e,l,a,d){let n=s,g=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,v=[],m;while((m=g.exec(n))!==null)v.push({full:m[0],expr:m[1],attrs:m[2],index:m.index});for(let x=v.length-1;x>=0;x--){let b=v[x];try{let w=Qt(b.expr,e);if(!w||typeof w!=="string"){let I=`<!-- dynamic component: could not resolve "${We(Yt(b.expr))}" -->`;n=n.slice(0,b.index)+I+n.slice(b.index+b.full.length);continue}if(nt.has(w)){let I=en(w,b.attrs,"");n=n.slice(0,b.index)+I+n.slice(b.index+b.full.length);continue}let S=a.componentsDir||"components",k=await Fe(w,{},"",S,e,l,a,new Set,d??new Set);n=n.slice(0,b.index)+k+n.slice(b.index+b.full.length)}catch(w){let S=w instanceof Error?w.message:String(w),k=`<!-- dynamic component error: ${We(S)} -->`;n=n.slice(0,b.index)+k+n.slice(b.index+b.full.length)}}return n}var Za="X-STX-Build",rt=Symbol.for("stx.buildId");function ts(){let s=globalThis;if(!s[rt])s[rt]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return s[rt]}function nn(s,e=ts()){if(s.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(s))return null;return`
|
|
847
|
+
<meta name="stx-build" content="${e}">`}var Ro="/_stx/sw.js";function Zr(s){if(typeof s!=="string"||!s.startsWith("/"))return null;let e=[],l=[],a=s.replace(/\/+$/,"").split("/").slice(1).map((d)=>{let n=/^:(\w+)$/.exec(d)||/^\[(\w+)\]$/.exec(d);if(n)return e.push(n[1]),l.push("0"),"([^/]+)";return l.push(d),d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")});if(!e.length)return null;return{path:s,re:`^/${a.join("/")}/?$`,names:e,sample:`/${l.join("/")}`}}function Qr(s){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,l=window;if(l.stxOffline)return;let a=null,d=!1,n=[],g={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>a,onUpdateReady(b){if(g.updateReady)try{b()}catch{}else n.push(b);return()=>{let w=n.indexOf(b);if(w!==-1)n.splice(w,1)}},applyUpdate(){let b=a&&a.waiting;if(!b)return!1;return d=!0,b.postMessage({type:"stx:activate-update",force:!0}),!0}};l.stxOffline=g;let v=(b)=>{if(!b.waiting||!e.controller||g.updateReady)return;g.updateReady=!0;let w=n.splice(0);for(let S of w)try{S()}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(l.stxOffline.reachable=w.reachable!==!1,Number(w.at)>0)l.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(d)d=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&a&&a.waiting)a.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let m=()=>{e.register(s,{scope:"/"}).then((b)=>{a=b;try{e.controller?.postMessage({type:"stx:reachability?"})}catch{}if(b.waiting)v(b),b.waiting.postMessage({type:"stx:activate-update",reason:"load"});b.addEventListener("updatefound",()=>{let w=b.installing;if(!w)return;w.addEventListener("statechange",()=>{if(w.state==="installed")v(b)})})}).catch(()=>{})},x=()=>{let b=(w)=>{setTimeout(w,0)};if(typeof requestAnimationFrame==="function")requestAnimationFrame(()=>b(m));else b(m)};if(!e.controller)if(document.readyState==="complete")x();else addEventListener("load",x);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",x);else x()}function Yr(){let s=`(${Qr.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(s).trim().replace(/;$/,"")}catch{return s}}function es(s,e){if(typeof e==="string"&&e.startsWith("/"))return e==="/"?"/":e.replace(/\/+$/,"");if(!s||!s.startsWith("/"))return null;let l=s.split(/[?#]/)[0].split("/").filter(Boolean)[0];return l?`/${l}`:"/"}var rn=`<script data-stx-offline>${Yr()}</script>`;function Ao(s,e){let l=Number(s.precacheTimeoutMs),a={build:String(e||"dev"),pages:Array.from(new Set((s.pages||[]).filter((d)=>typeof d==="string"&&d.startsWith("/")))),staticPages:(s.staticPages||[]).filter((d)=>typeof d==="string"&&((s.pages||[]).includes(d)||(s.routes||[]).includes(d))),api:s.apiPrefix||"/api/",timeout:Math.max(500,Number(s.networkTimeoutMs)||1500),precacheTimeout:Number.isFinite(l)&&l>0?Math.min(2147483647,Math.max(1,Math.floor(l))):1e4,networkFirst:(s.networkFirst||[]).filter((d)=>typeof d==="string"&&d.startsWith("/")),updateOnColdStart:s.updateOnColdStart===!0,fallback:s.fallback||s.pages&&s.pages[0]||null,fallbackScope:es(s.fallback||s.pages&&s.pages[0]||null,s.fallbackScope),routes:(s.routes||[]).map(Zr).filter(Boolean),exclude:["/_stx/hmr","/_stx/sw.js",...s.exclude||[]],mediaMax:Math.max(10485760,Number(s.mediaMaxBytes)||629145600),assetsMax:Math.max(50,Number(s.assetsMaxEntries)||500)};return`/* stx offline worker, build ${a.build} */
|
|
848
848
|
'use strict';
|
|
849
849
|
var S = ${JSON.stringify(a)};
|
|
850
850
|
var SHELL = 'stx-shell-' + S.build;
|
|
@@ -1548,45 +1548,45 @@ self.addEventListener('fetch', function (event) {
|
|
|
1548
1548
|
event.respondWith(pageResponse(request, event));
|
|
1549
1549
|
}
|
|
1550
1550
|
});
|
|
1551
|
-
`}import
|
|
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 l[
|
|
1551
|
+
`}import De from"path";function sn(s){return s.startsWith("http://")||s.startsWith("https://")||s.startsWith("//")}async function on(s,e,l){try{let a;if(s.startsWith("/")){let d=e;for(let n=0;n<5;n++){let g=De.join(d,s);if(await Bun.file(g).exists())return g;d=De.dirname(d)}a=De.join(e,s)}else if(s.startsWith("./")||s.startsWith("../"))a=De.resolve(e,s);else a=De.resolve(e,s);if(await Bun.file(a).exists())return a;return null}catch{return null}}var an=Symbol.for("stx.inline-assets.import-meta");function is(s,e){if(!s.includes("import.meta"))return;let l=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 l[an]=!0,l}async function cn(s,e,l){let a=s,d=De.dirname(e),n=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,g;while((g=n.exec(a))!==null){let[x,b,w,S]=g;if(sn(w))continue;let k=await on(w,d,e);if(k)try{let I=await Bun.file(k).text();if(l.add(k),w.endsWith(".ts")||w.endsWith(".tsx")){let M=await Bun.build({entrypoints:[k],target:"browser",minify:!0,define:C()});if(M.outputs.length>0)I=await M.outputs[0].text(),is(I,w)}let A=`<script>
|
|
1553
1553
|
// Source: ${w}
|
|
1554
|
-
${
|
|
1555
|
-
</script>`;a=a.replace(x,A),n.lastIndex=0}catch(
|
|
1554
|
+
${I}
|
|
1555
|
+
</script>`;a=a.replace(x,A),n.lastIndex=0}catch(I){if(I?.[an])throw I}}let v=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,m;while((m=v.exec(a))!==null){let[x,b,w,S]=m,k=b+S;if(sn(w))continue;if(/rel=["']stylesheet["']/.test(k)||w.endsWith(".css")){let A=await on(w,d,e);if(A)try{let M=await Bun.file(A).text();l.add(A);let D=`<style>
|
|
1556
1556
|
/* Source: ${w} */
|
|
1557
1557
|
${M}
|
|
1558
|
-
</style>`;a=a.replace(x,
|
|
1559
|
-
`,a+2),a===-1)return-1;a+=1,
|
|
1560
|
-
`){m=-1;break}m++}if(m===-1){a++,
|
|
1561
|
-
`)break;a++}
|
|
1562
|
-
`+s.slice(a,l.start)+s.slice(l.end);let
|
|
1563
|
-
`+n;return n.slice(0,
|
|
1564
|
-
`+n.slice(
|
|
1565
|
-
`),...x.htmlAttrs&&{htmlAttrs:
|
|
1566
|
-
<meta name="stx-layout" content="${
|
|
1567
|
-
<meta name="stx-layout-group" content="${
|
|
1568
|
-
${
|
|
1569
|
-
`+
|
|
1558
|
+
</style>`;a=a.replace(x,D),v.lastIndex=0}catch(M){}}}return a}import st from"path";var cs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ps=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function fs(s,e){if(!e||!s.includes("/"))return s;let l=st.dirname(e);return s.replace(cs,(a,d,n,g)=>{let v=st.resolve(l,g);return`${d}${n}${v.split(st.sep).join("/")}${n}`})}function ln(s,e){if(!e||!s.includes("<script"))return s;return s.replace(ps,(l,a,d,n)=>`${a}${fs(d,e)}${n}`)}var Ee="<!--PARENT_CONTENT_PLACEHOLDER-->";function un(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function $n(s,e){let l=s.length,a=e,d=!0,n=[],g=(v)=>v+9<=l&&s[v]==="<"&&s[v+1]==="/"&&(s[v+2]==="s"||s[v+2]==="S")&&(s[v+3]==="c"||s[v+3]==="C")&&(s[v+4]==="r"||s[v+4]==="R")&&(s[v+5]==="i"||s[v+5]==="I")&&(s[v+6]==="p"||s[v+6]==="P")&&(s[v+7]==="t"||s[v+7]==="T")&&(s[v+8]===">"||/\s/.test(s[v+8]));while(a<l){let v=s[a];if(g(a))return a;if(v==="/"&&s[a+1]==="/"){if(a=s.indexOf(`
|
|
1559
|
+
`,a+2),a===-1)return-1;a+=1,d=!0;continue}if(v==="/"&&s[a+1]==="*"){let m=s.indexOf("*/",a+2);if(m===-1)return-1;a=m+2,d=!0;continue}if(v==="/"&&d){let m=a+1,x=!1;while(m<l){let b=s[m];if(b==="\\"){m+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){m++;break}else if(b===`
|
|
1560
|
+
`){m=-1;break}m++}if(m===-1){a++,d=!1;continue}while(m<l&&/[a-z]/.test(s[m]))m++;a=m,d=!1;continue}if(v==="'"||v==='"'){let m=v;a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]===m){a++;break}if(s[a]===`
|
|
1561
|
+
`)break;a++}d=!1;continue}if(v==="`"){a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}if(n.length===0)d=!1;continue}if(v==="}"&&n.length>0){n.pop(),a++;while(a<l){if(s[a]==="\\"){a+=2;continue}if(s[a]==="`"){a++,d=!1;break}if(s[a]==="$"&&s[a+1]==="{"){n.push(!0),a+=2,d=!0;break}a++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))d=!1;else d=!0;a++}return-1}function En(s,e){let l=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),a=new RegExp(`<script\\b(?=[^>]*\\b${l}(?:\\s|=|/?>))[^>]*>`,"i").exec(s);if(!a)return null;let d=a.index+a[0].length,n=s.indexOf("</script>",d);if(n===-1)return null;let g=s.indexOf(">",n);if(g===-1)return null;return{start:a.index,end:g+1}}var ms=4096;async function it(s,e,l){if(l.buildMode!=="serve"||e.length<ms)return null;let{registerServeModuleBundle:a}=await import("./chunk-ctdw7fh4.js");return`<script ${s} src="${a(e)}"></script>`}async function er(s,e,l,a){try{let{registeredModuleIdsIn:d,buildModuleRegistryScript:n}=await o("stx/client-module-registry",()=>import("./chunk-803qm5tk.js")),g=[],v=await n(d(...s),{minify:_i(e.buildMode,e.minifyClient),collectInputs:g});for(let m of g)l?.add(m);if(a)a.inputs=g,a.code=v??void 0;if(!v)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:m}=await import("./chunk-ctdw7fh4.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${m(v)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${v.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}async function hs(s,e,l,a){let d={modulesTag:null,modulesCode:null,storeTag:null,storeCode:null,composableTag:null,composableCode:null,frameworkScript:null};try{let{getFrameworkComposableScript:S}=await o("stx/framework-composables",()=>import("./chunk-ttqs99jj.js"));d.frameworkScript=await S(s)}catch{}let n=null;try{n=await o("stx/store-loader",()=>import("./chunk-c5tkxjb0.js"))}catch{}let g=e.storesDir,v=!!a.__stx_native_screen||(n?.pageStoresAll()??!0),m=v?"":s.replace(/<script\b[^>]*\bdata-stx-(?:runtime|router|hmr)\b[^>]*>[\s\S]*?<\/script>/gi,""),x=[],b=[],w=null;for(let S=0;S<8;S++){let k=null,I="",A=!1;try{if(n){let H=v?await n.getStoreScript(g).then((U)=>U?{code:U,stores:["*"],functions:null}:null):await n.getStoreScriptFor(g,[m],{reads:n.storesReadInFiles([...x,...b]),runOnce:!0});if(H)k=H.code,I=H.stores.join(","),A=!!H.functions&&!v}}catch{}if(w!==null&&I===w)break;w=I;let M=A?'data-stx-scoped data-stx-run="always" data-stx-stores':"data-stx-stores",D=k?`<script ${M}>${k}</script>`:null;d.storeCode=k,d.storeTag=k?await it(M,k,e)??D:null;let N={};d.modulesTag=await er([s,D],e,l,N),d.modulesCode=N.code??null,x=N.inputs??[],d.composableTag=null,d.composableCode=null,b=[];try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-e5vn76f5.js")),U=e.composablesDir,O=[d.modulesCode??d.modulesTag,D,d.frameworkScript].filter((F)=>F!==null),j=await H(e._layerComposableDirs??U,s,O,b);if(j)d.composableCode=j,d.composableTag=await it('data-stx-scoped data-stx-run="always" data-stx-composables',j,e)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${j}</script>`}catch{}if(v||!n)break}return d}async function ys(s,e,l,a={}){let{withModuleSubstitutes:d,moduleSubstitutionKey:n}=await import("./chunk-1a9h6r9f.js"),g=await import("./chunk-fxnk5ee8.js"),v=e.messages,m=null;if(v&&g.pageMessagesEnabled(e)&&n()===""&&!a.__stx_native_screen)try{m=await g.loadPageMessages(process.cwd(),v)}catch(S){vs(S)}let x=()=>hs(s,e,l,a),b=m?await d(m.stubs,x):await x(),w=null;if(m){let S=g.messageAreasIn(b.modulesCode,b.storeCode,b.composableCode),k=g.pageMessagesScript(m,g.pageLanguages(s,m),S);if(k)w=await it('data-stx-scoped data-stx-run="always" data-stx-messages',k,e)??`<script data-stx-scoped data-stx-run="always" data-stx-messages>${k.replace(/<\/script/gi,"<\\/script")}</script>`}return[w,b.modulesTag,b.storeTag,b.composableTag,b.frameworkScript].filter((S)=>S!==null)}var fn=!1;function vs(s){if(fn)return;fn=!0,console.warn(`[stx] messages: ${s instanceof Error?s.message:String(s)}; pages ship every language`)}function bs(s,e=""){let l=En(s,"data-stx-runtime");if(!l)return s;let a=ir(s);if(a===-1||a===l.start){if(!e)return s;return s.slice(0,l.end)+e+s.slice(l.end)}if(a<l.start)return s.slice(0,a)+s.slice(l.start,l.end)+e+`
|
|
1562
|
+
`+s.slice(a,l.start)+s.slice(l.end);let d=s.slice(l.start,l.end),n=s.slice(0,l.start)+s.slice(l.end),g=ir(n);if(g===-1)return d+e+`
|
|
1563
|
+
`+n;return n.slice(0,g)+d+e+`
|
|
1564
|
+
`+n.slice(g)}function ws(s){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return s.replace(e,(l,a,d)=>{let n=s.slice(0,d);return n.lastIndexOf("<")>n.lastIndexOf(">")?`{{${a}}}`:`{<!--stx-literal-->{${a}}}`})}async function i(s,e,l,a,d){if(a.ssr===!1&&!a.autoShell&&a.buildMode==="spa")return s;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=Se(s,l);let n=!e.__stxProcessingDepth;gn(e);for(let g of a._layerGraph?.configDependencies??[])d.add(g);if(n&&a.runtimeConfig)await wn(e,l,a.runtimeConfig);if(n)jc(e),e.__stx_scope_seq??={n:0,key:js(String(e.__filename??l))},e.__stx_head_injections=xi(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((a.debug||!E()&&!kn())&&l&&l.endsWith(".stx"))Po(s,l);try{return await oe.timeAsync("template-processing",async()=>{let g=await xs(s,e,l,a,d);if(n)g=ci(g);if(n&&a.autoShell&&a.buildMode!=="compile"){let v=_e(a.app?.head,{known:Ar,source:"app.head"}),x=(e.__stx_runtime_head||null)??ki(),b=(e.__stx_head_raw||"").trim(),w,S=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(S)w=S[1].trim(),b=b.replace(S[0],"").trim();let k=e.__sections?.title,I=k?_(k,e,l):void 0,A=x.title||w||I,M=!x.title&&(!!w||!!I),D=x.meta||[],N=new Set(D.map((K)=>ot(K)).filter(Boolean)),H={...v,...A&&{title:A},meta:[...(v.meta||[]).filter((K)=>!N.has(ot(K))),...D],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
1565
|
+
`),...x.htmlAttrs&&{htmlAttrs:el(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},U=Si(g);if(g=$r(g,H,{...M&&{titleIsHtml:!0},...a.app?.colorMode&&{colorMode:a.app.colorMode}},U),U)g=nl(g,v),g=Tr(g,H.htmlAttrs);let O=g.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&g.includes("<head")){let K=O[1],G=Cs(K);g=g.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
|
|
1566
|
+
<meta name="stx-layout" content="${un(K)}">
|
|
1567
|
+
<meta name="stx-layout-group" content="${un(G)}">`)}let j=g.match(/function (__stx_setup_\w+)\(/),F=j?L(g):null;if(j&&F&&!/\bdata-stx=/.test(F.tag)){g=Je(g,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let K=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");g=g.replace(K,"$1")}}if(n){let v=e.__stx_head_injections??xi(),m=tl(g);if(m!==null)v.beforeClose.push(m);let x=nn(g);if(x!==null)v.afterOpen.push(x);if(a.offline?.enabled&&!g.includes("data-stx-offline"))v.beforeClose.push(rn);g=Zc(g,v);let b=a.app?.colorMode;if(b)g=Er(g,b)}if(n)if(En(g,"data-stx-runtime")){let m=await ys(g,a,d,e);g=bs(g,m.map((x)=>`
|
|
1568
|
+
${x}`).join(""))}else{let m=await er([g],a,d);if(m){let x=g.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)g=g.slice(0,x)+m+`
|
|
1569
|
+
`+g.slice(x)}}if(n)g=Qc(g);if(n&&e.__stx_inject_css!==!1)g=await y(g,void 0,a.buildMode==="serve",!0);else if(n)g=pn(g);if(g=g.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),g=ws(g),n&&e.__stx_runtime_config)g=Mt(g,e.__stx_runtime_config);if(n&&!e.__stx_defer_server_data){let v=Sr(e);if(v){let m=/<head\b[^>]*>/i.exec(g),x=m?m.index+m[0].length:0;g=g.slice(0,x)+v+g.slice(x)}}return g})}catch(g){if(g instanceof q)throw g;let v=g instanceof Error?g.message:String(g),m=new ae(`Template processing failed: ${v}`,l,void 0,void 0,s.substring(0,200)+(s.length>200?"...":""));if(B.log(m,{filePath:l,context:e}),xn.logDetailedError(m,{filePath:l,template:s.substring(0,500)}),E()&&!a.debug)console.error(`[stx] ${ce.relative(process.cwd(),l)||l}: ${m.message}`);if(a.debug)throw m;return wi.createFallbackContent("Template Processing",m)}}async function xs(s,e,l,a,d){let n=process.cwd(),g={...a,partialsDir:a.partialsDir&&!ce.isAbsolute(a.partialsDir)?ce.resolve(n,a.partialsDir):a.partialsDir,componentsDir:a.componentsDir&&!ce.isAbsolute(a.componentsDir)?ce.resolve(n,a.componentsDir):a.componentsDir,layoutsDir:a.layoutsDir&&!ce.isAbsolute(a.layoutsDir)?ce.resolve(n,a.layoutsDir):a.layoutsDir},v=g,m=s;await $s(l,e),ks(e,v),m=await ke(()=>Wt(m,e,l,v),m,(O)=>{B.log(O,{filePath:l,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${l}: ${O.message}`)}),m=m.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=pe(m,Ne,(O,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);m=x.output;let b=x.tokens,w=(O)=>b.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,F)=>b[Number(F)]??""),S="\x00STX_ESCAPED_AT\x00",k="\x00STX_ESC_MUSTACHE_OPEN\x00",I="\x00STX_ESC_MUSTACHE_CLOSE\x00";m=m.replace(/@@/g,S),m=m.replace(/@\{\{([\s\S]*?)\}\}/g,(O,j)=>`${k}${j}${I}`),m=Zt(m),m=await cn(m,l,d);let A={};m=ss(m,A);let M={...e.__sections||{}},D="",N=mt(ht(s)),H=/@nolayout\b/.test(m)||N===!1;if(/@nolayout\b/.test(m))m=m.replace(/@nolayout\b\s*/g,"");let U=m.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(U)D=U[1],m=m.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(D=N,!/@section\s*\(/.test(m))m=`@section('content')
|
|
1570
1570
|
${m.trim()}
|
|
1571
|
-
@endsection`}if(!
|
|
1571
|
+
@endsection`}if(!D&&!H&&v.defaultLayout){let O=Sn(m),j=/@section\s*\(/.test(m);if(!O||j){let F="",K=ce.dirname(l),G=v.layoutsDir?ce.dirname(v.layoutsDir):process.cwd();for(let Y=0;Y<20;Y++){let ee=ce.join(K,"_layout.stx");if(await r(ee)){F=ee;break}let te=ce.dirname(K);if(te===K||te.length<G.length)break;K=te}if(F)D=F;else if(v.layoutsDir){let Y=ce.isAbsolute(v.layoutsDir)?v.layoutsDir:ce.resolve(process.cwd(),v.layoutsDir),ee=ce.join(Y,`${v.defaultLayout}.stx`);if(await r(ee))D=ee}if(D&&!j)m=`@section('content')
|
|
1572
1572
|
${m.trim()}
|
|
1573
|
-
@endsection`}}if(
|
|
1573
|
+
@endsection`}}if(D&&m.includes("<script")){let O=X(m),j=O.scripts.map((F)=>mn(F,l)??F);m=wr(O.output,j)}if(m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,j,F)=>(M[j]=F,"")),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,j,F)=>{if(/^(['"]).*\1$/.test(F.trim()))return O;try{let K=u(F.trim(),e);if(K===void 0)return O;let Y=(e.__stx_inline_section_values??=[]).push(K)-1;return M[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return O}}),m=m.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,j,F)=>{if(F.includes("@parent"))M[j]=F.replace("@parent",Ee);else M[j]=F.trim();return""}),e.__sections=M,m=m.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,j,F)=>M[j]||F||""),!("slot"in e)||e.slot===void 0)m=m.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||"");if(m=os(m,A),D){let O=[],j=X(m),F=pe(j.output,dn,(K,G)=>`\x00STX_ORPHAN_STYLE_${G}\x00`);if(m=F.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(K,G,Y)=>{let ee=G==="SCRIPT"?mn(j.scripts[Number(Y)],l):F.tokens[Number(Y)];if(ee)O.push(ee);return""}),O.length>0){let K=O.join(`
|
|
1574
1574
|
`);M.content=M.content?`${M.content}
|
|
1575
|
-
${K}`:K,e.__sections=M}}if(
|
|
1576
|
-
${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${
|
|
1577
|
-
`;if(n=Y(n,e),n=ee(n,e,l),n=
|
|
1575
|
+
${K}`:K,e.__sections=M}}if(D)try{let O;if(ce.isAbsolute(D))O=D,d.add(D);else O=await ke(()=>yn(D,l,g,d),null,()=>{throw new ae(`Failed to resolve layout path: ${D}`,l,void 0,void 0,`Layout referenced from ${l}`)});if(!O){let ee=(re)=>{if(!re)return[];try{let ie=ce.isAbsolute(re)?re:ce.resolve(process.cwd(),re);return gs.readdirSync(ie).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(g.layoutsDir),...ee(g.fallbackLayoutsDir)].filter((re,ie,le)=>le.indexOf(re)===ie).sort(),ue=`Layout not found: ${D} (referenced from ${l})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:g.layoutsDir?`. No .stx layouts found in ${g.layoutsDir}`:"");if(B.log(Error(ue),{layoutPath:D,filePath:l,available:te},"error"),console.error(`[stx] ${ue}`),g.debug)throw new ae(ue,l);return m}let j=await ke(()=>Bun.file(O).text(),"",()=>{throw new ae(`Failed to read layout file: ${O}`,l,void 0,void 0,"Layout content could not be loaded")});j=ln(j,O);let F=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F){if(g.debug)console.log(`Found nested layout: ${F[1]} in ${O}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ie,le,ve)=>(ee[le]=ve.trim(),""));for(let[ie,le]of Object.entries(ee))if(M[ie]&&M[ie].includes(Ee)){let ve=M[ie].indexOf(Ee);M[ie]=M[ie].slice(0,ve)+le+M[ie].slice(ve+Ee.length)}else if(!M[ie])M[ie]=le;let ue={...e,__sections:M},re=`@layout('${F[1]}')${te}`;return await i(re,ue,O,g,d)}let K=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=ss(K,A),Y={};return G=G.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ee,te,ue)=>(Y[te]=ue.trim(),`@slot('${te}')`)),G=G.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(ee,te,ue)=>{if(M[te]){let re=M[te];if(re.includes(Ee)){let ie=Y[te]||"",le=re.indexOf(Ee);re=re.slice(0,le)+ie+re.slice(le+Ee.length)}return re}return ue||""}),G=Ss(G,M),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>M.content||""),G=os(G,A),e.__originalFilePath=l,m=await bn(G,e,O,g,d),m=`<!-- stx-layout: ${D} -->
|
|
1576
|
+
${m}`,w(m)}catch(O){if(O instanceof q)throw O;throw new ae(`Error processing layout ${D}: ${O instanceof Error?O.message:String(O)}`,l)}return w(await bn(m,e,l,g,d))}function Ss(s,e){return s.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(l,a,d)=>{let n=e[a];if(n!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(n))return n}return d||""})}function ks(s,e){if(s.__stx_sfc_mode=!0,s.__stx_options=e,e.buildMode)s.__stx_buildMode=e.buildMode;let l=e.envPrefix||"STX_PUBLIC_",a={};for(let[d,n]of Object.entries(process.env))if(d.startsWith(l)&&n!==void 0)a[d]=n;s.$env=a}async function $s(s,e){await ke(()=>Gt(s,e),void 0,(l)=>{B.log(l,{filePath:s,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${s}: ${l.message}`)})}var at="data-stx-source";function mn(s,e){if(!s)return s;let l=/^<script\b([^>]*)>/i.exec(s);if(!l||!/\bserver\b/.test(l[1])||l[1].includes(at))return s;return`<script ${at}="${encodeURIComponent(e)}"${s.slice(7)}`}function Es(s){let e=new RegExp(`${at}="([^"]*)"`).exec(s);return e?decodeURIComponent(e[1]):void 0}function hn(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function vn(s,e,l){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${hn(s)}</span><span style="display:block;margin-top:4px">${hn(l)}</span></div>`}async function _s(s,e,l,a){let{scanScriptTags:d}=await o("stx/signal-processing",()=>import("./chunk-7z2mebp5.js")),n=[],g=!E()&&!kn();for(let m of d(s)){let x=m.attrs;if(!/\bserver\b/.test(x))continue;let b=m.start+m.fullMatch.indexOf(">")+1,w=$n(s,b);if(w===-1)continue;let S=s.slice(b,w);if(!S.trim())continue;let k=Es(x)??l,I={index:m.start,length:w+9-m.start};try{let{extractVariables:A}=await o("stx/variable-extractor",()=>import("./chunk-jacb7aw1.js"));await A(S,e,k,{preserveExisting:!0,onFailure:(M)=>{if(M.kind==="unknown")return;if(a?.onServerScriptError?.({sourcePath:k,kind:M.kind,message:M.message}),!g)return;n.push({...I,markup:vn(k,M.kind,M.message)})}})}catch(A){let M=A instanceof Error?A:Error(String(A));if(B.log(M,{filePath:k,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${k}: ${M.message}`),g)n.push({...I,markup:vn(k,"unknown",M.message)})}}if(n.length===0)return s;let v=s;for(let m of n.sort((x,b)=>b.index-x.index))v=v.slice(0,m.index)+m.markup+v.slice(m.index+m.length);return v}async function Ts(s,e,l){try{let{interpolateScriptsInTemplate:a}=await o("stx/expressions",()=>import("./chunk-g9efdc5v.js"));return a(s,e,{skipServer:!0})}catch(a){let d=a instanceof Error?a:Error(String(a));return B.log(d,{filePath:l,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${l}: ${d.message}`),s}}async function bn(s,e,l,a,d){let n=s,g=a;if(n=await _s(n,e,l,a),n=await Ft(n,e,l),n=await qt(n,e,l),n=await Ts(n,e,l),n=await At(n,e,l,g),Se(n))n=Bo(n,e),n=ds(n,e),n=us(n,e);n=Fo(n);let{processStreamDirectives:v}=await o("stx/streaming",()=>import("./chunk-w512gnft.js"));n=v(n,e),n=sr(n,e,l,g,!0),n=await tn(n,e,l,g,d),n=await as(n,e,l,g,d),n=ac(n,e,l,g);let{processDeferDirectives:m}=await o("stx/defer",()=>import("./chunk-x1x69g3s.js"));n=m(n,e,l);let{processTeleportDirectives:x}=await o("stx/teleport",()=>import("./chunk-3wxb7mfb.js"));n=x(n,e,l);let{processTransitionDirectives:b,processTransitionAttributes:w}=await o("stx/transitions",()=>import("./chunk-jq1698j4.js"));n=b(n,e,l),n=w(n);let{processErrorBoundaryDirectives:S,stripRenderFailedMarkers:k}=await o("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));n=S(n,e,l),n=k(n);let{processSuspenseDirectives:I}=await o("stx/suspense",()=>import("./chunk-940wny2b.js"));n=I(n,e,l);let{processAsyncDirectives:A}=await o("stx/async-components",()=>import("./chunk-1w5gtkd6.js"));n=A(n,e,l);let{processKeepAliveDirectives:M}=await o("stx/keep-alive",()=>import("./chunk-ak4w2emd.js"));n=M(n,e,l);let{processVirtualListDirectives:D,processVirtualGridDirectives:N,processInfiniteListDirectives:H}=await o("stx/virtual-scrolling",()=>import("./chunk-86cg9qqm.js"));n=D(n,e,l),n=N(n,e,l),n=H(n,e,l);let{processPartialHydrationDirectives:U,processStaticDirectives:O}=await o("stx/partial-hydration",()=>import("./chunk-5x0g7e9y.js"));n=U(n,e,l),n=O(n);let{processComputedDirectives:j,processWatchDirectives:F}=await o("stx/computed",()=>import("./chunk-1xdzcy9d.js"));n=j(n,e,l),n=F(n,e,l);let{processFormValidationDirectives:K}=await o("stx/forms-validation",()=>import("./chunk-qm3jbse5.js"));n=K(n,e,l);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await o("stx/head",()=>import("./chunk-b8dtz3v8.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(n);if(n=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
|
|
1577
|
+
`;if(n=Y(n,e),n=ee(n,e,l),n=Kt(n),n=Do(n,e),n=Ct(n),n=Vt(n),n=await rs(n,e,l,g,d),n=await as(n,e,l,g,d),n=n.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),n=ci(n),n=se(n,e,l),n=ns(n),e.__stxProcessingDepth===1)n=Bc(n,e);if(n=Nc(n,e,{filePath:l,buildMode:g.buildMode}),n=Mo(n,e),n=Lo(n,e),n=ze(n,e),n=Nt(n,e),n=Ht(n,e),n=await wt(n,e,l,g),n=await lc(n,e,l),n=await uc(n,e,l,g),n=dc(n,e,l,g),n=Ko(n,e,l,g),n=Go(n,e,l),n=Xo(n,e,l,g),n=_t(n,e,l,g),n=Ms(n,e),n=Ls(n),n=Dc(n),!g.skipEventDirectives)n=kc(n,e,l);if(n=bt(n,e,l),g.debug){let z=/\bx-data\s*=/.test(n),W=ls(s);if(z&&W)console.warn(`[stx] ${l}: 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.`)}n=
|
|
1580
|
-
</head>`);if(/<head\b[^>]*>/i.test(
|
|
1581
|
-
${
|
|
1579
|
+
Prefer signals (state/derived/effect) for new components.`)}n=nc(n,e),n=await _(n,e,l),n=Mc(n),n=Lc(n),n=ft(n);let{processXElementDirectives:re}=await o("stx/x-element",()=>import("./chunk-zhxdpzga.js"));n=re(n);let ie=e.__originalFilePath||l,le=Me(e);if(n=await zo(n,g,ie,le),n=Pt(n,e),n=await Xt(n,e,l,g),g.media?.image?.autoSiblings){let z=g.publicDir||"public",{rewriteImagesWithSiblings:W}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-13v3vgb6.js"));n=await W(n,{publicDir:z})}if(g.seo?.enabled)n=Jo(n,e,g);let ve=(z,W,J=!0)=>{if(!W)return z;let me=W.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),ne=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(z),fe=ne?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(ne[0]):null;if(me&&ne&&fe){if(J){let Te=ne.index+fe.index;z=z.slice(0,Te)+me[0]+z.slice(Te+fe[0].length)}if(W=W.replace(me[0],"").trim(),!W)return z}if(/<\/head>/i.test(z))return z.replace(/<\/head>/i,`${W}
|
|
1580
|
+
</head>`);if(/<head\b[^>]*>/i.test(z))return z.replace(/(<head\b[^>]*>)/i,`$1
|
|
1581
|
+
${W}`);if(/<html\b[^>]*>/i.test(z))return z.replace(/(<html\b[^>]*>)/i,`$1
|
|
1582
1582
|
<head>
|
|
1583
|
-
${
|
|
1584
|
-
</head>`);return
|
|
1585
|
-
${
|
|
1586
|
-
</script>`;if(n.includes("</head>")){let J=n.indexOf("</head>"),ne=n.slice(0,J).indexOf("<script");if(ne!==-1){let fe=n.slice(0,ne),Te=n.slice(ne);n=fe+
|
|
1587
|
-
`+Te}else n=n.replace("</head>",`${
|
|
1583
|
+
${W}
|
|
1584
|
+
</head>`);return z},{renderHead:_n,getHead:Tn}=await o("stx/head",()=>import("./chunk-b8dtz3v8.js")),Ie=e.__stx_runtime_head??Tn();if(Ie.title||Ie.meta?.length||Ie.link?.length){let z=_n(Ie);if(z)n=ve(n,z)}if(ue.headContent)n=ve(n,ue.headContent,!Ie.title);if(g.csp?.enabled&&g.csp.addMetaTag)n=$t(n,g.csp,e);if(g.analytics?.enabled)n=gt(n,g);if(g.heatmap?.enabled)n=cc(n,g);if(g.pwa?.enabled&&g.pwa.autoInject!==!1){let{injectPwaTags:z}=await o("stx/pwa/inject",()=>import("./chunk-2wq0h5ye.js"));n=z(n,g)}let Cn=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(n),An=/\bSTX\.\w+/.test(n),Rn=/window\.STX\s*=/.test(n);if(Cn&&An&&!Rn){let W=`<script data-stx-scoped data-stx-run="once">
|
|
1585
|
+
${ut()}
|
|
1586
|
+
</script>`;if(n.includes("</head>")){let J=n.indexOf("</head>"),ne=n.slice(0,J).indexOf("<script");if(ne!==-1){let fe=n.slice(0,ne),Te=n.slice(ne);n=fe+W+`
|
|
1587
|
+
`+Te}else n=n.replace("</head>",`${W}
|
|
1588
1588
|
</head>`)}else if(n.includes("<body"))n=n.replace(/<body([^>]*)>/,`<body$1>
|
|
1589
|
-
${
|
|
1590
|
-
`+n}{let{scanScriptTags:
|
|
1591
|
-
`+n.slice(J)}e.__stx_event_bindings=[]}}if(!
|
|
1592
|
-
export{
|
|
1589
|
+
${W}`);else n=W+`
|
|
1590
|
+
`+n}{let{scanScriptTags:z}=await o("stx/signal-processing",()=>import("./chunk-7z2mebp5.js")),W=[];for(let J of z(n)){if(!/\bserver\b/i.test(J.attrs))continue;let me=J.start+J.fullMatch.indexOf(">")+1,ne=$n(n,me);if(ne===-1)continue;let fe=ne+9;while(fe<n.length&&/\s/.test(n[fe]))fe++;W.push({start:J.start,end:fe})}if(W.length>0){let J=Array(W.length+1),me=0;for(let ne=0;ne<W.length;ne++){let{start:fe,end:Te}=W[ne];J[ne]=n.slice(me,fe),me=Te}J[W.length]=n.slice(me),n=J.join("")}}let ct=Ns(n,l);if(ct.hasScoped)n=ct.html;let Mn=e.__stx_event_bindings||[],Xe=!1,lt=[],Dn=/\s:[a-z][\w.-]*\s*=/.test(n),{scanScriptTags:In}=await o("stx/signal-processing",()=>import("./chunk-7z2mebp5.js"));for(let z of In(n,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))lt.push({match:z.fullMatch,attrs:z.attrs,content:z.body});for(let{match:z,attrs:W,content:J}of lt){Xe=!0;let me=J;Oe(J,l,a.strict,e.__originalFilePath);let ne=await Le(J,{eventBindings:Mn,attrs:W,hasColonDirectives:Dn,templateContent:s,filePath:l,projectRoot:process.cwd(),production:_i(a.buildMode,a.minifyClient),serverData:le});n=n.replace(z,()=>ne)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let z=e.__stx_event_bindings||[];if(z.length>0){let W=ni(z);if(W){let J=n.lastIndexOf("</body>");n=J===-1?n+W:n.slice(0,J)+W+`
|
|
1591
|
+
`+n.slice(J)}e.__stx_event_bindings=[]}}if(!be(n)&&sc(n))n=await ar(n,g);if(n=oc(n),g.csp?.enabled&&g.csp.useNonce&&typeof e.cspNonce==="string")n=Et(n,e.cspNonce);return n}
|
|
1592
|
+
export{ht,Re,Za,ts,Ro,Ao,er,i};
|