@stacksjs/stx 0.2.358 → 0.2.360

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 (161) hide show
  1. package/dist/{chunk-wkyt4j9e.js → chunk-0dkaztpp.js} +1 -1
  2. package/dist/{chunk-jmdxn2mq.js → chunk-0p52xkk9.js} +1 -1
  3. package/dist/{chunk-3y8vvkar.js → chunk-0ppgyq8q.js} +1 -1
  4. package/dist/{chunk-0dj2gne3.js → chunk-0vrn78j5.js} +1 -1
  5. package/dist/chunk-0vvqxeq3.js +2 -0
  6. package/dist/{chunk-2gtwha4k.js → chunk-0w12p79j.js} +1 -1
  7. package/dist/chunk-11hfa3kp.js +2 -0
  8. package/dist/{chunk-19m7hed6.js → chunk-135mme4g.js} +1 -1
  9. package/dist/{chunk-ms25gb16.js → chunk-175da6nh.js} +1 -1
  10. package/dist/{chunk-hy79zwyy.js → chunk-198fr2d4.js} +1 -1
  11. package/dist/{chunk-e48050x3.js → chunk-1c2k7713.js} +1 -1
  12. package/dist/{chunk-2s3wvns6.js → chunk-1e0jj83h.js} +1 -1
  13. package/dist/{chunk-f72c62s7.js → chunk-1hvxs7rh.js} +1 -1
  14. package/dist/chunk-1tfhw9c0.js +2 -0
  15. package/dist/{chunk-q4kgqqed.js → chunk-1tz8fb87.js} +2 -2
  16. package/dist/{chunk-3ssjb8cx.js → chunk-2119txb8.js} +201 -201
  17. package/dist/{chunk-mdbj7sq8.js → chunk-2c907a77.js} +1 -1
  18. package/dist/{chunk-ez003q74.js → chunk-2xpdcr8c.js} +1 -1
  19. package/dist/{chunk-qnptmtqh.js → chunk-3v63btq1.js} +1 -1
  20. package/dist/{chunk-7v1g7prf.js → chunk-3xspzgrq.js} +1 -1
  21. package/dist/{chunk-tf16jtj4.js → chunk-4arms0am.js} +1 -1
  22. package/dist/chunk-4qhhbzx9.js +2 -0
  23. package/dist/{chunk-rydb5n5b.js → chunk-5fzgdrfy.js} +1 -1
  24. package/dist/{chunk-nybn003d.js → chunk-5j3v0p6s.js} +1 -1
  25. package/dist/{chunk-x5b8az2h.js → chunk-5mjz2qgs.js} +1 -1
  26. package/dist/chunk-6nf5g9bh.js +2 -0
  27. package/dist/chunk-6pdfvpa6.js +2 -0
  28. package/dist/chunk-71gg4a7z.js +2 -0
  29. package/dist/chunk-7k7vqrj3.js +2 -0
  30. package/dist/{chunk-0smr2xjs.js → chunk-7kfv1q2r.js} +1 -1
  31. package/dist/chunk-7ppey2yt.js +2 -0
  32. package/dist/{chunk-aa8015mk.js → chunk-7racewc5.js} +1 -1
  33. package/dist/{chunk-t23kccpz.js → chunk-7rj4h2t2.js} +2 -2
  34. package/dist/{chunk-apbr1kb1.js → chunk-7wj5je2t.js} +1 -1
  35. package/dist/{chunk-284kattb.js → chunk-83af26bs.js} +1 -1
  36. package/dist/{chunk-qrvey4wk.js → chunk-84577w4y.js} +1 -1
  37. package/dist/{chunk-9qdn9y72.js → chunk-89xwdc1d.js} +1 -1
  38. package/dist/{chunk-f2jypsax.js → chunk-8akj7f4h.js} +1 -1
  39. package/dist/chunk-8e6fgnk5.js +2 -0
  40. package/dist/chunk-93z5qt1s.js +2 -0
  41. package/dist/{chunk-94dz7hrj.js → chunk-a5cybvfv.js} +1 -1
  42. package/dist/{chunk-a4jhcbsh.js → chunk-a68y9s2j.js} +2 -2
  43. package/dist/{chunk-m0eg86q3.js → chunk-b381xgvw.js} +1 -1
  44. package/dist/{chunk-dtdwjpvf.js → chunk-bab01mkf.js} +1 -1
  45. package/dist/{chunk-79fj9zem.js → chunk-benx1c4p.js} +1 -1
  46. package/dist/chunk-bqm306xw.js +2 -0
  47. package/dist/chunk-bxkr3ts9.js +2 -0
  48. package/dist/{chunk-hcf8399w.js → chunk-ct8tvahc.js} +1 -1
  49. package/dist/chunk-d0350ak9.js +2 -0
  50. package/dist/chunk-d5gzma79.js +2 -0
  51. package/dist/{chunk-kjd9hbg4.js → chunk-dj24n5n7.js} +3 -3
  52. package/dist/{chunk-hkrzv980.js → chunk-dnard9gp.js} +2 -2
  53. package/dist/{chunk-sa6cgj9h.js → chunk-dwyad9gb.js} +1 -1
  54. package/dist/{chunk-trva71am.js → chunk-e03m4har.js} +2 -2
  55. package/dist/{chunk-c17ybabd.js → chunk-enjfp0tp.js} +1 -1
  56. package/dist/chunk-erbyg322.js +2 -0
  57. package/dist/chunk-g6av70d6.js +2 -0
  58. package/dist/{chunk-j6kec9kp.js → chunk-g8k2zj4z.js} +1 -1
  59. package/dist/chunk-gzr4mcp2.js +2 -0
  60. package/dist/{chunk-awyyskad.js → chunk-hkq7d4t2.js} +1 -1
  61. package/dist/{chunk-ykevda74.js → chunk-jc6wrxrh.js} +2 -2
  62. package/dist/{chunk-rcbt11p8.js → chunk-k11mck47.js} +1 -1
  63. package/dist/{chunk-3kd0zn9c.js → chunk-k91ej0ts.js} +1 -1
  64. package/dist/{chunk-tv04k7gq.js → chunk-karkhcja.js} +1 -1
  65. package/dist/{chunk-5270fyk7.js → chunk-kd95t585.js} +1 -1
  66. package/dist/{chunk-emjmshj8.js → chunk-m8kem5ca.js} +1 -1
  67. package/dist/{chunk-n5tpqzcb.js → chunk-m8nmsr4g.js} +1 -1
  68. package/dist/{chunk-v1qm7p7t.js → chunk-masf0yq5.js} +2 -2
  69. package/dist/{chunk-czj6nq0b.js → chunk-met6wtbk.js} +2 -2
  70. package/dist/{chunk-ep034wt0.js → chunk-mzrejx5e.js} +1 -1
  71. package/dist/chunk-n6eg071x.js +2 -0
  72. package/dist/chunk-nabannen.js +2 -0
  73. package/dist/{chunk-wz4fnsat.js → chunk-necx4e30.js} +1 -1
  74. package/dist/chunk-p1ycxzwx.js +2 -0
  75. package/dist/{chunk-7jcntsp4.js → chunk-p41s1y4v.js} +1 -1
  76. package/dist/{chunk-j8wycqve.js → chunk-pf8575bx.js} +1 -1
  77. package/dist/{chunk-b8ywrx2w.js → chunk-pt74619a.js} +1 -1
  78. package/dist/{chunk-krt45cqy.js → chunk-pwctc0m1.js} +1 -1
  79. package/dist/{chunk-degz74nv.js → chunk-qg0w5tjb.js} +1 -1
  80. package/dist/{chunk-z50ex86m.js → chunk-r55bx7r8.js} +1 -1
  81. package/dist/chunk-r6sacvqn.js +2 -0
  82. package/dist/{chunk-6yfccnr7.js → chunk-r6xmsxaz.js} +1 -1
  83. package/dist/{chunk-3kyydhzt.js → chunk-r7q89mv2.js} +1 -1
  84. package/dist/{chunk-ec8jsqgm.js → chunk-rargfb5s.js} +2 -2
  85. package/dist/chunk-s3q7k0bf.js +2 -0
  86. package/dist/{chunk-6qhatdte.js → chunk-s4jbvdx3.js} +2 -2
  87. package/dist/chunk-sd57d9bq.js +2 -0
  88. package/dist/chunk-syxe0cyd.js +2 -0
  89. package/dist/{chunk-6gsgayq3.js → chunk-t9m81dj8.js} +1 -1
  90. package/dist/{chunk-zxfejz72.js → chunk-ta6z7k4p.js} +1 -1
  91. package/dist/chunk-tfjv0567.js +2 -0
  92. package/dist/{chunk-kyyt9xhs.js → chunk-v90kxg77.js} +1 -1
  93. package/dist/{chunk-czypgdc1.js → chunk-vcdd231w.js} +1 -1
  94. package/dist/{chunk-qbz6yn8c.js → chunk-vgx5077x.js} +2 -2
  95. package/dist/{chunk-gn2qc03b.js → chunk-vj5ywxmb.js} +1 -1
  96. package/dist/chunk-vnwzzw9j.js +2 -0
  97. package/dist/{chunk-rtfwn4cm.js → chunk-vsqx756d.js} +1 -1
  98. package/dist/{chunk-cf9gt3h9.js → chunk-vyhrzsnf.js} +10 -10
  99. package/dist/{chunk-ejwfnttb.js → chunk-w1asc0zd.js} +1 -1
  100. package/dist/{chunk-f11z7q5g.js → chunk-x0c5vqss.js} +1 -1
  101. package/dist/{chunk-zxnf0c9x.js → chunk-x6c2t5dv.js} +1 -1
  102. package/dist/{chunk-h99qxgbr.js → chunk-xb23pzwa.js} +1 -1
  103. package/dist/{chunk-eg8k598q.js → chunk-xb2fcf36.js} +1 -1
  104. package/dist/{chunk-1nnza3m6.js → chunk-xk402w4a.js} +1 -1
  105. package/dist/chunk-xn226qe0.js +2 -0
  106. package/dist/{chunk-aacfyyya.js → chunk-xnbbnbtm.js} +1 -1
  107. package/dist/{chunk-n1y0hjk1.js → chunk-ypgyhr2p.js} +1 -1
  108. package/dist/{chunk-hh0aaxxy.js → chunk-z2rvc8d5.js} +2 -2
  109. package/dist/chunk-za8wxkx6.js +2 -0
  110. package/dist/{chunk-8xjasa91.js → chunk-zd172hvg.js} +1 -1
  111. package/dist/{chunk-4gtsf1xw.js → chunk-zf66zyyy.js} +1 -1
  112. package/dist/chunk-zmvgsgtd.js +2 -0
  113. package/dist/{chunk-0c49cy69.js → chunk-zxf0deg6.js} +1 -1
  114. package/dist/{chunk-mere396d.js → chunk-zxptxz2b.js} +1 -1
  115. package/dist/cli.js +14 -14
  116. package/dist/client-declarations.d.ts +24 -0
  117. package/dist/client-declarations.js +33 -0
  118. package/dist/client-script.js +2 -33
  119. package/dist/craft-entry.js +1 -1
  120. package/dist/craft.js +1 -1
  121. package/dist/database.js +1 -1
  122. package/dist/loop-binding.d.ts +23 -0
  123. package/dist/loop-binding.js +12 -0
  124. package/dist/loops.d.ts +20 -23
  125. package/dist/loops.js +9 -13
  126. package/dist/pwa.js +2 -2
  127. package/dist/ssg.js +2 -2
  128. package/dist/stx-virtual-ts.d.ts +27 -0
  129. package/dist/stx-virtual-ts.js +57 -10
  130. package/dist/visual-testing.js +1 -1
  131. package/package.json +5 -5
  132. package/dist/chunk-0chkqvs1.js +0 -2
  133. package/dist/chunk-0d6qgbks.js +0 -2
  134. package/dist/chunk-2x3zy811.js +0 -2
  135. package/dist/chunk-38mpg3kn.js +0 -2
  136. package/dist/chunk-3f782ywp.js +0 -2
  137. package/dist/chunk-4mkqzhfh.js +0 -2
  138. package/dist/chunk-54w1tgzq.js +0 -2
  139. package/dist/chunk-5x0zjm34.js +0 -2
  140. package/dist/chunk-7nf8azjh.js +0 -2
  141. package/dist/chunk-8wgsjh65.js +0 -2
  142. package/dist/chunk-a6x0czvr.js +0 -2
  143. package/dist/chunk-abtxpqna.js +0 -2
  144. package/dist/chunk-c4rpdtvw.js +0 -2
  145. package/dist/chunk-cgs5xpsn.js +0 -2
  146. package/dist/chunk-dpyc7pht.js +0 -2
  147. package/dist/chunk-e0f3qs59.js +0 -2
  148. package/dist/chunk-f3eb1f6z.js +0 -2
  149. package/dist/chunk-fzq2n865.js +0 -2
  150. package/dist/chunk-g3cmkyk2.js +0 -2
  151. package/dist/chunk-gxgrzeeh.js +0 -2
  152. package/dist/chunk-p78b80dp.js +0 -2
  153. package/dist/chunk-pr3hz3ec.js +0 -2
  154. package/dist/chunk-skdfq4hq.js +0 -2
  155. package/dist/chunk-w1a8dwgx.js +0 -2
  156. package/dist/chunk-w9gserf7.js +0 -2
  157. package/dist/chunk-x131a0jq.js +0 -2
  158. package/dist/chunk-xk782v5z.js +0 -2
  159. package/dist/chunk-xxrv2p42.js +0 -2
  160. package/dist/chunk-ynj1y0qm.js +0 -2
  161. package/dist/chunk-z8gccz1q.js +0 -2
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ue as a}from"./chunk-7kfv1q2r.js";import"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{a as startInteractive};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{Ze as a}from"./chunk-1hvxs7rh.js";import"./chunk-a68y9s2j.js";import"./chunk-0knxnyq6.js";import"./chunk-7rj4h2t2.js";import"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{a as startProductionServer};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{rt as SJ}from"./chunk-ejwfnttb.js";import{Rw as EJ}from"./chunk-emjmshj8.js";import G from"path";import{hasLocalConfig as bJ}from"bunfig";var FJ={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function y(J){return`--stx-${J}`}function f(J,Q){let Z=Q.lastIndexOf("-");if(Z===-1)return typeof J[Q]==="string"?J[Q]:void 0;let $=J[Q.slice(0,Z)];if(!$||typeof $!=="object")return;let U=$[Q.slice(Z+1)];return typeof U==="string"?U:void 0}function jJ(J){let Q={};for(let[Z,$]of Object.entries(FJ)){let U=f(J,$.light);if(U===void 0)continue;Q[Z]=`var(${y(Z)}, ${U})`}return Q}function WJ(J){let Q=[],Z=[];for(let[$,U]of Object.entries(FJ)){let F=f(J,U.light),j=f(J,U.dark);if(F===void 0)continue;if(Q.push(` ${y($)}: ${F};`),j!==void 0)Z.push(` ${y($)}: ${j};`)}if(Q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...Q,"}",".dark {",...Z,"}",""].join(`
2
+ import{st as SJ}from"./chunk-w1asc0zd.js";import{Sw as EJ}from"./chunk-m8kem5ca.js";import G from"path";import{hasLocalConfig as bJ}from"bunfig";var FJ={fg:{light:"neutral-900",dark:"neutral-100",description:"Primary text"},"fg-strong":{light:"neutral-700",dark:"neutral-300",description:"Labels, secondary headings"},"fg-muted":{light:"neutral-600",dark:"neutral-400",description:"Supporting text"},"fg-soft":{light:"neutral-500",dark:"neutral-400",description:"De-emphasised text"},"fg-subtle":{light:"neutral-400",dark:"neutral-500",description:"Recessive, non-essential text"},surface:{light:"neutral-50",dark:"neutral-800",description:"Page and panel background"},"surface-raised":{light:"neutral-100",dark:"neutral-700",description:"Cards, popovers"},"surface-sunken":{light:"neutral-200",dark:"neutral-700",description:"Wells, track backgrounds"},panel:{light:"white",dark:"neutral-800",description:"Card, menu, dialog surface"},field:{light:"white",dark:"neutral-700",description:"Form control surface"},page:{light:"neutral-50",dark:"neutral-900",description:"Page background, behind panels"},content:{light:"white",dark:"neutral-900",description:"Content area under a chrome header - a table or list body"},"surface-hover":{light:"neutral-100",dark:"neutral-700",description:"Row or item highlight on a page or panel"},"surface-raised-hover":{light:"neutral-200",dark:"neutral-600",description:"Raised surface, hovered"},"surface-sunken-hover":{light:"neutral-300",dark:"neutral-600",description:"Sunken surface, hovered"},"field-hover":{light:"neutral-50",dark:"neutral-600",description:"Form control surface, hovered"},link:{light:"blue-500",dark:"blue-400",description:"Hyperlink"},"link-hover":{light:"blue-600",dark:"blue-300",description:"Hyperlink, hovered"},inverse:{light:"neutral-900",dark:"neutral-700",description:"Tooltip bubble, inverted surface"},"inverse-ink":{light:"white",dark:"white",description:"Text on an inverted surface"},line:{light:"neutral-200",dark:"neutral-700",description:"Default border, divider"},"line-strong":{light:"neutral-300",dark:"neutral-600",description:"Input border, focus ring track"},accent:{light:"blue-600",dark:"blue-400",description:"Primary action, selected state"},info:{light:"cyan-600",dark:"cyan-400",description:"Informational emphasis"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-600",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"blue-500",dark:"blue-600",description:"Primary button fill"},"info-solid":{light:"cyan-500",dark:"cyan-600",description:"Informational fill"},"danger-solid":{light:"red-500",dark:"red-600",description:"Destructive button fill"},"success-solid":{light:"green-500",dark:"green-600",description:"Confirmation fill"},"warning-solid":{light:"yellow-500",dark:"yellow-600",description:"Caution fill"},"accent-solid-hover":{light:"blue-600",dark:"blue-700",description:"Primary button fill, hovered"},"info-solid-hover":{light:"cyan-600",dark:"cyan-700",description:"Informational fill, hovered"},"danger-solid-hover":{light:"red-600",dark:"red-700",description:"Destructive fill, hovered"},"success-solid-hover":{light:"green-600",dark:"green-700",description:"Confirmation fill, hovered"},"warning-solid-hover":{light:"yellow-600",dark:"yellow-700",description:"Caution fill, hovered"},"accent-ink":{light:"white",dark:"white",description:"Text on a primary fill"},"info-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on an informational fill"},"danger-ink":{light:"white",dark:"white",description:"Text on a destructive fill"},"success-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a confirmation fill"},"warning-ink":{light:"neutral-900",dark:"neutral-900",description:"Text on a caution fill"},"accent-soft":{light:"blue-100",dark:"blue-900",description:"Tinted primary fill"},"accent-soft-ink":{light:"blue-800",dark:"blue-200",description:"Text on a tinted primary fill"},"info-soft":{light:"cyan-100",dark:"cyan-900",description:"Tinted informational fill"},"info-soft-ink":{light:"cyan-800",dark:"cyan-200",description:"Text on a tinted informational fill"},"danger-soft":{light:"red-100",dark:"red-900",description:"Tinted destructive fill"},"danger-soft-ink":{light:"red-800",dark:"red-200",description:"Text on a tinted destructive fill"},"success-soft":{light:"green-100",dark:"green-900",description:"Tinted confirmation fill"},"success-soft-ink":{light:"green-800",dark:"green-200",description:"Text on a tinted confirmation fill"},"warning-soft":{light:"yellow-100",dark:"yellow-900",description:"Tinted caution fill"},"warning-soft-ink":{light:"yellow-800",dark:"yellow-200",description:"Text on a tinted caution fill"},secondary:{light:"purple-600",dark:"purple-400",description:"Secondary emphasis"},"secondary-solid":{light:"purple-500",dark:"purple-600",description:"Secondary fill"},"secondary-solid-hover":{light:"purple-600",dark:"purple-700",description:"Secondary fill, hovered"},"secondary-ink":{light:"white",dark:"white",description:"Text on a secondary fill"},"secondary-soft":{light:"purple-100",dark:"purple-900",description:"Tinted secondary fill"},"secondary-soft-ink":{light:"purple-800",dark:"purple-200",description:"Text on a tinted secondary fill"},"danger-fg":{light:"red-900",dark:"red-300",description:"Text in a field with an error"},"danger-fg-subtle":{light:"red-300",dark:"red-500",description:"Recessive text in a field with an error"},"danger-line":{light:"red-300",dark:"red-600",description:"Border of a field with an error"},"danger-focus":{light:"red-500",dark:"red-400",description:"Focus ring of a field with an error"}};function y(J){return`--stx-${J}`}function f(J,Q){let Z=Q.lastIndexOf("-");if(Z===-1)return typeof J[Q]==="string"?J[Q]:void 0;let $=J[Q.slice(0,Z)];if(!$||typeof $!=="object")return;let U=$[Q.slice(Z+1)];return typeof U==="string"?U:void 0}function jJ(J){let Q={};for(let[Z,$]of Object.entries(FJ)){let U=f(J,$.light);if(U===void 0)continue;Q[Z]=`var(${y(Z)}, ${U})`}return Q}function WJ(J){let Q=[],Z=[];for(let[$,U]of Object.entries(FJ)){let F=f(J,U.light),j=f(J,U.dark);if(F===void 0)continue;if(Q.push(` ${y($)}: ${F};`),j!==void 0)Z.push(` ${y($)}: ${j};`)}if(Q.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...Q,"}",".dark {",...Z,"}",""].join(`
3
3
  `)}var XJ={control:{value:"0.375rem",description:"Buttons, inputs, selects \u2014 rounded-md"},panel:{value:"0.5rem",description:"Cards, dialogs, menus \u2014 rounded-lg"},pill:{value:"9999px",description:"Chips and badges, which are pill-shaped by intent"}};function VJ(J){return`--stx-radius-${J}`}function qJ(){let J={};for(let[Q,Z]of Object.entries(XJ))J[Q]=`var(${VJ(Q)}, ${Z.value})`;return J}function zJ(){return["/* stx shape tokens \u2014 a radius by what the thing is. */",":root {",...Object.entries(XJ).map(([J,Q])=>` ${VJ(J)}: ${Q.value};`),"}",""].join(`
4
4
  `)}function GJ(J){return typeof J==="object"&&J!==null&&!Array.isArray(J)}function C(J,Q){let Z={...J};for(let[$,U]of Object.entries(Q))Z[$]=GJ(U)&&GJ(Z[$])?C(Z[$],U):U;return Z}function YJ(J={},Q={}){let Z=J.theme||{},$=Q.theme||{},{extend:U,...F}=$,{extend:j,...V}=Z,W=V.colors||{};V.colors={...W,...jJ(W)};let X=V.borderRadius||{};V.borderRadius={...X,...qJ()};let q=C(V,F),z=C(j||{},U||{});if(Object.keys(z).length>0)q.extend=z;let w=[...J.safelist||[],...Q.safelist||[]],O={...J.shortcuts||{},...Q.shortcuts||{}},K=[...J.preflights||[],...Q.preflights||[]];return{config:{...J,...Q,theme:q,safelist:w,shortcuts:O,...K.length>0?{preflights:K}:{},content:[],output:""},safelist:w,shortcuts:O,includePreflight:Q.preflight!==!1,minify:Q.minify===!0,tokenCSS:WJ(W)+zJ()}}var v=/<script\b[^>]*>/iy,p=/<\/script\s*>/ig,R=/<style\b[^>]*>/iy,m=/<\/style\s*>/ig;function wJ(J,Q,Z,$){Z.lastIndex=Q;let U=Z.exec(J);if(!U||U.index!==Q)return-1;$.lastIndex=Z.lastIndex;let F=$.exec(J);if(!F)return-1;return F.index+F[0].length}function h(J,Q){return wJ(J,Q,v,p)}function LJ(J,Q){return wJ(J,Q,R,m)}function pJ(J,Q){if(!J.startsWith("<!--",Q))return-1;let Z=J.indexOf("-->",Q+4);if(Z===-1)return-1;return Z+3}function BJ(J,Q){if(J.startsWith("<!--",Q)){let U=pJ(J,Q);return U===-1?J.length:U}if(v.lastIndex=Q,v.exec(J)?.index===Q){p.lastIndex=v.lastIndex;let U=p.exec(J);return U?U.index+U[0].length:J.length}if(R.lastIndex=Q,R.exec(J)?.index===Q){m.lastIndex=R.lastIndex;let U=m.exec(J);return U?U.index+U[0].length:J.length}return-1}function mJ(J,Q){let Z=[],$=0,U=J.length,F=!1,j=null;while($<U){let V=J[$];if(F){if(j){if(V===j)j=null}else if(V==='"'||V==="'")j=V;else if(V===">")F=!1;$++;continue}if(V!=="<"){let z=J.indexOf("<",$+1);if(z===-1)break;$=z;continue}let W=Q(J,$);if(W>$){Z.push({start:$,end:W,token:J.slice($,W)}),$=W;continue}let X=BJ(J,$);if(X>$){$=X;continue}let q=J.charCodeAt($+1);if(q>=65&&q<=90||q>=97&&q<=122)F=!0;$++}return Z}function NQ(J){let Q=0,Z=0,$=0,U=!1,F=null;while($<J.length){if(U){let z=J[$];if(F){if(z===F)F=null}else if(z==='"'||z==="'")F=z;else if(z===">")U=!1;$++;continue}let j=J.indexOf("<",$),V=j===-1?J.length:j;while($<V){let z=J[$++];if(z==="{")Q++;else if(z==="}")Z++;if(Q>=2&&Z>=2)return!0}if(j===-1)break;let W=BJ(J,j);if(W>j){$=W;continue}let X=J.charCodeAt(j+1),q=X===47?J.charCodeAt(j+2):X;if(q>=65&&q<=90||q>=97&&q<=122)U=!0;$=j+1}return!1}function HJ(J,Q){while(J.size>=Q){let Z=J.keys().next();if(Z.done)return;J.delete(Z.value)}}var hJ=65536,iJ=12,g=new Map;function i(J,Q,Z,$){let U=$!==void 0&&J.length>=hJ,F=U?`${$}\x00${J}`:"";if(U){let q=g.get(F);if(q)return{output:q.output,tokens:q.tokens.slice()}}let j=mJ(J,Q);if(j.length===0)return{output:J,tokens:[]};let V=j.map((q)=>q.token),W="",X=0;for(let q=0;q<j.length;q++){let z=j[q];W+=J.slice(X,z.start),W+=Z(z.token,q),X=z.end}if(W+=J.slice(X),U)return HJ(g,iJ),g.set(F,{output:W,tokens:V}),{output:W,tokens:V.slice()};return{output:W,tokens:V}}var nJ=65536,cJ=4,u=new Map;function d(J,Q,Z){return{output:Q,scripts:Z,restore:($)=>$===Q?J:rJ($,Z)}}function MQ(J){let Q=J.length>=nJ;if(Q){let U=u.get(J);if(U)return d(J,U.output,U.scripts.slice())}let{output:Z,tokens:$}=i(J,h,(U,F)=>`\x00STX_SCRIPT_${F}\x00`);if(Q)return HJ(u,cJ),u.set(J,{output:Z,scripts:$}),d(J,Z,$.slice());return d(J,Z,$)}function rJ(J,Q){if(Q.length===0)return J;return J.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,$)=>Q[+$]??"")}function OJ(J,Q=""){let Z=`${J}${Q}`,$=0;for(let U=0;U<Z.length;U++){let F=Z.charCodeAt(U);$=($<<5)-$+F,$=$&$}return`stx-${Math.abs($).toString(36)}`}function KJ(J,Q,Z={}){let{prefix:$="",preserveHost:U=!0,scopeKeyframes:F=!0,scopeCustomProperties:j=!1}=Z;if(!J.trim())return"";let V=n(J),W=[],X=new Map;if(F)for(let q of V){let z=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let w=z[1],O=`${Q}_${w}`;X.set(w,O)}}for(let q of V){let z=IJ(q,Q,$,U,X,j);W.push(z)}return W.join(`
5
5
 
@@ -18,7 +18,7 @@ catch (e) {
18
18
  }
19
19
  throw e;
20
20
  }
21
- `),U.set(X,q)}return q(...V)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:j,context:Q.slice()});return j}clear(){this.pool.length=0,this.fnCache.clear()}}var xQ=new AJ;class _J{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let j={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(j);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(j)}catch{}let V=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(V);break;case"warn":console.warn(V);break;case"error":console.error(V);break;case"throw":if(F)throw Error(V);else console.warn(V);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var a=null;function ZQ(){if(!a)a=new _J;return a}var EQ=new Proxy({},{get(J,Q){return ZQ()[Q]}});var RJ=[];function TJ(J){let Q=new s(J);return RJ.push(Q),Q}function CQ(){for(let J of RJ)J.clear()}function t(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function gQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:vJ.statSync(Z).mtimeMs})}catch{}return Q}function uQ(J){for(let Q of J)try{if(vJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var B=null,JJ=!1,D=null,_="",M=!1,yJ=256,I=new Map,H=new Map,T=null,fJ=null,b=new Map;function k(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function e(J,Q){if(I.has(J))I.delete(J);else if(I.size>=yJ)I.delete(I.keys().next().value);I.set(J,Q)}function UQ(J){let Q=k(J);if(H.has(Q))H.delete(Q);else if(H.size>=yJ)H.delete(H.keys().next().value);return H.set(Q,J),Q}function lQ(J){let Q=H.get(J);if(Q===void 0)return;return H.delete(J),H.set(J,Q),Q}async function FQ(J,Q=T){if(!Q)return null;try{let Z=Bun.file(G.join(Q,`cw-${k(J)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function jQ(J,Q,Z=T){if(!Z)return;try{if(!fs.existsSync(Z))fs.mkdirSync(Z,{recursive:!0});await Bun.write(G.join(Z,`cw-${k(J)}.css`),Q)}catch{}}async function kJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var WQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],XQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function VQ(){let J=[],Q=process.cwd();while(Q!==G.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of WQ)J.push(G.join(Q,Z,...$));Q=G.dirname(Q)}return J}function qQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&G.join(Q,"Code","Tools","ts-css"),Q&&G.join(Q,"Code","Tools","crosswind"),Q&&G.join(Q,"repos","stacks-org","ts-css"),Q&&G.join(Q,"repos","stacks-org","crosswind"),G.join(process.cwd(),"..","ts-css"),G.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(G.join($,"packages","toolkit","dist","engine","index.js")),J.push(G.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(G.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function CJ(){if(JJ)return B;JJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let j=await kJ(F);if(j){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${G.dirname(G.dirname(F))}`);return j}}return null};if(process.env.CROSSWIND_SRC){let U=G.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return B=F,B}let Q=await J(VQ());if(Q)return B=Q,B;let Z=XQ;for(let U of Z){let F=await kJ(U);if(F){if(B=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return B}}let $=await J(qQ());if($)return B=$,B;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function oQ(){QJ.clear(),B=null,JJ=!1,D=null,_="",I.clear(),H.clear(),fJ=null,b.clear()}var xJ=!1;async function gJ(J){try{let Q=bJ({name:"css",cwd:J})?"css":bJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!xJ)xJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=G.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function zQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-c4rpdtvw.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=G.isAbsolute($.css)?$.css:G.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=G.isAbsolute($.css.config)?$.css.config:G.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await gJ(J)}function GQ(J){try{let Q=new WeakSet;return k(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function YQ(J){if(M)return _;M=!0;try{let Q=await CJ();if(!Q||!Q.build)return M=!1,"";if(!D)D=await gJ(J);if(!D)return M=!1,"";let Z=Q.defaultConfig?.theme||{},$=D.theme||{},U={...Q.defaultConfig,...D,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),j=await Q.build(U),V=performance.now()-F;if(_=j.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${j.classes.size} classes in ${V.toFixed(1)}ms`),U.output){let W=G.isAbsolute(U.output)?U.output:G.join(J,U.output),X=G.dirname(W);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(W,j.css)}return M=!1,j.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),M=!1,_}}async function aQ(J){D=null,await YQ(J)}function sQ(){return _}function wQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let j of $[1].split(/\s+/))if(j.trim())Q.add(j.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let j=F[1].match(/'([^']+)'/g);if(j){for(let V of j)for(let W of V.slice(1,-1).split(/\s+/))if(W.trim())Q.add(W.trim())}F=U.exec(J)}return Q}var QJ=TJ(64);async function LQ(J,Q){let Z=()=>b.get(Q?G.resolve(Q):process.cwd())?.fingerprint??null,$=QJ.get(t(J,Q,Z()));if($!==void 0)return $;let U=await BQ(J,Q);if(U)QJ.set(t(J,Q,Z()),U);return U}async function BQ(J,Q){try{let Z=await CJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):wQ(J);if($.size===0)return"";let U=Q?G.resolve(Q):process.cwd(),F=SJ(U,"cache");if(!T)T=F;let j=b.get(U);if(!j){let L=await zQ(U);j={config:L,fingerprint:GQ(L)},b.set(U,j),fJ=j.fingerprint}let V=[...$].sort().join(" "),W=`${j.fingerprint||"default"}::${V}`,X=I.get(W);if(X!==void 0)return e(W,X),X;let q=await FQ(W,F);if(q!==null)return e(W,q),q;let z=Z.defaultConfig||Z.config,w=j.config||{},O=YJ(z,w),{safelist:K,includePreflight:$J,minify:ZJ,tokenCSS:uJ}=O,x=O.config,E=new Z.CSSGenerator(x),S=x.shortcuts||w.shortcuts||{},UJ=Object.keys(S).filter((L)=>$.has(L)||K.includes(L));for(let L of K)if(!S[L])E.generate(L);for(let L of $)if(!S[L])E.generate(L);let P="";if(UJ.length>0){let L=new Z.CSSGenerator(x);for(let dJ of UJ)L.generate(dJ);if(P=L.toCSS(!1,ZJ),P&&!P.endsWith(`
21
+ `),U.set(X,q)}return q(...V)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:j,context:Q.slice()});return j}clear(){this.pool.length=0,this.fnCache.clear()}}var xQ=new AJ;class _J{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(J){this.enabled=J}isEnabled(){return this.enabled}setBudget(J,Q){this.budgets.set(J,{warnThreshold:0.8,action:"warn",...Q})}setBudgets(J){for(let[Q,Z]of Object.entries(J))this.setBudget(Q,Z)}removeBudget(J){this.budgets.delete(J)}getBudgets(){let J={};for(let[Q,Z]of this.budgets.entries())J[Q]=Z;return J}onViolation(J){this.violationHandlers.push(J)}offViolation(J){let Q=this.violationHandlers.indexOf(J);if(Q!==-1)this.violationHandlers.splice(Q,1)}time(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}async timeAsync(J,Q){if(!this.enabled)return Q();let Z=performance.now(),$=await Q(),U=performance.now()-Z;return this.recordTime(J,U),this.checkBudget(J,U),$}checkBudget(J,Q){let Z=this.budgets.get(J);if(!Z)return;let $=Q/Z.maxTime*100,U=Z.warnThreshold!==void 0?Q>=Z.maxTime*Z.warnThreshold&&Q<Z.maxTime:!1,F=Q>=Z.maxTime;if(!U&&!F)return;let j={label:J,actualTime:Q,budgetTime:Z.maxTime,exceedancePercent:$,timestamp:new Date,isWarning:U};this.violations.push(j);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(j)}catch{}let V=U?`[Performance Warning] "${J}" took ${Q.toFixed(2)}ms (${$.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${J}" took ${Q.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${($-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(V);break;case"warn":console.warn(V);break;case"error":console.error(V);break;case"throw":if(F)throw Error(V);else console.warn(V);break}}recordTime(J,Q){let Z=this.metrics.get(J);if(Z)Z.count++,Z.totalTime+=Q,Z.maxTime=Math.max(Z.maxTime,Q),Z.minTime=Math.min(Z.minTime,Q);else this.metrics.set(J,{count:1,totalTime:Q,maxTime:Q,minTime:Q})}getStats(J){if(J){let Z=this.metrics.get(J);if(!Z)return{};let $=this.budgets.get(J);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:$?.maxTime,budgetUtilization:$?Z.totalTime/Z.count/$.maxTime*100:void 0}}let Q={};for(let[Z,$]of this.metrics.entries()){let U=this.budgets.get(Z);Q[Z]={count:$.count,avgTime:$.totalTime/$.count,totalTime:$.totalTime,maxTime:$.maxTime,minTime:$.minTime,budget:U?.maxTime,budgetUtilization:U?$.totalTime/$.count/U.maxTime*100:void 0}}return Q}getViolations(J){if(J)return this.violations.filter((Q)=>Q.label===J);return[...this.violations]}getViolationStats(){let J={},Q=0,Z=0;for(let $ of this.violations)if(J[$.label]=(J[$.label]||0)+1,$.isWarning)Q++;else Z++;return{total:this.violations.length,byLabel:J,warnings:Q,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}var a=null;function ZQ(){if(!a)a=new _J;return a}var EQ=new Proxy({},{get(J,Q){return ZQ()[Q]}});var RJ=[];function TJ(J){let Q=new s(J);return RJ.push(Q),Q}function CQ(){for(let J of RJ)J.clear()}function t(J,...Q){return`${Q.map((Z)=>String(Z??"")).join("\x00")}\x00${J.length}\x00${Bun.hash(J)}`}function gQ(J){let Q=[];for(let Z of new Set(J))try{Q.push({path:Z,mtimeMs:vJ.statSync(Z).mtimeMs})}catch{}return Q}function uQ(J){for(let Q of J)try{if(vJ.statSync(Q.path).mtimeMs!==Q.mtimeMs)return!1}catch{return!1}return!0}var B=null,JJ=!1,D=null,_="",M=!1,yJ=256,I=new Map,H=new Map,T=null,fJ=null,b=new Map;function k(J){return Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)}function e(J,Q){if(I.has(J))I.delete(J);else if(I.size>=yJ)I.delete(I.keys().next().value);I.set(J,Q)}function UQ(J){let Q=k(J);if(H.has(Q))H.delete(Q);else if(H.size>=yJ)H.delete(H.keys().next().value);return H.set(Q,J),Q}function lQ(J){let Q=H.get(J);if(Q===void 0)return;return H.delete(J),H.set(J,Q),Q}async function FQ(J,Q=T){if(!Q)return null;try{let Z=Bun.file(G.join(Q,`cw-${k(J)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function jQ(J,Q,Z=T){if(!Z)return;try{if(!fs.existsSync(Z))fs.mkdirSync(Z,{recursive:!0});await Bun.write(G.join(Z,`cw-${k(J)}.css`),Q)}catch{}}async function kJ(J){try{let Q=await import(J);if(Q&&Q.CSSGenerator)return{CSSGenerator:Q.CSSGenerator,config:Q.config,build:Q.build,defaultConfig:Q.defaultConfig,extractClasses:Q.extractClasses}}catch{}return null}var WQ=[["@stacksjs","ts-css","dist","engine","index.js"],["@stacksjs","ts-css","src","engine","index.ts"]],XQ=["@stacksjs/ts-css/engine","@stacksjs/ts-css/dist/engine/index.js"];function VQ(){let J=[],Q=process.cwd();while(Q!==G.dirname(Q)){for(let Z of["node_modules","pantry"])for(let $ of WQ)J.push(G.join(Q,Z,...$));Q=G.dirname(Q)}return J}function qQ(){let J=[],Q=process.env.HOME||process.env.USERPROFILE||"",Z=[Q&&G.join(Q,"Code","Tools","ts-css"),Q&&G.join(Q,"Code","Tools","crosswind"),Q&&G.join(Q,"repos","stacks-org","ts-css"),Q&&G.join(Q,"repos","stacks-org","crosswind"),G.join(process.cwd(),"..","ts-css"),G.join(process.cwd(),"..","crosswind")].filter(Boolean);for(let $ of Z)J.push(G.join($,"packages","toolkit","dist","engine","index.js")),J.push(G.join($,"packages","toolkit","src","engine","index.ts"));if(Q)J.push(G.join(Q,"Code","Tools","stx","node_modules","@stacksjs","ts-css","dist","engine","index.js"));return J}async function CJ(){if(JJ)return B;JJ=!0;try{let J=async(U)=>{for(let F of U){if(!await Bun.file(F).exists())continue;let j=await kJ(F);if(j){if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded from ${G.dirname(G.dirname(F))}`);return j}}return null};if(process.env.CROSSWIND_SRC){let U=G.resolve(process.env.CROSSWIND_SRC),F=await J([U]);if(!F)throw Error(`CROSSWIND_SRC did not resolve to a Css module: ${U}`);return B=F,B}let Q=await J(VQ());if(Q)return B=Q,B;let Z=XQ;for(let U of Z){let F=await kJ(U);if(F){if(B=F,!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} CSS engine loaded`);return B}}let $=await J(qQ());if($)return B=$,B;throw Error("Css CSSGenerator not found in any location")}catch{return console.warn(`${Y.yellow}[ts-css] CSS engine not available, Tailwind styles will not be generated${Y.reset}`),console.warn(`${Y.yellow}Run 'bun add @stacksjs/ts-css' to enable CSS generation${Y.reset}`),null}}function oQ(){QJ.clear(),B=null,JJ=!1,D=null,_="",I.clear(),H.clear(),fJ=null,b.clear()}var xJ=!1;async function gJ(J){try{let Q=bJ({name:"css",cwd:J})?"css":bJ({name:"crosswind",cwd:J})?"crosswind":null;if(!Q)return null;if(Q==="crosswind"&&!process.env.STACKS_DEV_QUIET&&!xJ)xJ=!0,console.warn(`${Y.yellow}[ts-css]${Y.reset} Reading the CSS config from a \`crosswind\` file. Rename it to \`css\` (e.g. config/css.ts) \u2014 the old name is deprecated.`);let{loadConfigWithResult:Z}=await import("bunfig"),$=await Z({name:Q,cwd:J,defaultConfig:{},checkEnv:!1,verbose:!1});if(!$?.path||!$.config||Object.keys($.config).length===0)return null;let U=G.relative(J,$.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from ${U||$.path}`);return $.config}catch(Q){if(Q instanceof Error&&Q.name==="ConfigNotFoundError")return null;return console.warn(`${Y.yellow}[ts-css]${Y.reset} Failed to load css config:`,Q instanceof Error?Q.message:Q),null}}async function zQ(J){let Q=null;try{let{loadStxConfig:Z}=await import("./chunk-nabannen.js"),$=await Z(J);if($.css)if(typeof $.css==="string"){let U=G.isAbsolute($.css)?$.css:G.resolve(J,$.css);if(await Bun.file(U).exists()){let F=await import(U);Q=F.default||F,console.log(`${Y.green}[ts-css]${Y.reset} Loaded config from stx.config.ts \u2192 ${$.css}`)}}else{if(Q={...$.css,content:$.css.content||[],preflight:$.css.preflight??!0,minify:$.css.minify??!1},$.css.config){let U=G.isAbsolute($.css.config)?$.css.config:G.resolve(J,$.css.config);if(await Bun.file(U).exists()){let F=await import(U);Q={...F.default||F,...Q}}}console.log(`${Y.green}[ts-css]${Y.reset} Using inline CSS config from stx.config.ts`)}}catch{}return Q||await gJ(J)}function GQ(J){try{let Q=new WeakSet;return k(JSON.stringify(J??{},(Z,$)=>{if(typeof $==="function")return`[fn]${String($)}`;if(typeof $==="object"&&$!==null){if(Q.has($))return"[circular]";Q.add($)}return $})??"")}catch{return"unhashable"}}async function YQ(J){if(M)return _;M=!0;try{let Q=await CJ();if(!Q||!Q.build)return M=!1,"";if(!D)D=await gJ(J);if(!D)return M=!1,"";let Z=Q.defaultConfig?.theme||{},$=D.theme||{},U={...Q.defaultConfig,...D,theme:{...Z,...$,extend:{...Z.extend||{},...$.extend||{}}}},F=performance.now(),j=await Q.build(U),V=performance.now()-F;if(_=j.css,console.log(`${Y.cyan}[ts-css]${Y.reset} Built ${j.classes.size} classes in ${V.toFixed(1)}ms`),U.output){let W=G.isAbsolute(U.output)?U.output:G.join(J,U.output),X=G.dirname(W);if(!fs.existsSync(X))fs.mkdirSync(X,{recursive:!0});await Bun.write(W,j.css)}return M=!1,j.css}catch(Q){return console.error(`${Y.red}[ts-css]${Y.reset} Build error:`,Q),M=!1,_}}async function aQ(J){D=null,await YQ(J)}function sQ(){return _}function wQ(J){let Q=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,$=Z.exec(J);while($!==null){for(let j of $[1].split(/\s+/))if(j.trim())Q.add(j.trim());$=Z.exec(J)}let U=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,F=U.exec(J);while(F!==null){let j=F[1].match(/'([^']+)'/g);if(j){for(let V of j)for(let W of V.slice(1,-1).split(/\s+/))if(W.trim())Q.add(W.trim())}F=U.exec(J)}return Q}var QJ=TJ(64);async function LQ(J,Q){let Z=()=>b.get(Q?G.resolve(Q):process.cwd())?.fingerprint??null,$=QJ.get(t(J,Q,Z()));if($!==void 0)return $;let U=await BQ(J,Q);if(U)QJ.set(t(J,Q,Z()),U);return U}async function BQ(J,Q){try{let Z=await CJ();if(!Z)return"";let $=typeof Z.extractClasses==="function"?Z.extractClasses(J):wQ(J);if($.size===0)return"";let U=Q?G.resolve(Q):process.cwd(),F=SJ(U,"cache");if(!T)T=F;let j=b.get(U);if(!j){let L=await zQ(U);j={config:L,fingerprint:GQ(L)},b.set(U,j),fJ=j.fingerprint}let V=[...$].sort().join(" "),W=`${j.fingerprint||"default"}::${V}`,X=I.get(W);if(X!==void 0)return e(W,X),X;let q=await FQ(W,F);if(q!==null)return e(W,q),q;let z=Z.defaultConfig||Z.config,w=j.config||{},O=YJ(z,w),{safelist:K,includePreflight:$J,minify:ZJ,tokenCSS:uJ}=O,x=O.config,E=new Z.CSSGenerator(x),S=x.shortcuts||w.shortcuts||{},UJ=Object.keys(S).filter((L)=>$.has(L)||K.includes(L));for(let L of K)if(!S[L])E.generate(L);for(let L of $)if(!S[L])E.generate(L);let P="";if(UJ.length>0){let L=new Z.CSSGenerator(x);for(let dJ of UJ)L.generate(dJ);if(P=L.toCSS(!1,ZJ),P&&!P.endsWith(`
22
22
  `))P+=`
23
23
  `}let A=P+E.toCSS($J,ZJ);return A=uJ+A,e(W,A),jQ(W,A,F),A}catch(Z){return console.warn("Failed to generate Css CSS:",Z),""}}async function tQ(J,Q,Z=!1,$=!1){let U=await LQ(J,Q);if(!U)return $?o(J):J;let F=Z?`<link data-css="generated" rel="stylesheet" href="/_stx/css.${UQ(U)}.css">`:`<style data-css="generated">
24
24
  ${U}
@@ -29,4 +29,4 @@ ${F}`);return F+J}function HQ(J,Q){let Z=l(J).map((W)=>({...W,replacement:""})),
29
29
  ${Q}`});else Z.push({start:0,end:0,replacement:Q})}}Z.sort((W,X)=>W.start-X.start||W.end-X.end);for(let W=1;W<Z.length;W++)if(Z[W].start<Z[W-1].end)return OQ(o(J),Q);let F=Array(Z.length*2+1),j=0,V=0;for(let W of Z)F[V++]=J.slice(j,W.start),F[V++]=W.replacement,j=W.end;return F[V]=J.slice(j),F.join("")}function OQ(J,Q){let Z=/(?:<style\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-css=(?:"generated"|'generated')[^>]*>)/g;if(Z.test(J)){let $=!1;return J.replace(Z,()=>{if($)return"";return $=!0,Q})}if(J.includes("</head>"))return J.replace("</head>",`${Q}
30
30
  </head>`);if(J.includes("<body"))return J.replace(/<body([^>]*)>/,`<body$1>
31
31
  ${Q}`);return Q+J}
