@stacksjs/stx 0.2.286 → 0.2.288

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 (204) hide show
  1. package/dist/builtins/index.d.ts +4 -3
  2. package/dist/builtins/index.js +11 -11
  3. package/dist/{chunk-3bv8h4r6.js → chunk-02af607x.js} +1 -1
  4. package/dist/chunk-06706a9a.js +2 -0
  5. package/dist/chunk-0896td83.js +2 -0
  6. package/dist/chunk-08yja60e.js +2 -0
  7. package/dist/{chunk-e2w23g2r.js → chunk-13tawjw8.js} +10 -10
  8. package/dist/{chunk-zn5jgmqw.js → chunk-1e83cj7k.js} +1 -1
  9. package/dist/chunk-1g6pvs7k.js +11 -0
  10. package/dist/chunk-1gvebxh4.js +2 -0
  11. package/dist/{chunk-jbfpc4z7.js → chunk-1t9g3mhg.js} +2 -2
  12. package/dist/{chunk-0f1kz0x2.js → chunk-2e6xafcm.js} +1 -1
  13. package/dist/chunk-2rfxs7zm.js +2 -0
  14. package/dist/{chunk-sskbegsz.js → chunk-2vza9m2x.js} +1 -1
  15. package/dist/{chunk-pbk8jxe2.js → chunk-2wtn443n.js} +1 -1
  16. package/dist/{chunk-6cye5m9f.js → chunk-34qkshwh.js} +2 -2
  17. package/dist/{chunk-2g9jwgs7.js → chunk-3br3pt6k.js} +1 -1
  18. package/dist/{chunk-kmhr1z0m.js → chunk-3p0n9ryv.js} +1 -1
  19. package/dist/chunk-437n7hyx.js +2 -0
  20. package/dist/{chunk-ayrjwkyw.js → chunk-461br5nn.js} +1 -1
  21. package/dist/chunk-4tr92e0v.js +2 -0
  22. package/dist/{chunk-t6nseeb9.js → chunk-4vpsvh6x.js} +1 -1
  23. package/dist/{chunk-nh21517m.js → chunk-5j9tvhpq.js} +2 -2
  24. package/dist/{chunk-mb518a4n.js → chunk-5yp3vt00.js} +1 -1
  25. package/dist/{chunk-e4hhz9j3.js → chunk-5zcg61j9.js} +2 -2
  26. package/dist/{chunk-snknv47x.js → chunk-6085vha7.js} +1 -1
  27. package/dist/{chunk-9th1wd1d.js → chunk-72c7gyqc.js} +3 -3
  28. package/dist/chunk-811cxzn4.js +2 -0
  29. package/dist/{chunk-bz2gytfs.js → chunk-8883pgj8.js} +1 -1
  30. package/dist/{chunk-vqxmxgaj.js → chunk-8bxtvsgm.js} +1 -1
  31. package/dist/{chunk-a63y3aa0.js → chunk-8daczchh.js} +1 -1
  32. package/dist/chunk-91ffbzmh.js +2 -0
  33. package/dist/chunk-96cqevhm.js +2 -0
  34. package/dist/chunk-978faewt.js +2 -0
  35. package/dist/{chunk-g3fy0tw8.js → chunk-9veqmqb6.js} +154 -48
  36. package/dist/{chunk-7q9mwh4v.js → chunk-a668m28h.js} +1 -1
  37. package/dist/{chunk-xg57nax9.js → chunk-a9fxxwrv.js} +2 -2
  38. package/dist/chunk-adkjxvy6.js +2 -0
  39. package/dist/{chunk-a2qghr2x.js → chunk-agx0620p.js} +1 -1
  40. package/dist/chunk-ak06mywr.js +2 -0
  41. package/dist/chunk-ayaz0wcj.js +2 -0
  42. package/dist/{chunk-ah4e6e09.js → chunk-bphx7ngb.js} +2 -2
  43. package/dist/chunk-bw48gj8j.js +2 -0
  44. package/dist/{chunk-7rxtra1g.js → chunk-byq2xpgb.js} +1 -1
  45. package/dist/chunk-bzsjhyet.js +2 -0
  46. package/dist/{chunk-rhs51nmz.js → chunk-ch31zddx.js} +2 -2
  47. package/dist/chunk-cqzqfm7m.js +2 -0
  48. package/dist/{chunk-9zndrzb3.js → chunk-d0f60jrg.js} +2 -2
  49. package/dist/{chunk-c0an64km.js → chunk-dcxtrqfy.js} +1 -1
  50. package/dist/{chunk-bf8wf3r2.js → chunk-drbbt69f.js} +35 -10
  51. package/dist/chunk-e0aybavh.js +2 -0
  52. package/dist/chunk-e63a220e.js +28 -0
  53. package/dist/chunk-e67w1bge.js +2 -0
  54. package/dist/chunk-e7kd0ny8.js +2 -0
  55. package/dist/{chunk-y8n174xq.js → chunk-ee2tfpec.js} +2 -2
  56. package/dist/{chunk-9n0gvfrg.js → chunk-efr3ejqt.js} +1 -1
  57. package/dist/chunk-evfct6hb.js +2 -0
  58. package/dist/{chunk-kzyhvrp8.js → chunk-favq46aa.js} +1 -1
  59. package/dist/{chunk-0fgcnv6y.js → chunk-fcfphfpw.js} +2 -2
  60. package/dist/{chunk-w95sp0k9.js → chunk-fed3xsp9.js} +2 -2
  61. package/dist/{chunk-e7jfpyqy.js → chunk-ffmtamm2.js} +1 -1
  62. package/dist/{chunk-39f40yc4.js → chunk-fv923f7g.js} +1 -1
  63. package/dist/{chunk-jr3jp3ev.js → chunk-fvh9ca47.js} +1 -1
  64. package/dist/chunk-fxk9j0rm.js +2 -0
  65. package/dist/{chunk-fskfes13.js → chunk-gy933rct.js} +1 -1
  66. package/dist/{chunk-f3hfk78e.js → chunk-h61qt916.js} +1 -1
  67. package/dist/{chunk-c6fw33zh.js → chunk-h7v70dbp.js} +2 -2
  68. package/dist/{chunk-bz820epz.js → chunk-hmf9z4jx.js} +1 -1
  69. package/dist/{chunk-j9g11dzx.js → chunk-hqh7x9h5.js} +2 -2
  70. package/dist/{chunk-hs0387tm.js → chunk-hv5v6vc2.js} +2 -2
  71. package/dist/{chunk-xttsqmkm.js → chunk-jem20v5k.js} +1 -1
  72. package/dist/{chunk-t1k5dpbr.js → chunk-jj6yp7gm.js} +1 -1
  73. package/dist/{chunk-90qr4f9m.js → chunk-jv91rkhx.js} +1 -1
  74. package/dist/{chunk-qbeffw17.js → chunk-jyc9eha6.js} +1 -1
  75. package/dist/{chunk-w3ycm4na.js → chunk-k0y7ta0d.js} +1 -1
  76. package/dist/chunk-k4jt9t4p.js +2 -0
  77. package/dist/{chunk-9y0g8kzt.js → chunk-k70fgb2f.js} +1 -1
  78. package/dist/{chunk-74cv4ta1.js → chunk-k78gvm0g.js} +1 -1
  79. package/dist/{chunk-jn6m8zf7.js → chunk-kb5j08tq.js} +1 -1
  80. package/dist/{chunk-a54n1r1q.js → chunk-kf8t2wq7.js} +1 -1
  81. package/dist/chunk-kfy1jh6p.js +2 -0
  82. package/dist/chunk-kws4rewx.js +17 -0
  83. package/dist/{chunk-s67mgegv.js → chunk-mc58fhgm.js} +1 -1
  84. package/dist/{chunk-n3ggrhb3.js → chunk-mjpqz66q.js} +1 -1
  85. package/dist/{chunk-mjkfc2v6.js → chunk-mmnqd035.js} +1 -1
  86. package/dist/{chunk-54st8g2j.js → chunk-mywp77gt.js} +1 -1
  87. package/dist/{chunk-p396xrew.js → chunk-n0j85038.js} +1 -1
  88. package/dist/{chunk-gjemavhx.js → chunk-n5y9gh1q.js} +1 -1
  89. package/dist/{chunk-qd8ggjdx.js → chunk-n9kk3jz1.js} +1 -1
  90. package/dist/{chunk-49kk0s96.js → chunk-nmkra8q5.js} +2 -2
  91. package/dist/{chunk-s2284nbk.js → chunk-np5dc1q1.js} +1 -1
  92. package/dist/chunk-nygtwffe.js +5 -0
  93. package/dist/{chunk-y6kw0wb7.js → chunk-p0zq5ckb.js} +1 -1
  94. package/dist/chunk-pb16azfa.js +4 -0
  95. package/dist/{chunk-nx5qkm8k.js → chunk-ps20v1ah.js} +1 -1
  96. package/dist/chunk-pv9apyrr.js +2 -0
  97. package/dist/chunk-qj2s3r1w.js +3756 -0
  98. package/dist/chunk-qjkzpd68.js +11 -0
  99. package/dist/chunk-qww39be9.js +2 -0
  100. package/dist/chunk-r90w3x6h.js +2 -0
  101. package/dist/chunk-rb87b7kr.js +2 -0
  102. package/dist/{chunk-an2539bs.js → chunk-rjqfa3g8.js} +2 -2
  103. package/dist/{chunk-2q630fj4.js → chunk-sag55qv7.js} +1 -1
  104. package/dist/chunk-srcbkg7g.js +2 -0
  105. package/dist/chunk-sxderfaa.js +12 -0
  106. package/dist/{chunk-ysnk7x79.js → chunk-t5c7rk0h.js} +1 -1
  107. package/dist/chunk-v2z3creg.js +2 -0
  108. package/dist/chunk-vtjfv7kg.js +2 -0
  109. package/dist/{chunk-5aq35j2e.js → chunk-vvqe2gaz.js} +2 -2
  110. package/dist/{chunk-s7pc68jf.js → chunk-vwzqg4fh.js} +2 -2
  111. package/dist/{chunk-7p9ns60j.js → chunk-vxxxczmn.js} +1 -1
  112. package/dist/chunk-vzzkhjw7.js +2 -0
  113. package/dist/{chunk-wcm80anz.js → chunk-wvq1g6gr.js} +1 -1
  114. package/dist/{chunk-y7m2dpd3.js → chunk-wyxw61az.js} +1 -1
  115. package/dist/{chunk-kdrpx9ft.js → chunk-xpct12p7.js} +1 -1
  116. package/dist/chunk-xvndd7h6.js +2 -0
  117. package/dist/{chunk-d0c3v7ax.js → chunk-y5jjrnfa.js} +1 -1
  118. package/dist/{chunk-vbdca0k1.js → chunk-ym4ggcpy.js} +1 -1
  119. package/dist/{chunk-q68xmak4.js → chunk-ymc99r5x.js} +18 -18
  120. package/dist/{chunk-refwkt87.js → chunk-ynt7y2n5.js} +1 -1
  121. package/dist/chunk-z6azwfb4.js +2 -0
  122. package/dist/chunk-zfnabevq.js +2 -0
  123. package/dist/{chunk-cvnh7dma.js → chunk-zqwmy0av.js} +1 -1
  124. package/dist/{chunk-phhzfeh9.js → chunk-zvw2qgwt.js} +1 -1
  125. package/dist/cli.js +14 -14
  126. package/dist/client-module-registry.d.ts +36 -0
  127. package/dist/client-module-registry.js +55 -0
  128. package/dist/client-script-bundler.d.ts +39 -0
  129. package/dist/client-script-bundler.js +89 -12
  130. package/dist/client-script.js +15 -8
  131. package/dist/component-client-factories.js +10 -5
  132. package/dist/component-processing.d.ts +13 -0
  133. package/dist/component-processing.js +37 -1
  134. package/dist/component-renderer.js +34 -15
  135. package/dist/conditionals.js +14 -3
  136. package/dist/craft-entry.js +1 -1
  137. package/dist/craft.js +1 -1
  138. package/dist/database.js +1 -1
  139. package/dist/document-shell.d.ts +1 -34
  140. package/dist/document-shell.js +19 -11
  141. package/dist/html-masking.d.ts +65 -9
  142. package/dist/html-masking.js +103 -15
  143. package/dist/misc-directives.d.ts +1 -1
  144. package/dist/misc-directives.js +48 -13
  145. package/dist/process.js +38 -7
  146. package/dist/pwa.js +2 -2
  147. package/dist/reactive-bindings.js +2 -0
  148. package/dist/runtime-globals.d.ts +7 -20
  149. package/dist/runtime-globals.js +28 -3
  150. package/dist/safe-evaluator.d.ts +15 -0
  151. package/dist/safe-evaluator.js +16 -12
  152. package/dist/server-bindings.js +21 -5
  153. package/dist/signal-processing.d.ts +17 -7
  154. package/dist/signal-processing.js +116 -46
  155. package/dist/signals-api.js +5 -2
  156. package/dist/signals.js +153 -47
  157. package/dist/ssg.js +2 -2
  158. package/dist/store-loader.js +1 -1
  159. package/dist/strip-literals.d.ts +20 -0
  160. package/dist/strip-literals.js +16 -0
  161. package/dist/utils.js +24 -7
  162. package/dist/variable-extractor.js +17 -47
  163. package/dist/visual-testing.js +1 -1
  164. package/package.json +5 -5
  165. package/dist/chunk-3ehv1by2.js +0 -2
  166. package/dist/chunk-4cqgbcy7.js +0 -3756
  167. package/dist/chunk-52mh63sp.js +0 -11
  168. package/dist/chunk-56ywtaff.js +0 -2
  169. package/dist/chunk-61sj52qh.js +0 -2
  170. package/dist/chunk-7ej1d910.js +0 -2
  171. package/dist/chunk-829pcte9.js +0 -2
  172. package/dist/chunk-8emkx9ja.js +0 -2
  173. package/dist/chunk-ajbfeey7.js +0 -2
  174. package/dist/chunk-areethga.js +0 -2
  175. package/dist/chunk-b29wbjs5.js +0 -2
  176. package/dist/chunk-b7tjq91c.js +0 -2
  177. package/dist/chunk-ba6tthsm.js +0 -2
  178. package/dist/chunk-e4akvata.js +0 -2
  179. package/dist/chunk-f4k2a7vs.js +0 -2
  180. package/dist/chunk-f80wwn5x.js +0 -2
  181. package/dist/chunk-fjkstnz3.js +0 -2
  182. package/dist/chunk-j03bare5.js +0 -2
  183. package/dist/chunk-jg0axas8.js +0 -2
  184. package/dist/chunk-jrk8rhwt.js +0 -28
  185. package/dist/chunk-kawk5ve9.js +0 -2
  186. package/dist/chunk-m3yaa0v5.js +0 -15
  187. package/dist/chunk-m7xnzt2t.js +0 -2
  188. package/dist/chunk-mkn6qqc7.js +0 -2
  189. package/dist/chunk-n3jyv9z6.js +0 -2
  190. package/dist/chunk-nvgxjvnb.js +0 -2
  191. package/dist/chunk-qk8tbcwk.js +0 -2
  192. package/dist/chunk-qp97dx7x.js +0 -2
  193. package/dist/chunk-qsr3bqav.js +0 -12
  194. package/dist/chunk-vb10qph4.js +0 -2
  195. package/dist/chunk-vrvehb01.js +0 -2
  196. package/dist/chunk-vy8v5xdb.js +0 -2
  197. package/dist/chunk-w0sqz3cb.js +0 -11
  198. package/dist/chunk-w8smn72c.js +0 -2
  199. package/dist/chunk-wxk2pbrh.js +0 -2
  200. package/dist/chunk-x1nw1p8z.js +0 -2
  201. package/dist/chunk-xz55q3gr.js +0 -2
  202. package/dist/chunk-yq1d9hb3.js +0 -2
  203. package/dist/chunk-ytgnzeeb.js +0 -2
  204. package/dist/chunk-zfr4d08r.js +0 -2
