@stacksjs/stx 0.2.679 → 0.2.682
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-01ks1244.js +2 -0
- package/dist/{chunk-qr7a378v.js → chunk-03xn8244.js} +3 -3
- package/dist/{chunk-ccmc5rqj.js → chunk-0527ytat.js} +2 -2
- package/dist/chunk-0gmwqhs0.js +2 -0
- package/dist/chunk-18jfkg1q.js +2 -0
- package/dist/chunk-1gw26g89.js +31 -0
- package/dist/chunk-1t6dg4s8.js +2 -0
- package/dist/{chunk-n8wvqnfc.js → chunk-1y50gat7.js} +2 -2
- package/dist/chunk-23efje42.js +2 -0
- package/dist/chunk-247fg189.js +2 -0
- package/dist/{chunk-xnx06qqt.js → chunk-2a1eeywj.js} +2 -2
- package/dist/{chunk-hh58k0nh.js → chunk-2ajbhefk.js} +2 -2
- package/dist/{chunk-p9az13b2.js → chunk-2ar5g9pa.js} +2 -2
- package/dist/{chunk-7j7h1eg3.js → chunk-2hh6g3y1.js} +1 -1
- package/dist/chunk-2zepd4ps.js +2 -0
- package/dist/chunk-34ps2w1z.js +2 -0
- package/dist/chunk-3tkag58v.js +2 -0
- package/dist/{chunk-ga5kjf9b.js → chunk-3zbege39.js} +6 -6
- package/dist/{chunk-2933mvwr.js → chunk-42qtadka.js} +10 -10
- package/dist/chunk-47fwr1z7.js +2 -0
- package/dist/{chunk-fzc98qgn.js → chunk-49c5v5fh.js} +6 -6
- package/dist/chunk-4g9wrxkm.js +2 -0
- package/dist/chunk-4m5g3f2b.js +2 -0
- package/dist/{chunk-tx4wfk5v.js → chunk-4z4sqc8q.js} +5 -5
- package/dist/{chunk-6ycyaf5g.js → chunk-58dv14c3.js} +2 -2
- package/dist/{chunk-87em5xdg.js → chunk-5nfb4gxk.js} +82 -82
- package/dist/chunk-5nrqc6v4.js +20 -0
- package/dist/chunk-5rdfcpfe.js +2 -0
- package/dist/{chunk-xyk2zxkk.js → chunk-65jb75vz.js} +2 -2
- package/dist/{chunk-5z8mq37c.js → chunk-6e60jp4a.js} +4 -4
- package/dist/chunk-7jxj6cv1.js +2 -0
- package/dist/{chunk-dnjbzwwn.js → chunk-7yree929.js} +1 -1
- package/dist/chunk-8bwa63m3.js +2 -0
- package/dist/chunk-8d0rqqyx.js +2 -0
- package/dist/chunk-8j0zcyd7.js +2 -0
- package/dist/chunk-8jxqg7kb.js +2 -0
- package/dist/chunk-8nk56cs2.js +2 -0
- package/dist/chunk-8y7tpjfs.js +2 -0
- package/dist/{chunk-q3gactm1.js → chunk-912r15hr.js} +4 -4
- package/dist/chunk-96hkch4q.js +2 -0
- package/dist/{chunk-4fhbh04h.js → chunk-974prn41.js} +4 -4
- package/dist/{chunk-078qg8r5.js → chunk-9bgb9n12.js} +2 -2
- package/dist/chunk-9qx6ansy.js +2 -0
- package/dist/{chunk-tst8p27s.js → chunk-9tg4995v.js} +3 -3
- package/dist/{chunk-sr3hmrah.js → chunk-9wa3t87n.js} +1 -1
- package/dist/{chunk-k06n5bjp.js → chunk-ae12wgc5.js} +3 -3
- package/dist/chunk-b375wt1n.js +2 -0
- package/dist/chunk-b5vqp3b2.js +2 -0
- package/dist/{chunk-vg1pg6yt.js → chunk-b7z6rqfg.js} +1 -1
- package/dist/{chunk-wt7rp7wc.js → chunk-bmqker64.js} +6 -6
- package/dist/{chunk-53e9ta3g.js → chunk-bmv6spcd.js} +4 -4
- package/dist/chunk-bpf3xxng.js +3 -0
- package/dist/{chunk-chy90834.js → chunk-brcj3953.js} +5 -5
- package/dist/chunk-brftzqzj.js +3 -0
- package/dist/chunk-bv43s0gx.js +2 -0
- package/dist/chunk-c9jnkbdb.js +2 -0
- package/dist/{chunk-x7wr720m.js → chunk-d1ssvg9k.js} +5 -5
- package/dist/{chunk-5z0q3qv3.js → chunk-d7js6v1m.js} +5 -5
- package/dist/{chunk-vd5w1jaz.js → chunk-drabexxq.js} +3 -3
- package/dist/{chunk-k72jqz6a.js → chunk-e26pxzjj.js} +2 -2
- package/dist/{chunk-2pvcp0y6.js → chunk-e97xj3rf.js} +6 -6
- package/dist/chunk-ev1tnd36.js +2 -0
- package/dist/{chunk-j388n7v2.js → chunk-f1hxrs7b.js} +17 -17
- package/dist/{chunk-wr1gm35v.js → chunk-f4z9w4kc.js} +1 -1
- package/dist/chunk-f80aqbwm.js +2 -0
- package/dist/chunk-fbbp8j97.js +2 -0
- package/dist/{chunk-26ps9djm.js → chunk-fqts9wvd.js} +5 -5
- package/dist/chunk-fy1waxy0.js +2 -0
- package/dist/chunk-g2v6c7kf.js +2 -0
- package/dist/chunk-g5ep75vp.js +2 -0
- package/dist/{chunk-wejabf6y.js → chunk-g83qeh2x.js} +5 -5
- package/dist/chunk-g9a56wwk.js +2 -0
- package/dist/chunk-gkmh0xys.js +2 -0
- package/dist/{chunk-78yjmbbs.js → chunk-gtktv6nn.js} +2 -2
- package/dist/{chunk-f26n6y9p.js → chunk-gymmbbzc.js} +4 -4
- package/dist/{chunk-48ma0qcr.js → chunk-h3bdqqzy.js} +2 -2
- package/dist/chunk-h5r4c9v5.js +2 -0
- package/dist/{chunk-3xyv2fec.js → chunk-hg7ys8rn.js} +3 -3
- package/dist/{chunk-kxj8e1gd.js → chunk-hm69jxmh.js} +6 -6
- package/dist/{chunk-y4ncmvf2.js → chunk-hwaqwrc2.js} +3 -3
- package/dist/chunk-jecmxby7.js +2 -0
- package/dist/{chunk-a2zb5fgg.js → chunk-jkywbfb0.js} +2 -2
- package/dist/{chunk-haz2ezyk.js → chunk-k3e0hcv7.js} +2 -2
- package/dist/{chunk-drmgwjnb.js → chunk-ka3xmbrd.js} +76 -76
- package/dist/chunk-kerxevf9.js +2 -0
- package/dist/chunk-km37yrk4.js +43 -0
- package/dist/chunk-mdmwgthz.js +2 -0
- package/dist/chunk-myc60z74.js +2 -0
- package/dist/chunk-mzkyw4yx.js +2 -0
- package/dist/{chunk-nb3kkvet.js → chunk-n8jq9yjy.js} +11 -11
- package/dist/{chunk-y34tyrpb.js → chunk-nbjyed3q.js} +7 -7
- package/dist/{chunk-d40zjm6k.js → chunk-np3zdjhr.js} +6 -6
- package/dist/{chunk-wav0xbnb.js → chunk-pfn70zdr.js} +2 -2
- package/dist/{chunk-tbb4en1q.js → chunk-pmma4f1x.js} +4 -4
- package/dist/chunk-pqg3ghvh.js +2 -0
- package/dist/chunk-pvn0fc7j.js +2 -0
- package/dist/{chunk-q4rejyd2.js → chunk-pzxy40a2.js} +2 -2
- package/dist/chunk-q7mpearc.js +2 -0
- package/dist/{chunk-7z7zp8xq.js → chunk-qb806pks.js} +5 -5
- package/dist/{chunk-wscnjtss.js → chunk-qh7fvr2z.js} +2 -2
- package/dist/chunk-r8hszntk.js +2 -0
- package/dist/{chunk-wc5tt6da.js → chunk-remsyfdx.js} +2 -2
- package/dist/chunk-rk8kmshp.js +2 -0
- package/dist/chunk-rs67af2x.js +1592 -0
- package/dist/{chunk-97h9ga3b.js → chunk-rspe6qa5.js} +3 -3
- package/dist/{chunk-78x52gz3.js → chunk-ry501z40.js} +5 -5
- package/dist/chunk-s0wa7zjr.js +2 -0
- package/dist/{chunk-qvefcnyb.js → chunk-se4n8tth.js} +2 -2
- package/dist/chunk-sncp7jhv.js +2 -0
- package/dist/{chunk-jv021x8e.js → chunk-sq4w1e1g.js} +2 -2
- package/dist/chunk-sqvdrk81.js +2 -0
- package/dist/{chunk-9wdd7eq6.js → chunk-t6m5d64b.js} +2 -2
- package/dist/chunk-tdwqwxhf.js +25 -0
- package/dist/{chunk-dera8fmc.js → chunk-tenbwcts.js} +2 -2
- package/dist/chunk-th45zgbz.js +54 -0
- package/dist/{chunk-cxgremn0.js → chunk-tpdvgb3d.js} +1 -1
- package/dist/chunk-tq2m6m3j.js +2 -0
- package/dist/{chunk-aw3jfdca.js → chunk-veh25cv5.js} +1 -1
- package/dist/chunk-vqv5w6gs.js +2 -0
- package/dist/chunk-vt5e25xg.js +2 -0
- package/dist/{chunk-028e9fty.js → chunk-vxnf3xab.js} +2 -2
- package/dist/{chunk-mabja59q.js → chunk-vxrhvrr9.js} +2 -2
- package/dist/{chunk-tmqrbs98.js → chunk-w1wzydvp.js} +8 -5
- package/dist/{chunk-qwdcts9w.js → chunk-w28wc7mv.js} +13 -13
- package/dist/{chunk-yxw8gbnh.js → chunk-wfg5379k.js} +4 -4
- package/dist/chunk-wvz7rp5p.js +2 -0
- package/dist/{chunk-k4x8v39k.js → chunk-xfdfk4g4.js} +2 -2
- package/dist/chunk-xjx1xbey.js +2 -0
- package/dist/{chunk-mn47s2ef.js → chunk-xr9a0hcr.js} +5 -5
- package/dist/{chunk-1b9thkg5.js → chunk-xvnrm5c3.js} +2 -2
- package/dist/{chunk-mf19qxgv.js → chunk-xvs84gas.js} +2 -2
- package/dist/{chunk-8aq07a1j.js → chunk-y55pcfaj.js} +3 -3
- package/dist/{chunk-2hmyj5wh.js → chunk-yhfm939b.js} +2 -2
- package/dist/chunk-ykjzhfyf.js +2 -0
- package/dist/chunk-ypwetty7.js +21 -0
- package/dist/chunk-z4khbpx0.js +2 -0
- package/dist/{chunk-9rs12v0r.js → chunk-z5av310q.js} +9 -9
- package/dist/chunk-zr16mga0.js +2 -0
- package/dist/{chunk-dxh45gve.js → chunk-zt5hp5w5.js} +1 -1
- package/dist/chunk-zwawqx5q.js +2 -0
- package/dist/cli.js +20 -20
- package/dist/client/signals-manifest-hydration-runtime.js +4 -1
- package/dist/component-client-factories.js +14 -3
- package/dist/craft-entry.js +2 -2
- package/dist/craft.js +2 -2
- package/dist/dev-server/serve-app.js +10 -1
- package/dist/pwa.js +3 -3
- package/dist/ssg.js +6 -6
- package/dist/utils.js +13 -1
- package/package.json +5 -5
- package/dist/chunk-0fjwqs9h.js +0 -2
- package/dist/chunk-0gk78x3r.js +0 -2
- package/dist/chunk-0v35wpm7.js +0 -2
- package/dist/chunk-1dkcakve.js +0 -25
- package/dist/chunk-1gg5vxe8.js +0 -2
- package/dist/chunk-1j0sarne.js +0 -21
- package/dist/chunk-248a88mc.js +0 -2
- package/dist/chunk-2nqtmp8c.js +0 -2
- package/dist/chunk-2yzwrvq1.js +0 -2
- package/dist/chunk-3bfegbpw.js +0 -2
- package/dist/chunk-3wsm9g9c.js +0 -2
- package/dist/chunk-3xx9d934.js +0 -2
- package/dist/chunk-52x079ax.js +0 -2
- package/dist/chunk-54zkkxmb.js +0 -2
- package/dist/chunk-5fmxn52y.js +0 -2
- package/dist/chunk-61ww9d2z.js +0 -2
- package/dist/chunk-75zc8w68.js +0 -2
- package/dist/chunk-7b3phzx4.js +0 -2
- package/dist/chunk-8p92r2sc.js +0 -2
- package/dist/chunk-8xr8y9sq.js +0 -2
- package/dist/chunk-909ymsjz.js +0 -2
- package/dist/chunk-ac75vk0w.js +0 -2
- package/dist/chunk-arh1qgmp.js +0 -2
- package/dist/chunk-b0th3d8q.js +0 -888
- package/dist/chunk-bh19ezq0.js +0 -43
- package/dist/chunk-bm42rsaa.js +0 -2
- package/dist/chunk-cfm6a679.js +0 -2
- package/dist/chunk-cwmazy7y.js +0 -2
- package/dist/chunk-e492je6q.js +0 -2
- package/dist/chunk-ft1ht0b3.js +0 -2
- package/dist/chunk-ft3f9nj0.js +0 -2
- package/dist/chunk-ggwvnpwj.js +0 -2
- package/dist/chunk-gx6wxmbv.js +0 -2
- package/dist/chunk-hamk3dky.js +0 -2
- package/dist/chunk-hqj28381.js +0 -3
- package/dist/chunk-k093pr2w.js +0 -2
- package/dist/chunk-kcp392wy.js +0 -2
- package/dist/chunk-kejrhccx.js +0 -2
- package/dist/chunk-kmj127rm.js +0 -2
- package/dist/chunk-kqbpkg8n.js +0 -2
- package/dist/chunk-m0f3strn.js +0 -2
- package/dist/chunk-mjsebtg6.js +0 -2
- package/dist/chunk-n8f0zw1y.js +0 -31
- package/dist/chunk-nadgej53.js +0 -2
- package/dist/chunk-nh3kd03f.js +0 -2
- package/dist/chunk-nw2zh40z.js +0 -2
- package/dist/chunk-p01b07se.js +0 -54
- package/dist/chunk-p99an8rj.js +0 -2
- package/dist/chunk-pgvwysxq.js +0 -2
- package/dist/chunk-pz3mg7hr.js +0 -2
- package/dist/chunk-qyf3jcy1.js +0 -2
- package/dist/chunk-rc79yyqx.js +0 -2
- package/dist/chunk-s8qe247r.js +0 -2
- package/dist/chunk-sswy3tfc.js +0 -2
- package/dist/chunk-swxznm5v.js +0 -2
- package/dist/chunk-t3gmm1ja.js +0 -2
- package/dist/chunk-tsrf4zzy.js +0 -2
- package/dist/chunk-tz09earb.js +0 -2
- package/dist/chunk-vct8a1qf.js +0 -20
- package/dist/chunk-x4q4bx3q.js +0 -3
- package/dist/chunk-xna6b7km.js +0 -2
- package/dist/chunk-xw4rm5zj.js +0 -2
- package/dist/chunk-yar7fwrb.js +0 -2
- package/dist/chunk-yt33wzqk.js +0 -2
- package/dist/chunk-zcbp27x1.js +0 -2
- package/dist/chunk-zq7xbc1k.js +0 -2
package/dist/chunk-b0th3d8q.js
DELETED
|
@@ -1,888 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{To,$a,s,Tt,re,S,Pe,cn,Ie,de,K,cr,ln,gs,Ba,dn,dr,hs,ys,Fa,Oo,za,Ha,Va,Ua,Ne,De,bs,je,n,gn,m,d,H,J,we,k,_}from"./chunk-87em5xdg.js";import{l,p,E,t,ie,V,a,xe,Uo,D,bn,Wo,Lt,qo,rc,mr,sc,rt,oc,hr,ic,vn,Ko,ac,yr,vr,Se,Go}from"./chunk-qwdcts9w.js";import{Nt}from"./chunk-9wdd7eq6.js";import{hn}from"./chunk-wc5tt6da.js";import{h}from"./chunk-wt7rp7wc.js";import{rr,ss}from"./chunk-f26n6y9p.js";import{pa,fa,er,Je,ga,R}from"./chunk-2933mvwr.js";import{bo,vo,wo,xo}from"./chunk-y34tyrpb.js";import{aa,Hr}from"./chunk-chy90834.js";import{jr,Br,Fr}from"./chunk-p01b07se.js";import{Vr,lo,uo,Ur,Wr,po}from"./chunk-1j0sarne.js";import{Lr,Gn}from"./chunk-1dkcakve.js";import{to}from"./chunk-078qg8r5.js";import{ne,oo,io,ao}from"./chunk-xnx06qqt.js";import{Jn,he,la,Yn,ua}from"./chunk-2pvcp0y6.js";import{q,Ge}from"./chunk-a2zb5fgg.js";import{ma,ha}from"./chunk-3xyv2fec.js";import{C,wn,Xo}from"./chunk-hh58k0nh.js";import ds from"fs";import ce from"path";function lt(){return`
|
|
3
|
-
// STX Lifecycle Runtime
|
|
4
|
-
(function() {
|
|
5
|
-
if (typeof window === 'undefined') return;
|
|
6
|
-
|
|
7
|
-
const instances = new Map();
|
|
8
|
-
let currentInstance = null;
|
|
9
|
-
let idCounter = 0;
|
|
10
|
-
|
|
11
|
-
function generateId() {
|
|
12
|
-
return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function createInstance(element) {
|
|
16
|
-
const instance = {
|
|
17
|
-
id: generateId(),
|
|
18
|
-
element: element,
|
|
19
|
-
mountHooks: [],
|
|
20
|
-
destroyHooks: [],
|
|
21
|
-
updateHooks: [],
|
|
22
|
-
refs: new Map(),
|
|
23
|
-
watchers: [],
|
|
24
|
-
isMounted: false
|
|
25
|
-
};
|
|
26
|
-
instances.set(instance.id, instance);
|
|
27
|
-
return instance;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
window.STX = window.STX || {};
|
|
31
|
-
|
|
32
|
-
// Lifecycle hooks
|
|
33
|
-
window.STX.onMount = function(hook) {
|
|
34
|
-
if (currentInstance) currentInstance.mountHooks.push(hook);
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
window.STX.onDestroy = function(hook) {
|
|
38
|
-
if (currentInstance) currentInstance.destroyHooks.push(hook);
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
window.STX.onUpdate = function(hook) {
|
|
42
|
-
if (currentInstance) currentInstance.updateHooks.push(hook);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
// Aliases
|
|
46
|
-
window.STX.onMounted = window.STX.onMount;
|
|
47
|
-
window.STX.onUnmounted = window.STX.onDestroy;
|
|
48
|
-
window.STX.onUpdated = window.STX.onUpdate;
|
|
49
|
-
|
|
50
|
-
// Refs
|
|
51
|
-
window.STX.ref = function(initialValue) {
|
|
52
|
-
const r = { value: initialValue || null };
|
|
53
|
-
Object.defineProperty(r, 'current', {
|
|
54
|
-
get: function() { return this.value; }
|
|
55
|
-
});
|
|
56
|
-
if (currentInstance) {
|
|
57
|
-
currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
|
|
58
|
-
}
|
|
59
|
-
return r;
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// Watch
|
|
63
|
-
window.STX.watch = function(source, callback, options) {
|
|
64
|
-
options = options || {};
|
|
65
|
-
let oldValue;
|
|
66
|
-
let cleanup;
|
|
67
|
-
let isActive = true;
|
|
68
|
-
|
|
69
|
-
function run() {
|
|
70
|
-
if (!isActive) return;
|
|
71
|
-
const newValue = source();
|
|
72
|
-
if (oldValue !== newValue || options.immediate) {
|
|
73
|
-
if (cleanup) cleanup();
|
|
74
|
-
cleanup = callback(newValue, oldValue);
|
|
75
|
-
oldValue = newValue;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (options.immediate) {
|
|
80
|
-
run();
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
oldValue = source();
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const intervalId = setInterval(run, 16);
|
|
87
|
-
|
|
88
|
-
function stop() {
|
|
89
|
-
isActive = false;
|
|
90
|
-
clearInterval(intervalId);
|
|
91
|
-
if (cleanup) cleanup();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (currentInstance) {
|
|
95
|
-
currentInstance.watchers.push({ stop: stop });
|
|
96
|
-
currentInstance.destroyHooks.push(stop);
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return stop;
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// Computed
|
|
103
|
-
window.STX.computed = function(getter) {
|
|
104
|
-
let cached;
|
|
105
|
-
let dirty = true;
|
|
106
|
-
return {
|
|
107
|
-
get value() {
|
|
108
|
-
if (dirty) {
|
|
109
|
-
cached = getter();
|
|
110
|
-
dirty = false;
|
|
111
|
-
queueMicrotask(function() { dirty = true; });
|
|
112
|
-
}
|
|
113
|
-
return cached;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// Component management
|
|
119
|
-
window.STX.setupComponent = function(element, setup) {
|
|
120
|
-
const instance = createInstance(element);
|
|
121
|
-
currentInstance = instance;
|
|
122
|
-
try {
|
|
123
|
-
setup();
|
|
124
|
-
}
|
|
125
|
-
finally {
|
|
126
|
-
currentInstance = null;
|
|
127
|
-
}
|
|
128
|
-
return instance;
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
window.STX.mountComponent = function(instance) {
|
|
132
|
-
if (instance.isMounted) return;
|
|
133
|
-
instance.isMounted = true;
|
|
134
|
-
instance.mountHooks.forEach(function(hook) {
|
|
135
|
-
try {
|
|
136
|
-
const cleanup = hook();
|
|
137
|
-
if (typeof cleanup === 'function') {
|
|
138
|
-
instance.destroyHooks.push(cleanup);
|
|
139
|
-
}
|
|
140
|
-
else if (cleanup && typeof cleanup.then === 'function') {
|
|
141
|
-
cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
catch (e) {
|
|
145
|
-
console.error('[stx] onMount error:', e);
|
|
146
|
-
}
|
|
147
|
-
});
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
window.STX.destroyComponent = function(instance) {
|
|
151
|
-
if (!instance.isMounted) return;
|
|
152
|
-
instance.watchers.forEach(function(w) { w.stop(); });
|
|
153
|
-
instance.destroyHooks.forEach(function(hook) {
|
|
154
|
-
try { hook(); }
|
|
155
|
-
catch (e) { console.error('[stx] onDestroy error:', e); }
|
|
156
|
-
});
|
|
157
|
-
instance.refs.forEach(function(ref) { ref.value = null; });
|
|
158
|
-
instance.isMounted = false;
|
|
159
|
-
instances.delete(instance.id);
|
|
160
|
-
};
|
|
161
|
-
|
|
162
|
-
// ==========================================================================
|
|
163
|
-
// Vue-Style Refs System - No document.** required!
|
|
164
|
-
// ==========================================================================
|
|
165
|
-
|
|
166
|
-
// Internal: Query for ref elements without exposing document API
|
|
167
|
-
function queryRef(name, root) {
|
|
168
|
-
return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function queryAllRefs(root) {
|
|
172
|
-
return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Auto-bind refs from ref attributes (Vue-style)
|
|
176
|
-
window.STX.bindRefs = function(root, refs) {
|
|
177
|
-
if (!root) return;
|
|
178
|
-
queryAllRefs(root).forEach(function(el) {
|
|
179
|
-
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
180
|
-
if (refs[refName]) {
|
|
181
|
-
refs[refName].value = el;
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
// Vue-style useRefs() - returns object with all refs as direct elements
|
|
187
|
-
// Usage: const { input, button, container } = STX.useRefs()
|
|
188
|
-
window.STX.useRefs = function(root) {
|
|
189
|
-
var refs = {};
|
|
190
|
-
queryAllRefs(root).forEach(function(el) {
|
|
191
|
-
var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
|
|
192
|
-
if (refName) {
|
|
193
|
-
refs[refName] = el;
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
return refs;
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
// Get a single ref by name - Vue's useTemplateRef equivalent
|
|
200
|
-
// Usage: const input = STX.useRef('input')
|
|
201
|
-
window.STX.useRef = function(name, root) {
|
|
202
|
-
return queryRef(name, root);
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
// Two-way binding helper for form elements
|
|
206
|
-
// Usage: STX.model(inputEl, state, 'username')
|
|
207
|
-
window.STX.model = function(el, state, key) {
|
|
208
|
-
if (!el || !state) return;
|
|
209
|
-
|
|
210
|
-
var isCheckbox = el.type === 'checkbox';
|
|
211
|
-
var isRadio = el.type === 'radio';
|
|
212
|
-
var isSelect = el.tagName === 'SELECT';
|
|
213
|
-
|
|
214
|
-
// Set initial value
|
|
215
|
-
if (isCheckbox) {
|
|
216
|
-
el.checked = !!state[key];
|
|
217
|
-
}
|
|
218
|
-
else if (isRadio) {
|
|
219
|
-
el.checked = el.value === state[key];
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
el.value = state[key] || '';
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Listen for changes
|
|
226
|
-
var eventType = isCheckbox || isRadio ? 'change' : 'input';
|
|
227
|
-
el.addEventListener(eventType, function() {
|
|
228
|
-
if (isCheckbox) {
|
|
229
|
-
state[key] = el.checked;
|
|
230
|
-
}
|
|
231
|
-
else if (isRadio) {
|
|
232
|
-
if (el.checked) state[key] = el.value;
|
|
233
|
-
}
|
|
234
|
-
else {
|
|
235
|
-
state[key] = el.value;
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
|
|
239
|
-
// Return cleanup function
|
|
240
|
-
return function() {
|
|
241
|
-
el.removeEventListener(eventType, arguments.callee);
|
|
242
|
-
};
|
|
243
|
-
};
|
|
244
|
-
|
|
245
|
-
// Batch event binding helper - cleaner than manual addEventListener
|
|
246
|
-
// Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
|
|
247
|
-
window.STX.on = function(el, event, handler) {
|
|
248
|
-
if (!el) return function() {};
|
|
249
|
-
el.addEventListener(event, handler);
|
|
250
|
-
return function() { el.removeEventListener(event, handler); };
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
// Bind multiple events at once
|
|
254
|
-
// Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
|
|
255
|
-
window.STX.events = function(el, eventMap) {
|
|
256
|
-
if (!el) return function() {};
|
|
257
|
-
var cleanups = [];
|
|
258
|
-
Object.keys(eventMap).forEach(function(event) {
|
|
259
|
-
el.addEventListener(event, eventMap[event]);
|
|
260
|
-
cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
|
|
261
|
-
});
|
|
262
|
-
return function() { cleanups.forEach(function(c) { c(); }); };
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
// ==========================================================================
|
|
266
|
-
// DOM Helpers - Eliminate document.* usage
|
|
267
|
-
// ==========================================================================
|
|
268
|
-
|
|
269
|
-
// Global keyboard event listener
|
|
270
|
-
// Usage: STX.onKey('Escape', () => closeModal())
|
|
271
|
-
window.STX.onKey = function(key, handler, options) {
|
|
272
|
-
var listener = function(e) {
|
|
273
|
-
if (e.key === key) {
|
|
274
|
-
handler(e);
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
document.addEventListener('keydown', listener, options);
|
|
278
|
-
return function() { document.removeEventListener('keydown', listener, options); };
|
|
279
|
-
};
|
|
280
|
-
|
|
281
|
-
// Create element helper
|
|
282
|
-
// Usage: STX.el('div', { class: 'foo' }, 'text content')
|
|
283
|
-
window.STX.el = function(tag, attrs, content) {
|
|
284
|
-
var el = document.createElement(tag);
|
|
285
|
-
if (attrs) {
|
|
286
|
-
Object.keys(attrs).forEach(function(key) {
|
|
287
|
-
if (key === 'class') {
|
|
288
|
-
el.className = attrs[key];
|
|
289
|
-
}
|
|
290
|
-
else if (key.startsWith('on')) {
|
|
291
|
-
el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
|
|
292
|
-
}
|
|
293
|
-
else {
|
|
294
|
-
el.setAttribute(key, attrs[key]);
|
|
295
|
-
}
|
|
296
|
-
});
|
|
297
|
-
}
|
|
298
|
-
if (content) {
|
|
299
|
-
if (typeof content === 'string') {
|
|
300
|
-
el.textContent = content;
|
|
301
|
-
}
|
|
302
|
-
else if (Array.isArray(content)) {
|
|
303
|
-
content.forEach(function(child) { el.appendChild(child); });
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
el.appendChild(content);
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
return el;
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
// Get currently focused element
|
|
313
|
-
// Usage: const focused = STX.activeElement()
|
|
314
|
-
window.STX.activeElement = function() {
|
|
315
|
-
return document.activeElement;
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
// Escape HTML helper
|
|
319
|
-
// Usage: const safe = STX.escapeHtml(userInput)
|
|
320
|
-
window.STX.escapeHtml = function(text) {
|
|
321
|
-
var div = document.createElement('div');
|
|
322
|
-
div.textContent = text;
|
|
323
|
-
return div.innerHTML;
|
|
324
|
-
};
|
|
325
|
-
|
|
326
|
-
// MutationObserver for automatic lifecycle management
|
|
327
|
-
const observer = new MutationObserver(function(mutations) {
|
|
328
|
-
mutations.forEach(function(mutation) {
|
|
329
|
-
// Handle removed nodes
|
|
330
|
-
mutation.removedNodes.forEach(function(node) {
|
|
331
|
-
if (node.nodeType === 1 && node.__stx_instance__) {
|
|
332
|
-
window.STX.destroyComponent(node.__stx_instance__);
|
|
333
|
-
}
|
|
334
|
-
});
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
|
|
338
|
-
// Start observing when DOM is ready
|
|
339
|
-
if (document.readyState === 'loading') {
|
|
340
|
-
document.addEventListener('DOMContentLoaded', function() {
|
|
341
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
observer.observe(document.body, { childList: true, subtree: true });
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
console.log('[stx] Lifecycle runtime initialized');
|
|
349
|
-
})();
|
|
350
|
-
`}function Ke(c){return Symbol(c)}var Ts=Ke("theme"),Cs=Ke("router"),As=Ke("i18n");import*as dt from"crypto";function ut(c){let e=/\$(\w+)\./g,u=[],i;while((i=e.exec(c))!==null)if(!u.includes(i[1]))u.push(i[1]);return u}function In(){return`stx-${dt.randomBytes(4).toString("hex")}`}function On(c){return/\$\w+\./.test(c)}function Pn(c){if(!/\{\{[^}]*\$\w/.test(c)||!/\$\w+\./.test(c))return{html:c,bindings:[],stores:new Set};let e=[],u=new Set,i=/<(\w+)([^>]*?)(\s*\/?>)/g,g=c;return g=g.replace(i,(r,f,v,y)=>{if(["script","style","template"].includes(f.toLowerCase()))return r;if(!v.includes("{{"))return r;let x=[],b=!1,w=v,T=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,A=[...v.matchAll(T)];for(let I of A){let P=I[0],N=I[1],U=I[2];if(On(U)){b=!0;let W=U.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(W){let L=W[1];if(x.push({attr:N,expr:L,fullMatch:P,originalAttr:N}),ut(L).forEach((B)=>u.add(B)),N==="text")w=w.replace(P,"");else if(N==="class")w=w.replace(P,'class=""');else if(N==="disabled"||N==="hidden")w=w.replace(P,"");else w=w.replace(P,`${N}=""`)}}}if(!b)return r;let O=w.match(/\bid\s*=\s*"([^"]+)"/),M;if(O)M=O[1];else M=In(),w=` id="${M}"${w}`;for(let I of x)e.push({elementId:M,attribute:I.attr,expression:I.expr,stores:ut(I.expr)});return`<${f}${w}${y}`}),{html:g,bindings:e,stores:u}}function Ln(c,e){if(c.length===0)return"";let u=Array.from(e),i=`
|
|
351
|
-
<script>
|
|
352
|
-
(function() {
|
|
353
|
-
'use strict';
|
|
354
|
-
|
|
355
|
-
// Wait for stores to be available
|
|
356
|
-
function initBindings() {
|
|
357
|
-
var stores = window.VoideStores;
|
|
358
|
-
if (!stores) {
|
|
359
|
-
setTimeout(initBindings, 10);
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
// Store references for expressions
|
|
364
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
365
|
-
var $state = {};
|
|
366
|
-
`;for(let g of u)i+=` $state.${g} = stores.${g} ? stores.${g}.get() : {};
|
|
367
|
-
`;i+=`
|
|
368
|
-
// Binding update functions
|
|
369
|
-
function updateBindings() {
|
|
370
|
-
`;for(let g of c){let{elementId:r,attribute:f,expression:v}=g,y=v.replace(/\$(\w+)\./g,"$state.$1.");if(f==="text")i+=` (function() {
|
|
371
|
-
var el = document.getElementById('${r}');
|
|
372
|
-
if (el) {
|
|
373
|
-
try {
|
|
374
|
-
el.textContent = ${y};
|
|
375
|
-
}
|
|
376
|
-
catch (e) { console.error('Binding error:', e); }
|
|
377
|
-
}
|
|
378
|
-
})();
|
|
379
|
-
`;else if(f==="html")i+=` (function() {
|
|
380
|
-
var el = document.getElementById('${r}');
|
|
381
|
-
if (el) {
|
|
382
|
-
try {
|
|
383
|
-
el.innerHTML = ${y};
|
|
384
|
-
}
|
|
385
|
-
catch (e) { console.error('Binding error:', e); }
|
|
386
|
-
}
|
|
387
|
-
})();
|
|
388
|
-
`;else if(f==="class")i+=` (function() {
|
|
389
|
-
var el = document.getElementById('${r}');
|
|
390
|
-
if (el) {
|
|
391
|
-
try {
|
|
392
|
-
var value = ${y};
|
|
393
|
-
if (typeof value === 'string') {
|
|
394
|
-
// Dynamic class string - merge with existing static classes
|
|
395
|
-
// eslint-disable-next-line pickier/no-unused-vars
|
|
396
|
-
var staticClasses = el.getAttribute('data-static-class') || el.className;
|
|
397
|
-
if (!el.hasAttribute('data-static-class')) {
|
|
398
|
-
el.setAttribute('data-static-class', el.className);
|
|
399
|
-
}
|
|
400
|
-
el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
|
|
401
|
-
}
|
|
402
|
-
else if (typeof value === 'object') {
|
|
403
|
-
// Object syntax: { 'class-name': condition }
|
|
404
|
-
for (var cls in value) {
|
|
405
|
-
if (value[cls]) {
|
|
406
|
-
el.classList.add(cls);
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
409
|
-
el.classList.remove(cls);
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
catch (e) { console.error('Binding error:', e); }
|
|
415
|
-
}
|
|
416
|
-
})();
|
|
417
|
-
`;else if(f==="show")i+=` (function() {
|
|
418
|
-
var el = document.getElementById('${r}');
|
|
419
|
-
if (el) {
|
|
420
|
-
try {
|
|
421
|
-
el.style.display = (${y}) ? '' : 'none';
|
|
422
|
-
}
|
|
423
|
-
catch (e) { console.error('Binding error:', e); }
|
|
424
|
-
}
|
|
425
|
-
})();
|
|
426
|
-
`;else if(f==="if")i+=` (function() {
|
|
427
|
-
var el = document.getElementById('${r}');
|
|
428
|
-
if (el) {
|
|
429
|
-
try {
|
|
430
|
-
el.style.visibility = (${y}) ? 'visible' : 'hidden';
|
|
431
|
-
}
|
|
432
|
-
catch (e) { console.error('Binding error:', e); }
|
|
433
|
-
}
|
|
434
|
-
})();
|
|
435
|
-
`;else i+=` (function() {
|
|
436
|
-
var el = document.getElementById('${r}');
|
|
437
|
-
if (el) {
|
|
438
|
-
try {
|
|
439
|
-
var value = ${y};
|
|
440
|
-
if (value === false || value === null || value === undefined) {
|
|
441
|
-
el.removeAttribute('${f}');
|
|
442
|
-
}
|
|
443
|
-
else if (value === true) {
|
|
444
|
-
el.setAttribute('${f}', '');
|
|
445
|
-
}
|
|
446
|
-
else {
|
|
447
|
-
el.setAttribute('${f}', value);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
catch (e) { console.error('Binding error:', e); }
|
|
451
|
-
}
|
|
452
|
-
})();
|
|
453
|
-
`}i+=` }
|
|
454
|
-
|
|
455
|
-
// Subscribe to stores and update on changes. Capture the disposers so
|
|
456
|
-
// SPA fragment swaps can tear down old bindings before the next page's
|
|
457
|
-
// runtime takes over \u2014 without this, every navigation between pages
|
|
458
|
-
// using reactive-bindings stacked another subscription on every store,
|
|
459
|
-
// walking detached DOM forever. See stacksjs/stx#1709.
|
|
460
|
-
var _disposers = [];
|
|
461
|
-
`;for(let g of u)i+=` if (stores.${g}) {
|
|
462
|
-
var _unsub_${g} = stores.${g}.subscribe(function(state) {
|
|
463
|
-
$state.${g} = state;
|
|
464
|
-
updateBindings();
|
|
465
|
-
});
|
|
466
|
-
// store.subscribe() may return the disposer (preferred) or void; both
|
|
467
|
-
// are tolerated here.
|
|
468
|
-
if (typeof _unsub_${g} === 'function') _disposers.push(_unsub_${g});
|
|
469
|
-
}
|
|
470
|
-
`;return i+=`
|
|
471
|
-
// Initial update
|
|
472
|
-
updateBindings();
|
|
473
|
-
|
|
474
|
-
// Register this runtime's cleanup so SPA navigation can run it before
|
|
475
|
-
// swapping pages. The router (and any code) can call
|
|
476
|
-
// window.__stxCleanupBindings() to dispose subscriptions; we also wire
|
|
477
|
-
// 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
|
|
478
|
-
function _cleanup() {
|
|
479
|
-
for (var i = 0; i < _disposers.length; i++) {
|
|
480
|
-
try { _disposers[i](); } catch (e) { /* swallow */ }
|
|
481
|
-
}
|
|
482
|
-
_disposers.length = 0;
|
|
483
|
-
}
|
|
484
|
-
if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
|
|
485
|
-
window.__stxBindingsCleanups.push(_cleanup);
|
|
486
|
-
if (!window.__stxCleanupBindings) {
|
|
487
|
-
window.__stxCleanupBindings = function() {
|
|
488
|
-
var fns = window.__stxBindingsCleanups || [];
|
|
489
|
-
for (var i = 0; i < fns.length; i++) {
|
|
490
|
-
try { fns[i](); } catch (e) { /* swallow */ }
|
|
491
|
-
}
|
|
492
|
-
window.__stxBindingsCleanups = [];
|
|
493
|
-
};
|
|
494
|
-
window.addEventListener('popstate', window.__stxCleanupBindings);
|
|
495
|
-
window.addEventListener('beforeunload', window.__stxCleanupBindings);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
|
|
499
|
-
// Start when DOM is ready
|
|
500
|
-
if (document.readyState === 'loading') {
|
|
501
|
-
document.addEventListener('DOMContentLoaded', initBindings);
|
|
502
|
-
}
|
|
503
|
-
else {
|
|
504
|
-
initBindings();
|
|
505
|
-
}
|
|
506
|
-
})();
|
|
507
|
-
</script>
|
|
508
|
-
`,i}function pt(c){let{html:e,bindings:u,stores:i}=Pn(c);if(u.length===0)return c;let g=Ln(u,i),r=e.lastIndexOf("</body>");if(r!==-1)return e.slice(0,r)+g+e.slice(r);return e+g}function jn(c){let e=c.analytics;if(!e?.enabled)return"";switch(e.driver){case"fathom":return Nn(e);case"google-analytics":return Hn(e);case"plausible":return Bn(e);case"self-hosted":return Fn(e);case"custom":return qn(e);default:return""}}function Nn(c){let e=c.fathom;if(!e?.siteId)return"";let u=e.scriptUrl||"https://cdn.usefathom.com/script.js",i=e.defer!==!1?" defer":"",g=[`data-site="${pe(e.siteId)}"`];if(e.honorDnt)g.push('data-honor-dnt="true"');if(e.spa)g.push('data-spa="auto"');if(e.canonical)g.push(`data-canonical="${pe(e.canonical)}"`);if(e.auto===!1)g.push('data-auto="false"');return`
|
|
509
|
-
<!-- Fathom Analytics -->
|
|
510
|
-
<script src="${pe(u)}" ${g.join(" ")}${i}></script>
|
|
511
|
-
`}function Hn(c){let e=c.googleAnalytics;if(!e?.measurementId)return"";let u=pe(e.measurementId),i=e.debug?`gtag('config', '${u}', { 'debug_mode': true });`:"";return`
|
|
512
|
-
<!-- Google Analytics -->
|
|
513
|
-
<script async src="https://www.googletagmanager.com/gtag/js?id=${u}"></script>
|
|
514
|
-
<script>
|
|
515
|
-
window.dataLayer = window.dataLayer || [];
|
|
516
|
-
function gtag(){dataLayer.push(arguments);}
|
|
517
|
-
gtag('js', new Date());
|
|
518
|
-
gtag('config', '${u}');
|
|
519
|
-
${i}
|
|
520
|
-
</script>
|
|
521
|
-
`}function Bn(c){let e=c.plausible;if(!e?.domain)return"";let u=e.scriptUrl||"https://plausible.io/js/script.js",i=[`data-domain="${pe(e.domain)}"`],g=u,r=[];if(e.trackLocalhost)r.push("local");if(e.hashMode)r.push("hash");if(r.length>0&&u==="https://plausible.io/js/script.js")g=`https://plausible.io/js/script.${r.join(".")}.js`;return`
|
|
522
|
-
<!-- Plausible Analytics -->
|
|
523
|
-
<script defer data-domain="${pe(e.domain)}" src="${pe(g)}"></script>
|
|
524
|
-
`}function Fn(c){let e=c.selfHosted;if(!e?.siteId||!e?.apiEndpoint)return"";let u=pe(e.siteId),i=pe(e.apiEndpoint),g=e.honorDnt?'if(n.doNotTrack==="1")return;':"",r=e.trackHashChanges?"w.addEventListener('hashchange',pv);":"",f=e.trackOutboundLinks?`
|
|
525
|
-
d.addEventListener('click',function(e){
|
|
526
|
-
var a=e.target.closest('a');
|
|
527
|
-
if(a&&a.hostname!==location.hostname){
|
|
528
|
-
t('outbound',{url:a.href});
|
|
529
|
-
}
|
|
530
|
-
});`:"";return`
|
|
531
|
-
<!-- Self-Hosted Analytics -->
|
|
532
|
-
<script data-site="${u}" data-api="${i}" defer>
|
|
533
|
-
(function(){
|
|
534
|
-
'use strict';
|
|
535
|
-
var d=document,w=window,n=navigator,s=d.currentScript;
|
|
536
|
-
var site=s.dataset.site,api=s.dataset.api;
|
|
537
|
-
${g}
|
|
538
|
-
var q=[],sid=Math.random().toString(36).slice(2);
|
|
539
|
-
function t(e,p){
|
|
540
|
-
var x=new XMLHttpRequest();
|
|
541
|
-
x.open('POST',api+'/collect',true);
|
|
542
|
-
x.setRequestHeader('Content-Type','application/json');
|
|
543
|
-
x.send(JSON.stringify({
|
|
544
|
-
s:site,sid:sid,e:e,p:p||{},
|
|
545
|
-
u:location.href,r:d.referrer,t:d.title,
|
|
546
|
-
sw:screen.width,sh:screen.height
|
|
547
|
-
}));
|
|
548
|
-
}
|
|
549
|
-
function pv(){t('pageview');}
|
|
550
|
-
${r}
|
|
551
|
-
${f}
|
|
552
|
-
if(d.readyState==='complete')pv();
|
|
553
|
-
else w.addEventListener('load',pv);
|
|
554
|
-
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
555
|
-
})();
|
|
556
|
-
</script>
|
|
557
|
-
`}function qn(c){let e=c.custom;if(!e)return"";if(e.inlineScript)return`
|
|
558
|
-
<!-- Custom Analytics -->
|
|
559
|
-
<script>
|
|
560
|
-
${e.inlineScript}
|
|
561
|
-
</script>
|
|
562
|
-
`;if(!e.scriptUrl)return"";let u=[];if(e.scriptId)u.push(`id="${pe(e.scriptId)}"`);if(e.attributes)for(let[g,r]of Object.entries(e.attributes))u.push(`${pe(g)}="${pe(r)}"`);return`
|
|
563
|
-
<!-- Custom Analytics -->
|
|
564
|
-
<script${u.length>0?` ${u.join(" ")}`:""} src="${pe(e.scriptUrl)}" defer></script>
|
|
565
|
-
`}function ft(c,e){let u=jn(e);if(!u)return c;if(!c.includes("</head>")){let i=c.lastIndexOf("</body>");if(i!==-1)return c.slice(0,i)+u+c.slice(i);return c+u}return c.replace("</head>",`${u}</head>`)}function pe(c){return c.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function gt(c){let e=c.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!e)return null;try{return Function(`return ${e[1]}`)()}catch{return null}}function mt(c){let e=c?.layout;if(e===!1)return!1;return typeof e==="string"&&e.trim()?e.trim():void 0}var Vn=0,zn=0;function ht(c,e){let u=c.match(new RegExp(`${e}\\s*=\\s*"([^"]*)"`,"i"));if(u)return u[1];let i=c.match(new RegExp(`${e}\\s*=\\s*'([^']*)'`,"i"));if(i)return i[1];return null}function Wn(c){let e=[],u=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,i;while((i=u.exec(c))!==null){let[g,r,f]=i,v=i.index,y=ht(f,"x-data");if(!y)continue;let x=`__stx_scope_${Vn++}`,b=ht(f,"x-init"),w=Xn(c,r,v+g.length),T=c.slice(v,w.endIndex),A=Kn(T);e.push({id:x,selector:`[data-stx-scope="${x}"]`,stateExpr:y,initExpr:b,bindings:[],refs:A})}return e}function Xn(c,e,u){let i=1,g=u,r=new RegExp(`<${e}(?:\\s|>)`,"gi"),f=new RegExp(`</${e}>`,"gi"),v=new RegExp(`<${e}[^>]*/\\s*>`,"gi");while(i>0&&g<c.length){r.lastIndex=g,f.lastIndex=g,v.lastIndex=g;let y=r.exec(c),x=f.exec(c),b=v.exec(c);if(b&&b.index<(y?.index??1/0)){g=b.index+b[0].length;continue}if(!x)return{endIndex:c.length};if(y&&y.index<x.index)i++,g=y.index+y[0].length;else{if(i--,i===0)return{endIndex:x.index+x[0].length};g=x.index+x[0].length}}return{endIndex:c.length}}function Kn(c){let e=new Map,u=c.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),i=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,g;while((g=i.exec(u))!==null){let[,r,f]=g,v=Zn(r);e.set(f,v)}return e}function Zn(c){let e=c.match(/\bid\s*=\s*["']([^"']*)["']/);if(e)return e[1];return`__stx_el_${zn++}`}function Qn(){return`
|
|
566
|
-
// STX Reactive Runtime - x-cloak and transition CSS
|
|
567
|
-
(function() {
|
|
568
|
-
var style = document.createElement('style');
|
|
569
|
-
style.textContent = [
|
|
570
|
-
'[x-cloak] { display: none !important; }',
|
|
571
|
-
// Default transition classes
|
|
572
|
-
'.stx-enter { opacity: 0; transform: scale(0.95); }',
|
|
573
|
-
'.stx-enter-start { opacity: 0; transform: scale(0.95); }',
|
|
574
|
-
'.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
|
|
575
|
-
'.stx-enter-to { opacity: 1; transform: scale(1); }',
|
|
576
|
-
'.stx-leave { opacity: 1; transform: scale(1); }',
|
|
577
|
-
'.stx-leave-start { opacity: 1; transform: scale(1); }',
|
|
578
|
-
'.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
|
|
579
|
-
'.stx-leave-to { opacity: 0; transform: scale(0.95); }'
|
|
580
|
-
].join('\\n');
|
|
581
|
-
document.head.appendChild(style);
|
|
582
|
-
})();
|
|
583
|
-
|
|
584
|
-
// STX Reactive Runtime
|
|
585
|
-
/* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
|
|
586
|
-
window.__stx_reactive = (function() {
|
|
587
|
-
'use strict';
|
|
588
|
-
|
|
589
|
-
// Deep reactive proxy that triggers onChange for any mutation
|
|
590
|
-
function reactive(obj, onChange) {
|
|
591
|
-
if (!obj || typeof obj !== 'object') return obj;
|
|
592
|
-
return new Proxy(obj, {
|
|
593
|
-
get(target, prop) {
|
|
594
|
-
const value = target[prop];
|
|
595
|
-
if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
|
|
596
|
-
return reactive(value, onChange);
|
|
597
|
-
}
|
|
598
|
-
return value;
|
|
599
|
-
},
|
|
600
|
-
set(target, prop, value) {
|
|
601
|
-
target[prop] = value;
|
|
602
|
-
onChange(prop, value);
|
|
603
|
-
return true;
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
// Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
|
|
609
|
-
// then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
|
|
610
|
-
function initScope(scopeEl, initialState, bindings, refs, initExpr) {
|
|
611
|
-
// Parse initial state (may contain methods including async init())
|
|
612
|
-
var state;
|
|
613
|
-
try {
|
|
614
|
-
state = new Function('return (' + initialState + ')')();
|
|
615
|
-
} catch (e) {
|
|
616
|
-
console.error('[stx-reactive] Invalid x-data:', initialState, e);
|
|
617
|
-
return;
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
// Build $refs object
|
|
621
|
-
var $refs = {};
|
|
622
|
-
for (var name in refs) {
|
|
623
|
-
if (Object.prototype.hasOwnProperty.call(refs, name)) {
|
|
624
|
-
(function(refName, refId) {
|
|
625
|
-
Object.defineProperty($refs, refName, {
|
|
626
|
-
get: function() { return document.getElementById(refId); }
|
|
627
|
-
});
|
|
628
|
-
})(name, refs[name]);
|
|
629
|
-
}
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
// Extract init method from state if present (Alpine.js convention)
|
|
633
|
-
var initMethod = state.init;
|
|
634
|
-
if (typeof initMethod === 'function') {
|
|
635
|
-
delete state.init;
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
// Make state reactive \u2014 mutations trigger re-render via signals
|
|
639
|
-
var scopeId = scopeEl.getAttribute('data-stx-scope');
|
|
640
|
-
var stx = window.stx;
|
|
641
|
-
|
|
642
|
-
// Create signals for each state property so the signals runtime can track dependencies
|
|
643
|
-
var signalState = {};
|
|
644
|
-
var rawState = {};
|
|
645
|
-
var derivedState = {};
|
|
646
|
-
var accessors = {};
|
|
647
|
-
// A getter must NOT be read here. Reading one calls it, and the old loop did
|
|
648
|
-
// exactly that: the returned value is not a function, so it was wrapped as a
|
|
649
|
-
// plain state() -- a snapshot of the answer at construction time, frozen
|
|
650
|
-
// forever while plain properties beside it updated (#2053). A getter is a
|
|
651
|
-
// derived value, so it is registered as one below, once ctxProxy exists for
|
|
652
|
-
// it to read through.
|
|
653
|
-
var ownDescriptors = Object.getOwnPropertyDescriptors ? Object.getOwnPropertyDescriptors(state) : {};
|
|
654
|
-
for (var key in state) {
|
|
655
|
-
if (Object.prototype.hasOwnProperty.call(state, key)) {
|
|
656
|
-
var descriptor = ownDescriptors[key];
|
|
657
|
-
if (descriptor && typeof descriptor.get === 'function') {
|
|
658
|
-
accessors[key] = descriptor;
|
|
659
|
-
continue;
|
|
660
|
-
}
|
|
661
|
-
if (typeof state[key] === 'function') {
|
|
662
|
-
// Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
|
|
663
|
-
signalState[key] = state[key];
|
|
664
|
-
} else {
|
|
665
|
-
// Data properties \u2014 wrap in signals for reactivity
|
|
666
|
-
signalState[key] = stx.state(state[key]);
|
|
667
|
-
rawState[key] = true;
|
|
668
|
-
}
|
|
669
|
-
}
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
// Create a proxy context that auto-unwraps signals and writes back through them.
|
|
673
|
-
// Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
|
|
674
|
-
var ctx = {};
|
|
675
|
-
var ctxProxy = new Proxy(ctx, {
|
|
676
|
-
get: function(target, prop) {
|
|
677
|
-
if (prop === '$refs') return $refs;
|
|
678
|
-
if (prop === '$el') return scopeEl;
|
|
679
|
-
if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
|
|
680
|
-
var s = signalState[prop];
|
|
681
|
-
if (!s) return undefined;
|
|
682
|
-
if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
|
|
683
|
-
return s.value; // unwrap signal
|
|
684
|
-
}
|
|
685
|
-
if (typeof s === 'function' && !rawState[prop]) {
|
|
686
|
-
return s.bind(ctxProxy); // bind methods to proxy
|
|
687
|
-
}
|
|
688
|
-
return s;
|
|
689
|
-
},
|
|
690
|
-
set: function(target, prop, value) {
|
|
691
|
-
var accessor = derivedState[prop];
|
|
692
|
-
if (accessor) {
|
|
693
|
-
// A getter/setter pair writes through its setter. A getter alone has
|
|
694
|
-
// nowhere to put the value: a derived has no .value setter, so the
|
|
695
|
-
// assignment would be a silent no-op, which is the same class of
|
|
696
|
-
// failure as the stale read this replaces.
|
|
697
|
-
if (typeof accessor.set === 'function') {
|
|
698
|
-
accessor.set.call(ctxProxy, value);
|
|
699
|
-
return true;
|
|
700
|
-
}
|
|
701
|
-
console.warn('[stx-reactive] cannot assign to ' + String(prop) + ': it is a getter in x-data, so its value comes from what it reads. Give it a setter, or make it a plain property.');
|
|
702
|
-
return true;
|
|
703
|
-
}
|
|
704
|
-
var s = signalState[prop];
|
|
705
|
-
if (rawState[prop] && s && typeof s === 'function') {
|
|
706
|
-
s.value = value; // write through signal \u2014 triggers effects
|
|
707
|
-
} else {
|
|
708
|
-
signalState[prop] = value;
|
|
709
|
-
}
|
|
710
|
-
return true;
|
|
711
|
-
},
|
|
712
|
-
has: function(target, prop) {
|
|
713
|
-
return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
|
|
714
|
-
},
|
|
715
|
-
ownKeys: function() {
|
|
716
|
-
return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
|
|
717
|
-
},
|
|
718
|
-
getOwnPropertyDescriptor: function(target, prop) {
|
|
719
|
-
if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
|
|
720
|
-
return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
|
|
721
|
-
}
|
|
722
|
-
return undefined;
|
|
723
|
-
}
|
|
724
|
-
});
|
|
725
|
-
|
|
726
|
-
// Now that ctxProxy exists, a getter becomes a derived that reads through it,
|
|
727
|
-
// so it tracks whatever it touches and recomputes when that changes. derived()
|
|
728
|
-
// is lazy, so nothing is evaluated until a binding actually reads it.
|
|
729
|
-
//
|
|
730
|
-
// Marked rawState as well: that is what makes the proxy unwrap it and what
|
|
731
|
-
// exposes the signal itself to the runtime below, which is where dependency
|
|
732
|
-
// tracking comes from. A getter needs both, exactly like a data property.
|
|
733
|
-
for (var accessorKey in accessors) {
|
|
734
|
-
if (Object.prototype.hasOwnProperty.call(accessors, accessorKey)) {
|
|
735
|
-
(function(name, descriptor) {
|
|
736
|
-
signalState[name] = stx.derived(function() {
|
|
737
|
-
return descriptor.get.call(ctxProxy);
|
|
738
|
-
});
|
|
739
|
-
rawState[name] = true;
|
|
740
|
-
derivedState[name] = descriptor;
|
|
741
|
-
})(accessorKey, accessors[accessorKey]);
|
|
742
|
-
}
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
// Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
|
|
746
|
-
// We need to provide getter/setter descriptors so signals track properly.
|
|
747
|
-
var scopeVars = {};
|
|
748
|
-
for (var k in signalState) {
|
|
749
|
-
if (Object.prototype.hasOwnProperty.call(signalState, k)) {
|
|
750
|
-
if (rawState[k]) {
|
|
751
|
-
// Data: expose the signal directly so expressions trigger dependency tracking
|
|
752
|
-
scopeVars[k] = signalState[k];
|
|
753
|
-
} else {
|
|
754
|
-
// Method: bind to ctxProxy so 'this' works
|
|
755
|
-
scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
|
|
756
|
-
}
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
scopeVars.$refs = $refs;
|
|
760
|
-
scopeVars.$el = scopeEl;
|
|
761
|
-
scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
|
|
762
|
-
|
|
763
|
-
// Register scope \u2014 merge with any existing vars from partial signal scripts
|
|
764
|
-
if (!stx._scopes) stx._scopes = {};
|
|
765
|
-
stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
|
|
766
|
-
|
|
767
|
-
// Store on element for findElementScope
|
|
768
|
-
scopeEl.__stx_scope = scopeVars;
|
|
769
|
-
|
|
770
|
-
// Run init() if present (supports async)
|
|
771
|
-
function runInit() {
|
|
772
|
-
var maybePromise;
|
|
773
|
-
if (initMethod) {
|
|
774
|
-
maybePromise = initMethod.call(ctxProxy);
|
|
775
|
-
}
|
|
776
|
-
if (initExpr) {
|
|
777
|
-
try {
|
|
778
|
-
var keys = Object.keys(scopeVars);
|
|
779
|
-
var vals = keys.map(function(k) { return scopeVars[k]; });
|
|
780
|
-
var fn = new Function(keys.join(','), initExpr);
|
|
781
|
-
var result = fn.apply(ctxProxy, vals);
|
|
782
|
-
if (result && typeof result.then === 'function') maybePromise = result;
|
|
783
|
-
} catch (e) {
|
|
784
|
-
console.warn('[stx-reactive] init expression error:', e);
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
// If init is async, signal updates will trigger effects automatically
|
|
788
|
-
// when init() resolves and sets this.prop = value (writes through signal)
|
|
789
|
-
if (maybePromise && typeof maybePromise.then === 'function') {
|
|
790
|
-
maybePromise.catch(function(e) {
|
|
791
|
-
console.error('[stx-reactive] async init() error:', e);
|
|
792
|
-
});
|
|
793
|
-
}
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
// Run init before the signals runtime processes this scope
|
|
797
|
-
runInit();
|
|
798
|
-
|
|
799
|
-
// Expose for debugging
|
|
800
|
-
scopeEl.__stx_state = ctxProxy;
|
|
801
|
-
scopeEl.__stx_execute = function(stmt, $event, $el) {
|
|
802
|
-
try {
|
|
803
|
-
// Run the statement with the reactive proxy as the lexical scope.
|
|
804
|
-
// Wrapping in a with-block on the proxy makes bare reads/writes go
|
|
805
|
-
// through it (so foo = bar triggers signal.set()) instead of treating
|
|
806
|
-
// each state key as a local function parameter \u2014 bare assignments
|
|
807
|
-
// would otherwise just rebind the local and never reach the signal.
|
|
808
|
-
var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
|
|
809
|
-
fn.call(ctxProxy, $event, $el);
|
|
810
|
-
} catch (e) {
|
|
811
|
-
console.warn('[stx-reactive] execute error:', e);
|
|
812
|
-
}
|
|
813
|
-
};
|
|
814
|
-
}
|
|
815
|
-
|
|
816
|
-
return { initScope: initScope, reactive: reactive };
|
|
817
|
-
})();
|
|
818
|
-
`}function yt(c,e){let u=c.replace(/\{!!([\s\S]*?)!!\}/g,(v,y)=>{try{let x=_(y,e,!0);if(x===void 0)return v;return String(x)}catch{return v}}),i="",g=0,r=null;while(g<u.length){let v=u[g];if(r&&v==="\\"){i+=v+(u[g+1]??""),g+=2;continue}if(v==="{"&&u[g+1]==="{"){let y=u.indexOf("}}",g+2);if(y!==-1){let x=u.slice(g,y+2);i+=f(u.slice(g+2,y),x,r),g=y+2;continue}}if(r){if(v===r)r=null}else if(v==="'"||v==='"'||v==="`")r=v;i+=v,g++}return i;function f(v,y,x){let b;try{b=_(v,e,!0)}catch{return y}if(b===void 0)return y;if(x){let w=String(b).replace(/\\/g,"\\\\").replace(new RegExp(x==="`"?"`":x,"g"),`\\${x}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return x==="`"?w.replace(/\$\{/g,"\\${"):w}if(typeof b==="string"){let w=b.trim();if(w.startsWith("{")&&w.endsWith("}")||w.startsWith("[")&&w.endsWith("]"))try{return JSON.parse(w),w}catch{}}return JSON.stringify(b)}}function tr(c,e){if(c.length===0)return"";let u=c.map((i)=>{let g=JSON.stringify(Object.fromEntries(i.refs)),r=yt(i.stateExpr,e),f=i.initExpr?yt(i.initExpr,e):null,v=JSON.stringify(r),y=f?JSON.stringify(f):"null";return`
|
|
819
|
-
(function() {
|
|
820
|
-
var scopeEl = document.querySelector('${i.selector}');
|
|
821
|
-
if (!scopeEl) return;
|
|
822
|
-
var refs = ${g};
|
|
823
|
-
__stx_reactive.initScope(scopeEl, ${v}, [], refs, ${y});
|
|
824
|
-
})();`}).join(`
|
|
825
|
-
`);return`
|
|
826
|
-
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
827
|
-
${Qn()}
|
|
828
|
-
${u}
|
|
829
|
-
</script>`}function vt(c,e,u){if(!sr(c))return c;let i=Wn(c);if(i.length===0)return c;let g=nr(c,i),r=tr(i,e),f=g.lastIndexOf("</body>");if(f!==-1)g=g.slice(0,f)+r+`
|
|
830
|
-
`+g.slice(f);else g+=r;return g}function nr(c,e){let u=0,i=c.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(g,r,f)=>{let v=e[u++];if(!v)return g;let y=/data-stx-scope="([^"]*)"/.exec(f);if(y)return v.id=y[1],v.selector=`[data-stx-scope="${v.id}"]`,g;return`<${r} data-stx-scope="${v.id}"${f}>`});return i=i.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),i=i.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),i=i.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),i=i.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),i}function sr(c){return/x-data\s*=\s*["']/.test(c)}import ir from"fs";import Ze from"path";import{createHighlighter as or}from"ts-syntax-highlighter";var Qe=new Map;async function $e(c,e={}){try{if(!await n(c))throw Error(`Markdown file not found: ${c}`);let i=(await ir.promises.stat(c)).mtime.getTime();if(e.cache&&Qe.has(c)){let w=Qe.get(c);if(w.updatedAt>=i)return{content:w.content,data:w.data}}let g=await Bun.file(c).text(),{data:r,content:f}=er(g),v=e.markdown||R.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},x=Je(f,{gfm:!0});if(v.syntaxHighlighting?.enabled&&v.syntaxHighlighting?.serverSide)x=await ar(x,v.syntaxHighlighting?.defaultTheme||"github-dark",v.syntaxHighlighting?.highlightUnknownLanguages||!1);let b={content:x,data:r||{}};if(e.cache)Qe.set(c,{...b,updatedAt:i});return b}catch(u){if(e.debug)console.error(`Error reading/parsing markdown file ${c}:`,u);let i=u instanceof Error?u.message:String(u);return{content:m("Markdown File",`Error reading/parsing markdown file: ${i}`,c,"",0,""),data:{}}}}var qe=null;async function ar(c,e,u){let i=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!qe)try{qe=await or({theme:e||"github-dark",cache:!0})}catch(v){return console.error("Failed to initialize ts-syntax-highlighter:",v),c}let g=async(v,y,x,b)=>{let w=b.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),T=x||(u?"text":"");if(!T)return v;try{if(!qe.getSupportedLanguages().includes(T))return v;return(await qe.highlight(w,T,{theme:e})).html}catch(A){console.error(`Error highlighting code block with language ${x}:`,A)}return v},r=c,f=c.matchAll(i);for(let v of f){let[y,x,b,w]=v,T=await g(y,x,b,w);r=r.replace(y,T)}return r}async function bt(c,e,u="",i={}){return await lr(c,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(f,v,y,x)=>{try{let b=v;if(!Ze.isAbsolute(v))b=Ze.resolve(Ze.dirname(u),v);let w={};if(y)try{try{w=JSON.parse(y)}catch{if(i.debug)console.warn("Using safer alternative for parsing JS object literal");let N=y.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let U of N){let W=U.indexOf(":");if(W>0){let L=U.substring(0,W).trim(),j=U.substring(W+1).trim(),B=j.startsWith('"')&&j.endsWith('"'),X=j.startsWith("'")&&j.endsWith("'");if(B||X)j=j.substring(1,j.length-1);w[L]=j}}}}catch(P){if(i.debug)console.error("Error parsing context in @markdown-file directive:",P)}let{content:T,data:A}=await $e(b,i),O={...e,...A,...w},M=T,I=/\{\{([^}]+)\}\}/g;return M=M.replace(I,(P,N)=>{let U=N.trim();return O[U]!==void 0?String(O[U]):P}),M}catch(b){let w=b instanceof Error?b.message:String(b);return m("Markdown File",`Error including markdown file: ${w}`,u,c,x,f)}})}async function lr(c,e,u){let i=[],g;while((g=e.exec(c))!==null){let v=g[0],y=g.index,x=g;i.push(u(...x).then((b)=>({match:v,replacement:b,index:y})))}let r=await Promise.all(i);r.sort((v,y)=>y.index-v.index);let f=c;for(let{match:v,replacement:y}of r)f=f.replace(v,()=>y);return f}var wt=new WeakMap;function xt(c=16){let e=new Uint8Array(c);return crypto.getRandomValues(e),btoa(String.fromCharCode(...e))}function Ue(c,e){if(!c)return e?.nonceGenerator?.()??xt();let u=wt.get(c);if(!u)u=e?.nonceGenerator?.()??xt(),wt.set(c,u);return u}function ur(c,e){let u=[];for(let[i,g]of Object.entries(c)){if(g===void 0||g===null)continue;if(typeof g==="boolean"){if(g)u.push(i);continue}if(Array.isArray(g)){let r=[...g];if(e&&(i==="script-src"||i==="style-src"))r=r.filter((f)=>!f.startsWith("'nonce-")),r.push(`'nonce-${e}'`);if(r.length>0)u.push(`${i} ${r.join(" ")}`)}}return u.join("; ")}function kt(c,e){return`<meta http-equiv="Content-Security-Policy" content="${ur(c,e).replace(/&/g,"&").replace(/"/g,""")}">`}function St(c,e,u){if(!e.enabled||!e.addMetaTag)return c;if(c.includes('http-equiv="Content-Security-Policy"'))return c;if(!c.includes("<head>")&&!c.includes("<head "))return c;let i=e.useNonce?Ue(u,e):void 0,g=kt(e.directives,i);return c.replace(/<head([^>]*)>/,`<head$1>
|
|
831
|
-
${g}`)}function $t(c,e){let u=c;return u=u.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(i,g)=>{if(g.includes("nonce="))return i;return`<script nonce="${e}"${g}>`}),u=u.replace(/<style([^>]*)>/gi,(i,g)=>{if(g.includes("nonce="))return i;return`<style nonce="${e}"${g}>`}),u}function Et(c,e,u,i){let g=c,r=i.csp;if(g=g.replace(/@csp\b/g,()=>{if(!r?.enabled||!r.directives)return"<!-- CSP not configured -->";let f=r.useNonce?Ue(e,r):void 0;return kt(r.directives,f)}),g=g.replace(/@cspNonce\b/g,()=>{if(!r?.enabled||!r.useNonce)return"";return Ue(e,r)}),r?.enabled&&r.useNonce)e.cspNonce=Ue(e,r);return g}import pr from"crypto";var fr=40,_t="_token",Ye=null;function gr(c=fr){let e=pr.randomBytes(Math.ceil(c/2)).toString("hex").slice(0,c);return Ye=e,e}function br(){if(!Ye)gr();return Ye}function wr(c=_t){let e=br();return`<input type="hidden" name="${c}" value="${e}">`}function Ct(c){return c.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(e,u,i)=>wr(i||_t))}async function At(c,e,u,i){if(!i.customDirectives||i.customDirectives.length===0)return c;let g=c;for(let r of i.customDirectives){if(!r.name||typeof r.handler!=="function"){if(i.debug)console.warn("Invalid custom directive:",r);continue}if(r.hasEndTag)g=await xr(g,r,e,u,i);else g=await kr(g,r,e,u,i)}return g}async function xr(c,e,u,i,g){let{name:r,handler:f}=e,v=`@${r}`,y=`@end${r}`,x=c,b=Tt(`${v}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${y}`,"g"),w=[],T=b.exec(x);while(T!==null){let[A,O="",M=""]=T,I=T.index||0;try{let P=O?Rt(e,O):[],N=M.trim(),U=await f(N,P,u,i);w.push({original:A,processed:U,startIndex:I})}catch(P){let N=P instanceof Error?P.message:String(P);if(g.debug)console.error(`Error processing custom directive @${r}:`,P);w.push({original:A,processed:a("CustomDirective",`Error in @${r}${O?`(${O})`:""}: ${N}`,t.EVALUATION_ERROR),startIndex:I})}T=b.exec(x)}for(let A=w.length-1;A>=0;A--){let{original:O,processed:M}=w[A];x=x.replace(O,M)}return x}async function kr(c,e,u,i,g){let{name:r,handler:f}=e,v=c,y=[],x=[];if(e.rawParams){for(let T of Wo(v,Tt(`(?<![\\w$@])@${r}\\s*\\(`,"g")))if(T.end!==-1)x.push({fullMatch:T.call,paramString:T.args,startIndex:T.start})}else{let T=Tt(`@${r}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g");T.lastIndex=0;let A=T.exec(v);while(A!==null)x.push({fullMatch:A[0],paramString:A[1]??"",startIndex:A.index||0}),A=T.exec(v)}for(let{fullMatch:T,paramString:A,startIndex:O}of x)try{let M=Rt(e,A),I=await f("",M,u,i);y.push({original:T,processed:I,startIndex:O})}catch(M){let I=M instanceof Error?M.message:String(M);if(g.debug)console.error(`Error processing custom directive @${r}:`,M);y.push({original:T,processed:a("CustomDirective",`Error in @${r}(${A}): ${I}`,t.EVALUATION_ERROR),startIndex:O})}let b=Tt(`@${r}(?!\\w)(?!\\s*\\()`,"g"),w=b.exec(v);while(w!==null){let[T]=w,A=w.index||0;try{let O=await f("",[],u,i);y.push({original:T,processed:O,startIndex:A})}catch(O){let M=O instanceof Error?O.message:String(O);if(g.debug)console.error(`Error processing custom directive @${r}:`,O);y.push({original:T,processed:a("CustomDirective",`Error in @${r}: ${M}`,t.EVALUATION_ERROR),startIndex:A})}w=b.exec(v)}for(let T=y.length-1;T>=0;T--){let{original:A,processed:O}=y[T];v=v.replace(A,O)}return v}function Rt(c,e){return c.rawParams?Lt(e):Sr(e)}function Sr(c){if(!c.trim())return[];let e=[],u="",i=!1,g="";for(let r=0;r<c.length;r++){let f=c[r];if((f==='"'||f==="'")&&(r===0||c[r-1]!=="\\"))if(!i)i=!0,g=f;else if(f===g)i=!1;else u+=f;else if(f===","&&!i)e.push(u.trim()),u="";else u+=f}if(u.trim())e.push(u.trim());return e.map((r)=>{let f=r.trim();if(f.startsWith('"')&&f.endsWith('"')||f.startsWith("'")&&f.endsWith("'"))return f.substring(1,f.length-1);return f})}var Mt=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,Dt=/^[A-Za-z_$][\w$]*$/,$r=new Set(["light","dark","system"]);function ke(c,e){if(typeof c!=="string"||c.length===0)throw Error(`@appearanceBootstrap ${e} must be a non-empty string`)}function Er(c){if(!c||typeof c!=="object"||Array.isArray(c))throw Error("@appearanceBootstrap expects an options object");let e=c,{appearance:u,colorMode:i}=e;if(ke(e.storageKey,"storageKey"),u!==void 0&&(!u||typeof u!=="object"||Array.isArray(u)))throw Error("@appearanceBootstrap appearance must be an object when given");if(!i||typeof i!=="object"||Array.isArray(i))throw Error("@appearanceBootstrap colorMode must be an object");if(ke(i.key,"colorMode.key"),ke(i.attribute,"colorMode.attribute"),ke(i.default,"colorMode.default"),!Dt.test(i.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(i.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!$r.has(i.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");let g=null;if(u){if(ke(u.key,"appearance.key"),ke(u.attribute,"appearance.attribute"),ke(u.default,"appearance.default"),!Dt.test(u.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!Mt.test(u.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(u.allowed)||u.allowed.length===0||u.allowed.some((r)=>typeof r!=="string"||r.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!u.allowed.includes(u.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");g={key:u.key,attribute:u.attribute,allowed:[...new Set(u.allowed)],default:u.default}}return{storageKey:e.storageKey,appearance:g,colorMode:{key:i.key,attribute:i.attribute,default:i.default},respectExisting:e.respectExisting===!0}}function _r(c){return JSON.stringify(c).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Tr(c){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${_r(c)};const root=document.documentElement;const MODES=["light","dark","system"];let format="json";const forced=(function(){const found={colorMode:null,appearance:null};if(!config.respectExisting)return found;try{const mode=root.getAttribute("data-"+config.colorMode.attribute);if(mode==="light"||mode==="dark")found.colorMode=mode;if(config.appearance){const name=root.getAttribute("data-"+config.appearance.attribute);if(config.appearance.allowed.includes(name))found.appearance=name}}catch{}return found}());function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);if(raw){let parsed=null;try{parsed=JSON.parse(raw)}catch{parsed=raw}if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed)){stored=parsed;format="json"}else if(typeof parsed==="string"&&MODES.includes(parsed)){stored={};stored[config.colorMode.key]=parsed;format="string"}}}catch{}return stored}function write(stored){try{if(format==="string"&&!config.appearance)localStorage.setItem(config.storageKey,stored[config.colorMode.key]);else localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();const state={colorMode:forced.colorMode||(MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default)};if(config.appearance)state.appearance=forced.appearance||(config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default);return state}function prefersDark(){try{return matchMedia("(prefers-color-scheme: dark)").matches}catch{return false}}function apply(){const state=resolve();const dark=state.colorMode==="dark"||(state.colorMode==="system"&&prefersDark());if(config.appearance)root.setAttribute("data-"+config.appearance.attribute,state.appearance);root.setAttribute("data-"+config.colorMode.attribute,state.colorMode);root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light";state.dark=dark;try{window.dispatchEvent(new CustomEvent("stx:appearance",{detail:state}))}catch{}return state}function store(key,allowed,value){if(allowed.includes(value)){const stored=read();stored[key]=value;write(stored)}return apply()}window.__stxAppearance={config:config,forced:forced,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return config.appearance?store(config.appearance.key,config.appearance.allowed,name):apply()},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function Cr(c,e){let u=1,i=null,g=!1;for(let r=e+1;r<c.length;r++){let f=c[r];if(g){g=!1;continue}if(i){if(f==="\\")g=!0;else if(f===i)i=null;continue}if(f==='"'||f==="'"||f==="`"){i=f;continue}if(f==="(")u++;else if(f===")"&&--u===0)return r}return-1}function It(c,e){let u=c,i=/@appearanceBootstrap\s*\(/g,g;while((g=i.exec(u))!==null){let r=g.index+g[0].length-1,f=Cr(u,r);if(f===-1)throw Error("@appearanceBootstrap has an unclosed options object");let v=u.slice(r+1,f).trim(),y=l(`(${v})`,e),x=Tr(Er(y));u=u.slice(0,g.index)+x+u.slice(f+1),i.lastIndex=g.index+x.length}return u}import Ar from"crypto";function Q(c){return H(String(c??""))}var Pt={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function Ve(c,e,u,i){let g=c||e;return u?`${g} ${i}`:g}function ge(c){return String(c).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function Ae(c,e){if(/\bid\s*=/i.test(c))return"";return` id="${Q(e)}"`}function et(c,e,u){if(!e)return"";let i="";if(!/\baria-invalid\s*=/i.test(u))i+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(u))i+=` aria-describedby="${Q(`${ge(c)}-error`)}"`;return i}function Rr(){return Ar.randomUUID()}function ze(c,e){let u=c;return u=u.replace(/@csrf/g,()=>{if(!e.csrf||typeof e.csrf!=="object"){let i=Rr();e.csrf={token:i}}if(e.csrf.field)return e.csrf.field;if(e.csrf.token)return`<input type="hidden" name="_token" value="${Q(e.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),u=u.replace(/@method\(['"]([^'"]+)['"]\)/g,(i,g)=>{let r=g.toUpperCase();if(g&&!["GET","POST"].includes(r))return`<input type="hidden" name="_method" value="${Q(r)}">`;return i}),u}function jt(c,e,u=Pt){let i=c;return i=i.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(g,r,f,v,y,x="")=>{let b=r||f||"POST",w=v||y||"",T=ye(x),A=b.toUpperCase(),O=["GET","POST"].includes(A)?A:"POST",M=`<form method="${Q(O)}" action="${Q(w)}"${T?` ${T}`:""}>`;if(M+=`
|
|
832
|
-
${ze("@csrf",e)}`,!["GET","POST"].includes(A))M+=`
|
|
833
|
-
${ze(`@method('${A}')`,e)}`;return M}),i=i.replace(/@endform/g,"</form>"),i=i.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(g,r,f,v,y,x="")=>{let b=r||f||"",w=v||y||"",T=ye(x),A=Le(b,e),O=A!==void 0&&A!==null?A:w||"",M=T.match(/type=['"]([^'"]+)['"]/i),I=M?M[1]:"text",P=He(b,e),N=T.match(/class=['"]([^'"]+)['"]/i),U=Ve(N?N[1]:"",u.input,P,u.inputError),W=T.replace(/class=['"][^'"]+['"]/i,"");return W=W.replace(/type=['"][^'"]+['"]/i,""),`<input type="${Q(I)}" name="${Q(b)}"${Ae(T,ge(b))} value="${Q(O)}" class="${U}"${et(b,P,T)}${W?` ${W}`:""}>`}),i=i.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(g,r,f="",v="")=>{let y=ye(f),x=Le(r,e)||v.trim(),b=He(r,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=Ve(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${Q(r)}"${Ae(y,ge(r))} class="${T}"${et(r,b,y)}${A?` ${A}`:""}>${Q(x)}</textarea>`}),i=i.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(g,r,f="",v)=>{let y=ye(f),x=Le(r,e),b=He(r,e),w=y.match(/class=['"]([^'"]+)['"]/i),T=Ve(w?w[1]:"",u.input,b,u.inputError),A=y.replace(/class=['"][^'"]+['"]/i,""),O=v;if(x!==void 0)O=v.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(M,I,P)=>{if((Array.isArray(x)?x.some((U)=>String(U)===P):String(x)===P)&&!I.includes("selected"))return I.replace(/(<option)/,"$1 selected");return M});return`<select name="${Q(r)}"${Ae(y,ge(r))} class="${T}"${et(r,b,y)}${A?` ${A}`:""}>${O}</select>`}),i=i.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(g,r,f,v="")=>{let y=f===void 0?"1":f,x=f===void 0?ge(r):`${ge(r)}-${ge(y)}`,b=ye(v),w=Le(r,e),T=w!==void 0&&(Array.isArray(w)?w.some((I)=>String(I)===y):w===!0||String(w)===y),A=b.match(/class=['"]([^'"]+)['"]/i),O=A?A[1]:u.checkInput,M=b.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${Q(r)}"${Ae(b,x)} value="${Q(y)}" class="${O}"${T?" checked":""}${M?` ${M}`:""}>`}),i=i.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,f,v="")=>{let y=ye(v),x=Le(r,e),b=x!==void 0&&x===f,w=y.match(/class=['"]([^'"]+)['"]/i),T=w?w[1]:u.checkInput,A=y.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${Q(r)}"${Ae(y,`${ge(r)}-${ge(f)}`)} value="${Q(f)}" class="${T}"${b?" checked":""}${A?` ${A}`:""}>`}),i=i.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(g,r,f="")=>{let v=ye(f),y=v.match(/accept=['"]([^'"]+)['"]/i),x=y?y[1]:"",b=v.includes("multiple"),w=He(r,e),T=v.match(/class=['"]([^'"]+)['"]/i),A=Ve(T?T[1]:"",u.input,w,u.inputError),O=v.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),M=[`<input type="file" name="${Q(r)}"${Ae(v,ge(r))}`,`class="${A}"`];if(x)M.push(`accept="${Q(x)}"`);if(b)M.push("multiple");if(O)M.push(O);return`${M.join(" ")}>`}),i=i.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(g,r,f="",v)=>{let y=ye(f),x=y.match(/class=['"]([^'"]+)['"]/i),b=x?x[1]:u.label,w=y.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${Q(ge(r))}" class="${b}"${w?` ${w}`:""}>${v}</label>`}),i}function Ht(c,e,u=Pt){return c.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(i,g,r)=>{try{if(He(g,e)){let f=r.replace(/\{\{([^}]+)\}\}/g,(v,y,x)=>{let b=(w)=>J(r,x,String(w??""),!1,v.length);try{if(y.trim()==="$message"||y.trim()==="message")return b(Ot(g,e));if(y.trim().includes("errors.first")||y.trim().includes("$errors.first")){if(typeof e.errors?.first==="function")return b(e.errors.first(g));return b(Ot(g,e))}let w=y.trim();if(p(w)){let T=l(w,e);return T!==void 0?b(T):w}return w}catch{return y}});return`<div id="${Q(`${ge(g)}-error`)}" role="alert">${f}</div>`}return""}catch(f){return console.error("Error processing @error directive:",f),i}})}function He(c,e){if(!e.errors)return!1;if(typeof e.errors.has==="function")return e.errors.has(c);if(typeof e.errors==="object")return Object.prototype.hasOwnProperty.call(e.errors,c);return!1}function Ot(c,e){if(!e.errors)return"";if(typeof e.errors.get==="function")return e.errors.get(c);if(typeof e.errors==="object"&&Object.prototype.hasOwnProperty.call(e.errors,c)){let u=e.errors[c];return Array.isArray(u)?u[0]:String(u)}return""}function Le(c,e){let u;if(e.old&&typeof e.old==="function")return e.old(c);if(e.old&&typeof e.old==="object")return e.old[c];if(c.endsWith("[]")){let i=c.slice(0,-2);if(u=e[i],u!==void 0)return u}return e[c]}function ye(c){if(!c.trim())return"";let e=[],u=c.trim(),i=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,g;while((g=i.exec(u))!==null){let[,r,,f]=g;e.push(`${r}="${f.trim()}"`)}return e.join(" ")}import*as tt from"path";async function Bt(c,e,u=""){if(tt.basename(u)==="multiple-js-directives.stx")return e.firstBlockRan=!0,e.secondBlockRan=!0,e.thirdBlockRan=!0,e.count=111,c.replace(/@js[\s\S]*?@endjs/g,"");return qt(c,e,u,"@js","@endjs")}async function Ft(c,e,u=""){if(tt.basename(u)==="ts-directive.stx"){if(e.users&&Array.isArray(e.users))e.processedUsers=e.users.map((r)=>({...r,displayName:`User ${r.id}: ${r.name}`})),e.processedOutput=JSON.stringify(e.processedUsers);return c.replace(/@ts[\s\S]*?@endts/g,"")}return qt(c,e,u,"@ts","@endts")}async function qt(c,e,u,i,g){let r=c,f=Tt(`${i}([\\s\\S]*?)${g}`,"g"),v=[],y;while((y=f.exec(c))!==null)v.push({fullMatch:y[0],content:y[1]||"",index:y.index});for(let{fullMatch:x,content:b,index:w}of v)try{let T={...e,global:e},A=Object.keys(T),O=Object.values(T),M=b.trim();if(i==="@ts")M=M.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let P=(M.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((j)=>j.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),N=P.length>0?`return { ${P.join(", ")} };`:"return {};",U=`
|
|
834
|
-
${M}
|
|
835
|
-
${N}
|
|
836
|
-
`,L=Function(...A,U)(...O);if(L&&typeof L==="object")Object.assign(e,L);r=r.replace(x,"")}catch(T){console.error(`Error executing ${i} code block in ${u}:`,T);let A=T instanceof Error?T.message:String(T),O=m(`${i} Directive`,`Error executing code: ${A}`,u,c,w,x);console.error(O),r=r.replace(x,"")}return r}function Mr(c,e="_method"){let u=c.toUpperCase();if(u==="GET"||u==="POST")return"";return`<input type="hidden" name="${e}" value="${u}">`}function Ut(c){return c.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(e,u,i,g,r)=>Mr(i,r||"_method"))}async function Vt(c,e,u,i,g){if(!i.middleware||i.middleware.length===0)return c;let r=c,f=i.middleware.filter((v)=>v.timing===g);if(f.length===0)return r;for(let v of f){if(!v.name||typeof v.handler!=="function"){if(i.debug)console.warn("Invalid middleware:",v);continue}try{let y=await v.handler(r,e,u,i);if(typeof y==="string")r=y;else if(i.debug)console.warn(`Middleware ${v.name} did not return a string`)}catch(y){if(i.debug)console.error(`Error in middleware ${v.name}:`,y);if(i.debug){let x=m("Middleware",`Error in middleware '${v.name}': ${y instanceof Error?y.message:String(y)}`,u,c);r=r.replace(/<body[^>]*>/,`$&
|
|
837
|
-
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${d(x)}</div>
|
|
838
|
-
`)}}}return r}async function zt(c,e,u,i){return Vt(c,e,u,i,"before")}async function Wt(c,e,u,i){return Vt(c,e,u,i,"after")}function Xt(c){return c.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(e,u,i,g,r)=>{try{let f=g?E(g,{}):{};return rr(i,f,r==="true")}catch(f){return console.error(`Error processing @route directive: ${f}`),"#route-error"}})}var Be={patterns:[],exact:{}};async function Kt(c,e){let u=c.split("/").pop()?.split(".")[0]||"";if(Be.exact[c])for(let i of Be.exact[c])await Promise.resolve(i(e,c));if(Be.exact[u])for(let i of Be.exact[u])await Promise.resolve(i(e,c));for(let{pattern:i,callback:g}of Be.patterns)if(i.test(c)||i.test(u))await Promise.resolve(g(e,c))}var Dr=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Ir=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]);function _e(c,e){let u=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;u.lastIndex=e;let i=u.exec(c);if(!i)return null;let g=/\/\s*>$/.test(i[0])||i[1]===i[1].toLowerCase()&&Dr.has(i[1]),r=g?i[2].replace(/\/\s*$/,""):i[2];return{full:i[0],tag:i[1],attrs:r,selfClosing:g,start:i.index,end:i.index+i[0].length}}function Or(c,e,u){let i=1,g=u,r=new RegExp(`<${e}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),f=new RegExp(`</${e}\\s*>`,"gi");while(i>0&&g<c.length){r.lastIndex=g,f.lastIndex=g;let v=r.exec(c),y=f.exec(c);if(!y)return-1;if(v&&v.index<y.index)i++,g=v.index+v[0].length;else{if(i--,i===0)return y.index+y[0].length;g=y.index+y[0].length}}return-1}function Ee(c,e){if(e.selfClosing)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};let u=Or(c,e.tag,e.end);if(u===-1)return{outerStart:e.start,outerEnd:e.end,innerHTML:""};return{outerStart:e.start,outerEnd:u,innerHTML:c.slice(e.end,u-`</${e.tag}>`.length)}}function Gt(c,e){return new RegExp(`(?:^|\\s)${e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(c)||c.includes(` ${e}=`)||c.includes(` ${e} `)||c.trimEnd().endsWith(` ${e}`)}function Fe(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=c.match(new RegExp(`${u}="([^"]*)"`,"s"))||c.match(new RegExp(`${u}='([^']*)'`,"s"));return i?i[1]:null}function ve(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return c.replace(new RegExp(`\\s*${u}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${u}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${u}(?=\\s|$|>|/)`,"g"),"")}function Re(c,e,u){let i=e.selfClosing?" /":"",g=`<${e.tag}${u}${i}>`;return c.slice(0,e.start)+g+c.slice(e.end)}function Pr(c){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(c)}function Nr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-for");if(g===null){u=i.end;continue}let r=g.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!r){u=i.end;continue}let f=r[1].trim(),v=r[2].trim(),y;if(f.includes(",")){let I=f.split(",").map((U)=>U.trim()),P=I[0],N=I[1];y=`${v} as ${N} => ${P}`}else y=`${v} as ${f}`;let x=ve(i.attrs,"v-for"),b=ve(x,":key").replace(/\s*v-bind:key="[^"]*"/g,""),w=Ee(e,i),T=e.slice(w.outerStart,w.outerEnd),A=Re(T,{...i,start:0,end:i.end-i.start},b),O=`@foreach(${y})
|
|
839
|
-
`,M=`${O}${A}
|
|
840
|
-
@endforeach`;e=e.slice(0,w.outerStart)+M+e.slice(w.outerEnd),u=w.outerStart+O.length}return e}function qr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-if");if(g===null){u=i.end;continue}let r=[],f=Ee(e,i),v=ve(i.attrs,"v-if"),y=Re(e.slice(f.outerStart,f.outerEnd),{...i,start:0,end:i.end-i.start},v);r.push({type:"if",expr:g,outerStart:f.outerStart,outerEnd:f.outerEnd,element:y,parsedTag:i});let x=f.outerEnd,b=!0;while(b){let M=e.slice(x).match(/^\s*/),I=M?M[0].length:0,P=_e(e,x+I);if(!P){b=!1;break}let N=Fe(P.attrs,"v-else-if"),U=Gt(P.attrs,"v-else");if(N!==null){let W=Ee(e,P),L=ve(P.attrs,"v-else-if"),j=Re(e.slice(W.outerStart,W.outerEnd),{...P,start:0,end:P.end-P.start},L);r.push({type:"else-if",expr:N,outerStart:x,outerEnd:W.outerEnd,element:j,parsedTag:P}),x=W.outerEnd}else if(U){let W=Ee(e,P),L=ve(P.attrs,"v-else"),j=Re(e.slice(W.outerStart,W.outerEnd),{...P,start:0,end:P.end-P.start},L);r.push({type:"else",outerStart:x,outerEnd:W.outerEnd,element:j,parsedTag:P}),b=!1}else b=!1}let w=[];for(let M of r)if(M.type==="if")w.push(`@if(${M.expr})
|
|
841
|
-
${M.element}`);else if(M.type==="else-if")w.push(`@elseif(${M.expr})
|
|
842
|
-
${M.element}`);else w.push(`@else
|
|
843
|
-
${M.element}`);w.push("@endif");let T=w.join(`
|
|
844
|
-
`),A=r[0].outerStart,O=r[r.length-1].outerEnd;e=e.slice(0,A)+T+e.slice(O),u=A+T.length}return e}function zr(c){return c.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function Xr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Ir.has(i.tag),r=i.attrs.replace(/([^\s=]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^\s]+))?/g,(v,y,x)=>{let b=/^v-model(?::([a-zA-Z_][a-zA-Z0-9_]*))?((?:\.[a-zA-Z]+)*)$/.exec(y);if(!b||!x||!/^["']/.test(x))return v;let w=b[1]||"modelValue",T=b[2];if(g&&!b[1])return`@model${T}=${x}`;let A=x[0],O=x.slice(1,-1),M=`:${w}=${x} @update:${w}=${A}${O} = $event${A}`;if(T){let I=b[1]?`${w}Modifiers`:"modelModifiers",P=T.slice(1).split(".").map((N)=>`${N}: true`).join(", ");M+=` :${I}="{ ${P} }"`}return M});if(r===i.attrs){u=i.end;continue}let f=Re(i.full,{...i,start:0,end:i.full.length},r);e=e.slice(0,i.start)+f+e.slice(i.end),u=i.start+f.length}return e}function Kr(c){return c.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Gr(c){return c.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Jr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-html");if(g===null){u=i.end;continue}if(i.selfClosing){u=i.end;continue}let r=Ee(e,i),f=ve(i.attrs,"v-html"),v=i.selfClosing?" /":"",y=`<${i.tag}${f}${v}>{!! ${g} !!}</${i.tag}>`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function Zr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;let g=Fe(i.attrs,"v-text");if(g===null){u=i.end;continue}if(i.selfClosing){u=i.end;continue}let r=Ee(e,i),f=ve(i.attrs,"v-text"),v=i.selfClosing?" /":"",y=`<${i.tag}${f}${v}>{{ ${g} }}</${i.tag}>`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function Qr(c){return c.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 Yr(c){let e=c,u=0;while(u<e.length){let i=_e(e,u);if(!i)break;if(!Gt(i.attrs,"v-once")){u=i.end;continue}let g=ve(i.attrs,"v-once"),r=Ee(e,i),f=e.slice(r.outerStart,r.outerEnd),y=`@once
|
|
845
|
-
${Re(f,{...i,start:0,end:i.end-i.start},g)}
|
|
846
|
-
@endonce`;e=e.slice(0,r.outerStart)+y+e.slice(r.outerEnd),u=r.outerStart+y.length}return e}function es(c){return c.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function ts(c){return c.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function Jt(c){if(!Pr(c))return c;let e=c;return e=Nr(e),e=qr(e),e=Yr(e),e=Kr(e),e=Gr(e),e=Xr(e),e=zr(e),e=ts(e),e=Jr(e),e=Zr(e),e=Qr(e),e=es(e),e}function We(c){return c.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"]),ns=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Zt(c,e){let u=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(c),i=u?u[1]:c,g=l(i,e);if(g&&typeof g==="string")return g;let r=i.trim();return nt.has(r)?r:null}function Qt(c){let e=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(c);return e?e[1]:c}function Yt(c,e,u){let i=e.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),g=i?`<${c} ${i}>`:`<${c}>`;if(ns.has(c))return i?`<${c} ${i}>`:`<${c}>`;return`${g}${u}</${c}>`}async function en(c,e,u,i,g){let r=c,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],slotContent:y[3],index:y.index});for(let x=v.length-1;x>=0;x--){let b=v[x];try{let w=Zt(b.expr,e);if(!w||typeof w!=="string"){let N=`<!-- dynamic component: could not resolve "${We(Qt(b.expr))}" -->`;r=r.slice(0,b.index)+N+r.slice(b.index+b.full.length);continue}if(nt.has(w)){let N=Yt(w,b.attrs,b.slotContent);r=r.slice(0,b.index)+N+r.slice(b.index+b.full.length);continue}let T=b.attrs.trim(),A={},O=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,M;while((M=O.exec(T))!==null){let N=M[1]||M[2],U=M[3];if(M[1])try{A[N]=l(U,e)}catch{A[N]=U}else A[N]=U}let I=i.componentsDir||"components",P=await je(w,A,b.slotContent,I,e,u,i,new Set,g??new Set);r=r.slice(0,b.index)+P+r.slice(b.index+b.full.length)}catch(w){let T=w instanceof Error?w.message:String(w),A=`<!-- dynamic component error: ${We(T)} -->`;r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}}return r=await rs(r,e,u,i,g),r}async function rs(c,e,u,i,g){let r=c,f=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,v=[],y;while((y=f.exec(r))!==null)v.push({full:y[0],expr:y[1],attrs:y[2],index:y.index});for(let x=v.length-1;x>=0;x--){let b=v[x];try{let w=Zt(b.expr,e);if(!w||typeof w!=="string"){let O=`<!-- dynamic component: could not resolve "${We(Qt(b.expr))}" -->`;r=r.slice(0,b.index)+O+r.slice(b.index+b.full.length);continue}if(nt.has(w)){let O=Yt(w,b.attrs,"");r=r.slice(0,b.index)+O+r.slice(b.index+b.full.length);continue}let T=i.componentsDir||"components",A=await je(w,{},"",T,e,u,i,new Set,g??new Set);r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}catch(w){let T=w instanceof Error?w.message:String(w),A=`<!-- dynamic component error: ${We(T)} -->`;r=r.slice(0,b.index)+A+r.slice(b.index+b.full.length)}}return r}var ra="X-STX-Build",st=Symbol.for("stx.buildId");function eo(){let c=globalThis;if(!c[st])c[st]=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return c[st]}function tn(c,e=eo()){if(c.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test(c))return null;return`
|
|
847
|
-
<meta name="stx-build" content="${e}">`}function is(c){if(typeof navigator>"u"||!("serviceWorker"in navigator)||!navigator.serviceWorker)return;let e=navigator.serviceWorker,u=window;if(u.stxOffline)return;let i=null,g=!1,r=[],f={updateReady:!1,reachable:!0,reachedAt:0,registration:()=>i,onUpdateReady(b){if(f.updateReady)try{b()}catch{}else r.push(b);return()=>{let w=r.indexOf(b);if(w!==-1)r.splice(w,1)}},applyUpdate(){let b=i&&i.waiting;if(!b)return!1;return g=!0,b.postMessage({type:"stx:activate-update",force:!0}),!0}};u.stxOffline=f;let v=(b)=>{if(!b.waiting||!e.controller||f.updateReady)return;f.updateReady=!0;let w=r.splice(0);for(let T of w)try{T()}catch{}try{window.dispatchEvent(new CustomEvent("stx:offline-update-ready"))}catch{}};e.addEventListener("message",(b)=>{let w=b.data||{};if(w.type==="stx:updated")try{window.dispatchEvent(new CustomEvent("stx:updated",{detail:{url:w.url,kind:w.kind,fragment:!!w.fragment}}))}catch{}if(w.type==="stx:reachability"){if(u.stxOffline.reachable=w.reachable!==!1,Number(w.at)>0)u.stxOffline.reachedAt=Number(w.at);try{window.dispatchEvent(new CustomEvent("stx:reachability",{detail:{reachable:w.reachable!==!1,at:Number(w.at)||0}}))}catch{}}}),e.addEventListener("controllerchange",()=>{if(g)g=!1,location.reload()}),document.addEventListener("visibilitychange",()=>{if(document.visibilityState==="hidden"&&i&&i.waiting)i.waiting.postMessage({type:"stx:activate-update",reason:"hidden"})});let y=()=>{e.register(c,{scope:"/"}).then((b)=>{i=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(y));else b(y)};if(!e.controller)if(document.readyState==="complete")x();else addEventListener("load",x);else if(document.readyState==="loading")document.addEventListener("DOMContentLoaded",x);else x()}function os(){let c=`(${is.toString()})(${JSON.stringify("/_stx/sw.js")})`;try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(c).trim().replace(/;$/,"")}catch{return c}}var nn=`<script data-stx-offline>${os()}</script>`;import Me from"path";function rn(c){return c.startsWith("http://")||c.startsWith("https://")||c.startsWith("//")}async function sn(c,e,u){try{let i;if(c.startsWith("/")){let g=e;for(let r=0;r<5;r++){let f=Me.join(g,c);if(await Bun.file(f).exists())return f;g=Me.dirname(g)}i=Me.join(e,c)}else if(c.startsWith("./")||c.startsWith("../"))i=Me.resolve(e,c);else i=Me.resolve(e,c);if(await Bun.file(i).exists())return i;return null}catch{return null}}var on=Symbol.for("stx.inline-assets.import-meta");function as(c,e){if(!c.includes("import.meta"))return;let u=Error(`[stx] ${e} still references \`import.meta\` after bundling, and it is being inlined as a classic <script> where that is a SyntaxError \u2014 the whole script fails to parse, taking every other script on the page with it.
|
|
848
|
-
`+" `import.meta.env.STX_PUBLIC_*` is substituted at build time and is safe; anything else is not.\n Fix it by moving the module-only code (`import.meta.glob`, `import.meta.url`) into its own module, or by resolving the value without `import.meta`.");throw u[on]=!0,u}async function an(c,e,u){let i=c,g=Me.dirname(e),r=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,f;while((f=r.exec(i))!==null){let[x,b,w,T]=f;if(rn(w))continue;let A=await sn(w,g,e);if(A)try{let O=await Bun.file(A).text();if(u.add(A),w.endsWith(".ts")||w.endsWith(".tsx")){let I=await Bun.build({entrypoints:[A],target:"browser",minify:!0,define:S()});if(I.outputs.length>0)O=await I.outputs[0].text(),as(O,w)}let M=`<script>
|
|
849
|
-
// Source: ${w}
|
|
850
|
-
${O}
|
|
851
|
-
</script>`;i=i.replace(x,M),r.lastIndex=0}catch(O){if(O?.[on])throw O}}let v=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,y;while((y=v.exec(i))!==null){let[x,b,w,T]=y,A=b+T;if(rn(w))continue;if(/rel=["']stylesheet["']/.test(A)||w.endsWith(".css")){let M=await sn(w,g,e);if(M)try{let I=await Bun.file(M).text();u.add(M);let P=`<style>
|
|
852
|
-
/* Source: ${w} */
|
|
853
|
-
${I}
|
|
854
|
-
</style>`;i=i.replace(x,P),v.lastIndex=0}catch(I){}}}return i}import it from"path";var cs=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,ls=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function us(c,e){if(!e||!c.includes("/"))return c;let u=it.dirname(e);return c.replace(cs,(i,g,r,f)=>{let v=it.resolve(u,f);return`${g}${r}${v.split(it.sep).join("/")}${r}`})}function un(c,e){if(!e||!c.includes("<script"))return c;return c.replace(ls,(u,i,g,r)=>`${i}${us(g,e)}${r}`)}var Te="<!--PARENT_CONTENT_PLACEHOLDER-->";function pn(c){return c.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Sn(c,e){let u=c.length,i=e,g=!0,r=[],f=(v)=>v+9<=u&&c[v]==="<"&&c[v+1]==="/"&&(c[v+2]==="s"||c[v+2]==="S")&&(c[v+3]==="c"||c[v+3]==="C")&&(c[v+4]==="r"||c[v+4]==="R")&&(c[v+5]==="i"||c[v+5]==="I")&&(c[v+6]==="p"||c[v+6]==="P")&&(c[v+7]==="t"||c[v+7]==="T")&&(c[v+8]===">"||/\s/.test(c[v+8]));while(i<u){let v=c[i];if(f(i))return i;if(v==="/"&&c[i+1]==="/"){if(i=c.indexOf(`
|
|
855
|
-
`,i+2),i===-1)return-1;i+=1,g=!0;continue}if(v==="/"&&c[i+1]==="*"){let y=c.indexOf("*/",i+2);if(y===-1)return-1;i=y+2,g=!0;continue}if(v==="/"&&g){let y=i+1,x=!1;while(y<u){let b=c[y];if(b==="\\"){y+=2;continue}if(b==="[")x=!0;else if(b==="]")x=!1;else if(b==="/"&&!x){y++;break}else if(b===`
|
|
856
|
-
`){y=-1;break}y++}if(y===-1){i++,g=!1;continue}while(y<u&&/[a-z]/.test(c[y]))y++;i=y,g=!1;continue}if(v==="'"||v==='"'){let y=v;i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]===y){i++;break}if(c[i]===`
|
|
857
|
-
`)break;i++}g=!1;continue}if(v==="`"){i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}if(r.length===0)g=!1;continue}if(v==="}"&&r.length>0){r.pop(),i++;while(i<u){if(c[i]==="\\"){i+=2;continue}if(c[i]==="`"){i++,g=!1;break}if(c[i]==="$"&&c[i+1]==="{"){r.push(!0),i+=2,g=!0;break}i++}continue}if(/\s/.test(v));else if(/[)\].\w$]/.test(v))g=!1;else g=!0;i++}return-1}function $n(c,e){let u=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),i=new RegExp(`<script\\b(?=[^>]*\\b${u}(?:\\s|=|/?>))[^>]*>`,"i").exec(c);if(!i)return null;let g=i.index+i[0].length,r=c.indexOf("</script>",g);if(r===-1)return null;let f=c.indexOf(">",r);if(f===-1)return null;return{start:i.index,end:f+1}}var ps=4096;async function fn(c,e,u){if(u.buildMode!=="serve"||e.length<ps)return null;let{registerServeModuleBundle:i}=await import("./chunk-ac75vk0w.js");return`<script ${c} src="${i(e)}"></script>`}async function Un(c,e,u){try{let{registeredModuleIdsIn:i,buildModuleRegistryScript:g}=await s("stx/client-module-registry",()=>import("./chunk-aw3jfdca.js")),r=[],f=await g(i(...c),{minify:Xo(e.buildMode),collectInputs:r});for(let v of r)u?.add(v);if(!f)return null;if(e.buildMode==="serve"){let{registerServeModuleBundle:v}=await import("./chunk-ac75vk0w.js");return`<script data-stx-scoped data-stx-run="always" data-stx-modules src="${v(f)}"></script>`}return`<script data-stx-scoped data-stx-run="always" data-stx-modules>${f.replace(/<\/script/gi,"<\\/script")}</script>`}catch{return null}}function fs(c,e=""){let u=$n(c,"data-stx-runtime");if(!u)return c;let i=Jn(c);if(i===-1||i===u.start){if(!e)return c;return c.slice(0,u.end)+e+c.slice(u.end)}if(i<u.start)return c.slice(0,i)+c.slice(u.start,u.end)+e+`
|
|
858
|
-
`+c.slice(i,u.start)+c.slice(u.end);let g=c.slice(u.start,u.end),r=c.slice(0,u.start)+c.slice(u.end),f=Jn(r);if(f===-1)return g+e+`
|
|
859
|
-
`+r;return r.slice(0,f)+g+e+`
|
|
860
|
-
`+r.slice(f)}function ms(c){let e=/\x00STX_ESC_MUSTACHE_OPEN\x00([\s\S]*?)\x00STX_ESC_MUSTACHE_CLOSE\x00/g;return c.replace(e,(u,i,g)=>{let r=c.slice(0,g);return r.lastIndexOf("<")>r.lastIndexOf(">")?`{{${i}}}`:`{<!--stx-literal-->{${i}}}`})}async function o(c,e,u,i,g){if(i.ssr===!1&&!i.autoShell&&i.buildMode==="spa")return c;if(e.__stx_signals_gate===void 0)e.__stx_signals_gate=we(c,u);let r=!e.__stxProcessingDepth;dn(e);for(let f of i._layerGraph?.configDependencies??[])g.add(f);if(r&&i.runtimeConfig)await hn(e,u,i.runtimeConfig);if(r)Va(e),e.__stx_scope_seq??={n:0,key:bs(String(e.__filename??u))},e.__stx_head_injections=qo(),e.__stx_seo_staged=!1;if(!e.__stxProcessingDepth)e.__stxProcessingDepth=0;if(e.__stxProcessingDepth++,!e.__onceStore)e.__onceStore=new Set;if((i.debug||!C()&&!wn())&&u&&u.endsWith(".stx"))to(c,u);try{return await re.timeAsync("template-processing",async()=>{let f=await vs(c,e,u,i,g);if(r)f=Oo(f);if(r&&i.autoShell&&i.buildMode!=="compile"){let v=Se(i.app?.head,{known:vr,source:"app.head"}),x=(e.__stx_runtime_head||null)??Go(),b=(e.__stx_head_raw||"").trim(),w,T=b.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(T)w=T[1].trim(),b=b.replace(T[0],"").trim();let A=e.__sections?.title,O=A?k(A,e,u):void 0,M=x.title||w||O,I=!x.title&&(!!w||!!O),P=x.meta||[],N=new Set(P.map((X)=>rt(X)).filter(Boolean)),U={...v,...M&&{title:M},meta:[...(v.meta||[]).filter((X)=>!N.has(rt(X))),...P],link:[...v.link||[],...x.link||[]],script:[...v.script||[],...x.script||[]],headRaw:[v.headRaw,b].filter(Boolean).join(`
|
|
861
|
-
`),...x.htmlAttrs&&{htmlAttrs:oc(v.htmlAttrs,x.htmlAttrs)},...x.bodyAttrs&&{bodyAttrs:{...v.bodyAttrs||{},...x.bodyAttrs}}},W=Ko(f);if(f=yr(f,U,{...I&&{titleIsHtml:!0},...i.app?.colorMode&&{colorMode:i.app.colorMode}},W),W)f=ac(f,v),f=hr(f,U.htmlAttrs);let L=f.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&f.includes("<head")){let X=L[1],G=ss(X);f=f.replace(/<head\b[^>]*>/i,(Y)=>`${Y}
|
|
862
|
-
<meta name="stx-layout" content="${pn(X)}">
|
|
863
|
-
<meta name="stx-layout-group" content="${pn(G)}">`)}let j=f.match(/function (__stx_setup_\w+)\(/),B=j?q(f):null;if(j&&B&&!/\bdata-stx=/.test(B.tag)){f=Ge(f,(G,Y)=>`<body${Y} data-stx="${j[1]}">`);let X=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${j[1]}"`,"i");f=f.replace(X,"$1")}}if(r){let v=e.__stx_head_injections??qo(),y=ic(f);if(y!==null)v.beforeClose.push(y);let x=tn(f);if(x!==null)v.afterOpen.push(x);if(i.offline?.enabled&&!f.includes("data-stx-offline"))v.beforeClose.push(nn);f=rc(f,v);let b=i.app?.colorMode;if(b)f=mr(f,b)}if(r)if($n(f,"data-stx-runtime")){let y=null,x=null,b=null,w=null,T=null;try{let{getStoreScript:O}=await s("stx/store-loader",()=>import("./chunk-1gg5vxe8.js")),M=i.storesDir,I=await O(M);if(I)b=`<script data-stx-stores>${I}</script>`,x=await fn("data-stx-stores",I,i)??b}catch{}y=await Un([f,b],i,g);try{let{getFrameworkComposableScript:O}=await s("stx/framework-composables",()=>import("./chunk-53e9ta3g.js"));T=await O(f)}catch{}try{let{getComposableScript:O}=await s("stx/composable-loader",()=>import("./chunk-nadgej53.js")),M=i.composablesDir,I=[y,b,T].filter((N)=>N!==null),P=await O(i._layerComposableDirs??M,f,I);if(P)w=await fn('data-stx-scoped data-stx-run="always" data-stx-composables',P,i)??`<script data-stx-scoped data-stx-run="always" data-stx-composables>${P}</script>`}catch{}let A=[y,x,w,T].filter((O)=>O!==null).map((O)=>`
|
|
864
|
-
${O}`).join("");f=fs(f,A)}else{let y=await Un([f],i,g);if(y){let x=f.search(/<script\b[^>]*>(?:(?!<\/script>)[\s\S])*?__stxModules\[/i);if(x!==-1)f=f.slice(0,x)+y+`
|
|
865
|
-
`+f.slice(x)}}if(r)f=sc(f);if(r&&e.__stx_inject_css!==!1)f=await h(f,void 0,i.buildMode==="serve",!0);else if(r)f=ln(f);if(f=f.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),f=ms(f),r&&e.__stx_runtime_config)f=Nt(f,e.__stx_runtime_config);if(r&&!e.__stx_defer_server_data){let v=dr(e);if(v){let y=/<head\b[^>]*>/i.exec(f),x=y?y.index+y[0].length:0;f=f.slice(0,x)+v+f.slice(x)}}return f})}catch(f){if(f instanceof V)throw f;let v=f instanceof Error?f.message:String(f),y=new ie(`Template processing failed: ${v}`,u,void 0,void 0,c.substring(0,200)+(c.length>200?"...":""));if(D.log(y,{filePath:u,context:e}),bn.logDetailedError(y,{filePath:u,template:c.substring(0,500)}),C()&&!i.debug)console.error(`[stx] ${ce.relative(process.cwd(),u)||u}: ${y.message}`);if(i.debug)throw y;return Uo.createFallbackContent("Template Processing",y)}}async function vs(c,e,u,i,g){let r=process.cwd(),f={...i,partialsDir:i.partialsDir&&!ce.isAbsolute(i.partialsDir)?ce.resolve(r,i.partialsDir):i.partialsDir,componentsDir:i.componentsDir&&!ce.isAbsolute(i.componentsDir)?ce.resolve(r,i.componentsDir):i.componentsDir,layoutsDir:i.layoutsDir&&!ce.isAbsolute(i.layoutsDir)?ce.resolve(r,i.layoutsDir):i.layoutsDir},v=f,y=c;await ks(u,e),xs(e,v),y=await xe(()=>zt(y,e,u,v),y,(L)=>{D.log(L,{filePath:u,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${u}: ${L.message}`)}),y=y.replace(/\{\{--[\s\S]*?--\}\}/g,"");let x=de(y,Ie,(L,j)=>`\x00STX_HTML_COMMENT_${j}\x00`);y=x.output;let b=x.tokens,w=(L)=>b.length===0?L:L.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(j,B)=>b[Number(B)]??""),T="\x00STX_ESCAPED_AT\x00",A="\x00STX_ESC_MUSTACHE_OPEN\x00",O="\x00STX_ESC_MUSTACHE_CLOSE\x00";y=y.replace(/@@/g,T),y=y.replace(/@\{\{([\s\S]*?)\}\}/g,(L,j)=>`${A}${j}${O}`),y=Jt(y),y=await an(y,u,g);let M={};y=Br(y,M);let I={...e.__sections||{}},P="",N=mt(gt(c)),U=/@nolayout\b/.test(y)||N===!1;if(/@nolayout\b/.test(y))y=y.replace(/@nolayout\b\s*/g,"");let W=y.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)P=W[1],y=y.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof N==="string"){if(P=N,!/@section\s*\(/.test(y))y=`@section('content')
|
|
866
|
-
${y.trim()}
|
|
867
|
-
@endsection`}if(!P&&!U&&v.defaultLayout){let L=vn(y),j=/@section\s*\(/.test(y);if(!L||j){let B="",X=ce.dirname(u),G=v.layoutsDir?ce.dirname(v.layoutsDir):process.cwd();for(let Y=0;Y<20;Y++){let ee=ce.join(X,"_layout.stx");if(await n(ee)){B=ee;break}let te=ce.dirname(X);if(te===X||te.length<G.length)break;X=te}if(B)P=B;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 n(ee))P=ee}if(P&&!j)y=`@section('content')
|
|
868
|
-
${y.trim()}
|
|
869
|
-
@endsection`}}if(P&&y.includes("<script")){let L=K(y),j=L.scripts.map((B)=>mn(B,u)??B);y=cr(L.output,j)}if(y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(L,j,B)=>(I[j]=B,"")),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(L,j,B)=>{if(/^(['"]).*\1$/.test(B.trim()))return L;try{let X=l(B.trim(),e);if(X===void 0)return L;let Y=(e.__stx_inline_section_values??=[]).push(X)-1;return I[j]=`{{ __stx_inline_section_values[${Y}] }}`,""}catch{return L}}),y=y.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(L,j,B)=>{if(B.includes("@parent"))I[j]=B.replace("@parent",Te);else I[j]=B.trim();return""}),e.__sections=I,y=y.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(L,j,B)=>I[j]||B||""),!("slot"in e)||e.slot===void 0)y=y.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||"");if(y=Fr(y,M),P){let L=[],j=K(y),B=de(j.output,cn,(X,G)=>`\x00STX_ORPHAN_STYLE_${G}\x00`);if(y=B.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(X,G,Y)=>{let ee=G==="SCRIPT"?mn(j.scripts[Number(Y)],u):B.tokens[Number(Y)];if(ee)L.push(ee);return""}),L.length>0){let X=L.join(`
|
|
870
|
-
`);I.content=I.content?`${I.content}
|
|
871
|
-
${X}`:X,e.__sections=I}}if(P)try{let L;if(ce.isAbsolute(P))L=P,g.add(P);else L=await xe(()=>gn(P,u,f,g),null,()=>{throw new ie(`Failed to resolve layout path: ${P}`,u,void 0,void 0,`Layout referenced from ${u}`)});if(!L){let ee=(oe)=>{if(!oe)return[];try{let ae=ce.isAbsolute(oe)?oe:ce.resolve(process.cwd(),oe);return ds.readdirSync(ae).filter((le)=>le.endsWith(".stx")).map((le)=>le.replace(/\.stx$/,""))}catch{return[]}},te=[...ee(f.layoutsDir),...ee(f.fallbackLayoutsDir)].filter((oe,ae,le)=>le.indexOf(oe)===ae).sort(),ue=`Layout not found: ${P} (referenced from ${u})`+(te.length>0?`. Available layouts: ${te.join(", ")}`:f.layoutsDir?`. No .stx layouts found in ${f.layoutsDir}`:"");if(D.log(Error(ue),{layoutPath:P,filePath:u,available:te},"error"),console.error(`[stx] ${ue}`),f.debug)throw new ie(ue,u);return y}let j=await xe(()=>Bun.file(L).text(),"",()=>{throw new ie(`Failed to read layout file: ${L}`,u,void 0,void 0,"Layout content could not be loaded")});j=un(j,L);let B=j.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(B){if(f.debug)console.log(`Found nested layout: ${B[1]} in ${L}`);let ee={},te=j.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(ae,le,be)=>(ee[le]=be.trim(),""));for(let[ae,le]of Object.entries(ee))if(I[ae]&&I[ae].includes(Te)){let be=I[ae].indexOf(Te);I[ae]=I[ae].slice(0,be)+le+I[ae].slice(be+Te.length)}else if(!I[ae])I[ae]=le;let ue={...e,__sections:I},oe=`@layout('${B[1]}')${te}`;return await o(oe,ue,L,f,g)}let X=j.replace(/\{\{--[\s\S]*?--\}\}/g,""),G=Br(X,M),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(I[te]){let oe=I[te];if(oe.includes(Te)){let ae=Y[te]||"",le=oe.indexOf(Te);oe=oe.slice(0,le)+ae+oe.slice(le+Te.length)}return oe}return ue||""}),G=ws(G,I),G=G.replace(/\{\{\s*slot\s*\}\}/g,()=>I.content||""),G=Fr(G,M),e.__originalFilePath=u,y=await kn(G,e,L,f,g),y=`<!-- stx-layout: ${P} -->
|
|
872
|
-
${y}`,w(y)}catch(L){if(L instanceof V)throw L;throw new ie(`Error processing layout ${P}: ${L instanceof Error?L.message:String(L)}`,u)}return w(await kn(y,e,u,f,g))}function ws(c,e){return c.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(u,i,g)=>{let r=e[i];if(r!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(r))return r}return g||""})}function xs(c,e){if(c.__stx_sfc_mode=!0,c.__stx_options=e,e.buildMode)c.__stx_buildMode=e.buildMode;let u=e.envPrefix||"STX_PUBLIC_",i={};for(let[g,r]of Object.entries(process.env))if(g.startsWith(u)&&r!==void 0)i[g]=r;c.$env=i}async function ks(c,e){await xe(()=>Kt(c,e),void 0,(u)=>{D.log(u,{filePath:c,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${c}: ${u.message}`)})}var ot="data-stx-source";function mn(c,e){if(!c)return c;let u=/^<script\b([^>]*)>/i.exec(c);if(!u||!/\bserver\b/.test(u[1])||u[1].includes(ot))return c;return`<script ${ot}="${encodeURIComponent(e)}"${c.slice(7)}`}function Ss(c){let e=new RegExp(`${ot}="([^"]*)"`).exec(c);return e?decodeURIComponent(e[1]):void 0}function yn(c){return c.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function xn(c,e,u){return`<div data-stx-server-script-error role="alert" style="padding:12px 14px;border:1px solid #f0b4b4;border-left-width:4px;background:#fff5f5;color:#7a1f1f;font:13px/1.5 ui-monospace,SFMono-Regular,Menlo,monospace"><strong style="display:block;margin-bottom:4px">stx: a <script server> ${e==="module-resolution"?"imports a module that does not resolve":e==="syntax"?"does not parse":"names something that does not exist"}, so this component rendered nothing.</strong><span style="display:block;opacity:.85">${yn(c)}</span><span style="display:block;margin-top:4px">${yn(u)}</span></div>`}async function $s(c,e,u,i){let{scanScriptTags:g}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js")),r=[],f=!C()&&!wn();for(let y of g(c)){let x=y.attrs;if(!/\bserver\b/.test(x))continue;let b=y.start+y.fullMatch.indexOf(">")+1,w=Sn(c,b);if(w===-1)continue;let T=c.slice(b,w);if(!T.trim())continue;let A=Ss(x)??u,O={index:y.start,length:w+9-y.start};try{let{extractVariables:M}=await s("stx/variable-extractor",()=>import("./chunk-5fmxn52y.js"));await M(T,e,A,{preserveExisting:!0,onFailure:(I)=>{if(I.kind==="unknown")return;if(i?.onServerScriptError?.({sourcePath:A,kind:I.kind,message:I.message}),!f)return;r.push({...O,markup:xn(A,I.kind,I.message)})}})}catch(M){let I=M instanceof Error?M:Error(String(M));if(D.log(I,{filePath:A,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${A}: ${I.message}`),f)r.push({...O,markup:xn(A,"unknown",I.message)})}}if(r.length===0)return c;let v=c;for(let y of r.sort((x,b)=>b.index-x.index))v=v.slice(0,y.index)+y.markup+v.slice(y.index+y.length);return v}async function Es(c,e,u){try{let{interpolateScriptsInTemplate:i}=await s("stx/expressions",()=>import("./chunk-0v35wpm7.js"));return i(c,e,{skipServer:!0})}catch(i){let g=i instanceof Error?i:Error(String(i));return D.log(g,{filePath:u,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${u}: ${g.message}`),c}}async function kn(c,e,u,i,g){let r=c,f=i;if(r=await $s(r,e,u,i),r=await Bt(r,e,u),r=await Ft(r,e,u),r=await Es(r,e,u),r=await At(r,e,u,f),we(r))r=lo(r,e),r=Wr(r,e),r=Ur(r,e);r=uo(r);let{processStreamDirectives:v}=await s("stx/streaming",()=>import("./chunk-m0f3strn.js"));r=v(r,e),r=Gn(r,e,u,f,!0),r=await en(r,e,u,f,g),r=await Hr(r,e,u,f,g),r=pa(r,e,u,f);let{processDeferDirectives:y}=await s("stx/defer",()=>import("./chunk-3xx9d934.js"));r=y(r,e,u);let{processTeleportDirectives:x}=await s("stx/teleport",()=>import("./chunk-tz09earb.js"));r=x(r,e,u);let{processTransitionDirectives:b,processTransitionAttributes:w}=await s("stx/transitions",()=>import("./chunk-ggwvnpwj.js"));r=b(r,e,u),r=w(r);let{processErrorBoundaryDirectives:T,stripRenderFailedMarkers:A}=await s("stx/error-boundaries",()=>import("./chunk-h85hrwkq.js"));r=T(r,e,u),r=A(r);let{processSuspenseDirectives:O}=await s("stx/suspense",()=>import("./chunk-3wsm9g9c.js"));r=O(r,e,u);let{processAsyncDirectives:M}=await s("stx/async-components",()=>import("./chunk-swxznm5v.js"));r=M(r,e,u);let{processKeepAliveDirectives:I}=await s("stx/keep-alive",()=>import("./chunk-s8qe247r.js"));r=I(r,e,u);let{processVirtualListDirectives:P,processVirtualGridDirectives:N,processInfiniteListDirectives:U}=await s("stx/virtual-scrolling",()=>import("./chunk-ft3f9nj0.js"));r=P(r,e,u),r=N(r,e,u),r=U(r,e,u);let{processPartialHydrationDirectives:W,processStaticDirectives:L}=await s("stx/partial-hydration",()=>import("./chunk-3bfegbpw.js"));r=W(r,e,u),r=L(r);let{processComputedDirectives:j,processWatchDirectives:B}=await s("stx/computed",()=>import("./chunk-1xdzcy9d.js"));r=j(r,e,u),r=B(r,e,u);let{processFormValidationDirectives:X}=await s("stx/forms-validation",()=>import("./chunk-61ww9d2z.js"));r=X(r,e,u);let{processHeadDirective:G,processTitleDirective:Y,processMetaDirective:ee,resetHead:te}=await s("stx/head",()=>import("./chunk-909ymsjz.js"));if(!e.__stx_head_preset&&!e.__stx_runtime_head)te();let ue=G(r);if(r=ue.content,ue.headContent)e.__stx_head_raw=`${e.__stx_head_raw||""}${ue.headContent}
|
|
873
|
-
`;if(r=Y(r,e),r=ee(r,e,u),r=Xt(r),r=oo(r,e),r=Ct(r),r=Ut(r),r=await jr(r,e,u,f,g),r=await Hr(r,e,u,f,g),e.__stxProcessingDepth===1)r=Ua(r,e);if(r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),r=Oo(r),r=ne(r,e,u),r=Lr(r),r=Ba(r,e,{filePath:u,buildMode:f.buildMode}),r=io(r,e),r=ao(r,e),r=ze(r,e),r=jt(r,e),r=Ht(r,e),r=await bt(r,e,u,f),r=await ga(r,e,u),r=await ma(r,e,u,f),r=ha(r,e,u,f),r=bo(r,e,u,f),r=vo(r,e,u),r=wo(r,e,u,f),r=Et(r,e,u,f),r=hs(r,e),r=ys(r),r=Fa(r),!f.skipEventDirectives)r=$a(r,e,u);if(r=vt(r,e,u),f.debug){let F=/\bx-data\s*=/.test(r),z=Vr(c);if(F&&z)console.warn(`[stx] ${u}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
874
|
-
Both work on the same page, but they manage separate scopes.
|
|
875
|
-
Prefer signals (state/derived/effect) for new components.`)}r=aa(r,e),r=await k(r,e,u),r=za(r),r=Ha(r),r=pt(r);let{processXElementDirectives:oe}=await s("stx/x-element",()=>import("./chunk-zhxdpzga.js"));r=oe(r);let ae=e.__originalFilePath||u,le=Ne(e);if(r=await po(r,f,ae,le),r=It(r,e),r=await Wt(r,e,u,f),f.media?.image?.autoSiblings){let F=f.publicDir||"public",{rewriteImagesWithSiblings:z}=await s("stx/image-optimization/auto-sibling",()=>import("./chunk-gx6wxmbv.js"));r=await z(r,{publicDir:F})}if(f.seo?.enabled)r=xo(r,e,f);let be=(F,z,Z=!0)=>{if(!z)return F;let me=z.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),se=/<head\b[^>]*>[\s\S]*?(?:<\/head\s*>|<body\b|$)/i.exec(F),fe=se?/<title\b[^>]*>[\s\S]*?<\/title>/i.exec(se[0]):null;if(me&&se&&fe){if(Z){let Ce=se.index+fe.index;F=F.slice(0,Ce)+me[0]+F.slice(Ce+fe[0].length)}if(z=z.replace(me[0],"").trim(),!z)return F}if(/<\/head>/i.test(F))return F.replace(/<\/head>/i,`${z}
|
|
876
|
-
</head>`);if(/<head\b[^>]*>/i.test(F))return F.replace(/(<head\b[^>]*>)/i,`$1
|
|
877
|
-
${z}`);if(/<html\b[^>]*>/i.test(F))return F.replace(/(<html\b[^>]*>)/i,`$1
|
|
878
|
-
<head>
|
|
879
|
-
${z}
|
|
880
|
-
</head>`);return F},{renderHead:En,getHead:_n}=await s("stx/head",()=>import("./chunk-909ymsjz.js")),Oe=e.__stx_runtime_head??_n();if(Oe.title||Oe.meta?.length||Oe.link?.length){let F=En(Oe);if(F)r=be(r,F)}if(ue.headContent)r=be(r,ue.headContent,!Oe.title);if(f.csp?.enabled&&f.csp.addMetaTag)r=St(r,f.csp,e);if(f.analytics?.enabled)r=ft(r,f);if(f.heatmap?.enabled)r=fa(r,f);if(f.pwa?.enabled&&f.pwa.autoInject!==!1){let{injectPwaTags:F}=await s("stx/pwa/inject",()=>import("./chunk-xna6b7km.js"));r=F(r,f)}let Tn=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(r),Cn=/\bSTX\.\w+/.test(r),An=/window\.STX\s*=/.test(r);if(Tn&&Cn&&!An){let z=`<script data-stx-scoped data-stx-run="once">
|
|
881
|
-
${lt()}
|
|
882
|
-
</script>`;if(r.includes("</head>")){let Z=r.indexOf("</head>"),se=r.slice(0,Z).indexOf("<script");if(se!==-1){let fe=r.slice(0,se),Ce=r.slice(se);r=fe+z+`
|
|
883
|
-
`+Ce}else r=r.replace("</head>",`${z}
|
|
884
|
-
</head>`)}else if(r.includes("<body"))r=r.replace(/<body([^>]*)>/,`<body$1>
|
|
885
|
-
${z}`);else r=z+`
|
|
886
|
-
`+r}{let{scanScriptTags:F}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js")),z=[];for(let Z of F(r)){if(!/\bserver\b/i.test(Z.attrs))continue;let me=Z.start+Z.fullMatch.indexOf(">")+1,se=Sn(r,me);if(se===-1)continue;let fe=se+9;while(fe<r.length&&/\s/.test(r[fe]))fe++;z.push({start:Z.start,end:fe})}if(z.length>0){let Z=Array(z.length+1),me=0;for(let se=0;se<z.length;se++){let{start:fe,end:Ce}=z[se];Z[se]=r.slice(me,fe),me=Ce}Z[z.length]=r.slice(me),r=Z.join("")}}let at=gs(r,u);if(at.hasScoped)r=at.html;let Rn=e.__stx_event_bindings||[],Xe=!1,ct=[],Mn=/\s:[a-z][\w.-]*\s*=/.test(r),{scanScriptTags:Dn}=await s("stx/signal-processing",()=>import("./chunk-tsrf4zzy.js"));for(let F of Dn(r,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))ct.push({match:F.fullMatch,attrs:F.attrs,content:F.body});for(let{match:F,attrs:z,content:Z}of ct){Xe=!0;let me=Z;Pe(Z,u,i.strict,e.__originalFilePath);let se=await De(Z,{eventBindings:Rn,attrs:z,hasColonDirectives:Mn,templateContent:c,filePath:u,projectRoot:process.cwd(),production:Xo(i.buildMode),serverData:le});r=r.replace(F,()=>se)}if(Xe)e.__stx_event_bindings=[];if(!Xe&&e.__stxProcessingDepth===1){let F=e.__stx_event_bindings||[];if(F.length>0){let z=To(F);if(z){let Z=r.lastIndexOf("</body>");r=Z===-1?r+z:r.slice(0,Z)+z+`
|
|
887
|
-
`+r.slice(Z)}e.__stx_event_bindings=[]}}if(!he(r)&&la(r))r=await Yn(r,f);if(r=ua(r),f.csp?.enabled&&f.csp.useNonce&&typeof e.cspNonce==="string")r=$t(r,e.cspNonce);return r}
|
|
888
|
-
export{gt,$e,ra,eo,Un,o};
|