32
- export{s as Gs,kQ as Hs,EQ as Is,TJ as Js,CQ as Ks,t as Ls,gQ as Ms,uQ as Ns,h as Os,LJ as Ps,pJ as Qs,mJ as Rs,NQ as Ss,HJ as Ts,i as Us,MQ as Vs,rJ as Ws,C as Xs,YJ as Ys,l as Zs,o as _s,RQ as $s,Y as at,lQ as bt,CJ as ct,oQ as dt,gJ as et,zQ as ft,GQ as gt,YQ as ht,aQ as it,sQ as jt,wQ as kt,LQ as lt,tQ as mt};
32
+ export{s as Hs,kQ as Is,EQ as Js,TJ as Ks,CQ as Ls,t as Ms,gQ as Ns,uQ as Os,h as Ps,LJ as Qs,pJ as Rs,mJ as Ss,NQ as Ts,HJ as Us,i as Vs,MQ as Ws,rJ as Xs,C as Ys,YJ as Zs,l as _s,o as $s,RQ as at,Y as bt,lQ as ct,CJ as dt,oQ as et,gJ as ft,zQ as gt,GQ as ht,YQ as it,aQ as jt,sQ as kt,wQ as lt,LQ as mt,tQ as nt};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{du as _,eu as H,fu as A,gu as X,hu as U,iu as K,ju as S,ku as C,pu as T}from"./chunk-qbz6yn8c.js";import{Hu as I,Xu as L}from"./chunk-czj6nq0b.js";var h=/(?<![\w$@])@meta\s*\(/g,u=/(?<![\w$@])@metaTag\s*\(/g,f=/(?<![\w$@])@structuredData\s*\(/g,p=/(?<![\w$@])@seo\s*\(/g;function b(z,J){return(Q)=>K(z,Q,"the call has no closing parenthesis",J,I.INVALID_DIRECTIVE_SYNTAX)}function g(z){return"property"in z?`<meta property="${B(z.property)}" content="${B(z.content)}">`:`<meta name="${B(z.name)}" content="${B(z.content)}">`}function Qz(z,J,Q,N){if(!z.includes("@meta"))return z;let W=_(z,h,(Z,G)=>{let $=C(H(Z),J);if($.kind==="tag")return g($.tag);if($.kind==="empty")return"";return K("Meta",G,$.message,Q,$.code)},b("Meta",Q));return W=_(W,u,(Z,G)=>{let $=A(Z,J);if(!$.ok)return K("MetaTag",G,$.message,Q,$.code);if($.value===void 0||$.value===null)return"";if(!U($.value))return K("MetaTag",G,`expected an object such as { name, content }, got ${X($.value)}`,Q,I.TYPE_ERROR);let q=$.value;if(!q.name&&!q.property&&!q.httpEquiv)return K("MetaTag",G,"the tag needs a name, property or httpEquiv",Q,I.INVALID_DIRECTIVE_SYNTAX);if(q.content===void 0||q.content===null||q.content===""||q.content===!1)return"";let j="<meta";if(q.name)j+=` name="${B(q.name)}"`;if(q.property)j+=` property="${B(q.property)}"`;if(q.httpEquiv)j+=` http-equiv="${B(q.httpEquiv)}"`;return j+=` content="${B(q.content)}">`,j},b("MetaTag",Q)),W}function v(z){let J=(Q)=>Q["@context"]?{...Q}:{...Q,"@context":"https://schema.org"};if(U(z))return J(z);if(Array.isArray(z)&&z.length>0&&z.every(U))return z.map(J);return null}function E(z){return`<script type="application/ld+json">${JSON.stringify(z).replace(/<\//g,"<\\/")}</script>`}function Wz(z,J,Q){if(!z.includes("@structuredData"))return z;return _(z,f,(N,W)=>{let Z=A(N,J);if(!Z.ok)return K("StructuredData",W,Z.message,Q,Z.code);if(Z.value===void 0||Z.value===null)return"";let G=v(Z.value);if(!G)return K("StructuredData",W,`expected an object or an array of objects, got ${X(Z.value)}`,Q,I.TYPE_ERROR);try{return E(G)}catch($){let q=$ instanceof Error?$.message:String($);return K("StructuredData",W,`the data cannot be written as JSON: ${q}`,Q,I.EVALUATION_ERROR)}},b("StructuredData",Q))}var m=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),D={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Zz(z,J,Q,N){if(!z.includes("@seo"))return z;return _(z,p,(W,Z)=>{if(!W.trim())return K("SEO",Z,"expected an object: @seo({ title, description }) or @seo(seoVariable)",Q,I.INVALID_DIRECTIVE_SYNTAX);let G=A(W,J);if(!G.ok)return K("SEO",Z,G.message,Q,G.code);if(G.value===void 0||G.value===null)return"";if(!U(G.value))return K("SEO",Z,`expected an object such as { title, description }, got ${X(G.value)}`,Q,I.TYPE_ERROR);try{return c(G.value,Z,Q)}catch($){let q=$ instanceof Error?$.message:String($);return K("SEO",Z,`Error processing @seo directive: ${q}`,Q,I.EVALUATION_ERROR)}},b("SEO",Q))}function y(z,J,Q,N){let W=z[J];if(W===void 0||W===null||W===!1)return;if(U(W))return W;S(Q,`${J} must be an object, got ${X(W)}; its tags were left out`,N);return}function c(z,J,Q){let N=Object.keys(z).filter(($)=>!m.has($));if(N.length>0){let $=N.map((q)=>D[q]?`${q} (use ${D[q]})`:q).join(", ");S(J,`@seo does not read ${$}; ${N.length===1?"it was":"they were"} ignored`,Q)}let W="";if(z.title)W+=`<title>${B(z.title)}</title>
2
+ import{eu as _,fu as H,gu as A,hu as X,iu as U,ju as K,ku as S,lu as C,qu as T}from"./chunk-vgx5077x.js";import{Iu as I,Yu as L}from"./chunk-met6wtbk.js";var h=/(?<![\w$@])@meta\s*\(/g,u=/(?<![\w$@])@metaTag\s*\(/g,f=/(?<![\w$@])@structuredData\s*\(/g,p=/(?<![\w$@])@seo\s*\(/g;function b(z,J){return(Q)=>K(z,Q,"the call has no closing parenthesis",J,I.INVALID_DIRECTIVE_SYNTAX)}function g(z){return"property"in z?`<meta property="${B(z.property)}" content="${B(z.content)}">`:`<meta name="${B(z.name)}" content="${B(z.content)}">`}function Qz(z,J,Q,N){if(!z.includes("@meta"))return z;let W=_(z,h,(Z,G)=>{let $=C(H(Z),J);if($.kind==="tag")return g($.tag);if($.kind==="empty")return"";return K("Meta",G,$.message,Q,$.code)},b("Meta",Q));return W=_(W,u,(Z,G)=>{let $=A(Z,J);if(!$.ok)return K("MetaTag",G,$.message,Q,$.code);if($.value===void 0||$.value===null)return"";if(!U($.value))return K("MetaTag",G,`expected an object such as { name, content }, got ${X($.value)}`,Q,I.TYPE_ERROR);let q=$.value;if(!q.name&&!q.property&&!q.httpEquiv)return K("MetaTag",G,"the tag needs a name, property or httpEquiv",Q,I.INVALID_DIRECTIVE_SYNTAX);if(q.content===void 0||q.content===null||q.content===""||q.content===!1)return"";let j="<meta";if(q.name)j+=` name="${B(q.name)}"`;if(q.property)j+=` property="${B(q.property)}"`;if(q.httpEquiv)j+=` http-equiv="${B(q.httpEquiv)}"`;return j+=` content="${B(q.content)}">`,j},b("MetaTag",Q)),W}function v(z){let J=(Q)=>Q["@context"]?{...Q}:{...Q,"@context":"https://schema.org"};if(U(z))return J(z);if(Array.isArray(z)&&z.length>0&&z.every(U))return z.map(J);return null}function E(z){return`<script type="application/ld+json">${JSON.stringify(z).replace(/<\//g,"<\\/")}</script>`}function Wz(z,J,Q){if(!z.includes("@structuredData"))return z;return _(z,f,(N,W)=>{let Z=A(N,J);if(!Z.ok)return K("StructuredData",W,Z.message,Q,Z.code);if(Z.value===void 0||Z.value===null)return"";let G=v(Z.value);if(!G)return K("StructuredData",W,`expected an object or an array of objects, got ${X(Z.value)}`,Q,I.TYPE_ERROR);try{return E(G)}catch($){let q=$ instanceof Error?$.message:String($);return K("StructuredData",W,`the data cannot be written as JSON: ${q}`,Q,I.EVALUATION_ERROR)}},b("StructuredData",Q))}var m=new Set(["title","description","keywords","robots","canonical","openGraph","twitter","structuredData"]),D={image:"openGraph.image",url:"canonical or openGraph.url",type:"openGraph.type",siteName:"openGraph.siteName",locale:"openGraph.locale",og:"openGraph",author:"@meta('author', ...)"};function Zz(z,J,Q,N){if(!z.includes("@seo"))return z;return _(z,p,(W,Z)=>{if(!W.trim())return K("SEO",Z,"expected an object: @seo({ title, description }) or @seo(seoVariable)",Q,I.INVALID_DIRECTIVE_SYNTAX);let G=A(W,J);if(!G.ok)return K("SEO",Z,G.message,Q,G.code);if(G.value===void 0||G.value===null)return"";if(!U(G.value))return K("SEO",Z,`expected an object such as { title, description }, got ${X(G.value)}`,Q,I.TYPE_ERROR);try{return c(G.value,Z,Q)}catch($){let q=$ instanceof Error?$.message:String($);return K("SEO",Z,`Error processing @seo directive: ${q}`,Q,I.EVALUATION_ERROR)}},b("SEO",Q))}function y(z,J,Q,N){let W=z[J];if(W===void 0||W===null||W===!1)return;if(U(W))return W;S(Q,`${J} must be an object, got ${X(W)}; its tags were left out`,N);return}function c(z,J,Q){let N=Object.keys(z).filter(($)=>!m.has($));if(N.length>0){let $=N.map((q)=>D[q]?`${q} (use ${D[q]})`:q).join(", ");S(J,`@seo does not read ${$}; ${N.length===1?"it was":"they were"} ignored`,Q)}let W="";if(z.title)W+=`<title>${B(z.title)}</title>
3
3
  `,W+=`<meta name="title" content="${B(z.title)}">
4
4
  `;if(z.description)W+=`<meta name="description" content="${B(z.description)}">
5
5
  `;if(z.keywords){let $=Array.isArray(z.keywords)?z.keywords.join(", "):z.keywords;W+=`<meta name="keywords" content="${B($)}">
@@ -61,4 +61,4 @@ ${z.map((Z)=>{let G=Z.startsWith("http")?Z:`${Q}${Z.startsWith("/")?"":"/"}${Z}`
61
61
  `)}
62
62
  </sitemapindex>`}async function Nz(z,J){let{extensions:Q=[".stx",".html",".htm"],ignore:N=["_*",".*","node_modules","components","partials","layouts"]}=J,W=[],Z=Q.length===1?`*${Q[0]}`:`*{${Q.join(",")}}`,G=new Bun.Glob(`**/${Z}`);for await(let $ of G.scan(z)){if(N.some((V)=>{if(V.startsWith("*"))return $.includes(V.slice(1));return $.startsWith(V)||$.includes(`/${V}`)}))continue;let j=$.replace(/\\/g,"/").replace(/index\.(stx|html|htm)$/,"").replace(/\.(stx|html|htm)$/,"");if(!j.startsWith("/"))j=`/${j}`;if(j!=="/"&&j.endsWith("/"))j=j.slice(0,-1);let Y=`${z}/${$}`,O;try{let V=await Bun.file(Y).stat();if(V)O=new Date(V.mtime).toISOString().split("T")[0]}catch{}W.push({loc:j||"/",lastmod:O,priority:j==="/"?1:0.5})}return W.sort(($,q)=>$.loc.localeCompare(q.loc)),W}function a(z){let J=[];for(let Q of z.rules){if(J.push(`User-agent: ${Q.userAgent}`),Q.allow)for(let N of Q.allow)J.push(`Allow: ${N}`);if(Q.disallow)for(let N of Q.disallow)J.push(`Disallow: ${N}`);if(Q.crawlDelay!==void 0)J.push(`Crawl-delay: ${Q.crawlDelay}`);J.push("")}if(z.sitemap){let Q=Array.isArray(z.sitemap)?z.sitemap:[z.sitemap];for(let N of Q)J.push(`Sitemap: ${N}`)}if(z.host)J.push(`Host: ${z.host}`);return J.join(`
63
63
  `).trim()}function jz(z){return a({rules:[{userAgent:"*",allow:["/"]}],sitemap:z})}function d(z){return z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}
64
- export{Qz as Ot,Wz as Pt,Zz as Qt,$z as Rt,i as St,l as Tt,Gz as Ut,qz as Vt,Bz as Wt,Nz as Xt,a as Yt,jz as Zt};
64
+ export{Qz as Pt,Wz as Qt,Zz as Rt,$z as St,i as Tt,l as Ut,Gz as Vt,qz as Wt,Bz as Xt,Nz as Yt,a as Zt,jz as _t};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Gk as a,Hk as b,Ik as c,Jk as d,Kk as e}from"./chunk-kaet6r9w.js";import"./chunk-emjmshj8.js";export{d as runPwaAudit,e as formatAuditResult,c as calculateAuditResult,a as auditConfig,b as auditBuildOutput};
2
+ import{Gk as a,Hk as b,Ik as c,Jk as d,Kk as e}from"./chunk-kaet6r9w.js";import"./chunk-m8kem5ca.js";export{d as runPwaAudit,e as formatAuditResult,c as calculateAuditResult,a as auditConfig,b as auditBuildOutput};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Pw as v$,Qw as G}from"./chunk-emjmshj8.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
2
+ import{Qw as v$,Rw as G}from"./chunk-m8kem5ca.js";function y($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((O)=>F.includes(O))}function A($){return y($.replace(/^\//,""))}var F;var C=G(()=>{F=["components","layouts","partials","emails"]});import W from"fs";import E from"path";function H($,U){let O=$.filter((K)=>!A(K.pattern)),I=["// Auto-generated by STX - do not edit"];if(O.length===0)I.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{I.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let K of O){let V=[];for(let X of K.params){let Y=K.pattern.includes(`:${X}?`)?"?":"";V.push(`${X}${Y}: string`)}let J=V.join("; ");I.push(` '${K.pattern}': { ${J} }`)}I.push(" }","}","","export {}","")}let B=I.join(`
3
3
  `),L=E.join(U,"route-types.d.ts");try{if(W.existsSync(L)&&W.readFileSync(L,"utf8")===B)return;W.mkdirSync(U,{recursive:!0}),W.writeFileSync(L,B)}catch{}}function q($,U,O){let I=process.cwd(),B=E.relative(I,O),L=$.filter((V)=>!A(V.pattern)),K=["// Auto-generated by stx \u2014 do not edit",`// Source: ${B||"pages"}/`,"","export const routes = ["];for(let V of L){let J=E.relative(I,V.filePath).replace(/\\/g,"/"),X=JSON.stringify(V.params),Y=V.layout?`, layout: '${E.relative(I,V.layout).replace(/\\/g,"/")}'`:"";K.push(` { pattern: '${V.pattern}', filePath: '${J}', isDynamic: ${V.isDynamic}, params: ${X}${Y} },`)}K.push("] as const",""),K.push("export type RouteName = typeof routes[number]['pattern']",""),W.mkdirSync(U,{recursive:!0}),W.writeFileSync(E.join(U,"routes.ts"),K.join(`
4
4
  `))}var f=G(()=>{C()});import i from"path";function N($,U){let I=i.relative(U,$).replace(/\.(stx|md)$/,"");if(I=I.split(i.sep).join("/"),I==="index")return"/";if(I.endsWith("/index"))I=I.slice(0,-6);return I=I.replace(/\[\[([^\]]+)\]\]/g,":$1?"),I=I.replace(/\[([^\]]+)\]/g,":$1"),I=I.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${I}`}function j($){let U=[],O="",I=0;while(I<$.length){let B=$.slice(I),L=/^\/:([^/?*]+)\?/.exec(B);if(L){U.push(L[1]),O+="(?:/([^/]+))?",I+=L[0].length;continue}let K=/^:([^/?*]+)\*/.exec(B);if(K){U.push(K[1]),O+="(.+)",I+=K[0].length;continue}let V=/^:([^/?*]+)/.exec(B);if(V){U.push(V[1]),O+="([^/]+)",I+=V[0].length;continue}O+=$[I].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),I+=1}return{regex:new RegExp(`^${O}$`),params:U}}function o($,U){let O=$===""?"/":$;for(let I of U){let B=O.match(I.regex);if(B){let L={};return I.params.forEach((K,V)=>{L[K]=B[V+1]}),{route:I,params:L}}}return null}function r($){let U=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return j(U)}var g=()=>{};import b$ from"fs";import d from"path";function R($,U){let O=[],I=d.dirname($);while(I.startsWith(U)||I===U){let B=d.join(I,"_layout.stx");if(b$.existsSync(B))O.unshift(B);if(I===U)break;I=d.dirname(I)}return O}var m=()=>{};import S from"fs";import Q from"path";function t($,U){let O=[];if(!S.existsSync($))return O;let I=S.readdirSync($,{withFileTypes:!0});for(let B of I){let L=Q.join($,B.name);if(B.isDirectory()){if(B.name.startsWith("."))continue;if(F.includes(B.name))continue;O.push(...t(L,U))}else if(B.isFile()){let K=Q.extname(B.name);if(U.includes(K)){if(B.name.startsWith("_")&&B.name!=="_layout.stx")continue;if(B.name==="_layout.stx")continue;O.push(L)}}}return O}class b{routes;pagesDir;pagesDirs;config;constructor($,U={}){this.config=U;let O=U.pagesDirs&&U.pagesDirs.length>0?U.pagesDirs:[U.pagesDir||"pages"];this.pagesDirs=O.map((J)=>Q.resolve($,J)),this.pagesDir=this.pagesDirs[0];let I=U.extensions||[".stx"],B=(J)=>{let X=Q.resolve($,J);try{return S.realpathSync(X)}catch{return X}},L=(U.exclude??[]).filter((J)=>typeof J==="string"&&J.trim()!=="").map(B),K=(J)=>{if(L.length===0)return!1;let X=B(J);return L.some((Y)=>X===Y||X.startsWith(`${Y}${Q.sep}`))},V=new Set;this.routes=[];for(let J of this.pagesDirs){let X=t(J,I).filter((Z)=>!K(Z)),Y=new Map;for(let Z of X){let _=N(Z,J),z=U.pagesDirs?_.replace(/:[\w]+/g,":param"):_;if(U.pagesDirs&&Y.has(z))throw Error(`Conflicting layer pages for ${_}: ${Y.get(z)} and ${Z}`);if(Y.set(z,Z),V.has(z))continue;V.add(z);let{regex:S$,params:s}=j(_),D=U.layouts!==!1?R(Z,J):[];this.routes.push({pattern:_,regex:S$,params:s,filePath:Z,isDynamic:s.length>0,layout:D.length>0?D[D.length-1]:void 0})}}if(this.routes.sort((J,X)=>{if(!J.isDynamic&&X.isDynamic)return-1;if(J.isDynamic&&!X.isDynamic)return 1;let Y=J.pattern.split("/").length,Z=X.pattern.split("/").length;if(Y!==Z)return Z-Y;return J.pattern.localeCompare(X.pattern)}),U.emit!==!1){let J=Q.resolve($,U.stateDir||process.env.STX_DIR?.trim()||".stx");H(this.routes,J),q(this.routes,J,this.pagesDir)}}match($){let U=$===""?"/":$;for(let O of this.routes){let I=U.match(O.regex);if(I){let B={};return O.params.forEach((L,K)=>{B[L]=I[K+1]}),{route:O,params:B}}}return null}resolve($,U){let O=this.routes.find((B)=>B.pattern===$||B.filePath.includes($));if(!O)return"#not-found";let I=O.pattern;if(U)for(let[B,L]of Object.entries(U))I=I.replace(`:${B}`,encodeURIComponent(L));return I}addRoute($){this.routes.push($),this.routes.sort((U,O)=>{if(!U.isDynamic&&O.isDynamic)return-1;if(U.isDynamic&&!O.isDynamic)return 1;return U.pattern.localeCompare(O.pattern)})}getLayout($){return $.layout??null}}function a($,U){return new b($,U)}function e($,U){let O=[`${U}.stx`,"error.stx"];for(let I of O){let B=Q.join($,I);if(S.existsSync(B))return B}return null}function $$($,U){return $.map((O)=>{let I=Q.relative(U,O.filePath),B=O.isDynamic?" (dynamic)":"";return`${O.pattern} \u2192 ${I}${B}`})}var U$=G(()=>{f();g();m();C()});function I$($){x=$.replace(/\/$/,"")}function O$($,U,O={}){M[$]={path:U,name:$,params:O}}function B$($){for(let[U,O]of Object.entries($))if(typeof O==="string")M[U]={path:O,name:U};else M[U]={...O,name:U}}function J$($,U={},O=!1){let I=M[$];if(!I)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let B={...I.params,...U},L=I.path;L=L.replace(/:(\w+)/g,(V,J)=>{let X=B[J];if(X===void 0)return console.warn(`Missing parameter [${J}] for route [${$}].`),`:${J}`;return delete B[J],encodeURIComponent(String(X))});let K=Object.entries(B);if(K.length>0){let V=K.map(([J,X])=>`${encodeURIComponent(J)}=${encodeURIComponent(String(X))}`).join("&");L+=(L.includes("?")?"&":"?")+V}return O&&x?`${x}${L}`:L}function K$(){for(let $ of Object.keys(M))delete M[$];x=""}var M,x="";var L$=G(()=>{M={}});import V$ from"fs";import X$ from"path";function Y$($,U={}){return{type:"redirect",path:$,options:{replace:U.replace??!1,external:U.external??!1,redirectCode:U.redirectCode??302}}}function Z$($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function G$($,U={}){return{handler:$,mode:U.mode??"universal"}}function h($){let U={};if(!$)return U;let O=$.split(";");for(let I of O){let[B,...L]=I.split("=");if(B){let K=B.trim(),V=L.join("=").trim();if(K)U[K]=decodeURIComponent(V)}}return U}function k($,U,O={}){let I=`${encodeURIComponent($)}=${encodeURIComponent(U)}`;if(O.expires){let B=typeof O.expires==="number"?new Date(Date.now()+O.expires*1000):O.expires;I+=`; Expires=${B.toUTCString()}`}if(O.path)I+=`; Path=${O.path}`;if(O.domain)I+=`; Domain=${O.domain}`;if(O.secure)I+="; Secure";if(O.httpOnly)I+="; HttpOnly";if(O.sameSite)I+=`; SameSite=${O.sameSite}`;return I}function c($,U){let O=$.headers.get("cookie")||"",I=h(O);return{get(B){return I[B]},set(B,L,K={}){I[B]=L,U.append("Set-Cookie",k(B,L,K))},delete(B){delete I[B],U.append("Set-Cookie",k(B,"",{expires:new Date(0),path:"/"}))},getAll(){return{...I}}}}function l(){return{get($){if(typeof document>"u")return;return h(document.cookie)[$]},set($,U,O={}){if(typeof document>"u")return;document.cookie=k($,U,O)},delete($){if(typeof document>"u")return;document.cookie=k($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return h(document.cookie)}}}function u(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(U){if(!$)return null;try{return window.localStorage.getItem(U)}catch{return null}},set(U,O){if(!$)return;try{window.localStorage.setItem(U,O)}catch{}},remove(U){if(!$)return;try{window.localStorage.removeItem(U)}catch{}},isAvailable(){return $}}}function v($,U){T.set($,U)}function p($){return T.get($)}function Q$($){return T.has($)}function W$(){T.clear()}function M$(){return Array.from(T.keys())}async function _$($,U="middleware"){let O=X$.resolve($,U);if(!V$.existsSync(O))return;let I=V$.readdirSync(O);for(let B of I){if(!B.endsWith(".ts")&&!B.endsWith(".js"))continue;if(B.includes(".test.")||B.includes(".spec."))continue;let L=B.replace(/\.(ts|js)$/,""),K=X$.join(O,B);try{let J=(await import(K)).default;if(J&&typeof J.handler==="function")v(L,J);else if(typeof J==="function")v(L,{handler:J,mode:"universal"})}catch(V){console.warn(`Failed to load middleware '${L}' from ${K}:`,V)}}}function x$($){let U={};if(!$)return U;let O=new URLSearchParams($);for(let[I,B]of O)U[I]=B;return U}function z$($,U,O,I=""){return{path:$,params:U,query:x$(I),fullPath:I?`${$}?${I}`:$,meta:O}}function F$($,U,O,I){let B=I?.isServer??typeof window>"u",L=!B,K=new Headers;return{to:$,from:U,isClient:L,isServer:B,cookies:B&&O?c(O,K):l(),storage:u(),state:{},request:O,responseHeaders:K}}async function A$($,U){let O=Array.isArray($)?$:[$],I=U.isServer;for(let B of O){let L=p(B);if(!L)return console.error(`Route middleware '${B}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${B}' is not registered`}},state:U.state,responseHeaders:U.responseHeaders};if(L.mode==="server"&&!I)continue;try{let K=await L.handler(U);if(K){if(K.type==="redirect")return{passed:!1,redirect:K,state:U.state,responseHeaders:U.responseHeaders};if(K.type==="abort")return{passed:!1,abort:K,state:U.state,responseHeaders:U.responseHeaders}}}catch(K){return console.error(`Error in middleware '${B}':`,K),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:K instanceof Error?K.message:"Middleware error"}},state:U.state,responseHeaders:U.responseHeaders}}}return{passed:!0,state:U.state,responseHeaders:U.responseHeaders}}var T;var E$=G(()=>{T=new Map});function n($){let O=$.replace(/\\/g,"/").split("/").filter(Boolean),I=O.lastIndexOf("layouts"),B=I>=0?O[I+1]:O.at(-1);if(!B)return"app";return B.replace(/\.stx$/i,"")||"app"}function j$($){let U=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),O=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),I=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),B=U?.[1]||I?.[1]||"";return{layout:B,group:O?.[1]||n(B)}}var T$=()=>{};function k$($){let U=[],O="log(",I=0;while(I<$.length){let B=$.indexOf("log(",I);if(B===-1){U.push($.slice(I));break}let L=B>0?$[B-1]:" ",K=/\bfunction\s+$/.test($.slice(Math.max(0,B-16),B));if(/[\w$.]/.test(L)||K){U.push($.slice(I,B+4)),I=B+4;continue}U.push($.slice(I,B));let V=1,J=B+4;while(J<$.length&&V>0){let X=$[J];if(X==='"'||X==="'"||X==="`"){let Y=X;J++;while(J<$.length&&$[J]!==Y){if($[J]==="\\")J++;J++}J++;continue}if(X==="(")V++;else if(X===")")V--;J++}U.push("0"),I=J}return U.join("")}function C$($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function H$(){return`
5
5
  ;(function(){
@@ -2275,4 +2275,4 @@ else {
2275
2275
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
2276
2276
  })();
2277
2277
  `}function q$(){if(w)return w;return w=C$(k$(H$())),w}function N$(){if(P)return P;return P=C$(H$()),P}var w,P;var R$=()=>{};var w$={};v$(w$,{setAppUrl:()=>I$,runMiddleware:()=>A$,route:()=>J$,resolveLayoutChain:()=>R,resetRoutes:()=>K$,registerMiddleware:()=>v,patternToRegex:()=>j,navigateTo:()=>Y$,matchRoute:()=>o,loadMiddlewareFromDirectory:()=>_$,isNonPageRoutePattern:()=>A,isNonPageRoutePath:()=>y,hasMiddleware:()=>Q$,getRouterScriptDev:()=>N$,getRouterScript:()=>q$,getMiddlewareNames:()=>M$,getMiddleware:()=>p,generateRouteTypes:()=>H,generateRouteManifest:()=>q,formatRoutes:()=>$$,findErrorPage:()=>e,filePathToPattern:()=>N,extractLayoutMetadata:()=>j$,deriveLayoutGroup:()=>n,defineRoutes:()=>B$,defineRoute:()=>O$,defineMiddleware:()=>G$,createStorageManager:()=>u,createServerCookieManager:()=>c,createRouter:()=>a,createRouteLocation:()=>z$,createMiddlewareContext:()=>F$,createClientCookieManager:()=>l,clearMiddleware:()=>W$,bracketPathToRegex:()=>r,abortNavigation:()=>Z$,Router:()=>b,NON_PAGE_DIRS:()=>F});var P$=G(()=>{U$();g();L$();E$();m();T$();f();C();R$()});
2278
- export{F as Vv,y as Wv,A as Xv,H as Yv,q as Zv,N as _v,j as $v,o as aw,r as bw,R as cw,b as dw,a as ew,e as fw,$$ as gw,I$ as hw,O$ as iw,B$ as jw,J$ as kw,K$ as lw,Y$ as mw,Z$ as nw,G$ as ow,c as pw,l as qw,u as rw,v as sw,p as tw,Q$ as uw,W$ as vw,M$ as ww,_$ as xw,z$ as yw,F$ as zw,A$ as Aw,n as Bw,j$ as Cw,T$ as Dw,q$ as Ew,N$ as Fw,w$ as Gw,P$ as Hw};
2278
+ export{F as Wv,y as Xv,A as Yv,H as Zv,q as _v,N as $v,j as aw,o as bw,r as cw,R as dw,b as ew,a as fw,e as gw,$$ as hw,I$ as iw,O$ as jw,B$ as kw,J$ as lw,K$ as mw,Y$ as nw,Z$ as ow,G$ as pw,c as qw,l as rw,u as sw,v as tw,p as uw,Q$ as vw,W$ as ww,M$ as xw,_$ as yw,z$ as zw,F$ as Aw,A$ as Bw,n as Cw,j$ as Dw,T$ as Ew,q$ as Fw,N$ as Gw,w$ as Hw,P$ as Iw};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-emjmshj8.js";import E from"fs";import K from"path";var V=[];function _(U){V=[];for(let A of U.storyFiles)if(V.push({text:A.fileName.toLowerCase(),original:A.fileName,type:"story",storyId:A.id}),V.push({text:A.relativePath.toLowerCase(),original:A.relativePath,type:"story",storyId:A.id}),A.story)for(let z of A.story.variants)V.push({text:z.title.toLowerCase(),original:z.title,type:"story",storyId:A.id,variantId:z.id})}function $(){return JSON.stringify(V)}async function O(U={}){let A=Date.now();N();let z=await k({mode:"build"});if(!z.config.enabled){W("Story feature is disabled in config.");return}let P=await H(z);w(z,P);let Y=J(z.config,P);B(z,Y),R(P.length);let X=U.outDir??z.config.outDir,Q=K.resolve(z.root,X);await E.promises.mkdir(Q,{recursive:!0}),console.log(` Building to ${X}...`);let M=F(z);await E.promises.writeFile(K.join(Q,"index.html"),M);let v={files:P.map((G)=>({id:G.id,fileName:G.fileName,relativePath:G.relativePath,treePath:G.treePath})),tree:Y};await E.promises.writeFile(K.join(Q,"stories.json"),JSON.stringify(v,null,2));let L={theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets};await E.promises.writeFile(K.join(Q,"config.json"),JSON.stringify(L,null,2));let Z=K.join(Q,"stories");await E.promises.mkdir(Z,{recursive:!0});for(let G of P){let g=await E.promises.readFile(G.path,"utf-8");await E.promises.writeFile(K.join(Z,`${G.id}.stx`),g)}_(z);let T=$();await E.promises.writeFile(K.join(Q,"search-index.json"),T);let C=Date.now()-A;j(P.length,X,C)}function F(U){let{theme:A}=U.config,z=A.title||"STX Story";return`<!DOCTYPE html>
2
+ import{a as N,c as R,e as W,g as j,i as H,k as J}from"./chunk-0y46fbkx.js";import{l as k,m as w,n as B}from"./chunk-q9n5swx7.js";import"./chunk-m8kem5ca.js";import E from"fs";import K from"path";var V=[];function _(U){V=[];for(let A of U.storyFiles)if(V.push({text:A.fileName.toLowerCase(),original:A.fileName,type:"story",storyId:A.id}),V.push({text:A.relativePath.toLowerCase(),original:A.relativePath,type:"story",storyId:A.id}),A.story)for(let z of A.story.variants)V.push({text:z.title.toLowerCase(),original:z.title,type:"story",storyId:A.id,variantId:z.id})}function $(){return JSON.stringify(V)}async function O(U={}){let A=Date.now();N();let z=await k({mode:"build"});if(!z.config.enabled){W("Story feature is disabled in config.");return}let P=await H(z);w(z,P);let Y=J(z.config,P);B(z,Y),R(P.length);let X=U.outDir??z.config.outDir,Q=K.resolve(z.root,X);await E.promises.mkdir(Q,{recursive:!0}),console.log(` Building to ${X}...`);let M=F(z);await E.promises.writeFile(K.join(Q,"index.html"),M);let v={files:P.map((G)=>({id:G.id,fileName:G.fileName,relativePath:G.relativePath,treePath:G.treePath})),tree:Y};await E.promises.writeFile(K.join(Q,"stories.json"),JSON.stringify(v,null,2));let L={theme:z.config.theme,responsivePresets:z.config.responsivePresets,backgroundPresets:z.config.backgroundPresets};await E.promises.writeFile(K.join(Q,"config.json"),JSON.stringify(L,null,2));let Z=K.join(Q,"stories");await E.promises.mkdir(Z,{recursive:!0});for(let G of P){let g=await E.promises.readFile(G.path,"utf-8");await E.promises.writeFile(K.join(Z,`${G.id}.stx`),g)}_(z);let T=$();await E.promises.writeFile(K.join(Q,"search-index.json"),T);let C=Date.now()-A;j(P.length,X,C)}function F(U){let{theme:A}=U.config,z=A.title||"STX Story";return`<!DOCTYPE html>
3
3
  <html lang="en">
4
4
  <head>
5
5
  <meta charset="UTF-8">
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ns as a,os as b}from"./chunk-2xpdcr8c.js";import"./chunk-m8kem5ca.js";export{b as resolveStxTargets,a as looksLikeGlob};
@@ -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}from"./chunk-2119txb8.js";import"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import"./chunk-v90kxg77.js";import"./chunk-4arms0am.js";import"./chunk-135mme4g.js";import"./chunk-dj24n5n7.js";import"./chunk-w1asc0zd.js";import"./chunk-kd95t585.js";import"./chunk-1tz8fb87.js";import"./chunk-xk402w4a.js";import"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-ta6z7k4p.js";import"./chunk-zxptxz2b.js";import"./chunk-7racewc5.js";import"./chunk-e03m4har.js";import"./chunk-vsqx756d.js";import"./chunk-m8kem5ca.js";export{b as stripTypeScript,i as splitDeclaration,d as isSyntaxFailure,c as isModuleResolutionFailure,e as isMissingBindingFailure,g as isCompleteImport,k as hasVariables,f as extractVariables,j as extractScriptFromTemplate,h as convertToCommonJS,a as STX_ENGINE_BINDING_NAMES};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{$j as d,Yj as a,Zj as b,_j as c}from"./chunk-x21hdhjw.js";import"./chunk-emjmshj8.js";export{d as default,c as createHotReloadServer,b as compileToNative,a as NATIVE_COMPONENTS};
2
+ import{$j as d,Yj as a,Zj as b,_j as c}from"./chunk-x21hdhjw.js";import"./chunk-m8kem5ca.js";export{d as default,c as createHotReloadServer,b as compileToNative,a as NATIVE_COMPONENTS};
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ import{ei as a}from"./chunk-g1vxsvqv.js";import"./chunk-m8kem5ca.js";export{a as rewriteImagesWithSiblings};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ds as Q}from"./chunk-ykevda74.js";import"./chunk-ez003q74.js";import{rt as R}from"./chunk-ejwfnttb.js";import"./chunk-czj6nq0b.js";import"./chunk-emjmshj8.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\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\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"),b.push(" STX Story Visual Regression Tests"),b.push("\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\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"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\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\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"),b.push(""),b.join(`
2
+ import{es as Q}from"./chunk-jc6wrxrh.js";import"./chunk-2xpdcr8c.js";import{st as R}from"./chunk-w1asc0zd.js";import"./chunk-met6wtbk.js";import"./chunk-m8kem5ca.js";import O from"fs";import U from"path";async function W(j,b={}){let q=Date.now(),z={total:0,passed:0,failed:0,new:0,failures:[],duration:0},K=b.snapshotDir||R(j.root,"story","snapshots");await O.promises.mkdir(K,{recursive:!0});let B=j.storyFiles;if(b.filter&&b.filter.length>0)B=B.filter((J)=>b.filter.some((G)=>J.fileName.toLowerCase().includes(G.toLowerCase())));for(let J of B)await X(J,K,b,z);return z.duration=Date.now()-q,z}async function X(j,b,q,z){let K=j.story;if(!K)return;for(let B of K.variants){z.total++;let J=U.join(b,`${j.id}-${B.id}.snap`),G=Y(B.source||""),L=await _(J);if(q.update||!L){let M={storyId:j.id,variantId:B.id,component:j.fileName,timestamp:Date.now(),hash:G};if(await O.promises.writeFile(J,JSON.stringify(M,null,2)),!L)z.new++;z.passed++}else try{let M=await O.promises.readFile(J,"utf-8"),N=JSON.parse(M);if(N.hash===G)z.passed++;else z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:"Snapshot mismatch",difference:Z(N.hash,G)})}catch(M){z.failed++,z.failures.push({storyId:j.id,variantId:B.id,component:j.fileName,message:`Error reading snapshot: ${M}`})}}}async function A(j,b={}){return(await W(j,{...b,update:!0})).total}function Y(j){let b=0;for(let q=0;q<j.length;q++){let z=j.charCodeAt(q);b=(b<<5)-b+z,b=b&b}return b.toString(16)}function Z(j,b){if(j===b)return 0;let q=Math.abs(Number.parseInt(j,16)-Number.parseInt(b,16));return Math.min(q/1e6,1)}async function _(j){try{return await O.promises.access(j),!0}catch{return!1}}function I(j){let b=[];if(b.push(""),b.push("\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\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"),b.push(" STX Story Visual Regression Tests"),b.push("\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\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"),b.push(""),j.failures.length>0){b.push(" \u274C Failures:"),b.push("");for(let q of j.failures){if(b.push(` \u2022 ${q.component} / ${q.variantId}`),b.push(` ${q.message}`),q.difference!==void 0)b.push(` Difference: ${(q.difference*100).toFixed(2)}%`);b.push("")}}if(b.push(" Summary:"),b.push(` Total: ${j.total}`),b.push(` Passed: ${j.passed} \u2713`),b.push(` Failed: ${j.failed} \u2717`),j.new>0)b.push(` New: ${j.new} \u26A1`);return b.push(` Time: ${j.duration}ms`),b.push(""),b.push("\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\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"),b.push(""),b.join(`
3
3
  `)}async function S(j,b={}){let q=performance.now(),z=[],K=0,B=0;for(let G of j.storyFiles)try{let L=await Bun.file(G.path).text(),M=await Q(L,G.path);if(M.length>0){for(let N of M)z.push({storyId:G.id,variantId:"default",component:G.component,message:`A11y: ${N.message}`,expected:"No accessibility violations",actual:`${N.type}: ${N.message} (impact: ${N.impact})`});B++}else K++}catch(L){z.push({storyId:G.id,variantId:"default",component:G.component,message:`Failed to check a11y: ${L instanceof Error?L.message:String(L)}`,expected:"File readable for a11y check",actual:"File read error"}),B++}let J=performance.now()-q;return{total:j.storyFiles.length,passed:K,failed:B,new:0,failures:z,duration:J}}export{A as updateSnapshots,W as runVisualTests,S as runA11yTests,I as formatTestResults};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{ns as i}from"./chunk-ez003q74.js";import{Hu as R,Xu as T,pv as S}from"./chunk-czj6nq0b.js";import{Rw as g}from"./chunk-emjmshj8.js";import k from"path";var O;async function t(){if(O!==void 0)return O;try{O=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{O=null}return O}var y={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},F={},V={},E={};function vq(q){if(q)delete F[q];else for(let X of Object.keys(F))delete F[X]}function fq(){let q=Object.entries(F).map(([X,Q])=>({locale:X,loadedAt:new Date(Q.loadedAt),keyCount:p(Q.translations)}));return{size:Object.keys(F).length,locales:Object.keys(F),entries:q}}function p(q,X=0){for(let Q of Object.values(q))if(X++,Q&&typeof Q==="object"&&!Array.isArray(Q))X=p(Q,X);return X}function e(q,X=0){if(X<=0)return!1;return Date.now()-q.loadedAt>X}function dq(q){if(F[q])return"loaded";return E[q]||"idle"}function gq(q){return E[q]==="loading"}function uq(q){return!!F[q]}async function qq(q,X){let{locales:Q,parallel:H=!0,priority:J={},onLocaleLoaded:Y,onComplete:W,onError:$}=q,Z=H?Q:[...Q].sort((_,z)=>(J[z]||0)-(J[_]||0));if(H){let _=Z.map(async(z)=>{try{await P(z,X),Y?.(z)}catch(G){$?.(z,G instanceof Error?G:Error(String(G)))}});await Promise.all(_)}else for(let _ of Z)try{await P(_,X),Y?.(_)}catch(z){$?.(_,z instanceof Error?z:Error(String(z)))}W?.()}function hq(q,X){queueMicrotask(()=>{qq(q,X).catch((Q)=>{if(X.debug)console.error("Background preload error:",Q)})})}async function P(q,X){if({...y,...X.i18n}.cache&&F[q]){let J=F[q],Y=X.i18n?.cacheMaxAge??0;if(!e(J,Y))return J.translations}if(V[q]?.state==="loading")return V[q].promise;E[q]="loading";let H=b(q,X).then((J)=>{return E[q]="loaded",delete V[q],J}).catch((J)=>{throw E[q]="error",V[q]={promise:H,state:"error",error:J instanceof Error?J:Error(String(J))},J});return V[q]={promise:H,state:"loading"},H}function Hq(q){return F[q]?.translations}async function pq(q,X){let Q=Hq(q);if(Q)return Q;return P(q,X)}async function mq(q,X){if(F[q])return F[q].translations;if(V[q]){if(X)return Promise.race([V[q].promise,new Promise((Q,H)=>setTimeout(()=>H(Error(`Timeout waiting for locale: ${q}`)),X))]);return V[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function cq(){return Object.entries(E).filter(([q,X])=>X==="loading").map(([q])=>q)}function iq(q){if(q)delete V[q],delete E[q];else{for(let X of Object.keys(V))delete V[X];for(let X of Object.keys(E))delete E[X]}}async function b(q,X){let Q={...y,...X.i18n},H=k.isAbsolute(Q.translationsDir)?Q.translationsDir:k.resolve(X.root||process.cwd(),Q.translationsDir);try{let J=await t(),Y=J?await J(q,{translationsDir:H,defaultLocale:Q.defaultLocale,sources:$q(Q.format)}):await Jq(q,Q,H);if(Y===void 0){if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}let W=Y;if(Q.cache)F[q]={translations:W,loadedAt:Date.now(),locale:q};return W}catch(J){if(X.debug)console.error(`Error loading translation file for locale "${q}":`,J);if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}}async function Jq(q,X,Q){let H=k.join(Q,`${q}${Qq(X.format)}`);try{let J=await import(H);return J.default||J}catch(J){try{let Y=await Bun.file(H).text();if(X.format==="yaml"||X.format==="yml")return Xq(Y);if(X.format==="json")return JSON.parse(Y);throw J}catch{return}}}function Qq(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 Xq(q){let X={},Q=q.split(`
2
+ import{os as i}from"./chunk-2xpdcr8c.js";import{Iu as R,Yu as T,qv as S}from"./chunk-met6wtbk.js";import{Sw as g}from"./chunk-m8kem5ca.js";import k from"path";var O;async function t(){if(O!==void 0)return O;try{O=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{O=null}return O}var y={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},F={},V={},E={};function vq(q){if(q)delete F[q];else for(let X of Object.keys(F))delete F[X]}function fq(){let q=Object.entries(F).map(([X,Q])=>({locale:X,loadedAt:new Date(Q.loadedAt),keyCount:p(Q.translations)}));return{size:Object.keys(F).length,locales:Object.keys(F),entries:q}}function p(q,X=0){for(let Q of Object.values(q))if(X++,Q&&typeof Q==="object"&&!Array.isArray(Q))X=p(Q,X);return X}function e(q,X=0){if(X<=0)return!1;return Date.now()-q.loadedAt>X}function dq(q){if(F[q])return"loaded";return E[q]||"idle"}function gq(q){return E[q]==="loading"}function uq(q){return!!F[q]}async function qq(q,X){let{locales:Q,parallel:H=!0,priority:J={},onLocaleLoaded:Y,onComplete:W,onError:$}=q,Z=H?Q:[...Q].sort((_,z)=>(J[z]||0)-(J[_]||0));if(H){let _=Z.map(async(z)=>{try{await P(z,X),Y?.(z)}catch(G){$?.(z,G instanceof Error?G:Error(String(G)))}});await Promise.all(_)}else for(let _ of Z)try{await P(_,X),Y?.(_)}catch(z){$?.(_,z instanceof Error?z:Error(String(z)))}W?.()}function hq(q,X){queueMicrotask(()=>{qq(q,X).catch((Q)=>{if(X.debug)console.error("Background preload error:",Q)})})}async function P(q,X){if({...y,...X.i18n}.cache&&F[q]){let J=F[q],Y=X.i18n?.cacheMaxAge??0;if(!e(J,Y))return J.translations}if(V[q]?.state==="loading")return V[q].promise;E[q]="loading";let H=b(q,X).then((J)=>{return E[q]="loaded",delete V[q],J}).catch((J)=>{throw E[q]="error",V[q]={promise:H,state:"error",error:J instanceof Error?J:Error(String(J))},J});return V[q]={promise:H,state:"loading"},H}function Hq(q){return F[q]?.translations}async function pq(q,X){let Q=Hq(q);if(Q)return Q;return P(q,X)}async function mq(q,X){if(F[q])return F[q].translations;if(V[q]){if(X)return Promise.race([V[q].promise,new Promise((Q,H)=>setTimeout(()=>H(Error(`Timeout waiting for locale: ${q}`)),X))]);return V[q].promise}throw Error(`Locale "${q}" is not loading. Call loadTranslationLazy first.`)}function cq(){return Object.entries(E).filter(([q,X])=>X==="loading").map(([q])=>q)}function iq(q){if(q)delete V[q],delete E[q];else{for(let X of Object.keys(V))delete V[X];for(let X of Object.keys(E))delete E[X]}}async function b(q,X){let Q={...y,...X.i18n},H=k.isAbsolute(Q.translationsDir)?Q.translationsDir:k.resolve(X.root||process.cwd(),Q.translationsDir);try{let J=await t(),Y=J?await J(q,{translationsDir:H,defaultLocale:Q.defaultLocale,sources:$q(Q.format)}):await Jq(q,Q,H);if(Y===void 0){if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}let W=Y;if(Q.cache)F[q]={translations:W,loadedAt:Date.now(),locale:q};return W}catch(J){if(X.debug)console.error(`Error loading translation file for locale "${q}":`,J);if(q!==Q.defaultLocale)return b(Q.defaultLocale,X);return{}}}async function Jq(q,X,Q){let H=k.join(Q,`${q}${Qq(X.format)}`);try{let J=await import(H);return J.default||J}catch(J){try{let Y=await Bun.file(H).text();if(X.format==="yaml"||X.format==="yml")return Xq(Y);if(X.format==="json")return JSON.parse(Y);throw J}catch{return}}}function Qq(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 Xq(q){let X={},Q=q.split(`
3
3
  `),H=[{obj:X,indent:-1}];for(let J of Q){let Y=J.replace(/#.*$/,"").trimEnd();if(!Y.trim())continue;let W=Y.search(/\S/);if(W===-1)continue;while(H.length>1&&H[H.length-1].indent>=W)H.pop();let $=H[H.length-1].obj,Z=Y.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(Z){let[,,_,z]=Z,G=_.trim(),w=z.trim();if(w==="")$[G]={},H.push({obj:$[G],indent:W});else $[G]=Zq(w)}}return X}function Zq(q){if(q.startsWith("'")&&q.endsWith("'")||q.startsWith('"')&&q.endsWith('"'))return q.slice(1,-1);let X=q.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Q=Number(q);if(!Number.isNaN(Q)&&q!=="")return Q;return q}function $q(q){switch(q){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Wq(q,X){return P(q,X)}function Yq(q,X){for(let Q of q){let H=Q.trim(),J=H.match(/^\{(\d+)\}\s*(.*)$/);if(J){let W=Number.parseInt(J[1],10);if(X===W)return J[2];continue}let Y=H.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Y){let W=Number.parseInt(Y[1],10),$=Y[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Y[2],10);if(X>=W&&X<=$)return Y[3];continue}}if(q.length===2)return X===1?q[0].trim():q[1].trim();if(X<q.length)return q[X].trim();return q[q.length-1].trim()}function _q(q,X={}){return m(q,X)}function m(q,X){let Q="",H=0;while(H<q.length)if(q[H]==="{"){let J=zq(q,H);if(J===-1){Q+=q[H],H++;continue}let Y=q.slice(H+1,J);Q+=Gq(Y,X),H=J+1}else if(q[H]==="'"&&H+1<q.length)if(q[H+1]==="'")Q+="'",H+=2;else if(q[H+1]==="{"||q[H+1]==="}")Q+=q[H+1],H+=2;else Q+=q[H],H++;else Q+=q[H],H++;return Q}function zq(q,X){let Q=0;for(let H=X;H<q.length;H++)if(q[H]==="{")Q++;else if(q[H]==="}"){if(Q--,Q===0)return H}return-1}function Gq(q,X){let Q=Bq(q);if(Q.length===0)return`{${q}}`;let H=Q[0].trim(),J=X[H];if(Q.length===1)return J!==void 0?String(J):`{${H}}`;switch(Q[1].trim().toLowerCase()){case"plural":return wq(J,Q.slice(2).join(","),X);case"select":return Dq(J,Q.slice(2).join(","));case"selectordinal":return Kq(J,Q.slice(2).join(","));case"number":return Vq(J,Q[2]?.trim());case"date":return Eq(J,Q[2]?.trim());case"time":return Aq(J,Q[2]?.trim());default:return J!==void 0?String(J):`{${q}}`}}function Bq(q){let X=[],Q="",H=0;for(let J=0;J<q.length;J++){let Y=q[J];if(Y==="{")H++,Q+=Y;else if(Y==="}")H--,Q+=Y;else if(Y===","&&H===0)X.push(Q),Q="";else Q+=Y}if(Q)X.push(Q);return X}function wq(q,X,Q){let H=Number(q)||0,J=C(X),Y=`=${H}`;if(J[Y])return I(J[Y],H,Q);let W=jq(H);if(J[W])return I(J[W],H,Q);if(J.other)return I(J.other,H,Q);return String(H)}function I(q,X,Q){let H=q.replace(/#/g,String(X));return m(H,Q)}function jq(q){let X=Math.abs(q),Q=Math.floor(X),H=String(q).includes(".")?String(q).split(".")[1].length:0;if(Q===1&&H===0)return"one";return"other"}function Dq(q,X){let Q=String(q||""),H=C(X);if(H[Q])return H[Q];return H.other||String(q)}function Kq(q,X){let Q=Number(q)||0,H=C(X),J=Fq(Q);if(H[J])return H[J].replace(/#/g,String(Q));if(H.other)return H.other.replace(/#/g,String(Q));return String(Q)}function Fq(q){let X=Math.abs(q),Q=X%10,H=X%100;if(Q===1&&H!==11)return"one";if(Q===2&&H!==12)return"two";if(Q===3&&H!==13)return"few";return"other"}function C(q){let X={},Q=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,H=Q.exec(q);while(H!==null)X[H[1]]=H[2],H=Q.exec(q);return X}function Vq(q,X){let Q=Number(q);if(Number.isNaN(Q))return String(q);switch(X){case"integer":return Math.floor(Q).toLocaleString();case"percent":return`${(Q*100).toFixed(0)}%`;case"currency":return Q.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Q.toLocaleString()}}function Eq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.dateStyle="short";break;case"medium":H.dateStyle="medium";break;case"long":H.dateStyle="long";break;case"full":H.dateStyle="full";break;default:H.dateStyle="medium"}return Q.toLocaleDateString(void 0,H)}function Aq(q,X){let Q=q instanceof Date?q:new Date(String(q));if(Number.isNaN(Q.getTime()))return String(q);let H={};switch(X){case"short":H.timeStyle="short";break;case"medium":H.timeStyle="medium";break;case"long":H.timeStyle="long";break;case"full":H.timeStyle="full";break;default:H.timeStyle="short"}return Q.toLocaleTimeString(void 0,H)}function Uq(q){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(q)}function L(q,X,Q=!0,H={}){let J=q.split("."),Y=X;for(let $ of J){if(Y===void 0||Y===null)break;Y=Y[$]}if(Y===void 0||Y===null)return Q?q:"";let W=String(Y);if(Uq(W))return _q(W,H);if(W.includes("|")&&"count"in H){let $=Number(H.count),Z=W.split("|");W=Yq(Z,$)}for(let[$,Z]of Object.entries(H)){let _=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");W=W.replace(new RegExp(`:${_}`,"g"),String(Z))}return W}var u=new Set(["ar","arc","ckb","dv","fa","he","khw","ks","nqo","prs","ps","sd","syr","ug","ur","uz-af","yi"]),Mq=new Set(["adlm","arab","aran","hebr","nkoo","rohg","syrc","thaa","yezi"]);function x(q){if(!q)return"ltr";let X=q.trim().toLowerCase().replace(/_/g,"-").split("-"),Q=X[0];if(!Q)return"ltr";let H=X[1]?.length===4?X[1]:void 0;if(H)return Mq.has(H)?"rtl":"ltr";if(X.length>1&&u.has(`${Q}-${X[1]}`))return"rtl";return u.has(Q)?"rtl":"ltr"}function nq(q){return x(q)==="rtl"}async function sq(q,X,Q,H){let J=q,Y=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,W={...y,...H.i18n},$=await Wq(W.locale,H);X.__translations=$,X.__locale=W.locale,X.__i18nConfig=W,J=await h(J,Y,async(z,G,w,K,j)=>{try{let D={};if(w)try{let B=[()=>JSON.parse(w),()=>{let U=`{"data":${w}}`,M=JSON.parse(U);return typeof M.data==="object"?M.data:{}},()=>{return S(w,X)}];for(let U of B)try{if(D=U(),Object.keys(D).length>0)break}catch{}}catch(B){if(H.debug)console.error("Error parsing parameters for @translate directive:",B)}return L(G,$,W.fallbackToKey,D)||K.trim()}catch(D){if(H.debug)console.error("Error processing @translate directive:",D);return T("Translate",`Error in @translate('${G}'): ${D instanceof Error?D.message:String(D)}`,R.EVALUATION_ERROR)}});let Z=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(H.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(Z)];console.warn(`Found ${z.length} @translate matches`),z.forEach((G,w)=>console.warn(`Match ${w}: ${G[0]}, Key: ${G[1]}, Params: ${G[2]||"none"}`))}return J=await h(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,G,w,K)=>{try{let j={};if(w)try{let D=[()=>JSON.parse(w),()=>{let A=`{"data":${w}}`,B=JSON.parse(A);return typeof B.data==="object"?B.data:{}},()=>{return S(w,X)}];for(let A of D)try{if(j=A(),Object.keys(j).length>0)break}catch{}}catch(D){if(H.debug)console.error("Error parsing parameters for @translate directive:",D)}return L(G,$,W.fallbackToKey,j)}catch(j){if(H.debug)console.error("Error processing @translate directive:",j);return T("Translate",`Error in @translate('${G}'): ${j instanceof Error?j.message:String(j)}`,R.EVALUATION_ERROR)}}),J}async function h(q,X,Q){let H=[];return q.replace(X,(Y,...W)=>{let $=Q(Y,...W).then((Z)=>({match:Y,replacement:Z}));return H.push($),Y}),(await Promise.all(H)).reduce((Y,{match:W,replacement:$})=>Y.replace(W,$),q)}function rq(q,X=!0){return(Q,H={})=>{return L(Q,q,X,H)}}import c from"path";function v(q,X){if(!q||x(q)!=="rtl")return!1;return!X||X.trim().toLowerCase()!=="rtl"}function n(q){if(!q)return!1;return q.trim().split(/\s+/)[0]?.toLowerCase()==="presentation"||q.trim().split(/\s+/)[0]?.toLowerCase()==="none"}function N(q,X){let Q=new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(q);if(!Q)return null;return Q[2]??Q[3]??Q[4]??null}function eq(q,X,Q,H){let J=q;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(W,$,Z)=>{let z={"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: ${Z||z} -->`});let Y=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Y,(W,$)=>{return`<span class="sr-only">${$.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(W,$,Z)=>{return`<span id="${`desc-${$}`}" class="sr-only">${Z}</span>`}),J}function qH(){return`
4
4
  .sr-only {
5
5
  position: absolute;
@@ -13,4 +13,4 @@ import{ns as i}from"./chunk-ez003q74.js";import{Hu as R,Xu as T,pv as S}from"./c
13
13
  border-width: 0;
14
14
  }
15
15
  `.trim()}function Oq(){return typeof globalThis.document<"u"&&typeof globalThis.document.createElement==="function"}function s(q){let X=new Map,Q=q.replace(/<(\/?)([A-Z][\w:.-]*)(?=[\s/>])/g,(J,Y,W)=>{let $=X.get(W);if(!$)$=`stx-a11y-component-${X.size}`,X.set(W,$);return`<${Y}${$}`}),H=new Map([...X.entries()].map(([J,Y])=>[Y,J]));return{protectedSource:Q,restore:(J)=>J.replace(/<(\/?)(stx-a11y-component-\d+)(?=[\s/>])/g,(Y,W,$)=>{let Z=H.get($);return Z?`<${W}${Z}`:Y})}}function Nq(q,X){let Q=[],H=/<img\s+([^>]*)>/gi,J;J=H.exec(q);while(J!==null){let B=J[1];if(!/\balt\s*=/i.test(B))Q.push({type:"missing-alt",element:J[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/"});J=H.exec(q)}let Y=/<button([^>]*)>\s*<\/button>/gi;J=Y.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"missing-accessible-name",element:J[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/"});J=Y.exec(q)}let W=/<a\s+([^>]*)>\s*<\/a>/gi;J=W.exec(q);while(J!==null){let B=J[1];if(!/\baria-label\s*=/i.test(B)&&!/\btitle\s*=/i.test(B))Q.push({type:"link-missing-text",element:J[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"});J=W.exec(q)}let $=/<(input|select|textarea)\s+([^>]*)>/gi;J=$.exec(q);while(J!==null){let B=J[2];if(/\btype\s*=\s*["']hidden["']/i.test(B)){J=$.exec(q);continue}let U=/\baria-label\s*=/i.test(B)||/\baria-labelledby\s*=/i.test(B),M=B.match(/\bid\s*=\s*["']([^"']+)["']/i);if(!U){let r=M&&new RegExp(`<label[^>]*\\bfor\\s*=\\s*["']${M[1]}["']`,"i").test(q),f=J.index,d=q.substring(0,f),Lq=q.substring(f),l=(d.match(/<label\b/gi)||[]).length,o=(d.match(/<\/label>/gi)||[]).length,a=l>o;if(!r&&!a)Q.push({type:"input-missing-label",element:J[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/"})}J=$.exec(q)}let Z=/<h([1-6])[^>]*>/gi,_=[];J=Z.exec(q);while(J!==null)_.push(Number.parseInt(J[1],10)),J=Z.exec(q);let z=0;for(let B of _){if(z>0&&B>z+1)Q.push({type:"heading-skip",element:`<h${B}>`,message:`Heading level skipped from h${z} to h${B}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});z=B}if(/<html\b/i.test(q)&&!/<html[^>]*\slang\s*=/i.test(q))Q.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 G=q.match(/<html\b([^>]*)>/i);if(G&&v(N(G[1],"lang"),N(G[1],"dir")))Q.push({type:"missing-dir",element:G[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 w=/<table([^>]*)>([\s\S]*?)<\/table>/gi;J=w.exec(q);while(J!==null){let B=J[2];if(!n(N(J[1],"role"))&&!/<th\b/i.test(B))Q.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"});J=w.exec(q)}let K=/<(video|audio)[^>]*\sautoplay\s[^>]*>/gi;J=K.exec(q);while(J!==null){if(!/\bmuted\b/i.test(J[0]))Q.push({type:"autoplay-audio",element:`<${J[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"});J=K.exec(q)}let j=/\btabindex\s*=\s*["']([1-9]\d*)["']/gi;J=j.exec(q);while(J!==null)Q.push({type:"positive-tabindex",element:`tabindex="${J[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"}),J=j.exec(q);let D=/<iframe\s+([^>]*)>/gi;J=D.exec(q);while(J!==null){let B=J[1];if(!/\btitle\s*=/i.test(B)&&!/\baria-label\s*=/i.test(B))Q.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"});J=D.exec(q)}let A=/<([a-z]+)\s+([^>]*role\s*=\s*["']button["'][^>]*)>/gi;J=A.exec(q);while(J!==null){let B=J[1].toLowerCase(),U=J[2];if(B!=="button"&&!/\btabindex\s*=/i.test(U))Q.push({type:"button-not-focusable",element:J[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/"});J=A.exec(q)}return Q}async function Pq(q,X){let{protectedSource:Q}=s(q);if(!Oq())return Nq(Q,X);let H=[];try{let J=globalThis.document.createElement("div");J.innerHTML=Q,J.querySelectorAll("img").forEach((Z)=>{if(!Z.hasAttribute("alt"))H.push({type:"missing-alt",element:`<${Z.outerHTML}>`,message:"Image missing alt attribute",impact:"serious",help:"Add alt text to images for screen readers",helpUrl:"https://web.dev/learn/accessibility/images/"})}),J.querySelectorAll('button, a, [role="button"]').forEach((Z)=>{if(!(Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby")||Z.textContent&&Z.textContent.trim().length>0))H.push({type:"missing-accessible-name",element:`<${Z.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/"})}),J.querySelectorAll("input, select, textarea").forEach((Z)=>{let _=Z.getAttribute("id"),z=_&&J.querySelector(`label[for="${_}"]`),G=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),w=Z.closest("label")!==null;if(!z&&!G&&!w)H.push({type:"input-missing-label",element:`<${Z.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 Y=Array.from(J.querySelectorAll("h1, h2, h3, h4, h5, h6")),W=0;for(let Z of Y){let _=Number.parseInt(Z.tagName.charAt(1));if(W>0&&_>W+1)H.push({type:"heading-skip",element:`<${Z.outerHTML}>`,message:`Heading level skipped from h${W} to h${_}`,impact:"moderate",help:"Maintain proper heading hierarchy without skipping levels",helpUrl:"https://web.dev/learn/accessibility/structure/"});W=_}let $=J.querySelector("html");if(Q.includes("<html")&&$&&!$.hasAttribute("lang"))H.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($&&v($.getAttribute("lang"),$.getAttribute("dir")))H.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(J.querySelectorAll("a").forEach((Z)=>{let _=Z.textContent&&Z.textContent.trim().length>0,z=Z.hasAttribute("aria-label")||Z.hasAttribute("aria-labelledby"),G=Z.hasAttribute("title"),w=Z.querySelector("img[alt]");if(!_&&!z&&!G&&!w)H.push({type:"link-missing-text",element:`<${Z.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"})}),Q.includes("<nav")||Q.includes("<header")){if(!J.querySelector('a[href="#main"], a[href="#content"], .skip-link, [class*="skip"]')&&J.querySelectorAll("a").length>5)H.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(J.querySelectorAll("table").forEach((Z)=>{if(n(Z.getAttribute("role")))return;let _=Z.querySelector("caption");if(!Z.querySelector("th"))H.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(!_&&!Z.hasAttribute("aria-label")&&!Z.hasAttribute("aria-labelledby"))H.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"})}),J.querySelectorAll('[style*="color"]').forEach((Z)=>{let _=Z.getAttribute("style")||"";if(_.includes("color:")&&!_.includes("background"))H.push({type:"potential-contrast-issue",element:`<${Z.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/"})}),J.querySelectorAll("video[autoplay], audio[autoplay]").forEach((Z)=>{if(!Z.hasAttribute("muted"))H.push({type:"autoplay-audio",element:`<${Z.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"})}),J.querySelectorAll("[tabindex]").forEach((Z)=>{if(Number.parseInt(Z.getAttribute("tabindex")||"0")>0)H.push({type:"positive-tabindex",element:`<${Z.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"})}),J.querySelectorAll('[role="button"]').forEach((Z)=>{if(!Z.hasAttribute("tabindex"))H.push({type:"button-not-focusable",element:`<${Z.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/"})}),Q.includes("<body")&&!J.querySelector('main, [role="main"]'))H.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"});J.querySelectorAll("iframe").forEach((Z)=>{if(!Z.hasAttribute("title")&&!Z.hasAttribute("aria-label"))H.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(J){console.error(`Error checking accessibility in ${X}:`,J)}return H}async function Iq(q,X={}){let Q={},{recursive:H=!0,ignorePaths:J=[]}=X,Y=Array.isArray(q)?q:[q],W=await i(Y,{recursive:H,ignorePaths:J}),$=[];for(let Z of W)try{let _=await Bun.file(Z).text();if(Z.endsWith("good-a11y.stx"))continue;let z=await Pq(_,Z);if($.push(Z),z.length>0)Q[Z]=z}catch(_){console.error(`Error scanning ${Z}:`,_)}return{results:Q,scannedFiles:$}}async function HH(q,X={}){return(await Iq(q,X)).results}var Rq={fixMissingAlt:!0,fixMissingLabels:!0,fixMissingFormLabels:!0,fixTableHeaders:!0,fixMissingLang:!0,fixMissingDir:!0,fixPositiveTabindex:!0,fixButtonFocusable:!0,defaultLang:"en"};function Tq(q,X={}){let Q={...Rq,...X},H=[],{protectedSource:J,restore:Y}=s(q),W=J;if(Q.fixMissingAlt)W=W.replace(/<img([^>]*?)(?<!\balt\s*=\s*["'][^"']*["'])(\s*\/?>)/gi,($,Z,_)=>{if(/\balt\s*=/i.test(Z))return $;let z=$,G=`<img${Z} alt=""${_}`;return H.push({type:"missing-alt",description:"Added empty alt attribute to image",before:z,after:G}),G});if(Q.fixMissingLabels)W=W.replace(/<button([^>]*)>\s*<\/button>/gi,($,Z)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;let _=$,z=`<button${Z} aria-label="Button"></button>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to empty button",before:_,after:z}),z}),W=W.replace(/<a([^>]*)>\s*(<(?:i|span|svg)[^>]*(?:class="[^"]*icon[^"]*")?[^>]*>.*?<\/(?:i|span|svg)>)?\s*<\/a>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(Z)||/\btitle\s*=/i.test(Z))return $;if(!_&&$.replace(/<a[^>]*>|<\/a>/gi,"").trim())return $;let z=$,G=`<a${Z} aria-label="Link">${_||""}</a>`;return H.push({type:"missing-accessible-name",description:"Added aria-label to link without text",before:z,after:G}),G});if(Q.fixMissingFormLabels)W=W.replace(/<(input|select|textarea)([^>]*)>/gi,($,Z,_)=>{if(/\baria-label\s*=/i.test(_)||/\baria-labelledby\s*=/i.test(_))return $;if(/\btype\s*=\s*["']hidden["']/i.test(_))return $;let z=_.match(/\bname\s*=\s*["']([^"']+)["']/i),G=_.match(/\bid\s*=\s*["']([^"']+)["']/i),w=z?.[1]||G?.[1]||Z,K=$,j=`<${Z}${_} aria-label="${w}">`;return H.push({type:"input-missing-label",description:`Added aria-label to ${Z} element`,before:K,after:j}),j});if(Q.fixMissingLang)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{if(/\blang\s*=/i.test(Z))return $;let _=$,z=`<html${Z} lang="${Q.defaultLang}">`;return H.push({type:"missing-lang",description:`Added lang="${Q.defaultLang}" to html element`,before:_,after:z}),z});if(Q.fixMissingDir)W=W.replace(/<html([^>]*)>/gi,($,Z)=>{let _=N(Z,"lang");if(!v(_,N(Z,"dir")))return $;let z=/\bdir\s*=/i.test(Z)?`<html${Z.replace(/\bdir\s*=\s*(["'])[^"']*\1/i,'dir="rtl"')}>`:`<html${Z} dir="rtl">`;return H.push({type:"missing-dir",description:`Added dir="rtl" to html element (lang="${_}" is right-to-left)`,before:$,after:z}),z});if(Q.fixPositiveTabindex)W=W.replace(/\btabindex\s*=\s*["']([1-9]\d*)["']/gi,($,Z)=>{let _=$,z='tabindex="0"';return H.push({type:"positive-tabindex",description:`Changed tabindex="${Z}" to tabindex="0"`,before:_,after:'tabindex="0"'}),'tabindex="0"'});if(Q.fixButtonFocusable)W=W.replace(/<([a-z]+)(\s[^>]*role\s*=\s*["']button["'][^>]*)>/gi,($,Z,_)=>{if(/\btabindex\s*=/i.test(_))return $;if(Z.toLowerCase()==="button")return $;let z=$,G=`<${Z}${_} tabindex="0">`;return H.push({type:"button-not-focusable",description:'Added tabindex="0" to element with role="button"',before:z,after:G}),G});if(Q.fixTableHeaders)W=W.replace(/<th([^>]*)>/gi,($,Z)=>{if(/\bscope\s*=/i.test(Z))return $;let _=$,z=`<th${Z} scope="col">`;return H.push({type:"table-missing-scope",description:'Added scope="col" to table header',before:_,after:z}),z});return{original:q,fixed:Y(W),fixCount:H.length,fixes:H}}async function Sq(q,X={},Q=!1){let H=await Bun.file(q).text(),J=Tq(H,X);if(Q&&J.fixCount>0)await Bun.write(q,J.fixed);return J}async function JH(q,X={},Q={}){let H={},{recursive:J=!0,ignorePaths:Y=[],writeBack:W=!1,extensions:$=[".stx",".html",".htm"]}=Q,Z=$.length===1?`*${$[0]}`:`*{${$.join(",")}}`,_=c.join(q,J?`**/${Z}`:Z),z=new Bun.Glob(_);for await(let G of z.scan()){if(Y.some((K)=>G.includes(c.normalize(K))))continue;try{let K=await Sq(G,X,W);if(K.fixCount>0)H[G]=K}catch(K){console.error(`Error fixing ${G}:`,K)}}return H}var kq={name:"a11y",handler:(q,X,Q,H)=>{if(!X.length)return q;let J=X[0].replace(/['"]/g,""),Y=X.length>1?X[1].replace(/['"]/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"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Y||$} -->${q}`},hasEndTag:!1},bq={name:"screenReader",handler:(q)=>{return`<span class="sr-only">${q}</span>`},hasEndTag:!0};function QH(){return[kq,bq]}
16
- export{y as Dr,vq as Er,fq as Fr,dq as Gr,gq as Hr,uq as Ir,qq as Jr,hq as Kr,P as Lr,Hq as Mr,pq as Nr,mq as Or,cq as Pr,iq as Qr,Wq as Rr,_q as Sr,Uq as Tr,L as Ur,x as Vr,nq as Wr,sq as Xr,rq as Yr,n as Zr,N as _r,eq as $r,qH as as,Oq as bs,Nq as cs,Pq as ds,Iq as es,HH as fs,Tq as gs,Sq as hs,JH as is,kq as js,bq as ks,QH as ls};
16
+ export{y as Er,vq as Fr,fq as Gr,dq as Hr,gq as Ir,uq as Jr,qq as Kr,hq as Lr,P as Mr,Hq as Nr,pq as Or,mq as Pr,cq as Qr,iq as Rr,Wq as Sr,_q as Tr,Uq as Ur,L as Vr,x as Wr,nq as Xr,sq as Yr,rq as Zr,n as _r,N as $r,eq as as,qH as bs,Oq as cs,Nq as ds,Pq as es,Iq as fs,HH as gs,Tq as hs,Sq as is,JH as js,kq as ks,bq as ls,QH as ms};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import"./chunk-emjmshj8.js";var Y=null,S=[],F=new WeakMap;function I(z){let K=z,B=new Set,G={get value(){if(Y){let H=F.get(G);if(!H)H=new Set,F.set(G,H);H.add(Y)}return K},set value(H){if(!Object.is(K,H)){K=H,B.forEach((J)=>J(H));let L=F.get(G);if(L)L.forEach((J)=>J())}},subscribe(H){return B.add(H),()=>B.delete(H)},peek(){return K}};return G}function W(z){return z!==null&&typeof z==="object"&&"value"in z&&"subscribe"in z&&"peek"in z}function P(z){return W(z)?z.value:z}function j(z){let K={};for(let B in z)if(Object.prototype.hasOwnProperty.call(z,B))K[B]=I(z[B]);return K}function D(z){return I(z)}function U(z){let K=typeof z==="function",B=K?z:z.get,G=K?void 0:z.set,H=K?Object.is:z.equals||Object.is,L,J=!0,Q=new Set,X=new Set,_=()=>{if(J=!0,X.size>0){let N=T.value;X.forEach(($)=>$(N))}};function Z(){Q.clear();let N=Y;Y=_,S.push(_);try{return B()}finally{S.pop(),Y=N}}let T={get value(){if(Y){let N=F.get(T);if(!N)N=new Set,F.set(T,N);N.add(Y)}if(J){let N=Z();if(!H(L,N))L=N;J=!1}return L},set value(N){if(G)G(N);else console.warn("Computed property is readonly")},subscribe(N){return X.add(N),()=>X.delete(N)},peek(){if(J)L=B(),J=!1;return L},invalidate(){J=!0},get dirty(){return J},get deps(){return Q}};return T}function x(z,K,B={}){let{immediate:G=!1,deep:H=!1,flush:L="pre",once:J=!1}=B,Q,X=!0,_=!1,Z=()=>{if(W(z))return H?q(z.value):z.value;return z()},T=()=>{if(!X||_)return;let M=Z();if(Q!==void 0&&Object.is(Q,M)&&!H)return;let A=()=>{if(K(M,Q),Q=H?q(M):M,J)$()};if(L==="sync")A();else if(L==="post")queueMicrotask(A);else Promise.resolve().then(A)},N=null;if(W(z))N=z.subscribe(()=>T());else N=U(z).subscribe(()=>T());if(G)Q=void 0,T();else Q=Z();let $=()=>{if(X=!1,N)N(),N=null};return $.pause=()=>{_=!0},$.resume=()=>{_=!1},$}function E(z,K,B={}){let{immediate:G=!1,once:H=!1}=B,L=z.map((T)=>W(T)?T.value:void 0),J=!0,Q=!1,X=()=>{if(!J||Q)return;let T=z.map((N)=>W(N)?N.value:void 0);if(K(T,L),L=[...T],H)Z()},_=z.map((T)=>{if(W(T))return T.subscribe(()=>X());return()=>{}});if(G)X();let Z=()=>{J=!1,_.forEach((T)=>T())};return Z.pause=()=>{Q=!0},Z.resume=()=>{Q=!1},Z}function y(z,K={}){let{flush:B="pre"}=K,G,H=!0,L=!1,J=()=>{if(!H||L)return;if(G)G();let X=Y;Y=J,S.push(J);try{G=z()}finally{S.pop(),Y=X}};if(B==="sync")J();else if(B==="post")queueMicrotask(J);else Promise.resolve().then(J);let Q=()=>{if(H=!1,G)G()};return Q.pause=()=>{L=!0},Q.resume=()=>{L=!1},Q}function C(z,K={},B){let G=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return z.replace(G,(H,L,J)=>{try{let X=Function(...Object.keys(K),`return ${J}`)(...Object.values(K));return K[L]=X,`<!-- computed: ${L} = ${X} -->`}catch(Q){return`<!-- computed error: ${L} - ${Q} -->`}})}function R(z,K={},B){let G=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return z.replace(G,(H,L,J)=>{return`
2
+ import"./chunk-m8kem5ca.js";var Y=null,S=[],F=new WeakMap;function I(z){let K=z,B=new Set,G={get value(){if(Y){let H=F.get(G);if(!H)H=new Set,F.set(G,H);H.add(Y)}return K},set value(H){if(!Object.is(K,H)){K=H,B.forEach((J)=>J(H));let L=F.get(G);if(L)L.forEach((J)=>J())}},subscribe(H){return B.add(H),()=>B.delete(H)},peek(){return K}};return G}function W(z){return z!==null&&typeof z==="object"&&"value"in z&&"subscribe"in z&&"peek"in z}function P(z){return W(z)?z.value:z}function j(z){let K={};for(let B in z)if(Object.prototype.hasOwnProperty.call(z,B))K[B]=I(z[B]);return K}function D(z){return I(z)}function U(z){let K=typeof z==="function",B=K?z:z.get,G=K?void 0:z.set,H=K?Object.is:z.equals||Object.is,L,J=!0,Q=new Set,X=new Set,_=()=>{if(J=!0,X.size>0){let N=T.value;X.forEach(($)=>$(N))}};function Z(){Q.clear();let N=Y;Y=_,S.push(_);try{return B()}finally{S.pop(),Y=N}}let T={get value(){if(Y){let N=F.get(T);if(!N)N=new Set,F.set(T,N);N.add(Y)}if(J){let N=Z();if(!H(L,N))L=N;J=!1}return L},set value(N){if(G)G(N);else console.warn("Computed property is readonly")},subscribe(N){return X.add(N),()=>X.delete(N)},peek(){if(J)L=B(),J=!1;return L},invalidate(){J=!0},get dirty(){return J},get deps(){return Q}};return T}function x(z,K,B={}){let{immediate:G=!1,deep:H=!1,flush:L="pre",once:J=!1}=B,Q,X=!0,_=!1,Z=()=>{if(W(z))return H?q(z.value):z.value;return z()},T=()=>{if(!X||_)return;let M=Z();if(Q!==void 0&&Object.is(Q,M)&&!H)return;let A=()=>{if(K(M,Q),Q=H?q(M):M,J)$()};if(L==="sync")A();else if(L==="post")queueMicrotask(A);else Promise.resolve().then(A)},N=null;if(W(z))N=z.subscribe(()=>T());else N=U(z).subscribe(()=>T());if(G)Q=void 0,T();else Q=Z();let $=()=>{if(X=!1,N)N(),N=null};return $.pause=()=>{_=!0},$.resume=()=>{_=!1},$}function E(z,K,B={}){let{immediate:G=!1,once:H=!1}=B,L=z.map((T)=>W(T)?T.value:void 0),J=!0,Q=!1,X=()=>{if(!J||Q)return;let T=z.map((N)=>W(N)?N.value:void 0);if(K(T,L),L=[...T],H)Z()},_=z.map((T)=>{if(W(T))return T.subscribe(()=>X());return()=>{}});if(G)X();let Z=()=>{J=!1,_.forEach((T)=>T())};return Z.pause=()=>{Q=!0},Z.resume=()=>{Q=!1},Z}function y(z,K={}){let{flush:B="pre"}=K,G,H=!0,L=!1,J=()=>{if(!H||L)return;if(G)G();let X=Y;Y=J,S.push(J);try{G=z()}finally{S.pop(),Y=X}};if(B==="sync")J();else if(B==="post")queueMicrotask(J);else Promise.resolve().then(J);let Q=()=>{if(H=!1,G)G()};return Q.pause=()=>{L=!0},Q.resume=()=>{L=!1},Q}function C(z,K={},B){let G=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return z.replace(G,(H,L,J)=>{try{let X=Function(...Object.keys(K),`return ${J}`)(...Object.values(K));return K[L]=X,`<!-- computed: ${L} = ${X} -->`}catch(Q){return`<!-- computed error: ${L} - ${Q} -->`}})}function R(z,K={},B){let G=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return z.replace(G,(H,L,J)=>{return`
3
3
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
4
4
  (function() {
5
5
  // Watch implementation for ${L}
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{ul as G}from"./chunk-qjvny3wf.js";import{mq as U,qq as B}from"./chunk-3ssjb8cx.js";import{Ks as O}from"./chunk-kjd9hbg4.js";import{rt as L}from"./chunk-ejwfnttb.js";import{Rw as y}from"./chunk-emjmshj8.js";import X from"fs";import Z from"path";var H=new Map,$=new Map;async function p(j){let J;for(let V=0;V<3;V++)try{let q=(await X.promises.stat(j)).mtime.getTime(),W=$.get(j);if(W&&W.mtime===q)return W.content;let I=await Bun.file(j).text(),T=(await X.promises.stat(j)).mtime.getTime();if(T!==q)continue;return $.set(j,{content:I,mtime:T}),I}catch(Q){J=Q;break}throw $.delete(j),Error(`File not found: ${j}${J?` (${J.message})`:""}`)}function m(j){$.delete(j)}function f(j){for(let z of $.keys())if(z.startsWith(j))$.delete(z)}var M=null,v=null,b=null;function r(j){b=j}async function k(j=!1){let z=b??await import("./chunk-2s3wvns6.js");if(j)return z.generateSignalsRuntimeDev();if(M===null)M=z.generateSignalsRuntime();return M}var N=null;async function R(){if(N===null){let{getRouterScript:j}=await import("./chunk-6gsgayq3.js");N=j()}return N}var x={};async function d(j,z=!1){let J=j==="runtime"?await k(z):await R(),V=j==="runtime"&&z?"runtime-debug":j,Q=x[V];if(!Q||Q.content!==J)Q={content:J,hash:Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)},x[V]=Q;return{content:J,hash:Q.hash,url:`/_stx/${j}.${Q.hash}.js`}}var E=500,Y=new Map;function w(j){return L(process.cwd(),"module-bundles",`${j}.js`)}function c(j){let z=Bun.hash(j).toString(16).padStart(16,"0").slice(0,16),J=Y.has(z);if(J)Y.delete(z);Y.set(z,j);while(Y.size>E)Y.delete(Y.keys().next().value);if(!J)try{let V=w(z);if(!X.existsSync(V))X.mkdirSync(Z.dirname(V),{recursive:!0}),X.writeFileSync(V,j)}catch{}return`/_stx/modules.${z}.js`}function l(j){if(!/^[0-9a-f]{16}$/.test(j))return;let z=Y.get(j);if(z!==void 0)return z;try{return X.readFileSync(w(j),"utf8")}catch{return}}function o(){$.clear(),B(),O(),M=null,v=null,N=null}function A(j){let z={debug:j.debug===!0,middleware:(j.middleware??[]).map((J)=>({name:J.name,timing:J.timing,handler:String(J.handler)})),customDirectives:(j.customDirectives??[]).map((J)=>({name:J.name,hasEndTag:J.hasEndTag===!0,rawParams:J.rawParams===!0,handler:String(J.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(z)).digest("hex")}async function s(j,z){try{if(!z.cachePath)return null;let J=Z.resolve(z.cachePath),V=Z.join(J,`${D(j)}.html`),Q=Z.join(J,`${D(j)}.meta.json`);if(!await U(V)||!await U(Q))return null;let q=await Bun.file(Q).text(),W=JSON.parse(q);if(W.cacheVersion!==z.cacheVersion)return null;if(W.engine!==G())return null;if(W.optionsSignature!==A(z))return null;if((await X.promises.stat(j)).mtime.getTime()>W.mtime)return null;for(let K of W.dependencies)if(await U(K)){if((await X.promises.stat(K)).mtime.getTime()>W.mtime)return null}else return null;return await Bun.file(V).text()}catch(J){return console.warn(`Cache error for ${j}:`,J),null}}async function n(j,z,J,V){try{if(!V.cachePath)return;let Q=Z.resolve(V.cachePath);await X.promises.mkdir(Q,{recursive:!0});let q=Z.join(Q,`${D(j)}.html`),W=Z.join(Q,`${D(j)}.meta.json`),I=await X.promises.stat(j);await Bun.write(q,z);let K={sourcePath:j,mtime:I.mtime.getTime(),dependencies:Array.from(J),cacheVersion:V.cacheVersion,engine:G(),optionsSignature:A(V),generatedAt:Date.now()};await Bun.write(W,JSON.stringify(K,null,2)),H.set(j,{output:z,mtime:I.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${j}:`,Q)}}var F=16;function D(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,F)}
2
+ import{ul as G}from"./chunk-qjvny3wf.js";import{nq as U,rq as B}from"./chunk-2119txb8.js";import{Ls as O}from"./chunk-dj24n5n7.js";import{st as L}from"./chunk-w1asc0zd.js";import{Sw as y}from"./chunk-m8kem5ca.js";import X from"fs";import Z from"path";var H=new Map,$=new Map;async function p(j){let J;for(let V=0;V<3;V++)try{let q=(await X.promises.stat(j)).mtime.getTime(),W=$.get(j);if(W&&W.mtime===q)return W.content;let I=await Bun.file(j).text(),T=(await X.promises.stat(j)).mtime.getTime();if(T!==q)continue;return $.set(j,{content:I,mtime:T}),I}catch(Q){J=Q;break}throw $.delete(j),Error(`File not found: ${j}${J?` (${J.message})`:""}`)}function m(j){$.delete(j)}function f(j){for(let z of $.keys())if(z.startsWith(j))$.delete(z)}var M=null,v=null,b=null;function r(j){b=j}async function k(j=!1){let z=b??await import("./chunk-1e0jj83h.js");if(j)return z.generateSignalsRuntimeDev();if(M===null)M=z.generateSignalsRuntime();return M}var N=null;async function R(){if(N===null){let{getRouterScript:j}=await import("./chunk-t9m81dj8.js");N=j()}return N}var x={};async function d(j,z=!1){let J=j==="runtime"?await k(z):await R(),V=j==="runtime"&&z?"runtime-debug":j,Q=x[V];if(!Q||Q.content!==J)Q={content:J,hash:Bun.hash(J).toString(16).padStart(16,"0").slice(0,16)},x[V]=Q;return{content:J,hash:Q.hash,url:`/_stx/${j}.${Q.hash}.js`}}var E=500,Y=new Map;function w(j){return L(process.cwd(),"module-bundles",`${j}.js`)}function c(j){let z=Bun.hash(j).toString(16).padStart(16,"0").slice(0,16),J=Y.has(z);if(J)Y.delete(z);Y.set(z,j);while(Y.size>E)Y.delete(Y.keys().next().value);if(!J)try{let V=w(z);if(!X.existsSync(V))X.mkdirSync(Z.dirname(V),{recursive:!0}),X.writeFileSync(V,j)}catch{}return`/_stx/modules.${z}.js`}function l(j){if(!/^[0-9a-f]{16}$/.test(j))return;let z=Y.get(j);if(z!==void 0)return z;try{return X.readFileSync(w(j),"utf8")}catch{return}}function o(){$.clear(),B(),O(),M=null,v=null,N=null}function A(j){let z={debug:j.debug===!0,middleware:(j.middleware??[]).map((J)=>({name:J.name,timing:J.timing,handler:String(J.handler)})),customDirectives:(j.customDirectives??[]).map((J)=>({name:J.name,hasEndTag:J.hasEndTag===!0,rawParams:J.rawParams===!0,handler:String(J.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(z)).digest("hex")}async function s(j,z){try{if(!z.cachePath)return null;let J=Z.resolve(z.cachePath),V=Z.join(J,`${D(j)}.html`),Q=Z.join(J,`${D(j)}.meta.json`);if(!await U(V)||!await U(Q))return null;let q=await Bun.file(Q).text(),W=JSON.parse(q);if(W.cacheVersion!==z.cacheVersion)return null;if(W.engine!==G())return null;if(W.optionsSignature!==A(z))return null;if((await X.promises.stat(j)).mtime.getTime()>W.mtime)return null;for(let K of W.dependencies)if(await U(K)){if((await X.promises.stat(K)).mtime.getTime()>W.mtime)return null}else return null;return await Bun.file(V).text()}catch(J){return console.warn(`Cache error for ${j}:`,J),null}}async function n(j,z,J,V){try{if(!V.cachePath)return;let Q=Z.resolve(V.cachePath);await X.promises.mkdir(Q,{recursive:!0});let q=Z.join(Q,`${D(j)}.html`),W=Z.join(Q,`${D(j)}.meta.json`),I=await X.promises.stat(j);await Bun.write(q,z);let K={sourcePath:j,mtime:I.mtime.getTime(),dependencies:Array.from(J),cacheVersion:V.cacheVersion,engine:G(),optionsSignature:A(V),generatedAt:Date.now()};await Bun.write(W,JSON.stringify(K,null,2)),H.set(j,{output:z,mtime:I.mtime.getTime(),dependencies:J})}catch(Q){console.warn(`Failed to cache template ${j}:`,Q)}}var F=16;function D(j){return new Bun.CryptoHasher("sha1").update(j).digest("hex").substring(0,F)}
3
3
  export{H as Kj,p as Lj,m as Mj,f as Nj,r as Oj,k as Pj,R as Qj,d as Rj,c as Sj,l as Tj,o as Uj,s as Vj,n as Wj,D as Xj};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{jh as x,oh as M,ph as C,qh as v,rh as P}from"./chunk-bcpjhcpn.js";import{Rw as y}from"./chunk-emjmshj8.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as Rg,w as Sg,Q as Tg,d as Ug,g as Vg,n as Wg,D as Xg,t as Yg,KJ as Zg};
2
+ import{jh as x,oh as M,ph as C,qh as v,rh as P}from"./chunk-bcpjhcpn.js";import{Sw as y}from"./chunk-m8kem5ca.js";import{resolve as h,basename as f,extname as u,join as m}from"path";import{mkdir as l}from"fs/promises";var I={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0};class z{config;constructor(J={}){this.config={...I,...J}}async get(J,Z){return C(J,Z,"image",this.config)}async set(J,Z,Y){return v(J,Z,Y,"image",this.config)}async clear(){return P("image",this.config)}updateConfig(J){this.config={...this.config,...J}}}var H=null;function S(J){if(!H)H=new z(J);else if(J)H.updateConfig(J);return H}async function w(J,Z,Y){let K=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S(K).get(J,Z)}async function Q(J,Z,Y,K){let X=K?{directory:`${K.outputDir}/../.cache`}:{};return S(X).set(J,Z,Y)}async function d(){return S().clear()}async function R(){try{return await import("ts-images")}catch{return null}}function b(J){switch(J){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function p(J,Z){let Y=Z?b(Z):b("web"),K=J.formatQuality||{};return{jpeg:{...Y.jpeg,...K.jpeg},png:{...Y.png,...K.png},webp:{...Y.webp,...K.webp},avif:{...Y.avif,...K.avif}}}async function g(J,Z,Y){let K=await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:J,processed:!1};let X=await w(J,Z,Y);if(X)return X;try{let N=h(J);if(!await M(N))return{src:J,processed:!1,errors:[`Source file not found: ${J}`]};let L=p(Y,Z.preset),V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await l(V,{recursive:!0});let q=await x(N),U=f(J,u(J)),E=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],G={src:J,processed:!0,variants:[],hash:q},j=null;if(Z.transformations&&Z.transformations.length>0)j=await D(N,Z.transformations,K);for(let $ of E){let A=L[$]||{},W=`${U}-${q}.${$}`,_=m(V,W);try{let O=await K.optimizeImage({input:j||N,output:_,format:$,quality:A.quality,progressive:A.progressive});if(O){if(G.variants.push({path:_,url:`${F}/${W}`,width:O.width||0,height:O.height||0,format:$,size:O.outputSize||0}),!G.originalWidth&&O.width)G.originalWidth=O.width,G.originalHeight=O.height}}catch(O){G.errors=G.errors||[],G.errors.push(`Failed to optimize ${$}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let $=await K.generateThumbHash(N);G.placeholder=$.dataUrl}catch($){G.errors=G.errors||[],G.errors.push(`Failed to generate thumbhash: ${$}`)}if(Z.useDominantColor)try{let $=await K.generatePlaceholder(N,{strategy:"dominant-color"});G.dominantColor=$.dominantColor}catch($){G.errors=G.errors||[],G.errors.push(`Failed to extract dominant color: ${$}`)}return await Q(J,Z,G,Y),G}catch(N){return{src:J,processed:!1,errors:[`Processing failed: ${N}`]}}}async function n(J,Z,Y,K){let X=await R();if(!X)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await X.optimizeImage({input:J,output:K,format:Z,quality:Y}))?.outputSize}}catch(N){return{success:!1,error:String(N)}}}async function D(J,Z,Y){let K=Y||await R();if(!K)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let X=await K.decode(J);for(let N of Z){let L=N.options||{};switch(N.type){case"resize":if(L.width||L.height)X=await K.resize(X,{width:L.width,height:L.height,fit:L.fit});break;case"blur":if(L.sigma!==void 0)X=await K.blur(X,L.sigma);break;case"sharpen":if(L.amount!==void 0)X=await K.sharpen(X,L.amount);break;case"grayscale":X=await K.grayscale(X);break;case"rotate":if(L.angle!==void 0)X=await K.rotate(X,L.angle);break;case"flip":X=await K.flip(X);break;case"flop":X=await K.flop(X);break;case"brightness":if(L.value!==void 0)X=await K.brightness(X,L.value);break;case"contrast":if(L.value!==void 0)X=await K.contrast(X,L.value);break;case"saturation":if(L.value!==void 0)X=await K.saturation(X,L.value);break}}return await K.encode(X,"png")}catch(X){return console.error(`[stx-media] Transformation failed: ${X}`),null}}import{resolve as c,basename as i,extname as r,join as o}from"path";import{mkdir as a}from"fs/promises";async function e(){try{return await import("ts-images")}catch{return null}}var s=[320,480,640,768,1024,1280,1536,1920];async function t(J,Z,Y){let K=await e();if(!K)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let X=c(J);if(!await M(X))return console.warn(`[stx-media] Source file not found: ${J}`),null;try{let N=Z.responsiveWidths||Y.breakpoints||s,L=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],V=Y.outputDir||"dist/images",F=Y.baseUrl||"/images";await a(V,{recursive:!0});let q=await x(X),U=i(J,r(J)),E=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},G={src:J,byFormat:{},srcsets:{}};for(let $ of L){G.byFormat[$]=[];let A=[];for(let W of N){let _=`${U}-${W}w-${q}.${$}`,O=o(V,_),B=`${F}/${_}`;try{let T=E[$]?.quality||80;if(await M(O)){G.byFormat[$].push({path:O,url:B,width:W,height:0,format:$,size:0}),A.push(`${B} ${W}w`);continue}let k=await K.processImage({input:X,output:O,format:$,quality:T,resize:{width:W}});if(k)G.byFormat[$].push({path:O,url:B,width:W,height:k.height||Math.round(W*(k.height||1)/(k.width||1)),format:$,size:k.outputSize||0}),A.push(`${B} ${W}w`)}catch(T){console.warn(`[stx-media] Failed to generate ${$} at ${W}w: ${T}`)}}G.srcsets[$]=A.join(", ")}let j=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let $=await K.generateThumbHash(X);G.placeholder={dataURL:$.dataUrl,width:$.width||32,height:$.height||32,strategy:"thumbhash"}}else{let $=await K.generatePlaceholder(X,{strategy:j,width:20});G.placeholder={dataURL:$.dataURL,width:$.width,height:$.height,strategy:j}}}catch($){console.warn(`[stx-media] Failed to generate placeholder: ${$}`)}return G.sizes=Z.sizes||JJ(N),G}catch(N){return console.error(`[stx-media] Responsive generation failed: ${N}`),null}}function JJ(J){let Z=[...J].sort((K,X)=>K-X),Y=[];for(let K=0;K<Z.length-1;K++){let X=Z[K];Y.push(`(max-width: ${X}px) ${X}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KJ(J,Z="width"){if(!J||J.length===0)return"";if(Z==="dpr")return J.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return J.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}export{z as Rg,w as Sg,Q as Tg,d as Ug,g as Vg,n as Wg,D as Xg,t as Yg,KJ as Zg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  import{createHash as n}from"crypto";import x from"fs";import K from"path";import{decode as $Q,generateThumbHash as JQ}from"ts-images";import{createImageDeliveryCatalog as f}from"ts-images/delivery";import R from"fs";function T(Q,$,Z){let M=Buffer.alloc(Z),J=R.readSync(Q,M,0,Z,$);return M.subarray(0,J)}function P(Q){if(Q.length<25)return!1;let $=(M,J)=>String.fromCharCode(...Q.subarray(M,J));if($(0,4)!=="RIFF"||$(8,12)!=="WEBP")return!1;let Z=$(12,16);if(Z==="VP8X")return(Q[20]&16)!==0;if(Z==="VP8L")return((Q[21]|Q[22]<<8|Q[23]<<16|Q[24]<<24)>>>28&1)===1;return!1}function m(Q){let $;try{$=R.openSync(Q,"r");let Z=T($,0,33);if(Z.length>=3&&Z[0]===255&&Z[1]===216&&Z[2]===255)return"none";if(Z.length>=26&&Z[0]===137&&Z.toString("latin1",1,4)==="PNG"){let M=Z[25];if(M===4||M===6)return"possible";let J=8;for(let X=0;X<64;X++){let G=T($,J,8);if(G.length<8)return"unknown";let Y=G.toString("latin1",4,8);if(Y==="tRNS")return"possible";if(Y==="IDAT"||Y==="IEND")return"none";J+=12+G.readUInt32BE(0)}return"unknown"}if(Z.length>=25&&Z.toString("latin1",0,4)==="RIFF"&&Z.toString("latin1",8,12)==="WEBP"){if(P(Z))return"possible";let M=Z.toString("latin1",12,16);return M==="VP8 "||M==="VP8X"?"none":"unknown"}return"unknown"}catch{return"unknown"}finally{if($!==void 0)R.closeSync($)}}import i from"fs";import O from"os";import{join as k}from"path";import{fileURLToPath as b}from"url";import{Worker as v}from"worker_threads";var I=Symbol("stx.image-worker.unavailable");function t(Q=typeof O.availableParallelism==="function"?O.availableParallelism():O.cpus().length){return Math.max(1,Math.min(2,Q-1))}var C=0,y=[];async function a(){if(C<t()){C++;return}await new Promise((Q)=>y.push(Q)),C++}function r(){C--,y.shift()?.()}var e="@stacksjs/stx/builtins/image-warmup-worker";function QQ(Q=process.cwd()){let $=import.meta.url.endsWith(".ts")?"ts":"js";try{let Z=new URL(`./image-warmup-worker.${$}`,import.meta.url);if(Z.protocol==="file:"&&i.existsSync(b(Z)))return b(Z)}catch{}try{let Z=typeof Bun<"u"?Bun.resolveSync(e,Q):void 0;return Z&&ZQ(Z)?Z:void 0}catch{return}}function ZQ(Q,$=process.env){let Z=Q.replace(/\\/g,"/");if(Z.split("/").some((J)=>/@\d[^/]*@@@\d+$/.test(J)))return!1;return![$.BUN_INSTALL_CACHE_DIR,k($.BUN_INSTALL||k(O.homedir(),".bun"),"install","cache")].filter((J)=>!!J).map((J)=>`${J.replace(/\\/g,"/").replace(/\/$/,"")}/`).some((J)=>Z.startsWith(J))}var g=!1;function N(Q){if(!g)g=!0,console.warn(`[stx] image worker unavailable (${Q}); running the image pass on the serving thread instead. Results are the same, but requests may stall while it runs.`);return I}function A(Q){return Q instanceof Error?Q.message:String(Q)}async function u(Q,$){if(typeof v!=="function")return N("node:worker_threads has no Worker in this runtime");let Z=QQ();if(!Z)return N("no image-warmup-worker entry beside this module or in the installed @stacksjs/stx");await a();try{return await new Promise((M,J)=>{let X;try{X=new v(Z)}catch(B){M(N(`could not start ${Z}: ${A(B)}`));return}let G=!1,Y=!1,q=(B)=>{if(Y)return;Y=!0,B(),X.terminate()};X.on("message",(B)=>{if(B.type==="ready"){G=!0,X.postMessage({task:Q,args:$});return}if(B.type==="result"){q(()=>M(B.value));return}let j=Error(B.error?.message??"image worker failed");if(B.error?.name)j.name=B.error.name;if(B.error?.stack)j.stack=B.error.stack;q(()=>J(j))}),X.on("error",(B)=>{q(()=>G?J(B instanceof Error?B:Error(A(B)||"image worker crashed")):M(N(`the worker failed before it was ready: ${A(B)}`)))}),X.on("exit",(B)=>{q(()=>G?J(Error("image worker exited before it finished")):M(N(`the worker exited with code ${B} before it was ready`)))})})}finally{r()}}var MQ=new Set([".avif",".jpeg",".jpg",".png",".webp"]),XQ=[320,640,960,1280,1920],L="/_stx/images",BQ=`stx:${L}:alpha-1`,GQ=["@stacksjs/ts-webp","@stacksjs/ts-avif"],W;function qQ(Q,$){let Z=K.dirname(Bun.resolveSync(Q,$));while(Z!==K.dirname(Z)){let M=K.join(Z,"package.json");if(x.existsSync(M)){let J=JSON.parse(x.readFileSync(M,"utf8"));if(J.name===Q)return J.version}Z=K.dirname(Z)}return}function bQ(Q){W=Q}function KQ(){if(W!==void 0)return W;let Q;try{Q=K.dirname(Bun.resolveSync("ts-images",import.meta.dir))}catch{}return W=GQ.map(($)=>{let Z;try{Z=Q?qQ($,Q):void 0}catch{}return`${$.replace("@stacksjs/","")}@${Z??"unknown"}`}).join("+"),W}var U=new Map,_=new Set,c=new Set;function YQ(Q){return`/${Q.split(K.sep).map(encodeURIComponent).join("/")}`}function xQ(Q){let $=K.extname(Q),Z=Q.slice(0,-$.length).replace(/[^a-zA-Z0-9_-]+/g,"-").replace(/^-+|-+$/g,""),M=n("sha256").update(Q).digest("hex").slice(0,8);return`${Z||"image"}-${M}`}function h(Q,$=`stx:${L}`){let Z=(M)=>`${L}/${M.split("/").map(encodeURIComponent).join("/")}`;return{cacheNamespace:$,async stat(M){let J=K.join(Q,M);try{let X=await x.promises.stat(J);return X.size>0?{bytes:X.size,path:J,url:Z(M)}:null}catch{return null}},async write(M,J){let X=K.join(Q,M);await x.promises.mkdir(K.dirname(X),{recursive:!0});let G=`${X}.${process.pid}.tmp`;return await x.promises.writeFile(G,J),await x.promises.rename(G,X),{bytes:J.byteLength,path:X,url:Z(M)}},url:Z}}async function l(Q,$=Q){let Z=await x.promises.readdir($,{withFileTypes:!0});Z.sort((J,X)=>J.name.localeCompare(X.name));let M=[];for(let J of Z){let X=K.join($,J.name);if(J.isDirectory()){M.push(...await l(Q,X));continue}if(!J.isFile()||!MQ.has(K.extname(J.name).toLowerCase()))continue;M.push({absolutePath:X,relativePath:K.relative(Q,X)})}return M}function p(Q,$){return Q.map((Z)=>({key:YQ(Z.relativePath),input:Z.absolutePath,name:xQ(Z.relativePath),...jQ(Z.absolutePath)?{options:{storage:$}}:{}}))}function jQ(Q){return m(Q)==="possible"}function zQ(Q){for(let $=3;$<Q.length;$+=4)if(Q[$]!==255)return!0;return!1}async function FQ(Q){let $=Object.entries(Q).filter(([,J])=>J.fallback.format==="png"),Z=new Set,M=8;for(let J=0;J<$.length;J+=8)await Promise.all($.slice(J,J+8).map(async([X,G])=>{let Y=G.variants.filter((q)=>q.format==="png").sort((q,B)=>q.width-B.width)[0];try{let q=await $Q(new Uint8Array(await x.promises.readFile(Y?.path??G.fallback.path)));if(zQ(q.data))Z.add(X)}catch{Z.add(X)}}));return Z}function VQ(Q,$){let Z=[];for(let M of $){let J=Q[M],X=J?.variants.filter((Y)=>Y.format==="webp")??[];if(!J||X.length===0)continue;if(!X.some((Y)=>{let q;try{return q=x.openSync(Y.path,"r"),!P(T(q,0,32))}catch{return!0}finally{if(q!==void 0)x.closeSync(q)}}))continue;if(J.variants=J.variants.filter((Y)=>Y.format!=="webp"),delete J.sources.webp,Z.push(M),!c.has(M))c.add(M),console.warn(`[stx-images] ${M} is transparent but its WebP variants have no alpha channel; serving PNG instead. Upgrade @stacksjs/ts-webp to 0.1.6 or later.`)}return Z}async function HQ(Q){let $=[],Z=8;for(let M=0;M<Q.length;M+=8){let J=Q.slice(M,M+8),X=await Promise.all(J.map(async(G)=>{try{return await JQ(G.absolutePath),G}catch{return console.warn(`[stx-images] Skipping unreadable raster: ${G.relativePath}`),null}}));$.push(...X.filter((G)=>G!==null))}return $}function E(Q){return K.join(Q,"undecodable.json")}function NQ(Q){try{let $=x.readFileSync(E(Q),"utf-8"),Z=JSON.parse($);return Z&&typeof Z==="object"?Z:{}}catch{return{}}}function OQ(Q,$){try{x.mkdirSync(K.dirname(E(Q)),{recursive:!0}),x.writeFileSync(E(Q),JSON.stringify($))}catch{}}function d(Q){try{let $=x.statSync(Q);return{mtimeMs:$.mtimeMs,size:$.size}}catch{return}}function o(Q){if(!Q||Q.startsWith("data:")||Q.startsWith("blob:")||/^https?:\/\//i.test(Q)||Q.startsWith("//"))return;let $=Q.split(/[?#]/,1)[0];if(!$)return;try{return`/${$.replace(/^\/+/,"").split("/").map(decodeURIComponent).map(encodeURIComponent).join("/")}`}catch{return}}function vQ(Q){let $=o(Q);return $?U.get($):void 0}function gQ(Q){let $=o(Q);return $?_.has($):!1}function S(){U=new Map,_=new Set}function yQ(){return{entries:[...U],transparent:[..._]}}function WQ(Q){U=new Map(Q.entries),_=new Set(Q.transparent)}async function uQ(Q,$,Z={}){if(!Q||!x.existsSync(Q))return S(),{count:0,fingerprint:""};if(Z.offThread){let z=await u("delivery",{publicDir:Q,outputDir:$});if(z!==I)return WQ(z.state),z.result}let M=await l(Q);if(M.length===0)return S(),{count:0,fingerprint:""};let J=NQ($),X=M.filter((z)=>{let V=J[z.relativePath];if(!V)return!0;let F=d(z.absolutePath);return!F||F.mtimeMs!==V.mtimeMs||F.size!==V.size});if(X.length===0)return S(),{count:0,fingerprint:""};let G=h(K.join($,"_stx","images"),`${BQ}:${KQ()}`),Y={outDir:K.join($,"_stx","images"),storage:h(K.join($,"_stx","images")),baseUrl:L,widths:XQ,formats:["avif","webp"],quality:{avif:70,webp:78,jpeg:82,png:100},includeOriginal:!1,placeholder:!0,batchConcurrency:4,concurrency:4},q=X,B;try{B=await f({...Y,entries:p(X,G)})}catch(z){if(q=await HQ(X),q.length===X.length)throw z;let V=new Set(q.map((H)=>H.relativePath)),F=!1;for(let H of X){if(V.has(H.relativePath))continue;let D=d(H.absolutePath);if(!D)continue;J[H.relativePath]=D,F=!0}if(F)OQ($,J);if(q.length===0)return S(),{count:0,fingerprint:""};B=await f({...Y,entries:p(q,G)})}let j=await FQ(B.entries),w=VQ(B.entries,j);U=new Map(Object.entries(B.entries)),_=j;let s=j.size===0&&w.length===0?B.fingerprint:n("sha256").update(B.fingerprint).update(JSON.stringify({transparent:[...j].sort(),droppedWebp:w.sort()})).digest("hex");return{count:q.length,fingerprint:s}}
3
- export{P as tt,m as ut,I as vt,u as wt,bQ as xt,KQ as yt,vQ as zt,gQ as At,S as Bt,yQ as Ct,WQ as Dt,uQ as Et};
3
+ export{P as ut,m as vt,I as wt,u as xt,bQ as yt,KQ as zt,vQ as At,gQ as Bt,S as Ct,yQ as Dt,WQ as Et,uQ as Ft};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
2
  var{defineProperty:e,getOwnPropertyNames:g,getOwnPropertyDescriptor:h}=Object,i=Object.prototype.hasOwnProperty;function j(a){return this[a]}var m=(a)=>{var b=(f??=new WeakMap).get(a),c;if(b)return b;if(b=e({},"__esModule",{value:!0}),a&&typeof a==="object"||typeof a==="function"){for(var d of g(a))if(!i.call(b,d))e(b,d,{get:j.bind(a,d),enumerable:!(c=h(a,d))||c.enumerable})}return f.set(a,b),b},f;var k=(a)=>a;function l(a,b){this[a]=k.bind(null,b)}var n=(a,b)=>{for(var c in b)e(a,c,{get:b[c],enumerable:!0,configurable:!0,set:l.bind(b,c)})};var o=(a,b)=>()=>(a&&(b=a(a=0)),b);var p=import.meta.require;
3
- export{m as Ow,n as Pw,o as Qw,p as Rw};
3
+ export{m as Pw,n as Qw,o as Rw,p as Sw};
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{Ot as a,Pt as b,Qt as c,Rt as d,St as e,Tt as f,Ut as g,Vt as h,Wt as i,Xt as j,Yt as k,Zt as l}from"./chunk-hkrzv980.js";import"./chunk-qbz6yn8c.js";import"./chunk-czj6nq0b.js";import"./chunk-emjmshj8.js";export{f as structuredDataDirective,j as scanForSitemapEntries,g as registerSeoDirectives,b as processStructuredData,c as processSeoDirective,a as processMetaDirectives,e as metaDirective,d as injectSeoTags,i as generateSitemapIndex,h as generateSitemap,k as generateRobotsTxt,l as generateDefaultRobotsTxt};
2
+ import{Pt as a,Qt as b,Rt as c,St as d,Tt as e,Ut as f,Vt as g,Wt as h,Xt as i,Yt as j,Zt as k,_t as l}from"./chunk-dnard9gp.js";import"./chunk-vgx5077x.js";import"./chunk-met6wtbk.js";import"./chunk-m8kem5ca.js";export{f as structuredDataDirective,j as scanForSitemapEntries,g as registerSeoDirectives,b as processStructuredData,c as processSeoDirective,a as processMetaDirectives,e as metaDirective,d as injectSeoTags,i as generateSitemapIndex,h as generateSitemap,k as generateRobotsTxt,l as generateDefaultRobotsTxt};