@@ -0,0 +1,11 @@
1
+ // @bun
2
+ function N(D,G){let j=D[G],F=G+1;while(F<D.length){if(D[F]==="\\"){F+=2;continue}if(D[F]===j)return F+1;F++}return D.length}function O(D,G){let j=G+1;while(j<D.length){if(D[j]==="\\"){j+=2;continue}if(D[j]==="`")return j+1;if(D[j]==="$"&&D[j+1]==="{"){if(j=M(D,j+2),j<D.length)j++;continue}j++}return D.length}function M(D,G){let j=1,F=G;while(F<D.length){let H=D[F];if(H==="\\"){F+=2;continue}if(H==='"'||H==="'"){F=N(D,F);continue}if(H==="`"){F=O(D,F);continue}if(H==="/"&&D[F+1]==="/"){while(F<D.length&&D[F]!==`
3
+ `)F++;continue}if(H==="/"&&D[F+1]==="*"){F+=2;while(F<D.length&&D.slice(F,F+2)!=="*/")F++;F+=2;continue}if(H==="{"){j++,F++;continue}if(H==="}"){if(j--,j===0)return F;F++;continue}F++}return D.length}function R(D){let G="",j=0;while(j<D.length){let F=D.slice(j,j+2);if(F==="//"){while(j<D.length&&D[j]!==`
4
+ `)G+=" ",j++;continue}if(F==="/*"){while(j<D.length&&D.slice(j,j+2)!=="*/")G+=D[j]===`
5
+ `?`
6
+ `:" ",j++;G+=" ",j+=2;continue}let H=D[j];if(H==='"'||H==="'"){let J=H;G+=" ",j++;while(j<D.length&&D[j]!==J){if(D[j]==="\\"){G+=" ",j+=2;continue}G+=D[j]===`
7
+ `?`
8
+ `:" ",j++}G+=" ",j++;continue}if(H==="`"){G+=" ",j++;while(j<D.length&&D[j]!=="`"){if(D[j]==="\\"){G+=" ",j+=2;continue}if(D[j]==="$"&&D[j+1]==="{"){let J=j+2,K=M(D,J);if(G+=" ",G+=R(D.slice(J,K)),K<D.length)G+=" ";j=K+1;continue}G+=D[j]===`
9
+ `?`
10
+ `:" ",j++}G+=" ",j++;continue}G+=H,j++}return G}function U(D){let G=new Uint16Array(D.length),j=0,F=!0;for(let H=0;H<D.length;H++){let J=D[H];if(J===")"||J==="]"||J==="}")if(j===0)F=!1;else j--;if(G[H]=j,J==="("||J==="["||J==="{")j++}return{depths:G,balanced:F&&j===0}}
11
+ export{M as Ys,R as Zs,U as _s};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Co as a,Do as b,Eo as c,Fo as d,Go as e,Ho as f}from"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{f as processStackReplacements,e as processStackPushDirectives,d as processIncludes,a as partialsCache,b as onceStore,c as clearOnceStore};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ai as a,Bi as b,Ci as c,Di as d,Ei as e}from"./chunk-wyxw61az.js";import"./chunk-2vza9m2x.js";export{c as renderSSRSuspense,a as processSuspenseDirectives,e as generateSuspenseRuntime,d as generateSuspenseCSS,b as createSSRSuspense};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{do as a,eo as b,fo as c,go as d,ho as e,io as f,jo as g,ko as h,lo as i,mo as j,no as k,oo as l,po as m}from"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{m as stripStxRuntimeImports,b as scanScriptTags,l as rewriteStxImportSpecifiers,j as processSignals,h as processScriptSetup,f as preEvalLiteralReactiveIfs,c as parseLoopExpression,d as hasSignalsSyntax,k as findMarkupIndexOutsideScripts,i as extractExports,g as convertSignalLoopsToAttributes,e as convertSignalDirectivesToAttributes,a as clearScriptScanCache};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ql as C}from"./chunk-4cqgbcy7.js";import{Ws as Y}from"./chunk-52mh63sp.js";import{Ut as D}from"./chunk-c6fw33zh.js";import u from"path";var S=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function h(K){let J=(Q)=>Q.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,J).replace(/\{\{--[\s\S]*?--\}\}/g,J)}function m(K){let J=[],Q=h(K);S.lastIndex=0;let $;while(($=S.exec(Q))!==null){let j=($[1]||"").trim(),F=($[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=($[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=$.index+F,Z=$.index+$[0].length-z,G=K.slice(W,Z);if(/\bsrc\s*=/.test(j))continue;let q=j.match(/\btype\s*=\s*["']([^"']+)["']/i);if(q&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(q[1]))continue;let X=/\bserver\b/.test(j)?"server":/\bclient\b/.test(j)?"client":"plain",U=B(K,W);J.push({kind:X,code:G,startLine:U,attrs:j})}return J}function B(K,J){let Q=1;for(let $=0;$<J&&$<K.length;$++)if(K.charCodeAt($)===10)Q++;return Q}function N(K,J){let Q=K.lastIndexOf(`
2
+ import{Rl as C}from"./chunk-qj2s3r1w.js";import{Zs as Y}from"./chunk-qjkzpd68.js";import{_t as D}from"./chunk-h7v70dbp.js";import u from"path";var S=/<script(\s[^>]*)?>([\s\S]*?)<\/script>/gi;function h(K){let J=(Q)=>Q.replace(/[^\n]/g," ");return K.replace(/<!--[\s\S]*?-->/g,J).replace(/\{\{--[\s\S]*?--\}\}/g,J)}function m(K){let J=[],Q=h(K);S.lastIndex=0;let $;while(($=S.exec(Q))!==null){let j=($[1]||"").trim(),F=($[0].match(/^<script(?:\s[^>]*)?>/i)?.[0]??"<script>").length,z=($[0].match(/<\/script\s*>$/i)?.[0]??"</script>").length,W=$.index+F,Z=$.index+$[0].length-z,G=K.slice(W,Z);if(/\bsrc\s*=/.test(j))continue;let q=j.match(/\btype\s*=\s*["']([^"']+)["']/i);if(q&&!/^(?:module|text\/(?:javascript|typescript))$/i.test(q[1]))continue;let X=/\bserver\b/.test(j)?"server":/\bclient\b/.test(j)?"client":"plain",U=B(K,W);J.push({kind:X,code:G,startLine:U,attrs:j})}return J}function B(K,J){let Q=1;for(let $=0;$<J&&$<K.length;$++)if(K.charCodeAt($)===10)Q++;return Q}function N(K,J){let Q=K.lastIndexOf(`
3
3
  `,J-1)+1;return J-Q+1}function g(K){let J=K.split(""),Q=(j,F)=>{for(let z=j;z<F&&z<J.length;z++)if(J[z]!==`
4
4
  `)J[z]=" "},$=[/<script(?:\s[^>]*)?>[\s\S]*?<\/script>/gi,/<style(?:\s[^>]*)?>[\s\S]*?<\/style>/gi,/<!--[\s\S]*?-->/g,/\{\{--[\s\S]*?--\}\}/g,/@verbatim\b[\s\S]*?@endverbatim\b/g];for(let j of $){j.lastIndex=0;let F;while((F=j.exec(K))!==null)Q(F.index,F.index+F[0].length)}return J.join("")}function p(K){let J=0,Q="";for(let $=0;$<K.length;$++){let j=K[$];if(Q){if(j==="\\"){$++;continue}if(j===Q)Q="";continue}if(j==='"'||j==="'"||j==="`"){Q=j;continue}if(j==="("||j==="["||j==="{"){J++;continue}if(j===")"||j==="]"||j==="}"){J--;continue}if(j==="|"&&J===0){if(K[$+1]==="|"){$++;continue}if(K[$-1]==="|")continue;return K.slice(0,$)}}return K}var R=new Set([":for","x-for","v-for"]),w=/(?:^|\s)((?::|x-|v-|@)[\w.:-]+)\s*=\s*(["'])([\s\S]*?)\2/g,O="__stx_interpolated",y="__StxElement",f="__StxTemplateValue",l=`type ${f}<T> = T extends { readonly _isSignal: true } | { readonly _isDerived: true } ? (T extends () => infer V ? T & V : T) : T`;function L(K){return K.replace(/\{\{[\s\S]*?\}\}/g,O).replace(/\{!![\s\S]*?!!\}/g,O)}function Vj(K){return K.replace(/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/g,(J)=>{let Q=J.split(`
5
5
  `).length-1,$=J.length-Q;return`0${" ".repeat(Math.max(0,$-1))}${`
@@ -19,4 +19,4 @@ import{Ql as C}from"./chunk-4cqgbcy7.js";import{Ws as Y}from"./chunk-52mh63sp.js
19
19
  `))z(Z);for(let Z of t().split(`
20
20
  `))z(Z);for(let Z of C)z(`declare var ${Z}: any`);for(let Z of Zj)z(`declare var ${Z}: any`);z(`declare var ${O}: any`);let W=new Set(Q.flatMap((Z)=>V(Z.code)));z(`type ${y}<T> = T extends readonly (infer E)[] ? E : T extends Iterable<infer E2> ? E2 : any`);for(let Z of n(K)){if(W.has(Z.name))continue;let G=Z.iterable&&W.has(Z.iterable)?`${y}<typeof ${Z.iterable}>`:"any";z(`declare var ${Z.name}: ${G}`)}}if(J.templateExpressions!==!1){let W=c(K).map((Z)=>({expression:Z,statement:Wj(Z)})).filter((Z)=>Z.statement!==null);if(W.length>0){let Z=g(K),q=[...new Set(Q.flatMap((U)=>V(U.code)))].filter((U)=>/^[A-Z_$][\w$]*$/i.test(U)),X=0;if(q.length>0){z(l);for(let U of q)z(`type __StxT_${U} = ${f}<typeof ${U}>`);z(`;((${q.map((U)=>`${U}: __StxT_${U}`).join(", ")}) => {`),X=1}for(let{expression:U,statement:H}of W){let P=" ".repeat(X),M=U.offset===void 0?[]:zj(Z,U.offset),v=M.length>0?`${M.map((b)=>`if (${b}) `).join("")}{ `:"",E=M.length>0?" }":"";z(P+v+H.text+E,{line:U.line,column:U.column,expression:U,prefixLength:H.prefixLength+P.length+v.length})}if(X>0)z("});")}}return z("export {}"),{text:j.join(`
21
21
  `),lineMap:F,sourceLineCount:$.length}}function Nj(K,J,Q){let $=K.lineMap.get(J);if(!$)return J<=K.sourceLineCount?{line:J,column:Q}:null;let j=Math.max(0,Q-1-($.prefixLength??0));return{line:$.line,column:$.column+j,expression:$.expression}}
22
- export{m as Ug,Vj as Vg,Yj as Wg,c as Xg,V as Yg,t as Zg,Bj as _g,wj as $g,Uj as ah,Mj as bh,Nj as ch};
22
+ export{m as ng,Vj as og,Yj as pg,c as qg,V as rg,t as sg,Bj as tg,wj as ug,Uj as vg,Mj as wg,Nj as xg};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{gt as a,ht as b,it as c,jt as d,kt as e,lt as f,mt as g,nt as h,ot as i,pt as j,qt as k,rt as l}from"./chunk-9th1wd1d.js";import"./chunk-39f40yc4.js";import"./chunk-sskbegsz.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
2
+ import{nt as a,ot as b,pt as c,qt as d,rt as e,st as f,tt as g,ut as h,vt as i,wt as j,xt as k,yt as l}from"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2vza9m2x.js";export{e as resolveUserCssConfig,c as resetCssCache,h as rebuildCss,d as loadCssEngineConfig,b as loadCssEngine,l as injectCss,a as getCssServeAsset,i as getCachedCSS,k as generateCss,f as fingerprintConfig,j as extractClassNames,g as buildCss};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Mg as a}from"./chunk-hqh7x9h5.js";import"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{a as buildApp};
@@ -0,0 +1,12 @@
1
+ // @bun
2
+ import{Pp as M,Sl as x}from"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import{ft as B,ht as P}from"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";import G from"path";var T=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],O=new Set(T);var K=new Map,U=B(64),V=new Set,D=0,N=new Set(T);function f(){K.clear(),U.clear()}function S(H){let J=new Map;for(let Q of H){let Z=G.basename(Q);if(Z.endsWith(".d.ts"))continue;let z=Z.replace(/\.[jt]s$/,"");if(z==="index")continue;if(z===Z)continue;let X=J.get(z);if(X&&!X.endsWith(".js"))continue;J.set(z,Q)}return[...J.values()].sort()}function g(H,J){let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Q}\\b`).test(H)}function y(H){if(!H)return[];let J=P(H,D),Q=U.get(J);if(Q)return Q.slice();let Z=H.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),z=[];for(let X of N){if(V.has(X))continue;let A=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${A}\\s*\\(`).test(Z))z.push(X)}return z.sort(),U.set(J,z),z.slice()}async function p(H,J){let Q=y(H);if(Q.length===0)return null;let Z=J??G.join(import.meta.dir,"composables"),z=`${Z}\x00${Q.join(",")}`,X=K.get(z);if(X!==void 0)return X||null;let A=M({loader:"ts",target:"browser",define:x()}),L=new Set(Q),W=[],C=new Set,F=[];try{let q=new Bun.Glob("*.{ts,js}");for await(let j of q.scan({cwd:Z,absolute:!0}))F.push(j)}catch{return K.set(z,""),null}F=S(F);for(let q of F){let j;try{j=await Bun.file(q).text()}catch{continue}let I=[];try{I=A.scan(j).exports.filter(($)=>$!=="default")}catch{continue}if(!I.some(($)=>L.has($)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${G.basename(q).replace(/\.[jt]s$/,"")}
3
+ ${A.transformSync(j).trim()}`);for(let $ of I)C.add($)}catch($){console.warn(`[stx] framework composable ${G.basename(q)} could not be bundled:`,$)}}let Y=Q.filter((q)=>!C.has(q)&&!g(H,q));if(Y.length>0)console.warn(`[stx] could not bundle ${Y.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return K.set(z,""),null;let k=[...C].map((q)=>` try { if (!(${JSON.stringify(q)} in __s)) { __s[${JSON.stringify(q)}] = ${q}; if (!(${JSON.stringify(q)} in window)) window[${JSON.stringify(q)}] = ${q}; } } catch (e) {}`).join(`
4
+ `),w=`<script data-stx-framework-composables>
5
+ ;(function(){
6
+ var __s = window.stx = window.stx || {};
7
+ ${W.join(`
8
+
9
+ `)}
10
+ ${k}
11
+ })();
12
+ </script>`;return K.set(z,w),w}function l(H){V.clear();for(let J of H)V.add(J);D++}export{S as selectComposableFiles,y as referencedFrameworkComposables,p as getFrameworkComposableScript,f as clearFrameworkComposableCache,l as __setRuntimeOwnedForTest};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{createHash as Y}from"crypto";import W from"fs";import Q from"path";import{generateThumbHash as A}from"ts-images";import{createImageDeliveryCatalog as x}from"ts-images/delivery";var w=new Set([".avif",".jpeg",".jpg",".png",".webp"]),N=[320,640,960,1280,1920],O="/_stx/images",$=new Map;function U(j){return`/${j.split(Q.sep).map(encodeURIComponent).join("/")}`}function _(j){let q=Q.extname(j),K=j.slice(0,-q.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),G=Y("sha256").update(j).digest("hex").slice(0,8);return`${K||"image"}-${G}`}async function X(j,q=j){let K=await W.promises.readdir(q,{withFileTypes:!0});K.sort((B,J)=>B.name.localeCompare(J.name));let G=[];for(let B of K){let J=Q.join(q,B.name);if(B.isDirectory()){G.push(...await X(j,J));continue}if(!B.isFile()||!w.has(Q.extname(B.name).toLowerCase()))continue;G.push({absolutePath:J,relativePath:Q.relative(j,J)})}return G}function V(j){return j.map((q)=>({key:U(q.relativePath),input:q.absolutePath,name:_(q.relativePath)}))}async function k(j){let q=[],K=8;for(let G=0;G<j.length;G+=8){let B=j.slice(G,G+8),J=await Promise.all(B.map(async(M)=>{try{return await A(M.absolutePath),M}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${M.relativePath}`),null}}));q.push(...J.filter((M)=>M!==null))}return q}function H(j){if(!j||j.startsWith("data:")||j.startsWith("blob:")||/^https?:\/\//i.test(j)||j.startsWith("//"))return;let q=j.split(/[?#]/,1)[0];if(!q)return;try{return`/${q.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function F(j){let q=H(j);return q?$.get(q):void 0}function Z(){$=new Map}async function C(j,q){if(!j||!W.existsSync(j))return Z(),{count:0,fingerprint:""};let K=await X(j);if(K.length===0)return Z(),{count:0,fingerprint:""};let G={outDir:Q.join(q,"_stx","images"),baseUrl:O,widths:N,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},B=K,J;try{J=await x({...G,entries:V(K)})}catch(M){if(B=await k(K),B.length===K.length)throw M;if(B.length===0)return Z(),{count:0,fingerprint:""};J=await x({...G,entries:V(B)})}return $=new Map(Object.entries(J.entries)),{count:B.length,fingerprint:J.fingerprint}}
3
- export{F as yt,Z as zt,C as At};
3
+ export{F as $s,Z as at,C as bt};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Oj as a,Pj as b,Qj as c,Rj as d,Sj as e,Tj as f,Uj as g,Vj as h,Wj as i,Xj as j,Yj as k}from"./chunk-jyc9eha6.js";import"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{a as templateCache,b as readFileCached,d as invalidateFileCacheByDir,c as invalidateFileCache,k as hashFilePath,f as getCachedSignalsRuntime,g as getCachedRouterScript,h as clearDevCaches,i as checkCache,j as cacheTemplate,e as __setSignalsGeneratorsForTest};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{$l as k,Rl as c,Ul as d,Vl as e,Wl as f,Xl as g,Yl as h,Zl as i,_l as j,am as l,bm as m}from"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import{Ys as a,Zs as b}from"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{h as transformAutoImports,b as stripCommentsAndLiterals,e as renderVendorStyleTags,m as processClientScript,g as injectBrowserCoreAutoImports,l as generateServerDataBridge,j as generateBrowserAutoImportDestructuring,i as generateAutoImportDestructuring,a as findInterpolationEnd,k as extractBridgeData,d as extractAndStripCssImports,f as STX_AUTO_IMPORTS,c as BROWSER_CORE_IMPORTS};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Kg as T}from"./chunk-9zndrzb3.js";import{dv as I}from"./chunk-sskbegsz.js";import E from"fs";import X from"path";import U from"crypto";var _=new Set(["webp","avif","jpeg","png"]),F=new Set(["cover","contain","fill","inside","outside"]),A=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),S=4096,y=80,D="cover";async function g(k,G){let J=G.routePath??"/_stx/img",B=new URL(k.url);if(B.pathname!==J)return null;let $=q(B,G);if(!$.ok)return new Response($.error,{status:$.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:j,srcUrl:K,width:H,height:v,format:Z,quality:Y,fit:z}=$,C;try{C=E.statSync(j)}catch{return new Response(`Source image not found: ${K}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!C.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let N=G.cacheDir??".stx/cache/img";await E.promises.mkdir(N,{recursive:!0});let V=`${j}:${C.mtimeMs}:${C.size}`,O=`${H}x${v}:${Z}:${Y}:${z}`,b=U.createHash("sha256").update(`${V}|${O}`).digest("hex").slice(0,16),Q=X.join(N,`${b}.${Z}`),W={"Content-Type":T(Z),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${b}"`,"X-Stx-Image-Cache":"HIT"};if(k.headers.get("if-none-match")===`"${b}"`)return new Response(null,{status:304,headers:W});let L=Bun.file(Q);if(await L.exists())return new Response(L,{headers:W});try{let R=Buffer.from(await Bun.file(j).arrayBuffer()),{resizeAndConvert:M}=await P(),w=await M(R,{width:H,height:v,format:Z,quality:Y,fit:z});return await Bun.write(Q,w),W["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(w),{headers:W})}catch(R){let M=R.message;return new Response(`Image processing failed: ${M}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function l(k){return async(G)=>{return await g(G,k)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}}function q(k,G){let J=k.searchParams.get("src");if(!J)return{ok:!1,error:"Missing required param: src",status:400};if(!J.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(J.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let B=X.extname(J).toLowerCase();if(!A.has(B))return{ok:!1,error:`Unsupported source extension: ${B}`,status:400};let $=X.resolve(G.publicDir),j=X.resolve($,J.slice(1));if(!j.startsWith(`${$}${X.sep}`)&&j!==$)return{ok:!1,error:"src is outside publicDir",status:400};let K=G.maxWidth??S,H=G.maxHeight??S,v=k.searchParams.get("w"),Z=k.searchParams.get("h"),Y=v?Number.parseInt(v,10):0,z=Z?Number.parseInt(Z,10):0;if(v&&(!Number.isFinite(Y)||Y<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(Z&&(!Number.isFinite(z)||z<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!v&&!Z)return{ok:!1,error:"At least one of w or h is required",status:400};let C=Math.min(Y||K,K),N=Math.min(z||H,H),V=k.searchParams.get("f")||"webp";if(!_.has(V))return{ok:!1,error:`Invalid f (must be one of: ${[..._].join(", ")})`,status:400};let O=V,b=k.searchParams.get("q"),Q=b?Number.parseInt(b,10):G.defaultQuality??y;if(!Number.isFinite(Q)||Q<1||Q>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let x=k.searchParams.get("fit")||G.defaultFit||D;if(!F.has(x))return{ok:!1,error:`Invalid fit (must be one of: ${[...F].join(", ")})`,status:400};return{ok:!0,srcFsPath:j,srcUrl:J,width:C,height:N,format:O,quality:Q,fit:x}}async function P(){return await import("./chunk-e7jfpyqy.js")}
3
- export{g as Cf,l as Df};
2
+ import{Rh as T}from"./chunk-d0f60jrg.js";import{kv as I}from"./chunk-2vza9m2x.js";import E from"fs";import X from"path";import U from"crypto";var _=new Set(["webp","avif","jpeg","png"]),F=new Set(["cover","contain","fill","inside","outside"]),A=new Set([".jpg",".jpeg",".png",".webp",".avif",".gif"]),S=4096,y=80,D="cover";async function g(k,G){let J=G.routePath??"/_stx/img",B=new URL(k.url);if(B.pathname!==J)return null;let $=q(B,G);if(!$.ok)return new Response($.error,{status:$.status,headers:{"Content-Type":"text/plain"}});let{srcFsPath:j,srcUrl:K,width:H,height:v,format:Z,quality:Y,fit:z}=$,C;try{C=E.statSync(j)}catch{return new Response(`Source image not found: ${K}`,{status:404,headers:{"Content-Type":"text/plain"}})}if(!C.isFile())return new Response("Not a file",{status:404,headers:{"Content-Type":"text/plain"}});let N=G.cacheDir??".stx/cache/img";await E.promises.mkdir(N,{recursive:!0});let V=`${j}:${C.mtimeMs}:${C.size}`,O=`${H}x${v}:${Z}:${Y}:${z}`,b=U.createHash("sha256").update(`${V}|${O}`).digest("hex").slice(0,16),Q=X.join(N,`${b}.${Z}`),W={"Content-Type":T(Z),"Cache-Control":"public, max-age=31536000, immutable",ETag:`"${b}"`,"X-Stx-Image-Cache":"HIT"};if(k.headers.get("if-none-match")===`"${b}"`)return new Response(null,{status:304,headers:W});let L=Bun.file(Q);if(await L.exists())return new Response(L,{headers:W});try{let R=Buffer.from(await Bun.file(j).arrayBuffer()),{resizeAndConvert:M}=await P(),w=await M(R,{width:H,height:v,format:Z,quality:Y,fit:z});return await Bun.write(Q,w),W["X-Stx-Image-Cache"]="MISS",new Response(new Uint8Array(w),{headers:W})}catch(R){let M=R.message;return new Response(`Image processing failed: ${M}`,{status:500,headers:{"Content-Type":"text/plain"}})}}function l(k){return async(G)=>{return await g(G,k)??new Response("Not Found",{status:404,headers:{"Content-Type":"text/plain"}})}}function q(k,G){let J=k.searchParams.get("src");if(!J)return{ok:!1,error:"Missing required param: src",status:400};if(!J.startsWith("/"))return{ok:!1,error:"src must be an absolute URL path (start with /)",status:400};if(J.startsWith("//"))return{ok:!1,error:"src must be a local path",status:400};let B=X.extname(J).toLowerCase();if(!A.has(B))return{ok:!1,error:`Unsupported source extension: ${B}`,status:400};let $=X.resolve(G.publicDir),j=X.resolve($,J.slice(1));if(!j.startsWith(`${$}${X.sep}`)&&j!==$)return{ok:!1,error:"src is outside publicDir",status:400};let K=G.maxWidth??S,H=G.maxHeight??S,v=k.searchParams.get("w"),Z=k.searchParams.get("h"),Y=v?Number.parseInt(v,10):0,z=Z?Number.parseInt(Z,10):0;if(v&&(!Number.isFinite(Y)||Y<=0))return{ok:!1,error:"Invalid w (must be positive integer)",status:400};if(Z&&(!Number.isFinite(z)||z<=0))return{ok:!1,error:"Invalid h (must be positive integer)",status:400};if(!v&&!Z)return{ok:!1,error:"At least one of w or h is required",status:400};let C=Math.min(Y||K,K),N=Math.min(z||H,H),V=k.searchParams.get("f")||"webp";if(!_.has(V))return{ok:!1,error:`Invalid f (must be one of: ${[..._].join(", ")})`,status:400};let O=V,b=k.searchParams.get("q"),Q=b?Number.parseInt(b,10):G.defaultQuality??y;if(!Number.isFinite(Q)||Q<1||Q>100)return{ok:!1,error:"Invalid q (must be 1-100)",status:400};let x=k.searchParams.get("fit")||G.defaultFit||D;if(!F.has(x))return{ok:!1,error:`Invalid fit (must be one of: ${[...F].join(", ")})`,status:400};return{ok:!0,srcFsPath:j,srcUrl:J,width:C,height:N,format:O,quality:Q,fit:x}}async function P(){return await import("./chunk-ffmtamm2.js")}
3
+ export{g as Kg,l as Lg};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{tk as m}from"./chunk-y8n174xq.js";import{dv as z}from"./chunk-sskbegsz.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
2
+ import{tk as m}from"./chunk-ee2tfpec.js";import{kv as z}from"./chunk-2vza9m2x.js";import{existsSync as s,mkdirSync as T,copyFileSync as F,chmodSync as A}from"fs";import{join as Z,basename as Yq}from"path";import{spawn as j,execSync as Zq}from"child_process";import{tmpdir as c,homedir as P,platform as Lq}from"os";var Iq=`
3
3
  <script>
4
4
  (function() {
5
5
  'use strict';
@@ -3019,4 +3019,4 @@ Terminal=false
3019
3019
  Categories=Utility;
3020
3020
  Icon=${$.toLowerCase()}
3021
3021
  `;z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.desktop`),_);let E=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(z("fs").writeFileSync(Z(Y,`${$.toLowerCase()}.png`),E),J.icon&&s(J.icon))F(J.icon,Z(Y,`${$.toLowerCase()}.png`));let H=j("appimagetool",[Y,U],{env:{...process.env,ARCH:"x86_64"}});H.on("close",(x)=>{if(z("fs").rmSync(K,{recursive:!0,force:!0}),x===0)A(U,493),W({success:!0});else W({success:!1,error:`appimagetool exited with code ${x}. Install from https://appimage.github.io/appimagetool/`})}),H.on("error",(x)=>{z("fs").rmSync(K,{recursive:!0,force:!0}),W({success:!1,error:`appimagetool not found: ${x.message}`})})}catch(K){W({success:!1,error:K.message})}})}function Vq(){return[I()]}function Fq(q){switch(q){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}var Aq={buildNative:Qq,getAvailableTargets:Vq,getAvailableFormats:Fq,detectPlatform:I},cq=Aq;
3022
- export{Iq as bk,D as ck,Cq as dk,yq as ek,N as fk,b as gk,h as hk,bq as ik,u as jk,Pq as kk,vq as lk,Qq as mk,Vq as nk,Fq as ok,cq as pk};
3022
+ export{Iq as Zj,D as _j,Cq as $j,yq as ak,N as bk,b as ck,h as dk,bq as ek,u as fk,Pq as gk,vq as hk,Qq as ik,Vq as jk,Fq as kk,cq as lk};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ci as a,di as b,ei as c,fi as d,gi as e,hi as f}from"./chunk-wcm80anz.js";import"./chunk-sskbegsz.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
2
+ import{ui as a,vi as b,wi as c,xi as d,yi as e,zi as f}from"./chunk-wvq1g6gr.js";import"./chunk-2vza9m2x.js";export{c as processTransitionDirectives,f as processTransitionAttributes,b as performLeave,a as performEnter,e as generateTransitionRuntime,d as generateTransitionCSS};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ii as a,ji as b,ki as c,li as d,mi as e,ni as f,oi as g,pi as h}from"./chunk-nmkra8q5.js";import"./chunk-fed3xsp9.js";import"./chunk-2vza9m2x.js";export{d as v,a as useForm,g as processHasErrorsDirective,h as processFormValidationDirectives,f as processErrorsDirective,e as processErrorDirective,b as defineForm,c as Validator};
@@ -318,4 +318,4 @@ else {
318
318
  console.log('[stx] Transition runtime initialized');
319
319
  })();
320
320
  `}function $(b){let j=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return b.replace(j,(B,q,A,z)=>{let F=A||"300",G=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${q}" data-stx-transition-duration="${F}" data-stx-transition-condition="${z}" data-stx-transition-id="${G}"`})}
321
- export{W as ci,X as di,Y as ei,Z as fi,_ as gi,$ as hi};
321
+ export{W as ui,X as vi,Y as wi,Z as xi,_ as yi,$ as zi};
@@ -338,4 +338,4 @@ else {
338
338
  console.log('[stx] Suspense runtime initialized');
339
339
  })();
340
340
  `}
341
- export{N as ii,Q as ji,T as ki,U as li,W as mi};
341
+ export{N as Ai,Q as Bi,T as Ci,U as Di,W as Ei};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{pg as a,qg as b,rg as c,sg as d,tg as e,ug as f,vg as g,wg as h}from"./chunk-bz820epz.js";import"./chunk-sskbegsz.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
2
+ import{Ah as e,Bh as f,Ch as g,Dh as h,wh as a,xh as b,yh as c,zh as d}from"./chunk-hmf9z4jx.js";import"./chunk-2vza9m2x.js";export{g as timingPlugin,c as pluginManager,a as definePlugin,f as debugPlugin,h as createVariablesPlugin,e as createFilterPlugin,d as createDirectivePlugin,b as PluginManager};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{qo as a,ro as b,so as c,to as d,uo as e,vo as f,wo as g,xo as h,yo as i,zo as j}from"./chunk-qj2s3r1w.js";import"./chunk-ymc99r5x.js";import"./chunk-dcxtrqfy.js";import"./chunk-jj6yp7gm.js";import"./chunk-qjkzpd68.js";import"./chunk-t5c7rk0h.js";import"./chunk-72c7gyqc.js";import"./chunk-fv923f7g.js";import"./chunk-2e6xafcm.js";import"./chunk-nygtwffe.js";import"./chunk-461br5nn.js";import"./chunk-h7v70dbp.js";import"./chunk-drbbt69f.js";import"./chunk-kb5j08tq.js";import"./chunk-2vza9m2x.js";export{b as stripTypeScript,h as splitDeclaration,c as isModuleResolutionFailure,d as isMissingBindingFailure,f as isCompleteImport,j as hasVariables,e as extractVariables,i as extractScriptFromTemplate,g as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{ni as a,oi as b,pi as c,qi as d,ri as e}from"./chunk-9y0g8kzt.js";import"./chunk-sskbegsz.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
2
+ import{Fi as a,Gi as b,Hi as c,Ii as d,Ji as e}from"./chunk-k70fgb2f.js";import"./chunk-2vza9m2x.js";export{a as processAsyncDirectives,c as isAsyncComponent,e as generateAsyncComponentRuntime,d as generateAsyncComponentCSS,b as defineAsyncComponent};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{si as a,ti as b,ui as c,vi as d,wi as e,xi as f,yi as g}from"./chunk-t6nseeb9.js";import"./chunk-sskbegsz.js";export{c as shouldCacheComponent,a as processKeepAliveDirectives,g as onDeactivated,f as onActivated,e as generateKeepAliveRuntime,d as generateKeepAliveCSS,b as createKeepAliveCache};
2
+ import{Ki as a,Li as b,Mi as c,Ni as d,Oi as e,Pi as f,Qi as g}from"./chunk-4vpsvh6x.js";import"./chunk-2vza9m2x.js";export{c as shouldCacheComponent,a as processKeepAliveDirectives,g as onDeactivated,f as onActivated,e as generateKeepAliveRuntime,d as generateKeepAliveCSS,b as createKeepAliveCache};
@@ -1,38 +1,38 @@
1
1
  // @bun
2
- import{Us as Aq}from"./chunk-t1k5dpbr.js";import{dv as N}from"./chunk-sskbegsz.js";var Sq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},P={},qq="en";function Pq(q){qq=q}function Lq(){return qq}function bq(q){P={...P,...q}}function Cq(){P={}}function Jq(q,Q={}){let J=P[q]||Sq[q]||{message:`Unknown error (code: ${q})`},Z=J.message,$=J.help;for(let[W,H]of Object.entries(Q)){let Y=`{{${W}}}`;if(Z=Z.replace(new RegExp(Y,"g"),H),$)$=$.replace(new RegExp(Y,"g"),H)}return{message:Z,help:$}}function yq(q,Q={}){let{message:J,help:Z}=Jq(q,Q);return Z?`${J}
3
- Help: ${Z}`:J}var j={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function g(q){for(let[Q,J]of Object.entries(j))if(J===q)return Q;return}function vq(){return!1}function E(){return!vq()||process.env.STX_DEBUG==="true"}function rJ(){return!1}import xq from"path";var Qq={showRelativePaths:!1,enableAutoRecovery:E(),logRecoveryWarnings:!0},R={...Qq};function gq(q){R={...R,...q}}function L(){return{...R}}function fq(){R={...Qq}}function b(q){if(!R.showRelativePaths||!q)return q;let Q=R.baseDir||process.cwd();try{let J=xq.relative(Q,q);return J.startsWith("..")?q:J}catch{return q}}class I extends Error{code;filePath;line;column;context;numericCode;constructor(q,Q,J,Z,$,W,H){super(q);this.code=Q;this.filePath=J;this.line=Z;this.column=$;this.context=W;if(this.name="StxError",this.numericCode=H||j.EVALUATION_ERROR,this.filePath)this.filePath=b(this.filePath)}}class Zq extends I{constructor(q,Q,J,Z,$,W){super(q,"stx_SYNTAX_ERROR",Q,J,Z,$,W||j.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class $q extends I{constructor(q,Q,J,Z,$,W){super(q,"stx_RUNTIME_ERROR",Q,J,Z,$,W||j.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Xq extends I{constructor(q,Q,J,Z,$,W){super(q,"stx_SECURITY_ERROR",Q,J,Z,$,W||j.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class Wq extends I{constructor(q,Q,J,Z,$,W){super(q,"stx_FILE_ERROR",Q,J,Z,$,W||j.FILE_NOT_FOUND);this.name="StxFileError"}}class Yq extends I{isFatal=!0;constructor(q,Q,J,Z,$,W){super(q,"stx_VALIDATION_ERROR",Q,J,Z,$,W||j.DOM_API_VIOLATION);this.name="StxValidationError"}}function f(q){let{type:Q,message:J,code:Z,filePath:$,line:W,column:H,template:Y,offset:X,snippet:G,suggestion:B,format:V="text"}=q,_=W,M=H;if(!_&&Y&&X!==void 0){let z=Gq(Y,X);_=z.line,M=z.column}let F=$?b($):void 0,K=Z?g(Z):void 0,O={type:Q,code:Z,codeName:K,message:J,filePath:F,line:_,column:M,snippet:G,suggestion:B,timestamp:new Date().toISOString()},U;switch(V){case"html":U=uq(O);break;case"json":U=JSON.stringify(O,null,2);break;case"console":U=dq(O,Y,X);break;case"text":default:U=hq(O,Y,X);break}return{formatted:U,data:O}}function hq(q,Q,J){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let W=q.filePath;if(q.line){if(W+=`:${q.line}`,q.column)W+=`:${q.column}`}Z.push(`at ${W}`)}if(Z.push(`
2
+ import{Xs as Iq}from"./chunk-jj6yp7gm.js";import{kv as N}from"./chunk-2vza9m2x.js";var Sq={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},P={},qq="en";function Pq(q){qq=q}function Lq(){return qq}function bq(q){P={...P,...q}}function Cq(){P={}}function Jq(q,Q={}){let J=P[q]||Sq[q]||{message:`Unknown error (code: ${q})`},Z=J.message,$=J.help;for(let[W,H]of Object.entries(Q)){let Y=`{{${W}}}`;if(Z=Z.replace(new RegExp(Y,"g"),H),$)$=$.replace(new RegExp(Y,"g"),H)}return{message:Z,help:$}}function yq(q,Q={}){let{message:J,help:Z}=Jq(q,Q);return Z?`${J}
3
+ Help: ${Z}`:J}var j={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603};function g(q){for(let[Q,J]of Object.entries(j))if(J===q)return Q;return}function vq(){return!1}function E(){return!vq()||process.env.STX_DEBUG==="true"}function oJ(){return!1}import xq from"path";var Qq={showRelativePaths:!1,enableAutoRecovery:E(),logRecoveryWarnings:!0},R={...Qq};function gq(q){R={...R,...q}}function L(){return{...R}}function fq(){R={...Qq}}function b(q){if(!R.showRelativePaths||!q)return q;let Q=R.baseDir||process.cwd();try{let J=xq.relative(Q,q);return J.startsWith("..")?q:J}catch{return q}}class A extends Error{code;filePath;line;column;context;numericCode;constructor(q,Q,J,Z,$,W,H){super(q);this.code=Q;this.filePath=J;this.line=Z;this.column=$;this.context=W;if(this.name="StxError",this.numericCode=H||j.EVALUATION_ERROR,this.filePath)this.filePath=b(this.filePath)}}class Zq extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_SYNTAX_ERROR",Q,J,Z,$,W||j.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}}class $q extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_RUNTIME_ERROR",Q,J,Z,$,W||j.EVALUATION_ERROR);this.name="StxRuntimeError"}}class Xq extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_SECURITY_ERROR",Q,J,Z,$,W||j.UNSAFE_EXPRESSION);this.name="StxSecurityError"}}class Wq extends A{constructor(q,Q,J,Z,$,W){super(q,"stx_FILE_ERROR",Q,J,Z,$,W||j.FILE_NOT_FOUND);this.name="StxFileError"}}class Yq extends A{isFatal=!0;constructor(q,Q,J,Z,$,W){super(q,"stx_VALIDATION_ERROR",Q,J,Z,$,W||j.DOM_API_VIOLATION);this.name="StxValidationError"}}function f(q){let{type:Q,message:J,code:Z,filePath:$,line:W,column:H,template:Y,offset:X,snippet:B,suggestion:G,format:V="text"}=q,_=W,M=H;if(!_&&Y&&X!==void 0){let z=Gq(Y,X);_=z.line,M=z.column}let U=$?b($):void 0,w=Z?g(Z):void 0,O={type:Q,code:Z,codeName:w,message:J,filePath:U,line:_,column:M,snippet:B,suggestion:G,timestamp:new Date().toISOString()},F;switch(V){case"html":F=uq(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=dq(O,Y,X);break;case"text":default:F=hq(O,Y,X);break}return{formatted:F,data:O}}function hq(q,Q,J){let Z=[],$=q.code?` [${q.codeName||q.code}]`:"";if(Z.push(`[${q.type} Error${$}]`),q.filePath){let W=q.filePath;if(q.line){if(W+=`:${q.line}`,q.column)W+=`:${q.column}`}Z.push(`at ${W}`)}if(Z.push(`
4
4
  ${q.message}`),Q&&q.line){let W=pq(Q,q.line,2);if(W)Z.push(`
5
5
  ${W}`)}if(q.snippet)Z.push(`
6
6
  Snippet: ${q.snippet}`);if(q.suggestion)Z.push(`
7
- Suggestion: ${q.suggestion}`);return Z.join(" ")}function uq(q){let Q=q.code?` [${q.code}]`:"",J=q.filePath?` in ${q.filePath}${q.line?`:${q.line}`:""}`:"",Z=`<!-- [${q.type} Error${Q}]${J}: ${Hq(q.message)}`;if(q.suggestion)Z+=` | Suggestion: ${Hq(q.suggestion)}`;return Z+=" -->",Z}function dq(q,Q,J){let G=[],B=q.code?` [${q.codeName||q.code}]`:"";if(G.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${q.type} Error${B} \u2501\u2501\u2501${"\x1B[0m"}`),q.filePath){let V=`\x1B[36m${q.filePath}\x1B[0m`;if(q.line){if(V+=`\x1B[90m:${q.line}\x1B[0m`,q.column)V+=`\x1B[90m:${q.column}\x1B[0m`}G.push(`
8
- \x1B[90mat\x1B[0m ${V}`)}if(G.push(`
7
+ Suggestion: ${q.suggestion}`);return Z.join(" ")}function uq(q){let Q=q.code?` [${q.code}]`:"",J=q.filePath?` in ${q.filePath}${q.line?`:${q.line}`:""}`:"",Z=`<!-- [${q.type} Error${Q}]${J}: ${Hq(q.message)}`;if(q.suggestion)Z+=` | Suggestion: ${Hq(q.suggestion)}`;return Z+=" -->",Z}function dq(q,Q,J){let B=[],G=q.code?` [${q.codeName||q.code}]`:"";if(B.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${q.type} Error${G} \u2501\u2501\u2501${"\x1B[0m"}`),q.filePath){let V=`\x1B[36m${q.filePath}\x1B[0m`;if(q.line){if(V+=`\x1B[90m:${q.line}\x1B[0m`,q.column)V+=`\x1B[90m:${q.column}\x1B[0m`}B.push(`
8
+ \x1B[90mat\x1B[0m ${V}`)}if(B.push(`
9
9
 
10
- ${q.message}`),Q&&q.line){let V=mq(Q,q.line,2);if(V)G.push(`
10
+ ${q.message}`),Q&&q.line){let V=mq(Q,q.line,2);if(V)B.push(`
11
11
 
12
12
  \x1B[90mContext:\x1B[0m
13
- ${V}`)}if(q.suggestion)G.push(`
13
+ ${V}`)}if(q.suggestion)B.push(`
14
14
 
15
- \x1B[33mSuggestion:\x1B[0m ${q.suggestion}`);return G.push(`
16
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),G.join("")}function pq(q,Q,J){let Z=q.split(`
17
- `),$=Math.max(0,Q-J-1),W=Math.min(Z.length-1,Q+J-1),H=[];for(let Y=$;Y<=W;Y++){let X=(Y+1).toString().padStart(4),G=Y===Q-1?">":" ";H.push(`${G}${X} | ${Z[Y]}`)}return H.join(`
15
+ \x1B[33mSuggestion:\x1B[0m ${q.suggestion}`);return B.push(`
16
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),B.join("")}function pq(q,Q,J){let Z=q.split(`
17
+ `),$=Math.max(0,Q-J-1),W=Math.min(Z.length-1,Q+J-1),H=[];for(let Y=$;Y<=W;Y++){let X=(Y+1).toString().padStart(4),B=Y===Q-1?">":" ";H.push(`${B}${X} | ${Z[Y]}`)}return H.join(`
18
18
  `)}function mq(q,Q,J){let Z=q.split(`
19
- `),$=Math.max(0,Q-J-1),W=Math.min(Z.length-1,Q+J-1),H="\x1B[90m",Y="\x1B[31m",X="\x1B[0m",G=[];for(let B=$;B<=W;B++){let V=(B+1).toString().padStart(4),_=B===Q-1,M=_?"\x1B[31m>\x1B[0m":" ",F=_?`\x1B[31m${Z[B]}\x1B[0m`:`\x1B[90m${Z[B]}\x1B[0m`;G.push(`${M}\x1B[90m${V}\x1B[0m | ${F}`)}return G.join(`
19
+ `),$=Math.max(0,Q-J-1),W=Math.min(Z.length-1,Q+J-1),H="\x1B[90m",Y="\x1B[31m",X="\x1B[0m",B=[];for(let G=$;G<=W;G++){let V=(G+1).toString().padStart(4),_=G===Q-1,M=_?"\x1B[31m>\x1B[0m":" ",U=_?`\x1B[31m${Z[G]}\x1B[0m`:`\x1B[90m${Z[G]}\x1B[0m`;B.push(`${M}\x1B[90m${V}\x1B[0m | ${U}`)}return B.join(`
20
20
  `)}function Hq(q){return q.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Gq(q,Q){let Z=q.substring(0,Q).split(`
21
21
  `);return{line:Z.length,column:Z[Z.length-1].length}}function C(q,Q,J){return f({type:q,message:Q,code:J,format:"html"}).formatted}function cq(q,Q,J,Z,$){return f({type:q,message:Q,code:$,filePath:J,line:Z,format:"console"}).formatted}function lq(q,Q,J){let Z=J.template.split(`
22
22
  `),$=Gq(J.template,J.offset),W=`[${q} Error at line ${$.line} in ${J.filePath}]: ${Q}
23
23
 
24
24
  `,H=Math.max(0,$.line-3),Y=Math.min(Z.length-1,$.line+2);W+=`Context:
25
- `;for(let X=H;X<=Y;X++){let G=X+1,B=Z[X]||"",V=X===$.line-1?">":" ";W+=`${V} ${G.toString().padStart(3)}: ${B}
25
+ `;for(let X=H;X<=Y;X++){let B=X+1,G=Z[X]||"",V=X===$.line-1?">":" ";W+=`${V} ${B.toString().padStart(3)}: ${G}
26
26
  `}if($.line-1<Z.length){let X=" ".repeat($.column+5);W+=`${X}^
27
- `}return W}function sq(q,Q,J){try{return q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}async function iq(q,Q,J){try{return await q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}var rq={isEnabled(){return L().enableAutoRecovery},fixCommonSyntaxErrors(q){let Q=L();if(!Q.enableAutoRecovery)return{fixed:q,fixes:[]};let J=q,Z=[],$=(J.match(/\{\{/g)||[]).length,W=(J.match(/\}\}/g)||[]).length;if($>W){let Y=$-W;J+="}}".repeat(Y),Z.push(`Added ${Y} missing closing braces '}}'`)}let H=["if","foreach","for","switch","section"];for(let Y of H){let X=(J.match(new RegExp(`@${Y}\\b`,"g"))||[]).length,G=(J.match(new RegExp(`@end${Y}\\b`,"g"))||[]).length;if(X>G){let B=X-G;for(let V=0;V<B;V++)J+=`
28
- @end${Y}`;Z.push(`Added ${B} missing @end${Y}`)}}if(Z.length>0&&Q.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Z.forEach((Y)=>console.warn(` - ${Y}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Z}},createFallbackContent(q,Q){if(E())return`<!-- ${q} failed: ${Q.message} -->`;return"<!-- stx rendering error -->"}};class h{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(q={}){this.maxErrors=q.maxErrors??1000,this.enableFileLogging=q.enableFileLogging??!1,this.logFilePath=q.logFilePath??".stx/errors.log",this.logFormat=q.logFormat??"json",this.maxFileSize=q.maxFileSize??10485760,this.maxLogFiles=q.maxLogFiles??5,this.minLevel=q.minLevel??"all"}configure(q){if(q.maxErrors!==void 0)this.maxErrors=q.maxErrors;if(q.enableFileLogging!==void 0)this.enableFileLogging=q.enableFileLogging;if(q.logFilePath!==void 0)this.logFilePath=q.logFilePath;if(q.logFormat!==void 0)this.logFormat=q.logFormat;if(q.maxFileSize!==void 0)this.maxFileSize=q.maxFileSize;if(q.maxLogFiles!==void 0)this.maxLogFiles=q.maxLogFiles;if(q.minLevel!==void 0)this.minLevel=q.minLevel}log(q,Q,J="error"){let Z={timestamp:new Date,error:q,context:Q,level:J};if(this.errors.push(Z),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Z)}shouldLog(q){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return q==="error"||q==="warning";if(this.minLevel==="error")return q==="error";return!0}formatEntry(q){if(this.logFormat==="json")return JSON.stringify({timestamp:q.timestamp.toISOString(),level:q.level||"error",type:q.error.constructor.name,message:q.error.message,stack:q.error.stack,context:q.context});let Q=[`[${q.timestamp.toISOString()}] [${(q.level||"error").toUpperCase()}] ${q.error.constructor.name}: ${q.error.message}`];if(q.error.stack)Q.push(` Stack: ${q.error.stack.split(`
27
+ `}return W}function sq(q,Q,J){try{return q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}async function iq(q,Q,J){try{return await q()}catch(Z){if(J&&Z instanceof Error)J(Z);return Q}}var rq={isEnabled(){return L().enableAutoRecovery},fixCommonSyntaxErrors(q){let Q=L();if(!Q.enableAutoRecovery)return{fixed:q,fixes:[]};let J=q,Z=[],$=(J.match(/\{\{/g)||[]).length,W=(J.match(/\}\}/g)||[]).length;if($>W){let Y=$-W;J+="}}".repeat(Y),Z.push(`Added ${Y} missing closing braces '}}'`)}let H=["if","foreach","for","switch","section"];for(let Y of H){let X=(J.match(new RegExp(`@${Y}\\b`,"g"))||[]).length,B=(J.match(new RegExp(`@end${Y}\\b`,"g"))||[]).length;if(X>B){let G=X-B;for(let V=0;V<G;V++)J+=`
28
+ @end${Y}`;Z.push(`Added ${G} missing @end${Y}`)}}if(Z.length>0&&Q.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Z.forEach((Y)=>console.warn(` - ${Y}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:J,fixes:Z}},createFallbackContent(q,Q){if(E())return`<!-- ${q} failed: ${Q.message} -->`;return"<!-- stx rendering error -->"}};class h{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(q={}){this.maxErrors=q.maxErrors??1000,this.enableFileLogging=q.enableFileLogging??!1,this.logFilePath=q.logFilePath??".stx/errors.log",this.logFormat=q.logFormat??"json",this.maxFileSize=q.maxFileSize??10485760,this.maxLogFiles=q.maxLogFiles??5,this.minLevel=q.minLevel??"all"}configure(q){if(q.maxErrors!==void 0)this.maxErrors=q.maxErrors;if(q.enableFileLogging!==void 0)this.enableFileLogging=q.enableFileLogging;if(q.logFilePath!==void 0)this.logFilePath=q.logFilePath;if(q.logFormat!==void 0)this.logFormat=q.logFormat;if(q.maxFileSize!==void 0)this.maxFileSize=q.maxFileSize;if(q.maxLogFiles!==void 0)this.maxLogFiles=q.maxLogFiles;if(q.minLevel!==void 0)this.minLevel=q.minLevel}log(q,Q,J="error"){let Z={timestamp:new Date,error:q,context:Q,level:J};if(this.errors.push(Z),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(J))this.writeToFile(Z)}shouldLog(q){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return q==="error"||q==="warning";if(this.minLevel==="error")return q==="error";return!0}formatEntry(q){if(this.logFormat==="json")return JSON.stringify({timestamp:q.timestamp.toISOString(),level:q.level||"error",type:q.error.constructor.name,message:q.error.message,stack:q.error.stack,context:q.context});let Q=[`[${q.timestamp.toISOString()}] [${(q.level||"error").toUpperCase()}] ${q.error.constructor.name}: ${q.error.message}`];if(q.error.stack)Q.push(` Stack: ${q.error.stack.split(`
29
29
  `).slice(1).join(`
30
30
  `)}`);if(q.context)Q.push(` Context: ${JSON.stringify(q.context)}`);return Q.join(`
31
31
  `)}writeToFile(q){this.writeQueue=this.writeQueue.then(async()=>{try{let Q=await import("fs"),Z=(await import("path")).dirname(this.logFilePath);if(!Q.existsSync(Z))Q.mkdirSync(Z,{recursive:!0});await this.rotateIfNeeded(Q);let $=`${this.formatEntry(q)}
32
32
  `;Q.appendFileSync(this.logFilePath,$,"utf-8")}catch(Q){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Q)}})}async rotateIfNeeded(q){try{if(!q.existsSync(this.logFilePath))return;if(q.statSync(this.logFilePath).size<this.maxFileSize)return;for(let J=this.maxLogFiles-1;J>=1;J--){let Z=`${this.logFilePath}.${J}`,$=`${this.logFilePath}.${J+1}`;if(q.existsSync(Z))if(J>=this.maxLogFiles-1)q.unlinkSync(Z);else q.renameSync(Z,$)}if(this.maxLogFiles<=1)q.writeFileSync(this.logFilePath,"");else q.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Q){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Q)}}getRecentErrors(q=10){return this.errors.slice(-q)}getErrorsByType(q){return this.errors.filter((Q)=>Q.error.constructor.name===q)}getErrorsByLevel(q){return this.errors.filter((Q)=>Q.level===q)}clear(){this.errors.length=0}async clearLogFile(){try{let q=await import("fs");if(q.existsSync(this.logFilePath))q.writeFileSync(this.logFilePath,"","utf-8")}catch(q){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",q)}}getStats(){let q={},Q={error:0,warning:0,info:0};for(let J of this.errors){let Z=J.error.constructor.name;q[Z]=(q[Z]||0)+1;let $=J.level||"error";Q[$]=(Q[$]||0)+1}return{total:this.errors.length,byType:q,byLevel:Q}}async exportToFile(q,Q="json"){let J=await import("fs"),$=(await import("path")).dirname(q);if(!J.existsSync($))J.mkdirSync($,{recursive:!0});if(Q==="json"){let W=this.errors.map((H)=>({timestamp:H.timestamp.toISOString(),level:H.level||"error",type:H.error.constructor.name,message:H.error.message,stack:H.error.stack,context:H.context}));J.writeFileSync(q,JSON.stringify(W,null,2),"utf-8")}else{let W=this.errors.map((H)=>this.formatEntry(H));J.writeFileSync(q,W.join(`
33
33
 
34
34
  `),"utf-8")}}async flush(){await this.writeQueue}}var nq=new h,oq={isDevelopment(){return E()},logDetailedError(q,Q){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",q.message),console.error("Stack:",q.stack),Q)console.error("Context:",Q);console.error("========================")},createErrorReport(q,Q){let J=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${q.message}`,`Type: ${q.constructor.name}`,`Stack: ${q.stack}`];if(Q)J.push(`Context: ${JSON.stringify(Q,null,2)}`);return J.push("========================"),J.join(`
35
- `)}};import u from"path";var d={isValidFilePath(q,Q){let J=q.replace(/\\/g,"/");if(J.includes("\x00"))return!1;if(J.includes("../")||J.includes("..\\")||J===".."||J.startsWith("../")||J.endsWith("/..")||J.includes("/..\\")||J.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(J))return!1;if(J.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((W)=>J===W.slice(0,-1)||J.startsWith(W)))return!1}if(/^[a-z]:/i.test(J)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((W)=>J.includes(W)))return!1}if(Q){let $=u.resolve(Q,q),W=u.resolve(Q);if(!$.startsWith(W+u.sep)&&$!==W)return!1}return!0},isValidVariableName(q){return/^[a-z_$]\w*$/i.test(q)},isValidDirectiveName(q){return/^[a-z][\w-]*$/i.test(q)},isSafeContent(q){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((J)=>J.test(q))}};function aq(q){let Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return q.replace(/[&<>"']/g,(J)=>Q[J]||J)}function y(q,Q={}){let{allowHtml:J=!1,maxLength:Z=1e4,allowSpecialChars:$=!0,customSanitizer:W}=Q,H=[],Y=q,X=!1;if(W){let B=W(Y);if(B!==Y)Y=B,X=!0}if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,H.push("Null bytes removed from parameter");if(Y.length>Z)Y=Y.substring(0,Z),X=!0,H.push(`Parameter truncated to ${Z} characters`);if(!J&&/<[^>]+>/.test(Y))Y=aq(Y),X=!0,H.push("HTML content was escaped");let G=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:V,name:_}of G)if(B.test(Y))Y=Y.replace(B,V),X=!0,H.push(`Removed ${_} from parameter`);if(!$){let B=Y;if(Y=Y.split("").filter((V)=>{let _=V.charCodeAt(0);return _>=32&&_!==127}).join(""),Y!==B)X=!0,H.push("Control characters removed")}return{value:Y,modified:X,warnings:H}}function tq(q,Q){let J=q.replace(/\0/g,"");J=J.replace(/\\/g,"/"),J=J.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(J.includes("../")||J.includes("./"))J=J.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!d.isValidFilePath(J,Q))return null;return J}function eq(q){let Q=[],J=q.trim(),Z=J!==q,$=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:W,name:H}of $)if(W.test(J))Q.push(`Potentially dangerous pattern detected: ${H}`);if(J.includes("\x00"))J=J.replace(/\0/g,""),Z=!0,Q.push("Null bytes removed from expression");return{value:J,modified:Z,warnings:Q}}function qJ(q,Q={}){return q.map((J)=>y(J,Q))}function Bq(q){let Q={};for(let[J,Z]of Object.entries(q)){if(!d.isValidVariableName(J))continue;if(typeof Z==="string"){let $=y(Z);Q[J]=$.value}else if(Array.isArray(Z))Q[J]=Z.map(($)=>typeof $==="string"?y($).value:$);else if(typeof Z==="object"&&Z!==null)Q[J]=Bq(Z);else Q[J]=Z}return Q}var JJ={maxSanitizeDepth:10,allowBracketNotation:!1},_q={...JJ};var Uq=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],QJ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),Fq=new Set(["__proto__","constructor","prototype"]),ZJ=/[\w)\]]\s*\[\s*['"]/;function $J(q){let Q="",J=null,Z=!1;for(let $=0;$<q.length;$++){let W=q[$];if(Z){Z=!1;continue}if(W==="\\"&&J){Z=!0;continue}if(J){if(J==="`"&&W==="$"&&$+1<q.length&&q[$+1]==="{"){let H=1;$+=2;while($<q.length&&H>0){if(q[$]==="{")H++;else if(q[$]==="}")H--;if(H>0)Q+=q[$],$++}continue}if(W===J)J=null;continue}if(W==='"'||W==="'"||W==="`"){J=W;continue}Q+=W}return Q}function XJ(q,Q){let J=/[$A-Z_a-z][$\w]*/g,Z;while((Z=J.exec(q))!==null){let $=Z[0],W=q[Z.index-1];if(QJ.has($))throw Error(`Potentially unsafe expression (matched /\\b${$}\\b/; identifier ${$}): ${Q}`);if(W==="."&&Fq.has($))throw Error(`Potentially unsafe expression (matched /.${$}/; property ${$}): ${Q}`)}}function WJ(q){let Q=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Q.exec(q))!==null){let Z=J[2];if(!Fq.has(Z))continue;let $=q.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],W=q.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!(($==="{"||$===",")&&W===":"))throw Error(`Potentially unsafe expression (bracket key ${J[2]}): ${q}`)}}function Mq(q){let Q=q.trim(),J=$J(Q);XJ(J,Q),WJ(Q);for(let Z of Uq)if(Z.test(J))throw Error(`Potentially unsafe expression (matched /${Z.source}/): ${Q}`);if(!_q.allowBracketNotation&&ZJ.test(Q))throw Error(`Bracket notation with strings not allowed: ${Q}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Q}function YJ(q){let Q={};Q.Math=Math,Q.JSON=JSON,Q.Date=Date,Q.String=String,Q.Number=Number,Q.Boolean=Boolean,Q.Array=Array,Q.parseInt=Number.parseInt,Q.parseFloat=Number.parseFloat,Q.isNaN=Number.isNaN,Q.isFinite=Number.isFinite,Q.encodeURIComponent=encodeURIComponent,Q.decodeURIComponent=decodeURIComponent;for(let[J,Z]of Object.entries(q)){if(J.startsWith("__")||Uq.some(($)=>$.test(J)))continue;if(Z&&typeof Z==="object"&&!Array.isArray(Z))Q[J]=p(Z);else Q[J]=Z}return Q}function p(q,Q=0){if(Q>=_q.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((Z)=>p(Z,Q+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let J={};for(let[Z,$]of Object.entries(q)){if(Z.startsWith("__")||Z==="constructor"||Z==="prototype")continue;if($&&typeof $==="object")J[Z]=p($,Q+1);else J[Z]=$}return J}function HJ(q,Q){try{let J=YJ(Q),Z=Object.keys(J),$=Object.values(J);return VJ(q,Z)(...$)}catch{return}}function KQ(q){try{return Mq(q),!0}catch{return!1}}function m(q,Q){try{let J=HJ(q,Q);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}var Kq=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),GJ=2000,v=new Map;function BJ(q,Q){let J=`${q.join(",")}\x00${Q}`,Z=v.get(J);if(Z)return Z;let $=Function(...q,Q);if(v.size>=GJ)v.clear();return v.set(J,$),$}function wQ(q){return q.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}function VJ(q,Q){let J=Mq(q),Z=/^[A-Za-z_$][\w$]*$/,$=[],W=[];for(let G=0;G<Q.length;G++){let B=Q[G];if(!Z.test(B))continue;if(Kq.has(B))continue;$.push(G),W.push(B)}let H=(G)=>BJ([...W,...G],`
35
+ `)}};import u from"path";var d={isValidFilePath(q,Q){let J=q.replace(/\\/g,"/");if(J.includes("\x00"))return!1;if(J.includes("../")||J.includes("..\\")||J===".."||J.startsWith("../")||J.endsWith("/..")||J.includes("/..\\")||J.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(J))return!1;if(J.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((W)=>J===W.slice(0,-1)||J.startsWith(W)))return!1}if(/^[a-z]:/i.test(J)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((W)=>J.includes(W)))return!1}if(Q){let $=u.resolve(Q,q),W=u.resolve(Q);if(!$.startsWith(W+u.sep)&&$!==W)return!1}return!0},isValidVariableName(q){return/^[a-z_$]\w*$/i.test(q)},isValidDirectiveName(q){return/^[a-z][\w-]*$/i.test(q)},isSafeContent(q){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((J)=>J.test(q))}};function aq(q){let Q={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return q.replace(/[&<>"']/g,(J)=>Q[J]||J)}function y(q,Q={}){let{allowHtml:J=!1,maxLength:Z=1e4,allowSpecialChars:$=!0,customSanitizer:W}=Q,H=[],Y=q,X=!1;if(W){let G=W(Y);if(G!==Y)Y=G,X=!0}if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,H.push("Null bytes removed from parameter");if(Y.length>Z)Y=Y.substring(0,Z),X=!0,H.push(`Parameter truncated to ${Z} characters`);if(!J&&/<[^>]+>/.test(Y))Y=aq(Y),X=!0,H.push("HTML content was escaped");let B=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:G,replacement:V,name:_}of B)if(G.test(Y))Y=Y.replace(G,V),X=!0,H.push(`Removed ${_} from parameter`);if(!$){let G=Y;if(Y=Y.split("").filter((V)=>{let _=V.charCodeAt(0);return _>=32&&_!==127}).join(""),Y!==G)X=!0,H.push("Control characters removed")}return{value:Y,modified:X,warnings:H}}function tq(q,Q){let J=q.replace(/\0/g,"");J=J.replace(/\\/g,"/"),J=J.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(J.includes("../")||J.includes("./"))J=J.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!d.isValidFilePath(J,Q))return null;return J}function eq(q){let Q=[],J=q.trim(),Z=J!==q,$=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:W,name:H}of $)if(W.test(J))Q.push(`Potentially dangerous pattern detected: ${H}`);if(J.includes("\x00"))J=J.replace(/\0/g,""),Z=!0,Q.push("Null bytes removed from expression");return{value:J,modified:Z,warnings:Q}}function qJ(q,Q={}){return q.map((J)=>y(J,Q))}function Bq(q){let Q={};for(let[J,Z]of Object.entries(q)){if(!d.isValidVariableName(J))continue;if(typeof Z==="string"){let $=y(Z);Q[J]=$.value}else if(Array.isArray(Z))Q[J]=Z.map(($)=>typeof $==="string"?y($).value:$);else if(typeof Z==="object"&&Z!==null)Q[J]=Bq(Z);else Q[J]=Z}return Q}var JJ={maxSanitizeDepth:10,allowBracketNotation:!1},_q={...JJ};var Fq=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],QJ=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),Uq=new Set(["__proto__","constructor","prototype"]),ZJ=/[\w)\]]\s*\[\s*['"]/;function $J(q){let Q="",J=null,Z=!1;for(let $=0;$<q.length;$++){let W=q[$];if(Z){Z=!1;continue}if(W==="\\"&&J){Z=!0;continue}if(J){if(J==="`"&&W==="$"&&$+1<q.length&&q[$+1]==="{"){let H=1;$+=2;while($<q.length&&H>0){if(q[$]==="{")H++;else if(q[$]==="}")H--;if(H>0)Q+=q[$],$++}continue}if(W===J)J=null;continue}if(W==='"'||W==="'"||W==="`"){J=W;continue}Q+=W}return Q}function XJ(q,Q){let J=/[$A-Z_a-z][$\w]*/g,Z;while((Z=J.exec(q))!==null){let $=Z[0],W=q[Z.index-1];if(QJ.has($))throw Error(`Potentially unsafe expression (matched /\\b${$}\\b/; identifier ${$}): ${Q}`);if(W==="."&&Uq.has($))throw Error(`Potentially unsafe expression (matched /.${$}/; property ${$}): ${Q}`)}}function WJ(q){let Q=/\[\s*(['"])(.*?)\1\s*\]/g,J;while((J=Q.exec(q))!==null){let Z=J[2];if(!Uq.has(Z))continue;let $=q.slice(0,J.index).match(/\S(?=\s*$)/)?.[0],W=q.slice(J.index+J[0].length).match(/^\s*(\S)/)?.[1];if(!(($==="{"||$===",")&&W===":"))throw Error(`Potentially unsafe expression (bracket key ${J[2]}): ${q}`)}}function Mq(q){let Q=q.trim(),J=$J(Q);XJ(J,Q),WJ(Q);for(let Z of Fq)if(Z.test(J))throw Error(`Potentially unsafe expression (matched /${Z.source}/): ${Q}`);if(!_q.allowBracketNotation&&ZJ.test(Q))throw Error(`Bracket notation with strings not allowed: ${Q}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Q}function YJ(q){let Q={};Q.Math=Math,Q.JSON=JSON,Q.Date=Date,Q.String=String,Q.Number=Number,Q.Boolean=Boolean,Q.Array=Array,Q.parseInt=Number.parseInt,Q.parseFloat=Number.parseFloat,Q.isNaN=Number.isNaN,Q.isFinite=Number.isFinite,Q.encodeURIComponent=encodeURIComponent,Q.decodeURIComponent=decodeURIComponent;for(let[J,Z]of Object.entries(q)){if(J.startsWith("__")||Fq.some(($)=>$.test(J)))continue;if(Z&&typeof Z==="object"&&!Array.isArray(Z))Q[J]=p(Z);else Q[J]=Z}return Q}function p(q,Q=0){if(Q>=_q.maxSanitizeDepth)return"[Object too deep]";if(q===null||typeof q!=="object")return q;if(Array.isArray(q))return q.map((Z)=>p(Z,Q+1));if(q instanceof Date||q instanceof RegExp||q instanceof Map||q instanceof Set||q instanceof Error)return q;let J={};for(let[Z,$]of Object.entries(q)){if(Z.startsWith("__")||Z==="constructor"||Z==="prototype")continue;if($&&typeof $==="object")J[Z]=p($,Q+1);else J[Z]=$}return J}function HJ(q,Q){try{let J=YJ(Q),Z=Object.keys(J),$=Object.values(J);return FJ(q,Z)(...$)}catch{return}}function OQ(q){try{return Mq(q),!0}catch{return!1}}function m(q,Q){try{let J=HJ(q,Q);if(J&&typeof J==="object"&&!Array.isArray(J))return J;return{}}catch{return{}}}var wq=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"]),GJ=2000,v=new Map;function BJ(q,Q){let J=`${q.join(",")}\x00${Q}`,Z=v.get(J);if(Z)return Z;let $=Function(...q,Q);if(v.size>=GJ)v.clear();return v.set(J,$),$}function jQ(q){return q.replace(/'(?:[^'\\]|\\.)*'|"(?:[^"\\]|\\.)*"|`(?:[^`\\]|\\.)*`/g," ").replace(/\??\.\s*[a-zA-Z_$][\w$]*/g," ").replace(/([{,]\s*)[a-zA-Z_$][\w$]*(\s*:)/g,"$1$2").match(/\b[a-zA-Z_$][\w$]*\b/g)||[]}var VJ=/^[A-Za-z_$][\w$]*$/;function _J(q){return VJ.test(q)&&!wq.has(q)}function FJ(q,Q){let J=Mq(q),Z=[];for(let G=0;G<Q.length;G++){if(!_J(Q[G]))continue;Z.push({key:Q[G],index:G})}Z.sort((G,V)=>G.key.localeCompare(V.key));let $=Z.map((G)=>G.key),W=Z.map((G)=>G.index),H=(G)=>BJ([...$,...G],`
36
36
  'use strict';
37
37
  try {
38
38
  return ${J};
@@ -43,8 +43,8 @@ catch (e) {
43
43
  }
44
44
  throw e;
45
45
  }
46
- `),Y=H([]);if(W.length===Q.length)return Vq(Y,W,H);return Vq((...G)=>{let B=Array($.length);for(let V=0;V<$.length;V++)B[V]=G[$[V]];return Y(...B)},W,H,(G)=>{Y=H(G)})}function Vq(q,Q,J,Z){let W=/^(\w+) is not defined$/,H=q,Y=[],X=new Set(Q);return(...G)=>{for(let B=0;B<=8;B++)try{return H(...G)}catch(V){let _=V instanceof Error?V.message:"",M=W.exec(_);if(!(V instanceof ReferenceError)||!M)return;let F=M[1];if(X.has(F)||Kq.has(F))return;X.add(F),Y.push(F),H=J(Y),Z?.(Y)}return}}function OQ(q){let Q=q.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Z of J)if(Z.test(Q))return!1;return!0}import l from"path";var k;async function _J(){if(k!==void 0)return k;try{k=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{k=null}return k}var r={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},w={},D={},A={};function IQ(q){if(q)delete w[q];else for(let Q of Object.keys(w))delete w[Q]}function NQ(){let q=Object.entries(w).map(([Q,J])=>({locale:Q,loadedAt:new Date(J.loadedAt),keyCount:jq(J.translations)}));return{size:Object.keys(w).length,locales:Object.keys(w),entries:q}}function jq(q,Q=0){for(let J of Object.values(q))if(Q++,J&&typeof J==="object"&&!Array.isArray(J))Q=jq(J,Q);return Q}function UJ(q,Q=0){if(Q<=0)return!1;return Date.now()-q.loadedAt>Q}function RQ(q){if(w[q])return"loaded";return A[q]||"idle"}function TQ(q){return A[q]==="loading"}function EQ(q){return!!w[q]}async function FJ(q,Q){let{locales:J,parallel:Z=!0,priority:$={},onLocaleLoaded:W,onComplete:H,onError:Y}=q,X=Z?J:[...J].sort((G,B)=>($[B]||0)-($[G]||0));if(Z){let G=X.map(async(B)=>{try{await x(B,Q),W?.(B)}catch(V){Y?.(B,V instanceof Error?V:Error(String(V)))}});await Promise.all(G)}else for(let G of X)try{await x(G,Q),W?.(G)}catch(B){Y?.(G,B instanceof Error?B:Error(String(B)))}H?.()}function kQ(q,Q){queueMicrotask(()=>{FJ(q,Q).catch((J)=>{if(Q.debug)console.error("Background preload error:",J)})})}async function x(q,Q){if({...r,...Q.i18n}.cache&&w[q]){let $=w[q],W=Q.i18n?.cacheMaxAge??0;if(!UJ($,W))return $.translations}if(D[q]?.state==="loading")return D[q].promise;A[q]="loading";let Z=s(q,Q).then(($)=>{return A[q]="loaded",delete D[q],$}).catch(($)=>{throw A[q]="error",D[q]={promise:Z,state:"error",error:$ instanceof Error?$:Error(String($))},$});return D[q]={promise:Z,state:"loading"},Z}function MJ(q){return w[q]?.translations}async function SQ(q,Q){let J=MJ(q);if(J)return J;return x(q,Q)}async function PQ(q,Q){if(w[q])return w[q].translations;if(D[q]){if(Q)return Promise.race([D[q].promise,new Promise((J,Z)=>setTimeout(()=>Z(Error(`Timeout waiting for locale: ${q}`)),Q))]);return D[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function LQ(){return Object.entries(A).filter(([q,Q])=>Q==="loading").map(([q])=>q)}function bQ(q){if(q)delete D[q],delete A[q];else{for(let Q of Object.keys(D))delete D[Q];for(let Q of Object.keys(A))delete A[Q]}}async function s(q,Q){let J={...r,...Q.i18n},Z=l.isAbsolute(J.translationsDir)?J.translationsDir:l.resolve(Q.root||process.cwd(),J.translationsDir);try{let $=await _J(),W=$?await $(q,{translationsDir:Z,defaultLocale:J.defaultLocale,sources:DJ(J.format)}):await KJ(q,J,Z);if(W===void 0){if(q!==J.defaultLocale)return s(J.defaultLocale,Q);return{}}let H=W;if(J.cache)w[q]={translations:H,loadedAt:Date.now(),locale:q};return H}catch($){if(Q.debug)console.error(`Error loading translation file for locale "${q}":`,$);if(q!==J.defaultLocale)return s(J.defaultLocale,Q);return{}}}async function KJ(q,Q,J){let Z=l.join(J,`${q}${wJ(Q.format)}`);try{let $=await import(Z);return $.default||$}catch($){try{let W=await Bun.file(Z).text();if(Q.format==="yaml"||Q.format==="yml")return OJ(W);if(Q.format==="json")return JSON.parse(W);throw $}catch{return}}}function wJ(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function OJ(q){let Q={},J=q.split(`
47
- `),Z=[{obj:Q,indent:-1}];for(let $ of J){let W=$.replace(/#.*$/,"").trimEnd();if(!W.trim())continue;let H=W.search(/\S/);if(H===-1)continue;while(Z.length>1&&Z[Z.length-1].indent>=H)Z.pop();let Y=Z[Z.length-1].obj,X=W.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(X){let[,,G,B]=X,V=G.trim(),_=B.trim();if(_==="")Y[V]={},Z.push({obj:Y[V],indent:H});else Y[V]=jJ(_)}}return Q}function jJ(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let Q=q.toLowerCase();if(Q==="true"||Q==="yes")return!0;if(Q==="false"||Q==="no")return!1;if(Q==="null"||Q==="~")return null;let J=Number(q);if(!Number.isNaN(J)&&q!=="")return J;return q}function DJ(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function zJ(q,Q){return x(q,Q)}function AJ(q,Q){for(let J of q){let Z=J.trim(),$=Z.match(/^\{(\d+)\}\s*(.*)$/);if($){let H=Number.parseInt($[1],10);if(Q===H)return $[2];continue}let W=Z.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(W){let H=Number.parseInt(W[1],10),Y=W[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(W[2],10);if(Q>=H&&Q<=Y)return W[3];continue}}if(q.length===2)return Q===1?q[0].trim():q[1].trim();if(Q<q.length)return q[Q].trim();return q[q.length-1].trim()}function IJ(q,Q={}){return Dq(q,Q)}function Dq(q,Q){let J="",Z=0;while(Z<q.length)if(q[Z]==="{"){let $=NJ(q,Z);if($===-1){J+=q[Z],Z++;continue}let W=q.slice(Z+1,$);J+=RJ(W,Q),Z=$+1}else if(q[Z]==="'"&&Z+1<q.length)if(q[Z+1]==="'")J+="'",Z+=2;else if(q[Z+1]==="{"||q[Z+1]==="}")J+=q[Z+1],Z+=2;else J+=q[Z],Z++;else J+=q[Z],Z++;return J}function NJ(q,Q){let J=0;for(let Z=Q;Z<q.length;Z++)if(q[Z]==="{")J++;else if(q[Z]==="}"){if(J--,J===0)return Z}return-1}function RJ(q,Q){let J=TJ(q);if(J.length===0)return`{${q}}`;let Z=J[0].trim(),$=Q[Z];if(J.length===1)return $!==void 0?String($):`{${Z}}`;switch(J[1].trim().toLowerCase()){case"plural":return EJ($,J.slice(2).join(","),Q);case"select":return SJ($,J.slice(2).join(","));case"selectordinal":return PJ($,J.slice(2).join(","));case"number":return bJ($,J[2]?.trim());case"date":return CJ($,J[2]?.trim());case"time":return yJ($,J[2]?.trim());default:return $!==void 0?String($):`{${q}}`}}function TJ(q){let Q=[],J="",Z=0;for(let $=0;$<q.length;$++){let W=q[$];if(W==="{")Z++,J+=W;else if(W==="}")Z--,J+=W;else if(W===","&&Z===0)Q.push(J),J="";else J+=W}if(J)Q.push(J);return Q}function EJ(q,Q,J){let Z=Number(q)||0,$=n(Q),W=`=${Z}`;if($[W])return c($[W],Z,J);let H=kJ(Z);if($[H])return c($[H],Z,J);if($.other)return c($.other,Z,J);return String(Z)}function c(q,Q,J){let Z=q.replace(/#/g,String(Q));return Dq(Z,J)}function kJ(q){let Q=Math.abs(q),J=Math.floor(Q),Z=String(q).includes(".")?String(q).split(".")[1].length:0;if(J===1&&Z===0)return"one";return"other"}function SJ(q,Q){let J=String(q||""),Z=n(Q);if(Z[J])return Z[J];return Z.other||String(q)}function PJ(q,Q){let J=Number(q)||0,Z=n(Q),$=LJ(J);if(Z[$])return Z[$].replace(/#/g,String(J));if(Z.other)return Z.other.replace(/#/g,String(J));return String(J)}function LJ(q){let Q=Math.abs(q),J=Q%10,Z=Q%100;if(J===1&&Z!==11)return"one";if(J===2&&Z!==12)return"two";if(J===3&&Z!==13)return"few";return"other"}function n(q){let Q={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Z=J.exec(q);while(Z!==null)Q[Z[1]]=Z[2],Z=J.exec(q);return Q}function bJ(q,Q){let J=Number(q);if(Number.isNaN(J))return String(q);switch(Q){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function CJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.dateStyle="short";break;case"medium":Z.dateStyle="medium";break;case"long":Z.dateStyle="long";break;case"full":Z.dateStyle="full";break;default:Z.dateStyle="medium"}return J.toLocaleDateString(void 0,Z)}function yJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.timeStyle="short";break;case"medium":Z.timeStyle="medium";break;case"long":Z.timeStyle="long";break;case"full":Z.timeStyle="full";break;default:Z.timeStyle="short"}return J.toLocaleTimeString(void 0,Z)}function vJ(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function i(q,Q,J=!0,Z={}){let $=q.split("."),W=Q;for(let Y of $){if(W===void 0||W===null)break;W=W[Y]}if(W===void 0||W===null)return J?q:"";let H=String(W);if(vJ(H))return IJ(H,Z);if(H.includes("|")&&"count"in Z){let Y=Number(Z.count),X=H.split("|");H=AJ(X,Y)}for(let[Y,X]of Object.entries(Z)){let G=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");H=H.replace(new RegExp(`:${G}`,"g"),String(X))}return H}var wq=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),xJ=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function o(q){if(!q)return"ltr";let Q=q.trim().toLowerCase().replace(/_/g,"-").split("-"),J=Q[0];if(!J)return"ltr";let Z=Q[1]?.length===4?Q[1]:void 0;if(Z)return xJ.has(Z)?"rtl":"ltr";if(Q.length>1&&wq.has(`${J}-${Q[1]}`))return"rtl";return wq.has(J)?"rtl":"ltr"}function CQ(q){return o(q)==="rtl"}async function yQ(q,Q,J,Z){let $=q,W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,H={...r,...Z.i18n},Y=await zJ(H.locale,Z);Q.__translations=Y,Q.__locale=H.locale,Q.__i18nConfig=H,$=await Oq($,W,async(B,V,_,M,F)=>{try{let K={};if(_)try{let U=[()=>JSON.parse(_),()=>{let z=`{"data":${_}}`,T=JSON.parse(z);return typeof T.data==="object"?T.data:{}},()=>{return m(_,Q)}];for(let z of U)try{if(K=z(),Object.keys(K).length>0)break}catch{}}catch(U){if(Z.debug)console.error("Error parsing parameters for @translate directive:",U)}return i(V,Y,H.fallbackToKey,K)||M.trim()}catch(K){if(Z.debug)console.error("Error processing @translate directive:",K);return C("Translate",`Error in @translate('${V}'): ${K instanceof Error?K.message:String(K)}`,j.EVALUATION_ERROR)}});let X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Z.debug){console.warn(`Processing translations in template. Sections: ${$.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let B=[...$.matchAll(X)];console.warn(`Found ${B.length} @translate matches`),B.forEach((V,_)=>console.warn(`Match ${_}: ${V[0]}, Key: ${V[1]}, Params: ${V[2]||"none"}`))}return $=await Oq($,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(B,V,_,M)=>{try{let F={};if(_)try{let K=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,U=JSON.parse(O);return typeof U.data==="object"?U.data:{}},()=>{return m(_,Q)}];for(let O of K)try{if(F=O(),Object.keys(F).length>0)break}catch{}}catch(K){if(Z.debug)console.error("Error parsing parameters for @translate directive:",K)}return i(V,Y,H.fallbackToKey,F)}catch(F){if(Z.debug)console.error("Error processing @translate directive:",F);return C("Translate",`Error in @translate('${V}'): ${F instanceof Error?F.message:String(F)}`,j.EVALUATION_ERROR)}}),$}async function Oq(q,Q,J){let Z=[];return q.replace(Q,(W,...H)=>{let Y=J(W,...H).then((X)=>({match:W,replacement:X}));return Z.push(Y),W}),(await Promise.all(Z)).reduce((W,{match:H,replacement:Y})=>W.replace(H,Y),q)}function vQ(q,Q=!0){return(J,Z={})=>{return i(J,q,Q,Z)}}import zq from"path";function a(q,Q){if(!q||o(q)!=="rtl")return!1;return!Q||Q.trim().toLowerCase()!=="rtl"}function Iq(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function S(q,Q){let J=new RegExp(`\\b${Q}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!J)return null;return J[2]??J[3]??J[4]??null}function uQ(q,Q,J,Z){let $=q;$=$.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(H,Y,X)=>{let B={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Y]||"Make this element accessible";return`<!-- a11y-hint: ${X||B} -->`});let W=/@screenReader\(([^@]*)\)@endScreenReader/g;return $=$.replace(W,(H,Y)=>{return`<span class="sr-only">${Y.trim()}</span>`}),$=$.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,Y,X)=>{return`<span id="${`desc-${Y}`}" class="sr-only">${X}</span>`}),$}function dQ(){return`
46
+ `),Y=H([]),X=Z.every((G,V)=>G.index===V);if($.length===Q.length&&X)return Vq(Y,$,H);return Vq((...G)=>{let V=Array(W.length);for(let _=0;_<W.length;_++)V[_]=G[W[_]];return Y(...V)},$,H,(G)=>{Y=H(G)})}function Vq(q,Q,J,Z){let W=/^(\w+) is not defined$/,H=q,Y=[],X=new Set(Q);return(...B)=>{for(let G=0;G<=8;G++)try{return H(...B)}catch(V){let _=V instanceof Error?V.message:"",M=W.exec(_);if(!(V instanceof ReferenceError)||!M)return;let U=M[1];if(X.has(U)||wq.has(U))return;if(X.add(U),Y.push(U),Z)Z(Y);else H=J(Y)}return}}function DQ(q){let Q=q.trim(),J=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Z of J)if(Z.test(Q))return!1;return!0}import l from"path";var k;async function UJ(){if(k!==void 0)return k;try{k=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{k=null}return k}var r={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},K={},D={},I={};function RQ(q){if(q)delete K[q];else for(let Q of Object.keys(K))delete K[Q]}function TQ(){let q=Object.entries(K).map(([Q,J])=>({locale:Q,loadedAt:new Date(J.loadedAt),keyCount:jq(J.translations)}));return{size:Object.keys(K).length,locales:Object.keys(K),entries:q}}function jq(q,Q=0){for(let J of Object.values(q))if(Q++,J&&typeof J==="object"&&!Array.isArray(J))Q=jq(J,Q);return Q}function MJ(q,Q=0){if(Q<=0)return!1;return Date.now()-q.loadedAt>Q}function EQ(q){if(K[q])return"loaded";return I[q]||"idle"}function kQ(q){return I[q]==="loading"}function SQ(q){return!!K[q]}async function wJ(q,Q){let{locales:J,parallel:Z=!0,priority:$={},onLocaleLoaded:W,onComplete:H,onError:Y}=q,X=Z?J:[...J].sort((B,G)=>($[G]||0)-($[B]||0));if(Z){let B=X.map(async(G)=>{try{await x(G,Q),W?.(G)}catch(V){Y?.(G,V instanceof Error?V:Error(String(V)))}});await Promise.all(B)}else for(let B of X)try{await x(B,Q),W?.(B)}catch(G){Y?.(B,G instanceof Error?G:Error(String(G)))}H?.()}function PQ(q,Q){queueMicrotask(()=>{wJ(q,Q).catch((J)=>{if(Q.debug)console.error("Background preload error:",J)})})}async function x(q,Q){if({...r,...Q.i18n}.cache&&K[q]){let $=K[q],W=Q.i18n?.cacheMaxAge??0;if(!MJ($,W))return $.translations}if(D[q]?.state==="loading")return D[q].promise;I[q]="loading";let Z=s(q,Q).then(($)=>{return I[q]="loaded",delete D[q],$}).catch(($)=>{throw I[q]="error",D[q]={promise:Z,state:"error",error:$ instanceof Error?$:Error(String($))},$});return D[q]={promise:Z,state:"loading"},Z}function KJ(q){return K[q]?.translations}async function LQ(q,Q){let J=KJ(q);if(J)return J;return x(q,Q)}async function bQ(q,Q){if(K[q])return K[q].translations;if(D[q]){if(Q)return Promise.race([D[q].promise,new Promise((J,Z)=>setTimeout(()=>Z(Error(`Timeout waiting for locale: ${q}`)),Q))]);return D[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function CQ(){return Object.entries(I).filter(([q,Q])=>Q==="loading").map(([q])=>q)}function yQ(q){if(q)delete D[q],delete I[q];else{for(let Q of Object.keys(D))delete D[Q];for(let Q of Object.keys(I))delete I[Q]}}async function s(q,Q){let J={...r,...Q.i18n},Z=l.isAbsolute(J.translationsDir)?J.translationsDir:l.resolve(Q.root||process.cwd(),J.translationsDir);try{let $=await UJ(),W=$?await $(q,{translationsDir:Z,defaultLocale:J.defaultLocale,sources:IJ(J.format)}):await OJ(q,J,Z);if(W===void 0){if(q!==J.defaultLocale)return s(J.defaultLocale,Q);return{}}let H=W;if(J.cache)K[q]={translations:H,loadedAt:Date.now(),locale:q};return H}catch($){if(Q.debug)console.error(`Error loading translation file for locale "${q}":`,$);if(q!==J.defaultLocale)return s(J.defaultLocale,Q);return{}}}async function OJ(q,Q,J){let Z=l.join(J,`${q}${jJ(Q.format)}`);try{let $=await import(Z);return $.default||$}catch($){try{let W=await Bun.file(Z).text();if(Q.format==="yaml"||Q.format==="yml")return DJ(W);if(Q.format==="json")return JSON.parse(W);throw $}catch{return}}}function jJ(q){switch(q){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function DJ(q){let Q={},J=q.split(`
47
+ `),Z=[{obj:Q,indent:-1}];for(let $ of J){let W=$.replace(/#.*$/,"").trimEnd();if(!W.trim())continue;let H=W.search(/\S/);if(H===-1)continue;while(Z.length>1&&Z[Z.length-1].indent>=H)Z.pop();let Y=Z[Z.length-1].obj,X=W.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(X){let[,,B,G]=X,V=B.trim(),_=G.trim();if(_==="")Y[V]={},Z.push({obj:Y[V],indent:H});else Y[V]=zJ(_)}}return Q}function zJ(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let Q=q.toLowerCase();if(Q==="true"||Q==="yes")return!0;if(Q==="false"||Q==="no")return!1;if(Q==="null"||Q==="~")return null;let J=Number(q);if(!Number.isNaN(J)&&q!=="")return J;return q}function IJ(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function AJ(q,Q){return x(q,Q)}function NJ(q,Q){for(let J of q){let Z=J.trim(),$=Z.match(/^\{(\d+)\}\s*(.*)$/);if($){let H=Number.parseInt($[1],10);if(Q===H)return $[2];continue}let W=Z.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(W){let H=Number.parseInt(W[1],10),Y=W[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(W[2],10);if(Q>=H&&Q<=Y)return W[3];continue}}if(q.length===2)return Q===1?q[0].trim():q[1].trim();if(Q<q.length)return q[Q].trim();return q[q.length-1].trim()}function RJ(q,Q={}){return Dq(q,Q)}function Dq(q,Q){let J="",Z=0;while(Z<q.length)if(q[Z]==="{"){let $=TJ(q,Z);if($===-1){J+=q[Z],Z++;continue}let W=q.slice(Z+1,$);J+=EJ(W,Q),Z=$+1}else if(q[Z]==="'"&&Z+1<q.length)if(q[Z+1]==="'")J+="'",Z+=2;else if(q[Z+1]==="{"||q[Z+1]==="}")J+=q[Z+1],Z+=2;else J+=q[Z],Z++;else J+=q[Z],Z++;return J}function TJ(q,Q){let J=0;for(let Z=Q;Z<q.length;Z++)if(q[Z]==="{")J++;else if(q[Z]==="}"){if(J--,J===0)return Z}return-1}function EJ(q,Q){let J=kJ(q);if(J.length===0)return`{${q}}`;let Z=J[0].trim(),$=Q[Z];if(J.length===1)return $!==void 0?String($):`{${Z}}`;switch(J[1].trim().toLowerCase()){case"plural":return SJ($,J.slice(2).join(","),Q);case"select":return LJ($,J.slice(2).join(","));case"selectordinal":return bJ($,J.slice(2).join(","));case"number":return yJ($,J[2]?.trim());case"date":return vJ($,J[2]?.trim());case"time":return xJ($,J[2]?.trim());default:return $!==void 0?String($):`{${q}}`}}function kJ(q){let Q=[],J="",Z=0;for(let $=0;$<q.length;$++){let W=q[$];if(W==="{")Z++,J+=W;else if(W==="}")Z--,J+=W;else if(W===","&&Z===0)Q.push(J),J="";else J+=W}if(J)Q.push(J);return Q}function SJ(q,Q,J){let Z=Number(q)||0,$=n(Q),W=`=${Z}`;if($[W])return c($[W],Z,J);let H=PJ(Z);if($[H])return c($[H],Z,J);if($.other)return c($.other,Z,J);return String(Z)}function c(q,Q,J){let Z=q.replace(/#/g,String(Q));return Dq(Z,J)}function PJ(q){let Q=Math.abs(q),J=Math.floor(Q),Z=String(q).includes(".")?String(q).split(".")[1].length:0;if(J===1&&Z===0)return"one";return"other"}function LJ(q,Q){let J=String(q||""),Z=n(Q);if(Z[J])return Z[J];return Z.other||String(q)}function bJ(q,Q){let J=Number(q)||0,Z=n(Q),$=CJ(J);if(Z[$])return Z[$].replace(/#/g,String(J));if(Z.other)return Z.other.replace(/#/g,String(J));return String(J)}function CJ(q){let Q=Math.abs(q),J=Q%10,Z=Q%100;if(J===1&&Z!==11)return"one";if(J===2&&Z!==12)return"two";if(J===3&&Z!==13)return"few";return"other"}function n(q){let Q={},J=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Z=J.exec(q);while(Z!==null)Q[Z[1]]=Z[2],Z=J.exec(q);return Q}function yJ(q,Q){let J=Number(q);if(Number.isNaN(J))return String(q);switch(Q){case"integer":return Math.floor(J).toLocaleString();case"percent":return`${(J*100).toFixed(0)}%`;case"currency":return J.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return J.toLocaleString()}}function vJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.dateStyle="short";break;case"medium":Z.dateStyle="medium";break;case"long":Z.dateStyle="long";break;case"full":Z.dateStyle="full";break;default:Z.dateStyle="medium"}return J.toLocaleDateString(void 0,Z)}function xJ(q,Q){let J=q instanceof Date?q:new Date(String(q));if(Number.isNaN(J.getTime()))return String(q);let Z={};switch(Q){case"short":Z.timeStyle="short";break;case"medium":Z.timeStyle="medium";break;case"long":Z.timeStyle="long";break;case"full":Z.timeStyle="full";break;default:Z.timeStyle="short"}return J.toLocaleTimeString(void 0,Z)}function gJ(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function i(q,Q,J=!0,Z={}){let $=q.split("."),W=Q;for(let Y of $){if(W===void 0||W===null)break;W=W[Y]}if(W===void 0||W===null)return J?q:"";let H=String(W);if(gJ(H))return RJ(H,Z);if(H.includes("|")&&"count"in Z){let Y=Number(Z.count),X=H.split("|");H=NJ(X,Y)}for(let[Y,X]of Object.entries(Z)){let B=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");H=H.replace(new RegExp(`:${B}`,"g"),String(X))}return H}var Kq=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),fJ=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function o(q){if(!q)return"ltr";let Q=q.trim().toLowerCase().replace(/_/g,"-").split("-"),J=Q[0];if(!J)return"ltr";let Z=Q[1]?.length===4?Q[1]:void 0;if(Z)return fJ.has(Z)?"rtl":"ltr";if(Q.length>1&&Kq.has(`${J}-${Q[1]}`))return"rtl";return Kq.has(J)?"rtl":"ltr"}function vQ(q){return o(q)==="rtl"}async function xQ(q,Q,J,Z){let $=q,W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,H={...r,...Z.i18n},Y=await AJ(H.locale,Z);Q.__translations=Y,Q.__locale=H.locale,Q.__i18nConfig=H,$=await Oq($,W,async(G,V,_,M,U)=>{try{let w={};if(_)try{let F=[()=>JSON.parse(_),()=>{let z=`{"data":${_}}`,T=JSON.parse(z);return typeof T.data==="object"?T.data:{}},()=>{return m(_,Q)}];for(let z of F)try{if(w=z(),Object.keys(w).length>0)break}catch{}}catch(F){if(Z.debug)console.error("Error parsing parameters for @translate directive:",F)}return i(V,Y,H.fallbackToKey,w)||M.trim()}catch(w){if(Z.debug)console.error("Error processing @translate directive:",w);return C("Translate",`Error in @translate('${V}'): ${w instanceof Error?w.message:String(w)}`,j.EVALUATION_ERROR)}});let X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Z.debug){console.warn(`Processing translations in template. Sections: ${$.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let G=[...$.matchAll(X)];console.warn(`Found ${G.length} @translate matches`),G.forEach((V,_)=>console.warn(`Match ${_}: ${V[0]}, Key: ${V[1]}, Params: ${V[2]||"none"}`))}return $=await Oq($,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(G,V,_,M)=>{try{let U={};if(_)try{let w=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return m(_,Q)}];for(let O of w)try{if(U=O(),Object.keys(U).length>0)break}catch{}}catch(w){if(Z.debug)console.error("Error parsing parameters for @translate directive:",w)}return i(V,Y,H.fallbackToKey,U)}catch(U){if(Z.debug)console.error("Error processing @translate directive:",U);return C("Translate",`Error in @translate('${V}'): ${U instanceof Error?U.message:String(U)}`,j.EVALUATION_ERROR)}}),$}async function Oq(q,Q,J){let Z=[];return q.replace(Q,(W,...H)=>{let Y=J(W,...H).then((X)=>({match:W,replacement:X}));return Z.push(Y),W}),(await Promise.all(Z)).reduce((W,{match:H,replacement:Y})=>W.replace(H,Y),q)}function gQ(q,Q=!0){return(J,Z={})=>{return i(J,q,Q,Z)}}import zq from"path";function a(q,Q){if(!q||o(q)!=="rtl")return!1;return!Q||Q.trim().toLowerCase()!=="rtl"}function Aq(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function S(q,Q){let J=new RegExp(`\\b${Q}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!J)return null;return J[2]??J[3]??J[4]??null}function pQ(q,Q,J,Z){let $=q;$=$.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(H,Y,X)=>{let G={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Y]||"Make this element accessible";return`<!-- a11y-hint: ${X||G} -->`});let W=/@screenReader\(([^@]*)\)@endScreenReader/g;return $=$.replace(W,(H,Y)=>{return`<span class="sr-only">${Y.trim()}</span>`}),$=$.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(H,Y,X)=>{return`<span id="${`desc-${Y}`}" class="sr-only">${X}</span>`}),$}function mQ(){return`
48
48
  .sr-only {
49
49
  position: absolute;
50
50
  width: 1px;
@@ -56,5 +56,5 @@ catch (e) {
56
56
  white-space: nowrap;
57
57
  border-width: 0;
58
58
  }
59
- `.trim()}function gJ(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function Nq(q){let Q=new Map,J=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,($,W,H)=>{let Y=Q.get(H);if(!Y)Y=`stx-a11y-component-${Q.size}`,Q.set(H,Y);return`<${W}${Y}`}),Z=new Map([...Q.entries()].map(([$,W])=>[W,$]));return{protectedSource:J,restore:($)=>$.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(W,H,Y)=>{let X=Z.get(Y);return X?`<${H}${X}`:W})}}function fJ(q,Q){let J=[],Z=/<img\s+([^>]*)>/gi,$;$=Z.exec(q);while($!==null){let U=$[1];if(!/\balt\s*=/i.test(U))J.push({type:"missing-alt",element:$[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});$=Z.exec(q)}let W=/<button([^>]*)>\s*<\/button>/gi;$=W.exec(q);while($!==null){let U=$[1];if(!/\baria-label\s*=/i.test(U)&&!/\btitle\s*=/i.test(U))J.push({type:"missing-accessible-name",element:$[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});$=W.exec(q)}let H=/<a\s+([^>]*)>\s*<\/a>/gi;$=H.exec(q);while($!==null){let U=$[1];if(!/\baria-label\s*=/i.test(U)&&!/\btitle\s*=/i.test(U))J.push({type:"link-missing-text",element:$[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});$=H.exec(q)}let Y=/<(input|select|textarea)\s+([^>]*)>/gi;$=Y.exec(q);while($!==null){let U=$[2];if(/\btype\s*=\s*["']hidden["']/i.test(U)){$=Y.exec(q);continue}let z=/\baria-label\s*=/i.test(U)||/\baria-labelledby\s*=/i.test(U),T=U.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!z){let Rq=T&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${T[1]}["']`,"i").test(q),t=$.index,e=q.substring(0,t),sJ=q.substring(t),Tq=(e.match(/<label\b/gi)||[]).length,Eq=(e.match(/<\/label>/gi)||[]).length,kq=Tq>Eq;if(!Rq&&!kq)J.push({type:"input-missing-label",element:$[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}$=Y.exec(q)}let X=/<h([1-6])[^>]*>/gi,G=[];$=X.exec(q);while($!==null)G.push(Number.parseInt($[1],10)),$=X.exec(q);let B=0;for(let U of G){if(B>0&&U>B+1)J.push({type:"heading-skip",element:`<h${U}>`,message:`Heading level skipped from h${B} to h${U}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});B=U}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))J.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let V=q.match(/<html\b([^>]*)>/i);if(V&&a(S(V[1],"lang"),S(V[1],"dir")))J.push({type:"missing-dir",element:V[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let _=/<table([^>]*)>([\s\S]*?)<\/table>/gi;$=_.exec(q);while($!==null){let U=$[2];if(!Iq(S($[1],"role"))&&!/<th\b/i.test(U))J.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});$=_.exec(q)}let M=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;$=M.exec(q);while($!==null){if(!/\bmuted\b/i.test($[0]))J.push({type:"autoplay-audio",element:`<${$[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});$=M.exec(q)}let F=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;$=F.exec(q);while($!==null)J.push({type:"positive-tabindex",element:`tabindex="${$[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),$=F.exec(q);let K=/<iframe\s+([^>]*)>/gi;$=K.exec(q);while($!==null){let U=$[1];if(!/\btitle\s*=/i.test(U)&&!/\baria-label\s*=/i.test(U))J.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});$=K.exec(q)}let O=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;$=O.exec(q);while($!==null){let U=$[1].toLowerCase(),z=$[2];if(U!=="button"&&!/\btabindex\s*=/i.test(z))J.push({type:"button-not-focusable",element:$[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});$=O.exec(q)}return J}async function hJ(q,Q){let{protectedSource:J}=Nq(q);if(!gJ())return fJ(J,Q);let Z=[];try{let $=globalThis.document.createElement("div");$.innerHTML=J,$.querySelectorAll("img").forEach((X)=>{if(!X.hasAttribute("alt"))Z.push({type:"missing-alt",element:`<${X.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),$.querySelectorAll('button, a, [role="button"]').forEach((X)=>{if(!(X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby")||X.textContent&&X.textContent.trim().length>0))Z.push({type:"missing-accessible-name",element:`<${X.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),$.querySelectorAll("input, select, textarea").forEach((X)=>{let G=X.getAttribute("id"),B=G&&$.querySelector(`label[for="${G}"]`),V=X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby"),_=X.closest("label")!==null;if(!B&&!V&&!_)Z.push({type:"input-missing-label",element:`<${X.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let W=Array.from($.querySelectorAll("h1, h2, h3, h4, h5, h6")),H=0;for(let X of W){let G=Number.parseInt(X.tagName.charAt(1));if(H>0&&G>H+1)Z.push({type:"heading-skip",element:`<${X.outerHTML}>`,message:`Heading level skipped from h${H} to h${G}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});H=G}let Y=$.querySelector("html");if(J.includes("<html")&&Y&&!Y.hasAttribute("lang"))Z.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(Y&&a(Y.getAttribute("lang"),Y.getAttribute("dir")))Z.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if($.querySelectorAll("a").forEach((X)=>{let G=X.textContent&&X.textContent.trim().length>0,B=X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby"),V=X.hasAttribute("title"),_=X.querySelector("img[alt]");if(!G&&!B&&!V&&!_)Z.push({type:"link-missing-text",element:`<${X.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),J.includes("<nav")||J.includes("<header")){if(!$.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&$.querySelectorAll("a").length>5)Z.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if($.querySelectorAll("table").forEach((X)=>{if(Iq(X.getAttribute("role")))return;let G=X.querySelector("caption");if(!X.querySelector("th"))Z.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!G&&!X.hasAttribute("aria-label")&&!X.hasAttribute("aria-labelledby"))Z.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),$.querySelectorAll('[style*="color"]').forEach((X)=>{let G=X.getAttribute("style")||"";if(G.includes("color:")&&!G.includes("background"))Z.push({type:"potential-contrast-issue",element:`<${X.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),$.querySelectorAll("video[autoplay], audio[autoplay]").forEach((X)=>{if(!X.hasAttribute("muted"))Z.push({type:"autoplay-audio",element:`<${X.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),$.querySelectorAll("[tabindex]").forEach((X)=>{if(Number.parseInt(X.getAttribute("tabindex")||"0")>0)Z.push({type:"positive-tabindex",element:`<${X.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),$.querySelectorAll('[role="button"]').forEach((X)=>{if(!X.hasAttribute("tabindex"))Z.push({type:"button-not-focusable",element:`<${X.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),J.includes("<body")&&!$.querySelector('main, [role="main"]'))Z.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});$.querySelectorAll("iframe").forEach((X)=>{if(!X.hasAttribute("title")&&!X.hasAttribute("aria-label"))Z.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch($){console.error(`Error checking accessibility in ${Q}:`,$)}return Z}async function uJ(q,Q={}){let J={},{recursive:Z=!0,ignorePaths:$=[]}=Q,W=Array.isArray(q)?q:[q],H=await Aq(W,{recursive:Z,ignorePaths:$}),Y=[];for(let X of H)try{let G=await Bun.file(X).text();if(X.endsWith("good-a11y.stx"))continue;let B=await hJ(G,X);if(Y.push(X),B.length>0)J[X]=B}catch(G){console.error(`Error scanning ${X}:`,G)}return{results:J,scannedFiles:Y}}async function pQ(q,Q={}){return(await uJ(q,Q)).results}var dJ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function pJ(q,Q={}){let J={...dJ,...Q},Z=[],{protectedSource:$,restore:W}=Nq(q),H=$;if(J.fixMissingAlt)H=H.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(Y,X,G)=>{if(/\balt\s*=/i.test(X))return Y;let B=Y,V=`<img${X} alt=""${G}`;return Z.push({type:"missing-alt",description:"Added empty alt attribute to image",before:B,after:V}),V});if(J.fixMissingLabels)H=H.replace(/<button([^>]*)>\s*<\/button>/gi,(Y,X)=>{if(/\baria-label\s*=/i.test(X)||/\btitle\s*=/i.test(X))return Y;let G=Y,B=`<button${X} aria-label="Button"></button>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:G,after:B}),B}),H=H.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(Y,X,G)=>{if(/\baria-label\s*=/i.test(X)||/\btitle\s*=/i.test(X))return Y;if(!G&&Y.replace(/<a[^>]*>|<\/a>/gi,"").trim())return Y;let B=Y,V=`<a${X} aria-label="Link">${G||""}</a>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:B,after:V}),V});if(J.fixMissingFormLabels)H=H.replace(/<(input|select|textarea)([^>]*)>/gi,(Y,X,G)=>{if(/\baria-label\s*=/i.test(G)||/\baria-labelledby\s*=/i.test(G))return Y;if(/\btype\s*=\s*["']hidden["']/i.test(G))return Y;let B=G.match(/\bname\s*=\s*["']([^"']+)["']/i),V=G.match(/\bid\s*=\s*["']([^"']+)["']/i),_=B?.[1]||V?.[1]||X,M=Y,F=`<${X}${G} aria-label="${_}">`;return Z.push({type:"input-missing-label",description:`Added aria-label to ${X} element`,before:M,after:F}),F});if(J.fixMissingLang)H=H.replace(/<html([^>]*)>/gi,(Y,X)=>{if(/\blang\s*=/i.test(X))return Y;let G=Y,B=`<html${X} lang="${J.defaultLang}">`;return Z.push({type:"missing-lang",description:`Added lang="${J.defaultLang}" to html element`,before:G,after:B}),B});if(J.fixMissingDir)H=H.replace(/<html([^>]*)>/gi,(Y,X)=>{let G=S(X,"lang");if(!a(G,S(X,"dir")))return Y;let B=/\bdir\s*=/i.test(X)?`<html${X.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${X} dir="rtl">`;return Z.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${G}" is right-to-left)`,before:Y,after:B}),B});if(J.fixPositiveTabindex)H=H.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(Y,X)=>{let G=Y,B='tabindex="0"';return Z.push({type:"positive-tabindex",description:`Changed tabindex="${X}" to tabindex="0"`,before:G,after:'tabindex="0"'}),'tabindex="0"'});if(J.fixButtonFocusable)H=H.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(Y,X,G)=>{if(/\btabindex\s*=/i.test(G))return Y;if(X.toLowerCase()==="button")return Y;let B=Y,V=`<${X}${G} tabindex="0">`;return Z.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:B,after:V}),V});if(J.fixTableHeaders)H=H.replace(/<th([^>]*)>/gi,(Y,X)=>{if(/\bscope\s*=/i.test(X))return Y;let G=Y,B=`<th${X} scope="col">`;return Z.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:G,after:B}),B});return{original:q,fixed:W(H),fixCount:Z.length,fixes:Z}}async function mJ(q,Q={},J=!1){let Z=await Bun.file(q).text(),$=pJ(Z,Q);if(J&&$.fixCount>0)await Bun.write(q,$.fixed);return $}async function mQ(q,Q={},J={}){let Z={},{recursive:$=!0,ignorePaths:W=[],writeBack:H=!1,extensions:Y=[".stx",".html",".htm"]}=J,X=Y.length===1?`*${Y[0]}`:`*{${Y.join(",")}}`,G=zq.join(q,$?`**/${X}`:X),B=new Bun.Glob(G);for await(let V of B.scan()){if(W.some((M)=>V.includes(zq.normalize(M))))continue;try{let M=await mJ(V,Q,H);if(M.fixCount>0)Z[V]=M}catch(M){console.error(`Error fixing ${V}:`,M)}}return Z}var cJ={name:"a11y",handler:(q,Q,J,Z)=>{if(!Q.length)return q;let $=Q[0].replace(/['"]/g,""),W=Q.length>1?Q[1].replace(/['"]/g,""):"",Y={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${W||Y} -->${q}`},hasEndTag:!1},lJ={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function cQ(){return[cJ,lJ]}
60
- export{Pq as jr,Lq as kr,bq as lr,Cq as mr,Jq as nr,yq as or,j as pr,g as qr,vq as rr,E as sr,rJ as tr,gq as ur,L as vr,fq as wr,b as xr,I as yr,Zq as zr,$q as Ar,Xq as Br,Wq as Cr,Yq as Dr,f as Er,C as Fr,cq as Gr,lq as Hr,sq as Ir,iq as Jr,rq as Kr,h as Lr,nq as Mr,oq as Nr,d as Or,y as Pr,tq as Qr,eq as Rr,qJ as Sr,Bq as Tr,Mq as Ur,HJ as Vr,KQ as Wr,m as Xr,wQ as Yr,VJ as Zr,OQ as _r,r as $r,IQ as as,NQ as bs,RQ as cs,TQ as ds,EQ as es,FJ as fs,kQ as gs,x as hs,MJ as is,SQ as js,PQ as ks,LQ as ls,bQ as ms,zJ as ns,IJ as os,vJ as ps,i as qs,o as rs,CQ as ss,yQ as ts,vQ as us,Iq as vs,S as ws,uQ as xs,dQ as ys,gJ as zs,fJ as As,hJ as Bs,uJ as Cs,pQ as Ds,pJ as Es,mJ as Fs,mQ as Gs,cJ as Hs,lJ as Is,cQ as Js};
59
+ `.trim()}function hJ(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function Nq(q){let Q=new Map,J=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,($,W,H)=>{let Y=Q.get(H);if(!Y)Y=`stx-a11y-component-${Q.size}`,Q.set(H,Y);return`<${W}${Y}`}),Z=new Map([...Q.entries()].map(([$,W])=>[W,$]));return{protectedSource:J,restore:($)=>$.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(W,H,Y)=>{let X=Z.get(Y);return X?`<${H}${X}`:W})}}function uJ(q,Q){let J=[],Z=/<img\s+([^>]*)>/gi,$;$=Z.exec(q);while($!==null){let F=$[1];if(!/\balt\s*=/i.test(F))J.push({type:"missing-alt",element:$[0].substring(0,100),message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"});$=Z.exec(q)}let W=/<button([^>]*)>\s*<\/button>/gi;$=W.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"missing-accessible-name",element:$[0].substring(0,100),message:"Empty button missing accessible name",impact:"critical",help:"Add text content, aria-label, or title",helpUrl:"https://web.dev/learn/accessibility/aria-html/"});$=W.exec(q)}let H=/<a\s+([^>]*)>\s*<\/a>/gi;$=H.exec(q);while($!==null){let F=$[1];if(!/\baria-label\s*=/i.test(F)&&!/\btitle\s*=/i.test(F))J.push({type:"link-missing-text",element:$[0].substring(0,100),message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"});$=H.exec(q)}let Y=/<(input|select|textarea)\s+([^>]*)>/gi;$=Y.exec(q);while($!==null){let F=$[2];if(/\btype\s*=\s*["']hidden["']/i.test(F)){$=Y.exec(q);continue}let z=/\baria-label\s*=/i.test(F)||/\baria-labelledby\s*=/i.test(F),T=F.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!z){let Rq=T&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${T[1]}["']`,"i").test(q),t=$.index,e=q.substring(0,t),rJ=q.substring(t),Tq=(e.match(/<label\b/gi)||[]).length,Eq=(e.match(/<\/label>/gi)||[]).length,kq=Tq>Eq;if(!Rq&&!kq)J.push({type:"input-missing-label",element:$[0].substring(0,100),message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})}$=Y.exec(q)}let X=/<h([1-6])[^>]*>/gi,B=[];$=X.exec(q);while($!==null)B.push(Number.parseInt($[1],10)),$=X.exec(q);let G=0;for(let F of B){if(G>0&&F>G+1)J.push({type:"heading-skip",element:`<h${F}>`,message:`Heading level skipped from h${G} to h${F}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});G=F}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))J.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});let V=q.match(/<html\b([^>]*)>/i);if(V&&a(S(V[1],"lang"),S(V[1],"dir")))J.push({type:"missing-dir",element:V[0].substring(0,100),message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});let _=/<table([^>]*)>([\s\S]*?)<\/table>/gi;$=_.exec(q);while($!==null){let F=$[2];if(!Aq(S($[1],"role"))&&!/<th\b/i.test(F))J.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});$=_.exec(q)}let M=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;$=M.exec(q);while($!==null){if(!/\bmuted\b/i.test($[0]))J.push({type:"autoplay-audio",element:`<${$[1]}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"});$=M.exec(q)}let U=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;$=U.exec(q);while($!==null)J.push({type:"positive-tabindex",element:`tabindex="${$[1]}"`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"}),$=U.exec(q);let w=/<iframe\s+([^>]*)>/gi;$=w.exec(q);while($!==null){let F=$[1];if(!/\btitle\s*=/i.test(F)&&!/\baria-label\s*=/i.test(F))J.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"});$=w.exec(q)}let O=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;$=O.exec(q);while($!==null){let F=$[1].toLowerCase(),z=$[2];if(F!=="button"&&!/\btabindex\s*=/i.test(z))J.push({type:"button-not-focusable",element:$[0].substring(0,100),message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"});$=O.exec(q)}return J}async function dJ(q,Q){let{protectedSource:J}=Nq(q);if(!hJ())return uJ(J,Q);let Z=[];try{let $=globalThis.document.createElement("div");$.innerHTML=J,$.querySelectorAll("img").forEach((X)=>{if(!X.hasAttribute("alt"))Z.push({type:"missing-alt",element:`<${X.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),$.querySelectorAll('button, a, [role="button"]').forEach((X)=>{if(!(X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby")||X.textContent&&X.textContent.trim().length>0))Z.push({type:"missing-accessible-name",element:`<${X.outerHTML}>`,message:"Interactive element missing accessible name",impact:"critical",help:"Add text content, aria-label, or aria-labelledby",helpUrl:"https://web.dev/learn/accessibility/aria-html/"})}),$.querySelectorAll("input, select, textarea").forEach((X)=>{let B=X.getAttribute("id"),G=B&&$.querySelector(`label[for="${B}"]`),V=X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby"),_=X.closest("label")!==null;if(!G&&!V&&!_)Z.push({type:"input-missing-label",element:`<${X.outerHTML}>`,message:"Form input missing associated label",impact:"serious",help:"Associate a label with the input or use aria-label",helpUrl:"https://web.dev/learn/accessibility/forms/"})});let W=Array.from($.querySelectorAll("h1, h2, h3, h4, h5, h6")),H=0;for(let X of W){let B=Number.parseInt(X.tagName.charAt(1));if(H>0&&B>H+1)Z.push({type:"heading-skip",element:`<${X.outerHTML}>`,message:`Heading level skipped from h${H} to h${B}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});H=B}let Y=$.querySelector("html");if(J.includes("<html")&&Y&&!Y.hasAttribute("lang"))Z.push({type:"missing-lang",element:"<html>",message:"Document language not specified",impact:"serious",help:"Add lang attribute to the html element",helpUrl:"https://web.dev/learn/accessibility/more-html/#language"});if(Y&&a(Y.getAttribute("lang"),Y.getAttribute("dir")))Z.push({type:"missing-dir",element:"<html>",message:'Document language is right-to-left but dir="rtl" is not set',impact:"serious",help:'Add dir="rtl" to the html element so the layout mirrors the text',helpUrl:"https://www.w3.org/International/questions/qa-html-dir"});if($.querySelectorAll("a").forEach((X)=>{let B=X.textContent&&X.textContent.trim().length>0,G=X.hasAttribute("aria-label")||X.hasAttribute("aria-labelledby"),V=X.hasAttribute("title"),_=X.querySelector("img[alt]");if(!B&&!G&&!V&&!_)Z.push({type:"link-missing-text",element:`<${X.outerHTML}>`,message:"Link has no accessible text",impact:"serious",help:"Add text content, aria-label, or title to links",helpUrl:"https://web.dev/learn/accessibility/more-html/#links"})}),J.includes("<nav")||J.includes("<header")){if(!$.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&$.querySelectorAll("a").length>5)Z.push({type:"missing-skip-link",element:"<nav>",message:"Consider adding a skip navigation link",impact:"minor",help:"Add a skip link to allow keyboard users to bypass navigation",helpUrl:"https://web.dev/learn/accessibility/focus/#skip-links"})}if($.querySelectorAll("table").forEach((X)=>{if(Aq(X.getAttribute("role")))return;let B=X.querySelector("caption");if(!X.querySelector("th"))Z.push({type:"table-missing-headers",element:"<table>",message:"Table missing header cells (th)",impact:"serious",help:"Use th elements for table headers",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"});if(!B&&!X.hasAttribute("aria-label")&&!X.hasAttribute("aria-labelledby"))Z.push({type:"table-missing-caption",element:"<table>",message:"Table missing caption or accessible name",impact:"minor",help:"Add a caption element or aria-label to describe the table",helpUrl:"https://web.dev/learn/accessibility/more-html/#tables"})}),$.querySelectorAll('[style*="color"]').forEach((X)=>{let B=X.getAttribute("style")||"";if(B.includes("color:")&&!B.includes("background"))Z.push({type:"potential-contrast-issue",element:`<${X.tagName.toLowerCase()}>`,message:"Element has inline color style - verify contrast ratio",impact:"minor",help:"Ensure text has sufficient contrast ratio (4.5:1 for normal text)",helpUrl:"https://web.dev/learn/accessibility/color-contrast/"})}),$.querySelectorAll("video[autoplay], audio[autoplay]").forEach((X)=>{if(!X.hasAttribute("muted"))Z.push({type:"autoplay-audio",element:`<${X.tagName.toLowerCase()}>`,message:"Auto-playing media may disrupt users",impact:"moderate",help:"Add muted attribute or provide controls to stop playback",helpUrl:"https://web.dev/learn/accessibility/more-html/#multimedia"})}),$.querySelectorAll("[tabindex]").forEach((X)=>{if(Number.parseInt(X.getAttribute("tabindex")||"0")>0)Z.push({type:"positive-tabindex",element:`<${X.tagName.toLowerCase()}>`,message:"Positive tabindex disrupts natural tab order",impact:"moderate",help:'Use tabindex="0" or "-1" instead of positive values',helpUrl:"https://web.dev/learn/accessibility/focus/#tab-index"})}),$.querySelectorAll('[role="button"]').forEach((X)=>{if(!X.hasAttribute("tabindex"))Z.push({type:"button-not-focusable",element:`<${X.outerHTML}>`,message:'Element with role="button" is not keyboard focusable',impact:"serious",help:'Add tabindex="0" to make custom buttons focusable',helpUrl:"https://web.dev/learn/accessibility/focus/"})}),J.includes("<body")&&!$.querySelector('main, [role="main"]'))Z.push({type:"missing-main-landmark",element:"<body>",message:"Document missing main landmark region",impact:"moderate",help:"Add a main element to identify the primary content",helpUrl:"https://web.dev/learn/accessibility/structure/#landmarks"});$.querySelectorAll("iframe").forEach((X)=>{if(!X.hasAttribute("title")&&!X.hasAttribute("aria-label"))Z.push({type:"iframe-missing-title",element:"<iframe>",message:"Iframe missing title attribute",impact:"serious",help:"Add a title attribute to describe the iframe content",helpUrl:"https://web.dev/learn/accessibility/more-html/#frames"})})}catch($){console.error(`Error checking accessibility in ${Q}:`,$)}return Z}async function pJ(q,Q={}){let J={},{recursive:Z=!0,ignorePaths:$=[]}=Q,W=Array.isArray(q)?q:[q],H=await Iq(W,{recursive:Z,ignorePaths:$}),Y=[];for(let X of H)try{let B=await Bun.file(X).text();if(X.endsWith("good-a11y.stx"))continue;let G=await dJ(B,X);if(Y.push(X),G.length>0)J[X]=G}catch(B){console.error(`Error scanning ${X}:`,B)}return{results:J,scannedFiles:Y}}async function cQ(q,Q={}){return(await pJ(q,Q)).results}var mJ={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function cJ(q,Q={}){let J={...mJ,...Q},Z=[],{protectedSource:$,restore:W}=Nq(q),H=$;if(J.fixMissingAlt)H=H.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,(Y,X,B)=>{if(/\balt\s*=/i.test(X))return Y;let G=Y,V=`<img${X} alt=""${B}`;return Z.push({type:"missing-alt",description:"Added empty alt attribute to image",before:G,after:V}),V});if(J.fixMissingLabels)H=H.replace(/<button([^>]*)>\s*<\/button>/gi,(Y,X)=>{if(/\baria-label\s*=/i.test(X)||/\btitle\s*=/i.test(X))return Y;let B=Y,G=`<button${X} aria-label="Button"></button>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:B,after:G}),G}),H=H.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,(Y,X,B)=>{if(/\baria-label\s*=/i.test(X)||/\btitle\s*=/i.test(X))return Y;if(!B&&Y.replace(/<a[^>]*>|<\/a>/gi,"").trim())return Y;let G=Y,V=`<a${X} aria-label="Link">${B||""}</a>`;return Z.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:G,after:V}),V});if(J.fixMissingFormLabels)H=H.replace(/<(input|select|textarea)([^>]*)>/gi,(Y,X,B)=>{if(/\baria-label\s*=/i.test(B)||/\baria-labelledby\s*=/i.test(B))return Y;if(/\btype\s*=\s*["']hidden["']/i.test(B))return Y;let G=B.match(/\bname\s*=\s*["']([^"']+)["']/i),V=B.match(/\bid\s*=\s*["']([^"']+)["']/i),_=G?.[1]||V?.[1]||X,M=Y,U=`<${X}${B} aria-label="${_}">`;return Z.push({type:"input-missing-label",description:`Added aria-label to ${X} element`,before:M,after:U}),U});if(J.fixMissingLang)H=H.replace(/<html([^>]*)>/gi,(Y,X)=>{if(/\blang\s*=/i.test(X))return Y;let B=Y,G=`<html${X} lang="${J.defaultLang}">`;return Z.push({type:"missing-lang",description:`Added lang="${J.defaultLang}" to html element`,before:B,after:G}),G});if(J.fixMissingDir)H=H.replace(/<html([^>]*)>/gi,(Y,X)=>{let B=S(X,"lang");if(!a(B,S(X,"dir")))return Y;let G=/\bdir\s*=/i.test(X)?`<html${X.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${X} dir="rtl">`;return Z.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${B}" is right-to-left)`,before:Y,after:G}),G});if(J.fixPositiveTabindex)H=H.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,(Y,X)=>{let B=Y,G='tabindex="0"';return Z.push({type:"positive-tabindex",description:`Changed tabindex="${X}" to tabindex="0"`,before:B,after:'tabindex="0"'}),'tabindex="0"'});if(J.fixButtonFocusable)H=H.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,(Y,X,B)=>{if(/\btabindex\s*=/i.test(B))return Y;if(X.toLowerCase()==="button")return Y;let G=Y,V=`<${X}${B} tabindex="0">`;return Z.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:G,after:V}),V});if(J.fixTableHeaders)H=H.replace(/<th([^>]*)>/gi,(Y,X)=>{if(/\bscope\s*=/i.test(X))return Y;let B=Y,G=`<th${X} scope="col">`;return Z.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:B,after:G}),G});return{original:q,fixed:W(H),fixCount:Z.length,fixes:Z}}async function lJ(q,Q={},J=!1){let Z=await Bun.file(q).text(),$=cJ(Z,Q);if(J&&$.fixCount>0)await Bun.write(q,$.fixed);return $}async function lQ(q,Q={},J={}){let Z={},{recursive:$=!0,ignorePaths:W=[],writeBack:H=!1,extensions:Y=[".stx",".html",".htm"]}=J,X=Y.length===1?`*${Y[0]}`:`*{${Y.join(",")}}`,B=zq.join(q,$?`**/${X}`:X),G=new Bun.Glob(B);for await(let V of G.scan()){if(W.some((M)=>V.includes(zq.normalize(M))))continue;try{let M=await lJ(V,Q,H);if(M.fixCount>0)Z[V]=M}catch(M){console.error(`Error fixing ${V}:`,M)}}return Z}var sJ={name:"a11y",handler:(q,Q,J,Z)=>{if(!Q.length)return q;let $=Q[0].replace(/['"]/g,""),W=Q.length>1?Q[1].replace(/['"]/g,""):"",Y={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[$]||"Make this element accessible";return`<!-- a11y-hint: ${W||Y} -->${q}`},hasEndTag:!1},iJ={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function sQ(){return[sJ,iJ]}
60
+ export{Pq as lr,Lq as mr,bq as nr,Cq as or,Jq as pr,yq as qr,j as rr,g as sr,vq as tr,E as ur,oJ as vr,gq as wr,L as xr,fq as yr,b as zr,A as Ar,Zq as Br,$q as Cr,Xq as Dr,Wq as Er,Yq as Fr,f as Gr,C as Hr,cq as Ir,lq as Jr,sq as Kr,iq as Lr,rq as Mr,h as Nr,nq as Or,oq as Pr,d as Qr,y as Rr,tq as Sr,eq as Tr,qJ as Ur,Bq as Vr,Mq as Wr,HJ as Xr,OQ as Yr,m as Zr,jQ as _r,_J as $r,FJ as as,DQ as bs,r as cs,RQ as ds,TQ as es,EQ as fs,kQ as gs,SQ as hs,wJ as is,PQ as js,x as ks,KJ as ls,LQ as ms,bQ as ns,CQ as os,yQ as ps,AJ as qs,RJ as rs,gJ as ss,i as ts,o as us,vQ as vs,xQ as ws,gQ as xs,Aq as ys,S as zs,pQ as As,mQ as Bs,hJ as Cs,uJ as Ds,dJ as Es,pJ as Fs,cQ as Gs,cJ as Hs,lJ as Is,lQ as Js,sJ as Ks,iJ as Ls,sQ as Ms};