@stacksjs/stx 0.2.285 → 0.2.287

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.
Files changed (166) hide show
  1. package/dist/builtins/index.d.ts +4 -3
  2. package/dist/builtins/index.js +11 -11
  3. package/dist/chunk-122tyfre.js +2 -0
  4. package/dist/{chunk-0fgcnv6y.js → chunk-19nfvxfw.js} +1 -1
  5. package/dist/{chunk-f2s94353.js → chunk-1kah92n2.js} +1 -1
  6. package/dist/{chunk-90qr4f9m.js → chunk-1kms3b9d.js} +1 -1
  7. package/dist/{chunk-s2284nbk.js → chunk-1q4y74mh.js} +1 -1
  8. package/dist/{chunk-49kk0s96.js → chunk-248e84r1.js} +1 -1
  9. package/dist/{chunk-zfr4d08r.js → chunk-24ps8kft.js} +1 -1
  10. package/dist/chunk-2et5hxfv.js +2 -0
  11. package/dist/chunk-2r1rd8f0.js +2 -0
  12. package/dist/{chunk-n3qyd366.js → chunk-2tk1zkrz.js} +1 -1
  13. package/dist/{chunk-ysnk7x79.js → chunk-38ejahd9.js} +1 -1
  14. package/dist/chunk-3zv4wz87.js +2 -0
  15. package/dist/chunk-4122k1bh.js +2 -0
  16. package/dist/chunk-45az9zht.js +2 -0
  17. package/dist/{chunk-yq1d9hb3.js → chunk-4qr85f07.js} +1 -1
  18. package/dist/{chunk-9aw94jhm.js → chunk-4ww3znrr.js} +4 -4
  19. package/dist/chunk-5a19dhx5.js +2 -0
  20. package/dist/{chunk-39f40yc4.js → chunk-5kk8gsj2.js} +1 -1
  21. package/dist/{chunk-kzyhvrp8.js → chunk-5w1e3yxs.js} +1 -1
  22. package/dist/chunk-6gdycmxr.js +2 -0
  23. package/dist/{chunk-xqxg3fck.js → chunk-6hmnaza7.js} +10 -10
  24. package/dist/{chunk-zn5jgmqw.js → chunk-71t0yan0.js} +1 -1
  25. package/dist/chunk-74v15e8z.js +2 -0
  26. package/dist/{chunk-3y623mek.js → chunk-7b329e5v.js} +1 -1
  27. package/dist/{chunk-g3fy0tw8.js → chunk-866y9d8b.js} +154 -48
  28. package/dist/chunk-8fwerspy.js +2 -0
  29. package/dist/{chunk-c0an64km.js → chunk-8mjdpr94.js} +1 -1
  30. package/dist/{chunk-q68xmak4.js → chunk-92mj1t26.js} +18 -18
  31. package/dist/{chunk-f8b83xbw.js → chunk-9b22663r.js} +1 -1
  32. package/dist/chunk-9hjdgm4d.js +2 -0
  33. package/dist/{chunk-egez576q.js → chunk-9wr7zcad.js} +2 -2
  34. package/dist/{chunk-dy2y790t.js → chunk-a0nfbmeh.js} +1 -1
  35. package/dist/{chunk-7g88q9ft.js → chunk-acn1b56m.js} +2 -2
  36. package/dist/chunk-awkq3xfx.js +2 -0
  37. package/dist/{chunk-bf8wf3r2.js → chunk-b6ej2fdf.js} +2 -2
  38. package/dist/{chunk-e7jfpyqy.js → chunk-b8rrnqry.js} +1 -1
  39. package/dist/{chunk-a1g1zsbh.js → chunk-bfqfs07m.js} +1 -1
  40. package/dist/{chunk-fjkstnz3.js → chunk-bs6kapy7.js} +1 -1
  41. package/dist/{chunk-qd8ggjdx.js → chunk-btav940g.js} +1 -1
  42. package/dist/{chunk-pbk8jxe2.js → chunk-ccspd3mc.js} +1 -1
  43. package/dist/{chunk-7rxtra1g.js → chunk-csbgwaa5.js} +1 -1
  44. package/dist/chunk-d8t4sjsp.js +2 -0
  45. package/dist/chunk-dap191q2.js +2 -0
  46. package/dist/{chunk-ayrjwkyw.js → chunk-de7fye10.js} +1 -1
  47. package/dist/{chunk-2g9jwgs7.js → chunk-dgrt76d2.js} +1 -1
  48. package/dist/{chunk-9zndrzb3.js → chunk-dhh5q7qt.js} +1 -1
  49. package/dist/chunk-dsffsqnt.js +2 -0
  50. package/dist/{chunk-d0c3v7ax.js → chunk-dtq7y5ym.js} +1 -1
  51. package/dist/{chunk-w95sp0k9.js → chunk-fed3xsp9.js} +2 -2
  52. package/dist/{chunk-bxskmetn.js → chunk-ferav3bw.js} +1 -1
  53. package/dist/{chunk-a63y3aa0.js → chunk-fvhm8psm.js} +1 -1
  54. package/dist/{chunk-bz2gytfs.js → chunk-g4vpzv6b.js} +1 -1
  55. package/dist/{chunk-d34fnbpc.js → chunk-g9csmj0s.js} +1 -1
  56. package/dist/chunk-gtcrpmz1.js +2 -0
  57. package/dist/{chunk-9v5s9ax8.js → chunk-h4xh8cms.js} +1 -1
  58. package/dist/chunk-h8yqsz9m.js +2 -0
  59. package/dist/{chunk-phhzfeh9.js → chunk-hcq5dw7a.js} +1 -1
  60. package/dist/{chunk-d10btecr.js → chunk-hm0xha6c.js} +1 -1
  61. package/dist/chunk-jegt35zh.js +2 -0
  62. package/dist/{chunk-ggrzaenz.js → chunk-k56rjjc0.js} +1 -1
  63. package/dist/{chunk-ada449cq.js → chunk-kdh37tp8.js} +1 -1
  64. package/dist/{chunk-e4hhz9j3.js → chunk-kxzb4et3.js} +1 -1
  65. package/dist/{chunk-3bv8h4r6.js → chunk-mf4n3x1j.js} +1 -1
  66. package/dist/{chunk-5aq35j2e.js → chunk-mkd9kjgb.js} +1 -1
  67. package/dist/chunk-mxfh1nxg.js +2 -0
  68. package/dist/{chunk-snknv47x.js → chunk-nkb3scg6.js} +1 -1
  69. package/dist/{chunk-s67mgegv.js → chunk-nnd4wq8j.js} +1 -1
  70. package/dist/{chunk-1xfqy79h.js → chunk-nsp1cw38.js} +1 -1
  71. package/dist/chunk-p3242nck.js +2 -0
  72. package/dist/chunk-p98kfh94.js +2 -0
  73. package/dist/{chunk-t1k5dpbr.js → chunk-pkaabd8h.js} +1 -1
  74. package/dist/{chunk-t0ghjghe.js → chunk-pzm13sdc.js} +1 -1
  75. package/dist/{chunk-n32gnc22.js → chunk-q4p5k2p3.js} +1 -1
  76. package/dist/{chunk-sskbegsz.js → chunk-qc1f74ek.js} +1 -1
  77. package/dist/{chunk-nvgxjvnb.js → chunk-qpyjak7z.js} +1 -1
  78. package/dist/{chunk-0hdkedwq.js → chunk-qr82je1m.js} +1 -1
  79. package/dist/{chunk-a54n1r1q.js → chunk-qy73j6m4.js} +1 -1
  80. package/dist/{chunk-p396xrew.js → chunk-qzkhpsam.js} +1 -1
  81. package/dist/{chunk-f3hfk78e.js → chunk-r3ayvdz3.js} +1 -1
  82. package/dist/chunk-r7r66978.js +2 -0
  83. package/dist/{chunk-kpy77ys3.js → chunk-rbb7dvja.js} +1 -1
  84. package/dist/{chunk-kdrpx9ft.js → chunk-rj4kajww.js} +1 -1
  85. package/dist/{chunk-areethga.js → chunk-rp4rjjmf.js} +1 -1
  86. package/dist/{chunk-gjemavhx.js → chunk-se0p17c2.js} +1 -1
  87. package/dist/chunk-sj9pmene.js +2 -0
  88. package/dist/{chunk-a2qghr2x.js → chunk-sscwkffs.js} +1 -1
  89. package/dist/chunk-svpqxn2c.js +2 -0
  90. package/dist/chunk-t8y1ggdy.js +2 -0
  91. package/dist/{chunk-y6kw0wb7.js → chunk-tndhnk9e.js} +1 -1
  92. package/dist/{chunk-c6fw33zh.js → chunk-v5e1gxwm.js} +2 -2
  93. package/dist/{chunk-7p9ns60j.js → chunk-vrrax298.js} +1 -1
  94. package/dist/{chunk-zcmtqan3.js → chunk-wrzwgkbx.js} +3 -3
  95. package/dist/{chunk-jn6m8zf7.js → chunk-x650vjcp.js} +1 -1
  96. package/dist/{chunk-mjkfc2v6.js → chunk-xgnc1wy6.js} +1 -1
  97. package/dist/{chunk-52mh63sp.js → chunk-xpp135ad.js} +1 -1
  98. package/dist/chunk-y11cxbxd.js +3757 -0
  99. package/dist/{chunk-cvnh7dma.js → chunk-y98jsjqq.js} +1 -1
  100. package/dist/{chunk-vbdca0k1.js → chunk-ya386h70.js} +1 -1
  101. package/dist/chunk-ydrz60kr.js +2 -0
  102. package/dist/{chunk-0f1kz0x2.js → chunk-ypmqf7tm.js} +1 -1
  103. package/dist/{chunk-cb74rvec.js → chunk-z4jhj5e5.js} +1 -1
  104. package/dist/{chunk-fskfes13.js → chunk-zg75gjns.js} +1 -1
  105. package/dist/{chunk-mb518a4n.js → chunk-zqqx1qaj.js} +1 -1
  106. package/dist/cli.js +14 -14
  107. package/dist/client-script-bundler.js +7 -7
  108. package/dist/client-script.js +27 -7
  109. package/dist/component-client-factories.js +10 -5
  110. package/dist/component-processing.d.ts +13 -0
  111. package/dist/component-processing.js +37 -1
  112. package/dist/component-renderer.js +34 -15
  113. package/dist/conditionals.js +14 -3
  114. package/dist/craft-entry.js +1 -1
  115. package/dist/craft.js +1 -1
  116. package/dist/database.js +1 -1
  117. package/dist/document-shell.d.ts +1 -34
  118. package/dist/document-shell.js +19 -11
  119. package/dist/html-masking.d.ts +65 -9
  120. package/dist/html-masking.js +103 -15
  121. package/dist/misc-directives.d.ts +1 -1
  122. package/dist/misc-directives.js +48 -13
  123. package/dist/process.js +14 -4
  124. package/dist/pwa.js +2 -2
  125. package/dist/reactive-bindings.js +2 -0
  126. package/dist/runtime-globals.d.ts +7 -20
  127. package/dist/runtime-globals.js +28 -3
  128. package/dist/safe-evaluator.d.ts +15 -0
  129. package/dist/safe-evaluator.js +16 -12
  130. package/dist/server-bindings.js +21 -5
  131. package/dist/signal-processing.d.ts +17 -7
  132. package/dist/signal-processing.js +112 -43
  133. package/dist/signals-api.js +5 -2
  134. package/dist/signals.js +153 -47
  135. package/dist/ssg.js +2 -2
  136. package/dist/utils.js +23 -6
  137. package/dist/variable-extractor.js +17 -47
  138. package/dist/visual-testing.js +1 -1
  139. package/package.json +5 -5
  140. package/dist/chunk-1k957wj9.js +0 -2
  141. package/dist/chunk-43r6p08p.js +0 -2
  142. package/dist/chunk-492g6g4g.js +0 -2
  143. package/dist/chunk-60c5bvke.js +0 -2
  144. package/dist/chunk-71nr1avx.js +0 -2
  145. package/dist/chunk-7gbwa2ph.js +0 -2
  146. package/dist/chunk-8ns2r0we.js +0 -2
  147. package/dist/chunk-9rkntp0z.js +0 -3756
  148. package/dist/chunk-b29wbjs5.js +0 -2
  149. package/dist/chunk-ba6tthsm.js +0 -2
  150. package/dist/chunk-f6x9bh8n.js +0 -2
  151. package/dist/chunk-f80wwn5x.js +0 -2
  152. package/dist/chunk-fk6ssg32.js +0 -2
  153. package/dist/chunk-gkmtkzdm.js +0 -2
  154. package/dist/chunk-hzw1ekq3.js +0 -2
  155. package/dist/chunk-j03bare5.js +0 -2
  156. package/dist/chunk-jxjt1szw.js +0 -2
  157. package/dist/chunk-m2harpd3.js +0 -2
  158. package/dist/chunk-qp97dx7x.js +0 -2
  159. package/dist/chunk-stw3ej3d.js +0 -2
  160. package/dist/chunk-v4f08c2r.js +0 -2
  161. package/dist/chunk-vrvehb01.js +0 -2
  162. package/dist/chunk-y1segp76.js +0 -2
  163. package/dist/chunk-y3qng57q.js +0 -2
  164. package/dist/chunk-yqaky7fa.js +0 -2
  165. package/dist/chunk-ytgnzeeb.js +0 -2
  166. package/dist/chunk-z7cwrmgt.js +0 -2
@@ -1,3756 +0,0 @@
1
- // @bun
2
- import{Ar as R2,Dr as x6,Fr as J0,Hs as a3,Is as t3,Jr as D2,Kr as g6,Mr as s0,Nr as h6,Ur as g4,Vr as e,Wr as z0,Xr as I0,Yr as Q9,Zr as U0,_r as Z9,pr as X0,rr as e2,tr as $9,ts as u6,xs as d6}from"./chunk-q68xmak4.js";import{Os as d2}from"./chunk-c0an64km.js";import{Ws as l0}from"./chunk-52mh63sp.js";import{Xs as g1,Ys as v1,Zs as l6,_s as e1,at as M1,bt as U8,ct as W8,rt as c6}from"./chunk-zcmtqan3.js";import{st as e3,ut as $4,vt as Z4,xt as K2}from"./chunk-39f40yc4.js";import{yt as a7}from"./chunk-ysnk7x79.js";import{Bt as p6,Ft as l2,Ht as Z8}from"./chunk-0f1kz0x2.js";import{St as i6}from"./chunk-ayrjwkyw.js";import{$t as y$,Tt as o$,Ut as L8,Vt as K8,Wt as x1,_t as O8,au as h7,cu as r4,fu as w6}from"./chunk-c6fw33zh.js";import{Qu as m6,Su as AQ,Tu as m9,Vu as Q2,pu as u5,su as k7,zu as I5}from"./chunk-bf8wf3r2.js";import{_u as X4}from"./chunk-jn6m8zf7.js";import{dv as u}from"./chunk-sskbegsz.js";import I1 from"path";import A2 from"fs";var T$=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),E$={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},A8=new Set(["ctrl","alt","shift","meta"]),C$={left:0,middle:1,right:2};function b$($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let X of $){let J=X.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(A8.has(J))Z.systemKeys.push(J);else if(J in C$)Z.mouse=J;else if(J in E$||/^[a-z]$/.test(J))Z.keys.push(E$[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return Z}function S$($){let Z=[],X=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[Q,G,z]=Y,q=Y.index,K=q+Q.length,U=`__stx_evt_${X++}`,W=[],H=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=H.exec(z))!==null){let[,_,O]=j,V=_.split("."),L=V[0];if(!T$.has(L))continue;W.push({attribute:`@${_}`,event:L,handler:O,modifiers:b$(V.slice(1)),elementId:U})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(z))!==null){let[,_,O]=j,V=_.split("."),L=V[0];if(!T$.has(L))continue;W.push({attribute:`@${_}`,event:L,handler:O,modifiers:b$(V.slice(1)),elementId:U})}if(W.length>0)Z.push({originalTag:Q,elementId:U,events:W,startIndex:q,endIndex:K})}return Z}function M8($){let Z=[],{modifiers:X}=$;if(X.self)Z.push("if ($event.target !== $el) return");for(let J of X.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(X.keys.length>0){let J=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(X.mouse!==null){let J=C$[X.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(X.prevent)Z.push("$event.preventDefault()");if(X.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function k8($,Z){let X=$;if(Z.debounce!==null)X=`__stx_debounce(() => { ${X} }, ${Z.debounce})`;else if(Z.throttle!==null)X=`__stx_throttle(() => { ${X} }, ${Z.throttle})`;return X}function E9($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function I8($){let{modifiers:Z}=$,X=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=M8($),Y=k8(E9($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",z=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
3
- (function() {
4
- var $el = document.getElementById('${X}');
5
- if (!$el) return;
6
- // Run mounted handler immediately (DOM is ready)
7
- var scope = $el.closest('[data-stx-scope]');
8
- if (scope && scope.__stx_execute) {
9
- scope.__stx_execute('${z}', null, $el);
10
- }
11
- else {
12
- __stx_runHandler('${z}', null, $el);
13
- }
14
- })();`;if($.event==="unmounted")return`
15
- (function() {
16
- var $el = document.getElementById('${X}');
17
- if (!$el) return;
18
- // Set up MutationObserver to detect removal
19
- var observer = new MutationObserver(function(mutations) {
20
- for (var m of mutations) {
21
- for (var node of m.removedNodes) {
22
- if (node === $el || (node.contains && node.contains($el))) {
23
- observer.disconnect();
24
- var scope = $el.closest('[data-stx-scope]');
25
- if (scope && scope.__stx_execute) {
26
- scope.__stx_execute('${z}', null, $el);
27
- }
28
- else {
29
- __stx_runHandler('${z}', null, $el);
30
- }
31
- return;
32
- }
33
- }
34
- }
35
- });
36
- observer.observe(document.body, { childList: true, subtree: true });
37
- // Store observer for cleanup
38
- $el.__stx_unmount_observer = observer;
39
- })();`;return`
40
- (function() {
41
- var $el = document.getElementById('${X}');
42
- if (!$el) return;
43
- // eslint-disable-next-line pickier/no-unused-vars
44
- $el.addEventListener('${$.event}', function($event) {
45
- ${J?J+";":""}
46
- // Find the closest reactive scope and execute within its context
47
- var scope = $el.closest('[data-stx-scope]');
48
- if (scope && scope.__stx_execute) {
49
- scope.__stx_execute('${z}', $event, $el);
50
- }
51
- else {
52
- // Fallback for non-reactive context (entity-safe; decoded + run in memory)
53
- __stx_runHandler('${z}', $event, $el);
54
- }
55
- }${G});
56
- })();`}function b9($){if($.length===0)return"";return`
57
- <script data-stx-events>
58
- (function() {
59
- 'use strict';
60
-
61
- // Utility functions
62
- function __stx_debounce(fn, delay) {
63
- var timeout;
64
- return function() {
65
- var args = arguments;
66
- var ctx = this;
67
- clearTimeout(timeout);
68
- timeout = setTimeout(function() { fn.apply(ctx, args); }, delay);
69
- };
70
- }
71
-
72
- function __stx_throttle(fn, delay) {
73
- var last = 0;
74
- return function() {
75
- var now = Date.now();
76
- if (now - last >= delay) {
77
- last = now;
78
- fn.apply(this, arguments);
79
- }
80
- };
81
- }
82
-
83
- // Non-reactive fallback runner. The handler is embedded HTML-entity-encoded
84
- // so the surrounding script element can never contain raw markup, including
85
- // its own closing tag; we decode it to JS only in memory here, then run it
86
- // with $event/$el in scope.
87
- //
88
- // This comment must not spell that closing tag out. It used to, as an
89
- // example, and a browser ends the script element at the FIRST one it sees \u2014
90
- // so everything below this line, __stx_runHandler included, was emitted as
91
- // page text and no listener was ever bound. The comment about escaping was
92
- // the thing that needed escaping.
93
- function __stx_runHandler(h, $event, $el) {
94
- var code = h
95
- .replace(/&lt;/g, '<')
96
- .replace(/&gt;/g, '>')
97
- .replace(/&quot;/g, '"')
98
- .replace(/&#39;/g, "'")
99
- .replace(/&#x27;/g, "'")
100
- .replace(/&amp;/g, '&');
101
- try {
102
- // eslint-disable-next-line no-new-func
103
- (new Function('$event', '$el', code)).call($el, $event, $el);
104
- }
105
- catch (e) {
106
- if (typeof console !== 'undefined') console.error('[stx] event handler error:', e);
107
- }
108
- }
109
-
110
- // Event listeners
111
- ${$.map(I8).join(`
112
- `)}
113
- })();
114
- </script>`}function T8($){let Z=S$($);if(Z.length===0)return{template:$,bindings:[]};let X=$,J=[];for(let Y=Z.length-1;Y>=0;Y--){let Q=Z[Y],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let q of Q.events)q.elementId=z[1]}for(let z of Q.events){let q=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(K,""),G=G.replace(U,"")}X=X.slice(0,Q.startIndex)+G+X.slice(Q.endIndex),J.push(...Q.events)}return{template:X,bindings:J}}function P$($,Z,X){if(y$($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:z,bindings:q}=T8($),K=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...K,...q],z}let J=S$($);if(J.length===0)return $;let Y=$;for(let z=J.length-1;z>=0;z--){let q=J[z],K=q.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=K.match(/id=["']([^"']+)["']/);if(U)for(let W of q.events)W.elementId=U[1]}for(let U of q.events){let W=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),H=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");K=K.replace(H,""),K=K.replace(j,"")}Y=Y.slice(0,q.startIndex)+K+Y.slice(q.endIndex)}let Q=b9(J.flatMap((z)=>z.events)),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
115
- `+Y.slice(G);else Y+=Q;return Y}function cG($){return/@[a-z]+(?:\.[a-z]+)*\s*=\s*["'][^"']*["']/i.test($)}function t0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
116
- `});let X=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(X,(J,Y)=>{return`const { ${Y.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
117
- `}),$}function iG($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}import KG from"fs";import h from"path";import{createHash as E8}from"crypto";var C2="__stx_component_client_factories";function S2($){let Z=$[C2];return Z instanceof Map?Z:null}function v$($){$[C2]=new Map}function y9($,Z){let X=S2($);if(!X)return null;let J=E8("sha256").update(Z).digest("hex").slice(0,16),Y=X.get(J);if(Y)Y.instances++;else X.set(J,{body:Z,instances:1});return J}function f$($,Z){let X=S2(Z);if(!X?.size)return $;let J=$;for(let[q,K]of X){if(K.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(U,(W,H)=>`(${K.body})(${H});`)}let Y=[...X].filter(([,q])=>q.instances>1);if(Y.length===0)return J;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
118
- (function() {
119
- const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
120
- ${Y.map(([q,K])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${K.body}; }
121
- catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(q)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
122
- `)}
123
- })();
124
- </script>`,z=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(z<0)return`${G}
125
- ${J}`;return`${J.slice(0,z)}${G}
126
- ${J.slice(z)}`}function x$($){let Z=S2($),X=new Map;if(Z)for(let[J,Y]of Z)X.set(J,Y.instances);return X}function g$($,Z){let X=S2($);if(!X)return[];let J=[];for(let[Y,Q]of X){let G=Q.instances-(Z.get(Y)??0);if(G>0)J.push({body:Q.body,count:G})}return J}function h$($,Z){for(let{body:X,count:J}of Z)for(let Y=0;Y<J;Y++)y9($,X)}var u$=0,P2=new Map;function rG(){u$=0,P2.clear()}function v2($,Z){let X=u$++,J=`<!--__STX_${$.toUpperCase()}_${X}__-->`;return P2.set(J,{type:$,expression:Z}),J}function aG(){let $={};for(let[Z,X]of P2)$[Z]={type:X.type,expression:X.expression};return $}function tG($){let Z={},X=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,J;while((J=X.exec($))!==null){let Y=J[0],Q=J[1].toLowerCase(),G=P2.get(Y);Z[Y]={type:Q,expression:G?.expression||""}}return Z}function eG($,Z){let X=$;for(let[J,Y]of Z)X=X.split(J).join(Y);return X}function $z($){return $.includes("<!--__STX_")}var d$=/<script\b[^>]*>/iy,m$=/<\/script\s*>/ig,l$=/<style\b[^>]*>/iy,c$=/<\/style\s*>/ig;function p$($,Z,X,J){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)return-1;J.lastIndex=X.lastIndex;let Q=J.exec($);if(!Q)return-1;return Q.index+Q[0].length}function X1($,Z){return p$($,Z,d$,m$)}function T1($,Z){return p$($,Z,l$,c$)}function X2($,Z){if(!$.startsWith("<!--",Z))return-1;let X=$.indexOf("-->",Z+4);if(X===-1)return-1;return X+3}function b8($,Z){if($.startsWith("<!--",Z)){let X=X2($,Z);return X===-1?$.length:X}for(let[X,J]of[[d$,m$],[l$,c$]]){X.lastIndex=Z;let Y=X.exec($);if(!Y||Y.index!==Z)continue;J.lastIndex=X.lastIndex;let Q=J.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function f2($,Z){let X=[],J=0,Y=$.length,Q=!1,G=null;while(J<Y){let z=$[J];if(Q){if(G){if(z===G)G=null}else if(z==='"'||z==="'")G=z;else if(z===">")Q=!1;J++;continue}if(z!=="<"){J++;continue}let q=Z($,J);if(q>J){X.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let K=b8($,J);if(K>J){J=K;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))Q=!0;J++}return X}function i0($,Z,X){let J=f2($,Z);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((z)=>z.token),Q="",G=0;for(let z=0;z<J.length;z++){let q=J[z];Q+=$.slice(G,q.start),Q+=X(q.token,z),G=q.end}return Q+=$.slice(G),{output:Q,tokens:Y}}function n0($){let{output:Z,tokens:X}=i0($,X1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:Z,scripts:X}}function E1($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(X,J)=>Z[+J]??"")}var J2={},i$=new Map;function y8($){let Z=i$.get($);if(!Z){let X=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${X}(?!\\w)`,"g"),i$.set($,Z)}return Z.lastIndex=0,Z}var x2={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let X=String($);return X.charAt(0).toUpperCase()+X.slice(1)},number:($,Z,X=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(X),10))}catch{return""}},fmt:($,Z,X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(X)}catch{return String($)}},join:($,Z,X=",")=>{if(!Array.isArray($))return"";return $.join(String(X))},escape:($,Z)=>{if($===void 0||$===null)return"";return s$(String($))},translate:($,Z,X={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Y=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=J;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Y?$:"";let z=String(G);return Object.entries(X).forEach(([q,K])=>{z=z.replace(y8(q),String(K))}),z},t:($,Z,X={})=>{return x2.translate($,Z,X)},truncate:($,Z,X=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=X)return Y;if(X<=J.length)return J.substring(0,X);return Y.substring(0,X-J.length)+J},date:($,Z,X="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(X==="iso")return Y.toISOString();return new Intl.DateTimeFormat(J,Q[X]||Q.short).format(Y)}catch{return String($)}},currency:($,Z,X="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:X}).format(Y)}catch{return String($)}},pluralize:($,Z,X,J)=>{let Y=Number($);if(Number.isNaN(Y))return X;let Q=J||`${X}s`;return Y===1?X:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let X=String($);return X.charAt(X.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,X=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return X?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,X="")=>{return $===void 0||$===null||$===""?X:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,X=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(X,J);return $},replace:($,Z,X,J="")=>{if($===void 0||$===null)return"";let Y=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let X=Number($);return Number.isNaN(X)?0:Math.abs(X)},round:($,Z,X=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**X;return Math.round(J*Y)/Y}};function C8($,Z){if($ in x2)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);J2[$]=Z}function Kz($){for(let[Z,X]of Object.entries($))C8(Z,X)}function S8(){return{...x2,...J2}}function Uz(){for(let $ of Object.keys(J2))delete J2[$]}function C9($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function s$($){return C9($).replace(/\{{2,}/g,(Z)=>P8(Z.length)).replace(/\{(?=!)/g,`&#123;${r$}`)}var r$="&#8288;";function P8($){return Array.from({length:$},()=>"&#123;").join(r$)}function J1($,Z){let{scripts:X}=n0($);for(let J of X){let Y=J.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let Q=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))return!0;if(o$(Q,Z))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function n$($,Z){let X=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",Q=!1,G=0;for(let K=0;K<J.length;K++){let U=J[K];if(!Q&&U==="`"){Q=!0,G=0;continue}if(Q){if(U==="`"&&G===0){Q=!1;continue}if(U==="$"&&J[K+1]==="{"){G++,K++,Y+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Y+=U;continue}continue}Y+=U}J=Y;let z=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=z.exec(J))!==null){let K=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!X.includes(K)&&!(K in Z))return!1}}return!0}function v8($,Z){let X=Z.__stx_serverDeclared;if(!X||X.size===0)return!1;let J=l0($);for(let Y of X)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function S9($,Z){let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=v0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=v0(Y,Z);if(G===void 0)return J;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return J}}),X}function f8($,Z){if(!$.includes("{"))return $;let X=$;return X=X.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let Q=v0(Y,Z);if(Q===void 0)return J;return Q===null?"":String(Q)}catch{return J}}),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let Q=Y.trim();if(/^__[A-Z_]+__$/.test(Q))return J;try{let G=v0(Y,Z);if(G===void 0)return J;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),X}function Wz($,Z,X={}){let{output:J,scripts:Y}=n0($),Q=Y.map((G)=>{let z=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),K=G.search(/<\/script\s*>$/i);if(!z||!q||K===-1)return G;let U=z[1],W=z[2];if(/\bdata-raw\b/.test(U))return G;if(X.skipServer&&/\bserver\b/.test(U))return G;let j=`<script${f8(U,Z)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return j+W+G.slice(K);return j+S9(W,Z)+G.slice(K)});return E1(J,Q)}function B1($,Z,X){let J=$,Y=(W,H)=>{let j=T1(W,H);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(W.slice(H,j))?-1:j},Q=(W,H,j,B)=>{let _=j.length,{output:O,tokens:V}=i0(W,H,(L,F)=>B(_+F));return j.push(...V),O},G=[];J=Q(J,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`);let z=[];J=Q(J,X1,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`);let q=Z?.__stx_signals_gate===!0||J1($),K=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);if(J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(W,H,j)=>{try{let B=v0(H,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {{{ ${H.trim()}}}}: ${_}`,X,$,j,W)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(W,H,j)=>{try{let B=v0(H,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return v2("raw",H.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return v2("raw",H.trim());let _=B instanceof Error?B.message:String(B);return j0("Expression",`Error evaluating: {!! ${H.trim()} !!}: ${_}`,X,$,j,W)}}),J=Q(J,X1,z,(W)=>`<!--__STX_SCRIPT_EXPR_${W}__-->`),J=Q(J,Y,G,(W)=>`<!--__STX_STYLE_${W}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(W,H,j)=>{let B=H.trim();if(U.has(B))return W;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],F=L&&((L in Z)||_.includes(L)),w=Boolean(L&&K.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,D=B.match(R),A=D&&!_.includes(D[1])&&!(D[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let k=v0(H,Z);if(w)return W;if(q&&!n$(B,Z))return W;if(Z.__stx_buildMode==="compile"&&!q&&(k===void 0||v8(B,Z)))return v2("expr",B);return k!==void 0&&k!==null?s$(String(k)):""}catch(k){if(w)return W;if(q&&!n$(B,Z))return W;if(A)return W;let N=k instanceof Error?k.message:String(k);return j0("Expression",`Error evaluating: {{ ${B} }}: ${N}`,X,$,j,W)}}),z.length>0)J=J.replace(/<!--__STX_SCRIPT_EXPR_(\d+)__-->/g,(W,H)=>z[Number(H)]??W);if(G.length>0)J=J.replace(/<!--__STX_STYLE_(\d+)__-->/g,(W,H)=>G[Number(H)]??W);return J}function x8($,Z,X){if(!Z.trim())return $;let J=$,Y=Z.trim();while(Y.length>0){let Q=Y.match(/^(\w+)/);if(!Q)break;let G=Q[1];Y=Y.substring(G.length).trim();let z=J2[G]||x2[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(S8()).join(", ")}`);let q=[];if(Y.startsWith(":")){let K=Y.match(/^:([^|\s]+)/);if(K){let U=K[1].trim();try{let W=Number(U);q=[Number.isNaN(W)?U:W]}catch{q=[U]}Y=Y.substring(K[0].length).trim()}}else if(Y.startsWith("(")){let K=1,U=1;while(K>0&&U<Y.length){if(Y[U]==="(")K++;if(Y[U]===")")K--;U++}if(K===0){let W=Y.substring(1,U-1).trim();if(W)try{if(W.startsWith("{")&&W.endsWith("}"))q=[v0(`(${W})`,X,!0)];else{let H=[],j="",B=null,_=0,O=0,V=0,L=!1;for(let F=0;F<W.length;F++){let w=W[F];if(L){j+=w,L=!1;continue}if(w==="\\"){j+=w,L=!0;continue}if(B){if(j+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,j+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")V++;else if(w==="}")V--;if(w===","&&_===0&&O===0&&V===0){H.push(j),j="";continue}j+=w}if(j)H.push(j);q=H.map((F)=>{let w=F.trim();return v0(w,X,!0)})}}catch{q=[W]}Y=Y.substring(U).trim()}}try{J=z(J,X,...q)}catch(K){let U=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${G}': ${U}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function g8($){let Z=!1,X="",J=0,Y=0,Q=0,G=!1;for(let z=0;z<$.length;z++){let q=$[z],K=$[z+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,X=q;else if(q===X)Z=!1,X="";continue}if(Z&&X==="`"&&q==="$"&&K==="{"){let U=1;z+=2;while(z<$.length&&U>0){if($[z]==="{")U++;else if($[z]==="}")U--;if(U>0)z++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&J===0&&Y===0&&Q===0){if(K==="|"){z++;continue}if(K==="="){z++;continue}return z}}return-1}function v0($,Z,X=!1){try{let J=$.trim(),Y=g8(J);if(Y>0){let Q=J.substring(0,Y).trim(),G=J.substring(Y+1).trim(),z=v0(Q,Z,!0);return x8(z,G,Z)}if(!z0(J)){if(!X)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return e(J,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return U0(J,Q)(...G)}catch{return e(J,Z)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let Q=Y[1],G=h8(Q,Object.keys(Z));if(G&&G!==Q)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!X)console.error(`Error evaluating expression: ${$}`,J);throw J}}function h8($,Z){let X=null;for(let Y of Z){if(Y===$)continue;let Q=u8($,Y);if(X===null||Q<X.dist)X={key:Y,dist:Q}}if(!X)return null;let J=Math.max($.length,X.key.length);if(X.dist<=2||X.dist/J<=0.35)return X.key;return null}function u8($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[X,J]=$.length<Z.length?[$,Z]:[Z,$],Y=Array(X.length+1),Q=Array(X.length+1);for(let G=0;G<=X.length;G++)Y[G]=G;for(let G=1;G<=J.length;G++){Q[0]=G;for(let z=1;z<=X.length;z++){let q=X[z-1]===J[G-1]?0:1;Q[z]=Math.min(Q[z-1]+1,Y[z]+1,Y[z-1]+q)}for(let z=0;z<=X.length;z++)Y[z]=Q[z]}return Y[X.length]}function Hz($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}import MQ from"fs";import A0 from"path";var P9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],a$=/<body\b([^>]*)>/gi;function Y1($){let Z=0,X,J=P9.map(()=>{return});while(Z<$.length){if(X===void 0||X!==null&&X.index<Z)a$.lastIndex=Z,X=a$.exec($);if(!X)return null;let Y=X.index,Q=-1,G=null;for(let q=0;q<P9.length;q++){let K=P9[q],U=J[q];if(U===void 0||U!==null&&U.index<Z)K.open.lastIndex=Z,U=K.open.exec($),J[q]=U;if(!U)continue;if(U.index<Y&&(Q===-1||U.index<Q))Q=U.index,G=K.close}if(Q===-1||!G)return{index:Y,tag:X[0],attrs:X[1]??""};G.lastIndex=Q;let z=G.exec($);if(!z)return null;Z=z.index+z[0].length}return null}function b1($,Z){let X=Y1($);if(!X)return $;return $.slice(0,X.index)+Z(X.tag,X.attrs)+$.slice(X.index+X.tag.length)}var t$=null;function d8($){if(!t$)return console.warn(`[stx] ${$} must be called within a component setup.`),null;return t$}function _z($){let Z=d8("onUpdate");if(Z)Z.updateHooks.push($)}function e$(){return`
127
- // STX Lifecycle Runtime
128
- (function() {
129
- if (typeof window === 'undefined') return;
130
-
131
- const instances = new Map();
132
- let currentInstance = null;
133
- let idCounter = 0;
134
-
135
- function generateId() {
136
- return 'stx-' + (++idCounter) + '-' + Date.now().toString(36);
137
- }
138
-
139
- function createInstance(element) {
140
- const instance = {
141
- id: generateId(),
142
- element: element,
143
- mountHooks: [],
144
- destroyHooks: [],
145
- updateHooks: [],
146
- refs: new Map(),
147
- watchers: [],
148
- isMounted: false
149
- };
150
- instances.set(instance.id, instance);
151
- return instance;
152
- }
153
-
154
- window.STX = window.STX || {};
155
-
156
- // Lifecycle hooks
157
- window.STX.onMount = function(hook) {
158
- if (currentInstance) currentInstance.mountHooks.push(hook);
159
- };
160
-
161
- window.STX.onDestroy = function(hook) {
162
- if (currentInstance) currentInstance.destroyHooks.push(hook);
163
- };
164
-
165
- window.STX.onUpdate = function(hook) {
166
- if (currentInstance) currentInstance.updateHooks.push(hook);
167
- };
168
-
169
- // Aliases
170
- window.STX.onMounted = window.STX.onMount;
171
- window.STX.onUnmounted = window.STX.onDestroy;
172
- window.STX.onUpdated = window.STX.onUpdate;
173
-
174
- // Refs
175
- window.STX.ref = function(initialValue) {
176
- const r = { value: initialValue || null };
177
- Object.defineProperty(r, 'current', {
178
- get: function() { return this.value; }
179
- });
180
- if (currentInstance) {
181
- currentInstance.refs.set('ref-' + currentInstance.refs.size, r);
182
- }
183
- return r;
184
- };
185
-
186
- // Watch
187
- window.STX.watch = function(source, callback, options) {
188
- options = options || {};
189
- let oldValue;
190
- let cleanup;
191
- let isActive = true;
192
-
193
- function run() {
194
- if (!isActive) return;
195
- const newValue = source();
196
- if (oldValue !== newValue || options.immediate) {
197
- if (cleanup) cleanup();
198
- cleanup = callback(newValue, oldValue);
199
- oldValue = newValue;
200
- }
201
- }
202
-
203
- if (options.immediate) {
204
- run();
205
- }
206
- else {
207
- oldValue = source();
208
- }
209
-
210
- const intervalId = setInterval(run, 16);
211
-
212
- function stop() {
213
- isActive = false;
214
- clearInterval(intervalId);
215
- if (cleanup) cleanup();
216
- }
217
-
218
- if (currentInstance) {
219
- currentInstance.watchers.push({ stop: stop });
220
- currentInstance.destroyHooks.push(stop);
221
- }
222
-
223
- return stop;
224
- };
225
-
226
- // Computed
227
- window.STX.computed = function(getter) {
228
- let cached;
229
- let dirty = true;
230
- return {
231
- get value() {
232
- if (dirty) {
233
- cached = getter();
234
- dirty = false;
235
- queueMicrotask(function() { dirty = true; });
236
- }
237
- return cached;
238
- }
239
- };
240
- };
241
-
242
- // Component management
243
- window.STX.setupComponent = function(element, setup) {
244
- const instance = createInstance(element);
245
- currentInstance = instance;
246
- try {
247
- setup();
248
- }
249
- finally {
250
- currentInstance = null;
251
- }
252
- return instance;
253
- };
254
-
255
- window.STX.mountComponent = function(instance) {
256
- if (instance.isMounted) return;
257
- instance.isMounted = true;
258
- instance.mountHooks.forEach(function(hook) {
259
- try {
260
- const cleanup = hook();
261
- if (typeof cleanup === 'function') {
262
- instance.destroyHooks.push(cleanup);
263
- }
264
- else if (cleanup && typeof cleanup.then === 'function') {
265
- cleanup.catch(function(e) { console.error('[stx] onMount error:', e); });
266
- }
267
- }
268
- catch (e) {
269
- console.error('[stx] onMount error:', e);
270
- }
271
- });
272
- };
273
-
274
- window.STX.destroyComponent = function(instance) {
275
- if (!instance.isMounted) return;
276
- instance.watchers.forEach(function(w) { w.stop(); });
277
- instance.destroyHooks.forEach(function(hook) {
278
- try { hook(); }
279
- catch (e) { console.error('[stx] onDestroy error:', e); }
280
- });
281
- instance.refs.forEach(function(ref) { ref.value = null; });
282
- instance.isMounted = false;
283
- instances.delete(instance.id);
284
- };
285
-
286
- // ==========================================================================
287
- // Vue-Style Refs System - No document.** required!
288
- // ==========================================================================
289
-
290
- // Internal: Query for ref elements without exposing document API
291
- function queryRef(name, root) {
292
- return (root || document).querySelector('[data-stx-ref="' + name + '"], [data-ref="' + name + '"]');
293
- }
294
-
295
- function queryAllRefs(root) {
296
- return (root || document).querySelectorAll('[data-stx-ref], [data-ref]');
297
- }
298
-
299
- // Auto-bind refs from ref attributes (Vue-style)
300
- window.STX.bindRefs = function(root, refs) {
301
- if (!root) return;
302
- queryAllRefs(root).forEach(function(el) {
303
- var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
304
- if (refs[refName]) {
305
- refs[refName].value = el;
306
- }
307
- });
308
- };
309
-
310
- // Vue-style useRefs() - returns object with all refs as direct elements
311
- // Usage: const { input, button, container } = STX.useRefs()
312
- window.STX.useRefs = function(root) {
313
- var refs = {};
314
- queryAllRefs(root).forEach(function(el) {
315
- var refName = el.getAttribute('data-stx-ref') || el.getAttribute('data-ref');
316
- if (refName) {
317
- refs[refName] = el;
318
- }
319
- });
320
- return refs;
321
- };
322
-
323
- // Get a single ref by name - Vue's useTemplateRef equivalent
324
- // Usage: const input = STX.useRef('input')
325
- window.STX.useRef = function(name, root) {
326
- return queryRef(name, root);
327
- };
328
-
329
- // Two-way binding helper for form elements
330
- // Usage: STX.model(inputEl, state, 'username')
331
- window.STX.model = function(el, state, key) {
332
- if (!el || !state) return;
333
-
334
- var isCheckbox = el.type === 'checkbox';
335
- var isRadio = el.type === 'radio';
336
- var isSelect = el.tagName === 'SELECT';
337
-
338
- // Set initial value
339
- if (isCheckbox) {
340
- el.checked = !!state[key];
341
- }
342
- else if (isRadio) {
343
- el.checked = el.value === state[key];
344
- }
345
- else {
346
- el.value = state[key] || '';
347
- }
348
-
349
- // Listen for changes
350
- var eventType = isCheckbox || isRadio ? 'change' : 'input';
351
- el.addEventListener(eventType, function() {
352
- if (isCheckbox) {
353
- state[key] = el.checked;
354
- }
355
- else if (isRadio) {
356
- if (el.checked) state[key] = el.value;
357
- }
358
- else {
359
- state[key] = el.value;
360
- }
361
- });
362
-
363
- // Return cleanup function
364
- return function() {
365
- el.removeEventListener(eventType, arguments.callee);
366
- };
367
- };
368
-
369
- // Batch event binding helper - cleaner than manual addEventListener
370
- // Usage: STX.on({ click: [btn1, btn2], input: [textField] }, handler)
371
- window.STX.on = function(el, event, handler) {
372
- if (!el) return function() {};
373
- el.addEventListener(event, handler);
374
- return function() { el.removeEventListener(event, handler); };
375
- };
376
-
377
- // Bind multiple events at once
378
- // Usage: STX.events(refs.btn, { click: handleClick, mouseenter: handleHover })
379
- window.STX.events = function(el, eventMap) {
380
- if (!el) return function() {};
381
- var cleanups = [];
382
- Object.keys(eventMap).forEach(function(event) {
383
- el.addEventListener(event, eventMap[event]);
384
- cleanups.push(function() { el.removeEventListener(event, eventMap[event]); });
385
- });
386
- return function() { cleanups.forEach(function(c) { c(); }); };
387
- };
388
-
389
- // ==========================================================================
390
- // DOM Helpers - Eliminate document.* usage
391
- // ==========================================================================
392
-
393
- // Global keyboard event listener
394
- // Usage: STX.onKey('Escape', () => closeModal())
395
- window.STX.onKey = function(key, handler, options) {
396
- var listener = function(e) {
397
- if (e.key === key) {
398
- handler(e);
399
- }
400
- };
401
- document.addEventListener('keydown', listener, options);
402
- return function() { document.removeEventListener('keydown', listener, options); };
403
- };
404
-
405
- // Create element helper
406
- // Usage: STX.el('div', { class: 'foo' }, 'text content')
407
- window.STX.el = function(tag, attrs, content) {
408
- var el = document.createElement(tag);
409
- if (attrs) {
410
- Object.keys(attrs).forEach(function(key) {
411
- if (key === 'class') {
412
- el.className = attrs[key];
413
- }
414
- else if (key.startsWith('on')) {
415
- el.addEventListener(key.slice(2).toLowerCase(), attrs[key]);
416
- }
417
- else {
418
- el.setAttribute(key, attrs[key]);
419
- }
420
- });
421
- }
422
- if (content) {
423
- if (typeof content === 'string') {
424
- el.textContent = content;
425
- }
426
- else if (Array.isArray(content)) {
427
- content.forEach(function(child) { el.appendChild(child); });
428
- }
429
- else {
430
- el.appendChild(content);
431
- }
432
- }
433
- return el;
434
- };
435
-
436
- // Get currently focused element
437
- // Usage: const focused = STX.activeElement()
438
- window.STX.activeElement = function() {
439
- return document.activeElement;
440
- };
441
-
442
- // Escape HTML helper
443
- // Usage: const safe = STX.escapeHtml(userInput)
444
- window.STX.escapeHtml = function(text) {
445
- var div = document.createElement('div');
446
- div.textContent = text;
447
- return div.innerHTML;
448
- };
449
-
450
- // MutationObserver for automatic lifecycle management
451
- const observer = new MutationObserver(function(mutations) {
452
- mutations.forEach(function(mutation) {
453
- // Handle removed nodes
454
- mutation.removedNodes.forEach(function(node) {
455
- if (node.nodeType === 1 && node.__stx_instance__) {
456
- window.STX.destroyComponent(node.__stx_instance__);
457
- }
458
- });
459
- });
460
- });
461
-
462
- // Start observing when DOM is ready
463
- if (document.readyState === 'loading') {
464
- document.addEventListener('DOMContentLoaded', function() {
465
- observer.observe(document.body, { childList: true, subtree: true });
466
- });
467
- }
468
- else {
469
- observer.observe(document.body, { childList: true, subtree: true });
470
- }
471
-
472
- console.log('[stx] Lifecycle runtime initialized');
473
- })();
474
- `}function v9($){return Symbol($)}var Vz=v9("theme"),Lz=v9("router"),Oz=v9("i18n");import*as Z3 from"crypto";function $3($){let Z=/\$(\w+)\./g,X=[],J;while((J=Z.exec($))!==null)if(!X.includes(J[1]))X.push(J[1]);return X}function m8(){return`stx-${Z3.randomBytes(4).toString("hex")}`}function l8($){return/\$\w+\./.test($)}function c8($){let Z=[],X=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(Q,G,z,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let K=[],U=!1,W=z,H=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...z.matchAll(H)];for(let O of j){let V=O[0],L=O[1],F=O[2];if(l8(F)){U=!0;let w=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(K.push({attr:L,expr:R,fullMatch:V,originalAttr:L}),$3(R).forEach((A)=>X.add(A)),L==="text")W=W.replace(V,"");else if(L==="class")W=W.replace(V,'class=""');else if(L==="disabled"||L==="hidden")W=W.replace(V,"");else W=W.replace(V,`${L}=""`)}}}if(!U)return Q;let B=W.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=m8(),W=` id="${_}"${W}`;for(let O of K)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:$3(O.expr)});return`<${G}${W}${q}`}),{html:Y,bindings:Z,stores:X}}function p8($,Z){if($.length===0)return"";let X=Array.from(Z),J=`
475
- <script>
476
- (function() {
477
- 'use strict';
478
-
479
- // Wait for stores to be available
480
- function initBindings() {
481
- var stores = window.VoideStores;
482
- if (!stores) {
483
- setTimeout(initBindings, 10);
484
- return;
485
- }
486
-
487
- // Store references for expressions
488
- // eslint-disable-next-line pickier/no-unused-vars
489
- var $state = {};
490
- `;for(let Y of X)J+=` $state.${Y} = stores.${Y} ? stores.${Y}.get() : {};
491
- `;J+=`
492
- // Binding update functions
493
- function updateBindings() {
494
- `;for(let Y of $){let{elementId:Q,attribute:G,expression:z}=Y,q=z.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")J+=` (function() {
495
- var el = document.getElementById('${Q}');
496
- if (el) {
497
- try {
498
- el.textContent = ${q};
499
- }
500
- catch (e) { console.error('Binding error:', e); }
501
- }
502
- })();
503
- `;else if(G==="html")J+=` (function() {
504
- var el = document.getElementById('${Q}');
505
- if (el) {
506
- try {
507
- el.innerHTML = ${q};
508
- }
509
- catch (e) { console.error('Binding error:', e); }
510
- }
511
- })();
512
- `;else if(G==="class")J+=` (function() {
513
- var el = document.getElementById('${Q}');
514
- if (el) {
515
- try {
516
- var value = ${q};
517
- if (typeof value === 'string') {
518
- // Dynamic class string - merge with existing static classes
519
- // eslint-disable-next-line pickier/no-unused-vars
520
- var staticClasses = el.getAttribute('data-static-class') || el.className;
521
- if (!el.hasAttribute('data-static-class')) {
522
- el.setAttribute('data-static-class', el.className);
523
- }
524
- el.className = (el.getAttribute('data-static-class') + ' ' + value).trim();
525
- }
526
- else if (typeof value === 'object') {
527
- // Object syntax: { 'class-name': condition }
528
- for (var cls in value) {
529
- if (value[cls]) {
530
- el.classList.add(cls);
531
- }
532
- else {
533
- el.classList.remove(cls);
534
- }
535
- }
536
- }
537
- }
538
- catch (e) { console.error('Binding error:', e); }
539
- }
540
- })();
541
- `;else if(G==="show")J+=` (function() {
542
- var el = document.getElementById('${Q}');
543
- if (el) {
544
- try {
545
- el.style.display = (${q}) ? '' : 'none';
546
- }
547
- catch (e) { console.error('Binding error:', e); }
548
- }
549
- })();
550
- `;else if(G==="if")J+=` (function() {
551
- var el = document.getElementById('${Q}');
552
- if (el) {
553
- try {
554
- el.style.visibility = (${q}) ? 'visible' : 'hidden';
555
- }
556
- catch (e) { console.error('Binding error:', e); }
557
- }
558
- })();
559
- `;else J+=` (function() {
560
- var el = document.getElementById('${Q}');
561
- if (el) {
562
- try {
563
- var value = ${q};
564
- if (value === false || value === null || value === undefined) {
565
- el.removeAttribute('${G}');
566
- }
567
- else if (value === true) {
568
- el.setAttribute('${G}', '');
569
- }
570
- else {
571
- el.setAttribute('${G}', value);
572
- }
573
- }
574
- catch (e) { console.error('Binding error:', e); }
575
- }
576
- })();
577
- `}J+=` }
578
-
579
- // Subscribe to stores and update on changes. Capture the disposers so
580
- // SPA fragment swaps can tear down old bindings before the next page's
581
- // runtime takes over \u2014 without this, every navigation between pages
582
- // using reactive-bindings stacked another subscription on every store,
583
- // walking detached DOM forever. See stacksjs/stx#1709.
584
- var _disposers = [];
585
- `;for(let Y of X)J+=` if (stores.${Y}) {
586
- var _unsub_${Y} = stores.${Y}.subscribe(function(state) {
587
- $state.${Y} = state;
588
- updateBindings();
589
- });
590
- // store.subscribe() may return the disposer (preferred) or void; both
591
- // are tolerated here.
592
- if (typeof _unsub_${Y} === 'function') _disposers.push(_unsub_${Y});
593
- }
594
- `;return J+=`
595
- // Initial update
596
- updateBindings();
597
-
598
- // Register this runtime's cleanup so SPA navigation can run it before
599
- // swapping pages. The router (and any code) can call
600
- // window.__stxCleanupBindings() to dispose subscriptions; we also wire
601
- // 'popstate' and 'beforeunload' as a safety net for browser-driven nav.
602
- function _cleanup() {
603
- for (var i = 0; i < _disposers.length; i++) {
604
- try { _disposers[i](); } catch (e) { /* swallow */ }
605
- }
606
- _disposers.length = 0;
607
- }
608
- if (!window.__stxBindingsCleanups) window.__stxBindingsCleanups = [];
609
- window.__stxBindingsCleanups.push(_cleanup);
610
- if (!window.__stxCleanupBindings) {
611
- window.__stxCleanupBindings = function() {
612
- var fns = window.__stxBindingsCleanups || [];
613
- for (var i = 0; i < fns.length; i++) {
614
- try { fns[i](); } catch (e) { /* swallow */ }
615
- }
616
- window.__stxBindingsCleanups = [];
617
- };
618
- window.addEventListener('popstate', window.__stxCleanupBindings);
619
- window.addEventListener('beforeunload', window.__stxCleanupBindings);
620
- }
621
- }
622
-
623
- // Start when DOM is ready
624
- if (document.readyState === 'loading') {
625
- document.addEventListener('DOMContentLoaded', initBindings);
626
- }
627
- else {
628
- initBindings();
629
- }
630
- })();
631
- </script>
632
- `,J}function X3($){let{html:Z,bindings:X,stores:J}=c8($);if(X.length===0)return $;let Y=p8(X,J),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+Y+Z.slice(Q);return Z+Y}function J3($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return i8(Z);case"google-analytics":return n8(Z);case"plausible":return o8(Z);case"self-hosted":return s8(Z);case"custom":return r8(Z);default:return""}}function i8($){let Z=$.fathom;if(!Z?.siteId)return"";let X=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Y=[`data-site="${f0(Z.siteId)}"`];if(Z.honorDnt)Y.push('data-honor-dnt="true"');if(Z.spa)Y.push('data-spa="auto"');if(Z.canonical)Y.push(`data-canonical="${f0(Z.canonical)}"`);if(Z.auto===!1)Y.push('data-auto="false"');return`
633
- <!-- Fathom Analytics -->
634
- <script src="${f0(X)}" ${Y.join(" ")}${J}></script>
635
- `}function n8($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let X=f0(Z.measurementId),J=Z.debug?`gtag('config', '${X}', { 'debug_mode': true });`:"";return`
636
- <!-- Google Analytics -->
637
- <script async src="https://www.googletagmanager.com/gtag/js?id=${X}"></script>
638
- <script>
639
- window.dataLayer = window.dataLayer || [];
640
- function gtag(){dataLayer.push(arguments);}
641
- gtag('js', new Date());
642
- gtag('config', '${X}');
643
- ${J}
644
- </script>
645
- `}function o8($){let Z=$.plausible;if(!Z?.domain)return"";let X=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${f0(Z.domain)}"`],Y=X,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&X==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
646
- <!-- Plausible Analytics -->
647
- <script defer data-domain="${f0(Z.domain)}" src="${f0(Y)}"></script>
648
- `}function s8($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let X=f0(Z.siteId),J=f0(Z.apiEndpoint),Y=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
649
- d.addEventListener('click',function(e){
650
- var a=e.target.closest('a');
651
- if(a&&a.hostname!==location.hostname){
652
- t('outbound',{url:a.href});
653
- }
654
- });`:"";return`
655
- <!-- Self-Hosted Analytics -->
656
- <script data-site="${X}" data-api="${J}" defer>
657
- (function(){
658
- 'use strict';
659
- var d=document,w=window,n=navigator,s=d.currentScript;
660
- var site=s.dataset.site,api=s.dataset.api;
661
- ${Y}
662
- var q=[],sid=Math.random().toString(36).slice(2);
663
- function t(e,p){
664
- var x=new XMLHttpRequest();
665
- x.open('POST',api+'/collect',true);
666
- x.setRequestHeader('Content-Type','application/json');
667
- x.send(JSON.stringify({
668
- s:site,sid:sid,e:e,p:p||{},
669
- u:location.href,r:d.referrer,t:d.title,
670
- sw:screen.width,sh:screen.height
671
- }));
672
- }
673
- function pv(){t('pageview');}
674
- ${Q}
675
- ${G}
676
- if(d.readyState==='complete')pv();
677
- else w.addEventListener('load',pv);
678
- w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
679
- })();
680
- </script>
681
- `}function r8($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
682
- <!-- Custom Analytics -->
683
- <script>
684
- ${Z.inlineScript}
685
- </script>
686
- `;if(!Z.scriptUrl)return"";let X=[];if(Z.scriptId)X.push(`id="${f0(Z.scriptId)}"`);if(Z.attributes)for(let[Y,Q]of Object.entries(Z.attributes))X.push(`${f0(Y)}="${f0(Q)}"`);return`
687
- <!-- Custom Analytics -->
688
- <script${X.length>0?` ${X.join(" ")}`:""} src="${f0(Z.scriptUrl)}" defer></script>
689
- `}function Y3($,Z){let X=J3(Z);if(!X)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}return $.replace("</head>",`${X}</head>`)}function f0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var Rz={name:"analytics",hasEndTag:!1,handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};return J3(Y)}};var a8={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};function Q3($){let Z=$.heatmap;if(!Z?.enabled)return"";let X={...a8,...Z};return`
690
- <!-- stx Heatmap - Privacy-Compliant Tracking -->
691
- <script>
692
- (function() {
693
- 'use strict';
694
-
695
- // Configuration
696
- var config = ${JSON.stringify({trackMouse:X.trackMouse,trackClicks:X.trackClicks,trackScroll:X.trackScroll,samplingRate:X.samplingRate,honorDnt:X.honorDnt,endpoint:X.endpoint,batchSize:X.batchSize,maxDataPoints:X.maxDataPoints,sessionTimeout:X.sessionTimeout,persistData:X.persistData,storagePrefix:X.storagePrefix,captureAttributes:X.captureAttributes,ignoreSelectors:X.ignoreSelectors,zones:X.zones,debugOverlay:X.debugOverlay,minViewportWidth:X.minViewportWidth,maxViewportWidth:X.maxViewportWidth})};
697
-
698
- // Check Do Not Track
699
- if (config.honorDnt && navigator.doNotTrack === '1') {
700
- return;
701
- }
702
-
703
- // Check viewport constraints
704
- var vw = window.innerWidth;
705
- if (config.minViewportWidth && vw < config.minViewportWidth) return;
706
- if (config.maxViewportWidth && vw > config.maxViewportWidth) return;
707
-
708
- // Session management (anonymous, no cookies)
709
- var session = {
710
- sid: Math.random().toString(36).slice(2) + Date.now().toString(36),
711
- page: location.pathname,
712
- vw: window.innerWidth,
713
- vh: window.innerHeight,
714
- points: [],
715
- started: Date.now(),
716
- lastActivity: Date.now()
717
- };
718
-
719
- // Throttle helper
720
- var lastMove = 0;
721
- function throttle(fn, wait) {
722
- return function() {
723
- var now = Date.now();
724
- if (now - lastMove >= wait) {
725
- lastMove = now;
726
- fn.apply(this, arguments);
727
- }
728
- };
729
- }
730
-
731
- // Get relative coordinates (percentage)
732
- function getRelativeCoords(e) {
733
- return {
734
- x: Math.round((e.clientX / window.innerWidth) * 10000) / 100,
735
- y: Math.round((e.clientY / window.innerHeight) * 10000) / 100
736
- };
737
- }
738
-
739
- // Check if element should be ignored
740
- function shouldIgnore(el) {
741
- if (!el || !config.ignoreSelectors) return false;
742
- for (var i = 0; i < config.ignoreSelectors.length; i++) {
743
- if (el.matches && el.matches(config.ignoreSelectors[i])) return true;
744
- if (el.closest && el.closest(config.ignoreSelectors[i])) return true;
745
- }
746
- return false;
747
- }
748
-
749
- // Get element selector (simplified, no IDs to preserve privacy)
750
- function getSelector(el) {
751
- if (!el || !el.tagName) return null;
752
- var tag = el.tagName.toLowerCase();
753
- var classes = el.className && typeof el.className === 'string'
754
- ? '.' + el.className.trim().split(/\\s+/).slice(0, 2).join('.')
755
- : '';
756
- return tag + classes;
757
- }
758
-
759
- // Find zone for element
760
- function findZone(el) {
761
- if (!config.zones || !el) return null;
762
- for (var i = 0; i < config.zones.length; i++) {
763
- var zone = config.zones[i];
764
- if (el.closest && el.closest(zone.selector)) {
765
- return zone.id;
766
- }
767
- }
768
- return null;
769
- }
770
-
771
- // Capture custom attributes
772
- function captureAttributes(el) {
773
- if (!config.captureAttributes || !el) return null;
774
- var attrs = {};
775
- var hasAttrs = false;
776
- for (var i = 0; i < config.captureAttributes.length; i++) {
777
- var attr = config.captureAttributes[i];
778
- var value = el.getAttribute && el.getAttribute(attr);
779
- if (value) {
780
- attrs[attr] = value;
781
- hasAttrs = true;
782
- }
783
- }
784
- return hasAttrs ? attrs : null;
785
- }
786
-
787
- // Add data point
788
- function addPoint(point) {
789
- session.lastActivity = Date.now();
790
- if (session.points.length >= config.maxDataPoints) {
791
- session.points.shift();
792
- }
793
- session.points.push(point);
794
-
795
- // Send batch if threshold reached
796
- if (config.endpoint && session.points.length >= config.batchSize) {
797
- sendData();
798
- }
799
- }
800
-
801
- // Send data to endpoint
802
- function sendData() {
803
- if (!config.endpoint || session.points.length === 0) return;
804
-
805
- var data = {
806
- sid: session.sid,
807
- page: session.page,
808
- vw: session.vw,
809
- vh: session.vh,
810
- points: session.points.splice(0, config.batchSize)
811
- };
812
-
813
- // Use sendBeacon for reliability
814
- if (navigator.sendBeacon) {
815
- navigator.sendBeacon(config.endpoint, JSON.stringify(data));
816
- }
817
- else {
818
- var xhr = new XMLHttpRequest();
819
- xhr.open('POST', config.endpoint, true);
820
- xhr.setRequestHeader('Content-Type', 'application/json');
821
- xhr.send(JSON.stringify(data));
822
- }
823
- }
824
-
825
- // Mouse move handler
826
- if (config.trackMouse) {
827
- document.addEventListener('mousemove', throttle(function(e) {
828
- if (shouldIgnore(e.target)) return;
829
- var coords = getRelativeCoords(e);
830
- addPoint({
831
- x: coords.x,
832
- y: coords.y,
833
- type: 'move',
834
- t: Date.now(),
835
- zone: findZone(e.target)
836
- });
837
- }, config.samplingRate), { passive: true });
838
- }
839
-
840
- // Click handler
841
- if (config.trackClicks) {
842
- document.addEventListener('click', function(e) {
843
- if (shouldIgnore(e.target)) return;
844
- var coords = getRelativeCoords(e);
845
- var point = {
846
- x: coords.x,
847
- y: coords.y,
848
- type: 'click',
849
- t: Date.now(),
850
- el: getSelector(e.target),
851
- zone: findZone(e.target)
852
- };
853
- var attrs = captureAttributes(e.target);
854
- if (attrs) point.attrs = attrs;
855
- addPoint(point);
856
- }, { passive: true });
857
- }
858
-
859
- // Scroll handler
860
- if (config.trackScroll) {
861
- var lastScrollDepth = 0;
862
- document.addEventListener('scroll', throttle(function() {
863
- var scrollTop = window.pageYOffset || document.documentElement.scrollTop;
864
- var scrollHeight = document.documentElement.scrollHeight - window.innerHeight;
865
- var depth = scrollHeight > 0 ? Math.round((scrollTop / scrollHeight) * 100) : 0;
866
-
867
- // Only track significant scroll changes (every 10%)
868
- if (Math.abs(depth - lastScrollDepth) >= 10) {
869
- lastScrollDepth = depth;
870
- addPoint({
871
- x: 50,
872
- y: depth,
873
- type: 'scroll',
874
- t: Date.now(),
875
- depth: depth
876
- });
877
- }
878
- }, config.samplingRate * 2), { passive: true });
879
- }
880
-
881
- // Send remaining data on page unload
882
- window.addEventListener('beforeunload', sendData);
883
- window.addEventListener('visibilitychange', function() {
884
- if (document.visibilityState === 'hidden') {
885
- sendData();
886
- }
887
- });
888
-
889
- // Persist data to localStorage if enabled
890
- if (config.persistData) {
891
- var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
892
-
893
- // Load existing data
894
- try {
895
- var stored = localStorage.getItem(storageKey);
896
- if (stored) {
897
- var parsed = JSON.parse(stored);
898
- if (Date.now() - parsed.lastActivity < config.sessionTimeout * 60000) {
899
- session.points = parsed.points || [];
900
- }
901
- }
902
- }
903
- catch (e) {}
904
-
905
- // Save periodically
906
- setInterval(function() {
907
- try {
908
- localStorage.setItem(storageKey, JSON.stringify({
909
- points: session.points,
910
- lastActivity: session.lastActivity
911
- }));
912
- }
913
- catch (e) {}
914
- }, 5000);
915
- }
916
-
917
- // Debug overlay
918
- if (config.debugOverlay) {
919
- var overlay = document.createElement('div');
920
- overlay.id = 'stx-heatmap-overlay';
921
- overlay.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;pointer-events:none;z-index:999999;';
922
- document.body.appendChild(overlay);
923
-
924
- var canvas = document.createElement('canvas');
925
- canvas.width = window.innerWidth;
926
- canvas.height = window.innerHeight;
927
- canvas.style.cssText = 'width:100%;height:100%;';
928
- overlay.appendChild(canvas);
929
- var ctx = canvas.getContext('2d');
930
-
931
- function renderOverlay() {
932
- ctx.clearRect(0, 0, canvas.width, canvas.height);
933
- session.points.forEach(function(p) {
934
- var x = (p.x / 100) * canvas.width;
935
- var y = (p.y / 100) * canvas.height;
936
- ctx.beginPath();
937
- ctx.arc(x, y, p.type === 'click' ? 8 : 3, 0, Math.PI * 2);
938
- ctx.fillStyle = p.type === 'click' ? 'rgba(255,0,0,0.5)' : 'rgba(0,0,255,0.2)';
939
- ctx.fill();
940
- });
941
- requestAnimationFrame(renderOverlay);
942
- }
943
- renderOverlay();
944
-
945
- window.addEventListener('resize', function() {
946
- canvas.width = window.innerWidth;
947
- canvas.height = window.innerHeight;
948
- });
949
- }
950
-
951
- // Expose API for manual tracking and data export
952
- window.stxHeatmap = {
953
- // Get current session data
954
- getData: function() {
955
- return {
956
- sid: session.sid,
957
- page: session.page,
958
- vw: session.vw,
959
- vh: session.vh,
960
- points: session.points.slice(),
961
- started: session.started,
962
- lastActivity: session.lastActivity
963
- };
964
- },
965
- // Export data as JSON
966
- exportJSON: function() {
967
- return JSON.stringify(this.getData(), null, 2);
968
- },
969
- // Export data as CSV
970
- exportCSV: function() {
971
- var data = this.getData();
972
- var lines = ['x,y,type,timestamp,element,zone,depth'];
973
- data.points.forEach(function(p) {
974
- lines.push([p.x, p.y, p.type, p.t, p.el || '', p.zone || '', p.depth || ''].join(','));
975
- });
976
- return lines.join('\\n');
977
- },
978
- // Manual data send
979
- flush: function() {
980
- sendData();
981
- },
982
- // Clear data
983
- clear: function() {
984
- session.points = [];
985
- if (config.persistData) {
986
- var storageKey = config.storagePrefix + '_' + session.page.replace(/\\//g, '_');
987
- try { localStorage.removeItem(storageKey); }
988
- catch (e) {}
989
- }
990
- },
991
- // Add custom event
992
- track: function(type, data) {
993
- addPoint({
994
- x: data && data.x || 0,
995
- y: data && data.y || 0,
996
- type: type,
997
- t: Date.now(),
998
- attrs: data
999
- });
1000
- },
1001
- // Generate heatmap visualization
1002
- visualize: function(options) {
1003
- options = options || {};
1004
- var data = this.getData();
1005
- var width = options.width || data.vw;
1006
- var height = options.height || data.vh;
1007
- var radius = options.radius || 20;
1008
- var blur = options.blur || 15;
1009
- var maxOpacity = options.maxOpacity || 0.6;
1010
-
1011
- var canvas = document.createElement('canvas');
1012
- canvas.width = width;
1013
- canvas.height = height;
1014
- var ctx = canvas.getContext('2d');
1015
-
1016
- // Create heat points
1017
- data.points.forEach(function(p) {
1018
- var x = (p.x / 100) * width;
1019
- var y = (p.y / 100) * height;
1020
- var intensity = p.type === 'click' ? 1 : 0.3;
1021
-
1022
- var gradient = ctx.createRadialGradient(x, y, 0, x, y, radius);
1023
- gradient.addColorStop(0, 'rgba(255,0,0,' + intensity + ')');
1024
- gradient.addColorStop(1, 'rgba(255,0,0,0)');
1025
- ctx.fillStyle = gradient;
1026
- ctx.fillRect(x - radius, y - radius, radius * 2, radius * 2);
1027
- });
1028
-
1029
- // Apply blur
1030
- ctx.filter = 'blur(' + blur + 'px)';
1031
- ctx.drawImage(canvas, 0, 0);
1032
- ctx.filter = 'none';
1033
-
1034
- // Colorize
1035
- var imageData = ctx.getImageData(0, 0, width, height);
1036
- var pixels = imageData.data;
1037
- for (var i = 0; i < pixels.length; i += 4) {
1038
- var alpha = pixels[i + 3];
1039
- if (alpha > 0) {
1040
- var ratio = alpha / 255;
1041
- // Gradient: blue -> cyan -> green -> yellow -> red
1042
- if (ratio < 0.25) {
1043
- pixels[i] = 0;
1044
- pixels[i + 1] = Math.round(ratio * 4 * 255);
1045
- pixels[i + 2] = 255;
1046
- }
1047
- else if (ratio < 0.5) {
1048
- pixels[i] = 0;
1049
- pixels[i + 1] = 255;
1050
- pixels[i + 2] = Math.round((1 - (ratio - 0.25) * 4) * 255);
1051
- }
1052
- else if (ratio < 0.75) {
1053
- pixels[i] = Math.round((ratio - 0.5) * 4 * 255);
1054
- pixels[i + 1] = 255;
1055
- pixels[i + 2] = 0;
1056
- }
1057
- else {
1058
- pixels[i] = 255;
1059
- pixels[i + 1] = Math.round((1 - (ratio - 0.75) * 4) * 255);
1060
- pixels[i + 2] = 0;
1061
- }
1062
- pixels[i + 3] = Math.round(alpha * maxOpacity);
1063
- }
1064
- }
1065
- ctx.putImageData(imageData, 0, 0);
1066
-
1067
- return canvas;
1068
- }
1069
- };
1070
- })();
1071
- </script>
1072
- `}function G3($,Z){let X=Q3(Z);if(!X)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);return $+X}var z3={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,X,J)=>{let Y=X.__stx_config||{};if(Z.length>0){let Q=t8(Z.join(" "));Y.heatmap={...Y.heatmap,...Q,enabled:!0}}return Q3(Y)}};function t8($){let Z={},X=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of X){let[Y,Q]=J.split("="),G=Q?.replace(/["']/g,"");switch(Y){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}class q3{sessions=new Map;addSession($){let Z=this.sessions.get($.sid);if(Z)Z.points.push(...$.points),Z.lastActivity=Math.max(Z.lastActivity,$.lastActivity);else this.sessions.set($.sid,$)}getPageData($){let Z=[];for(let X of this.sessions.values())if(X.page===$)Z.push(...X.points);return Z}getClickData($){return this.getPageData($).filter((Z)=>Z.type==="click")}getMovementData($){return this.getPageData($).filter((Z)=>Z.type==="move")}getScrollData($){let Z=this.getPageData($).filter((J)=>J.type==="scroll"),X=new Map;for(let J of Z)if(J.depth!==void 0)X.set(J.depth,(X.get(J.depth)||0)+1);return Array.from(X.entries()).map(([J,Y])=>({depth:J,count:Y})).sort((J,Y)=>J.depth-Y.depth)}getZoneStats($){let Z=new Map,X=this.getPageData($);for(let J of X)if(J.zone){let Y=Z.get(J.zone)||{clicks:0,hovers:0};if(J.type==="click")Y.clicks++;else if(J.type==="move")Y.hovers++;Z.set(J.zone,Y)}return Z}generateGridData($,Z=20){let X=this.getPageData($),J=[];for(let Q=0;Q<Z;Q++){J[Q]=[];for(let G=0;G<Z;G++)J[Q][G]=0}for(let Q of X){let G=Math.min(Math.floor(Q.x/100*Z),Z-1),z=Math.min(Math.floor(Q.y/100*Z),Z-1);J[z][G]+=Q.type==="click"?3:1}let Y=0;for(let Q of J)for(let G of Q)Y=Math.max(Y,G);return J.map((Q,G)=>Q.map((z,q)=>({x:q,y:G,intensity:Y>0?z/Y:0})))}exportJSON(){return JSON.stringify({sessions:Array.from(this.sessions.values()),exportedAt:new Date().toISOString()},null,2)}clear(){this.sessions.clear()}get sessionCount(){return this.sessions.size}get totalPoints(){let $=0;for(let Z of this.sessions.values())$+=Z.points.length;return $}}function Nz(){return new q3}var e8;((G)=>{G.Fade="fade";G.Slide="slide";G.Scale="scale";G.Flip="flip";G.Rotate="rotate";G.Custom="custom"})(e8||={});var $Z;((J)=>{J.In="in";J.Out="out";J.Both="both"})($Z||={});var ZZ;((G)=>{G.Linear="linear";G.Ease="ease";G.EaseIn="ease-in";G.EaseOut="ease-out";G.EaseInOut="ease-in-out";G.Spring="spring"})(ZZ||={});var e0={duration:300,delay:0,ease:"ease",direction:"both"};function XZ($,Z={}){let{duration:X,delay:J,ease:Y,direction:Q,custom:G}={...e0,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1073
- @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1074
- @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1075
- @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
1076
- @keyframes slideOut { from { transform: translateY(0); opacity: 1; } to { transform: translateY(20px); opacity: 0; } }`;case"scale":return`${Q==="in"?"transform: scale(0.95); opacity: 0; animation: scaleIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: scale(1); opacity: 1; animation: scaleOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: scale(1); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1077
- @keyframes scaleIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
1078
- @keyframes scaleOut { from { transform: scale(1); opacity: 1; } to { transform: scale(0.95); opacity: 0; } }`;case"flip":return`${Q==="in"?"transform: perspective(400px) rotateX(-90deg); opacity: 0; animation: flipIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: perspective(400px) rotateX(0); opacity: 1; animation: flipOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: perspective(400px) rotateX(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1079
- @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1080
- @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1081
- @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1082
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function JZ(){return`
1083
- <script data-stx-scoped data-stx-run="once">
1084
- // Motion preferences handling
1085
- (function() {
1086
- const prefersReducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
1087
-
1088
- if (prefersReducedMotion) {
1089
- // Apply reduced motion settings
1090
- document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
1091
- document.documentElement.setAttribute('data-reduced-motion', 'true');
1092
- }
1093
- else {
1094
- document.documentElement.setAttribute('data-reduced-motion', 'false');
1095
- }
1096
-
1097
- // Listen for changes in preference
1098
- window.matchMedia('(prefers-reduced-motion: reduce)').addEventListener('change', (e) => {
1099
- if (e.matches) {
1100
- document.documentElement.style.setProperty('--stx-transition-duration', '0ms');
1101
- document.documentElement.setAttribute('data-reduced-motion', 'true');
1102
- }
1103
- else {
1104
- document.documentElement.style.setProperty('--stx-transition-duration', '');
1105
- document.documentElement.setAttribute('data-reduced-motion', 'false');
1106
- }
1107
- });
1108
- })();
1109
- </script>
1110
- `}function YZ($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((X)=>X.test($))}function QZ($=0.1,Z="0px"){return`
1111
- <script data-stx-scoped data-stx-run="always">
1112
- // Intersection Observer for scroll animations
1113
- (function() {
1114
- const initObserver = () => {
1115
- if (!('IntersectionObserver' in window)) {
1116
- // For browsers that don't support IntersectionObserver, show all elements immediately
1117
- const elements = document.querySelectorAll('.stx-observe');
1118
- elements.forEach(el => el.classList.remove('stx-out'));
1119
- return;
1120
- }
1121
-
1122
- // Create the observer
1123
- const options = {
1124
- root: null, // Use viewport
1125
- rootMargin: '${Z}',
1126
- threshold: ${$}
1127
- };
1128
-
1129
- const observer = new IntersectionObserver((entries) => {
1130
- entries.forEach(entry => {
1131
- if (entry.isIntersecting) {
1132
- entry.target.classList.remove('stx-out');
1133
- // Stop observing after animation is triggered
1134
- observer.unobserve(entry.target);
1135
- }
1136
- });
1137
- }, options);
1138
-
1139
- // Start observing elements
1140
- const elements = document.querySelectorAll('.stx-observe');
1141
- elements.forEach(el => observer.observe(el));
1142
- };
1143
-
1144
- // Initialize observer when DOM is ready
1145
- if (document.readyState === 'loading') {
1146
- document.addEventListener('DOMContentLoaded', initObserver);
1147
- }
1148
- else {
1149
- initObserver();
1150
- }
1151
- })();
1152
- </script>
1153
- `}function GZ(){return`
1154
- <style id="stx-animation-base">
1155
- :root {
1156
- --stx-transition-duration: 300ms;
1157
- --stx-transition-delay: 0ms;
1158
- --stx-transition-ease: ease;
1159
- }
1160
-
1161
- @media (prefers-reduced-motion: reduce) {
1162
- :root {
1163
- --stx-transition-duration: 0ms;
1164
- }
1165
- }
1166
-
1167
- [data-animate="false"] * {
1168
- --stx-transition-duration: 0ms !important;
1169
- animation-duration: 0ms !important;
1170
- transition-duration: 0ms !important;
1171
- }
1172
-
1173
- /* Base transition classes */
1174
- .stx-transition {
1175
- transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1176
- transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1177
- backface-visibility: hidden; /* Improve animation performance */
1178
- transform-style: preserve-3d; /* Better 3D transforms */
1179
- }
1180
-
1181
- /* Fade animations */
1182
- .stx-fade {
1183
- transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1184
- }
1185
-
1186
- .stx-fade.stx-out {
1187
- opacity: 0 !important;
1188
- }
1189
-
1190
- /* Scale animations */
1191
- .stx-scale {
1192
- transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1193
- opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1194
- }
1195
-
1196
- .stx-scale.stx-out {
1197
- transform: scale(0.85) !important;
1198
- opacity: 0 !important;
1199
- }
1200
-
1201
- /* Flip animations */
1202
- .stx-flip {
1203
- transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1204
- opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1205
- perspective: 600px;
1206
- }
1207
-
1208
- .stx-flip.stx-out {
1209
- transform: perspective(600px) rotateX(-90deg) !important;
1210
- opacity: 0 !important;
1211
- }
1212
-
1213
- /* Rotate animations */
1214
- .stx-rotate {
1215
- transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1216
- opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1217
- }
1218
-
1219
- .stx-rotate.stx-out {
1220
- transform: rotate(-90deg) !important;
1221
- opacity: 0 !important;
1222
- }
1223
-
1224
- /* Direction-based animations */
1225
- .stx-from-left, .stx-from-right, .stx-from-top, .stx-from-bottom {
1226
- transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1227
- opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1228
- }
1229
-
1230
- .stx-from-left.stx-out {
1231
- transform: translateX(-30px) !important;
1232
- opacity: 0 !important;
1233
- }
1234
-
1235
- .stx-from-right.stx-out {
1236
- transform: translateX(30px) !important;
1237
- opacity: 0 !important;
1238
- }
1239
-
1240
- .stx-from-top.stx-out {
1241
- transform: translateY(-30px) !important;
1242
- opacity: 0 !important;
1243
- }
1244
-
1245
- .stx-from-bottom.stx-out {
1246
- transform: translateY(30px) !important;
1247
- opacity: 0 !important;
1248
- }
1249
-
1250
- /* Generic slide animations */
1251
- .stx-slide {
1252
- transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1253
- opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1254
- }
1255
-
1256
- .stx-slide.stx-out {
1257
- transform: translateY(30px) !important;
1258
- opacity: 0 !important;
1259
- }
1260
-
1261
- /* Scroll animation observer class */
1262
- .stx-observe {
1263
- will-change: opacity, transform;
1264
- transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms),
1265
- transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1266
- }
1267
- </style>
1268
- `}function zZ($,Z,X={}){let{staggerDelay:J=50,sequence:Y=!1}=X;return`
1269
- <script data-stx-scoped data-stx-run="always">
1270
- // Animation Group: ${$}
1271
- (function() {
1272
- const elements = ${JSON.stringify(Z)};
1273
- const staggerDelay = ${J};
1274
- const sequence = ${Y};
1275
-
1276
- function animateGroup() {
1277
- elements.forEach((selector, index) => {
1278
- const element = document.querySelector(selector);
1279
- if (!element) return;
1280
-
1281
- const delay = sequence ? index * staggerDelay : 0;
1282
- element.style.setProperty('--stx-transition-delay', delay + 'ms');
1283
-
1284
- // For elements using animation keyframes
1285
- element.style.animationDelay = delay + 'ms';
1286
-
1287
- // If the element is initially hidden, show it
1288
- if (element.classList.contains('stx-out')) {
1289
- setTimeout(() => {
1290
- element.classList.remove('stx-out');
1291
- }, 10); // Small delay to ensure styles are applied
1292
- }
1293
- });
1294
- }
1295
-
1296
- // Run when DOM is fully loaded
1297
- if (document.readyState === 'loading') {
1298
- document.addEventListener('DOMContentLoaded', animateGroup);
1299
- }
1300
- else {
1301
- animateGroup();
1302
- }
1303
- })();
1304
- </script>
1305
- `}var f9={name:"transition",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=XZ(Y,{duration:Q,delay:z,ease:G,direction:q}),W="stx-transition",H="";if(Y==="fade")H="stx-fade";else if(Y==="slide")H="stx-slide";else if(Y==="scale")H="stx-scale";else if(Y==="flip")H="stx-flip";else if(Y==="rotate")H="stx-rotate";return`<div id="${K}" class="${W} ${H} ${q==="out"?"stx-out":""}"
1306
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},x9={name:"scrollAnimate",handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,W="stx-transition stx-observe stx-out";if(Y==="fade")W+=" stx-fade";else if(Y==="slide-up"||Y==="slide")W+=" stx-from-bottom";else if(Y==="slide-down")W+=" stx-from-top";else if(Y==="slide-left")W+=" stx-from-right";else if(Y==="slide-right")W+=" stx-from-left";else if(Y==="scale")W+=" stx-scale";else if(Y.includes("-"))W+=` stx-${Y}`;else W+=` stx-${Y}`;return`<div id="${K}" class="${W}" style="${U}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},g9={name:"animationGroup",handler:($,Z,X,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=Z[0],Q=Z.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),G=X.staggerDelay||50,z=X.sequence||!0,q=zZ(Y,Q,{staggerDelay:G,sequence:z});return`${$}
1307
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},h9={name:"motion",handler:($,Z,X,J)=>{let Y=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=JZ();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"};function U3($,Z,X,J){let Y=$;if(J.animation?.enabled===!1)return Y;let Q=X.includes("test")&&X.includes("animation");if(!YZ(Y)&&!Q)return Y;if(!Y.includes('<style id="stx-animation-base">')){let z=GZ();Y=Y.replace("</head>",`${z}
1308
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=QZ(),K=Y.lastIndexOf("</body>");if(K!==-1)Y=Y.slice(0,K)+q+`
1309
- `+Y.slice(K)}}return Y}var K3={default:{stiffness:100,damping:10,mass:1},gentle:{stiffness:120,damping:14,mass:1},wobbly:{stiffness:180,damping:12,mass:1},stiff:{stiffness:210,damping:20,mass:1},slow:{stiffness:280,damping:60,mass:1},molasses:{stiffness:280,damping:120,mass:1}};function qZ($,Z){let X=Z.map((J)=>{let Y=J.offset!==void 0?`${J.offset*100}%`:"from",Q=Object.entries(J.properties).map(([G,z])=>`${G}: ${z}`).join("; ");return`${Y} { ${Q} }`}).join(`
1310
- `);return`@keyframes ${$} {
1311
- ${X}
1312
- }`}var KZ={name:"keyframe",hasEndTag:!0,handler:($,Z,X,J)=>{if(Z.length<1)return`<div class="stx-error">@keyframe requires an animation name</div>${$}`;let Y=Z[0].replace(/['"`]/g,""),Q=Z[1]?Number.parseInt(Z[1],10):1000,G=Z[2]?.replace(/['"`]/g,"")||"ease",z=Z[3]||"1",q=Z[4]?.replace(/['"`]/g,"")||"normal",K=Z[5]?.replace(/['"`]/g,"")||"forwards",U=`stx-keyframe-${Math.random().toString(36).slice(2,9)}`,W=`
1313
- animation-name: ${Y};
1314
- animation-duration: ${Q}ms;
1315
- animation-timing-function: ${G};
1316
- animation-iteration-count: ${z};
1317
- animation-direction: ${q};
1318
- animation-fill-mode: ${K};
1319
- `.trim().replace(/\s+/g," ");return`<div id="${U}" style="${W}">${$}</div>`},description:"Applies a keyframe animation to an element"};function UZ($,Z,X,J,Y){return`
1320
- <script data-stx-scoped data-stx-run="always">
1321
- (function() {
1322
- const container = document.getElementById('${$}');
1323
- if (!container) return;
1324
-
1325
- const children = container.querySelectorAll('${Z}');
1326
- children.forEach((child, index) => {
1327
- const delay = ${X} + (index * ${J});
1328
- child.style.setProperty('--stx-stagger-delay', delay + 'ms');
1329
- child.style.animationDelay = delay + 'ms';
1330
- child.classList.add('${Y}');
1331
- });
1332
- })();
1333
- </script>`}var WZ={name:"stagger",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"> *",Q=Z[1]?Number.parseInt(Z[1],10):100,G=Z[2]?Number.parseInt(Z[2],10):0,z=Z[3]?.replace(/['"`]/g,"")||"fade",q=`stx-stagger-${Math.random().toString(36).slice(2,9)}`,K="stx-stagger-item";if(z==="fade")K+=" stx-fade";else if(z==="slide")K+=" stx-from-bottom";else if(z==="scale")K+=" stx-scale";let U=UZ(q,Y,G,Q,K);return`${`
1334
- <style>
1335
- #${q} .stx-stagger-item {
1336
- opacity: 0;
1337
- animation: staggerIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-stagger-delay, 0ms) forwards;
1338
- }
1339
- @keyframes staggerIn {
1340
- from { opacity: 0; transform: translateY(10px); }
1341
- to { opacity: 1; transform: translateY(0); }
1342
- }
1343
- </style>`}<div id="${q}" class="stx-stagger-container">${$}</div>${U}`},description:"Applies staggered animations to child elements"};function HZ($){let{stiffness:Z,damping:X}=$,J=X/(2*Math.sqrt(Z));if(J<0.5)return"cubic-bezier(0.175, 0.885, 0.32, 1.275)";else if(J<1)return"cubic-bezier(0.34, 1.56, 0.64, 1)";else return"cubic-bezier(0.25, 0.1, 0.25, 1)"}var jZ={name:"spring",hasEndTag:!0,handler:($,Z,X,J)=>{let Y=Z[0]?.replace(/['"`]/g,"")||"default",Q;if(K3[Y])Q=K3[Y];else Q={stiffness:Number.parseInt(Y,10)||100,damping:Z[1]?Number.parseInt(Z[1],10):10,mass:Z[2]?Number.parseFloat(Z[2]):1};let G=Z[3]?Number.parseInt(Z[3],10):500,z=`stx-spring-${Math.random().toString(36).slice(2,9)}`,q=HZ(Q),K=`
1344
- transition: all ${G}ms ${q};
1345
- --stx-spring-stiffness: ${Q.stiffness};
1346
- --stx-spring-damping: ${Q.damping};
1347
- --stx-spring-mass: ${Q.mass};
1348
- `.trim().replace(/\s+/g," ");return`<div id="${z}" class="stx-spring" style="${K}">${$}</div>`},description:"Applies spring physics animations to an element"};function Mz($){let Z=`stx-timeline-${Math.random().toString(36).slice(2,9)}`;return`
1349
- <script data-stx-scoped data-stx-run="always">
1350
- (function() {
1351
- const timeline = ${JSON.stringify($)};
1352
-
1353
- function runTimeline() {
1354
- timeline.forEach((entry, index) => {
1355
- const element = document.querySelector(entry.selector);
1356
- if (!element) return;
1357
-
1358
- const keyframes = entry.keyframes.map(kf => {
1359
- const frame = { ...kf.properties };
1360
- if (kf.offset !== undefined) frame.offset = kf.offset;
1361
- if (kf.easing) frame.easing = kf.easing;
1362
- return frame;
1363
- });
1364
-
1365
- const options = {
1366
- duration: entry.options.duration || 1000,
1367
- delay: entry.options.delay || 0,
1368
- easing: entry.options.easing || 'ease',
1369
- iterations: entry.options.iterations || 1,
1370
- direction: entry.options.direction || 'normal',
1371
- fill: entry.options.fill || 'forwards'
1372
- };
1373
-
1374
- element.animate(keyframes, options);
1375
- });
1376
- }
1377
-
1378
- if (document.readyState === 'loading') {
1379
- document.addEventListener('DOMContentLoaded', runTimeline);
1380
- }
1381
- else {
1382
- runTimeline();
1383
- }
1384
- })();
1385
- </script>`}function kz($,Z,X){let J=qZ($,Z),Y=`
1386
- .${$}-animation {
1387
- animation-name: ${$};
1388
- animation-duration: ${X.duration}ms;
1389
- animation-timing-function: ${X.easing||"ease"};
1390
- animation-delay: ${X.delay||0}ms;
1391
- animation-iteration-count: ${X.iterations==="infinite"?"infinite":X.iterations||1};
1392
- animation-direction: ${X.direction||"normal"};
1393
- animation-fill-mode: ${X.fill||"forwards"};
1394
- }`;return`${J}
1395
- ${Y}`}function Iz($){let Z=$.trim().split(/\s+/),X={duration:300};for(let J=0;J<Z.length;J++){let Y=Z[J];if(/^\d+(?:ms|s)?$/.test(Y)){let Q=Number.parseInt(Y,10);if(J===0)X.duration=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q;else X.delay=Y.endsWith("s")&&!Y.endsWith("ms")?Q*1000:Q}else if(Y==="infinite"||/^\d+$/.test(Y))X.iterations=Y==="infinite"?"infinite":Number.parseInt(Y,10);else if(["normal","reverse","alternate","alternate-reverse"].includes(Y))X.direction=Y;else if(["none","forwards","backwards","both"].includes(Y))X.fill=Y;else X.easing=Y}return X}function Tz(){return`
1396
- <script data-stx-scoped data-stx-run="once">
1397
- window.__stxAnimation = {
1398
- // Registry of animations
1399
- animations: new Map(),
1400
-
1401
- // Register a reusable animation
1402
- register(name, keyframes, options) {
1403
- this.animations.set(name, { keyframes, options });
1404
- },
1405
-
1406
- // Run an animation on an element
1407
- animate(element, nameOrKeyframes, options = {}) {
1408
- if (typeof element === 'string') {
1409
- element = document.querySelector(element);
1410
- }
1411
- if (!element) return null;
1412
-
1413
- let keyframes, defaultOptions;
1414
-
1415
- if (typeof nameOrKeyframes === 'string' && this.animations.has(nameOrKeyframes)) {
1416
- const registered = this.animations.get(nameOrKeyframes);
1417
- keyframes = registered.keyframes;
1418
- defaultOptions = registered.options;
1419
- }
1420
- else {
1421
- keyframes = nameOrKeyframes;
1422
- defaultOptions = {};
1423
- }
1424
-
1425
- const finalOptions = { ...defaultOptions, ...options };
1426
- return element.animate(keyframes, finalOptions);
1427
- },
1428
-
1429
- // Animate multiple elements with stagger
1430
- stagger(elements, keyframes, options = {}, staggerDelay = 100) {
1431
- if (typeof elements === 'string') {
1432
- elements = document.querySelectorAll(elements);
1433
- }
1434
-
1435
- const animations = [];
1436
- Array.from(elements).forEach((el, index) => {
1437
- const elementOptions = {
1438
- ...options,
1439
- delay: (options.delay || 0) + (index * staggerDelay)
1440
- };
1441
- animations.push(this.animate(el, keyframes, elementOptions));
1442
- });
1443
-
1444
- return animations;
1445
- },
1446
-
1447
- // Chain animations sequentially
1448
- async sequence(steps) {
1449
- for (const step of steps) {
1450
- const animation = this.animate(step.element, step.keyframes, step.options);
1451
- if (animation) {
1452
- await animation.finished;
1453
- }
1454
- }
1455
- },
1456
-
1457
- // Run animations in parallel
1458
- parallel(steps) {
1459
- return Promise.all(
1460
- steps.map(step => {
1461
- const animation = this.animate(step.element, step.keyframes, step.options);
1462
- return animation ? animation.finished : Promise.resolve();
1463
- })
1464
- );
1465
- }
1466
- };
1467
- </script>`}function Ez($){let Z=$.customDirectives||[];return Z.push(f9),Z.push(g9),Z.push(h9),Z.push(x9),Z.push(KZ),Z.push(WZ),Z.push(jZ),{...$,customDirectives:Z}}function W3($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function H3($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}var BZ=100,_Z=599,d9="__stxResponseStatus",Y2="__stxResponseHeaders";function g2($){return typeof $==="number"&&Number.isInteger($)&&$>=BZ&&$<=_Z}function Sz($){for(let Z of $.matchAll(/\bdefinePageMeta\s*\(\s*\{([\s\S]*?)\}\s*\)/g)){let X=Z[1].match(/(?:^|,)\s*status\s*:\s*(\d{3})(?=\s*(?:,|$))/);if(!X)continue;let J=Number(X[1]);if(g2(J))return J}return}function u9($,Z){if(!$||typeof $!=="object")return!1;let X=typeof Z==="string"&&/^\d+$/.test(Z.trim())?Number(Z.trim()):Z;if(!g2(X))return!1;return $[d9]=X,!0}function VZ($,Z,X){if(!$||typeof $!=="object")return;let J=String(Z??"").trim();if(!J)return;$[Y2]={...$[Y2],[J]:String(X)}}function LZ($){let Z=$?.[d9];return g2(Z)?Z:void 0}function OZ($){let Z=$?.[Y2];if(!Z||typeof Z!=="object")return;let X=Object.entries(Z).map(([J,Y])=>[J,String(Y)]);return X.length>0?Object.fromEntries(X):void 0}function Pz($,Z){if(!$||!Z||$===Z||typeof Z!=="object")return;let X=LZ($);if(X!==void 0)Z[d9]=X;let J=OZ($);if(J)Z[Y2]={...Z[Y2],...J}}function j3($){return{setResponseStatus:(Z)=>{u9($,Z)},notFound:(Z=404)=>{let X=g2(Z)&&Z>=400?Z:404;u9($,X)},setResponseHeader:(Z,X)=>{VZ($,Z,X)}}}function B3($,Z,X={}){if(!$.includes("@status"))return $;let{filePath:J,buildMode:Y}=X,Q=Y==="compile",G="",z=0,q=/@status\s*\(/g,K;while((K=q.exec($))!==null){let U=FZ($,K.index+K[0].length-1);if(U<0)break;let W=$.slice(K.index+K[0].length,U).trim(),H=/^\d+$/.test(W)?Number(W):e(W,Z),j=J?` in ${J}`:"";if(Q)console.warn(`[stx] @status(${W})${j} is skipped when precompiling: the build has no request, so the branch it sits in is not the one a visitor will get. Call notFound() or setResponseStatus(${W}) from <script server> instead \u2014 that runs per request.`);else if(!u9(Z,H))console.warn(`[stx] @status(${W})${j} is not an HTTP status (100-599) \u2014 ignoring it.`);G+=$.slice(z,K.index),z=U+1+($.slice(U+1).match(/^[^\S\n]*\n?/)?.[0].length??0),q.lastIndex=z}return z===0?$:G+$.slice(z)}function FZ($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}var wZ=0,RZ=0;function _3($,Z){let X=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(X)return X[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function DZ($){let Z=[],X=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=X.exec($))!==null){let[Y,Q,G]=J,z=J.index,q=_3(G,"x-data");if(!q)continue;let K=`__stx_scope_${wZ++}`,U=_3(G,"x-init"),W=NZ($,Q,z+Y.length),H=$.slice(z,W.endIndex),j=AZ(H);Z.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:q,initExpr:U,bindings:[],refs:j})}return Z}function NZ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y,z.lastIndex=Y;let q=Q.exec($),K=G.exec($),U=z.exec($);if(U&&U.index<(q?.index??1/0)){Y=U.index+U[0].length;continue}if(!K)return{endIndex:$.length};if(q&&q.index<K.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return{endIndex:K.index+K[0].length};Y=K.index+K[0].length}}return{endIndex:$.length}}function AZ($){let Z=new Map,X=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(X))!==null){let[,Q,G]=Y,z=MZ(Q);Z.set(G,z)}return Z}function MZ($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${RZ++}`}function kZ(){return`
1468
- // STX Reactive Runtime - x-cloak and transition CSS
1469
- (function() {
1470
- var style = document.createElement('style');
1471
- style.textContent = [
1472
- '[x-cloak] { display: none !important; }',
1473
- // Default transition classes
1474
- '.stx-enter { opacity: 0; transform: scale(0.95); }',
1475
- '.stx-enter-start { opacity: 0; transform: scale(0.95); }',
1476
- '.stx-enter-active { transition: opacity 150ms ease-out, transform 150ms ease-out; }',
1477
- '.stx-enter-to { opacity: 1; transform: scale(1); }',
1478
- '.stx-leave { opacity: 1; transform: scale(1); }',
1479
- '.stx-leave-start { opacity: 1; transform: scale(1); }',
1480
- '.stx-leave-active { transition: opacity 100ms ease-in, transform 100ms ease-in; }',
1481
- '.stx-leave-to { opacity: 0; transform: scale(0.95); }'
1482
- ].join('\\n');
1483
- document.head.appendChild(style);
1484
- })();
1485
-
1486
- // STX Reactive Runtime
1487
- /* eslint-disable pickier/no-unused-vars, no-console, prefer-const */
1488
- window.__stx_reactive = (function() {
1489
- 'use strict';
1490
-
1491
- // Deep reactive proxy that triggers onChange for any mutation
1492
- function reactive(obj, onChange) {
1493
- if (!obj || typeof obj !== 'object') return obj;
1494
- return new Proxy(obj, {
1495
- get(target, prop) {
1496
- const value = target[prop];
1497
- if (value && typeof value === 'object' && !Array.isArray(value) && !(value instanceof Promise)) {
1498
- return reactive(value, onChange);
1499
- }
1500
- return value;
1501
- },
1502
- set(target, prop, value) {
1503
- target[prop] = value;
1504
- onChange(prop, value);
1505
- return true;
1506
- }
1507
- });
1508
- }
1509
-
1510
- // Initialize an x-data scope: parse state, run init(), register into window.stx._scopes,
1511
- // then let the signals runtime handle all directive processing (x-for, x-text, :bind, etc.)
1512
- function initScope(scopeEl, initialState, bindings, refs, initExpr) {
1513
- // Parse initial state (may contain methods including async init())
1514
- var state;
1515
- try {
1516
- state = new Function('return (' + initialState + ')')();
1517
- } catch (e) {
1518
- console.error('[stx-reactive] Invalid x-data:', initialState, e);
1519
- return;
1520
- }
1521
-
1522
- // Build $refs object
1523
- var $refs = {};
1524
- for (var name in refs) {
1525
- if (Object.prototype.hasOwnProperty.call(refs, name)) {
1526
- (function(refName, refId) {
1527
- Object.defineProperty($refs, refName, {
1528
- get: function() { return document.getElementById(refId); }
1529
- });
1530
- })(name, refs[name]);
1531
- }
1532
- }
1533
-
1534
- // Extract init method from state if present (Alpine.js convention)
1535
- var initMethod = state.init;
1536
- if (typeof initMethod === 'function') {
1537
- delete state.init;
1538
- }
1539
-
1540
- // Make state reactive \u2014 mutations trigger re-render via signals
1541
- var scopeId = scopeEl.getAttribute('data-stx-scope');
1542
- var stx = window.stx;
1543
-
1544
- // Create signals for each state property so the signals runtime can track dependencies
1545
- var signalState = {};
1546
- var rawState = {};
1547
- for (var key in state) {
1548
- if (Object.prototype.hasOwnProperty.call(state, key)) {
1549
- if (typeof state[key] === 'function') {
1550
- // Methods \u2014 bind to a proxy so 'this.prop = val' triggers signal updates
1551
- signalState[key] = state[key];
1552
- } else {
1553
- // Data properties \u2014 wrap in signals for reactivity
1554
- signalState[key] = stx.state(state[key]);
1555
- rawState[key] = true;
1556
- }
1557
- }
1558
- }
1559
-
1560
- // Create a proxy context that auto-unwraps signals and writes back through them.
1561
- // Methods get 'this' bound to this proxy so this.foo = bar triggers reactivity.
1562
- var ctx = {};
1563
- var ctxProxy = new Proxy(ctx, {
1564
- get: function(target, prop) {
1565
- if (prop === '$refs') return $refs;
1566
- if (prop === '$el') return scopeEl;
1567
- if (prop === '$nextTick') return function(fn) { requestAnimationFrame(fn); };
1568
- var s = signalState[prop];
1569
- if (!s) return undefined;
1570
- if (rawState[prop] && s && typeof s === 'function' && typeof s.value !== 'undefined') {
1571
- return s.value; // unwrap signal
1572
- }
1573
- if (typeof s === 'function' && !rawState[prop]) {
1574
- return s.bind(ctxProxy); // bind methods to proxy
1575
- }
1576
- return s;
1577
- },
1578
- set: function(target, prop, value) {
1579
- var s = signalState[prop];
1580
- if (rawState[prop] && s && typeof s === 'function') {
1581
- s.value = value; // write through signal \u2014 triggers effects
1582
- } else {
1583
- signalState[prop] = value;
1584
- }
1585
- return true;
1586
- },
1587
- has: function(target, prop) {
1588
- return prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick';
1589
- },
1590
- ownKeys: function() {
1591
- return Object.keys(signalState).concat(['$refs', '$el', '$nextTick']);
1592
- },
1593
- getOwnPropertyDescriptor: function(target, prop) {
1594
- if (prop in signalState || prop === '$refs' || prop === '$el' || prop === '$nextTick') {
1595
- return { configurable: true, enumerable: true, writable: true, value: ctxProxy[prop] };
1596
- }
1597
- return undefined;
1598
- }
1599
- });
1600
-
1601
- // Build scope vars for the signals runtime \u2014 it reads these for expression evaluation.
1602
- // We need to provide getter/setter descriptors so signals track properly.
1603
- var scopeVars = {};
1604
- for (var k in signalState) {
1605
- if (Object.prototype.hasOwnProperty.call(signalState, k)) {
1606
- if (rawState[k]) {
1607
- // Data: expose the signal directly so expressions trigger dependency tracking
1608
- scopeVars[k] = signalState[k];
1609
- } else {
1610
- // Method: bind to ctxProxy so 'this' works
1611
- scopeVars[k] = (typeof signalState[k] === 'function') ? signalState[k].bind(ctxProxy) : signalState[k];
1612
- }
1613
- }
1614
- }
1615
- scopeVars.$refs = $refs;
1616
- scopeVars.$el = scopeEl;
1617
- scopeVars.$nextTick = function(fn) { requestAnimationFrame(fn); };
1618
-
1619
- // Register scope \u2014 merge with any existing vars from partial signal scripts
1620
- if (!stx._scopes) stx._scopes = {};
1621
- stx._scopes[scopeId] = Object.assign(stx._scopes[scopeId] || {}, scopeVars);
1622
-
1623
- // Store on element for findElementScope
1624
- scopeEl.__stx_scope = scopeVars;
1625
-
1626
- // Run init() if present (supports async)
1627
- function runInit() {
1628
- var maybePromise;
1629
- if (initMethod) {
1630
- maybePromise = initMethod.call(ctxProxy);
1631
- }
1632
- if (initExpr) {
1633
- try {
1634
- var keys = Object.keys(scopeVars);
1635
- var vals = keys.map(function(k) { return scopeVars[k]; });
1636
- var fn = new Function(keys.join(','), initExpr);
1637
- var result = fn.apply(ctxProxy, vals);
1638
- if (result && typeof result.then === 'function') maybePromise = result;
1639
- } catch (e) {
1640
- console.warn('[stx-reactive] init expression error:', e);
1641
- }
1642
- }
1643
- // If init is async, signal updates will trigger effects automatically
1644
- // when init() resolves and sets this.prop = value (writes through signal)
1645
- if (maybePromise && typeof maybePromise.then === 'function') {
1646
- maybePromise.catch(function(e) {
1647
- console.error('[stx-reactive] async init() error:', e);
1648
- });
1649
- }
1650
- }
1651
-
1652
- // Run init before the signals runtime processes this scope
1653
- runInit();
1654
-
1655
- // Expose for debugging
1656
- scopeEl.__stx_state = ctxProxy;
1657
- scopeEl.__stx_execute = function(stmt, $event, $el) {
1658
- try {
1659
- // Run the statement with the reactive proxy as the lexical scope.
1660
- // Wrapping in a with-block on the proxy makes bare reads/writes go
1661
- // through it (so foo = bar triggers signal.set()) instead of treating
1662
- // each state key as a local function parameter \u2014 bare assignments
1663
- // would otherwise just rebind the local and never reach the signal.
1664
- var fn = new Function('$event', '$el', 'with(this){' + stmt + ';}');
1665
- fn.call(ctxProxy, $event, $el);
1666
- } catch (e) {
1667
- console.warn('[stx-reactive] execute error:', e);
1668
- }
1669
- };
1670
- }
1671
-
1672
- return { initScope: initScope, reactive: reactive };
1673
- })();
1674
- `}function V3($,Z){let X=$.replace(/\{!!([\s\S]*?)!!\}/g,(z,q)=>{try{let K=v0(q,Z,!0);if(K===void 0)return z;return String(K)}catch{return z}}),J="",Y=0,Q=null;while(Y<X.length){let z=X[Y];if(Q&&z==="\\"){J+=z+(X[Y+1]??""),Y+=2;continue}if(z==="{"&&X[Y+1]==="{"){let q=X.indexOf("}}",Y+2);if(q!==-1){let K=X.slice(Y,q+2);J+=G(X.slice(Y+2,q),K,Q),Y=q+2;continue}}if(Q){if(z===Q)Q=null}else if(z==="'"||z==='"'||z==="`")Q=z;J+=z,Y++}return J;function G(z,q,K){let U;try{U=v0(z,Z,!0)}catch{return q}if(U===void 0)return q;if(K){let W=String(U).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?W.replace(/\$\{/g,"\\${"):W}if(typeof U==="string"){let W=U.trim();if(W.startsWith("{")&&W.endsWith("}")||W.startsWith("[")&&W.endsWith("]"))try{return JSON.parse(W),W}catch{}}return JSON.stringify(U)}}function IZ($,Z){if($.length===0)return"";let X=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),Q=V3(J.stateExpr,Z),G=J.initExpr?V3(J.initExpr,Z):null,z=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
1675
- (function() {
1676
- var scopeEl = document.querySelector('${J.selector}');
1677
- if (!scopeEl) return;
1678
- var refs = ${Y};
1679
- __stx_reactive.initScope(scopeEl, ${z}, [], refs, ${q});
1680
- })();`}).join(`
1681
- `);return`
1682
- <script data-stx-scoped data-stx-reactive data-stx-run="always">
1683
- ${kZ()}
1684
- ${X}
1685
- </script>`}function L3($,Z,X){if(!EZ($))return $;let J=DZ($);if(J.length===0)return $;let Y=TZ($,J),Q=IZ(J,Z),G=Y.lastIndexOf("</body>");if(G!==-1)Y=Y.slice(0,G)+Q+`
1686
- `+Y.slice(G);else Y+=Q;return Y}function TZ($,Z){let X=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,Q,G)=>{let z=Z[X++];if(!z)return Y;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return z.id=q[1],z.selector=`[data-stx-scope="${z.id}"]`,Y;return`<${Q} data-stx-scope="${z.id}"${G}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function EZ($){return/x-data\s*=\s*["']/.test($)}import wX from"fs";import G5 from"path";import{createHighlighter as RX}from"ts-syntax-highlighter";import p2 from"fs";import T0 from"path";import{loadConfigWithResult as jX}from"bunfig";Q2();async function bZ($,Z,X,J){let Y=Z[0]?.replace(/['"]/g,"")||"main",Q=m9();if(Y!=="main")Q=Q.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${Q}</script>`}var O3={name:"stxRouter",handler:bZ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"};function Q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function F3($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function w3($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,X=$.match(Z);if(!X)return{data:{},content:$.trim()};let J=X[1],Y=$.slice(X[0].length),Q={};for(let G of J.split(`
1687
- `)){let z=G.trim();if(!z||z.startsWith("#"))continue;let q=z.indexOf(":");if(q===-1)continue;let K=z.slice(0,q).trim(),U=z.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}Q[K]=U}return{data:Q,content:Y.trim()}}function G2($,Z={}){let{gfm:X=!0,breaks:J=!1}=Z,Y=$,Q=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(U,W,H)=>{let j=Q.length,B=W?` class="language-${Q1(W)}"`:"";return Q.push(`<pre><code${B}>${Q1(H.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(U,W)=>`<code>${Q1(W)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),X)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,W,H)=>{return`<img src="${F3(H)?Q1(H):""}" alt="${Q1(W)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,W,H)=>{return`<a href="${F3(H)?Q1(H):""}">${W}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
1688
- `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),X)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,W,H)=>{let B=`<tr>${W.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${Q1(O)}</th>`).join("")}</tr>`,_=H.trim().split(`
1689
- `).map((O)=>{return`<tr>${O.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${Q1(L)}</td>`).join("")}</tr>`}).join(`
1690
- `);return`<table>
1691
- <thead>
1692
- ${B}
1693
- </thead>
1694
- <tbody>
1695
- ${_}
1696
- </tbody>
1697
- </table>`});if(X)Y=Y.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Y=Y.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Y.split(`
1698
- `),z=[],q=!1,K=[];for(let U of G){let W=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(W)||/^\0CODEBLOCK\d+\0$/.test(W)||W===""){if(q&&K.length>0)z.push(`<p>${K.join(J?`<br />
1699
- `:`
1700
- `)}</p>`),K=[],q=!1;z.push(U)}else q=!0,K.push(W)}if(q&&K.length>0)z.push(`<p>${K.join(J?`<br />
1701
- `:`
1702
- `)}</p>`);if(Y=z.join(`
1703
- `),J)Y=Y.replace(/\n/g,`<br />
1704
- `);for(let U=0;U<Q.length;U++)Y=Y.replace(`\x00CODEBLOCK${U}\x00`,Q[U]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}async function R3($,Z,X=""){let J=$,Y=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let z=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),K=q?q[1]:"",U=z+G[0].length,W=1,H=U,j=-1;while(W>0&&H<$.length){let O=$.indexOf("@markdown",H),V=$.indexOf("@endmarkdown",H);if(V===-1)break;if(O!==-1&&O<V&&O!==z){let L=$[O+9];if(L==="("||L===`
1705
- `||L==="\r"||L===" "||L===void 0)W++;H=O+9}else{if(W--,W===0){j=V;break}H=V+12}}if(j===-1)continue;let B=$.slice(U,j),_=$.slice(z,j+12);Y.push({fullMatch:_,options:K,content:B,index:z}),Q.lastIndex=j+12}for(let{fullMatch:z,options:q,content:K,index:U}of Y)try{let W={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)W[_]=!0});let H={gfm:W.gfm??!0,breaks:W.breaks??!1},j=G2(K.trim(),H);J=J.split(z).join(j)}catch(W){let H=W instanceof Error?W.message:String(W),j=j0("Markdown Directive",`Error processing markdown: ${H}`,X,$,U,z);J=J.split(z).join(j)}return J}async function D3($,Z,X,J){let Y={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")Y.breaks=!0;if(G==="no-gfm")Y.gfm=!1}),G2($.trim(),Y)}var _1=[320,480,640,768,1024,1280,1536,1920,2560],N3=[1,1.5,2,3],y1=["avif","webp","jpeg"],A3={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"},yZ={avif:"avif",webp:"webp",jpeg:"jpg",png:"png",gif:"gif"};function z2($,Z=_1,X={},J){return Z.sort((Y,Q)=>Y-Q).map((Y)=>{return`${G1($,{...X,w:Y,fm:J})} ${Y}w`}).join(", ")}function nz($,Z=320,X=2560,J=0.08,Y={},Q){let G=CZ(Z,X,J);return z2($,G,Y,Q)}function CZ($,Z,X=0.08){let J=[],Y=$;while(Y<Z)J.push(Math.round(Y)),Y*=1+X*2;if(J[J.length-1]!==Z)J.push(Z);return J}function l9($,Z,X=N3,J={},Y){return X.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${G1($,{...J,w:G,dpr:Q,fm:Y})} ${Q}x`}).join(", ")}function oz($,Z,X=N3,J=80,Y={},Q){let G={1:J,1.5:Math.round(J*0.9),2:Math.round(J*0.8),3:Math.round(J*0.7),4:Math.round(J*0.6),5:Math.round(J*0.5)};return X.sort((z,q)=>z-q).map((z)=>{let q=Math.round(Z*z),K=G[z]||Math.round(J*Math.max(0.5,1-z*0.1));return`${G1($,{...Y,w:q,q:K,dpr:z,fm:Q})} ${z}x`}).join(", ")}function c9($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([Y,Q])=>{let G=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((Y,Q)=>Y.numericBp-Q.numericBp).map(({bp:Y,size:Q})=>`(max-width: ${Y}) ${Q}`);return J.push(Z),J.join(", ")}function sz($,Z="100vw"){if(!$||$.length===0)return Z;let J=[...$].sort((Y,Q)=>(Y.maxWidth||0)-(Q.maxWidth||0)).filter((Y)=>Y.maxWidth).map((Y)=>`(max-width: ${Y.maxWidth}px) ${Y.imageWidth}`);return J.push(Z),J.join(", ")}var rz={fullWidth:"100vw",halfDesktop:"(max-width: 768px) 100vw, 50vw",thirdDesktop:"(max-width: 768px) 100vw, 33.33vw",quarterDesktop:"(max-width: 480px) 100vw, (max-width: 768px) 50vw, 25vw",contentWidth:"(max-width: 768px) 100vw, (max-width: 1200px) 80vw, 960px"};function G1($,Z={}){let X=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(X.length===0)return $;let J=X.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function az($){let[Z,X]=$.split("?"),J={};if(X)new URLSearchParams(X).forEach((Q,G)=>{if(/^\d+$/.test(Q))J[G]=Number.parseInt(Q,10);else if(/^\d+\.\d+$/.test(Q))J[G]=Number.parseFloat(Q);else if(Q==="true")J[G]=!0;else if(Q==="false")J[G]=!1;else J[G]=Q});return{src:Z,params:J}}function tz($){let{src:Z,widths:X,dprValues:J,fixedWidth:Y,formats:Q=y1,baseUrl:G="",params:z={}}=$,q=[];for(let K of Q){let U,W;if(Y!==void 0&&J)U=l9(Z,Y,J,z,K),W=J.map((H)=>({path:"",url:G1(Z,{...z,w:Math.round(Y*H),fm:K}),width:Math.round(Y*H),height:0,format:K,size:0,dpr:H}));else{let H=X||_1;U=z2(Z,H,z,K),W=H.map((j)=>({path:"",url:G1(Z,{...z,w:j,fm:K}),width:j,height:0,format:K,size:0}))}q.push({srcset:U,format:K,mimeType:A3[K],variants:W})}return q}function ez($,Z="100vw"){return $.map(({srcset:X,mimeType:J})=>`<source type="${J}" srcset="${X}" sizes="${Z}" />`).join(`
1706
- `)}function $q($,Z){if($.length===0)return;let X=[...$].sort((Y,Q)=>Y.width-Q.width),J=X.find((Y)=>Y.width>=Z);if(J)return J;return X[X.length-1]}function p9($){return A3[$]||"application/octet-stream"}function Zq($){return yZ[$]||$}function Xq($){switch($.split(".").pop()?.toLowerCase()){case"jpg":case"jpeg":return"jpeg";case"png":return"png";case"webp":return"webp";case"avif":return"avif";case"gif":return"gif";default:return}}var SZ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},i9=`
1707
- .stx-img-placeholder {
1708
- position: relative;
1709
- overflow: hidden;
1710
- background-size: cover;
1711
- background-position: center;
1712
- background-repeat: no-repeat;
1713
- }
1714
-
1715
- .stx-img-placeholder img {
1716
- opacity: 0;
1717
- transition: opacity var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
1718
- }
1719
-
1720
- .stx-img-placeholder.stx-img-loaded img {
1721
- opacity: 1;
1722
- }
1723
-
1724
- .stx-img-blur {
1725
- filter: blur(20px);
1726
- transform: scale(1.1);
1727
- transition: filter var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out),
1728
- transform var(--stx-img-transition-duration, 300ms) var(--stx-img-transition-easing, ease-out);
1729
- }
1730
-
1731
- .stx-img-loaded .stx-img-blur {
1732
- filter: blur(0);
1733
- transform: scale(1);
1734
- }
1735
- `.trim();async function n9(){try{return await import("ts-images")}catch{return null}}async function M3($,Z={}){let X={...SZ,...Z},J=await n9();if(J)try{return await PZ($,X,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return k3($,X)}async function PZ($,Z,X){let{generatePlaceholder:J,generateThumbHash:Y}=X,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function k3($,Z){let X=Z.width||20,J=Z.height||X,Y="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${J}" viewBox="0 0 ${X} ${J}"><rect fill="#e5e7eb" width="${X}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:X,height:J,aspectRatio:X/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}async function Yq($){let Z=await n9();if(Z)try{return(await Z.generateThumbHash($)).dataUrl}catch{}return(await k3($,{strategy:"thumbhash",width:32,height:32})).dataURL}function Qq($){let Z=$[0]|$[1]<<8|$[2]<<16,X=(Z&63)/63,J=(Z>>6&63)/31.5-1,Y=(Z>>12&63)/31.5-1,Q=(Z>>18&31)/31,G=Z>>23!==0,z=$[3]|$[4]<<8,q=(z>>3&63)/63,K=(z>>9&63)/63,U=z>>15!==0,W=Math.max(3,U?G?5:7:G?5:7),H=Math.max(3,U?G?5:7:G?5:7),j=32,B=32,_=Math.max(0,Math.min(255,Math.round((X+J)*255))),O=Math.max(0,Math.min(255,Math.round(X*255))),V=Math.max(0,Math.min(255,Math.round((X-J)*255))),L=`<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32">
1736
- <rect fill="rgb(${_},${O},${V})" width="32" height="32"/>
1737
- </svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(L)}`}async function Gq($,Z=20,X=50){return M3($,{strategy:"blur",width:Z,quality:X,blurLevel:40})}async function zq($){let Z=await n9();if(Z)try{return(await Z.generatePlaceholder($,{strategy:"dominant-color"})).dominantColor||"#e5e7eb"}catch{}return"#e5e7eb"}function qq($,Z=1,X=1){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${X}"><rect fill="${$}" width="${Z}" height="${X}"/></svg>`;return`data:image/svg+xml;charset=utf-8,${encodeURIComponent(J)}`}function I3($,Z,X={}){let J=X.transitionDuration||300,Y=X.easing||"ease-out";return`
1738
- #${$} {
1739
- --stx-img-transition-duration: ${J}ms;
1740
- --stx-img-transition-easing: ${Y};
1741
- background-image: url('${Z.dataURL}');
1742
- background-size: cover;
1743
- background-position: center;
1744
- }
1745
-
1746
- #${$} img {
1747
- opacity: 0;
1748
- transition: opacity var(--stx-img-transition-duration) var(--stx-img-transition-easing);
1749
- }
1750
-
1751
- #${$}.stx-img-loaded img {
1752
- opacity: 1;
1753
- }
1754
- `.trim()}function Kq($){return`background-image: url('${$.dataURL}'); background-size: cover; background-position: center;`}var C1=new Map;async function T3($,Z={}){let X=`${$}:${JSON.stringify(Z)}`;if(C1.has(X))return C1.get(X);let J=await M3($,Z);return C1.set(X,J),J}function Uq(){C1.clear()}function Wq(){return{size:C1.size,keys:Array.from(C1.keys())}}async function vZ(){try{return await import("./chunk-f3hfk78e.js")}catch($){if(!E3)console.warn("[stx-media] Image processor not available, some features disabled:",$),E3=!0;return null}}var E3=!1,o9=80,h2="async",u2="lazy",b3=!1;async function q2($,Z={}){let X=Z,J=$;if(J.process&&!J.skipOptimization){if(X.tsImagesConfig?.enabled&&!X.isDev)return uZ(J,X)}if(X.processedResult?.processed)return a9($,X.processedResult,Z);if(X.responsiveVariants)return S3($,X.responsiveVariants,Z);let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,dpr:U,formats:W=y1,quality:H=o9,params:j={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:V=!1,loading:L=V?"eager":u2,decoding:F=h2,fetchpriority:w,objectFit:R,objectPosition:D,crossorigin:A,referrerpolicy:k}=$,N=$.class,M=$.style,T=$.id,I=$.data||{},{isDev:y=!1,baseUrl:E=""}=Z;if(y&&!Z.optimize)return gZ($);let b,C,v=T||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!V)try{b=await T3(Y,{strategy:B,..._}),C=I3(v,b,_)}catch{}let P=U!==void 0&&G!==void 0,g;if(P)g=xZ($,v,b,Z);else g=await fZ($,v,b,Z);let x;if(V){let M0=W.includes("webp")?"webp":W[0],C0=z2(Y,K,{...j,q:H},M0),Z0=typeof q==="object"?c9(q):q||"100vw";x=`<link rel="preload" as="image" imagesrcset="${C0}" imagesizes="${Z0}" />`}let $0=[];if(!b3&&B!=="none")$0.push(i9),b3=!0;if(C)$0.push(C);let a0=O?C3(v):void 0;return{html:g,preloadLink:x,css:$0.length>0?$0.join(`
1755
- `):void 0,script:a0}}async function fZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:z,sizes:q,widths:K=_1,formats:U=y1,quality:W=o9,params:H={},lazy:j=!0,priority:B=!1,loading:_=B?"eager":u2,decoding:O=h2,fetchpriority:V,objectFit:L,objectPosition:F,crossorigin:w,referrerpolicy:R}=$,D=$.class,A=$.style,k=$.data||{},N=typeof q==="object"?c9(q):q||"100vw",M=[];for(let y of U){let E=z2(Y,K,{...H,q:W},y),b=p9(y);if(j&&!B)M.push(` <source type="${b}" data-srcset="${E}" data-sizes="${N}" />`);else M.push(` <source type="${b}" srcset="${E}" sizes="${N}" />`)}let T=s9({src:G1(Y,{...H,q:W}),alt:Q,width:G,height:z,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":V,objectFit:L,objectPosition:F,crossorigin:w,referrerpolicy:R,className:y3(D,X),style:r9(A,L,F,X),lazy:j&&!B,data:k}),I;if(X){let y=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${y}">
1756
- <picture>
1757
- ${M.join(`
1758
- `)}
1759
- <img ${T} />
1760
- </picture>
1761
- </div>`}else I=`<picture${Z?` id="${Z}"`:""}>
1762
- ${M.join(`
1763
- `)}
1764
- <img ${T} />
1765
- </picture>`;return I}function xZ($,Z,X,J){let{src:Y,alt:Q,width:G,height:z,dpr:q=[1,2,3],quality:K=o9,params:U={},lazy:W=!0,priority:H=!1,loading:j=H?"eager":u2,decoding:B=h2,fetchpriority:_,objectFit:O,objectPosition:V,crossorigin:L,referrerpolicy:F}=$,w=$.class,R=$.style,D=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),k=l9(Y,A,q,{...U,q:K}),N=s9({src:G1(Y,{...U,w:A,q:K}),alt:Q,width:G,height:z,loading:H?void 0:j,decoding:B,fetchpriority:H?"high":_,objectFit:O,objectPosition:V,crossorigin:L,referrerpolicy:F,className:y3(w,X),style:r9(R,O,V,X),lazy:W&&!H,data:D}),M=W&&!H?`data-srcset="${k}"`:`srcset="${k}"`;if(X){let T=`background-image: url('${X.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${T}">
1766
- <img ${N} ${M} />
1767
- </div>`}return`<img ${Z?`id="${Z}" `:""}${N} ${M} />`}function gZ($){let{src:Z,alt:X,width:J,height:Y,loading:Q=u2,decoding:G=h2,fetchpriority:z,objectFit:q,objectPosition:K,crossorigin:U,referrerpolicy:W,priority:H=!1}=$,j=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${s9({src:Z,alt:X,width:J,height:Y,loading:H?"eager":Q,decoding:G,fetchpriority:H?"high":z,objectFit:q,objectPosition:K,crossorigin:U,referrerpolicy:W,className:j,style:r9(B,q,K),id:_,data:O})} />`}}function s9($){let Z=[];if($.lazy)Z.push(`data-src="${c0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${c0($.src)}"`);if(Z.push(`alt="${c0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${c0($.className)}"`);if($.style)Z.push(`style="${c0($.style)}"`);if($.id)Z.push(`id="${c0($.id)}"`);if($.data)for(let[X,J]of Object.entries($.data))Z.push(`data-${X}="${c0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function y3($,Z){let X=[];if($)X.push($);if(Z)X.push("stx-img-blur");return X.join(" ")||""}function r9($,Z,X,J){let Y=[];if(Z)Y.push(`object-fit: ${Z}`);if(X)Y.push(`object-position: ${X}`);if(J)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function c0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C3($){return`
1768
- (function() {
1769
- const container = document.getElementById('${$}');
1770
- if (!container) return;
1771
-
1772
- const img = container.querySelector('img[data-stx-lazy]') || container;
1773
- if (!img.dataset.src && !img.dataset.srcset) return;
1774
-
1775
- const observer = new IntersectionObserver((entries) => {
1776
- entries.forEach(entry => {
1777
- if (entry.isIntersecting) {
1778
- // Load image
1779
- if (img.dataset.src) img.src = img.dataset.src;
1780
- if (img.dataset.srcset) img.srcset = img.dataset.srcset;
1781
-
1782
- // Load sources
1783
- const sources = container.querySelectorAll('source[data-srcset]');
1784
- sources.forEach(source => {
1785
- if (source.dataset.srcset) source.srcset = source.dataset.srcset;
1786
- if (source.dataset.sizes) source.sizes = source.dataset.sizes;
1787
- });
1788
-
1789
- // Handle load completion
1790
- img.onload = () => {
1791
- img.style.opacity = '1';
1792
- if (container.classList.contains('stx-img-placeholder')) {
1793
- container.classList.add('stx-img-loaded');
1794
- }
1795
- };
1796
-
1797
- observer.disconnect();
1798
- }
1799
- });
1800
- }, { rootMargin: '50px' });
1801
-
1802
- observer.observe(container);
1803
- })();
1804
- `.trim()}function hZ($){let Z=$.match(/<Img\s+([^>]*?)\/?>/);if(!Z)return null;let X=Z[1],J={},Y=/(:?)(\w+)(?:=(?:"([^"]*)"|'([^']*)'|\{([^}]+)\}))?/g,Q;while((Q=Y.exec(X))!==null){let[,G,z,q,K,U]=Q,W=q??K??U??!0;if(G===":"&&typeof W==="string")try{J[z]=JSON.parse(W)}catch{J[z]=W}else switch(z){case"src":J.src=String(W);break;case"alt":J.alt=String(W);break;case"width":J.width=Number(W)||W;break;case"height":J.height=Number(W)||W;break;case"sizes":J.sizes=String(W);break;case"quality":J.quality=Number(W);break;case"placeholder":J.placeholder=W;break;case"lazy":J.lazy=W===!0||W==="true";break;case"priority":J.priority=W===!0||W==="true";break;case"class":J.class=String(W);break;case"style":J.style=String(W);break;case"id":J.id=String(W);break;case"loading":J.loading=W;break;case"decoding":J.decoding=W;break;case"fetchpriority":J.fetchpriority=W;break;case"objectFit":J.objectFit=W;break;case"objectPosition":J.objectPosition=String(W);break;case"crossorigin":J.crossorigin=W;break}}if(!J.src||!J.alt)return null;return J}async function _q($,Z={}){let X=/<Img\s+[^>]*?\/?>/g,J=[],Y=[],Q=[],G=$,z=[],q;while((q=X.exec($))!==null)z.push({match:q[0],index:q.index});for(let K=z.length-1;K>=0;K--){let{match:U}=z[K],W=hZ(U);if(W){let H=await q2(W,Z);if(G=G.replace(U,H.html),H.preloadLink)J.push(H.preloadLink);if(H.css)Y.push(H.css);if(H.script)Q.push(H.script)}}return{html:G,preloadLinks:J,styles:Y,scripts:Q}}async function uZ($,Z){let X=await vZ();if(!X)return q2({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await X.generateResponsiveVariants($.src,$,J);if(Q)return S3($,Q,Z)}else{let Q=await X.processImage($.src,$,J);if(Q.processed)return a9($,Q,Z)}return q2({...$,process:!1},Z)}async function a9($,Z,X){let{alt:J,width:Y,height:Q,lazy:G=!0,priority:z=!1,objectFit:q,objectPosition:K,crossorigin:U,referrerpolicy:W}=$,H=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],V=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=V?.url||$.src,F=O.filter((C)=>C.format===(V?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],D=["avif","webp","jpeg","png"];for(let C of D){let v=w.get(C);if(v&&v.length>0){let P=v.map((x)=>`${x.url} ${x.width}w`).join(", "),g=p9(C);if(G&&!z)R.push(` <source type="${g}" data-srcset="${P}" />`);else R.push(` <source type="${g}" srcset="${P}" />`)}}let A=[];if(G&&!z){if(A.push(`data-src="${c0(L)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)A.push(`data-srcset="${F}"`)}else if(A.push(`src="${c0(L)}"`),F)A.push(`srcset="${F}"`);A.push(`alt="${c0(J)}"`);let k=Y||Z.originalWidth,N=Q||Z.originalHeight;if(k)A.push(`width="${k}"`);if(N)A.push(`height="${N}"`);if(!z)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),z)A.push('fetchpriority="high"');if(U)A.push(`crossorigin="${U}"`);if(W)A.push(`referrerpolicy="${W}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(K)M.push(`object-position: ${K}`);if(Z.placeholder&&G)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)A.push(`style="${M.join("; ")}"`);let T=[];if(H)T.push(H);if(Z.placeholder)T.push("stx-img-blur");if(T.length>0)A.push(`class="${T.join(" ")}"`);if(G&&!z)A.push("data-stx-lazy");for(let[C,v]of Object.entries(_))A.push(`data-${C}="${c0(v)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${B}" class="stx-img-placeholder" style="${C}">
1805
- <picture>
1806
- ${R.join(`
1807
- `)}
1808
- <img ${A.join(" ")} />
1809
- </picture>
1810
- </div>`}else I=`<picture${B?` id="${B}"`:""}>
1811
- ${R.join(`
1812
- `)}
1813
- <img ${A.join(" ")} />
1814
- </picture>`;let y=[];if(Z.placeholder)y.push(i9);let E=G?C3(B):void 0,b;if(z&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:y.length>0?y.join(`
1815
- `):void 0,script:E}}async function S3($,Z,X){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Y,Q]of Object.entries(Z.byFormat))if(Q)J.variants.push(...Q);return a9($,J,X)}function dZ(){return d2({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,X,J)=>{let{src:Y,alt:Q,options:G}=mZ($,Z,X);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Y,alt:Q||"",widths:G.widths||_1,formats:G.formats||y1,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=X.__isDev||!1,K=await q2(z,{isDev:q}),U=K.html;if(K.preloadLink)U=K.preloadLink+`
1816
- `+U;if(K.css)U+=`
1817
- <style>${K.css}</style>`;if(K.script)U+=`
1818
- <script>${K.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function mZ($,Z,X){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=lZ(J),Q=t9(Y[0],X)||"",G=t9(Y[1],X)||"",z={};if(Y[2]){let q=t9(Y[2],X);if(typeof q==="object"&&q!==null)z=q;else if(typeof Y[2]==="string")try{z=JSON.parse(Y[2])}catch{}}return{src:Q,alt:G,options:z}}function lZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else X+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=q}if(X.trim())Z.push(X.trim());return Z}function t9($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var P3=dZ();async function f3(){try{return await import("./chunk-bz2gytfs.js")}catch($){if(!v3)console.warn("[stx-media] Video processor not available, some features disabled:",$),v3=!0;return null}}var v3=!1,x3=!0,g3="metadata",cZ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";async function m2($,Z={}){let X=Z,J=$;if(J.process&&!J.skipProcessing){if(X.tsVideosConfig?.enabled&&!X.isDev)return sZ(J,X)}if(X.processedResult?.processed)return u3($,X.processedResult,Z);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await rZ(J,X);let{src:Q,sources:G=[],poster:z,posterPlaceholder:q,controls:K=x3,autoplay:U=!1,muted:W=!1,loop:H=!1,preload:j=g3,playsinline:B=!0,lazy:_=!0,player:O="native",type:V,width:L,height:F,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:D=!1}=$,A=Y||z,k=$.class,N=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return iZ($,Z);if(V&&V!=="video")return pZ(Q||"",V,$);let T=G.length>0?G:Q?[{src:Q,type:h3(Q)}]:[],I=[`id="${M}"`];if(K)I.push("controls");if(U)I.push("autoplay");if(W)I.push("muted");if(H)I.push("loop");if(B)I.push("playsinline");if(R)I.push("disablepictureinpicture");if(D)I.push("disableremoteplayback");if(w)I.push(`crossorigin="${w}"`);if(_){if(I.push(`data-preload="${j}"`),I.push('preload="none"'),A)I.push(`data-poster="${R0(A)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${j}"`),A)I.push(`poster="${R0(A)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(k)I.push(`class="${R0(k)}"`);if(N)I.push(`style="${R0(N)}"`);let y=T.map((C)=>{return` <source ${_?`data-src="${R0(C.src)}"`:`src="${R0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
1819
- `),E=`<video ${I.join(" ")}>
1820
- ${y}
1821
- Your browser does not support the video tag.
1822
- </video>`,b;if(_)b=`
1823
- (function() {
1824
- var video = document.getElementById('${M}');
1825
- if (!video) return;
1826
-
1827
- var observer = new IntersectionObserver(function(entries) {
1828
- entries.forEach(function(entry) {
1829
- if (entry.isIntersecting) {
1830
- // Load poster
1831
- if (video.dataset.poster) {
1832
- video.poster = video.dataset.poster;
1833
- delete video.dataset.poster;
1834
- }
1835
-
1836
- // Load sources
1837
- var sources = video.querySelectorAll('source[data-src]');
1838
- sources.forEach(function(source) {
1839
- source.src = source.dataset.src;
1840
- delete source.dataset.src;
1841
- });
1842
-
1843
- // Set preload
1844
- if (video.dataset.preload) {
1845
- video.preload = video.dataset.preload;
1846
- delete video.dataset.preload;
1847
- }
1848
-
1849
- video.load();
1850
- observer.disconnect();
1851
- }
1852
- });
1853
- }, { rootMargin: '50px' });
1854
-
1855
- observer.observe(video);
1856
- })();
1857
- `.trim();return{html:E,script:b}}function pZ($,Z,X){let{width:J=640,height:Y=360}=X,Q=X.class,G=X.style,z=X.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,K=null;switch(Z){case"youtube":K=nZ($),q=K?`https://www.youtube-nocookie.com/embed/${K}`:$;break;case"vimeo":K=oZ($),q=K?`https://player.vimeo.com/video/${K}`:$;break;case"dailymotion":K=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let U=[`id="${z}"`,`src="${R0(q)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)U.push(`class="${R0(Q)}"`);if(G)U.push(`style="${R0(G)}"`);if(X.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
1858
- <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
1859
- </div>`}}function iZ($,Z={}){let{src:X,sources:J=[],poster:Y,controls:Q=!0,autoplay:G=!1,muted:z=!1,loop:q=!1,preload:K="metadata",playsinline:U=!0,lazy:W=!0,width:H,height:j}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,V={src:J.length>0?J:X,autoplay:G,loop:q,muted:z,playsinline:U,preload:K,poster:Y,controls:Q,title:$.title},L=["position: relative",H?`width: ${typeof H==="number"?H+"px":H}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",_||""].filter(Boolean).join("; "),F=`
1860
- <div
1861
- id="${O}"
1862
- class="ts-video-player${B?" "+R0(B):""}"
1863
- style="${L}"
1864
- data-ts-video-player
1865
- data-config='${JSON.stringify(V)}'
1866
- ${W?"data-lazy":""}
1867
- >
1868
- <div class="ts-video-player__container">
1869
- ${Y?`
1870
- <div class="ts-video-player__placeholder" style="background-image: url('${R0(Y)}');">
1871
- <button class="ts-video-player__play-button" aria-label="Play video">
1872
- <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
1873
- <path d="M8 5v14l11-7z"/>
1874
- </svg>
1875
- </button>
1876
- </div>
1877
- `:""}
1878
- </div>
1879
- </div>
1880
- `.trim(),w=`
1881
- (function() {
1882
- var container = document.getElementById('${O}');
1883
- if (!container) return;
1884
-
1885
- var config = JSON.parse(container.dataset.config || '{}');
1886
- var isLazy = container.hasAttribute('data-lazy');
1887
-
1888
- function loadPlayer() {
1889
- if (typeof TSVideoPlayer !== 'undefined') {
1890
- initPlayer();
1891
- return;
1892
- }
1893
-
1894
- // Load ts-video-player from CDN
1895
- var script = document.createElement('script');
1896
- script.src = '${cZ}';
1897
- script.onload = initPlayer;
1898
- script.onerror = function() {
1899
- console.error('[stx] Failed to load ts-video-player');
1900
- fallbackToNative();
1901
- };
1902
- document.head.appendChild(script);
1903
- }
1904
-
1905
- function initPlayer() {
1906
- var player = TSVideoPlayer.createPlayer(container, config);
1907
- if (config.src) {
1908
- player.setSrc(config.src);
1909
- }
1910
- container.__tsVideoPlayer = player;
1911
-
1912
- // Remove placeholder
1913
- var placeholder = container.querySelector('.ts-video-player__placeholder');
1914
- if (placeholder) {
1915
- placeholder.style.display = 'none';
1916
- }
1917
- }
1918
-
1919
- function fallbackToNative() {
1920
- // Fallback to native video element
1921
- var video = document.createElement('video');
1922
- video.controls = config.controls !== false;
1923
- video.autoplay = config.autoplay;
1924
- video.muted = config.muted;
1925
- video.loop = config.loop;
1926
- video.playsInline = config.playsinline;
1927
- video.preload = config.preload || 'metadata';
1928
- if (config.poster) video.poster = config.poster;
1929
- if (config.src) video.src = typeof config.src === 'string' ? config.src : config.src[0]?.src || config.src[0];
1930
- video.style.width = '100%';
1931
- video.style.height = '100%';
1932
-
1933
- var containerEl = container.querySelector('.ts-video-player__container');
1934
- if (containerEl) {
1935
- containerEl.innerHTML = '';
1936
- containerEl.appendChild(video);
1937
- }
1938
- }
1939
-
1940
- if (isLazy) {
1941
- var observer = new IntersectionObserver(function(entries) {
1942
- entries.forEach(function(entry) {
1943
- if (entry.isIntersecting) {
1944
- loadPlayer();
1945
- observer.disconnect();
1946
- }
1947
- });
1948
- }, { rootMargin: '50px' });
1949
- observer.observe(container);
1950
- }
1951
- else {
1952
- if (document.readyState === 'loading') {
1953
- document.addEventListener('DOMContentLoaded', loadPlayer);
1954
- }
1955
- else {
1956
- loadPlayer();
1957
- }
1958
- }
1959
-
1960
- // Handle play button click
1961
- var playButton = container.querySelector('.ts-video-player__play-button');
1962
- if (playButton) {
1963
- playButton.addEventListener('click', function() {
1964
- loadPlayer();
1965
- var check = setInterval(function() {
1966
- if (container.__tsVideoPlayer && container.__tsVideoPlayer.ready) {
1967
- container.__tsVideoPlayer.play();
1968
- clearInterval(check);
1969
- }
1970
- }, 100);
1971
- });
1972
- }
1973
- })();
1974
- `.trim(),R=`
1975
- .ts-video-player {
1976
- position: relative;
1977
- background: #000;
1978
- }
1979
-
1980
- .ts-video-player__container {
1981
- position: relative;
1982
- width: 100%;
1983
- padding-bottom: 56.25%;
1984
- }
1985
-
1986
- .ts-video-player__container > * {
1987
- position: absolute;
1988
- top: 0;
1989
- left: 0;
1990
- width: 100%;
1991
- height: 100%;
1992
- }
1993
-
1994
- .ts-video-player__placeholder {
1995
- display: flex;
1996
- align-items: center;
1997
- justify-content: center;
1998
- background-color: #1a1a1a;
1999
- background-size: cover;
2000
- background-position: center;
2001
- cursor: pointer;
2002
- }
2003
-
2004
- .ts-video-player__play-button {
2005
- display: flex;
2006
- align-items: center;
2007
- justify-content: center;
2008
- width: 80px;
2009
- height: 80px;
2010
- background: rgba(0, 0, 0, 0.7);
2011
- border: none;
2012
- border-radius: 50%;
2013
- color: white;
2014
- cursor: pointer;
2015
- transition: transform 0.2s, background 0.2s;
2016
- }
2017
-
2018
- .ts-video-player__play-button:hover {
2019
- transform: scale(1.1);
2020
- background: rgba(0, 0, 0, 0.9);
2021
- }
2022
-
2023
- .ts-video-player__play-button svg {
2024
- margin-left: 4px;
2025
- }
2026
- `.trim();return{html:F,script:w,css:R}}function h3($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function nZ($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let X of Z){let J=$.match(X);if(J)return J[1]}return null}function oZ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function R0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Rq($,Z,X){if(Z.src)return{src:String(Z.src),...Z};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=J.indexOf(",");if(Y===-1)return{src:J.replace(/^['"]|['"]$/g,"")};let Q=J.slice(0,Y).trim().replace(/^['"]|['"]$/g,""),G=J.slice(Y+1).trim();try{let z=JSON.parse(G);return{src:Q,...z}}catch{return{src:Q}}}async function sZ($,Z){let X=await f3();if(!X)return m2({...$,process:!1},Z);let J=Z.tsVideosConfig,Y=await X.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return u3($,Y,Z);return m2({...$,process:!1},Z)}async function rZ($,Z){let X=await f3();if(!X||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await X.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function u3($,Z,X){let{controls:J=x3,autoplay:Y=!1,muted:Q=!1,loop:G=!1,preload:z=g3,playsinline:q=!0,lazy:K=!0,width:U,height:W,crossorigin:H,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,V=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,F=h3(L);if(Z.transcoded)L=Z.transcoded.url,F="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,F="application/dash+xml"}let R=Z.poster?.url||$.poster,D=[`id="${V}"`];if(J)D.push("controls");if(Y)D.push("autoplay");if(Q)D.push("muted");if(G)D.push("loop");if(q)D.push("playsinline");if(j)D.push("disablepictureinpicture");if(B)D.push("disableremoteplayback");if(H)D.push(`crossorigin="${H}"`);if(K){if(D.push(`data-preload="${z}"`),D.push('preload="none"'),R)D.push(`data-poster="${R0(R)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${z}"`),R)D.push(`poster="${R0(R)}"`);let A=U||Z.metadata?.width,k=W||Z.metadata?.height;if(A)D.push(`width="${A}"`);if(k)D.push(`height="${k}"`);if(_)D.push(`class="${R0(_)}"`);if(O)D.push(`style="${R0(O)}"`);let M=` <source ${K?`data-src="${R0(L)}"`:`src="${R0(L)}"`} type="${F}" />`,T=`<video ${D.join(" ")}>
2027
- ${M}
2028
- Your browser does not support the video tag.
2029
- </video>`;if(Z.spriteSheet)T=`<div class="stx-video-wrapper" data-sprite-sheet="${R0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
2030
- ${T}
2031
- </div>`;let I;if(K)I=`
2032
- (function() {
2033
- var video = document.getElementById('${V}');
2034
- if (!video) return;
2035
-
2036
- var observer = new IntersectionObserver(function(entries) {
2037
- entries.forEach(function(entry) {
2038
- if (entry.isIntersecting) {
2039
- // Load poster
2040
- if (video.dataset.poster) {
2041
- video.poster = video.dataset.poster;
2042
- delete video.dataset.poster;
2043
- }
2044
-
2045
- // Load sources
2046
- var sources = video.querySelectorAll('source[data-src]');
2047
- sources.forEach(function(source) {
2048
- source.src = source.dataset.src;
2049
- delete source.dataset.src;
2050
- });
2051
-
2052
- // Set preload
2053
- if (video.dataset.preload) {
2054
- video.preload = video.dataset.preload;
2055
- delete video.dataset.preload;
2056
- }
2057
-
2058
- video.load();
2059
- observer.disconnect();
2060
- }
2061
- });
2062
- }, { rootMargin: '50px' });
2063
-
2064
- observer.observe(video);
2065
- })();
2066
- `.trim();let y;if(w)y=`
2067
- .stx-video-wrapper {
2068
- position: relative;
2069
- width: 100%;
2070
- }
2071
- .stx-video-wrapper video {
2072
- width: 100%;
2073
- height: auto;
2074
- }
2075
- `.trim();return{html:T,script:I,css:y}}function d3(){return d2({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,X,J)=>{let{src:Y,options:Q}=aZ($,Z,X);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Y,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:X.__isDev||!1,tsVideosConfig:X.__tsVideosConfig},K=await m2(G,q),U=K.html;if(K.css)U+=`
2076
- <style>${K.css}</style>`;if(K.script)U+=`
2077
- <script>${K.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function aZ($,Z,X){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=tZ(J),Q=m3(Y[0],X)||"",G={};if(Y[1]){let z=m3(Y[1],X);if(typeof z==="object"&&z!==null)G=z;else if(typeof Y[1]==="string")try{G=JSON.parse(Y[1])}catch{}}return{src:Q,options:G}}function tZ($){let Z=[],X="",J=!1,Y="",Q=0,G=0;for(let z=0;z<$.length;z++){let q=$[z],K=z>0?$[z-1]:"";if((q==='"'||q==="'"||q==="`")&&K!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else X+=q;continue}if(!J){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(X.trim()),X="";continue}}X+=q}if(X.trim())Z.push(X.trim());return Z}function m3($,Z){if(typeof $!=="string")return $;let X=$.trim();if(X.startsWith('"')&&X.endsWith('"')||X.startsWith("'")&&X.endsWith("'"))return X.slice(1,-1);if(!X.startsWith("/")&&!X.startsWith(".")&&!X.startsWith("http")&&!X.startsWith("{")){let J=Z[X];if(J!==void 0)return J}if(X.startsWith("{")||X.startsWith("["))try{return JSON.parse(X)}catch{}return X}var e9=d3();function c3($,Z,X,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(z,q,K)=>{if(!K&&q.includes(":")){let U=q.split(":"),W=q,H=U.length>1?U[1]:"";if(H&&Z[H])K=Z[H];else if(W.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])K=Z.openGraph[U[1]];else K="";return K?`<meta property="${l(W)}" content="${l(K)}">`:""}return K?`<meta name="${l(q)}" content="${l(K)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(Y))!==null){let z=G.index,q=z+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let W=Y.substring(q+1,U).trim(),H=U+1,j=(()=>{try{let B=I0(W,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${l(String(B.name))}"`;if(B.property)_+=` property="${l(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)_+=` content="${l(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return J0("MetaTag",_,X0.EVALUATION_ERROR)}})();Y=Y.substring(0,z)+j+Y.substring(H),Q.lastIndex=0}return Y}function p3($,Z,X){let J=$,Y=/@structuredData\s*\(/g,Q;while((Q=Y.exec(J))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<J.length&&q>0){if(J[K]==="(")q++;else if(J[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let U=J.substring(z+1,K).trim(),W=K+1,H=(()=>{try{let j=I0(U,Z);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return J0("StructuredData",B,X0.EVALUATION_ERROR)}})();J=J.substring(0,G)+H+J.substring(W),Y.lastIndex=0}return J}function i3($,Z,X,J){let Y=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(Y))!==null){let z=Y.indexOf("{",G.index+4),q=1,K=z+1,U=null,W=!1;while(K<Y.length&&q>0){let V=Y[K];if(W){W=!1,K++;continue}if(V==="\\"&&U){W=!0,K++;continue}if(U){if(V===U)U=null;K++;continue}if(V==='"'||V==="'"||V==="`"){U=V,K++;continue}if(V==="{")q++;else if(V==="}")q--;K++}if(q!==0)break;let H=Y.substring(K).match(/^\s*\)/);if(!H)break;let j=K+H[0].length,B=Y.substring(z,K),_=Y.substring(G.index,j),O=((V)=>{try{let L=I0(V,Z);if(!L)return"";let F="";if(L.title)F+=`<title>${l(L.title)}</title>
2078
- `,F+=`<meta name="title" content="${l(L.title)}">
2079
- `;if(L.description)F+=`<meta name="description" content="${l(L.description)}">
2080
- `;if(L.keywords){let w=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${l(w)}">
2081
- `}if(L.robots)F+=`<meta name="robots" content="${l(L.robots)}">
2082
- `;if(L.canonical)F+=`<link rel="canonical" href="${l(L.canonical)}">
2083
- `;if(L.openGraph){let w=L.openGraph;if(F+=`<meta property="og:type" content="${l(w.type||"website")}">
2084
- `,w.title||L.title){let R=w.title||L.title||"";F+=`<meta property="og:title" content="${l(R)}">
2085
- `}if(w.description||L.description){let R=w.description||L.description||"";F+=`<meta property="og:description" content="${l(R)}">
2086
- `}if(w.url||L.canonical){let R=w.url||L.canonical||"";F+=`<meta property="og:url" content="${l(R)}">
2087
- `}if(w.image){if(F+=`<meta property="og:image" content="${l(w.image)}">
2088
- `,w.imageAlt)F+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
2089
- `;if(w.imageWidth)F+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
2090
- `;if(w.imageHeight)F+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
2091
- `}if(w.siteName)F+=`<meta property="og:site_name" content="${l(w.siteName)}">
2092
- `}if(L.twitter){let w=L.twitter;if(F+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
2093
- `,w.title||L.title){let R=w.title||L.title||"";F+=`<meta name="twitter:title" content="${l(R)}">
2094
- `}if(w.description||L.description){let R=w.description||L.description||"";F+=`<meta name="twitter:description" content="${l(R)}">
2095
- `}if(w.image||L.openGraph&&L.openGraph.image){let R=w.image||(L.openGraph?L.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${l(R)}">
2096
- `}if(w.site)F+=`<meta name="twitter:site" content="${l(w.site)}">
2097
- `;if(w.creator)F+=`<meta name="twitter:creator" content="${l(w.creator)}">
2098
- `}if(L.structuredData){let w=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${w}</script>
2099
- `}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return J0("SEO",`Error processing @seo directive: ${F}`,X0.EVALUATION_ERROR)}})(B);Y=Y.substring(0,G.index)+O+Y.substring(j),Q.lastIndex=G.index+O.length}return Y}function n3($,Z,X){if(X.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.__stx_seo_staged===!0||X.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((H)=>H.property==="og:title"||H.name==="og:title"||H.name==="twitter:title"||H.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(X.seo?.defaultConfig?.title)G=X.seo.defaultConfig.title;else G=X.defaultTitle||"stx Project";let z="";if(Z.description)z=Z.description;else if(Z.meta&&Z.meta.description)z=Z.meta.description;else if(X.seo?.defaultConfig?.description)z=X.seo.defaultConfig.description;else z=X.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(X.seo?.defaultImage)q=X.seo.defaultImage;else if(X.defaultImage)q=X.defaultImage;let K=`
2100
- <!-- stx SEO Tags -->
2101
- <meta name="title" content="${l(G)}">
2102
- <meta name="description" content="${l(z)}">
2103
- <meta property="og:title" content="${l(G)}">
2104
- <meta property="og:description" content="${l(z)}">
2105
- <meta property="og:type" content="website">
2106
- <meta name="twitter:card" content="summary_large_image">
2107
- <meta name="twitter:title" content="${l(G)}">
2108
- <meta name="twitter:description" content="${l(z)}">
2109
- `;if(q)K+=`
2110
- <meta property="og:image" content="${l(q)}">
2111
- <meta name="twitter:image" content="${l(q)}">
2112
- `;let U=$;if(!Q)U=U.replace(/<head[^>]*>/,`$&
2113
- <title>${l(G)}</title>`);let W=Z.__stx_head_injections;if(W)return Z.__stx_seo_staged=!0,W.afterOpen.push(`
2114
- ${K}
2115
- `),U;return U.replace(/<head[^>]*>/,`$&
2116
- ${K}
2117
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var eZ=["og:","article:","book:","profile:","fb:","music:","video:"];function l3($){let Z=$.trim(),X=Z[0];if((X==="'"||X==='"'||X==="`")&&Z.length>1&&Z.at(-1)===X)return{value:Z.slice(1,-1),quoted:!0};return{value:Z,quoted:!1}}var $5={name:"meta",handler:($,Z,X,J)=>{if(Z.length<1)return J0("Meta","meta directive requires at least the meta name",X0.INVALID_DIRECTIVE_SYNTAX);let Y=l3(Z[0]).value,Q;if(Z.length>1){let q=l3(Z[1]);Q=q.quoted?q.value:String(X?.[q.value]??q.value)}else{let q=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,K=X?.openGraph;Q=String(X?.[q]??K?.[q]??"")}if(!Q)return"";let z=eZ.some((q)=>Y.startsWith(q))?{property:Y,content:Q}:{name:Y,content:Q};if(X)X.__stx_runtime_head=l2(X.__stx_runtime_head??{},{meta:[z]});return""},hasEndTag:!1},Z5={name:"structuredData",handler:($,Z,X,J)=>{if($.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",X0.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return J0("StructuredData","structuredData requires @type property",X0.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let Q=Y instanceof Error?Y.message:String(Y);return J0("StructuredData",Q,X0.EVALUATION_ERROR)}},hasEndTag:!0};function bq(){return[$5,Z5]}function yq($,Z){let X=Z.replace(/\/$/,""),J=new Date().toISOString().split("T")[0];return`<?xml version="1.0" encoding="UTF-8"?>
2118
- <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
2119
- ${$.map((Q)=>{let G=Q.startsWith("http")?Q:`${X}${Q.startsWith("/")?"":"/"}${Q}`;return` <sitemap>
2120
- <loc>${ZX(G)}</loc>
2121
- <lastmod>${J}</lastmod>
2122
- </sitemap>`}).join(`
2123
- `)}
2124
- </sitemapindex>`}async function Cq($,Z){let{extensions:X=[".stx",".html",".htm"],ignore:J=["_*",".*","node_modules","components","partials","layouts"]}=Z,Y=[],Q=X.length===1?`*${X[0]}`:`*{${X.join(",")}}`,G=new Bun.Glob(`**/${Q}`);for await(let z of G.scan($)){if(J.some((H)=>{if(H.startsWith("*"))return z.includes(H.slice(1));return z.startsWith(H)||z.includes(`/${H}`)}))continue;let K=z.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!K.startsWith("/"))K=`/${K}`;if(K!=="/"&&K.endsWith("/"))K=K.slice(0,-1);let U=`${$}/${z}`,W;try{let H=await Bun.file(U).stat();if(H)W=new Date(H.mtime).toISOString().split("T")[0]}catch{}Y.push({loc:K||"/",lastmod:W,priority:K==="/"?1:0.5})}return Y.sort((z,q)=>z.loc.localeCompare(q.loc)),Y}function $X($){let Z=[];for(let X of $.rules){if(Z.push(`User-agent: ${X.userAgent}`),X.allow)for(let J of X.allow)Z.push(`Allow: ${J}`);if(X.disallow)for(let J of X.disallow)Z.push(`Disallow: ${J}`);if(X.crawlDelay!==void 0)Z.push(`Crawl-delay: ${X.crawlDelay}`);Z.push("")}if($.sitemap){let X=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of X)Z.push(`Sitemap: ${J}`)}if($.host)Z.push(`Host: ${$.host}`);return Z.join(`
2125
- `).trim()}function Sq($){return $X({rules:[{userAgent:"*",allow:["/"]}],sitemap:$})}function ZX($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}import XX from"fs";import g0 from"path";async function hq($,Z){if(!$.webComponents?.enabled)return[];let X=$.webComponents.components||[],J=[];if(X.length>0){if($.debug)console.log(`Building ${X.length} web components...`);for(let Y of X)try{let Q=await JX(Y,$,Z);if(Q)J.push(Q)}catch(Q){if(console.error(`Error building web component ${Y.name}:`,Q),$.debug)throw Q}}return J}async function JX($,Z,X){let{name:J,file:Y,tag:Q,extends:G}=$;if(!J||!Y||!Q)return console.error("Invalid web component configuration, missing required fields:",$),null;let z=null;if(g0.isAbsolute(Y)&&await a(Y))z=Y;else if(Z.componentsDir){let _=g0.join(Z.componentsDir,Y);if(await a(_))z=_}if(!z)z=await c2(Y,process.cwd(),Z,X);if(!z)return console.error(`Web component source file not found: ${Y}`),null;let q=await Bun.file(z).text();X.add(z);let U=($.outputFormat||"js")==="ts",W=U?QX({name:J,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[],attributeTypes:$.attributeTypes||{}}):YX({name:J,tag:Q,baseElement:G,source:q,shadowDOM:$.shadowDOM??!0,template:$.template??!0,styleSource:$.styleSource,attributes:$.attributes||[]}),H=Z.webComponents?.outputDir||"dist/web-components";await XX.promises.mkdir(H,{recursive:!0});let j=U?"ts":"js",B=g0.join(H,`${Q}.${j}`);if(await Bun.write(B,W),Z.debug)console.log(`Built web component ${J} -> ${B}`);return B}function YX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[]}=$,K=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)K=K.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),K=K.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),K=K.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),K=K.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");let U="";if(z)U=`<link rel="stylesheet" href="${z}">`;return`/**
2126
- * ${Z} Web Component
2127
- * Auto-generated from stx component
2128
- */
2129
- class ${Z.replace(/\W/g,"")} extends ${J} {
2130
- constructor() {
2131
- super()
2132
- this._initialized = false
2133
- ${Q?"":"this._slotContent = []"}
2134
- ${Q?'this.attachShadow({ mode: "open" })':""}
2135
- }
2136
-
2137
- ${G?`
2138
- _createTemplate() {
2139
- const template = document.createElement('template')
2140
- template.innerHTML = \`${U}${K}\`
2141
- ${Q?"this.shadowRoot.appendChild(template.content.cloneNode(true))":"this.appendChild(template.content.cloneNode(true))"}
2142
- this._processSlots()
2143
- }
2144
- `:`
2145
- _render() {
2146
- ${Q?"this.shadowRoot.innerHTML":"this.innerHTML"} = \`${U}${K}\`
2147
- this._processSlots()
2148
- }
2149
- `}
2150
-
2151
- _processSlots() {
2152
- ${Q?`// Shadow DOM handles slot assignment automatically
2153
- // Listen for slot changes if needed
2154
- const slots = this.shadowRoot.querySelectorAll('slot')
2155
- slots.forEach(slot => {
2156
- slot.addEventListener('slotchange', (e) => {
2157
- const assignedNodes = slot.assignedNodes()
2158
- this.dispatchEvent(new CustomEvent('slot-changed', {
2159
- detail: { slotName: slot.name || 'default', assignedNodes }
2160
- }))
2161
- })
2162
- })`:`// Manual slot processing for non-shadow DOM mode
2163
- const slots = this.querySelectorAll('[data-slot]')
2164
-
2165
- // Process named slots
2166
- slots.forEach(slotEl => {
2167
- const slotName = slotEl.getAttribute('data-slot')
2168
- const slottedContent = this._slotContent.filter(
2169
- node => node.nodeType === Node.ELEMENT_NODE && node.getAttribute('slot') === slotName
2170
- )
2171
- if (slottedContent.length > 0) {
2172
- slotEl.innerHTML = ''
2173
- slottedContent.forEach(content => slotEl.appendChild(content))
2174
- }
2175
- })
2176
-
2177
- // Process default slot
2178
- const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]')
2179
- if (defaultSlot) {
2180
- const unslottedContent = this._slotContent.filter(
2181
- node => node.nodeType !== Node.ELEMENT_NODE || !node.hasAttribute('slot')
2182
- )
2183
- if (unslottedContent.length > 0) {
2184
- defaultSlot.innerHTML = ''
2185
- unslottedContent.forEach(content => defaultSlot.appendChild(content))
2186
- }
2187
- }`}
2188
- }
2189
-
2190
- ${q.length>0?`
2191
- static get observedAttributes() {
2192
- return [${q.map((W)=>`'${W}'`).join(", ")}]
2193
- }
2194
-
2195
- attributeChangedCallback(name, oldValue, newValue) {
2196
- if (oldValue !== newValue) {
2197
- this[name] = newValue
2198
- ${G?"":"if (this._initialized) this._render()"}
2199
- }
2200
- }
2201
- `:""}
2202
-
2203
- connectedCallback() {
2204
- if (this._initialized) return
2205
- ${Q?"":"this._slotContent = Array.from(this.childNodes)"}
2206
- this._initialized = true
2207
- ${G?"this._createTemplate()":"this._render()"}
2208
- }
2209
-
2210
- disconnectedCallback() {
2211
- // Component removed from the DOM
2212
- }
2213
- }
2214
-
2215
- // Register the web component
2216
- customElements.define('${X}', ${Z.replace(/\W/g,"")})
2217
- `}function QX($){let{name:Z,tag:X,baseElement:J="HTMLElement",source:Y,shadowDOM:Q,template:G,styleSource:z,attributes:q=[],attributeTypes:K={}}=$,U=Z.replace(/\W/g,""),W=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").trim();if(!Q)W=W.replace(/<slot\s+name=["']([^"']+)["']\s*>([\s\S]*?)<\/slot>/gi,'<div data-slot="$1">$2</div>'),W=W.replace(/<slot\s+name=["']([^"']+)["']\s*\/>/gi,'<div data-slot="$1"></div>'),W=W.replace(/<slot\s*>([\s\S]*?)<\/slot>/gi,"<div data-default-slot>$1</div>"),W=W.replace(/<slot\s*\/>/gi,"<div data-default-slot></div>");W=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${");let H=z?`<link rel="stylesheet" href="${z}">`:"",j=(R)=>{switch(K[R]){case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";default:return"string"}},B=(R)=>R.replace(/-([a-z])/g,(D,A)=>A.toUpperCase()),_=q.map((R)=>` private _${B(R)}: ${j(R)} | null = null;`).join(`
2218
- `),O=q.map((R)=>{let D=j(R),A=B(R);return`
2219
- get ${A}(): ${D} | null {
2220
- return this._${A};
2221
- }
2222
-
2223
- set ${A}(value: ${D} | null) {
2224
- this._${A} = value;
2225
- if (value !== null) {
2226
- this.setAttribute('${R}', String(value));
2227
- }
2228
- else {
2229
- this.removeAttribute('${R}');
2230
- }
2231
- }`}).join(`
2232
- `),V=q.length>0?`/**
2233
- * Props interface for ${Z}
2234
- */
2235
- export interface ${U}Props {
2236
- ${q.map((R)=>{let D=j(R);return` ${B(R)}?: ${D};`}).join(`
2237
- `)}
2238
- }
2239
- `:"",L=q.length>0?`
2240
- static get observedAttributes(): string[] {
2241
- return [${q.map((R)=>`'${R}'`).join(", ")}];
2242
- }
2243
-
2244
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
2245
- if (oldValue !== newValue) {
2246
- const camelCase = name.replace(/-([a-z])/g, (_: string, letter: string) => letter.toUpperCase());
2247
- (this as unknown as Record<string, unknown>)[\`_\${camelCase}\`] = this._parseAttributeValue(name, newValue);
2248
- ${G?"":"if (this._initialized) this._render();"}
2249
- }
2250
- }
2251
-
2252
- private _parseAttributeValue(name: string, value: string | null): unknown {
2253
- if (value === null) return null;
2254
- const typeMap: Record<string, string> = ${JSON.stringify(K)};
2255
- const type = typeMap[name] || 'string';
2256
- switch (type) {
2257
- case 'number': return Number(value);
2258
- case 'boolean': return value !== 'false' && value !== '0';
2259
- case 'object': try { return JSON.parse(value); }
2260
- catch { return value; }
2261
- default: return value;
2262
- }
2263
- }
2264
- `:"",F=G?`
2265
- private _createTemplate(): void {
2266
- const template = document.createElement('template');
2267
- template.innerHTML = \`${H}${W}\`;
2268
- ${Q?"this.shadowRoot!.appendChild(template.content.cloneNode(true));":"this.appendChild(template.content.cloneNode(true));"}
2269
- this._processSlots();
2270
- }`:`
2271
- private _render(): void {
2272
- ${Q?"this.shadowRoot!.innerHTML":"this.innerHTML"} = \`${H}${W}\`;
2273
- this._processSlots();
2274
- }`;return`/**
2275
- * ${Z} Web Component
2276
- * Auto-generated from stx component (TypeScript)
2277
- *
2278
- * @example
2279
- * \`\`\`html
2280
- * <${X}></${X}>
2281
- * \`\`\`
2282
- */
2283
-
2284
- /**
2285
- * Detail type for slot-changed event
2286
- */
2287
- interface SlotChangeDetail {
2288
- slotName: string;
2289
- assignedNodes: Node[];
2290
- }
2291
-
2292
- ${V}
2293
- /**
2294
- * ${Z} custom element class
2295
- * @customElement ${X}
2296
- */
2297
- export class ${U} extends ${J} {
2298
- ${_}
2299
- private _initialized = false;
2300
- ${Q?"":"private _slotContent: Node[] = [];"}
2301
-
2302
- constructor() {
2303
- super();
2304
- ${Q?'this.attachShadow({ mode: "open" });':""}
2305
- }
2306
- ${F}
2307
- ${Q?`
2308
- private _processSlots(): void {
2309
- const slots = this.shadowRoot!.querySelectorAll('slot');
2310
- slots.forEach((slot) => {
2311
- slot.addEventListener('slotchange', () => {
2312
- const assignedNodes = (slot as HTMLSlotElement).assignedNodes();
2313
- this.dispatchEvent(new CustomEvent<SlotChangeDetail>('slot-changed', {
2314
- detail: { slotName: slot.getAttribute('name') || 'default', assignedNodes }
2315
- }));
2316
- });
2317
- });
2318
- }`:`
2319
- private _processSlots(): void {
2320
- const slots = this.querySelectorAll('[data-slot]');
2321
- slots.forEach((slotEl) => {
2322
- const slotName = slotEl.getAttribute('data-slot');
2323
- if (slotName) {
2324
- const slottedContent = this._slotContent.filter(
2325
- node => node.nodeType === Node.ELEMENT_NODE && (node as Element).getAttribute('slot') === slotName
2326
- );
2327
- if (slottedContent.length > 0) {
2328
- slotEl.innerHTML = '';
2329
- slottedContent.forEach(content => slotEl.appendChild(content));
2330
- }
2331
- }
2332
- });
2333
- const defaultSlot = this.querySelector('[data-slot=""]') || this.querySelector('[data-default-slot]');
2334
- if (defaultSlot) {
2335
- const unslottedContent = this._slotContent.filter(
2336
- node => node.nodeType !== Node.ELEMENT_NODE || !(node as Element).hasAttribute('slot')
2337
- );
2338
- if (unslottedContent.length > 0) {
2339
- defaultSlot.innerHTML = '';
2340
- unslottedContent.forEach(content => defaultSlot.appendChild(content));
2341
- }
2342
- }
2343
- }`}
2344
- ${L}
2345
- ${O}
2346
-
2347
- connectedCallback(): void {
2348
- if (this._initialized) return;
2349
- ${Q?"":"this._slotContent = Array.from(this.childNodes);"}
2350
- this._initialized = true;
2351
- ${G?"this._createTemplate();":"this._render();"}
2352
- }
2353
-
2354
- disconnectedCallback(): void {
2355
- // Component removed from the DOM
2356
- }
2357
-
2358
- adoptedCallback(): void {
2359
- // Component moved to a new document
2360
- }
2361
- }
2362
-
2363
- // Type augmentation for HTMLElementTagNameMap
2364
- declare global {
2365
- interface HTMLElementTagNameMap {
2366
- '${X}': ${U};
2367
- }
2368
- }
2369
-
2370
- // Register the web component
2371
- customElements.define('${X}', ${U});
2372
- `}var X5={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0};function J5($){let Z=$.split("").reduce((X,J)=>(X<<5)-X+J.charCodeAt(0)|0,0);return Math.abs(Z).toString(36).slice(0,8)}function GX($,Z,X={}){let J={...X5,...X},Y=J5(Z);switch(J.strategy){case"shadow":return $;case"prefix":return qX($,J.prefix||Z,J.preserveOriginal);case"attribute":return zX($,Y,J.attributeName||"data-v",J.preserveOriginal);case"bem":return KX($,Z,J.preserveOriginal);default:return $}}function zX($,Z,X,J){let Y=`[${X}-${Z}]`;return $.replace(/([.#]?[\w-]+|\*)\s*(\{|,)/g,(Q,G,z)=>{if(G.startsWith("@"))return Q;if(/^(?::root|:host|html|body)$/i.test(G))return Q;return`${J?`${G}${Y}`:`${G}${Y}`}${z}`})}function qX($,Z,X){return $.replace(/\.([a-z_][\w-]*)/gi,(J,Y)=>{if(Y.startsWith(Z))return J;let Q=`${Z}__${Y}`;return X?`.${Q}`:`.${Q}`})}function KX($,Z,X){let J=Z.replace(/[^a-z0-9]/gi,"-");return $.replace(/\.([a-z_][\w-]*)/gi,(Y,Q)=>{if(Q.includes("__")||Q.includes("--")){if(!Q.startsWith(J))return`.${J}__${Q}`;return Y}let G=`${J}__${Q}`;return X?`.${G}`:`.${G}`})}function UX($,Z,X={}){let J={...X5,...X};if(J.strategy==="shadow")return $;if(J.strategy==="attribute"){let Y=J5(Z),G=`${J.attributeName||"data-v"}-${Y}`;return $.replace(/<([a-z][a-z0-9-]*)([^>]*)>/gi,(z,q,K)=>{if(/^(?:script|style|!--)$/i.test(q))return z;let U=K.trimEnd().endsWith("/"),W=U?K.slice(0,-1):K;return`<${q}${W} ${G}${U?"/":""}>`})}if(J.strategy==="prefix"||J.strategy==="bem"){let Y=J.strategy==="bem"?Z.replace(/[^a-z0-9]/gi,"-"):J.prefix||Z;return $.replace(/\bclass\s*=\s*["']([^"']+)["']/gi,(Q,G)=>{return`class="${G.split(/\s+/).map((q)=>{if(!q)return q;if(q.startsWith(Y))return q;return`${Y}__${q}`}).join(" ")}"`})}return $}function uq($,Z={}){let X={...X5,...Z},J=J5($);return`${X.attributeName||"data-v"}-${J}`}function dq($,Z,X={}){let J="",Y=$.replace(/<style([^>]*)>([\s\S]*?)<\/style>/gi,(G,z,q)=>{if(/\bscoped\b/i.test(z)||X.strategy!=="shadow")J+=`${GX(q,Z,X)}
2373
- `;else J+=`${q}
2374
- `;return""});return{html:UX(Y,Z,X),css:J.trim()}}function S1($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function mq($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:U={},state:W={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((k)=>z[k].attribute!==!1).map((k)=>z[k].attribute||S1(k)),_=j.map((k)=>{let N=z[k],M=N.default!==void 0?JSON.stringify(N.default):N.type==="string"?'""':N.type==="number"?"0":N.type==="boolean"?"false":N.type==="array"?"[]":"{}";return` this._${k} = ${M};`}).join(`
2375
- `),O=j.map((k)=>{let N=z[k],M=N.attribute!==!1?N.attribute||S1(k):null,T=N.reflect&&M?`
2376
- if (value !== null && value !== undefined) {
2377
- ${N.type==="boolean"?`if (value) { this.setAttribute('${M}', ''); }
2378
- else { this.removeAttribute('${M}'); }`:`this.setAttribute('${M}', ${N.type==="object"||N.type==="array"?"JSON.stringify(value)":"String(value)"});`}
2379
- }
2380
- else {
2381
- this.removeAttribute('${M}');
2382
- }`:"",I=N.observer?`this.${N.observer}(value, oldValue);`:"",y=N.render!==!1?"this._scheduleRender();":"";return`
2383
- get ${k}() {
2384
- return this._${k};
2385
- }
2386
-
2387
- set ${k}(value) {
2388
- const oldValue = this._${k};
2389
- if (oldValue === value) return;
2390
- this._${k} = value;${T}
2391
- ${I}
2392
- ${y}
2393
- this.dispatchEvent(new CustomEvent('${k}-changed', {
2394
- detail: { value, oldValue },
2395
- bubbles: true
2396
- }));
2397
- }`}).join(`
2398
- `),V=B.length>0?`
2399
- static get observedAttributes() {
2400
- return [${B.map((k)=>`'${k}'`).join(", ")}];
2401
- }
2402
-
2403
- attributeChangedCallback(name, oldValue, newValue) {
2404
- if (oldValue === newValue) return;
2405
- const propName = this._attrToProp[name];
2406
- if (propName) {
2407
- const propDef = this._propertyDefs[propName];
2408
- this[propName] = this._deserializeAttribute(newValue, propDef.type);
2409
- }
2410
- ${q.attributeChanged||""}
2411
- }`:"",L=Object.entries(K).map(([k,N])=>{return`this._root.addEventListener('${k}', (e) => { ${N} });`}).join(`
2412
- `),F=Object.entries(U).map(([k,N])=>{return`
2413
- ${k}() {
2414
- ${N}
2415
- }`}).join(`
2416
- `),w=JSON.stringify(Object.fromEntries(j.map((k)=>[k,z[k]]))),R=JSON.stringify(Object.fromEntries(j.filter((k)=>z[k].attribute!==!1).map((k)=>[z[k].attribute||S1(k),k]))),D=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),A=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2417
- * ${Z} - Reactive Web Component
2418
- * Auto-generated with reactive properties and lifecycle management
2419
- *
2420
- * @customElement ${X}
2421
- */
2422
- class ${H} extends ${J} {
2423
- // Property definitions
2424
- _propertyDefs = ${w};
2425
- _attrToProp = ${R};
2426
-
2427
- // Internal state
2428
- _state = ${JSON.stringify(W)};
2429
- _renderPending = false;
2430
- _isConnected = false;
2431
-
2432
- constructor() {
2433
- super();
2434
- ${G?'this.attachShadow({ mode: "open" });':""}
2435
- this._root = ${G?"this.shadowRoot":"this"};
2436
-
2437
- // Initialize properties with defaults
2438
- ${_}
2439
-
2440
- // Initial render
2441
- this._render();
2442
- }
2443
-
2444
- // =========================================================================
2445
- // Reactive Properties
2446
- // =========================================================================
2447
- ${O}
2448
-
2449
- // =========================================================================
2450
- // State Management
2451
- // =========================================================================
2452
-
2453
- /**
2454
- * Get current internal state
2455
- */
2456
- get state() {
2457
- return { ...this._state };
2458
- }
2459
-
2460
- /**
2461
- * Update internal state and trigger re-render
2462
- * @param {Object} updates - State updates to merge
2463
- */
2464
- setState(updates) {
2465
- const oldState = { ...this._state };
2466
- this._state = { ...this._state, ...updates };
2467
- this._scheduleRender();
2468
- this.dispatchEvent(new CustomEvent('state-changed', {
2469
- detail: { state: this._state, oldState },
2470
- bubbles: true
2471
- }));
2472
- }
2473
-
2474
- // =========================================================================
2475
- // Rendering
2476
- // =========================================================================
2477
-
2478
- /**
2479
- * Schedule a render on the next animation frame (batched)
2480
- */
2481
- _scheduleRender() {
2482
- if (this._renderPending) return;
2483
- this._renderPending = true;
2484
- requestAnimationFrame(() => {
2485
- this._renderPending = false;
2486
- this._render();
2487
- });
2488
- }
2489
-
2490
- /**
2491
- * Render the component template
2492
- */
2493
- _render() {
2494
- const template = \`${A?`<style>${A}</style>`:""}${D}\`;
2495
-
2496
- // Interpolate template with property values
2497
- const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
2498
- if (propName in this) {
2499
- const value = this[propName];
2500
- if (value === null || value === undefined) return '';
2501
- if (typeof value === 'object') return JSON.stringify(value);
2502
- return String(value);
2503
- }
2504
- if (propName in this._state) {
2505
- const value = this._state[propName];
2506
- if (value === null || value === undefined) return '';
2507
- if (typeof value === 'object') return JSON.stringify(value);
2508
- return String(value);
2509
- }
2510
- return match;
2511
- });
2512
-
2513
- this._root.innerHTML = rendered;
2514
- this._bindEvents();
2515
- }
2516
-
2517
- /**
2518
- * Bind event handlers after render
2519
- */
2520
- _bindEvents() {
2521
- ${L}
2522
- }
2523
-
2524
- // =========================================================================
2525
- // Attribute Handling
2526
- // =========================================================================
2527
-
2528
- /**
2529
- * Deserialize attribute value to property type
2530
- */
2531
- _deserializeAttribute(value, type) {
2532
- if (value === null) return null;
2533
- switch (type) {
2534
- case 'number': return Number(value);
2535
- case 'boolean': return value !== null && value !== 'false' && value !== '0';
2536
- case 'object':
2537
- case 'array':
2538
- try { return JSON.parse(value); }
2539
- catch { return type === 'array' ? [] : {}; }
2540
- default: return value;
2541
- }
2542
- }
2543
-
2544
- ${V}
2545
-
2546
- // =========================================================================
2547
- // Lifecycle
2548
- // =========================================================================
2549
-
2550
- connectedCallback() {
2551
- this._isConnected = true;
2552
- ${q.connected||"// Component connected to DOM"}
2553
- }
2554
-
2555
- disconnectedCallback() {
2556
- this._isConnected = false;
2557
- ${q.disconnected||"// Component disconnected from DOM"}
2558
- }
2559
-
2560
- adoptedCallback() {
2561
- ${q.adopted||"// Component moved to new document"}
2562
- }
2563
-
2564
- // =========================================================================
2565
- // Custom Methods
2566
- // =========================================================================
2567
- ${F}
2568
- }
2569
-
2570
- // Register the custom element
2571
- customElements.define('${X}', ${H});
2572
-
2573
- // Export for module usage
2574
- export { ${H} };
2575
- export default ${H};
2576
- `}function lq($){let{name:Z,tag:X,baseElement:J="HTMLElement",template:Y,styles:Q="",shadowDOM:G=!0,properties:z={},lifecycle:q={},events:K={},methods:U={},state:W={}}=$,H=Z.replace(/\W/g,""),j=Object.keys(z),B=j.filter((N)=>z[N].attribute!==!1).map((N)=>z[N].attribute||S1(N)),_=(N)=>{switch(N){case"string":return"string";case"number":return"number";case"boolean":return"boolean";case"object":return"Record<string, unknown>";case"array":return"unknown[]";default:return"unknown"}},O=j.length>0?`
2577
- /**
2578
- * Props interface for ${Z}
2579
- */
2580
- export interface ${H}Props {
2581
- ${j.map((N)=>` ${N}?: ${_(z[N].type)};`).join(`
2582
- `)}
2583
- }
2584
- `:"",V=Object.keys(W).length>0?`
2585
- /**
2586
- * State interface for ${Z}
2587
- */
2588
- export interface ${H}State {
2589
- ${Object.entries(W).map(([N,M])=>` ${N}: ${typeof M};`).join(`
2590
- `)}
2591
- }
2592
- `:`
2593
- export interface ${H}State {
2594
- [key: string]: unknown;
2595
- }
2596
- `,L=j.map((N)=>{let M=z[N],T=_(M.type);return` private _${N}: ${T};`}).join(`
2597
- `),F=j.map((N)=>{let M=z[N],T=_(M.type),I=M.attribute!==!1?M.attribute||S1(N):null,y=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}",E=M.reflect&&I?`
2598
- if (value !== null && value !== undefined) {
2599
- ${M.type==="boolean"?`if (value) { this.setAttribute('${I}', ''); }
2600
- else { this.removeAttribute('${I}'); }`:`this.setAttribute('${I}', ${M.type==="object"||M.type==="array"?"JSON.stringify(value)":"String(value)"});`}
2601
- }
2602
- else {
2603
- this.removeAttribute('${I}');
2604
- }`:"",b=M.observer?`this.${M.observer}(value, oldValue);`:"",C=M.render!==!1?"this._scheduleRender();":"";return`
2605
- get ${N}(): ${T} {
2606
- return this._${N};
2607
- }
2608
-
2609
- set ${N}(value: ${T}) {
2610
- const oldValue = this._${N};
2611
- if (oldValue === value) return;
2612
- this._${N} = value;${E}
2613
- ${b}
2614
- ${C}
2615
- this.dispatchEvent(new CustomEvent('${N}-changed', {
2616
- detail: { value, oldValue },
2617
- bubbles: true
2618
- }));
2619
- }
2620
-
2621
- // Property default: ${y}`}).join(`
2622
- `),w=B.length>0?`
2623
- static get observedAttributes(): string[] {
2624
- return [${B.map((N)=>`'${N}'`).join(", ")}];
2625
- }
2626
-
2627
- attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void {
2628
- if (oldValue === newValue) return;
2629
- const propName = this._attrToProp[name];
2630
- if (propName) {
2631
- const propDef = this._propertyDefs[propName];
2632
- (this as unknown as Record<string, unknown>)[propName] = this._deserializeAttribute(newValue, propDef.type);
2633
- }
2634
- ${q.attributeChanged||""}
2635
- }`:"",R=Object.entries(K).map(([N,M])=>{return`this._root.addEventListener('${N}', (e: Event) => { ${M} });`}).join(`
2636
- `),D=Object.entries(U).map(([N,M])=>{return`
2637
- ${N}(): void {
2638
- ${M}
2639
- }`}).join(`
2640
- `),A=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),k=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`");return`/**
2641
- * ${Z} - Reactive Web Component (TypeScript)
2642
- * Auto-generated with reactive properties and lifecycle management
2643
- *
2644
- * @customElement ${X}
2645
- */
2646
-
2647
- ${O}
2648
- ${V}
2649
-
2650
- /**
2651
- * Property definition type
2652
- */
2653
- interface PropertyDefinition {
2654
- type: 'string' | 'number' | 'boolean' | 'object' | 'array';
2655
- default?: unknown;
2656
- reflect?: boolean;
2657
- attribute?: string | false;
2658
- observer?: string;
2659
- render?: boolean;
2660
- }
2661
-
2662
- /**
2663
- * ${Z} custom element
2664
- */
2665
- export class ${H} extends ${J} {
2666
- // Property definitions
2667
- private _propertyDefs: Record<string, PropertyDefinition> = ${JSON.stringify(z)};
2668
- private _attrToProp: Record<string, string> = ${JSON.stringify(Object.fromEntries(j.filter((N)=>z[N].attribute!==!1).map((N)=>[z[N].attribute||S1(N),N])))};
2669
-
2670
- // Internal state
2671
- private _state: ${H}State = ${JSON.stringify(W)};
2672
- private _renderPending = false;
2673
- private _isConnected = false;
2674
- private _root: ShadowRoot | HTMLElement;
2675
-
2676
- // Property backing fields
2677
- ${L}
2678
-
2679
- constructor() {
2680
- super();
2681
- ${G?'this.attachShadow({ mode: "open" });':""}
2682
- this._root = ${G?"this.shadowRoot!":"this"};
2683
-
2684
- // Initialize properties with defaults
2685
- ${j.map((N)=>{let M=z[N],T=M.default!==void 0?JSON.stringify(M.default):M.type==="string"?'""':M.type==="number"?"0":M.type==="boolean"?"false":M.type==="array"?"[]":"{}";return` this._${N} = ${T};`}).join(`
2686
- `)}
2687
-
2688
- // Initial render
2689
- this._render();
2690
- }
2691
-
2692
- // =========================================================================
2693
- // Reactive Properties
2694
- // =========================================================================
2695
- ${F}
2696
-
2697
- // =========================================================================
2698
- // State Management
2699
- // =========================================================================
2700
-
2701
- /**
2702
- * Get current internal state
2703
- */
2704
- get state(): ${H}State {
2705
- return { ...this._state };
2706
- }
2707
-
2708
- /**
2709
- * Update internal state and trigger re-render
2710
- */
2711
- setState(updates: Partial<${H}State>): void {
2712
- const oldState = { ...this._state };
2713
- this._state = { ...this._state, ...updates };
2714
- this._scheduleRender();
2715
- this.dispatchEvent(new CustomEvent('state-changed', {
2716
- detail: { state: this._state, oldState },
2717
- bubbles: true
2718
- }));
2719
- }
2720
-
2721
- // =========================================================================
2722
- // Rendering
2723
- // =========================================================================
2724
-
2725
- /**
2726
- * Schedule a render on the next animation frame (batched)
2727
- */
2728
- private _scheduleRender(): void {
2729
- if (this._renderPending) return;
2730
- this._renderPending = true;
2731
- requestAnimationFrame(() => {
2732
- this._renderPending = false;
2733
- this._render();
2734
- });
2735
- }
2736
-
2737
- /**
2738
- * Render the component template
2739
- */
2740
- private _render(): void {
2741
- const template = \`${k?`<style>${k}</style>`:""}${A}\`;
2742
-
2743
- // Interpolate template with property values
2744
- const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, propName) => {
2745
- if (propName in this) {
2746
- const value = (this as unknown as Record<string, unknown>)[propName];
2747
- if (value === null || value === undefined) return '';
2748
- if (typeof value === 'object') return JSON.stringify(value);
2749
- return String(value);
2750
- }
2751
- if (propName in this._state) {
2752
- const value = this._state[propName as keyof ${H}State];
2753
- if (value === null || value === undefined) return '';
2754
- if (typeof value === 'object') return JSON.stringify(value);
2755
- return String(value);
2756
- }
2757
- return match;
2758
- });
2759
-
2760
- this._root.innerHTML = rendered;
2761
- this._bindEvents();
2762
- }
2763
-
2764
- /**
2765
- * Bind event handlers after render
2766
- */
2767
- private _bindEvents(): void {
2768
- ${R}
2769
- }
2770
-
2771
- // =========================================================================
2772
- // Attribute Handling
2773
- // =========================================================================
2774
-
2775
- /**
2776
- * Deserialize attribute value to property type
2777
- */
2778
- private _deserializeAttribute(value: string | null, type: string): unknown {
2779
- if (value === null) return null;
2780
- switch (type) {
2781
- case 'number': return Number(value);
2782
- case 'boolean': return value !== null && value !== 'false' && value !== '0';
2783
- case 'object':
2784
- case 'array':
2785
- try { return JSON.parse(value); }
2786
- catch { return type === 'array' ? [] : {}; }
2787
- default: return value;
2788
- }
2789
- }
2790
-
2791
- ${w}
2792
-
2793
- // =========================================================================
2794
- // Lifecycle
2795
- // =========================================================================
2796
-
2797
- connectedCallback(): void {
2798
- this._isConnected = true;
2799
- ${q.connected||"// Component connected to DOM"}
2800
- }
2801
-
2802
- disconnectedCallback(): void {
2803
- this._isConnected = false;
2804
- ${q.disconnected||"// Component disconnected from DOM"}
2805
- }
2806
-
2807
- adoptedCallback(): void {
2808
- ${q.adopted||"// Component moved to new document"}
2809
- }
2810
-
2811
- // =========================================================================
2812
- // Custom Methods
2813
- // =========================================================================
2814
- ${D}
2815
- }
2816
-
2817
- // Type augmentation for HTMLElementTagNameMap
2818
- declare global {
2819
- interface HTMLElementTagNameMap {
2820
- '${X}': ${H};
2821
- }
2822
- }
2823
-
2824
- // Register the custom element
2825
- customElements.define('${X}', ${H});
2826
-
2827
- export default ${H};
2828
- `}function cq(){return`/**
2829
- * ReactiveElement Mixin
2830
- * Adds reactive properties and lifecycle management to web components
2831
- */
2832
- const ReactiveElement = (Base) => class extends Base {
2833
- static get observedAttributes() {
2834
- const props = this.properties || {};
2835
- return Object.keys(props)
2836
- .filter(prop => props[prop].attribute !== false)
2837
- .map(prop => props[prop].attribute || prop.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase());
2838
- }
2839
-
2840
- constructor() {
2841
- super();
2842
- this._state = {};
2843
- this._renderPending = false;
2844
- this._propertyValues = new Map();
2845
- this._initializeProperties();
2846
- }
2847
-
2848
- _initializeProperties() {
2849
- const props = this.constructor.properties || {};
2850
- for (const [name, def] of Object.entries(props)) {
2851
- // Set default value
2852
- if (def.default !== undefined) {
2853
- this._propertyValues.set(name, def.default);
2854
- }
2855
-
2856
- // Define getter/setter
2857
- Object.defineProperty(this, name, {
2858
- get: () => this._propertyValues.get(name),
2859
- set: (value) => {
2860
- const oldValue = this._propertyValues.get(name);
2861
- if (oldValue === value) return;
2862
- this._propertyValues.set(name, value);
2863
-
2864
- // Reflect to attribute
2865
- if (def.reflect) {
2866
- const attrName = def.attribute || name.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
2867
- if (def.type === 'boolean') {
2868
- value ? this.setAttribute(attrName, '') : this.removeAttribute(attrName);
2869
- }
2870
- else {
2871
- this.setAttribute(attrName, def.type === 'object' ? JSON.stringify(value) : String(value));
2872
- }
2873
- }
2874
-
2875
- // Call observer
2876
- if (def.observer && typeof this[def.observer] === 'function') {
2877
- this[def.observer](value, oldValue);
2878
- }
2879
-
2880
- // Schedule render
2881
- if (def.render !== false) {
2882
- this._scheduleRender();
2883
- }
2884
-
2885
- // Dispatch event
2886
- this.dispatchEvent(new CustomEvent(\`\${name}-changed\`, {
2887
- detail: { value, oldValue },
2888
- bubbles: true
2889
- }));
2890
- },
2891
- enumerable: true,
2892
- configurable: true
2893
- });
2894
- }
2895
- }
2896
-
2897
- attributeChangedCallback(name, oldValue, newValue) {
2898
- if (oldValue === newValue) return;
2899
- const props = this.constructor.properties || {};
2900
- const propName = Object.keys(props).find(p =>
2901
- (props[p].attribute || p.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()) === name
2902
- );
2903
- if (propName) {
2904
- const def = props[propName];
2905
- this[propName] = this._deserialize(newValue, def.type);
2906
- }
2907
- }
2908
-
2909
- _deserialize(value, type) {
2910
- if (value === null) return null;
2911
- switch (type) {
2912
- case 'number': return Number(value);
2913
- case 'boolean': return value !== null && value !== 'false';
2914
- case 'object':
2915
- case 'array':
2916
- try { return JSON.parse(value); }
2917
- catch { return type === 'array' ? [] : {}; }
2918
- default: return value;
2919
- }
2920
- }
2921
-
2922
- get state() {
2923
- return { ...this._state };
2924
- }
2925
-
2926
- setState(updates) {
2927
- const oldState = { ...this._state };
2928
- this._state = { ...this._state, ...updates };
2929
- this._scheduleRender();
2930
- this.dispatchEvent(new CustomEvent('state-changed', {
2931
- detail: { state: this._state, oldState },
2932
- bubbles: true
2933
- }));
2934
- }
2935
-
2936
- _scheduleRender() {
2937
- if (this._renderPending) return;
2938
- this._renderPending = true;
2939
- requestAnimationFrame(() => {
2940
- this._renderPending = false;
2941
- if (typeof this.render === 'function') {
2942
- this.render();
2943
- }
2944
- });
2945
- }
2946
- };
2947
-
2948
- export { ReactiveElement };
2949
- export default ReactiveElement;
2950
- `}function pq(){return`/**
2951
- * stx Reactive Web Components Runtime
2952
- * Provides base classes and utilities for reactive web components
2953
- */
2954
- (function(global) {
2955
- 'use strict';
2956
-
2957
- /**
2958
- * Base class for reactive web components
2959
- */
2960
- class StxElement extends HTMLElement {
2961
- static get observedAttributes() {
2962
- const props = this.properties || {};
2963
- return Object.keys(props)
2964
- .filter(prop => props[prop].attribute !== false)
2965
- .map(prop => props[prop].attribute || toKebabCase(prop));
2966
- }
2967
-
2968
- constructor() {
2969
- super();
2970
- this._state = {};
2971
- this._renderPending = false;
2972
- this._props = new Map();
2973
- this._setupShadowDOM();
2974
- this._initProperties();
2975
- }
2976
-
2977
- _setupShadowDOM() {
2978
- if (this.constructor.useShadowDOM !== false) {
2979
- this.attachShadow({ mode: 'open' });
2980
- this._root = this.shadowRoot;
2981
- }
2982
- else {
2983
- this._root = this;
2984
- }
2985
- }
2986
-
2987
- _initProperties() {
2988
- const props = this.constructor.properties || {};
2989
- for (const [name, def] of Object.entries(props)) {
2990
- let value = def.default;
2991
- this._props.set(name, value);
2992
-
2993
- Object.defineProperty(this, name, {
2994
- get: () => this._props.get(name),
2995
- set: (newValue) => this._setProperty(name, newValue, def),
2996
- enumerable: true
2997
- });
2998
- }
2999
- }
3000
-
3001
- _setProperty(name, value, def) {
3002
- const oldValue = this._props.get(name);
3003
- if (oldValue === value) return;
3004
-
3005
- this._props.set(name, value);
3006
-
3007
- if (def.reflect && def.attribute !== false) {
3008
- this._reflectToAttribute(name, value, def);
3009
- }
3010
-
3011
- if (def.observer && this[def.observer]) {
3012
- this[def.observer](value, oldValue);
3013
- }
3014
-
3015
- if (def.render !== false) {
3016
- this.requestUpdate();
3017
- }
3018
-
3019
- this.dispatchEvent(new CustomEvent(name + '-changed', {
3020
- detail: { value, oldValue },
3021
- bubbles: true,
3022
- composed: true
3023
- }));
3024
- }
3025
-
3026
- _reflectToAttribute(name, value, def) {
3027
- const attrName = def.attribute || toKebabCase(name);
3028
- if (value == null || (def.type === 'boolean' && !value)) {
3029
- this.removeAttribute(attrName);
3030
- }
3031
- else if (def.type === 'boolean') {
3032
- this.setAttribute(attrName, '');
3033
- }
3034
- else if (def.type === 'object' || def.type === 'array') {
3035
- this.setAttribute(attrName, JSON.stringify(value));
3036
- }
3037
- else {
3038
- this.setAttribute(attrName, String(value));
3039
- }
3040
- }
3041
-
3042
- attributeChangedCallback(name, oldValue, newValue) {
3043
- if (oldValue === newValue) return;
3044
- const props = this.constructor.properties || {};
3045
- const propName = Object.keys(props).find(p => {
3046
- const def = props[p];
3047
- return (def.attribute || toKebabCase(p)) === name;
3048
- });
3049
-
3050
- if (propName) {
3051
- const def = props[propName];
3052
- this[propName] = deserialize(newValue, def.type);
3053
- }
3054
- }
3055
-
3056
- get state() {
3057
- return { ...this._state };
3058
- }
3059
-
3060
- setState(updates) {
3061
- const oldState = { ...this._state };
3062
- Object.assign(this._state, updates);
3063
- this.requestUpdate();
3064
- this.dispatchEvent(new CustomEvent('state-changed', {
3065
- detail: { state: this._state, oldState },
3066
- bubbles: true
3067
- }));
3068
- }
3069
-
3070
- requestUpdate() {
3071
- if (this._renderPending) return;
3072
- this._renderPending = true;
3073
- requestAnimationFrame(() => {
3074
- this._renderPending = false;
3075
- this.update();
3076
- });
3077
- }
3078
-
3079
- update() {
3080
- if (this.render) {
3081
- const content = this.render();
3082
- if (typeof content === 'string') {
3083
- this._root.innerHTML = content;
3084
- }
3085
- }
3086
- }
3087
-
3088
- connectedCallback() {
3089
- this.update();
3090
- if (this.connected) this.connected();
3091
- }
3092
-
3093
- disconnectedCallback() {
3094
- if (this.disconnected) this.disconnected();
3095
- }
3096
-
3097
- adoptedCallback() {
3098
- if (this.adopted) this.adopted();
3099
- }
3100
-
3101
- // Template helper
3102
- html(strings, ...values) {
3103
- return strings.reduce((result, str, i) => {
3104
- let value = values[i] || '';
3105
- if (Array.isArray(value)) value = value.join('');
3106
- if (typeof value === 'object') value = JSON.stringify(value);
3107
- return result + str + value;
3108
- }, '');
3109
- }
3110
- }
3111
-
3112
- // Utility functions
3113
- function toKebabCase(str) {
3114
- return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase();
3115
- }
3116
-
3117
- function deserialize(value, type) {
3118
- if (value === null) return null;
3119
- switch (type) {
3120
- case 'number': return Number(value);
3121
- case 'boolean': return value !== null && value !== 'false' && value !== '0';
3122
- case 'object':
3123
- case 'array':
3124
- try { return JSON.parse(value); }
3125
- catch { return type === 'array' ? [] : {}; }
3126
- default: return value;
3127
- }
3128
- }
3129
-
3130
- // Export to global
3131
- global.StxElement = StxElement;
3132
- global.stxComponents = global.stxComponents || {};
3133
-
3134
- // Helper to define components
3135
- global.defineStxComponent = function(tag, config) {
3136
- const { properties, template, styles, methods, ...options } = config;
3137
-
3138
- class Component extends StxElement {
3139
- static get properties() { return properties || {}; }
3140
- static get useShadowDOM() { return options.shadowDOM !== false; }
3141
-
3142
- render() {
3143
- let html = template || '';
3144
- // Simple interpolation
3145
- html = html.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, key) => {
3146
- if (key in this) return this[key] ?? '';
3147
- if (key in this._state) return this._state[key] ?? '';
3148
- return match;
3149
- });
3150
- return (styles ? '<style>' + styles + '</style>' : '') + html;
3151
- }
3152
- }
3153
-
3154
- // Add methods
3155
- if (methods) {
3156
- for (const [name, fn] of Object.entries(methods)) {
3157
- Component.prototype[name] = fn;
3158
- }
3159
- }
3160
-
3161
- customElements.define(tag, Component);
3162
- global.stxComponents[tag] = Component;
3163
- return Component;
3164
- };
3165
-
3166
- })(typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : this);
3167
- `}function WX($,Z){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=X?X[1].trim():"",Y=Z,Q=[],G=!0;if(J){let W=J.match(/export\s+default\s+({[\s\S]*})/);if(W)try{let H=W[1],j=H.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=H.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=H.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=z?z[1].trim():"",K=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=K?K[1].trim():"";return{tag:Y,props:Q,template:q,styles:U,script:J,shadowDOM:G}}function HX($){let{tag:Z,props:X,template:J,styles:Y,shadowDOM:Q}=$,G=Z.split("-").map((W)=>W.charAt(0).toUpperCase()+W.slice(1)).join(""),z=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=X.map((W)=>`'${W}'`).join(", "),U=X.map((W)=>`
3168
- get ${W}() {
3169
- return this.getAttribute('${W}') || '';
3170
- }
3171
- set ${W}(value) {
3172
- if (value) {
3173
- this.setAttribute('${W}', value);
3174
- }
3175
- else {
3176
- this.removeAttribute('${W}');
3177
- }
3178
- }`).join(`
3179
- `);return`/**
3180
- * ${G} Web Component
3181
- * Auto-generated from SFC
3182
- */
3183
- class ${G} extends HTMLElement {
3184
- constructor() {
3185
- super();
3186
- ${Q?"this.attachShadow({ mode: 'open' });":""}
3187
- this._render();
3188
- }
3189
-
3190
- static get observedAttributes() {
3191
- return [${K}];
3192
- }
3193
-
3194
- attributeChangedCallback(name, oldValue, newValue) {
3195
- if (oldValue !== newValue) {
3196
- this._render();
3197
- }
3198
- }
3199
- ${U}
3200
-
3201
- _render() {
3202
- const template = \`${q?`<style>${q}</style>`:""}${z}\`;
3203
-
3204
- // Interpolate {{ prop }} with attribute values
3205
- const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
3206
- return this.getAttribute(prop) || '';
3207
- });
3208
-
3209
- ${Q?"this.shadowRoot.innerHTML = rendered;":"this.innerHTML = rendered;"}
3210
- }
3211
-
3212
- connectedCallback() {
3213
- this._render();
3214
- }
3215
- }
3216
-
3217
- customElements.define('${Z}', ${G});
3218
- `}async function o3($,Z,X,J){if(Z.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",X0.INVALID_DIRECTIVE_SYNTAX);let Y=Z[0].replace(/['"]/g,""),G=(X.__stx_options||{}).componentsDir||"components",z=g0.isAbsolute(G)?[g0.join(G,`${Y}.stx`),g0.join(g0.dirname(J),`${Y}.stx`)]:[g0.join(g0.dirname(J),G,`${Y}.stx`),g0.join(process.cwd(),G,`${Y}.stx`),g0.join(g0.dirname(J),`${Y}.stx`)],q=null;for(let W of z)if(await a(W)){q=await Bun.file(W).text();break}if(!q)return J0("WebComponent",`Component file not found: ${Y}.stx`,X0.FILE_NOT_FOUND);let K=WX(q,Y);return`<script type="module">
3219
- ${HX(K)}
3220
- </script>`}var J4={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:e3,cachePath:".stx/cache",cacheVersion:"1.0.0",componentRenderCacheBytes:33554432,build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:D3,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:o3,hasEndTag:!1,description:"Include a web component in the template"},a3,t3,$5,Z5,f9,g9,h9,x9,O3,z3,P3,e9,...X4],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};function BX($,Z,X){let J=Z||"pages";if($)return{root:$,pagesDir:J};let Y=X||process.cwd(),Q=T0.join(Y,"resources","views"),G=T0.join(Y,"resources","layouts");if(p2.existsSync(Q)&&p2.existsSync(G))return{root:"resources",pagesDir:"views"};let z=T0.join(Y,"resources","views","pages");if(p2.existsSync(z))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}var s3=new Set,i2=["partialsDir","componentsDir","layoutsDir"],Y5=new WeakMap;function _X($,Z){let X=Z.replace(/[\\/]+$/,"");if(!X||X===".")return!0;let J=$.replace(/\\/g,"/"),Y=X.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function VX($,Z){let X=!$.root,J=BX($.root,$.pagesDir,Z);if($.root=J.root,$.pagesDir=J.pagesDir,X&&J.root!=="."){let Y=`${Z}::${J.root}`;if(!s3.has(Y))s3.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(!Y5.has($)){let Y={};for(let Q of i2){let G=$[Q];if(typeof G==="string"&&G)Y[Q]=G}Y5.set($,Y)}if($.root&&$.root!=="."){let Y=$.root;for(let Q of i2){let G=$[Q];if(typeof G!=="string"||!G)continue;if(T0.isAbsolute(G)||_X(G,Y))continue;$[Q]=T0.join(Y,G)}}for(let Y of i2){let Q=$[Y];if(typeof Q!=="string"||!Q||T0.isAbsolute(Q))continue;$[Y]=T0.resolve(Z,Q)}return $}function LX($,Z){let X=Y5.get($);for(let J of i2){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let Q=T0.isAbsolute(Y)?Y:T0.join(Z,Y);if(p2.existsSync(Q))continue;let G=X?.[J]??Y,z=$.root,q=!!z&&z!==".";console.warn(`[stx] ${String(J)} resolves to "${Q}", which does not exist. Configured as "${G}"`+(q?`, resolved under root "${z}".`:"."))}}function OX($){if($.customDirectives)$.customDirectives=[...$.customDirectives];if($.middleware)$.middleware=[...$.middleware];if($.apiRoutes)$.apiRoutes={...$.apiRoutes}}function FX($){if($4($.stateDir),$.stateDir=Z4(),$.cachePath=K2($.cachePath),$.build)$.build.cacheDir=K2($.build.cacheDir);if($.media?.cache)$.media.cache.directory=K2($.media.cache.directory);if($.story)$.story.outDir=K2($.story.outDir)}var P1=null,r3=new Map,n2=null;async function Q5($){if(!$){if(P1)return P1;if(n2)return n2}let Z=$?T0.resolve($):process.cwd(),X=r3.get(Z);if(X)return X;let J=(async()=>{let Q=(await jX({name:"stx",alias:"ui",cwd:Z,defaultConfig:J4,verbose:!1})).config;if(OX(Q),FX(Q),VX(Q,Z),LX(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await import("./chunk-kdrpx9ft.js"),z=[],q=[];for(let K of Q.plugins){let U=typeof K==="string"?K:K[0],W=typeof K==="string"?{}:K[1]||{};try{let H,j;try{H=await import(U),j=T0.dirname(u.resolve(U))}catch{let _=T0.resolve(process.cwd(),U);H=await import(_),j=T0.dirname(_)}let B=H.default||H;if(!G.has(B.name))await G.register(B,Q);if(B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)z.push(T0.resolve(j,O))}if(B.pages){let _=T0.resolve(j,B.pages),O=W.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,V)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=V},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:j,config:Q};await B.setup(W,_)}console.log(`[stx] Plugin loaded: ${B.name||U}`)}catch(H){console.warn(`[stx] Failed to load plugin ${U}:`,H.message)}}Q._pluginComponentDirs=z,Q._pluginPageDirs=q}return Q})();if(r3.set(Z,J),!$)n2=J,J.then((Y)=>{P1=Y}).catch(()=>{});return J}var Y4=new Proxy(J4,{get($,Z){if(P1&&Z in P1)return P1[Z];if(!n2)Q5().catch((X)=>{console.warn("[stx] Failed to load config file:",X?.message||X)});return $[Z]}});function zK($){return $}function qK($){let Z=[],X=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)X.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)X.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,Q)=>{if(!Y.pattern||typeof Y.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!J.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)X.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)X.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:X}}var z5=new Map;async function DX($,Z={}){try{if(!await a($))throw Error(`Markdown file not found: ${$}`);let J=(await wX.promises.stat($)).mtime.getTime();if(Z.cache&&z5.has($)){let W=z5.get($);if(W.updatedAt>=J)return{content:W.content,data:W.data}}let Y=await Bun.file($).text(),{data:Q,content:G}=w3(Y),z=Z.markdown||Y4.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=G2(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)K=await NX(K,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:K,data:Q||{}};if(Z.cache)z5.set($,{...U,updatedAt:J});return U}catch(X){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,X);let J=X instanceof Error?X.message:String(X);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}var o2=null;async function NX($,Z,X){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!o2)try{o2=await RX({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Y=async(z,q,K,U)=>{let W=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),H=K||(X?"text":"");if(!H)return z;try{if(!o2.getSupportedLanguages().includes(H))return z;return(await o2.highlight(W,H,{theme:Z})).html}catch(j){console.error(`Error highlighting code block with language ${K}:`,j)}return z},Q=$,G=$.matchAll(J);for(let z of G){let[q,K,U,W]=z,H=await Y(q,K,U,W);Q=Q.replace(q,H)}return Q}async function Q4($,Z,X="",J={}){return await AX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,q,K)=>{try{let U=z;if(!G5.isAbsolute(z))U=G5.resolve(G5.dirname(X),z);let W={};if(q)try{try{W=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let w=F.indexOf(":");if(w>0){let R=F.substring(0,w).trim(),D=F.substring(w+1).trim(),A=D.startsWith('"')&&D.endsWith('"'),k=D.startsWith("'")&&D.endsWith("'");if(A||k)D=D.substring(1,D.length-1);W[R]=D}}}}catch(V){if(J.debug)console.error("Error parsing context in @markdown-file directive:",V)}let{content:H,data:j}=await DX(U,J),B={...Z,...j,...W},_=H,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(V,L)=>{let F=L.trim();return B[F]!==void 0?String(B[F]):V}),_}catch(U){let W=U instanceof Error?U.message:String(U);return j0("Markdown File",`Error including markdown file: ${W}`,X,$,K,G)}})}async function AX($,Z,X){let J=[],Y;while((Y=Z.exec($))!==null){let z=Y[0],q=Y.index,K=Y;J.push(X(...K).then((U)=>({match:z,replacement:U,index:q})))}let Q=await Promise.all(J);Q.sort((z,q)=>q.index-z.index);let G=$;for(let{match:z,replacement:q}of Q)G=G.replace(z,()=>q);return G}function z1($,Z){try{let X=$.trim();if(z0(X))return U0(X,Object.keys(Z))(...Object.values(Z));else return e(X,Z)}catch{return!1}}class s2{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,X=this.column,J=this.source[this.pos];if(/\s/.test(J))return this.readWhitespace($,Z,X);if(J==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,X);if(J==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,X);if(J==='"'||J==="'")return this.readString(J,$,Z,X);if(J==="`")return this.readTemplateString($,Z,X);if(/\d/.test(J)||J==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,X);if(/[a-z_$]/i.test(J))return this.readIdentifier($,Z,X);if(J==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:X}}if(J==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:X};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:X}}if(J==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:X};if(J==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,X);let Y=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of Y)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:X};if(/[+\-*/%<>=!&|^~?:]/.test(J))return this.advance(),{type:"OPERATOR",value:J,start:$,end:this.pos,line:Z,column:X};if(/[()[\]{},;.]/.test(J))return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X};return this.advance(),{type:"PUNCTUATION",value:J,start:$,end:this.pos,line:Z,column:X}}readWhitespace($,Z,X){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readLineComment($,Z,X){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
3221
- `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readBlockComment($,Z,X){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readString($,Z,X,J){this.advance();while(this.pos<this.source.length){let Y=this.source[this.pos];if(Y==="\\"){this.advance(2);continue}if(Y===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:X,column:J}}readTemplateString($,Z,X){this.advance();let J=0,Y=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(J>=Y){this.pos=this.source.length;break}this.advance(2),J++;continue}if(Q==="{"&&J>0){J++,this.advance();continue}if(Q==="}"&&J>0){J--,this.advance();continue}if(Q==="`"&&J===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readNumber($,Z,X){if(this.source[this.pos]==="0"){let J=this.peek(1)?.toLowerCase();if(J==="x"||J==="o"||J==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readIdentifier($,Z,X){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}readDirective($,Z,X){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:X}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
3222
- `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function B0($,Z,X,J=0){let Y=0,Q=J,G=null,z=0,q=!1;while(Q<$.length){let K=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&K==="\\"){q=!0,Q++;continue}if(q=!1,(K==='"'||K==="'"||K==="`")&&!G){G=K,Q++;continue}if(K===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&K==="$"&&$[Q+1]==="{"){z++,Q+=2;continue}if(z>0&&K==="}"){z--,Q++;continue}if(K==="`"&&G==="`"&&z===0){G=null,Q++;continue}if(G){Q++;continue}if(K===Z)Y++;else if(K===X){if(Y--,Y===0)return Q}Q++}return-1}function G4($,Z){let X=Z,J={paren:0,bracket:0,brace:0},Y=null,Q=0;while(X<$.length){let G=$[X];if((X>0?$[X-1]:"")==="\\"&&Y){X++;continue}if((G==='"'||G==="'")&&!Y){Y=G,X++;continue}if(G===Y&&Y!=="`"){Y=null,X++;continue}if(G==="`"&&!Y){Y="`",X++;continue}if(G==="`"&&Y==="`"&&Q===0){Y=null,X++;continue}if(Y==="`"&&G==="$"&&$[X+1]==="{"){Q++,X+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;X++;continue}if(Y){X++;continue}if(J.paren===0&&J.bracket===0&&J.brace===0){if($.slice(X,X+2)==="}}"||$.slice(X,X+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")J.paren++;else if(G===")"){if(J.paren--,J.paren<0)break}else if(G==="[")J.bracket++;else if(G==="]"){if(J.bracket--,J.bracket<0)break}else if(G==="{")J.brace++;else if(G==="}"){if(J.brace--,J.brace<0)break}X++}return{expression:$.slice(Z,X),endPos:X}}function q5($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,X+=z;continue}if(z===Y&&Y!=="`"){Y=null,X+=z;continue}if(z==="`"&&!Y){Y="`",X+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,X+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,X+=z+$[G+1],G++;continue}if(Q>0&&z==="{"){Q++,X+=z;continue}if(Q>0&&z==="}"){Q--,X+=z;continue}if(Y){X+=z;continue}if(z==="(")J.paren++;else if(z===")")J.paren--;else if(z==="[")J.bracket++;else if(z==="]")J.bracket--;else if(z==="{")J.brace++;else if(z==="}")J.brace--;if(z==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}if(z==="|"&&$[G-1]==="\\"&&!Y){X=X.slice(0,-1)+z;continue}X+=z}if(X.trim())Z.push(X.trim());return Z}function q1($,Z){let X=MX($,Z);return X.ok?{expression:X.expression,endPos:X.endPos}:null}function MX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return{ok:!1,reason:"missing-open-paren",pos:X};let J=B0($,"(",")",X);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:X};return{ok:!0,expression:$.slice(X+1,J),endPos:J+1}}function kX($,Z){let X=$.lastIndexOf("<",Z);if(X===-1)return!1;return X>$.lastIndexOf(">",Z)}function V1($,Z,X,J){let Y=1,Q=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${X}(?![a-z])`,"g");while(Q<$.length&&Y>0){G.lastIndex=Q,z.lastIndex=Q;let q=G.exec($),K=z.exec($),U=q?q.index:1/0,W=K?K.index:1/0;if(U<W)Y++,Q=U+q[0].length;else if(W<1/0){if(Y--,Y===0)return W;Q=W+K[0].length}else break}return-1}function z4($,Z){let X=$.slice(Z).match(/^@if\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=V1($,"if","endif",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,U="if",W=Y.expression,H=0,j=0;while(K<z.length){let B=z.indexOf("@",K);if(B===-1)break;K=B;let _=z.substring(B);if(kX(z,B)){K++;continue}if(/^@if\s*\(/.test(_)){j++,K++;continue}if(/^@endif(?![a-z])/.test(_)){j--,K+=6;continue}if(j===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:U,condition:W,content:z.substring(H,K),start:Q+H,end:Q+K});let V=K+O[0].length,L=q1(z,V);if(!L){K++;continue}U="elseif",W=L.expression,K=L.endPos,H=K;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:U,condition:W,content:z.substring(H,K),start:Q+H,end:Q+K}),U="else",W=void 0,K+=5,H=K;continue}}K++}return q.push({type:U,condition:W,content:z.slice(H),start:Q+H,end:Q+z.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U2($){let Z=[],X=/@if\s*\(/g,J=X.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=X.exec($);continue}let Q=z4($,J.index);if(Q)Z.push(Q),X.lastIndex=Q.end;J=X.exec($)}return Z}function r2($,Z,X){let J=[],Y=new RegExp(`@${Z}\\s*\\(`,"g"),Q=Y.exec($);while(Q!==null){if(J.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=Y.exec($);continue}let z=Q.index,q=z+Q[0].length-1,K=B0($,"(",")",q);if(K===-1){Q=Y.exec($);continue}let U=$.slice(q+1,K),W=K+1,H=V1($,Z,X,W);if(H===-1){Q=Y.exec($);continue}let j=$.slice(W,H),B=H+`@${X}`.length;J.push({fullMatch:$.slice(z,B),name:Z,params:U,content:j,start:z,end:B}),Y.lastIndex=B,Q=Y.exec($)}return J}function K5($,Z){let X=$.slice(Z).match(/^@switch\s*/);if(!X)return null;let J=Z+X[0].length,Y=q1($,J);if(!Y)return null;let Q=Y.endPos,G=V1($,"switch","endswitch",Q);if(G===-1)return null;let z=$.slice(Q,G),q=[],K=0,U=null,W=0;while(K<z.length){let H=z.slice(K),j=H.match(/^@switch\s*\(/),B=H.match(/^@endswitch(?![a-z])/);if(j){if(W++,U)U.content+=j[0];K+=j[0].length;continue}if(B){if(W--,U)U.content+=B[0];K+=B[0].length;continue}if(W>0){if(U)U.content+=z[K];K++;continue}let _=H.match(/^@case\s*/),O=H.match(/^@default(?![a-z])/),V=H.match(/^@break(?![a-z])/);if(_&&H.startsWith("@case")){if(U)q.push(U);let L=K+_[0].length,F=q1(z,L);if(!F){K++;continue}U={type:"case",value:F.expression,content:""},K=F.endPos}else if(O&&H.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},K+=O[0].length}else if(V&&H.startsWith("@break"))K+=V[0].length;else{if(U)U.content+=z[K];K++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Y.expression,cases:q,start:Z,end:G+10}}function IX($){let Z=[],X=0;while(X<$.length){let J=$.indexOf("{{",X),Y=$.indexOf("{!!",X),Q=!1,G;if(J===-1&&Y===-1)break;else if(J===-1)G=Y,Q=!0;else if(Y===-1)G=J,Q=!1;else if(Y<J)G=Y,Q=!0;else G=J,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let z=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",q=Q?z==="{{{"?"}}}":"!!}":"}}",K=G+z.length,U=TX($,K,q);if(U===-1){X=G+1;continue}let W=$.slice(K,U).trim(),H=U+q.length;Z.push({fullMatch:$.slice(G,H),expression:W,start:G,end:H,isRaw:Q}),X=H}return Z}function TX($,Z,X){let J=Z,Y=null,Q={paren:0,bracket:0,brace:0},G=0;while(J<$.length){let z=$[J];if((J>0?$[J-1]:"")==="\\"&&Y){J++;continue}if((z==='"'||z==="'")&&!Y){Y=z,J++;continue}if(z===Y&&Y!=="`"){Y=null,J++;continue}if(z==="`"&&!Y){Y="`",J++;continue}if(z==="`"&&Y==="`"&&G===0){Y=null,J++;continue}if(Y==="`"&&z==="$"&&$[J+1]==="{"){G++,J+=2;continue}if(G>0){if(z==="{")G++;else if(z==="}")G--;J++;continue}if(Y){J++;continue}if(z==="(")Q.paren++;else if(z===")")Q.paren--;else if(z==="[")Q.bracket++;else if(z==="]")Q.bracket--;else if(z==="{")Q.brace++;else if(z==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(J,J+X.length)===X)return J}J++}return-1}function EX($){let Z=q5($);if(Z.length===0)return{baseExpression:"",filters:[]};let X=Z[0],J=[];for(let Y=1;Y<Z.length;Y++){let Q=bX(Z[Y]);if(Q)J.push(Q)}return{baseExpression:X,filters:J}}function bX($){let Z=$.trim();if(!Z)return null;let X=Z.indexOf("(");if(X===-1)return{name:Z,args:[]};let J=Z.slice(0,X).trim(),Y=X+1,Q=B0(Z,"(",")",X);if(Q===-1)return{name:J,args:[]};let G=Z.slice(Y,Q),z=U4(G);return{name:J,args:z}}function U4($){let Z=[],X="",J={paren:0,bracket:0,brace:0},Y=null,Q=0;for(let G=0;G<$.length;G++){let z=$[G];if((G>0?$[G-1]:"")==="\\"&&Y){X+=z;continue}if((z==='"'||z==="'")&&!Y){Y=z,X+=z;continue}if(z===Y&&Y!=="`"){Y=null,X+=z;continue}if(z==="`"&&!Y){Y="`",X+=z;continue}if(z==="`"&&Y==="`"&&Q===0){Y=null,X+=z;continue}if(Y==="`"&&z==="$"&&$[G+1]==="{"){Q++,X+="${",G++;continue}if(Q>0&&z==="{"){Q++,X+=z;continue}if(Q>0&&z==="}"){Q--,X+=z;continue}if(Y){X+=z;continue}if(z==="(")J.paren++;else if(z===")")J.paren--;else if(z==="[")J.bracket++;else if(z==="]")J.bracket--;else if(z==="{")J.brace++;else if(z==="}")J.brace--;if(z===","&&J.paren===0&&J.bracket===0&&J.brace===0){Z.push(X.trim()),X="";continue}X+=z}if(X.trim())Z.push(X.trim());return Z}function yX($,Z){let X=Z;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;let J=B0($,"(",")",X);if(J===-1)return null;return{params:$.slice(X+1,J),endPos:J+1}}function CX($){let Z=[],J=new s2($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),Y=0;while(Y<J.length){let Q=J[Y],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,Y++,Y>=J.length)break}let z=J[Y];if(z.type==="IDENTIFIER"&&(z.value==="const"||z.value==="let"||z.value==="var")){let q=z.value;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;if(Y++,Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let W=Y<J.length?J[Y].start:$.length,H=q4(J,Y,$);Y=H.nextIndex,Z.push({type:"variable",name:U,value:$.slice(W,H.endPos),exported:G,start:z.start,end:H.endPos})}}else if(K.type==="PUNCTUATION"&&(K.value==="{"||K.value==="[")){let U=K.start,W=K.value==="{"?"}":"]",H=B0($,K.value,W,U);if(H!==-1){let j=$.slice(U,H+1);if(Y=K4(J,H+1),Y<J.length&&J[Y].type==="OPERATOR"&&J[Y].value==="="){Y++;let B=Y<J.length?J[Y].start:$.length,_=q4(J,Y,$);Y=_.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(B,_.endPos)}; ${q} ${j} = ${O}`,exported:G,start:z.start,end:_.endPos})}}}}else if(z.type==="IDENTIFIER"&&z.value==="function"){let q=G?J[Y-1].start:z.start;if(Y++,Y>=J.length)break;let K=J[Y];if(K.type==="IDENTIFIER"){let U=K.value;Y++;let W=-1;while(Y<J.length){if(J[Y].type==="PUNCTUATION"&&J[Y].value==="{"){W=J[Y].start;break}Y++}if(W!==-1){let H=B0($,"{","}",W);if(H!==-1)Z.push({type:"function",name:U,value:$.slice(q,H+1).replace(/^export\s+/,""),exported:G,start:q,end:H+1}),Y=K4(J,H+1)}}}else Y++}return Z}function q4($,Z,X){let J=Z,Y={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:X.length;while(J<$.length){let G=$[J];if(G.type==="PUNCTUATION"){if(G.value==="(")Y.paren++;else if(G.value===")")Y.paren--;else if(G.value==="[")Y.bracket++;else if(G.value==="]")Y.bracket--;else if(G.value==="{")Y.brace++;else if(G.value==="}")Y.brace--;if(G.value===";"&&Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=G.start,J++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(Y.paren===0&&Y.bracket===0&&Y.brace===0){Q=$[J-1]?.end??G.start;break}}Q=G.end,J++}return{nextIndex:J,endPos:Q}}function K4($,Z){for(let X=0;X<$.length;X++)if($[X].start>=Z)return X;return $.length}function SX($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=K5(J,G);if(!z)break;try{let q;if(z0(z.expression))q=U0(z.expression,Object.keys(Z))(...Object.values(Z));else q=e(z.expression,Z);let K="",U=!1;for(let W of z.cases)if(W.type==="default"){if(!U)K=W.content.trim()}else try{let H;if(W.value&&z0(W.value))H=U0(W.value,Object.keys(Z))(...Object.values(Z));else if(W.value)H=e(W.value,Z);if(q===H){K=W.content.trim(),U=!0;break}}catch{continue}J=J.substring(0,G)+K+J.substring(z.end),Y=!0}catch(q){let K=q instanceof Error?q.message:String(q),U=J0("Switch",`Error evaluating @switch expression: ${K}`,X0.EVALUATION_ERROR);J=J.substring(0,G)+U+J.substring(z.end);break}}return J}function PX($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return Z.push(J),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function vX($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(X,J)=>Z[Number(J)]??X)}function $1($,Z,X){let{masked:J,scripts:Y}=PX($);return vX(fX(J,Z,X),Y)}function fX($,Z,X){let J=$;J=SX(J,Z,X);{let Q=!0;while(Q){Q=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=q1(J,z+7);if(!q)break;let K=q.endPos,U=V1(J,"unless","endunless",K);if(U===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let W=J.slice(K,U),H=q.expression,j=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,V=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],w;while((w=O.exec(W))!==null)F.push({pos:w.index,type:"open"});while((w=V.exec(W))!==null)F.push({pos:w.index,type:"close"});while((w=L.exec(W))!==null)F.push({pos:w.index,type:"else"});F.sort((R,D)=>R.pos-D.pos);for(let R of F)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){j=R.pos;break}}let B;if(j!==-1){let _=W.slice(0,j),O=W.slice(j+5);B=`@if (${H})${O}@else ${_}@endif`}else B=`@if (!(${H}))${W}@endif`;J=J.substring(0,z)+B+J.substring(U+10),Q=!0}}J=W5(J,Z,X),J=H5(J,Z,X),J=U5(J,Z);let Y=()=>{let Q=U2(J);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let z=Q[G];try{let q="",K=!1;for(let U of z.branches){if(K)break;if(U.type==="else")q=U.content,K=!0;else try{let W;if(U.condition&&z0(U.condition))W=U0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)W=e(U.condition,Z);if(W)q=U.content,K=!0}catch(W){q=J0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${W instanceof Error?W.message:String(W)}`,X0.EVALUATION_ERROR),K=!0}}J=J.substring(0,z.start)+q+J.substring(z.end)}catch(q){let K=q instanceof Error?q.message:String(q),U=J0("If",`Error processing @if block: ${K}`,X0.EVALUATION_ERROR);J=J.substring(0,z.start)+U+J.substring(z.end)}}return!0};while(!0){let Q=J;if(!Y())break;if(J===Q)break}return J}function W4($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let X=$[Z];if(X!=="'"&&X!=='"')return null;Z++;let J=[];while(Z<$.length){let Y=$[Z];if(Y==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Y===X){Z++;break}J.push(Y),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function U5($,Z){let X=$;function J(z,q,K,U){let W=1,H=U,j=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${K}(?![a-z])`,"g");while(H<z.length&&W>0){j.lastIndex=H,B.lastIndex=H;let _=j.exec(z),O=B.exec(z),V=_?_.index:1/0,L=O?O.index:1/0;if(V<L)W++,H=V+_[0].length;else if(L<1/0){if(W--,W===0)return L;H=L+O[0].length}else break}return-1}function Y(z,q,K){let U=0,W=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),H=new RegExp(`@${K}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],_;while((_=W.exec(z))!==null)B.push({pos:_.index,type:"open"});while((_=H.exec(z))!==null)B.push({pos:_.index,type:"close"});while((_=j.exec(z))!==null)B.push({pos:_.index,type:"else"});B.sort((O,V)=>O.pos-V.pos);for(let O of B)if(O.type==="open")U++;else if(O.type==="close")U--;else if(O.type==="else"&&U===0)return O.pos;return-1}{let z=!0;while(z){z=!1;let q=X.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,U,W,H=X.slice(K+5),j=W4(H);if(j)U=j.value,W=K+5+j.consumed;else W=K+5;let B=J(X,"auth","endauth",W);if(B===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let _=X.slice(W,B),O=Y(_,"auth","endauth"),V;if(!Z.auth)V=!1;else V=U?z1(`auth?.check && auth?.user?.[${U}]`,Z):z1("auth?.check",Z);let L;if(O!==-1){let F=_.slice(0,O),w=_.slice(O+5);L=V?F:w}else L=V?_:"";X=X.substring(0,K)+L+X.substring(B+8),z=!0}}{let z=!0;while(z){z=!1;let q=X.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let K=q.index,U,W,H=X.slice(K+6),j=W4(H);if(j)U=j.value,W=K+6+j.consumed;else W=K+6;let B=J(X,"guest","endguest",W);if(B===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let _=X.slice(W,B),O=Y(_,"guest","endguest"),V;if(!Z.auth)V=!0;else V=U?z1(`!auth?.check || !auth?.user?.[${U}]`,Z):z1("!auth?.check",Z);let L;if(O!==-1){let F=_.slice(0,O),w=_.slice(O+5);L=V?F:w}else L=V?_:"";X=X.substring(0,K)+L+X.substring(B+9),z=!0}}function Q(z,q,K){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[z];if(q)U.push(q);if(K){let W=z1(K,Z);U.push(W)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(z){let q=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let z of["can","cannot"]){let q=`end${z}`,K=z==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let W=X.match(new RegExp(`@${z}\\s*\\(`));if(!W||W.index===void 0)break;let H=W.index,j=X.slice(H+`@${z}`.length),B=G(j);if(!B)break;let _=H+`@${z}`.length+B.paramsEnd,O=J(X,z,q,_);if(O===-1){console.warn(`[stx] @${z} directive at position ${H} has no matching @${q} \u2014 the block was skipped.`);break}let V=X.slice(_,O),L=[],F=0,w=new RegExp(`@${z}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),D=new RegExp(`@${K}\\s*\\(`,"g"),A=/@else(?![a-z])/g,k=[],N;while((N=w.exec(V))!==null)k.push({pos:N.index,type:"open"});while((N=R.exec(V))!==null)k.push({pos:N.index,type:"close"});while((N=D.exec(V))!==null)k.push({pos:N.index,type:"elseDirective"});while((N=A.exec(V))!==null)k.push({pos:N.index,type:"else"});k.sort((b,C)=>b.pos-C.pos);for(let b of k){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let M=[],T=0;for(let b=0;b<L.length;b++){let C=L[b];if(M.push({content:V.slice(T,C.pos),ability:void 0}),C.type==="elseDirective"){let v=V.slice(C.pos+`@${K}`.length),P=G(v);if(P){M[M.length-1]={content:V.slice(T,C.pos)},T=C.pos+`@${K}`.length+P.paramsEnd,M.push({content:"",ability:P.ability,type:P.type,id:P.id}),M.pop();let g=L[b+1],x=g?g.pos:V.length;M.push({content:V.slice(T,x),ability:P.ability,type:P.type,id:P.id}),T=x}}else T=C.pos+5}if(T<V.length){let b=M[M.length-1];if(L.length>0&&L[L.length-1].type==="else")M.push({content:V.slice(T),isFinalElse:!0});else if(M.length===0)M.push({content:V.slice(T)})}let I=Q(B.ability,B.type,B.id),y=z==="can"?I:!I,E="";if(y)E=M[0]?.content||"";else{let b=!1;for(let C=1;C<M.length;C++){let v=M[C];if(v.isFinalElse){E=v.content,b=!0;break}if(v.ability){let P=Q(v.ability,v.type,v.id);if(z==="can"?P:!P){E=v.content,b=!0;break}}}if(!b&&M.length>0){let C=M[M.length-1];if(C.isFinalElse)E=C.content}}X=X.substring(0,H)+E+X.substring(O+`@${q}`.length),U=!0}}return X}function W5($,Z,X){let J=$;function Y(Q,G,z,q,K){let U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\s*\\(`),H=Q.match(W);if(!H||H.index===void 0)break;let j=H.index,B=q1(Q,j+`@${G}`.length);if(!B)break;let _=B.endPos,O=V1(Q,G,z,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${j} has no matching @${z} \u2014 the block was skipped.`);break}let V=Q.slice(_,O),L=B.expression,F=-1,w=0,R=0;while(R<V.length){let D=V.indexOf("@",R);if(D===-1)break;let A=V.substring(D);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=D+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=D+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){F=D;break}R=D+1}try{let D=q(L.trim()),A;if(F!==-1){let k=V.slice(0,F),N=V.slice(F+5);A=D?k:N}else A=D?V:"";Q=Q.substring(0,j)+A+Q.substring(O+`@${z}`.length),U=!0}catch(D){let A=D instanceof Error?D.message:String(D),k=J0(K,`Error processing @${G} directive: ${A}`,X0.EVALUATION_ERROR);Q=Q.substring(0,j)+k+Q.substring(O+`@${z}`.length);break}}return Q}return J=Y(J,"isset","endisset",(Q)=>{let G=z1(Q,Z);return G!==void 0&&G!==null},"Isset"),J=Y(J,"empty","endempty",(Q)=>{let G=z1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function H5($,Z,X){let J=$,Y="development";function Q(G,z,q,K){let U=new RegExp(`@${z}(?![a-z])`,"g"),W=new RegExp(`@${q}(?![a-z])`,"g"),H=new RegExp(`^@${z}(?![a-z])`),j=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,U.lastIndex=0;let O=U.exec(B);if(!O)break;let V=O.index,L=V+O[0].length;if(z==="env"){let I=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,K=Y===I[2]}let F=1,w=L,R=-1;while(F>0&&w<B.length){U.lastIndex=w,W.lastIndex=w;let I=U.exec(B),y=W.exec(B),E=I?I.index:1/0,b=y?y.index:1/0;if(E<b)F++,w=E+I[0].length;else if(b<1/0){if(F--,F===0){R=b;break}w=b+y[0].length}else break}if(R===-1){console.warn(`[stx] @${z} directive at position ${V} has no matching @${q} \u2014 the block was skipped.`);break}let D=B.substring(L,R),A=-1,k=0,N=0;while(N<D.length){let I=D.indexOf("@",N);if(I===-1)break;let y=D.substring(I);if(H.test(y)){k++,N=I+1;continue}if(j.test(y)){k--,N=I+1;continue}if(k===0&&/^@else(?![a-z])/.test(y)){A=I;break}N=I+1}let M;if(A!==-1){let I=D.slice(0,A),y=D.slice(A+5);M=K?I:y}else M=K?D:"";let T=`@${q}`.length;B=B.substring(0,V)+M+B.substring(R+T),_=!0}return B}return J=Q(J,"env","endenv",!1),J=Q(J,"production","endproduction",Y==="production"),J=Q(J,"development","enddevelopment",Y==="development"),J=Q(J,"staging","endstaging",Y==="staging"),J=Q(J,"testing","endtesting",Y==="testing"),J}var j5=new WeakMap;function H4($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function L1($,Z){if(!$)return Z?.nonceGenerator?.()??H4();let X=j5.get($);if(!X)X=Z?.nonceGenerator?.()??H4(),j5.set($,X);return X}function vK($){j5.delete($)}function j4($,Z){let X=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)X.push(J);continue}if(Array.isArray(Y)){let Q=[...Y];if(Z&&(J==="script-src"||J==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)X.push(`${J} ${Q.join(" ")}`)}}return X.join("; ")}function _5($,Z){return`<meta http-equiv="Content-Security-Policy" content="${j4($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}var xX={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},B5={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},gX={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},hX={"default-src":["'none'"],"frame-ancestors":["'none'"]};function fK($){return{enabled:!0,directives:{strict:xX,moderate:B5,relaxed:gX,api:hX}[$]||B5,useNonce:$==="strict",addMetaTag:!0}}function xK($,Z){let X={...$};for(let[J,Y]of Object.entries(Z)){let Q=J,G=X[Q];if(Y===void 0||Y===null)continue;if(typeof Y==="boolean")X[Q]=G||Y;else if(Array.isArray(Y)){let z=Array.isArray(G)?G:[],q=[...new Set([...z,...Y])];X[Q]=q}}return X}function B4($,Z,X){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?L1(X,Z):void 0,Y=_5(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
3223
- ${Y}`)}function _4($,Z){let X=$;return X=X.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${Z}"${Y}>`}),X=X.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${Z}"${Y}>`}),X}function V4($,Z,X,J){let Y=$,Q=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?L1(Z,Q):void 0;return _5(Q.directives,G)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return L1(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=L1(Z,Q);return Y}var uX={name:"csp",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?L1(X,Q):void 0;return _5(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},dX={name:"cspNonce",handler:($,Z,X,J)=>{let Q=X.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return L1(X,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};function gK(){return[uX,dX]}function hK($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[X,J]of Object.entries($))if(Array.isArray(J)&&J.includes("http:"))Z.push(`CSP: Using http: in ${X} allows insecure resources`);return Z}function mX($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function uK($,Z){if(!$.enabled)return{};let X=$.useNonce?L1(Z,$):void 0,J=j4($.directives,X);return{[mX($.reportOnly)]:J}}var dK={enabled:!1,reportOnly:!1,directives:B5,useNonce:!1,addMetaTag:!0};import lX from"crypto";var cX=40,L4="_token",V5=null;function pX($=cX){let Z=lX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return V5=Z,Z}function iX(){if(!V5)pX();return V5}function nX($=L4){let Z=iX();return`<input type="hidden" name="${$}" value="${Z}">`}function O4($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,X,J)=>{return nX(J||L4)})}async function F4($,Z,X,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let Q of J.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)Y=await oX(Y,Q,Z,X,J);else Y=await sX(Y,Q,Z,X,J)}return Y}async function oX($,Z,X,J,Y){let{name:Q,handler:G}=Z,z=`@${Q}`,q=`@end${Q}`,K=$,U=v1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),W=[],H=U.exec(K);while(H!==null){let[j,B="",_=""]=H,O=H.index||0;try{let V=B?w4(B):[],L=_.trim(),F=await G(L,V,X,J);W.push({original:j,processed:F,startIndex:O})}catch(V){let L=V instanceof Error?V.message:String(V);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,V);W.push({original:j,processed:J0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,X0.EVALUATION_ERROR),startIndex:O})}H=U.exec(K)}for(let j=W.length-1;j>=0;j--){let{original:B,processed:_}=W[j];K=K.replace(B,_)}return K}async function sX($,Z,X,J,Y){let{name:Q,handler:G}=Z,z=$,q=v1(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],U=q.exec(z);while(U!==null){let[j,B=""]=U,_=U.index||0;try{let O=w4(B),V=await G("",O,X,J);K.push({original:j,processed:V,startIndex:_})}catch(O){let V=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,O);K.push({original:j,processed:J0("CustomDirective",`Error in @${Q}(${B}): ${V}`,X0.EVALUATION_ERROR),startIndex:_})}U=q.exec(z)}let W=v1(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),H=W.exec(z);while(H!==null){let[j]=H,B=H.index||0;try{let _=await G("",[],X,J);K.push({original:j,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${Q}:`,_);K.push({original:j,processed:J0("CustomDirective",`Error in @${Q}: ${O}`,X0.EVALUATION_ERROR),startIndex:B})}H=W.exec(z)}for(let j=K.length-1;j>=0;j--){let{original:B,processed:_}=K[j];z=z.replace(B,_)}return z}function w4($){if(!$.trim())return[];let Z=[],X="",J=!1,Y="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!J)J=!0,Y=G;else if(G===Y)J=!1;else X+=G;else if(G===","&&!J)Z.push(X.trim()),X="";else X+=G}if(X.trim())Z.push(X.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var R4=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,D4=/^[A-Za-z_$][\w$]*$/,rX=new Set(["light","dark","system"]);function O1($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function aX($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,X=Z.appearance,J=Z.colorMode;if(O1(Z.storageKey,"storageKey"),!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(O1(X.key,"appearance.key"),O1(X.attribute,"appearance.attribute"),O1(X.default,"appearance.default"),O1(J.key,"colorMode.key"),O1(J.attribute,"colorMode.attribute"),O1(J.default,"colorMode.default"),!D4.test(X.key)||!D4.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!R4.test(X.attribute)||!R4.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(X.allowed)||X.allowed.length===0||X.allowed.some((Y)=>typeof Y!=="string"||Y.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!X.allowed.includes(X.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!rX.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:X.key,attribute:X.attribute,allowed:[...new Set(X.allowed)],default:X.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function tX($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function eX($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${tX($)};const root=document.documentElement;const MODES=["light","dark","system"];function read(){let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}return stored}function write(stored){try{localStorage.setItem(config.storageKey,JSON.stringify(stored))}catch{}}function resolve(){const stored=read();return{appearance:config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default,colorMode:MODES.includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default}}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());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,read:read,resolve:resolve,apply:apply,setColorMode:function(mode){return store(config.colorMode.key,MODES,mode)},setAppearance:function(name){return store(config.appearance.key,config.appearance.allowed,name)},watchSystem:function(){try{matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(){if(resolve().colorMode==="system")apply()})}catch{}}};apply()}());</script>`}function $J($,Z){let X=1,J=null,Y=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(Y){Y=!1;continue}if(J){if(G==="\\")Y=!0;else if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="(")X++;else if(G===")"&&--X===0)return Q}return-1}function N4($,Z){let X=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,G=$J(X,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let z=X.slice(Q+1,G).trim(),q=e(`(${z})`,Z),K=eX(aX(q));X=X.slice(0,Y.index)+K+X.slice(G+1),J.lastIndex=Y.index+K.length}return X}import ZJ from"crypto";function _0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var O5={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"};function XJ($){return{...O5,...$.forms?.classes}}function a2($,Z,X,J){let Y=$||Z;return X?`${Y} ${J}`:Y}function h0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f1($,Z){if(/\bid\s*=/i.test($))return"";return` id="${_0(Z)}"`}function L5($,Z,X){if(!Z)return"";let J="";if(!/\baria-invalid\s*=/i.test(X))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(X))J+=` aria-describedby="${_0(`${h0($)}-error`)}"`;return J}function JJ(){return ZJ.randomUUID()}function tK($,Z,X,J){let Y=XJ(J),Q=$;return Q=QJ(Q,Z),Q=j2(Q,Z),Q=F5(Q,Z,Y),Q=w5(Q,Z,Y),Q}function j2($,Z){let X=$;return X=X.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=JJ();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${_0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),X=X.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let Q=Y.toUpperCase();if(Y&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${_0(Q)}">`;return J}),X}function F5($,Z,X=O5){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,Q,G,z,q,K="")=>{let U=Q||G||"POST",W=z||q||"",H=K1(K),j=U.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",_=`<form method="${_0(B)}" action="${_0(W)}"${H?` ${H}`:""}>`;if(_+=`
3224
- ${j2("@csrf",Z)}`,!["GET","POST"].includes(j))_+=`
3225
- ${j2(`@method('${j}')`,Z)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,Q,G,z,q,K="")=>{let U=Q||G||"",W=z||q||"",H=K1(K),j=W2(U,Z),B=j!==void 0&&j!==null?j:W||"",_=H.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",V=H2(U,Z),L=H.match(/class=['"]([^'"]+)['"]/i),F=a2(L?L[1]:"",X.input,V,X.inputError),w=H.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${_0(O)}" name="${_0(U)}"${f1(H,h0(U))} value="${_0(B)}" class="${F}"${L5(U,V,H)}${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,Q,G="",z="")=>{let q=K1(G),K=W2(Q,Z)||z.trim(),U=H2(Q,Z),W=q.match(/class=['"]([^'"]+)['"]/i),H=a2(W?W[1]:"",X.input,U,X.inputError),j=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${_0(Q)}"${f1(q,h0(Q))} class="${H}"${L5(Q,U,q)}${j?` ${j}`:""}>${_0(K)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,Q,G="",z)=>{let q=K1(G),K=W2(Q,Z),U=H2(Q,Z),W=q.match(/class=['"]([^'"]+)['"]/i),H=a2(W?W[1]:"",X.input,U,X.inputError),j=q.replace(/class=['"][^'"]+['"]/i,""),B=z;if(K!==void 0)B=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,V)=>{if((Array.isArray(K)?K.some((F)=>String(F)===V):String(K)===V)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${_0(Q)}"${f1(q,h0(Q))} class="${H}"${L5(Q,U,q)}${j?` ${j}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=G===void 0?"1":G,K=G===void 0?h0(Q):`${h0(Q)}-${h0(q)}`,U=K1(z),W=W2(Q,Z),H=W!==void 0&&(Array.isArray(W)?W.some((O)=>String(O)===q):W===!0||String(W)===q),j=U.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:X.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${_0(Q)}"${f1(U,K)} value="${_0(q)}" class="${B}"${H?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G,z="")=>{let q=K1(z),K=W2(Q,Z),U=K!==void 0&&K===G,W=q.match(/class=['"]([^'"]+)['"]/i),H=W?W[1]:X.checkInput,j=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${_0(Q)}"${f1(q,`${h0(Q)}-${h0(G)}`)} value="${_0(G)}" class="${H}"${U?" checked":""}${j?` ${j}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,Q,G="")=>{let z=K1(G),q=z.match(/accept=['"]([^'"]+)['"]/i),K=q?q[1]:"",U=z.includes("multiple"),W=H2(Q,Z),H=z.match(/class=['"]([^'"]+)['"]/i),j=a2(H?H[1]:"",X.input,W,X.inputError),B=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${_0(Q)}"${f1(z,h0(Q))}`,`class="${j}"`];if(K)_.push(`accept="${_0(K)}"`);if(U)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,Q,G="",z)=>{let q=K1(G),K=q.match(/class=['"]([^'"]+)['"]/i),U=K?K[1]:X.label,W=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${_0(h0(Q))}" class="${U}"${W?` ${W}`:""}>${z}</label>`}),J}function w5($,Z,X=O5){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,Q)=>{try{if(H2(Y,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(z,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return A4(Y,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Y);return A4(Y,Z)}let K=q.trim();if(z0(K)){let U=e(K,Z);return U!==void 0?String(U):K}return K}catch{return q}});return`<div id="${_0(`${h0(Y)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function H2($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function A4($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let X=Z.errors[$];return Array.isArray(X)?X[0]:String(X)}return""}function W2($,Z){let X;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(X=Z[J],X!==void 0)return X}return Z[$]}function K1($){if(!$.trim())return"";let Z=[],X=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(X))!==null){let[,Q,,G]=Y;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var M4={required:($,Z,X)=>{if($===void 0||$===null||$===""||Array.isArray($)&&$.length===0)return`The ${X} field is required.`;return null},email:($,Z,X)=>{if(!$)return null;if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($)))return`The ${X} field must be a valid email address.`;return null},min:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length<J)return`The ${X} field must be at least ${J} characters.`;if(typeof $==="number"&&$<J)return`The ${X} field must be at least ${J}.`;if(Array.isArray($)&&$.length<J)return`The ${X} field must have at least ${J} items.`;return null},max:($,Z,X)=>{if(!$)return null;let J=Number(Z[0]);if(typeof $==="string"&&$.length>J)return`The ${X} field must not exceed ${J} characters.`;if(typeof $==="number"&&$>J)return`The ${X} field must not exceed ${J}.`;if(Array.isArray($)&&$.length>J)return`The ${X} field must not have more than ${J} items.`;return null},confirmed:($,Z,X)=>{if(Z[0]!==void 0&&$!==Z[0])return`The ${X} confirmation does not match.`;return null},numeric:($,Z,X)=>{if(!$)return null;if(Number.isNaN(Number($)))return`The ${X} field must be a number.`;return null},integer:($,Z,X)=>{if(!$)return null;if(!Number.isInteger(Number($)))return`The ${X} field must be an integer.`;return null},alpha:($,Z,X)=>{if(!$)return null;if(!/^[a-z]+$/i.test(String($)))return`The ${X} field must only contain letters.`;return null},alphanumeric:($,Z,X)=>{if(!$)return null;if(!/^[a-z0-9]+$/i.test(String($)))return`The ${X} field must only contain letters and numbers.`;return null},url:($,Z,X)=>{if(!$)return null;try{return new URL(String($))?null:null}catch{return`The ${X} field must be a valid URL.`}},regex:($,Z,X)=>{if(!$)return null;try{if(!new RegExp(Z[0]).test(String($)))return`The ${X} field format is invalid.`;return null}catch{return`The ${X} field has an invalid validation pattern.`}},in:($,Z,X)=>{if(!$)return null;if(!Z.includes(String($)))return`The ${X} field must be one of: ${Z.join(", ")}.`;return null},notIn:($,Z,X)=>{if(!$)return null;if(Z.includes(String($)))return`The ${X} field must not be: ${Z.join(", ")}.`;return null},date:($,Z,X)=>{if(!$)return null;let J=new Date($);if(Number.isNaN(J.getTime()))return`The ${X} field must be a valid date.`;return null},before:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J>=Y)return`The ${X} field must be before ${Z[0]}.`;return null},after:($,Z,X)=>{if(!$)return null;let J=new Date($),Y=new Date(Z[0]);if(J<=Y)return`The ${X} field must be after ${Z[0]}.`;return null}};function eK($,Z){M4[$]=Z}function R5($){let[Z,...X]=$.split(":"),J=X.length>0?X.join(":").split(","):[];return{name:Z.trim(),params:J}}function YJ($,Z,X,J={}){let Y=[],Q=X.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let z=R5(G),q=M4[z.name];if(!q){console.warn(`Unknown validation rule: ${z.name}`);continue}if(z.name==="confirmed"){let U=`${$}_confirmation`;z.params=[J[U]]}let K=q(Z,z.params||[],$);if(K)Y.push(z.message||K)}return{field:$,valid:Y.length===0,errors:Y}}function $U($,Z){let X={};for(let[J,Y]of Object.entries(Z)){let Q=YJ(J,$[J],Y,$);if(!Q.valid)X[J]=Q.errors}return X}function QJ($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(X,J,Y,Q)=>{let G=Y.split("|").map((q)=>q.trim()),z=[];for(let q of G){let K=R5(q);switch(K.name){case"required":z.push("required");break;case"email":z.push('type="email"');break;case"url":z.push('type="url"');break;case"numeric":case"integer":if(z.push('type="number"'),K.name==="integer")z.push('step="1"');break;case"min":if(K.params?.[0])z.push(`minlength="${K.params[0]}"`);break;case"max":if(K.params?.[0])z.push(`maxlength="${K.params[0]}"`);break;case"regex":if(K.params?.[0])z.push(`pattern="${K.params[0]}"`);break}}return`<!-- @validate:${J}:${Y} -->${z.length>0?`<!-- attrs:${z.join(" ")} -->`:""}`})}var k4={required:{name:"required",validate:($)=>{if($===null||$===void 0||$==="")return"This field is required";if(Array.isArray($)&&$.length===0)return"This field is required";return!0},toHtml5:()=>["required"],message:"This field is required"},email:{name:"email",validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||"Please enter a valid email address"},toHtml5:()=>['type="email"'],message:"Please enter a valid email address"},url:{name:"url",validate:($)=>{if(!$)return!0;try{return new URL(String($)).protocol.startsWith("http")||"Please enter a valid URL"}catch{return"Please enter a valid URL"}},toHtml5:()=>['type="url"'],message:"Please enter a valid URL"},numeric:{name:"numeric",validate:($)=>{if(!$)return!0;return!Number.isNaN(Number($))||"Please enter a number"},toHtml5:()=>['type="number"'],message:"Please enter a number"},integer:{name:"integer",validate:($)=>{if(!$)return!0;let Z=Number($);return Number.isInteger(Z)||"Please enter a whole number"},toHtml5:()=>['type="number"','step="1"'],message:"Please enter a whole number"},alpha:{name:"alpha",validate:($)=>{if(!$)return!0;return/^[a-z]+$/i.test(String($))||"Please enter only letters"},toHtml5:()=>['pattern="[a-zA-Z]+"'],message:"Please enter only letters"},alphanumeric:{name:"alphanumeric",validate:($)=>{if(!$)return!0;return/^[a-z0-9]+$/i.test(String($))||"Please enter only letters and numbers"},toHtml5:()=>['pattern="[a-zA-Z0-9]+"'],message:"Please enter only letters and numbers"},min:{name:"min",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length>=X||`Must be at least ${X} characters`;if(typeof $==="number")return $>=X||`Must be at least ${X}`;if(Array.isArray($))return $.length>=X||`Must have at least ${X} items`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`min="${$[0]}"`],message:"Must be at least {{param}} characters"},max:{name:"max",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length<=X||`Must be no more than ${X} characters`;if(typeof $==="number")return $<=X||`Must be no more than ${X}`;if(Array.isArray($))return $.length<=X||`Must have no more than ${X} items`;return!0},toHtml5:($)=>[`maxlength="${$[0]}"`,`max="${$[0]}"`],message:"Must be no more than {{param}} characters"},between:{name:"between",validate:($,Z)=>{if(!$)return!0;let[X,J]=Z.map(Number);if(typeof $==="string")return $.length>=X&&$.length<=J||`Must be between ${X} and ${J} characters`;if(typeof $==="number")return $>=X&&$<=J||`Must be between ${X} and ${J}`;return!0},toHtml5:($)=>[`minlength="${$[0]}"`,`maxlength="${$[1]}"`],message:"Must be between {{min}} and {{max}}"},confirmed:{name:"confirmed",validate:($,Z,X)=>{let J=Object.keys(X);for(let Y of J)if(Y.endsWith("_confirmation")&&X[Y]===$)return!0;return"Confirmation does not match"},message:"Confirmation does not match"},in:{name:"in",validate:($,Z)=>{if(!$)return!0;return Z.includes(String($))||`Must be one of: ${Z.join(", ")}`},message:"Must be one of: {{values}}"},notIn:{name:"notIn",validate:($,Z)=>{if(!$)return!0;return!Z.includes(String($))||`Must not be: ${Z.join(", ")}`},message:"Must not be: {{values}}"},regex:{name:"regex",validate:($,Z)=>{if(!$)return!0;try{return new RegExp(Z[0]).test(String($))||"Invalid format"}catch{return"Invalid format"}},toHtml5:($)=>[`pattern="${$[0]}"`],message:"Invalid format"},date:{name:"date",validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||"Please enter a valid date"},toHtml5:()=>['type="date"'],message:"Please enter a valid date"},before:{name:"before",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X<J||`Must be before ${Z[0]}`},toHtml5:($)=>[`max="${$[0]}"`],message:"Must be before {{date}}"},after:{name:"after",validate:($,Z)=>{if(!$)return!0;let X=new Date(String($)),J=new Date(Z[0]);return X>J||`Must be after ${Z[0]}`},toHtml5:($)=>[`min="${$[0]}"`],message:"Must be after {{date}}"},size:{name:"size",validate:($,Z)=>{if(!$)return!0;let X=Number(Z[0]);if(typeof $==="string")return $.length===X||`Must be exactly ${X} characters`;if(Array.isArray($))return $.length===X||`Must have exactly ${X} items`;return!0},message:"Must be exactly {{size}}"},phone:{name:"phone",validate:($)=>{if(!$)return!0;return/^\+?\(?\d{1,4}\)?[-\s./\d]*$/.test(String($))||"Please enter a valid phone number"},toHtml5:()=>['type="tel"','pattern="\\+?\\(?\\d{1,4}\\)?[-\\s./\\d]*"'],message:"Please enter a valid phone number"}};function ZU($){k4[$.name]=$}function GJ($,Z,X={}){let J=[],Y=Z.split("|").map((Q)=>Q.trim());for(let Q of Y){let G=R5(Q),z=k4[G.name];if(!z){console.warn(`Unknown validation rule: ${G.name}`);continue}let q=z.validate($,G.params||[],X);if(q!==!0)J.push(q)}return{valid:J.length===0,errors:J}}function XU($,Z){let X={},J=!0;for(let[Y,Q]of Object.entries(Z)){let G=GJ($[Y],Q,$);if(!G.valid)J=!1,X[Y]=G.errors}return{valid:J,errors:X}}function JU($,Z){let X=JSON.stringify(Z);return`
3226
- <script>
3227
- (function() {
3228
- const form = document.getElementById('${$}');
3229
- if (!form) return;
3230
-
3231
- const rules = ${X};
3232
- const validators = {
3233
- required: (v) => v !== null && v !== undefined && v !== '' ? true : 'This field is required',
3234
- email: (v) => !v || /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(v) ? true : 'Please enter a valid email',
3235
- url: (v) => { if (!v) return true; try { new URL(v); return true; }
3236
- catch { return 'Please enter a valid URL'; } },
3237
- numeric: (v) => !v || !isNaN(Number(v)) ? true : 'Please enter a number',
3238
- integer: (v) => !v || Number.isInteger(Number(v)) ? true : 'Please enter a whole number',
3239
- min: (v, p) => !v || (typeof v === 'string' ? v.length >= p : v >= p) ? true : 'Too short/small',
3240
- max: (v, p) => !v || (typeof v === 'string' ? v.length <= p : v <= p) ? true : 'Too long/large',
3241
- regex: (v, p) => !v || new RegExp(p).test(v) ? true : 'Invalid format',
3242
- };
3243
-
3244
- form.addEventListener('submit', function(e) {
3245
- let valid = true;
3246
- const errors = {};
3247
-
3248
- for (const [field, fieldRules] of Object.entries(rules)) {
3249
- const input = form.querySelector('[name="' + field + '"]');
3250
- if (!input) continue;
3251
-
3252
- const value = input.value;
3253
- const ruleList = fieldRules.split('|');
3254
-
3255
- for (const rule of ruleList) {
3256
- const [name, param] = rule.split(':');
3257
- const validator = validators[name];
3258
- if (validator) {
3259
- const result = validator(value, param);
3260
- if (result !== true) {
3261
- valid = false;
3262
- errors[field] = errors[field] || [];
3263
- errors[field].push(result);
3264
- input.classList.add('is-invalid');
3265
- break;
3266
- }
3267
- }
3268
- }
3269
- }
3270
-
3271
- if (!valid) {
3272
- e.preventDefault();
3273
- console.log('Validation errors:', errors);
3274
- }
3275
- });
3276
- })();
3277
- </script>`.trim()}var B2=/<\/?template\b[^>]*>/gi,zJ=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i;function qJ($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return zJ.test(Z)}function t2($){B2.lastIndex=0;let Z;while((Z=B2.exec($))!==null){if(Z[0].startsWith("</")||qJ(Z[0]))continue;let X=Z.index,J=B2.lastIndex,Y=1,Q;while((Q=B2.exec($))!==null)if(Q[0].startsWith("</")){if(Y--,Y===0){let G=Q.index;return{start:X,openEnd:J,closeStart:G,end:B2.lastIndex,content:$.slice(J,G)}}}else Y++;return null}return null}import W0 from"path";function D5($,Z){let X=0;for(let J=Z;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y===","&&X===0)return J}return-1}function KJ($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=Y.exec(J);while(Q){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1;while(K<J.length&&q>0){if(J[K]==="(")q++;else if(J[K]===")")q--;K++}if(q!==0)break;let U=J.substring(z+1,K-1),W=`${X}(${U})`;J=J.substring(0,G)+W+J.substring(K),Y.lastIndex=G+W.length,Q=Y.exec(J)}return J}function UJ($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function T4($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,z=(W)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===W){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let W=1;while(Q<G&&W>0)if(Z[Q]==="{")W++,Q++;else if(Z[Q]==="}")W--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},K=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3278
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},U=()=>{if(Y!==0)return;let W=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!J.has(B))X.push(B),J.add(B);return}let H=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!J.has(B))X.push(B),J.add(B);return}let j=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))X.push(B),J.add(B)}};while(Q<G){if(K())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){Y++,Q++;continue}if(Z[Q]==="}"){Y--,Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))U();Q++}return X.join(", ")}function E4($,Z=""){let X=T4($).split(",").map((J)=>J.trim()).filter(Boolean);return`
3279
- (function() {
3280
- ${x1("var",X)}
3281
- var __destroyHooks = [];
3282
- var __origOnDestroy = onDestroy;
3283
- onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
3284
-
3285
- ${$}
3286
- ${Z}})();
3287
- `}function b4($,Z){return`
3288
- // Register scope variables for STX runtime
3289
- if (!window.stx._scopes) window.stx._scopes = {};
3290
- var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3291
- ${T4($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
3292
- `)}
3293
- // #1767: when the bundler renamed a component const that collided with an
3294
- // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
3295
- // renamed declaration so it resolves to the component's value, not the
3296
- // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3297
- try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3298
- window.stx._scopes['${Z}'] = __scopeRegistration;
3299
- `}function WJ($,Z){let X=b4($,Z),J=`
3300
- (function() {
3301
- var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
3302
- var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
3303
- if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
3304
- try {`,Y=`
3305
- } finally {
3306
- if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3307
- }
3308
- })();`;return J+E4($,X)+`
3309
- } finally {
3310
- if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3311
- }
3312
- })();`}function HJ($,Z){if(Y1($)){let Y=Y1($).tag.match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};return{html:b1($,(Q,G)=>`<body${G} data-stx-scope="${Z}">`),mergedIntoExisting:null,stamped:!0}}let X=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(X){let Y=(X[2]+X[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1],stamped:!0};let Q=X[1],G=X[2],z=X[3];return{html:`${Q}${G} data-stx-scope="${Z}"${z}${$.slice(X[0].length)}`,mergedIntoExisting:null,stamped:!0}}return{html:$,mergedIntoExisting:null,stamped:!1}}var I4=0,LU=new g1(500),y4=new Set;function OU(){y4.clear()}function jJ($){if($.__onceStore instanceof Set)return $.__onceStore;return y4}async function N5($,Z,X,J,Y,Q=new Set){let G=J.partialsDir||W0.join(W0.dirname(X),"partials");if(G&&!W0.isAbsolute(G))G=W0.resolve(process.cwd(),G);let z=KJ($,"@partial","@include"),q=jJ(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(_,O,V)=>{let L=O.trim(),F=`${X}:${L}`;if(q.has(F))return"";return q.add(F),O});{let _=/@includeIf\s*\(/g,O;while((O=_.exec(z))!==null){let V=O.index,L=V+O[0].length-1,F=1,w=L+1;while(w<z.length&&F>0){if(z[w]==="(")F++;else if(z[w]===")")F--;w++}if(F!==0)break;let R=z.substring(L+1,w-1),D=R.match(/^\s*['"]([^'"]+)['"]/);if(!D){_.lastIndex=w;continue}let A=D[1],k=K(A,G,X),N="";if(k&&await Bun.file(k).exists())Y.add(k),N=`@include(${R})`;z=z.substring(0,V)+N+z.substring(w),_.lastIndex=0}}for(let[_,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let V=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=V.exec(z))!==null){let F=L.index,w=F+L[0].length-1,R=1,D=w+1;while(D<z.length&&R>0){if(z[D]==="(")R++;else if(z[D]===")")R--;D++}if(R!==0)break;let A=z.substring(w+1,D-1),k=D5(A,0);if(k===-1){V.lastIndex=D;continue}let N=A.substring(0,k).trim(),M=A.substring(k+1).trim(),T=M.match(/^\s*['"]([^'"]+)['"]/);if(!T){V.lastIndex=D;continue}let I=T[1],y=M.substring(T[0].length),E,b=D5(y,0);if(b!==-1)E=y.substring(b+1).trim();try{let C=`Boolean(${N})`,v;if(z0(C)){let x=U0(C,Object.keys(Z));v=Boolean(x(...Object.values(Z)))}else v=Boolean(e(C,Z));let P=O?!v:v,g="";if(P){let x=K(I,G,X);if(x&&await Bun.file(x).exists())Y.add(x);g=`@include('${I}'${E?`, ${E}`:""})`}z=z.substring(0,F)+g+z.substring(D),V.lastIndex=0}catch(C){let v=C instanceof Error?C.message:String(C),P=j0("Include",`Error evaluating ${_} condition: ${v}`,X,$,F);z=z.substring(0,F)+P+z.substring(D),V.lastIndex=0}}}{let _=/@each\s*\(/g,O;while((O=_.exec(z))!==null){let V=O.index,L=V+O[0].length-1,F=1,w=L+1;while(w<z.length&&F>0){if(z[w]==="(")F++;else if(z[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=z.substring(L+1,w),D=z.substring(V,w+1),A=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let[,k,N,M,T]=A;try{let I,y=N.trim();if(z0(y))I=U0(y,Object.keys(Z))(...Object.values(Z));else I=e(y,Z);let E="";if(Array.isArray(I)&&I.length>0)for(let b of I){let C={...Z,[M]:b},v=await H(k,C,$,V);E+=v}else if(T)E=await H(T,{},$,V);z=z.substring(0,V)+E+z.substring(w+1),_.lastIndex=0}catch(I){let y=I instanceof Error?I.message:String(I);z=z.substring(0,V)+j0("Each",`Error in @each: ${y}`,X,$,V)+z.substring(w+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,O;while((O=_.exec(z))!==null){let V=O.index,L=V+O[0].length-1,F=1,w=L+1;while(w<z.length&&F>0){if(z[w]==="(")F++;else if(z[w]===")"){if(F--,F===0)break}w++}if(F!==0)break;let R=z.substring(L+1,w),D=z.substring(V,w+1),A=R.match(/^\s*(\[[^\]]+\])/);if(!A){_.lastIndex=0,z=z.replace(D,"");continue}let k=A[1],N=R.slice(A[0].length),M,T=N.match(/^\s*,\s*\{/);if(T){N=N.slice(T[0].length-1);let E=1,b=1;while(b<N.length&&E>0){if(N[b]==="{")E++;else if(N[b]==="}"){if(E--,E===0)break}b++}M=N.substring(0,b+1),N=N.slice(b+1)}let I,y=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(y)I=y[1];try{let E=JSON.parse(k.replace(/'/g,'"')),b={};if(M)try{b=I0(M,Z)}catch(v){let P=v instanceof Error?v.message:String(v);if(J.debug){let g=j0("Include",`Error parsing includeFirst variables: ${P}`,X,$,V,D);z=z.replace(D,()=>g)}else z=z.replace(D,()=>I||"");continue}let C=!1;for(let v of E){let P=K(v,G,X);if(!P)continue;if(await a(P)){let g=await H(v,b,$,V);z=z.replace(D,()=>g),C=!0;break}}if(!C)if(I!==void 0)z=z.replace(D,()=>I);else if(J.debug){let v=j0("Include",`None of the includeFirst paths exist: ${k}`,X,$,V,D);z=z.replace(D,()=>v)}else z=z.replace(D,"")}catch(E){let b=E instanceof Error?E.message:String(E),C=j0("Include",`Error processing @includeFirst: ${b}`,X,$,V,D);z=z.replace(D,()=>C)}_.lastIndex=0}}function K(_,O,V){try{let L=_;if(!_.endsWith(".stx"))L=`${_}.stx`;let F=W0.resolve(O),w=W0.resolve(W0.dirname(V)),R;if(!L.startsWith("./")&&!L.startsWith("../"))R=W0.resolve(O,L);else R=W0.resolve(w,L);let D=W0.normalize(R),A=D.startsWith(F+W0.sep)||D===F,k=D.startsWith(w+W0.sep)||D===w,N=!1,M=W0.dirname(w);if(D.startsWith(M+W0.sep)){if(!W0.relative(M,D).split(W0.sep).some((E)=>E.startsWith(".")&&E!=="."&&E!==".."))N=!0}if(!A&&!k&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${D}`),console.error(` Allowed dirs: ${F}, ${w}`),null;return D}catch(L){return console.error(`Error resolving path ${_}: ${L}`),null}}let U=W0.resolve(X);Q.add(U);function W(_,O,V,L){return J.onIncludeError?.({includePath:_,templatePath:X,message:O,partialsDir:G}),j0("Include",O,X,V,L)}async function H(_,O={},V,L){let F=K(_,G,X);if(!F)return W(_,`Could not resolve path for include: ${_}`,V,L);let w=W0.resolve(F);if(Q.has(w)){let R=[...Q,w].map((D)=>W0.basename(D)).join(" -> ");return W(_,`Circular include detected: ${R}`,V,L)}try{Y.add(F);let R;if(!R)try{R=await Bun.file(F).text()}catch(P){let g=P instanceof Error?P.message:String(P);return W(_,`Error loading include file ${_}: ${g}`,V,L)}if(R)R=R.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(R&&R.includes("@stream")){let{processStreamDirectives:P}=await import("./chunk-f8b83xbw.js");R=P(R,Z)}if(R&&(J.debug||!e2()&&!$9()))try{let{warnUnbalancedTags:P}=await import("./chunk-vrvehb01.js");P(R,F)}catch{}let D=R;try{let{processESImports:P}=await import("./chunk-f6x9bh8n.js");await P(R,Z,F,J,Y)}catch(P){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,P instanceof Error?P.message:P)}let A=t2(D);if(A)D=A.content.trim();let N=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(N)M=`<style${N[1]}>${N[2]}</style>`;D=D.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),D=D.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=J1(R,F);for(let[P,g]of Object.entries(O))T[P]=g;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...R.matchAll(I)],E="",b=null;for(let P of y){let g=P[1]||"",x=P[2]||"",$0=g.includes("server"),a0=F1(g);if(!$0&&x.trim()){let{interpolateScriptExpressions:Z0}=await import("./chunk-d34fnbpc.js");x=Z0(x,T)}let M0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:H0}=await import("./chunk-n32gnc22.js"),k0=Z0(x,{filePath:F,projectRoot:process.cwd()});x=k0.code,M0=H0(k0.styles)}catch(Z0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,Z0 instanceof Error?Z0.message:Z0)}if(a0&&x.trim())x=w1(x);if(!$0){try{let{injectBrowserCoreAutoImports:H0}=await import("./chunk-n32gnc22.js");x=H0(x).code;let{hasUserImports:k0,bundleClientScript:E0}=await import("./chunk-43r6p08p.js");if(k0(x))x=await E0(x,F,{projectRoot:process.cwd()})}catch(H0){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,H0 instanceof Error?H0.message:H0)}let{stripStxRuntimeImports:Z0}=await import("./chunk-hzw1ekq3.js");x=Z0(x)}let C0=UJ(x);if(C0&&!$0){b=`stx_scope_${W0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++I4}`;let Z0=t0(x),H0=WJ(Z0,b);E+=`${M0}<script data-stx-scoped data-stx-run="always">${H0}</script>
3313
- `;continue}if($0)try{let{extractVariables:Z0}=await import("./chunk-y1segp76.js");await Z0(x,T,F)}catch(Z0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,Z0)}if(!$0&&!C0){let Z0=g.replace(/\bclient\b/i,"").trim();b=`stx_scope_${W0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++I4}`;let H0=t0(x),k0=b4(H0,b),E0=E4(H0,k0);E+=`${M0}<script data-stx-scoped data-stx-run="always"${Z0?` ${Z0}`:""}>${E0}</script>
3314
- `}}if(b){let P=HJ(D,b);if(D=P.html,P.mergedIntoExisting)E=E.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${P.mergedIntoExisting}']`),b=P.mergedIntoExisting;else if(!P.stamped)console.warn(`[stx] ${W0.relative(process.cwd(),F)} declares signals but has no element to scope them to, so nothing in it will hydrate. Wrap the partial's markup in a single root element.`)}if(D.includes("@include")||D.includes("@partial"))D=await N5(D,T,F,J,Y,Q);let{processLoops:C}=await import("./chunk-stw3ej3d.js"),v=C(D,T,F);if(v=$1(v,T,F),v=B1(v,T,F),M)v+=`
3315
- `+M;if(E)v+=`
3316
- `+E;return v}catch(R){let D=R instanceof Error?R.message:String(R);return W(_,`Error processing include ${_}: ${D}`,V,L)}}let j=/@include\s*\(/g,B;while((B=j.exec(z))!==null){let _=B.index,O=_+B[0].length-1,V=1,L=O+1;while(L<z.length&&V>0){if(z[L]==="(")V++;else if(z[L]===")")V--;L++}if(V!==0)break;let F=z.substring(_,L),w=z.substring(O+1,L-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){j.lastIndex=L;continue}let D=R[1],A,k=w.substring(R[0].length),N=D5(k,0);if(N!==-1)A=k.substring(N+1).trim();let M={};if(A)try{M=I0(A,Z)}catch(I){let y=I instanceof Error?I.message:String(I);z=z.replace(F,j0("Include",`Error parsing include variables for ${D}: ${y}`,X,$,_)),j.lastIndex=0;continue}let T=await H(D,M,$,_);z=z.substring(0,_)+T+z.substring(L),j.lastIndex=0}return z}function A5($,Z){let X=$;function J(Y,Q,G,z){let q=Y,K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),W=q.match(U);if(!W||W.index===void 0)break;let H=W.index,j=W[1],B=H+W[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),V=1,L=B,F=-1;while(V>0&&L<q.length){let R=q.slice(L),D=R.match(_),A=R.match(O),k=D?L+D.index:1/0,N=A?L+A.index:1/0;if(k<N)V++,L=k+(D[0].length||1);else if(N<1/0){if(V--,V===0){F=N;break}L=N+G.length+1}else break}if(F===-1)break;let w=q.slice(B,F);if(!Z[j])Z[j]=[];if(z)Z[j].unshift(w);else Z[j].push(w);q=q.substring(0,H)+q.substring(F+`@${G}`.length),K=!0}return q}return X=J(X,"push","endpush",!1),X=J(X,"prepend","endprepend",!0),X}function M5($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(X,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3317
- `)})}import*as k5 from"path";async function C4($,Z,X=""){if(k5.basename(X)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return P4($,Z,X,"@js","@endjs")}async function S4($,Z,X=""){if(k5.basename(X)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return P4($,Z,X,"@ts","@endts")}async function P4($,Z,X,J,Y){let Q=$,G=v1(`${J}([\\s\\S]*?)${Y}`,"g"),z=[],q;while((q=G.exec($))!==null)z.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:K,content:U,index:W}of z)try{let H={...Z,global:Z},j=Object.keys(H),B=Object.values(H),_=U.trim();if(J==="@ts")_=_.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 V=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((D)=>D.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=V.length>0?`return { ${V.join(", ")} };`:"return {};",F=`
3318
- ${_}
3319
- ${L}
3320
- `,R=Function(...j,F)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(K,"")}catch(H){console.error(`Error executing ${J} code block in ${X}:`,H);let j=H instanceof Error?H.message:String(H),B=j0(`${J} Directive`,`Error executing code: ${j}`,X,$,W,K);console.error(B),Q=Q.replace(K,"")}return Q}var BJ=1000,_J=!1;function VJ($,Z){let X=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index+Q[0].length,z=Q.index+Q[0].indexOf("("),q=B0($,"(",")",z);if(q===-1)continue;let K=$.slice(G,q).trim();if(!K)continue;if(!Object.keys(Z).some((H)=>new RegExp(`(?:^|[^\\w$.])${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let W;try{let H=I0(K,Z);if(!H||typeof H!=="object")continue;W=JSON.stringify(H)}catch{continue}J+=$.slice(Y,G)+W,Y=q,X.lastIndex=q}return Y===0?$:J+$.slice(Y)}function LJ($,Z){let X=/@component\s*\(/g,J=$,Y,Q=[];while((Y=X.exec(J))!==null){let G=Y.index,z=G+Y[0].length-1,q=1,K=z+1;while(K<J.length&&q>0){if(J[K]==="(")q++;else if(J[K]===")"){if(q--,q===0)break}K++}if(q!==0)continue;let U=J.substring(z+1,K),W=K+1,H=U.match(/^\s*['"]([^'"]+)['"]/);if(!H)continue;let j=H[1],B=U.slice(H[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let V=I0(O,Z),L=JSON.stringify(V),F=`@component('${j}', ${L})`;Q.push({start:G,end:W,replacement:F})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];J=J.substring(0,z)+K+J.substring(q)}return J}function X9($,Z,X){let J=$,Y=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=Y.exec(J))!==null){let G=Q.index,z=G+Q[0].length-1,q=1,K=z+1,U=null,W=!1;while(K<J.length&&q>0){let B=J[K];if(W){W=!1,K++;continue}if(B==="\\"&&U){W=!0,K++;continue}if(U){if(B===U)U=null;K++;continue}if(B==='"'||B==="'"||B==="`"){U=B,K++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}K++}if(q!==0)break;let H=J.substring(z+1,K),j=X(H);J=J.substring(0,G)+j+J.substring(K+1)}return J}function OJ($,Z){let X=$;return X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in Z)return`:${Y}="${Y}"`;return J}),X=X.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,Q)=>{try{let G=Object.keys(Z),z=Object.values(Z);g4(Q);let K=U0(Q,G)(...z),U=JSON.stringify(K);if(U===void 0){if(!Q9(Q).some((j)=>!(j in Z)))return"";return J}let W=Buffer.from(U,"utf8").toString("base64");return`__stx_${Y}="${W}"`}catch(G){return J}}),X}var J9="<!--__STX_BREAK__-->",Y9="<!--__STX_CONTINUE__-->";function FJ($,Z){let X=$;return X=X9(X,"@break",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(z0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?J9:""}catch{return""}}),X=X9(X,"@continue",(J)=>{try{let Q=`!!(${J.trim()})`,G;if(z0(Q)){let z=U0(Q,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(e(Q,Z));return G?Y9:""}catch{return""}}),X}function wJ($){let Z=$;return Z=Z.replace(/@break(?!\()/g,J9),Z=Z.replace(/@continue(?!\()/g,Y9),Z}function v4($){let Z=$.includes(J9),X=Z?$.substring(0,$.indexOf(J9)):$;return{hasBreak:Z,content:X}}function f4($){let Z=$.includes(Y9),X=Z?$.substring(0,$.indexOf(Y9)):$;return{hasContinue:Z,content:X}}function h4($){let Z=$;return Z=X9(Z,"@break",(X)=>{let J=X.trim();if(!Z9(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=X9(Z,"@continue",(X)=>{let J=X.trim();if(!Z9(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function RJ($){let Z=/@forelse\s*\(/g,X,J=[],Y=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=Y.exec($))!==null)J.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((U,W)=>U.pos-W.pos);let z=[],q=0;for(let U of J)q+=U.delta,z.push({pos:U.pos,depth:q});function K(U){let W=0,H=z.length-1,j=0;while(W<=H){let B=W+H>>1;if(z[B].pos<=U)j=z[B].depth,W=B+1;else H=B-1}return j}while((X=Z.exec($))!==null){if(K(X.index)>0)continue;let U=X.index,W=X.index+X[0].length-1,H=1,j=W+1,B=-1;while(j<$.length&&H>0){if($[j]==="(")H++;else if($[j]===")"){if(H--,H===0){B=j;break}}j++}if(B===-1)continue;let _=$.substring(W+1,B),O=u4(_);if(!O)continue;let{arrayExpr:V,itemVar:L}=O,F=B+1,w=1,R=F,D=/@forelse\s*\(/g,A=/@endforelse/g,k=-1;while(w>0&&R<$.length){D.lastIndex=R,A.lastIndex=R;let E=D.exec($),b=A.exec($);if(!b)break;if(E&&E.index<b.index)w++,R=E.index+E[0].length;else{if(w--,w===0){k=b.index;break}R=b.index+11}}if(k===-1)continue;let N=$.substring(F,k),M=k+11,T=-1,I=0,y=0;while(y<N.length){let E=N.indexOf("@",y);if(E===-1)break;let b=N.substring(E);if(/^@forelse\s*\(/.test(b))I++,y=E+1;else if(b.startsWith("@endforelse"))I--,y=E+11;else if(I===0&&b.startsWith("@empty")){if(N.length<=E+6||!/[a-z]/i.test(N[E+6])){T=E;break}y=E+1}else y=E+1}if(T===-1)continue;return{start:U,end:M,arrayExpr:V,itemVar:L,foreachContent:N.substring(0,T),emptyContent:N.substring(T+6)}}return null}function x4($,Z){let X=$;while(!0){let J=RJ(X);if(!J)break;let{start:Y,end:Q,arrayExpr:G,itemVar:z,foreachContent:q,emptyContent:K}=J;try{let U;if(z0(G))U=U0(G,Object.keys(Z))(...Object.values(Z));else U=e(G,Z);let W;if(!Array.isArray(U)||U.length===0)W=K;else W=`@foreach (${G} as ${z})${q}@endforeach`;X=X.substring(0,Y)+W+X.substring(Q)}catch(U){let W=U instanceof Error?U.message:String(U),H=J0("Forelse",`Error in @forelse(${G} as ${z}): ${W}`,X0.EVALUATION_ERROR);X=X.substring(0,Y)+H+X.substring(Q)}}return X}function u4($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let X=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!X)return null;let J=X[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=X[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function d4($,Z,X,J){let Y=$;Y=x4(Y,Z);function Q(q){let K=/@foreach\s*\(/g,U;while((U=K.exec(q))!==null){let W=U.index,H=U.index+U[0].length-1,j=1,B=H+1,_=-1;while(B<q.length&&j>0){if(q[B]==="(")j++;else if(q[B]===")"){if(j--,j===0){_=B;break}}B++}if(_===-1)continue;let O=q.substring(H+1,_),V=u4(O);if(!V)continue;let L=W,{arrayExpr:F,itemVar:w}=V,R=_+1,D=1,A=R,k=/@foreach\s*\(/g,N=/@endforeach/g;while(D>0&&A<q.length){k.lastIndex=A,N.lastIndex=A;let M=k.exec(q),T=N.exec(q);if(!T)break;if(M&&M.index<T.index)D++,A=M.index+M[0].length;else{if(D--,D===0){let I=q.substring(R,T.index),y=T.index+11;return{start:L,end:y,arrayExpr:F,itemVar:w,content:I}}A=T.index+11}}}return null}function G(q,K){let U=q;while(!0){let W=Q(U);if(!W)break;let{start:H,end:j,arrayExpr:B,itemVar:_,content:O}=W;try{let V=B.trim(),L;if(z0(V))L=U0(V,Object.keys(K))(...Object.values(K));else L=e(V,K);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${V}) in ${X}: ${V} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let T=J0("Foreach",`Error in @foreach: ${V} is not iterable`,X0.TYPE_ERROR);U=U.substring(0,H)+T+U.substring(j);continue}let w=J?.loops?.useAltLoopVariable??_J,R=_.trim(),D=null,A,k=!1;if(R.includes("=>")){let T=R.split("=>").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])D=T[0],A=T[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let T=R.split(",").map((I)=>I.trim());if(T.length===2&&T[0]&&T[1])A=T[0],D=T[1],k=!0;else A=R}else A=R;let N="",M=L;for(let T=0;T<M.length;T++){let I=M[T],y={index:T,iteration:T+1,first:T===0,last:T===M.length-1,count:M.length},E={...K,loop:y,$loop:y};if(A.startsWith("[")&&A.endsWith("]")){let P=A.slice(1,-1).split(",").map((g)=>g.trim());if(Array.isArray(I))P.forEach((g,x)=>{if(g)E[g]=I[x]});else E[A]=I}else E[A]=I;if(D)if(!k&&F&&Array.isArray(I)&&I.length===2)E[D]=I[0],E[A]=I[1];else E[D]=T;let b=FJ(O,E),C=f4(b);if(C.hasContinue){N+=C.content;continue}let v=v4(b);if(v.hasBreak){N+=v.content;break}if(b=x4(b,E),b=G(b,E),b=$1(b,E,X),b=wJ(b),v=v4(b),v.hasBreak){N+=v.content;break}if(C=f4(b),C.hasContinue){N+=C.content;continue}b=B1(b,E,X),b=OJ(b,E),b=LJ(b,E),b=VJ(b,E),N+=b}U=U.substring(0,H)+N+U.substring(j)}catch(V){let L=J0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${V instanceof Error?V.message:String(V)}`,X0.EVALUATION_ERROR);U=U.substring(0,H)+L+U.substring(j)}}return U}Y=G(Y,Z),Y=l4(Y,Z,X,J);let z=J?.loops?.maxWhileIterations??BJ;return Y=AJ(Y,Z,z),Y}function m4($){return Z9($)}function l4($,Z,X,J){let Y=$,Q=!0;while(Q){Q=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,q=z+G[0].length-1,K=B0(Y,"(",")",q);if(K===-1)break;let U=Y.slice(q+1,K),W=K+1,H=r2(Y.slice(z),"for","endfor");if(H.length===0)break;let j=H[0].content,B=z+H[0].end;if(!m4(U)){let _=J0("For",`Unsafe expression in @for: ${U}`,X0.UNSAFE_EXPRESSION);Y=Y.substring(0,z)+_+Y.substring(B),Q=!0;continue}try{let _=DJ(U),O=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(_.length>0&&O){let D=NJ({forExpr:U,content:j,iterVarNames:_,context:Z,filePath:X,options:J});Y=Y.substring(0,z)+D+Y.substring(B),Q=!0;continue}let V=Object.keys(Z),L=Object.values(Z),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(D,A)=>{return`\${${A}}`});F=h4(F);let R=Function(...V,`
3321
- let result = '';
3322
- for (${U}) {
3323
- result += \`${F}\`;
3324
- }
3325
- return result;
3326
- `)(...L);Y=Y.substring(0,z)+R+Y.substring(B),Q=!0}catch(_){let O=J0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,X0.EVALUATION_ERROR);Y=Y.substring(0,z)+O+Y.substring(B),Q=!0}}return Y}function DJ($){let Z=$.trim(),X=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(X){let Q=X[1];return Q.slice(1,-1).split(",").map((z)=>{let q=z.trim();if(!q)return"";let K=q.indexOf(":");if(K>=0&&Q.startsWith("{")){let H=q.slice(K+1).trim(),j=H.indexOf("=");return(j>=0?H.slice(0,j):H).trim()}let U=q.indexOf("="),W=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(W)?W:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function NJ($){let{forExpr:Z,content:X,iterVarNames:J,context:Y,filePath:Q,options:G}=$,z=Object.keys(Y),q=Object.values(Y),K=Function(...z,"__pushIter",`
3327
- for (${Z}) {
3328
- __pushIter([${J.join(", ")}])
3329
- }
3330
- `),U=[];K(...q,(j)=>{U.push(j)});let W=Q??"inline.stx",H="";for(let j of U){let B={...Y};J.forEach((O,V)=>{B[O]=j[V]});let _=l4(X,B,Q,G);_=$1(_,B,W),_=B1(_,B,W),H+=_}return H}function AJ($,Z,X){let J=$,Y=!0;while(Y){Y=!1;let Q=J.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,z=G+Q[0].length-1,q=B0(J,"(",")",z);if(q===-1)break;let K=J.slice(z+1,q),U=r2(J.slice(G),"while","endwhile");if(U.length===0)break;let W=U[0].content,H=G+U[0].end;if(!m4(K)){let j=J0("While",`Unsafe expression in @while: ${K}`,X0.UNSAFE_EXPRESSION);J=J.substring(0,G)+j+J.substring(H),Y=!0;continue}try{let j=Object.keys(Z),B=Object.values(Z),_=W.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});_=h4(_);let V=Function(...j,`
3331
- let result = '';
3332
- let maxIterations = ${X}; // Configurable safety limit
3333
- let counter = 0;
3334
- while (${K} && counter < maxIterations) {
3335
- counter++;
3336
- result += \`${_}\`;
3337
- }
3338
- if (counter > maxIterations) {
3339
- result += '<!-- [While Error [1104]]: Maximum iterations (${X}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3340
- }
3341
- return result;
3342
- `)(...B);J=J.substring(0,G)+V+J.substring(H),Y=!0}catch(j){let B=J0("While",`Error in @while(${K}): ${j instanceof Error?j.message:String(j)}`,X0.EVALUATION_ERROR);J=J.substring(0,G)+B+J.substring(H),Y=!0}}return J}function MJ($,Z="_method"){let X=$.toUpperCase();if(X==="GET"||X==="POST")return"";return`<input type="hidden" name="${Z}" value="${X}">`}function c4($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,X,J,Y,Q)=>{return MJ(J,Q||"_method")})}async function p4($,Z,X,J,Y){if(!J.middleware||J.middleware.length===0)return $;let Q=$,G=J.middleware.filter((z)=>z.timing===Y);if(G.length===0)return Q;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",z);continue}try{let q=await z.handler(Q,Z,X,J);if(typeof q==="string")Q=q;else if(J.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${z.name}:`,q);if(J.debug){let K=j0("Middleware",`Error in middleware '${z.name}': ${q instanceof Error?q.message:String(q)}`,X,$);Q=Q.replace(/<body[^>]*>/,`$&
3343
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${C9(K)}</div>
3344
- `)}}}return Q}async function i4($,Z,X,J){return p4($,Z,X,J,"before")}async function n4($,Z,X,J){return p4($,Z,X,J,"after")}Q2();Q2();function o4($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,X,J,Y,Q)=>{try{let G=Y?I0(Y,{}):{};return I5(J,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var p0={patterns:[],exact:{}};function dU($,Z){if(!p0.exact[$])p0.exact[$]=[];p0.exact[$].push(Z)}function mU($,Z){let X=typeof $==="string"?new RegExp($):$;p0.patterns.push({pattern:X,callback:Z})}async function s4($,Z){let X=$.split("/").pop()?.split(".")[0]||"";if(p0.exact[$])for(let J of p0.exact[$])await Promise.resolve(J(Z,$));if(p0.exact[X])for(let J of p0.exact[X])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Y}of p0.patterns)if(J.test($)||J.test(X))await Promise.resolve(Y(Z,$))}function lU(){p0.patterns=[],p0.exact={}}var kJ=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),IJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function T5($){let Z=[],X=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=X.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let Q=J.index,G=Q+J[0].length,z=J[1].toLowerCase();if(J[0].endsWith("/>")||IJ.has(z)){Z.push([Q,G]);continue}let q=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=G;let U=1,W=G,H;while((H=K.exec($))!==null)if(H[0].startsWith("</")){if(U--,U===0){W=H.index+H[0].length;break}}else if(!H[0].endsWith("/>"))U++;Z.push([Q,W])}return Z}function a4($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>a4(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function t4($,Z){if(!/:[\w-]+=/.test($))return $;let X=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],Q;while((Q=J.exec($))!==null)Y.push([Q.index,Q.index+Q[0].length]);Y.push(...T5($));function G(K){return Y.some(([U,W])=>K>=U&&K<W)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((Q=z.exec(X))!==null){if(G(Q.index))continue;let K=Q[0],U=Q[2];if(!U||!U.includes(":"))continue;let W=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,H,j=U,B=!1;while((H=W.exec(U))!==null){let _=H[1],O=H[2];if(r4(_))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let V=Object.keys(Z),L=Object.values(Z),F=O.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!V.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let R=Function(...V,`return (${O})`)(...L);if(_==="class"){let D=a4(R);if(D){let A=j.match(/\sclass="([^"]*)"/);if(A)j=j.replace(A[0],` class="${A[1]} ${D}"`);else j=j.replace(H[0],` class="${D}"`)}else j=j.replace(H[0],"");B=!0;continue}if(kJ.has(_)){if(R)j=j.replace(H[0],` ${_}`);else j=j.replace(H[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)j=j.replace(H[0],"");else{let D=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(H[0],` ${_}="${D}"`)}B=!0}catch{continue}}if(B){let _=K.endsWith("/>")?" /":"",V=`<${Q[1]}${j}${_}>`;q.push({start:Q.index,end:Q.index+K.length,replacement:V})}}for(let K=q.length-1;K>=0;K--){let{start:U,end:W,replacement:H}=q[K];X=X.slice(0,U)+H+X.slice(W)}return X}var TJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),EJ=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 R1($,Z){let X=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;X.lastIndex=Z;let J=X.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&TJ.has(J[1]),Q=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:Q,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function bJ($,Z,X){let J=1,Y=X,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Y<$.length){Q.lastIndex=Y,G.lastIndex=Y;let z=Q.exec($),q=G.exec($);if(!q)return-1;if(z&&z.index<q.index)J++,Y=z.index+z[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function o0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let X=bJ($,Z.tag,Z.end);if(X===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:X,innerHTML:$.slice(Z.end,X-`</${Z.tag}>`.length)}}function e4($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function h1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${X}="([^"]*)"`,"s"))||$.match(new RegExp(`${X}='([^']*)'`,"s"));return J?J[1]:null}function U1($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${X}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${X}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${X}(?=\\s|$|>|/)`,"g"),"")}function W1($,Z,X){let J=Z.selfClosing?" /":"",Y=`<${Z.tag}${X}${J}>`;return $.slice(0,Z.start)+Y+$.slice(Z.end)}function yJ($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function CJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-for");if(Y===null){X=J.end;continue}let Q=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){X=J.end;continue}let G=Q[1].trim(),z=Q[2].trim(),q;if(G.includes(",")){let O=G.split(",").map((F)=>F.trim()),V=O[0],L=O[1];q=`${z} as ${L} => ${V}`}else q=`${z} as ${G}`;let K=U1(J.attrs,"v-for"),U=U1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),W=o0(Z,J),H=Z.slice(W.outerStart,W.outerEnd),j=W1(H,{...J,start:0,end:J.end-J.start},U),B=`@foreach(${q})
3345
- `,_=`${B}${j}
3346
- @endforeach`;Z=Z.slice(0,W.outerStart)+_+Z.slice(W.outerEnd),X=W.outerStart+B.length}return Z}function SJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-if");if(Y===null){X=J.end;continue}let Q=[],G=o0(Z,J),z=U1(J.attrs,"v-if"),q=W1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},z);Q.push({type:"if",expr:Y,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:J});let K=G.outerEnd,U=!0;while(U){let _=Z.slice(K).match(/^\s*/),O=_?_[0].length:0,V=R1(Z,K+O);if(!V){U=!1;break}let L=h1(V.attrs,"v-else-if"),F=e4(V.attrs,"v-else");if(L!==null){let w=o0(Z,V),R=U1(V.attrs,"v-else-if"),D=W1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else-if",expr:L,outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:V}),K=w.outerEnd}else if(F){let w=o0(Z,V),R=U1(V.attrs,"v-else"),D=W1(Z.slice(w.outerStart,w.outerEnd),{...V,start:0,end:V.end-V.start},R);Q.push({type:"else",outerStart:K,outerEnd:w.outerEnd,element:D,parsedTag:V}),U=!1}else U=!1}let W=[];for(let _ of Q)if(_.type==="if")W.push(`@if(${_.expr})
3347
- ${_.element}`);else if(_.type==="else-if")W.push(`@elseif(${_.expr})
3348
- ${_.element}`);else W.push(`@else
3349
- ${_.element}`);W.push("@endif");let H=W.join(`
3350
- `),j=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,j)+H+Z.slice(B),X=j+H.length}return Z}function PJ($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function vJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=J.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,z=Y.match(G);while(z){Q=!0;let U=z[1],W=z[2],H=z[3];Y=Y.replace(z[0],""),Y+=` :${U}="${H}" @update:${U}="${H} = $event"`,z=Y.match(G)}if(Q){let U=o0(Z,J),W=Z.slice(U.outerStart,U.outerEnd),H=W1(W,{...J,start:0,end:J.end-J.start},Y);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),X=U.outerStart+H.length;continue}let q=h1(J.attrs,"v-model");if(q===null){X=J.end;continue}if(EJ.has(J.tag)){let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,W=o0(Z,J),H=Z.slice(W.outerStart,W.outerEnd),j=W1(H,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),X=W.outerStart+j.length}else{let U=J.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let W=o0(Z,J),H=Z.slice(W.outerStart,W.outerEnd),j=W1(H,{...J,start:0,end:J.end-J.start},U);Z=Z.slice(0,W.outerStart)+j+Z.slice(W.outerEnd),X=W.outerStart+j.length}}return Z}function fJ($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function xJ($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function gJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-html");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=o0(Z,J),G=U1(J.attrs,"v-html"),z=J.selfClosing?" /":"",q=`<${J.tag}${G}${z}>{!! ${Y} !!}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function hJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;let Y=h1(J.attrs,"v-text");if(Y===null){X=J.end;continue}if(J.selfClosing){X=J.end;continue}let Q=o0(Z,J),G=U1(J.attrs,"v-text"),z=J.selfClosing?" /":"",q=`<${J.tag}${G}${z}>{{ ${Y} }}</${J.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function uJ($){return $.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 dJ($){let Z=$,X=0;while(X<Z.length){let J=R1(Z,X);if(!J)break;if(!e4(J.attrs,"v-once")){X=J.end;continue}let Y=U1(J.attrs,"v-once"),Q=o0(Z,J),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
3351
- ${W1(G,{...J,start:0,end:J.end-J.start},Y)}
3352
- @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),X=Q.outerStart+q.length}return Z}function mJ($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function lJ($){return $.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 $7($){if(!yJ($))return $;let Z=$;return Z=CJ(Z),Z=SJ(Z),Z=dJ(Z),Z=fJ(Z),Z=xJ(Z),Z=vJ(Z),Z=PJ(Z),Z=lJ(Z),Z=gJ(Z),Z=hJ(Z),Z=uJ(Z),Z=mJ(Z),Z}function G9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var E5=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"]),cJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"]);function Z7($,Z){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=X?X[1]:$,Y=e(J,Z);if(Y&&typeof Y==="string")return Y;let Q=J.trim();return E5.has(Q)?Q:null}function X7($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function J7($,Z,X){let J=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(cJ.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${X}</${$}>`}async function Y7($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let K=z.length-1;K>=0;K--){let U=z[K];try{let W=Z7(U.expr,Z);if(!W||typeof W!=="string"){let L=`<!-- dynamic component: could not resolve "${G9(X7(U.expr))}" -->`;Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}if(E5.has(W)){let L=J7(W,U.attrs,U.slotContent);Q=Q.slice(0,U.index)+L+Q.slice(U.index+U.full.length);continue}let H=U.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(H))!==null){let L=_[1]||_[2],F=_[3];if(_[1])try{j[L]=e(F,Z)}catch{j[L]=F}else j[L]=F}let O=J.componentsDir||"components",V=await D1(W,j,U.slotContent,O,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,U.index)+V+Q.slice(U.index+U.full.length)}catch(W){let H=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${G9(H)} -->`;Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length)}}return Q=await pJ(Q,Z,X,J,Y),Q}async function pJ($,Z,X,J,Y){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],q;while((q=G.exec(Q))!==null)z.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let K=z.length-1;K>=0;K--){let U=z[K];try{let W=Z7(U.expr,Z);if(!W||typeof W!=="string"){let B=`<!-- dynamic component: could not resolve "${G9(X7(U.expr))}" -->`;Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}if(E5.has(W)){let B=J7(W,U.attrs,"");Q=Q.slice(0,U.index)+B+Q.slice(U.index+U.full.length);continue}let H=J.componentsDir||"components",j=await D1(W,{},"",H,Z,X,J,new Set,Y??new Set);Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length)}catch(W){let H=W instanceof Error?W.message:String(W),j=`<!-- dynamic component error: ${G9(H)} -->`;Q=Q.slice(0,U.index)+j+Q.slice(U.index+U.full.length)}}return Q}function Q7($,Z=""){let X=`${$}${Z}`,J=0;for(let Y=0;Y<X.length;Y++){let Q=X.charCodeAt(Y);J=(J<<5)-J+Q,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function G7($,Z,X={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=X;if(!$.trim())return"";let z=b5($),q=[],K=new Map;if(Q)for(let U of z){let W=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(W){let H=W[1],j=`${Z}_${H}`;K.set(H,j)}}for(let U of z){let W=z7(U,Z,J,Y,K,G);q.push(W)}return q.join(`
3353
-
3354
- `)}function b5($){let Z=[],X=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",Q=!1,G="";for(let z=0;z<X.length;z++){let q=X[z];if(q==="@"&&J===0)Q=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(Q){G+=q;let K=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(K){let[,U,W,H]=K;if(U==="keyframes")Z.push({selector:`@keyframes ${W.trim()}`,declarations:H.trim()});else if(U==="media"||U==="supports"||U==="container"){let j=b5(H);Z.push({selector:`@${U} ${W.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
3355
- `)})}else Z.push({selector:`@${U} ${W.trim()}`,declarations:H.trim()})}G="",Q=!1}else if(Y.trim()){Y+=q;let K=Y.match(/([^{]+)\{([^}]*)\}/);if(K)Z.push({selector:K[1].trim(),declarations:K[2].trim()});Y=""}continue}}if(Q)G+=q;else Y+=q}return Z}function z7($,Z,X,J,Y,Q){let{selector:G,declarations:z}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Y.get(U)||U} { ${z} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let W=b5(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((H)=>z7(H,Z,X,J,Y,Q)).join(`
3356
- `);return`${G} {
3357
- ${W}
3358
- }`}return`${G} { ${z} }`}let q=iJ(G,Z,X,J),K=z;for(let[U,W]of Y)K=K.replace(new RegExp(`\\b${U}\\b`,"g"),W);if(Q)K=K.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${K} }`}function iJ($,Z,X,J){let Y=$.split(",").map((G)=>G.trim()),Q=[];for(let G of Y){if(G.startsWith(":host")){if(J)Q.push(G);else{let K=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(K)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let z=X?`${X} .${Z}`:`.${Z}`;Q.push(`${z} ${G}`);let q=nJ(G,Z);if(q)Q.push(X?`${X} ${q}`:q)}return Q.join(", ")}function nJ($,Z){let X=0,J=$.length;for(let q=0;q<$.length;q++){let K=$[q];if(K==="["||K==="(")X++;else if(K==="]"||K===")")X--;else if(X===0&&(K===" "||K===">"||K==="+"||K==="~")){J=q;break}}let Y=$.slice(0,J),Q=$.slice(J);if(!Y)return"";let G=Y.length,z=0;for(let q=0;q<Y.length;q++){let K=Y[q];if(K==="["||K==="(")z++;else if(K==="]"||K===")")z--;else if(X===0&&z===0&&K===":"){G=q;break}}return`${Y.slice(0,G)}.${Z}${Y.slice(G)}${Q}`}var U7=String.raw`(?<![\w-])scoped(?![\w-])`,y5=/<style\s+([^>]*)>/gi,q7=/<style\s+([^>]*)>([\s\S]*?)<\/style>/gi,W7=new RegExp(U7,"i"),oJ=new RegExp(U7,"gi");function sJ($){y5.lastIndex=0;let Z=y5.exec($);while(Z!==null){if(W7.test(Z[1]))return!0;Z=y5.exec($)}return!1}function H7($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(X)=>{let J=X.trim();if(Z.has(J))return"";return Z.add(J),X})}function z9($,Z){if(!sJ($))return{html:$,hasScoped:!1};let X=Q7(Z),J=`data-v-${X}`,Y=$,Q=!1;if(q7.lastIndex=0,Y=Y.replace(q7,(G,z,q)=>{if(!W7.test(z))return G;Q=!0;let K=rJ(q,J),U=z.replace(oJ,"").trim(),W=U?` ${U}`:"";return`<style data-stx-scoped="${X}"${W}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=tJ(Y,J),{html:Y,hasScoped:!0}}function rJ($,Z){return G7($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}var aJ=($)=>`\x00stx-scope-mask-${$}\x00`,K7=/\u0000stx-scope-mask-(\d+)\u0000/g;function tJ($,Z){let X=i0($,(Y,Q)=>{let G=X1(Y,Q);return G>Q?G:T1(Y,Q)},(Y,Q)=>aJ(Q)),J=eJ(X.output,Z);return K7.lastIndex=0,J.replace(K7,(Y,Q)=>X.tokens[Number(Q)])}function eJ($,Z){let X=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,Q)=>{if(X.has(Y.toLowerCase()))return J;if(J.includes(Z))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(Q)return J.replace(`<${Y}${Q}`,`<${Y} ${Z}${Q}`);if(J.endsWith("/>"))return`<${Y} ${Z} />`;return`<${Y} ${Z}>`})}function C5(){return{afterOpen:[],beforeClose:[]}}function $Y($){return $.afterOpen.length>0||$.beforeClose.length>0}function B7($,Z){if(!$Y(Z))return $;let X=Z.afterOpen.join(""),J=Z.beforeClose.join(""),Y=$.lastIndexOf("</head>"),Q=X?_2($):null,G=J&&Y!==-1?Y:null;if(Q===null&&G===null)return $;if(Q!==null&&G!==null)return`${$.slice(0,Q)}${X}${$.slice(Q,G)}${J}${$.slice(G)}`;if(Q!==null)return`${$.slice(0,Q)}${X}${$.slice(Q)}`;return`${$.slice(0,G)}${J}${$.slice(G)}`}var j7=/\s*<meta\b[^>]*\bcharset\b[^>]*>/iy;function _2($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let X=Z.index+Z[0].length;j7.lastIndex=X;let J=j7.exec($);return J?X+J[0].length:X}var P5="data-stx-color-mode-boot",ZY="__STX_COLOR_MODE__",XY=new Set(["light","dark","auto","system"]),JY=new Set(["auto","system"]),YY=/^[a-z][\w:-]*$/i,QY=/^[\w-]+$/;function GY($){let Z=$.storageKey??"stx-color-mode",X=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!XY.has(X))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!QY.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!YY.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(Q!==null&&!JY.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(J===null&&Y===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:Z,initialMode:X==="system"?"auto":X,darkClass:J,attribute:Y,autoValue:Q}}function zY($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function v5($={}){let Z=GY($),J=`(function(){"use strict";var c=${zY(Z)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.${ZY}={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`;return`<script ${P5}>${J}</script>`}function L7($,Z={}){if($.includes(P5))return $;let X=S5($);if(X===null)return $;let J=v5(Z);return`${$.slice(0,X)}
3359
- ${J}${$.slice(X)}`}var S5=_2,qY=new RegExp(`<script\\b[^>]*\\b${P5}\\b[^>]*>[\\s\\S]*?<\\/script>`,"i"),_7=/<meta\b[^>]*\bcharset\b[^>]*>/gi,V7=/<\/head>/gi;function KY($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let X=Z.index+Z[0].length;V7.lastIndex=X;let J=V7.exec($),Y=J?J.index:$.length;_7.lastIndex=X;let Q=_7.exec($);if(!Q||Q.index>=Y)return $;if($.slice(X,Q.index).trim()==="")return $;let G=Q.index+Q[0].length;return`${$.slice(0,X)}
3360
- ${Q[0]}${$.slice(X,Q.index)}${$.slice(G,Y)}${$.slice(Y)}`}function O7($){return UY(KY($))}function UY($){let Z=qY.exec($);if(!Z)return $;let X=S5($);if(X===null)return $;if(Z.index<=X||$.slice(X,Z.index).trim()==="")return $;let J=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),Y=S5(J);if(Y===null)return $;return`${J.slice(0,Y)}
3361
- ${Z[0]}${J.slice(Y)}`}var QW="stx-build",GW="X-STX-Build",q9=null;function F7(){if(q9===null)q9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return q9}function zW($){q9=$}function qW($,Z=F7()){let X=f5($,Z);if(X===null)return $;let J=/<head\b[^>]*>/i.exec($),Y=J.index+J[0].length;return`${$.slice(0,Y)}${X}${$.slice(Y)}`}function f5($,Z=F7()){if($.includes('name="stx-build"'))return null;if(!/<head\b[^>]*>/i.test($))return null;return`
3362
- <meta name="stx-build" content="${Z}">`}var w7="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",K9="data-stx-html-attrs",U9="data-stx-html-class",R7=/^[A-Za-z_:][\w:.-]*$/;function Z1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WY($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d1($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function u1($,Z){return Object.entries($).filter(([X])=>!Z?.(X)).map(([X,J])=>`${X}="${Z1(String(J))}"`).join(" ")}function HY($={},Z="en"){let X=[],J=[],Y="",Q=Z;for(let[z,q]of Object.entries($||{})){if(q==null)continue;let K=z.trim();if(!R7.test(K))continue;let U=K.toLowerCase();if(U==="lang"){Q=String(q);continue}if(U==="class"){Y=String(q).trim();continue}X.push(` ${K}="${Z1(String(q))}"`),J.push(K)}let G=` lang="${Z1(Q)}"`;if(Y)G+=` class="${Z1(Y)}"`;if(G+=X.join(""),Y)G+=` ${U9}="${Z1(Y)}"`;if(J.length)G+=` ${K9}="${Z1(J.join(" "))}"`;return G}function D7($={},Z={}){let X={...$,...Z};if($.class&&Z.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of Z.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);X.class=J.join(" ")}return X}function N7($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let X=$.match(/<html\b([^>]*)>/i);if(!X)return $;let J={},Y=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(X[1]))!==null){let U=G[1];if(!(U in J))Y.push(U);J[U]=G[2]??G[3]??G[4]??""}let z=[],q=[];for(let[U,W]of Object.entries(Z)){if(W==null)continue;let H=U.trim();if(!R7.test(H))continue;let j=H.toLowerCase();if(j==="class"){let B=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(W).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),z.push(_);if(!("class"in J))Y.push("class");J.class=B.join(" ");continue}if(!(H in J))Y.push(H);if(J[H]=String(W),j!=="lang")q.push(H)}if(z.length){if(!(U9 in J))Y.push(U9);J[U9]=z.join(" ")}if(q.length){if(!(K9 in J))Y.push(K9);J[K9]=q.join(" ")}let K=Y.map((U)=>` ${U}="${Z1(J[U])}"`).join("");return $.replace(X[0],()=>`<html${K}>`)}function WW($){let Z=x5($);if(Z===null)return $;let X=$.lastIndexOf("</head>");return`${$.slice(0,X)}${Z}${$.slice(X)}`}function x5($){if($.includes("data-stx-cloak"))return null;if($.lastIndexOf("</head>")===-1)return null;return`${w7}
3363
- `}function jY($){let Z=[],X=0;while(X<$.length){let Q=$.slice(X),G=Q.match(/^\s+/);if(G){X+=G[0].length;continue}if(Q.startsWith("<!--")){let W=$.indexOf("-->",X);if(W===-1)break;X=W+3;continue}let z=Q.match(/^<script\b[^>]*>/i);if(z){let W=$.toLowerCase().indexOf("</script>",X+z[0].length);if(W===-1)break;X=W+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),X+=q[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K){Z.push(K[0]),X+=K[0].length;continue}let U=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),X+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let J="",Y=0;while(Y<$.length&&Y<X){let Q=$.slice(Y),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Y+=G[0].length;continue}let z=Q.match(/^<meta\b[^>]*>/i);if(z&&Z.includes(z[0])){Y+=z[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Y+=q[0].length;continue}J+=$[Y],Y++}return J+=$.slice(X),{body:J,hoisted:Z}}function BY($,Z={},X={}){let{title:J="stx App",lang:Y="en",meta:Q=[],link:G=[],script:z=[],headRaw:q="",htmlAttrs:K={},bodyClass:U="",bodyAttrs:W={}}=Z,H=X.title||J,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(d1).filter(Boolean)),O=[...j.filter((M)=>!B.has(d1(M))),...Q].map((M)=>{return` <meta ${u1(M)}>`}).join(`
3364
- `),V=G.map((M)=>{return` <link ${u1(M)}>`}).join(`
3365
- `),L=z.map((M)=>{if(M.src)return` <script ${u1(M,(T)=>T==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
3366
- `),F=HY(K,Y),w=Object.entries(W).map(([M,T])=>` ${M}="${Z1(String(T))}"`).join(""),R=U?` class="${Z1(U)}"`:"",{body:D,hoisted:A}=jY($),k=[O,X.colorMode?` ${v5(X.colorMode)}`:"",` <title>${X.titleIsHtml?H:WY(H)}</title>`,` ${w7}`,V,L,q?` ${q}`:"",...(X.styles||[]).map((M)=>` ${M}`),...A.map((M)=>` ${M}`),...(X.headScripts||[]).map((M)=>` ${M}`),X.headStack||""].filter(Boolean),N=[D,...(X.bodyScripts||[]).map((M)=>M),X.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3367
- <html${F}>
3368
- <head>
3369
- ${k.join(`
3370
- `)}
3371
- </head>
3372
- <body${R}${w}>
3373
- ${N.join(`
3374
- `)}
3375
- </body>
3376
- </html>`}function g5($){let Z=0;while(Z<$.length){let X=$.slice(Z),J=X.match(/^\s+/);if(J){Z+=J[0].length;continue}if(X.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let Y=X.match(/^<(script|style)\b[^>]*>/i);if(Y){let Q=`</${Y[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+Y[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(X)||/^<html[\s>]/i.test(X)}return!1}function h5($){return g5($)}function A7($,Z={}){let X=$.lastIndexOf("</head>");if(X===-1)return $;let{meta:J=[],link:Y=[],script:Q=[],headRaw:G=""}=Z,z=$.slice(0,X),q=[];for(let K of J){let U=d1(K);if(U&&z.includes(U))continue;q.push(` <meta ${u1(K)}>`)}for(let K of Y){if(K.href&&z.includes(`href="${K.href}"`))continue;q.push(` <link ${u1(K)}>`)}for(let K of Q)if(K.src){if(z.includes(`src="${K.src}"`))continue;q.push(` <script ${u1(K,(U)=>U==="content")}></script>`)}else if(K.content){if(z.includes(K.content))continue;q.push(` <script>${K.content}</script>`)}if(G&&!z.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,X)}${q.join(`
3377
- `)}
3378
- ${$.slice(X)}`}function M7($,Z={},X={}){if(h5($))return $;return BY($,Z,X)}var _Y=/<\/(script)/gi;function m1($){if(!$||$.indexOf("</")===-1)return $;return $.replace(_Y,"<\\/$1")}var V2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useObjectUrl","useTimeoutFn"];Q2();Q2();function I7($,Z={}){return new k7($,Z).routes}function wW($,Z){let X=u5($,Z);return X?X.params:null}var T7=new Map;async function E7($){let Z=$;if(!Z)try{Z=(await Q5())?.pagesDir||"pages"}catch{Z="pages"}let X=Z,J=T7.get(X);if(J)return J;let Y=[];try{Y=I7(".",{pagesDir:X}).map((Q)=>Q.regex.source).filter(Boolean)}catch{Y=[]}return T7.set(X,Y),Y}function VY($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function b7($){return VY(JSON.stringify($))}function d5(){return`
3379
- (function(){
3380
- var tip=null,hideTimer=null,currentEl=null;
3381
-
3382
- function createTip(){
3383
- tip=document.createElement("div");
3384
- tip.id="stx-tooltip";
3385
- tip.style.cssText="position:absolute;background:#1f2937;color:#fff;font-size:12px;line-height:1.4;padding:6px 10px;border-radius:6px;max-width:250px;z-index:999999;pointer-events:none;opacity:0;transition:opacity .15s ease;white-space:pre-wrap;word-wrap:break-word;box-shadow:0 2px 8px rgba(0,0,0,.25)";
3386
- var arrow=document.createElement("div");
3387
- arrow.className="stx-tip-arrow";
3388
- arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent";
3389
- tip.appendChild(arrow);
3390
- var text=document.createElement("span");
3391
- text.className="stx-tip-text";
3392
- tip.appendChild(text);
3393
- document.body.appendChild(tip);
3394
- }
3395
-
3396
- function position(el){
3397
- var pos=el.getAttribute("x-tooltip-position")||"top";
3398
- var r=el.getBoundingClientRect();
3399
- var sy=window.scrollY,sx=window.scrollX;
3400
- tip.style.display="block";
3401
- tip.style.opacity="0";
3402
- // Force layout so we can measure
3403
- var tw=tip.offsetWidth,th=tip.offsetHeight;
3404
- var arrow=tip.querySelector(".stx-tip-arrow");
3405
- var left,top;
3406
-
3407
- if(pos==="top"){
3408
- left=r.left+r.width/2-tw/2+sx;
3409
- top=r.top-th-8+sy;
3410
- if(top-sy<0){pos="bottom";}
3411
- }
3412
- if(pos==="bottom"){
3413
- left=r.left+r.width/2-tw/2+sx;
3414
- top=r.bottom+8+sy;
3415
- arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-bottom-color:#1f2937;top:-10px;left:50%;transform:translateX(-50%)";
3416
- }
3417
- if(pos==="left"){
3418
- left=r.left-tw-8+sx;
3419
- top=r.top+r.height/2-th/2+sy;
3420
- if(left-sx<0){pos="right";}
3421
- }
3422
- if(pos==="right"){
3423
- left=r.right+8+sx;
3424
- top=r.top+r.height/2-th/2+sy;
3425
- arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-right-color:#1f2937;left:-10px;top:50%;transform:translateY(-50%)";
3426
- }
3427
-
3428
- // Set arrow for top/left after potential flips
3429
- if(pos==="top"){
3430
- arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-top-color:#1f2937;bottom:-10px;left:50%;transform:translateX(-50%)";
3431
- }
3432
- if(pos==="left"){
3433
- arrow.style.cssText="position:absolute;width:0;height:0;border:5px solid transparent;border-left-color:#1f2937;right:-10px;top:50%;transform:translateY(-50%)";
3434
- }
3435
-
3436
- // Clamp horizontal
3437
- if(left<sx+4) left=sx+4;
3438
- if(left+tw>sx+window.innerWidth-4) left=sx+window.innerWidth-tw-4;
3439
-
3440
- tip.style.left=left+"px";
3441
- tip.style.top=top+"px";
3442
- tip.style.opacity="1";
3443
- }
3444
-
3445
- function showTip(el){
3446
- if(hideTimer){clearTimeout(hideTimer);hideTimer=null;}
3447
- if(!tip) createTip();
3448
- var text=el.getAttribute("x-tooltip");
3449
- if(!text) return;
3450
- tip.querySelector(".stx-tip-text").textContent=text;
3451
- currentEl=el;
3452
- position(el);
3453
- }
3454
-
3455
- function hideTip(){
3456
- if(!tip) return;
3457
- tip.style.opacity="0";
3458
- hideTimer=setTimeout(function(){
3459
- if(tip) tip.style.display="none";
3460
- currentEl=null;
3461
- },150);
3462
- }
3463
-
3464
- document.addEventListener("mouseover",function(e){
3465
- var el=e.target.closest("[x-tooltip]");
3466
- if(el) showTip(el);
3467
- });
3468
- document.addEventListener("mouseout",function(e){
3469
- var el=e.target.closest("[x-tooltip]");
3470
- if(el&&el===currentEl) hideTip();
3471
- });
3472
- document.addEventListener("focusin",function(e){
3473
- var el=e.target.closest("[x-tooltip]");
3474
- if(el) showTip(el);
3475
- });
3476
- document.addEventListener("focusout",function(e){
3477
- var el=e.target.closest("[x-tooltip]");
3478
- if(el) hideTip();
3479
- });
3480
- })();
3481
- `}function y7($){return $.includes("data-stx-runtime")}function C7($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let X=Z.exec($);X!==null;X=Z.exec($)){let J=$.slice(Math.max(0,X.index-80),X.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function m5($,Z){let X=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(X!==-1&&(J===-1||X>J))return $.slice(0,X)+Z+`
3482
- `+$.slice(X);let Y=_2($);if(Y!==null)return`${$.slice(0,Y)}
3483
- ${Z}${$.slice(Y)}`;if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Z+`
3484
- `+$.slice(G)}if(Y1($))return b1($,(G)=>`${G}
3485
- ${Z}`);return`${Z}
3486
- ${$}`}async function W9($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve")return m5($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(Z.buildMode==="compile")return m5($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:X}=await import("./chunk-v4f08c2r.js"),J=await X(Z.debug);return m5($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function LY($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function S7($){if($.includes("data-stx-tooltip-runtime")||!LY($))return $;let Z=`<script data-stx-scoped data-stx-tooltip-runtime>${d5()}</script>`,X=$.lastIndexOf("</body>");if(X===-1)return`${$}
3487
- ${Z}`;return`${$.slice(0,X)}${Z}
3488
- ${$.slice(X)}`}var OY=/<script\b[^>]*\sdata-stx-router(?=[\s=>])/i;function FY($){return OY.test($)||$.includes("__stxRouter)return")||$.includes("__stxRouter=true")}async function wY($,Z){if(!$.includes("</body>"))return $;if(FY($))return $;let X=Z?.router,J="";{let z={};if(X){if(X.container)z.container=X.container;if(X.interceptAllLinks!==void 0)z.interceptAllLinks=X.interceptAllLinks;if(X.progress!==void 0)z.progress=X.progress;if(X.viewTransitions!==void 0)z.viewTransitions=X.viewTransitions;if(X.viewTransitionDuration!==void 0)z.viewTransitionDuration=X.viewTransitionDuration;if(X.viewTransitionEasing!==void 0)z.viewTransitionEasing=X.viewTransitionEasing;if(X.scrollToTop!==void 0)z.scrollToTop=X.scrollToTop;if(X.prefetch!==void 0)z.prefetch=X.prefetch;if(X.cache!==void 0)z.cache=X.cache;if(X.progressColor!==void 0)z.progressColor=X.progressColor;if(X.progressHeight!==void 0)z.progressHeight=X.progressHeight}try{let q=await E7(Z?.pagesDir);if(q.length>0)z.ownedRoutes=q}catch{}if(Object.keys(z).length>0)J=`<script>window.__stxRouterConfig=${b7(z)};</script>
3489
- `}let{getCachedRouterScript:Y}=await import("./chunk-v4f08c2r.js"),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+Q+`
3490
- </body>`+$.slice(G+7)}var P7=Symbol.for("stx.lazy-module-promises");function RY(){let $=globalThis;return $[P7]??=new Map,$[P7]}function o($,Z){let X=RY(),J=`${import.meta.url}\x00${$}`,Y=X.get(J);if(Y)return Y;let Q=Z();return X.set(J,Q),Q.catch(()=>{if(X.get(J)===Q)X.delete(J)}),Q}var c5=`(?:"[^"]*"|'[^']*'|[^>"'])*`,u7=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;function DY($,Z={}){let X=[];for(let J of f2($,X1)){let Y=J.token.match(/^<script\b([^>]*)>/i),Q=J.token.match(/<\/script\s*>$/i);if(!Y||!Q)continue;let G=Y[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let z=Y[0].length,q=J.token.length-Q[0].length;X.push({fullMatch:J.token,attrs:G,body:J.token.slice(z,q),start:J.start,end:J.end})}return X}function d7($){let Z=$.trim(),X=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(X){let Y=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:z}=v7(Q);if(G)return{style:"as",iterable:Y,itemVar:G,indexVar:z}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),Q=J[2].trim(),{itemVar:G,indexVar:z}=v7(Y);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function v7($){let Z=$.trim(),X=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(X)return{itemVar:X[2],indexVar:X[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function i5($,Z){return h7($,Z)}function NY($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,X=0,J;while((J=Z.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))X++;else if(Y==="endif")X--;else if(X===0)return!0}return!1}function AY($){let Z=new Set,X=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=X.exec($))!==null){let Q=Y[1],G;while((G=J.exec(Q))!==null)Z.add(G[1])}return Z}function MY($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let Z=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${c5})>`,"iy"),X=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=f2($,(Q,G)=>{Z.lastIndex=G;let z=Z.exec(Q);if(!z||z.index!==G||!X.test(z[2]))return-1;return Z.lastIndex}),Y=[];for(let Q of J){Z.lastIndex=0;let G=Z.exec(Q.token);if(!G)continue;let z=G[2].match(X),q=d7(z?.[1]??z?.[2]??""),K=[q.itemVar,q.indexVar].filter(Boolean);if(K.length===0)continue;let U=G[1],H=/\/\s*>$/.test(Q.token)||j9.has(U.toLowerCase())?Q.end:l7($,Q.start,U,Q.end);if(H!==-1)Y.push({start:Q.start,end:H,vars:new Set(K)})}return Y}var f7=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);function kY($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function x7($,Z,X,J){if(!$)return!1;let Y=kY($),Q=!1,G=!1,z=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let j=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(f7.has(j))continue;if(Z.has(j)||J?.has(j))Q=!0;else if(X&&j in X)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=U.exec(Y))!==null){let j=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(f7.has(j)||X&&j in X)continue;z=!0}return(Q||z)&&!G}function H9($,Z,X){let J=X===void 0?` ${Z}`:` ${Z}="${X.replace(/"/g,"&quot;")}"`,Y=$.trim(),Q=Y.match(u7);if(Q&&IY(Q[3],Q[1])){let[,G,z,q]=Q;return`<${G}${z}${J}>${q}</${G}>`}return`<template${J}>${Y}</template>`}function IY($,Z){let X=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=X.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function m7($,Z){let X=AY($);function J(Y){let Q=Y,G=MY(Y),z=(W)=>{let H=new Set;for(let j of G)if(W>j.start&&W<j.end)for(let B of j.vars)H.add(B);return H},q=/@if\s*\(/g,K,U=[];while((K=q.exec(Q))!==null){let W=K.index,H=W+K[0].length,j=1,B=H;while(B<Q.length&&j>0){if(Q[B]==="(")j++;else if(Q[B]===")")j--;B++}if(j!==0)continue;let _=Q.substring(H,B-1).trim(),O=B,V=1,L=O,F=/@(if\s*\(|endif)/g;F.lastIndex=O;let w;while((w=F.exec(Q))!==null)if(w[1].startsWith("if"))V++;else if(w[1]==="endif"){if(V--,V===0){L=w.index+w[0].length;break}}if(V!==0)continue;let R=Q.substring(O,L-6).trim(),D;if(NY(R)){let A=U2(Q.substring(W,L));if(A.length===0)continue;let k=A[0].branches.filter((I)=>I.type!=="else"),N=z(W);if(!(k.length>0&&k.every((I)=>x7(I.condition,X,Z,N))))continue;D=A[0].branches.map((I)=>{let y=J(I.content);if(I.type==="elseif")return H9(y,"@else-if",I.condition??"");if(I.type==="else")return H9(y,"@else");return H9(y,"@if",I.condition??"")}).join(`
3491
- `)}else{if(!x7(_,X,Z,z(W)))continue;D=H9(J(R),"@if",_)}U.push({start:W,end:L,replacement:D}),q.lastIndex=L}for(let W=U.length-1;W>=0;W--){let{start:H,end:j,replacement:B}=U[W];Q=Q.substring(0,H)+B+Q.substring(j)}return Q}return J($)}function TY($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Y=Number(Z);return Y!==0&&!Number.isNaN(Y)}let X=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(X)return X[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}var j9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function l7($,Z,X,J){if(j9.has(X.toLowerCase()))return J;let Y=X.toLowerCase(),Q=$.toLowerCase(),G=$.length,z=1,q=J;while(q<G){let K=$.indexOf("<",q);if(K===-1)return-1;if(q=K,$.startsWith("<!--",q)){let j=$.indexOf("-->",q+4);if(j===-1)return-1;q=j+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let j=$.indexOf(">",q);if(j===-1)return-1;if($[j-1]==="/"){q=j+1;continue}let B=Q.indexOf(`</${U[1].toLowerCase()}`,q);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!j){q++;continue}if(j[1].toLowerCase()===Y){if(z--,q+=j[0].length,z===0)return q;continue}q+=j[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!W){q++;continue}let H=$.indexOf(">",q);if(H===-1)return-1;if(W[1].toLowerCase()===Y){let j=$.slice(q,H+1);if(!(/\/\s*>$/.test(j)||j9.has(Y)))z++}q=H+1}return-1}var EY=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/;function bY($,Z){let X=Z,J=$.length;for(;;){while(X<J&&$[X]!=="<")X++;if(X>=J)return!1;if($.startsWith("<!--",X)){let G=$.indexOf("-->",X+4);if(G===-1)return!1;X=G+3;continue}break}if($[X+1]==="/")return!1;let Y=$.indexOf(">",X);if(Y===-1)return!1;let Q=$.slice(X,Y+1);return EY.test(Q)}function c7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=X.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Y=(W)=>Z.some(([H,j])=>W>=H&&W<j),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=Q.exec($))!==null){if(Y(z.index))continue;let[W,H,j,B,_,O,V]=z,L=TY(_);if(L===void 0)continue;let F=z.index,w=F+W.length,A=!!V||/\/\s*>$/.test(W)||j9.has(H.toLowerCase())?w:l7($,F,H,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&bY($,A)){Q.lastIndex=w;continue}if(L===!0){let N=`<${H}${j}${O}${V}>`;G.push({start:F,end:w,replacement:N});continue}G.push({start:F,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((W,H)=>W.start-H.start);let q=[],K=-1;for(let W of G){if(W.start<K)continue;q.push(W),K=W.end}let U=$;for(let W=q.length-1;W>=0;W--){let{start:H,end:j,replacement:B}=q[W];U=U.substring(0,H)+B+U.substring(j)}return U}function n5($,Z){let X=$,J=/@(for|foreach)\s*\(/g,Y,Q=[],G=[];while((Y=J.exec(X))!==null){let z=Y[1],q=Y.index,K=q+Y[0].length,U=1,W=K;while(W<X.length&&U>0){if(X[W]==="(")U++;else if(X[W]===")")U--;W++}if(U!==0)continue;let H=X.substring(K,W-1).trim(),j=W,B=d7(H),_=z==="for"?"@endfor":"@endforeach",O=1,V=j,L=z==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${z}\\s*\\(|end${z})`,"g");L.lastIndex=j;let F;while((F=L.exec(X))!==null)if(F[1].startsWith(z))O++;else if(O--,O===0){V=F.index+F[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:V,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let T=M.split(/[.[(]/)[0].trim(),I=Z?T in Z:!1,y=G.some((E)=>q>E.start&&q<E.end&&E.vars.includes(T));if(T&&(I||y)){w();continue}}if(B.style==="as")H=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=X.substring(j,V-_.length).trim(),D=Z?{...Z}:{};if(B.itemVar)delete D[B.itemVar];if(B.indexVar)delete D[B.indexVar];let A=n5(R,D),k=A.match(u7),N;if(k){let[,M,T,I]=k;N=`<${M}${T} @for="${H}">${I}</${M}>`}else N=`<template @for="${H}">${A}</template>`;Q.push({start:q,end:V,replacement:N}),J.lastIndex=V}for(let z=Q.length-1;z>=0;z--){let{start:q,end:K,replacement:U}=Q[z];X=X.substring(0,q)+U+X.substring(K)}return X}function yY($){let Z=new Set,X=[],J=0,Y=0,Q=$.length,G=(U)=>{let W=J+1;while(W<Q){let H=$[W];if(H==="\\"){W+=2;continue}if(H===U)return W+1;W++}return Q},z=()=>{let U=J+2;while(U<Q&&$[U]!==`
3492
- `)U++;return U},q=()=>{let U=J+2;while(U<Q-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return Q},K=(U)=>{let W=U,H=0;while(W<Q){let j=$[W];if(j==="/"&&$[W+1]==="/"){let B=W+2;while(B<Q&&$[B]!==`
3493
- `)B++;W=B;continue}if(j==="/"&&$[W+1]==="*"){let B=W+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;W=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=W+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}W=B;continue}if(j==="("||j==="["||j==="{"){H++,W++;continue}if(j===")"||j==="]"||j==="}"){H--,W++;continue}if(j===";"&&H===0)return W+1;W++}return Q};while(J<Q){let U=$[J];if(U==="/"&&$[J+1]==="/"){let W=z();X.push($.slice(J,W)),J=W;continue}if(U==="/"&&$[J+1]==="*"){let W=q();X.push($.slice(J,W)),J=W;continue}if(U==='"'||U==="'"||U==="`"){let W=G(U);X.push($.slice(J,W)),J=W;continue}if(U==="{"){Y++,X.push(U),J++;continue}if(U==="}"){Y--,X.push(U),J++;continue}if(Y===0){let W=J>0?$[J-1]:"";if(W===""||/\s/.test(W)||W===";"||W==="}"||W==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],_=K(J+j[0].length);if(Z.has(B)){X.push(`/* stx: deduped const ${B} */`),J=_;continue}Z.add(B),X.push($.slice(J,_)),J=_;continue}}}X.push(U),J++}return X.join("")}async function CY($,Z,X){let J=DY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,Q=[],{hasUserImports:G,bundleClientScript:z}=await o("stx/client-script-bundler",()=>import("./chunk-43r6p08p.js"));for(let V of J){let L=V.body;if(F1(V.attrs))L=w1(L);if(Y.test(L)){Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:L});continue}if(!G(L))continue;try{let F=await z(l1(L).code,Z||"",{projectRoot:process.cwd()});if(Y.test(F))Q.push({fullMatch:V.fullMatch,attrs:V.attrs,content:L,bundled:F})}catch{}}if(Q.length===0)return{output:$,setupCode:null};let q=`${Z??""}\x00${Q.map((V)=>V.content).join("\x00")}`,K=`__stx_setup_${Bun.hash(q).toString(36).slice(0,10)}`,U=[];for(let V=0;V<Q.length;V++){let L=Q[V].bundled??l1(Q[V].content).code;if(!Q[V].bundled&&G(L))L=await z(L,Z||"",{projectRoot:process.cwd()});L=fY(L);let F=t0(L);U.push(`// \u2500\u2500 merged signal script #${V+1} \u2500\u2500
3494
- ${F}`)}let W=U.join(`
3495
-
3496
- `);W=yY(W);let H=SY(W),j=H.split(",").map((V)=>V.trim()).filter(Boolean),B=p5(W,X),_=`
3497
- <script data-stx-scoped>
3498
- function ${K}() {
3499
- ${x1("const",j)}
3500
- ${m1(`${B}${W}`)}
3501
- return { ${H} };
3502
- }
3503
- window.__stx_latestSetup=${K};
3504
- if(window.stx)window.stx._latestSetup=${K};
3505
- </script>`,O=$;for(let V of Q)O=O.split(V.fullMatch).join("");if(O.includes("<body"))O=O.replace(new RegExp(`<body(${c5})>`),`<body$1 data-stx="${K}">`);else{let V=["script","style","html","head","meta","link","title","!doctype"],L=!1;O=O.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${c5})>`,"gi"),(F,w,R)=>{if(L||V.includes(w.toLowerCase()))return F;return L=!0,`<${w}${R} data-stx="${K}">`})}return{output:O,setupCode:_}}function SY($){let Z=$,X=[],J=new Set,Y=0,Q=0,G=Z.length,z="",q=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
3506
- `)return;Q++}},K=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},U=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')U(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},H=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
3507
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!J.has(F))X.push(F),J.add(F);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let w=F.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!J.has(A))X.push(A),J.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((F)=>{let w=F.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!J.has(R))X.push(R),J.add(R)});return}let V=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(V){let F=V[1];if(!J.has(F))X.push(F),J.add(F);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!J.has(F))X.push(F),J.add(F)}};while(Q<G){if(H())continue;if(Z[Q]==="'"||Z[Q]==='"'){U(Z[Q]),z=Z[Q-1];continue}if(Z[Q]==="`"){W(),z="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&K()){q(),z="/";continue}if(Z[Q]==="{"){Y++,z="{",Q++;continue}if(Z[Q]==="}"){Y--,z="}",Q++;continue}if(Y===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))j();if(!/\s/.test(Z[Q]))z=Z[Q];Q++}return X.join(", ")}async function p7($,Z,X,J){if(!i5($,X))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:Q,setupCode:G}=await CY(Y,X,J);if(Y=Q,Y=await W9(Y,Z),G){let U=l5(Y,/<\/head>/i),W=U===-1?l5(Y,/<body[^>]*>/i):-1;if(U!==-1)Y=`${Y.slice(0,U)}${G}
3508
- ${Y.slice(U)}`;else if(W!==-1){let H=/<body[^>]*>/i.exec(Y.slice(W))[0],j=W+H.length;Y=`${Y.slice(0,j)}
3509
- ${G}${Y.slice(j)}`}else Y=`${Y}
3510
- ${G}`}let q=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),K=q&&/data-stx/.test(q[1]);if(!G&&!K&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,W=l5(Y,U);if(W!==-1){let H=Y.slice(0,W),j=Y.slice(W).replace(U,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=H+j}}return Y}function l5($,Z){let X=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=X.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let z=Q.exec($.slice(G));if(!z)return-1;let q=G+z.index;if(!J.some(([U,W])=>q>=U&&q<W))return q;G=q+Math.max(z[0].length,1)}return-1}var g7="/* [stx import stripped, resolved via window.stx in __stx_setup] */";function PY($){let Z=[];for(let X of $.split(",")){let J=X.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])Z.push(`${Y[2]} = ${Y[1]}`)}if(Z.length===0)return g7;return`var ${Z.join(", ")}; ${g7}`}var vY=/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm;function fY($){return $.replace(vY,(Z,X)=>PY(X))}import u0 from"path";import o5 from"fs";function i7($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function n7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class o7{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,X,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,Q=J?.__importedComponents;if(Q){let j=[Y,Y.toLowerCase(),i7(Y),n7(Y)];for(let B of j)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${Y}.stx`,`${i7(Y)}.stx`,`${n7(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let j=u0.resolve(u0.dirname(Z),`${Y}.stx`);if(await a(j))return j;return null}let z=[],q=X.componentsDir||"",K=J?.__originalFilePath;if(K)z.push(u0.join(u0.dirname(K),"components"));if(q)z.push(q);let U=u0.join(u0.dirname(Z),"components");if(!z.includes(U))z.push(U);let W=process.cwd(),H=[u0.resolve(W,"src/components"),u0.resolve(W,"components"),u0.resolve(import.meta.dir,"components")];for(let j of H)if(!z.includes(j))z.push(j);for(let j of z){if(!j)continue;for(let B of G){let _=u0.join(j,B);if(await a(_))return _}try{if(!o5.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let _=o5.readdirSync(j,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let V=u0.join(j,O.name);for(let L of G){let F=u0.join(V,L);if(await a(F))return F}}}catch{}}return null}}var y0=new o7;function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var N1="\x00stx-boolean-attribute";function s5($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}function c1($,Z){let X=[];for(let[J,Y]of Object.entries($.static)){if(Z.has(J))continue;let Q=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)X.push(w0(Q));continue}if(Y===N1){X.push(w0(Q));continue}X.push(`${w0(Q)}="${w0(s5(String(Y)))}"`)}return X}function p1($,Z){let X=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(Z.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let Q=$.serverDynamicNames?.[J]??J;if(Y===!0){X.push(w0(Q));continue}if(typeof Y==="object")continue;X.push(`${w0(Q)}="${w0(s5(String(Y)))}"`)}return X}function L2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xY($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var r5={name:"StxLink",aliases:["stx-link"],render($,Z,X){let J=xY($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(J.reactive)q.push(`:href="${L2(J.value)}"`);else q.push(`href="${L2(J.value)}"`);if(Y)q.push(`class="${L2(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${L2(Q)}"`),q.push(`data-stx-exact-active-class="${L2(G)}"`),z)q.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...c1($,K)),q.push(...p1($,K)),`<a ${q.join(" ")}>${Z}</a>`}};import n1 from"fs";import a5 from"path";var gY=new Set([".jpg",".jpeg",".png",".webp",".avif"]),H1=new Map,i1=!1;function s7($){if(!$)return;let Z=$.split("?")[0].split("#")[0];return H1.get(Z)}function GH(){return i1}function zH(){H1.clear(),i1=!1}function qH($,Z){H1.set($,Z),i1=!0}function hY($){let Z=0,X=0,J=0,Y=0;for(let G=0;G<$.length;G+=4)Z+=$[G],X+=$[G+1],J+=$[G+2],Y++;if(Y===0)return"#e5e7eb";let Q=(G)=>Math.round(G/Y).toString(16).padStart(2,"0");return`#${Q(Z)}${Q(X)}${Q(J)}`}function uY($,Z,X,J=4,Y=3){let Q=[];for(let G=0;G<Y;G++)for(let z=0;z<J;z++){let q=Math.floor(z*Z/J),K=Math.max(q+1,Math.floor((z+1)*Z/J)),U=Math.floor(G*X/Y),W=Math.max(U+1,Math.floor((G+1)*X/Y)),H=0,j=0,B=0,_=0;for(let V=U;V<W;V++)for(let L=q;L<K;L++){let F=(V*Z+L)*4;H+=$[F],j+=$[F+1],B+=$[F+2],_++}let O=(V)=>Math.round(V/_).toString(16).padStart(2,"0");Q.push(`<rect x="${z}" y="${G}" width="1" height="1" fill="#${O(H)}${O(j)}${O(B)}"/>`)}return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${J} ${Y}" preserveAspectRatio="none"><filter id="b"><feGaussianBlur stdDeviation=".6"/></filter><g filter="url(#b)">${Q.join("")}</g></svg>`}function dY($){return`data:image/svg+xml;base64,${Buffer.from($,"utf8").toString("base64")}`}function mY($){try{return JSON.parse(n1.readFileSync($,"utf8"))}catch{return{}}}function lY($,Z){try{n1.mkdirSync(a5.dirname($),{recursive:!0}),n1.writeFileSync($,JSON.stringify(Z))}catch{}}function r7($,Z,X=[]){let J;try{J=n1.readdirSync($,{withFileTypes:!0})}catch{return X}for(let Y of J){let Q=a5.join($,Y.name);if(Y.isDirectory()){r7(Q,`${Z}/${Y.name}`,X);continue}if(!gY.has(a5.extname(Y.name).toLowerCase()))continue;X.push([`${Z}/${Y.name}`,Q])}return X}async function KH($,Z={}){let{cachePath:X,maxBytes:J=33554432,limit:Y=2000}=Z;if(!$||!n1.existsSync($))return i1=!0,H1.size;let Q;try{Q=await import("ts-images")}catch{return i1=!0,H1.size}let G=X?mY(X):{},z=!1,q=r7($,"").slice(0,Y),K=8,U=async([W,H])=>{let j;try{j=n1.statSync(H)}catch{return}if(j.size>J)return;let B=G[W];if(B&&B.mtimeMs===j.mtimeMs&&B.size===j.size){H1.set(W,{dataUrl:B.dataUrl,color:B.color});return}try{let{hash:_}=await Q.generateThumbHash(H);if(!_)return;let{rgba:O,w:V,h:L}=Q.thumbHashToRGBA(_),F={dataUrl:dY(uY(O,V,L)),color:hY(O)};H1.set(W,F),G[W]={mtimeMs:j.mtimeMs,size:j.size,...F},z=!0}catch{}};for(let W=0;W<q.length;W+=K)await Promise.all(q.slice(W,W+K).map(U));if(X&&z)lY(X,G);return i1=!0,H1.size}var cY={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},t5=[320,640,768,1024,1280,1536,1920];function V0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function B9($,Z,X=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[Z];if(Y!==void 0)return Y!=="false"&&Y!==!1;return X}function pY($){let Z=(J)=>$.variants.filter((Y)=>Y.format===J).reduce((Y,Q)=>Y+Q.bytes,0),X=Z($.fallback.format);return["avif","webp"].map((J)=>({format:J,srcset:$.sources[J]||"",bytes:Z(J)})).filter((J)=>J.srcset&&J.bytes>0&&J.bytes<X).sort((J,Y)=>J.bytes-Y.bytes).map(({format:J,srcset:Y})=>({format:J,srcset:Y}))}function e5($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),X=[];for(let J of Z)if(J.includes(":")){let[Y,Q]=J.split(":"),G=cY[Y];if(G)X.push(`(max-width: ${G}px) ${Q}`);else{let z=Number.parseInt(Y);if(!Number.isNaN(z))X.push(`(max-width: ${z}px) ${Q}`)}}else X.push(J);return X.join(", ")}function $$($,Z,X,J){return Z.map((Y)=>`${O2($,Y,void 0,X,J)} ${Y}w`).join(", ")}function iY($,Z,X,J,Y){return Z.map((Q)=>{let G=X?X*Q:void 0;return`${O2($,G,void 0,J,Y)} ${Q}x`}).join(", ")}function O2($,Z,X,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(X)Q.push(`h_${X}`);if(Y)Q.push(`f_${Y}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(X)Q.set("h",String(X));if(Y)Q.set("fm",Y);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(J==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(X)Q.set("height",String(X));if(Y)Q.set("format",Y);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function nY($,Z,X="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${X}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var Z$={name:"StxImage",aliases:["Image","stx-image","stx-img"],render($,Z,X){let J=N0($,"src")||"",Y=a7(J),Q=N0($,"alt")||"",G=N0($,"width")||(Y?String(Y.source.width):void 0),z=N0($,"height")||(Y?String(Y.source.height):void 0),q=N0($,"sizes"),K=N0($,"srcset"),U=N0($,"densities"),W=N0($,"format"),H=N0($,"placeholder")||(Y?"thumbhash":void 0),j=N0($,"placeholderColor")||"#e5e7eb",B=N0($,"provider"),_=N0($,"class")||N0($,"className")||"",O=N0($,"style")||"",V=N0($,"quality"),L=B9($,"lazy",!0),F=B9($,"preload",!1),w=B9($,"priority",!1),R=N0($,"loading"),D=N0($,"decoding")||"async",A=!!Y||B9($,"picture",!1)||!!W,k=G?Number.parseInt(G):void 0,N=z?Number.parseInt(z):void 0,M=K||"",T="";if(Y)M=Y.sources[Y.fallback.format]||"",T=q?e5(q):"100vw";else if(!M&&q&&B&&B!=="local"&&B!=="static")M=$$(J,t5,B,W),T=e5(q);else if(!M&&U){let g=U.split(/\s+/).map((x)=>Number.parseFloat(x.replace("x","")));M=iY(J,g,k,B,W)}else if(q)T=e5(q);let I=[];if(O)I.push(O);if(k&&N)I.push(`aspect-ratio:${k}/${N}`);if(H==="blur"||H==="color"||H==="thumbhash"){let g=Y?.placeholder?{dataUrl:Y.placeholder.dataUrl,color:j}:s7(J);if(g&&H==="color")I.push(`background-color:${g.color}`);else if(g)I.push(`background-color:${g.color}`),I.push(`background-image:url(${g.dataUrl})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");else{let x=nY(k||16,N||9,j);I.push(`background-image:url(${x})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}}else if(H&&H!=="empty"&&H!=="none")I.push(`background-image:url(${V0(H)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let y=Y?.fallback.url||O2(J,k,N,B,W),E=[];if(E.push(`src="${V0(y)}"`),E.push(`alt="${V0(Q)}"`),G)E.push(`width="${V0(G)}"`);if(z)E.push(`height="${V0(z)}"`);let b=R||(w||F?"eager":L?"lazy":"");if(b)E.push(`loading="${V0(b)}"`);if(w)E.push('fetchpriority="high"');if(E.push(`decoding="${V0(D)}"`),_)E.push(`class="${V0(_)}"`);if(I.length>0)E.push(`style="${V0(I.join(";"))}"`);if(M)E.push(`srcset="${V0(M)}"`);if(T)E.push(`sizes="${V0(T)}"`);let C=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","priority","picture","loading","decoding"]);E.push(...c1($,C)),E.push(...p1($,C));let v=`<img ${E.join(" ")} />`,P="";if(F){let x=W==="webp"?"image/webp":W==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${V0(y)}"${x?` type="${x}"`:""}${M?` imagesrcset="${V0(M)}"`:""}${T?` imagesizes="${V0(T)}"`:""} />
3511
- `}if(A){let g=[];if(Y)for(let x of pY(Y))g.push(`<source type="image/${x.format}" srcset="${V0(x.srcset)}"${T?` sizes="${V0(T)}"`:""} />`);if(!Y&&(W==="avif"||W==="auto")){let x=O2(J,k,N,B,"avif"),$0=M?$$(J,t5,B,"avif"):`${x}`;g.push(`<source type="image/avif" srcset="${V0($0)}"${T?` sizes="${V0(T)}"`:""} />`)}if(!Y&&(W==="webp"||W==="auto")){let x=O2(J,k,N,B,"webp"),$0=M?$$(J,t5,B,"webp"):`${x}`;g.push(`<source type="image/webp" srcset="${V0($0)}"${T?` sizes="${V0(T)}"`:""} />`)}return`${P}<picture>
3512
- ${g.join(`
3513
- `)}
3514
- ${v}
3515
- </picture>`}return`${P}${v}`}};var t7="/images/safe-image-default.svg";function F2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var oY=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${t7}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,X$={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,X){let J=o1($,"src")||"",Y=o1($,"alt")||"",Q=o1($,"fallback")||t7,G=o1($,"class")||o1($,"className")||"",z=o1($,"fallbackClassName")||"",q=[];if(q.push(`src="${F2(J)}"`),q.push(`alt="${F2(Y)}"`),G)q.push(`class="${F2(G)}"`);if(q.push(`data-fallback="${F2(Q)}"`),z)q.push(`data-fallback-class="${F2(z)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...c1($,K)),q.push(...p1($,K));let U=`<img ${q.join(" ")} />`,W=X.context;if(!W.__safeImageHandlerEmitted)return W.__safeImageHandlerEmitted=!0,`${oY}${U}`;return U}};function J$($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function w2($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function _9($,Z,X){let J=w2($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var Y$={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,X){let J=J$(w2($,"color")||"#6366f1"),Y=J$(w2($,"initialColor")||w2($,"initial-color")||""),Q=J$(w2($,"height")||"3px"),G=_9($,"duration",2000),z=_9($,"throttle",200),q=_9($,"zIndex",999999)||_9($,"z-index",999999),K=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
3516
- <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${K};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3517
- <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
3518
- </div>
3519
- <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3520
- <script>
3521
- (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
3522
- </script>`}};function $6($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}function sY($,Z,X){let J=$6($,Z);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return X}var e7={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},Q$={name:"StxToast",aliases:["stx-toast"],render($,Z,X){let J=w0($6($,"position")||"top-right"),Y=sY($,"max",5),Q=e7[J]||e7["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Y}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3523
- <style>
3524
- @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3525
- @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
3526
- @keyframes stx-toast-in-left{from{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}
3527
- @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3528
- @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3529
- @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3530
- </style>`}};function V9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var Z6={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},G$={name:"StxModal",aliases:["stx-modal"],render($,Z,X){let J=V9($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=w0(J),Q=V9($,"size")||"md",G=V9($,"closeOnBackdrop")!=="false",z=V9($,"closeOnEscape")!=="false",q=Z6[Q]||Z6.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
3531
- <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
3532
- <div style="padding:1.5rem">${Z}</div>
3533
- </div>
3534
- </div>
3535
- <style>
3536
- @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3537
- .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3538
- .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3539
- </style>`}};function s1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let X=$.static[Z];if(typeof X==="string")return X;return}var X6={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},z$={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,X){let J=s1($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=w0(J),Q=s1($,"side")||"right",G=s1($,"size")||"md",z=s1($,"closeOnBackdrop")!=="false",q=s1($,"closeOnEscape")!=="false",K=s1($,"overlay")!=="false",U=X6[G]||X6.md,W=Q==="left",H=W?"left:0":"right:0",j=W?"translateX(-100%)":"translateX(100%)",B=W?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${z}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3540
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${H};width:${U};max-width:100vw;transform:${j};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
3541
- <div style="padding:1.5rem">${Z}</div>
3542
- </div>
3543
- </div>
3544
- <style>
3545
- @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3546
- .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3547
- .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3548
- </style>`}};import{existsSync as rY,readFileSync as aY}from"fs";var A1=new Map,J6=new Set;function Y6($){if(J6.has($))return;J6.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Q6($){let Z=process.cwd();for(let X of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(rY(X))return X;for(let X of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return u.resolve(X)}catch{}return null}function tY($){if(A1.has($))return A1.get($);let Z=Q6($);if(!Z)return Y6($),null;try{let X=JSON.parse(aY(Z,"utf8"));return A1.set($,X.icons),X.icons}catch{return null}}async function eY($,Z=!1){if(A1.has($))return A1.get($);let X=Q6($);if(!X){if(!Z)Y6($);return null}try{let J=await Bun.file(X).json();return A1.set($,J.icons),J.icons}catch{return null}}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var q$={name:"Icon",aliases:["icon","stx-icon"],render($,Z,X){let J=r1($,"name")??r1($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",Q=J;if(J.includes(":")){let L=J.split(":");Y=L[0],Q=L[1]}let G=w0(r1($,"size")||"24"),z=w0(r1($,"color")||"currentColor"),q=w0(r1($,"class")||""),K=w0(r1($,"style")||""),U=A1.get(Y)??tY(Y);if(!U)return`<!-- Icon: collection "${Y}" not loaded -->`;let W=U[Q];if(!W)return`<!-- Icon: "${Q}" not found in ${Y} -->`;let H=W.width||24,j=W.height||24,B=`0 0 ${H} ${j}`,_=W.body;if(z!=="currentColor")_=_.replace(/currentColor/g,z);let O=q?` class="${q}"`:"",V=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${V}>${_}</svg>`}};async function $Q($="lucide",Z={}){await eY($,Z.speculative??!0)}function G6($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}function z6($,Z){let X=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(X);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var K$={name:"Suspense",aliases:["suspense"],render($,Z,X){let J=z6(Z,"fallback"),Y=J.rest,Q=z6(Y,"error"),G=Q.rest,z=J.region??G6($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??G6($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}};function L9($,...Z){for(let X of Z){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let J=$.static[X];if(typeof J==="string")return J}return}var U$={name:"TransitionGroup",aliases:["transition-group"],render($,Z,X){let J=(L9($,"name")||"v").replace(/["'<>]/g,""),Y=(L9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=L9($,"class"),G=L9($,"id"),z=[`data-stx-transition-group="${J}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Y} ${z}>${Z}</${Y}>`}};function q6(){y0.registerBuiltin(r5),y0.registerBuiltin(Z$),y0.registerBuiltin(X$),y0.registerBuiltin(Y$),y0.registerBuiltin(Q$),y0.registerBuiltin(G$),y0.registerBuiltin(z$),y0.registerBuiltin(q$),y0.registerBuiltin(K$),y0.registerBuiltin(U$)}function O9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}var K6=new Map;function ZQ($){let Z=K6.get($.source);if(!Z)Z=new RegExp(`(${$.source})(?![\\w.:-])`,"y"),K6.set($.source,Z);return Z}var U6=new WeakMap;function W6($){let Z=U6.get($);if(!Z)Z=new Set([...$].map((J)=>J.toLowerCase())),U6.set($,Z);let X=Z;return(J)=>!/[a-z]/.test(J)&&X.has(J.toLowerCase())}function H6($,Z,X){let J=[],Y=0,Q=typeof X==="function"?X:X?(G)=>X.has(G.toLowerCase()):void 0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let z=ZQ(Z);z.lastIndex=G+1;let q=z.exec($);if(!q){Y=G+1;continue}let K=q[1];if(Q&&Q(K)){let O=G+1+K.length;while(O<$.length&&$[O]!==">")O++;Y=O+1;continue}let U=G+1+K.length,W=null,H=U,j=-1,B=!1;while(U<$.length){let O=$[U];if(W){if(O==="\\"&&U+1<$.length){U+=2;continue}if(O===W)W=null;U++;continue}if(O==='"'||O==="'"){W=O,U++;continue}if(O==="/"&&U+1<$.length&&$[U+1]===">"){j=U+2,B=!0;break}if(O===">"){j=U+1;break}U++}if(j===-1){Y=G+1;continue}let _=$.slice(H,B?j-2:j-1).trim();if(B)J.push({fullMatch:$.slice(G,j),tagName:K,attributes:_,content:"",startIndex:G,endIndex:j,isSelfClosing:!0}),Y=j;else{let O=`<${K}`,V=`</${K}>`,L=1,F=j,w=-1;while(L>0&&F<$.length){let A=$.indexOf(O,F),k=$.indexOf(V,F);if(k===-1)break;if(A!==-1&&A<k){let N=$[A+O.length];if(N===" "||N===">"||N==="/"||N===`
3549
- `||N==="\t")L++;F=A+O.length}else{if(L--,L===0){w=k;break}F=k+V.length}}if(w===-1){Y=j;continue}let R=$.slice(j,w),D=w+V.length;J.push({fullMatch:$.slice(G,D),tagName:K,attributes:_,content:R,startIndex:G,endIndex:D,isSelfClosing:!1}),Y=D}}return J}function j6($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function B6($,Z){try{let X=Buffer.from($,"base64").toString("utf8");return JSON.parse(X)}catch{}try{let X=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(X)}catch(X){if(Z?.debug)console.error("Error decoding __stx_ prop:",X);return $}}import w9 from"fs";import x0 from"path";var _6=!1,V6=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","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","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);function XQ($,Z,X,J=!1){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Q=new Set(Array.isArray(Z.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),G=(U)=>{if(Q.size===0)return!1;let W=l0(U),H=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(H&&Q.has(H))return!0;for(let j of Q){let B=j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},z=new Set(w6),q=(U)=>{if(!U.includes("-")||U.startsWith("@")||U.startsWith(":")||U.startsWith("x-")||U.startsWith("__"))return U;if(U.startsWith("aria-")||U.startsWith("data-"))return U;return U.replace(/-([a-z0-9])/g,(W,H)=>H.toUpperCase())},K=(U,W)=>{let H=q(U);if(Y.static[H]=W,H!==U)Y.staticNames[H]=U};for(let[U,W]of Object.entries($)){let H=U.startsWith("x-")&&!z.has(U)&&!U.startsWith("x-bind:")&&!U.startsWith("x-on:")?`:${U.slice(2)}`:U;if(H.startsWith("@")){Y.events[H]=W;continue}if(H.startsWith("__stx_")){let j=q(H.slice(6));Y.serverDynamic[j]=B6(W,X);continue}if(H.startsWith(":")){let j=q(H.slice(1)),B=W===N1?j:W;if(j==="if"||j==="for"||j==="show"){Y.clientReactive[j]=B;continue}if(J){Y.clientReactive[j]=B;continue}if(G(B)){Y.clientReactive[j]=B;continue}try{if(!z0(B)){if(X.debug)console.error(`Unsafe expression in :${j} binding: ${B}`);Y.clientReactive[j]=B;continue}let _=Object.keys(Z),V=U0(B,_)(...Object.values(Z));if(V===void 0){let L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(Q9(B).some((w)=>!L.has(w)&&!_.includes(w))){Y.clientReactive[j]=B;continue}}if(Y.serverDynamic[j]=V,j!==H.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[j]=H.slice(1)}catch{Y.clientReactive[j]=B}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let j=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(j)try{let B=j[1];if(z0(B)){let O=U0(B,Object.keys(Z))(...Object.values(Z));K(H,O!=null?String(O):"")}else{if(X.debug)console.error(`Unsafe expression in ${H}: ${B}`);K(H,W)}}catch(B){if(X.debug)console.error(`Error evaluating expression for ${H}:`,B);K(H,W)}else{let B=W,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,O;while((O=_.exec(W))!==null)try{let V=O[1];if(!z0(V)){if(X.debug)console.error(`Unsafe expression in ${H}: ${V}`);continue}let F=U0(V,Object.keys(Z))(...Object.values(Z));B=B.replace(O[0],String(F??""))}catch(V){if(X.debug)console.error(`Error evaluating expression in ${H}:`,V)}K(H,B)}continue}K(H,W===N1?"true":j6(W))}return Y}var JQ=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];function YQ($,Z,X){if(!$.includes("@"))return $;if(!JQ.some(([Y,Q])=>Y.test($)&&$.includes(Q)))return $;try{return $1($,Z,X)}catch{return $}}function QQ($){let Z={},X=0,J=$.length;while(X<J){while(X<J&&/\s/.test($[X]))X++;if(X>=J)break;let Y="";while(X<J&&!/[\s=]/.test($[X]))Y+=$[X],X++;if(!Y)break;while(X<J&&/\s/.test($[X]))X++;if(X<J&&$[X]==="="){X++;while(X<J&&/\s/.test($[X]))X++;let Q="";if(X<J&&($[X]==='"'||$[X]==="'")){let G=$[X];X++;while(X<J){let z=$[X];if(z==="\\"&&X+1<J){X++,Q+=$[X],X++;continue}if(z===G){X++;break}Q+=z,X++}}else while(X<J&&!/\s/.test($[X]))Q+=$[X],X++;Z[Y]=Q}else Z[Y]=N1}return Z}function L6($){return Object.entries($).map(([Z,X])=>X===N1?Z:`${Z}="${GQ(X)}"`).join(" ")}function GQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function zQ($){let Z=new Set,X=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=X.exec($))!==null){let Y=J[1];if(y0.isBuiltin(Y))Z.add(Y)}return[...Z].sort()}var O6=new Map;function qQ($){let Z=O6.get($);if(Z)return Z;let X=new Map,J=[x0.join($,"src"),x0.join($,"dist"),$];function Y(Q,G){if(G>6)return;let z;try{z=w9.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of z){let K=x0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(K,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!X.has(U))X.set(U,K);let W=U.toLowerCase();if(!X.has(W))X.set(W,K);let H=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!X.has(H))X.set(H,K)}}}for(let Q of J)if(Y(Q,0),X.size>0)break;return O6.set($,X),X}function KQ($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let X=Z;while(!0){let J=x0.join(X,"node_modules",$);try{if(w9.statSync(J).isDirectory())return J}catch{}let Y=x0.dirname(X);if(Y===X)return null;X=Y}}async function UQ($,Z,X,J,Y){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=x0.dirname(X),z=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return z=z.replace(q,(K,U,W)=>{let H=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=W,B,_=[];while((B=H.exec(W))!==null){let[O,V,L,F]=B,w=null,R=null;if(F.startsWith(".")||F.startsWith("/")){let k=x0.resolve(G,F);if(k.endsWith(".stx"))R=k;else{let N=`${k}.stx`;try{if(w9.statSync(N).isFile())R=N}catch{try{if(w9.statSync(k).isDirectory())w=k}catch{}}}}else w=KQ(F,G);if(!w&&!R)continue;let D=!1,A=(k,N)=>{Q.set(k,N),Q.set(k.toLowerCase(),N);let M=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(M,N),Y.add(N)};if(L&&R)A(L,R),D=!0;else if(V){let k=V.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let T=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(T)return{source:T[1],local:T[2]};return{source:M,local:M}}),N=w?qQ(w):null;for(let{source:M,local:T}of k){let I=null;if(R)I=R;else if(N)I=N.get(M)??N.get(M.toLowerCase())??N.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)A(T,I),D=!0}}if(D)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return K;for(let O=_.length-1;O>=0;O--)j=j.slice(0,_[O].start)+j.slice(_[O].end);return`<script${U}>${j}</script>`}),z}async function WQ($,Z,X,J,Y){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=z.exec(Q))!==null){let[K,U]=q,W=U.split(",").map((H)=>H.trim().replace(/^['"]|['"]$/g,"")).filter((H)=>H.length>0);for(let H of W){let j=H.split("/"),_=j[j.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),V=null,L=[x0.resolve(x0.dirname(X),`${H}.stx`),x0.resolve(x0.dirname(X),H),x0.resolve(J.componentsDir||"components",`${H}.stx`),x0.resolve(J.componentsDir||"components",H),H.endsWith(".stx")?H:`${H}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){V=F;break}}catch{}if(V){G.set(O,V),G.set(_,V),G.set(_.toLowerCase(),V);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(F,V),Y.add(V),J.debug)console.log(`Imported component: ${O} -> ${V}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${H}`)}Q=Q.replace(K,""),z.lastIndex=0}return Q}async function HQ($,Z,X,J,Y){let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=/@component\s*\(/g,K;while((K=q.exec(Q))!==null){let U=K.index,W=U+K[0].length-1,H=1,j=W+1;while(j<Q.length&&H>0){if(Q[j]==="(")H++;else if(Q[j]===")"){if(H--,H===0)break}j++}if(H!==0)break;let B=Q.substring(W+1,j),_=j+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let V=O[1],L,F=B.slice(O[0].length),w=F.match(/^\s*,\s*/);if(w)L=F.slice(w[0].length).trim();let R={};if(L)try{R=I0(L,Z)}catch(T){let I=T instanceof Error?T.message:String(T);Q=Q.replace(Q.substring(U,_),`[Error parsing component props: ${I}]`);continue}let D="",A=_,N=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(N)D=N[1].trim(),A=_+N[0].length;let M=await D1(V,R,D,G,Z,X,J,z,Y);Q=Q.substring(0,U)+M+Q.substring(A),q.lastIndex=0}return Q}async function jQ($,Z,X,J,Y){if(!$)return $;let Q=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,q=n0(Q);Q=q.output;let K=T5(Q);return Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0,W6(V6)),Q=await j(Q,/[a-z][a-z0-9]*/,!1,V6),Q=E1(Q,q.scripts),Q;async function j(B,_,O,V){if(!B)return B;let L=B,F=H6(L,_,V),w=new Map;for(let A=F.length-1;A>=0;A--){let k=F[A],N=O?O9(k.tagName):k.tagName,M=QQ(YQ(k.attributes,Z,X)),T=K.some(([P,g])=>k.startIndex>=P&&k.startIndex<g),I=XQ(M,Z,J,T),y=y0.getBuiltin(k.tagName),E=y?await F9(N,G,Z,X,J):!1;if(y&&!E){let P={context:Z,filePath:X,options:J,dependencies:Y},g=y.render(I,k.content,P);if(Object.keys(I.events).length>0){let x=L6(I.events);g=g.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${x}`)}if(Object.keys(I.clientReactive).length>0)g=F6(g,I.clientReactive);w.set(A,g);continue}if(!O&&k.tagName.includes("-")&&!await F9(N,G,Z,X,J))continue;let b={};for(let[P,g]of Object.entries(I.static))b[P]=g;for(let[P,g]of Object.entries(I.serverDynamic))b[P]=g;let v=await D1(N,b,E1(k.content,q.scripts),G,Z,X,J,z,Y);if(Object.keys(I.events).length>0){let P=R6(v);if(P){let g=L6(I.events),x=Object.keys(I.events).map(($0)=>$0.replace(/^@/,"").split(".")[0]).join(" ");v=v.substring(0,P.insertPos)+` data-stx-parent-events="${x}" ${g}`+v.substring(P.insertPos)}}if(Object.keys(I.clientReactive).length>0)v=F6(v,I.clientReactive);w.set(A,v)}if(w.size===0)return L;let R="",D=0;for(let A=0;A<F.length;A++){let k=w.get(A);if(k===void 0)continue;R+=L.slice(D,F[A].startIndex),R+=k,D=F[A].endIndex}return R+=L.slice(D),R}}function F6($,Z){let X=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(Z).filter(([U])=>!X.has(U)),Q=Y.filter(([U])=>!J.has(U)).map(([U])=>O9(U)).join(" "),G=$,z=Y.length>0?R6(G):null;if(z){let U=Y.map(([H,j])=>`:${O9(H)}="${j.replace(/"/g,"&quot;")}"`).join(" "),W=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,z.insertPos)+`${W} ${U}`+G.substring(z.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let K=Z.for;if(K)G=`<template :for="${K.replace(/"/g,"&quot;")}">${G}</template>`;return G}function R6($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let X=0;while(X<$.length){let J=$.slice(X),Y=J.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",X+4);if(z===-1)return null;X=z+3;continue}let Q=J.match(/^<(script|style)\b[^>]*>/i);if(Q){let z=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(z,X+Q[0].length);if(q===-1)return null;X=q+z.length;continue}let G=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:X+1+G[1].length}}return null}async function W$($,Z,X,J,Y){if(!_6)q6(),_6=!0;let Q=await UQ($,Z,X,J,Y);Q=await WQ(Q,Z,X,J,Y),Q=await HQ(Q,Z,X,J,Y);let G=[];for(let z=0;z<3;z++){let q=i0(Q,X2,(U,W)=>`\x00STX_COMPONENT_COMMENT_${G.length+W}\x00`);G.push(...q.tokens);let K=Q;if(Q=await jQ(q.output,Z,X,J,Y),Q===K)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(z,q)=>G[Number(q)]??"");if(J.debug){let z=zQ(Q);if(z.length>0)console.warn(`[stx] ${X}: unresolved component tag(s) after render passes: ${z.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}import t1 from"path";import D6 from"process";function a1($="STX_PUBLIC_"){let Z={},X={};for(let[J,Y]of Object.entries(D6.env)){if(!J.startsWith($)||Y===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Y),X[J]=Y}return Z["import.meta.env"]=JSON.stringify(X),Z}function Fj($="STX_PUBLIC_"){let Z={};for(let[X,J]of Object.entries(D6.env))if(X.startsWith($)&&J!==void 0)Z[X]=J;return Z}function N6($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function A6($,Z,X){try{let J;if($.startsWith("/")){let Y=Z;for(let Q=0;Q<5;Q++){let G=t1.join(Y,$);if(await Bun.file(G).exists())return G;Y=t1.dirname(Y)}J=t1.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=t1.resolve(Z,$);else J=t1.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function M6($,Z,X){let J=$,Y=t1.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(J))!==null){let[K,U,W,H]=G;if(N6(W))continue;let j=await A6(W,Y,Z);if(j)try{let B=await Bun.file(j).text();if(X.add(j),W.endsWith(".ts")||W.endsWith(".tsx")){let O=await Bun.build({entrypoints:[j],target:"browser",minify:!0,define:a1()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
3550
- // Source: ${W}
3551
- ${B}
3552
- </script>`;J=J.replace(K,_),Q.lastIndex=0}catch(B){}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=z.exec(J))!==null){let[K,U,W,H]=q,j=U+H;if(N6(W))continue;if(/rel=["']stylesheet["']/.test(j)||W.endsWith(".css")){let _=await A6(W,Y,Z);if(_)try{let O=await Bun.file(_).text();X.add(_);let V=`<style>
3553
- /* Source: ${W} */
3554
- ${O}
3555
- </style>`;J=J.replace(K,V),z.lastIndex=0}catch(O){}}}return J}function H$($,Z){let X=$,J=/@json\s*\(/g,Y;while((Y=J.exec(X))!==null){let Q=Y.index,G=Q+Y[0].length-1,z=1,q=G+1,K=null,U=!1;while(q<X.length&&z>0){let F=X[q];if(U){U=!1,q++;continue}if(F==="\\"&&K){U=!0,q++;continue}if(K){if(F===K)K=null;q++;continue}if(F==='"'||F==="'"||F==="`"){K=F,q++;continue}if(F==="(")z++;else if(F===")"){if(z--,z===0)break}q++}if(z!==0)break;let W=X.substring(G+1,q).trim(),H=X.substring(Q,q+1),j=-1,B=0,_=null,O=!1;for(let F=0;F<W.length;F++){let w=W[F];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){j=F;break}}let V=j>=0?W.substring(0,j).trim():W,L=j>=0?W.substring(j+1).trim():void 0;try{let F=V.trim(),w;if(z0(F))w=U0(F,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let D=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");X=X.substring(0,Q)+D+X.substring(q+1),J.lastIndex=Q+D.length}catch(F){s0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=Q+H.length}}return X}function j$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function k6($){let Z=$,X=/@memo\s*\(/g,J,Y=[];while((J=X.exec(Z))!==null){let Q=J.index,G=Q+J[0].length,z=1,q=G;while(q<Z.length&&z>0){if(Z[q]==="(")z++;else if(Z[q]===")")z--;q++}if(z!==0)continue;let K=Z.slice(G,q-1).trim(),U=q,W=Z.slice(U),H=W.indexOf("@endmemo");if(H===-1)continue;let j=W.slice(0,H),B=U+H+8,_=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,V=j.slice(O),L=j.match(/(\s*)$/),F=L?L[0].length:0,w=V.slice(0,V.length-F),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),D;if(R){let[A,k,N="",M]=R,T=`<${k}${N} data-stx-memo="${K}"${M}>`;D=j.slice(0,O)+T+w.slice(A.length)+j.slice(O+w.length)}else D=`${j.slice(0,O)}<div data-stx-memo="${K}">${w}</div>${j.slice(O+w.length)}`;Y.push({start:Q,end:B,replacement:D}),X.lastIndex=B}for(let Q=Y.length-1;Q>=0;Q--){let G=Y[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function B$($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}var BQ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),I6=/(?:^|\s)x-no-cloak(?:=|\s|\/|>|$)/;function _Q($,Z){let X=!1,J=!1;for(let Y=Z;Y<$.length;Y++){let Q=$[Y];if(X){if(Q==="'")X=!1}else if(J){if(Q==='"')J=!1}else if(Q==="'")X=!0;else if(Q==='"')J=!0;else if(Q===">")return Y}return-1}function VQ($,Z){let X=0,J="",Y=Z;while(Y<$.length){let Q=$[Y];if(Q!=="<"){if(X===0)J+=Q;Y++;continue}if($.startsWith("<!--",Y)){let K=$.indexOf("-->",Y);Y=K===-1?$.length:K+3;continue}let G=_Q($,Y);if(G===-1)break;let z=$.slice(Y,G+1),q=/^<\/?\s*([a-z][\w-]*)/i.exec(z)?.[1]?.toLowerCase()??"";if(z[1]==="/"){if(X===0)break;X--}else if(!/\/\s*>$/.test(z)&&!BQ.has(q))X++;Y=G+1}return J}function T6($){let X=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Y=0,Q;while((Q=X.exec($))!==null){let G=Q.index,z=G+Q[0].length,q=!1,K=!1,U=-1;while(z<$.length){let j=$[z];if(q){if(j==="'")q=!1}else if(K){if(j==='"')K=!1}else if(j==="'")q=!0;else if(j==='"')K=!0;else if(j===">"){U=z;break}z++}if(U===-1)continue;let W=$.slice(G,U+1);if(I6.test(W))continue;if(W.includes("x-cloak"))continue;let H=VQ($,U+1);if(/\{\{[\s\S]*?\}\}/.test(H))J+=$.slice(Y,U)+" x-cloak>",Y=U+1}return J+=$.slice(Y),J}var LQ=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/,OQ=/<\/script>/gi,FQ=/<\/style>/gi;function E6($){let Z=/<[a-z][\w-]*/gi,X="",J=0,Y;while((Y=Z.exec($))!==null){let Q=Y.index,G=Y[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=G==="script"?OQ:FQ;B.lastIndex=Q;let _=B.exec($);if(_!==null)Z.lastIndex=_.index+_[0].length;continue}let z=Q+Y[0].length,q=!1,K=!1,U=-1;while(z<$.length){let B=$[z];if(q){if(B==="'")q=!1}else if(K){if(B==='"')K=!1}else if(B==="'")q=!0;else if(B==='"')K=!0;else if(B===">"){U=z;break}z++}if(U===-1)continue;let W=$.slice(Q+Y[0].length,U);if(I6.test(W))continue;if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(W))continue;if(!LQ.test(W))continue;let H=$[U-1]==="/",j=H?U-1:U;X+=`${$.slice(J,j)} x-cloak${H?" ":""}`,J=j}return X+=$.slice(J),X}var _$=e1(256),wQ=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}];function V$($,Z,X,J){let Y=typeof X==="boolean"?{enabled:X,failOnViolation:X}:X??{enabled:!1};if(!Y.enabled)return;let Q=M1($,Z,J,JSON.stringify(Y)),G=_$.get(Q);if(G!==void 0){if(G&&Y.failOnViolation)throw Error(G);return}let z=Y.allowPatterns??[],q=[],K=l0($.replace(/\{\{--[\s\S]*?--\}\}/g,(j)=>j.replace(/[^\n]/g," ")));for(let{pattern:j,message:B,suggestion:_}of wQ){if(z.some((V)=>/\w/.test(V)&&B.includes(V)))continue;j.lastIndex=0;let O=K.match(j);if(O&&O.length>0){let V=K.split(`
3556
- `),L=$.split(`
3557
- `),F=[];V.forEach((A,k)=>{if(j.lastIndex=0,j.test(A))F.push(k+1)});let w=F.length>0?` (script line${F.length>1?"s":""} ${F.join(", ")})`:"",R=F.slice(0,3).map((A)=>` ${A} | ${(L[A-1]??"").trim().slice(0,100)}`).join(`
3558
- `),D=R?`
3559
- ${R}`:"";q.push(` \u2717 ${B}${w}
3560
- \u2192 ${_}${D}`)}}if(q.length===0){_$.set(Q,"");return}let U=(j)=>{let B=`${process.cwd()}/`;return j.startsWith(B)?j.slice(B.length):j},H=`[STX] DOM API violation in ${J&&J!==Z?`${U(J)} (composed into ${U(Z)})`:U(Z)}:
3561
- ${q.join(`
3562
- `)}
3563
- Tip: prefer useRef(), navigate(), and composables for component code`;if(_$.set(Q,H),Y.failOnViolation)throw Error(H);else console.warn(H)}AQ();import L$ from"path";var RQ=/(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(\.\.?\/[^'"]*)\2/g,DQ=/(<script\b[^>]*>)([\s\S]*?)(<\/script>)/gi;function NQ($,Z){if(!Z||!$.includes("/"))return $;let X=L$.dirname(Z);return $.replace(RQ,(J,Y,Q,G)=>{let z=L$.resolve(X,G);return`${Y}${Q}${z.split(L$.sep).join("/")}${Q}`})}function b6($,Z){if(!Z||!$.includes("<script"))return $;return $.replace(DQ,(X,J,Y,Q)=>`${J}${NQ(Y,Z)}${Q}`)}var k1="<!--PARENT_CONTENT_PLACEHOLDER-->";function y6($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kQ($,Z){let X=$.length,J=Z,Y=!0,Q=[],G=(z)=>z+9<=X&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(J<X){let z=$[J];if(G(J))return J;if(z==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
3564
- `,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(z==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Y=!0;continue}if(z==="/"&&Y){let q=J+1,K=!1;while(q<X){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")K=!0;else if(U==="]")K=!1;else if(U==="/"&&!K){q++;break}else if(U===`
3565
- `){q=-1;break}q++}if(q===-1){J++,Y=!1;continue}while(q<X&&/[a-z]/.test($[q]))q++;J=q,Y=!1;continue}if(z==="'"||z==='"'){let q=z;J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
3566
- `)break;J++}Y=!1;continue}if(z==="`"){J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}if(Q.length===0)Y=!1;continue}if(z==="}"&&Q.length>0){Q.pop(),J++;while(J<X){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){Q.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Y=!1;else Y=!0;J++}return-1}function n6($,Z){let X=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${X}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,Q=$.indexOf("</script>",Y);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:J.index,end:G+1}}var C6=/<style\b[^>]*>/iy,S6=/<\/style>/gi,P6=/<script\b[^>]*>/iy;function v6($){let Z=0;while(Z<$.length){let X=$.indexOf("<",Z);if(X===-1)return-1;if($.startsWith("<!--",X)){let Y=$.indexOf("-->",X+4);Z=Y===-1?$.length:Y+3;continue}C6.lastIndex=X;let J=C6.exec($);if(J){S6.lastIndex=X+J[0].length;let Y=S6.exec($);Z=Y===null?$.length:Y.index+8;continue}if(P6.lastIndex=X,P6.test($))return X;Z=X+1}return-1}function IQ($){let Z=n6($,"data-stx-runtime");if(!Z)return $;let X=v6($);if(X===-1||X===Z.start)return $;let J=$.slice(Z.start,Z.end),Y=$.slice(0,Z.start)+$.slice(Z.end),Q=v6(Y);if(Q===-1)return J+`
3567
- `+Y;return Y.slice(0,Q)+J+`
3568
- `+Y.slice(Q)}async function O$($,Z,X,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=J1($,X);let Q=!Z.__stxProcessingDepth;if(Q)v$(Z),Z.__stx_head_injections=C5(),Z.__stx_seo_staged=!1;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!e2()&&!$9())&&X&&X.endsWith(".stx"))i6($,X);try{return await l6.timeAsync("template-processing",async()=>{let G=await TQ($,Z,X,J,Y);if(Q)G=B$(G);if(Q&&J.autoShell&&J.buildMode!=="compile"){let z=J.app?.head||{},K=(Z.__stx_runtime_head||null)??p6(),U=(Z.__stx_head_raw||"").trim(),W,H=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(H)W=H[1].trim(),U=U.replace(H[0],"").trim();let j=Z.__sections?.title,B=K.title||W||j,_=!K.title&&(!!W||!!j),O=K.meta||[],V=new Set(O.map((A)=>d1(A)).filter(Boolean)),L={...z,...B&&{title:B},meta:[...(z.meta||[]).filter((A)=>!V.has(d1(A))),...O],link:[...z.link||[],...K.link||[]],script:[...z.script||[],...K.script||[]],headRaw:[z.headRaw,U].filter(Boolean).join(`
3569
- `),...K.htmlAttrs&&{htmlAttrs:D7(z.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...K.bodyAttrs}}},F=h5(G);if(G=M7(G,L,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)G=A7(G,z),G=N7(G,L.htmlAttrs);let w=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(w&&G.includes("<head")){let A=w[1],k=m6(A);G=G.replace(/<head\b[^>]*>/i,(N)=>`${N}
3570
- <meta name="stx-layout" content="${y6(A)}">
3571
- <meta name="stx-layout-group" content="${y6(k)}">`)}let R=G.match(/function (__stx_setup_\w+)\(/),D=R?Y1(G):null;if(R&&D&&!/\bdata-stx=/.test(D.tag)){G=b1(G,(k,N)=>`<body${N} data-stx="${R[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${R[1]}"`,"i");G=G.replace(A,"$1")}}if(Q){let z=Z.__stx_head_injections??C5(),q=x5(G);if(q!==null)z.beforeClose.push(q);let K=f5(G);if(K!==null)z.afterOpen.push(K);G=B7(G,z);let U=J.app?.colorMode;if(U)G=L7(G,U);G=IQ(G)}if(Q){let z=n6(G,"data-stx-runtime");if(z){let q=null,K=null,U=null;try{let{getStoreScript:H}=await o("stx/store-loader",()=>import("./chunk-7gbwa2ph.js")),j=J.storesDir,B=await H(j);if(B)q=`<script data-stx-stores>${B}</script>`}catch{}try{let{getFrameworkComposableScript:H}=await o("stx/framework-composables",()=>import("./chunk-d10btecr.js"));U=await H(G)}catch{}try{let{getComposableScript:H}=await o("stx/composable-loader",()=>import("./chunk-492g6g4g.js")),j=J.composablesDir,B=[q,U].filter((O)=>O!==null),_=await H(j,G,B);if(_)K=`<script data-stx-composables>${_}</script>`}catch{}let W=[q,K,U].filter((H)=>H!==null).map((H)=>`
3572
- ${H}`).join("");if(W)G=G.slice(0,z.end)+W+G.slice(z.end)}}if(Q)G=O7(G);if(Q&&Z.__stx_inject_css!==!1)G=await c6(G,void 0,J.buildMode==="serve");if(Q)G=H7(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof x6)throw G;let z=G instanceof Error?G.message:String(G),q=new R2(`Template processing failed: ${z}`,X,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(s0.log(q,{filePath:X,context:Z}),h6.logDetailedError(q,{filePath:X,template:$.substring(0,500)}),J.debug)throw q;return g6.createFallbackContent("Template Processing",q)}}async function TQ($,Z,X,J,Y){let Q=process.cwd(),G={...J,partialsDir:J.partialsDir&&!A0.isAbsolute(J.partialsDir)?A0.resolve(Q,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!A0.isAbsolute(J.componentsDir)?A0.resolve(Q,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!A0.isAbsolute(J.layoutsDir)?A0.resolve(Q,J.layoutsDir):J.layoutsDir},z=G,q=$;await yQ(X,Z),bQ(Z,z),q=await D2(()=>i4(q,Z,X,z),q,(F)=>{s0.log(F,{filePath:X,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${X}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=i0(q,X2,(F,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=K.output;let U=K.tokens,W=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>U[Number(R)]??""),H="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,H),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,w)=>{return`{{ ${w} }}`}),q=$7(q),q=await M6(q,X,Y);let j={};q=A5(q,j);let B={...Z.__sections||{}},_="",O=H3(W3($)),V=/@nolayout\b/.test(q)||O===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(q))q=`@section('content')
3573
- ${q.trim()}
3574
- @endsection`}if(!_&&!V&&z.defaultLayout){let F=g5(q),w=/@section\s*\(/.test(q);if(!F||w){let R="",D=A0.dirname(X),A=z.layoutsDir?A0.dirname(z.layoutsDir):process.cwd();for(let k=0;k<20;k++){let N=A0.join(D,"_layout.stx");if(await a(N)){R=N;break}let M=A0.dirname(D);if(M===D||M.length<A.length)break;D=M}if(R)_=R;else if(z.layoutsDir){let k=A0.isAbsolute(z.layoutsDir)?z.layoutsDir:A0.resolve(process.cwd(),z.layoutsDir),N=A0.join(k,`${z.defaultLayout}.stx`);if(await a(N))_=N}if(_&&!w)q=`@section('content')
3575
- ${q.trim()}
3576
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return F;try{let D=e(R.trim(),Z);if(D===void 0)return F;return B[w]=String(D??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",k1);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=M5(q,j),_){let F=[],w=n0(q),R=i0(w.output,T1,(D,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(D,A,k)=>{let N=A==="SCRIPT"?w.scripts[Number(k)]:R.tokens[Number(k)];if(N)F.push(N);return""}),F.length>0){let D=F.join(`
3577
- `);B.content=B.content?`${B.content}
3578
- ${D}`:D,Z.__sections=B}}if(_)try{let F;if(A0.isAbsolute(_))F=_,Y.add(_);else F=await D2(()=>c2(_,X,G,Y),null,()=>{throw new R2(`Failed to resolve layout path: ${_}`,X,void 0,void 0,`Layout referenced from ${X}`)});if(!F){let N=(I)=>{if(!I)return[];try{let y=A0.isAbsolute(I)?I:A0.resolve(process.cwd(),I);return MQ.readdirSync(y).filter((E)=>E.endsWith(".stx")).map((E)=>E.replace(/\.stx$/,""))}catch{return[]}},M=[...N(G.layoutsDir),...N(G.fallbackLayoutsDir)].filter((I,y,E)=>E.indexOf(I)===y).sort(),T=`Layout not found: ${_} (referenced from ${X})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(s0.log(Error(T),{layoutPath:_,filePath:X,available:M},"error"),console.error(`[stx] ${T}`),G.debug)throw new R2(T,X);return q}let w=await D2(()=>Bun.file(F).text(),"",()=>{throw new R2(`Failed to read layout file: ${F}`,X,void 0,void 0,"Layout content could not be loaded")});w=b6(w,F);let R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${F}`);let N={},M=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(y,E,b)=>{return N[E]=b.trim(),""});for(let[y,E]of Object.entries(N))if(B[y]&&B[y].includes(k1)){let b=B[y].indexOf(k1);B[y]=B[y].slice(0,b)+E+B[y].slice(b+k1.length)}else if(!B[y])B[y]=E;let T={...Z,__sections:B},I=`@layout('${R[1]}')${M}`;return await O$(I,T,F,G,Y)}let D=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=A5(D,j),k={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,M,T)=>{return k[M]=T.trim(),`@slot('${M}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(N,M,T)=>{if(B[M]){let I=B[M];if(I.includes(k1)){let y=k[M]||"",E=I.indexOf(k1);I=I.slice(0,E)+y+I.slice(E+k1.length)}return I}return T||""}),A=EQ(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=M5(A,j),Z.__originalFilePath=X,q=await f6(A,Z,F,G,Y),q=`<!-- stx-layout: ${_} -->
3579
- ${q}`,W(q)}catch(F){return s0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:X},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return W(await f6(q,Z,X,G,Y))}function EQ($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,J,Y)=>{let Q=Z[J];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return Y||""})}function bQ($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let X=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Y,Q]of Object.entries(process.env))if(Y.startsWith(X)&&Q!==void 0)J[Y]=Q;$.$env=J}async function yQ($,Z){await D2(()=>s4($,Z),void 0,(X)=>{s0.log(X,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${X.message}`)})}async function CQ($,Z,X){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let Q=Y[1],G=Y[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await o("stx/variable-extractor",()=>import("./chunk-y1segp76.js"));await q(G,Z,X,{preserveExisting:!0})}catch(q){let K=q instanceof Error?q:Error(String(q));s0.log(K,{filePath:X,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${X}: ${K.message}`)}}}async function SQ($,Z,X){try{let{interpolateScriptsInTemplate:J}=await o("stx/expressions",()=>import("./chunk-d34fnbpc.js"));return J($,Z,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return s0.log(Y,{filePath:X,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${X}: ${Y.message}`),$}}async function f6($,Z,X,J,Y){let Q=$,G=J;if(await CQ(Q,Z,X),Q=await SQ(Q,Z,X),Q=await C4(Q,Z,X),Q=await S4(Q,Z,X),Q=await F4(Q,Z,X,G),J1(Q))Q=m7(Q,Z),Q=n5(Q,Z);Q=c7(Q);let{processStreamDirectives:z}=await o("stx/streaming",()=>import("./chunk-f8b83xbw.js"));Q=z(Q,Z),Q=d4(Q,Z,X,G),Q=await Y7(Q,Z,X,G,Y),Q=await W$(Q,Z,X,G,Y),Q=U3(Q,Z,X,G);let{processDeferDirectives:q}=await o("stx/defer",()=>import("./chunk-j03bare5.js"));Q=q(Q,Z,X);let{processTeleportDirectives:K}=await o("stx/teleport",()=>import("./chunk-fjkstnz3.js"));Q=K(Q,Z,X);let{processTransitionDirectives:U,processTransitionAttributes:W}=await o("stx/transitions",()=>import("./chunk-7p9ns60j.js"));Q=U(Q,Z,X),Q=W(Q);let{processErrorBoundaryDirectives:H}=await o("stx/error-boundaries",()=>import("./chunk-s67mgegv.js"));Q=H(Q,Z,X);let{processSuspenseDirectives:j}=await o("stx/suspense",()=>import("./chunk-areethga.js"));Q=j(Q,Z,X);let{processAsyncDirectives:B}=await o("stx/async-components",()=>import("./chunk-d0c3v7ax.js"));Q=B(Q,Z,X);let{processKeepAliveDirectives:_}=await o("stx/keep-alive",()=>import("./chunk-vbdca0k1.js"));Q=_(Q,Z,X);let{processVirtualListDirectives:O,processVirtualGridDirectives:V,processInfiniteListDirectives:L}=await o("stx/virtual-scrolling",()=>import("./chunk-cvnh7dma.js"));Q=O(Q,Z,X),Q=V(Q,Z,X),Q=L(Q,Z,X);let{processPartialHydrationDirectives:F,processStaticDirectives:w}=await o("stx/partial-hydration",()=>import("./chunk-90qr4f9m.js"));Q=F(Q,Z,X),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:D}=await o("stx/computed",()=>import("./chunk-3bv8h4r6.js"));Q=R(Q,Z,X),Q=D(Q,Z,X);let{processFormValidationDirectives:A}=await o("stx/forms-validation",()=>import("./chunk-yq1d9hb3.js"));Q=A(Q,Z,X);let{processHeadDirective:k,processTitleDirective:N,processMetaDirective:M,resetHead:T}=await o("stx/head",()=>import("./chunk-phhzfeh9.js"));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)T();let I=k(Q);if(Q=I.content,I.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${I.headContent}
3580
- `;if(Q=N(Q,Z),Q=M(Q,Z),Q=o4(Q),Q=U5(Q,Z),Q=O4(Q),Q=c4(Q),Q=await N5(Q,Z,X,G,Y),Q=await W$(Q,Z,X,G,Y),Z.__stxProcessingDepth===1)Q=f$(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=B$(Q),Q=$1(Q,Z,X),Q=B3(Q,Z,{filePath:X,buildMode:G.buildMode}),Q=W5(Q,Z),Q=H5(Q,Z),Q=j2(Q,Z),Q=F5(Q,Z),Q=w5(Q,Z),Q=await Q4(Q,Z,X,G),Q=await R3(Q,Z,X),Q=await u6(Q,Z,X,G),Q=d6(Q,Z,X,G),Q=c3(Q,Z,X,G),Q=p3(Q,Z,X),Q=i3(Q,Z,X,G),Q=V4(Q,Z,X,G),Q=H$(Q,Z),Q=j$(Q),Q=k6(Q),!G.skipEventDirectives)Q=P$(Q,Z,X);if(Q=L3(Q,Z,X),G.debug){let c=/\bx-data\s*=/.test(Q),p=i5($);if(c&&p)console.warn(`[stx] ${X}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
3581
- Both work on the same page, but they manage separate scopes.
3582
- Prefer signals (state/derived/effect) for new components.`)}Q=t4(Q,Z),Q=await B1(Q,Z,X),Q=T6(Q),Q=E6(Q),Q=X3(Q);let{processXElementDirectives:y}=await o("stx/x-element",()=>import("./chunk-a54n1r1q.js"));Q=y(Q);let E=Z.__originalFilePath||X,b=R9(Z);if(Q=await p7(Q,G,E,b),Q=N4(Q,Z),Q=await n4(Q,Z,X,G),G.media?.image?.autoSiblings){let c=G.publicDir||"public",{rewriteImagesWithSiblings:p}=await o("stx/image-optimization/auto-sibling",()=>import("./chunk-b29wbjs5.js"));Q=await p(Q,{publicDir:c})}if(G.seo?.enabled)Q=n3(Q,Z,G);let C=(c,p,q0=!0)=>{if(!p)return c;let G0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),D0=c.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(G0&&D0){if(q0)c=c.replace(D0[0],G0[0]);if(p=p.replace(G0[0],"").trim(),!p)return c}if(/<\/head>/i.test(c))return c.replace(/<\/head>/i,`${p}
3583
- </head>`);if(/<head\b[^>]*>/i.test(c))return c.replace(/(<head\b[^>]*>)/i,`$1
3584
- ${p}`);if(/<html\b[^>]*>/i.test(c))return c.replace(/(<html\b[^>]*>)/i,`$1
3585
- <head>
3586
- ${p}
3587
- </head>`);return c},{renderHead:v,getHead:P}=await o("stx/head",()=>import("./chunk-phhzfeh9.js")),x=Z.__stx_runtime_head??P();if(x.title||x.meta?.length||x.link?.length){let c=v(x);if(c)Q=C(Q,c)}if(I.headContent)Q=C(Q,I.headContent,!x.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=B4(Q,G.csp,Z);if(G.analytics?.enabled)Q=Y3(Q,G);if(G.heatmap?.enabled)Q=G3(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:c}=await o("stx/pwa/inject",()=>import("./chunk-qp97dx7x.js"));Q=c(Q,G)}let $0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),a0=/\bSTX\.\w+/.test(Q),M0=/window\.STX\s*=/.test(Q);if($0&&a0&&!M0){let p=`<script data-stx-scoped data-stx-run="once">
3588
- ${e$()}
3589
- </script>`;if(Q.includes("</head>")){let q0=Q.indexOf("</head>"),D0=Q.slice(0,q0).indexOf("<script");if(D0!==-1){let S0=Q.slice(0,D0),Z2=Q.slice(D0);Q=S0+p+`
3590
- `+Z2}else Q=Q.replace("</head>",`${p}
3591
- </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
3592
- ${p}`);else Q=p+`
3593
- `+Q}{let{scanScriptTags:c}=await o("stx/signal-processing",()=>import("./chunk-hzw1ekq3.js")),p=[];for(let q0 of c(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let G0=q0.start+q0.fullMatch.indexOf(">")+1,D0=kQ(Q,G0);if(D0===-1)continue;let S0=D0+9;while(S0<Q.length&&/\s/.test(Q[S0]))S0++;p.push({start:q0.start,end:S0})}for(let q0=p.length-1;q0>=0;q0--){let{start:G0,end:D0}=p[q0];Q=Q.substring(0,G0)+Q.substring(D0)}}let C0=z9(Q,X);if(C0.hasScoped)Q=C0.html;let Z0=Z.__stx_event_bindings||[],H0=!1,k0=[],E0=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:d0}=await o("stx/signal-processing",()=>import("./chunk-hzw1ekq3.js"));for(let c of d0(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))k0.push({match:c.fullMatch,attrs:c.attrs,content:c.body});for(let{match:c,attrs:p,content:q0}of k0){H0=!0;let G0=q0;V$(q0,X,J.strict,Z.__originalFilePath);let D0=await D9(q0,{eventBindings:Z0,attrs:p,hasColonDirectives:E0,templateContent:$,filePath:X,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:b});Q=Q.replace(c,()=>D0)}if(H0)Z.__stx_event_bindings=[];if(!H0&&Z.__stxProcessingDepth===1){let c=Z.__stx_event_bindings||[];if(c.length>0){let p=b9(c);if(p){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+p:Q.slice(0,q0)+p+`
3594
- `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!y7(Q)&&C7(Q))Q=await W9(Q,G);if(Q=S7(Q),G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=_4(Q,Z.cspNonce);return Q}var PQ=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],vQ=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],fQ=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}];function xQ($){let Z=[],X=[];return gQ($,Z),hQ($,Z,X),uQ($,X),dQ($,Z),{valid:Z.length===0,errors:Z,warnings:X}}function gQ($,Z){let X=($.match(/\{\{/g)||[]).length,J=($.match(/\}\}/g)||[]).length;if(X!==J)Z.push({type:"expression",message:`Unclosed expression brackets: found ${X} opening '{{' and ${J} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function hQ($,Z,X){for(let J of PQ){let Y=new RegExp(`${J.open}(?:\\s|\\()`,"g"),Q=new RegExp(J.close,"g"),G=($.match(Y)||[]).length,z=($.match(Q)||[]).length;if(J.altClose){let q=new RegExp(J.altClose,"g");z+=($.match(q)||[]).length}if(G>z)Z.push({type:"directive",message:`Unclosed @${J.name} directive: found ${G} opening and ${z} closing`,suggestion:`Add ${G-z} missing ${J.close} tag(s)`});else if(z>G)X.push({type:"directive",message:`Extra ${J.close} found: ${z-G} more closing than opening`,suggestion:`Check for orphaned ${J.close} tags`})}}function uQ($,Z){for(let X of vQ)if(X.pattern.test($))Z.push({type:"syntax",message:X.message,suggestion:X.suggestion})}function dQ($,Z){for(let X of fQ)if(X.pattern.test($))Z.push({type:"expression",message:`Security warning: ${X.message}`,suggestion:"Remove dangerous code from template expressions"})}function mQ($,Z){let X=$.slice(0,Z).split(`
3595
- `);return{line:X.length,column:X[X.length-1].length+1}}function lQ($,Z,X){let J=[];switch($){case"if":case"elseif":case"unless":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(X.length===0||!X[0].includes(" as "))J.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(X.length===0)J.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(X.length===0)J.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(X.length===0)J.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(X.length===0)J.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return J}function cQ($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function pQ($){let Z=$.matchAll(/@([a-z]+)/gi),X=new Set;for(let J of Z){let Y=J[1].toLowerCase();if(!Y.startsWith("end"))X.add(Y)}return Array.from(X)}import r0 from"path";import $2 from"process";var X8=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","setResponseStatus","setResponseHeader","notFound","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],o6=new Set(X8),iQ=new Set(["props","$props","defineProps"]),nQ=new Set(["stx","@stacksjs/stx"]),s6=e1(128);function oQ($){let Z=[],X=0,J=$.split(`
3596
- `);for(let Y of J){let Q=X,G=null,z=!1;for(let q=0;q<Y.length;q++){let K=Y[q];if(z){z=!1;continue}if(K==="\\"){z=!0;continue}if(G){if(K===G)G=null;continue}if(K==="'"||K==='"'||K==="`"){G=K;continue}if(K==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(K==="{")X++;else if(K==="}")X--}if(Q===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let K=Y.match(/(?:const|let|var)\s+(\w+)/);if(K)Z.push(K[1])}else{let K=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let W=K[1].slice(1,-1).split(",").map((H)=>{let j=H.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((H)=>/^\w+$/.test(H));Z.push(...W)}}}}return[...new Set(Z)]}function sQ($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function X(J){if(!J.includes(":"))return J;let Y=[],Q="",G=0,z=0,q=null;for(let K=0;K<J.length;K++){let U=J[K];if(q){if(Q+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,Q+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")z++;else if(U===")")z--;if(U===","&&G===0&&z===0){Y.push(Q),Q="";continue}Q+=U}if(Q)Y.push(Q);return Y.map((K)=>{let U=K.trim(),W=U.startsWith("..."),H=W?U.slice(3):U,j=-1,B=0;for(let R=0;R<H.length;R++)if(H[R]==="<")B++;else if(H[R]===">")B--;else if(H[R]===":"&&B===0){j=R;break}if(j===-1)return K;let O=H.substring(0,j).trim().replace(/\?$/,""),V=H.substring(j+1),L=-1,F=0;for(let R=0;R<V.length;R++)if(V[R]==="<")F++;else if(V[R]===">")F--;else if(V[R]==="="&&F===0){L=R;break}let w=W?"...":"";if(L!==-1)return`${w}${O} = ${V.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,Q)=>{if(!Q.includes(":"))return J;return`${Y}(${X(Q)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,Q=[];while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,z=1,q=G+1,K=0,U=null;while(q<Z.length&&z>0){let j=Z[q];if(U){if(j===U)U=null;q++;continue}if(j==='"'||j==="'"||j==="`"){U=j,q++;continue}if(j==="<")K++;else if(j===">"&&K>0)K--;else if(K===0){if(j==="(")z++;else if(j===")")z--}if(z>0)q++}if(z!==0)continue;let W=Z.substring(G+1,q);if(!W.includes(":"))continue;let H=X(W);Q.push({start:G+1,end:q,replacement:H})}for(let G=Q.length-1;G>=0;G--){let{start:z,end:q,replacement:K}=Q[G];Z=Z.substring(0,z)+K+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((G)=>{let[z,...q]=G.split("="),K=z.split(":")[0].trim();if(q.length>0)return`${K} = ${q.join("=").trim()}`;return K}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
3597
-
3598
- `),Z}function rQ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function aQ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function tQ($,Z,X,J={}){if(!$.trim())return;let Y=a1(),Q=M1($,JSON.stringify(Y)),G=s6.get(Q);if(G===void 0){try{let S=w$({loader:"ts",target:"browser",define:Y}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),G=S.transformSync(f)}catch{G=sQ($)}s6.set(Q,G)}let z={exports:{}},q=z.exports,K=$2.cwd(),U={},W=[...G.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((S)=>S[1]).filter((S)=>!S.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(S)),H=new Map;for(let S of W)try{if(S.startsWith(".")){U[S]=await import(r0.resolve(r0.dirname(X),S));continue}let f=r0.resolve(K,"node_modules",S),s=r0.join(f,"package.json"),r=JSON.parse(u("fs").readFileSync(s,"utf8")),Y0=r.main||"index.js";if(r.exports){let Q0=typeof r.exports==="string"?r.exports:r.exports["."];if(typeof Q0==="string")Y0=Q0;else if(Q0?.bun)Y0=Q0.bun;else if(Q0?.import)Y0=Q0.import;else if(Q0?.default)Y0=Q0.default}U[S]=await import(r0.resolve(f,Y0))}catch(f){if(S.startsWith("."))H.set(S,f instanceof Error?f.message:String(f))}let j=(S)=>{if(U[S])return U[S];let f=H.get(S);if(f!==void 0)throw Error(`Cannot require '${S}' from ${X}: ${f}`);return u(S)},B=Z.props||{},_=(S)=>{if(!S)return B;let f={};for(let[s,r]of Object.entries(S)){let Y0=B[s];if(Y0!==void 0)f[s]=Y0;else if(typeof r==="function")f[s]=r();else f[s]=r}return f};for(let[S,f]of Object.entries(B))Object.defineProperty(_,S,{value:f,enumerable:!0,configurable:!0,writable:!0});for(let S of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(B,S))continue;try{Object.defineProperty(_,S,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let O=(S)=>{if(!S)return B;let f={...B};for(let[s,r]of Object.entries(S)){let Y0=r&&typeof r==="object"&&!Array.isArray(r)?r:{type:r};if(f[s]===void 0&&Y0.default!==void 0)f[s]=typeof Y0.default==="function"?Y0.default():Y0.default}return f},V=()=>Z.slots||{},L=(S,f)=>{let s={...S};for(let[r,Y0]of Object.entries(f))if(s[r]===void 0)if(typeof Y0==="function")s[r]=Y0();else s[r]=Y0;return s},F=(S)=>{let f=()=>S;return f.set=(s)=>{},f.update=(s)=>{},f},w=(S)=>{let f,s=!1;return()=>{if(!s)try{f=S(),s=!0}catch{f=void 0}return f}},R=(S)=>{},D=(S)=>S(),A=(S)=>{},k=(S)=>{},N=j3(Z);function M(S){let f=S||{};if(f.title!==void 0||f.description!==void 0)b({title:f.title,description:f.description})}function T(S){if(!S||typeof S!=="object")return;let f=Z.__stxClientPayload??{};Object.assign(f,S),Z.__stxClientPayload=f}let I=()=>{let S=Z.__stxServeContext,f=Z.__stxServeSearch??S?.search??"",s=S?.path??"",r=Object.fromEntries(new URLSearchParams(f)),Y0=Z.query,Q0=Object.keys(r).length>0?r:Y0??{},d=f||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:Z.params??{},query:Q0,path:s,name:"",fullPath:s+d,hash:"",matched:[]}},y=()=>({push:(S)=>{},replace:(S)=>{},back:()=>{},forward:()=>{},go:(S)=>{}}),E=(S)=>{let f=Z.__stx_runtime_head||{};Z.__stx_runtime_head=l2(f,S||{})},b=(S)=>{E(Z8(S||{}))},C=(S)=>({value:S}),v=(S)=>S,P=(S)=>({value:typeof S==="function"?S():S}),g=(S,f)=>{},x=(S)=>{},$0=(S)=>{},a0=(S)=>S?S():Promise.resolve(),M0=(S)=>(f,...s)=>{},C0=(S)=>{},Z0=(S,f)=>{},H0=(S,f)=>f,k0=()=>({value:"light"}),E0=()=>F(!1),d0=(S)=>F(!1),c=()=>F(!1),p=()=>d0("(prefers-color-scheme: dark)"),q0=()=>d0("(prefers-color-scheme: light)"),G0=()=>d0("(prefers-reduced-motion: reduce)"),D0=()=>d0("(prefers-contrast: more)"),S0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},Z2=new Proxy(S0,{get(S,f){if(f in S)return S[f];return},set(S,f,s){return S[f]=s,!0}}),M2={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},k2=console;try{let S=J8(G,X),f=new Set(Object.keys(B)),s=(n)=>/^[a-z_$][\w$]*$/i.test(n),r=Object.keys(Z).filter((n)=>!f.has(n)&&!iQ.has(n)&&s(n)),Y0=r.map((n)=>Z[n]);if(!r.includes("__stxServeContext"))r.push("__stxServeContext"),Y0.push(void 0);let Q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),d=[],m=[];for(let[n,m0]of Object.entries(B)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(Q0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(S))continue;d.push(n),m.push(m0)}let i=oQ(S).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3599
- `),L0=Z.params??{},O0=[],P0=[];for(let n=0;n<r.length;n++){if(r[n]==="params")continue;O0.push(r[n]),P0.push(Y0[n])}let b0=await Function(...X8,...d,...O0,`return (async () => {
3600
- ${S}
3601
- ${i}
3602
- return module.exports
3603
- })()`)(z,q,j,B,_,O,L,T,F,w,R,D,A,k,M,I,y,E,b,N.setResponseStatus,N.setResponseHeader,N.notFound,C,v,P,g,x,$0,a0,M0,C0,V,Z0,H0,k0,E0,d0,c,p,q0,G0,D0,Z2,M2,k2,S0.confirm,S0.alert,S0.fetch,L0,...m,...P0);if(J.preserveExisting){for(let[n,m0]of Object.entries(b0))if(!(n in Z)||Z[n]===void 0)Z[n]=m0}else Object.assign(Z,b0);for(let[n,m0]of Object.entries(B))if(!(n in Z))Z[n]=m0}catch(S){let f=S instanceof Error?S.message:String(S);if(rQ(f))console.warn(`[stx] server <script> in ${X??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${f}`);else if(aQ(f))console.warn(`[stx] server <script> in ${X??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${f}`);else if($2.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${X??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`);try{await GG(G,Z,X)}catch(s){if($2.env.STX_DEBUG){let r=s instanceof Error?s.message:String(s);console.warn(`[stx] fallback extraction also failed in ${X??"<unknown>"}: ${r}`)}}}}function eQ($){let Z=0,X=null,J=!1,Y=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(X){if(G===X){if(X=null,J||Z===0)Y=!0}continue}if(G==="'"||G==='"'||G==="`"){X=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)J=!0}return X===null&&Z===0&&Y}var $G=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/;function J8($,Z){let X=Z?r0.dirname(Z):$2.cwd(),J=$2.cwd(),Y=$.split(`
3604
- `),Q=[],G=0;while(G<Y.length){let z=Y[G].trim();if(z.startsWith("interface ")||z.startsWith("export interface ")||z.startsWith("type ")||z.startsWith("export type ")){if(z.includes("{")&&!z.includes("}")){let q=0;for(;G<Y.length;G++){for(let K of Y[G])if(K==="{")q++;else if(K==="}")q--;if(q<=0)break}}G++;continue}if(z.startsWith("definePageMeta(")){let q=0,K=!1,U=G;for(let j=G;j<Y.length&&!K;j++){let B=null,_=!1,O=Y[j];for(let V=0;V<O.length;V++){let L=O[V];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){G=j+1,K=!0;break}}}}if(!K)G=Y.length;let W=Y.slice(U,G).join(`
3605
- `),H=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(W);if(B)H.push(`${j}: ${JSON.stringify(B[2])}`)}if(H.length>0)Q.push(`useSeoMeta({ ${H.join(", ")} });`);continue}if(z.startsWith("import ")||z==="import"||z.startsWith("import{")){let q=z,K=0;while(!eQ(q)&&G+K+1<Y.length)K++,q=`${q} ${Y[G+K].trim()}`;G+=K;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),W=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),H=q.match(/^import\s+['"](.+?)['"]/),j=q,B=(_)=>{if(_.startsWith("."))return r0.resolve(X,_);if(_.startsWith("~/")||_.startsWith("@/"))return r0.resolve(J,_.slice(2));return _};if(U){let[,_,O]=U,V=B(O);Q.push(`const ${_} = (await import('${V}')).default`),Q.push(`module.exports.${_} = ${_};`)}else if(W){let[,_,O]=W,V=B(O),L=[],F=[],w=nQ.has(O);for(let R of _.split(",")){let D=R.trim();if(!D)continue;let A=D.split(/\s+as\s+/);if(A.length===2){let[k,N]=[A[0].trim(),A[1].trim()];if(w&&o6.has(k)){Q.push(`const ${N} = ${k};`);continue}L.push(`${k}: ${N}`),F.push(N)}else{if(w&&o6.has(D))continue;L.push(D),F.push(D)}}if(L.length>0)Q.push(`const { ${L.join(", ")} } = await import('${V}')`);for(let R of F)Q.push(`module.exports.${R} = ${R};`)}else if(H){let _=B(H[1]);Q.push(`await import('${_}')`)}else Q.push(j);G++;continue}if($G.test(z))Q.push(Y[G]),G++;else if(z.startsWith("export const ")||z.startsWith("export let ")||z.startsWith("export var ")){let q=a6(Y,G),{type:K,name:U,value:W}=q;Q.push(`${K} ${U} = ${W};`),Q.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(z.startsWith("export function ")||z.startsWith("export async function ")){let q=F$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("const ")||z.startsWith("let ")||z.startsWith("var ")){let q=a6(Y,G),{type:K,name:U,value:W}=q;Q.push(`${K} ${U} = ${W};`),Q.push(`module.exports.${U} = ${U};`),G=q.nextIndex}else if(z.startsWith("function ")||z.startsWith("async function ")){let q=F$(Y,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(z.startsWith("export default function ")||z.startsWith("export default async function ")){let q=Y[G].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...Y];K[G]=q;let U=F$(K,G);if(Q.push(U.functionCode),U.name)Q.push(`module.exports.default = ${U.name};`);G=U.nextIndex}else if(z.startsWith("export default ")){let q=z.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(z.startsWith("class ")||z.startsWith("export class ")){let q=z.match(/(?:export\s+)?class\s+(\w+)/);if(q){let K=q[1],U=Y[G].replace(/^export\s+/,""),W=0,H=G;for(;H<Y.length;H++){let j=Y[H];for(let B of j)if(B==="{")W++;else if(B==="}")W--;if(H>G)U+=`
3606
- `+j;if(W<=0&&H>=G)break}Q.push(U),Q.push(`module.exports.${K} = ${K};`),G=H+1}else Q.push(z),G++}else if(z.includes("module.exports"))Q.push(z),G++;else if(z.trim()&&!z.startsWith("//"))Q.push(z),G++;else G++}return ZG(Q.join(`
3607
- `),X,J)}function ZG($,Z,X){let J=$.length,Y="",Q=0,G=null,z=!1,q=!1,K=0;while(Q<J){let U=$[Q],W=$[Q+1];if(z){if(Y+=U,U===`
3608
- `)z=!1;Q++;continue}if(q){if(Y+=U,U==="*"&&W==="/"){Y+=W,Q+=2,q=!1;continue}Q++;continue}if(!G&&U==="/"&&W==="/"){z=!0,Y+=U,Q++;continue}if(!G&&U==="/"&&W==="*"){q=!0,Y+=U,Q++;continue}if(G){if(Y+=U,U==="\\"){Y+=W,Q+=2;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(U==="$"&&W==="{"){K++,Y+=W,Q+=2;continue}if(U==="`"){G=null,Q++;continue}}Q++;continue}if(K>0){if(U==="{")K++;else if(U==="}")K--}if(U==='"'||U==="'"||U==="`"){G=U,Y+=U,Q++;continue}if(U==="a"&&$.startsWith("await",Q)){let H=XG($,Q);if(H){let{quote:j,path:B,end:_}=H;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?r0.resolve(Z,B):r0.resolve(X,B.slice(2));Y+=`await import(${j}${O}${j})`,Q=_;continue}}}Y+=U,Q++}return Y}function XG($,Z){let X=Z+5;if(X>=$.length)return null;if(!/\s/.test($[X]))return null;while(X<$.length&&/\s/.test($[X]))X++;if(!$.startsWith("import",X))return null;X+=6;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let J=$[X];if(J!=="'"&&J!=='"')return null;X++;let Y=X;while(X<$.length&&$[X]!==J)if($[X]==="\\")X+=2;else X++;if(X>=$.length)return null;let Q=$.slice(Y,X);X++;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return{quote:J,path:Q,end:X+1}}function Y8($,Z){let X=$[Z];if(X!=="{"&&X!=="[")return null;let Y=B0($,X,X==="{"?"}":"]",Z);if(Y===-1)return null;return{pattern:$.slice(Z,Y+1),endPos:Y+1}}function Q8($){let Z=[],X=$.slice(1,-1).trim();if(!X)return Z;let J=0,Y=0,Q="";while(J<X.length){let G=X[J];if(G==="{"||G==="["){let z=Y===0?Y8(X,J):null;if(z){Z.push(...Q8(z.pattern)),J=z.endPos,Q="";continue}Y++}else if(G==="}"||G==="]")Y--;if(Y>0){J++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",J++;continue}if(G===":"){Q="",J++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",J++;while(J<X.length&&X[J]!==","&&Y===0){if(X[J]==="{"||X[J]==="[")Y++;else if(X[J]==="}"||X[J]==="]")Y--;J++}continue}if(/[\w$]/.test(G))Q+=G;J++}if(Q.trim())Z.push(Q.trim());return Z}function JG($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let X=Z[0].length,J=(Y)=>Y===" "||Y==="\t";while(X<$.length&&J($[X]))X++;if($[X]===":"){let Y=0,Q=null;X++;for(;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){Y++;continue}if(G===")"||G==="]"||G==="}"||G===">"){Y--;continue}if(G==="="&&Y<=0){let z=$[X+1],q=$[X-1];if(z!=="="&&z!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[X]!=="=")return null}while(X<$.length&&J($[X]))X++;if($[X]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(X+1).trim()}}function r6($,Z,X,J){let Y=null,Q=!1;for(let G of $){if(Q){Q=!1;continue}if(G==="\\"){Q=!0;continue}if(Y){if(G===Y)Y=null;continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G===Z)J++;else if(G===X)J--}return J}function a6($,Z){let X=$[Z].trim(),J=JG(X),Y=J?[X,J.type,J.name,J.value]:null;if(!Y){let U=X.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let W=X.slice(U[0].length),H=Z;if(W.startsWith("{")||W.startsWith("[")){let B=W[0],_=B==="{"?"}":"]",O=r6(W,B,_,0),V=W;for(let L=Z+1;L<$.length&&O>0;L++)V+=` ${$[L].trim()}`,H=L,O=r6($[L],B,_,O);if(O>0)V=W,H=Z;W=V}let j=Y8(W,0);if(j){let B=U[1],_=j.pattern,O=W.slice(j.endPos).trim();if(O.startsWith("=")){let V=O.slice(1).trim(),L=V,F=Math.max(H,Z);if(t6(V)){let A=e6($,F,V);L=A.value,F=A.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let w=Q8(_),R=`__stx_src_${Z}`,D=w.map((A)=>`module.exports.${A} = ${A};`).join(`
3609
- `);return{type:B,name:R,value:`${L}; ${B} ${_} = ${R};
3610
- ${D}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${X}`)}let[,Q,G,z]=Y,q=z,K=Z;if(t6(z)){let U=e6($,Z,z);q=U.value,K=U.nextIndex}else K=Z+1;while(K<$.length){let U=$[K].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
3611
- ${$[K]}`,K++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:K}}function F$($,Z){let X=$[Z].trim(),J=X.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${X}`);let[,Y]=J,Q=X.replace(/^export\s+/,""),G=Z;if(YG(X)){let z=QG($,Z,Q);Q=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Y,functionCode:Q,nextIndex:G}}function t6($){let Z=$.trim();if(Z.startsWith("{"))return B0(Z,"{","}",0)===-1;if(Z.startsWith("["))return B0(Z,"[","]",0)===-1;return!G8(Z)}function G8($){let Z={paren:0,bracket:0,brace:0},X=null,J=0;for(let Y=0;Y<$.length;Y++){let Q=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&X)continue;if((Q==='"'||Q==="'")&&!X){X=Q;continue}if(Q===X&&X!=="`"){X=null;continue}if(Q==="`"&&!X){X="`";continue}if(Q==="`"&&X==="`"&&J===0){X=null;continue}if(X==="`"&&Q==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&Q==="{"){J++;continue}if(J>0&&Q==="}"){J--;continue}if(X)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&X===null}function z8($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let X=B0($,"(",")",Z);if(X===-1)return-1;return $.indexOf("{",X)}function YG($){let Z=z8($);if(Z===-1)return!0;return B0($,"{","}",Z)===-1}function e6($,Z,X){let J=X,Y=Z+1;while(Y<$.length&&!G8(J)){let Q=$[Y];J+=`
3612
- ${Q}`,Y++}while(Y<$.length){let Q=$[Y].trim();if(Q.startsWith(".")||Q.startsWith("?."))J+=`
3613
- ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function QG($,Z,X){let J=X,Y=Z+1;while(Y<$.length){let Q=z8(J);if(Q!==-1){if(B0(J,"{","}",Q)!==-1)break}let G=$[Y];J+=`
3614
- ${G}`,Y++}return{functionCode:J,nextIndex:Y}}function $8($,Z){let X=e($,Z)??e(`(${$})`,Z);if(X!==void 0)return X;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...$2.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function GG($,Z,X){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of J){let[,,G,z]=Q;try{let q=z.trim().replace(/;$/,""),K=$8(q,Z);if(K!==void 0)Z[G]=K}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of Y){let[,,G,z]=Q;if(!(G in Z))try{let q=z.trim().replace(/;$/,""),K=$8(q,Z);if(K!==void 0)Z[G]=K}catch{}}}function zG($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:X,templateWithoutScript:J}}function qG($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var N2=new g1(500),A9=new g1(1000),H8=33554432,D$=H8;function UG($){let Z=$.componentRenderCacheBytes;if(typeof Z!=="number"||Z<0||Z===D$)return;D$=Z,M9.setMaxBytes(Z)}var M9=new g1(2000,{maxBytes:H8,sizeOf:($)=>$.output.length});function WG($){let Z=new WeakSet;try{let X=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(Z.has(J))throw TypeError("Circular component input");if(Z.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(X);let Y={};for(let Q of Object.keys(J).sort())Y[Q]=X(J[Q]);return Y};return JSON.stringify(X($))}catch{return null}}function q8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HG($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function F1($){return!HG($)}var N9=new Map;function w$($){let Z;try{Z=JSON.stringify($)}catch{return new Bun.Transpiler($)}let X=N9.get(Z);if(X)return X;if(N9.size>=16)N9.clear();let J=new Bun.Transpiler($);return N9.set(Z,J),J}function w1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let X=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=X.length;return X.push(Q),`"__STX_EXPR_${G}__"`});let Y=w$({loader:"ts",target:"browser",define:a1()}).transformSync(Z);for(let Q=0;Q<X.length;Q++)Y=Y.replace(`"__STX_EXPR_${Q}__"`,X[Q]),Y=Y.replace(`'__STX_EXPR_${Q}__'`,X[Q]);return Y}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function jG($){let Z=[],X=new Set,J=0,Y=0,Q=$.length,G=(U)=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]===U){Y++;return}Y++}},z=()=>{Y++;while(Y<Q){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let U=1;while(Y<Q&&U>0)if($[Y]==="{")U++,Y++;else if($[Y]==="}")U--,Y++;else if($[Y]==="'"||$[Y]==='"')G($[Y]);else if($[Y]==="`")z();else Y++;continue}Y++}},q=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<Q&&$[Y]!==`
3615
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<Q-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let B=U[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!X.has(_))Z.push(_),X.add(_);return}let W=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(W){let B=W[2];if(!X.has(B))Z.push(B),X.add(B);return}let H=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Z.push(B),X.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Z.push(B),X.add(B)}};while(Y<Q){if(q())continue;if($[Y]==="'"||$[Y]==='"'){G($[Y]);continue}if($[Y]==="`"){z();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))K();Y++}return Z}function BG($){let Z=[],X=0,J=0,Y=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G==="\\"){Q++;continue}if(G===Y)Y=null;continue}if(G==='"'||G==="'"||G==="`"){Y=G;continue}if(G==="("||G==="["||G==="{")X++;else if(G===")"||G==="]"||G==="}")X--;else if(G===","&&X===0)Z.push($.slice(J,Q)),J=Q+1}if(J<$.length)Z.push($.slice(J));return Z}function _G($){let Z=0,X=null;for(let J=0;J<$.length;J++){let Y=$[J];if(X){if(Y==="\\"){J++;continue}if(Y===X)X=null;continue}if(Y==='"'||Y==="'"||Y==="`"){X=Y;continue}if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y==="="&&Z===0){let Q=$[J-1],G=$[J+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function VG($,Z){try{let X=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!X)return;let J=X.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,Q=0,G=-1;for(;J>=0;J--){let q=$[J];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=J;break}}}if(G===-1)return;let z=$.slice(G+1,Y);for(let q of BG(z)){let K=q.trim();if(!K||K.startsWith("..."))continue;let U=_G(K);if(U===-1)continue;let W=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(W))continue;if(Z[W]!==void 0)continue;let H=K.slice(U+1).trim();if(!H)continue;try{let j=Object.keys(Z),B=Function(...j,`"use strict"; return (${H});`);Z[W]=B(...j.map((_)=>Z[_]))}catch{}}}catch{}}async function F9($,Z,X,J,Y){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""),z=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=X.__importedComponents;if(q){for(let O of[Q,Q.toLowerCase(),G(Q),z(Q)])if(q.has(O))return!0}let K=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${z(Q)}.stx`])],U=typeof Y.root==="string"?h.resolve(Y.root):void 0,W=U??h.dirname(J),H=[],j=(O)=>{if(O&&!H.includes(O))H.push(O)},B=X.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));if(j(Z),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir),U)j(h.resolve(U,"resources/views/components")),j(h.resolve(U,"resources/components")),j(h.resolve(U,"src/components")),j(h.resolve(U,"components"));let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let O of _)j(typeof O==="string"?O:null);if(j(Y.fallbackComponentsDir),Q.startsWith("./")||Q.startsWith("../"))return a(h.resolve(h.dirname(J),`${Q}.stx`));for(let O of H){let V=h.isAbsolute(O)?O:h.resolve(W,O);for(let L of K)if(await a(h.join(V,L)))return!0}return!1}function LG($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function OG($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function FG($){let Z=new Set,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=X.exec(J))!==null)Z.add(Y[1]);X.lastIndex=0}return[...Z]}async function D1($,Z,X,J,Y,Q,G,z=new Set,q){let{extractVariables:K}=await o("stx/variable-extractor",()=>import("./chunk-y1segp76.js")),U=z??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let W=new Set(U);W.add($);let H=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let j=H&&H!=="load"&&LG(H)?H:"";try{let B=(d)=>d.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),_=(d)=>d.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,V=null,L=Y.__importedComponents;if(L){let d=[O,O.toLowerCase(),B(O),_(O)];for(let m of d)if(L.has(m)){V=L.get(m);break}}let F=[];if(!V){let d=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],m=[...new Set(d)],K0=Y.__originalFilePath,i=[];if(K0){let F0=h.join(h.dirname(K0),"components");i.push(F0)}if(J)i.push(J);let L0=G._rootComponentsDir;if(typeof L0==="string"&&!i.includes(L0))i.push(L0);let O0=h.join(h.dirname(Q),"components");if(!i.includes(O0))i.push(O0);if(G.componentsDir&&G.componentsDir!==J&&!i.includes(G.componentsDir))i.push(G.componentsDir);let P0=typeof G.root==="string"?h.resolve(G.root):void 0,j1=P0??h.dirname(Q),b0=[];if(P0)b0.push(h.resolve(P0,"resources/views/components")),b0.push(h.resolve(P0,"resources/components")),b0.push(h.resolve(P0,"src/components")),b0.push(h.resolve(P0,"components"));b0.push(h.resolve(import.meta.dir,"components"));for(let F0 of b0)if(!i.includes(F0))i.push(F0);let n=G._pluginComponentDirs;if(Array.isArray(n)){for(let F0 of n)if(typeof F0==="string"&&!i.includes(F0))i.push(F0)}if(G.fallbackComponentsDir&&!i.includes(G.fallbackComponentsDir))i.push(G.fallbackComponentsDir);let m0=[...new Set(i.map((F0)=>{if(!F0)return F0;return h.isAbsolute(F0)?F0:h.resolve(j1,F0)}))];i.length=0,i.push(...m0);let I2=`${O}\x00${Q}\x00${m0.join("\x00")}`,k9=A9.get(I2);if(k9)if(await a(k9))V=k9;else A9.delete(I2);if(!V&&(O.startsWith("./")||O.startsWith("../")))V=h.resolve(h.dirname(Q),`${O}.stx`),F.push(V);else if(!V)for(let F0 of i){if(!F0)continue;for(let T2 of m){let E2=h.join(F0,T2);if(F.push(E2),await a(E2)){V=E2;break}}if(V)break;if(!V)try{let T2=await import("fs");if(!T2.statSync(F0,{throwIfNoEntry:!1})?.isDirectory())continue;let D8=8,I9=[{path:F0,depth:0}];while(I9.length>0&&!V){let b2=I9.pop();if(b2.depth>=D8)continue;let k$;try{k$=T2.readdirSync(b2.path,{withFileTypes:!0})}catch{continue}for(let y2 of k$){if(!y2.isDirectory())continue;if(y2.name==="node_modules"||y2.name.startsWith("."))continue;let I$=h.join(b2.path,y2.name);for(let N8 of m){let T9=h.join(I$,N8);if(F.push(T9),await a(T9)){V=T9;break}}if(V)break;I9.push({path:I$,depth:b2.depth+1})}}}catch{}if(V)break}if(V)A9.set(I2,V)}if(!V||!await a(V)){let d=F.length>0?`
3616
- Searched paths:
3617
- ${F.map((m)=>` - ${m}`).join(`
3618
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${d}`}q.add(V);let w;if(N2.has(V))w=N2.get(V);else try{w=await Bun.file(V).text(),N2.set(V,w)}catch(d){return`[Error loading component: ${d instanceof Error?d.message:String(d)}]`}let R=new Set(["__originalFilePath","__importedComponents",C2,"__stx_client_signal_names","__stxServeContext","__stx_scope_seq"]),D={};for(let[d,m]of Object.entries(Y))if(!d.startsWith("__")||R.has(d))D[d]=m;let A=X;if(X.includes("@include")){let{processIncludes:d}=await o("stx/includes",()=>import("./chunk-71nr1avx.js"));A=await d(X,Y,Q,G,q)}let k=n0(A),N=[],M=k.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(d,m)=>{let K0=k.scripts[Number(m)]||"",i=K0.match(/^<script\b([^>]*)>/i)?.[1]||"",L0=i.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),O0=!L0||["module","text/javascript","application/javascript"].includes(L0);if(!/\bserver\b/i.test(i)&&O0)return N.push(K0),"";return K0}),{extractSlotContent:T}=await o("stx/slots",()=>import("./chunk-gkmtkzdm.js")),I=T(M),y={};if(I.defaultSlot?.trim())y.default=I.defaultSlot;for(let[d,m]of I.namedSlots)y[d]=m.content;let E=Y.__stx_scope_seq??={n:0,key:Bun.hash(String(Y.__filename??Q)).toString(36).slice(0,6)},b=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++E.n}_${E.key}`,C={...D,$uid:b,...Z,props:Z,slot:M,$slots:y,__processedComponents:W,__sections:{},__stx_signals_gate:J1(w)||OG(X)};VG(w,C);let v=w,P=t2(v);if(P)v=P.content.trim();let g=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...w.matchAll(g)],$0=[],a0=x.some((d)=>/\bserver\b/.test(d[1]||"")&&/\bcache\b/.test(d[1]||"")),M0=null,C0=null,Z0=null,H0=0,k0=null;if(UG(G),a0&&D$>0){let d=WG({props:Z,slot:X,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0,uid:b});if(d!==null){M0=`${V}\x00${M1(w)}\x00${d}`;let m=M9.get(M0);if(m){for(let K0 of m.dependencies)q.add(K0);if(h$(Y,m.clientFactories),E.n+=m.uidsConsumed,m.preservedClientExpressions.length>0){let K0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let i of m.preservedClientExpressions)K0.add(i);Y.__stx_preserved_client_expressions=[...K0]}return m.output}C0=new Set(q),Z0=x$(Y),H0=E.n,k0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[])}}for(let d of x){let m=d[1]||"",K0=d[2]||"",i=m.includes("server");if(F1(m)&&K0.trim())K0=w1(K0);if(i&&K0)try{await K(K0,C,V)}catch(O0){}if(!i){let O0=K0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),P0=O0.includes("{{")&&O0.includes("}}"),j1=O0.includes("{!!")&&O0.includes("!!}");if(P0||j1)O0=S9(O0,C);let b0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");$0.push(`<script${b0}>${O0}</script>`)}}let E0=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),d0=E0?E0[1]:"",c=E0?E0[2]:"",p="",q0=d0&&/\bscoped\b/i.test(d0);if(E0)p=`<style${d0}>${c}</style>`;let G0=v;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),E0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let d=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(G0=G0.replace(d,(K0,i)=>{let L0=i.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(L0)m.push(`<style${L0[1]}>${L0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)p=`${p}${m.join(`
3619
- `)}`}if(X&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>X);let{applySlots:D0}=await o("stx/slots",()=>import("./chunk-gkmtkzdm.js")),{defaultSlot:S0,namedSlots:Z2}=I;G0=await D0(G0,S0,Z2,C);let M2=$0.some((d)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(d)),k2=FG($0),S=Array.isArray(C.__stx_client_signal_names)?C.__stx_client_signal_names:[];if(k2.length>0||S.length>0)C.__stx_client_signal_names=[...new Set([...S,...k2])];let f={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:h.dirname(V),skipSignalsRuntime:!0,skipEventDirectives:M2||$0.length===0,defaultLayout:void 0};C.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let s=await O$(G0,C,V,f,q),r=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let d of s.matchAll(/\{\{([\s\S]*?)\}\}/g))r.add(d[1].trim());if(r.size>0)Y.__stx_preserved_client_expressions=[...r];let Y0=b,Q0=s;if(M2){let d="";if(Object.keys(Z).length>0)try{d=` data-stx-props="${q8(JSON.stringify(Z))}"`}catch{}let m=j?` stx-hydrate="${q8(j)}"`:"";Q0=`<div data-stx-scope="${Y0}"${d}${m}>${s}</div>`;let K0=await Promise.all($0.map(async(i)=>{let L0=i.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!L0)return i;let[,O0,P0]=L0,{vendorStyleTags:j1,factoryBody:b0}=await DG(P0,V,G.buildMode==="compile"),n=j?null:y9(Y,b0),m0=n?`window.__stxComponentFactories[${JSON.stringify(n)}](${JSON.stringify(Y0)});`:`(${b0})(${JSON.stringify(Y0)});`;if(j)return`${j1}<script type="stx/island" data-stx-island="${Y0}" data-stx-scoped${O0}>${m0}</script>`;return`${j1}<script data-stx-scoped data-stx-run="always"${O0}>${m0}</script>`}));if(Q0=Q0+`
3620
- `+K0.join(`
3621
- `),p)Q0+=`
3622
- `+p}else{if(p)Q0+=`
3623
- `+p;if($0.length>0){let d=C.__stx_event_bindings||[],m=R9(C),K0=await Promise.all($0.map(async(i)=>{let L0=i.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!L0)return i;return await D9(L0[1],{eventBindings:d,templateContent:Q0,filePath:V,projectRoot:process.cwd(),serverData:m})}));Q0+=`
3624
- `+K0.join(`
3625
- `),C.__stx_event_bindings=[]}}if(q0){let d=z9(Q0,V);if(d.hasScoped)Q0=d.html}if(M0&&C0){let d=Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[];M9.set(M0,{output:Q0,dependencies:[...q].filter((m)=>!C0.has(m)),clientFactories:Z0?g$(Y,Z0):[],uidsConsumed:E.n-H0,preservedClientExpressions:k0?d.filter((m)=>!k0.has(m)):[]})}return N.length>0?`${Q0}
3626
- ${N.join(`
3627
- `)}`:Q0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{U.delete($)}}async function a($){return Bun.file($).exists()}function N$($,Z){let X=h.resolve(Z),J=h.resolve($),Y=X.endsWith(h.sep)?X:X+h.sep;if(J===X||J.startsWith(Y))return J;return null}async function wG($,Z,X,J){let Y=Z.startsWith("layouts/")?Z.slice(8):Z,Q=h.join($,Y);for(let G of Q.endsWith(".stx")?[Q]:[Q,`${Q}.stx`])if(await a(G)){if(J)console.log(`Found layout in ${$}: ${G}`);return X?.add(G),G}return null}async function c2($,Z,X,J){let Y=await RG($,Z,X,J);if(Y===null)return null;let Q=N$(Y,process.cwd());if(Q)return Q;let G=[X.root,X.layoutsDir,X.fallbackLayoutsDir,X.componentsDir,X.partialsDir,X.pagesDir].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let q=h.isAbsolute(z)?z:h.resolve(process.cwd(),z);if(N$(Y,q))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${Z})`),null}async function RG($,Z,X,J){if(X.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Y=h.dirname(Z),Q=process.cwd();if($.startsWith("/")){let H=h.join(Q,$),j=N$(H,Q);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(X.debug)console.log(`Checking absolute path: ${j}`);if(await a(j)&&J)J.add(j);return j}let G=h.join(Y,$);if(await a(G)){if(X.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let H of[".stx",".tsx",".jsx"]){let j=`${G}${H}`;if(await a(j)){if(X.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let z=[];if(X.layoutsDir)z.push(h.isAbsolute(X.layoutsDir)?X.layoutsDir:h.resolve(process.cwd(),X.layoutsDir));let q=h.resolve(Y),K=process.cwd();for(let H=0;H<10;H++){let j=h.join(q,"layouts"),B=!1;try{B=KG.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){z.push(j);break}let _=h.dirname(q);if(_===q||_.length<K.length)break;q=_}for(let H of z){let j=await wG(H,$,J,X.debug);if(j)return j}if(X.fallbackLayoutsDir){let H=h.isAbsolute(X.fallbackLayoutsDir)?X.fallbackLayoutsDir:h.resolve(process.cwd(),X.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[h.join(H,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let _ of B)if(await a(_)){if(X.debug)console.log(`Found in options.fallbackLayoutsDir: ${_}`);if(J)J.add(_);return _}}if($.startsWith("layouts/")||$.includes("/layouts/")){let H=$.split("layouts/"),j=h.join(X.partialsDir||Y,"layouts",H[1]);if(await a(j)){if(X.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(X.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(X.partialsDir){let H=h.join(X.partialsDir,"layouts");if(await a(H)){let j=h.join(H,$);if(await a(j)){if(X.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await a(B)){if(X.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let U=X.partialsDir||h.join(process.cwd(),"views"),W=h.join(U,$);if(await a(W)){if(X.debug)console.log(`Found in views path: ${W}`);if(J)J.add(W);return W}if(!$.endsWith(".stx")){let H=`${W}.stx`;if(await a(H)){if(X.debug)console.log(`Found in views path with extension: ${H}`);if(J)J.add(H);return H}}if(Y.includes("temp")){let H=h.join(h.dirname(Y),"layouts",$);if(await a(H)){if(X.debug)console.log(`Found in temp layouts dir: ${H}`);if(J)J.add(H);return H}if(!$.endsWith(".stx")){let j=`${H}.stx`;if(await a(j)){if(X.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(X.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function j8($,Z,X){let J=0,Y="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
3628
- `),z=0;for(let q=0;q<G.length;q++)if(z+=G[q].length+1,z>=Z){J=q+1,Y=G[q].trim();let K=Math.max(0,q-2),U=Math.min(G.length,q+3);Q=G.slice(K,U).map((W,H)=>{let j=K+H+1;return`${j===J?"> ":" "}${j}: ${W}`}).join(`
3629
- `);break}}else if(X){let G=$.indexOf(X);if(G>=0)return j8($,G)}}catch{}return{lineNumber:J,lineContent:Y,context:Q}}var t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"};function j0($,Z,X,J,Y,Q){let{lineNumber:G,context:z}=j8(J,Y,Q),q=X.split("/").pop(),K=0;if(typeof Y==="number"&&Y>=0&&J){let W=J.lastIndexOf(`
3630
- `,Math.max(0,Y-1));K=Y-(W+1)+1}let U="";if(G>0)U+=`
3631
- ${X}:${G}${K>0?`:${K}`:""}: ${$.toLowerCase()} error: ${Z}
3632
- `;if(U+=`
3633
- ${t.bold}${t.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${t.reset}
3634
- `,U+=`${t.bold}${t.red}\u2502${t.reset} ${t.bold}${t.bgRed} ERROR ${t.reset} ${t.red}${$} Error${t.reset}${" ".repeat(Math.max(0,43-$.length))}${t.bold}${t.red}\u2502${t.reset}
3635
- `,U+=`${t.bold}${t.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${t.reset}
3636
- `,U+=`
3637
- ${t.cyan}${t.bold}File:${t.reset} ${t.dim}${q}${t.reset}`,G>0)U+=` ${t.gray}(line ${G}${K>0?`, col ${K}`:""})${t.reset}`;if(U+=`
3638
- ${t.yellow}${t.bold}Message:${t.reset} ${Z}
3639
- `,z)U+=`
3640
- ${t.blue}${t.bold}Context:${t.reset}
3641
- ${t.dim}${z}${t.reset}
3642
- `;return U}function __(){N2.clear(),A9.clear(),M9.clear()}function V_(){return{size:N2.size,maxSize:500}}var R$=e1(128);async function DG($,Z,X){let J=M1($,Z,X),Y=R$.get(J);if(Y){if(W8(Y.deps))return Y;R$.delete(J)}let Q=A$($,{filePath:Z,projectRoot:process.cwd()}),G=Q.code,z=M$(Q.styles);G=l1(G).code;let{hasUserImports:q,bundleClientScript:K}=await o("stx/client-script-bundler",()=>import("./chunk-43r6p08p.js")),U=[],W=!1;if(q(G)){let V=G;G=await K(V,Z,{projectRoot:process.cwd(),minify:X,collectInputs:U}),W=G===V}let{stripStxRuntimeImports:H}=await o("stx/signal-processing",()=>import("./chunk-hzw1ekq3.js"));G=H(G);let j=t0(G),B=jG(j),_=`function(__scopeId) {
3643
- ${x1("const",[...K8,...B],j)}
3644
- const __scope = window.stx._scopes = window.stx._scopes || {};
3645
- const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
3646
- __scopeVars.$refs = __scopeVars.$refs || {};
3647
- const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
3648
- window.__STX_CURRENT_ELEMENT__ = document.querySelector('[data-stx-scope="' + __scopeId + '"]');
3649
-
3650
- // Scope-specific lifecycle callbacks
3651
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
3652
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
3653
- const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
3654
- const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
3655
-
3656
- try {
3657
- ${j}
3658
-
3659
- // Register all defined signals and functions in this scope
3660
- const __localVars = {};
3661
- try {
3662
- ${B.map((V)=>`if (typeof ${V} !== 'undefined') __localVars['${V}'] = ${V};`).join(`
3663
- `)}
3664
- }
3665
- catch (e) {}
3666
- Object.assign(__scopeVars, __localVars);
3667
- }
3668
- finally {
3669
- window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
3670
- }
3671
- }`,O={vendorStyleTags:z,factoryBody:_,deps:U8([...U,...Q.styles.map((V)=>V.resolvedPath)])};if(!W&&Q.unresolved.length===0)R$.set(J,O);return O}var NG=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;function AG($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let X=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function MG($,Z){let X=Z;while(!0){let J=I1.join(X,"node_modules",$,"package.json");if(A2.existsSync(J))return I1.dirname(J);let Y=I1.dirname(X);if(Y===X)return null;X=Y}}function kG($,Z){if(!$||typeof $!=="object")return null;let X=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return X(Y.import);if(typeof Y.default==="object")return X(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return X($[Z]);let J=null;for(let Y of Object.keys($)){let Q=Y.indexOf("*");if(Q===-1)continue;let G=Y.slice(0,Q),z=Y.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Y,prefix:G,suffix:z}}if(J){let Y=Z.slice(J.prefix.length,Z.length-J.suffix.length),Q=X($[J.pattern]);if(Q)return Q.replace("*",Y)}return null}function IG($,Z){let X=AG($);if(!X||!X.subpath)return null;let J=MG(X.pkg,Z);if(!J)return null;let Y;try{Y=JSON.parse(A2.readFileSync(I1.join(J,"package.json"),"utf8"))}catch{return null}let Q=`.${X.subpath}`,G=kG(Y.exports,Q);if(!G)return null;let z=I1.resolve(J,G);return A2.existsSync(z)?z:null}function A$($,Z){let X=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Y=new Set,Q=[],G=[];return{code:$.replace(NG,(q,K)=>{let U;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(U=K.startsWith("/")?K:I1.resolve(X,K),!A2.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(K,J)}catch{W=IG(K,J)}if(!W)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${W?.message||W}`),G.push(K),""}if(Y.has(U))return"";Y.add(U);try{let W=A2.readFileSync(U,"utf8");Q.push({source:K,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`),G.push(K)}return""}),styles:Q,unresolved:G}}function TG($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function M$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${TG(Z.source)}" data-stx-layer="vendor">
3672
- @layer vendor {
3673
- ${Z.contents}
3674
- }
3675
- </style>`}).join(`
3676
- `)}
3677
- `}var EG=L8;function l1($){let Z=l0($),X=new Set;for(let z of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of z[1].split(",")){let K=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)X.add(K)}let J=new Set;for(let z of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(z[1]);for(let z of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of z[1].split(",")){let K=q.trim().split(/[:=]/).pop()?.trim();if(K)J.add(K)}let Y=V2.filter((z)=>{if(X.has(z)||J.has(z))return!1;return new RegExp(`\\b${z}\\s*\\(`).test(Z)}),Q=F8(Z).filter((z)=>!X.has(z)&&!J.has(z));if(Y.length===0&&Q.length===0)return{code:$,imports:Y,models:Q};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3678
- `)}
3679
- ${$}`,imports:Y,models:Q}}var bG=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);function F8($){let Z=new Set,X=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=X.exec($))!==null)if(!bG.has(J[1]))Z.add(J[1]);return Array.from(Z)}function yG($){let Z=new Set;for(let X of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(X[1]);for(let X of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of X[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function w8($){let Z=new Set,X=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],H=G[2];if(G[0].includes("import type"))continue;let j=[];for(let _ of W.split(",")){let O=_.trim();if(!O||O.startsWith("type "))continue;let V=O.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!V)continue;let L=V[1],F=V[2]||L;if(Y.add(L),Y.add(F),H==="stx"||H==="@stacksjs/stx")Z.add(L);else X.add(L);if(F!==L)j.push(`${F} = ${L}`)}let B=j.length>0?`var ${j.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(G[0],B)}let z=yG(J);for(let W of EG){if(Y.has(W)||z.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))Z.add(W)}let q=l0(J),K=new Set;for(let W of J.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let H of W[1].split(",")){let j=H.trim().replace(/^type\s+/,"").split(/\s+as\s+/);for(let B of j){let _=B.trim();if(_)K.add(_)}}for(let W of V2){if(Y.has(W)||z.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(q))X.add(W)}let U=F8(J);for(let W of U)if(!Y.has(W)&&!z.has(W))X.add(W);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(X)}}function R8($,Z){let X=[];if($.length>0)X.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)X.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(X.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3680
- ${X.join(`
3681
- `)}
3682
- ${CG($,Z)}`;return""}function C_($,Z=[]){let{browserImports:X}=w8($),J=new Set(Z);return R8([],X.filter((Y)=>!J.has(Y)))}function CG($,Z){let X=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...Z.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(X.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3683
- [${X.join(", ")}].forEach(function (e) {
3684
- if (e[1] !== 'undefined') return;
3685
- console.error(
3686
- '[stx] "' + e[0] + '" is used in this client script and auto-imported from ' + e[2] + ', '
3687
- + 'but the client runtime does not provide it. Either it is not exported to the browser, '
3688
- + 'or it should be imported from a relative path so the bundler includes it.'
3689
- );
3690
- });
3691
- `}function R9($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let J={};for(let Y in Z){let Q=Z[Y];if(typeof Q==="function")continue;J[Y]=Q}return J.__stxDeclaredPayload=!0,J}let X={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;X[J]=Y}return X}function B8($,Z){let X=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(Z){let Q=Y.lastIndexOf(":");if(Q!==-1)Y=Y.slice(Q+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))X.add(Y)}return X}function SG($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(B8(X[1],!0).has(Z))return!0;for(let X of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(B8(X[1],!1).has(Z))return!0;return!1}function PG($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}var vG=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,_8=new Set;function fG($,Z){let X=vG.test($),J=Z.length>32768;if(!X&&!J)return;if(_8.has($))return;if(_8.add($),X)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(J)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function p5($,Z){if(!Z)return"";let X=l0($),J=Z.__stxDeclaredPayload===!0,Y=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!J&&!PG(X,Q))continue;if(SG($,Q))continue;let z;try{z=JSON.stringify(G)}catch{continue}if(z===void 0)continue;fG(Q,z),Y.push(` var ${Q} = ${z.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3692
- ${Y.join(`
3693
- `)}
3694
- `}var xG={left:0,middle:1,right:2};function gG($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let X of $.systemKeys)Z.push(`if (!$event.${X}Key) return`);if($.keys.length>0){let X=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if($.mouse!==null){let X=xG[$.mouse];Z.push(`if ($event.button !== ${X}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function hG($,Z){let{elementId:X,event:J,modifiers:Y}=$,Q=E9($.handler),G=gG(Y),z=[];if(Y.once)z.push("once: true");if(Y.capture)z.push("capture: true");if(Y.passive)z.push("passive: true");let q=z.length>0?`, { ${z.join(", ")} }`:"",K="";if(G)K+=`${G}; `;let U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),W=`var $emit = function(name, detail) {
3695
- $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3696
- };`;function H(j){if(/\$emit\s*\(/.test(j))return`${W}
3697
- ${j}`;return`var scope = $el.closest('[data-stx-scope]');
3698
- if (scope && scope.__stx_execute) {
3699
- scope.__stx_execute('${U}', $event, $el);
3700
- }
3701
- else {
3702
- ${j}
3703
- }`}if(Y.debounce!==null)return` ;(function() {
3704
- // eslint-disable-next-line pickier/no-unused-vars
3705
- var $el = document.getElementById('${X}')
3706
- if (!$el) return
3707
- var __timer
3708
- $el.addEventListener('${J}', function($event) {
3709
- ${G?G+"; ":""}clearTimeout(__timer)
3710
- __timer = setTimeout(function() { ${H(Q)} }, ${Y.debounce})
3711
- }${q})
3712
- })()`;if(Y.throttle!==null)return` ;(function() {
3713
- // eslint-disable-next-line pickier/no-unused-vars
3714
- var $el = document.getElementById('${X}')
3715
- if (!$el) return
3716
- var __last = 0
3717
- $el.addEventListener('${J}', function($event) {
3718
- ${G?G+"; ":""}var __now = Date.now()
3719
- if (__now - __last >= ${Y.throttle}) {
3720
- __last = __now
3721
- ${H(Q)}
3722
- }
3723
- }${q})
3724
- })()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${X}')
3725
- if ($el) $el.addEventListener('${J}', function($event) {
3726
- ${K}${W}
3727
- ${Q}
3728
- }${q})`;return` var $el = document.getElementById('${X}')
3729
- if ($el) $el.addEventListener('${J}', function($event) {
3730
- ${K}var scope = $el.closest('[data-stx-scope]');
3731
- if (scope && scope.__stx_execute) {
3732
- scope.__stx_execute('${U}', $event, $el);
3733
- }
3734
- else {
3735
- ${Q}
3736
- }
3737
- }${q})`}function uG($){if($.length===0)return"";return`
3738
- // STX: auto-generated event bindings
3739
- ${$.map((X,J)=>hG(X,J)).join(`
3740
- `)}`}function V8($){let Z=[],X=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,Q=J.length,G=0;while(G<Q){let z=J[G];if(z==="'"||z==='"'||z==="`"){let q=z;if(G++,q==="`"){let K=0;while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&K===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){K++,G+=2;continue}if(J[G]==="}"&&K>0){K--,G++;continue}G++}}else while(G<Q){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(z==="/"&&J[G+1]==="/"){while(G<Q&&J[G]!==`
3741
- `)G++;continue}if(z==="/"&&J[G+1]==="*"){G+=2;while(G<Q-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Y++,G++;continue}if(z==="}"){Y--,G++;continue}if(Y===0){let q=J.slice(G),K=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let H=K[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=K[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((H)=>{let j=H.trim(),B=j.indexOf(":"),_=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!X.has(_))Z.push(_),X.add(_)}),G+=U[0].length;continue}let W=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(W){let H=W[1];if(!H.startsWith("_")&&!X.has(H))Z.push(H),X.add(H);G+=W[0].length;continue}}G++}return Z}var dG=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"]);function mG($){let Z=new Set,X=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(H){let j;while((j=X.exec(H))!==null){let B=j[0];if(!dG.has(B))Z.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=Y.exec($))!==null)J(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)J(Q[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=z.exec($))!==null)J(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)J(Q[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)J(Q[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=U.exec($))!==null)J(Q[1]);let W=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=W.exec($))!==null)J(Q[1]);return Z}async function D9($,Z={}){let X=$,J="",Y=!1,Q=[],G=A$(X,{filePath:Z.filePath,projectRoot:Z.projectRoot});X=G.code;let z=M$(G.styles),q=l1(X);X=q.code,Q=[...q.imports,...q.models];let{hasUserImports:K,bundleClientScript:U}=await o("stx/client-script-bundler",()=>import("./chunk-43r6p08p.js"));if(K(X))X=await U(X,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Y=!0;if(Z.autoImports!==!1){let L=w8(X);X=L.code,J=R8(L.stxImports,L.browserImports.filter((F)=>!Q.includes(F)))}if(J=`${p5(X,Z.serverData)}${J}`,X=t0(X),!Y&&F1(Z.attrs||""))X=w1(X);let W=uG(Z.eventBindings||[]),H=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(H)){let L=H.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${z}<script ${F}>
3742
- ${m1(`${J}${X}
3743
- ${W}`)}
3744
- </script>`}let B=O8($),_=/function __stx_setup_/.test(X),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function V(L){let F=L.length>0?`
3745
- return { ${L.join(", ")} };`:"";return`${z}<script data-stx-scoped data-stx-run="always">
3746
- window.stx.mount(function() {
3747
- 'use strict';
3748
- ${m1(`${J}${X}
3749
- ${W}${F}`)}
3750
- })</script>`}if(!O&&!_){if(B)return V(V8($));if(Z.templateContent){let L=V8($);if(L.length>0){let F=mG(Z.templateContent);if(L.some((R)=>F.has(R)))return V(L)}}}return`${z}<script data-stx-scoped data-stx-run="always">
3751
- ;(function() {
3752
- 'use strict';
3753
- ${m1(`${J}${X}
3754
- ${W}`)}
3755
- })()</script>`}
3756
- export{e8 as jl,$Z as kl,ZZ as ll,e0 as ml,f9 as nl,x9 as ol,g9 as pl,h9 as ql,U3 as rl,K3 as sl,KZ as tl,WZ as ul,jZ as vl,Mz as wl,kz as xl,Iz as yl,Tz as zl,Ez as Al,a8 as Bl,Q3 as Cl,G3 as Dl,z3 as El,q3 as Fl,Nz as Gl,w3 as Hl,G2 as Il,E9 as Jl,b9 as Kl,T8 as Ll,P$ as Ml,cG as Nl,t0 as Ol,iG as Pl,V2 as Ql,a1 as Rl,Fj as Sl,A$ as Tl,M$ as Ul,EG as Vl,l1 as Wl,w8 as Xl,R8 as Yl,C_ as Zl,R9 as _l,p5 as $l,D9 as am,rG as bm,v2 as cm,aG as dm,tG as em,eG as fm,$z as gm,X1 as hm,X2 as im,x2 as jm,C8 as km,Kz as lm,S8 as mm,Uz as nm,C9 as om,s$ as pm,J1 as qm,S9 as rm,f8 as sm,Wz as tm,B1 as um,x8 as vm,v0 as wm,Hz as xm,_z as ym,c8 as zm,p8 as Am,X3 as Bm,J3 as Cm,Y3 as Dm,Rz as Em,W3 as Fm,d9 as Gm,Y2 as Hm,g2 as Im,Sz as Jm,u9 as Km,VZ as Lm,LZ as Mm,OZ as Nm,Pz as Om,j3 as Pm,B3 as Qm,z1 as Rm,s2 as Sm,B0 as Tm,G4 as Um,q5 as Vm,q1 as Wm,V1 as Xm,z4 as Ym,U2 as Zm,r2 as _m,K5 as $m,IX as an,EX as bn,U4 as cn,yX as dn,CX as en,H4 as fn,L1 as gn,vK as hn,j4 as in,_5 as jn,xX as kn,B5 as ln,gX as mn,hX as nn,fK as on,xK as pn,B4 as qn,_4 as rn,V4 as sn,uX as tn,dX as un,gK as vn,hK as wn,mX as xn,uK as yn,dK as zn,F4 as An,N4 as Bn,O5 as Cn,tK as Dn,j2 as En,F5 as Fn,w5 as Gn,eK as Hn,YJ as In,$U as Jn,QJ as Kn,k4 as Ln,ZU as Mn,GJ as Nn,XU as On,JU as Pn,t2 as Qn,s7 as Rn,GH as Sn,zH as Tn,qH as Un,KH as Vn,$Q as Wn,t4 as Xn,UQ as Yn,W$ as Zn,I7 as _n,wW as $n,y7 as ao,wY as bo,DY as co,d7 as do,i5 as eo,m7 as fo,c7 as go,n5 as ho,CY as io,SY as jo,p7 as ko,l5 as lo,PY as mo,fY as no,X8 as oo,sQ as po,rQ as qo,aQ as ro,tQ as so,eQ as to,J8 as uo,JG as vo,zG as wo,qG as xo,u4 as yo,d4 as zo,LU as Ao,y4 as Bo,OU as Co,N5 as Do,A5 as Eo,M5 as Fo,p4 as Go,i4 as Ho,n4 as Io,c3 as Jo,p3 as Ko,i3 as Lo,n3 as Mo,$5 as No,Z5 as Oo,bq as Po,yq as Qo,Cq as Ro,$X as So,Sq as To,dU as Uo,mU as Vo,s4 as Wo,lU as Xo,yJ as Yo,$7 as Zo,Y7 as _o,H7 as $o,z9 as ap,P5 as bp,ZY as cp,v5 as dp,L7 as ep,O7 as fp,UY as gp,QW as hp,GW as ip,F7 as jp,zW as kp,qW as lp,f5 as mp,w7 as np,K9 as op,U9 as pp,d1 as qp,HY as rp,D7 as sp,N7 as tp,WW as up,x5 as vp,jY as wp,BY as xp,g5 as yp,h5 as zp,A7 as Ap,M7 as Bp,H$ as Cp,j$ as Dp,V$ as Ep,O$ as Fp,xQ as Gp,mQ as Hp,lQ as Ip,cQ as Jp,pQ as Kp,HG as Lp,F1 as Mp,w$ as Np,w1 as Op,F9 as Pp,LG as Qp,OG as Rp,FG as Sp,D1 as Tp,a as Up,c2 as Vp,j8 as Wp,j0 as Xp,__ as Yp,V_ as Zp,R3 as _p,D3 as $p,_1 as aq,N3 as bq,y1 as cq,A3 as dq,z2 as eq,nz as fq,CZ as gq,l9 as hq,oz as iq,c9 as jq,sz as kq,rz as lq,G1 as mq,az as nq,tz as oq,ez as pq,$q as qq,Zq as rq,Xq as sq,SZ as tq,i9 as uq,M3 as vq,Yq as wq,Qq as xq,Gq as yq,zq,qq as Aq,I3 as Bq,Kq as Cq,T3 as Dq,Uq as Eq,Wq as Fq,q2 as Gq,hZ as Hq,_q as Iq,dZ as Jq,P3 as Kq,m2 as Lq,Rq as Mq,d3 as Nq,e9 as Oq,hq as Pq,J5 as Qq,GX as Rq,UX as Sq,uq as Tq,dq as Uq,mq as Vq,lq as Wq,cq as Xq,pq as Yq,WX as Zq,HX as _q,o3 as $q,J4 as ar,VX as br,Q5 as cr,Y4 as dr,zK as er,qK as fr,z5 as gr,DX as hr,Q4 as ir};