@stacksjs/stx 0.2.5 → 0.2.6

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 (293) hide show
  1. package/dist/a11y.d.ts +2 -6
  2. package/dist/analytics.d.ts +1 -1
  3. package/dist/analyzer.d.ts +1 -1
  4. package/dist/animation.d.ts +10 -86
  5. package/dist/app.d.ts +2 -4
  6. package/dist/assets.d.ts +1 -1
  7. package/dist/ast.d.ts +3 -24
  8. package/dist/async-components.d.ts +1 -1
  9. package/dist/auth.d.ts +1 -1
  10. package/dist/browser-composables.d.ts +6 -4
  11. package/dist/build-optimizer.d.ts +4 -29
  12. package/dist/build-views.d.ts +20 -1
  13. package/dist/bundle-analyzer/collector.d.ts +1 -1
  14. package/dist/bundle-analyzer/index.d.ts +40 -4
  15. package/dist/bundle-analyzer/report.d.ts +1 -1
  16. package/dist/bundle-analyzer/treemap.d.ts +1 -1
  17. package/dist/caching.d.ts +1 -1
  18. package/dist/cli.js +1323 -511
  19. package/dist/client/directive.d.ts +1 -1
  20. package/dist/client/index.d.ts +6 -1
  21. package/dist/client/router.d.ts +3 -11
  22. package/dist/client/stx-router.browser.d.ts +1 -0
  23. package/dist/client-script.d.ts +2 -1
  24. package/dist/client.d.ts +2 -2
  25. package/dist/component-hmr.d.ts +4 -18
  26. package/dist/components.d.ts +1 -1
  27. package/dist/composables/index.d.ts +114 -1
  28. package/dist/composables/use-battery.d.ts +1 -1
  29. package/dist/composables/use-broadcast-channel.d.ts +2 -2
  30. package/dist/composables/use-clipboard.d.ts +1 -1
  31. package/dist/composables/use-color-mode.d.ts +52 -0
  32. package/dist/composables/use-cookie.d.ts +1 -1
  33. package/dist/composables/use-device-orientation.d.ts +1 -1
  34. package/dist/composables/use-event-listener.d.ts +35 -0
  35. package/dist/composables/use-event-source.d.ts +1 -1
  36. package/dist/composables/use-eye-dropper.d.ts +3 -2
  37. package/dist/composables/use-fetch.d.ts +1 -1
  38. package/dist/composables/use-fullscreen.d.ts +1 -1
  39. package/dist/composables/use-geolocation.d.ts +1 -1
  40. package/dist/composables/use-idle.d.ts +2 -2
  41. package/dist/composables/use-intersection-observer.d.ts +1 -1
  42. package/dist/composables/use-keyboard.d.ts +1 -2
  43. package/dist/composables/use-media-query.d.ts +1 -1
  44. package/dist/composables/use-meta.d.ts +35 -0
  45. package/dist/composables/use-mouse.d.ts +1 -1
  46. package/dist/composables/use-mutation-observer.d.ts +1 -1
  47. package/dist/composables/use-network.d.ts +1 -1
  48. package/dist/composables/use-notification.d.ts +10 -1
  49. package/dist/composables/use-permissions.d.ts +17 -7
  50. package/dist/composables/use-query.d.ts +43 -0
  51. package/dist/composables/use-resize-observer.d.ts +1 -1
  52. package/dist/composables/use-router.d.ts +59 -0
  53. package/dist/composables/use-share.d.ts +1 -1
  54. package/dist/composables/use-speech.d.ts +1 -1
  55. package/dist/composables/use-storage.d.ts +1 -1
  56. package/dist/composables/use-text-selection.d.ts +1 -1
  57. package/dist/composables/use-timer.d.ts +92 -0
  58. package/dist/composables/use-utilities.d.ts +103 -0
  59. package/dist/composables/use-wake-lock.d.ts +1 -1
  60. package/dist/composables/use-websocket.d.ts +3 -3
  61. package/dist/composables/use-window.d.ts +1 -1
  62. package/dist/composables.d.ts +10 -7
  63. package/dist/composition-api.d.ts +1 -14
  64. package/dist/computed.d.ts +10 -4
  65. package/dist/conditionals.d.ts +1 -1
  66. package/dist/config.d.ts +1 -1
  67. package/dist/craft-bridge.d.ts +1 -1
  68. package/dist/craft-compiler.d.ts +6 -3
  69. package/dist/craft-components.d.ts +1 -8
  70. package/dist/craft-entry.d.ts +1 -1
  71. package/dist/craft-ssr.d.ts +1 -1
  72. package/dist/csp.d.ts +2 -2
  73. package/dist/csrf.d.ts +1 -1
  74. package/dist/custom-directives.d.ts +1 -1
  75. package/dist/database.d.ts +8 -26
  76. package/dist/defer.d.ts +1 -1
  77. package/dist/deploy/config-generators.d.ts +1 -1
  78. package/dist/deploy/index.d.ts +6 -3
  79. package/dist/deploy/netlify.d.ts +1 -1
  80. package/dist/dev-server/crosswind.d.ts +11 -1
  81. package/dist/dev-server/index.d.ts +16 -1
  82. package/dist/dev-server/keyboard-shortcuts.d.ts +1 -1
  83. package/dist/dev-server/native-window.d.ts +1 -1
  84. package/dist/dev-server/port-utils.d.ts +2 -2
  85. package/dist/dev-server/terminal-colors.d.ts +1 -5
  86. package/dist/dev-server/theme-selector.d.ts +1 -1
  87. package/dist/dev-server/types.d.ts +3 -8
  88. package/dist/dev-server.d.ts +1 -4
  89. package/dist/devtools.d.ts +4 -1
  90. package/dist/directive-api.d.ts +3 -3
  91. package/dist/docs.d.ts +2 -2
  92. package/dist/dynamic-components.d.ts +1 -1
  93. package/dist/edge-runtime.d.ts +3 -3
  94. package/dist/env.d.ts +1 -1
  95. package/dist/error-boundaries.d.ts +1 -1
  96. package/dist/error-handling.d.ts +14 -1
  97. package/dist/errors/codes.d.ts +2 -17
  98. package/dist/errors/formatter.d.ts +1 -1
  99. package/dist/errors/index.d.ts +13 -1
  100. package/dist/errors/logger.d.ts +2 -15
  101. package/dist/errors/sanitizer.d.ts +1 -1
  102. package/dist/errors/types.d.ts +1 -1
  103. package/dist/events.d.ts +1 -1
  104. package/dist/expressions.d.ts +64 -90
  105. package/dist/formatter.d.ts +1 -1
  106. package/dist/forms-validation.d.ts +23 -24
  107. package/dist/forms.d.ts +5 -22
  108. package/dist/head.d.ts +5 -1
  109. package/dist/heatmap.d.ts +4 -7
  110. package/dist/hot-reload.d.ts +3 -8
  111. package/dist/hydration-runtime.d.ts +1 -1
  112. package/dist/hydration.d.ts +5 -32
  113. package/dist/i18n.d.ts +1 -9
  114. package/dist/image-optimization/build-plugin.d.ts +2 -2
  115. package/dist/image-optimization/component.d.ts +2 -2
  116. package/dist/image-optimization/directive.d.ts +2 -2
  117. package/dist/image-optimization/index.d.ts +55 -1
  118. package/dist/image-optimization/processor.d.ts +9 -4
  119. package/dist/includes.d.ts +1 -1
  120. package/dist/index.d.ts +29 -1
  121. package/dist/index.js +1387 -542
  122. package/dist/init.d.ts +1 -1
  123. package/dist/interactive.d.ts +1 -1
  124. package/dist/internal-markdown.d.ts +1 -1
  125. package/dist/js-ts.d.ts +1 -1
  126. package/dist/jsx-runtime.d.ts +1 -20
  127. package/dist/keep-alive.d.ts +1 -1
  128. package/dist/lazy-loader.d.ts +3 -35
  129. package/dist/loading-indicator.d.ts +2 -1
  130. package/dist/loops.d.ts +1 -1
  131. package/dist/markdown.d.ts +1 -1
  132. package/dist/media/client/blur-up.d.ts +1 -1
  133. package/dist/media/client/index.d.ts +17 -1
  134. package/dist/media/client/lazy-load.d.ts +1 -1
  135. package/dist/media/client/upload-handler.d.ts +1 -1
  136. package/dist/media/image/component.d.ts +2 -4
  137. package/dist/media/image/directive.d.ts +1 -1
  138. package/dist/media/image/editing.d.ts +1 -1
  139. package/dist/media/image/index.d.ts +25 -1
  140. package/dist/media/image/placeholder.d.ts +1 -1
  141. package/dist/media/image/processor/cache.d.ts +3 -4
  142. package/dist/media/image/processor/index.d.ts +9 -1
  143. package/dist/media/image/processor/optimizer.d.ts +2 -2
  144. package/dist/media/image/processor/responsive.d.ts +3 -2
  145. package/dist/media/image/srcset.d.ts +6 -4
  146. package/dist/media/index.d.ts +37 -1
  147. package/dist/media/manager/embed.d.ts +1 -1
  148. package/dist/media/protected/component.d.ts +2 -3
  149. package/dist/media/protected/index.d.ts +14 -1
  150. package/dist/media/protected/signature.d.ts +2 -2
  151. package/dist/media/shared/cache.d.ts +1 -1
  152. package/dist/media/shared/hash.d.ts +1 -1
  153. package/dist/media/shared/index.d.ts +6 -1
  154. package/dist/media/types.d.ts +16 -72
  155. package/dist/media/upload/component.d.ts +2 -16
  156. package/dist/media/upload/index.d.ts +8 -1
  157. package/dist/media/video/directive.d.ts +1 -1
  158. package/dist/media/video/index.d.ts +11 -2
  159. package/dist/media/video/processor/cache.d.ts +3 -4
  160. package/dist/media/video/processor/index.d.ts +9 -1
  161. package/dist/media/video/processor/streaming.d.ts +2 -2
  162. package/dist/media/video/processor/thumbnail.d.ts +2 -2
  163. package/dist/media/video/processor/transcoder.d.ts +2 -2
  164. package/dist/method-spoofing.d.ts +1 -1
  165. package/dist/middleware.d.ts +1 -1
  166. package/dist/native-build.d.ts +3 -6
  167. package/dist/parser/directive-parser.d.ts +1 -1
  168. package/dist/parser/expression-parser.d.ts +2 -1
  169. package/dist/parser/index.d.ts +14 -1
  170. package/dist/parser/tokenizer.d.ts +2 -18
  171. package/dist/partial-hydration.d.ts +5 -6
  172. package/dist/performance-utils.d.ts +5 -18
  173. package/dist/plugin-system.d.ts +2 -8
  174. package/dist/plugin.d.ts +1 -1
  175. package/dist/precompiler.d.ts +2 -67
  176. package/dist/process.d.ts +12 -2
  177. package/dist/production-build.d.ts +1 -37
  178. package/dist/props.d.ts +3 -30
  179. package/dist/pwa/audit.d.ts +1 -1
  180. package/dist/pwa/directives.d.ts +1 -1
  181. package/dist/pwa/icons.d.ts +7 -4
  182. package/dist/pwa/index.d.ts +46 -1
  183. package/dist/pwa/inject.d.ts +1 -1
  184. package/dist/pwa/manifest.d.ts +1 -1
  185. package/dist/pwa/offline.d.ts +1 -1
  186. package/dist/pwa/precache.d.ts +1 -1
  187. package/dist/pwa/service-worker.d.ts +1 -1
  188. package/dist/pwa/workbox-strategies.d.ts +1 -1
  189. package/dist/pwa/workbox.d.ts +1 -10
  190. package/dist/pwa.d.ts +1 -1
  191. package/dist/pwa.js +1242 -430
  192. package/dist/reactive-bindings.d.ts +1 -1
  193. package/dist/reactive.d.ts +1 -1
  194. package/dist/reactivity.d.ts +6 -50
  195. package/dist/release.d.ts +1 -1
  196. package/dist/route-middleware.d.ts +3 -3
  197. package/dist/router.d.ts +1 -1
  198. package/dist/routes.d.ts +2 -2
  199. package/dist/runtime.d.ts +4 -4
  200. package/dist/safe-evaluator.d.ts +1 -4
  201. package/dist/scaffolding.d.ts +1 -1
  202. package/dist/seo.d.ts +1 -5
  203. package/dist/serve.d.ts +1 -1
  204. package/dist/server-components.d.ts +1 -1
  205. package/dist/signals.d.ts +8 -168
  206. package/dist/slots.d.ts +2 -2
  207. package/dist/source-maps.d.ts +3 -22
  208. package/dist/spa-shell.d.ts +20 -0
  209. package/dist/ssg.d.ts +4 -6
  210. package/dist/ssg.js +1242 -430
  211. package/dist/ssr.d.ts +6 -14
  212. package/dist/state-management.d.ts +5 -45
  213. package/dist/stores-client.d.ts +3 -3
  214. package/dist/story/addons.d.ts +1 -1
  215. package/dist/story/analytics.d.ts +4 -11
  216. package/dist/story/auto-stories.d.ts +1 -1
  217. package/dist/story/bookmarks.d.ts +2 -6
  218. package/dist/story/bun-test.d.ts +1 -1
  219. package/dist/story/cli.d.ts +0 -25
  220. package/dist/story/collect/analyzer.d.ts +1 -1
  221. package/dist/story/collect/index.d.ts +5 -1
  222. package/dist/story/collect/parser.d.ts +1 -1
  223. package/dist/story/collect/scanner.d.ts +1 -1
  224. package/dist/story/collect/tree.d.ts +2 -2
  225. package/dist/story/commands/build.d.ts +1 -1
  226. package/dist/story/commands/dev.d.ts +1 -1
  227. package/dist/story/commands/index.d.ts +4 -1
  228. package/dist/story/commands/preview.d.ts +1 -1
  229. package/dist/story/compiled-output.d.ts +1 -1
  230. package/dist/story/composition.d.ts +1 -1
  231. package/dist/story/config-watcher.d.ts +1 -1
  232. package/dist/story/config.d.ts +2 -2
  233. package/dist/story/context.d.ts +1 -1
  234. package/dist/story/controls/index.d.ts +1 -1
  235. package/dist/story/crosswind.d.ts +1 -1
  236. package/dist/story/desktop-preview.d.ts +1 -1
  237. package/dist/story/docs-generator.d.ts +1 -1
  238. package/dist/story/errors.d.ts +1 -1
  239. package/dist/story/figma-export.d.ts +2 -2
  240. package/dist/story/generator.d.ts +1 -1
  241. package/dist/story/hmr.d.ts +1 -1
  242. package/dist/story/hot-swap.d.ts +1 -1
  243. package/dist/story/index.d.ts +49 -1
  244. package/dist/story/interactions.d.ts +1 -1
  245. package/dist/story/keyboard-shortcuts.d.ts +1 -1
  246. package/dist/story/output.d.ts +1 -1
  247. package/dist/story/performance.d.ts +3 -12
  248. package/dist/story/presets.d.ts +3 -8
  249. package/dist/story/props-validation.d.ts +11 -1
  250. package/dist/story/renderer.d.ts +1 -1
  251. package/dist/story/search-index.d.ts +2 -2
  252. package/dist/story/search.d.ts +2 -2
  253. package/dist/story/server.d.ts +1 -1
  254. package/dist/story/setup.d.ts +1 -1
  255. package/dist/story/snapshots.d.ts +1 -1
  256. package/dist/story/testing.d.ts +1 -1
  257. package/dist/story/theme.d.ts +1 -1
  258. package/dist/story/types.d.ts +3 -12
  259. package/dist/story/ui/code-panel.d.ts +1 -1
  260. package/dist/story/ui/controls-panel.d.ts +1 -1
  261. package/dist/story/ui/index.d.ts +5 -1
  262. package/dist/story/ui/navigation.d.ts +1 -1
  263. package/dist/story/ui/preview.d.ts +1 -1
  264. package/dist/story/visual-testing.d.ts +1 -1
  265. package/dist/streaming.d.ts +0 -59
  266. package/dist/suspense.d.ts +1 -1
  267. package/dist/teleport.d.ts +1 -1
  268. package/dist/testing.d.ts +62 -80
  269. package/dist/transitions.d.ts +1 -1
  270. package/dist/type-checker.d.ts +2 -26
  271. package/dist/types/component-types.d.ts +3 -3
  272. package/dist/types/config-types.d.ts +15 -30
  273. package/dist/types/context-types.d.ts +6 -5
  274. package/dist/types/csp-types.d.ts +2 -2
  275. package/dist/types/directive-types.d.ts +5 -5
  276. package/dist/types/index.d.ts +21 -1
  277. package/dist/types/pwa-types.d.ts +1 -6
  278. package/dist/types.d.ts +28 -1
  279. package/dist/typescript-templates.d.ts +1 -34
  280. package/dist/utils.d.ts +2 -1
  281. package/dist/validator.d.ts +1 -1
  282. package/dist/variable-extractor.d.ts +1 -1
  283. package/dist/view-composers.d.ts +1 -1
  284. package/dist/virtual-scrolling.d.ts +4 -1
  285. package/dist/visual-editor.d.ts +2 -30
  286. package/dist/visual-testing.d.ts +4 -1
  287. package/dist/vue-template.d.ts +1 -1
  288. package/dist/web-components/css-scoping.d.ts +1 -1
  289. package/dist/web-components/index.d.ts +10 -1
  290. package/dist/web-components/reactive-generator.d.ts +1 -1
  291. package/dist/web-components.d.ts +1 -1
  292. package/dist/x-element.d.ts +13 -6
  293. package/package.json +4 -4
package/dist/ssg.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // @bun
2
- var t3=Object.defineProperty;var t=(Z,$)=>{for(var Y in $)t3(Z,Y,{get:$[Y],enumerable:!0,configurable:!0,set:(J)=>$[Y]=()=>J})};var I=(Z,$)=>()=>(Z&&($=Z(Z=0)),$);var KZ=import.meta.require;var UZ;var a7=I(()=>{UZ={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});import Z0 from"fs";import _Z from"path";async function e7(Z){try{let $=await import(Z);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig}}catch{}return null}function $1(){let Z=[],$=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==_Z.dirname(Y))Z.push(_Z.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),Z.push(_Z.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),Z.push(_Z.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=_Z.dirname(Y);if($){let J=[_Z.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),_Z.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),_Z.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),_Z.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),_Z.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),_Z.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];Z.push(...J)}return Z.push(_Z.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),Z.push(_Z.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),Z}async function Y1(){if(t7)return Q4;t7=!0;try{let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let J=await e7(Y);if(J)return Q4=J,console.log(`${UZ.green}[Crosswind]${UZ.reset} CSS engine loaded`),Q4}let $=$1();for(let Y of $)if(Z0.existsSync(Y)){let J=await e7(Y);if(J)return Q4=J,console.log(`${UZ.green}[Crosswind]${UZ.reset} CSS engine loaded from ${_Z.dirname(_Z.dirname(Y))}`),Q4}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${UZ.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${UZ.reset}`),console.warn(`${UZ.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${UZ.reset}`),null}}async function J1(Z){let $=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs"];for(let Y of $){let J=_Z.join(Z,Y);if(Z0.existsSync(J))try{let G=await import(J),X=G.default||G;return console.log(`${UZ.green}[Crosswind]${UZ.reset} Loaded config from ${Y}`),X}catch(G){console.warn(`${UZ.yellow}[Crosswind]${UZ.reset} Failed to load ${Y}:`,G)}}return null}function X1(Z){let $=/class\s*=\s*["']([^"']+)["']/gi,Y=new Set,J=$.exec(Z);while(J!==null){let G=J[1];for(let X of G.split(/\s+/))if(X.trim())Y.add(X.trim());J=$.exec(Z)}return Y}async function G1(Z){try{let $=await Y1();if(!$)return"";let Y=X1(Z);if(Y.size===0)return"";if(!L5)L5=await J1(process.cwd());let J=$.defaultConfig||$.config,G=L5||{},X=J.theme||{},K=(G.theme||{}).extend||{},q={...X};if(Object.keys(K).length>0)q.extend=K;let _=[...J.safelist||[],...G.safelist||[]],j={...J,...G,content:[],output:"",preflight:!0,minify:!1,theme:q,safelist:_},B=new $.CSSGenerator(j);for(let W of _)B.generate(W);for(let W of Y)B.generate(W);return B.toCSS(!0,!1)}catch($){return console.warn("Failed to generate Crosswind CSS:",$),""}}async function $0(Z){let $=await G1(Z);if(!$)return Z;let Y=`<style data-crosswind="generated">
2
+ var $1=Object.defineProperty;var ZZ=(Z,$)=>{for(var Y in $)$1(Z,Y,{get:$[Y],enumerable:!0,configurable:!0,set:(J)=>$[Y]=()=>J})};var I=(Z,$)=>()=>(Z&&($=Z(Z=0)),$);var qZ=import.meta.require;var OZ;var t7=I(()=>{OZ={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});import $0 from"fs";import jZ from"path";async function Z0(Z){try{let $=await import(Z);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig}}catch{}return null}function X1(){let Z=[],$=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==jZ.dirname(Y))Z.push(jZ.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),Z.push(jZ.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),Z.push(jZ.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=jZ.dirname(Y);if($){let J=[jZ.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),jZ.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),jZ.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),jZ.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),jZ.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),jZ.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];Z.push(...J)}return Z.push(jZ.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),Z.push(jZ.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),Z}async function G1(){if(e7)return Q4;e7=!0;try{let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let J=await Z0(Y);if(J)return Q4=J,console.log(`${OZ.green}[Crosswind]${OZ.reset} CSS engine loaded`),Q4}let $=X1();for(let Y of $)if($0.existsSync(Y)){let J=await Z0(Y);if(J)return Q4=J,console.log(`${OZ.green}[Crosswind]${OZ.reset} CSS engine loaded from ${jZ.dirname(jZ.dirname(Y))}`),Q4}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${OZ.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${OZ.reset}`),console.warn(`${OZ.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${OZ.reset}`),null}}async function Q1(Z){let $=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs"];for(let Y of $){let J=jZ.join(Z,Y);if($0.existsSync(J))try{let G=await import(J),X=G.default||G;return console.log(`${OZ.green}[Crosswind]${OZ.reset} Loaded config from ${Y}`),X}catch(G){console.warn(`${OZ.yellow}[Crosswind]${OZ.reset} Failed to load ${Y}:`,G)}}return null}function K1(Z){let $=/class\s*=\s*["']([^"']+)["']/gi,Y=new Set,J=$.exec(Z);while(J!==null){let G=J[1];for(let X of G.split(/\s+/))if(X.trim())Y.add(X.trim());J=$.exec(Z)}return Y}async function q1(Z){try{let $=await G1();if(!$)return"";let Y=K1(Z);if(Y.size===0)return"";if(!A5)A5=await Q1(process.cwd());let J=$.defaultConfig||$.config,G=A5||{},X=J.theme||{},K=(G.theme||{}).extend||{},q={...X};if(Object.keys(K).length>0)q.extend=K;let _=[...J.safelist||[],...G.safelist||[]],j={...J,...G,content:[],output:"",preflight:!0,minify:!1,theme:q,safelist:_},B=new $.CSSGenerator(j);for(let W of _)B.generate(W);for(let W of Y)B.generate(W);return B.toCSS(!0,!1)}catch($){return console.warn("Failed to generate Crosswind CSS:",$),""}}async function Y0(Z){let $=await q1(Z);if(!$)return Z;let Y=`<style data-crosswind="generated">
3
3
  ${$}
4
4
  </style>`;if(Z.includes("</head>"))return Z.replace("</head>",`${Y}
5
5
  </head>`);if(Z.includes("<body"))return Z.replace(/<body([^>]*)>/,`<body$1>
6
- ${Y}`);return Y+Z}var Q4=null,t7=!1,L5=null;var Y0=I(()=>{a7()});function J0(Z,$,Y,J){let G=Z;G=G.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,K,q)=>{let j={"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"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||j} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return G=G.replace(X,(Q,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),G=G.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),G}var X0,G0;var F5=I(()=>{X0={name:"a11y",handler:(Z,$,Y,J)=>{if(!$.length)return Z;let G=$[0].replace(/['"]/g,""),X=$.length>1?$[1].replace(/['"]/g,""):"",K={"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"}[G]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${Z}`},hasEndTag:!1},G0={name:"screenReader",handler:(Z)=>{return`<span class="sr-only">${Z}</span>`},hasEndTag:!0}});function Q0(){return`
6
+ ${Y}`);return Y+Z}var Q4=null,e7=!1,A5=null;var J0=I(()=>{t7()});function X0(Z,$,Y,J){let G=Z;G=G.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,K,q)=>{let j={"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"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||j} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return G=G.replace(X,(Q,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),G=G.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),G}var G0,Q0;var N5=I(()=>{G0={name:"a11y",handler:(Z,$,Y,J)=>{if(!$.length)return Z;let G=$[0].replace(/['"]/g,""),X=$.length>1?$[1].replace(/['"]/g,""):"",K={"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"}[G]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${Z}`},hasEndTag:!1},Q0={name:"screenReader",handler:(Z)=>{return`<span class="sr-only">${Z}</span>`},hasEndTag:!0}});function K0(){return`
7
7
  // STX Lifecycle Runtime
8
8
  (function() {
9
9
  if (typeof window === 'undefined') return;
@@ -335,7 +335,7 @@ ${Y}`);return Y+Z}var Q4=null,t7=!1,L5=null;var Y0=I(()=>{a7()});function J0(Z,$
335
335
 
336
336
  console.log('[stx] Lifecycle runtime initialized');
337
337
  })();
338
- `}function A5(Z){return Symbol(Z)}var xG,vG,fG;var K0=I(()=>{xG=A5("theme"),vG=A5("router"),fG=A5("i18n")});import*as _0 from"crypto";function q0(Z){let $=/\$(\w+)\./g,Y=[],J;while((J=$.exec(Z))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function Q1(){return`stx-${_0.randomBytes(4).toString("hex")}`}function K1(Z){return/\$\w+\./.test(Z)}function q1(Z){let $=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,G=Z;return G=G.replace(J,(X,Q,K,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return X;let _=[],j=!1,B=K,W=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,U=[...K.matchAll(W)];for(let L of U){let F=L[0],O=L[1],A=L[2];if(K1(A)){j=!0;let M=A.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(M){let V=M[1];if(_.push({attr:O,expr:V,fullMatch:F,originalAttr:O}),q0(V).forEach((N)=>Y.add(N)),O==="text")B=B.replace(F,"");else if(O==="class")B=B.replace(F,'class=""');else if(O==="disabled"||O==="hidden")B=B.replace(F,"");else B=B.replace(F,`${O}=""`)}}}if(!j)return X;let z=B.match(/\bid\s*=\s*"([^"]+)"/),H;if(z)H=z[1];else H=Q1(),B=` id="${H}"${B}`;for(let L of _)$.push({elementId:H,attribute:L.attr,expression:L.expr,stores:q0(L.expr)});return`<${Q}${B}${q}`}),{html:G,bindings:$,stores:Y}}function _1(Z,$){if(Z.length===0)return"";let Y=Array.from($),J=`
338
+ `}function R5(Z){return Symbol(Z)}var hG,dG,mG;var q0=I(()=>{hG=R5("theme"),dG=R5("router"),mG=R5("i18n")});import*as j0 from"crypto";function _0(Z){let $=/\$(\w+)\./g,Y=[],J;while((J=$.exec(Z))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function _1(){return`stx-${j0.randomBytes(4).toString("hex")}`}function j1(Z){return/\$\w+\./.test(Z)}function B1(Z){let $=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,G=Z;return G=G.replace(J,(X,Q,K,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return X;let _=[],j=!1,B=K,W=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,U=[...K.matchAll(W)];for(let F of U){let O=F[0],L=F[1],A=F[2];if(j1(A)){j=!0;let M=A.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(M){let V=M[1];if(_.push({attr:L,expr:V,fullMatch:O,originalAttr:L}),_0(V).forEach((R)=>Y.add(R)),L==="text")B=B.replace(O,"");else if(L==="class")B=B.replace(O,'class=""');else if(L==="disabled"||L==="hidden")B=B.replace(O,"");else B=B.replace(O,`${L}=""`)}}}if(!j)return X;let z=B.match(/\bid\s*=\s*"([^"]+)"/),H;if(z)H=z[1];else H=_1(),B=` id="${H}"${B}`;for(let F of _)$.push({elementId:H,attribute:F.attr,expression:F.expr,stores:_0(F.expr)});return`<${Q}${B}${q}`}),{html:G,bindings:$,stores:Y}}function W1(Z,$){if(Z.length===0)return"";let Y=Array.from($),J=`
339
339
  <script>
340
340
  (function() {
341
341
  'use strict';
@@ -448,10 +448,10 @@ ${Y}`);return Y+Z}var Q4=null,t7=!1,L5=null;var Y0=I(()=>{a7()});function J0(Z,$
448
448
  }
449
449
  })();
450
450
  </script>
451
- `,J}function j0(Z){let{html:$,bindings:Y,stores:J}=q1(Z);if(Y.length===0)return Z;let G=_1(Y,J);if($.includes("</body>"))return $.replace("</body>",`${G}</body>`);return $+G}var B0=()=>{};function j1(Z){let $=Z.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return B1($);case"google-analytics":return W1($);case"plausible":return z1($);case"self-hosted":return U1($);case"custom":return H1($);default:return""}}function B1(Z){let $=Z.fathom;if(!$?.siteId)return"";let Y=$.scriptUrl||"https://cdn.usefathom.com/script.js",J=$.defer!==!1?" defer":"",G=[`data-site="${HZ($.siteId)}"`];if($.honorDnt)G.push('data-honor-dnt="true"');if($.spa)G.push('data-spa="auto"');if($.canonical)G.push(`data-canonical="${HZ($.canonical)}"`);if($.auto===!1)G.push('data-auto="false"');return`
451
+ `,J}function B0(Z){let{html:$,bindings:Y,stores:J}=B1(Z);if(Y.length===0)return Z;let G=W1(Y,J);if($.includes("</body>"))return $.replace("</body>",`${G}</body>`);return $+G}var W0=()=>{};function z1(Z){let $=Z.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return U1($);case"google-analytics":return H1($);case"plausible":return O1($);case"self-hosted":return L1($);case"custom":return F1($);default:return""}}function U1(Z){let $=Z.fathom;if(!$?.siteId)return"";let Y=$.scriptUrl||"https://cdn.usefathom.com/script.js",J=$.defer!==!1?" defer":"",G=[`data-site="${LZ($.siteId)}"`];if($.honorDnt)G.push('data-honor-dnt="true"');if($.spa)G.push('data-spa="auto"');if($.canonical)G.push(`data-canonical="${LZ($.canonical)}"`);if($.auto===!1)G.push('data-auto="false"');return`
452
452
  <!-- Fathom Analytics -->
453
- <script src="${HZ(Y)}" ${G.join(" ")}${J}></script>
454
- `}function W1(Z){let $=Z.googleAnalytics;if(!$?.measurementId)return"";let Y=HZ($.measurementId),J=$.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
453
+ <script src="${LZ(Y)}" ${G.join(" ")}${J}></script>
454
+ `}function H1(Z){let $=Z.googleAnalytics;if(!$?.measurementId)return"";let Y=LZ($.measurementId),J=$.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
455
455
  <!-- Google Analytics -->
456
456
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
457
457
  <script>
@@ -461,10 +461,10 @@ ${Y}`);return Y+Z}var Q4=null,t7=!1,L5=null;var Y0=I(()=>{a7()});function J0(Z,$
461
461
  gtag('config', '${Y}');
462
462
  ${J}
463
463
  </script>
464
- `}function z1(Z){let $=Z.plausible;if(!$?.domain)return"";let Y=$.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${HZ($.domain)}"`],G=Y,X=[];if($.trackLocalhost)X.push("local");if($.hashMode)X.push("hash");if(X.length>0&&Y==="https://plausible.io/js/script.js")G=`https://plausible.io/js/script.${X.join(".")}.js`;return`
464
+ `}function O1(Z){let $=Z.plausible;if(!$?.domain)return"";let Y=$.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${LZ($.domain)}"`],G=Y,X=[];if($.trackLocalhost)X.push("local");if($.hashMode)X.push("hash");if(X.length>0&&Y==="https://plausible.io/js/script.js")G=`https://plausible.io/js/script.${X.join(".")}.js`;return`
465
465
  <!-- Plausible Analytics -->
466
- <script defer data-domain="${HZ($.domain)}" src="${HZ(G)}"></script>
467
- `}function U1(Z){let $=Z.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Y=HZ($.siteId),J=HZ($.apiEndpoint),G=$.honorDnt?'if(n.doNotTrack==="1")return;':"",X=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
466
+ <script defer data-domain="${LZ($.domain)}" src="${LZ(G)}"></script>
467
+ `}function L1(Z){let $=Z.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Y=LZ($.siteId),J=LZ($.apiEndpoint),G=$.honorDnt?'if(n.doNotTrack==="1")return;':"",X=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
468
468
  d.addEventListener('click',function(e){
469
469
  var a=e.target.closest('a');
470
470
  if(a&&a.hostname!==location.hostname){
@@ -497,15 +497,15 @@ ${Y}`);return Y+Z}var Q4=null,t7=!1,L5=null;var Y0=I(()=>{a7()});function J0(Z,$
497
497
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
498
498
  })();
499
499
  </script>
500
- `}function H1(Z){let $=Z.custom;if(!$)return"";if($.inlineScript)return`
500
+ `}function F1(Z){let $=Z.custom;if(!$)return"";if($.inlineScript)return`
501
501
  <!-- Custom Analytics -->
502
502
  <script>
503
503
  ${$.inlineScript}
504
504
  </script>
505
- `;if(!$.scriptUrl)return"";let Y=[];if($.scriptId)Y.push(`id="${HZ($.scriptId)}"`);if($.attributes)for(let[G,X]of Object.entries($.attributes))Y.push(`${HZ(G)}="${HZ(X)}"`);return`
505
+ `;if(!$.scriptUrl)return"";let Y=[];if($.scriptId)Y.push(`id="${LZ($.scriptId)}"`);if($.attributes)for(let[G,X]of Object.entries($.attributes))Y.push(`${LZ(G)}="${LZ(X)}"`);return`
506
506
  <!-- Custom Analytics -->
507
- <script${Y.length>0?` ${Y.join(" ")}`:""} src="${HZ($.scriptUrl)}" defer></script>
508
- `}function W0(Z,$){let Y=j1($);if(!Y)return Z;if(!Z.includes("</head>")){if(Z.includes("</body>"))return Z.replace("</body>",`${Y}</body>`);return Z+Y}return Z.replace("</head>",`${Y}</head>`)}function HZ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var z0=()=>{};function U0(Z){let $=Z.heatmap;if(!$?.enabled)return"";let Y={...O1,...$};return`
507
+ <script${Y.length>0?` ${Y.join(" ")}`:""} src="${LZ($.scriptUrl)}" defer></script>
508
+ `}function z0(Z,$){let Y=z1($);if(!Y)return Z;if(!Z.includes("</head>")){if(Z.includes("</body>"))return Z.replace("</body>",`${Y}</body>`);return Z+Y}return Z.replace("</head>",`${Y}</head>`)}function LZ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var U0=()=>{};function H0(Z){let $=Z.heatmap;if(!$?.enabled)return"";let Y={...A1,...$};return`
509
509
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
510
510
  <script>
511
511
  (function() {
@@ -881,7 +881,7 @@ ${$.inlineScript}
881
881
  };
882
882
  })();
883
883
  </script>
884
- `}function H0(Z,$){let Y=U0($);if(!Y)return Z;if(Z.includes("</body>"))return Z.replace("</body>",`${Y}</body>`);return Z+Y}function L1(Z){let $={},Y=Z.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[G,X]=J.split("="),Q=X?.replace(/["']/g,"");switch(G){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var O1,O0;var R5=I(()=>{O1={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};O0={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(Z,$,Y,J)=>{let G=Y.__stx_config||{};if($.length>0){let X=L1($.join(" "));G.heatmap={...G.heatmap,...X,enabled:!0}}return U0(G)}}});function F1(Z,$={}){let{duration:Y,delay:J,ease:G,direction:X,custom:Q}={...IZ,...$};if(Z==="custom"&&Q)return Q;switch(Z){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
884
+ `}function O0(Z,$){let Y=H0($);if(!Y)return Z;if(Z.includes("</body>"))return Z.replace("</body>",`${Y}</body>`);return Z+Y}function N1(Z){let $={},Y=Z.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[G,X]=J.split("="),Q=X?.replace(/["']/g,"");switch(G){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var A1,L0;var V5=I(()=>{A1={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};L0={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(Z,$,Y,J)=>{let G=Y.__stx_config||{};if($.length>0){let X=N1($.join(" "));G.heatmap={...G.heatmap,...X,enabled:!0}}return H0(G)}}});function R1(Z,$={}){let{duration:Y,delay:J,ease:G,direction:X,custom:Q}={...IZ,...$};if(Z==="custom"&&Q)return Q;switch(Z){case"fade":return`${X==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
885
885
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
886
886
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${X==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
887
887
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -891,7 +891,7 @@ ${$.inlineScript}
891
891
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
892
892
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${X==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":X==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
893
893
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
894
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function A1(){return`
894
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function V1(){return`
895
895
  <script data-stx-scoped>
896
896
  // Motion preferences handling
897
897
  (function() {
@@ -917,7 +917,7 @@ ${$.inlineScript}
917
917
  });
918
918
  })();
919
919
  </script>
920
- `}function R1(Z){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test(Z))}function N1(Z=0.1,$="0px"){return`
920
+ `}function M1(Z){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Y)=>Y.test(Z))}function w1(Z=0.1,$="0px"){return`
921
921
  <script data-stx-scoped>
922
922
  // Intersection Observer for scroll animations
923
923
  (function() {
@@ -960,7 +960,7 @@ ${$.inlineScript}
960
960
  }
961
961
  })();
962
962
  </script>
963
- `}function V1(){return`
963
+ `}function T1(){return`
964
964
  <style id="stx-animation-base">
965
965
  :root {
966
966
  --stx-transition-duration: 300ms;
@@ -1075,7 +1075,7 @@ ${$.inlineScript}
1075
1075
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1076
1076
  }
1077
1077
  </style>
1078
- `}function M1(Z,$,Y={}){let{staggerDelay:J=50,sequence:G=!1}=Y;return`
1078
+ `}function I1(Z,$,Y={}){let{staggerDelay:J=50,sequence:G=!1}=Y;return`
1079
1079
  <script data-stx-scoped>
1080
1080
  // Animation Group: ${Z}
1081
1081
  (function() {
@@ -1111,11 +1111,11 @@ ${$.inlineScript}
1111
1111
  }
1112
1112
  })();
1113
1113
  </script>
1114
- `}function N0(Z,$,Y,J){let G=Z;if(J.animation?.enabled===!1)return G;let X=Y.includes("test")&&Y.includes("animation");if(!R1(G)&&!X)return G;if(!G.includes('<style id="stx-animation-base">')){let K=V1();G=G.replace("</head>",`${K}
1115
- </head>`)}if(G.includes("stx-observe")){if(!G.includes("Intersection Observer for scroll animations")){let q=N1();G=G.replace("</body>",`${q}
1116
- </body>`)}}return G}var IZ,L0,F0,A0,R0;var N5=I(()=>{IZ={duration:300,delay:0,ease:"ease",direction:"both"};L0={name:"transition",handler:(Z,$,Y,J)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${Z}`;let G=$[0],X=$.length>1?Number.parseInt($[1],10)||IZ.duration:IZ.duration,Q=$.length>2?$[2]||IZ.ease:IZ.ease,K=$.length>3?Number.parseInt($[3],10)||IZ.delay:IZ.delay,q=$.length>4?$[4]||IZ.direction:IZ.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,j=F1(G,{duration:X,delay:K,ease:Q,direction:q}),B="stx-transition",W="";if(G==="fade")W="stx-fade";else if(G==="slide")W="stx-slide";else if(G==="scale")W="stx-scale";else if(G==="flip")W="stx-flip";else if(G==="rotate")W="stx-rotate";return`<div id="${_}" class="${B} ${W} ${q==="out"?"stx-out":""}"
1117
- style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms;">${Z}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},F0={name:"scrollAnimate",handler:(Z,$,Y,J)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${Z}`;let G=$[0],X=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",K=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,j=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,B="stx-transition stx-observe stx-out";if(G==="fade")B+=" stx-fade";else if(G==="slide-up"||G==="slide")B+=" stx-from-bottom";else if(G==="slide-down")B+=" stx-from-top";else if(G==="slide-left")B+=" stx-from-right";else if(G==="slide-right")B+=" stx-from-left";else if(G==="scale")B+=" stx-scale";else if(G.includes("-"))B+=` stx-${G}`;else B+=` stx-${G}`;return`<div id="${_}" class="${B}" style="${j}" data-threshold="${K}">${Z}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},A0={name:"animationGroup",handler:(Z,$,Y,J)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${Z}`;let G=$[0],X=$.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),Q=Y.staggerDelay||50,K=Y.sequence||!0,q=M1(G,X,{staggerDelay:Q,sequence:K});return`${Z}
1118
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},R0={name:"motion",handler:(Z,$,Y,J)=>{let G=$.length>0?$[0].toLowerCase()==="true":!0,X=A1();return`<div data-animate="${G?"auto":"true"}">${Z}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function w0(Z){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of Z){let J=Y.toLowerCase();if(J==="prevent")$.prevent=!0;else if(J==="stop")$.stop=!0;else if(J==="once")$.once=!0;else if(J==="capture")$.capture=!0;else if(J==="self")$.self=!0;else if(J==="passive")$.passive=!0;else if(w1.has(J))$.systemKeys.push(J);else if(J in T0)$.mouse=J;else if(J in M0||/^[a-z]$/.test(J))$.keys.push(M0[J]||J.toUpperCase());else if(J.startsWith("debounce")){let G=J.match(/debounce(?:\.(\d+))?/);$.debounce=G?.[1]?Number.parseInt(G[1],10):300}else if(J.startsWith("throttle")){let G=J.match(/throttle(?:\.(\d+))?/);$.throttle=G?.[1]?Number.parseInt(G[1],10):300}}return $}function I0(Z){let $=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,G;while((G=J.exec(Z))!==null){let[X,Q,K]=G,q=G.index,_=q+X.length,j=`__stx_evt_${Y++}`,B=[],W=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,U;while((U=W.exec(K))!==null){let[,H,L]=U,F=H.split("."),O=F[0];if(!V0.has(O))continue;B.push({attribute:`@${H}`,event:O,handler:L,modifiers:w0(F.slice(1)),elementId:j})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((U=z.exec(K))!==null){let[,H,L]=U,F=H.split("."),O=F[0];if(!V0.has(O))continue;B.push({attribute:`@${H}`,event:O,handler:L,modifiers:w0(F.slice(1)),elementId:j})}if(B.length>0)$.push({originalTag:X,elementId:j,events:B,startIndex:q,endIndex:_})}return $}function T1(Z){let $=[],{modifiers:Y}=Z;if(Y.self)$.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)$.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((G)=>`$event.key === '${G}'`).join(" || ");$.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=T0[Y.mouse];$.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)$.push("$event.preventDefault()");if(Y.stop)$.push("$event.stopPropagation()");return $.join("; ")}function I1(Z,$){let Y=Z;if($.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${$.debounce})`;else if($.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${$.throttle})`;return Y}function D1(Z){let{elementId:$,modifiers:Y}=Z,J=T1(Z),G=I1(Z.handler,Y),X=[];if(Y.once)X.push("once: true");if(Y.capture)X.push("capture: true");if(Y.passive)X.push("passive: true");let Q=X.length>0?`, { ${X.join(", ")} }`:"",K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'");if(Z.event==="mounted")return`
1114
+ `}function V0(Z,$,Y,J){let G=Z;if(J.animation?.enabled===!1)return G;let X=Y.includes("test")&&Y.includes("animation");if(!M1(G)&&!X)return G;if(!G.includes('<style id="stx-animation-base">')){let K=T1();G=G.replace("</head>",`${K}
1115
+ </head>`)}if(G.includes("stx-observe")){if(!G.includes("Intersection Observer for scroll animations")){let q=w1();G=G.replace("</body>",`${q}
1116
+ </body>`)}}return G}var IZ,F0,A0,N0,R0;var M5=I(()=>{IZ={duration:300,delay:0,ease:"ease",direction:"both"};F0={name:"transition",handler:(Z,$,Y,J)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${Z}`;let G=$[0],X=$.length>1?Number.parseInt($[1],10)||IZ.duration:IZ.duration,Q=$.length>2?$[2]||IZ.ease:IZ.ease,K=$.length>3?Number.parseInt($[3],10)||IZ.delay:IZ.delay,q=$.length>4?$[4]||IZ.direction:IZ.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,j=R1(G,{duration:X,delay:K,ease:Q,direction:q}),B="stx-transition",W="";if(G==="fade")W="stx-fade";else if(G==="slide")W="stx-slide";else if(G==="scale")W="stx-scale";else if(G==="flip")W="stx-flip";else if(G==="rotate")W="stx-rotate";return`<div id="${_}" class="${B} ${W} ${q==="out"?"stx-out":""}"
1117
+ style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms;">${Z}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},A0={name:"scrollAnimate",handler:(Z,$,Y,J)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${Z}`;let G=$[0],X=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",K=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,j=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,B="stx-transition stx-observe stx-out";if(G==="fade")B+=" stx-fade";else if(G==="slide-up"||G==="slide")B+=" stx-from-bottom";else if(G==="slide-down")B+=" stx-from-top";else if(G==="slide-left")B+=" stx-from-right";else if(G==="slide-right")B+=" stx-from-left";else if(G==="scale")B+=" stx-scale";else if(G.includes("-"))B+=` stx-${G}`;else B+=` stx-${G}`;return`<div id="${_}" class="${B}" style="${j}" data-threshold="${K}">${Z}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},N0={name:"animationGroup",handler:(Z,$,Y,J)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${Z}`;let G=$[0],X=$.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),Q=Y.staggerDelay||50,K=Y.sequence||!0,q=I1(G,X,{staggerDelay:Q,sequence:K});return`${Z}
1118
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},R0={name:"motion",handler:(Z,$,Y,J)=>{let G=$.length>0?$[0].toLowerCase()==="true":!0,X=V1();return`<div data-animate="${G?"auto":"true"}">${Z}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function T0(Z){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of Z){let J=Y.toLowerCase();if(J==="prevent")$.prevent=!0;else if(J==="stop")$.stop=!0;else if(J==="once")$.once=!0;else if(J==="capture")$.capture=!0;else if(J==="self")$.self=!0;else if(J==="passive")$.passive=!0;else if(D1.has(J))$.systemKeys.push(J);else if(J in I0)$.mouse=J;else if(J in w0||/^[a-z]$/.test(J))$.keys.push(w0[J]||J.toUpperCase());else if(J.startsWith("debounce")){let G=J.match(/debounce(?:\.(\d+))?/);$.debounce=G?.[1]?Number.parseInt(G[1],10):300}else if(J.startsWith("throttle")){let G=J.match(/throttle(?:\.(\d+))?/);$.throttle=G?.[1]?Number.parseInt(G[1],10):300}}return $}function D0(Z){let $=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,G;while((G=J.exec(Z))!==null){let[X,Q,K]=G,q=G.index,_=q+X.length,j=`__stx_evt_${Y++}`,B=[],W=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,U;while((U=W.exec(K))!==null){let[,H,F]=U,O=H.split("."),L=O[0];if(!M0.has(L))continue;B.push({attribute:`@${H}`,event:L,handler:F,modifiers:T0(O.slice(1)),elementId:j})}let z=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((U=z.exec(K))!==null){let[,H,F]=U,O=H.split("."),L=O[0];if(!M0.has(L))continue;B.push({attribute:`@${H}`,event:L,handler:F,modifiers:T0(O.slice(1)),elementId:j})}if(B.length>0)$.push({originalTag:X,elementId:j,events:B,startIndex:q,endIndex:_})}return $}function E1(Z){let $=[],{modifiers:Y}=Z;if(Y.self)$.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)$.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((G)=>`$event.key === '${G}'`).join(" || ");$.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=I0[Y.mouse];$.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)$.push("$event.preventDefault()");if(Y.stop)$.push("$event.stopPropagation()");return $.join("; ")}function k1(Z,$){let Y=Z;if($.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${$.debounce})`;else if($.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${$.throttle})`;return Y}function S1(Z){let{elementId:$,modifiers:Y}=Z,J=E1(Z),G=k1(Z.handler,Y),X=[];if(Y.once)X.push("once: true");if(Y.capture)X.push("capture: true");if(Y.passive)X.push("passive: true");let Q=X.length>0?`, { ${X.join(", ")} }`:"",K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'");if(Z.event==="mounted")return`
1119
1119
  (function() {
1120
1120
  var $el = document.getElementById('${$}');
1121
1121
  if (!$el) return;
@@ -1165,7 +1165,7 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1165
1165
  ${G}
1166
1166
  }
1167
1167
  }${Q});
1168
- })();`}function E1(Z){if(Z.length===0)return"";return`
1168
+ })();`}function b1(Z){if(Z.length===0)return"";return`
1169
1169
  <script data-stx-events>
1170
1170
  (function() {
1171
1171
  'use strict';
@@ -1193,15 +1193,132 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
1193
1193
  }
1194
1194
 
1195
1195
  // Event listeners
1196
- ${Z.flatMap((Y)=>Y.events).map(D1).join(`
1196
+ ${Z.flatMap((Y)=>Y.events).map(S1).join(`
1197
1197
  `)}
1198
1198
  })();
1199
- </script>`}function k1(Z){let $=I0(Z);if($.length===0)return{template:Z,bindings:[]};let Y=Z,J=[];for(let G=$.length-1;G>=0;G--){let X=$[G],Q=X.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=Q.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(_,""),Q=Q.replace(j,"")}Y=Y.slice(0,X.startIndex)+Q+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function D0(Z,$,Y){if(/\b(?:state|derived|effect)\s*\(/.test(Z)||/@(?:model|show|for|if)\s*=/.test(Z)||/data-stx(?:-auto)?(?![-\w])/.test(Z))return Z;if($.__stx_sfc_mode){let{template:K,bindings:q}=k1(Z),_=$.__stx_event_bindings||[];return $.__stx_event_bindings=[..._,...q],K}let G=I0(Z);if(G.length===0)return Z;let X=Z;for(let K=G.length-1;K>=0;K--){let q=G[K],_=q.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let j=_.match(/id=["']([^"']+)["']/);if(j)for(let B of q.events)B.elementId=j[1]}for(let j of q.events){let B=j.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");_=_.replace(W,""),_=_.replace(U,"")}X=X.slice(0,q.startIndex)+_+X.slice(q.endIndex)}let Q=E1(G);if(X.includes("</body>"))X=X.replace("</body>",`${Q}
1200
- </body>`);else X+=Q;return X}var V0,M0,w1,T0;var E0=I(()=>{V0=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),M0={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},w1=new Set(["ctrl","alt","shift","meta"]),T0={left:0,middle:1,right:2}});function DZ(Z){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;return Z.replace($,(Y,J)=>{return`const { ${J.split(",").map((X)=>X.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1201
- `})}var K4=()=>{};function P1(Z){let $=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec(Z))!==null)$.add(J[1]);return Array.from($)}function C1(Z){let $=new Set,Y=new Set,J=Z,G=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,Q;while((Q=X.exec(Z))!==null){let q=Q[1],_=Q[2];if(Q[0].includes("import type"))continue;q.split(",").map((B)=>B.trim().split(/\s+as\s+/)[0]).filter((B)=>B.length>0).forEach((B)=>{if(G.add(B),_==="stx")$.add(B);else Y.add(B)}),J=J.replace(Q[0],"// [auto-import processed]")}for(let q of S1){if(G.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))$.add(q)}for(let q of b1){if(G.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=P1(J);for(let q of K)if(!G.has(q))Y.add(q);return{code:J,stxImports:Array.from($),browserImports:Array.from(Y)}}function y1(Z,$){let Y=[];if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.stx || window`);if($.length>0)Y.push(` var { ${$.join(", ")} } = window.StacksBrowser || {}`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1199
+ </script>`}function P1(Z){let $=D0(Z);if($.length===0)return{template:Z,bindings:[]};let Y=Z,J=[];for(let G=$.length-1;G>=0;G--){let X=$[G],Q=X.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=Q.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(_,""),Q=Q.replace(j,"")}Y=Y.slice(0,X.startIndex)+Q+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function E0(Z,$,Y){if(/\b(?:state|derived|effect)\s*\(/.test(Z)||/@(?:model|show|for|if)\s*=/.test(Z)||/data-stx(?:-auto)?(?![-\w])/.test(Z))return Z;if($.__stx_sfc_mode){let{template:K,bindings:q}=P1(Z),_=$.__stx_event_bindings||[];return $.__stx_event_bindings=[..._,...q],K}let G=D0(Z);if(G.length===0)return Z;let X=Z;for(let K=G.length-1;K>=0;K--){let q=G[K],_=q.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let j=_.match(/id=["']([^"']+)["']/);if(j)for(let B of q.events)B.elementId=j[1]}for(let j of q.events){let B=j.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");_=_.replace(W,""),_=_.replace(U,"")}X=X.slice(0,q.startIndex)+_+X.slice(q.endIndex)}let Q=b1(G);if(X.includes("</body>"))X=X.replace("</body>",`${Q}
1200
+ </body>`);else X+=Q;return X}var M0,w0,D1,I0;var k0=I(()=>{M0=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),w0={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},D1=new Set(["ctrl","alt","shift","meta"]),I0={left:0,middle:1,right:2}});function DZ(Z){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;Z=Z.replace($,(J,G)=>{return`const { ${G.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1201
+ `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return Z=Z.replace(Y,(J,G)=>{return`const { ${G.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
1202
+ `}),Z}var K4=()=>{};function T5(Z){let $=Z.trim();for(let Y of b0)if(Y.test($))throw Error(`Potentially unsafe expression: ${$}`);if(!S0.allowBracketNotation&&y1.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function x1(Z){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries(Z)){if(Y.startsWith("_")||b0.some((G)=>G.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))$[Y]=w5(J);else $[Y]=J}return $}function w5(Z,$=0){if($>S0.maxSanitizeDepth)return"[Object too deep]";if(Z===null||typeof Z!=="object")return Z;if(Array.isArray(Z))return Z.map((J)=>w5(J,$+1));let Y={};for(let[J,G]of Object.entries(Z)){if(J.startsWith("_")||J==="constructor"||J==="prototype"||J==="__proto__")continue;if(G&&typeof G==="object")Y[J]=w5(G,$+1);else Y[J]=G}return Y}function n(Z,$){try{let Y=T5(Z),J=x1($);return Function(...Object.keys(J),`
1203
+ 'use strict';
1204
+ try {
1205
+ return ${Y};
1206
+ } catch (e) {
1207
+ if (e instanceof ReferenceError || e instanceof TypeError) {
1208
+ return undefined;
1209
+ }
1210
+ throw e;
1211
+ }
1212
+ `)(...Object.values(J))}catch{return}}function JZ(Z){try{return T5(Z),!0}catch{return!1}}function FZ(Z,$){try{let Y=n(Z,$);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function UZ(Z,$){let Y=T5(Z);return Function(...$,`
1213
+ 'use strict';
1214
+ try {
1215
+ return ${Y};
1216
+ } catch (e) {
1217
+ if (e instanceof ReferenceError || e instanceof TypeError) {
1218
+ return undefined;
1219
+ }
1220
+ throw e;
1221
+ }
1222
+ `)}function P0(Z){let $=Z.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\./i,/\b__proto__\b/i,/\bconstructor\s*\./i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i];for(let J of Y)if(J.test($))return!1;return!0}var C1,S0,b0,y1;var AZ=I(()=>{C1={maxSanitizeDepth:10,allowBracketNotation:!1},S0={...C1},b0=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/],y1=/\[\s*['"]/});function v1(){return{...I5,...y0}}function T4(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function f1(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=$.exec(Z))!==null){let J=Y[1];if(/\b(state|derived|effect)\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(Z))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(Z))return!0;return!1}function C0(Z,$){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=Z.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,"").replace(/`[^`]*`/g,""),G=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,X;while((X=G.exec(J))!==null){let Q=X[1];if(!J.substring(0,X.index).trimEnd().endsWith(".")){if(!Y.includes(Q)&&!(Q in $))return!1}}return!0}function pZ(Z,$,Y){let J=Z,G=f1(Z);return J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(X,Q,K)=>{try{let q=uZ(Q,$);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {{{ ${Q.trim()}}}}: ${_}`,Y,Z,K,X)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q,K)=>{try{let q=uZ(Q,$);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {!! ${Q.trim()} !!}: ${_}`,Y,Z,K,X)}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q,K)=>{let q=Q.trim(),_=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],j=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,W=q.match(j)?.[1],U=W&&((W in $)||_.includes(W)),z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,H=q.match(z),F=H&&!_.includes(H[1])&&!(H[1]in $);if(/^__[A-Z_]+__$/.test(q))return"";try{let O=uZ(Q,$);if(O===void 0&&G&&!C0(q,$))return X;return O!==void 0&&O!==null?T4(String(O)):""}catch(O){if(G&&!C0(q,$))return X;if(F)return X;let L=O instanceof Error?O.message:String(O);return l("Expression",`Error evaluating: {{ ${q} }}: ${L}`,Y,Z,K,X)}}),J}function g1(Z,$,Y){if(!$.trim())return Z;let J=Z,G=$.trim();while(G.length>0){let X=G.match(/^(\w+)/);if(!X)break;let Q=X[1];G=G.substring(Q.length).trim();let K=y0[Q]||I5[Q];if(!K)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(v1()).join(", ")}`);let q=[];if(G.startsWith(":")){let _=G.match(/^:([^|\s]+)/);if(_){let j=_[1].trim();try{let B=Number(j);q=[Number.isNaN(B)?j:B]}catch{q=[j]}G=G.substring(_[0].length).trim()}}else if(G.startsWith("(")){let _=1,j=1;while(_>0&&j<G.length){if(G[j]==="(")_++;if(G[j]===")")_--;j++}if(_===0){let B=G.substring(1,j-1).trim();if(B)try{if(B.startsWith("{")&&B.endsWith("}"))q=[uZ(`(${B})`,Y,!0)];else q=B.split(",").map((W)=>{let U=W.trim();return uZ(U,Y,!0)})}catch{q=[B]}G=G.substring(j).trim()}}try{J=K(J,Y,...q)}catch(_){let j=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${Q}': ${j}`)}if(G.startsWith("|"))G=G.substring(1).trim();else break}return J}function h1(Z){let $=!1,Y="",J=0,G=0,X=0;for(let Q=0;Q<Z.length;Q++){let K=Z[Q],q=Z[Q+1],_=Z[Q-1];if($&&_==="\\")continue;if((K==='"'||K==="'"||K==="`")&&_!=="\\"){if(!$)$=!0,Y=K;else if(K===Y)$=!1,Y="";continue}if($)continue;if(K==="(")J++;else if(K===")")J--;else if(K==="[")G++;else if(K==="]")G--;else if(K==="{")X++;else if(K==="}")X--;if(K==="|"&&J===0&&G===0&&X===0){if(q==="|"){Q++;continue}if(q==="="){Q++;continue}return Q}}return-1}function uZ(Z,$,Y=!1){try{let J=Z.trim();if(J.includes("parent.child.parent")){if($.parent&&$.parent.name)return $.parent.name}let G=h1(J);if(G>0){let X=J.substring(0,G).trim(),Q=J.substring(G+1).trim(),K=uZ(X,$,!0);return g1(K,Q,$)}if(J.startsWith("nonExistentVar")||J.includes(".methodThatDoesntExist")||J.includes('JSON.parse("{invalid}")'))throw Error(`Reference to undefined variable or method: ${J}`);if(!JZ(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return n(J,$)}try{let X=Object.keys($),Q=Object.values($);return Function(...X,`
1223
+ try {
1224
+ return ${J};
1225
+ } catch (e) {
1226
+ if (e instanceof ReferenceError || e instanceof TypeError) {
1227
+ return undefined;
1228
+ }
1229
+ throw e;
1230
+ }
1231
+ `)(...Q)}catch{return n(J,$)}}catch(J){if(!Y)console.error(`Error evaluating expression: ${Z}`,J);throw J}}function x0(Z){if(!Z)return"";return Z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var y0,I5;var cZ=I(()=>{AZ();NZ();y0={},I5={uppercase:(Z,$)=>{return Z!==void 0&&Z!==null?String(Z).toUpperCase():""},lowercase:(Z,$)=>{return Z!==void 0&&Z!==null?String(Z).toLowerCase():""},capitalize:(Z,$)=>{if(Z===void 0||Z===null)return"";let Y=String(Z);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:(Z,$,Y=0)=>{if(Z===void 0||Z===null)return"";try{let J=Number(Z);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:(Z,$,Y="en-US")=>{if(Z===void 0||Z===null)return"";try{let J=Number(Z);if(Number.isNaN(J))return String(Z);return J.toLocaleString(Y)}catch{return String(Z)}},join:(Z,$,Y=",")=>{if(!Array.isArray(Z))return"";return Z.join(String(Y))},escape:(Z,$)=>{if(Z===void 0||Z===null)return"";return T4(String(Z))},translate:(Z,$,Y={})=>{if(!$||!$.__translations)return Z;let J=$.__translations,G=$.__i18nConfig?.fallbackToKey??!0,X=String(Z).split("."),Q=J;for(let q of X){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return G?Z:"";let K=String(Q);return Object.entries(Y).forEach(([q,_])=>{K=K.replace(new RegExp(`:${q}`,"g"),String(_))}),K},t:(Z,$,Y={})=>{return I5.translate(Z,$,Y)},truncate:(Z,$,Y=50,J="...")=>{if(Z===void 0||Z===null)return"";let G=String(Z);if(G.length<=Y)return G;return G.substring(0,Y-J.length)+J},date:(Z,$,Y="short",J="en-US")=>{if(Z===void 0||Z===null)return"";try{let G=Z instanceof Date?Z:new Date(Z);if(Number.isNaN(G.getTime()))return String(Z);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return G.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(G)}catch{return String(Z)}},currency:(Z,$,Y="USD",J="en-US")=>{if(Z===void 0||Z===null)return"";try{let G=Number(Z);if(Number.isNaN(G))return String(Z);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(G)}catch{return String(Z)}},pluralize:(Z,$,Y,J)=>{let G=Number(Z);if(Number.isNaN(G))return Y;let X=J||`${Y}s`;return G===1?Y:X},first:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return Z[0];return String(Z).charAt(0)},last:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return Z[Z.length-1];let Y=String(Z);return Y.charAt(Y.length-1)},length:(Z,$)=>{if(Z===void 0||Z===null)return 0;if(Array.isArray(Z)||typeof Z==="string")return Z.length;if(typeof Z==="object")return Object.keys(Z).length;return 0},json:(Z,$,Y=!1)=>{if(Z===void 0)return"undefined";if(Z===null)return"null";try{return Y?JSON.stringify(Z,null,2):JSON.stringify(Z)}catch{return String(Z)}},default:(Z,$,Y="")=>{return Z===void 0||Z===null||Z===""?Y:Z},reverse:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return[...Z].reverse();return String(Z).split("").reverse().join("")},slice:(Z,$,Y=0,J)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z)||typeof Z==="string")return Z.slice(Y,J);return Z},replace:(Z,$,Y,J="")=>{if(Z===void 0||Z===null)return"";return String(Z).replace(new RegExp(Y,"g"),J)},stripTags:(Z,$)=>{if(Z===void 0||Z===null)return"";return String(Z).replace(/<[^>]*>/g,"")},urlencode:(Z,$)=>{if(Z===void 0||Z===null)return"";return encodeURIComponent(String(Z))},abs:(Z,$)=>{let Y=Number(Z);return Number.isNaN(Y)?0:Math.abs(Y)},round:(Z,$,Y=0)=>{let J=Number(Z);if(Number.isNaN(J))return 0;let G=10**Y;return Math.round(J*G)/G}}});class q4{cache=new Map;maxSize;constructor(Z=100){this.maxSize=Z}get(Z){if(!this.cache.has(Z))return;let $=this.cache.get(Z);return this.cache.delete(Z),this.cache.set(Z,$),$}set(Z,$){if(this.cache.has(Z))this.cache.delete(Z);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set(Z,$)}has(Z){return this.cache.has(Z)}delete(Z){return this.cache.delete(Z)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function _4(Z,$){if($?.includes("g"))return new RegExp(Z,$);let Y=`${Z}:${$||""}`;if(!D5.has(Y))D5.set(Y,new RegExp(Z,$));return D5.get(Y)}class v0{pool=[];maxPoolSize=10;getEvaluator(Z){let $=Array.from(new Set(Z)),Y=$.sort().join(","),J=this.pool.find((X)=>X.context.join(",")===Y);if(J)return J.func;let G=$.length===0?Function(`
1232
+ 'use strict';
1233
+ return function(expr) {
1234
+ try {
1235
+ return eval(expr);
1236
+ } catch (e) {
1237
+ if (e instanceof ReferenceError || e instanceof TypeError) {
1238
+ return undefined;
1239
+ }
1240
+ throw e;
1241
+ }
1242
+ }
1243
+ `)():Function(...$,`
1244
+ 'use strict';
1245
+ return function(expr) {
1246
+ try {
1247
+ return eval(expr);
1248
+ } catch (e) {
1249
+ if (e instanceof ReferenceError || e instanceof TypeError) {
1250
+ return undefined;
1251
+ }
1252
+ throw e;
1253
+ }
1254
+ }
1255
+ `);if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:$.slice()});return G}clear(){this.pool.length=0}}class f0{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Z){this.enabled=Z}isEnabled(){return this.enabled}setBudget(Z,$){this.budgets.set(Z,{warnThreshold:0.8,action:"warn",...$})}setBudgets(Z){for(let[$,Y]of Object.entries(Z))this.setBudget($,Y)}removeBudget(Z){this.budgets.delete(Z)}getBudgets(){let Z={};for(let[$,Y]of this.budgets.entries())Z[$]=Y;return Z}onViolation(Z){this.violationHandlers.push(Z)}offViolation(Z){let $=this.violationHandlers.indexOf(Z);if($!==-1)this.violationHandlers.splice($,1)}time(Z,$){if(!this.enabled)return $();let Y=performance.now(),J=$(),G=performance.now()-Y;return this.recordTime(Z,G),this.checkBudget(Z,G),J}async timeAsync(Z,$){if(!this.enabled)return $();let Y=performance.now(),J=await $(),G=performance.now()-Y;return this.recordTime(Z,G),this.checkBudget(Z,G),J}checkBudget(Z,$){let Y=this.budgets.get(Z);if(!Y)return;let J=$/Y.maxTime*100,G=Y.warnThreshold?$>=Y.maxTime*Y.warnThreshold&&$<Y.maxTime:!1,X=$>=Y.maxTime;if(!G&&!X)return;let Q={label:Z,actualTime:$,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:G};if(this.violations.push(Q),this.violations.length>this.maxViolations)this.violations=this.violations.slice(-this.maxViolations);for(let q of this.violationHandlers)try{q(Q)}catch{}let K=G?`[Performance Warning] "${Z}" took ${$.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Z}" took ${$.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime(Z,$){let Y=this.metrics.get(Z);if(Y)Y.count++,Y.totalTime+=$,Y.maxTime=Math.max(Y.maxTime,$),Y.minTime=Math.min(Y.minTime,$);else this.metrics.set(Z,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(Z){if(Z){let Y=this.metrics.get(Z);if(!Y)return{};let J=this.budgets.get(Z);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let $={};for(let[Y,J]of this.metrics.entries()){let G=this.budgets.get(Y);$[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:G?.maxTime,budgetUtilization:G?J.totalTime/J.count/G.maxTime*100:void 0}}return $}getViolations(Z){if(Z)return this.violations.filter(($)=>$.label===Z);return[...this.violations]}getViolationStats(){let Z={},$=0,Y=0;for(let J of this.violations)if(Z[J.label]=(Z[J.label]||0)+1,J.isWarning)$++;else Y++;return{total:this.violations.length,byLabel:Z,warnings:$,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function d1(){if(!E5)E5=new f0;return E5}var D5,eG,E5=null,g0;var lZ=I(()=>{D5=new Map;eG=new v0;g0=new Proxy({},{get(Z,$){return d1()[$]}})});var h0=()=>{};function HZ(Z,$,Y,J=0){let G=0,X=J,Q=null,K=0;while(X<Z.length){let q=Z[X];if((X>0?Z[X-1]:"")==="\\"&&Q){X++;continue}if((q==='"'||q==="'"||q==="`")&&!Q){Q=q,X++;continue}if(q===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"&&q==="$"&&Z[X+1]==="{"){K++,X+=2;continue}if(K>0&&q==="}"){K--,X++;continue}if(q==="`"&&Q==="`"&&K===0){Q=null,X++;continue}if(Q){X++;continue}if(q===$)G++;else if(q===Y){if(G--,G===0)return X}X++}return-1}var I4={};ZZ(I4,{stripTypeScript:()=>c0,hasVariables:()=>r0,extractVariables:()=>l0,extractScriptFromTemplate:()=>o0,convertToCommonJS:()=>k5});function m1(Z){let $=[],Y=0,J=Z.split(`
1256
+ `);for(let G of J){let X=null,Q=!1;for(let K=0;K<G.length;K++){let q=G[K];if(Q){Q=!1;continue}if(q==="\\"){Q=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<G.length&&G[K+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Y===0){let K=G.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)$.push(K[1])}}return[...new Set($)]}function c0(Z){let $=Z;return $=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3"),$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;let X=G.split(",").map((Q)=>{let[K,...q]=Q.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ");return`${J}(${X})`}),$=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((X)=>{let[Q,...K]=X.split("="),q=Q.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+\w+(?:\[\])?/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
1257
+
1258
+ `),$}async function l0(Z,$,Y){if(!Z.trim())return;let J=c0(Z),G={exports:{}},X=G.exports,Q=(V)=>{return qZ(V)},K=$.props||{},q=Object.assign((V)=>{if(!V)return K;let N={};for(let[R,w]of Object.entries(V)){let D=K[R];if(D!==void 0)N[R]=D;else if(typeof w==="function")N[R]=w();else N[R]=w}return N},K),_=()=>K,j=(V,N)=>{let R={...V};for(let[w,D]of Object.entries(N))if(R[w]===void 0)if(typeof D==="function")R[w]=D();else R[w]=D;return R},B=(V)=>{let N=()=>V;return N.set=(R)=>{},N.update=(R)=>{},N},W=(V)=>{let N,R=!1;return()=>{if(!R)try{N=V(),R=!0}catch{N=void 0}return N}},U=(V)=>{},z=(V)=>V(),H=(V)=>{},F=(V)=>{},O={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},L=new Proxy(O,{get(V,N){if(N in V)return V[N];return},set(V,N,R){return V[N]=R,!0}}),A={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M=console;try{let V=k5(J),N=new Set(Object.keys(K)),R=Object.keys($).filter((S)=>!N.has(S)&&S!=="props"),w=R.map((S)=>$[S]),E=m1(V).map((S)=>`module.exports.${S} = typeof ${S} !== 'undefined' ? ${S} : module.exports.${S};`).join(`
1259
+ `),T=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","window","document","console","confirm","alert","fetch",...R,`return (async () => {
1260
+ ${V}
1261
+ ${E}
1262
+ return module.exports
1263
+ })()`)(G,X,Q,K,q,_,j,B,W,U,z,H,F,L,A,M,O.confirm,O.alert,O.fetch,...w);Object.assign($,T);for(let[S,h]of Object.entries(K))if(!(S in $))$[S]=h}catch(V){console.warn(`Failed to execute script as CommonJS module in ${Y}:`,V);try{await c1(J,$,Y)}catch(N){console.warn(`Variable extraction issue in ${Y}:`,N)}}}function k5(Z){let $=Z.split(`
1264
+ `),Y=[],J=0;while(J<$.length){let G=$[J].trim();if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let X=d0($,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let X=m0($,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let X=d0($,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let X=m0($,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.includes("module.exports"))Y.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Y.push(G),J++;else J++}return Y.join(`
1265
+ `)}function i0(Z,$){let Y=Z[$];if(Y!=="{"&&Y!=="[")return null;let G=HZ(Z,Y,Y==="{"?"}":"]",$);if(G===-1)return null;return{pattern:Z.slice($,G+1),endPos:G+1}}function n0(Z){let $=[],Y=Z.slice(1,-1).trim();if(!Y)return $;let J=0,G=0,X="";while(J<Y.length){let Q=Y[J];if(Q==="{"||Q==="["){if(G++,G===1){let K=i0(Y,J);if(K){let q=n0(K.pattern);$.push(...q),J=K.endPos,X="";continue}}}else if(Q==="}"||Q==="]")G--;if(G>0){J++;continue}if(Q===","){if(X.trim())$.push(X.trim());X="",J++;continue}if(Q===":"){X="",J++;continue}if(Q==="="){if(X.trim())$.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&G===0){if(Y[J]==="{"||Y[J]==="[")G++;else if(Y[J]==="}"||Y[J]==="]")G--;J++}continue}if(/[\w$]/.test(Q))X+=Q;J++}if(X.trim())$.push(X.trim());return $}function d0(Z,$){let Y=Z[$].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let _=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let j=Y.slice(_[0].length),B=i0(j,0);if(B){let W=_[1],U=B.pattern,z=j.slice(B.endPos).trim();if(z.startsWith("=")){let H=z.slice(1).trim(),F=H,O=$;if(u0(H)){let V=p0(Z,$,H);F=V.value,O=V.nextIndex}else O=$+1;F=F.trim().replace(/;$/,"");let L=n0(U),A=`__stx_src_${$}`,M=L.map((V)=>`module.exports.${V} = ${V};`).join(`
1266
+ `);return{type:W,name:A,value:`${F}; ${W} ${U} = ${A};
1267
+ ${M}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,G,X,Q]=J,K=Q,q=$;if(u0(Q)){let _=p0(Z,$,Q);K=_.value,q=_.nextIndex}else q=$+1;return K=K.trim().replace(/;$/,""),{type:G,name:X,value:K,nextIndex:q}}function m0(Z,$){let Y=Z[$].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,G]=J,X=Y.replace(/^export\s+/,""),Q=$;if(u1(Y)){let K=p1(Z,$,X);X=K.functionCode,Q=K.nextIndex}else Q=$+1;return{name:G,functionCode:X,nextIndex:Q}}function u0(Z){let $=Z.trim();if($.startsWith("{"))return HZ($,"{","}",0)===-1;if($.startsWith("["))return HZ($,"[","]",0)===-1;return!s0($)}function s0(Z){let $={paren:0,bracket:0,brace:0},Y=null,J=0;for(let G=0;G<Z.length;G++){let X=Z[G];if((G>0?Z[G-1]:"")==="\\"&&Y)continue;if((X==='"'||X==="'")&&!Y){Y=X;continue}if(X===Y&&Y!=="`"){Y=null;continue}if(X==="`"&&!Y){Y="`";continue}if(X==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&X==="$"&&Z[G+1]==="{"){J++,G++;continue}if(J>0&&X==="{"){J++;continue}if(J>0&&X==="}"){J--;continue}if(Y)continue;if(X==="(")$.paren++;else if(X===")")$.paren--;else if(X==="[")$.bracket++;else if(X==="]")$.bracket--;else if(X==="{")$.brace++;else if(X==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Y===null}function u1(Z){let $=Z.indexOf("{");if($===-1)return!0;return HZ(Z,"{","}",$)===-1}function p0(Z,$,Y){let J=Y,G=$+1;while(G<Z.length&&!s0(J)){let X=Z[G];J+=`
1268
+ ${X}`,G++}return{value:J,nextIndex:G}}function p1(Z,$,Y){let J=Y,G=$+1;while(G<Z.length){let X=J.indexOf("{");if(X!==-1){if(HZ(J,"{","}",X)!==-1)break}let Q=Z[G];J+=`
1269
+ ${Q}`,G++}return{functionCode:J,nextIndex:G}}async function c1(Z,$,Y){let J=Z.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of J){let[,,Q,K]=X;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);$[Q]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);$[Q]=_()}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}}let G=Z.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of G){let[,,Q,K]=X;if(!(Q in $))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);$[Q]=_()}catch{}}try{let X=Z.replace(/^export\s+/gm,""),K=Function(`
1270
+ ${X}
1271
+ const result = {};
1272
+ ${Array.from(Z.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
1273
+ `)}
1274
+ return result;
1275
+ `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in $))$[q]=_})}catch{}}function o0(Z){let $=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=$?$[1]:"",J=$?Z.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):Z;return{scriptContent:Y,templateWithoutScript:J}}function r0(Z){let $=Z.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var j4=()=>{};var $6={};ZZ($6,{renderSlot:()=>t0,processSlots:()=>Z6,parseSlots:()=>a0,parseSlotElement:()=>i1,extractSlotContent:()=>o1,applySlots:()=>r1});function l1(Z,$){let Y=1,J=$;while(J<Z.length&&Y>0){let G=Z.slice(J).match(/^<template\b/);if(G){Y++,J+=G[0].length;continue}let X=Z.slice(J).match(/^<\/template\s*>/);if(X){if(Y--,Y===0)return J+X[0].length;J+=X[0].length;continue}J++}return Y===0?J:-1}function a0(Z){let $={default:"",named:new Map},Y=Z,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,G=[],X;while((X=J.exec(Z))!==null){let[Q,K,q,_,j]=X,B=K||q||_,W=X.index+Q.length,U=l1(Z,W);if(U!==-1){let z=Z.slice(W,U-11).trim();G.push({start:X.index,end:U,slotName:B,content:z,propsBinding:j||void 0}),$.named.set(B,{name:B,content:z,propsBinding:j||void 0})}}G.sort((Q,K)=>K.start-Q.start);for(let Q of G)Y=Y.slice(0,Q.start)+Y.slice(Q.end);return $.default=Y.trim(),$}function i1(Z){let $=Z.match(/name\s*=\s*["']([^"']+)["']/),Y=$?$[1]:"",J={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(Z))!==null)J[X[1]]=X[2];let Q=Z.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=Q?Q[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function t0(Z,$,Y,J){if(!Z)return Y;let G=Z.content;if(Z.propsBinding&&Object.keys($).length>0){let X=Z.propsBinding.trim(),Q={...J};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,j]=q.split(":").map((W)=>W.trim()),B=j||_;if($[_]!==void 0)Q[B]=$[_]}}else Q[X]=$;G=n1(G,Q)}return G}function n1(Z,$){return Z.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let G=J.trim(),X=e0(G,$);return String(X??"")}catch{return`{{ ${J} }}`}})}function e0(Z,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(Z)){let J=Z.split("."),G=$;for(let X of J)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let Y=Z.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,G,X]=Y,Q=$[J],K=parseInt(X,10);if(typeof Q==="number")switch(G){case"+":return Q+K;case"-":return Q-K;case"*":return Q*K;case"/":return Q/K}}try{let J=Object.keys($),G=Object.values($);return Function(...J,`return ${Z}`)(...G)}catch{return}}async function Z6(Z,$,Y){let J=Z;J=await s1(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,K,q,_)=>{let j=$.named.get(K),B=_?.trim()||"",W=q||"",U={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=z.exec(W))!==null){let F=H[1],O=H[2];U[F]=e0(O,Y)}return await t0(j,U,B,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(Q,K)=>{if(Q.includes("name="))return Q;let q=K?.trim()||"";return $.default||q}),J}async function s1(Z,$,Y){let J=[],G=[];Z.replace($,(K,...q)=>{let _=q[q.length-2];return G.push({match:K,index:_}),J.push(Y(K,...q.slice(0,-2))),K});let X=await Promise.all(J),Q=Z;for(let K=G.length-1;K>=0;K--){let{match:q,index:_}=G[K];Q=Q.slice(0,_)+X[K]+Q.slice(_+q.length)}return Q}function o1(Z){let $=a0(Z);return{defaultSlot:$.default,namedSlots:$.named}}async function r1(Z,$,Y,J){return await Z6(Z,{default:$,named:Y},J)}import a1 from"fs";import i from"path";import D4 from"process";function t1(Z){return/\bjs\b/.test(Z)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(Z)}function iZ(Z){return!t1(Z)}function EZ(Z){try{let $=Z.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");return $=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),new Bun.Transpiler({loader:"ts",target:"browser"}).transformSync($)}catch($){return console.warn("[STX] TypeScript transpilation error:",$),Z}}function e1(Z){let $=[],Y=new Set,J=0,G=0,X=Z.length,Q=(j)=>{G++;while(G<X){if(Z[G]==="\\"){G+=2;continue}if(Z[G]===j){G++;return}G++}},K=()=>{G++;while(G<X){if(Z[G]==="\\"){G+=2;continue}if(Z[G]==="`"){G++;return}if(Z[G]==="$"&&Z[G+1]==="{"){G+=2;let j=1;while(G<X&&j>0)if(Z[G]==="{")j++;else if(Z[G]==="}")j--;else if(Z[G]==="'"||Z[G]==='"')Q(Z[G]);else if(Z[G]==="`")K();else G++;continue}G++}},q=()=>{if(Z[G]==="/"&&Z[G+1]==="/"){while(G<X&&Z[G]!==`
1276
+ `)G++;return!0}if(Z[G]==="/"&&Z[G+1]==="*"){G+=2;while(G<X-1&&!(Z[G]==="*"&&Z[G+1]==="/"))G++;return G+=2,!0}return!1},_=()=>{if(J!==0)return;let j=Z.slice(G).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let z=j[2].split(",").map((H)=>{let F=H.trim().split(":");return F[F.length-1].trim()});for(let H of z)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))$.push(H),Y.add(H);return}let B=Z.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let z=B[2];if(!Y.has(z))$.push(z),Y.add(z);return}let W=Z.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!Y.has(z))$.push(z),Y.add(z);return}let U=Z.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!Y.has(z))$.push(z),Y.add(z)}};while(G<X){if(q())continue;if(Z[G]==="'"||Z[G]==='"'){Q(Z[G]);continue}if(Z[G]==="`"){K();continue}if(Z[G]==="{"){J++,G++;continue}if(Z[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test(Z[G])&&(G===0||/\s|[;{}()]/.test(Z[G-1])))_();G++}return $}async function nZ(Z,$,Y,J,G,X,Q,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (j4(),I4)),j=K??new Set;if(j.has(Z))return`[Circular component reference: ${Z}]`;j.add(Z);try{let B=(g)=>g.split("-").map((C)=>C.charAt(0).toUpperCase()+C.slice(1)).join(""),W=(g)=>g.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=Z.endsWith(".stx")?Z.slice(0,-4):Z,z=null,H=G.__importedComponents;if(H){let g=[U,U.toLowerCase(),B(U),W(U)];for(let C of g)if(H.has(C)){z=H.get(C);break}}let F=[];if(!z){let g=[`${U}.stx`,`${B(U)}.stx`,`${W(U)}.stx`],C=[...new Set(g)],d=[J,i.join(i.dirname(X),"components")].filter(Boolean);if(Q.componentsDir&&Q.componentsDir!==J)d.push(Q.componentsDir);let x=D4.cwd(),r=[i.resolve(x,"src/components"),i.resolve(x,"components")];for(let a of r)if(!d.includes(a))d.push(a);if(U.startsWith("./")||U.startsWith("../"))z=i.resolve(i.dirname(X),`${U}.stx`),F.push(z);else for(let a of d){if(!a)continue;for(let YZ of C){let zZ=i.join(a,YZ);if(F.push(zZ),await p(zZ)){z=zZ;break}}if(z)break;if(!z)try{let YZ=await import("fs");if(!YZ.statSync(a,{throwIfNoEntry:!1})?.isDirectory())continue;let O5=YZ.readdirSync(a,{withFileTypes:!0});for(let w4 of O5)if(w4.isDirectory()){let e3=i.join(a,w4.name);for(let Z1 of C){let L5=i.join(e3,Z1);if(F.push(L5),await p(L5)){z=L5;break}}if(z)break}}catch{}if(z)break}}if(!z||!await p(z)){let g=F.length>0?`
1277
+ Searched paths:
1278
+ ${F.map((C)=>` - ${C}`).join(`
1279
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${Z}']${g}`}q.add(z);let O;if(S5.has(z))O=S5.get(z);else try{O=await Bun.file(z).text(),S5.set(z,O)}catch(g){return`[Error loading component: ${g instanceof Error?g.message:String(g)}]`}let L={...G,...$,props:$,slot:Y},A=O,M=A.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)A=M[1].trim();let V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,N=[...O.matchAll(V)],R=[];for(let g of N){let C=g[1]||"",d=g[2]||"",x=C.includes("server"),r=C.includes("client")||C.includes('type="module"');if(iZ(C)&&d.trim())d=EZ(d);if(!r&&d)try{await _(d,L,z)}catch(YZ){}if(!x){let YZ=d.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),zZ=C.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");R.push(`<script${zZ}>${YZ}</script>`)}}let w=O.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=w?w[1]:"",E=w?w[2]:"",k="";if(w)k=`<style${D}>${E}</style>`;let T=A;if(T=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w)T=T.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&T.includes("{{ text || slot }}"))T=T.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,Y);let{extractSlotContent:S,applySlots:h}=await Promise.resolve().then(() => $6),{defaultSlot:c,namedSlots:b}=S(Y);T=await h(T,c||Y,b,L);for(let[g,C]of Object.entries(L))if(typeof C==="string"){if(C.includes("<")&&C.includes(">")||C.includes("&lt;")||C.includes("&quot;")){let d=x0(C);L[g]=d}}let u=R.some((g)=>/\b(state|derived|effect)\s*\(/.test(g)),QZ={...Q,componentsDir:i.dirname(z),skipSignalsRuntime:!0,skipEventDirectives:u},s=await sZ(T,L,z,QZ,q),e=`stx_${U.replace(/[^a-zA-Z0-9]/g,"_")}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,KZ=s;if(u){if(KZ=`<div data-stx-scope="${e}">${s}</div>`,KZ=R.map((C)=>{let d=C.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!d)return C;let[,x,r]=d,a=DZ(r),YZ=`
1280
+ (function() {
1281
+ const { state, derived, effect, batch } = window.stx;
1282
+ const __scope = window.stx._scopes = window.stx._scopes || {};
1283
+ const __scopeVars = __scope['${e}'] = __scope['${e}'] || {};
1284
+
1285
+ // Scope-specific lifecycle callbacks
1286
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
1287
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
1288
+ const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
1289
+ const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
1290
+
1291
+ ${a}
1292
+
1293
+ // Register all defined signals and functions in this scope
1294
+ const __localVars = {};
1295
+ try {
1296
+ ${e1(a).map((zZ)=>`if (typeof ${zZ} !== 'undefined') __localVars['${zZ}'] = ${zZ};`).join(`
1297
+ `)}
1298
+ } catch(e) {}
1299
+ Object.assign(__scopeVars, __localVars);
1300
+ })();`;return`<script data-stx-scoped${x}>${YZ}</script>`}).join(`
1301
+ `)+`
1302
+ `+KZ,k)KZ+=`
1303
+ `+k}else{if(k)KZ+=`
1304
+ `+k;if(R.length>0){let g=L.__stx_event_bindings||[],C=R.map((d)=>{let x=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!x)return d;return E4(x[1],{eventBindings:g})});KZ+=`
1305
+ `+C.join(`
1306
+ `),L.__stx_event_bindings=[]}}return KZ}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{j.delete(Z)}}async function p(Z){try{return(await a1.promises.stat(Z)).isFile()}catch{return!1}}async function b5(Z,$,Y,J){if(Y.debug)console.log(`Resolving template path: ${Z} from ${$}`);let G=i.dirname($);if(Z.startsWith("/")){let _=i.join(D4.cwd(),Z);if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await p(_)&&J)J.add(_);return _}let X=i.join(G,Z);if(await p(X)){if(Y.debug)console.log(`Found direct path: ${X}`);if(J)J.add(X);return X}if(!Z.endsWith(".stx")&&!Z.endsWith(".jsx")&&!Z.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let j=`${X}${_}`;if(await p(j)){if(Y.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let Q=i.join(G,"layouts");if(await p(Q)){let _=i.join(Q,Z);if(await p(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!Z.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let _=i.isAbsolute(Y.layoutsDir)?Y.layoutsDir:i.resolve(D4.cwd(),Y.layoutsDir),j=i.join(_,Z);if(await p(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!Z.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${B}`);if(J)J.add(B);return B}}}if(Z.startsWith("layouts/")||Z.includes("/layouts/")){let _=Z.split("layouts/"),j=i.join(Y.partialsDir||G,"layouts",_[1]);if(await p(j)){if(Y.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(Q=i.join(Y.partialsDir,"layouts"),await p(Q)){let _=i.join(Q,Z);if(await p(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!Z.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=Y.partialsDir||i.join(D4.cwd(),"views"),q=i.join(K,Z);if(await p(q)){if(Y.debug)console.log(`Found in views path: ${q}`);if(J)J.add(q);return q}if(!Z.endsWith(".stx")){let _=`${q}.stx`;if(await p(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(G.includes("temp")){let _=i.join(i.dirname(G),"layouts",Z);if(await p(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!Z.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${Z} (referenced from ${$})`);else console.warn(`Template not found: ${Z} (referenced from ${$})`);return null}function Y6(Z,$,Y){let J=0,G="",X="";try{if(typeof $==="number"&&$>=0){let Q=Z.split(`
1307
+ `),K=0;for(let q=0;q<Q.length;q++)if(K+=Q[q].length+1,K>=$){J=q+1,G=Q[q].trim();let _=Math.max(0,q-2),j=Math.min(Q.length,q+3);X=Q.slice(_,j).map((B,W)=>{let U=_+W+1;return`${U===J?"> ":" "}${U}: ${B}`}).join(`
1308
+ `);break}}else if(Y){let Q=Z.indexOf(Y);if(Q>=0)return Y6(Z,Q)}}catch{}return{lineNumber:J,lineContent:G,context:X}}function l(Z,$,Y,J,G,X){let{lineNumber:Q,context:K}=Y6(J,G,X),q=Y.split("/").pop(),_=`
1309
+ ${v.bold}${v.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${v.reset}
1310
+ `;if(_+=`${v.bold}${v.red}\u2502${v.reset} ${v.bold}${v.bgRed} ERROR ${v.reset} ${v.red}${Z} Error${v.reset}${" ".repeat(Math.max(0,43-Z.length))}${v.bold}${v.red}\u2502${v.reset}
1311
+ `,_+=`${v.bold}${v.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${v.reset}
1312
+ `,_+=`
1313
+ ${v.cyan}${v.bold}File:${v.reset} ${v.dim}${q}${v.reset}`,Q>0)_+=` ${v.gray}(line ${Q})${v.reset}`;if(_+=`
1314
+ ${v.yellow}${v.bold}Message:${v.reset} ${$}
1315
+ `,K)_+=`
1316
+ ${v.blue}${v.bold}Context:${v.reset}
1317
+ ${v.dim}${K}${v.reset}
1318
+ `;return _}var S5,v;var NZ=I(()=>{P5();cZ();K4();lZ();C5();h0();j4();S5=new q4(500);v={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});function JY(Z){let $=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,J;while((J=Y.exec(Z))!==null)if(!YY.has(J[1]))$.add(J[1]);return Array.from($)}function XY(Z){let $=new Set,Y=new Set,J=Z;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let G=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,Q;while((Q=X.exec(Z))!==null){let q=Q[1],_=Q[2];if(Q[0].includes("import type"))continue;q.split(",").map((B)=>B.trim().split(/\s+as\s+/)[0]).filter((B)=>B.length>0).forEach((B)=>{if(G.add(B),_==="stx")$.add(B);else Y.add(B)}),J=J.replace(Q[0],"// [auto-import processed]")}for(let q of ZY){if(G.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))$.add(q)}for(let q of $Y){if(G.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=JY(J);for(let q of K)if(!G.has(q))Y.add(q);return{code:J,stxImports:Array.from($),browserImports:Array.from(Y)}}function GY(Z,$){let Y=[];if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.stx || window;`);if($.length>0)Y.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1202
1319
  ${Y.join(`
1203
1320
  `)}
1204
- `;return""}function v1(Z){let $=[];if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=x1[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function f1(Z,$){let{elementId:Y,event:J,handler:G,modifiers:X}=Z,Q=v1(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(Q)_+=`${Q}; `;if(X.debounce!==null)return` ;(function() {
1321
+ `;return""}function KY(Z){let $=[];if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=QY[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function qY(Z,$){let{elementId:Y,event:J,handler:G,modifiers:X}=Z,Q=KY(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(Q)_+=`${Q}; `;if(X.debounce!==null)return` ;(function() {
1205
1322
  var $el = document.getElementById('${Y}')
1206
1323
  if (!$el) return
1207
1324
  var __timer
@@ -1223,18 +1340,24 @@ ${Y.join(`
1223
1340
  })()`;return` var $el = document.getElementById('${Y}')
1224
1341
  if ($el) $el.addEventListener('${J}', function($event) {
1225
1342
  ${_}${G}
1226
- }${q})`}function g1(Z){if(Z.length===0)return"";return`
1343
+ }${q})`}function _Y(Z){if(Z.length===0)return"";return`
1227
1344
  // STX: auto-generated event bindings
1228
- ${Z.map((Y,J)=>f1(Y,J)).join(`
1229
- `)}`}function T4(Z,$={}){let Y=Z,J="";if($.autoImports!==!1){let K=C1(Y);Y=K.code,J=y1(K.stxImports,K.browserImports)}Y=DZ(Y);let G=g1($.eventBindings||[]),X=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(X)){let K=X.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${K?` ${K}`:""}`}>
1345
+ ${Z.map((Y,J)=>qY(Y,J)).join(`
1346
+ `)}`}function jY(Z){let $=[],Y=new Set,J=Z.replace(/^\s*import\s+.*$/gm,""),G=/^[ \t]*(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*=/gm,X;while(X=G.exec(J))if(!X[1].startsWith("_")&&!Y.has(X[1]))$.push(X[1]),Y.add(X[1]);let Q=/^[ \t]*(?:const|let|var)\s+\{([^}]+)\}\s*=/gm;while(X=Q.exec(J))X[1].split(",").forEach((q)=>{let _=q.trim().split(/[\s:]/)[0].trim();if(_&&!_.startsWith("_")&&!Y.has(_))$.push(_),Y.add(_)});let K=/^[ \t]*(?:async\s+)?function\s+([a-zA-Z_$]\w*)/gm;while(X=K.exec(J))if(!X[1].startsWith("_")&&!Y.has(X[1]))$.push(X[1]),Y.add(X[1]);return $}function E4(Z,$={}){let Y=Z,J="";if($.autoImports!==!1){let _=XY(Y);Y=_.code,J=GY(_.stxImports,_.browserImports)}Y=DZ(Y),Y=EZ(Y);let G=_Y($.eventBindings||[]),X=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(X)){let _=X.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${_?` ${_}`:""}`}>
1230
1347
  ${J}${Y}
1231
1348
  ${G}
1232
- </script>`}return`<script data-stx-scoped>
1349
+ </script>`}let K=/\b(state|derived|effect)\s*\(/.test(Z),q=/function __stx_setup_/.test(Y);if(K&&!q){let _=jY(Z),j=_.length>0?`
1350
+ return { ${_.join(", ")} };`:"";return`<script data-stx-scoped>
1351
+ window.stx.mount(function() {
1352
+ 'use strict';
1353
+ ${J}${Y}
1354
+ ${G}${j}
1355
+ })</script>`}return`<script data-stx-scoped>
1233
1356
  ;(function() {
1234
1357
  'use strict';
1235
1358
  ${J}${Y}
1236
1359
  ${G}
1237
- })()</script>`}var S1,b1,x1;var V5=I(()=>{K4();S1=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","action","createSelector","h","Fragment"],b1=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","auth","useAuth","initApi","formatAreaSize","formatDistance","formatElevation","formatDuration","getRelativeTime","fetchData"];x1={left:0,middle:1,right:2}});function k0(Z){return Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function S0(Z,$){let Y=Z.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=Z.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function h1(Z){let $=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[G,X,Q]=J,K=J.index,q=S0(Q,"x-data");if(!q)continue;let _=`__stx_scope_${C0++}`,j=S0(Q,"x-init"),B=d1(Z,X,K+G.length),W=Z.slice(K,B.endIndex),U=m1(W,K),z=u1(W);$.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:j,bindings:U,refs:z})}return $}function d1(Z,$,Y){let J=1,G=Y,X=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),K=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(J>0&&G<Z.length){X.lastIndex=G,Q.lastIndex=G,K.lastIndex=G;let q=X.exec(Z),_=Q.exec(Z),j=K.exec(Z);if(j&&j.index<(q?.index??1/0)){G=j.index+j[0].length;continue}if(!_)return{endIndex:Z.length};if(q&&q.index<_.index)J++,G=q.index+q[0].length;else{if(J--,J===0)return{endIndex:_.index+_[0].length};G=_.index+_[0].length}}return{endIndex:Z.length}}function m1(Z,$){let Y=[];function J(K,q){let _=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*"([^"]*)"[^>]*)>`,"gi"),j;while((j=_.exec(Z))!==null){let[,W,U,z]=j,H=q4(U),L=q==="model"?b0(U,W):void 0,F=q==="show"||q==="hide"?P0(U):void 0;Y.push({elementId:H,type:q,expression:z,inputType:L,transition:F})}let B=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*'([^']*)'[^>]*)>`,"gi");while((j=B.exec(Z))!==null){let[,W,U,z]=j,H=q4(U),L=q==="model"?b0(U,W):void 0,F=q==="show"||q==="hide"?P0(U):void 0;Y.push({elementId:H,type:q,expression:z,inputType:L,transition:F})}}J("x-model","model"),J("x-show","show"),J("x-hide","hide"),J("x-text","text"),J("x-html","html");let G=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*"([^"]*)"[^>]*)>/gi,X;while((X=G.exec(Z))!==null){let[,K,q,_]=X,j=q4(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}let Q=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*'([^']*)'[^>]*)>/gi;while((X=Q.exec(Z))!==null){let[,K,q,_]=X,j=q4(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}return Y}function u1(Z){let $=new Map,Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,X]=J,Q=q4(G);$.set(X,Q)}return $}function q4(Z){let $=Z.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${I4++}`}function b0(Z,$){if($.toLowerCase()==="select")return"select";if($.toLowerCase()==="textarea")return"textarea";let Y=Z.match(/\btype\s*=\s*["']([^"']*)["']/);return Y?Y[1].toLowerCase():"text"}function P0(Z){if(/\bx-transition(?:\s|>|$|=)/.test(Z)){let $={enabled:!0};if(/\bx-transition(?:\s|>|$)/.test(Z)&&!/\bx-transition\s*=/.test(Z))return $;let J=Z.match(/x-transition:enter\s*=\s*["']([^"']*)["']/);if(J)$.enter=J[1];let G=Z.match(/x-transition:enter-start\s*=\s*["']([^"']*)["']/);if(G)$.enterStart=G[1];let X=Z.match(/x-transition:enter-end\s*=\s*["']([^"']*)["']/);if(X)$.enterEnd=X[1];let Q=Z.match(/x-transition:leave\s*=\s*["']([^"']*)["']/);if(Q)$.leave=Q[1];let K=Z.match(/x-transition:leave-start\s*=\s*["']([^"']*)["']/);if(K)$.leaveStart=K[1];let q=Z.match(/x-transition:leave-end\s*=\s*["']([^"']*)["']/);if(q)$.leaveEnd=q[1];let _=Z.match(/x-transition\.duration\.(\d+)(?:ms)?/);if(_)$.duration=parseInt(_[1],10);return $}return}function p1(){return`
1360
+ })()</script>`}var ZY,$Y,YY,QY;var P5=I(()=>{K4();NZ();ZY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","action","createSelector","h","Fragment"],$Y=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],YY=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);QY={left:0,middle:1,right:2}});function J6(Z){return Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function X6(Z,$){let Y=Z.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=Z.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function BY(Z){let $=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[G,X,Q]=J,K=J.index,q=X6(Q,"x-data");if(!q)continue;let _=`__stx_scope_${K6++}`,j=X6(Q,"x-init"),B=WY(Z,X,K+G.length),W=Z.slice(K,B.endIndex),U=zY(W,K),z=UY(W);$.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:j,bindings:U,refs:z})}return $}function WY(Z,$,Y){let J=1,G=Y,X=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),K=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(J>0&&G<Z.length){X.lastIndex=G,Q.lastIndex=G,K.lastIndex=G;let q=X.exec(Z),_=Q.exec(Z),j=K.exec(Z);if(j&&j.index<(q?.index??1/0)){G=j.index+j[0].length;continue}if(!_)return{endIndex:Z.length};if(q&&q.index<_.index)J++,G=q.index+q[0].length;else{if(J--,J===0)return{endIndex:_.index+_[0].length};G=_.index+_[0].length}}return{endIndex:Z.length}}function zY(Z,$){let Y=[];function J(K,q){let _=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*"([^"]*)"[^>]*)>`,"gi"),j;while((j=_.exec(Z))!==null){let[,W,U,z]=j,H=B4(U),F=q==="model"?G6(U,W):void 0,O=q==="show"||q==="hide"?Q6(U):void 0;Y.push({elementId:H,type:q,expression:z,inputType:F,transition:O})}let B=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*'([^']*)'[^>]*)>`,"gi");while((j=B.exec(Z))!==null){let[,W,U,z]=j,H=B4(U),F=q==="model"?G6(U,W):void 0,O=q==="show"||q==="hide"?Q6(U):void 0;Y.push({elementId:H,type:q,expression:z,inputType:F,transition:O})}}J("x-model","model"),J("x-show","show"),J("x-hide","hide"),J("x-text","text"),J("x-html","html");let G=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*"([^"]*)"[^>]*)>/gi,X;while((X=G.exec(Z))!==null){let[,K,q,_]=X,j=B4(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}let Q=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*'([^']*)'[^>]*)>/gi;while((X=Q.exec(Z))!==null){let[,K,q,_]=X,j=B4(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}return Y}function UY(Z){let $=new Map,Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,X]=J,Q=B4(G);$.set(X,Q)}return $}function B4(Z){let $=Z.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${k4++}`}function G6(Z,$){if($.toLowerCase()==="select")return"select";if($.toLowerCase()==="textarea")return"textarea";let Y=Z.match(/\btype\s*=\s*["']([^"']*)["']/);return Y?Y[1].toLowerCase():"text"}function Q6(Z){if(/\bx-transition(?:\s|>|$|=)/.test(Z)){let $={enabled:!0};if(/\bx-transition(?:\s|>|$)/.test(Z)&&!/\bx-transition\s*=/.test(Z))return $;let J=Z.match(/x-transition:enter\s*=\s*["']([^"']*)["']/);if(J)$.enter=J[1];let G=Z.match(/x-transition:enter-start\s*=\s*["']([^"']*)["']/);if(G)$.enterStart=G[1];let X=Z.match(/x-transition:enter-end\s*=\s*["']([^"']*)["']/);if(X)$.enterEnd=X[1];let Q=Z.match(/x-transition:leave\s*=\s*["']([^"']*)["']/);if(Q)$.leave=Q[1];let K=Z.match(/x-transition:leave-start\s*=\s*["']([^"']*)["']/);if(K)$.leaveStart=K[1];let q=Z.match(/x-transition:leave-end\s*=\s*["']([^"']*)["']/);if(q)$.leaveEnd=q[1];let _=Z.match(/x-transition\.duration\.(\d+)(?:ms)?/);if(_)$.duration=parseInt(_[1],10);return $}return}function HY(){return`
1238
1361
  // STX Reactive Runtime - x-cloak and transition CSS
1239
1362
  (function() {
1240
1363
  var style = document.createElement('style');
@@ -1593,7 +1716,7 @@ window.__stx_reactive = (function() {
1593
1716
 
1594
1717
  return { initScope, evaluate, execute, reactive, transitionIn, transitionOut };
1595
1718
  })();
1596
- `}function c1(Z){if(Z.length===0)return"";let $=Z.map((Y)=>{let J=JSON.stringify(Y.bindings.map((X)=>({elementId:X.elementId,type:X.type,expression:X.expression,attribute:X.attribute,inputType:X.inputType,transition:X.transition}))),G=JSON.stringify(Object.fromEntries(Y.refs));return`
1719
+ `}function OY(Z){if(Z.length===0)return"";let $=Z.map((Y)=>{let J=JSON.stringify(Y.bindings.map((X)=>({elementId:X.elementId,type:X.type,expression:X.expression,attribute:X.attribute,inputType:X.inputType,transition:X.transition}))),G=JSON.stringify(Object.fromEntries(Y.refs));return`
1597
1720
  (function() {
1598
1721
  var scopeEl = document.querySelector('${Y.selector}');
1599
1722
  if (!scopeEl) return;
@@ -1603,17 +1726,18 @@ window.__stx_reactive = (function() {
1603
1726
  })();`}).join(`
1604
1727
  `);return`
1605
1728
  <script data-stx-reactive>
1606
- ${p1()}
1729
+ ${HY()}
1607
1730
 
1608
1731
  // Initialize all reactive scopes
1609
1732
  document.addEventListener('DOMContentLoaded', function() {
1610
1733
  ${$}
1611
1734
  });
1612
- </script>`}function CZ(Z,$){let Y=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${$.source}[^>]*)>`,"gi");return Z.replace(Y,(J,G,X)=>{if(/\bid\s*=\s*["']/.test(X))return J;let Q=`__stx_el_${I4++}`;return`<${G} id="${Q}" ${X}>`})}function l1(Z){let $=Z,Y=[/\s*x-data\s*=\s*"[^"]*"/g,/\s*x-init\s*=\s*"[^"]*"/g,/\s*x-model\s*=\s*"[^"]*"/g,/\s*x-show\s*=\s*"[^"]*"/g,/\s*x-hide\s*=\s*"[^"]*"/g,/\s*x-text\s*=\s*"[^"]*"/g,/\s*x-html\s*=\s*"[^"]*"/g,/\s*x-ref\s*=\s*"[^"]*"/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*:[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*x-transition:enter\s*=\s*"[^"]*"/g,/\s*x-transition:enter-start\s*=\s*"[^"]*"/g,/\s*x-transition:enter-end\s*=\s*"[^"]*"/g,/\s*x-transition:leave\s*=\s*"[^"]*"/g,/\s*x-transition:leave-start\s*=\s*"[^"]*"/g,/\s*x-transition:leave-end\s*=\s*"[^"]*"/g,/\s*x-transition\s*=\s*"[^"]*"/g,/\s*x-data\s*=\s*'[^']*'/g,/\s*x-init\s*=\s*'[^']*'/g,/\s*x-model\s*=\s*'[^']*'/g,/\s*x-show\s*=\s*'[^']*'/g,/\s*x-hide\s*=\s*'[^']*'/g,/\s*x-text\s*=\s*'[^']*'/g,/\s*x-html\s*=\s*'[^']*'/g,/\s*x-ref\s*=\s*'[^']*'/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*:[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*x-transition:enter\s*=\s*'[^']*'/g,/\s*x-transition:enter-start\s*=\s*'[^']*'/g,/\s*x-transition:enter-end\s*=\s*'[^']*'/g,/\s*x-transition:leave\s*=\s*'[^']*'/g,/\s*x-transition:leave-start\s*=\s*'[^']*'/g,/\s*x-transition:leave-end\s*=\s*'[^']*'/g,/\s*x-transition\s*=\s*'[^']*'/g,/\s*x-transition\.duration\.\d+(?:ms)?/g,/\s*x-transition(?=[\s>\/])/g];for(let J of Y)$=$.replace(J,"");return $}function y0(Z,$,Y){if(C0=0,I4=0,!s1(Z))return Z;let J=i1(Z),G=h1(J);if(G.length===0)return Z;J=n1(J,G);let X=c1(G);if(J.includes("</body>"))J=J.replace("</body>",`${X}
1613
- </body>`);else J+=X;return J}function i1(Z){let $=Z;return I4=0,$=CZ($,/x-model\s*=\s*["']/),$=CZ($,/x-show\s*=\s*["']/),$=CZ($,/x-hide\s*=\s*["']/),$=CZ($,/x-text\s*=\s*["']/),$=CZ($,/x-html\s*=\s*["']/),$=CZ($,/(?:x-bind:|:)[a-z]/),$=CZ($,/x-ref\s*=\s*["']/),$}function n1(Z,$){let Y=Z;for(let J of $)Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${k0(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${k0(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`);return Y=l1(Y),Y}function s1(Z){return/x-data\s*=\s*["']/.test(Z)}var C0=0,I4=0;class M5{options;cache=new Map;isNavigating=!1;currentUrl;constructor(Z={}){this.options={container:Z.container??"main",linkSelector:Z.linkSelector??"a[href]",loadingClass:Z.loadingClass??"stx-navigating",viewTransitions:Z.viewTransitions??!0,cache:Z.cache??!0,scrollToTop:Z.scrollToTop??!0,onBeforeNavigate:Z.onBeforeNavigate??(()=>!0),onAfterNavigate:Z.onAfterNavigate??(()=>{}),onError:Z.onError??(($)=>console.error("[STX Router]",$))},this.currentUrl=window.location.href}init(){if(document.addEventListener("click",this.handleClick.bind(this)),window.addEventListener("popstate",this.handlePopState.bind(this)),this.options.cache)this.cacheCurrentPage()}async navigate(Z,$=!0){if(this.isNavigating)return;let Y=new URL(Z,window.location.origin);if(Y.href===this.currentUrl)return;if(Y.origin!==window.location.origin){window.location.href=Z;return}if(this.options.onBeforeNavigate(Z)===!1)return;this.isNavigating=!0,document.body.classList.add(this.options.loadingClass);try{let J=await this.fetchPage(Y.href);if(J){if(await this.swapContent(J),$)window.history.pushState({url:Y.href},"",Y.href);if(this.currentUrl=Y.href,this.options.scrollToTop)window.scrollTo({top:0,behavior:"instant"});this.options.onAfterNavigate(Y.href)}}catch(J){this.options.onError(J,Z),window.location.href=Z}finally{this.isNavigating=!1,document.body.classList.remove(this.options.loadingClass)}}async prefetch(Z){let $=new URL(Z,window.location.origin);if($.origin!==window.location.origin)return;if(this.cache.has($.href))return;try{await this.fetchPage($.href)}catch{}}clearCache(){this.cache.clear()}handleClick(Z){let $=Z.target.closest(this.options.linkSelector);if(!$)return;if(Z.metaKey||Z.ctrlKey||Z.shiftKey||Z.altKey)return;if(Z.button!==0)return;if($.target&&$.target!=="_self")return;if($.hasAttribute("download"))return;let Y=$.getAttribute("href");if(!Y||Y.startsWith("#")||Y.startsWith("mailto:")||Y.startsWith("tel:"))return;if($.hasAttribute("data-stx-no-router"))return;if(new URL(Y,window.location.origin).origin!==window.location.origin)return;Z.preventDefault(),this.navigate(Y)}handlePopState(Z){let $=Z.state?.url||window.location.href;this.navigate($,!1)}async fetchPage(Z){if(this.options.cache&&this.cache.has(Z)){let K=this.cache.get(Z);if(Date.now()-K.timestamp<300000)return{html:K.html,title:K.title};this.cache.delete(Z)}let $=await fetch(Z,{headers:{"X-STX-Router":"true",Accept:"text/html"}});if(!$.ok)throw Error(`Failed to fetch ${Z}: ${$.status}`);let Y=await $.text(),G=new DOMParser().parseFromString(Y,"text/html"),X=G.querySelector(this.options.container);if(!X)throw Error(`Container "${this.options.container}" not found in response`);let Q={html:X.innerHTML,title:G.title};if(this.options.cache)this.cache.set(Z,{...Q,timestamp:Date.now()});return Q}async swapContent(Z){let $=document.querySelector(this.options.container);if(!$)throw Error(`Container "${this.options.container}" not found`);let Y=()=>{$.innerHTML=Z.html,document.title=Z.title,$.querySelectorAll("script").forEach((G)=>{let X=document.createElement("script");Array.from(G.attributes).forEach((Q)=>{X.setAttribute(Q.name,Q.value)}),X.textContent=G.textContent,G.parentNode?.replaceChild(X,G)}),window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url:this.currentUrl}}))};if(this.options.viewTransitions&&"startViewTransition"in document)await document.startViewTransition(Y).finished;else Y()}cacheCurrentPage(){let Z=document.querySelector(this.options.container);if(Z)this.cache.set(this.currentUrl,{html:Z.innerHTML,title:document.title,timestamp:Date.now()})}}function o1(Z){if(mZ)return mZ;return mZ=new M5(Z),mZ.init(),mZ}function r1(){return mZ}var mZ=null;var x0=I(()=>{if(typeof window<"u")window.STXRouter={init:o1,get:r1,Router:M5}});function v0(){return`
1735
+ </script>`}function yZ(Z,$){let Y=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${$.source}[^>]*)>`,"gi");return Z.replace(Y,(J,G,X)=>{if(/\bid\s*=\s*["']/.test(X))return J;let Q=`__stx_el_${k4++}`;return`<${G} id="${Q}" ${X}>`})}function LY(Z){let $=Z,Y=[/\s*x-data\s*=\s*"[^"]*"/g,/\s*x-init\s*=\s*"[^"]*"/g,/\s*x-model\s*=\s*"[^"]*"/g,/\s*x-show\s*=\s*"[^"]*"/g,/\s*x-hide\s*=\s*"[^"]*"/g,/\s*x-text\s*=\s*"[^"]*"/g,/\s*x-html\s*=\s*"[^"]*"/g,/\s*x-ref\s*=\s*"[^"]*"/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*:(?!click|dblclick|submit|input|change|keydown|keyup|keypress|focus|blur|mousedown|mouseup|mousemove|mouseenter|mouseleave|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove|if|for|show|model|class|text|html|ref|style)[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*x-transition:enter\s*=\s*"[^"]*"/g,/\s*x-transition:enter-start\s*=\s*"[^"]*"/g,/\s*x-transition:enter-end\s*=\s*"[^"]*"/g,/\s*x-transition:leave\s*=\s*"[^"]*"/g,/\s*x-transition:leave-start\s*=\s*"[^"]*"/g,/\s*x-transition:leave-end\s*=\s*"[^"]*"/g,/\s*x-transition\s*=\s*"[^"]*"/g,/\s*x-data\s*=\s*'[^']*'/g,/\s*x-init\s*=\s*'[^']*'/g,/\s*x-model\s*=\s*'[^']*'/g,/\s*x-show\s*=\s*'[^']*'/g,/\s*x-hide\s*=\s*'[^']*'/g,/\s*x-text\s*=\s*'[^']*'/g,/\s*x-html\s*=\s*'[^']*'/g,/\s*x-ref\s*=\s*'[^']*'/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*:(?!click|dblclick|submit|input|change|keydown|keyup|keypress|focus|blur|mousedown|mouseup|mousemove|mouseenter|mouseleave|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove|if|for|show|model|class|text|html|ref|style)[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*x-transition:enter\s*=\s*'[^']*'/g,/\s*x-transition:enter-start\s*=\s*'[^']*'/g,/\s*x-transition:enter-end\s*=\s*'[^']*'/g,/\s*x-transition:leave\s*=\s*'[^']*'/g,/\s*x-transition:leave-start\s*=\s*'[^']*'/g,/\s*x-transition:leave-end\s*=\s*'[^']*'/g,/\s*x-transition\s*=\s*'[^']*'/g,/\s*x-transition\.duration\.\d+(?:ms)?/g,/\s*x-transition(?=[\s>\/])/g];for(let J of Y)$=$.replace(J,"");return $}function q6(Z,$,Y){if(K6=0,k4=0,!NY(Z))return Z;let J=FY(Z),G=BY(J);if(G.length===0)return Z;J=AY(J,G);let X=OY(G);if(J.includes("</body>"))J=J.replace("</body>",`${X}
1736
+ </body>`);else J+=X;return J}function FY(Z){let $=Z;return k4=0,$=yZ($,/x-model\s*=\s*["']/),$=yZ($,/x-show\s*=\s*["']/),$=yZ($,/x-hide\s*=\s*["']/),$=yZ($,/x-text\s*=\s*["']/),$=yZ($,/x-html\s*=\s*["']/),$=yZ($,/(?:x-bind:|:)[a-z]/),$=yZ($,/x-ref\s*=\s*["']/),$}function AY(Z,$){let Y=Z;for(let J of $)Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${J6(J.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${J6(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`);return Y=LY(Y),Y}function NY(Z){return/x-data\s*=\s*["']/.test(Z)}var K6=0,k4=0;class y5{options;cache=new Map;isNavigating=!1;currentUrl;constructor(Z={}){this.options={container:Z.container??"main",linkSelector:Z.linkSelector??"a[href]",loadingClass:Z.loadingClass??"stx-navigating",viewTransitions:Z.viewTransitions??!0,cache:Z.cache??!0,scrollToTop:Z.scrollToTop??!0,onBeforeNavigate:Z.onBeforeNavigate??(()=>!0),onAfterNavigate:Z.onAfterNavigate??(()=>{}),onError:Z.onError??(($)=>console.error("[STX Router]",$))},this.currentUrl=window.location.href}init(){if(document.addEventListener("click",this.handleClick.bind(this)),window.addEventListener("popstate",this.handlePopState.bind(this)),this.options.cache)this.cacheCurrentPage()}async navigate(Z,$=!0){if(this.isNavigating)return;let Y=new URL(Z,window.location.origin);if(Y.href===this.currentUrl)return;if(Y.origin!==window.location.origin){window.location.href=Z;return}if(this.options.onBeforeNavigate(Z)===!1)return;this.isNavigating=!0,document.body.classList.add(this.options.loadingClass);try{let J=await this.fetchPage(Y.href);if(J){if(await this.swapContent(J),$)window.history.pushState({url:Y.href},"",Y.href);if(this.currentUrl=Y.href,this.options.scrollToTop)window.scrollTo({top:0,behavior:"instant"});this.options.onAfterNavigate(Y.href)}}catch(J){this.options.onError(J,Z),window.location.href=Z}finally{this.isNavigating=!1,document.body.classList.remove(this.options.loadingClass)}}async prefetch(Z){let $=new URL(Z,window.location.origin);if($.origin!==window.location.origin)return;if(this.cache.has($.href))return;try{await this.fetchPage($.href)}catch{}}clearCache(){this.cache.clear()}handleClick(Z){let $=Z.target.closest(this.options.linkSelector);if(!$)return;if(Z.metaKey||Z.ctrlKey||Z.shiftKey||Z.altKey)return;if(Z.button!==0)return;if($.target&&$.target!=="_self")return;if($.hasAttribute("download"))return;let Y=$.getAttribute("href");if(!Y||Y.startsWith("#")||Y.startsWith("mailto:")||Y.startsWith("tel:"))return;if($.hasAttribute("data-stx-no-router"))return;if(new URL(Y,window.location.origin).origin!==window.location.origin)return;Z.preventDefault(),this.navigate(Y)}handlePopState(Z){let $=Z.state?.url||window.location.href;this.navigate($,!1)}async fetchPage(Z){if(this.options.cache&&this.cache.has(Z)){let K=this.cache.get(Z);if(Date.now()-K.timestamp<300000)return{html:K.html,title:K.title};this.cache.delete(Z)}let $=await fetch(Z,{headers:{"X-STX-Router":"true",Accept:"text/html"}});if(!$.ok)throw Error(`Failed to fetch ${Z}: ${$.status}`);let Y=await $.text(),G=new DOMParser().parseFromString(Y,"text/html"),X=G.querySelector(this.options.container);if(!X)throw Error(`Container "${this.options.container}" not found in response`);let Q={html:X.innerHTML,title:G.title};if(this.options.cache)this.cache.set(Z,{...Q,timestamp:Date.now()});return Q}async swapContent(Z){let $=document.querySelector(this.options.container);if(!$)throw Error(`Container "${this.options.container}" not found`);let Y=()=>{$.innerHTML=Z.html,document.title=Z.title,$.querySelectorAll("script").forEach((G)=>{let X=document.createElement("script");Array.from(G.attributes).forEach((Q)=>{X.setAttribute(Q.name,Q.value)}),X.textContent=G.textContent,G.parentNode?.replaceChild(X,G)}),window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url:this.currentUrl}}))};if(this.options.viewTransitions&&"startViewTransition"in document)await document.startViewTransition(Y).finished;else Y()}cacheCurrentPage(){let Z=document.querySelector(this.options.container);if(Z)this.cache.set(this.currentUrl,{html:Z.innerHTML,title:document.title,timestamp:Date.now()})}}function RY(Z){if(oZ)return oZ;return oZ=new y5(Z),oZ.init(),oZ}function VY(){return oZ}var oZ=null;var _6=I(()=>{if(typeof window<"u")window.STXRouter={init:RY,get:VY,Router:y5}});function j6(){return`
1614
1737
  ;(function(){
1615
1738
  'use strict';
1616
- var o={container:'main',linkSelector:'a[href]',loadingClass:'stx-navigating',viewTransitions:!0,cache:!0,scrollToTop:!0,prefetch:!0};
1739
+ var d={container:'main',linkSelector:'a[href]',loadingClass:'stx-navigating',viewTransitions:!0,cache:!0,scrollToTop:!0,prefetch:!0};
1740
+ var o=Object.assign({},d,window.STX_ROUTER_OPTIONS||{});
1617
1741
  var c=new Map(),p=new Set(),n=!1,u=location.href;
1618
1742
  function init(){
1619
1743
  document.addEventListener('click',handleClick,!0);
@@ -1690,16 +1814,16 @@ ${$}
1690
1814
  window.stxRouter={navigate:navigate,clearCache:function(){c.clear()}};
1691
1815
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1692
1816
  })();
1693
- `}var f0=I(()=>{x0();w5()});async function a1(Z,$,Y,J){let G=$[0]?.replace(/['"]/g,"")||"main",X=v0();if(G!=="main")X=X.replace("container:'main'",`container:'${G}'`);return`<script>${X}</script>`}var g0;var w5=I(()=>{f0();g0={name:"stxRouter",handler:a1,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function h0(Z){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=Z.match($);if(!Y)return{data:{},content:Z.trim()};let J=Y[1],G=Z.slice(Y[0].length),X={};for(let Q of J.split(`
1694
- `)){let K=Q.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),j=K.slice(q+1).trim();if(typeof j==="string"){if(j.startsWith('"')&&j.endsWith('"')||j.startsWith("'")&&j.endsWith("'"))j=j.slice(1,-1);else if(j.startsWith("[")&&j.endsWith("]"))try{j=JSON.parse(j)}catch{}else if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^-?\d+(?:\.\d+)?$/.test(j))j=Number(j)}X[_]=j}return{data:X,content:G.trim()}}function _4(Z,$={}){let{gfm:Y=!0,breaks:J=!1}=$,G=Z,X=[];if(G=G.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,z)=>{let H=X.length,L=U?` class="language-${U}"`:"";return X.push(`<pre><code${L}>${z.trim()}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),G=G.replace(/`([^`]+)`/g,"<code>$1</code>"),G=G.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),G=G.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),G=G.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),G=G.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),G=G.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),G=G.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),G=G.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),G=G.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),G=G.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),G=G.replace(/__(.+?)__/g,"<strong>$1</strong>"),G=G.replace(/\*(.+?)\*/g,"<em>$1</em>"),G=G.replace(/_(.+?)_/g,"<em>$1</em>"),Y)G=G.replace(/~~(.+?)~~/g,"<del>$1</del>");G=G.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" />'),G=G.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),G=G.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),G=G.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),G=G.replace(/<\/blockquote>\n<blockquote>/g,`
1695
- `),G=G.replace(/^[*\-+]\s+(.*)$/gm,"<li>$1</li>"),G=G.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),G=G.replace(/<\/ul>\n<ul>/g,""),G=G.replace(/^\d+\.\s+(.*)$/gm,"<li>$1</li>");let Q=/(<li>.*<\/li>\n?)+/g,K=G.match(Q);if(K){for(let W of K)if(!G.includes(`<ul>${W}</ul>`)){let U=`<ol>${W}</ol>`;G=G.replace(W,U)}}if(Y)G=G.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,z)=>{let L=`<tr>${U.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${O}</th>`).join("")}</tr>`,F=z.trim().split(`
1696
- `).map((O)=>{return`<tr>${O.split("|").map((M)=>M.trim()).filter(Boolean).map((M)=>`<td>${M}</td>`).join("")}</tr>`}).join(`
1817
+ `}var B6=I(()=>{_6();x5()});async function MY(Z,$,Y,J){let G=$[0]?.replace(/['"]/g,"")||"main",X=j6();if(G!=="main")X=X.replace("container:'main'",`container:'${G}'`);return`<script>${X}</script>`}var W6;var x5=I(()=>{B6();W6={name:"stxRouter",handler:MY,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function z6(Z){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=Z.match($);if(!Y)return{data:{},content:Z.trim()};let J=Y[1],G=Z.slice(Y[0].length),X={};for(let Q of J.split(`
1818
+ `)){let K=Q.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),j=K.slice(q+1).trim();if(typeof j==="string"){if(j.startsWith('"')&&j.endsWith('"')||j.startsWith("'")&&j.endsWith("'"))j=j.slice(1,-1);else if(j.startsWith("[")&&j.endsWith("]"))try{j=JSON.parse(j)}catch{}else if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^-?\d+(?:\.\d+)?$/.test(j))j=Number(j)}X[_]=j}return{data:X,content:G.trim()}}function W4(Z,$={}){let{gfm:Y=!0,breaks:J=!1}=$,G=Z,X=[];if(G=G.replace(/```(\w*)\n([\s\S]*?)```/g,(W,U,z)=>{let H=X.length,F=U?` class="language-${U}"`:"";return X.push(`<pre><code${F}>${z.trim()}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),G=G.replace(/`([^`]+)`/g,"<code>$1</code>"),G=G.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),G=G.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),G=G.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),G=G.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),G=G.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),G=G.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),G=G.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),G=G.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),G=G.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),G=G.replace(/__(.+?)__/g,"<strong>$1</strong>"),G=G.replace(/\*(.+?)\*/g,"<em>$1</em>"),G=G.replace(/_(.+?)_/g,"<em>$1</em>"),Y)G=G.replace(/~~(.+?)~~/g,"<del>$1</del>");G=G.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" />'),G=G.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),G=G.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),G=G.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),G=G.replace(/<\/blockquote>\n<blockquote>/g,`
1819
+ `),G=G.replace(/^[*\-+]\s+(.*)$/gm,"<li>$1</li>"),G=G.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),G=G.replace(/<\/ul>\n<ul>/g,""),G=G.replace(/^\d+\.\s+(.*)$/gm,"<li>$1</li>");let Q=/(<li>.*<\/li>\n?)+/g,K=G.match(Q);if(K){for(let W of K)if(!G.includes(`<ul>${W}</ul>`)){let U=`<ol>${W}</ol>`;G=G.replace(W,U)}}if(Y)G=G.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,U,z)=>{let F=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${L}</th>`).join("")}</tr>`,O=z.trim().split(`
1820
+ `).map((L)=>{return`<tr>${L.split("|").map((M)=>M.trim()).filter(Boolean).map((M)=>`<td>${M}</td>`).join("")}</tr>`}).join(`
1697
1821
  `);return`<table>
1698
1822
  <thead>
1699
- ${L}
1823
+ ${F}
1700
1824
  </thead>
1701
1825
  <tbody>
1702
- ${F}
1826
+ ${O}
1703
1827
  </tbody>
1704
1828
  </table>`});if(Y)G=G.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),G=G.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let q=G.split(`
1705
1829
  `),_=[],j=!1,B=[];for(let W of q){let U=W.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(j&&B.length>0)_.push(`<p>${B.join(J?`<br />
@@ -1708,123 +1832,7 @@ ${F}
1708
1832
  `:`
1709
1833
  `)}</p>`);G=_.join(`
1710
1834
  `);for(let W=0;W<X.length;W++)G=G.replace(`\x00CODEBLOCK${W}\x00`,X[W]);if(J)G=G.replace(/\n/g,`<br />
1711
- `);return G=G.replace(/<p>\s*<\/p>/g,""),G.trim()}function I5(Z){let $=Z.trim();for(let Y of m0)if(Y.test($))throw Error(`Potentially unsafe expression: ${$}`);if(!d0.allowBracketNotation&&e1.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function ZY(Z){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries(Z)){if(Y.startsWith("_")||m0.some((G)=>G.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))$[Y]=T5(J);else $[Y]=J}return $}function T5(Z,$=0){if($>d0.maxSanitizeDepth)return"[Object too deep]";if(Z===null||typeof Z!=="object")return Z;if(Array.isArray(Z))return Z.map((J)=>T5(J,$+1));let Y={};for(let[J,G]of Object.entries(Z)){if(J.startsWith("_")||J==="constructor"||J==="prototype"||J==="__proto__")continue;if(G&&typeof G==="object")Y[J]=T5(G,$+1);else Y[J]=G}return Y}function i(Z,$){try{let Y=I5(Z),J=ZY($);return Function(...Object.keys(J),`
1712
- 'use strict';
1713
- try {
1714
- return ${Y};
1715
- } catch (e) {
1716
- if (e instanceof ReferenceError || e instanceof TypeError) {
1717
- return undefined;
1718
- }
1719
- throw e;
1720
- }
1721
- `)(...Object.values(J))}catch{return}}function $Z(Z){try{return I5(Z),!0}catch{return!1}}function OZ(Z,$){try{let Y=i(Z,$);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function WZ(Z,$){let Y=I5(Z);return Function(...$,`
1722
- 'use strict';
1723
- try {
1724
- return ${Y};
1725
- } catch (e) {
1726
- if (e instanceof ReferenceError || e instanceof TypeError) {
1727
- return undefined;
1728
- }
1729
- throw e;
1730
- }
1731
- `)}function u0(Z){let $=Z.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\./i,/\b__proto__\b/i,/\bconstructor\s*\./i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i];for(let J of Y)if(J.test($))return!1;return!0}var t1,d0,m0,e1;var LZ=I(()=>{t1={maxSanitizeDepth:10,allowBracketNotation:!1},d0={...t1},m0=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/],e1=/\[\s*['"]/});function $Y(){return{...D5,...p0}}function D4(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function YY(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=$.exec(Z))!==null){let J=Y[1];if(/\b(state|derived|effect)\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(Z))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(Z))return!0;return!1}function JY(Z,$){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],J=Z.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,"").replace(/`[^`]*`/g,""),G=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,X;while((X=G.exec(J))!==null){let Q=X[1];if(!J.substring(0,X.index).trimEnd().endsWith(".")){if(!Y.includes(Q)&&!(Q in $))return!1}}return!0}function pZ(Z,$,Y){let J=Z,G=YY(Z);return J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(X,Q,K)=>{try{let q=uZ(Q,$);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {{{ ${Q.trim()}}}}: ${_}`,Y,Z,K,X)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q,K)=>{try{let q=uZ(Q,$);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {!! ${Q.trim()} !!}: ${_}`,Y,Z,K,X)}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q,K)=>{let q=Q.trim(),_=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],j=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,W=q.match(j)?.[1],U=W&&((W in $)||_.includes(W)),z=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,H=q.match(z),L=H&&!_.includes(H[1])&&!(H[1]in $);if(/^__[A-Z_]+__$/.test(q))return"";try{let F=uZ(Q,$);return F!==void 0&&F!==null?D4(String(F)):""}catch(F){if(G&&!JY(q,$))return X;if(L)return X;let O=F instanceof Error?F.message:String(F);return l("Expression",`Error evaluating: {{ ${q} }}: ${O}`,Y,Z,K,X)}}),J}function XY(Z,$,Y){if(!$.trim())return Z;let J=Z,G=$.trim();while(G.length>0){let X=G.match(/^(\w+)/);if(!X)break;let Q=X[1];G=G.substring(Q.length).trim();let K=p0[Q]||D5[Q];if(!K)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys($Y()).join(", ")}`);let q=[];if(G.startsWith(":")){let _=G.match(/^:([^|\s]+)/);if(_){let j=_[1].trim();try{let B=Number(j);q=[Number.isNaN(B)?j:B]}catch{q=[j]}G=G.substring(_[0].length).trim()}}else if(G.startsWith("(")){let _=1,j=1;while(_>0&&j<G.length){if(G[j]==="(")_++;if(G[j]===")")_--;j++}if(_===0){let B=G.substring(1,j-1).trim();if(B)try{if(B.startsWith("{")&&B.endsWith("}"))q=[uZ(`(${B})`,Y,!0)];else q=B.split(",").map((W)=>{let U=W.trim();return uZ(U,Y,!0)})}catch{q=[B]}G=G.substring(j).trim()}}try{J=K(J,Y,...q)}catch(_){let j=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${Q}': ${j}`)}if(G.startsWith("|"))G=G.substring(1).trim();else break}return J}function GY(Z){let $=!1,Y="",J=0,G=0,X=0;for(let Q=0;Q<Z.length;Q++){let K=Z[Q],q=Z[Q+1],_=Z[Q-1];if($&&_==="\\")continue;if((K==='"'||K==="'"||K==="`")&&_!=="\\"){if(!$)$=!0,Y=K;else if(K===Y)$=!1,Y="";continue}if($)continue;if(K==="(")J++;else if(K===")")J--;else if(K==="[")G++;else if(K==="]")G--;else if(K==="{")X++;else if(K==="}")X--;if(K==="|"&&J===0&&G===0&&X===0){if(q==="|"){Q++;continue}if(q==="="){Q++;continue}return Q}}return-1}function uZ(Z,$,Y=!1){try{let J=Z.trim();if(J.includes("parent.child.parent")){if($.parent&&$.parent.name)return $.parent.name}let G=GY(J);if(G>0){let X=J.substring(0,G).trim(),Q=J.substring(G+1).trim(),K=uZ(X,$,!0);return XY(K,Q,$)}if(J.startsWith("nonExistentVar")||J.includes(".methodThatDoesntExist")||J.includes('JSON.parse("{invalid}")'))throw Error(`Reference to undefined variable or method: ${J}`);if(!$Z(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return i(J,$)}try{let X=Object.keys($),Q=Object.values($);return Function(...X,`
1732
- try {
1733
- return ${J};
1734
- } catch (e) {
1735
- if (e instanceof ReferenceError || e instanceof TypeError) {
1736
- return undefined;
1737
- }
1738
- throw e;
1739
- }
1740
- `)(...Q)}catch{return i(J,$)}}catch(J){if(!Y)console.error(`Error evaluating expression: ${Z}`,J);throw J}}function c0(Z){if(!Z)return"";return Z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var p0,D5;var cZ=I(()=>{LZ();MZ();p0={},D5={uppercase:(Z,$)=>{return Z!==void 0&&Z!==null?String(Z).toUpperCase():""},lowercase:(Z,$)=>{return Z!==void 0&&Z!==null?String(Z).toLowerCase():""},capitalize:(Z,$)=>{if(Z===void 0||Z===null)return"";let Y=String(Z);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:(Z,$,Y=0)=>{if(Z===void 0||Z===null)return"";try{let J=Number(Z);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},join:(Z,$,Y=",")=>{if(!Array.isArray(Z))return"";return Z.join(String(Y))},escape:(Z,$)=>{if(Z===void 0||Z===null)return"";return D4(String(Z))},translate:(Z,$,Y={})=>{if(!$||!$.__translations)return Z;let J=$.__translations,G=$.__i18nConfig?.fallbackToKey??!0,X=String(Z).split("."),Q=J;for(let q of X){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return G?Z:"";let K=String(Q);return Object.entries(Y).forEach(([q,_])=>{K=K.replace(new RegExp(`:${q}`,"g"),String(_))}),K},t:(Z,$,Y={})=>{return D5.translate(Z,$,Y)},truncate:(Z,$,Y=50,J="...")=>{if(Z===void 0||Z===null)return"";let G=String(Z);if(G.length<=Y)return G;return G.substring(0,Y-J.length)+J},date:(Z,$,Y="short",J="en-US")=>{if(Z===void 0||Z===null)return"";try{let G=Z instanceof Date?Z:new Date(Z);if(Number.isNaN(G.getTime()))return String(Z);let X={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return G.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(G)}catch{return String(Z)}},currency:(Z,$,Y="USD",J="en-US")=>{if(Z===void 0||Z===null)return"";try{let G=Number(Z);if(Number.isNaN(G))return String(Z);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(G)}catch{return String(Z)}},pluralize:(Z,$,Y,J)=>{let G=Number(Z);if(Number.isNaN(G))return Y;let X=J||`${Y}s`;return G===1?Y:X},first:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return Z[0];return String(Z).charAt(0)},last:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return Z[Z.length-1];let Y=String(Z);return Y.charAt(Y.length-1)},length:(Z,$)=>{if(Z===void 0||Z===null)return 0;if(Array.isArray(Z)||typeof Z==="string")return Z.length;if(typeof Z==="object")return Object.keys(Z).length;return 0},json:(Z,$,Y=!1)=>{if(Z===void 0)return"undefined";if(Z===null)return"null";try{return Y?JSON.stringify(Z,null,2):JSON.stringify(Z)}catch{return String(Z)}},default:(Z,$,Y="")=>{return Z===void 0||Z===null||Z===""?Y:Z},reverse:(Z,$)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z))return[...Z].reverse();return String(Z).split("").reverse().join("")},slice:(Z,$,Y=0,J)=>{if(Z===void 0||Z===null)return"";if(Array.isArray(Z)||typeof Z==="string")return Z.slice(Y,J);return Z},replace:(Z,$,Y,J="")=>{if(Z===void 0||Z===null)return"";return String(Z).replace(new RegExp(Y,"g"),J)},stripTags:(Z,$)=>{if(Z===void 0||Z===null)return"";return String(Z).replace(/<[^>]*>/g,"")},urlencode:(Z,$)=>{if(Z===void 0||Z===null)return"";return encodeURIComponent(String(Z))},abs:(Z,$)=>{let Y=Number(Z);return Number.isNaN(Y)?0:Math.abs(Y)},round:(Z,$,Y=0)=>{let J=Number(Z);if(Number.isNaN(J))return 0;let G=10**Y;return Math.round(J*G)/G}}});class j4{cache=new Map;maxSize;constructor(Z=100){this.maxSize=Z}get(Z){if(!this.cache.has(Z))return;let $=this.cache.get(Z);return this.cache.delete(Z),this.cache.set(Z,$),$}set(Z,$){if(this.cache.has(Z))this.cache.delete(Z);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set(Z,$)}has(Z){return this.cache.has(Z)}delete(Z){return this.cache.delete(Z)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function B4(Z,$){if($?.includes("g"))return new RegExp(Z,$);let Y=`${Z}:${$||""}`;if(!E5.has(Y))E5.set(Y,new RegExp(Z,$));return E5.get(Y)}class l0{pool=[];maxPoolSize=10;getEvaluator(Z){let $=Array.from(new Set(Z)),Y=$.sort().join(","),J=this.pool.find((X)=>X.context.join(",")===Y);if(J)return J.func;let G=$.length===0?Function(`
1741
- 'use strict';
1742
- return function(expr) {
1743
- try {
1744
- return eval(expr);
1745
- } catch (e) {
1746
- if (e instanceof ReferenceError || e instanceof TypeError) {
1747
- return undefined;
1748
- }
1749
- throw e;
1750
- }
1751
- }
1752
- `)():Function(...$,`
1753
- 'use strict';
1754
- return function(expr) {
1755
- try {
1756
- return eval(expr);
1757
- } catch (e) {
1758
- if (e instanceof ReferenceError || e instanceof TypeError) {
1759
- return undefined;
1760
- }
1761
- throw e;
1762
- }
1763
- }
1764
- `);if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:$.slice()});return G}clear(){this.pool.length=0}}class i0{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(Z){this.enabled=Z}isEnabled(){return this.enabled}setBudget(Z,$){this.budgets.set(Z,{warnThreshold:0.8,action:"warn",...$})}setBudgets(Z){for(let[$,Y]of Object.entries(Z))this.setBudget($,Y)}removeBudget(Z){this.budgets.delete(Z)}getBudgets(){let Z={};for(let[$,Y]of this.budgets.entries())Z[$]=Y;return Z}onViolation(Z){this.violationHandlers.push(Z)}offViolation(Z){let $=this.violationHandlers.indexOf(Z);if($!==-1)this.violationHandlers.splice($,1)}time(Z,$){if(!this.enabled)return $();let Y=performance.now(),J=$(),G=performance.now()-Y;return this.recordTime(Z,G),this.checkBudget(Z,G),J}async timeAsync(Z,$){if(!this.enabled)return $();let Y=performance.now(),J=await $(),G=performance.now()-Y;return this.recordTime(Z,G),this.checkBudget(Z,G),J}checkBudget(Z,$){let Y=this.budgets.get(Z);if(!Y)return;let J=$/Y.maxTime*100,G=Y.warnThreshold?$>=Y.maxTime*Y.warnThreshold&&$<Y.maxTime:!1,X=$>=Y.maxTime;if(!G&&!X)return;let Q={label:Z,actualTime:$,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:G};if(this.violations.push(Q),this.violations.length>this.maxViolations)this.violations=this.violations.slice(-this.maxViolations);for(let q of this.violationHandlers)try{q(Q)}catch{}let K=G?`[Performance Warning] "${Z}" took ${$.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${Z}" took ${$.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(X)throw Error(K);else console.warn(K);break}}recordTime(Z,$){let Y=this.metrics.get(Z);if(Y)Y.count++,Y.totalTime+=$,Y.maxTime=Math.max(Y.maxTime,$),Y.minTime=Math.min(Y.minTime,$);else this.metrics.set(Z,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(Z){if(Z){let Y=this.metrics.get(Z);if(!Y)return{};let J=this.budgets.get(Z);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}let $={};for(let[Y,J]of this.metrics.entries()){let G=this.budgets.get(Y);$[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:G?.maxTime,budgetUtilization:G?J.totalTime/J.count/G.maxTime*100:void 0}}return $}getViolations(Z){if(Z)return this.violations.filter(($)=>$.label===Z);return[...this.violations]}getViolationStats(){let Z={},$=0,Y=0;for(let J of this.violations)if(Z[J.label]=(Z[J.label]||0)+1,J.isWarning)$++;else Y++;return{total:this.violations.length,byLabel:Z,warnings:$,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function QY(){if(!k5)k5=new i0;return k5}var E5,GQ,k5=null,n0;var lZ=I(()=>{E5=new Map;GQ=new l0;n0=new Proxy({},{get(Z,$){return QY()[$]}})});var s0=()=>{};function zZ(Z,$,Y,J=0){let G=0,X=J,Q=null,K=0;while(X<Z.length){let q=Z[X];if((X>0?Z[X-1]:"")==="\\"&&Q){X++;continue}if((q==='"'||q==="'"||q==="`")&&!Q){Q=q,X++;continue}if(q===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"&&q==="$"&&Z[X+1]==="{"){K++,X+=2;continue}if(K>0&&q==="}"){K--,X++;continue}if(q==="`"&&Q==="`"&&K===0){Q=null,X++;continue}if(Q){X++;continue}if(q===$)G++;else if(q===Y){if(G--,G===0)return X}X++}return-1}var E4={};t(E4,{stripTypeScript:()=>e0,hasVariables:()=>G6,extractVariables:()=>Z6,extractScriptFromTemplate:()=>X6,convertToCommonJS:()=>S5});function KY(Z){let $=[],Y=0,J=Z.split(`
1765
- `);for(let G of J){let X=null,Q=!1;for(let K=0;K<G.length;K++){let q=G[K];if(Q){Q=!1;continue}if(q==="\\"){Q=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<G.length&&G[K+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Y===0){let K=G.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)$.push(K[1])}}return[...new Set($)]}function e0(Z){let $=Z;return $=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3"),$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;let X=G.split(",").map((Q)=>{let[K,...q]=Q.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ");return`${J}(${X})`}),$=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((X)=>{let[Q,...K]=X.split("="),q=Q.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+\w+(?:\[\])?/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
1766
-
1767
- `),$}async function Z6(Z,$,Y){if(!Z.trim())return;let J=e0(Z),G={exports:{}},X=G.exports,Q=(V)=>{return KZ(V)},K=$.props||{},q=Object.assign((V)=>{if(!V)return K;let R={};for(let[N,w]of Object.entries(V)){let D=K[N];if(D!==void 0)R[N]=D;else if(typeof w==="function")R[N]=w();else R[N]=w}return R},K),_=()=>K,j=(V,R)=>{let N={...V};for(let[w,D]of Object.entries(R))if(N[w]===void 0)if(typeof D==="function")N[w]=D();else N[w]=D;return N},B=(V)=>{let R=()=>V;return R.set=(N)=>{},R.update=(N)=>{},R},W=(V)=>{let R,N=!1;return()=>{if(!N)try{R=V(),N=!0}catch{R=void 0}return R}},U=(V)=>{},z=(V)=>V(),H=(V)=>{},L=(V)=>{},F={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},O=new Proxy(F,{get(V,R){if(R in V)return V[R];return},set(V,R,N){return V[R]=N,!0}}),A={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M=console;try{let V=S5(J),R=new Set(Object.keys(K)),N=Object.keys($).filter((S)=>!R.has(S)&&S!=="props"),w=N.map((S)=>$[S]),E=KY(V).map((S)=>`module.exports.${S} = typeof ${S} !== 'undefined' ? ${S} : module.exports.${S};`).join(`
1768
- `),T=await Function("module","exports","require","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","window","document","console","confirm","alert","fetch",...N,`return (async () => {
1769
- ${V}
1770
- ${E}
1771
- return module.exports
1772
- })()`)(G,X,Q,q,_,j,B,W,U,z,H,L,O,A,M,F.confirm,F.alert,F.fetch,...w);Object.assign($,T);for(let[S,d]of Object.entries(K))if(!(S in $))$[S]=d}catch(V){console.warn(`Failed to execute script as CommonJS module in ${Y}:`,V);try{await jY(J,$,Y)}catch(R){console.warn(`Variable extraction issue in ${Y}:`,R)}}}function S5(Z){let $=Z.split(`
1773
- `),Y=[],J=0;while(J<$.length){let G=$[J].trim();if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let X=o0($,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let X=r0($,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let X=o0($,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let X=r0($,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.includes("module.exports"))Y.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Y.push(G),J++;else J++}return Y.join(`
1774
- `)}function $6(Z,$){let Y=Z[$];if(Y!=="{"&&Y!=="[")return null;let G=zZ(Z,Y,Y==="{"?"}":"]",$);if(G===-1)return null;return{pattern:Z.slice($,G+1),endPos:G+1}}function Y6(Z){let $=[],Y=Z.slice(1,-1).trim();if(!Y)return $;let J=0,G=0,X="";while(J<Y.length){let Q=Y[J];if(Q==="{"||Q==="["){if(G++,G===1){let K=$6(Y,J);if(K){let q=Y6(K.pattern);$.push(...q),J=K.endPos,X="";continue}}}else if(Q==="}"||Q==="]")G--;if(G>0){J++;continue}if(Q===","){if(X.trim())$.push(X.trim());X="",J++;continue}if(Q===":"){X="",J++;continue}if(Q==="="){if(X.trim())$.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&G===0){if(Y[J]==="{"||Y[J]==="[")G++;else if(Y[J]==="}"||Y[J]==="]")G--;J++}continue}if(/[\w$]/.test(Q))X+=Q;J++}if(X.trim())$.push(X.trim());return $}function o0(Z,$){let Y=Z[$].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let _=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let j=Y.slice(_[0].length),B=$6(j,0);if(B){let W=_[1],U=B.pattern,z=j.slice(B.endPos).trim();if(z.startsWith("=")){let H=z.slice(1).trim(),L=H,F=$;if(a0(H)){let V=t0(Z,$,H);L=V.value,F=V.nextIndex}else F=$+1;L=L.trim().replace(/;$/,"");let O=Y6(U),A=`__stx_src_${$}`,M=O.map((V)=>`module.exports.${V} = ${V};`).join(`
1775
- `);return{type:W,name:A,value:`${L}; ${W} ${U} = ${A};
1776
- ${M}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,G,X,Q]=J,K=Q,q=$;if(a0(Q)){let _=t0(Z,$,Q);K=_.value,q=_.nextIndex}else q=$+1;return K=K.trim().replace(/;$/,""),{type:G,name:X,value:K,nextIndex:q}}function r0(Z,$){let Y=Z[$].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,G]=J,X=Y.replace(/^export\s+/,""),Q=$;if(qY(Y)){let K=_Y(Z,$,X);X=K.functionCode,Q=K.nextIndex}else Q=$+1;return{name:G,functionCode:X,nextIndex:Q}}function a0(Z){let $=Z.trim();if($.startsWith("{"))return zZ($,"{","}",0)===-1;if($.startsWith("["))return zZ($,"[","]",0)===-1;return!J6($)}function J6(Z){let $={paren:0,bracket:0,brace:0},Y=null,J=0;for(let G=0;G<Z.length;G++){let X=Z[G];if((G>0?Z[G-1]:"")==="\\"&&Y)continue;if((X==='"'||X==="'")&&!Y){Y=X;continue}if(X===Y&&Y!=="`"){Y=null;continue}if(X==="`"&&!Y){Y="`";continue}if(X==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&X==="$"&&Z[G+1]==="{"){J++,G++;continue}if(J>0&&X==="{"){J++;continue}if(J>0&&X==="}"){J--;continue}if(Y)continue;if(X==="(")$.paren++;else if(X===")")$.paren--;else if(X==="[")$.bracket++;else if(X==="]")$.bracket--;else if(X==="{")$.brace++;else if(X==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Y===null}function qY(Z){let $=Z.indexOf("{");if($===-1)return!0;return zZ(Z,"{","}",$)===-1}function t0(Z,$,Y){let J=Y,G=$+1;while(G<Z.length&&!J6(J)){let X=Z[G];J+=`
1777
- ${X}`,G++}return{value:J,nextIndex:G}}function _Y(Z,$,Y){let J=Y,G=$+1;while(G<Z.length){let X=J.indexOf("{");if(X!==-1){if(zZ(J,"{","}",X)!==-1)break}let Q=Z[G];J+=`
1778
- ${Q}`,G++}return{functionCode:J,nextIndex:G}}async function jY(Z,$,Y){let J=Z.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of J){let[,,Q,K]=X;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);$[Q]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);$[Q]=_()}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}}let G=Z.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of G){let[,,Q,K]=X;if(!(Q in $))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);$[Q]=_()}catch{}}try{let X=Z.replace(/^export\s+/gm,""),K=Function(`
1779
- ${X}
1780
- const result = {};
1781
- ${Array.from(Z.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
1782
- `)}
1783
- return result;
1784
- `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in $))$[q]=_})}catch{}}function X6(Z){let $=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=$?$[1]:"",J=$?Z.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):Z;return{scriptContent:Y,templateWithoutScript:J}}function G6(Z){let $=Z.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var W4=()=>{};var j6={};t(j6,{renderSlot:()=>K6,processSlots:()=>_6,parseSlots:()=>Q6,parseSlotElement:()=>WY,extractSlotContent:()=>HY,applySlots:()=>OY});function BY(Z,$){let Y=1,J=$;while(J<Z.length&&Y>0){let G=Z.slice(J).match(/^<template\b/);if(G){Y++,J+=G[0].length;continue}let X=Z.slice(J).match(/^<\/template\s*>/);if(X){if(Y--,Y===0)return J+X[0].length;J+=X[0].length;continue}J++}return Y===0?J:-1}function Q6(Z){let $={default:"",named:new Map},Y=Z,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,G=[],X;while((X=J.exec(Z))!==null){let[Q,K,q,_,j]=X,B=K||q||_,W=X.index+Q.length,U=BY(Z,W);if(U!==-1){let z=Z.slice(W,U-11).trim();G.push({start:X.index,end:U,slotName:B,content:z,propsBinding:j||void 0}),$.named.set(B,{name:B,content:z,propsBinding:j||void 0})}}G.sort((Q,K)=>K.start-Q.start);for(let Q of G)Y=Y.slice(0,Q.start)+Y.slice(Q.end);return $.default=Y.trim(),$}function WY(Z){let $=Z.match(/name\s*=\s*["']([^"']+)["']/),Y=$?$[1]:"",J={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec(Z))!==null)J[X[1]]=X[2];let Q=Z.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=Q?Q[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function K6(Z,$,Y,J){if(!Z)return Y;let G=Z.content;if(Z.propsBinding&&Object.keys($).length>0){let X=Z.propsBinding.trim(),Q={...J};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,j]=q.split(":").map((W)=>W.trim()),B=j||_;if($[_]!==void 0)Q[B]=$[_]}}else Q[X]=$;G=zY(G,Q)}return G}function zY(Z,$){return Z.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let G=J.trim(),X=q6(G,$);return String(X??"")}catch{return`{{ ${J} }}`}})}function q6(Z,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(Z)){let J=Z.split("."),G=$;for(let X of J)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let Y=Z.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,G,X]=Y,Q=$[J],K=parseInt(X,10);if(typeof Q==="number")switch(G){case"+":return Q+K;case"-":return Q-K;case"*":return Q*K;case"/":return Q/K}}try{let J=Object.keys($),G=Object.values($);return Function(...J,`return ${Z}`)(...G)}catch{return}}async function _6(Z,$,Y){let J=Z;J=await UY(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,K,q,_)=>{let j=$.named.get(K),B=_?.trim()||"",W=q||"",U={},z=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=z.exec(W))!==null){let L=H[1],F=H[2];U[L]=q6(F,Y)}return await K6(j,U,B,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(Q,K)=>{if(Q.includes("name="))return Q;let q=K?.trim()||"";return $.default||q}),J}async function UY(Z,$,Y){let J=[],G=[];Z.replace($,(K,...q)=>{let _=q[q.length-2];return G.push({match:K,index:_}),J.push(Y(K,...q.slice(0,-2))),K});let X=await Promise.all(J),Q=Z;for(let K=G.length-1;K>=0;K--){let{match:q,index:_}=G[K];Q=Q.slice(0,_)+X[K]+Q.slice(_+q.length)}return Q}function HY(Z){let $=Q6(Z);return{defaultSlot:$.default,namedSlots:$.named}}async function OY(Z,$,Y,J){return await _6(Z,{default:$,named:Y},J)}import LY from"fs";import n from"path";import b5 from"process";function FY(Z){return/\bjs\b/.test(Z)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(Z)}function iZ(Z){return!FY(Z)}function nZ(Z){try{let $=Z.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");return $=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),new Bun.Transpiler({loader:"ts",target:"browser"}).transformSync($)}catch($){return console.warn("[STX] TypeScript transpilation error:",$),Z}}function AY(Z){let $=[],Y=new Set,J=0,G=0,X=Z.length,Q=(j)=>{G++;while(G<X){if(Z[G]==="\\"){G+=2;continue}if(Z[G]===j){G++;return}G++}},K=()=>{G++;while(G<X){if(Z[G]==="\\"){G+=2;continue}if(Z[G]==="`"){G++;return}if(Z[G]==="$"&&Z[G+1]==="{"){G+=2;let j=1;while(G<X&&j>0)if(Z[G]==="{")j++;else if(Z[G]==="}")j--;else if(Z[G]==="'"||Z[G]==='"')Q(Z[G]);else if(Z[G]==="`")K();else G++;continue}G++}},q=()=>{if(Z[G]==="/"&&Z[G+1]==="/"){while(G<X&&Z[G]!==`
1785
- `)G++;return!0}if(Z[G]==="/"&&Z[G+1]==="*"){G+=2;while(G<X-1&&!(Z[G]==="*"&&Z[G+1]==="/"))G++;return G+=2,!0}return!1},_=()=>{if(J!==0)return;let j=Z.slice(G).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let z=j[2].split(",").map((H)=>H.trim().split(":")[0].trim());for(let H of z)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))$.push(H),Y.add(H);return}let B=Z.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let z=B[2];if(!Y.has(z))$.push(z),Y.add(z);return}let W=Z.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!Y.has(z))$.push(z),Y.add(z);return}let U=Z.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!Y.has(z))$.push(z),Y.add(z)}};while(G<X){if(q())continue;if(Z[G]==="'"||Z[G]==='"'){Q(Z[G]);continue}if(Z[G]==="`"){K();continue}if(Z[G]==="{"){J++,G++;continue}if(Z[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test(Z[G])&&(G===0||/\s|[;{}()]/.test(Z[G-1])))_();G++}return $}async function sZ(Z,$,Y,J,G,X,Q,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (W4(),E4)),j=K??new Set;if(j.has(Z))return`[Circular component reference: ${Z}]`;j.add(Z);try{let B=(h)=>h.split("-").map((y)=>y.charAt(0).toUpperCase()+y.slice(1)).join(""),W=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),U=Z.endsWith(".stx")?Z.slice(0,-4):Z,z=null,H=G.__importedComponents;if(H){let h=[U,U.toLowerCase(),B(U),W(U)];for(let y of h)if(H.has(y)){z=H.get(y);break}}let L=[];if(!z){let h=[`${U}.stx`,`${B(U)}.stx`,`${W(U)}.stx`],y=[...new Set(h)],b=[J,n.join(n.dirname(X),"components")].filter(Boolean);if(Q.componentsDir&&Q.componentsDir!==J)b.push(Q.componentsDir);if(U.startsWith("./")||U.startsWith("../"))z=n.resolve(n.dirname(X),`${U}.stx`),L.push(z);else for(let v of b){if(!v)continue;for(let ZZ of y){let QZ=n.join(v,ZZ);if(L.push(QZ),await p(QZ)){z=QZ;break}}if(z)break;if(!z)try{let ZZ=await import("fs");if(!ZZ.statSync(v,{throwIfNoEntry:!1})?.isDirectory())continue;let NZ=ZZ.readdirSync(v,{withFileTypes:!0});for(let VZ of NZ)if(VZ.isDirectory()){let U5=n.join(v,VZ.name);for(let a3 of y){let H5=n.join(U5,a3);if(L.push(H5),await p(H5)){z=H5;break}}if(z)break}}catch{}if(z)break}}if(!z||!await p(z)){let h=L.length>0?`
1786
- Searched paths:
1787
- ${L.map((y)=>` - ${y}`).join(`
1788
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${Z}']${h}`}q.add(z);let F;if(P5.has(z))F=P5.get(z);else try{F=await Bun.file(z).text(),P5.set(z,F)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let O={...G,...$,props:$,slot:Y},A=F,M=A.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)A=M[1].trim();let V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,R=[...F.matchAll(V)],N=[];for(let h of R){let y=h[1]||"",b=h[2]||"",v=y.includes("server"),ZZ=y.includes("client")||y.includes('type="module"');if(iZ(y)&&b.trim())b=nZ(b);if(!ZZ&&b)try{await _(b,O,z)}catch(NZ){}if(!v){let NZ=b.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),VZ=y.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");N.push(`<script${VZ}>${NZ}</script>`)}}let w=F.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=w?w[1]:"",E=w?w[2]:"",k="";if(w)k=`<style${D}>${E}</style>`;let T=A;if(T=T.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w)T=T.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&T.includes("{{ text || slot }}"))T=T.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,Y);let{extractSlotContent:S,applySlots:d}=await Promise.resolve().then(() => j6),{defaultSlot:c,namedSlots:P}=S(Y);T=await d(T,c||Y,P,O);for(let[h,y]of Object.entries(O))if(typeof y==="string"){if(y.includes("<")&&y.includes(">")||y.includes("&lt;")||y.includes("&quot;")){let b=c0(y);O[h]=b}}let u=N.some((h)=>/\b(state|derived|effect)\s*\(/.test(h)),XZ={...Q,componentsDir:n.dirname(z),skipSignalsRuntime:!0,skipEventDirectives:u},s=await oZ(T,O,z,XZ,q),a=`stx_${U.replace(/[^a-zA-Z0-9]/g,"_")}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,GZ=s;if(u){if(GZ=`<div data-stx-scope="${a}">${s}</div>`,GZ=N.map((y)=>{let b=y.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!b)return y;let[,v,ZZ]=b,QZ=DZ(ZZ),NZ=`
1789
- (function() {
1790
- const { state, derived, effect, batch } = window.stx;
1791
- const __scope = window.stx._scopes = window.stx._scopes || {};
1792
- const __scopeVars = __scope['${a}'] = __scope['${a}'] || {};
1793
-
1794
- // Scope-specific lifecycle callbacks
1795
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
1796
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
1797
- const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
1798
- const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
1799
-
1800
- ${QZ}
1801
-
1802
- // Register all defined signals and functions in this scope
1803
- const __localVars = {};
1804
- try {
1805
- ${AY(QZ).map((VZ)=>`if (typeof ${VZ} !== 'undefined') __localVars['${VZ}'] = ${VZ};`).join(`
1806
- `)}
1807
- } catch(e) {}
1808
- Object.assign(__scopeVars, __localVars);
1809
- })();`;return`<script data-stx-scoped${v}>${NZ}</script>`}).join(`
1810
- `)+`
1811
- `+GZ,k)GZ+=`
1812
- `+k}else{if(k)GZ+=`
1813
- `+k;if(N.length>0){let h=O.__stx_event_bindings||[],y=N.map((b)=>{let v=b.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!v)return b;return T4(v[1],{eventBindings:h})});GZ+=`
1814
- `+y.join(`
1815
- `),O.__stx_event_bindings=[]}}return GZ}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{j.delete(Z)}}async function p(Z){try{return(await LY.promises.stat(Z)).isFile()}catch{return!1}}async function C5(Z,$,Y,J){if(Y.debug)console.log(`Resolving template path: ${Z} from ${$}`);let G=n.dirname($);if(Z.startsWith("/")){let _=n.join(b5.cwd(),Z);if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await p(_)&&J)J.add(_);return _}let X=n.join(G,Z);if(await p(X)){if(Y.debug)console.log(`Found direct path: ${X}`);if(J)J.add(X);return X}if(!Z.endsWith(".stx")&&!Z.endsWith(".jsx")&&!Z.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let j=`${X}${_}`;if(await p(j)){if(Y.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let Q=n.join(G,"layouts");if(await p(Q)){let _=n.join(Q,Z);if(await p(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!Z.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let _=n.isAbsolute(Y.layoutsDir)?Y.layoutsDir:n.resolve(b5.cwd(),Y.layoutsDir),j=n.join(_,Z);if(await p(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!Z.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${B}`);if(J)J.add(B);return B}}}if(Z.startsWith("layouts/")||Z.includes("/layouts/")){let _=Z.split("layouts/"),j=n.join(Y.partialsDir||G,"layouts",_[1]);if(await p(j)){if(Y.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(Q=n.join(Y.partialsDir,"layouts"),await p(Q)){let _=n.join(Q,Z);if(await p(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!Z.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=Y.partialsDir||n.join(b5.cwd(),"views"),q=n.join(K,Z);if(await p(q)){if(Y.debug)console.log(`Found in views path: ${q}`);if(J)J.add(q);return q}if(!Z.endsWith(".stx")){let _=`${q}.stx`;if(await p(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(G.includes("temp")){let _=n.join(n.dirname(G),"layouts",Z);if(await p(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!Z.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${Z} (referenced from ${$})`);else console.warn(`Template not found: ${Z} (referenced from ${$})`);return null}function B6(Z,$,Y){let J=0,G="",X="";try{if(typeof $==="number"&&$>=0){let Q=Z.split(`
1816
- `),K=0;for(let q=0;q<Q.length;q++)if(K+=Q[q].length+1,K>=$){J=q+1,G=Q[q].trim();let _=Math.max(0,q-2),j=Math.min(Q.length,q+3);X=Q.slice(_,j).map((B,W)=>{let U=_+W+1;return`${U===J?"> ":" "}${U}: ${B}`}).join(`
1817
- `);break}}else if(Y){let Q=Z.indexOf(Y);if(Q>=0)return B6(Z,Q)}}catch{}return{lineNumber:J,lineContent:G,context:X}}function l(Z,$,Y,J,G,X){let{lineNumber:Q,context:K}=B6(J,G,X),q=Y.split("/").pop(),_=`
1818
- ${f.bold}${f.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${f.reset}
1819
- `;if(_+=`${f.bold}${f.red}\u2502${f.reset} ${f.bold}${f.bgRed} ERROR ${f.reset} ${f.red}${Z} Error${f.reset}${" ".repeat(Math.max(0,43-Z.length))}${f.bold}${f.red}\u2502${f.reset}
1820
- `,_+=`${f.bold}${f.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${f.reset}
1821
- `,_+=`
1822
- ${f.cyan}${f.bold}File:${f.reset} ${f.dim}${q}${f.reset}`,Q>0)_+=` ${f.gray}(line ${Q})${f.reset}`;if(_+=`
1823
- ${f.yellow}${f.bold}Message:${f.reset} ${$}
1824
- `,K)_+=`
1825
- ${f.blue}${f.bold}Context:${f.reset}
1826
- ${f.dim}${K}${f.reset}
1827
- `;return _}var P5,f;var MZ=I(()=>{V5();cZ();K4();lZ();y5();s0();W4();P5=new j4(500);f={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function W6(Z,$,Y=""){let J=Z,G=/@markdown(?:\(([^)]*)\))?([\s\S]*?)@endmarkdown/g,X=[],Q;while((Q=G.exec(Z))!==null)X.push({fullMatch:Q[0],options:Q[1]||"",content:Q[2]||"",index:Q.index});for(let{fullMatch:K,options:q,content:_,index:j}of X)try{let B={};if(q)q.split(",").forEach((z)=>{let H=z.trim();if(H)B[H]=!0});let W={gfm:B.gfm??!0,breaks:B.breaks??!1},U=_4(_.trim(),W);J=J.replace(K,U)}catch(B){let W=B instanceof Error?B.message:String(B),U=l("Markdown Directive",`Error processing markdown: ${W}`,Y,Z,j,K);J=J.replace(K,U)}return J}async function z6(Z,$,Y,J){let G={gfm:!0,breaks:!1};return $.forEach((X)=>{let Q=X.trim().replace(/['"]/g,"");if(Q==="breaks")G.breaks=!0;if(Q==="no-gfm")G.gfm=!1}),_4(Z.trim(),G)}var x5=I(()=>{MZ()});function VY(Z){if(RY.set(Z.name,Z),Z.client)NY.set(Z.name,Z.client)}function k4(Z){return VY(Z),{name:Z.name,hasEndTag:Z.hasEndTag??!0,description:Z.description,handler:async(Y,J,G,X)=>{let Q=MY(J,Z.defaults);if(Z.validate){let q=Z.validate(Q);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${Z.name}`;throw Error(_)}}let K=Y;if(Z.transform)K=await Z.transform(Y,Q,G,X);if(Z.clientScript){let q=Z.clientScript(Q);K+=`<script>${q}</script>`}if(Z.css){let q=Z.css(Q);K+=`<style>${q}</style>`}return K}}}function MY(Z,$){let Y={...$};for(let J of Z){let G=J.indexOf(":"),X=J.indexOf("="),Q=G>=0&&(X<0||G<X)?G:X;if(Q>=0){let K=J.slice(0,Q).trim(),q=J.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!$||!(q in $)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var RY,NY;var v5=I(()=>{RY=new Map,NY=new Map});function f5(Z,$=rZ,Y={},J){return $.sort((G,X)=>G-X).map((G)=>{return`${U4(Z,{...Y,w:G,fm:J})} ${G}w`}).join(", ")}function U6(Z,$,Y=wY,J={},G){return Y.sort((X,Q)=>X-Q).map((X)=>{let Q=Math.round($*X);return`${U4(Z,{...J,w:Q,dpr:X,fm:G})} ${X}x`}).join(", ")}function g5(Z,$="100vw"){if(!Z||Object.keys(Z).length===0)return $;let J=Object.entries(Z).map(([G,X])=>{let Q=/^\d+$/.test(G)?`${G}px`:G;return{bp:Q,size:X,numericBp:Number.parseInt(Q)||0}}).sort((G,X)=>G.numericBp-X.numericBp).map(({bp:G,size:X})=>`(max-width: ${G}) ${X}`);return J.push($),J.join(", ")}function U4(Z,$={}){let Y=Object.entries($).filter(([,X])=>X!==void 0&&X!==null).map(([X,Q])=>{if(Array.isArray(Q))return[X,Q.join(",")];return[X,String(Q)]});if(Y.length===0)return Z;let J=Y.map(([X,Q])=>`${X}=${encodeURIComponent(Q)}`).join("&"),G=Z.includes("?")?"&":"?";return`${Z}${G}${J}`}function h5(Z){return TY[Z]||"application/octet-stream"}var rZ,wY,z4,TY;var d5=I(()=>{rZ=[320,480,640,768,1024,1280,1536,1920,2560],wY=[1,1.5,2,3],z4=["avif","webp","jpeg"],TY={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function DY(){try{return await import("ts-images")}catch{return null}}async function EY(Z,$={}){let Y={...IY,...$},J=await DY();if(J)try{return await kY(Z,Y,J)}catch(G){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${G}`)}return SY(Z,Y)}async function kY(Z,$,Y){let{generatePlaceholder:J,generateThumbHash:G}=Y,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await G(Z)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J(Z,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:$.strategy,dominantColor:K.dominantColor,css:K.css}}function SY(Z,$){let Y=$.width||20,J=$.height||Y,G="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function H6(Z,$,Y={}){let J=Y.transitionDuration||300,G=Y.easing||"ease-out";return`
1835
+ `);return G=G.replace(/<p>\s*<\/p>/g,""),G.trim()}async function U6(Z,$,Y=""){let J=Z,G=/@markdown(?:\(([^)]*)\))?([\s\S]*?)@endmarkdown/g,X=[],Q;while((Q=G.exec(Z))!==null)X.push({fullMatch:Q[0],options:Q[1]||"",content:Q[2]||"",index:Q.index});for(let{fullMatch:K,options:q,content:_,index:j}of X)try{let B={};if(q)q.split(",").forEach((z)=>{let H=z.trim();if(H)B[H]=!0});let W={gfm:B.gfm??!0,breaks:B.breaks??!1},U=W4(_.trim(),W);J=J.replace(K,U)}catch(B){let W=B instanceof Error?B.message:String(B),U=l("Markdown Directive",`Error processing markdown: ${W}`,Y,Z,j,K);J=J.replace(K,U)}return J}async function H6(Z,$,Y,J){let G={gfm:!0,breaks:!1};return $.forEach((X)=>{let Q=X.trim().replace(/['"]/g,"");if(Q==="breaks")G.breaks=!0;if(Q==="no-gfm")G.gfm=!1}),W4(Z.trim(),G)}var v5=I(()=>{NZ()});function IY(Z){if(wY.set(Z.name,Z),Z.client)TY.set(Z.name,Z.client)}function S4(Z){return IY(Z),{name:Z.name,hasEndTag:Z.hasEndTag??!0,description:Z.description,handler:async(Y,J,G,X)=>{let Q=DY(J,Z.defaults);if(Z.validate){let q=Z.validate(Q);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${Z.name}`;throw Error(_)}}let K=Y;if(Z.transform)K=await Z.transform(Y,Q,G,X);if(Z.clientScript){let q=Z.clientScript(Q);K+=`<script>${q}</script>`}if(Z.css){let q=Z.css(Q);K+=`<style>${q}</style>`}return K}}}function DY(Z,$){let Y={...$};for(let J of Z){let G=J.indexOf(":"),X=J.indexOf("="),Q=G>=0&&(X<0||G<X)?G:X;if(Q>=0){let K=J.slice(0,Q).trim(),q=J.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!$||!(q in $)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var wY,TY;var f5=I(()=>{wY=new Map,TY=new Map});function g5(Z,$=rZ,Y={},J){return $.sort((G,X)=>G-X).map((G)=>{return`${U4(Z,{...Y,w:G,fm:J})} ${G}w`}).join(", ")}function O6(Z,$,Y=EY,J={},G){return Y.sort((X,Q)=>X-Q).map((X)=>{let Q=Math.round($*X);return`${U4(Z,{...J,w:Q,dpr:X,fm:G})} ${X}x`}).join(", ")}function h5(Z,$="100vw"){if(!Z||Object.keys(Z).length===0)return $;let J=Object.entries(Z).map(([G,X])=>{let Q=/^\d+$/.test(G)?`${G}px`:G;return{bp:Q,size:X,numericBp:Number.parseInt(Q)||0}}).sort((G,X)=>G.numericBp-X.numericBp).map(({bp:G,size:X})=>`(max-width: ${G}) ${X}`);return J.push($),J.join(", ")}function U4(Z,$={}){let Y=Object.entries($).filter(([,X])=>X!==void 0&&X!==null).map(([X,Q])=>{if(Array.isArray(Q))return[X,Q.join(",")];return[X,String(Q)]});if(Y.length===0)return Z;let J=Y.map(([X,Q])=>`${X}=${encodeURIComponent(Q)}`).join("&"),G=Z.includes("?")?"&":"?";return`${Z}${G}${J}`}function d5(Z){return kY[Z]||"application/octet-stream"}var rZ,EY,z4,kY;var m5=I(()=>{rZ=[320,480,640,768,1024,1280,1536,1920,2560],EY=[1,1.5,2,3],z4=["avif","webp","jpeg"],kY={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function bY(){try{return await import("ts-images")}catch{return null}}async function PY(Z,$={}){let Y={...SY,...$},J=await bY();if(J)try{return await CY(Z,Y,J)}catch(G){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${G}`)}return yY(Z,Y)}async function CY(Z,$,Y){let{generatePlaceholder:J,generateThumbHash:G}=Y,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await G(Z)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J(Z,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:$.strategy,dominantColor:K.dominantColor,css:K.css}}function yY(Z,$){let Y=$.width||20,J=$.height||Y,G="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function L6(Z,$,Y={}){let J=Y.transitionDuration||300,G=Y.easing||"ease-out";return`
1828
1836
  #${Z} {
1829
1837
  --stx-img-transition-duration: ${J}ms;
1830
1838
  --stx-img-transition-easing: ${G};
@@ -1841,7 +1849,7 @@ ${f.dim}${K}${f.reset}
1841
1849
  #${Z}.stx-img-loaded img {
1842
1850
  opacity: 1;
1843
1851
  }
1844
- `.trim()}async function O6(Z,$={}){let Y=`${Z}:${JSON.stringify($)}`;if(m5.has(Y))return m5.get(Y);let J=await EY(Z,$);return m5.set(Y,J),J}var IY,u5,m5;var L6=I(()=>{IY={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},u5=`
1852
+ `.trim()}async function F6(Z,$={}){let Y=`${Z}:${JSON.stringify($)}`;if(u5.has(Y))return u5.get(Y);let J=await PY(Z,$);return u5.set(Y,J),J}var SY,p5,u5;var A6=I(()=>{SY={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},p5=`
1845
1853
  .stx-img-placeholder {
1846
1854
  position: relative;
1847
1855
  overflow: hidden;
@@ -1870,8 +1878,8 @@ ${f.dim}${K}${f.reset}
1870
1878
  filter: blur(0);
1871
1879
  transform: scale(1);
1872
1880
  }
1873
- `.trim();m5=new Map});import{createHash as A6}from"crypto";import{readFile as bY,stat as R6}from"fs/promises";async function BZ(Z){try{let $=await bY(Z);return A6("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function F6(Z){return A6("sha256").update(Z).digest("hex").slice(0,16)}function S4(Z,$){let Y=JSON.stringify($,Object.keys($).sort());return`${F6(Z)}-${F6(Y)}`}async function p5(Z){try{return(await R6(Z)).mtimeMs}catch{return 0}}async function jZ(Z){try{return await R6(Z),!0}catch{return!1}}var yZ=()=>{};import{mkdir as PY,readFile as CY,writeFile as yY,readdir as fQ,rm as xY,stat as gQ}from"fs/promises";import{join as V6,dirname as vY}from"path";async function fY(Z){try{await PY(Z,{recursive:!0})}catch{}}function M6(Z,$,Y){return V6(Z,Y,`${$}.json`)}async function N6(Z,$,Y){if((Date.now()-Z.createdAt)/86400000>Y)return!1;if(await p5($)!==Z.srcMtime)return!1;return!0}async function b4(Z,$,Y,J=c5){if(!J.enabled)return null;let G=S4(Z,$),X=aZ.get(G);if(X){if(await N6(X,Z,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;aZ.delete(G)}let Q=M6(J.directory,G,Y);if(await jZ(Q))try{let K=await CY(Q,"utf-8"),q=JSON.parse(K);if(await N6(q,Z,J.maxAge))return q.lastAccessedAt=Date.now(),aZ.set(G,q),q.data}catch{}return null}async function P4(Z,$,Y,J,G=c5){if(!G.enabled)return;let X=S4(Z,$),Q=await BZ(Z),K=await p5(Z),q={key:X,src:Z,srcHash:Q,srcMtime:K,optionsHash:S4("",$),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};aZ.set(X,q);let _=M6(G.directory,X,J);try{await fY(vY(_)),await yY(_,JSON.stringify(q,null,2))}catch(j){console.warn(`[stx-media] Failed to write cache: ${j}`)}}async function C4(Z,$=c5){if(Z==="all")aZ.clear();else aZ.clear();let Y=Z==="all"?["image","video"]:[Z];for(let J of Y){let G=V6($.directory,J);try{await xY(G,{recursive:!0,force:!0})}catch{}}}var aZ,c5;var l5=I(()=>{yZ();aZ=new Map,c5={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class x4{config;constructor(Z={}){this.config={...gY,...Z}}async get(Z,$){return b4(Z,$,"image",this.config)}async set(Z,$,Y){return P4(Z,$,Y,"image",this.config)}async clear(){return C4("image",this.config)}updateConfig(Z){this.config={...this.config,...Z}}}function i5(Z){if(!y4)y4=new x4(Z);else if(Z)y4.updateConfig(Z);return y4}async function v4(Z,$,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return i5(J).get(Z,$)}async function f4(Z,$,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return i5(G).set(Z,$,Y)}async function w6(){return i5().clear()}var gY,y4=null;var n5=I(()=>{l5();gY={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as hY,basename as dY,extname as mY,join as uY}from"path";import{mkdir as pY}from"fs/promises";async function s5(){try{return await import("ts-images")}catch{return null}}function T6(Z){switch(Z){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 cY(Z,$){let Y=$?T6($):T6("web"),J=Z.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function I6(Z,$,Y){let J=await s5();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:Z,processed:!1};let G=await v4(Z,$,Y);if(G)return G;try{let X=hY(Z);if(!await jZ(X))return{src:Z,processed:!1,errors:[`Source file not found: ${Z}`]};let Q=cY(Y,$.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await pY(K,{recursive:!0});let _=await BZ(X),j=dY(Z,mY(Z)),B=$.outputFormat?[$.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],W={src:Z,processed:!0,variants:[],hash:_},U=null;if($.transformations&&$.transformations.length>0)U=await o5(X,$.transformations,J);for(let z of B){let H=Q[z]||{},L=`${j}-${_}.${z}`,F=uY(K,L);try{let O=await J.optimizeImage({input:U||X,output:F,format:z,quality:H.quality,progressive:H.progressive});if(O){if(W.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:z,size:O.outputSize||0}),!W.originalWidth&&O.width)W.originalWidth=O.width,W.originalHeight=O.height}}catch(O){W.errors=W.errors||[],W.errors.push(`Failed to optimize ${z}: ${O}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let z=await J.generateThumbHash(X);W.placeholder=z.dataUrl}catch(z){W.errors=W.errors||[],W.errors.push(`Failed to generate thumbhash: ${z}`)}if($.useDominantColor)try{let z=await J.generatePlaceholder(X,{strategy:"dominant-color"});W.dominantColor=z.dominantColor}catch(z){W.errors=W.errors||[],W.errors.push(`Failed to extract dominant color: ${z}`)}return await f4(Z,$,W,Y),W}catch(X){return{src:Z,processed:!1,errors:[`Processing failed: ${X}`]}}}async function D6(Z,$,Y,J){let G=await s5();if(!G)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await G.optimizeImage({input:Z,output:J,format:$,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function o5(Z,$,Y){let J=Y||await s5();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let G=await J.decode(Z);for(let X of $){let Q=X.options||{};switch(X.type){case"resize":if(Q.width||Q.height)G=await J.resize(G,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)G=await J.blur(G,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)G=await J.sharpen(G,Q.amount);break;case"grayscale":G=await J.grayscale(G);break;case"rotate":if(Q.angle!==void 0)G=await J.rotate(G,Q.angle);break;case"flip":G=await J.flip(G);break;case"flop":G=await J.flop(G);break;case"brightness":if(Q.value!==void 0)G=await J.brightness(G,Q.value);break;case"contrast":if(Q.value!==void 0)G=await J.contrast(G,Q.value);break;case"saturation":if(Q.value!==void 0)G=await J.saturation(G,Q.value);break}}return await J.encode(G,"png")}catch(G){return console.error(`[stx-media] Transformation failed: ${G}`),null}}var E6=I(()=>{yZ();n5()});import{resolve as lY,basename as iY,extname as nY,join as sY}from"path";import{mkdir as oY}from"fs/promises";async function rY(){try{return await import("ts-images")}catch{return null}}async function k6(Z,$,Y){let J=await rY();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let G=lY(Z);if(!await jZ(G))return console.warn(`[stx-media] Source file not found: ${Z}`),null;try{let X=$.responsiveWidths||Y.breakpoints||aY,Q=$.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await oY(K,{recursive:!0});let _=await BZ(G),j=iY(Z,nY(Z)),B=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},W={src:Z,byFormat:{},srcsets:{}};for(let z of Q){W.byFormat[z]=[];let H=[];for(let L of X){let F=`${j}-${L}w-${_}.${z}`,O=sY(K,F),A=`${q}/${F}`;try{let M=B[z]?.quality||80;if(await jZ(O)){W.byFormat[z].push({path:O,url:A,width:L,height:0,format:z,size:0}),H.push(`${A} ${L}w`);continue}let V=await J.processImage({input:G,output:O,format:z,quality:M,resize:{width:L}});if(V)W.byFormat[z].push({path:O,url:A,width:L,height:V.height||Math.round(L*(V.height||1)/(V.width||1)),format:z,size:V.outputSize||0}),H.push(`${A} ${L}w`)}catch(M){console.warn(`[stx-media] Failed to generate ${z} at ${L}w: ${M}`)}}W.srcsets[z]=H.join(", ")}let U=$.placeholder||Y.placeholderStrategy||"thumbhash";if(U!=="none")try{if(U==="thumbhash"){let z=await J.generateThumbHash(G);W.placeholder={dataURL:z.dataUrl,width:z.width||32,height:z.height||32,strategy:"thumbhash"}}else{let z=await J.generatePlaceholder(G,{strategy:U,width:20});W.placeholder={dataURL:z.dataURL,width:z.width,height:z.height,strategy:U}}}catch(z){console.warn(`[stx-media] Failed to generate placeholder: ${z}`)}return W.sizes=$.sizes||tY(X),W}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function tY(Z){let $=[...Z].sort((J,G)=>J-G),Y=[];for(let J=0;J<$.length-1;J++){let G=$[J];Y.push(`(max-width: ${G}px) ${G}px`)}return Y.push(`${$[$.length-1]}px`),Y.join(", ")}function S6(Z,$="width"){if(!Z||Z.length===0)return"";if($==="dpr")return Z.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return Z.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var aY;var b6=I(()=>{yZ();aY=[320,480,640,768,1024,1280,1536,1920]});var P6={};t(P6,{setCachedImageResult:()=>f4,processImage:()=>I6,optimizeImage:()=>D6,getCachedImageResult:()=>v4,generateSrcset:()=>S6,generateResponsiveVariants:()=>k6,clearImageCache:()=>w6,applyTransformations:()=>o5,ImageProcessorCache:()=>x4});var C6=I(()=>{E6();b6();n5()});async function eY(){try{return await Promise.resolve().then(() => (C6(),P6))}catch(Z){if(!y6)console.warn("[stx-media] Image processor not available, some features disabled:",Z),y6=!0;return null}}async function g4(Z,$={}){let Y=$,J=Z;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return JJ(J,Y)}if(Y.processedResult?.processed)return e5(Z,Y.processedResult,$);if(Y.responsiveVariants)return g6(Z,Y.responsiveVariants,$);let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=rZ,dpr:j,formats:B=z4,quality:W=r5,params:U={},placeholder:z="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":d4,decoding:A=h4,fetchpriority:M,objectFit:V,objectPosition:R,crossorigin:N,referrerpolicy:w}=Z,D=Z.class,E=Z.style,k=Z.id,T=Z.data||{},{isDev:S=!1,baseUrl:d=""}=$;if(S&&!$.optimize)return YJ(Z);let c,P,u=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!F)try{c=await O6(G,{strategy:z,...H}),P=H6(u,c,H)}catch{}let XZ=j!==void 0&&Q!==void 0,s;if(XZ)s=$J(Z,u,c,$);else s=await ZJ(Z,u,c,$);let a;if(F){let y=B.includes("webp")?"webp":B[0],b=f5(G,_,{...U,q:W},y),v=typeof q==="object"?g5(q):q||"100vw";a=`<link rel="preload" as="image" imagesrcset="${b}" imagesizes="${v}" />`}let GZ=[];if(!x6&&z!=="none")GZ.push(u5),x6=!0;if(P)GZ.push(P);let h=L?f6(u):void 0;return{html:s,preloadLink:a,css:GZ.length>0?GZ.join(`
1874
- `):void 0,script:h}}async function ZJ(Z,$,Y,J){let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=rZ,formats:j=z4,quality:B=r5,params:W={},lazy:U=!0,priority:z=!1,loading:H=z?"eager":d4,decoding:L=h4,fetchpriority:F,objectFit:O,objectPosition:A,crossorigin:M,referrerpolicy:V}=Z,R=Z.class,N=Z.style,w=Z.data||{},D=typeof q==="object"?g5(q):q||"100vw",E=[];for(let S of j){let d=f5(G,_,{...W,q:B},S),c=h5(S);if(U&&!z)E.push(` <source type="${c}" data-srcset="${d}" data-sizes="${D}" />`);else E.push(` <source type="${c}" srcset="${d}" sizes="${D}" />`)}let k=a5({src:U4(G,{...W,q:B}),alt:X,width:Q,height:K,loading:z?void 0:H,decoding:L,fetchpriority:z?"high":F,objectFit:O,objectPosition:A,crossorigin:M,referrerpolicy:V,className:v6(R,Y),style:t5(N,O,A,Y),lazy:U&&!z,data:w}),T;if(Y){let S=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;T=`<div id="${$}" class="stx-img-placeholder" style="${S}">
1881
+ `.trim();u5=new Map});import{createHash as R6}from"crypto";import{readFile as xY,stat as V6}from"fs/promises";async function WZ(Z){try{let $=await xY(Z);return R6("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function N6(Z){return R6("sha256").update(Z).digest("hex").slice(0,16)}function b4(Z,$){let Y=JSON.stringify($,Object.keys($).sort());return`${N6(Z)}-${N6(Y)}`}async function c5(Z){try{return(await V6(Z)).mtimeMs}catch{return 0}}async function BZ(Z){try{return await V6(Z),!0}catch{return!1}}var xZ=()=>{};import{mkdir as vY,readFile as fY,writeFile as gY,readdir as uQ,rm as hY,stat as pQ}from"fs/promises";import{join as w6,dirname as dY}from"path";async function mY(Z){try{await vY(Z,{recursive:!0})}catch{}}function T6(Z,$,Y){return w6(Z,Y,`${$}.json`)}async function M6(Z,$,Y){if((Date.now()-Z.createdAt)/86400000>Y)return!1;if(await c5($)!==Z.srcMtime)return!1;return!0}async function P4(Z,$,Y,J=l5){if(!J.enabled)return null;let G=b4(Z,$),X=aZ.get(G);if(X){if(await M6(X,Z,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;aZ.delete(G)}let Q=T6(J.directory,G,Y);if(await BZ(Q))try{let K=await fY(Q,"utf-8"),q=JSON.parse(K);if(await M6(q,Z,J.maxAge))return q.lastAccessedAt=Date.now(),aZ.set(G,q),q.data}catch{}return null}async function C4(Z,$,Y,J,G=l5){if(!G.enabled)return;let X=b4(Z,$),Q=await WZ(Z),K=await c5(Z),q={key:X,src:Z,srcHash:Q,srcMtime:K,optionsHash:b4("",$),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};aZ.set(X,q);let _=T6(G.directory,X,J);try{await mY(dY(_)),await gY(_,JSON.stringify(q,null,2))}catch(j){console.warn(`[stx-media] Failed to write cache: ${j}`)}}async function y4(Z,$=l5){if(Z==="all")aZ.clear();else aZ.clear();let Y=Z==="all"?["image","video"]:[Z];for(let J of Y){let G=w6($.directory,J);try{await hY(G,{recursive:!0,force:!0})}catch{}}}var aZ,l5;var i5=I(()=>{xZ();aZ=new Map,l5={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class v4{config;constructor(Z={}){this.config={...uY,...Z}}async get(Z,$){return P4(Z,$,"image",this.config)}async set(Z,$,Y){return C4(Z,$,Y,"image",this.config)}async clear(){return y4("image",this.config)}updateConfig(Z){this.config={...this.config,...Z}}}function n5(Z){if(!x4)x4=new v4(Z);else if(Z)x4.updateConfig(Z);return x4}async function f4(Z,$,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n5(J).get(Z,$)}async function g4(Z,$,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return n5(G).set(Z,$,Y)}async function I6(){return n5().clear()}var uY,x4=null;var s5=I(()=>{i5();uY={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as pY,basename as cY,extname as lY,join as iY}from"path";import{mkdir as nY}from"fs/promises";async function o5(){try{return await import("ts-images")}catch{return null}}function D6(Z){switch(Z){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 sY(Z,$){let Y=$?D6($):D6("web"),J=Z.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function E6(Z,$,Y){let J=await o5();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:Z,processed:!1};let G=await f4(Z,$,Y);if(G)return G;try{let X=pY(Z);if(!await BZ(X))return{src:Z,processed:!1,errors:[`Source file not found: ${Z}`]};let Q=sY(Y,$.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await nY(K,{recursive:!0});let _=await WZ(X),j=cY(Z,lY(Z)),B=$.outputFormat?[$.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],W={src:Z,processed:!0,variants:[],hash:_},U=null;if($.transformations&&$.transformations.length>0)U=await r5(X,$.transformations,J);for(let z of B){let H=Q[z]||{},F=`${j}-${_}.${z}`,O=iY(K,F);try{let L=await J.optimizeImage({input:U||X,output:O,format:z,quality:H.quality,progressive:H.progressive});if(L){if(W.variants.push({path:O,url:`${q}/${F}`,width:L.width||0,height:L.height||0,format:z,size:L.outputSize||0}),!W.originalWidth&&L.width)W.originalWidth=L.width,W.originalHeight=L.height}}catch(L){W.errors=W.errors||[],W.errors.push(`Failed to optimize ${z}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let z=await J.generateThumbHash(X);W.placeholder=z.dataUrl}catch(z){W.errors=W.errors||[],W.errors.push(`Failed to generate thumbhash: ${z}`)}if($.useDominantColor)try{let z=await J.generatePlaceholder(X,{strategy:"dominant-color"});W.dominantColor=z.dominantColor}catch(z){W.errors=W.errors||[],W.errors.push(`Failed to extract dominant color: ${z}`)}return await g4(Z,$,W,Y),W}catch(X){return{src:Z,processed:!1,errors:[`Processing failed: ${X}`]}}}async function k6(Z,$,Y,J){let G=await o5();if(!G)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await G.optimizeImage({input:Z,output:J,format:$,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function r5(Z,$,Y){let J=Y||await o5();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let G=await J.decode(Z);for(let X of $){let Q=X.options||{};switch(X.type){case"resize":if(Q.width||Q.height)G=await J.resize(G,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)G=await J.blur(G,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)G=await J.sharpen(G,Q.amount);break;case"grayscale":G=await J.grayscale(G);break;case"rotate":if(Q.angle!==void 0)G=await J.rotate(G,Q.angle);break;case"flip":G=await J.flip(G);break;case"flop":G=await J.flop(G);break;case"brightness":if(Q.value!==void 0)G=await J.brightness(G,Q.value);break;case"contrast":if(Q.value!==void 0)G=await J.contrast(G,Q.value);break;case"saturation":if(Q.value!==void 0)G=await J.saturation(G,Q.value);break}}return await J.encode(G,"png")}catch(G){return console.error(`[stx-media] Transformation failed: ${G}`),null}}var S6=I(()=>{xZ();s5()});import{resolve as oY,basename as rY,extname as aY,join as tY}from"path";import{mkdir as eY}from"fs/promises";async function Z9(){try{return await import("ts-images")}catch{return null}}async function b6(Z,$,Y){let J=await Z9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let G=oY(Z);if(!await BZ(G))return console.warn(`[stx-media] Source file not found: ${Z}`),null;try{let X=$.responsiveWidths||Y.breakpoints||$9,Q=$.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await eY(K,{recursive:!0});let _=await WZ(G),j=rY(Z,aY(Z)),B=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},W={src:Z,byFormat:{},srcsets:{}};for(let z of Q){W.byFormat[z]=[];let H=[];for(let F of X){let O=`${j}-${F}w-${_}.${z}`,L=tY(K,O),A=`${q}/${O}`;try{let M=B[z]?.quality||80;if(await BZ(L)){W.byFormat[z].push({path:L,url:A,width:F,height:0,format:z,size:0}),H.push(`${A} ${F}w`);continue}let V=await J.processImage({input:G,output:L,format:z,quality:M,resize:{width:F}});if(V)W.byFormat[z].push({path:L,url:A,width:F,height:V.height||Math.round(F*(V.height||1)/(V.width||1)),format:z,size:V.outputSize||0}),H.push(`${A} ${F}w`)}catch(M){console.warn(`[stx-media] Failed to generate ${z} at ${F}w: ${M}`)}}W.srcsets[z]=H.join(", ")}let U=$.placeholder||Y.placeholderStrategy||"thumbhash";if(U!=="none")try{if(U==="thumbhash"){let z=await J.generateThumbHash(G);W.placeholder={dataURL:z.dataUrl,width:z.width||32,height:z.height||32,strategy:"thumbhash"}}else{let z=await J.generatePlaceholder(G,{strategy:U,width:20});W.placeholder={dataURL:z.dataURL,width:z.width,height:z.height,strategy:U}}}catch(z){console.warn(`[stx-media] Failed to generate placeholder: ${z}`)}return W.sizes=$.sizes||Y9(X),W}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function Y9(Z){let $=[...Z].sort((J,G)=>J-G),Y=[];for(let J=0;J<$.length-1;J++){let G=$[J];Y.push(`(max-width: ${G}px) ${G}px`)}return Y.push(`${$[$.length-1]}px`),Y.join(", ")}function P6(Z,$="width"){if(!Z||Z.length===0)return"";if($==="dpr")return Z.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return Z.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var $9;var C6=I(()=>{xZ();$9=[320,480,640,768,1024,1280,1536,1920]});var y6={};ZZ(y6,{setCachedImageResult:()=>g4,processImage:()=>E6,optimizeImage:()=>k6,getCachedImageResult:()=>f4,generateSrcset:()=>P6,generateResponsiveVariants:()=>b6,clearImageCache:()=>I6,applyTransformations:()=>r5,ImageProcessorCache:()=>v4});var x6=I(()=>{S6();C6();s5()});async function J9(){try{return await Promise.resolve().then(() => (x6(),y6))}catch(Z){if(!v6)console.warn("[stx-media] Image processor not available, some features disabled:",Z),v6=!0;return null}}async function h4(Z,$={}){let Y=$,J=Z;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return K9(J,Y)}if(Y.processedResult?.processed)return Z7(Z,Y.processedResult,$);if(Y.responsiveVariants)return d6(Z,Y.responsiveVariants,$);let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=rZ,dpr:j,formats:B=z4,quality:W=a5,params:U={},placeholder:z="none",placeholderOptions:H={},lazy:F=!0,priority:O=!1,loading:L=O?"eager":m4,decoding:A=d4,fetchpriority:M,objectFit:V,objectPosition:N,crossorigin:R,referrerpolicy:w}=Z,D=Z.class,E=Z.style,k=Z.id,T=Z.data||{},{isDev:S=!1,baseUrl:h=""}=$;if(S&&!$.optimize)return Q9(Z);let c,b,u=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(z!=="none"&&!O)try{c=await F6(G,{strategy:z,...H}),b=L6(u,c,H)}catch{}let QZ=j!==void 0&&Q!==void 0,s;if(QZ)s=G9(Z,u,c,$);else s=await X9(Z,u,c,$);let e;if(O){let C=B.includes("webp")?"webp":B[0],d=g5(G,_,{...U,q:W},C),x=typeof q==="object"?h5(q):q||"100vw";e=`<link rel="preload" as="image" imagesrcset="${d}" imagesizes="${x}" />`}let KZ=[];if(!f6&&z!=="none")KZ.push(p5),f6=!0;if(b)KZ.push(b);let g=F?h6(u):void 0;return{html:s,preloadLink:e,css:KZ.length>0?KZ.join(`
1882
+ `):void 0,script:g}}async function X9(Z,$,Y,J){let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=rZ,formats:j=z4,quality:B=a5,params:W={},lazy:U=!0,priority:z=!1,loading:H=z?"eager":m4,decoding:F=d4,fetchpriority:O,objectFit:L,objectPosition:A,crossorigin:M,referrerpolicy:V}=Z,N=Z.class,R=Z.style,w=Z.data||{},D=typeof q==="object"?h5(q):q||"100vw",E=[];for(let S of j){let h=g5(G,_,{...W,q:B},S),c=d5(S);if(U&&!z)E.push(` <source type="${c}" data-srcset="${h}" data-sizes="${D}" />`);else E.push(` <source type="${c}" srcset="${h}" sizes="${D}" />`)}let k=t5({src:U4(G,{...W,q:B}),alt:X,width:Q,height:K,loading:z?void 0:H,decoding:F,fetchpriority:z?"high":O,objectFit:L,objectPosition:A,crossorigin:M,referrerpolicy:V,className:g6(N,Y),style:e5(R,L,A,Y),lazy:U&&!z,data:w}),T;if(Y){let S=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;T=`<div id="${$}" class="stx-img-placeholder" style="${S}">
1875
1883
  <picture>
1876
1884
  ${E.join(`
1877
1885
  `)}
@@ -1881,9 +1889,9 @@ ${E.join(`
1881
1889
  ${E.join(`
1882
1890
  `)}
1883
1891
  <img ${k} />
1884
- </picture>`;return T}function $J(Z,$,Y,J){let{src:G,alt:X,width:Q,height:K,dpr:q=[1,2,3],quality:_=r5,params:j={},lazy:B=!0,priority:W=!1,loading:U=W?"eager":d4,decoding:z=h4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:A}=Z,M=Z.class,V=Z.style,R=Z.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),w=U6(G,N,q,{...j,q:_}),D=a5({src:U4(G,{...j,w:N,q:_}),alt:X,width:Q,height:K,loading:W?void 0:U,decoding:z,fetchpriority:W?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:A,className:v6(M,Y),style:t5(V,L,F,Y),lazy:B&&!W,data:R}),E=B&&!W?`data-srcset="${w}"`:`srcset="${w}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${k}">
1892
+ </picture>`;return T}function G9(Z,$,Y,J){let{src:G,alt:X,width:Q,height:K,dpr:q=[1,2,3],quality:_=a5,params:j={},lazy:B=!0,priority:W=!1,loading:U=W?"eager":m4,decoding:z=d4,fetchpriority:H,objectFit:F,objectPosition:O,crossorigin:L,referrerpolicy:A}=Z,M=Z.class,V=Z.style,N=Z.data||{},R=typeof Q==="number"?Q:Number.parseInt(String(Q),10),w=O6(G,R,q,{...j,q:_}),D=t5({src:U4(G,{...j,w:R,q:_}),alt:X,width:Q,height:K,loading:W?void 0:U,decoding:z,fetchpriority:W?"high":H,objectFit:F,objectPosition:O,crossorigin:L,referrerpolicy:A,className:g6(M,Y),style:e5(V,F,O,Y),lazy:B&&!W,data:N}),E=B&&!W?`data-srcset="${w}"`:`srcset="${w}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${k}">
1885
1893
  <img ${D} ${E} />
1886
- </div>`}return`<img ${$?`id="${$}" `:""}${D} ${E} />`}function YJ(Z){let{src:$,alt:Y,width:J,height:G,loading:X=d4,decoding:Q=h4,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,priority:W=!1}=Z,U=Z.class,z=Z.style,H=Z.id,L=Z.data||{};return{html:`<img ${a5({src:$,alt:Y,width:J,height:G,loading:W?"eager":X,decoding:Q,fetchpriority:W?"high":K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,className:U,style:t5(z,q,_),id:H,data:L})} />`}}function a5(Z){let $=[];if(Z.lazy)$.push(`data-src="${FZ(Z.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${FZ(Z.src)}"`);if($.push(`alt="${FZ(Z.alt)}"`),Z.width)$.push(`width="${Z.width}"`);if(Z.height)$.push(`height="${Z.height}"`);if(Z.loading)$.push(`loading="${Z.loading}"`);if(Z.decoding)$.push(`decoding="${Z.decoding}"`);if(Z.fetchpriority)$.push(`fetchpriority="${Z.fetchpriority}"`);if(Z.crossorigin)$.push(`crossorigin="${Z.crossorigin}"`);if(Z.referrerpolicy)$.push(`referrerpolicy="${Z.referrerpolicy}"`);if(Z.className)$.push(`class="${FZ(Z.className)}"`);if(Z.style)$.push(`style="${FZ(Z.style)}"`);if(Z.id)$.push(`id="${FZ(Z.id)}"`);if(Z.data)for(let[Y,J]of Object.entries(Z.data))$.push(`data-${Y}="${FZ(J)}"`);if(Z.lazy)$.push("data-stx-lazy");return $.join(" ")}function v6(Z,$){let Y=[];if(Z)Y.push(Z);if($)Y.push("stx-img-blur");return Y.join(" ")||""}function t5(Z,$,Y,J){let G=[];if($)G.push(`object-fit: ${$}`);if(Y)G.push(`object-position: ${Y}`);if(J)G.push("opacity: 0; transition: opacity 300ms ease-out");if(Z)G.push(Z);return G.join("; ")}function FZ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f6(Z){return`
1894
+ </div>`}return`<img ${$?`id="${$}" `:""}${D} ${E} />`}function Q9(Z){let{src:$,alt:Y,width:J,height:G,loading:X=m4,decoding:Q=d4,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,priority:W=!1}=Z,U=Z.class,z=Z.style,H=Z.id,F=Z.data||{};return{html:`<img ${t5({src:$,alt:Y,width:J,height:G,loading:W?"eager":X,decoding:Q,fetchpriority:W?"high":K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,className:U,style:e5(z,q,_),id:H,data:F})} />`}}function t5(Z){let $=[];if(Z.lazy)$.push(`data-src="${RZ(Z.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${RZ(Z.src)}"`);if($.push(`alt="${RZ(Z.alt)}"`),Z.width)$.push(`width="${Z.width}"`);if(Z.height)$.push(`height="${Z.height}"`);if(Z.loading)$.push(`loading="${Z.loading}"`);if(Z.decoding)$.push(`decoding="${Z.decoding}"`);if(Z.fetchpriority)$.push(`fetchpriority="${Z.fetchpriority}"`);if(Z.crossorigin)$.push(`crossorigin="${Z.crossorigin}"`);if(Z.referrerpolicy)$.push(`referrerpolicy="${Z.referrerpolicy}"`);if(Z.className)$.push(`class="${RZ(Z.className)}"`);if(Z.style)$.push(`style="${RZ(Z.style)}"`);if(Z.id)$.push(`id="${RZ(Z.id)}"`);if(Z.data)for(let[Y,J]of Object.entries(Z.data))$.push(`data-${Y}="${RZ(J)}"`);if(Z.lazy)$.push("data-stx-lazy");return $.join(" ")}function g6(Z,$){let Y=[];if(Z)Y.push(Z);if($)Y.push("stx-img-blur");return Y.join(" ")||""}function e5(Z,$,Y,J){let G=[];if($)G.push(`object-fit: ${$}`);if(Y)G.push(`object-position: ${Y}`);if(J)G.push("opacity: 0; transition: opacity 300ms ease-out");if(Z)G.push(Z);return G.join("; ")}function RZ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function h6(Z){return`
1887
1895
  (function() {
1888
1896
  const container = document.getElementById('${Z}');
1889
1897
  if (!container) return;
@@ -1920,22 +1928,22 @@ ${E.join(`
1920
1928
 
1921
1929
  observer.observe(container);
1922
1930
  })();
1923
- `.trim()}async function JJ(Z,$){let Y=await eY();if(!Y)return g4({...Z,process:!1},$);let J=$.tsImagesConfig;if(Z.responsiveWidths&&Z.responsiveWidths.length>0||Z.widths&&Z.widths.length>0||!Z.width&&!Z.dpr){let X=await Y.generateResponsiveVariants(Z.src,Z,J);if(X)return g6(Z,X,$)}else{let X=await Y.processImage(Z.src,Z,J);if(X.processed)return e5(Z,X,$)}return g4({...Z,process:!1},$)}async function e5(Z,$,Y){let{alt:J,width:G,height:X,lazy:Q=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B}=Z,W=Z.class,U=Z.style,z=Z.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=Z.data||{},L=$.variants||[],F=L.find((P)=>P.format==="jpeg")||L.find((P)=>P.format==="webp")||L[0],O=F?.url||Z.src,A=L.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),M=new Map;for(let P of L){if(!M.has(P.format))M.set(P.format,[]);M.get(P.format).push(P)}let V=[],R=["avif","webp","jpeg","png"];for(let P of R){let u=M.get(P);if(u&&u.length>0){let XZ=u.map((a)=>`${a.url} ${a.width}w`).join(", "),s=h5(P);if(Q&&!K)V.push(` <source type="${s}" data-srcset="${XZ}" />`);else V.push(` <source type="${s}" srcset="${XZ}" />`)}}let N=[];if(Q&&!K){if(N.push(`data-src="${FZ(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),A)N.push(`data-srcset="${A}"`)}else if(N.push(`src="${FZ(O)}"`),A)N.push(`srcset="${A}"`);N.push(`alt="${FZ(J)}"`);let w=G||$.originalWidth,D=X||$.originalHeight;if(w)N.push(`width="${w}"`);if(D)N.push(`height="${D}"`);if(!K)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(j)N.push(`crossorigin="${j}"`);if(B)N.push(`referrerpolicy="${B}"`);let E=[];if(q)E.push(`object-fit: ${q}`);if(_)E.push(`object-position: ${_}`);if($.placeholder&&Q)E.push("opacity: 0; transition: opacity 300ms ease-out");if(U)E.push(U);if(E.length>0)N.push(`style="${E.join("; ")}"`);let k=[];if(W)k.push(W);if($.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(Q&&!K)N.push("data-stx-lazy");for(let[P,u]of Object.entries(H))N.push(`data-${P}="${FZ(u)}"`);let T;if($.placeholder||$.dominantColor&&Z.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;T=`<div id="${z}" class="stx-img-placeholder" style="${P}">
1931
+ `.trim()}async function K9(Z,$){let Y=await J9();if(!Y)return h4({...Z,process:!1},$);let J=$.tsImagesConfig;if(Z.responsiveWidths&&Z.responsiveWidths.length>0||Z.widths&&Z.widths.length>0||!Z.width&&!Z.dpr){let X=await Y.generateResponsiveVariants(Z.src,Z,J);if(X)return d6(Z,X,$)}else{let X=await Y.processImage(Z.src,Z,J);if(X.processed)return Z7(Z,X,$)}return h4({...Z,process:!1},$)}async function Z7(Z,$,Y){let{alt:J,width:G,height:X,lazy:Q=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B}=Z,W=Z.class,U=Z.style,z=Z.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=Z.data||{},F=$.variants||[],O=F.find((b)=>b.format==="jpeg")||F.find((b)=>b.format==="webp")||F[0],L=O?.url||Z.src,A=F.filter((b)=>b.format===(O?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),M=new Map;for(let b of F){if(!M.has(b.format))M.set(b.format,[]);M.get(b.format).push(b)}let V=[],N=["avif","webp","jpeg","png"];for(let b of N){let u=M.get(b);if(u&&u.length>0){let QZ=u.map((e)=>`${e.url} ${e.width}w`).join(", "),s=d5(b);if(Q&&!K)V.push(` <source type="${s}" data-srcset="${QZ}" />`);else V.push(` <source type="${s}" srcset="${QZ}" />`)}}let R=[];if(Q&&!K){if(R.push(`data-src="${RZ(L)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),A)R.push(`data-srcset="${A}"`)}else if(R.push(`src="${RZ(L)}"`),A)R.push(`srcset="${A}"`);R.push(`alt="${RZ(J)}"`);let w=G||$.originalWidth,D=X||$.originalHeight;if(w)R.push(`width="${w}"`);if(D)R.push(`height="${D}"`);if(!K)R.push(`loading="${Q?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(j)R.push(`crossorigin="${j}"`);if(B)R.push(`referrerpolicy="${B}"`);let E=[];if(q)E.push(`object-fit: ${q}`);if(_)E.push(`object-position: ${_}`);if($.placeholder&&Q)E.push("opacity: 0; transition: opacity 300ms ease-out");if(U)E.push(U);if(E.length>0)R.push(`style="${E.join("; ")}"`);let k=[];if(W)k.push(W);if($.placeholder)k.push("stx-img-blur");if(k.length>0)R.push(`class="${k.join(" ")}"`);if(Q&&!K)R.push("data-stx-lazy");for(let[b,u]of Object.entries(H))R.push(`data-${b}="${RZ(u)}"`);let T;if($.placeholder||$.dominantColor&&Z.useDominantColor){let b=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;T=`<div id="${z}" class="stx-img-placeholder" style="${b}">
1924
1932
  <picture>
1925
1933
  ${V.join(`
1926
1934
  `)}
1927
- <img ${N.join(" ")} />
1935
+ <img ${R.join(" ")} />
1928
1936
  </picture>
1929
1937
  </div>`}else T=`<picture${z?` id="${z}"`:""}>
1930
1938
  ${V.join(`
1931
1939
  `)}
1932
- <img ${N.join(" ")} />
1933
- </picture>`;let S=[];if($.placeholder)S.push(u5);let d=Q?f6(z):void 0,c;if(K&&A)c=`<link rel="preload" as="image" imagesrcset="${A}" />`;return{html:T,preloadLink:c,css:S.length>0?S.join(`
1934
- `):void 0,script:d}}async function g6(Z,$,Y){let J={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[G,X]of Object.entries($.byFormat))if(X)J.variants.push(...X);return e5(Z,J,Y)}var y6=!1,r5=80,h4="async",d4="lazy",x6=!1;var h6=I(()=>{d5();L6()});function XJ(){return k4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(Z,$,Y,J)=>{let{src:G,alt:X,options:Q}=GJ(Z,$,Y);if(!G)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:G,alt:X||"",widths:Q.widths||rZ,formats:Q.formats||z4,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Y.__isDev||!1,_=await g4(K,{isDev:q}),j=_.html;if(_.preloadLink)j=_.preloadLink+`
1940
+ <img ${R.join(" ")} />
1941
+ </picture>`;let S=[];if($.placeholder)S.push(p5);let h=Q?h6(z):void 0,c;if(K&&A)c=`<link rel="preload" as="image" imagesrcset="${A}" />`;return{html:T,preloadLink:c,css:S.length>0?S.join(`
1942
+ `):void 0,script:h}}async function d6(Z,$,Y){let J={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[G,X]of Object.entries($.byFormat))if(X)J.variants.push(...X);return Z7(Z,J,Y)}var v6=!1,a5=80,d4="async",m4="lazy",f6=!1;var m6=I(()=>{m5();A6()});function q9(){return S4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(Z,$,Y,J)=>{let{src:G,alt:X,options:Q}=_9(Z,$,Y);if(!G)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:G,alt:X||"",widths:Q.widths||rZ,formats:Q.formats||z4,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Y.__isDev||!1,_=await h4(K,{isDev:q}),j=_.html;if(_.preloadLink)j=_.preloadLink+`
1935
1943
  `+j;if(_.css)j+=`
1936
1944
  <style>${_.css}</style>`;if(_.script)j+=`
1937
- <script>${_.script}</script>`;return j},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function GJ(Z,$,Y){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let J=Z.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let G=QJ(J),X=Z7(G[0],Y)||"",Q=Z7(G[1],Y)||"",K={};if(G[2]){let q=Z7(G[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof G[2]==="string")try{K=JSON.parse(G[2])}catch{}}return{src:X,alt:Q,options:K}}function QJ(Z){let $=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<Z.length;K++){let q=Z[K],_=K>0?Z[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){$.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())$.push(Y.trim());return $}function Z7(Z,$){if(typeof Z!=="string")return Z;let Y=Z.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=$[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var d6;var m6=I(()=>{v5();h6();d5();d6=XJ()});class u4{config;constructor(Z={}){this.config={...KJ,...Z}}async get(Z,$){return b4(Z,$,"video",this.config)}async set(Z,$,Y){return P4(Z,$,Y,"video",this.config)}async clear(){return C4("video",this.config)}updateConfig(Z){this.config={...this.config,...Z}}}function $7(Z){if(!m4)m4=new u4(Z);else if(Z)m4.updateConfig(Z);return m4}async function p4(Z,$,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return $7(J).get(Z,$)}async function c4(Z,$,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return $7(G).set(Z,$,Y)}async function u6(){return $7().clear()}var KJ,m4=null;var Y7=I(()=>{l5();KJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as J7,basename as X7,extname as G7,join as l4}from"path";import{mkdir as Q7}from"fs/promises";async function K7(){try{return await import("ts-videos")}catch{return null}}async function i4(Z,$,Y,J){let G=await K7();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=J7(Z);if(!await jZ(X))return null;await Q7(Y,{recursive:!0});let Q=await BZ(X),K=X7(Z,G7(Z)),q=$.format||"webp",_=$.timestamp||0,j=`${K}-poster-${Q}.${q}`,B=l4(Y,j),W=await G.extractThumbnails(X,{timestamps:[_],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:Y,outputPattern:j.replace(`.${q}`,"")});if(W&&W.length>0){let U=W[0];return{path:B,url:`${J}/${j}`,width:U.width||$.width||1280,height:U.height||720,timestamp:_,size:U.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function n4(Z,$,Y,J){let G=await K7();if(!G)return[];try{let X=J7(Z);if(!await jZ(X))return[];await Q7(Y,{recursive:!0});let Q=await BZ(X),K=X7(Z,G7(Z)),q=$.format||"webp",B=(await new G.Input(X).getInfo()).duration||60,W=$.count||10,U=$.interval||B/W,z=[];for(let L=0;L<W&&L*U<B;L++)z.push(L*U);let H=await G.extractThumbnails(X,{timestamps:z,width:$.width||320,format:q,quality:$.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${Q}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||l4(Y,`${K}-thumb-${Q}-${F}.${q}`),url:`${J}/${K}-thumb-${Q}-${F}.${q}`,width:L.width||$.width||320,height:L.height||180,timestamp:z[F],size:L.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function p6(Z,$,Y,J){let G=await K7();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=J7(Z);if(!await jZ(X))return null;await Q7(Y,{recursive:!0});let Q=await BZ(X),K=X7(Z,G7(Z)),j=(await new G.Input(X).getInfo()).duration||60,B=$.columns||10,W=$.interval||5,U=$.thumbnailWidth||160,z=$.thumbnailHeight||90,H=$.format||"jpeg",L=Math.ceil(j/W),F=Math.ceil(L/B),O=`${K}-sprite-${Q}.${H}`,A=l4(Y,O),M=[];for(let R=0;R<L;R++)M.push(R*W);let V=await G.extractThumbnails(X,{timestamps:M,width:U,height:z,format:H,quality:$.quality||70,outputDir:l4(Y,".temp")});if(!V||V.length===0)return null;try{let R=await import("ts-images"),N=B*U,w=F*z,D=await R.createSprite({images:V.map((E)=>E.path),columns:B,padding:0,outputPath:A,format:H,quality:$.quality||70});return{url:`${J}/${O}`,path:A,columns:B,rows:F,thumbnailWidth:U,thumbnailHeight:z,interval:W,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var q7=I(()=>{yZ()});import{resolve as l6,basename as i6,extname as n6,join as xZ}from"path";import{mkdir as s4,writeFile as s6}from"fs/promises";async function o6(){try{return await import("ts-videos")}catch{return null}}async function o4(Z,$,Y,J,G){let X=await o6();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=l6(Z);if(!await jZ(Q))return null;let K=await BZ(Q),q=i6(Z,n6(Z)),_=xZ(Y,`${q}-${K}-hls`);await s4(_,{recursive:!0});let j=$.length>0?$:r6,B=G?.segmentDuration||6,z=(await new X.Input(Q).getInfo()).duration||0,H=[],L=0;for(let A of j){let M=xZ(_,A.label);await s4(M,{recursive:!0});let V=`${A.label}.m3u8`,R=xZ(M,V);try{let N=await X.generateHLS(Q,{outputDir:M,segmentDuration:B,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate,playlistName:A.label});if(N)H.push({quality:A,url:`${J}/${q}-${K}-hls/${A.label}/${V}`,path:R}),L+=N.segmentCount||Math.ceil(z/B)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${A.label}: ${N}`)}}if(H.length===0)return null;let F=xZ(_,"master.m3u8"),O=qJ(H,J,q,K);return await s6(F,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:z}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function qJ(Z,$,Y,J){let G=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of Z){let{quality:Q}=X,K=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;G.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return G.join(`
1938
- `)}async function r4(Z,$,Y,J,G){let X=await o6();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=l6(Z);if(!await jZ(Q))return null;let K=await BZ(Q),q=i6(Z,n6(Z)),_=xZ(Y,`${q}-${K}-dash`);await s4(_,{recursive:!0});let j=$.length>0?$:r6,B=G?.segmentDuration||4,W=G?.minBufferTime||2,H=(await new X.Input(Q).getInfo()).duration||0,L=[],F=[];for(let V of j){let R=xZ(_,V.label);await s4(R,{recursive:!0});try{if(await X.generateDASH(Q,{outputDir:R,segmentDuration:B,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate})){if(L.push({bandwidth:V.bitrate,width:V.width,height:V.height||Math.round(V.width*9/16),url:`${J}/${q}-${K}-dash/${V.label}/video`}),V.audioBitrate)F.push({bandwidth:V.audioBitrate,url:`${J}/${q}-${K}-dash/${V.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${V.label}: ${N}`)}}if(L.length===0)return null;let O=xZ(_,"manifest.mpd"),A=_J(L,F,H,B,W);await s6(O,A);let M=[{type:"video",representations:L}];if(F.length>0)M.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:M,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function _J(Z,$,Y,J,G){let X=c6(Y),Q=c6(G),K=`<?xml version="1.0" encoding="UTF-8"?>
1945
+ <script>${_.script}</script>`;return j},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function _9(Z,$,Y){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let J=Z.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let G=j9(J),X=$7(G[0],Y)||"",Q=$7(G[1],Y)||"",K={};if(G[2]){let q=$7(G[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof G[2]==="string")try{K=JSON.parse(G[2])}catch{}}return{src:X,alt:Q,options:K}}function j9(Z){let $=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<Z.length;K++){let q=Z[K],_=K>0?Z[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){$.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())$.push(Y.trim());return $}function $7(Z,$){if(typeof Z!=="string")return Z;let Y=Z.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=$[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var u6;var p6=I(()=>{f5();m6();m5();u6=q9()});class p4{config;constructor(Z={}){this.config={...B9,...Z}}async get(Z,$){return P4(Z,$,"video",this.config)}async set(Z,$,Y){return C4(Z,$,Y,"video",this.config)}async clear(){return y4("video",this.config)}updateConfig(Z){this.config={...this.config,...Z}}}function Y7(Z){if(!u4)u4=new p4(Z);else if(Z)u4.updateConfig(Z);return u4}async function c4(Z,$,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Y7(J).get(Z,$)}async function l4(Z,$,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return Y7(G).set(Z,$,Y)}async function c6(){return Y7().clear()}var B9,u4=null;var J7=I(()=>{i5();B9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as X7,basename as G7,extname as Q7,join as i4}from"path";import{mkdir as K7}from"fs/promises";async function q7(){try{return await import("ts-videos")}catch{return null}}async function n4(Z,$,Y,J){let G=await q7();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=X7(Z);if(!await BZ(X))return null;await K7(Y,{recursive:!0});let Q=await WZ(X),K=G7(Z,Q7(Z)),q=$.format||"webp",_=$.timestamp||0,j=`${K}-poster-${Q}.${q}`,B=i4(Y,j),W=await G.extractThumbnails(X,{timestamps:[_],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:Y,outputPattern:j.replace(`.${q}`,"")});if(W&&W.length>0){let U=W[0];return{path:B,url:`${J}/${j}`,width:U.width||$.width||1280,height:U.height||720,timestamp:_,size:U.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function s4(Z,$,Y,J){let G=await q7();if(!G)return[];try{let X=X7(Z);if(!await BZ(X))return[];await K7(Y,{recursive:!0});let Q=await WZ(X),K=G7(Z,Q7(Z)),q=$.format||"webp",B=(await new G.Input(X).getInfo()).duration||60,W=$.count||10,U=$.interval||B/W,z=[];for(let F=0;F<W&&F*U<B;F++)z.push(F*U);let H=await G.extractThumbnails(X,{timestamps:z,width:$.width||320,format:q,quality:$.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${Q}`});if(H&&H.length>0)return H.map((F,O)=>({path:F.path||i4(Y,`${K}-thumb-${Q}-${O}.${q}`),url:`${J}/${K}-thumb-${Q}-${O}.${q}`,width:F.width||$.width||320,height:F.height||180,timestamp:z[O],size:F.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function l6(Z,$,Y,J){let G=await q7();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=X7(Z);if(!await BZ(X))return null;await K7(Y,{recursive:!0});let Q=await WZ(X),K=G7(Z,Q7(Z)),j=(await new G.Input(X).getInfo()).duration||60,B=$.columns||10,W=$.interval||5,U=$.thumbnailWidth||160,z=$.thumbnailHeight||90,H=$.format||"jpeg",F=Math.ceil(j/W),O=Math.ceil(F/B),L=`${K}-sprite-${Q}.${H}`,A=i4(Y,L),M=[];for(let N=0;N<F;N++)M.push(N*W);let V=await G.extractThumbnails(X,{timestamps:M,width:U,height:z,format:H,quality:$.quality||70,outputDir:i4(Y,".temp")});if(!V||V.length===0)return null;try{let N=await import("ts-images"),R=B*U,w=O*z,D=await N.createSprite({images:V.map((E)=>E.path),columns:B,padding:0,outputPath:A,format:H,quality:$.quality||70});return{url:`${J}/${L}`,path:A,columns:B,rows:O,thumbnailWidth:U,thumbnailHeight:z,interval:W,totalFrames:F}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(X){return console.warn(`[stx-media] Failed to generate sprite sheet: ${X}`),null}}var _7=I(()=>{xZ()});import{resolve as n6,basename as s6,extname as o6,join as vZ}from"path";import{mkdir as o4,writeFile as r6}from"fs/promises";async function a6(){try{return await import("ts-videos")}catch{return null}}async function r4(Z,$,Y,J,G){let X=await a6();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=n6(Z);if(!await BZ(Q))return null;let K=await WZ(Q),q=s6(Z,o6(Z)),_=vZ(Y,`${q}-${K}-hls`);await o4(_,{recursive:!0});let j=$.length>0?$:t6,B=G?.segmentDuration||6,z=(await new X.Input(Q).getInfo()).duration||0,H=[],F=0;for(let A of j){let M=vZ(_,A.label);await o4(M,{recursive:!0});let V=`${A.label}.m3u8`,N=vZ(M,V);try{let R=await X.generateHLS(Q,{outputDir:M,segmentDuration:B,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate,playlistName:A.label});if(R)H.push({quality:A,url:`${J}/${q}-${K}-hls/${A.label}/${V}`,path:N}),F+=R.segmentCount||Math.ceil(z/B)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${A.label}: ${R}`)}}if(H.length===0)return null;let O=vZ(_,"master.m3u8"),L=W9(H,J,q,K);return await r6(O,L),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:O,playlists:H,segmentCount:F,duration:z}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function W9(Z,$,Y,J){let G=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of Z){let{quality:Q}=X,K=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;G.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return G.join(`
1946
+ `)}async function a4(Z,$,Y,J,G){let X=await a6();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=n6(Z);if(!await BZ(Q))return null;let K=await WZ(Q),q=s6(Z,o6(Z)),_=vZ(Y,`${q}-${K}-dash`);await o4(_,{recursive:!0});let j=$.length>0?$:t6,B=G?.segmentDuration||4,W=G?.minBufferTime||2,H=(await new X.Input(Q).getInfo()).duration||0,F=[],O=[];for(let V of j){let N=vZ(_,V.label);await o4(N,{recursive:!0});try{if(await X.generateDASH(Q,{outputDir:N,segmentDuration:B,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate})){if(F.push({bandwidth:V.bitrate,width:V.width,height:V.height||Math.round(V.width*9/16),url:`${J}/${q}-${K}-dash/${V.label}/video`}),V.audioBitrate)O.push({bandwidth:V.audioBitrate,url:`${J}/${q}-${K}-dash/${V.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${V.label}: ${R}`)}}if(F.length===0)return null;let L=vZ(_,"manifest.mpd"),A=z9(F,O,H,B,W);await r6(L,A);let M=[{type:"video",representations:F}];if(O.length>0)M.push({type:"audio",representations:O});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:M,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function z9(Z,$,Y,J,G){let X=i6(Y),Q=i6(G),K=`<?xml version="1.0" encoding="UTF-8"?>
1939
1947
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
1940
1948
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1941
1949
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -1961,8 +1969,8 @@ ${V.join(`
1961
1969
  </Representation>
1962
1970
  `}K+=` </AdaptationSet>
1963
1971
  `}return K+=` </Period>
1964
- </MPD>`,K}function c6(Z){let $=Math.floor(Z/3600),Y=Math.floor(Z%3600/60),J=Math.floor(Z%60),G="PT";if($>0)G+=`${$}H`;if(Y>0)G+=`${Y}M`;return G+=`${J}S`,G}var r6;var _7=I(()=>{yZ();r6=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as a6,basename as jJ,extname as BJ,join as WJ}from"path";import{mkdir as zJ}from"fs/promises";async function t6(){try{return await import("ts-videos")}catch{return null}}function UJ(Z){switch(Z){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function HJ(Z){switch(Z){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function j7(Z){let $=await t6();if(!$)return null;try{let Y=a6(Z),G=await new $.Input(Y).getInfo();return{duration:G.duration||0,width:G.width||0,height:G.height||0,frameRate:G.frameRate||0,bitrate:G.bitrate||0,codec:G.videoCodec||"",audioCodec:G.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function e6(Z,$,Y,J){let G=await t6();if(!G)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:Z,processed:!1};let X=await p4(Z,$,Y);if(X)return X;try{let Q=a6(Z);if(!await jZ(Q))return{src:Z,processed:!1,errors:[`Source file not found: ${Z}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await zJ(K,{recursive:!0});let _=await BZ(Q),j=jJ(Z,BJ(Z)),B={src:Z,processed:!0,hash:_};J?.({percentage:5,stage:"analyzing"}),B.metadata=await j7(Q)||void 0;let W={};if($.quality)W.bitrate=UJ($.quality);if($.platform)Object.assign(W,HJ($.platform));if($.transcode)Object.assign(W,$.transcode);if(Object.keys(W).length>0||$.process){J?.({percentage:10,stage:"transcoding"});let U=`${j}-${_}.mp4`,z=WJ(K,U);try{let H=await OJ(Q,z,W,G,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)B.transcoded={path:z,url:`${q}/${U}`,duration:H.duration,size:H.size,video:{codec:W.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:W.audioCodec||"aac",bitrate:W.audioBitrate||128000,sampleRate:W.sampleRate||48000,channels:W.channels||2}:void 0}}catch(H){B.errors=B.errors||[],B.errors.push(`Transcoding failed: ${H}`)}}if($.generatePoster){J?.({percentage:65,stage:"generating-poster"});let U=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},z=await i4(Q,U,K,q);if(z)B.poster=z}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let U=await n4(Q,Y.thumbnails,K,q);if(U.length>0)B.thumbnails=U}if($.streaming){J?.({percentage:80,stage:"generating-manifests"});let U=typeof $.streaming==="object"?$.streaming:Y.streaming||{format:"hls"};if(U.format==="hls"||U.format===void 0){let z=await o4(Q,U.qualities||Y.streaming?.defaultQualities||[],K,q);if(z)B.streaming={...B.streaming,hls:z}}if(U.format==="dash"){let z=await r4(Q,U.qualities||Y.streaming?.defaultQualities||[],K,q);if(z)B.streaming={...B.streaming,dash:z}}}if($.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await c4(Z,$,B,Y),B}catch(Q){return{src:Z,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function OJ(Z,$,Y,J,G){try{let Q=await new J.Conversion(Z,$,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{G?.(K.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Y.maxWidth||0,height:Q.height||Y.maxHeight||0,bitrate:Q.bitrate||Y.bitrate||0,frameRate:Q.frameRate||Y.frameRate||30,audioCodec:Q.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var Z$=I(()=>{yZ();Y7();q7();_7()});var $$={};t($$,{setCachedVideoResult:()=>c4,processVideo:()=>e6,getCachedVideoResult:()=>p4,generateThumbnails:()=>n4,generateSpriteSheet:()=>p6,generatePoster:()=>i4,generateHLSManifest:()=>o4,generateDASHManifest:()=>r4,clearVideoCache:()=>u6,analyzeVideo:()=>j7,VideoProcessorCache:()=>u4});var Y$=I(()=>{Z$();q7();_7();Y7()});async function X$(){try{return await Promise.resolve().then(() => (Y$(),$$))}catch(Z){if(!J$)console.warn("[stx-media] Video processor not available, some features disabled:",Z),J$=!0;return null}}async function a4(Z,$={}){let Y=$,J=Z;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return VJ(J,Y)}if(Y.processedResult?.processed)return q$(Z,Y.processedResult,$);let G;if(J.generatePoster&&J.src&&!Z.poster)G=await MJ(J,Y);let{src:X,sources:Q=[],poster:K,posterPlaceholder:q,controls:_=G$,autoplay:j=!1,muted:B=!1,loop:W=!1,preload:U=Q$,playsinline:z=!0,lazy:H=!0,player:L="native",type:F,width:O,height:A,crossorigin:M,disablePictureInPicture:V=!1,disableRemotePlayback:R=!1}=Z,N=G||K,w=Z.class,D=Z.style,E=Z.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return AJ(Z,$);if(F&&F!=="video")return FJ(X||"",F,Z);let k=Q.length>0?Q:X?[{src:X,type:K$(X)}]:[],T=[`id="${E}"`];if(_)T.push("controls");if(j)T.push("autoplay");if(B)T.push("muted");if(W)T.push("loop");if(z)T.push("playsinline");if(V)T.push("disablepictureinpicture");if(R)T.push("disableremoteplayback");if(M)T.push(`crossorigin="${M}"`);if(H){if(T.push(`data-preload="${U}"`),T.push('preload="none"'),N)T.push(`data-poster="${YZ(N)}"`);T.push("data-stx-lazy")}else if(T.push(`preload="${U}"`),N)T.push(`poster="${YZ(N)}"`);if(O)T.push(`width="${O}"`);if(A)T.push(`height="${A}"`);if(w)T.push(`class="${YZ(w)}"`);if(D)T.push(`style="${YZ(D)}"`);let S=k.map((P)=>{return` <source ${H?`data-src="${YZ(P.src)}"`:`src="${YZ(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
1965
- `),d=`<video ${T.join(" ")}>
1972
+ </MPD>`,K}function i6(Z){let $=Math.floor(Z/3600),Y=Math.floor(Z%3600/60),J=Math.floor(Z%60),G="PT";if($>0)G+=`${$}H`;if(Y>0)G+=`${Y}M`;return G+=`${J}S`,G}var t6;var j7=I(()=>{xZ();t6=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as e6,basename as U9,extname as H9,join as O9}from"path";import{mkdir as L9}from"fs/promises";async function Z$(){try{return await import("ts-videos")}catch{return null}}function F9(Z){switch(Z){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function A9(Z){switch(Z){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function B7(Z){let $=await Z$();if(!$)return null;try{let Y=e6(Z),G=await new $.Input(Y).getInfo();return{duration:G.duration||0,width:G.width||0,height:G.height||0,frameRate:G.frameRate||0,bitrate:G.bitrate||0,codec:G.videoCodec||"",audioCodec:G.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function $$(Z,$,Y,J){let G=await Z$();if(!G)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:Z,processed:!1};let X=await c4(Z,$,Y);if(X)return X;try{let Q=e6(Z);if(!await BZ(Q))return{src:Z,processed:!1,errors:[`Source file not found: ${Z}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await L9(K,{recursive:!0});let _=await WZ(Q),j=U9(Z,H9(Z)),B={src:Z,processed:!0,hash:_};J?.({percentage:5,stage:"analyzing"}),B.metadata=await B7(Q)||void 0;let W={};if($.quality)W.bitrate=F9($.quality);if($.platform)Object.assign(W,A9($.platform));if($.transcode)Object.assign(W,$.transcode);if(Object.keys(W).length>0||$.process){J?.({percentage:10,stage:"transcoding"});let U=`${j}-${_}.mp4`,z=O9(K,U);try{let H=await N9(Q,z,W,G,(F)=>J?.({percentage:10+F*0.5,stage:"transcoding"}));if(H)B.transcoded={path:z,url:`${q}/${U}`,duration:H.duration,size:H.size,video:{codec:W.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:W.audioCodec||"aac",bitrate:W.audioBitrate||128000,sampleRate:W.sampleRate||48000,channels:W.channels||2}:void 0}}catch(H){B.errors=B.errors||[],B.errors.push(`Transcoding failed: ${H}`)}}if($.generatePoster){J?.({percentage:65,stage:"generating-poster"});let U=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},z=await n4(Q,U,K,q);if(z)B.poster=z}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let U=await s4(Q,Y.thumbnails,K,q);if(U.length>0)B.thumbnails=U}if($.streaming){J?.({percentage:80,stage:"generating-manifests"});let U=typeof $.streaming==="object"?$.streaming:Y.streaming||{format:"hls"};if(U.format==="hls"||U.format===void 0){let z=await r4(Q,U.qualities||Y.streaming?.defaultQualities||[],K,q);if(z)B.streaming={...B.streaming,hls:z}}if(U.format==="dash"){let z=await a4(Q,U.qualities||Y.streaming?.defaultQualities||[],K,q);if(z)B.streaming={...B.streaming,dash:z}}}if($.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await l4(Z,$,B,Y),B}catch(Q){return{src:Z,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function N9(Z,$,Y,J,G){try{let Q=await new J.Conversion(Z,$,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{G?.(K.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Y.maxWidth||0,height:Q.height||Y.maxHeight||0,bitrate:Q.bitrate||Y.bitrate||0,frameRate:Q.frameRate||Y.frameRate||30,audioCodec:Q.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var Y$=I(()=>{xZ();J7();_7();j7()});var J$={};ZZ(J$,{setCachedVideoResult:()=>l4,processVideo:()=>$$,getCachedVideoResult:()=>c4,generateThumbnails:()=>s4,generateSpriteSheet:()=>l6,generatePoster:()=>n4,generateHLSManifest:()=>r4,generateDASHManifest:()=>a4,clearVideoCache:()=>c6,analyzeVideo:()=>B7,VideoProcessorCache:()=>p4});var X$=I(()=>{Y$();_7();j7();J7()});async function Q$(){try{return await Promise.resolve().then(() => (X$(),J$))}catch(Z){if(!G$)console.warn("[stx-media] Video processor not available, some features disabled:",Z),G$=!0;return null}}async function t4(Z,$={}){let Y=$,J=Z;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return I9(J,Y)}if(Y.processedResult?.processed)return j$(Z,Y.processedResult,$);let G;if(J.generatePoster&&J.src&&!Z.poster)G=await D9(J,Y);let{src:X,sources:Q=[],poster:K,posterPlaceholder:q,controls:_=K$,autoplay:j=!1,muted:B=!1,loop:W=!1,preload:U=q$,playsinline:z=!0,lazy:H=!0,player:F="native",type:O,width:L,height:A,crossorigin:M,disablePictureInPicture:V=!1,disableRemotePlayback:N=!1}=Z,R=G||K,w=Z.class,D=Z.style,E=Z.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(F==="ts-video")return M9(Z,$);if(O&&O!=="video")return V9(X||"",O,Z);let k=Q.length>0?Q:X?[{src:X,type:_$(X)}]:[],T=[`id="${E}"`];if(_)T.push("controls");if(j)T.push("autoplay");if(B)T.push("muted");if(W)T.push("loop");if(z)T.push("playsinline");if(V)T.push("disablepictureinpicture");if(N)T.push("disableremoteplayback");if(M)T.push(`crossorigin="${M}"`);if(H){if(T.push(`data-preload="${U}"`),T.push('preload="none"'),R)T.push(`data-poster="${XZ(R)}"`);T.push("data-stx-lazy")}else if(T.push(`preload="${U}"`),R)T.push(`poster="${XZ(R)}"`);if(L)T.push(`width="${L}"`);if(A)T.push(`height="${A}"`);if(w)T.push(`class="${XZ(w)}"`);if(D)T.push(`style="${XZ(D)}"`);let S=k.map((b)=>{return` <source ${H?`data-src="${XZ(b.src)}"`:`src="${XZ(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
1973
+ `),h=`<video ${T.join(" ")}>
1966
1974
  ${S}
1967
1975
  Your browser does not support the video tag.
1968
1976
  </video>`,c;if(H)c=`
@@ -2000,20 +2008,20 @@ ${S}
2000
2008
 
2001
2009
  observer.observe(video);
2002
2010
  })();
2003
- `.trim();return{html:d,script:c}}function FJ(Z,$,Y){let{width:J=640,height:G=360}=Y,X=Y.class,Q=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch($){case"youtube":_=RJ(Z),q=_?`https://www.youtube-nocookie.com/embed/${_}`:Z;break;case"vimeo":_=NJ(Z),q=_?`https://player.vimeo.com/video/${_}`:Z;break;case"dailymotion":_=Z.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=Z.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=Z}let j=[`id="${K}"`,`src="${YZ(q)}"`,`width="${J}"`,`height="${G}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)j.push(`class="${YZ(X)}"`);if(Q)j.push(`style="${YZ(Q)}"`);if(Y.lazy)j.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2011
+ `.trim();return{html:h,script:c}}function V9(Z,$,Y){let{width:J=640,height:G=360}=Y,X=Y.class,Q=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch($){case"youtube":_=w9(Z),q=_?`https://www.youtube-nocookie.com/embed/${_}`:Z;break;case"vimeo":_=T9(Z),q=_?`https://player.vimeo.com/video/${_}`:Z;break;case"dailymotion":_=Z.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=Z.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=Z}let j=[`id="${K}"`,`src="${XZ(q)}"`,`width="${J}"`,`height="${G}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)j.push(`class="${XZ(X)}"`);if(Q)j.push(`style="${XZ(Q)}"`);if(Y.lazy)j.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
2004
2012
  <iframe ${j.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
2005
- </div>`}}function AJ(Z,$={}){let{src:Y,sources:J=[],poster:G,controls:X=!0,autoplay:Q=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:j=!0,lazy:B=!0,width:W,height:U}=Z,z=Z.class,H=Z.style,L=Z.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:Q,loop:q,muted:K,playsinline:j,preload:_,poster:G,controls:X,title:Z.title},O=["position: relative",W?`width: ${typeof W==="number"?W+"px":W}`:"width: 100%",U?`height: ${typeof U==="number"?U+"px":U}`:"",H||""].filter(Boolean).join("; "),A=`
2013
+ </div>`}}function M9(Z,$={}){let{src:Y,sources:J=[],poster:G,controls:X=!0,autoplay:Q=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:j=!0,lazy:B=!0,width:W,height:U}=Z,z=Z.class,H=Z.style,F=Z.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:J.length>0?J:Y,autoplay:Q,loop:q,muted:K,playsinline:j,preload:_,poster:G,controls:X,title:Z.title},L=["position: relative",W?`width: ${typeof W==="number"?W+"px":W}`:"width: 100%",U?`height: ${typeof U==="number"?U+"px":U}`:"",H||""].filter(Boolean).join("; "),A=`
2006
2014
  <div
2007
- id="${L}"
2008
- class="ts-video-player${z?" "+YZ(z):""}"
2009
- style="${O}"
2015
+ id="${F}"
2016
+ class="ts-video-player${z?" "+XZ(z):""}"
2017
+ style="${L}"
2010
2018
  data-ts-video-player
2011
- data-config='${JSON.stringify(F)}'
2019
+ data-config='${JSON.stringify(O)}'
2012
2020
  ${B?"data-lazy":""}
2013
2021
  >
2014
2022
  <div class="ts-video-player__container">
2015
2023
  ${G?`
2016
- <div class="ts-video-player__placeholder" style="background-image: url('${YZ(G)}');">
2024
+ <div class="ts-video-player__placeholder" style="background-image: url('${XZ(G)}');">
2017
2025
  <button class="ts-video-player__play-button" aria-label="Play video">
2018
2026
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
2019
2027
  <path d="M8 5v14l11-7z"/>
@@ -2025,7 +2033,7 @@ ${S}
2025
2033
  </div>
2026
2034
  `.trim(),M=`
2027
2035
  (function() {
2028
- var container = document.getElementById('${L}');
2036
+ var container = document.getElementById('${F}');
2029
2037
  if (!container) return;
2030
2038
 
2031
2039
  var config = JSON.parse(container.dataset.config || '{}');
@@ -2039,7 +2047,7 @@ ${S}
2039
2047
 
2040
2048
  // Load ts-video-player from CDN
2041
2049
  var script = document.createElement('script');
2042
- script.src = '${LJ}';
2050
+ script.src = '${R9}';
2043
2051
  script.onload = initPlayer;
2044
2052
  script.onerror = function() {
2045
2053
  console.error('[stx] Failed to load ts-video-player');
@@ -2167,14 +2175,14 @@ ${S}
2167
2175
  .ts-video-player__play-button svg {
2168
2176
  margin-left: 4px;
2169
2177
  }
2170
- `.trim();return{html:A,script:M,css:V}}function K$(Z){switch(Z.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function RJ(Z){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of $){let J=Z.match(Y);if(J)return J[1]}return null}function NJ(Z){let $=Z.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function YZ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function VJ(Z,$){let Y=await X$();if(!Y)return a4({...Z,process:!1},$);let J=$.tsVideosConfig,G=await Y.processVideo(Z.src,Z,J,Z.onProcessProgress);if(G.processed)return q$(Z,G,$);return a4({...Z,process:!1},$)}async function MJ(Z,$){let Y=await X$();if(!Y||!Z.src)return;let J=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},G=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster(Z.src,J,G.outputDir,G.baseUrl||"/videos"))?.url}function q$(Z,$,Y){let{controls:J=G$,autoplay:G=!1,muted:X=!1,loop:Q=!1,preload:K=Q$,playsinline:q=!0,lazy:_=!0,width:j,height:B,crossorigin:W,disablePictureInPicture:U=!1,disableRemotePlayback:z=!1}=Z,H=Z.class,L=Z.style,F=Z.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=Z.src,A=K$(O);if($.transcoded)O=$.transcoded.url,A="video/mp4";let M=$.streaming?.hls||$.streaming?.dash;if(M){if($.streaming?.hls)O=$.streaming.hls.manifestUrl,A="application/x-mpegURL";else if($.streaming?.dash)O=$.streaming.dash.manifestUrl,A="application/dash+xml"}let V=$.poster?.url||Z.poster,R=[`id="${F}"`];if(J)R.push("controls");if(G)R.push("autoplay");if(X)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(U)R.push("disablepictureinpicture");if(z)R.push("disableremoteplayback");if(W)R.push(`crossorigin="${W}"`);if(_){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),V)R.push(`data-poster="${YZ(V)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),V)R.push(`poster="${YZ(V)}"`);let N=j||$.metadata?.width,w=B||$.metadata?.height;if(N)R.push(`width="${N}"`);if(w)R.push(`height="${w}"`);if(H)R.push(`class="${YZ(H)}"`);if(L)R.push(`style="${YZ(L)}"`);let E=` <source ${_?`data-src="${YZ(O)}"`:`src="${YZ(O)}"`} type="${A}" />`,k=`<video ${R.join(" ")}>
2178
+ `.trim();return{html:A,script:M,css:V}}function _$(Z){switch(Z.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function w9(Z){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of $){let J=Z.match(Y);if(J)return J[1]}return null}function T9(Z){let $=Z.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function XZ(Z){return Z.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function I9(Z,$){let Y=await Q$();if(!Y)return t4({...Z,process:!1},$);let J=$.tsVideosConfig,G=await Y.processVideo(Z.src,Z,J,Z.onProcessProgress);if(G.processed)return j$(Z,G,$);return t4({...Z,process:!1},$)}async function D9(Z,$){let Y=await Q$();if(!Y||!Z.src)return;let J=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},G=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster(Z.src,J,G.outputDir,G.baseUrl||"/videos"))?.url}function j$(Z,$,Y){let{controls:J=K$,autoplay:G=!1,muted:X=!1,loop:Q=!1,preload:K=q$,playsinline:q=!0,lazy:_=!0,width:j,height:B,crossorigin:W,disablePictureInPicture:U=!1,disableRemotePlayback:z=!1}=Z,H=Z.class,F=Z.style,O=Z.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=Z.src,A=_$(L);if($.transcoded)L=$.transcoded.url,A="video/mp4";let M=$.streaming?.hls||$.streaming?.dash;if(M){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,A="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,A="application/dash+xml"}let V=$.poster?.url||Z.poster,N=[`id="${O}"`];if(J)N.push("controls");if(G)N.push("autoplay");if(X)N.push("muted");if(Q)N.push("loop");if(q)N.push("playsinline");if(U)N.push("disablepictureinpicture");if(z)N.push("disableremoteplayback");if(W)N.push(`crossorigin="${W}"`);if(_){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),V)N.push(`data-poster="${XZ(V)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),V)N.push(`poster="${XZ(V)}"`);let R=j||$.metadata?.width,w=B||$.metadata?.height;if(R)N.push(`width="${R}"`);if(w)N.push(`height="${w}"`);if(H)N.push(`class="${XZ(H)}"`);if(F)N.push(`style="${XZ(F)}"`);let E=` <source ${_?`data-src="${XZ(L)}"`:`src="${XZ(L)}"`} type="${A}" />`,k=`<video ${N.join(" ")}>
2171
2179
  ${E}
2172
2180
  Your browser does not support the video tag.
2173
- </video>`;if($.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${YZ($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
2181
+ </video>`;if($.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${XZ($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
2174
2182
  ${k}
2175
2183
  </div>`;let T;if(_)T=`
2176
2184
  (function() {
2177
- var video = document.getElementById('${F}');
2185
+ var video = document.getElementById('${O}');
2178
2186
  if (!video) return;
2179
2187
 
2180
2188
  var observer = new IntersectionObserver(function(entries) {
@@ -2216,9 +2224,9 @@ ${k}
2216
2224
  width: 100%;
2217
2225
  height: auto;
2218
2226
  }
2219
- `.trim();return{html:k,script:T,css:S}}var J$=!1,G$=!0,Q$="metadata",LJ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var _$=I(()=>{W7()});function j$(){return k4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(Z,$,Y,J)=>{let{src:G,options:X}=wJ(Z,$,Y);if(!G)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:G,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await a4(Q,q),j=_.html;if(_.css)j+=`
2227
+ `.trim();return{html:k,script:T,css:S}}var G$=!1,K$=!0,q$="metadata",R9="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var B$=I(()=>{z7()});function W$(){return S4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(Z,$,Y,J)=>{let{src:G,options:X}=E9(Z,$,Y);if(!G)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:G,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await t4(Q,q),j=_.html;if(_.css)j+=`
2220
2228
  <style>${_.css}</style>`;if(_.script)j+=`
2221
- <script>${_.script}</script>`;return j},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function wJ(Z,$,Y){if($.src)return{src:String($.src),options:$.options||{}};let J=Z.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let G=TJ(J),X=B$(G[0],Y)||"",Q={};if(G[1]){let K=B$(G[1],Y);if(typeof K==="object"&&K!==null)Q=K;else if(typeof G[1]==="string")try{Q=JSON.parse(G[1])}catch{}}return{src:X,options:Q}}function TJ(Z){let $=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<Z.length;K++){let q=Z[K],_=K>0?Z[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){$.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())$.push(Y.trim());return $}function B$(Z,$){if(typeof Z!=="string")return Z;let Y=Z.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=$[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var B7;var W7=I(()=>{v5();_$();B7=j$()});function IJ(Z,$){let Y=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2229
+ <script>${_.script}</script>`;return j},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function E9(Z,$,Y){if($.src)return{src:String($.src),options:$.options||{}};let J=Z.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let G=k9(J),X=z$(G[0],Y)||"",Q={};if(G[1]){let K=z$(G[1],Y);if(typeof K==="object"&&K!==null)Q=K;else if(typeof G[1]==="string")try{Q=JSON.parse(G[1])}catch{}}return{src:X,options:Q}}function k9(Z){let $=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<Z.length;K++){let q=Z[K],_=K>0?Z[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){$.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())$.push(Y.trim());return $}function z$(Z,$){if(typeof Z!=="string")return Z;let Y=Z.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let J=$[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var W7;var z7=I(()=>{f5();B$();W7=W$()});function S9(Z,$){let Y=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
2222
2230
  ${Z}
2223
2231
  </div>
2224
2232
  <script>
@@ -2263,7 +2271,7 @@ ${k}
2263
2271
  }
2264
2272
  }
2265
2273
  })();
2266
- </script>`}function DJ(Z,$){let Y=$.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",G=Y?.autoReload||!1,X=Z.trim().length>0,Q=`
2274
+ </script>`}function b9(Z,$){let Y=$.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",G=Y?.autoReload||!1,X=Z.trim().length>0,Q=`
2267
2275
  <div class="stx-pwa-update-banner" style="
2268
2276
  position: fixed;
2269
2277
  bottom: 0;
@@ -2372,7 +2380,7 @@ ${k}
2372
2380
  // Also listen for custom event
2373
2381
  window.addEventListener('pwa-update-available', showUpdate);
2374
2382
  })();
2375
- </script>`}function EJ(Z,$){let Y=Z.trim().length>0,J=`
2383
+ </script>`}function P9(Z,$){let Y=Z.trim().length>0,J=`
2376
2384
  <div class="stx-offline-indicator" style="
2377
2385
  position: fixed;
2378
2386
  top: 16px;
@@ -2433,7 +2441,7 @@ ${k}
2433
2441
  window.addEventListener('offline', updateStatus);
2434
2442
  updateStatus();
2435
2443
  })();
2436
- </script>`}function kJ(Z,$){let Y=$.pwa?.push,J=Y?.vapidPublicKey||"",G=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2444
+ </script>`}function C9(Z,$){let Y=$.pwa?.push,J=Y?.vapidPublicKey||"",G=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
2437
2445
  ${Z}
2438
2446
  </div>
2439
2447
  <script>
@@ -2514,71 +2522,71 @@ ${k}
2514
2522
  init();
2515
2523
  }
2516
2524
  })();
2517
- </script>`}var SJ,bJ,PJ,CJ,W$;var z$=I(()=>{SJ={name:"pwa.installButton",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return IJ(Z,G)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},bJ={name:"pwa.updatePrompt",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return DJ(Z,G)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},PJ={name:"pwa.offlineIndicator",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return EJ(Z,G)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},CJ={name:"pwa.pushSubscribe",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return kJ(Z,G)},hasEndTag:!0,description:"Renders a push notification subscription button"},W$=[SJ,bJ,PJ,CJ]});function z7(Z){for(let[$,Y]of Object.entries(C))if(Y===Z)return $;return}var C;var t4=I(()=>{C={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});import U$ from"process";function yJ(){return U$.env.NODE_ENV==="production"}function H4(){return!yJ()||U$.env.STX_DEBUG==="true"}var U7=()=>{};import xJ from"path";import vJ from"process";function e4(){return{...H7}}function Z5(Z){if(!H7.showRelativePaths||!Z)return Z;let $=H7.baseDir||vJ.cwd();try{let Y=xJ.relative($,Z);return Y.startsWith("..")?Z:Y}catch{return Z}}var fJ,H7,$5,vZ,O4;var Y5=I(()=>{U7();t4();fJ={showRelativePaths:!1,enableAutoRecovery:H4(),logRecoveryWarnings:!0},H7={...fJ};$5=class $5 extends Error{code;filePath;line;column;context;numericCode;constructor(Z,$,Y,J,G,X,Q){super(Z);this.code=$;this.filePath=Y;this.line=J;this.column=G;this.context=X;if(this.name="StxError",this.numericCode=Q||C.EVALUATION_ERROR,this.filePath)this.filePath=Z5(this.filePath)}};vZ=class vZ extends $5{constructor(Z,$,Y,J,G,X){super(Z,"stx_RUNTIME_ERROR",$,Y,J,G,X||C.EVALUATION_ERROR);this.name="StxRuntimeError"}};O4=class O4 extends $5{isFatal=!0;constructor(Z,$,Y,J,G,X){super(Z,"stx_VALIDATION_ERROR",$,Y,J,G,X||C.DOM_API_VIOLATION);this.name="StxValidationError"}}});function O$(Z){let{type:$,message:Y,code:J,filePath:G,line:X,column:Q,template:K,offset:q,snippet:_,suggestion:j,format:B="text"}=Z,W=X,U=Q;if(!W&&K&&q!==void 0){let O=pJ(K,q);W=O.line,U=O.column}let z=G?Z5(G):void 0,H=J?z7(J):void 0,L={type:$,code:J,codeName:H,message:Y,filePath:z,line:W,column:U,snippet:_,suggestion:j,timestamp:new Date().toISOString()},F;switch(B){case"html":F=hJ(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=dJ(L,K,q);break;case"text":default:F=gJ(L,K,q);break}return{formatted:F,data:L}}function gJ(Z,$,Y){let J=[],G=Z.code?` [${Z.codeName||Z.code}]`:"";if(J.push(`[${Z.type} Error${G}]`),Z.filePath){let X=Z.filePath;if(Z.line){if(X+=`:${Z.line}`,Z.column)X+=`:${Z.column}`}J.push(`at ${X}`)}if(J.push(`
2518
- ${Z.message}`),$&&Z.line){let X=mJ($,Z.line,2);if(X)J.push(`
2525
+ </script>`}var y9,x9,v9,f9,U$;var H$=I(()=>{y9={name:"pwa.installButton",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return S9(Z,G)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},x9={name:"pwa.updatePrompt",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return b9(Z,G)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},v9={name:"pwa.offlineIndicator",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return P9(Z,G)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},f9={name:"pwa.pushSubscribe",handler:(Z,$,Y,J)=>{let G=Y.__stx_options||{};return C9(Z,G)},hasEndTag:!0,description:"Renders a push notification subscription button"},U$=[y9,x9,v9,f9]});function U7(Z){for(let[$,Y]of Object.entries(P))if(Y===Z)return $;return}var P;var e4=I(()=>{P={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});import O$ from"process";function g9(){return O$.env.NODE_ENV==="production"}function H4(){return!g9()||O$.env.STX_DEBUG==="true"}var H7=()=>{};import h9 from"path";import d9 from"process";function Z5(){return{...O7}}function $5(Z){if(!O7.showRelativePaths||!Z)return Z;let $=O7.baseDir||d9.cwd();try{let Y=h9.relative($,Z);return Y.startsWith("..")?Z:Y}catch{return Z}}var m9,O7,Y5,fZ,J5;var X5=I(()=>{H7();e4();m9={showRelativePaths:!1,enableAutoRecovery:H4(),logRecoveryWarnings:!0},O7={...m9};Y5=class Y5 extends Error{code;filePath;line;column;context;numericCode;constructor(Z,$,Y,J,G,X,Q){super(Z);this.code=$;this.filePath=Y;this.line=J;this.column=G;this.context=X;if(this.name="StxError",this.numericCode=Q||P.EVALUATION_ERROR,this.filePath)this.filePath=$5(this.filePath)}};fZ=class fZ extends Y5{constructor(Z,$,Y,J,G,X){super(Z,"stx_RUNTIME_ERROR",$,Y,J,G,X||P.EVALUATION_ERROR);this.name="StxRuntimeError"}};J5=class J5 extends Y5{isFatal=!0;constructor(Z,$,Y,J,G,X){super(Z,"stx_VALIDATION_ERROR",$,Y,J,G,X||P.DOM_API_VIOLATION);this.name="StxValidationError"}}});function F$(Z){let{type:$,message:Y,code:J,filePath:G,line:X,column:Q,template:K,offset:q,snippet:_,suggestion:j,format:B="text"}=Z,W=X,U=Q;if(!W&&K&&q!==void 0){let L=n9(K,q);W=L.line,U=L.column}let z=G?$5(G):void 0,H=J?U7(J):void 0,F={type:$,code:J,codeName:H,message:Y,filePath:z,line:W,column:U,snippet:_,suggestion:j,timestamp:new Date().toISOString()},O;switch(B){case"html":O=p9(F);break;case"json":O=JSON.stringify(F,null,2);break;case"console":O=c9(F,K,q);break;case"text":default:O=u9(F,K,q);break}return{formatted:O,data:F}}function u9(Z,$,Y){let J=[],G=Z.code?` [${Z.codeName||Z.code}]`:"";if(J.push(`[${Z.type} Error${G}]`),Z.filePath){let X=Z.filePath;if(Z.line){if(X+=`:${Z.line}`,Z.column)X+=`:${Z.column}`}J.push(`at ${X}`)}if(J.push(`
2526
+ ${Z.message}`),$&&Z.line){let X=l9($,Z.line,2);if(X)J.push(`
2519
2527
  ${X}`)}if(Z.snippet)J.push(`
2520
2528
  Snippet: ${Z.snippet}`);if(Z.suggestion)J.push(`
2521
- Suggestion: ${Z.suggestion}`);return J.join(" ")}function hJ(Z){let $=Z.code?` [${Z.code}]`:"",Y=Z.filePath?` in ${Z.filePath}${Z.line?`:${Z.line}`:""}`:"",J=`<!-- [${Z.type} Error${$}]${Y}: ${H$(Z.message)}`;if(Z.suggestion)J+=` | Suggestion: ${H$(Z.suggestion)}`;return J+=" -->",J}function dJ(Z,$,Y){let _=[],j=Z.code?` [${Z.codeName||Z.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${Z.type} Error${j} \u2501\u2501\u2501${"\x1B[0m"}`),Z.filePath){let B=`\x1B[36m${Z.filePath}\x1B[0m`;if(Z.line){if(B+=`\x1B[90m:${Z.line}\x1B[0m`,Z.column)B+=`\x1B[90m:${Z.column}\x1B[0m`}_.push(`
2529
+ Suggestion: ${Z.suggestion}`);return J.join(" ")}function p9(Z){let $=Z.code?` [${Z.code}]`:"",Y=Z.filePath?` in ${Z.filePath}${Z.line?`:${Z.line}`:""}`:"",J=`<!-- [${Z.type} Error${$}]${Y}: ${L$(Z.message)}`;if(Z.suggestion)J+=` | Suggestion: ${L$(Z.suggestion)}`;return J+=" -->",J}function c9(Z,$,Y){let _=[],j=Z.code?` [${Z.codeName||Z.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${Z.type} Error${j} \u2501\u2501\u2501${"\x1B[0m"}`),Z.filePath){let B=`\x1B[36m${Z.filePath}\x1B[0m`;if(Z.line){if(B+=`\x1B[90m:${Z.line}\x1B[0m`,Z.column)B+=`\x1B[90m:${Z.column}\x1B[0m`}_.push(`
2522
2530
  \x1B[90mat\x1B[0m ${B}`)}if(_.push(`
2523
2531
 
2524
- ${Z.message}`),$&&Z.line){let B=uJ($,Z.line,2);if(B)_.push(`
2532
+ ${Z.message}`),$&&Z.line){let B=i9($,Z.line,2);if(B)_.push(`
2525
2533
 
2526
2534
  \x1B[90mContext:\x1B[0m
2527
2535
  ${B}`)}if(Z.suggestion)_.push(`
2528
2536
 
2529
2537
  \x1B[33mSuggestion:\x1B[0m ${Z.suggestion}`);return _.push(`
2530
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),_.join("")}function mJ(Z,$,Y){let J=Z.split(`
2538
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),_.join("")}function l9(Z,$,Y){let J=Z.split(`
2531
2539
  `),G=Math.max(0,$-Y-1),X=Math.min(J.length-1,$+Y-1),Q=[];for(let K=G;K<=X;K++){let q=(K+1).toString().padStart(4),_=K===$-1?">":" ";Q.push(`${_}${q} | ${J[K]}`)}return Q.join(`
2532
- `)}function uJ(Z,$,Y){let J=Z.split(`
2540
+ `)}function i9(Z,$,Y){let J=Z.split(`
2533
2541
  `),G=Math.max(0,$-Y-1),X=Math.min(J.length-1,$+Y-1),Q="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let j=G;j<=X;j++){let B=(j+1).toString().padStart(4),W=j===$-1,U=W?"\x1B[31m>\x1B[0m":" ",z=W?`\x1B[31m${J[j]}\x1B[0m`:`\x1B[90m${J[j]}\x1B[0m`;_.push(`${U}\x1B[90m${B}\x1B[0m | ${z}`)}return _.join(`
2534
- `)}function H$(Z){return Z.replace(/--/g,"- -").replace(/>/g,"&gt;")}function pJ(Z,$){let J=Z.substring(0,$).split(`
2535
- `);return{line:J.length,column:J[J.length-1].length}}function g(Z,$,Y){return O$({type:Z,message:$,code:Y,format:"html"}).formatted}async function tZ(Z,$,Y){try{return await Z()}catch(J){if(Y&&J instanceof Error)Y(J);return $}}var L$=I(()=>{t4();Y5()});import O7 from"process";class F7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(Z={}){this.maxErrors=Z.maxErrors??1000,this.enableFileLogging=Z.enableFileLogging??!1,this.logFilePath=Z.logFilePath??".stx/errors.log",this.logFormat=Z.logFormat??"json",this.maxFileSize=Z.maxFileSize??10485760,this.maxLogFiles=Z.maxLogFiles??5,this.minLevel=Z.minLevel??"all"}configure(Z){if(Z.maxErrors!==void 0)this.maxErrors=Z.maxErrors;if(Z.enableFileLogging!==void 0)this.enableFileLogging=Z.enableFileLogging;if(Z.logFilePath!==void 0)this.logFilePath=Z.logFilePath;if(Z.logFormat!==void 0)this.logFormat=Z.logFormat;if(Z.maxFileSize!==void 0)this.maxFileSize=Z.maxFileSize;if(Z.maxLogFiles!==void 0)this.maxLogFiles=Z.maxLogFiles;if(Z.minLevel!==void 0)this.minLevel=Z.minLevel}log(Z,$,Y="error"){let J={timestamp:new Date,error:Z,context:$,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog(Z){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return Z==="error"||Z==="warning";if(this.minLevel==="error")return Z==="error";return!0}formatEntry(Z){if(this.logFormat==="json")return JSON.stringify({timestamp:Z.timestamp.toISOString(),level:Z.level||"error",type:Z.error.constructor.name,message:Z.error.message,stack:Z.error.stack,context:Z.context});let $=[`[${Z.timestamp.toISOString()}] [${(Z.level||"error").toUpperCase()}] ${Z.error.constructor.name}: ${Z.error.message}`];if(Z.error.stack)$.push(` Stack: ${Z.error.stack.split(`
2542
+ `)}function L$(Z){return Z.replace(/--/g,"- -").replace(/>/g,"&gt;")}function n9(Z,$){let J=Z.substring(0,$).split(`
2543
+ `);return{line:J.length,column:J[J.length-1].length}}function f(Z,$,Y){return F$({type:Z,message:$,code:Y,format:"html"}).formatted}async function tZ(Z,$,Y){try{return await Z()}catch(J){if(Y&&J instanceof Error)Y(J);return $}}var A$=I(()=>{e4();X5()});import L7 from"process";class A7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(Z={}){this.maxErrors=Z.maxErrors??1000,this.enableFileLogging=Z.enableFileLogging??!1,this.logFilePath=Z.logFilePath??".stx/errors.log",this.logFormat=Z.logFormat??"json",this.maxFileSize=Z.maxFileSize??10485760,this.maxLogFiles=Z.maxLogFiles??5,this.minLevel=Z.minLevel??"all"}configure(Z){if(Z.maxErrors!==void 0)this.maxErrors=Z.maxErrors;if(Z.enableFileLogging!==void 0)this.enableFileLogging=Z.enableFileLogging;if(Z.logFilePath!==void 0)this.logFilePath=Z.logFilePath;if(Z.logFormat!==void 0)this.logFormat=Z.logFormat;if(Z.maxFileSize!==void 0)this.maxFileSize=Z.maxFileSize;if(Z.maxLogFiles!==void 0)this.maxLogFiles=Z.maxLogFiles;if(Z.minLevel!==void 0)this.minLevel=Z.minLevel}log(Z,$,Y="error"){let J={timestamp:new Date,error:Z,context:$,level:Y};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(J)}shouldLog(Z){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return Z==="error"||Z==="warning";if(this.minLevel==="error")return Z==="error";return!0}formatEntry(Z){if(this.logFormat==="json")return JSON.stringify({timestamp:Z.timestamp.toISOString(),level:Z.level||"error",type:Z.error.constructor.name,message:Z.error.message,stack:Z.error.stack,context:Z.context});let $=[`[${Z.timestamp.toISOString()}] [${(Z.level||"error").toUpperCase()}] ${Z.error.constructor.name}: ${Z.error.message}`];if(Z.error.stack)$.push(` Stack: ${Z.error.stack.split(`
2536
2544
  `).slice(1).join(`
2537
2545
  `)}`);if(Z.context)$.push(` Context: ${JSON.stringify(Z.context)}`);return $.join(`
2538
2546
  `)}writeToFile(Z){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(J))$.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded($);let G=`${this.formatEntry(Z)}
2539
- `;$.appendFileSync(this.logFilePath,G,"utf-8")}catch($){if(O7.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(Z){try{if(!Z.existsSync(this.logFilePath))return;if(Z.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,G=`${this.logFilePath}.${Y+1}`;if(Z.existsSync(J))if(Y===this.maxLogFiles-1)Z.unlinkSync(J);else Z.renameSync(J,G)}Z.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(O7.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(Z=10){return this.errors.slice(-Z)}getErrorsByType(Z){return this.errors.filter(($)=>$.error.constructor.name===Z)}getErrorsByLevel(Z){return this.errors.filter(($)=>$.level===Z)}clear(){this.errors.length=0}async clearLogFile(){try{let Z=await import("fs");if(Z.existsSync(this.logFilePath))Z.writeFileSync(this.logFilePath,"","utf-8")}catch(Z){if(O7.env.STX_DEBUG==="true")console.error("Failed to clear error log:",Z)}}getStats(){let Z={},$={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;Z[J]=(Z[J]||0)+1;let G=Y.level||"error";$[G]=($[G]||0)+1}return{total:this.errors.length,byType:Z,byLevel:$}}async exportToFile(Z,$="json"){let Y=await import("fs"),G=(await import("path")).dirname(Z);if(!Y.existsSync(G))Y.mkdirSync(G,{recursive:!0});if($==="json"){let X=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Y.writeFileSync(Z,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((Q)=>this.formatEntry(Q));Y.writeFileSync(Z,X.join(`
2540
-
2541
- `),"utf-8")}}async flush(){await this.writeQueue}}var L7,eZ,A7;var F$=I(()=>{U7();Y5();L7={isEnabled(){return e4().enableAutoRecovery},fixCommonSyntaxErrors(Z){let $=e4();if(!$.enableAutoRecovery)return{fixed:Z,fixes:[]};let Y=Z,J=[],G=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(G>X){let K=G-X;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let K of Q){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let j=q-_;for(let B=0;B<j;B++)Y+=`
2542
- @end${K}`;J.push(`Added ${j} missing @end${K}`)}}if(J.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent(Z,$){if(H4())return`<!-- ${Z} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};eZ=new F7,A7={isDevelopment(){return H4()},logDetailedError(Z,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",Z.message),console.error("Stack:",Z.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(Z,$){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${Z.message}`,`Type: ${Z.constructor.name}`,`Stack: ${Z.stack}`];if($)Y.push(`Context: ${JSON.stringify($,null,2)}`);return Y.push("========================"),Y.join(`
2543
- `)}}});var A$=()=>{};var R$=I(()=>{t4();L$();F$();A$();Y5()});var EZ=I(()=>{R$()});function N$(Z,$,Y,J){let G=Z;return G=G.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Q,K)=>{if(!K&&Q.includes(":")){let q=Q.split(":"),_=Q,j=q.length>1?q[1]:"";if(j&&$[j])K=$[j];else if(_.startsWith("og:")&&$.openGraph&&$.openGraph[q[1]])K=$.openGraph[q[1]];else K="";return K?`<meta property="${_}" content="${x(K)}">`:""}return K?`<meta name="${Q}" content="${x(K)}">`:""}),G=G.replace(/@metaTag\(\s*(\{[^}]+\})\s*\)/g,(X,Q)=>{try{let K=OZ(Q,$);if(!K)return"";let q="<meta";if(K.name)q+=` name="${x(String(K.name))}"`;if(K.property)q+=` property="${x(String(K.property))}"`;if(K.httpEquiv)q+=` http-equiv="${x(String(K.httpEquiv))}"`;if(K.content)q+=` content="${x(String(K.content))}"`;return q+=">",q}catch(K){let q=K instanceof Error?K.message:String(K);return g("MetaTag",q,C.EVALUATION_ERROR)}}),G}function V$(Z,$,Y){let J=Z;return J=J.replace(/@structuredData\(\s*(\{[\s\S]*?\})\s*\)/g,(G,X)=>{try{let Q=OZ(X,$);if(!Q)return"";if(!Q["@context"])Q["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let K=Q instanceof Error?Q.message:String(Q);return g("StructuredData",K,C.EVALUATION_ERROR)}}),J}function M$(Z,$,Y,J){let G=Z;return G=G.replace(/@seo\(\s*(\{[\s\S]*?\})\s*\)/g,(X,Q)=>{try{let K=OZ(Q,$);if(!K)return"";let q="";if(K.title)q+=`<title>${x(K.title)}</title>
2544
- `,q+=`<meta name="title" content="${x(K.title)}">
2545
- `;if(K.description)q+=`<meta name="description" content="${x(K.description)}">
2546
- `;if(K.keywords){let _=Array.isArray(K.keywords)?K.keywords.join(", "):K.keywords;q+=`<meta name="keywords" content="${x(_)}">
2547
- `}if(K.robots)q+=`<meta name="robots" content="${x(K.robots)}">
2548
- `;if(K.canonical)q+=`<link rel="canonical" href="${x(K.canonical)}">
2549
- `;if(K.openGraph){let _=K.openGraph;if(q+=`<meta property="og:type" content="${x(_.type||"website")}">
2550
- `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta property="og:title" content="${x(j)}">
2551
- `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta property="og:description" content="${x(j)}">
2552
- `}if(_.url||K.canonical){let j=_.url||K.canonical||"";q+=`<meta property="og:url" content="${x(j)}">
2553
- `}if(_.image){if(q+=`<meta property="og:image" content="${x(_.image)}">
2554
- `,_.imageAlt)q+=`<meta property="og:image:alt" content="${x(_.imageAlt)}">
2547
+ `;$.appendFileSync(this.logFilePath,G,"utf-8")}catch($){if(L7.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(Z){try{if(!Z.existsSync(this.logFilePath))return;if(Z.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,G=`${this.logFilePath}.${Y+1}`;if(Z.existsSync(J))if(Y===this.maxLogFiles-1)Z.unlinkSync(J);else Z.renameSync(J,G)}Z.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(L7.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(Z=10){return this.errors.slice(-Z)}getErrorsByType(Z){return this.errors.filter(($)=>$.error.constructor.name===Z)}getErrorsByLevel(Z){return this.errors.filter(($)=>$.level===Z)}clear(){this.errors.length=0}async clearLogFile(){try{let Z=await import("fs");if(Z.existsSync(this.logFilePath))Z.writeFileSync(this.logFilePath,"","utf-8")}catch(Z){if(L7.env.STX_DEBUG==="true")console.error("Failed to clear error log:",Z)}}getStats(){let Z={},$={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;Z[J]=(Z[J]||0)+1;let G=Y.level||"error";$[G]=($[G]||0)+1}return{total:this.errors.length,byType:Z,byLevel:$}}async exportToFile(Z,$="json"){let Y=await import("fs"),G=(await import("path")).dirname(Z);if(!Y.existsSync(G))Y.mkdirSync(G,{recursive:!0});if($==="json"){let X=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Y.writeFileSync(Z,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((Q)=>this.formatEntry(Q));Y.writeFileSync(Z,X.join(`
2548
+
2549
+ `),"utf-8")}}async flush(){await this.writeQueue}}var F7,eZ,N7;var N$=I(()=>{H7();X5();F7={isEnabled(){return Z5().enableAutoRecovery},fixCommonSyntaxErrors(Z){let $=Z5();if(!$.enableAutoRecovery)return{fixed:Z,fixes:[]};let Y=Z,J=[],G=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(G>X){let K=G-X;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let K of Q){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let j=q-_;for(let B=0;B<j;B++)Y+=`
2550
+ @end${K}`;J.push(`Added ${j} missing @end${K}`)}}if(J.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent(Z,$){if(H4())return`<!-- ${Z} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};eZ=new A7,N7={isDevelopment(){return H4()},logDetailedError(Z,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",Z.message),console.error("Stack:",Z.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(Z,$){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${Z.message}`,`Type: ${Z.constructor.name}`,`Stack: ${Z.stack}`];if($)Y.push(`Context: ${JSON.stringify($,null,2)}`);return Y.push("========================"),Y.join(`
2551
+ `)}}});var R$=()=>{};var V$=I(()=>{e4();A$();N$();R$();X5()});var kZ=I(()=>{V$()});function M$(Z,$,Y,J){let G=Z;return G=G.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Q,K)=>{if(!K&&Q.includes(":")){let q=Q.split(":"),_=Q,j=q.length>1?q[1]:"";if(j&&$[j])K=$[j];else if(_.startsWith("og:")&&$.openGraph&&$.openGraph[q[1]])K=$.openGraph[q[1]];else K="";return K?`<meta property="${_}" content="${y(K)}">`:""}return K?`<meta name="${Q}" content="${y(K)}">`:""}),G=G.replace(/@metaTag\(\s*(\{[^}]+\})\s*\)/g,(X,Q)=>{try{let K=FZ(Q,$);if(!K)return"";let q="<meta";if(K.name)q+=` name="${y(String(K.name))}"`;if(K.property)q+=` property="${y(String(K.property))}"`;if(K.httpEquiv)q+=` http-equiv="${y(String(K.httpEquiv))}"`;if(K.content)q+=` content="${y(String(K.content))}"`;return q+=">",q}catch(K){let q=K instanceof Error?K.message:String(K);return f("MetaTag",q,P.EVALUATION_ERROR)}}),G}function w$(Z,$,Y){let J=Z;return J=J.replace(/@structuredData\(\s*(\{[\s\S]*?\})\s*\)/g,(G,X)=>{try{let Q=FZ(X,$);if(!Q)return"";if(!Q["@context"])Q["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let K=Q instanceof Error?Q.message:String(Q);return f("StructuredData",K,P.EVALUATION_ERROR)}}),J}function T$(Z,$,Y,J){let G=Z;return G=G.replace(/@seo\(\s*(\{[\s\S]*?\})\s*\)/g,(X,Q)=>{try{let K=FZ(Q,$);if(!K)return"";let q="";if(K.title)q+=`<title>${y(K.title)}</title>
2552
+ `,q+=`<meta name="title" content="${y(K.title)}">
2553
+ `;if(K.description)q+=`<meta name="description" content="${y(K.description)}">
2554
+ `;if(K.keywords){let _=Array.isArray(K.keywords)?K.keywords.join(", "):K.keywords;q+=`<meta name="keywords" content="${y(_)}">
2555
+ `}if(K.robots)q+=`<meta name="robots" content="${y(K.robots)}">
2556
+ `;if(K.canonical)q+=`<link rel="canonical" href="${y(K.canonical)}">
2557
+ `;if(K.openGraph){let _=K.openGraph;if(q+=`<meta property="og:type" content="${y(_.type||"website")}">
2558
+ `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta property="og:title" content="${y(j)}">
2559
+ `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta property="og:description" content="${y(j)}">
2560
+ `}if(_.url||K.canonical){let j=_.url||K.canonical||"";q+=`<meta property="og:url" content="${y(j)}">
2561
+ `}if(_.image){if(q+=`<meta property="og:image" content="${y(_.image)}">
2562
+ `,_.imageAlt)q+=`<meta property="og:image:alt" content="${y(_.imageAlt)}">
2555
2563
  `;if(_.imageWidth)q+=`<meta property="og:image:width" content="${_.imageWidth}">
2556
2564
  `;if(_.imageHeight)q+=`<meta property="og:image:height" content="${_.imageHeight}">
2557
- `}if(_.siteName)q+=`<meta property="og:site_name" content="${x(_.siteName)}">
2558
- `}if(K.twitter){let _=K.twitter;if(q+=`<meta name="twitter:card" content="${x(_.card||"summary_large_image")}">
2559
- `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta name="twitter:title" content="${x(j)}">
2560
- `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta name="twitter:description" content="${x(j)}">
2561
- `}if(_.image||K.openGraph&&K.openGraph.image){let j=_.image||(K.openGraph?K.openGraph.image:"")||"";q+=`<meta name="twitter:image" content="${x(j)}">
2562
- `}if(_.site)q+=`<meta name="twitter:site" content="${x(_.site)}">
2563
- `;if(_.creator)q+=`<meta name="twitter:creator" content="${x(_.creator)}">
2565
+ `}if(_.siteName)q+=`<meta property="og:site_name" content="${y(_.siteName)}">
2566
+ `}if(K.twitter){let _=K.twitter;if(q+=`<meta name="twitter:card" content="${y(_.card||"summary_large_image")}">
2567
+ `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta name="twitter:title" content="${y(j)}">
2568
+ `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta name="twitter:description" content="${y(j)}">
2569
+ `}if(_.image||K.openGraph&&K.openGraph.image){let j=_.image||(K.openGraph?K.openGraph.image:"")||"";q+=`<meta name="twitter:image" content="${y(j)}">
2570
+ `}if(_.site)q+=`<meta name="twitter:site" content="${y(_.site)}">
2571
+ `;if(_.creator)q+=`<meta name="twitter:creator" content="${y(_.creator)}">
2564
2572
  `}if(K.structuredData)q+=`<script type="application/ld+json">${JSON.stringify(K.structuredData)}</script>
2565
- `;return q.trim()}catch(K){let q=K instanceof Error?K.message:String(K);return g("SEO",`Error processing @seo directive: ${q}`,C.EVALUATION_ERROR)}}),G}function w$(Z,$,Y){if(Y.seo?.enabled===!1)return Z;if(Z.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return Z;if(!Z.includes("<head>")&&!Z.includes("<head "))return Z;let J=Z.includes("<title>")||Z.includes("</title>"),G="";if($.title)G=$.title;else if($.meta&&$.meta.title)G=$.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let X="";if($.description)X=$.description;else if($.meta&&$.meta.description)X=$.meta.description;else if(Y.seo?.defaultConfig?.description)X=Y.seo.defaultConfig.description;else X=Y.defaultDescription||"A website built with stx templating engine";let Q="";if($.image)Q=$.image;else if($.meta&&$.meta.image)Q=$.meta.image;else if($.openGraph&&$.openGraph.image)Q=$.openGraph.image;else if(Y.seo?.defaultImage)Q=Y.seo.defaultImage;else if(Y.defaultImage)Q=Y.defaultImage;let K=`
2573
+ `;return q.trim()}catch(K){let q=K instanceof Error?K.message:String(K);return f("SEO",`Error processing @seo directive: ${q}`,P.EVALUATION_ERROR)}}),G}function I$(Z,$,Y){if(Y.seo?.enabled===!1)return Z;if(Z.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return Z;if(!Z.includes("<head>")&&!Z.includes("<head "))return Z;let J=Z.includes("<title>")||Z.includes("</title>"),G="";if($.title)G=$.title;else if($.meta&&$.meta.title)G=$.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let X="";if($.description)X=$.description;else if($.meta&&$.meta.description)X=$.meta.description;else if(Y.seo?.defaultConfig?.description)X=Y.seo.defaultConfig.description;else X=Y.defaultDescription||"A website built with stx templating engine";let Q="";if($.image)Q=$.image;else if($.meta&&$.meta.image)Q=$.meta.image;else if($.openGraph&&$.openGraph.image)Q=$.openGraph.image;else if(Y.seo?.defaultImage)Q=Y.seo.defaultImage;else if(Y.defaultImage)Q=Y.defaultImage;let K=`
2566
2574
  <!-- stx SEO Tags -->
2567
- <meta name="title" content="${x(G)}">
2568
- <meta name="description" content="${x(X)}">
2569
- <meta property="og:title" content="${x(G)}">
2570
- <meta property="og:description" content="${x(X)}">
2575
+ <meta name="title" content="${y(G)}">
2576
+ <meta name="description" content="${y(X)}">
2577
+ <meta property="og:title" content="${y(G)}">
2578
+ <meta property="og:description" content="${y(X)}">
2571
2579
  <meta property="og:type" content="website">
2572
2580
  <meta name="twitter:card" content="summary_large_image">
2573
- <meta name="twitter:title" content="${x(G)}">
2574
- <meta name="twitter:description" content="${x(X)}">
2581
+ <meta name="twitter:title" content="${y(G)}">
2582
+ <meta name="twitter:description" content="${y(X)}">
2575
2583
  `;if(Q)K+=`
2576
- <meta property="og:image" content="${x(Q)}">
2577
- <meta name="twitter:image" content="${x(Q)}">
2584
+ <meta property="og:image" content="${y(Q)}">
2585
+ <meta name="twitter:image" content="${y(Q)}">
2578
2586
  `;let q=Z;if(!J)q=q.replace(/<head[^>]*>/,`$&
2579
- <title>${x(G)}</title>`);return q.replace(/<head[^>]*>/,`$&
2587
+ <title>${y(G)}</title>`);return q.replace(/<head[^>]*>/,`$&
2580
2588
  ${K}
2581
- `)}function x(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var T$,I$;var R7=I(()=>{EZ();LZ();T$={name:"meta",handler:(Z,$,Y,J)=>{if($.length<1)return g("Meta","meta directive requires at least the meta name",C.INVALID_DIRECTIVE_SYNTAX);let G=$[0].replace(/['"]/g,""),X=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${x(G)}" content="${x(X)}">`},hasEndTag:!1},I$={name:"structuredData",handler:(Z,$,Y,J)=>{if(Z.trim()==="")return g("StructuredData","structuredData directive requires JSON-LD content",C.INVALID_DIRECTIVE_SYNTAX);try{let G=JSON.parse(Z);if(!G["@context"])G["@context"]="https://schema.org";if(!G["@type"])return g("StructuredData","structuredData requires @type property",C.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(G)}</script>`}catch(G){let X=G instanceof Error?G.message:String(G);return g("StructuredData",X,C.EVALUATION_ERROR)}},hasEndTag:!0}});import L4 from"path";import cJ from"process";function lJ(Z,$){let Y=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",G=$,X=[],Q=!0;if(J){let B=J.match(/export\s+default\s+({[\s\S]*})/);if(B)try{let W=B[1],U=W.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(U)G=U[1];let z=W.match(/props\s*:\s*\[([\s\S]*?)\]/);if(z)X=z[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=W.match(/shadowDOM\s*:\s*(true|false)/);if(H)Q=H[1]==="true"}catch{}}let K=Z.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=Z.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),j=_?_[1].trim():"";return{tag:G,props:X,template:q,styles:j,script:J,shadowDOM:Q}}function iJ(Z){let{tag:$,props:Y,template:J,styles:G,shadowDOM:X}=Z,Q=$.split("-").map((B)=>B.charAt(0).toUpperCase()+B.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=G.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Y.map((B)=>`'${B}'`).join(", "),j=Y.map((B)=>`
2589
+ `)}function y(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var D$,E$;var R7=I(()=>{kZ();AZ();D$={name:"meta",handler:(Z,$,Y,J)=>{if($.length<1)return f("Meta","meta directive requires at least the meta name",P.INVALID_DIRECTIVE_SYNTAX);let G=$[0].replace(/['"]/g,""),X=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${y(G)}" content="${y(X)}">`},hasEndTag:!1},E$={name:"structuredData",handler:(Z,$,Y,J)=>{if(Z.trim()==="")return f("StructuredData","structuredData directive requires JSON-LD content",P.INVALID_DIRECTIVE_SYNTAX);try{let G=JSON.parse(Z);if(!G["@context"])G["@context"]="https://schema.org";if(!G["@type"])return f("StructuredData","structuredData requires @type property",P.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(G)}</script>`}catch(G){let X=G instanceof Error?G.message:String(G);return f("StructuredData",X,P.EVALUATION_ERROR)}},hasEndTag:!0}});import O4 from"path";import s9 from"process";function o9(Z,$){let Y=Z.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",G=$,X=[],Q=!0;if(J){let B=J.match(/export\s+default\s+({[\s\S]*})/);if(B)try{let W=B[1],U=W.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(U)G=U[1];let z=W.match(/props\s*:\s*\[([\s\S]*?)\]/);if(z)X=z[1].split(",").map((F)=>F.trim().replace(/['"`]/g,"")).filter((F)=>F.length>0);let H=W.match(/shadowDOM\s*:\s*(true|false)/);if(H)Q=H[1]==="true"}catch{}}let K=Z.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=Z.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),j=_?_[1].trim():"";return{tag:G,props:X,template:q,styles:j,script:J,shadowDOM:Q}}function r9(Z){let{tag:$,props:Y,template:J,styles:G,shadowDOM:X}=Z,Q=$.split("-").map((B)=>B.charAt(0).toUpperCase()+B.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=G.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Y.map((B)=>`'${B}'`).join(", "),j=Y.map((B)=>`
2582
2590
  get ${B}() {
2583
2591
  return this.getAttribute('${B}') || '';
2584
2592
  }
@@ -2628,17 +2636,17 @@ ${j}
2628
2636
  }
2629
2637
 
2630
2638
  customElements.define('${$}', ${Q});
2631
- `}async function D$(Z,$,Y,J){if($.length<1)return g("WebComponent","@webcomponent directive requires at least the tag name parameter",C.INVALID_DIRECTIVE_SYNTAX);let G=$[0].replace(/['"]/g,""),Q=(Y.__stx_options||{}).componentsDir||"components",K=[L4.join(L4.dirname(J),Q,`${G}.stx`),L4.join(cJ.cwd(),Q,`${G}.stx`),L4.join(L4.dirname(J),`${G}.stx`)],q=null;for(let B of K)if(await p(B)){q=await Bun.file(B).text();break}if(!q)return g("WebComponent",`Component file not found: ${G}.stx`,C.FILE_NOT_FOUND);let _=lJ(q,G);return`<script type="module">
2632
- ${iJ(_)}
2633
- </script>`}var E$=I(()=>{EZ();MZ()});import{loadConfigWithResult as nJ}from"bunfig";async function J5(){if(fZ)return fZ;if(F4)return F4;return F4=(async()=>{return fZ=(await nJ({name:"stx",cwd:process.cwd(),defaultConfig:k$,verbose:!1})).config,fZ})(),F4}var k$,fZ=null,F4=null,S$;var N7=I(()=>{F5();N5();w5();R5();x5();m6();W7();z$();R7();E$();k$={enabled:!0,partialsDir:"partials",componentsDir:"components",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:z6,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:D$,hasEndTag:!1,description:"Include a web component in the template"},X0,G0,T$,I$,L0,A0,R0,F0,g0,O0,d6,B7,...W$],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}}};S$=new Proxy(k$,{get(Z,$){if(fZ&&$ in fZ)return fZ[$];if(!F4)J5().catch(()=>{});return Z[$]}})});import sJ from"fs";import V7 from"path";import{createHighlighter as oJ}from"ts-syntax-highlighter";async function rJ(Z,$={}){try{if(!await p(Z))throw Error(`Markdown file not found: ${Z}`);let J=(await sJ.promises.stat(Z)).mtime.getTime();if($.cache&&M7.has(Z)){let B=M7.get(Z);if(B.updatedAt>=J)return{content:B.content,data:B.data}}let G=await Bun.file(Z).text(),{data:X,content:Q}=h0(G),K=$.markdown||S$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=_4(Q,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await aJ(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let j={content:_,data:X||{}};if($.cache)M7.set(Z,{...j,updatedAt:J});return j}catch(Y){if($.debug)console.error(`Error reading/parsing markdown file ${Z}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:l("Markdown File",`Error reading/parsing markdown file: ${J}`,Z,"",0,""),data:{}}}}async function aJ(Z,$,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!X5)try{X5=await oJ({theme:$||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),Z}let G=async(K,q,_,j)=>{let B=j.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),W=_||(Y?"text":"");if(!W)return K;try{if(!X5.getSupportedLanguages().includes(W))return K;return(await X5.highlight(B,W,{theme:$})).html}catch(U){console.error(`Error highlighting code block with language ${_}:`,U)}return K},X=Z,Q=Z.matchAll(J);for(let K of Q){let[q,_,j,B]=K,W=await G(q,_,j,B);X=X.replace(q,W)}return X}async function b$(Z,$,Y="",J={}){return await tJ(Z,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,K,q,_)=>{try{let j=K;if(!V7.isAbsolute(K))j=V7.resolve(V7.dirname(Y),K);let B={};if(q)try{try{B=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let A of O){let M=A.indexOf(":");if(M>0){let V=A.substring(0,M).trim(),R=A.substring(M+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),w=R.startsWith("'")&&R.endsWith("'");if(N||w)R=R.substring(1,R.length-1);B[V]=R}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:W,data:U}=await rJ(j,J),z={...$,...U,...B},H=W,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let A=O.trim();return z[A]!==void 0?String(z[A]):F}),H}catch(j){let B=j instanceof Error?j.message:String(j);return l("Markdown File",`Error including markdown file: ${B}`,Y,Z,_,Q)}})}async function tJ(Z,$,Y){let J=[],G;while((G=$.exec(Z))!==null){let K=G[0],q=G.index,_=G;J.push(Y(..._).then((j)=>({match:K,replacement:j,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let Q=Z;for(let{match:K,replacement:q}of X)Q=Q.replace(K,q);return Q}var M7,X5=null;var P$=I(()=>{N7();MZ();M7=new Map});function AZ(Z,$){try{let Y=Z.trim();if($Z(Y))return WZ(Y,Object.keys($))(...Object.values($));else return i(Y,$)}catch{return!1}}var C$=I(()=>{LZ()});function A4(Z,$){let Y=$;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Z[Y]!=="(")return null;let J=zZ(Z,"(",")",Y);if(J===-1)return null;return{expression:Z.slice(Y+1,J),endPos:J+1}}function G5(Z,$,Y,J){let G=1,X=J,Q=new RegExp(`@${$}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<Z.length&&G>0){Q.lastIndex=X,K.lastIndex=X;let q=Q.exec(Z),_=K.exec(Z),j=q?q.index:1/0,B=_?_.index:1/0;if(j<B)G++,X=j+q[0].length;else if(B<1/0){if(G--,G===0)return B;X=B+_[0].length}else break}return-1}function y$(Z,$){let Y=Z.slice($).match(/^@if\s*/);if(!Y)return null;let J=$+Y[0].length,G=A4(Z,J);if(!G)return null;let X=G.endPos,Q=G5(Z,"if","endif",X);if(Q===-1)return null;let K=Z.slice(X,Q),q=[],_=0,j="if",B=G.expression,W=0;while(_<K.length){let U=K.slice(_).match(/^@elseif\s*/),z=K.slice(_).match(/^@else(?![a-z])/);if(U&&K.slice(_).startsWith("@elseif")){q.push({type:j,condition:B,content:K.slice(W,_),start:X+W,end:X+_});let H=_+U[0].length,L=A4(K,H);if(!L){_++;continue}j="elseif",B=L.expression,_=L.endPos,W=_}else if(z&&K.slice(_).startsWith("@else"))q.push({type:j,condition:B,content:K.slice(W,_),start:X+W,end:X+_}),j="else",B=void 0,_+=z[0].length,W=_;else _++}return q.push({type:j,condition:B,content:K.slice(W),start:X+W,end:X+K.length}),{fullMatch:Z.slice($,Q+6),branches:q,start:$,end:Q+6}}function w7(Z){let $=[],Y=/@if\s*\(/g,J=Y.exec(Z);while(J!==null){if($.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Y.exec(Z);continue}let X=y$(Z,J.index);if(X)$.push(X),Y.lastIndex=X.end;J=Y.exec(Z)}return $}function Q5(Z,$,Y){let J=[],G=new RegExp(`@${$}\\s*\\(`,"g"),X=G.exec(Z);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=G.exec(Z);continue}let K=X.index,q=K+X[0].length-1,_=zZ(Z,"(",")",q);if(_===-1){X=G.exec(Z);continue}let j=Z.slice(q+1,_),B=_+1,W=G5(Z,$,Y,B);if(W===-1){X=G.exec(Z);continue}let U=Z.slice(B,W),z=W+`@${Y}`.length;J.push({fullMatch:Z.slice(K,z),name:$,params:j,content:U,start:K,end:z}),G.lastIndex=z,X=G.exec(Z)}return J}function T7(Z,$){let Y=Z.slice($).match(/^@switch\s*/);if(!Y)return null;let J=$+Y[0].length,G=A4(Z,J);if(!G)return null;let X=G.endPos,Q=G5(Z,"switch","endswitch",X);if(Q===-1)return null;let K=Z.slice(X,Q),q=[],_=0,j=null;while(_<K.length){let B=K.slice(_).match(/^@case\s*/),W=K.slice(_).match(/^@default(?![a-z])/),U=K.slice(_).match(/^@break(?![a-z])/);if(B&&K.slice(_).startsWith("@case")){if(j)q.push(j);let z=_+B[0].length,H=A4(K,z);if(!H){_++;continue}j={type:"case",value:H.expression,content:""},_=H.endPos}else if(W&&K.slice(_).startsWith("@default")){if(j)q.push(j);j={type:"default",content:""},_+=W[0].length}else if(U&&K.slice(_).startsWith("@break"))_+=U[0].length;else{if(j)j.content+=K[_];_++}}if(j)q.push(j);return{fullMatch:Z.slice($,Q+10),expression:G.expression,cases:q,start:$,end:Q+10}}var x$=()=>{};var v$=()=>{};var I7=I(()=>{x$();v$()});import r from"process";function Y9(Z,$,Y){let J=Z,G=!0;while(G){G=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=T7(J,Q);if(!K)break;try{let q;if($Z(K.expression))q=WZ(K.expression,Object.keys($))(...Object.values($));else q=i(K.expression,$);let _="",j=!1;for(let B of K.cases)if(B.type==="default"){if(!j)_=B.content.replace(/@break/g,"").trim()}else try{let W;if(B.value&&$Z(B.value))W=WZ(B.value,Object.keys($))(...Object.values($));else if(B.value)W=i(B.value,$);if(q===W){_=B.content.replace(/@break/g,"").trim(),j=!0;break}}catch{continue}J=J.substring(0,Q)+_+J.substring(K.end),G=!0}catch(q){let _=q instanceof Error?q.message:String(q),j=g("Switch",`Error evaluating @switch expression: ${_}`,C.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(K.end);break}}return J}function Z4(Z,$,Y){let J=Z;J=Y9(J,$,Y),J=J.replace(/@unless\s*\(([^)]+)\)([\s\S]*?)@endunless/g,(X,Q,K)=>{let q=K.match(/^([\s\S]*?)@else([\s\S]*)$/);if(q){let _=q[1],j=q[2];return`@if (${Q})${j}@else${_}@endif`}else return`@if (!(${Q}))${K}@endif`}),J=E7(J,$,Y),J=k7(J,$,Y),J=D7(J,$);let G=()=>{let X=w7(J);if(X.length===0)return!1;for(let Q=X.length-1;Q>=0;Q--){let K=X[Q];try{let q="",_=!1;for(let j of K.branches){if(_)break;if(j.type==="else")q=j.content,_=!0;else try{let B;if(j.condition&&$Z(j.condition))B=WZ(j.condition,Object.keys($))(...Object.values($));else if(j.condition)B=i(j.condition,$);if(B)q=j.content,_=!0}catch(B){q=g(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,C.EVALUATION_ERROR),_=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),j=g("If",`Error processing @if block: ${_}`,C.EVALUATION_ERROR);J=J.substring(0,K.start)+j+J.substring(K.end)}}return!0};while(G());return J}function D7(Z,$){let Y=Z;return Y=Y.replace(/@auth\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endauth/g,(J,G,X,Q)=>{return(G?AZ(`auth?.check && auth?.user?.[${G}]`,$):AZ("auth?.check",$))?X:Q||""}),Y=Y.replace(/@guest\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endguest/g,(J,G,X,Q)=>{return(G?AZ(`!auth?.check || !auth?.user?.[${G}]`,$):AZ("!auth?.check",$))?X:Q||""}),Y=Y.replace(/@can\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecan\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcan/g,(J,G,X,Q,K,q,_,j,B,W)=>{let U=!1;if($.userCan&&typeof $.userCan[G]==="boolean")U=$.userCan[G];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let z=[G];if(X)z.push(X);if(Q){let H=AZ(Q,$);z.push(H)}U=$.permissions.check(...z)}catch{U=!1}if(U)return K;else if(q){let z=!1;if($.userCan&&typeof $.userCan[q]==="boolean")z=$.userCan[q];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let L=AZ(j,$);H.push(L)}z=$.permissions.check(...H)}catch{z=!1}return z?B:W||""}else return W||""}),Y=Y.replace(/@cannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcannot/g,(J,G,X,Q,K,q,_,j,B,W)=>{let U=!0;if($.userCan&&typeof $.userCan[G]==="boolean")U=!$.userCan[G];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let z=[G];if(X)z.push(X);if(Q){let H=AZ(Q,$);z.push(H)}U=!$.permissions.check(...z)}catch{U=!0}if(U)return K;else if(q){let z=!0;if($.userCan&&typeof $.userCan[q]==="boolean")z=!$.userCan[q];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let L=AZ(j,$);H.push(L)}z=!$.permissions.check(...H)}catch{z=!0}return z?B:W||""}else return W||""}),Y}function E7(Z,$,Y){let J=Z;return J=J.replace(/@isset\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endisset/g,(G,X,Q,K,q)=>{try{let _=AZ(X.trim(),$);if(_!==void 0&&_!==null)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return g("Isset",`Error processing @isset directive: ${j}`,C.EVALUATION_ERROR)}}),J=J.replace(/@empty\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endempty/g,(G,X,Q,K,q)=>{try{let _=AZ(X.trim(),$);if(_===void 0||_===null||_===""||Array.isArray(_)&&_.length===0||typeof _==="object"&&_!==null&&Object.keys(_).length===0)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return g("Empty",`Error processing @empty directive: ${j}`,C.EVALUATION_ERROR)}}),J}function k7(Z,$,Y){let J=Z;return J=J.replace(/@env\s*\(\s*(['"])([^'"]+)\1\s*\)([\s\S]*?)(?:@else([\s\S]*?))?@endenv/g,(G,X,Q,K,q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")===Q?K:q}),J=J.replace(/@production([\s\S]*?)(?:@else([\s\S]*?))?@endproduction/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="production"?X:Q}),J=J.replace(/@development([\s\S]*?)(?:@else([\s\S]*?))?@enddevelopment/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="development"?X:Q}),J=J.replace(/@staging([\s\S]*?)(?:@else([\s\S]*?))?@endstaging/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="staging"?X:Q}),J=J.replace(/@testing([\s\S]*?)(?:@else([\s\S]*?))?@endtesting/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="testing"?X:Q}),J}var K5=I(()=>{C$();EZ();I7();LZ()});function g$(Z=16){let $=new Uint8Array(Z);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function q5(Z,$){if(!Z)return $?.nonceGenerator?.()??g$();let Y=f$.get(Z);if(!Y)Y=$?.nonceGenerator?.()??g$(),f$.set(Z,Y);return Y}function J9(Z,$){let Y=[];for(let[J,G]of Object.entries(Z)){if(G===void 0||G===null)continue;if(typeof G==="boolean"){if(G)Y.push(J);continue}if(Array.isArray(G)){let X=[...G];if($&&(J==="script-src"||J==="style-src"))X=X.filter((Q)=>!Q.startsWith("'nonce-")),X.push(`'nonce-${$}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function h$(Z,$){return`<meta http-equiv="Content-Security-Policy" content="${J9(Z,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function d$(Z,$,Y){if(!$.enabled||!$.addMetaTag)return Z;if(Z.includes('http-equiv="Content-Security-Policy"'))return Z;if(!Z.includes("<head>")&&!Z.includes("<head "))return Z;let J=$.useNonce?q5(Y,$):void 0,G=h$($.directives,J);return Z.replace(/<head([^>]*)>/,`<head$1>
2634
- ${G}`)}function m$(Z,$,Y,J){let G=Z,X=J.csp;if(G=G.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let Q=X.useNonce?q5($,X):void 0;return h$(X.directives,Q)}),G=G.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return q5($,X)}),X?.enabled&&X.useNonce)$.cspNonce=q5($,X);return G}var f$;var u$=I(()=>{f$=new WeakMap});import X9 from"crypto";function Q9(Z=G9){let $=X9.randomBytes(Math.ceil(Z/2)).toString("hex").slice(0,Z);return S7=$,$}function K9(){if(!S7)Q9();return S7}function q9(Z=p$){let $=K9();return`<input type="hidden" name="${Z}" value="${$}">`}function c$(Z){return Z.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Y,J)=>{return q9(J||p$)})}var G9=40,p$="_token",S7=null;var l$=()=>{};async function i$(Z,$,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return Z;let G=Z;for(let X of J.customDirectives){if(!X.name||typeof X.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)G=await _9(G,X,$,Y,J);else G=await j9(G,X,$,Y,J)}return G}async function _9(Z,$,Y,J,G){let{name:X,handler:Q}=$,K=`@${X}`,q=`@end${X}`,_=Z,j=B4(`${K}(?:\\s*\\(([^)]+)\\))?([\\s\\S]*?)${q}`,"g"),B=[],W=j.exec(_);while(W!==null){let[U,z="",H=""]=W,L=W.index||0;try{let F=z?n$(z):[],O=H.trim(),A=await Q(O,F,Y,J);B.push({original:U,processed:A,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(G.debug)console.error(`Error processing custom directive @${X}:`,F);B.push({original:U,processed:g("CustomDirective",`Error in @${X}${z?`(${z})`:""}: ${O}`,C.EVALUATION_ERROR),startIndex:L})}W=j.exec(_)}for(let U=B.length-1;U>=0;U--){let{original:z,processed:H}=B[U];_=_.replace(z,H)}return _}async function j9(Z,$,Y,J,G){let{name:X,handler:Q}=$,K=Z,q=B4(`@${X}\\s*\\(([^)]+)\\)`,"g"),_=[],j=q.exec(K);while(j!==null){let[B,W=""]=j,U=j.index||0;try{let z=n$(W),H=await Q("",z,Y,J);_.push({original:B,processed:H,startIndex:U})}catch(z){let H=z instanceof Error?z.message:String(z);if(G.debug)console.error(`Error processing custom directive @${X}:`,z);_.push({original:B,processed:g("CustomDirective",`Error in @${X}(${W}): ${H}`,C.EVALUATION_ERROR),startIndex:U})}j=q.exec(K)}for(let B=_.length-1;B>=0;B--){let{original:W,processed:U}=_[B];K=K.replace(W,U)}return K}function n$(Z){if(!Z.trim())return[];let $=[],Y="",J=!1,G="";for(let X=0;X<Z.length;X++){let Q=Z[X];if((Q==='"'||Q==="'")&&(X===0||Z[X-1]!=="\\"))if(!J)J=!0,G=Q;else if(Q===G)J=!1;else Y+=Q;else if(Q===","&&!J)$.push(Y.trim()),Y="";else Y+=Q}if(Y.trim())$.push(Y.trim());return $.map((X)=>{let Q=X.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var s$=I(()=>{EZ();lZ()});import B9 from"crypto";function z9(){return B9.randomUUID()}function r$(Z,$){let Y=Z;return Y=Y.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let J=z9();$.csrf={token:J}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${$.csrf.token}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,G)=>{if(G&&["PUT","PATCH","DELETE"].includes(G.toUpperCase()))return`<input type="hidden" name="_method" value="${G.toUpperCase()}">`;return J}),Y}function a$(Z,$,Y=W9){return Z.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,G,X)=>{try{if(U9(G,$))return X.replace(/\{\{([^}]+)\}\}/g,(Q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return o$(G,$);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(G);return o$(G,$)}let q=K.trim();if($Z(q)){let _=i(q,$);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function U9(Z,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(Z);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,Z);return!1}function o$(Z,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(Z);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,Z)){let Y=$.errors[Z];return Array.isArray(Y)?Y[0]:String(Y)}return""}var W9;var t$=I(()=>{LZ();W9={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import e$ from"path";function H9(Z,$=0){if($<=0)return!1;return Date.now()-Z.loadedAt>$}async function O9(Z,$){if({...y7,...$.i18n}.cache&&C7[Z]){let G=C7[Z],X=$.i18n?.cacheMaxAge??0;if(!H9(G,X))return G.translations}if(R4[Z]?.state==="loading")return R4[Z].promise;b7[Z]="loading";let J=Y8(Z,$).then((G)=>{return b7[Z]="loaded",delete R4[Z],G}).catch((G)=>{throw b7[Z]="error",R4[Z]={promise:J,state:"error",error:G instanceof Error?G:Error(String(G))},G});return R4[Z]={promise:J,state:"loading"},J}async function Y8(Z,$){let Y={...y7,...$.i18n},J=e$.resolve(import.meta.dir,"..",Y.translationsDir),G=R9(Y.format),X=e$.join(J,`${Z}${G}`);try{let Q={};try{let K=await import(X);Q=K.default||K}catch(K){let q=await Bun.file(X).text();if(Y.format==="yaml"||Y.format==="yml")Q=F9(q);else if(Y.format==="json")Q=JSON.parse(q);else throw K}if(Y.cache)C7[Z]={translations:Q,loadedAt:Date.now(),locale:Z};return Q}catch(Q){if($.debug)console.error(`Error loading translation file for locale "${Z}":`,Q);if(Z!==Y.defaultLocale)return Y8(Y.defaultLocale,$);return{}}}async function L9(Z,$){return O9(Z,$)}function F9(Z){let $={},Y=Z.split(`
2635
- `),J=[{obj:$,indent:-1}];for(let G of Y){let X=G.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let Q=X.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,j]=q,B=_.trim(),W=j.trim();if(W==="")K[B]={},J.push({obj:K[B],indent:Q});else K[B]=A9(W)}}return $}function A9(Z){if(Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith('"')&&Z.endsWith('"'))return Z.slice(1,-1);let $=Z.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Y=Number(Z);if(!Number.isNaN(Y))return Y;return Z}function R9(Z){switch(Z){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function N9(Z,$){for(let Y of Z){let J=Y.trim(),G=J.match(/^\{(\d+)\}\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10);if($===Q)return G[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let Q=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if($>=Q&&$<=K)return X[3];continue}}if(Z.length===2)return $===1?Z[0].trim():Z[1].trim();if($<Z.length)return Z[$].trim();return Z[Z.length-1].trim()}function V9(Z,$={}){return J8(Z,$)}function J8(Z,$){let Y="",J=0;while(J<Z.length)if(Z[J]==="{"){let G=M9(Z,J);if(G===-1){Y+=Z[J],J++;continue}let X=Z.slice(J+1,G);Y+=w9(X,$),J=G+1}else if(Z[J]==="'"&&J+1<Z.length)if(Z[J+1]==="'")Y+="'",J+=2;else if(Z[J+1]==="{"||Z[J+1]==="}")Y+=Z[J+1],J+=2;else Y+=Z[J],J++;else Y+=Z[J],J++;return Y}function M9(Z,$){let Y=0;for(let J=$;J<Z.length;J++)if(Z[J]==="{")Y++;else if(Z[J]==="}"){if(Y--,Y===0)return J}return-1}function w9(Z,$){let Y=T9(Z);if(Y.length===0)return`{${Z}}`;let J=Y[0].trim(),G=$[J];if(Y.length===1)return G!==void 0?String(G):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return I9(G,Y.slice(2).join(","),$);case"select":return E9(G,Y.slice(2).join(","));case"selectordinal":return k9(G,Y.slice(2).join(","));case"number":return b9(G,Y[2]?.trim());case"date":return P9(G,Y[2]?.trim());case"time":return C9(G,Y[2]?.trim());default:return G!==void 0?String(G):`{${Z}}`}}function T9(Z){let $=[],Y="",J=0;for(let G=0;G<Z.length;G++){let X=Z[G];if(X==="{")J++,Y+=X;else if(X==="}")J--,Y+=X;else if(X===","&&J===0)$.push(Y),Y="";else Y+=X}if(Y)$.push(Y);return $}function I9(Z,$,Y){let J=Number(Z)||0,G=x7($),X=`=${J}`;if(G[X])return P7(G[X],J,Y);let Q=D9(J);if(G[Q])return P7(G[Q],J,Y);if(G.other)return P7(G.other,J,Y);return String(J)}function P7(Z,$,Y){let J=Z.replace(/#/g,String($));return J8(J,Y)}function D9(Z){let $=Math.abs(Z),Y=Math.floor($),J=String(Z).includes(".")?String(Z).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function E9(Z,$){let Y=String(Z||""),J=x7($);if(J[Y])return J[Y];return J.other||String(Z)}function k9(Z,$){let Y=Number(Z)||0,J=x7($),G=S9(Y);if(J[G])return J[G].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function S9(Z){let $=Math.abs(Z),Y=$%10,J=$%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function x7(Z){let $={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec(Z);while(J!==null)$[J[1]]=J[2],J=Y.exec(Z);return $}function b9(Z,$){let Y=Number(Z);if(Number.isNaN(Y))return String(Z);switch($){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function P9(Z,$){let Y=Z instanceof Date?Z:new Date(String(Z));if(Number.isNaN(Y.getTime()))return String(Z);let J={};switch($){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function C9(Z,$){let Y=Z instanceof Date?Z:new Date(String(Z));if(Number.isNaN(Y.getTime()))return String(Z);let J={};switch($){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function y9(Z){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(Z)}function Z8(Z,$,Y=!0,J={}){let G=Z.split("."),X=$;for(let K of G){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return Y?Z:"";let Q=String(X);if(y9(Q))return V9(Q,J);if(Q.includes("|")&&"count"in J){let K=Number(J.count),q=Q.split("|");Q=N9(q,K)}for(let[K,q]of Object.entries(J))Q=Q.replace(new RegExp(`:${K}`,"g"),String(q));return Q}async function X8(Z,$,Y,J){let G=Z,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...y7,...J.i18n},K=await L9(Q.locale,J);$.__translations=K,$.__locale=Q.locale,$.__i18nConfig=Q,G=await $8(G,X,async(j,B,W,U,z)=>{try{let H={};if(W)try{let F=[()=>JSON.parse(W),()=>{let O=`{"data":${W}}`,A=JSON.parse(O);return typeof A.data==="object"?A.data:{}},()=>{return OZ(W,$)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return Z8(B,K,Q.fallbackToKey,H)||U.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return g("Translate",`Error in @translate('${B}'): ${H instanceof Error?H.message:String(H)}`,C.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${G.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let j=[...G.matchAll(q)];console.warn(`Found ${j.length} @translate matches`),j.forEach((B,W)=>console.warn(`Match ${W}: ${B[0]}, Key: ${B[1]}, Params: ${B[2]||"none"}`))}return G=await $8(G,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(j,B,W,U)=>{try{let z={};if(W)try{let H=[()=>JSON.parse(W),()=>{let L=`{"data":${W}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return OZ(W,$)}];for(let L of H)try{if(z=L(),Object.keys(z).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return Z8(B,K,Q.fallbackToKey,z)}catch(z){if(J.debug)console.error("Error processing @translate directive:",z);return g("Translate",`Error in @translate('${B}'): ${z instanceof Error?z.message:String(z)}`,C.EVALUATION_ERROR)}}),G}async function $8(Z,$,Y){let J=[];return Z.replace($,(X,...Q)=>{let K=Y(X,...Q).then((q)=>({match:X,replacement:q}));return J.push(K),X}),(await Promise.all(J)).reduce((X,{match:Q,replacement:K})=>X.replace(Q,K),Z)}var y7,C7,R4,b7;var G8=I(()=>{EZ();LZ();y7={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},C7={},R4={},b7={}});var j8={};t(j8,{processLoops:()=>v7});function f9(Z,$){let Y=Z;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,G)=>{if(G in $)return`:${G}="${G}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,G,X)=>{try{let Q=Object.keys($),K=Object.values($),_=Function(...Q,`return ${X}`)(...K),B=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${G}="${B}"`}catch(Q){return J}}),Y}function g9(Z,$){let Y=Z;return Y=Y.replace(/@break\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if($Z(Q)){let q=WZ(Q,Object.keys($));K=Boolean(q(...Object.values($)))}else K=Boolean(i(Q,$));return K?_5:""}catch{return""}}),Y=Y.replace(/@continue\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if($Z(Q)){let q=WZ(Q,Object.keys($));K=Boolean(q(...Object.values($)))}else K=Boolean(i(Q,$));return K?j5:""}catch{return""}}),Y}function h9(Z){let $=Z;return $=$.replace(/@break(?!\()/g,_5),$=$.replace(/@continue(?!\()/g,j5),$}function Q8(Z){let $=Z.includes(_5),Y=$?Z.substring(0,Z.indexOf(_5)):Z;return{hasBreak:$,content:Y}}function K8(Z){let $=Z.includes(j5),Y=$?Z.substring(0,Z.indexOf(j5)):Z;return{hasContinue:$,content:Y}}function q8(Z){let $=Z;return $=$.replace(/@break\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { break; } result += \``}),$=$.replace(/@continue\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function v7(Z,$,Y,J){let G=Z;G=G.replace(/@forelse\s*\(([^)]+)as([^)]+)\)([\s\S]*?)@empty([\s\S]*?)@endforelse/g,(q,_,j,B,W,U)=>{try{let z=_.trim(),H;if($Z(z))H=WZ(z,Object.keys($))(...Object.values($));else H=i(z,$);if(!Array.isArray(H)||H.length===0)return W;return`@foreach (${z} as ${j.trim()})${B}@endforeach`}catch(z){return g("Forelse",`Error in @forelse(${_.trim()} as ${j.trim()}): ${z instanceof Error?z.message:String(z)}`,C.EVALUATION_ERROR)}});function X(q){let _=/@foreach\s*\(/g,j;while((j=_.exec(q))!==null){let B=j.index,W=j.index+j[0].length-1,U=1,z=W+1,H=-1;while(z<q.length&&U>0){if(q[z]==="(")U++;else if(q[z]===")"){if(U--,U===0){H=z;break}}z++}if(H===-1)continue;let L=q.substring(W+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=B,A=L.substring(0,F),M=L.substring(F+4),V=H+1,R=1,N=V,w=/@foreach\s*\(/g,D=/@endforeach/g;while(R>0&&N<q.length){w.lastIndex=N,D.lastIndex=N;let E=w.exec(q),k=D.exec(q);if(!k)break;if(E&&E.index<k.index)R++,N=E.index+E[0].length;else{if(R--,R===0){let T=q.substring(V,k.index),S=k.index+11;return{start:O,end:S,arrayExpr:A,itemVar:M,content:T}}N=k.index+11}}}return null}function Q(q,_){let j=q;while(!0){let B=X(j);if(!B)break;let{start:W,end:U,arrayExpr:z,itemVar:H,content:L}=B;try{let F=z.trim(),O;if($Z(F))O=WZ(F,Object.keys(_))(...Object.values(_));else O=i(F,_);if(!Array.isArray(O)){let w=g("Foreach",`Error in @foreach: ${F} is not an array`,C.TYPE_ERROR);j=j.substring(0,W)+w+j.substring(U);continue}let A=J?.loops?.useAltLoopVariable??v9,M=H.trim(),V=null,R;if(M.includes("=>")){let w=M.split("=>").map((D)=>D.trim());if(w.length===2)V=w[0],R=w[1];else R=M}else R=M;let N="";for(let w=0;w<O.length;w++){let D=O[w],E={index:w,iteration:w+1,first:w===0,last:w===O.length-1,count:O.length},k={..._,[R]:D,loop:E,$loop:E};if(V)k[V]=w;let T=g9(L,k),S=K8(T);if(S.hasContinue){N+=S.content;continue}let d=Q8(T);if(d.hasBreak){N+=d.content;break}if(T=Q(T,k),T=Z4(T,k,Y),T=h9(T),d=Q8(T),d.hasBreak){N+=d.content;break}if(S=K8(T),S.hasContinue){N+=S.content;continue}T=pZ(T,k,Y),T=f9(T,k),N+=T}j=j.substring(0,W)+N+j.substring(U)}catch(F){let O=g("Foreach",`Error in @foreach(${z.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,C.EVALUATION_ERROR);j=j.substring(0,W)+O+j.substring(U)}}return j}G=Q(G,$),G=d9(G,$);let K=J?.loops?.maxWhileIterations??x9;return G=m9(G,$,K),G}function _8(Z){return u0(Z)}function d9(Z,$){let Y=Z,J=!0;while(J){J=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let X=G.index,Q=X+G[0].length-1,K=zZ(Y,"(",")",Q);if(K===-1)break;let q=Y.slice(Q+1,K),_=K+1,j=Q5(Y.slice(X),"for","endfor");if(j.length===0)break;let B=j[0].content,W=X+j[0].end;if(!_8(q)){let U=g("For",`Unsafe expression in @for: ${q}`,C.UNSAFE_EXPRESSION);Y=Y.substring(0,X)+U+Y.substring(W),J=!0;continue}try{let U=Object.keys($),z=Object.values($),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(O,A)=>{return`\${${A}}`});H=q8(H);let F=Function(...U,`
2639
+ `}async function k$(Z,$,Y,J){if($.length<1)return f("WebComponent","@webcomponent directive requires at least the tag name parameter",P.INVALID_DIRECTIVE_SYNTAX);let G=$[0].replace(/['"]/g,""),Q=(Y.__stx_options||{}).componentsDir||"components",K=[O4.join(O4.dirname(J),Q,`${G}.stx`),O4.join(s9.cwd(),Q,`${G}.stx`),O4.join(O4.dirname(J),`${G}.stx`)],q=null;for(let B of K)if(await p(B)){q=await Bun.file(B).text();break}if(!q)return f("WebComponent",`Component file not found: ${G}.stx`,P.FILE_NOT_FOUND);let _=o9(q,G);return`<script type="module">
2640
+ ${r9(_)}
2641
+ </script>`}var S$=I(()=>{kZ();NZ()});import{loadConfigWithResult as a9}from"bunfig";async function G5(){if(gZ)return gZ;if(L4)return L4;return L4=(async()=>{return gZ=(await a9({name:"stx",cwd:process.cwd(),defaultConfig:b$,verbose:!1})).config,gZ})(),L4}var b$,gZ=null,L4=null,P$;var V7=I(()=>{N5();M5();x5();V5();v5();p6();z7();H$();R7();S$();b$={enabled:!0,ssr:!0,partialsDir:"partials",componentsDir:"components",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:H6,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:k$,hasEndTag:!1,description:"Include a web component in the template"},G0,Q0,D$,E$,F0,N0,R0,A0,W6,L0,u6,W7,...U$],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}}};P$=new Proxy(b$,{get(Z,$){if(gZ&&$ in gZ)return gZ[$];if(!L4)G5().catch(()=>{});return Z[$]}})});import t9 from"fs";import M7 from"path";import{createHighlighter as e9}from"ts-syntax-highlighter";async function ZJ(Z,$={}){try{if(!await p(Z))throw Error(`Markdown file not found: ${Z}`);let J=(await t9.promises.stat(Z)).mtime.getTime();if($.cache&&w7.has(Z)){let B=w7.get(Z);if(B.updatedAt>=J)return{content:B.content,data:B.data}}let G=await Bun.file(Z).text(),{data:X,content:Q}=z6(G),K=$.markdown||P$.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=W4(Q,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await $J(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let j={content:_,data:X||{}};if($.cache)w7.set(Z,{...j,updatedAt:J});return j}catch(Y){if($.debug)console.error(`Error reading/parsing markdown file ${Z}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:l("Markdown File",`Error reading/parsing markdown file: ${J}`,Z,"",0,""),data:{}}}}async function $J(Z,$,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Q5)try{Q5=await e9({theme:$||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),Z}let G=async(K,q,_,j)=>{let B=j.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),W=_||(Y?"text":"");if(!W)return K;try{if(!Q5.getSupportedLanguages().includes(W))return K;return(await Q5.highlight(B,W,{theme:$})).html}catch(U){console.error(`Error highlighting code block with language ${_}:`,U)}return K},X=Z,Q=Z.matchAll(J);for(let K of Q){let[q,_,j,B]=K,W=await G(q,_,j,B);X=X.replace(q,W)}return X}async function C$(Z,$,Y="",J={}){return await YJ(Z,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,K,q,_)=>{try{let j=K;if(!M7.isAbsolute(K))j=M7.resolve(M7.dirname(Y),K);let B={};if(q)try{try{B=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let A of L){let M=A.indexOf(":");if(M>0){let V=A.substring(0,M).trim(),N=A.substring(M+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),w=N.startsWith("'")&&N.endsWith("'");if(R||w)N=N.substring(1,N.length-1);B[V]=N}}}}catch(O){if(J.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:W,data:U}=await ZJ(j,J),z={...$,...U,...B},H=W,F=/\{\{([^}]+)\}\}/g;return H=H.replace(F,(O,L)=>{let A=L.trim();return z[A]!==void 0?String(z[A]):O}),H}catch(j){let B=j instanceof Error?j.message:String(j);return l("Markdown File",`Error including markdown file: ${B}`,Y,Z,_,Q)}})}async function YJ(Z,$,Y){let J=[],G;while((G=$.exec(Z))!==null){let K=G[0],q=G.index,_=G;J.push(Y(..._).then((j)=>({match:K,replacement:j,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let Q=Z;for(let{match:K,replacement:q}of X)Q=Q.replace(K,q);return Q}var w7,Q5=null;var y$=I(()=>{V7();NZ();w7=new Map});function VZ(Z,$){try{let Y=Z.trim();if(JZ(Y))return UZ(Y,Object.keys($))(...Object.values($));else return n(Y,$)}catch{return!1}}var x$=I(()=>{AZ()});function F4(Z,$){let Y=$;while(Y<Z.length&&/\s/.test(Z[Y]))Y++;if(Z[Y]!=="(")return null;let J=HZ(Z,"(",")",Y);if(J===-1)return null;return{expression:Z.slice(Y+1,J),endPos:J+1}}function K5(Z,$,Y,J){let G=1,X=J,Q=new RegExp(`@${$}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<Z.length&&G>0){Q.lastIndex=X,K.lastIndex=X;let q=Q.exec(Z),_=K.exec(Z),j=q?q.index:1/0,B=_?_.index:1/0;if(j<B)G++,X=j+q[0].length;else if(B<1/0){if(G--,G===0)return B;X=B+_[0].length}else break}return-1}function v$(Z,$){let Y=Z.slice($).match(/^@if\s*/);if(!Y)return null;let J=$+Y[0].length,G=F4(Z,J);if(!G)return null;let X=G.endPos,Q=K5(Z,"if","endif",X);if(Q===-1)return null;let K=Z.slice(X,Q),q=[],_=0,j="if",B=G.expression,W=0;while(_<K.length){let U=K.slice(_).match(/^@elseif\s*/),z=K.slice(_).match(/^@else(?![a-z])/);if(U&&K.slice(_).startsWith("@elseif")){q.push({type:j,condition:B,content:K.slice(W,_),start:X+W,end:X+_});let H=_+U[0].length,F=F4(K,H);if(!F){_++;continue}j="elseif",B=F.expression,_=F.endPos,W=_}else if(z&&K.slice(_).startsWith("@else"))q.push({type:j,condition:B,content:K.slice(W,_),start:X+W,end:X+_}),j="else",B=void 0,_+=z[0].length,W=_;else _++}return q.push({type:j,condition:B,content:K.slice(W),start:X+W,end:X+K.length}),{fullMatch:Z.slice($,Q+6),branches:q,start:$,end:Q+6}}function T7(Z){let $=[],Y=/@if\s*\(/g,J=Y.exec(Z);while(J!==null){if($.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Y.exec(Z);continue}let X=v$(Z,J.index);if(X)$.push(X),Y.lastIndex=X.end;J=Y.exec(Z)}return $}function q5(Z,$,Y){let J=[],G=new RegExp(`@${$}\\s*\\(`,"g"),X=G.exec(Z);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=G.exec(Z);continue}let K=X.index,q=K+X[0].length-1,_=HZ(Z,"(",")",q);if(_===-1){X=G.exec(Z);continue}let j=Z.slice(q+1,_),B=_+1,W=K5(Z,$,Y,B);if(W===-1){X=G.exec(Z);continue}let U=Z.slice(B,W),z=W+`@${Y}`.length;J.push({fullMatch:Z.slice(K,z),name:$,params:j,content:U,start:K,end:z}),G.lastIndex=z,X=G.exec(Z)}return J}function I7(Z,$){let Y=Z.slice($).match(/^@switch\s*/);if(!Y)return null;let J=$+Y[0].length,G=F4(Z,J);if(!G)return null;let X=G.endPos,Q=K5(Z,"switch","endswitch",X);if(Q===-1)return null;let K=Z.slice(X,Q),q=[],_=0,j=null;while(_<K.length){let B=K.slice(_).match(/^@case\s*/),W=K.slice(_).match(/^@default(?![a-z])/),U=K.slice(_).match(/^@break(?![a-z])/);if(B&&K.slice(_).startsWith("@case")){if(j)q.push(j);let z=_+B[0].length,H=F4(K,z);if(!H){_++;continue}j={type:"case",value:H.expression,content:""},_=H.endPos}else if(W&&K.slice(_).startsWith("@default")){if(j)q.push(j);j={type:"default",content:""},_+=W[0].length}else if(U&&K.slice(_).startsWith("@break"))_+=U[0].length;else{if(j)j.content+=K[_];_++}}if(j)q.push(j);return{fullMatch:Z.slice($,Q+10),expression:G.expression,cases:q,start:$,end:Q+10}}var f$=()=>{};var g$=()=>{};var D7=I(()=>{f$();g$()});import t from"process";function QJ(Z,$,Y){let J=Z,G=!0;while(G){G=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=I7(J,Q);if(!K)break;try{let q;if(JZ(K.expression))q=UZ(K.expression,Object.keys($))(...Object.values($));else q=n(K.expression,$);let _="",j=!1;for(let B of K.cases)if(B.type==="default"){if(!j)_=B.content.replace(/@break/g,"").trim()}else try{let W;if(B.value&&JZ(B.value))W=UZ(B.value,Object.keys($))(...Object.values($));else if(B.value)W=n(B.value,$);if(q===W){_=B.content.replace(/@break/g,"").trim(),j=!0;break}}catch{continue}J=J.substring(0,Q)+_+J.substring(K.end),G=!0}catch(q){let _=q instanceof Error?q.message:String(q),j=f("Switch",`Error evaluating @switch expression: ${_}`,P.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(K.end);break}}return J}function Z4(Z,$,Y){let J=Z;J=QJ(J,$,Y),J=J.replace(/@unless\s*\(([^)]+)\)([\s\S]*?)@endunless/g,(X,Q,K)=>{let q=K.match(/^([\s\S]*?)@else([\s\S]*)$/);if(q){let _=q[1],j=q[2];return`@if (${Q})${j}@else${_}@endif`}else return`@if (!(${Q}))${K}@endif`}),J=k7(J,$,Y),J=S7(J,$,Y),J=E7(J,$);let G=()=>{let X=T7(J);if(X.length===0)return!1;for(let Q=X.length-1;Q>=0;Q--){let K=X[Q];try{let q="",_=!1;for(let j of K.branches){if(_)break;if(j.type==="else")q=j.content,_=!0;else try{let B;if(j.condition&&JZ(j.condition))B=UZ(j.condition,Object.keys($))(...Object.values($));else if(j.condition)B=n(j.condition,$);if(B)q=j.content,_=!0}catch(B){q=f(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,P.EVALUATION_ERROR),_=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),j=f("If",`Error processing @if block: ${_}`,P.EVALUATION_ERROR);J=J.substring(0,K.start)+j+J.substring(K.end)}}return!0};while(G());return J}function E7(Z,$){let Y=Z;return Y=Y.replace(/@auth\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endauth/g,(J,G,X,Q)=>{return(G?VZ(`auth?.check && auth?.user?.[${G}]`,$):VZ("auth?.check",$))?X:Q||""}),Y=Y.replace(/@guest\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endguest/g,(J,G,X,Q)=>{return(G?VZ(`!auth?.check || !auth?.user?.[${G}]`,$):VZ("!auth?.check",$))?X:Q||""}),Y=Y.replace(/@can\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecan\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcan/g,(J,G,X,Q,K,q,_,j,B,W)=>{let U=!1;if($.userCan&&typeof $.userCan[G]==="boolean")U=$.userCan[G];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let z=[G];if(X)z.push(X);if(Q){let H=VZ(Q,$);z.push(H)}U=$.permissions.check(...z)}catch{U=!1}if(U)return K;else if(q){let z=!1;if($.userCan&&typeof $.userCan[q]==="boolean")z=$.userCan[q];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let F=VZ(j,$);H.push(F)}z=$.permissions.check(...H)}catch{z=!1}return z?B:W||""}else return W||""}),Y=Y.replace(/@cannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcannot/g,(J,G,X,Q,K,q,_,j,B,W)=>{let U=!0;if($.userCan&&typeof $.userCan[G]==="boolean")U=!$.userCan[G];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let z=[G];if(X)z.push(X);if(Q){let H=VZ(Q,$);z.push(H)}U=!$.permissions.check(...z)}catch{U=!0}if(U)return K;else if(q){let z=!0;if($.userCan&&typeof $.userCan[q]==="boolean")z=!$.userCan[q];else if($.permissions?.check&&typeof $.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let F=VZ(j,$);H.push(F)}z=!$.permissions.check(...H)}catch{z=!0}return z?B:W||""}else return W||""}),Y}function k7(Z,$,Y){let J=Z;return J=J.replace(/@isset\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endisset/g,(G,X,Q,K,q)=>{try{let _=VZ(X.trim(),$);if(_!==void 0&&_!==null)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return f("Isset",`Error processing @isset directive: ${j}`,P.EVALUATION_ERROR)}}),J=J.replace(/@empty\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endempty/g,(G,X,Q,K,q)=>{try{let _=VZ(X.trim(),$);if(_===void 0||_===null||_===""||Array.isArray(_)&&_.length===0||typeof _==="object"&&_!==null&&Object.keys(_).length===0)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return f("Empty",`Error processing @empty directive: ${j}`,P.EVALUATION_ERROR)}}),J}function S7(Z,$,Y){let J=Z;return J=J.replace(/@env\s*\(\s*(['"])([^'"]+)\1\s*\)([\s\S]*?)(?:@else([\s\S]*?))?@endenv/g,(G,X,Q,K,q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")===Q?K:q}),J=J.replace(/@production([\s\S]*?)(?:@else([\s\S]*?))?@endproduction/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="production"?X:Q}),J=J.replace(/@development([\s\S]*?)(?:@else([\s\S]*?))?@enddevelopment/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="development"?X:Q}),J=J.replace(/@staging([\s\S]*?)(?:@else([\s\S]*?))?@endstaging/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="staging"?X:Q}),J=J.replace(/@testing([\s\S]*?)(?:@else([\s\S]*?))?@endtesting/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="testing"?X:Q}),J}var _5=I(()=>{x$();kZ();D7();AZ()});function d$(Z=16){let $=new Uint8Array(Z);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function j5(Z,$){if(!Z)return $?.nonceGenerator?.()??d$();let Y=h$.get(Z);if(!Y)Y=$?.nonceGenerator?.()??d$(),h$.set(Z,Y);return Y}function KJ(Z,$){let Y=[];for(let[J,G]of Object.entries(Z)){if(G===void 0||G===null)continue;if(typeof G==="boolean"){if(G)Y.push(J);continue}if(Array.isArray(G)){let X=[...G];if($&&(J==="script-src"||J==="style-src"))X=X.filter((Q)=>!Q.startsWith("'nonce-")),X.push(`'nonce-${$}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function m$(Z,$){return`<meta http-equiv="Content-Security-Policy" content="${KJ(Z,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function u$(Z,$,Y){if(!$.enabled||!$.addMetaTag)return Z;if(Z.includes('http-equiv="Content-Security-Policy"'))return Z;if(!Z.includes("<head>")&&!Z.includes("<head "))return Z;let J=$.useNonce?j5(Y,$):void 0,G=m$($.directives,J);return Z.replace(/<head([^>]*)>/,`<head$1>
2642
+ ${G}`)}function p$(Z,$,Y,J){let G=Z,X=J.csp;if(G=G.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let Q=X.useNonce?j5($,X):void 0;return m$(X.directives,Q)}),G=G.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return j5($,X)}),X?.enabled&&X.useNonce)$.cspNonce=j5($,X);return G}var h$;var c$=I(()=>{h$=new WeakMap});import qJ from"crypto";function jJ(Z=_J){let $=qJ.randomBytes(Math.ceil(Z/2)).toString("hex").slice(0,Z);return b7=$,$}function BJ(){if(!b7)jJ();return b7}function WJ(Z=l$){let $=BJ();return`<input type="hidden" name="${Z}" value="${$}">`}function i$(Z){return Z.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Y,J)=>{return WJ(J||l$)})}var _J=40,l$="_token",b7=null;var n$=()=>{};async function s$(Z,$,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return Z;let G=Z;for(let X of J.customDirectives){if(!X.name||typeof X.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)G=await zJ(G,X,$,Y,J);else G=await UJ(G,X,$,Y,J)}return G}async function zJ(Z,$,Y,J,G){let{name:X,handler:Q}=$,K=`@${X}`,q=`@end${X}`,_=Z,j=_4(`${K}(?:\\s*\\(([^)]+)\\))?([\\s\\S]*?)${q}`,"g"),B=[],W=j.exec(_);while(W!==null){let[U,z="",H=""]=W,F=W.index||0;try{let O=z?o$(z):[],L=H.trim(),A=await Q(L,O,Y,J);B.push({original:U,processed:A,startIndex:F})}catch(O){let L=O instanceof Error?O.message:String(O);if(G.debug)console.error(`Error processing custom directive @${X}:`,O);B.push({original:U,processed:f("CustomDirective",`Error in @${X}${z?`(${z})`:""}: ${L}`,P.EVALUATION_ERROR),startIndex:F})}W=j.exec(_)}for(let U=B.length-1;U>=0;U--){let{original:z,processed:H}=B[U];_=_.replace(z,H)}return _}async function UJ(Z,$,Y,J,G){let{name:X,handler:Q}=$,K=Z,q=_4(`@${X}\\s*\\(([^)]+)\\)`,"g"),_=[],j=q.exec(K);while(j!==null){let[B,W=""]=j,U=j.index||0;try{let z=o$(W),H=await Q("",z,Y,J);_.push({original:B,processed:H,startIndex:U})}catch(z){let H=z instanceof Error?z.message:String(z);if(G.debug)console.error(`Error processing custom directive @${X}:`,z);_.push({original:B,processed:f("CustomDirective",`Error in @${X}(${W}): ${H}`,P.EVALUATION_ERROR),startIndex:U})}j=q.exec(K)}for(let B=_.length-1;B>=0;B--){let{original:W,processed:U}=_[B];K=K.replace(W,U)}return K}function o$(Z){if(!Z.trim())return[];let $=[],Y="",J=!1,G="";for(let X=0;X<Z.length;X++){let Q=Z[X];if((Q==='"'||Q==="'")&&(X===0||Z[X-1]!=="\\"))if(!J)J=!0,G=Q;else if(Q===G)J=!1;else Y+=Q;else if(Q===","&&!J)$.push(Y.trim()),Y="";else Y+=Q}if(Y.trim())$.push(Y.trim());return $.map((X)=>{let Q=X.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var r$=I(()=>{kZ();lZ()});import HJ from"crypto";function LJ(){return HJ.randomUUID()}function t$(Z,$){let Y=Z;return Y=Y.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let J=LJ();$.csrf={token:J}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${$.csrf.token}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,G)=>{if(G&&["PUT","PATCH","DELETE"].includes(G.toUpperCase()))return`<input type="hidden" name="_method" value="${G.toUpperCase()}">`;return J}),Y}function e$(Z,$,Y=OJ){return Z.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,G,X)=>{try{if(FJ(G,$))return X.replace(/\{\{([^}]+)\}\}/g,(Q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return a$(G,$);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(G);return a$(G,$)}let q=K.trim();if(JZ(q)){let _=n(q,$);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function FJ(Z,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(Z);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,Z);return!1}function a$(Z,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(Z);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,Z)){let Y=$.errors[Z];return Array.isArray(Y)?Y[0]:String(Y)}return""}var OJ;var Z8=I(()=>{AZ();OJ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import $8 from"path";function AJ(Z,$=0){if($<=0)return!1;return Date.now()-Z.loadedAt>$}async function NJ(Z,$){if({...x7,...$.i18n}.cache&&y7[Z]){let G=y7[Z],X=$.i18n?.cacheMaxAge??0;if(!AJ(G,X))return G.translations}if(A4[Z]?.state==="loading")return A4[Z].promise;P7[Z]="loading";let J=X8(Z,$).then((G)=>{return P7[Z]="loaded",delete A4[Z],G}).catch((G)=>{throw P7[Z]="error",A4[Z]={promise:J,state:"error",error:G instanceof Error?G:Error(String(G))},G});return A4[Z]={promise:J,state:"loading"},J}async function X8(Z,$){let Y={...x7,...$.i18n},J=$8.resolve(import.meta.dir,"..",Y.translationsDir),G=wJ(Y.format),X=$8.join(J,`${Z}${G}`);try{let Q={};try{let K=await import(X);Q=K.default||K}catch(K){let q=await Bun.file(X).text();if(Y.format==="yaml"||Y.format==="yml")Q=VJ(q);else if(Y.format==="json")Q=JSON.parse(q);else throw K}if(Y.cache)y7[Z]={translations:Q,loadedAt:Date.now(),locale:Z};return Q}catch(Q){if($.debug)console.error(`Error loading translation file for locale "${Z}":`,Q);if(Z!==Y.defaultLocale)return X8(Y.defaultLocale,$);return{}}}async function RJ(Z,$){return NJ(Z,$)}function VJ(Z){let $={},Y=Z.split(`
2643
+ `),J=[{obj:$,indent:-1}];for(let G of Y){let X=G.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let Q=X.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,j]=q,B=_.trim(),W=j.trim();if(W==="")K[B]={},J.push({obj:K[B],indent:Q});else K[B]=MJ(W)}}return $}function MJ(Z){if(Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith('"')&&Z.endsWith('"'))return Z.slice(1,-1);let $=Z.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Y=Number(Z);if(!Number.isNaN(Y))return Y;return Z}function wJ(Z){switch(Z){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function TJ(Z,$){for(let Y of Z){let J=Y.trim(),G=J.match(/^\{(\d+)\}\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10);if($===Q)return G[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let Q=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if($>=Q&&$<=K)return X[3];continue}}if(Z.length===2)return $===1?Z[0].trim():Z[1].trim();if($<Z.length)return Z[$].trim();return Z[Z.length-1].trim()}function IJ(Z,$={}){return G8(Z,$)}function G8(Z,$){let Y="",J=0;while(J<Z.length)if(Z[J]==="{"){let G=DJ(Z,J);if(G===-1){Y+=Z[J],J++;continue}let X=Z.slice(J+1,G);Y+=EJ(X,$),J=G+1}else if(Z[J]==="'"&&J+1<Z.length)if(Z[J+1]==="'")Y+="'",J+=2;else if(Z[J+1]==="{"||Z[J+1]==="}")Y+=Z[J+1],J+=2;else Y+=Z[J],J++;else Y+=Z[J],J++;return Y}function DJ(Z,$){let Y=0;for(let J=$;J<Z.length;J++)if(Z[J]==="{")Y++;else if(Z[J]==="}"){if(Y--,Y===0)return J}return-1}function EJ(Z,$){let Y=kJ(Z);if(Y.length===0)return`{${Z}}`;let J=Y[0].trim(),G=$[J];if(Y.length===1)return G!==void 0?String(G):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return SJ(G,Y.slice(2).join(","),$);case"select":return PJ(G,Y.slice(2).join(","));case"selectordinal":return CJ(G,Y.slice(2).join(","));case"number":return xJ(G,Y[2]?.trim());case"date":return vJ(G,Y[2]?.trim());case"time":return fJ(G,Y[2]?.trim());default:return G!==void 0?String(G):`{${Z}}`}}function kJ(Z){let $=[],Y="",J=0;for(let G=0;G<Z.length;G++){let X=Z[G];if(X==="{")J++,Y+=X;else if(X==="}")J--,Y+=X;else if(X===","&&J===0)$.push(Y),Y="";else Y+=X}if(Y)$.push(Y);return $}function SJ(Z,$,Y){let J=Number(Z)||0,G=v7($),X=`=${J}`;if(G[X])return C7(G[X],J,Y);let Q=bJ(J);if(G[Q])return C7(G[Q],J,Y);if(G.other)return C7(G.other,J,Y);return String(J)}function C7(Z,$,Y){let J=Z.replace(/#/g,String($));return G8(J,Y)}function bJ(Z){let $=Math.abs(Z),Y=Math.floor($),J=String(Z).includes(".")?String(Z).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function PJ(Z,$){let Y=String(Z||""),J=v7($);if(J[Y])return J[Y];return J.other||String(Z)}function CJ(Z,$){let Y=Number(Z)||0,J=v7($),G=yJ(Y);if(J[G])return J[G].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function yJ(Z){let $=Math.abs(Z),Y=$%10,J=$%100;if(Y===1&&J!==11)return"one";if(Y===2&&J!==12)return"two";if(Y===3&&J!==13)return"few";return"other"}function v7(Z){let $={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec(Z);while(J!==null)$[J[1]]=J[2],J=Y.exec(Z);return $}function xJ(Z,$){let Y=Number(Z);if(Number.isNaN(Y))return String(Z);switch($){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function vJ(Z,$){let Y=Z instanceof Date?Z:new Date(String(Z));if(Number.isNaN(Y.getTime()))return String(Z);let J={};switch($){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Y.toLocaleDateString(void 0,J)}function fJ(Z,$){let Y=Z instanceof Date?Z:new Date(String(Z));if(Number.isNaN(Y.getTime()))return String(Z);let J={};switch($){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Y.toLocaleTimeString(void 0,J)}function gJ(Z){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(Z)}function Y8(Z,$,Y=!0,J={}){let G=Z.split("."),X=$;for(let K of G){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return Y?Z:"";let Q=String(X);if(gJ(Q))return IJ(Q,J);if(Q.includes("|")&&"count"in J){let K=Number(J.count),q=Q.split("|");Q=TJ(q,K)}for(let[K,q]of Object.entries(J))Q=Q.replace(new RegExp(`:${K}`,"g"),String(q));return Q}async function Q8(Z,$,Y,J){let G=Z,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...x7,...J.i18n},K=await RJ(Q.locale,J);$.__translations=K,$.__locale=Q.locale,$.__i18nConfig=Q,G=await J8(G,X,async(j,B,W,U,z)=>{try{let H={};if(W)try{let O=[()=>JSON.parse(W),()=>{let L=`{"data":${W}}`,A=JSON.parse(L);return typeof A.data==="object"?A.data:{}},()=>{return FZ(W,$)}];for(let L of O)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(O){if(J.debug)console.error("Error parsing parameters for @translate directive:",O)}return Y8(B,K,Q.fallbackToKey,H)||U.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return f("Translate",`Error in @translate('${B}'): ${H instanceof Error?H.message:String(H)}`,P.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${G.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let j=[...G.matchAll(q)];console.warn(`Found ${j.length} @translate matches`),j.forEach((B,W)=>console.warn(`Match ${W}: ${B[0]}, Key: ${B[1]}, Params: ${B[2]||"none"}`))}return G=await J8(G,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(j,B,W,U)=>{try{let z={};if(W)try{let H=[()=>JSON.parse(W),()=>{let F=`{"data":${W}}`,O=JSON.parse(F);return typeof O.data==="object"?O.data:{}},()=>{return FZ(W,$)}];for(let F of H)try{if(z=F(),Object.keys(z).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return Y8(B,K,Q.fallbackToKey,z)}catch(z){if(J.debug)console.error("Error processing @translate directive:",z);return f("Translate",`Error in @translate('${B}'): ${z instanceof Error?z.message:String(z)}`,P.EVALUATION_ERROR)}}),G}async function J8(Z,$,Y){let J=[];return Z.replace($,(X,...Q)=>{let K=Y(X,...Q).then((q)=>({match:X,replacement:q}));return J.push(K),X}),(await Promise.all(J)).reduce((X,{match:Q,replacement:K})=>X.replace(Q,K),Z)}var x7,y7,A4,P7;var K8=I(()=>{kZ();AZ();x7={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},y7={},A4={},P7={}});var W8={};ZZ(W8,{processLoops:()=>f7});function mJ(Z,$){let Y=Z;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,G)=>{if(G in $)return`:${G}="${G}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,G,X)=>{try{let Q=Object.keys($),K=Object.values($),_=Function(...Q,`return ${X}`)(...K),B=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${G}="${B}"`}catch(Q){return J}}),Y}function uJ(Z,$){let Y=Z;return Y=Y.replace(/@break\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if(JZ(Q)){let q=UZ(Q,Object.keys($));K=Boolean(q(...Object.values($)))}else K=Boolean(n(Q,$));return K?B5:""}catch{return""}}),Y=Y.replace(/@continue\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if(JZ(Q)){let q=UZ(Q,Object.keys($));K=Boolean(q(...Object.values($)))}else K=Boolean(n(Q,$));return K?W5:""}catch{return""}}),Y}function pJ(Z){let $=Z;return $=$.replace(/@break(?!\()/g,B5),$=$.replace(/@continue(?!\()/g,W5),$}function q8(Z){let $=Z.includes(B5),Y=$?Z.substring(0,Z.indexOf(B5)):Z;return{hasBreak:$,content:Y}}function _8(Z){let $=Z.includes(W5),Y=$?Z.substring(0,Z.indexOf(W5)):Z;return{hasContinue:$,content:Y}}function j8(Z){let $=Z;return $=$.replace(/@break\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { break; } result += \``}),$=$.replace(/@continue\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function f7(Z,$,Y,J){let G=Z;G=G.replace(/@forelse\s*\(([^)]+)as([^)]+)\)([\s\S]*?)@empty([\s\S]*?)@endforelse/g,(q,_,j,B,W,U)=>{try{let z=_.trim(),H;if(JZ(z))H=UZ(z,Object.keys($))(...Object.values($));else H=n(z,$);if(!Array.isArray(H)||H.length===0)return W;return`@foreach (${z} as ${j.trim()})${B}@endforeach`}catch(z){return f("Forelse",`Error in @forelse(${_.trim()} as ${j.trim()}): ${z instanceof Error?z.message:String(z)}`,P.EVALUATION_ERROR)}});function X(q){let _=/@foreach\s*\(/g,j;while((j=_.exec(q))!==null){let B=j.index,W=j.index+j[0].length-1,U=1,z=W+1,H=-1;while(z<q.length&&U>0){if(q[z]==="(")U++;else if(q[z]===")"){if(U--,U===0){H=z;break}}z++}if(H===-1)continue;let F=q.substring(W+1,H),O=F.indexOf(" as ");if(O===-1)continue;let L=B,A=F.substring(0,O),M=F.substring(O+4),V=H+1,N=1,R=V,w=/@foreach\s*\(/g,D=/@endforeach/g;while(N>0&&R<q.length){w.lastIndex=R,D.lastIndex=R;let E=w.exec(q),k=D.exec(q);if(!k)break;if(E&&E.index<k.index)N++,R=E.index+E[0].length;else{if(N--,N===0){let T=q.substring(V,k.index),S=k.index+11;return{start:L,end:S,arrayExpr:A,itemVar:M,content:T}}R=k.index+11}}}return null}function Q(q,_){let j=q;while(!0){let B=X(j);if(!B)break;let{start:W,end:U,arrayExpr:z,itemVar:H,content:F}=B;try{let O=z.trim(),L;if(JZ(O))L=UZ(O,Object.keys(_))(...Object.values(_));else L=n(O,_);if(!Array.isArray(L)){let w=f("Foreach",`Error in @foreach: ${O} is not an array`,P.TYPE_ERROR);j=j.substring(0,W)+w+j.substring(U);continue}let A=J?.loops?.useAltLoopVariable??dJ,M=H.trim(),V=null,N;if(M.includes("=>")){let w=M.split("=>").map((D)=>D.trim());if(w.length===2)V=w[0],N=w[1];else N=M}else N=M;let R="";for(let w=0;w<L.length;w++){let D=L[w],E={index:w,iteration:w+1,first:w===0,last:w===L.length-1,count:L.length},k={..._,[N]:D,loop:E,$loop:E};if(V)k[V]=w;let T=uJ(F,k),S=_8(T);if(S.hasContinue){R+=S.content;continue}let h=q8(T);if(h.hasBreak){R+=h.content;break}if(T=Q(T,k),T=Z4(T,k,Y),T=pJ(T),h=q8(T),h.hasBreak){R+=h.content;break}if(S=_8(T),S.hasContinue){R+=S.content;continue}T=pZ(T,k,Y),T=mJ(T,k),R+=T}j=j.substring(0,W)+R+j.substring(U)}catch(O){let L=f("Foreach",`Error in @foreach(${z.trim()} as ${H.trim()}): ${O instanceof Error?O.message:String(O)}`,P.EVALUATION_ERROR);j=j.substring(0,W)+L+j.substring(U)}}return j}G=Q(G,$),G=cJ(G,$);let K=J?.loops?.maxWhileIterations??hJ;return G=lJ(G,$,K),G}function B8(Z){return P0(Z)}function cJ(Z,$){let Y=Z,J=!0;while(J){J=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let X=G.index,Q=X+G[0].length-1,K=HZ(Y,"(",")",Q);if(K===-1)break;let q=Y.slice(Q+1,K),_=K+1,j=q5(Y.slice(X),"for","endfor");if(j.length===0)break;let B=j[0].content,W=X+j[0].end;if(!B8(q)){let U=f("For",`Unsafe expression in @for: ${q}`,P.UNSAFE_EXPRESSION);Y=Y.substring(0,X)+U+Y.substring(W),J=!0;continue}try{let U=Object.keys($),z=Object.values($),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(L,A)=>{return`\${${A}}`});H=j8(H);let O=Function(...U,`
2636
2644
  let result = '';
2637
2645
  for (${q}) {
2638
2646
  result += \`${H}\`;
2639
2647
  }
2640
2648
  return result;
2641
- `)(...z);Y=Y.substring(0,X)+F+Y.substring(W),J=!0}catch(U){let z=g("For",`Error in @for(${q}): ${U instanceof Error?U.message:String(U)}`,C.EVALUATION_ERROR);Y=Y.substring(0,X)+z+Y.substring(W),J=!0}}return Y}function m9(Z,$,Y){let J=Z,G=!0;while(G){G=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=Q+X[0].length-1,q=zZ(J,"(",")",K);if(q===-1)break;let _=J.slice(K+1,q),j=Q5(J.slice(Q),"while","endwhile");if(j.length===0)break;let B=j[0].content,W=Q+j[0].end;if(!_8(_)){let U=g("While",`Unsafe expression in @while: ${_}`,C.UNSAFE_EXPRESSION);J=J.substring(0,Q)+U+J.substring(W),G=!0;continue}try{let U=Object.keys($),z=Object.values($),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(O,A)=>{return`\${${A}}`});H=q8(H);let F=Function(...U,`
2649
+ `)(...z);Y=Y.substring(0,X)+O+Y.substring(W),J=!0}catch(U){let z=f("For",`Error in @for(${q}): ${U instanceof Error?U.message:String(U)}`,P.EVALUATION_ERROR);Y=Y.substring(0,X)+z+Y.substring(W),J=!0}}return Y}function lJ(Z,$,Y){let J=Z,G=!0;while(G){G=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=Q+X[0].length-1,q=HZ(J,"(",")",K);if(q===-1)break;let _=J.slice(K+1,q),j=q5(J.slice(Q),"while","endwhile");if(j.length===0)break;let B=j[0].content,W=Q+j[0].end;if(!B8(_)){let U=f("While",`Unsafe expression in @while: ${_}`,P.UNSAFE_EXPRESSION);J=J.substring(0,Q)+U+J.substring(W),G=!0;continue}try{let U=Object.keys($),z=Object.values($),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(L,A)=>{return`\${${A}}`});H=j8(H);let O=Function(...U,`
2642
2650
  let result = '';
2643
2651
  let maxIterations = ${Y}; // Configurable safety limit
2644
2652
  let counter = 0;
@@ -2650,8 +2658,8 @@ ${G}`)}function m$(Z,$,Y,J){let G=Z,X=J.csp;if(G=G.replace(/@csp\b/g,()=>{if(!X?
2650
2658
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2651
2659
  }
2652
2660
  return result;
2653
- `)(...z);J=J.substring(0,Q)+F+J.substring(W),G=!0}catch(U){let z=g("While",`Error in @while(${_}): ${U instanceof Error?U.message:String(U)}`,C.EVALUATION_ERROR);J=J.substring(0,Q)+z+J.substring(W),G=!0}}return J}var x9=1000,v9=!1,_5="<!--__STX_BREAK__-->",j5="<!--__STX_CONTINUE__-->";var f7=I(()=>{K5();EZ();cZ();I7();LZ()});import g7 from"fs";import e from"path";function u9(Z){return/\b(state|derived|effect)\s*\(/.test(Z)}function p9(Z){let $=Z,Y=[],J=new Set,G=0,X=0,Q=$.length,K=(B)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if($[X]==="{")B++;else if($[X]==="}")B--;else if($[X]==="'"||$[X]==='"')K($[X]);else if($[X]==="`")q();else X++;continue}X++}},_=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
2654
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let z=B[2];if(!J.has(z))Y.push(z),J.add(z);return}let W=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!J.has(z))Y.push(z),J.add(z);return}let U=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!J.has(z))Y.push(z),J.add(z)}};while(X<Q){if(_())continue;if($[X]==="'"||$[X]==='"'){K($[X]);continue}if($[X]==="`"){q();continue}if($[X]==="{"){G++,X++;continue}if($[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))j();X++}return Y.join(", ")}function c9(Z,$){let Y=p9(Z);return`
2661
+ `)(...z);J=J.substring(0,Q)+O+J.substring(W),G=!0}catch(U){let z=f("While",`Error in @while(${_}): ${U instanceof Error?U.message:String(U)}`,P.EVALUATION_ERROR);J=J.substring(0,Q)+z+J.substring(W),G=!0}}return J}var hJ=1000,dJ=!1,B5="<!--__STX_BREAK__-->",W5="<!--__STX_CONTINUE__-->";var g7=I(()=>{_5();kZ();cZ();D7();AZ()});import h7 from"fs";import $Z from"path";function iJ(Z){return/\b(state|derived|effect)\s*\(/.test(Z)}function nJ(Z){let $=Z,Y=[],J=new Set,G=0,X=0,Q=$.length,K=(B)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if($[X]==="{")B++;else if($[X]==="}")B--;else if($[X]==="'"||$[X]==='"')K($[X]);else if($[X]==="`")q();else X++;continue}X++}},_=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
2662
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let z=B[2];if(!J.has(z))Y.push(z),J.add(z);return}let W=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!J.has(z))Y.push(z),J.add(z);return}let U=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!J.has(z))Y.push(z),J.add(z)}};while(X<Q){if(_())continue;if($[X]==="'"||$[X]==='"'){K($[X]);continue}if($[X]==="`"){q();continue}if($[X]==="{"){G++,X++;continue}if($[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))j();X++}return Y.join(", ")}function sJ(Z,$){let Y=nJ(Z);return`
2655
2663
  (function() {
2656
2664
  var __stx = window.stx || {};
2657
2665
  var state = __stx.state || function(v) { var s = function() { return s._v; }; s._v = v; s.set = function(nv) { s._v = nv; }; s.update = function(fn) { s._v = fn(s._v); }; return s; };
@@ -2668,17 +2676,17 @@ ${Z}
2668
2676
  if (!window.stx._scopes) window.stx._scopes = {};
2669
2677
  window.stx._scopes['${$}'] = { ${Y} };
2670
2678
  })();
2671
- `}function l9(Z,$){let Y=Z.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)([\s>])/s);if(Y){let[,J,G,X]=Y;if(Z.includes("data-stx-scope"))return Z;return`${J}${G} data-stx-scope="${$}"${X}${Z.slice(Y[0].length)}`}return Z}function s9(Z){if(Z.__onceStore instanceof Set)return Z.__onceStore;return n9}async function h7(Z,$,Y,J,G,X=new Set){let Q=J.partialsDir||e.join(e.dirname(Y),"partials");if(Q&&!e.isAbsolute(Q)){let L=e.resolve(__dirname,"..");Q=e.resolve(L,Q)}let K=Z.replace(/@partial\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(L,F,O)=>`@include('${F}'${O?`, ${O}`:""})`),q=s9($);K=K.replace(/@once([\s\S]*?)@endonce/g,(L,F,O)=>{let A=F.trim(),M=`${Y}:${A}`;if(q.has(M))return"";return q.add(M),F}),K=K.replace(/@includeIf\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(L,F,O)=>{let A=B(F,Q,Y);if(A&&g7.existsSync(A))return G.add(A),`@include('${F}'${O?`, ${O}`:""})`;return""}),K=K.replace(/@includeWhen\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(L,F,O,A,M)=>{try{let V=`Boolean(${F})`,R;if($Z(V)){let N=WZ(V,Object.keys($));R=Boolean(N(...Object.values($)))}else R=Boolean(i(V,$));if(R){let N=B(O,Q,Y);if(N&&g7.existsSync(N))G.add(N);return`@include('${O}'${A?`, ${A}`:""})`}return""}catch(V){let R=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeWhen condition: ${R}`,Y,Z,M,L)}}),K=K.replace(/@includeUnless\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(L,F,O,A,M)=>{try{let V=`Boolean(${F})`,R;if($Z(V)){let N=WZ(V,Object.keys($));R=Boolean(N(...Object.values($)))}else R=Boolean(i(V,$));if(!R){let N=B(O,Q,Y);if(N&&g7.existsSync(N))G.add(N);return`@include('${O}'${A?`, ${A}`:""})`}return""}catch(V){let R=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeUnless condition: ${R}`,Y,Z,M,L)}});let _=/@includeFirst\s*\(\s*(\[[^\]]+\])\s*(?:,\s*(\{[^}]*\})\s*)?(?:,\s*['"]([^'"]*)['"]\s*)?\)/g,j;while(j=_.exec(K)){let[L,F,O,A]=j,M=j.index;try{let V=JSON.parse(F.replace(/'/g,'"')),R={};if(O)try{R=OZ(O,$)}catch(w){let D=w instanceof Error?w.message:String(w);if(J.debug)K=K.replace(L,l("Include",`Error parsing includeFirst variables: ${D}`,Y,Z,M,L));else K=K.replace(L,A||"");continue}let N=!1;for(let w of V){let D=B(w,Q,Y);if(!D)continue;if(await p(D)){let E=await U(w,R,Z,M);K=K.replace(L,E),N=!0;break}}if(!N)if(A!==void 0)K=K.replace(L,A);else if(J.debug)K=K.replace(L,l("Include",`None of the includeFirst paths exist: ${F}`,Y,Z,M,L));else K=K.replace(L,"")}catch(V){let R=V instanceof Error?V.message:String(V);K=K.replace(L,l("Include",`Error processing @includeFirst: ${R}`,Y,Z,M,L))}_.lastIndex=0}function B(L,F,O){try{let A=L;if(!L.endsWith(".stx"))A=`${L}.stx`;let M=e.resolve(F),V=e.resolve(e.dirname(O)),R;if(!A.startsWith("./")&&!A.startsWith("../"))R=e.resolve(F,A);else R=e.resolve(V,A);let N=e.normalize(R),w=N.startsWith(M+e.sep)||N===M,D=N.startsWith(V+e.sep)||N===V,E=!1,k=V;for(let T=0;T<3;T++)if(k=e.dirname(k),N.startsWith(k+e.sep)){E=!0;break}if(!w&&!D&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${L}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${M}, ${V}`),null;return N}catch(A){return console.error(`Error resolving path ${L}: ${A}`),null}}let W=e.resolve(Y);X.add(W);async function U(L,F={},O,A){let M=B(L,Q,Y);if(!M)return l("Include",`Could not resolve path for include: ${L}`,Y,O,A);let V=e.resolve(M);if(X.has(V)){let R=[...X,V].map((N)=>e.basename(N)).join(" -> ");return l("Include",`Circular include detected: ${R}`,Y,O,A)}try{if(!M)return l("Include",`Could not resolve path for include: ${L}`,Y,O,A);G.add(M);let R=B8.get(M);if(!R)try{R=await Bun.file(M).text(),B8.set(M,R)}catch(XZ){let s=XZ instanceof Error?XZ.message:String(XZ);return l("Include",`Error loading include file ${L}: ${s}`,Y,O,A)}let N=R,w=N.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)N=w[1].trim();let D=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),E="";if(D)E=`<style${D[1]}>${D[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...$};for(let[XZ,s]of Object.entries(F))k[XZ]=s;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(T)],d="",c=null;for(let XZ of S){let s=XZ[1]||"",a=XZ[2]||"",GZ=s.includes("server"),h=s.includes("client")||s.includes('type="module"');if(iZ(s)&&a.trim())a=nZ(a);let b=u9(a);if(b&&!GZ){c=`stx_scope_${e.basename(M,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++i9}`;let v=DZ(a),ZZ=c9(v,c);d+=`<script data-stx-scoped>${ZZ}</script>
2672
- `;continue}if(GZ||!h&&!s.includes("src")&&!b)try{let{extractVariables:v}=await Promise.resolve().then(() => (W4(),E4));await v(a,k,M)}catch(v){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${M}:`,v)}if(h&&!b)d+=`<script${s}>${a}</script>
2673
- `}if(c)N=l9(N,c);if(N.includes("@include")||N.includes("@partial"))N=await h7(N,k,M,J,G,X);let{processLoops:P}=await Promise.resolve().then(() => (f7(),j8)),u=P(N,k,M);if(u=Z4(u,k,M),u=pZ(u,k,M),E)u+=`
2674
- `+E;if(d)u+=`
2675
- `+d;return u}catch(R){let N=R instanceof Error?R.message:String(R);return l("Include",`Error processing include ${L}: ${N}`,Y,O,A)}}let z=/@include\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,H;while(H=z.exec(K)){let[L,F,O]=H,A=H.index,M={};if(O)try{M=OZ(O,$)}catch(R){let N=R instanceof Error?R.message:String(R);K=K.replace(L,l("Include",`Error parsing include variables for ${F}: ${N}`,Y,Z,A));continue}let V=await U(F,M,Z,A);K=K.replace(L,V),z.lastIndex=0}return K}function d7(Z,$){let Y=Z;return Y=Y.replace(/@push\(['"]([^'"]+)['"]\)([\s\S]*?)@endpush/g,(J,G,X)=>{if(!$[G])$[G]=[];return $[G].push(X),""}),Y=Y.replace(/@prepend\(['"]([^'"]+)['"]\)([\s\S]*?)@endprepend/g,(J,G,X)=>{if(!$[G])$[G]=[];return $[G].unshift(X),""}),Y}function m7(Z,$){return Z.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!$[J]||$[J].length===0)return"";return $[J].join(`
2676
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",i9=0,B8,n9;var W8=I(()=>{K5();cZ();lZ();LZ();K4();MZ();B8=new j4(500),n9=new Set});import*as u7 from"path";async function z8(Z,$,Y=""){if(u7.basename(Y)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,Z.replace(/@js[\s\S]*?@endjs/g,"");return H8(Z,$,Y,"@js","@endjs")}async function U8(Z,$,Y=""){if(u7.basename(Y)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return Z.replace(/@ts[\s\S]*?@endts/g,"")}return H8(Z,$,Y,"@ts","@endts")}async function H8(Z,$,Y,J,G){let X=Z,Q=B4(`${J}([\\s\\S]*?)${G}`,"g"),K=[],q;while((q=Q.exec(Z))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:_,content:j,index:B}of K)try{let W=Object.keys($),U=Object.values($),z=j.trim();if(J==="@ts")z=z.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(z.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((V)=>V.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
2679
+ `}function oJ(Z,$){let Y=Z.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)([\s>])/s);if(Y){let[,J,G,X]=Y;if(Z.includes("data-stx-scope"))return Z;return`${J}${G} data-stx-scope="${$}"${X}${Z.slice(Y[0].length)}`}return Z}function tJ(Z){if(Z.__onceStore instanceof Set)return Z.__onceStore;return aJ}async function d7(Z,$,Y,J,G,X=new Set){let Q=J.partialsDir||$Z.join($Z.dirname(Y),"partials");if(Q&&!$Z.isAbsolute(Q)){let F=$Z.resolve(__dirname,"..");Q=$Z.resolve(F,Q)}let K=Z.replace(/@partial\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(F,O,L)=>`@include('${O}'${L?`, ${L}`:""})`),q=tJ($);K=K.replace(/@once([\s\S]*?)@endonce/g,(F,O,L)=>{let A=O.trim(),M=`${Y}:${A}`;if(q.has(M))return"";return q.add(M),O}),K=K.replace(/@includeIf\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(F,O,L)=>{let A=B(O,Q,Y);if(A&&h7.existsSync(A))return G.add(A),`@include('${O}'${L?`, ${L}`:""})`;return""}),K=K.replace(/@includeWhen\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(F,O,L,A,M)=>{try{let V=`Boolean(${O})`,N;if(JZ(V)){let R=UZ(V,Object.keys($));N=Boolean(R(...Object.values($)))}else N=Boolean(n(V,$));if(N){let R=B(L,Q,Y);if(R&&h7.existsSync(R))G.add(R);return`@include('${L}'${A?`, ${A}`:""})`}return""}catch(V){let N=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeWhen condition: ${N}`,Y,Z,M,F)}}),K=K.replace(/@includeUnless\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(F,O,L,A,M)=>{try{let V=`Boolean(${O})`,N;if(JZ(V)){let R=UZ(V,Object.keys($));N=Boolean(R(...Object.values($)))}else N=Boolean(n(V,$));if(!N){let R=B(L,Q,Y);if(R&&h7.existsSync(R))G.add(R);return`@include('${L}'${A?`, ${A}`:""})`}return""}catch(V){let N=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeUnless condition: ${N}`,Y,Z,M,F)}});let _=/@includeFirst\s*\(\s*(\[[^\]]+\])\s*(?:,\s*(\{[^}]*\})\s*)?(?:,\s*['"]([^'"]*)['"]\s*)?\)/g,j;while(j=_.exec(K)){let[F,O,L,A]=j,M=j.index;try{let V=JSON.parse(O.replace(/'/g,'"')),N={};if(L)try{N=FZ(L,$)}catch(w){let D=w instanceof Error?w.message:String(w);if(J.debug)K=K.replace(F,l("Include",`Error parsing includeFirst variables: ${D}`,Y,Z,M,F));else K=K.replace(F,A||"");continue}let R=!1;for(let w of V){let D=B(w,Q,Y);if(!D)continue;if(await p(D)){let E=await U(w,N,Z,M);K=K.replace(F,E),R=!0;break}}if(!R)if(A!==void 0)K=K.replace(F,A);else if(J.debug)K=K.replace(F,l("Include",`None of the includeFirst paths exist: ${O}`,Y,Z,M,F));else K=K.replace(F,"")}catch(V){let N=V instanceof Error?V.message:String(V);K=K.replace(F,l("Include",`Error processing @includeFirst: ${N}`,Y,Z,M,F))}_.lastIndex=0}function B(F,O,L){try{let A=F;if(!F.endsWith(".stx"))A=`${F}.stx`;let M=$Z.resolve(O),V=$Z.resolve($Z.dirname(L)),N;if(!A.startsWith("./")&&!A.startsWith("../"))N=$Z.resolve(O,A);else N=$Z.resolve(V,A);let R=$Z.normalize(N),w=R.startsWith(M+$Z.sep)||R===M,D=R.startsWith(V+$Z.sep)||R===V,E=!1,k=V;for(let T=0;T<3;T++)if(k=$Z.dirname(k),R.startsWith(k+$Z.sep)){E=!0;break}if(!w&&!D&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${F}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${M}, ${V}`),null;return R}catch(A){return console.error(`Error resolving path ${F}: ${A}`),null}}let W=$Z.resolve(Y);X.add(W);async function U(F,O={},L,A){let M=B(F,Q,Y);if(!M)return l("Include",`Could not resolve path for include: ${F}`,Y,L,A);let V=$Z.resolve(M);if(X.has(V)){let N=[...X,V].map((R)=>$Z.basename(R)).join(" -> ");return l("Include",`Circular include detected: ${N}`,Y,L,A)}try{if(!M)return l("Include",`Could not resolve path for include: ${F}`,Y,L,A);G.add(M);let N=z8.get(M);if(!N)try{N=await Bun.file(M).text(),z8.set(M,N)}catch(QZ){let s=QZ instanceof Error?QZ.message:String(QZ);return l("Include",`Error loading include file ${F}: ${s}`,Y,L,A)}let R=N,w=R.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)R=w[1].trim();let D=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),E="";if(D)E=`<style${D[1]}>${D[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...$};for(let[QZ,s]of Object.entries(O))k[QZ]=s;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...N.matchAll(T)],h="",c=null;for(let QZ of S){let s=QZ[1]||"",e=QZ[2]||"",KZ=s.includes("server"),g=s.includes("client")||s.includes('type="module"');if(iZ(s)&&e.trim())e=EZ(e);let d=iJ(e);if(d&&!KZ){c=`stx_scope_${$Z.basename(M,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++rJ}`;let x=DZ(e),r=sJ(x,c);h+=`<script data-stx-scoped>${r}</script>
2680
+ `;continue}if(KZ||!g&&!s.includes("src")&&!d)try{let{extractVariables:x}=await Promise.resolve().then(() => (j4(),I4));await x(e,k,M)}catch(x){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${M}:`,x)}if(g&&!d)h+=`<script${s}>${e}</script>
2681
+ `}if(c)R=oJ(R,c);if(R.includes("@include")||R.includes("@partial"))R=await d7(R,k,M,J,G,X);let{processLoops:b}=await Promise.resolve().then(() => (g7(),W8)),u=b(R,k,M);if(u=Z4(u,k,M),u=pZ(u,k,M),E)u+=`
2682
+ `+E;if(h)u+=`
2683
+ `+h;return u}catch(N){let R=N instanceof Error?N.message:String(N);return l("Include",`Error processing include ${F}: ${R}`,Y,L,A)}}let z=/@include\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,H;while(H=z.exec(K)){let[F,O,L]=H,A=H.index,M={};if(L)try{M=FZ(L,$)}catch(N){let R=N instanceof Error?N.message:String(N);K=K.replace(F,l("Include",`Error parsing include variables for ${O}: ${R}`,Y,Z,A));continue}let V=await U(O,M,Z,A);K=K.replace(F,V),z.lastIndex=0}return K}function m7(Z,$){let Y=Z;return Y=Y.replace(/@push\(['"]([^'"]+)['"]\)([\s\S]*?)@endpush/g,(J,G,X)=>{if(!$[G])$[G]=[];return $[G].push(X),""}),Y=Y.replace(/@prepend\(['"]([^'"]+)['"]\)([\s\S]*?)@endprepend/g,(J,G,X)=>{if(!$[G])$[G]=[];return $[G].unshift(X),""}),Y}function u7(Z,$){return Z.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!$[J]||$[J].length===0)return"";return $[J].join(`
2684
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",rJ=0,z8,aJ;var U8=I(()=>{_5();cZ();lZ();AZ();K4();NZ();z8=new q4(500),aJ=new Set});import*as p7 from"path";async function H8(Z,$,Y=""){if(p7.basename(Y)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,Z.replace(/@js[\s\S]*?@endjs/g,"");return L8(Z,$,Y,"@js","@endjs")}async function O8(Z,$,Y=""){if(p7.basename(Y)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return Z.replace(/@ts[\s\S]*?@endts/g,"")}return L8(Z,$,Y,"@ts","@endts")}async function L8(Z,$,Y,J,G){let X=Z,Q=_4(`${J}([\\s\\S]*?)${G}`,"g"),K=[],q;while((q=Q.exec(Z))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:_,content:j,index:B}of K)try{let W=Object.keys($),U=Object.values($),z=j.trim();if(J==="@ts")z=z.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let F=(z.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((V)=>V.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=F.length>0?`return { ${F.join(", ")} };`:"return {};",L=`
2677
2685
  ${z}
2678
- ${F}
2679
- `,M=Function(...W,O)(...U);if(M&&typeof M==="object")Object.assign($,M);X=X.replace(_,"")}catch(W){console.error(`Error executing ${J} code block in ${Y}:`,W);let U=W instanceof Error?W.message:String(W),z=l(`${J} Directive`,`Error executing code: ${U}`,Y,Z,B,_);console.error(z),X=X.replace(_,"")}return X}var O8=I(()=>{lZ();MZ()});function o9(Z,$="_method"){let Y=Z.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${$}" value="${Y}">`}function L8(Z){return Z.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Y,J,G,X)=>{return o9(J,X||"_method")})}async function F8(Z,$,Y,J,G){if(!J.middleware||J.middleware.length===0)return Z;let X=Z,Q=J.middleware.filter((K)=>K.timing===G);if(Q.length===0)return X;for(let K of Q){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,$,Y,J);if(typeof q==="string")X=q;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${K.name}:`,q);if(J.debug){let _=l("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,Z);X=X.replace(/<body[^>]*>/,`$&
2680
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${D4(_)}</div>
2681
- `)}}}return X}async function A8(Z,$,Y,J){return F8(Z,$,Y,J,"before")}async function R8(Z,$,Y,J){return F8(Z,$,Y,J,"after")}var N8=I(()=>{cZ();MZ()});function a9(Z,$={},Y=!1){let J=r9[Z];if(!J)return console.warn(`Route [${Z}] not defined.`),"#undefined-route";let G={...J.params,...$},X=J.path;X=X.replace(/:(\w+)/g,(K,q)=>{let _=G[q];if(_===void 0)return console.warn(`Missing parameter [${q}] for route [${Z}].`),`:${q}`;return delete G[q],encodeURIComponent(String(_))});let Q=Object.entries(G);if(Q.length>0){let K=Q.map(([q,_])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(_))}`).join("&");X+=(X.includes("?")?"&":"?")+K}return Y&&V8?`${V8}${X}`:X}function M8(Z){return Z.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Y,J,G,X)=>{try{let Q=G?OZ(G,{}):{};return a9(J,Q,X==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var r9,V8="";var w8=I(()=>{LZ();r9={}});async function T8(Z,$){let Y=Z.split("/").pop()?.split(".")[0]||"";if(N4.exact[Z])for(let J of N4.exact[Z])await Promise.resolve(J($,Z));if(N4.exact[Y])for(let J of N4.exact[Y])await Promise.resolve(J($,Z));for(let{pattern:J,callback:G}of N4.patterns)if(J.test(Z)||J.test(Y))await Promise.resolve(G($,Z))}var N4;var I8=I(()=>{N4={patterns:[],exact:{}}});function D8(){return p7().replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n\s*/g," ").replace(/\s+/g," ").replace(/\s*([{}();,:])\s*/g,"$1").replace(/;\}/g,"}").trim()}function p7(){return`
2686
+ ${O}
2687
+ `,M=Function(...W,L)(...U);if(M&&typeof M==="object")Object.assign($,M);X=X.replace(_,"")}catch(W){console.error(`Error executing ${J} code block in ${Y}:`,W);let U=W instanceof Error?W.message:String(W),z=l(`${J} Directive`,`Error executing code: ${U}`,Y,Z,B,_);console.error(z),X=X.replace(_,"")}return X}var F8=I(()=>{lZ();NZ()});function eJ(Z,$="_method"){let Y=Z.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${$}" value="${Y}">`}function A8(Z){return Z.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Y,J,G,X)=>{return eJ(J,X||"_method")})}async function N8(Z,$,Y,J,G){if(!J.middleware||J.middleware.length===0)return Z;let X=Z,Q=J.middleware.filter((K)=>K.timing===G);if(Q.length===0)return X;for(let K of Q){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,$,Y,J);if(typeof q==="string")X=q;else if(J.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${K.name}:`,q);if(J.debug){let _=l("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,Z);X=X.replace(/<body[^>]*>/,`$&
2688
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${T4(_)}</div>
2689
+ `)}}}return X}async function R8(Z,$,Y,J){return N8(Z,$,Y,J,"before")}async function V8(Z,$,Y,J){return N8(Z,$,Y,J,"after")}var M8=I(()=>{cZ();NZ()});function $2(Z,$={},Y=!1){let J=Z2[Z];if(!J)return console.warn(`Route [${Z}] not defined.`),"#undefined-route";let G={...J.params,...$},X=J.path;X=X.replace(/:(\w+)/g,(K,q)=>{let _=G[q];if(_===void 0)return console.warn(`Missing parameter [${q}] for route [${Z}].`),`:${q}`;return delete G[q],encodeURIComponent(String(_))});let Q=Object.entries(G);if(Q.length>0){let K=Q.map(([q,_])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(_))}`).join("&");X+=(X.includes("?")?"&":"?")+K}return Y&&w8?`${w8}${X}`:X}function T8(Z){return Z.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Y,J,G,X)=>{try{let Q=G?FZ(G,{}):{};return $2(J,Q,X==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var Z2,w8="";var I8=I(()=>{AZ();Z2={}});async function D8(Z,$){let Y=Z.split("/").pop()?.split(".")[0]||"";if(N4.exact[Z])for(let J of N4.exact[Z])await Promise.resolve(J($,Z));if(N4.exact[Y])for(let J of N4.exact[Y])await Promise.resolve(J($,Z));for(let{pattern:J,callback:G}of N4.patterns)if(J.test(Z)||J.test(Y))await Promise.resolve(G($,Z))}var N4;var E8=I(()=>{N4={patterns:[],exact:{}}});function k8(){return c7().replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n\s*/g," ").replace(/\s+/g," ").replace(/\s*([{}();,:])\s*/g,"$1").replace(/;\}/g,"}").trim()}function c7(){return`
2682
2690
  // STX Signals Runtime (Development Build)
2683
2691
  (function() {
2684
2692
  'use strict';
@@ -3255,6 +3263,220 @@ ${Z}
3255
3263
  };
3256
3264
  }
3257
3265
 
3266
+ // ==========================================================================
3267
+ // Template Refs (useRef)
3268
+ // ==========================================================================
3269
+
3270
+ function useRef(name) {
3271
+ return {
3272
+ get current() {
3273
+ return componentScope.$refs ? componentScope.$refs[name] : null;
3274
+ },
3275
+ get value() {
3276
+ return this.current;
3277
+ }
3278
+ };
3279
+ }
3280
+
3281
+ // ==========================================================================
3282
+ // Navigation API
3283
+ // ==========================================================================
3284
+
3285
+ function navigate(url) {
3286
+ if (window.stxRouter && typeof window.stxRouter.navigate === 'function') {
3287
+ window.stxRouter.navigate(url);
3288
+ } else {
3289
+ window.location.href = url;
3290
+ }
3291
+ }
3292
+
3293
+ function goBack() { window.history.back(); }
3294
+ function goForward() { window.history.forward(); }
3295
+
3296
+ function useRoute() {
3297
+ return {
3298
+ get path() { return window.location.pathname; },
3299
+ get fullPath() { return window.location.pathname + window.location.search + window.location.hash; },
3300
+ get hash() { return window.location.hash; },
3301
+ get query() {
3302
+ var params = {};
3303
+ new URLSearchParams(window.location.search).forEach(function(v, k) { params[k] = v; });
3304
+ return params;
3305
+ },
3306
+ get params() { return window.stxRouter && window.stxRouter.params ? window.stxRouter.params : {}; }
3307
+ };
3308
+ }
3309
+
3310
+ function useSearchParams() {
3311
+ var params = state(Object.fromEntries(new URLSearchParams(window.location.search)));
3312
+ var syncFromUrl = function() {
3313
+ params.set(Object.fromEntries(new URLSearchParams(window.location.search)));
3314
+ };
3315
+ window.addEventListener('popstate', syncFromUrl);
3316
+ window.addEventListener('stx:navigate', syncFromUrl);
3317
+ return {
3318
+ data: params,
3319
+ get: function(key) { return params()[key]; },
3320
+ set: function(key, value) {
3321
+ var url = new URL(window.location.href);
3322
+ url.searchParams.set(key, value);
3323
+ window.history.pushState({}, '', url);
3324
+ syncFromUrl();
3325
+ },
3326
+ setAll: function(obj) {
3327
+ var url = new URL(window.location.href);
3328
+ Object.keys(obj).forEach(function(k) { url.searchParams.set(k, obj[k]); });
3329
+ window.history.pushState({}, '', url);
3330
+ syncFromUrl();
3331
+ }
3332
+ };
3333
+ }
3334
+
3335
+ // ==========================================================================
3336
+ // Advanced Data Fetching (useQuery / useMutation)
3337
+ // ==========================================================================
3338
+
3339
+ var _queryCache = {};
3340
+
3341
+ function useQuery(url, options) {
3342
+ options = options || {};
3343
+ var staleTime = options.staleTime || 0;
3344
+ var cacheTime = options.cacheTime || 300000; // 5 min default
3345
+ var cacheKey = options.cacheKey || (typeof url === 'function' ? null : url);
3346
+ var data = state(options.initialData || null);
3347
+ var loading = state(true);
3348
+ var error = state(null);
3349
+ var isStale = state(false);
3350
+
3351
+ var fetchData = async function() {
3352
+ var resolvedUrl = typeof url === 'function' ? url() : url;
3353
+ if (!resolvedUrl) { loading.set(false); return; }
3354
+ var key = cacheKey || resolvedUrl;
3355
+
3356
+ // Check cache
3357
+ var cached = _queryCache[key];
3358
+ if (cached && (Date.now() - cached.timestamp < staleTime)) {
3359
+ data.set(cached.data);
3360
+ loading.set(false);
3361
+ isStale.set(false);
3362
+ if (options.onSuccess) options.onSuccess(cached.data);
3363
+ return;
3364
+ }
3365
+
3366
+ // Stale-while-revalidate
3367
+ if (cached) {
3368
+ data.set(cached.data);
3369
+ isStale.set(true);
3370
+ }
3371
+
3372
+ loading.set(true);
3373
+ error.set(null);
3374
+ try {
3375
+ var fetchOpts = { method: 'GET', headers: { 'Content-Type': 'application/json', ...(options.headers || {}) } };
3376
+ var response = await fetch(resolvedUrl, fetchOpts);
3377
+ if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + response.statusText);
3378
+ var result = await response.json();
3379
+ var transformed = options.transform ? options.transform(result) : result;
3380
+ data.set(transformed);
3381
+ isStale.set(false);
3382
+ _queryCache[key] = { data: transformed, timestamp: Date.now() };
3383
+ if (options.onSuccess) options.onSuccess(transformed);
3384
+ // Schedule cache eviction
3385
+ setTimeout(function() { delete _queryCache[key]; }, cacheTime);
3386
+ } catch (e) {
3387
+ error.set(e.message || 'Query failed');
3388
+ if (options.onError) options.onError(e);
3389
+ } finally {
3390
+ loading.set(false);
3391
+ }
3392
+ };
3393
+
3394
+ if (options.immediate !== false) {
3395
+ onMount(fetchData);
3396
+ }
3397
+
3398
+ // refetchOnFocus
3399
+ if (options.refetchOnFocus) {
3400
+ document.addEventListener('visibilitychange', function() {
3401
+ if (!document.hidden) fetchData();
3402
+ });
3403
+ }
3404
+
3405
+ // refetchInterval
3406
+ if (options.refetchInterval) {
3407
+ var intervalId = setInterval(fetchData, options.refetchInterval);
3408
+ onDestroy(function() { clearInterval(intervalId); });
3409
+ }
3410
+
3411
+ return {
3412
+ data: data,
3413
+ loading: loading,
3414
+ error: error,
3415
+ isStale: isStale,
3416
+ refetch: fetchData,
3417
+ invalidate: function() {
3418
+ var key = cacheKey || (typeof url === 'function' ? url() : url);
3419
+ delete _queryCache[key];
3420
+ return fetchData();
3421
+ }
3422
+ };
3423
+ }
3424
+
3425
+ function useMutation(url, options) {
3426
+ options = options || {};
3427
+ var data = state(null);
3428
+ var loading = state(false);
3429
+ var error = state(null);
3430
+
3431
+ var mutate = async function(body) {
3432
+ loading.set(true);
3433
+ error.set(null);
3434
+ var previousData = data();
3435
+
3436
+ // Optimistic update
3437
+ if (options.optimisticData) {
3438
+ var optimistic = typeof options.optimisticData === 'function' ? options.optimisticData(body) : options.optimisticData;
3439
+ data.set(optimistic);
3440
+ }
3441
+
3442
+ try {
3443
+ var resolvedUrl = typeof url === 'function' ? url() : url;
3444
+ var fetchOpts = {
3445
+ method: options.method || 'POST',
3446
+ headers: { 'Content-Type': 'application/json', ...(options.headers || {}) },
3447
+ body: typeof body === 'string' ? body : JSON.stringify(body)
3448
+ };
3449
+ var response = await fetch(resolvedUrl, fetchOpts);
3450
+ if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + response.statusText);
3451
+ var result = await response.json();
3452
+ var transformed = options.transform ? options.transform(result) : result;
3453
+ data.set(transformed);
3454
+ if (options.onSuccess) options.onSuccess(transformed);
3455
+ // Invalidate related queries
3456
+ if (options.invalidateQueries) {
3457
+ options.invalidateQueries.forEach(function(key) { delete _queryCache[key]; });
3458
+ }
3459
+ return transformed;
3460
+ } catch (e) {
3461
+ error.set(e.message || 'Mutation failed');
3462
+ // Rollback optimistic update
3463
+ if (options.optimisticData) data.set(previousData);
3464
+ if (options.onError) options.onError(e);
3465
+ throw e;
3466
+ } finally {
3467
+ loading.set(false);
3468
+ }
3469
+ };
3470
+
3471
+ return {
3472
+ data: data,
3473
+ loading: loading,
3474
+ error: error,
3475
+ mutate: mutate,
3476
+ reset: function() { data.set(null); error.set(null); loading.set(false); }
3477
+ };
3478
+ }
3479
+
3258
3480
  // ==========================================================================
3259
3481
  // Template Binding
3260
3482
  // ==========================================================================
@@ -3445,8 +3667,16 @@ ${Z}
3445
3667
  span.textContent = fn(...Object.values(unwrapScope));
3446
3668
  }
3447
3669
  } catch (e) {
3448
- console.warn('[STX] Expression error:', expr, e);
3449
- span.textContent = '';
3670
+ // Auto-unwrap can break explicit signal calls like errorData().message
3671
+ // because it converts the signal to its value before the expression runs.
3672
+ // Retry without auto-unwrap so signal functions remain callable.
3673
+ try {
3674
+ const fn = new Function(...Object.keys(capturedScope), 'return ' + expr);
3675
+ span.textContent = fn(...Object.values(capturedScope));
3676
+ } catch (e2) {
3677
+ console.warn('[STX] Expression error:', expr, e2);
3678
+ span.textContent = '';
3679
+ }
3450
3680
  }
3451
3681
  });
3452
3682
  } else if (part) {
@@ -3461,26 +3691,28 @@ ${Z}
3461
3691
 
3462
3692
  if (el.nodeType !== Node.ELEMENT_NODE) return;
3463
3693
 
3464
- // Handle @for first (reactive list)
3465
- if (el.hasAttribute('@for')) {
3466
- bindFor(el, scope);
3694
+ // Handle @for / :for first (reactive list)
3695
+ if (el.hasAttribute('@for') || el.hasAttribute(':for')) {
3696
+ bindFor(el, scope, el.hasAttribute(':for') ? ':for' : '@for');
3467
3697
  return;
3468
3698
  }
3469
3699
 
3470
- // Handle @if (conditional rendering)
3471
- if (el.hasAttribute('@if')) {
3472
- bindIf(el, scope);
3700
+ // Handle @if / :if (conditional rendering)
3701
+ if (el.hasAttribute('@if') || el.hasAttribute(':if')) {
3702
+ bindIf(el, scope, el.hasAttribute(':if') ? ':if' : '@if');
3473
3703
  return;
3474
3704
  }
3475
3705
 
3476
- // Handle @show (visibility toggle - keeps element in DOM)
3477
- if (el.hasAttribute('@show')) {
3478
- bindShow(el, el.getAttribute('@show'), scope);
3706
+ // Handle @show / :show (visibility toggle - keeps element in DOM)
3707
+ if (el.hasAttribute('@show') || el.hasAttribute(':show')) {
3708
+ var showAttr = el.hasAttribute(':show') ? ':show' : '@show';
3709
+ bindShow(el, el.getAttribute(showAttr), scope, showAttr);
3479
3710
  }
3480
3711
 
3481
- // Handle @model (two-way binding)
3482
- if (el.hasAttribute('@model')) {
3483
- bindModel(el, el.getAttribute('@model'), scope);
3712
+ // Handle @model / :model (two-way binding)
3713
+ if (el.hasAttribute('@model') || el.hasAttribute(':model')) {
3714
+ var modelAttr = el.hasAttribute(':model') ? ':model' : '@model';
3715
+ bindModel(el, el.getAttribute(modelAttr), scope, modelAttr);
3484
3716
  }
3485
3717
 
3486
3718
  // Capture scope once for all attribute bindings on this element
@@ -3503,18 +3735,33 @@ ${Z}
3503
3735
  const fn = new Function(...Object.keys(attrCapturedScope), 'return ' + expr);
3504
3736
  return fn(...Object.values(unwrapScope));
3505
3737
  } catch (e) {
3506
- console.warn('[STX] Attribute expression error:', expr, e);
3507
- return '';
3738
+ // Auto-unwrap can break explicit signal calls like errorData().message
3739
+ // Retry without auto-unwrap so signal functions remain callable
3740
+ try {
3741
+ const fn = new Function(...Object.keys(attrCapturedScope), 'return ' + expr);
3742
+ return fn(...Object.values(attrCapturedScope));
3743
+ } catch (e2) {
3744
+ console.warn('[STX] Attribute expression error:', expr, e2);
3745
+ return '';
3746
+ }
3508
3747
  }
3509
3748
  };
3510
3749
 
3750
+ // Known directive names to exclude from generic :attr binding
3751
+ var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
3752
+ var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
3753
+ var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
3754
+
3511
3755
  // Handle attributes
3512
3756
  Array.from(el.attributes).forEach(attr => {
3513
3757
  const name = attr.name;
3514
3758
  const value = attr.value;
3515
3759
 
3516
3760
  // @bind:attr OR :attr shorthand (Feature #4) for dynamic attribute binding
3517
- if (name.startsWith('@bind:') || (name.startsWith(':') && !name.startsWith('::'))) {
3761
+ // Only match :attr that is NOT a known directive and NOT an event name
3762
+ if (name.startsWith('@bind:') || (name.startsWith(':') && !name.startsWith('::')
3763
+ && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]]
3764
+ && !EVENT_RE.test(name.slice(1)))) {
3518
3765
  const attrName = name.startsWith('@bind:') ? name.slice(6) : name.slice(1);
3519
3766
  effect(() => {
3520
3767
  const v = evalAttrExpr(value);
@@ -3527,37 +3774,63 @@ ${Z}
3527
3774
  }
3528
3775
  });
3529
3776
  el.removeAttribute(name);
3530
- } else if (name === '@class') {
3777
+ } else if (name === '@class' || name === ':class') {
3531
3778
  bindClass(el, value, scope);
3532
3779
  el.removeAttribute(name);
3533
- } else if (name === '@style') {
3780
+ } else if (name === '@style' || name === ':style') {
3534
3781
  bindStyle(el, value, scope);
3535
3782
  el.removeAttribute(name);
3536
- } else if (name === '@text') {
3783
+ } else if (name === '@text' || name === ':text') {
3537
3784
  effect(() => {
3538
3785
  el.textContent = evalAttrExpr(value);
3539
3786
  });
3540
3787
  el.removeAttribute(name);
3541
- } else if (name === '@html') {
3788
+ } else if (name === '@html' || name === ':html') {
3542
3789
  effect(() => {
3543
3790
  el.innerHTML = evalAttrExpr(value);
3544
3791
  });
3545
3792
  el.removeAttribute(name);
3546
- } else if (name.startsWith('@')) {
3547
- // Event handlers: @click, @submit.prevent, etc.
3793
+ } else if (name === ':ref' || name === 'data-stx-ref') {
3794
+ // Store ref in scope.$refs (from :ref directive or build-time ref="name" transform)
3795
+ if (scope.$refs) scope.$refs[value] = el;
3796
+ el.removeAttribute(name);
3797
+ } else if (name.startsWith('@') || name.startsWith(':')) {
3798
+ // Event handlers: @click, :click, @submit.prevent, :keydown.enter, etc.
3548
3799
  const parts = name.slice(1).split('.');
3549
3800
  const eventName = parts[0];
3550
3801
  const modifiers = parts.slice(1);
3551
3802
 
3552
3803
  // Skip special directives (already handled above or in processElement)
3553
- if (['if', 'for', 'show', 'model', 'class', 'style', 'text', 'html'].includes(eventName)) {
3804
+ if (['if', 'for', 'show', 'model', 'class', 'style', 'text', 'html', 'ref'].includes(eventName)) {
3554
3805
  return;
3555
3806
  }
3556
3807
 
3808
+ // Capture scope at setup time so @for loop variables are available when event fires
3809
+ const eventCapturedScope = { ...scope, ...(findElementScope(el) || {}), ...globalHelpers };
3810
+
3557
3811
  el.addEventListener(eventName, (event) => {
3812
+ // System key modifiers
3813
+ if (modifiers.includes('self') && event.target !== el) return;
3814
+ if (modifiers.includes('ctrl') && !event.ctrlKey) return;
3815
+ if (modifiers.includes('alt') && !event.altKey) return;
3816
+ if (modifiers.includes('shift') && !event.shiftKey) return;
3817
+ if (modifiers.includes('meta') && !event.metaKey) return;
3818
+ // Key modifiers
3819
+ for (var mi = 0; mi < modifiers.length; mi++) {
3820
+ if (KEY_MAP[modifiers[mi]] && event.key !== KEY_MAP[modifiers[mi]]) return;
3821
+ }
3558
3822
  if (modifiers.includes('prevent')) event.preventDefault();
3559
3823
  if (modifiers.includes('stop')) event.stopPropagation();
3560
- executeHandler(value, event, el);
3824
+ // Execute with captured scope (includes @for loop variables)
3825
+ try {
3826
+ if (!value || /^__[A-Z_]+__$/.test(value.trim())) return;
3827
+ var shorthandFn = parseEventShorthand(value, eventCapturedScope);
3828
+ if (shorthandFn) { shorthandFn(); return; }
3829
+ var fn = new Function(...Object.keys(eventCapturedScope), '$event', value);
3830
+ fn(...Object.values(eventCapturedScope), event);
3831
+ } catch (e) {
3832
+ console.warn('[STX] Handler error:', value, e);
3833
+ }
3561
3834
  }, {
3562
3835
  capture: modifiers.includes('capture'),
3563
3836
  passive: modifiers.includes('passive'),
@@ -3571,7 +3844,7 @@ ${Z}
3571
3844
  Array.from(el.childNodes).forEach(child => processElement(child, scope));
3572
3845
  }
3573
3846
 
3574
- function bindShow(el, expr, passedScope = componentScope) {
3847
+ function bindShow(el, expr, passedScope = componentScope, attrName = '@show') {
3575
3848
  const originalDisplay = el.style.display || '';
3576
3849
  // Capture scope at setup time - use passed scope to preserve context
3577
3850
  const capturedScope = { ...passedScope, ...(findElementScope(el) || {}) };
@@ -3589,10 +3862,10 @@ ${Z}
3589
3862
  effect(() => {
3590
3863
  el.style.display = evalExpr() ? originalDisplay : 'none';
3591
3864
  });
3592
- el.removeAttribute('@show');
3865
+ el.removeAttribute(attrName);
3593
3866
  }
3594
3867
 
3595
- function bindModel(el, expr, passedScope = componentScope) {
3868
+ function bindModel(el, expr, passedScope = componentScope, attrName = '@model') {
3596
3869
  const tag = el.tagName.toLowerCase();
3597
3870
  const type = el.type;
3598
3871
 
@@ -3610,7 +3883,7 @@ ${Z}
3610
3883
  fn(...Object.values(scope), val);
3611
3884
  }
3612
3885
  } catch (e) {
3613
- console.warn('[STX] @model set error:', expr, e);
3886
+ console.warn('[STX] ' + attrName + ' set error:', expr, e);
3614
3887
  }
3615
3888
  };
3616
3889
 
@@ -3625,7 +3898,7 @@ ${Z}
3625
3898
  el.addEventListener('input', () => setValue(el.value));
3626
3899
  }
3627
3900
 
3628
- el.removeAttribute('@model');
3901
+ el.removeAttribute(attrName);
3629
3902
  }
3630
3903
 
3631
3904
  function bindClass(el, expr, passedScope = componentScope) {
@@ -3681,12 +3954,12 @@ ${Z}
3681
3954
  });
3682
3955
  }
3683
3956
 
3684
- function bindFor(el, passedScope = componentScope) {
3685
- const expr = el.getAttribute('@for');
3957
+ function bindFor(el, passedScope = componentScope, attrName = '@for') {
3958
+ const expr = el.getAttribute(attrName);
3686
3959
  const match = expr.match(/^\\s*(\\w+)(?:\\s*,\\s*(\\w+))?\\s+(?:in|of)\\s+(.+)\\s*$/);
3687
3960
 
3688
3961
  if (!match) {
3689
- console.warn('[STX] Invalid @for:', expr);
3962
+ console.warn('[STX] Invalid ' + attrName + ':', expr);
3690
3963
  return;
3691
3964
  }
3692
3965
 
@@ -3702,8 +3975,8 @@ ${Z}
3702
3975
  const placeholder = document.createComment('stx-for');
3703
3976
  const isTemplate = el.tagName === 'TEMPLATE';
3704
3977
 
3705
- // Check if element also has @if - need to handle together
3706
- const ifExpr = el.getAttribute('@if');
3978
+ // Check if element also has @if / :if - need to handle together
3979
+ const ifExpr = el.getAttribute('@if') || el.getAttribute(':if');
3707
3980
 
3708
3981
  // Feature #3: Check for @loading and @empty siblings/content
3709
3982
  const loadingExpr = el.getAttribute('@loading');
@@ -3746,10 +4019,11 @@ ${Z}
3746
4019
  } else {
3747
4020
  const wrapper = el.cloneNode(true);
3748
4021
  wrapper.removeAttribute('@for');
4022
+ wrapper.removeAttribute(':for');
3749
4023
  wrapper.removeAttribute('@loading');
3750
4024
  wrapper.removeAttribute('@empty');
3751
- // Also remove @if - we'll handle it inline
3752
- if (ifExpr) wrapper.removeAttribute('@if');
4025
+ // Also remove @if / :if - we'll handle it inline
4026
+ if (ifExpr) { wrapper.removeAttribute('@if'); wrapper.removeAttribute(':if'); }
3753
4027
  templateContent = wrapper;
3754
4028
  }
3755
4029
 
@@ -3881,8 +4155,8 @@ ${Z}
3881
4155
  });
3882
4156
  }
3883
4157
 
3884
- function bindIf(el, passedScope = componentScope) {
3885
- const expr = el.getAttribute('@if');
4158
+ function bindIf(el, passedScope = componentScope, attrName = '@if') {
4159
+ const expr = el.getAttribute(attrName);
3886
4160
  const parent = el.parentNode;
3887
4161
 
3888
4162
  // Guard: if element has no parent, it's detached - skip processing
@@ -3904,7 +4178,7 @@ ${Z}
3904
4178
  const capturedComponentScope = { ...passedScope };
3905
4179
 
3906
4180
  parent.insertBefore(placeholder, el);
3907
- el.removeAttribute('@if');
4181
+ el.removeAttribute(attrName);
3908
4182
 
3909
4183
  if (isTemplate) {
3910
4184
  // For templates, we need to handle the content fragment
@@ -4013,6 +4287,390 @@ ${Z}
4013
4287
  });
4014
4288
  }
4015
4289
 
4290
+ // provide() \u2014 share values across components (like Vue's provide/inject)
4291
+ // Usage: provide('Modal', Modal) \u2014 makes Modal accessible in all components
4292
+ function provide(name, value) {
4293
+ window[name] = value;
4294
+ }
4295
+
4296
+ // ==========================================================================
4297
+ // Timer & Utility Composables
4298
+ // ==========================================================================
4299
+
4300
+ function useDebounce(fn, delay) {
4301
+ delay = delay || 250;
4302
+ var timer = null;
4303
+ var lastArgs = null;
4304
+ var debounced = function() {
4305
+ lastArgs = Array.prototype.slice.call(arguments);
4306
+ if (timer !== null) clearTimeout(timer);
4307
+ var args = lastArgs;
4308
+ timer = setTimeout(function() {
4309
+ timer = null;
4310
+ lastArgs = null;
4311
+ fn.apply(null, args);
4312
+ }, delay);
4313
+ };
4314
+ debounced.cancel = function() {
4315
+ if (timer !== null) { clearTimeout(timer); timer = null; lastArgs = null; }
4316
+ };
4317
+ debounced.flush = function() {
4318
+ if (timer !== null && lastArgs !== null) {
4319
+ clearTimeout(timer); timer = null;
4320
+ var args = lastArgs; lastArgs = null;
4321
+ fn.apply(null, args);
4322
+ }
4323
+ };
4324
+ debounced.pending = function() { return timer !== null; };
4325
+ onDestroy(debounced.cancel);
4326
+ return debounced;
4327
+ }
4328
+
4329
+ function useDebouncedValue(getter, delay) {
4330
+ delay = delay || 250;
4331
+ var current = getter();
4332
+ var listeners = [];
4333
+ var timer = null;
4334
+ function schedule() {
4335
+ if (timer !== null) clearTimeout(timer);
4336
+ timer = setTimeout(function() {
4337
+ timer = null;
4338
+ var next = getter();
4339
+ if (next !== current) {
4340
+ current = next;
4341
+ listeners.forEach(function(fn) { fn(current); });
4342
+ }
4343
+ }, delay);
4344
+ }
4345
+ schedule();
4346
+ onDestroy(function() { if (timer !== null) clearTimeout(timer); listeners = []; });
4347
+ return {
4348
+ get value() { return current; },
4349
+ subscribe: function(fn) {
4350
+ listeners.push(fn);
4351
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4352
+ }
4353
+ };
4354
+ }
4355
+
4356
+ function useThrottle(fn, limit) {
4357
+ limit = limit || 250;
4358
+ var timer = null;
4359
+ var lastRan = 0;
4360
+ var throttled = function() {
4361
+ var args = Array.prototype.slice.call(arguments);
4362
+ var now = Date.now();
4363
+ var remaining = limit - (now - lastRan);
4364
+ if (remaining <= 0) {
4365
+ if (timer !== null) { clearTimeout(timer); timer = null; }
4366
+ lastRan = now;
4367
+ fn.apply(null, args);
4368
+ } else if (timer === null) {
4369
+ timer = setTimeout(function() {
4370
+ lastRan = Date.now();
4371
+ timer = null;
4372
+ fn.apply(null, args);
4373
+ }, remaining);
4374
+ }
4375
+ };
4376
+ throttled.cancel = function() {
4377
+ if (timer !== null) { clearTimeout(timer); timer = null; }
4378
+ };
4379
+ onDestroy(throttled.cancel);
4380
+ return throttled;
4381
+ }
4382
+
4383
+ function useInterval(interval, options) {
4384
+ interval = interval || 1000;
4385
+ options = options || {};
4386
+ var count = 0;
4387
+ var id = null;
4388
+ var running = false;
4389
+ var listeners = [];
4390
+ function tick() {
4391
+ count++;
4392
+ listeners.forEach(function(fn) { fn(count); });
4393
+ }
4394
+ function resume() {
4395
+ if (running) return;
4396
+ running = true;
4397
+ id = setInterval(tick, interval);
4398
+ if (options.immediate) tick();
4399
+ }
4400
+ function pause() {
4401
+ if (!running) return;
4402
+ running = false;
4403
+ if (id !== null) { clearInterval(id); id = null; }
4404
+ }
4405
+ function reset() {
4406
+ pause();
4407
+ count = 0;
4408
+ listeners.forEach(function(fn) { fn(count); });
4409
+ resume();
4410
+ }
4411
+ resume();
4412
+ onDestroy(function() { pause(); listeners = []; });
4413
+ return {
4414
+ get counter() { return count; },
4415
+ pause: pause,
4416
+ resume: resume,
4417
+ reset: reset,
4418
+ subscribe: function(fn) {
4419
+ listeners.push(fn);
4420
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4421
+ }
4422
+ };
4423
+ }
4424
+
4425
+ function useTimeout(callback, delay) {
4426
+ delay = delay || 1000;
4427
+ var timer = null;
4428
+ var pending = false;
4429
+ var listeners = [];
4430
+ function setPending(v) {
4431
+ if (v !== pending) {
4432
+ pending = v;
4433
+ listeners.forEach(function(fn) { fn(pending); });
4434
+ }
4435
+ }
4436
+ function start() {
4437
+ stop();
4438
+ setPending(true);
4439
+ timer = setTimeout(function() {
4440
+ timer = null;
4441
+ setPending(false);
4442
+ callback();
4443
+ }, delay);
4444
+ }
4445
+ function stop() {
4446
+ if (timer !== null) { clearTimeout(timer); timer = null; }
4447
+ setPending(false);
4448
+ }
4449
+ start();
4450
+ onDestroy(stop);
4451
+ return {
4452
+ get isPending() { return pending; },
4453
+ start: start,
4454
+ stop: stop,
4455
+ subscribe: function(fn) {
4456
+ listeners.push(fn);
4457
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4458
+ }
4459
+ };
4460
+ }
4461
+
4462
+ function useToggle(initial) {
4463
+ var current = !!initial;
4464
+ var listeners = [];
4465
+ function notify() { listeners.forEach(function(fn) { fn(current); }); }
4466
+ function toggle() { current = !current; notify(); }
4467
+ function set(v) { v = !!v; if (v !== current) { current = v; notify(); } }
4468
+ var ref = {
4469
+ get value() { return current; },
4470
+ subscribe: function(fn) {
4471
+ listeners.push(fn);
4472
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4473
+ }
4474
+ };
4475
+ return [ref, toggle, set];
4476
+ }
4477
+
4478
+ function useCounter(initial, options) {
4479
+ initial = initial || 0;
4480
+ options = options || {};
4481
+ var min = options.min != null ? options.min : -Infinity;
4482
+ var max = options.max != null ? options.max : Infinity;
4483
+ function clamp(v) { return Math.min(max, Math.max(min, v)); }
4484
+ var current = clamp(initial);
4485
+ var listeners = [];
4486
+ function notify() { listeners.forEach(function(fn) { fn(current); }); }
4487
+ return {
4488
+ get count() { return current; },
4489
+ inc: function(step) { current = clamp(current + (step || 1)); notify(); },
4490
+ dec: function(step) { current = clamp(current - (step || 1)); notify(); },
4491
+ set: function(v) { current = clamp(v); notify(); },
4492
+ reset: function() { current = clamp(initial); notify(); },
4493
+ subscribe: function(fn) {
4494
+ listeners.push(fn);
4495
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4496
+ }
4497
+ };
4498
+ }
4499
+
4500
+ function useClickOutside(target, handler) {
4501
+ function listener(event) {
4502
+ var el = typeof target === 'string' ? document.querySelector(target) : target;
4503
+ if (!el) return;
4504
+ if (el === event.target || el.contains(event.target)) return;
4505
+ handler(event);
4506
+ }
4507
+ document.addEventListener('pointerdown', listener, true);
4508
+ function remove() { document.removeEventListener('pointerdown', listener, true); }
4509
+ onDestroy(remove);
4510
+ return { remove: remove };
4511
+ }
4512
+
4513
+ function useFocus(target) {
4514
+ var focused = false;
4515
+ var listeners = [];
4516
+ function resolve() {
4517
+ return typeof target === 'string' ? document.querySelector(target) : target;
4518
+ }
4519
+ function setFocused(v) {
4520
+ if (v !== focused) {
4521
+ focused = v;
4522
+ listeners.forEach(function(fn) { fn(focused); });
4523
+ }
4524
+ }
4525
+ var onFocusIn = function() { setFocused(true); };
4526
+ var onBlurOut = function() { setFocused(false); };
4527
+ var el = resolve();
4528
+ if (el) {
4529
+ el.addEventListener('focus', onFocusIn);
4530
+ el.addEventListener('blur', onBlurOut);
4531
+ focused = document.activeElement === el;
4532
+ }
4533
+ onDestroy(function() {
4534
+ var el = resolve();
4535
+ if (el) { el.removeEventListener('focus', onFocusIn); el.removeEventListener('blur', onBlurOut); }
4536
+ listeners = [];
4537
+ });
4538
+ return {
4539
+ get isFocused() { return focused; },
4540
+ focus: function() { var el = resolve(); if (el && el.focus) el.focus(); },
4541
+ blur: function() { var el = resolve(); if (el && el.blur) el.blur(); },
4542
+ subscribe: function(fn) {
4543
+ listeners.push(fn);
4544
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4545
+ }
4546
+ };
4547
+ }
4548
+
4549
+ function useAsync(fn, options) {
4550
+ options = options || {};
4551
+ var asyncState = 'idle';
4552
+ var data = null;
4553
+ var error = null;
4554
+ var listeners = [];
4555
+ function notify() {
4556
+ var snap = { state: asyncState, data: data, error: error };
4557
+ listeners.forEach(function(fn) { fn(snap); });
4558
+ }
4559
+ function execute() {
4560
+ var args = Array.prototype.slice.call(arguments);
4561
+ asyncState = 'loading'; error = null; notify();
4562
+ return fn.apply(null, args).then(function(result) {
4563
+ data = result; asyncState = 'success'; notify(); return data;
4564
+ }).catch(function(e) {
4565
+ error = e instanceof Error ? e : new Error(String(e));
4566
+ asyncState = 'error'; notify(); return null;
4567
+ });
4568
+ }
4569
+ if (options.immediate) execute();
4570
+ return {
4571
+ get state() { return asyncState; },
4572
+ get isLoading() { return asyncState === 'loading'; },
4573
+ get error() { return error; },
4574
+ get data() { return data; },
4575
+ execute: execute,
4576
+ subscribe: function(fn) {
4577
+ listeners.push(fn);
4578
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4579
+ }
4580
+ };
4581
+ }
4582
+
4583
+ function useColorMode(options) {
4584
+ options = options || {};
4585
+ var storageKey = options.storageKey || 'stx-color-mode';
4586
+ var initialMode = options.initialMode || 'auto';
4587
+ var darkClass = options.darkClass || 'dark';
4588
+ var attribute = options.attribute || null;
4589
+ var disableTransitions = options.disableTransitions !== false;
4590
+ var preference = initialMode;
4591
+ var resolved = 'light';
4592
+ var listeners = [];
4593
+ var cleanups = [];
4594
+
4595
+ function getSystem() {
4596
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
4597
+ }
4598
+ function resolve(pref) { return pref === 'auto' ? getSystem() : pref; }
4599
+ function applyDOM(mode) {
4600
+ var el = document.documentElement;
4601
+ if (disableTransitions) el.style.setProperty('transition', 'none', 'important');
4602
+ if (attribute) { el.setAttribute(attribute, mode); }
4603
+ else { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }
4604
+ if (disableTransitions) { el.offsetHeight; el.style.removeProperty('transition'); }
4605
+ }
4606
+ function persist(pref) { try { localStorage.setItem(storageKey, pref); } catch(e) {} }
4607
+ function readPersisted() {
4608
+ try { var v = localStorage.getItem(storageKey); if (v === 'light' || v === 'dark' || v === 'auto') return v; } catch(e) {}
4609
+ return null;
4610
+ }
4611
+ function update(pref) {
4612
+ preference = pref;
4613
+ resolved = resolve(pref);
4614
+ applyDOM(resolved);
4615
+ persist(pref);
4616
+ listeners.forEach(function(fn) { fn(resolved, preference); });
4617
+ }
4618
+
4619
+ var persisted = readPersisted();
4620
+ update(persisted || initialMode);
4621
+
4622
+ var mql = window.matchMedia('(prefers-color-scheme: dark)');
4623
+ var onSystemChange = function() {
4624
+ if (preference === 'auto') {
4625
+ resolved = getSystem();
4626
+ applyDOM(resolved);
4627
+ listeners.forEach(function(fn) { fn(resolved, preference); });
4628
+ }
4629
+ };
4630
+ mql.addEventListener('change', onSystemChange);
4631
+ cleanups.push(function() { mql.removeEventListener('change', onSystemChange); });
4632
+
4633
+ var onStorage = function(e) {
4634
+ if (e.key !== storageKey) return;
4635
+ var v = e.newValue;
4636
+ if (v === 'light' || v === 'dark' || v === 'auto') {
4637
+ preference = v; resolved = resolve(v); applyDOM(resolved);
4638
+ listeners.forEach(function(fn) { fn(resolved, preference); });
4639
+ }
4640
+ };
4641
+ window.addEventListener('storage', onStorage);
4642
+ cleanups.push(function() { window.removeEventListener('storage', onStorage); });
4643
+
4644
+ onDestroy(function() { cleanups.forEach(function(fn) { fn(); }); listeners = []; });
4645
+
4646
+ return {
4647
+ get mode() { return resolved; },
4648
+ get preference() { return preference; },
4649
+ get isDark() { return resolved === 'dark'; },
4650
+ set: function(mode) { update(mode); },
4651
+ toggle: function() { update(resolved === 'dark' ? 'light' : 'dark'); },
4652
+ subscribe: function(fn) {
4653
+ listeners.push(fn);
4654
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
4655
+ }
4656
+ };
4657
+ }
4658
+
4659
+ function useDark(options) {
4660
+ var cm = useColorMode(options);
4661
+ return {
4662
+ get isDark() { return cm.isDark; },
4663
+ toggle: function() { cm.toggle(); },
4664
+ set: function(dark) { cm.set(dark ? 'dark' : 'light'); },
4665
+ subscribe: function(fn) {
4666
+ return cm.subscribe(function(mode) { fn(mode === 'dark'); });
4667
+ }
4668
+ };
4669
+ }
4670
+
4671
+ // Component mount system
4672
+ var mountQueue = [];
4673
+
4016
4674
  window.stx = {
4017
4675
  state,
4018
4676
  derived,
@@ -4024,12 +4682,81 @@ ${Z}
4024
4682
  onMount,
4025
4683
  onDestroy,
4026
4684
  useFetch,
4685
+ useRef,
4686
+ navigate,
4687
+ goBack,
4688
+ goForward,
4689
+ useRoute,
4690
+ useSearchParams,
4691
+ useQuery,
4692
+ useMutation,
4693
+ provide,
4027
4694
  $computed,
4028
4695
  $watch,
4696
+ useDebounce,
4697
+ useDebouncedValue,
4698
+ useThrottle,
4699
+ useInterval,
4700
+ useTimeout,
4701
+ useToggle,
4702
+ useCounter,
4703
+ useClickOutside,
4704
+ useFocus,
4705
+ useAsync,
4706
+ useColorMode,
4707
+ useDark,
4029
4708
  helpers: globalHelpers,
4030
4709
  _mountCallbacks: mountCallbacks,
4031
4710
  _destroyCallbacks: destroyCallbacks,
4032
- _scopes: {} // Component-level scopes
4711
+ _scopes: {}, // Component-level scopes
4712
+ mount: function(setupFn) {
4713
+ // Capture script reference synchronously (only valid during execution)
4714
+ var scriptEl = document.currentScript;
4715
+
4716
+ function doMount() {
4717
+ // Find component root: next sibling element after the script tag
4718
+ var root = scriptEl ? scriptEl.nextElementSibling : null;
4719
+ if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
4720
+ if (!root) { console.warn('[stx] mount: no root element found'); return; }
4721
+
4722
+ // Track lifecycle hooks registered during setup
4723
+ var startLen = mountCallbacks.length;
4724
+
4725
+ // Run setup function \u2014 returns scope object with declarations
4726
+ var scope = setupFn();
4727
+
4728
+ // Capture mount hooks added during setup
4729
+ var localMountHooks = mountCallbacks.splice(startLen);
4730
+ var localDestroyHooks = [];
4731
+
4732
+ // Register scope
4733
+ if (typeof scope === 'object' && scope !== null) {
4734
+ scope.$el = root;
4735
+ scope.$refs = scope.$refs || {};
4736
+ Object.assign(componentScope, scope);
4737
+ }
4738
+
4739
+ // Walk DOM and bind directives
4740
+ processElement(root, scope || componentScope);
4741
+
4742
+ // Fire mount hooks
4743
+ localMountHooks.forEach(function(fn) {
4744
+ try {
4745
+ var cleanup = fn();
4746
+ if (typeof cleanup === 'function') localDestroyHooks.push(cleanup);
4747
+ } catch(e) { console.error('[stx] onMount error:', e); }
4748
+ });
4749
+
4750
+ // Store cleanup on element for auto-destroy
4751
+ root.__stx_destroy = localDestroyHooks;
4752
+ }
4753
+
4754
+ if (document.readyState === 'loading') {
4755
+ mountQueue.push(doMount);
4756
+ } else {
4757
+ doMount();
4758
+ }
4759
+ }
4033
4760
  };
4034
4761
 
4035
4762
  // Also expose globally for convenience
@@ -4040,14 +4767,39 @@ ${Z}
4040
4767
  window.onMount = onMount;
4041
4768
  window.onDestroy = onDestroy;
4042
4769
  window.useFetch = useFetch;
4770
+ window.useRef = useRef;
4771
+ window.navigate = navigate;
4772
+ window.goBack = goBack;
4773
+ window.goForward = goForward;
4774
+ window.useRoute = useRoute;
4775
+ window.useSearchParams = useSearchParams;
4776
+ window.useQuery = useQuery;
4777
+ window.useMutation = useMutation;
4778
+ window.provide = provide;
4043
4779
  window.$computed = $computed;
4044
4780
  window.$watch = $watch;
4781
+ window.useDebounce = useDebounce;
4782
+ window.useDebouncedValue = useDebouncedValue;
4783
+ window.useThrottle = useThrottle;
4784
+ window.useInterval = useInterval;
4785
+ window.useTimeout = useTimeout;
4786
+ window.useToggle = useToggle;
4787
+ window.useCounter = useCounter;
4788
+ window.useClickOutside = useClickOutside;
4789
+ window.useFocus = useFocus;
4790
+ window.useAsync = useAsync;
4791
+ window.useColorMode = useColorMode;
4792
+ window.useDark = useDark;
4045
4793
 
4046
4794
  // ==========================================================================
4047
4795
  // Auto-initialization
4048
4796
  // ==========================================================================
4049
4797
 
4050
4798
  document.addEventListener('DOMContentLoaded', () => {
4799
+ // Process mount queue (from stx.mount() calls during loading)
4800
+ mountQueue.forEach(function(fn) { fn(); });
4801
+ mountQueue = [];
4802
+
4051
4803
  // Track which scoped elements have been processed
4052
4804
  const processedScopes = new Set();
4053
4805
 
@@ -4119,6 +4871,9 @@ ${Z}
4119
4871
  } else if (el.tagName === 'META') {
4120
4872
  const content = el.getAttribute('content');
4121
4873
  if (content && content.includes('{{')) {
4874
+ // Skip build-time placeholders like {{__TITLE__}}
4875
+ const hasOnlyPlaceholders = !content.replace(/{{s*__[A-Z_]+__s*}}/g, '').includes('{{');
4876
+ if (hasOnlyPlaceholders) return;
4122
4877
  effect(() => {
4123
4878
  try {
4124
4879
  let result = content;
@@ -4126,6 +4881,7 @@ ${Z}
4126
4881
  if (matches) {
4127
4882
  matches.forEach(match => {
4128
4883
  const expr = match.replace(/^{{s*|s*}}$/g, '');
4884
+ if (/^__[A-Z_]+__$/.test(expr.trim())) return;
4129
4885
  const fn = new Function(...Object.keys(componentScope), 'return ' + expr);
4130
4886
  const value = fn(...Object.values(componentScope));
4131
4887
  result = result.replace(match, value != null ? value : '');
@@ -4141,6 +4897,36 @@ ${Z}
4141
4897
  });
4142
4898
  });
4143
4899
 
4900
+ // Re-initialize components after SPA content swap
4901
+ window.addEventListener('stx:load', function() {
4902
+ // Process mount queue (scripts in swapped content may have called stx.mount())
4903
+ mountQueue.forEach(function(fn) { fn(); });
4904
+ mountQueue = [];
4905
+
4906
+ // Re-process scoped components in new content
4907
+ var container = document.querySelector('#main-content') || document.body;
4908
+ container.querySelectorAll('[data-stx-scope]').forEach(function(el) {
4909
+ var scopeId = el.getAttribute('data-stx-scope');
4910
+ var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
4911
+ if (scopeVars) {
4912
+ componentScope = Object.assign({}, componentScope, scopeVars);
4913
+ }
4914
+ processElement(el);
4915
+ if (scopeVars && scopeVars.__mountCallbacks) {
4916
+ scopeVars.__mountCallbacks.forEach(function(fn) { fn(); });
4917
+ }
4918
+ });
4919
+
4920
+ container.querySelectorAll('[data-stx]').forEach(function(el) {
4921
+ var setupName = el.getAttribute('data-stx');
4922
+ if (setupName && window[setupName]) {
4923
+ var result = window[setupName]();
4924
+ if (typeof result === 'object') Object.assign(componentScope, result);
4925
+ }
4926
+ processElement(el);
4927
+ });
4928
+ });
4929
+
4144
4930
  // Helper to process elements while skipping already-processed scoped containers
4145
4931
  function processElementSkipScopes(el, processedScopes) {
4146
4932
  if (processedScopes.has(el)) return;
@@ -4153,26 +4939,32 @@ ${Z}
4153
4939
  if (el.hasAttribute && el.hasAttribute('data-stx-scope')) return;
4154
4940
  // Process this element's directives without recursing into children
4155
4941
  // (we'll handle children manually to skip scoped ones)
4156
- const hasFor = el.hasAttribute && el.hasAttribute('@for');
4157
- const hasIf = el.hasAttribute && el.hasAttribute('@if');
4158
- if (hasFor) { bindFor(el); return; }
4159
- if (hasIf) { bindIf(el); return; }
4942
+ const hasFor = el.hasAttribute && (el.hasAttribute('@for') || el.hasAttribute(':for'));
4943
+ const hasIf = el.hasAttribute && (el.hasAttribute('@if') || el.hasAttribute(':if'));
4944
+ if (hasFor) { bindFor(el, componentScope, el.hasAttribute(':for') ? ':for' : '@for'); return; }
4945
+ if (hasIf) { bindIf(el, componentScope, el.hasAttribute(':if') ? ':if' : '@if'); return; }
4160
4946
  // Process other attributes...
4161
- if (el.hasAttribute && el.hasAttribute('@show')) bindShow(el, el.getAttribute('@show'));
4162
- if (el.hasAttribute && el.hasAttribute('@model')) bindModel(el, el.getAttribute('@model'));
4947
+ if (el.hasAttribute && (el.hasAttribute('@show') || el.hasAttribute(':show'))) {
4948
+ var sa = el.hasAttribute(':show') ? ':show' : '@show';
4949
+ bindShow(el, el.getAttribute(sa), componentScope, sa);
4950
+ }
4951
+ if (el.hasAttribute && (el.hasAttribute('@model') || el.hasAttribute(':model'))) {
4952
+ var ma = el.hasAttribute(':model') ? ':model' : '@model';
4953
+ bindModel(el, el.getAttribute(ma), componentScope, ma);
4954
+ }
4163
4955
  // Process children, skipping scoped containers
4164
4956
  Array.from(el.childNodes).forEach(child => processElementSkipScopes(child, processedScopes));
4165
4957
  }
4166
4958
  })();
4167
- `}var E8=()=>{};function gZ(Z,$){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=$;let J=Y.exec(Z);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||t9.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function Z2(Z,$,Y){let J=1,G=Y,X=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(J>0&&G<Z.length){X.lastIndex=G,Q.lastIndex=G;let K=X.exec(Z),q=Q.exec(Z);if(!q)return-1;if(K&&K.index<q.index)J++,G=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;G=q.index+q[0].length}}return-1}function wZ(Z,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Y=Z2(Z,$.tag,$.end);if(Y===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Y,innerHTML:Z.slice($.end,Y-`</${$.tag}>`.length)}}function k8(Z,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(Z)||Z.includes(` ${$}=`)||Z.includes(` ${$} `)||Z.trimEnd().endsWith(` ${$}`)}function $4(Z,$){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=Z.match(new RegExp(`${Y}="([^"]*)"`,"s"))||Z.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function kZ(Z,$){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Z.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function SZ(Z,$,Y){let J=$.selfClosing?" /":"",G=`<${$.tag}${Y}${J}>`;return Z.slice(0,$.start)+G+Z.slice($.end)}function $2(Z){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(Z)}function Y2(Z){let $=Z,Y=0;while(Y<$.length){let J=gZ($,Y);if(!J)break;let G=$4(J.attrs,"v-for");if(G===null){Y=J.end;continue}let X=G.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let Q=X[1].trim(),K=X[2].trim(),q;if(Q.includes(",")){let L=Q.split(",").map((A)=>A.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${Q}`;let _=kZ(J.attrs,"v-for"),j=kZ(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),B=wZ($,J),W=$.slice(B.outerStart,B.outerEnd),U=SZ(W,{...J,start:0,end:J.end-J.start},j),z=`@foreach(${q})
4959
+ `}var S8=()=>{};function hZ(Z,$){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=$;let J=Y.exec(Z);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||Y2.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function X2(Z,$,Y){let J=1,G=Y,X=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(J>0&&G<Z.length){X.lastIndex=G,Q.lastIndex=G;let K=X.exec(Z),q=Q.exec(Z);if(!q)return-1;if(K&&K.index<q.index)J++,G=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;G=q.index+q[0].length}}return-1}function wZ(Z,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Y=X2(Z,$.tag,$.end);if(Y===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Y,innerHTML:Z.slice($.end,Y-`</${$.tag}>`.length)}}function b8(Z,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(Z)||Z.includes(` ${$}=`)||Z.includes(` ${$} `)||Z.trimEnd().endsWith(` ${$}`)}function $4(Z,$){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=Z.match(new RegExp(`${Y}="([^"]*)"`,"s"))||Z.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function SZ(Z,$){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return Z.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function bZ(Z,$,Y){let J=$.selfClosing?" /":"",G=`<${$.tag}${Y}${J}>`;return Z.slice(0,$.start)+G+Z.slice($.end)}function G2(Z){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(Z)}function Q2(Z){let $=Z,Y=0;while(Y<$.length){let J=hZ($,Y);if(!J)break;let G=$4(J.attrs,"v-for");if(G===null){Y=J.end;continue}let X=G.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let Q=X[1].trim(),K=X[2].trim(),q;if(Q.includes(",")){let F=Q.split(",").map((A)=>A.trim()),O=F[0],L=F[1];q=`${K} as ${L} => ${O}`}else q=`${K} as ${Q}`;let _=SZ(J.attrs,"v-for"),j=SZ(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),B=wZ($,J),W=$.slice(B.outerStart,B.outerEnd),U=bZ(W,{...J,start:0,end:J.end-J.start},j),z=`@foreach(${q})
4168
4960
  `,H=`${z}${U}
4169
- @endforeach`;$=$.slice(0,B.outerStart)+H+$.slice(B.outerEnd),Y=B.outerStart+z.length}return $}function J2(Z){let $=Z,Y=0;while(Y<$.length){let J=gZ($,Y);if(!J)break;let G=$4(J.attrs,"v-if");if(G===null){Y=J.end;continue}let X=[],Q=wZ($,J),K=kZ(J.attrs,"v-if"),q=SZ($.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},K);X.push({type:"if",expr:G,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let _=Q.outerEnd,j=!0;while(j){let H=$.slice(_).match(/^\s*/),L=H?H[0].length:0,F=gZ($,_+L);if(!F){j=!1;break}let O=$4(F.attrs,"v-else-if"),A=k8(F.attrs,"v-else");if(O!==null){let M=wZ($,F),V=kZ(F.attrs,"v-else-if"),R=SZ($.slice(M.outerStart,M.outerEnd),{...F,start:0,end:F.end-F.start},V);X.push({type:"else-if",expr:O,outerStart:_,outerEnd:M.outerEnd,element:R,parsedTag:F}),_=M.outerEnd}else if(A){let M=wZ($,F),V=kZ(F.attrs,"v-else"),R=SZ($.slice(M.outerStart,M.outerEnd),{...F,start:0,end:F.end-F.start},V);X.push({type:"else",outerStart:_,outerEnd:M.outerEnd,element:R,parsedTag:F}),j=!1}else j=!1}let B=[];for(let H of X)if(H.type==="if")B.push(`@if(${H.expr})
4961
+ @endforeach`;$=$.slice(0,B.outerStart)+H+$.slice(B.outerEnd),Y=B.outerStart+z.length}return $}function K2(Z){let $=Z,Y=0;while(Y<$.length){let J=hZ($,Y);if(!J)break;let G=$4(J.attrs,"v-if");if(G===null){Y=J.end;continue}let X=[],Q=wZ($,J),K=SZ(J.attrs,"v-if"),q=bZ($.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},K);X.push({type:"if",expr:G,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let _=Q.outerEnd,j=!0;while(j){let H=$.slice(_).match(/^\s*/),F=H?H[0].length:0,O=hZ($,_+F);if(!O){j=!1;break}let L=$4(O.attrs,"v-else-if"),A=b8(O.attrs,"v-else");if(L!==null){let M=wZ($,O),V=SZ(O.attrs,"v-else-if"),N=bZ($.slice(M.outerStart,M.outerEnd),{...O,start:0,end:O.end-O.start},V);X.push({type:"else-if",expr:L,outerStart:_,outerEnd:M.outerEnd,element:N,parsedTag:O}),_=M.outerEnd}else if(A){let M=wZ($,O),V=SZ(O.attrs,"v-else"),N=bZ($.slice(M.outerStart,M.outerEnd),{...O,start:0,end:O.end-O.start},V);X.push({type:"else",outerStart:_,outerEnd:M.outerEnd,element:N,parsedTag:O}),j=!1}else j=!1}let B=[];for(let H of X)if(H.type==="if")B.push(`@if(${H.expr})
4170
4962
  ${H.element}`);else if(H.type==="else-if")B.push(`@elseif(${H.expr})
4171
4963
  ${H.element}`);else B.push(`@else
4172
4964
  ${H.element}`);B.push("@endif");let W=B.join(`
4173
- `),U=X[0].outerStart,z=X[X.length-1].outerEnd;$=$.slice(0,U)+W+$.slice(z),Y=U+W.length}return $}function X2(Z){return Z.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function G2(Z){let $=Z,Y=0;while(Y<$.length){let J=gZ($,Y);if(!J)break;let G=J.attrs,X=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=G.match(Q);while(K){X=!0;let j=K[1],B=K[2],W=K[3];G=G.replace(K[0],""),G+=` :${j}="${W}" @update:${j}="${W} = $event"`,K=G.match(Q)}if(X){let j=wZ($,J),B=$.slice(j.outerStart,j.outerEnd),W=SZ(B,{...J,start:0,end:J.end-J.start},G);$=$.slice(0,j.outerStart)+W+$.slice(j.outerEnd),Y=j.outerStart+W.length;continue}let q=$4(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(e9.has(J.tag.toLowerCase())){let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,B=wZ($,J),W=$.slice(B.outerStart,B.outerEnd),U=SZ(W,{...J,start:0,end:J.end-J.start},j);$=$.slice(0,B.outerStart)+U+$.slice(B.outerEnd),Y=B.outerStart+U.length}else{let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"");j+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let B=wZ($,J),W=$.slice(B.outerStart,B.outerEnd),U=SZ(W,{...J,start:0,end:J.end-J.start},j);$=$.slice(0,B.outerStart)+U+$.slice(B.outerEnd),Y=B.outerStart+U.length}}return $}function Q2(Z){return Z.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function K2(Z){return Z.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function q2(Z){let $=Z,Y=0;while(Y<$.length){let J=gZ($,Y);if(!J)break;let G=$4(J.attrs,"v-html");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=wZ($,J),Q=kZ(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{!! ${G} !!}</${J.tag}>`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),Y=X.outerStart+q.length}return $}function _2(Z){let $=Z,Y=0;while(Y<$.length){let J=gZ($,Y);if(!J)break;let G=$4(J.attrs,"v-text");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=wZ($,J),Q=kZ(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{{ ${G} }}</${J.tag}>`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),Y=X.outerStart+q.length}return $}function j2(Z){return Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function B2(Z){let $=Z,Y=0;while(Y<$.length){let J=gZ($,Y);if(!J)break;if(!k8(J.attrs,"v-once")){Y=J.end;continue}let G=kZ(J.attrs,"v-once"),X=wZ($,J),Q=$.slice(X.outerStart,X.outerEnd),q=`@once
4174
- ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4175
- @endonce`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),Y=X.outerStart+q.length}return $}function W2(Z){return Z.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function z2(Z){return Z.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function S8(Z){if(!$2(Z))return Z;let $=Z;return $=Y2($),$=J2($),$=B2($),$=Q2($),$=K2($),$=G2($),$=X2($),$=z2($),$=q2($),$=_2($),$=j2($),$=W2($),$}var t9,e9;var b8=I(()=>{t9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),e9=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});async function P8(Z,$,Y,J,G){let X=Z,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=i(j.expr,$);if(!B||typeof B!=="string"){let O=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+O+X.slice(j.index+j.full.length);continue}let W=j.attrs.trim(),U={},z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=z.exec(W))!==null){let O=H[1]||H[2],A=H[3];if(H[1])try{U[O]=i(A,$)}catch{U[O]=A}else U[O]=A}let L=J.componentsDir||"components",F=await sZ(B,U,j.slotContent,L,$,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+F+X.slice(j.index+j.full.length)}catch(B){let U=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length)}}return X=await U2(X,$,Y,J,G),X}async function U2(Z,$,Y,J,G){let X=Z,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=i(j.expr,$);if(!B||typeof B!=="string"){let z=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length);continue}let W=J.componentsDir||"components",U=await sZ(B,{},"",W,$,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length)}catch(B){let U=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length)}}return X}var C8=I(()=>{MZ();LZ()});var x8={};t(x8,{processDeferDirectives:()=>A2});function H2(){return`stx-defer-${++y8}`}function O2(Z){let $=Z.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function L2(Z,$,Y){let{trigger:J,value:G}=O2($),X=Y,Q,K,q,_=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)Q=_[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let j=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(j)K=j[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let B=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(B)q=B[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:G,content:X,placeholder:Q,loading:K,error:q}}function F2(Z,$){let{trigger:Y,triggerValue:J}=$,G;switch(Y){case"visible":G=`
4965
+ `),U=X[0].outerStart,z=X[X.length-1].outerEnd;$=$.slice(0,U)+W+$.slice(z),Y=U+W.length}return $}function q2(Z){return Z.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function _2(Z){let $=Z,Y=0;while(Y<$.length){let J=hZ($,Y);if(!J)break;let G=J.attrs,X=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=G.match(Q);while(K){X=!0;let j=K[1],B=K[2],W=K[3];G=G.replace(K[0],""),G+=` :${j}="${W}" @update:${j}="${W} = $event"`,K=G.match(Q)}if(X){let j=wZ($,J),B=$.slice(j.outerStart,j.outerEnd),W=bZ(B,{...J,start:0,end:J.end-J.start},G);$=$.slice(0,j.outerStart)+W+$.slice(j.outerEnd),Y=j.outerStart+W.length;continue}let q=$4(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(J2.has(J.tag.toLowerCase())){let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,B=wZ($,J),W=$.slice(B.outerStart,B.outerEnd),U=bZ(W,{...J,start:0,end:J.end-J.start},j);$=$.slice(0,B.outerStart)+U+$.slice(B.outerEnd),Y=B.outerStart+U.length}else{let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"");j+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let B=wZ($,J),W=$.slice(B.outerStart,B.outerEnd),U=bZ(W,{...J,start:0,end:J.end-J.start},j);$=$.slice(0,B.outerStart)+U+$.slice(B.outerEnd),Y=B.outerStart+U.length}}return $}function j2(Z){return Z.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function B2(Z){return Z.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function W2(Z){let $=Z,Y=0;while(Y<$.length){let J=hZ($,Y);if(!J)break;let G=$4(J.attrs,"v-html");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=wZ($,J),Q=SZ(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{!! ${G} !!}</${J.tag}>`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),Y=X.outerStart+q.length}return $}function z2(Z){let $=Z,Y=0;while(Y<$.length){let J=hZ($,Y);if(!J)break;let G=$4(J.attrs,"v-text");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=wZ($,J),Q=SZ(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{{ ${G} }}</${J.tag}>`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),Y=X.outerStart+q.length}return $}function U2(Z){return Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function H2(Z){let $=Z,Y=0;while(Y<$.length){let J=hZ($,Y);if(!J)break;if(!b8(J.attrs,"v-once")){Y=J.end;continue}let G=SZ(J.attrs,"v-once"),X=wZ($,J),Q=$.slice(X.outerStart,X.outerEnd),q=`@once
4966
+ ${bZ(Q,{...J,start:0,end:J.end-J.start},G)}
4967
+ @endonce`;$=$.slice(0,X.outerStart)+q+$.slice(X.outerEnd),Y=X.outerStart+q.length}return $}function O2(Z){return Z.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function L2(Z){return Z.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function P8(Z){if(!G2(Z))return Z;let $=Z;return $=Q2($),$=K2($),$=H2($),$=j2($),$=B2($),$=_2($),$=q2($),$=L2($),$=W2($),$=z2($),$=U2($),$=O2($),$}var Y2,J2;var C8=I(()=>{Y2=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),J2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});async function y8(Z,$,Y,J,G){let X=Z,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=n(j.expr,$);if(!B||typeof B!=="string"){let L=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+L+X.slice(j.index+j.full.length);continue}let W=j.attrs.trim(),U={},z=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=z.exec(W))!==null){let L=H[1]||H[2],A=H[3];if(H[1])try{U[L]=n(A,$)}catch{U[L]=A}else U[L]=A}let F=J.componentsDir||"components",O=await nZ(B,U,j.slotContent,F,$,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+O+X.slice(j.index+j.full.length)}catch(B){let U=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length)}}return X=await F2(X,$,Y,J,G),X}async function F2(Z,$,Y,J,G){let X=Z,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=n(j.expr,$);if(!B||typeof B!=="string"){let z=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length);continue}let W=J.componentsDir||"components",U=await nZ(B,{},"",W,$,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length)}catch(B){let U=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length)}}return X}var x8=I(()=>{NZ();AZ()});var f8={};ZZ(f8,{processDeferDirectives:()=>M2});function A2(){return`stx-defer-${++v8}`}function N2(Z){let $=Z.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function R2(Z,$,Y){let{trigger:J,value:G}=N2($),X=Y,Q,K,q,_=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)Q=_[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let j=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(j)K=j[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let B=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(B)q=B[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:G,content:X,placeholder:Q,loading:K,error:q}}function V2(Z,$){let{trigger:Y,triggerValue:J}=$,G;switch(Y){case"visible":G=`
4176
4968
  const observer = new IntersectionObserver((entries) => {
4177
4969
  if (entries[0].isIntersecting) {
4178
4970
  observer.disconnect();
@@ -4244,7 +5036,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4244
5036
  ${G}
4245
5037
  })();
4246
5038
  </script>
4247
- `}function A2(Z,$,Y){y8=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return Z.replace(J,(G,X,Q)=>{let K=H2(),q=L2(G,X,Q),_=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",j=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',B=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",W=`<div data-defer-content style="display: none;">${q.content}</div>`,U=F2(K,q);return`
5039
+ `}function M2(Z,$,Y){v8=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return Z.replace(J,(G,X,Q)=>{let K=A2(),q=R2(G,X,Q),_=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",j=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',B=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",W=`<div data-defer-content style="display: none;">${q.content}</div>`,U=V2(K,q);return`
4248
5040
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
4249
5041
  ${_}
4250
5042
  ${j}
@@ -4252,7 +5044,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4252
5044
  ${B}
4253
5045
  </div>
4254
5046
  ${U}
4255
- `})}var y8=0;var f8={};t(f8,{processTeleportDirectives:()=>M2,ensureTeleportTargets:()=>w2});function R2(){return`stx-teleport-${++v8}`}function N2(Z){let $=Z.split(",").map((G)=>G.trim()),Y=$[0].replace(/['"]/g,""),J;for(let G=1;G<$.length;G++){let X=$[G].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function V2(Z,$){return`
5047
+ `})}var v8=0;var h8={};ZZ(h8,{processTeleportDirectives:()=>D2,ensureTeleportTargets:()=>E2});function w2(){return`stx-teleport-${++g8}`}function T2(Z){let $=Z.split(",").map((G)=>G.trim()),Y=$[0].replace(/['"]/g,""),J;for(let G=1;G<$.length;G++){let X=$[G].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function I2(Z,$){return`
4256
5048
  <script>
4257
5049
  (function() {
4258
5050
  const source = document.getElementById('${Z}');
@@ -4288,12 +5080,12 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4288
5080
  }));
4289
5081
  })();
4290
5082
  </script>
4291
- `}function M2(Z,$,Y){v8=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return Z.replace(J,(G,X,Q)=>{let K=R2(),{target:q,disabled:_}=N2(X),j=Q.trim();if(_)try{let W=!1;if(_==="true")W=!0;else if(_==="false")W=!1;else if(_ in $)W=Boolean($[_]);if(W)return`<div class="stx-teleport-inline" data-teleport-disabled>${j}</div>`}catch{}let B=V2(K,q);return`
5083
+ `}function D2(Z,$,Y){g8=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return Z.replace(J,(G,X,Q)=>{let K=w2(),{target:q,disabled:_}=T2(X),j=Q.trim();if(_)try{let W=!1;if(_==="true")W=!0;else if(_==="false")W=!1;else if(_ in $)W=Boolean($[_]);if(W)return`<div class="stx-teleport-inline" data-teleport-disabled>${j}</div>`}catch{}let B=I2(K,q);return`
4292
5084
  <div id="${K}" class="stx-teleport-source" style="display: none;">
4293
5085
  <template>${j}</template>
4294
5086
  </div>
4295
5087
  ${B}
4296
- `})}function w2(){return`
5088
+ `})}function E2(){return`
4297
5089
  <script>
4298
5090
  (function() {
4299
5091
  // Common teleport targets
@@ -4310,7 +5102,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4310
5102
  });
4311
5103
  })();
4312
5104
  </script>
4313
- `}var v8=0;var m8={};t(m8,{processTransitionDirectives:()=>E2,processTransitionAttributes:()=>P2,performLeave:()=>D2,performEnter:()=>I2,generateTransitionRuntime:()=>b2,generateTransitionCSS:()=>S2});function g8(Z,$={}){return{enterFrom:$.enterClass||`${Z}-enter-from`,enterActive:$.enterActiveClass||`${Z}-enter-active`,enterTo:$.enterToClass||`${Z}-enter-to`,leaveFrom:$.leaveClass||`${Z}-leave-from`,leaveActive:$.leaveActiveClass||`${Z}-leave-active`,leaveTo:$.leaveToClass||`${Z}-leave-to`}}function T2(Z){let $=getComputedStyle(Z),Y=$.transitionDuration||"0s",J=$.animationDuration||"0s",G=(X)=>{let Q=X.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let K=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?K:K*1000};return Math.max(G(Y),G(J))}function h8(Z,$){return new Promise((Y)=>{let J=$??T2(Z);if(J===0){Y();return}let G=!1,X=()=>{if(G)return;G=!0,Z.removeEventListener("transitionend",Q),Z.removeEventListener("animationend",Q),Y()},Q=(K)=>{if(K.target===Z)X()};Z.addEventListener("transitionend",Q),Z.addEventListener("animationend",Q),setTimeout(X,J+50)})}function d8(Z){Z.offsetHeight}async function I2(Z,$={}){let Y=$.name||"stx",J=g8(Y,$),G=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(Z),Z.classList.add(J.enterFrom),Z.classList.add(J.enterActive),d8(Z),Z.classList.remove(J.enterFrom),Z.classList.add(J.enterTo),$.onEnter)await new Promise((X)=>{$.onEnter(Z,X)});else await h8(Z,G);Z.classList.remove(J.enterActive),Z.classList.remove(J.enterTo),$.onAfterEnter?.(Z)}async function D2(Z,$={}){let Y=$.name||"stx",J=g8(Y,$),G=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(Z),Z.classList.add(J.leaveFrom),Z.classList.add(J.leaveActive),d8(Z),Z.classList.remove(J.leaveFrom),Z.classList.add(J.leaveTo),$.onLeave)await new Promise((X)=>{$.onLeave(Z,X)});else await h8(Z,G);Z.classList.remove(J.leaveActive),Z.classList.remove(J.leaveTo),$.onAfterLeave?.(Z)}function E2(Z,$={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return Z.replace(J,(G,X,Q)=>{let K=k2(X),q=K.name||"stx",_=K.duration||300,j=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
5105
+ `}var g8=0;var p8={};ZZ(p8,{processTransitionDirectives:()=>P2,processTransitionAttributes:()=>v2,performLeave:()=>b2,performEnter:()=>S2,generateTransitionRuntime:()=>x2,generateTransitionCSS:()=>y2});function d8(Z,$={}){return{enterFrom:$.enterClass||`${Z}-enter-from`,enterActive:$.enterActiveClass||`${Z}-enter-active`,enterTo:$.enterToClass||`${Z}-enter-to`,leaveFrom:$.leaveClass||`${Z}-leave-from`,leaveActive:$.leaveActiveClass||`${Z}-leave-active`,leaveTo:$.leaveToClass||`${Z}-leave-to`}}function k2(Z){let $=getComputedStyle(Z),Y=$.transitionDuration||"0s",J=$.animationDuration||"0s",G=(X)=>{let Q=X.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let K=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?K:K*1000};return Math.max(G(Y),G(J))}function m8(Z,$){return new Promise((Y)=>{let J=$??k2(Z);if(J===0){Y();return}let G=!1,X=()=>{if(G)return;G=!0,Z.removeEventListener("transitionend",Q),Z.removeEventListener("animationend",Q),Y()},Q=(K)=>{if(K.target===Z)X()};Z.addEventListener("transitionend",Q),Z.addEventListener("animationend",Q),setTimeout(X,J+50)})}function u8(Z){Z.offsetHeight}async function S2(Z,$={}){let Y=$.name||"stx",J=d8(Y,$),G=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(Z),Z.classList.add(J.enterFrom),Z.classList.add(J.enterActive),u8(Z),Z.classList.remove(J.enterFrom),Z.classList.add(J.enterTo),$.onEnter)await new Promise((X)=>{$.onEnter(Z,X)});else await m8(Z,G);Z.classList.remove(J.enterActive),Z.classList.remove(J.enterTo),$.onAfterEnter?.(Z)}async function b2(Z,$={}){let Y=$.name||"stx",J=d8(Y,$),G=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(Z),Z.classList.add(J.leaveFrom),Z.classList.add(J.leaveActive),u8(Z),Z.classList.remove(J.leaveFrom),Z.classList.add(J.leaveTo),$.onLeave)await new Promise((X)=>{$.onLeave(Z,X)});else await m8(Z,G);Z.classList.remove(J.leaveActive),Z.classList.remove(J.leaveTo),$.onAfterLeave?.(Z)}function P2(Z,$={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return Z.replace(J,(G,X,Q)=>{let K=C2(X),q=K.name||"stx",_=K.duration||300,j=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
4314
5106
  <div
4315
5107
  class="stx-transition-wrapper"
4316
5108
  data-transition="${q}"
@@ -4352,7 +5144,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4352
5144
  });
4353
5145
  })();
4354
5146
  </script>
4355
- `})}function k2(Z){let $={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3]||J[4]||J[5];switch(G){case"name":$.name=X;break;case"duration":$.duration=parseInt(X,10);break;case"mode":$.mode=X;break;case"easing":$.easing=X;break}}return $}function S2(){return`
5147
+ `})}function C2(Z){let $={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3]||J[4]||J[5];switch(G){case"name":$.name=X;break;case"duration":$.duration=parseInt(X,10);break;case"mode":$.mode=X;break;case"easing":$.easing=X;break}}return $}function y2(){return`
4356
5148
  /* STX Transition Presets */
4357
5149
 
4358
5150
  /* Fade */
@@ -4539,7 +5331,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4539
5331
  opacity: 1;
4540
5332
  max-height: 1000px;
4541
5333
  }
4542
- `}function b2(){return`
5334
+ `}function x2(){return`
4543
5335
  // STX Transition Runtime
4544
5336
  (function() {
4545
5337
  if (typeof window === 'undefined') return;
@@ -4627,7 +5419,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4627
5419
 
4628
5420
  console.log('[stx] Transition runtime initialized');
4629
5421
  })();
4630
- `}function P2(Z){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return Z.replace($,(Y,J,G,X)=>{let Q=G||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var p8={};t(p8,{withErrorBoundary:()=>u8,processErrorBoundaryDirectives:()=>x2,generateErrorBoundaryRuntime:()=>d2,generateErrorBoundaryCSS:()=>h2,createErrorBoundary:()=>g2});function y2(){return`eb-${++C2}-${Date.now().toString(36)}`}function x2(Z,$={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return Z.replace(J,(G,X,Q,K)=>{let q=y2(),_=v2(X||"");return f2(q,Q.trim(),K.trim(),_)})}function v2(Z){let $={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3]||J[4];switch(G){case"id":$.id=X;break;case"logErrors":$.logErrors=X==="true";break}}return $}function f2(Z,$,Y,J){let G=J.logErrors!==!1;return`
5422
+ `}function v2(Z){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return Z.replace($,(Y,J,G,X)=>{let Q=G||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var l8={};ZZ(l8,{withErrorBoundary:()=>c8,processErrorBoundaryDirectives:()=>h2,generateErrorBoundaryRuntime:()=>c2,generateErrorBoundaryCSS:()=>p2,createErrorBoundary:()=>u2});function g2(){return`eb-${++f2}-${Date.now().toString(36)}`}function h2(Z,$={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return Z.replace(J,(G,X,Q,K)=>{let q=g2(),_=d2(X||"");return m2(q,Q.trim(),K.trim(),_)})}function d2(Z){let $={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3]||J[4];switch(G){case"id":$.id=X;break;case"logErrors":$.logErrors=X==="true";break}}return $}function m2(Z,$,Y,J){let G=J.logErrors!==!1;return`
4631
5423
  <div class="stx-error-boundary" data-boundary-id="${Z}" data-has-error="false">
4632
5424
  <div class="stx-error-boundary-content" data-boundary-content="${Z}">
4633
5425
  ${$}
@@ -4747,7 +5539,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4747
5539
  };
4748
5540
  })();
4749
5541
  </script>
4750
- `}async function u8(Z,$,Y){try{return await Z()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return $}}function g2(Z,$={}){let Y=$.onError?(J)=>$.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>u8(J,Z,Y)}function h2(){return`
5542
+ `}async function c8(Z,$,Y){try{return await Z()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return $}}function u2(Z,$={}){let Y=$.onError?(J)=>$.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>c8(J,Z,Y)}function p2(){return`
4751
5543
  /* STX Error Boundary Styles */
4752
5544
  .stx-error-boundary {
4753
5545
  position: relative;
@@ -4791,7 +5583,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4791
5583
  color: #fecaca;
4792
5584
  }
4793
5585
  }
4794
- `}function d2(){return`
5586
+ `}function c2(){return`
4795
5587
  // STX Error Boundary Runtime
4796
5588
  (function() {
4797
5589
  if (typeof window === 'undefined') return;
@@ -4856,7 +5648,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
4856
5648
 
4857
5649
  console.log('[stx] Error boundary runtime initialized');
4858
5650
  })();
4859
- `}var C2=0;var c8={};t(c8,{renderSSRSuspense:()=>n2,processSuspenseDirectives:()=>p2,generateSuspenseRuntime:()=>o2,generateSuspenseCSS:()=>s2,createSSRSuspense:()=>i2});function u2(){return`suspense-${++m2}-${Date.now().toString(36)}`}function p2(Z,$={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return Z.replace(J,(G,X,Q,K)=>{let q=u2(),_=c2(X||"");return l2(q,Q.trim(),K.trim(),_)})}function c2(Z){let $={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"id":$.id=X;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function l2(Z,$,Y,J){let G=J.timeout||30000,X=J.id||Z;return`
5651
+ `}var f2=0;var i8={};ZZ(i8,{renderSSRSuspense:()=>a2,processSuspenseDirectives:()=>n2,generateSuspenseRuntime:()=>e2,generateSuspenseCSS:()=>t2,createSSRSuspense:()=>r2});function i2(){return`suspense-${++l2}-${Date.now().toString(36)}`}function n2(Z,$={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return Z.replace(J,(G,X,Q,K)=>{let q=i2(),_=s2(X||"");return o2(q,Q.trim(),K.trim(),_)})}function s2(Z){let $={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"id":$.id=X;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function o2(Z,$,Y,J){let G=J.timeout||30000,X=J.id||Z;return`
4860
5652
  <div class="stx-suspense" data-suspense-id="${Z}" data-custom-id="${X}" data-status="pending">
4861
5653
  <div class="stx-suspense-fallback" data-suspense-fallback="${Z}">
4862
5654
  ${Y}
@@ -5044,7 +5836,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5044
5836
  }, 0);
5045
5837
  })();
5046
5838
  </script>
5047
- `}function i2(Z,$,Y){return{id:Z,fallback:Y,content:$}}async function n2(Z){let $=Z.map((J)=>`
5839
+ `}function r2(Z,$,Y){return{id:Z,fallback:Y,content:$}}async function a2(Z){let $=Z.map((J)=>`
5048
5840
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
5049
5841
  ${J.fallback}
5050
5842
  </div>
@@ -5069,7 +5861,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5069
5861
  }
5070
5862
  })();
5071
5863
  </script>
5072
- `}}return{initial:$,streaming:Y()}}function s2(){return`
5864
+ `}}return{initial:$,streaming:Y()}}function t2(){return`
5073
5865
  /* STX Suspense Styles */
5074
5866
  .stx-suspense {
5075
5867
  position: relative;
@@ -5125,7 +5917,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5125
5917
  background-size: 200% 100%;
5126
5918
  }
5127
5919
  }
5128
- `}function o2(){return`
5920
+ `}function e2(){return`
5129
5921
  // STX Suspense Runtime
5130
5922
  (function() {
5131
5923
  if (typeof window === 'undefined') return;
@@ -5190,7 +5982,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5190
5982
 
5191
5983
  console.log('[stx] Suspense runtime initialized');
5192
5984
  })();
5193
- `}var m2=0;var s8={};t(s8,{processAsyncDirectives:()=>a2,isAsyncComponent:()=>e2,generateAsyncComponentRuntime:()=>$X,generateAsyncComponentCSS:()=>ZX,defineAsyncComponent:()=>t2});function l8(){return`async-${++r2}-${Date.now().toString(36)}`}function a2(Z,$={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,G=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=Z;return X=X.replace(J,(Q,K,q,_)=>{let j=l8(),B=i8(K);return n8(j,B,q.trim(),_.trim())}),X=X.replace(G,(Q,K,q)=>{let _=l8(),j=i8(K);return n8(_,j,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function i8(Z){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3],Q=J[4],K=J[5];switch(G){case"component":$.component=X||K||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=K==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=X||K;break;case"errorComponent":$.errorComponent=X||K;break}}return $}function n8(Z,$,Y,J){let{component:G,timeout:X,delay:Q,suspensible:K,retries:q}=$;return`
5985
+ `}var l2=0;var r8={};ZZ(r8,{processAsyncDirectives:()=>$X,isAsyncComponent:()=>JX,generateAsyncComponentRuntime:()=>GX,generateAsyncComponentCSS:()=>XX,defineAsyncComponent:()=>YX});function n8(){return`async-${++ZX}-${Date.now().toString(36)}`}function $X(Z,$={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,G=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=Z;return X=X.replace(J,(Q,K,q,_)=>{let j=n8(),B=s8(K);return o8(j,B,q.trim(),_.trim())}),X=X.replace(G,(Q,K,q)=>{let _=n8(),j=s8(K);return o8(_,j,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function s8(Z){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3],Q=J[4],K=J[5];switch(G){case"component":$.component=X||K||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=K==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=X||K;break;case"errorComponent":$.errorComponent=X||K;break}}return $}function o8(Z,$,Y,J){let{component:G,timeout:X,delay:Q,suspensible:K,retries:q}=$;return`
5194
5986
  <div class="stx-async-component" data-async-id="${Z}" data-component="${G}" data-status="pending">
5195
5987
  <div class="stx-async-loading" data-async-loading="${Z}">
5196
5988
  ${Y}
@@ -5368,7 +6160,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5368
6160
  loadComponent();
5369
6161
  })();
5370
6162
  </script>
5371
- `}function t2(Z){return{__asyncComponent:!0,...typeof Z==="function"?{loader:Z}:Z}}function e2(Z){return typeof Z==="object"&&Z!==null&&"__asyncComponent"in Z&&Z.__asyncComponent===!0}function ZX(){return`
6163
+ `}function YX(Z){return{__asyncComponent:!0,...typeof Z==="function"?{loader:Z}:Z}}function JX(Z){return typeof Z==="object"&&Z!==null&&"__asyncComponent"in Z&&Z.__asyncComponent===!0}function XX(){return`
5372
6164
  /* STX Async Component Styles */
5373
6165
  .stx-async-component {
5374
6166
  position: relative;
@@ -5442,7 +6234,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5442
6234
  background-size: 200% 100%;
5443
6235
  }
5444
6236
  }
5445
- `}function $X(){return`
6237
+ `}function GX(){return`
5446
6238
  // STX Async Component Runtime
5447
6239
  (function() {
5448
6240
  if (typeof window === 'undefined') return;
@@ -5494,7 +6286,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5494
6286
 
5495
6287
  console.log('[stx] Async component runtime initialized');
5496
6288
  })();
5497
- `}var r2=0;var r8={};t(r8,{shouldCacheComponent:()=>KX,processKeepAliveDirectives:()=>JX,onDeactivated:()=>BX,onActivated:()=>jX,generateKeepAliveRuntime:()=>_X,generateKeepAliveCSS:()=>qX,createKeepAliveCache:()=>QX});function o8(){return`keep-alive-${++YX}-${Date.now().toString(36)}`}function JX(Z,$={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return Z.replace(J,(G,X,Q)=>{let K=o8(),q=XX(X||"");return GX(K,Q.trim(),q)})}function XX(Z){let $={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=X;break;case"exclude":$.exclude=X;break;case"id":$.id=X;break}}return $}function GX(Z,$,Y){let{max:J,include:G,exclude:X}=Y,Q=Y.id||Z;return`
6289
+ `}var ZX=0;var t8={};ZZ(t8,{shouldCacheComponent:()=>BX,processKeepAliveDirectives:()=>KX,onDeactivated:()=>HX,onActivated:()=>UX,generateKeepAliveRuntime:()=>zX,generateKeepAliveCSS:()=>WX,createKeepAliveCache:()=>jX});function a8(){return`keep-alive-${++QX}-${Date.now().toString(36)}`}function KX(Z,$={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return Z.replace(J,(G,X,Q)=>{let K=a8(),q=qX(X||"");return _X(K,Q.trim(),q)})}function qX(Z){let $={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec(Z))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=X;break;case"exclude":$.exclude=X;break;case"id":$.id=X;break}}return $}function _X(Z,$,Y){let{max:J,include:G,exclude:X}=Y,Q=Y.id||Z;return`
5498
6290
  <div class="stx-keep-alive" data-keep-alive-id="${Z}" data-custom-id="${Q}">
5499
6291
  <div class="stx-keep-alive-content" data-keep-alive-content="${Z}">
5500
6292
  ${$}
@@ -5773,7 +6565,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5773
6565
  });
5774
6566
  })();
5775
6567
  </script>
5776
- `}function QX(Z={}){return{id:Z.id||o8(),cache:new Map,max:Z.max||10,include:Z.include?Z.include.split(",").map((Y)=>Y.trim()):null,exclude:Z.exclude?Z.exclude.split(",").map((Y)=>Y.trim()):null}}function KX(Z,$){if($.exclude&&$.exclude.includes(Z))return!1;if($.include&&!$.include.includes(Z))return!1;return!0}function qX(){return`
6568
+ `}function jX(Z={}){return{id:Z.id||a8(),cache:new Map,max:Z.max||10,include:Z.include?Z.include.split(",").map((Y)=>Y.trim()):null,exclude:Z.exclude?Z.exclude.split(",").map((Y)=>Y.trim()):null}}function BX(Z,$){if($.exclude&&$.exclude.includes(Z))return!1;if($.include&&!$.include.includes(Z))return!1;return!0}function WX(){return`
5777
6569
  /* STX Keep-Alive Styles */
5778
6570
  .stx-keep-alive {
5779
6571
  position: relative;
@@ -5798,7 +6590,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5798
6590
  .stx-keep-alive-content > [data-activated] {
5799
6591
  opacity: 1;
5800
6592
  }
5801
- `}function _X(){return`
6593
+ `}function zX(){return`
5802
6594
  // STX Keep-Alive Runtime
5803
6595
  (function() {
5804
6596
  if (typeof window === 'undefined') return;
@@ -5834,12 +6626,12 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5834
6626
 
5835
6627
  console.log('[stx] Keep-alive runtime initialized');
5836
6628
  })();
5837
- `}function jX(Z){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{Z($.detail)})}function BX(Z){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{Z($.detail)})}var YX=0;var $3={};t($3,{useVirtualList:()=>t8,processVirtualListDirectives:()=>l7,processVirtualGridDirectives:()=>Z3,processInfiniteListDirectives:()=>e8,generateVirtualListCSS:()=>a8,default:()=>WX,createVirtualList:()=>c7});function c7(Z,$){let{itemHeight:Y,containerHeight:J,overscan:G=3,keyProperty:X="id",dynamicHeight:Q=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=$,_=[...Z],j=0,B=new Map;function W(){if(Q)return U();let R=Math.max(0,Math.floor(j/Y)-G),N=Math.ceil(J/Y),w=Math.min(_.length-1,R+N+G*2);return{startIndex:R,endIndex:w}}function U(){let R=0,N=0,w=_.length-1;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(R+E>j){N=Math.max(0,D-G);break}R+=E}R=0;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(R+=E,R>j+J){w=Math.min(_.length-1,D+G);break}}return{startIndex:N,endIndex:w}}function z(){if(Q){let R=0;for(let N=0;N<_.length;N++)R+=B.get(N)||K;return R}return _.length*Y}function H(R){if(Q){let N=0;for(let w=0;w<R;w++)N+=B.get(w)||K;return N}return R*Y}function L(){let{startIndex:R,endIndex:N}=W();return{startIndex:R,endIndex:N,scrollTop:j,totalHeight:z(),visibleItems:_.slice(R,N+1),itemHeights:new Map(B)}}function F(R,N="auto"){let w=H(R);O(w,N)}function O(R,N="auto"){j=Math.max(0,Math.min(R,z()-J))}function A(){W()}function M(R){_=[...R],B.clear(),A()}function V(){_=[],B.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:A,setItems:M,destroy:V}}function l7(Z,$={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return Z.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=$[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let j={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),A=Function(`return ${O}`)();j={...j,...A}}catch{}let B=`vlist-${Math.random().toString(36).substring(2,9)}`,W=Math.ceil(j.containerHeight/j.itemHeight),U=j.overscan||3,z=0,H=Math.min(_.length-1,W+U),L="";for(let O=z;O<=H&&O<_.length;O++){let A=_[O],M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(V,R)=>{if(typeof A==="object"&&A!==null)return String(A[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
6629
+ `}function UX(Z){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{Z($.detail)})}function HX(Z){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{Z($.detail)})}var QX=0;var J3={};ZZ(J3,{useVirtualList:()=>Z3,processVirtualListDirectives:()=>i7,processVirtualGridDirectives:()=>Y3,processInfiniteListDirectives:()=>$3,generateVirtualListCSS:()=>e8,default:()=>OX,createVirtualList:()=>l7});function l7(Z,$){let{itemHeight:Y,containerHeight:J,overscan:G=3,keyProperty:X="id",dynamicHeight:Q=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=$,_=[...Z],j=0,B=new Map;function W(){if(Q)return U();let N=Math.max(0,Math.floor(j/Y)-G),R=Math.ceil(J/Y),w=Math.min(_.length-1,N+R+G*2);return{startIndex:N,endIndex:w}}function U(){let N=0,R=0,w=_.length-1;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(N+E>j){R=Math.max(0,D-G);break}N+=E}N=0;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(N+=E,N>j+J){w=Math.min(_.length-1,D+G);break}}return{startIndex:R,endIndex:w}}function z(){if(Q){let N=0;for(let R=0;R<_.length;R++)N+=B.get(R)||K;return N}return _.length*Y}function H(N){if(Q){let R=0;for(let w=0;w<N;w++)R+=B.get(w)||K;return R}return N*Y}function F(){let{startIndex:N,endIndex:R}=W();return{startIndex:N,endIndex:R,scrollTop:j,totalHeight:z(),visibleItems:_.slice(N,R+1),itemHeights:new Map(B)}}function O(N,R="auto"){let w=H(N);L(w,R)}function L(N,R="auto"){j=Math.max(0,Math.min(N,z()-J))}function A(){W()}function M(N){_=[...N],B.clear(),A()}function V(){_=[],B.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:F,refresh:A,setItems:M,destroy:V}}function i7(Z,$={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return Z.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=$[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let j={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),A=Function(`return ${L}`)();j={...j,...A}}catch{}let B=`vlist-${Math.random().toString(36).substring(2,9)}`,W=Math.ceil(j.containerHeight/j.itemHeight),U=j.overscan||3,z=0,H=Math.min(_.length-1,W+U),F="";for(let L=z;L<=H&&L<_.length;L++){let A=_[L],M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(V,N)=>{if(typeof A==="object"&&A!==null)return String(A[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));F+=`
5838
6630
  <div class="virtual-item ${j.itemClass||""}"
5839
- style="position: absolute; top: ${O*j.itemHeight}px; height: ${j.itemHeight}px; width: 100%;"
5840
- data-index="${O}">
6631
+ style="position: absolute; top: ${L*j.itemHeight}px; height: ${j.itemHeight}px; width: 100%;"
6632
+ data-index="${L}">
5841
6633
  ${M}
5842
- </div>`}let F=_.length*j.itemHeight;return`
6634
+ </div>`}let O=_.length*j.itemHeight;return`
5843
6635
  <div id="${B}"
5844
6636
  class="virtual-list-container ${j.containerClass||""}"
5845
6637
  style="position: relative; height: ${j.containerHeight}px; overflow-y: auto;"
@@ -5847,8 +6639,8 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5847
6639
  data-total-items="${_.length}"
5848
6640
  data-overscan="${U}">
5849
6641
  <div class="virtual-list-viewport ${j.viewportClass||""}"
5850
- style="position: relative; height: ${F}px; width: 100%;">
5851
- ${L}
6642
+ style="position: relative; height: ${O}px; width: 100%;">
6643
+ ${F}
5852
6644
  </div>
5853
6645
  </div>
5854
6646
  <script data-virtual-list="${B}">
@@ -5911,7 +6703,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5911
6703
  };
5912
6704
  })();
5913
6705
  </script>
5914
- `})}function a8(){return`
6706
+ `})}function e8(){return`
5915
6707
  .virtual-list-container {
5916
6708
  position: relative;
5917
6709
  overflow-y: auto;
@@ -5959,7 +6751,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5959
6751
  0% { background-position: 200% 0; }
5960
6752
  100% { background-position: -200% 0; }
5961
6753
  }
5962
- `}function t8(Z,$){let Y=null,J=()=>{if(!Y)Y=c7(Z(),$);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(G)=>{let X=G.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(G)=>({style:{position:"absolute",top:`${G*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":G}),scrollToIndex:(G)=>{J().scrollToIndex(G)}}}function e8(Z,$={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return Z.replace(J,(G,X,Q,K,q)=>{let _=X.trim(),j=$[_];if(!j||!Array.isArray(j))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let B={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let z=Function(`return ${Q.trim()}`)();B={...B,...z}}catch{}let W=`ilist-${Math.random().toString(36).substring(2,9)}`,U=l7(`@virtualList(${_}, ${JSON.stringify({itemHeight:B.itemHeight,containerHeight:B.containerHeight,overscan:B.overscan,containerClass:B.containerClass})})${K}@endvirtualList`,$);return U=U.replace("</script>",`
6754
+ `}function Z3(Z,$){let Y=null,J=()=>{if(!Y)Y=l7(Z(),$);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(G)=>{let X=G.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(G)=>({style:{position:"absolute",top:`${G*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":G}),scrollToIndex:(G)=>{J().scrollToIndex(G)}}}function $3(Z,$={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return Z.replace(J,(G,X,Q,K,q)=>{let _=X.trim(),j=$[_];if(!j||!Array.isArray(j))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let B={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let z=Function(`return ${Q.trim()}`)();B={...B,...z}}catch{}let W=`ilist-${Math.random().toString(36).substring(2,9)}`,U=i7(`@virtualList(${_}, ${JSON.stringify({itemHeight:B.itemHeight,containerHeight:B.containerHeight,overscan:B.overscan,containerClass:B.containerClass})})${K}@endvirtualList`,$);return U=U.replace("</script>",`
5963
6755
  // Infinite scroll detection
5964
6756
  container.addEventListener('scroll', function() {
5965
6757
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -5977,9 +6769,9 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5977
6769
  ${q}
5978
6770
  </div>
5979
6771
  </div>
5980
- `})}function Z3(Z,$={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return Z.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=$[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let j={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let A=Function(`return ${Q.trim()}`)();j={...j,...A}}catch{}let B=`vgrid-${Math.random().toString(36).substring(2,9)}`,W=Math.ceil(_.length/j.columns),U=W*(j.rowHeight+(j.gap||0)),z=Math.ceil(j.containerHeight/(j.rowHeight+(j.gap||0))),H=j.overscan||2,L=0,F=Math.min(W-1,z+H),O="";for(let A=L;A<=F;A++)for(let M=0;M<j.columns;M++){let V=A*j.columns+M;if(V>=_.length)break;let R=_[V],N=M*(100/j.columns),w=A*(j.rowHeight+(j.gap||0)),D=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(E,k)=>{if(typeof R==="object"&&R!==null)return String(R[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(V));O+=`
6772
+ `})}function Y3(Z,$={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return Z.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=$[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let j={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let A=Function(`return ${Q.trim()}`)();j={...j,...A}}catch{}let B=`vgrid-${Math.random().toString(36).substring(2,9)}`,W=Math.ceil(_.length/j.columns),U=W*(j.rowHeight+(j.gap||0)),z=Math.ceil(j.containerHeight/(j.rowHeight+(j.gap||0))),H=j.overscan||2,F=0,O=Math.min(W-1,z+H),L="";for(let A=F;A<=O;A++)for(let M=0;M<j.columns;M++){let V=A*j.columns+M;if(V>=_.length)break;let N=_[V],R=M*(100/j.columns),w=A*(j.rowHeight+(j.gap||0)),D=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(E,k)=>{if(typeof N==="object"&&N!==null)return String(N[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(V));L+=`
5981
6773
  <div class="virtual-grid-item"
5982
- style="position: absolute; top: ${w}px; left: ${N}%; width: calc(${100/j.columns}% - ${j.gap||0}px); height: ${j.rowHeight}px;"
6774
+ style="position: absolute; top: ${w}px; left: ${R}%; width: calc(${100/j.columns}% - ${j.gap||0}px); height: ${j.rowHeight}px;"
5983
6775
  data-index="${V}">
5984
6776
  ${D}
5985
6777
  </div>`}return`
@@ -5988,7 +6780,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
5988
6780
  style="position: relative; height: ${j.containerHeight}px; overflow-y: auto;">
5989
6781
  <div class="virtual-grid-viewport"
5990
6782
  style="position: relative; height: ${U}px; width: 100%;">
5991
- ${O}
6783
+ ${L}
5992
6784
  </div>
5993
6785
  </div>
5994
6786
  <script data-virtual-grid="${B}">
@@ -6047,7 +6839,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6047
6839
  });
6048
6840
  })();
6049
6841
  </script>
6050
- `})}var WX;var Y3=I(()=>{WX={createVirtualList:c7,processVirtualListDirectives:l7,processInfiniteListDirectives:e8,processVirtualGridDirectives:Z3,generateVirtualListCSS:a8,useVirtualList:t8}});function J3(){return`<script data-stx-hydration-runtime>
6842
+ `})}var OX;var X3=I(()=>{OX={createVirtualList:l7,processVirtualListDirectives:i7,processInfiniteListDirectives:$3,processVirtualGridDirectives:Y3,generateVirtualListCSS:e8,useVirtualList:Z3}});function G3(){return`<script data-stx-hydration-runtime>
6051
6843
  (function() {
6052
6844
  'use strict';
6053
6845
 
@@ -6201,7 +6993,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6201
6993
  stxIslands.initIslands();
6202
6994
  }
6203
6995
  })();
6204
- </script>`}function X3(Z){let $=Z.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Y=Z.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function G3(Z,$){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,G;while((G=J.exec(Z))!==null){let X=G[1],Q=G[2];if(Q in $)Y[X]=$[Q];else Y[X]=Q}return Y}var O3={};t(O3,{processStaticDirectives:()=>U3,processPartialHydrationDirectives:()=>K3,onHydrated:()=>z3,isHydrated:()=>W3,hydrateIsland:()=>_3,hydrateByStrategy:()=>j3,hydrateAll:()=>B3,generatePartialHydrationCSS:()=>q3,generateIslandManifest:()=>H3,default:()=>RX,createIslandRegistry:()=>Q3});function Q3(){let Z=new Map;return{islands:Z,register($){Z.set($.id,$)},get($){return Z.get($)},async hydrate($){let Y=Z.get($);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Y.component}}))},async hydrateAll(){let $=Array.from(Z.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all($)}}}function zX(Z){return`
6996
+ </script>`}function Q3(Z){let $=Z.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Y=Z.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function K3(Z,$){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,G;while((G=J.exec(Z))!==null){let X=G[1],Q=G[2];if(Q in $)Y[X]=$[Q];else Y[X]=Q}return Y}var F3={};ZZ(F3,{processStaticDirectives:()=>O3,processPartialHydrationDirectives:()=>_3,onHydrated:()=>H3,isHydrated:()=>U3,hydrateIsland:()=>B3,hydrateByStrategy:()=>W3,hydrateAll:()=>z3,generatePartialHydrationCSS:()=>j3,generateIslandManifest:()=>L3,default:()=>wX,createIslandRegistry:()=>q3});function q3(){let Z=new Map;return{islands:Z,register($){Z.set($.id,$)},get($){return Z.get($)},async hydrate($){let Y=Z.get($);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Y.component}}))},async hydrateAll(){let $=Array.from(Z.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all($)}}}function LX(Z){return`
6205
6997
  <script data-hydrate="${Z}">
6206
6998
  (function() {
6207
6999
  const island = document.querySelector('[data-island="${Z}"]');
@@ -6212,7 +7004,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6212
7004
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
6213
7005
  })();
6214
7006
  </script>
6215
- `}function UX(Z,$){let Y=$.timeout||2000,J=$.priority||"low";return`
7007
+ `}function FX(Z,$){let Y=$.timeout||2000,J=$.priority||"low";return`
6216
7008
  <script data-hydrate="${Z}">
6217
7009
  (function() {
6218
7010
  const island = document.querySelector('[data-island="${Z}"]');
@@ -6246,7 +7038,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6246
7038
  }
6247
7039
  })();
6248
7040
  </script>
6249
- `}function HX(Z,$){let Y=$.rootMargin||"0px",J=$.threshold||0;return`
7041
+ `}function AX(Z,$){let Y=$.rootMargin||"0px",J=$.threshold||0;return`
6250
7042
  <script data-hydrate="${Z}">
6251
7043
  (function() {
6252
7044
  const island = document.querySelector('[data-island="${Z}"]');
@@ -6278,7 +7070,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6278
7070
  }
6279
7071
  })();
6280
7072
  </script>
6281
- `}function OX(Z,$){let Y=$.media||"(min-width: 768px)";return`
7073
+ `}function NX(Z,$){let Y=$.media||"(min-width: 768px)";return`
6282
7074
  <script data-hydrate="${Z}">
6283
7075
  (function() {
6284
7076
  const island = document.querySelector('[data-island="${Z}"]');
@@ -6306,7 +7098,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6306
7098
  }
6307
7099
  })();
6308
7100
  </script>
6309
- `}function LX(Z){return`
7101
+ `}function RX(Z){return`
6310
7102
  <script data-hydrate="${Z}">
6311
7103
  (function() {
6312
7104
  const island = document.querySelector('[data-island="${Z}"]');
@@ -6328,7 +7120,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6328
7120
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
6329
7121
  })();
6330
7122
  </script>
6331
- `}function FX(Z,$){let Y=$.event||"stx:activate";return`
7123
+ `}function VX(Z,$){let Y=$.event||"stx:activate";return`
6332
7124
  <script data-hydrate="${Z}">
6333
7125
  (function() {
6334
7126
  const island = document.querySelector('[data-island="${Z}"]');
@@ -6349,9 +7141,9 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6349
7141
  });
6350
7142
  })();
6351
7143
  </script>
6352
- `}function K3(Z,$={},Y){let J=Z,G=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test(Z);if(J=Y4(J,"load",$),J=Y4(J,"idle",$),J=Y4(J,"visible",$),J=Y4(J,"media",$),J=AX(J),J=Y4(J,"hover",$),J=Y4(J,"event",$),G=X&&J!==Z,G)J+=`
6353
- `+J3();return J}function Y4(Z,$,Y){let J=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return Z.replace(J,(G,X,Q)=>{let K={strategy:$};if(X)try{let H=X.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((A)=>A.trim());if(F&&O){let A=O.replace(/^['"]|['"]$/g,"");K[F]=A}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=X3(Q.trim()),j=G3(Q.trim(),Y),B=[];if(K.rootMargin)B.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)B.push(`data-threshold="${K.threshold}"`);if(K.media)B.push(`data-media="${K.media}"`);if(K.event)B.push(`data-event="${K.event}"`);if(_)B.push(`data-component="${_}"`);let U=Object.keys(j).length>0?`
6354
- <script type="application/json" data-island-props="${q}">${JSON.stringify(j)}</script>`:"",z="";switch($){case"load":z=zX(q);break;case"idle":z=UX(q,K);break;case"visible":z=HX(q,K);break;case"media":z=OX(q,K);break;case"hover":z=LX(q);break;case"event":z=FX(q,K);break}return`
7144
+ `}function _3(Z,$={},Y){let J=Z,G=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test(Z);if(J=Y4(J,"load",$),J=Y4(J,"idle",$),J=Y4(J,"visible",$),J=Y4(J,"media",$),J=MX(J),J=Y4(J,"hover",$),J=Y4(J,"event",$),G=X&&J!==Z,G)J+=`
7145
+ `+G3();return J}function Y4(Z,$,Y){let J=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return Z.replace(J,(G,X,Q)=>{let K={strategy:$};if(X)try{let H=X.split(",").map((F)=>F.trim());for(let F of H){let[O,L]=F.split(":").map((A)=>A.trim());if(O&&L){let A=L.replace(/^['"]|['"]$/g,"");K[O]=A}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=Q3(Q.trim()),j=K3(Q.trim(),Y),B=[];if(K.rootMargin)B.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)B.push(`data-threshold="${K.threshold}"`);if(K.media)B.push(`data-media="${K.media}"`);if(K.event)B.push(`data-event="${K.event}"`);if(_)B.push(`data-component="${_}"`);let U=Object.keys(j).length>0?`
7146
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(j)}</script>`:"",z="";switch($){case"load":z=LX(q);break;case"idle":z=FX(q,K);break;case"visible":z=AX(q,K);break;case"media":z=NX(q,K);break;case"hover":z=RX(q);break;case"event":z=VX(q,K);break}return`
6355
7147
  <div data-island="${q}"
6356
7148
  data-strategy="${$}"
6357
7149
  ${B.join(`
@@ -6361,7 +7153,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6361
7153
  ${Q.trim()}${U}
6362
7154
  </div>
6363
7155
  ${z}
6364
- `})}function AX(Z){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return Z.replace($,(Y,J)=>{let G=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
7156
+ `})}function MX(Z){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return Z.replace($,(Y,J)=>{let G=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
6365
7157
  <div data-island="${G}"
6366
7158
  data-strategy="only"
6367
7159
  class="stx-island stx-client-only">
@@ -6380,7 +7172,7 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6380
7172
  }
6381
7173
  })();
6382
7174
  </script>
6383
- `})}function q3(){return`
7175
+ `})}function j3(){return`
6384
7176
  /* Island base styles */
6385
7177
  .stx-island {
6386
7178
  display: contents;
@@ -6421,11 +7213,11 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6421
7213
  .stx-island.hydrated {
6422
7214
  opacity: 1;
6423
7215
  }
6424
- `}function _3(Z){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${Z}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function j3(Z){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${Z}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function B3(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function W3(Z){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${Z}"]`)?.classList.contains("hydrated")??!1}function z3(Z){return new Promise(($)=>{if(typeof window>"u"){$();return}let Y=document.querySelector(`[data-island="${Z}"]`);if(!Y){$();return}if(Y.classList.contains("hydrated")){$();return}Y.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function U3(Z){return Z.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function H3(Z){let $=Z.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
7216
+ `}function B3(Z){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${Z}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function W3(Z){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${Z}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function z3(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function U3(Z){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${Z}"]`)?.classList.contains("hydrated")??!1}function H3(Z){return new Promise(($)=>{if(typeof window>"u"){$();return}let Y=document.querySelector(`[data-island="${Z}"]`);if(!Y){$();return}if(Y.classList.contains("hydrated")){$();return}Y.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function O3(Z){return Z.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function L3(Z){let $=Z.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
6425
7217
  <script type="application/json" id="stx-island-manifest">
6426
7218
  ${JSON.stringify($)}
6427
7219
  </script>
6428
- `}var RX;var L3=I(()=>{RX={processPartialHydrationDirectives:K3,processStaticDirectives:U3,generatePartialHydrationCSS:q3,generateIslandManifest:H3,createIslandRegistry:Q3,hydrateIsland:_3,hydrateByStrategy:j3,hydrateAll:B3,isHydrated:W3,onHydrated:z3}});var E3={};t(E3,{watchMultiple:()=>V3,watchEffect:()=>M3,watch:()=>N3,unref:()=>F3,toRefs:()=>A3,throttledComputed:()=>D3,stxWatchMultiple:()=>V3,stxWatchEffect:()=>M3,stxWatch:()=>N3,stxUnref:()=>F3,stxToRefs:()=>A3,stxThrottledComputed:()=>D3,stxShallowRef:()=>R3,stxRef:()=>J4,stxIsRef:()=>bZ,stxDebouncedComputed:()=>I3,stxComputed:()=>M4,shallowRef:()=>R3,ref:()=>J4,processWatchDirectives:()=>T3,processComputedDirectives:()=>w3,isRef:()=>bZ,default:()=>NX,debouncedComputed:()=>I3,computed:()=>M4});function J4(Z){let $=Z,Y=new Set,J={get value(){if(TZ){let G=V4.get(J);if(!G)G=new Set,V4.set(J,G);G.add(TZ)}return $},set value(G){if(!Object.is($,G)){$=G,Y.forEach((Q)=>Q(G));let X=V4.get(J);if(X)X.forEach((Q)=>Q())}},subscribe(G){return Y.add(G),()=>Y.delete(G)},peek(){return $}};return J}function bZ(Z){return Z!==null&&typeof Z==="object"&&"value"in Z&&"subscribe"in Z&&"peek"in Z}function F3(Z){return bZ(Z)?Z.value:Z}function A3(Z){let $={};for(let Y in Z)if(Object.prototype.hasOwnProperty.call(Z,Y))$[Y]=J4(Z[Y]);return $}function R3(Z){return J4(Z)}function M4(Z){let $=typeof Z==="function",Y=$?Z:Z.get,J=$?void 0:Z.set,G=$?Object.is:Z.equals||Object.is,X,Q=!0,K=new Set,q=new Set,_=()=>{if(Q=!0,q.size>0){let W=B.value;q.forEach((U)=>U(W))}};function j(){K.clear();let W=TZ;TZ=_,B5.push(_);try{return Y()}finally{B5.pop(),TZ=W}}let B={get value(){if(TZ){let W=V4.get(B);if(!W)W=new Set,V4.set(B,W);W.add(TZ)}if(Q){let W=j();if(!G(X,W))X=W;Q=!1}return X},set value(W){if(J)J(W);else console.warn("Computed property is readonly")},subscribe(W){return q.add(W),()=>q.delete(W)},peek(){if(Q)X=Y(),Q=!1;return X},invalidate(){Q=!0},get dirty(){return Q},get deps(){return K}};return B}function N3(Z,$,Y={}){let{immediate:J=!1,deep:G=!1,flush:X="pre",once:Q=!1}=Y,K,q=!0,_=!1,j=()=>{if(bZ(Z))return G?hZ(Z.value):Z.value;return Z()},B=()=>{if(!q||_)return;let z=j();if(K!==void 0&&Object.is(K,z)&&!G)return;let H=()=>{if($(z,K),K=G?hZ(z):z,Q)U()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},W=null;if(bZ(Z))W=Z.subscribe(()=>B());else W=M4(Z).subscribe(()=>B());if(J)K=void 0,B();else K=j();let U=()=>{if(q=!1,W)W(),W=null};return U.pause=()=>{_=!0},U.resume=()=>{_=!1},U}function V3(Z,$,Y={}){let{immediate:J=!1,once:G=!1}=Y,X=Z.map((B)=>bZ(B)?B.value:void 0),Q=!0,K=!1,q=()=>{if(!Q||K)return;let B=Z.map((W)=>bZ(W)?W.value:void 0);if($(B,X),X=[...B],G)j()},_=Z.map((B)=>{if(bZ(B))return B.subscribe(()=>q());return()=>{}});if(J)q();let j=()=>{Q=!1,_.forEach((B)=>B())};return j.pause=()=>{K=!0},j.resume=()=>{K=!1},j}function M3(Z,$={}){let{flush:Y="pre"}=$,J,G=!0,X=!1,Q=()=>{if(!G||X)return;if(J)J();let q=TZ;TZ=Q,B5.push(Q);try{J=Z()}finally{B5.pop(),TZ=q}};if(Y==="sync")Q();else if(Y==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let K=()=>{if(G=!1,J)J()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function w3(Z,$={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return Z.replace(J,(G,X,Q)=>{try{let q=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function T3(Z,$={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return Z.replace(J,(G,X,Q)=>{return`
7220
+ `}var wX;var A3=I(()=>{wX={processPartialHydrationDirectives:_3,processStaticDirectives:O3,generatePartialHydrationCSS:j3,generateIslandManifest:L3,createIslandRegistry:q3,hydrateIsland:B3,hydrateByStrategy:W3,hydrateAll:z3,isHydrated:U3,onHydrated:H3}});var S3={};ZZ(S3,{watchMultiple:()=>w3,watchEffect:()=>T3,watch:()=>M3,unref:()=>N3,toRefs:()=>R3,throttledComputed:()=>k3,stxWatchMultiple:()=>w3,stxWatchEffect:()=>T3,stxWatch:()=>M3,stxUnref:()=>N3,stxToRefs:()=>R3,stxThrottledComputed:()=>k3,stxShallowRef:()=>V3,stxRef:()=>J4,stxIsRef:()=>PZ,stxDebouncedComputed:()=>E3,stxComputed:()=>V4,shallowRef:()=>V3,ref:()=>J4,processWatchDirectives:()=>D3,processComputedDirectives:()=>I3,isRef:()=>PZ,default:()=>TX,debouncedComputed:()=>E3,computed:()=>V4});function J4(Z){let $=Z,Y=new Set,J={get value(){if(TZ){let G=R4.get(J);if(!G)G=new Set,R4.set(J,G);G.add(TZ)}return $},set value(G){if(!Object.is($,G)){$=G,Y.forEach((Q)=>Q(G));let X=R4.get(J);if(X)X.forEach((Q)=>Q())}},subscribe(G){return Y.add(G),()=>Y.delete(G)},peek(){return $}};return J}function PZ(Z){return Z!==null&&typeof Z==="object"&&"value"in Z&&"subscribe"in Z&&"peek"in Z}function N3(Z){return PZ(Z)?Z.value:Z}function R3(Z){let $={};for(let Y in Z)if(Object.prototype.hasOwnProperty.call(Z,Y))$[Y]=J4(Z[Y]);return $}function V3(Z){return J4(Z)}function V4(Z){let $=typeof Z==="function",Y=$?Z:Z.get,J=$?void 0:Z.set,G=$?Object.is:Z.equals||Object.is,X,Q=!0,K=new Set,q=new Set,_=()=>{if(Q=!0,q.size>0){let W=B.value;q.forEach((U)=>U(W))}};function j(){K.clear();let W=TZ;TZ=_,z5.push(_);try{return Y()}finally{z5.pop(),TZ=W}}let B={get value(){if(TZ){let W=R4.get(B);if(!W)W=new Set,R4.set(B,W);W.add(TZ)}if(Q){let W=j();if(!G(X,W))X=W;Q=!1}return X},set value(W){if(J)J(W);else console.warn("Computed property is readonly")},subscribe(W){return q.add(W),()=>q.delete(W)},peek(){if(Q)X=Y(),Q=!1;return X},invalidate(){Q=!0},get dirty(){return Q},get deps(){return K}};return B}function M3(Z,$,Y={}){let{immediate:J=!1,deep:G=!1,flush:X="pre",once:Q=!1}=Y,K,q=!0,_=!1,j=()=>{if(PZ(Z))return G?dZ(Z.value):Z.value;return Z()},B=()=>{if(!q||_)return;let z=j();if(K!==void 0&&Object.is(K,z)&&!G)return;let H=()=>{if($(z,K),K=G?dZ(z):z,Q)U()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},W=null;if(PZ(Z))W=Z.subscribe(()=>B());else W=V4(Z).subscribe(()=>B());if(J)K=void 0,B();else K=j();let U=()=>{if(q=!1,W)W(),W=null};return U.pause=()=>{_=!0},U.resume=()=>{_=!1},U}function w3(Z,$,Y={}){let{immediate:J=!1,once:G=!1}=Y,X=Z.map((B)=>PZ(B)?B.value:void 0),Q=!0,K=!1,q=()=>{if(!Q||K)return;let B=Z.map((W)=>PZ(W)?W.value:void 0);if($(B,X),X=[...B],G)j()},_=Z.map((B)=>{if(PZ(B))return B.subscribe(()=>q());return()=>{}});if(J)q();let j=()=>{Q=!1,_.forEach((B)=>B())};return j.pause=()=>{K=!0},j.resume=()=>{K=!1},j}function T3(Z,$={}){let{flush:Y="pre"}=$,J,G=!0,X=!1,Q=()=>{if(!G||X)return;if(J)J();let q=TZ;TZ=Q,z5.push(Q);try{J=Z()}finally{z5.pop(),TZ=q}};if(Y==="sync")Q();else if(Y==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let K=()=>{if(G=!1,J)J()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function I3(Z,$={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return Z.replace(J,(G,X,Q)=>{try{let q=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function D3(Z,$={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return Z.replace(J,(G,X,Q)=>{return`
6429
7221
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
6430
7222
  (function() {
6431
7223
  // Watch implementation for ${X}
@@ -6437,11 +7229,11 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6437
7229
  }
6438
7230
  })();
6439
7231
  </script>
6440
- `})}function hZ(Z){if(Z===null||typeof Z!=="object")return Z;if(Array.isArray(Z))return Z.map((Y)=>hZ(Y));if(Z instanceof Date)return new Date(Z.getTime());if(Z instanceof Map){let Y=new Map;return Z.forEach((J,G)=>Y.set(hZ(G),hZ(J))),Y}if(Z instanceof Set){let Y=new Set;return Z.forEach((J)=>Y.add(hZ(J))),Y}let $={};for(let Y in Z)if(Object.prototype.hasOwnProperty.call(Z,Y))$[Y]=hZ(Z[Y]);return $}function I3(Z,$=100){let Y=J4(Z()),J=null,G=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=Z()},$)};return M4(Z).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}function D3(Z,$=100){let Y=J4(Z()),J=0,G=()=>{let Q=Date.now();if(Q-J>=$)J=Q,Y.value=Z()};return M4(Z).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}var TZ=null,B5,V4,NX;var k3=I(()=>{B5=[],V4=new WeakMap;NX={ref:J4,computed:M4,watch:N3,watchMultiple:V3,watchEffect:M3,isRef:bZ,unref:F3,toRefs:A3,shallowRef:R3,debouncedComputed:I3,throttledComputed:D3,processComputedDirectives:w3,processWatchDirectives:T3}});var C3={};t(C3,{v:()=>VX,processHasErrorsDirective:()=>P3,processFormValidationDirectives:()=>wX,processErrorsDirective:()=>b3,processErrorDirective:()=>S3,defineForm:()=>MX,Validator:()=>X4});class X4{rules=[];defaultValue="";addRule(Z){let $=new X4;return $.rules=[...this.rules,Z],$.defaultValue=this.defaultValue,$}required(Z="This field is required"){return this.addRule({name:"required",message:Z,validate:($)=>{if($===null||$===void 0)return Z;if(typeof $==="string"&&$.trim()==="")return Z;if(Array.isArray($)&&$.length===0)return Z;return!0}})}email(Z="Please enter a valid email"){return this.addRule({name:"email",message:Z,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||Z}})}url(Z="Please enter a valid URL"){return this.addRule({name:"url",message:Z,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return Z}}})}min(Z,$){let Y=$||`Must be at least ${Z} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=Z||Y}})}max(Z,$){let Y=$||`Must be no more than ${Z} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=Z||Y}})}length(Z,$,Y){let J=Y||`Must be between ${Z} and ${$} characters`;return this.addRule({name:"length",message:J,validate:(G)=>{if(!G)return!0;let X=String(G).length;return X>=Z&&X<=$||J}})}pattern(Z,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Y)=>{if(!Y)return!0;return Z.test(String(Y))||$}})}hasUppercase(Z="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,Z)}hasLowercase(Z="Must contain a lowercase letter"){return this.pattern(/[a-z]/,Z)}hasNumber(Z="Must contain a number"){return this.pattern(/\d/,Z)}hasSpecial(Z="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,Z)}alphanumeric(Z="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,Z)}startsWithLetter(Z="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,Z)}noSpaces(Z="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:Z,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||Z}})}number(Z="Must be a number"){let $=this.addRule({name:"number",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||Z}});return $.defaultValue=0,$}integer(Z="Must be a whole number"){return this.addRule({name:"integer",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||Z}})}positive(Z="Must be a positive number"){return this.addRule({name:"positive",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||Z}})}negative(Z="Must be a negative number"){return this.addRule({name:"negative",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||Z}})}minValue(Z,$){let Y=$||`Must be at least ${Z}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=Z||Y}})}maxValue(Z,$){let Y=$||`Must be no more than ${Z}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=Z||Y}})}between(Z,$,Y){let J=Y||`Must be between ${Z} and ${$}`;return this.addRule({name:"between",message:J,validate:(G)=>{if(!G&&G!==0)return!0;let X=Number(G);return X>=Z&&X<=$||J}})}matches(Z,$){let Y=$||`Must match ${Z}`;return this.addRule({name:"matches",message:Y,validate:(J,G)=>{if(!G)return!0;return J===G[Z]||Y}})}oneOf(Z,$){let Y=$||`Must be one of: ${Z.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return Z.includes(J)||Y}})}notOneOf(Z,$){let Y=$||`Cannot be one of: ${Z.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!Z.includes(J)||Y}})}date(Z="Must be a valid date"){return this.addRule({name:"date",message:Z,validate:($)=>{if(!$)return!0;let Y=new Date(String($));return!Number.isNaN(Y.getTime())||Z}})}before(Z,$){let Y=new Date(Z),J=$||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(G)=>{if(!G)return!0;return new Date(String(G))<Y||J}})}after(Z,$){let Y=new Date(Z),J=$||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(G)=>{if(!G)return!0;return new Date(String(G))>Y||J}})}custom(Z,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:Z})}async(Z,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:Z})}when(Z,$){let Y=new X4;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of $.getRules())Y.rules.push({...J,validate:(G,X)=>{if(!Z(G,X||{}))return!0;return J.validate(G,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(Z){let $=new X4;return $.rules=[...this.rules],$.defaultValue=Z,$}async validate(Z,$){let Y=[];for(let J of this.rules){let G=await J.validate(Z,$);if(G!==!0)Y.push(G)}return Y}validateSync(Z,$){let Y=[];for(let J of this.rules){if(J.async)continue;let G=J.validate(Z,$);if(G!==!0)Y.push(G)}return Y}}function MX(Z,$){let Y=Object.keys(Z),J={},G={},X={},Q={},K={};for(let O of Y)J[O]=$?.[O]??Z[O].getDefaultValue(),G[O]=[],X[O]=!1,Q[O]=!1,K[O]=!1;let q=!1;async function _(O){K[O]=!0;let A=await Z[O].validate(J[O],J);return G[O]=A,K[O]=!1,A.length===0}async function j(){q=!0;let O=await Promise.all(Y.map(_));return q=!1,O.every(Boolean)}function B(){for(let O of Y)J[O]=$?.[O]??Z[O].getDefaultValue(),G[O]=[],X[O]=!1,Q[O]=!1}function W(O){for(let A of Y)if(A in O)J[A]=O[A],Q[A]=!0}function U(O,A){J[O]=A,Q[O]=!0}function z(O,A=!0){if(X[O]=A,A)_(O)}function H(O){return{value:J[O],errors:G[O],touched:X[O],dirty:Q[O],valid:G[O].length===0,validating:K[O]}}function L(O){return async(A)=>{A?.preventDefault?.();for(let V of Y)X[V]=!0;if(await j())await O(J)}}return{values:J,errors:G,touched:X,dirty:Q,get isValid(){return Y.every((O)=>G[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>Q[O])},validate:j,validateField:_,reset:B,setValues:W,setFieldValue:U,setFieldTouched:z,getFieldState:H,handleSubmit:L}}function S3(Z,$,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return Z.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=$;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,j)}).join(`
6441
- `)}catch{return""}})}function b3(Z,$,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return Z.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=$;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>Q.replace(/\{\{\s*message\s*\}\}/g,j)).join(`
6442
- `)}catch{return""}})}function P3(Z,$,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return Z.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=$;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return Q}catch{return""}})}function wX(Z,$,Y){let J=Z;return J=S3(J,$,Y),J=b3(J,$,Y),J=P3(J,$,Y),J}var VX;var y3=I(()=>{VX=new X4});var i7={};t(i7,{useTitle:()=>bX,useSeoMeta:()=>x3,usePageTitle:()=>bX,useHead:()=>w4,resetHead:()=>EX,renderHtmlAttrs:()=>CX,renderHead:()=>PX,renderBodyAttrs:()=>yX,processTitleDirective:()=>fX,processMetaDirective:()=>gX,processHeadDirective:()=>vX,getPageMeta:()=>DX,getHead:()=>IX,definePageMeta:()=>SX,applyHead:()=>xX});function IX(){return PZ}function DX(){return W5}function EX(){PZ={},TX.length=0,W5={}}function w4(Z){PZ=kX(PZ,Z)}function kX(Z,$){return{title:$.title??Z.title,titleTemplate:$.titleTemplate??Z.titleTemplate,base:$.base??Z.base,meta:[...Z.meta||[],...$.meta||[]],link:[...Z.link||[],...$.link||[]],script:[...Z.script||[],...$.script||[]],style:[...Z.style||[],...$.style||[]],htmlAttrs:{...Z.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...Z.bodyAttrs,...$.bodyAttrs}}}function x3(Z){let $=[];if(Z.description)$.push({name:"description",content:Z.description});if(Z.keywords){let q=Array.isArray(Z.keywords)?Z.keywords.join(", "):Z.keywords;$.push({name:"keywords",content:q})}if(Z.author)$.push({name:"author",content:Z.author});if(Z.robots)$.push({name:"robots",content:Z.robots});let Y=Z.ogTitle??Z.title,J=Z.ogDescription??Z.description;if(Y)$.push({property:"og:title",content:Y});if(J)$.push({property:"og:description",content:J});if(Z.ogImage)$.push({property:"og:image",content:Z.ogImage});if(Z.ogUrl)$.push({property:"og:url",content:Z.ogUrl});if(Z.ogType)$.push({property:"og:type",content:Z.ogType});if(Z.ogSiteName)$.push({property:"og:site_name",content:Z.ogSiteName});if(Z.ogLocale)$.push({property:"og:locale",content:Z.ogLocale});let G=Z.twitterTitle??Z.title,X=Z.twitterDescription??Z.description,Q=Z.twitterImage??Z.ogImage;if(Z.twitterCard)$.push({name:"twitter:card",content:Z.twitterCard});if(G)$.push({name:"twitter:title",content:G});if(X)$.push({name:"twitter:description",content:X});if(Q)$.push({name:"twitter:image",content:Q});if(Z.twitterSite)$.push({name:"twitter:site",content:Z.twitterSite});if(Z.twitterCreator)$.push({name:"twitter:creator",content:Z.twitterCreator});if(Z.articleAuthor)$.push({property:"article:author",content:Z.articleAuthor});if(Z.articlePublishedTime)$.push({property:"article:published_time",content:Z.articlePublishedTime});if(Z.articleModifiedTime)$.push({property:"article:modified_time",content:Z.articleModifiedTime});if(Z.articleSection)$.push({property:"article:section",content:Z.articleSection});if(Z.articleTags)for(let q of Z.articleTags)$.push({property:"article:tag",content:q});let K=[];if(Z.canonical)K.push({rel:"canonical",href:Z.canonical});w4({title:Z.title,titleTemplate:Z.titleTemplate,meta:$,link:K})}function SX(Z){if(W5={...W5,...Z},Z.title||Z.description)x3({title:Z.title,description:Z.description})}function bX(Z){let $=typeof Z==="function"?Z():Z;w4({title:$})}function PX(Z=PZ){let $=[];if(Z.title){let Y=Z.title;if(Z.titleTemplate)Y=typeof Z.titleTemplate==="function"?Z.titleTemplate(Y):Z.titleTemplate.replace("%s",Y);$.push(`<title>${dZ(Y)}</title>`)}if(Z.base){let Y=Object.entries(Z.base).map(([J,G])=>`${J}="${dZ(G)}"`).join(" ");$.push(`<base ${Y}>`)}for(let Y of Z.meta||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>{return`${G==="httpEquiv"?"http-equiv":G}="${dZ(String(X))}"`}).join(" ");$.push(`<meta ${J}>`)}for(let Y of Z.link||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>`${G}="${dZ(String(X))}"`).join(" ");$.push(`<link ${J}>`)}for(let Y of Z.script||[]){let{content:J,...G}=Y,X=Object.entries(G).filter(([Q,K])=>K!==void 0).map(([Q,K])=>{if(typeof K==="boolean")return K?Q:"";return`${Q}="${dZ(String(K))}"`}).filter(Boolean).join(" ");if(J)$.push(`<script ${X}>${J}</script>`);else $.push(`<script ${X}></script>`)}for(let Y of Z.style||[]){let J=Y.type?` type="${Y.type}"`:"";$.push(`<style${J}>${Y.content}</style>`)}return $.join(`
6443
- `)}function CX(Z=PZ){if(!Z.htmlAttrs)return"";return Object.entries(Z.htmlAttrs).map(([$,Y])=>`${$}="${dZ(Y)}"`).join(" ")}function yX(Z=PZ){if(!Z.bodyAttrs)return"";return Object.entries(Z.bodyAttrs).map(([$,Y])=>`${$}="${dZ(Y)}"`).join(" ")}function dZ(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function xX(Z=PZ){if(typeof document>"u")return;if(Z.title){let $=Z.title;if(Z.titleTemplate)$=typeof Z.titleTemplate==="function"?Z.titleTemplate($):Z.titleTemplate.replace("%s",$);document.title=$}for(let $ of Z.meta||[]){let Y=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),$.name)J.setAttribute("name",$.name);if($.property)J.setAttribute("property",$.property);document.head.appendChild(J)}J.setAttribute("content",$.content)}}for(let $ of Z.link||[]){let Y=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[G,X]of Object.entries($))if(X!==void 0)J.setAttribute(G,String(X))}if(Z.htmlAttrs)for(let[$,Y]of Object.entries(Z.htmlAttrs))document.documentElement.setAttribute($,Y);if(Z.bodyAttrs)for(let[$,Y]of Object.entries(Z.bodyAttrs))document.body.setAttribute($,Y)}function vX(Z){let $="";return{content:Z.replace(/@head\s*([\s\S]*?)@endhead/g,(J,G)=>{return $+=G.trim()+`
6444
- `,""}),headContent:$.trim()}}function fX(Z,$){return Z.replace(/@title\s*\(\s*(['"`]?)([^)]+)\1\s*\)/g,(Y,J,G)=>{let X=J?G:$[G.trim()]??G;return w4({title:X}),""})}function gX(Z,$){return Z.replace(/@meta\s*\(\s*(['"`])([^'"]+)\1\s*,\s*(['"`]?)([^)]+)\3\s*\)/g,(Y,J,G,X,Q)=>{let K=X?Q:$[Q.trim()]??Q,_=G.includes(":")?{property:G,content:K}:{name:G,content:K};return w4({meta:[_]}),""})}var PZ,TX,W5;var n7=I(()=>{PZ={},TX=[],W5={}});var g3={};t(g3,{processXElementDirectives:()=>hX,hasXElementDirectives:()=>f3,generateXElementRuntime:()=>v3});function v3(){return`<script>
7232
+ `})}function dZ(Z){if(Z===null||typeof Z!=="object")return Z;if(Array.isArray(Z))return Z.map((Y)=>dZ(Y));if(Z instanceof Date)return new Date(Z.getTime());if(Z instanceof Map){let Y=new Map;return Z.forEach((J,G)=>Y.set(dZ(G),dZ(J))),Y}if(Z instanceof Set){let Y=new Set;return Z.forEach((J)=>Y.add(dZ(J))),Y}let $={};for(let Y in Z)if(Object.prototype.hasOwnProperty.call(Z,Y))$[Y]=dZ(Z[Y]);return $}function E3(Z,$=100){let Y=J4(Z()),J=null,G=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=Z()},$)};return V4(Z).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}function k3(Z,$=100){let Y=J4(Z()),J=0,G=()=>{let Q=Date.now();if(Q-J>=$)J=Q,Y.value=Z()};return V4(Z).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}var TZ=null,z5,R4,TX;var b3=I(()=>{z5=[],R4=new WeakMap;TX={ref:J4,computed:V4,watch:M3,watchMultiple:w3,watchEffect:T3,isRef:PZ,unref:N3,toRefs:R3,shallowRef:V3,debouncedComputed:E3,throttledComputed:k3,processComputedDirectives:I3,processWatchDirectives:D3}});var x3={};ZZ(x3,{v:()=>IX,processHasErrorsDirective:()=>y3,processFormValidationDirectives:()=>EX,processErrorsDirective:()=>C3,processErrorDirective:()=>P3,defineForm:()=>DX,Validator:()=>X4});class X4{rules=[];defaultValue="";addRule(Z){let $=new X4;return $.rules=[...this.rules,Z],$.defaultValue=this.defaultValue,$}required(Z="This field is required"){return this.addRule({name:"required",message:Z,validate:($)=>{if($===null||$===void 0)return Z;if(typeof $==="string"&&$.trim()==="")return Z;if(Array.isArray($)&&$.length===0)return Z;return!0}})}email(Z="Please enter a valid email"){return this.addRule({name:"email",message:Z,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||Z}})}url(Z="Please enter a valid URL"){return this.addRule({name:"url",message:Z,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return Z}}})}min(Z,$){let Y=$||`Must be at least ${Z} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=Z||Y}})}max(Z,$){let Y=$||`Must be no more than ${Z} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=Z||Y}})}length(Z,$,Y){let J=Y||`Must be between ${Z} and ${$} characters`;return this.addRule({name:"length",message:J,validate:(G)=>{if(!G)return!0;let X=String(G).length;return X>=Z&&X<=$||J}})}pattern(Z,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Y)=>{if(!Y)return!0;return Z.test(String(Y))||$}})}hasUppercase(Z="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,Z)}hasLowercase(Z="Must contain a lowercase letter"){return this.pattern(/[a-z]/,Z)}hasNumber(Z="Must contain a number"){return this.pattern(/\d/,Z)}hasSpecial(Z="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,Z)}alphanumeric(Z="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,Z)}startsWithLetter(Z="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,Z)}noSpaces(Z="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:Z,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||Z}})}number(Z="Must be a number"){let $=this.addRule({name:"number",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||Z}});return $.defaultValue=0,$}integer(Z="Must be a whole number"){return this.addRule({name:"integer",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||Z}})}positive(Z="Must be a positive number"){return this.addRule({name:"positive",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||Z}})}negative(Z="Must be a negative number"){return this.addRule({name:"negative",message:Z,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||Z}})}minValue(Z,$){let Y=$||`Must be at least ${Z}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=Z||Y}})}maxValue(Z,$){let Y=$||`Must be no more than ${Z}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=Z||Y}})}between(Z,$,Y){let J=Y||`Must be between ${Z} and ${$}`;return this.addRule({name:"between",message:J,validate:(G)=>{if(!G&&G!==0)return!0;let X=Number(G);return X>=Z&&X<=$||J}})}matches(Z,$){let Y=$||`Must match ${Z}`;return this.addRule({name:"matches",message:Y,validate:(J,G)=>{if(!G)return!0;return J===G[Z]||Y}})}oneOf(Z,$){let Y=$||`Must be one of: ${Z.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return Z.includes(J)||Y}})}notOneOf(Z,$){let Y=$||`Cannot be one of: ${Z.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!Z.includes(J)||Y}})}date(Z="Must be a valid date"){return this.addRule({name:"date",message:Z,validate:($)=>{if(!$)return!0;let Y=new Date(String($));return!Number.isNaN(Y.getTime())||Z}})}before(Z,$){let Y=new Date(Z),J=$||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(G)=>{if(!G)return!0;return new Date(String(G))<Y||J}})}after(Z,$){let Y=new Date(Z),J=$||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(G)=>{if(!G)return!0;return new Date(String(G))>Y||J}})}custom(Z,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:Z})}async(Z,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:Z})}when(Z,$){let Y=new X4;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of $.getRules())Y.rules.push({...J,validate:(G,X)=>{if(!Z(G,X||{}))return!0;return J.validate(G,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(Z){let $=new X4;return $.rules=[...this.rules],$.defaultValue=Z,$}async validate(Z,$){let Y=[];for(let J of this.rules){let G=await J.validate(Z,$);if(G!==!0)Y.push(G)}return Y}validateSync(Z,$){let Y=[];for(let J of this.rules){if(J.async)continue;let G=J.validate(Z,$);if(G!==!0)Y.push(G)}return Y}}function DX(Z,$){let Y=Object.keys(Z),J={},G={},X={},Q={},K={};for(let L of Y)J[L]=$?.[L]??Z[L].getDefaultValue(),G[L]=[],X[L]=!1,Q[L]=!1,K[L]=!1;let q=!1;async function _(L){K[L]=!0;let A=await Z[L].validate(J[L],J);return G[L]=A,K[L]=!1,A.length===0}async function j(){q=!0;let L=await Promise.all(Y.map(_));return q=!1,L.every(Boolean)}function B(){for(let L of Y)J[L]=$?.[L]??Z[L].getDefaultValue(),G[L]=[],X[L]=!1,Q[L]=!1}function W(L){for(let A of Y)if(A in L)J[A]=L[A],Q[A]=!0}function U(L,A){J[L]=A,Q[L]=!0}function z(L,A=!0){if(X[L]=A,A)_(L)}function H(L){return{value:J[L],errors:G[L],touched:X[L],dirty:Q[L],valid:G[L].length===0,validating:K[L]}}function F(L){return async(A)=>{A?.preventDefault?.();for(let V of Y)X[V]=!0;if(await j())await L(J)}}return{values:J,errors:G,touched:X,dirty:Q,get isValid(){return Y.every((L)=>G[L].length===0)},get isValidating(){return q||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>Q[L])},validate:j,validateField:_,reset:B,setValues:W,setFieldValue:U,setFieldTouched:z,getFieldState:H,handleSubmit:F}}function P3(Z,$,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return Z.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=$;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,j)}).join(`
7233
+ `)}catch{return""}})}function C3(Z,$,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return Z.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=$;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>Q.replace(/\{\{\s*message\s*\}\}/g,j)).join(`
7234
+ `)}catch{return""}})}function y3(Z,$,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return Z.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=$;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return Q}catch{return""}})}function EX(Z,$,Y){let J=Z;return J=P3(J,$,Y),J=C3(J,$,Y),J=y3(J,$,Y),J}var IX;var v3=I(()=>{IX=new X4});var n7={};ZZ(n7,{useTitle:()=>xX,useSeoMeta:()=>f3,usePageTitle:()=>xX,useHead:()=>M4,resetHead:()=>PX,renderHtmlAttrs:()=>fX,renderHead:()=>vX,renderBodyAttrs:()=>gX,processTitleDirective:()=>mX,processMetaDirective:()=>uX,processHeadDirective:()=>dX,getPageMeta:()=>bX,getHead:()=>SX,definePageMeta:()=>yX,applyHead:()=>hX});function SX(){return CZ}function bX(){return U5}function PX(){CZ={},kX.length=0,U5={}}function M4(Z){CZ=CX(CZ,Z)}function CX(Z,$){return{title:$.title??Z.title,titleTemplate:$.titleTemplate??Z.titleTemplate,base:$.base??Z.base,meta:[...Z.meta||[],...$.meta||[]],link:[...Z.link||[],...$.link||[]],script:[...Z.script||[],...$.script||[]],style:[...Z.style||[],...$.style||[]],htmlAttrs:{...Z.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...Z.bodyAttrs,...$.bodyAttrs}}}function f3(Z){let $=[];if(Z.description)$.push({name:"description",content:Z.description});if(Z.keywords){let q=Array.isArray(Z.keywords)?Z.keywords.join(", "):Z.keywords;$.push({name:"keywords",content:q})}if(Z.author)$.push({name:"author",content:Z.author});if(Z.robots)$.push({name:"robots",content:Z.robots});let Y=Z.ogTitle??Z.title,J=Z.ogDescription??Z.description;if(Y)$.push({property:"og:title",content:Y});if(J)$.push({property:"og:description",content:J});if(Z.ogImage)$.push({property:"og:image",content:Z.ogImage});if(Z.ogUrl)$.push({property:"og:url",content:Z.ogUrl});if(Z.ogType)$.push({property:"og:type",content:Z.ogType});if(Z.ogSiteName)$.push({property:"og:site_name",content:Z.ogSiteName});if(Z.ogLocale)$.push({property:"og:locale",content:Z.ogLocale});let G=Z.twitterTitle??Z.title,X=Z.twitterDescription??Z.description,Q=Z.twitterImage??Z.ogImage;if(Z.twitterCard)$.push({name:"twitter:card",content:Z.twitterCard});if(G)$.push({name:"twitter:title",content:G});if(X)$.push({name:"twitter:description",content:X});if(Q)$.push({name:"twitter:image",content:Q});if(Z.twitterSite)$.push({name:"twitter:site",content:Z.twitterSite});if(Z.twitterCreator)$.push({name:"twitter:creator",content:Z.twitterCreator});if(Z.articleAuthor)$.push({property:"article:author",content:Z.articleAuthor});if(Z.articlePublishedTime)$.push({property:"article:published_time",content:Z.articlePublishedTime});if(Z.articleModifiedTime)$.push({property:"article:modified_time",content:Z.articleModifiedTime});if(Z.articleSection)$.push({property:"article:section",content:Z.articleSection});if(Z.articleTags)for(let q of Z.articleTags)$.push({property:"article:tag",content:q});let K=[];if(Z.canonical)K.push({rel:"canonical",href:Z.canonical});M4({title:Z.title,titleTemplate:Z.titleTemplate,meta:$,link:K})}function yX(Z){if(U5={...U5,...Z},Z.title||Z.description)f3({title:Z.title,description:Z.description})}function xX(Z){let $=typeof Z==="function"?Z():Z;M4({title:$})}function vX(Z=CZ){let $=[];if(Z.title){let Y=Z.title;if(Z.titleTemplate)Y=typeof Z.titleTemplate==="function"?Z.titleTemplate(Y):Z.titleTemplate.replace("%s",Y);$.push(`<title>${mZ(Y)}</title>`)}if(Z.base){let Y=Object.entries(Z.base).map(([J,G])=>`${J}="${mZ(G)}"`).join(" ");$.push(`<base ${Y}>`)}for(let Y of Z.meta||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>{return`${G==="httpEquiv"?"http-equiv":G}="${mZ(String(X))}"`}).join(" ");$.push(`<meta ${J}>`)}for(let Y of Z.link||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>`${G}="${mZ(String(X))}"`).join(" ");$.push(`<link ${J}>`)}for(let Y of Z.script||[]){let{content:J,...G}=Y,X=Object.entries(G).filter(([Q,K])=>K!==void 0).map(([Q,K])=>{if(typeof K==="boolean")return K?Q:"";return`${Q}="${mZ(String(K))}"`}).filter(Boolean).join(" ");if(J)$.push(`<script ${X}>${J}</script>`);else $.push(`<script ${X}></script>`)}for(let Y of Z.style||[]){let J=Y.type?` type="${Y.type}"`:"";$.push(`<style${J}>${Y.content}</style>`)}return $.join(`
7235
+ `)}function fX(Z=CZ){if(!Z.htmlAttrs)return"";return Object.entries(Z.htmlAttrs).map(([$,Y])=>`${$}="${mZ(Y)}"`).join(" ")}function gX(Z=CZ){if(!Z.bodyAttrs)return"";return Object.entries(Z.bodyAttrs).map(([$,Y])=>`${$}="${mZ(Y)}"`).join(" ")}function mZ(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function hX(Z=CZ){if(typeof document>"u")return;if(Z.title){let $=Z.title;if(Z.titleTemplate)$=typeof Z.titleTemplate==="function"?Z.titleTemplate($):Z.titleTemplate.replace("%s",$);document.title=$}for(let $ of Z.meta||[]){let Y=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),$.name)J.setAttribute("name",$.name);if($.property)J.setAttribute("property",$.property);document.head.appendChild(J)}J.setAttribute("content",$.content)}}for(let $ of Z.link||[]){let Y=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[G,X]of Object.entries($))if(X!==void 0)J.setAttribute(G,String(X))}if(Z.htmlAttrs)for(let[$,Y]of Object.entries(Z.htmlAttrs))document.documentElement.setAttribute($,Y);if(Z.bodyAttrs)for(let[$,Y]of Object.entries(Z.bodyAttrs))document.body.setAttribute($,Y)}function dX(Z){let $="";return{content:Z.replace(/@head\s*([\s\S]*?)@endhead/g,(J,G)=>{return $+=G.trim()+`
7236
+ `,""}),headContent:$.trim()}}function mX(Z,$){return Z.replace(/@title\s*\(\s*(['"`]?)([^)]+)\1\s*\)/g,(Y,J,G)=>{let X=J?G:$[G.trim()]??G;return M4({title:X}),""})}function uX(Z,$){return Z.replace(/@meta\s*\(\s*(['"`])([^'"]+)\1\s*,\s*(['"`]?)([^)]+)\3\s*\)/g,(Y,J,G,X,Q)=>{let K=X?Q:$[Q.trim()]??Q,_=G.includes(":")?{property:G,content:K}:{name:G,content:K};return M4({meta:[_]}),""})}var CZ,kX,U5;var s7=I(()=>{CZ={},kX=[],U5={}});var d3={};ZZ(d3,{processXElementDirectives:()=>pX,hasXElementDirectives:()=>h3,generateXElementRuntime:()=>g3});function g3(){return`<script>
6445
7237
  (function() {
6446
7238
  'use strict';
6447
7239
 
@@ -6528,11 +7320,23 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6528
7320
  this.watchExpression(expr, update);
6529
7321
  });
6530
7322
 
6531
- // Process @event (event handling)
7323
+ // Process x-show (toggle visibility)
7324
+ const shows = el.querySelectorAll('[x-show]');
7325
+ shows.forEach(elem => {
7326
+ const expr = elem.getAttribute('x-show');
7327
+ const update = () => {
7328
+ elem.style.display = this.evaluate(expr) ? '' : 'none';
7329
+ };
7330
+ update();
7331
+ this.watchExpression(expr, update);
7332
+ });
7333
+
7334
+ // Process @event and :bind attributes
6532
7335
  const allElements = el.querySelectorAll('*');
6533
7336
  allElements.forEach(elem => {
6534
7337
  Array.from(elem.attributes).forEach(attr => {
6535
7338
  if (attr.name.startsWith('@')) {
7339
+ // Event handling
6536
7340
  const eventName = attr.name.slice(1);
6537
7341
  const expr = attr.value;
6538
7342
 
@@ -6556,6 +7360,35 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6556
7360
 
6557
7361
  this.execute(expr, { $event: e, $el: elem });
6558
7362
  });
7363
+ } else if (attr.name.startsWith(':')) {
7364
+ // Attribute binding (:disabled, :class, :href, :src, etc.)
7365
+ const bindAttr = attr.name.slice(1);
7366
+ const expr = attr.value;
7367
+
7368
+ const update = () => {
7369
+ const val = this.evaluate(expr);
7370
+ if (bindAttr === 'class') {
7371
+ // :class supports object syntax { className: bool }
7372
+ if (val && typeof val === 'object') {
7373
+ for (const [cls, active] of Object.entries(val)) {
7374
+ elem.classList.toggle(cls, !!active);
7375
+ }
7376
+ } else if (typeof val === 'string') {
7377
+ elem.className = val;
7378
+ }
7379
+ } else if (typeof val === 'boolean') {
7380
+ // Boolean attributes (disabled, hidden, readonly, etc.)
7381
+ if (val) {
7382
+ elem.setAttribute(bindAttr, '');
7383
+ } else {
7384
+ elem.removeAttribute(bindAttr);
7385
+ }
7386
+ } else {
7387
+ elem.setAttribute(bindAttr, val != null ? String(val) : '');
7388
+ }
7389
+ };
7390
+ update();
7391
+ this.watchExpression(expr, update);
6559
7392
  }
6560
7393
  });
6561
7394
  });
@@ -6626,16 +7459,16 @@ ${SZ(Q,{...J,start:0,end:J.end-J.start},G)}
6626
7459
  // Expose for manual initialization
6627
7460
  window.XElement = XElement;
6628
7461
  })();
6629
- </script>`}function f3(Z){return/\bx-(data|model|text)\b/.test(Z)}function hX(Z){if(!f3(Z))return Z;let $=v3();if(Z.includes("</body>"))return Z.replace("</body>",`${$}
7462
+ </script>`}function h3(Z){return/\bx-(data|model|text|show)\b/.test(Z)||/\s:[a-z]/.test(Z)}function pX(Z){if(!h3(Z))return Z;let $=g3();if(Z.includes("</body>"))return Z.replace("</body>",`${$}
6630
7463
  </body>`);return Z+`
6631
- `+$}var h3=()=>{};function s7(Z){return Z.pwa?.serviceWorker?.fileName||"sw.js"}var d3=I(()=>{h3()});var u3={};t(u3,{injectPwaTags:()=>dX,generateThemeColorMeta:()=>pX,generateSwRegistrationScript:()=>mX,generatePwaTags:()=>z5,generateManifestLink:()=>uX});function z5(Z){let $=Z.pwa;if(!$?.enabled)return"";let Y=$.manifest,J=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",G=s7(Z),X=`
7464
+ `+$}var m3=()=>{};function o7(Z){return Z.pwa?.serviceWorker?.fileName||"sw.js"}var u3=I(()=>{m3()});var c3={};ZZ(c3,{injectPwaTags:()=>cX,generateThemeColorMeta:()=>nX,generateSwRegistrationScript:()=>lX,generatePwaTags:()=>H5,generateManifestLink:()=>iX});function H5(Z){let $=Z.pwa;if(!$?.enabled)return"";let Y=$.manifest,J=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",G=o7(Z),X=`
6632
7465
  <!-- stx PWA Meta Tags -->
6633
7466
  <link rel="manifest" href="/manifest.json">
6634
7467
  <meta name="theme-color" content="${Y?.themeColor||"#000000"}">
6635
7468
  <meta name="mobile-web-app-capable" content="yes">
6636
7469
  <meta name="apple-mobile-web-app-capable" content="yes">
6637
7470
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
6638
- <meta name="apple-mobile-web-app-title" content="${m3(Y?.shortName||Y?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)X+=`
7471
+ <meta name="apple-mobile-web-app-title" content="${p3(Y?.shortName||Y?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)X+=`
6639
7472
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
6640
7473
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
6641
7474
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -6672,12 +7505,12 @@ if ('serviceWorker' in navigator) {
6672
7505
  });
6673
7506
  }
6674
7507
  </script>
6675
- <!-- End stx PWA -->`,X}function dX(Z,$){let Y=$.pwa;if(!Y?.enabled||Y.autoInject===!1)return Z;if(Z.includes("<!-- stx PWA Meta Tags -->"))return Z;if(!Z.includes("</head>")){if(Z.includes("</body>")){let G=z5($);return Z.replace("</body>",`${G}
6676
- </body>`)}return Z+z5($)}let J=z5($);return Z.replace("</head>",`${J}
6677
- </head>`)}function mX(Z){if(!Z.pwa?.enabled)return"";return`<script>
7508
+ <!-- End stx PWA -->`,X}function cX(Z,$){let Y=$.pwa;if(!Y?.enabled||Y.autoInject===!1)return Z;if(Z.includes("<!-- stx PWA Meta Tags -->"))return Z;if(!Z.includes("</head>")){if(Z.includes("</body>")){let G=H5($);return Z.replace("</body>",`${G}
7509
+ </body>`)}return Z+H5($)}let J=H5($);return Z.replace("</head>",`${J}
7510
+ </head>`)}function lX(Z){if(!Z.pwa?.enabled)return"";return`<script>
6678
7511
  if ('serviceWorker' in navigator) {
6679
7512
  window.addEventListener('load', function() {
6680
- navigator.serviceWorker.register('/${s7(Z)}')
7513
+ navigator.serviceWorker.register('/${o7(Z)}')
6681
7514
  .then(function(registration) {
6682
7515
  console.log('[PWA] Service Worker registered:', registration.scope);
6683
7516
  })
@@ -6686,120 +7519,99 @@ if ('serviceWorker' in navigator) {
6686
7519
  });
6687
7520
  });
6688
7521
  }
6689
- </script>`}function uX(){return'<link rel="manifest" href="/manifest.json">'}function pX(Z){return`<meta name="theme-color" content="${m3(Z)}">`}function m3(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var p3=I(()=>{d3()});import JZ from"path";function cX(Z){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bstate\s*\(/,/\bderived\s*\(/,/\beffect\s*\(/,/data-stx(?:-auto)?(?![-\w])/].some((Y)=>Y.test(Z))}function lX(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=$.exec(Z))!==null){let J=Y[1];if(/\b(state|derived|effect)\s*\(/.test(J))return!0}return!1}function iX(Z){let $=Z,Y=/@if\s*\(/g,J,G=[];while((J=Y.exec($))!==null){let X=J.index,Q=X+J[0].length,K=1,q=Q;while(q<$.length&&K>0){if($[q]==="(")K++;else if($[q]===")")K--;q++}if(K!==0)continue;let _=$.substring(Q,q-1).trim(),j=q,B=1,W=j,U=/@(if\s*\(|endif)/g;U.lastIndex=j;let z;while((z=U.exec($))!==null)if(z[1].startsWith("if"))B++;else if(z[1]==="endif"){if(B--,B===0){W=z.index+z[0].length;break}}if(B!==0)continue;let H=$.substring(j,W-6).trim(),L=H.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),F;if(L){let[,O,A,M]=L;F=`<${O}${A} @if="${_}">${M}</${O}>`}else F=`<template @if="${_}">${H}</template>`;G.push({start:X,end:W,replacement:F})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];$=$.substring(0,Q)+q+$.substring(K)}return $}function nX(Z){let $=Z,Y=/@(for|foreach)\s*\(/g,J,G=[];while((J=Y.exec($))!==null){let X=J[1],Q=J.index,K=Q+J[0].length,q=1,_=K;while(_<$.length&&q>0){if($[_]==="(")q++;else if($[_]===")")q--;_++}if(q!==0)continue;let j=$.substring(K,_-1).trim(),B=_,W=X==="for"?"@endfor":"@endforeach",U=1,z=B,H=new RegExp(`@(${X}\\s*\\(|end${X})`,"g");H.lastIndex=B;let L;while((L=H.exec($))!==null)if(L[1].startsWith(X))U++;else if(U--,U===0){z=L.index+L[0].length;break}if(U!==0)continue;let F=$.substring(B,z-W.length).trim(),O=F.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),A;if(O){let[,M,V,R]=O;A=`<${M}${V} @for="${j}">${R}</${M}>`}else A=`<template @for="${j}">${F}</template>`;G.push({start:Q,end:z,replacement:A})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];$=$.substring(0,Q)+q+$.substring(K)}return $}function sX(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,Y,J=null;while((Y=$.exec(Z))!==null){let q=Y[1],_=Y[2];if(iZ(q))_=nZ(_);if(/\b(state|derived|effect)\s*\(/.test(_)){J={fullMatch:Y[0],attrs:q,content:_};break}}if(!J)return{output:Z,setupCode:null};let G=`__stx_setup_${Date.now()}`,X=DZ(J.content),Q=`
6690
- <script>
7522
+ </script>`}function iX(){return'<link rel="manifest" href="/manifest.json">'}function nX(Z){return`<meta name="theme-color" content="${p3(Z)}">`}function p3(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var l3=I(()=>{u3()});import GZ from"path";function sX(Z){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bstate\s*\(/,/\bderived\s*\(/,/\beffect\s*\(/,/data-stx(?:-auto)?(?![-\w])/].some((Y)=>Y.test(Z))}function oX(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=$.exec(Z))!==null){let J=Y[1];if(/\b(state|derived|effect)\s*\(/.test(J))return!0}return!1}function rX(Z){let $=Z,Y=/@if\s*\(/g,J,G=[];while((J=Y.exec($))!==null){let X=J.index,Q=X+J[0].length,K=1,q=Q;while(q<$.length&&K>0){if($[q]==="(")K++;else if($[q]===")")K--;q++}if(K!==0)continue;let _=$.substring(Q,q-1).trim(),j=q,B=1,W=j,U=/@(if\s*\(|endif)/g;U.lastIndex=j;let z;while((z=U.exec($))!==null)if(z[1].startsWith("if"))B++;else if(z[1]==="endif"){if(B--,B===0){W=z.index+z[0].length;break}}if(B!==0)continue;let H=$.substring(j,W-6).trim(),F=H.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),O;if(F){let[,L,A,M]=F;O=`<${L}${A} @if="${_}">${M}</${L}>`}else O=`<template @if="${_}">${H}</template>`;G.push({start:X,end:W,replacement:O})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];$=$.substring(0,Q)+q+$.substring(K)}return $}function aX(Z){let $=Z,Y=/@(for|foreach)\s*\(/g,J,G=[];while((J=Y.exec($))!==null){let X=J[1],Q=J.index,K=Q+J[0].length,q=1,_=K;while(_<$.length&&q>0){if($[_]==="(")q++;else if($[_]===")")q--;_++}if(q!==0)continue;let j=$.substring(K,_-1).trim(),B=_,W=X==="for"?"@endfor":"@endforeach",U=1,z=B,H=new RegExp(`@(${X}\\s*\\(|end${X})`,"g");H.lastIndex=B;let F;while((F=H.exec($))!==null)if(F[1].startsWith(X))U++;else if(U--,U===0){z=F.index+F[0].length;break}if(U!==0)continue;let O=$.substring(B,z-W.length).trim(),L=O.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),A;if(L){let[,M,V,N]=L;A=`<${M}${V} @for="${j}">${N}</${M}>`}else A=`<template @for="${j}">${O}</template>`;G.push({start:Q,end:z,replacement:A})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];$=$.substring(0,Q)+q+$.substring(K)}return $}function tX(Z){let $=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,Y,J=null;while((Y=$.exec(Z))!==null){let q=Y[1],_=Y[2];if(iZ(q))_=EZ(_);if(/\b(state|derived|effect)\s*\(/.test(_)){J={fullMatch:Y[0],attrs:q,content:_};break}}if(!J)return{output:Z,setupCode:null};let G=`__stx_setup_${Date.now()}`,X=DZ(J.content),Q=`
7523
+ <script data-stx-scoped>
6691
7524
  function ${G}() {
6692
7525
  const { state, derived, effect, batch, onMount, onDestroy } = window.stx;
6693
7526
  ${X}
6694
- return { ${oX(X)} };
7527
+ return { ${eX(X)} };
6695
7528
  }
6696
- </script>`,K=Z.replace(J.fullMatch,"");if(K.includes("<body"))K=K.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let q=["script","style","html","head","meta","link","title","!doctype"];K=K.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(_,j,B)=>{if(q.includes(j.toLowerCase()))return _;return`<${j}${B} data-stx="${G}">`})}return{output:K,setupCode:Q}}function oX(Z){let $=Z,Y=[],J=new Set,G=0,X=0,Q=$.length,K=(B)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if($[X]==="{")B++;else if($[X]==="}")B--;else if($[X]==="'"||$[X]==='"')K($[X]);else if($[X]==="`")q();else X++;continue}X++}},_=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
6697
- `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let z=B[2];if(!J.has(z))Y.push(z),J.add(z);return}let W=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!J.has(z))Y.push(z),J.add(z);return}let U=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!J.has(z))Y.push(z),J.add(z)}};while(X<Q){if(_())continue;if($[X]==="'"||$[X]==='"'){K($[X]);continue}if($[X]==="`"){q();continue}if($[X]==="{"){G++,X++;continue}if($[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))j();X++}return Y.join(", ")}function rX(Z){if(Z.includes("window.StacksBrowser")||Z.includes("StacksBrowser ="))return Z;let $=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=$.exec(Z))!==null)Y+=J[1]+`
7529
+ </script>`,K=Z.replace(J.fullMatch,"");if(K.includes("<body"))K=K.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let q=["script","style","html","head","meta","link","title","!doctype"];K=K.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(_,j,B)=>{if(q.includes(j.toLowerCase()))return _;return`<${j}${B} data-stx="${G}">`})}return{output:K,setupCode:Q}}function eX(Z){let $=Z,Y=[],J=new Set,G=0,X=0,Q=$.length,K=(B)=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;return}if($[X]==="$"&&$[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if($[X]==="{")B++;else if($[X]==="}")B--;else if($[X]==="'"||$[X]==='"')K($[X]);else if($[X]==="`")q();else X++;continue}X++}},_=()=>{if($[X]==="/"&&$[X+1]==="/"){while(X<Q&&$[X]!==`
7530
+ `)X++;return!0}if($[X]==="/"&&$[X+1]==="*"){X+=2;while(X<Q-1&&!($[X]==="*"&&$[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let z=B[2];if(!J.has(z))Y.push(z),J.add(z);return}let W=$.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let z=W[1];if(!J.has(z))Y.push(z),J.add(z);return}let U=$.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let z=U[1];if(!J.has(z))Y.push(z),J.add(z)}};while(X<Q){if(_())continue;if($[X]==="'"||$[X]==='"'){K($[X]);continue}if($[X]==="`"){q();continue}if($[X]==="{"){G++,X++;continue}if($[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test($[X])&&(X===0||/\s|[;{}()]/.test($[X-1])))j();X++}return Y.join(", ")}function ZG(Z){if(Z.includes("window.StacksBrowser")||Z.includes("StacksBrowser ="))return Z;let $=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=$.exec(Z))!==null)Y+=J[1]+`
6698
7531
  `;let G=/\{\{([\s\S]*?)\}\}/g;while((J=G.exec(Z))!==null)Y+=J[1]+`
6699
- `;if(!Y.trim())return Z;let Q=["auth","useAuth","formatAreaSize","formatDistance","formatElevation","formatDuration","getRelativeTime","fetchData","browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((j)=>{return new RegExp(`\\b${j}\\b`).test(Y)}),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g.test(Y);if(!Q&&!q)return Z;let _=`<script type="module">
7532
+ `;if(!Y.trim())return Z;let Q=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((W)=>{return new RegExp(`\\b${W}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,_,j=!1;while((_=q.exec(Y))!==null)if(!K.has(_[1])){j=!0;break}if(!Q&&!j)return Z;let B=`<script type="module">
6700
7533
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
6701
7534
  import '@stacksjs/browser'
6702
- </script>`;if(Z.includes("</head>")){let j=Z.indexOf("</head>"),W=Z.slice(0,j).indexOf("<script");if(W!==-1)return Z.slice(0,W)+_+`
6703
- `+Z.slice(W);return Z.replace("</head>",`${_}
7535
+ </script>`;if(Z.includes("</head>")){let W=Z.indexOf("</head>"),z=Z.slice(0,W).indexOf("<script");if(z!==-1)return Z.slice(0,z)+B+`
7536
+ `+Z.slice(z);return Z.replace("</head>",`${B}
6704
7537
  </head>`)}if(Z.includes("<body"))return Z.replace(/<body([^>]*)>/,`<body$1>
6705
- ${_}`);return _+`
6706
- `+Z}function aX(Z,$){if(Z.includes("window.stx =")||Z.includes("window.stx=")||Z.includes("window.stx.state"))return Z;let G=`<script data-stx-scoped>${($.debug?p7():D8()).replace(/\$/g,"$$$$")}</script>`;if(Z.includes("</head>")){let X=Z.indexOf("</head>"),K=Z.slice(0,X).indexOf("<script");if(K!==-1)return Z.slice(0,K)+G+`
7538
+ ${B}`);return B+`
7539
+ `+Z}function $G(Z,$){if(Z.includes("window.stx.state")||Z.includes("STX Signals Runtime"))return Z;let G=`<script data-stx-scoped>${($.debug?c7():k8()).replace(/\$/g,"$$$$")}</script>`;if(Z.includes("</head>")){let X=Z.indexOf("</head>"),K=Z.slice(0,X).indexOf("<script");if(K!==-1)return Z.slice(0,K)+G+`
6707
7540
  `+Z.slice(K);return Z.replace("</head>",`${G}
6708
7541
  </head>`)}if(Z.includes("<body"))return Z.replace(/<body([^>]*)>/,`<body$1>
6709
7542
  ${G}`);return G+`
6710
- `+Z}function tX(Z,$){if(!cX(Z))return Z;let Y=Z;if($.skipSignalsRuntime)return Y;let{output:J,setupCode:G}=sX(Y);if(Y=J,Y=aX(Y,$),Y=rX(Y),G)if(Y.includes("</head>"))Y=Y.replace("</head>",`${G}
7543
+ `+Z}function YG(Z,$){if(!sX(Z))return Z;let Y=Z;if($.skipSignalsRuntime)return Y;let{output:J,setupCode:G}=tX(Y);if(Y=J,Y=$G(Y,$),Y=ZG(Y),G)if(Y.includes("</head>"))Y=Y.replace("</head>",`${G}
6711
7544
  </head>`);else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
6712
7545
  ${G}`);else Y=Y+`
6713
- `+G;let X=Y.match(/<body([^>]*)>/i),Q=X&&/data-stx/.test(X[1]);if(!G&&!Q){if(Y.includes("<body")&&X&&!/data-stx-auto/.test(X[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}function eX(Z){return Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function ZG(Z,$,Y){let J=[],G=0;while(G<Z.length){let X=Z.indexOf("<",G);if(X===-1)break;let K=Z.slice(X+1).match(new RegExp(`^(${$.source})`));if(!K){G=X+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=X+1+q.length;while(H<Z.length&&Z[H]!==">")H++;G=H+1;continue}let _=X+1+q.length,j=null,B=_,W=-1,U=!1;while(_<Z.length){let H=Z[_];if(j){if(H==="\\"&&_+1<Z.length){_+=2;continue}if(H===j)j=null;_++;continue}if(H==='"'||H==="'"){j=H,_++;continue}if(H==="/"&&_+1<Z.length&&Z[_+1]===">"){W=_+2,U=!0;break}if(H===">"){W=_+1;break}_++}if(W===-1){G=X+1;continue}let z=Z.slice(B,U?W-2:W-1).trim();if(U)J.push({fullMatch:Z.slice(X,W),tagName:q,attributes:z,content:"",startIndex:X,endIndex:W,isSelfClosing:!0}),G=W;else{let H=`</${q}>`,L=Z.indexOf(H,W);if(L===-1){G=W;continue}let F=Z.slice(W,L),O=L+H.length;J.push({fullMatch:Z.slice(X,O),tagName:q,attributes:z,content:F,startIndex:X,endIndex:O,isSelfClosing:!1}),G=O}}return J}function $G(Z){let $={},Y=0,J=Z.length;while(Y<J){while(Y<J&&/\s/.test(Z[Y]))Y++;if(Y>=J)break;let G="";while(Y<J&&!/[\s=]/.test(Z[Y]))G+=Z[Y],Y++;if(!G)break;if(G.startsWith("@")){while(Y<J&&Z[Y]!=='"'&&Z[Y]!=="'")Y++;if(Y<J){let X=Z[Y];Y++;while(Y<J&&Z[Y]!==X){if(Z[Y]==="\\")Y++;Y++}Y++}continue}while(Y<J&&/\s/.test(Z[Y]))Y++;if(Y<J&&Z[Y]==="="){Y++;while(Y<J&&/\s/.test(Z[Y]))Y++;let X="";if(Y<J&&(Z[Y]==='"'||Z[Y]==="'")){let Q=Z[Y];Y++;while(Y<J){let K=Z[Y];if(K==="\\"&&Y+1<J){Y++,X+=Z[Y],Y++;continue}if(K===Q){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test(Z[Y]))X+=Z[Y],Y++;$[G]=X}else $[G]="true"}return $}async function oZ(Z,$,Y,J,G){let X=!$.__stxProcessingDepth;if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;try{return await n0.timeAsync("template-processing",async()=>{let Q=await YG(Z,$,Y,J,G);if(X)Q=await $0(Q);return Q})}catch(Q){if(Q instanceof O4)throw Q;let K=Q instanceof Error?Q.message:String(Q),q=new vZ(`Template processing failed: ${K}`,Y,void 0,void 0,Z.substring(0,200)+(Z.length>200?"...":""));if(eZ.log(q,{filePath:Y,context:$}),A7.logDetailedError(q,{filePath:Y,template:Z.substring(0,500)}),J.debug)throw q;return L7.createFallbackContent("Template Processing",q)}}async function YG(Z,$,Y,J,G){let X=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!JZ.isAbsolute(J.partialsDir)?JZ.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!JZ.isAbsolute(J.componentsDir)?JZ.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!JZ.isAbsolute(J.layoutsDir)?JZ.resolve(X,J.layoutsDir):J.layoutsDir},K=Q,q=Z;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,""),q=q.replace(/@@/g,"@"),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(U,z)=>{return`{{ ${z} }}`}),q=S8(q),q=await WG(q,Y,G);let _={};q=d7(q,_);let j={...$.__sections||{}},B="",W=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)B=W[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/,"");if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)([\s\S]*?)(?:@endsection|@show)/g,(U,z,H,L)=>{if(H)return j[z]=H,"";if(L.includes("@parent"))j[z]=L.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else j[z]=L.trim();return""}),$.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(U,z,H)=>{return j[z]||H||""}),q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),q=m7(q,_),B)try{if(Q.debug)console.log(`Processing layout: ${B} for file ${Y}`);let U=await tZ(()=>C5(B,Y,Q,G),null,()=>{throw new vZ(`Failed to resolve layout path: ${B}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!U){let O=`Layout not found: ${B} (referenced from ${Y})`;if(eZ.log(Error(O),{layoutPath:B,filePath:Y},"warning"),Q.debug)throw new vZ(O,Y);return q}let z=await tZ(()=>Bun.file(U).text(),"",()=>{throw new vZ(`Failed to read layout file: ${U}`,Y,void 0,void 0,"Layout content could not be loaded")}),H=z.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(Q.debug)console.log(`Found nested layout: ${H[1]} in ${U}`);let O={},A=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,N,w)=>{return O[N]=w.trim(),""});for(let[R,N]of Object.entries(O))if(j[R]&&j[R].includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))j[R]=j[R].replace("<!--PARENT_CONTENT_PLACEHOLDER-->",N);else if(!j[R])j[R]=N;let M={...$,__sections:j},V=`@layout('${H[1]}')${A}`;return await oZ(V,M,U,Q,G)}let L=d7(z,_),F={};return L=L.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(O,A,M)=>{return F[A]=M.trim(),`@slot('${A}')`}),L=L.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(O,A,M)=>{if(j[A]){let V=j[A];if(V.includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))V=V.replace("<!--PARENT_CONTENT_PLACEHOLDER-->",F[A]||"");return V}return M||""}),L=L.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),L=m7(L,_),q=await c3(L,$,U,Q,G),q}catch(U){return eZ.log(U instanceof Error?U:Error(String(U)),{layoutPath:B,filePath:Y},"error"),`[Error processing layout: ${U instanceof Error?U.message:String(U)}]`}return await c3(q,$,Y,Q,G)}async function JG(Z,$,Y,J){let G=Z;return G=G.replace(/<stx-loading-indicator([^>]*?)(?:\s*\/>|><\/stx-loading-indicator>)/gi,(X,Q)=>{let K=Q.match(/color=["']([^"']+)["']/i),q=Q.match(/initial-color=["']([^"']+)["']/i),_=Q.match(/height=["']([^"']+)["']/i),j=Q.match(/duration=["']([^"']+)["']/i),B=Q.match(/throttle=["']([^"']+)["']/i),W=Q.match(/z-index=["']([^"']+)["']/i),U={color:K?.[1]||"#6366f1",initialColor:q?.[1]||"",height:_?.[1]||"3px",duration:j?Number.parseInt(j[1]):2000,throttle:B?Number.parseInt(B[1]):200,zIndex:W?Number.parseInt(W[1]):999999},z=U.initialColor?`linear-gradient(to right, ${U.initialColor}, ${U.color})`:U.color;return`
7546
+ `+G;let X=Y.match(/<body([^>]*)>/i),Q=X&&/data-stx/.test(X[1]);if(!G&&!Q){if(Y.includes("<body")&&X&&!/data-stx-auto/.test(X[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}function JG(Z){return Z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function XG(Z,$,Y){let J=[],G=0;while(G<Z.length){let X=Z.indexOf("<",G);if(X===-1)break;let K=Z.slice(X+1).match(new RegExp(`^(${$.source})`));if(!K){G=X+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=X+1+q.length;while(H<Z.length&&Z[H]!==">")H++;G=H+1;continue}let _=X+1+q.length,j=null,B=_,W=-1,U=!1;while(_<Z.length){let H=Z[_];if(j){if(H==="\\"&&_+1<Z.length){_+=2;continue}if(H===j)j=null;_++;continue}if(H==='"'||H==="'"){j=H,_++;continue}if(H==="/"&&_+1<Z.length&&Z[_+1]===">"){W=_+2,U=!0;break}if(H===">"){W=_+1;break}_++}if(W===-1){G=X+1;continue}let z=Z.slice(B,U?W-2:W-1).trim();if(U)J.push({fullMatch:Z.slice(X,W),tagName:q,attributes:z,content:"",startIndex:X,endIndex:W,isSelfClosing:!0}),G=W;else{let H=`</${q}>`,F=Z.indexOf(H,W);if(F===-1){G=W;continue}let O=Z.slice(W,F),L=F+H.length;J.push({fullMatch:Z.slice(X,L),tagName:q,attributes:z,content:O,startIndex:X,endIndex:L,isSelfClosing:!1}),G=L}}return J}function GG(Z){let $={},Y=0,J=Z.length;while(Y<J){while(Y<J&&/\s/.test(Z[Y]))Y++;if(Y>=J)break;let G="";while(Y<J&&!/[\s=]/.test(Z[Y]))G+=Z[Y],Y++;if(!G)break;if(G.startsWith("@")||G.startsWith(":")){while(Y<J&&Z[Y]!=='"'&&Z[Y]!=="'")Y++;if(Y<J){let X=Z[Y];Y++;while(Y<J&&Z[Y]!==X){if(Z[Y]==="\\")Y++;Y++}Y++}continue}while(Y<J&&/\s/.test(Z[Y]))Y++;if(Y<J&&Z[Y]==="="){Y++;while(Y<J&&/\s/.test(Z[Y]))Y++;let X="";if(Y<J&&(Z[Y]==='"'||Z[Y]==="'")){let Q=Z[Y];Y++;while(Y<J){let K=Z[Y];if(K==="\\"&&Y+1<J){Y++,X+=Z[Y],Y++;continue}if(K===Q){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test(Z[Y]))X+=Z[Y],Y++;$[G]=X}else $[G]="true"}return $}async function sZ(Z,$,Y,J,G){if(J.ssr===!1)return Z;let X=!$.__stxProcessingDepth;if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;try{return await g0.timeAsync("template-processing",async()=>{let Q=await QG(Z,$,Y,J,G);if(X)Q=await Y0(Q);return Q})}catch(Q){if(Q instanceof J5)throw Q;let K=Q instanceof Error?Q.message:String(Q),q=new fZ(`Template processing failed: ${K}`,Y,void 0,void 0,Z.substring(0,200)+(Z.length>200?"...":""));if(eZ.log(q,{filePath:Y,context:$}),N7.logDetailedError(q,{filePath:Y,template:Z.substring(0,500)}),J.debug)throw q;return F7.createFallbackContent("Template Processing",q)}}async function QG(Z,$,Y,J,G){let X=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!GZ.isAbsolute(J.partialsDir)?GZ.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!GZ.isAbsolute(J.componentsDir)?GZ.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!GZ.isAbsolute(J.layoutsDir)?GZ.resolve(X,J.layoutsDir):J.layoutsDir},K=Q,q=Z;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,""),q=q.replace(/@@/g,"@"),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(U,z)=>{return`{{ ${z} }}`}),q=P8(q),q=await OG(q,Y,G);let _={};q=m7(q,_);let j={...$.__sections||{}},B="",W=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)B=W[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/,"");if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)([\s\S]*?)(?:@endsection|@show)/g,(U,z,H,F)=>{if(H)return j[z]=H,"";if(F.includes("@parent"))j[z]=F.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else j[z]=F.trim();return""}),$.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(U,z,H)=>{return j[z]||H||""}),q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),q=u7(q,_),B)try{if(Q.debug)console.log(`Processing layout: ${B} for file ${Y}`);let U=await tZ(()=>b5(B,Y,Q,G),null,()=>{throw new fZ(`Failed to resolve layout path: ${B}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!U){let A=`Layout not found: ${B} (referenced from ${Y})`;if(eZ.log(Error(A),{layoutPath:B,filePath:Y},"warning"),Q.debug)throw new fZ(A,Y);return q}let z=await tZ(()=>Bun.file(U).text(),"",()=>{throw new fZ(`Failed to read layout file: ${U}`,Y,void 0,void 0,"Layout content could not be loaded")}),H=z.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(Q.debug)console.log(`Found nested layout: ${H[1]} in ${U}`);let A={},M=z.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(R,w,D)=>{return A[w]=D.trim(),""});for(let[R,w]of Object.entries(A))if(j[R]&&j[R].includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))j[R]=j[R].replace("<!--PARENT_CONTENT_PLACEHOLDER-->",w);else if(!j[R])j[R]=w;let V={...$,__sections:j},N=`@layout('${H[1]}')${M}`;return await sZ(N,V,U,Q,G)}let F=z.replace(/\{\{--[\s\S]*?--\}\}/g,""),O=m7(F,_),L={};return O=O.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,V)=>{return L[M]=V.trim(),`@slot('${M}')`}),O=O.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,V)=>{if(j[M]){let N=j[M];if(N.includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))N=N.replace("<!--PARENT_CONTENT_PLACEHOLDER-->",L[M]||"");return N}return V||""}),O=O.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),O=u7(O,_),q=await i3(O,$,U,Q,G),q}catch(U){return eZ.log(U instanceof Error?U:Error(String(U)),{layoutPath:B,filePath:Y},"error"),`[Error processing layout: ${U instanceof Error?U.message:String(U)}]`}return await i3(q,$,Y,Q,G)}async function KG(Z,$,Y,J){let G=Z;return G=G.replace(/<stx-loading-indicator([^>]*?)(?:\s*\/>|><\/stx-loading-indicator>)/gi,(X,Q)=>{let K=Q.match(/color=["']([^"']+)["']/i),q=Q.match(/initial-color=["']([^"']+)["']/i),_=Q.match(/height=["']([^"']+)["']/i),j=Q.match(/duration=["']([^"']+)["']/i),B=Q.match(/throttle=["']([^"']+)["']/i),W=Q.match(/z-index=["']([^"']+)["']/i),U={color:K?.[1]||"#6366f1",initialColor:q?.[1]||"",height:_?.[1]||"3px",duration:j?Number.parseInt(j[1]):2000,throttle:B?Number.parseInt(B[1]):200,zIndex:W?Number.parseInt(W[1]):999999},z=U.initialColor?`linear-gradient(to right, ${U.initialColor}, ${U.color})`:U.color;return`
6714
7547
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${U.height};background:${z};z-index:${U.zIndex};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
6715
7548
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
6716
7549
  </div>
6717
7550
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
6718
7551
  <script>
6719
7552
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${U.throttle})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
6720
- </script>`}),G}async function c3(Z,$,Y,J,G){let X=Z;$.__stx_sfc_mode=!0;let Q=J;await tZ(()=>T8(Y,$),void 0,(b)=>{if(Q.debug)console.warn(`View composer error for ${Y}:`,b.message)}),$.__stx_options=Q,X=await tZ(()=>A8(X,$,Y,Q),X,(b)=>{if(Q.debug)console.warn("Pre-processing middleware error:",b.message)});let K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,q;while((q=K.exec(X))!==null){let b=q[1],v=q[2];if(/\bserver\b/.test(b)&&v.trim())try{let{extractVariables:QZ}=await Promise.resolve().then(() => (W4(),E4));await QZ(v,$,Y)}catch(QZ){if(Q.debug)console.warn("Script extraction error:",QZ)}}if(X=await z8(X,$,Y),X=await U8(X,$,Y),X=await XG(X,$,Y,Q,G),X=await i$(X,$,Y,Q),X=await JG(X,$,Y,Q),X=v7(X,$,Y,Q),Q.componentsDir)X=await GG(X,$,Y,Q.componentsDir,Q,G),X=await QG(X,$,Y,Q.componentsDir,Q,G),X=await P8(X,$,Y,Q,G);X=N0(X,$,Y,Q);let{processDeferDirectives:_}=await Promise.resolve().then(() => x8);X=_(X,$,Y);let{processTeleportDirectives:j}=await Promise.resolve().then(() => f8);X=j(X,$,Y);let{processTransitionDirectives:B,processTransitionAttributes:W}=await Promise.resolve().then(() => m8);X=B(X,$,Y),X=W(X);let{processErrorBoundaryDirectives:U}=await Promise.resolve().then(() => p8);X=U(X,$,Y);let{processSuspenseDirectives:z}=await Promise.resolve().then(() => c8);X=z(X,$,Y);let{processAsyncDirectives:H}=await Promise.resolve().then(() => s8);X=H(X,$,Y);let{processKeepAliveDirectives:L}=await Promise.resolve().then(() => r8);X=L(X,$,Y);let{processVirtualListDirectives:F,processVirtualGridDirectives:O,processInfiniteListDirectives:A}=await Promise.resolve().then(() => (Y3(),$3));X=F(X,$,Y),X=O(X,$,Y),X=A(X,$,Y);let{processPartialHydrationDirectives:M,processStaticDirectives:V}=await Promise.resolve().then(() => (L3(),O3));X=M(X,$,Y),X=V(X);let{processComputedDirectives:R,processWatchDirectives:N}=await Promise.resolve().then(() => (k3(),E3));X=R(X,$,Y),X=N(X,$,Y);let{processFormValidationDirectives:w}=await Promise.resolve().then(() => (y3(),C3));X=w(X,$,Y);let{processHeadDirective:D,processTitleDirective:E,processMetaDirective:k,resetHead:T}=await Promise.resolve().then(() => (n7(),i7));T();let S=D(X);if(X=S.content,X=E(X,$),X=k(X,$),X=_G(X),X=M8(X),X=D7(X,$),X=c$(X),X=L8(X),X=await h7(X,$,Y,Q,G),lX(X))X=iX(X),X=nX(X);if(X=Z4(X,$,Y),X=E7(X,$),X=k7(X,$),X=r$(X,$),X=a$(X,$),X=await b$(X,$,Y,Q),X=await W6(X,$,Y),X=await X8(X,$,Y,Q),X=J0(X,$,Y,Q),X=N$(X,$,Y,Q),X=V$(X,$,Y),X=M$(X,$,Y,Q),X=m$(X,$,Y,Q),X=KG(X,$),X=qG(X),!Q.skipEventDirectives)X=D0(X,$,Y);X=y0(X,$,Y),X=await pZ(X,$,Y),X=j0(X);let{processXElementDirectives:d}=await Promise.resolve().then(() => g3);if(X=d(X),X=tX(X,Q),X=await R8(X,$,Y,Q),Q.seo?.enabled)X=w$(X,$,Q);let{renderHead:c,getHead:P}=await Promise.resolve().then(() => (n7(),i7)),u=P();if(u.title||u.meta?.length||u.link?.length){let b=c();if(b){if(X.includes("</head>"))X=X.replace("</head>",`${b}
7553
+ </script>`}),G}async function i3(Z,$,Y,J,G){let X=Z;$.__stx_sfc_mode=!0;let Q=J;await tZ(()=>D8(Y,$),void 0,(x)=>{if(Q.debug)console.warn(`View composer error for ${Y}:`,x.message)}),$.__stx_options=Q,X=await tZ(()=>R8(X,$,Y,Q),X,(x)=>{if(Q.debug)console.warn("Pre-processing middleware error:",x.message)});let K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,q;while((q=K.exec(X))!==null){let x=q[1],r=q[2];if(/\bserver\b/.test(x)&&r.trim())try{let{extractVariables:YZ}=await Promise.resolve().then(() => (j4(),I4));await YZ(r,$,Y)}catch(YZ){if(Q.debug)console.warn("Script extraction error:",YZ)}}if(X=await H8(X,$,Y),X=await O8(X,$,Y),X=await qG(X,$,Y,Q,G),X=await s$(X,$,Y,Q),X=await KG(X,$,Y,Q),X=f7(X,$,Y,Q),Q.componentsDir)X=await _G(X,$,Y,Q.componentsDir,Q,G),X=await jG(X,$,Y,Q.componentsDir,Q,G),X=await y8(X,$,Y,Q,G);X=V0(X,$,Y,Q);let{processDeferDirectives:_}=await Promise.resolve().then(() => f8);X=_(X,$,Y);let{processTeleportDirectives:j}=await Promise.resolve().then(() => h8);X=j(X,$,Y);let{processTransitionDirectives:B,processTransitionAttributes:W}=await Promise.resolve().then(() => p8);X=B(X,$,Y),X=W(X);let{processErrorBoundaryDirectives:U}=await Promise.resolve().then(() => l8);X=U(X,$,Y);let{processSuspenseDirectives:z}=await Promise.resolve().then(() => i8);X=z(X,$,Y);let{processAsyncDirectives:H}=await Promise.resolve().then(() => r8);X=H(X,$,Y);let{processKeepAliveDirectives:F}=await Promise.resolve().then(() => t8);X=F(X,$,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:L,processInfiniteListDirectives:A}=await Promise.resolve().then(() => (X3(),J3));X=O(X,$,Y),X=L(X,$,Y),X=A(X,$,Y);let{processPartialHydrationDirectives:M,processStaticDirectives:V}=await Promise.resolve().then(() => (A3(),F3));X=M(X,$,Y),X=V(X);let{processComputedDirectives:N,processWatchDirectives:R}=await Promise.resolve().then(() => (b3(),S3));X=N(X,$,Y),X=R(X,$,Y);let{processFormValidationDirectives:w}=await Promise.resolve().then(() => (v3(),x3));X=w(X,$,Y);let{processHeadDirective:D,processTitleDirective:E,processMetaDirective:k,resetHead:T}=await Promise.resolve().then(() => (s7(),n7));T();let S=D(X);if(X=S.content,X=E(X,$),X=k(X,$),X=zG(X),X=T8(X),X=E7(X,$),X=i$(X),X=A8(X),X=await d7(X,$,Y,Q,G),oX(X))X=rX(X),X=aX(X);if(X=Z4(X,$,Y),X=k7(X,$),X=S7(X,$),X=t$(X,$),X=e$(X,$),X=await C$(X,$,Y,Q),X=await U6(X,$,Y),X=await Q8(X,$,Y,Q),X=X0(X,$,Y,Q),X=M$(X,$,Y,Q),X=w$(X,$,Y),X=T$(X,$,Y,Q),X=p$(X,$,Y,Q),X=BG(X,$),X=WG(X),!Q.skipEventDirectives)X=E0(X,$,Y);X=q6(X,$,Y),X=await pZ(X,$,Y),X=B0(X);let{processXElementDirectives:h}=await Promise.resolve().then(() => d3);if(X=h(X),X=YG(X,Q),X=await V8(X,$,Y,Q),Q.seo?.enabled)X=I$(X,$,Q);let{renderHead:c,getHead:b}=await Promise.resolve().then(() => (s7(),n7)),u=b();if(u.title||u.meta?.length||u.link?.length){let x=c();if(x){if(X.includes("</head>"))X=X.replace("</head>",`${x}
6721
7554
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
6722
- ${b}`)}}if(S.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${S.headContent}
7555
+ ${x}`)}}if(S.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${S.headContent}
6723
7556
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
6724
- ${S.headContent}`)}if(Q.csp?.enabled&&Q.csp.addMetaTag)X=d$(X,Q.csp,$);if(Q.analytics?.enabled)X=W0(X,Q);if(Q.heatmap?.enabled)X=H0(X,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:b}=await Promise.resolve().then(() => (p3(),u3));X=b(X,Q)}let XZ=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),s=/\bSTX\.\w+/.test(X),a=/window\.STX\s*=/.test(X);if(XZ&&s&&!a){let v=`<script data-stx-scoped>
6725
- ${Q0()}
6726
- </script>`;if(X.includes("</head>")){let ZZ=X.indexOf("</head>"),NZ=X.slice(0,ZZ).indexOf("<script");if(NZ!==-1){let VZ=X.slice(0,NZ),U5=X.slice(NZ);X=VZ+v+`
6727
- `+U5}else X=X.replace("</head>",`${v}
7557
+ ${S.headContent}`)}if(Q.csp?.enabled&&Q.csp.addMetaTag)X=u$(X,Q.csp,$);if(Q.analytics?.enabled)X=z0(X,Q);if(Q.heatmap?.enabled)X=O0(X,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (l3(),c3));X=x(X,Q)}let QZ=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),s=/\bSTX\.\w+/.test(X),e=/window\.STX\s*=/.test(X);if(QZ&&s&&!e){let r=`<script data-stx-scoped>
7558
+ ${K0()}
7559
+ </script>`;if(X.includes("</head>")){let a=X.indexOf("</head>"),zZ=X.slice(0,a).indexOf("<script");if(zZ!==-1){let O5=X.slice(0,zZ),w4=X.slice(zZ);X=O5+r+`
7560
+ `+w4}else X=X.replace("</head>",`${r}
6728
7561
  </head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
6729
- ${v}`);else X=v+`
6730
- `+X}X=X.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>\s*/gi,"");let GZ=$.__stx_event_bindings||[],h=!1,y=[];X.replace(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,(b,v,ZZ)=>{return y.push({match:b,attrs:v||"",content:ZZ}),b});for(let{match:b,attrs:v,content:ZZ}of y){h=!0;let QZ=ZZ;if(iZ(v))QZ=nZ(ZZ);BG(QZ,Y),X=X.replace(b,T4(QZ,{eventBindings:GZ,attrs:v}))}if(h)$.__stx_event_bindings=[];return X}async function XG(Z,$,Y,J,G){let X=Z;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[_,j]=q,B=j.split(",").map((W)=>W.trim().replace(/^['"]|['"]$/g,"")).filter((W)=>W.length>0);for(let W of B){let U=W.split("/"),H=U[U.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[JZ.resolve(JZ.dirname(Y),`${W}.stx`),JZ.resolve(JZ.dirname(Y),W),JZ.resolve(J.componentsDir||"components",`${W}.stx`),JZ.resolve(J.componentsDir||"components",W),W.endsWith(".stx")?W:`${W}.stx`];for(let A of O)try{if(await Bun.file(A).exists()){F=A;break}}catch{}if(F){Q.set(L,F),Q.set(H,F),Q.set(H.toLowerCase(),F);let A=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(A,F),G.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${W}`)}X=X.replace(_,"")}return X}async function GG(Z,$,Y,J,G,X){let Q=Z;if(!$.__processedComponents)$.__processedComponents=new Set;let K=$.__processedComponents,q=/@component\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,_;while(_=q.exec(Q)){let[j,B,W]=_,U={};if(W)try{U=Function(...Object.keys($),`return ${W}`)(...Object.values($))}catch(H){let L=H instanceof Error?H.message:String(H);Q=Q.replace(j,`[Error parsing component props: ${L}]`);continue}let z=await sZ(B,U,"",J,$,Y,G,K,X);Q=Q.replace(j,z),q.lastIndex=0}return Q}async function QG(Z,$,Y,J,G,X){let Q=Z;if(!$.__processedComponents)$.__processedComponents=new Set;let K=$.__processedComponents,q=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);return Q=await W(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await W(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await W(Q,/[a-z][a-z0-9]*/,!1,q),Q;async function W(U,z,H,L){let F=U,O=ZG(F,z,L);for(let A=O.length-1;A>=0;A--){let M=O[A],V=H?eX(M.tagName):M.tagName,R=$G(M.attributes),N={};for(let[D,E]of Object.entries(R)){if(D.startsWith("@"))continue;if(D.startsWith("__stx_")){let k=D.slice(6);try{let T=E.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");N[k]=JSON.parse(T)}catch(T){if(G.debug)console.error(`Error parsing __stx_${k}:`,T);N[k]=E}continue}if(D.startsWith(":")){let k=D.slice(1),T=E==="true"?k:E;try{let S=Function(...Object.keys($),`return ${T}`);N[k]=S(...Object.values($))}catch(S){if(G.debug)console.error(`Error evaluating :${k} binding:`,S);N[k]=E}continue}if(typeof E==="string"&&E.includes("{{")&&E.includes("}}")){let k=E.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(k)try{let T=Function(...Object.keys($),`return ${k[1]}`);N[D]=T(...Object.values($))}catch(T){if(G.debug)console.error(`Error evaluating expression for ${D}:`,T);N[D]=E}else{let T=E,S=/\{\{\s*([\s\S]+?)\s*\}\}/g,d;while((d=S.exec(E))!==null)try{let P=Function(...Object.keys($),`return ${d[1]}`)(...Object.values($));T=T.replace(d[0],String(P??""))}catch(c){if(G.debug)console.error(`Error evaluating expression in ${D}:`,c)}N[D]=T}}else N[D]=E}let w=await sZ(V,N,M.content,J,$,Y,G,K,X);F=F.substring(0,M.startIndex)+w+F.substring(M.endIndex)}return F}}function KG(Z,$){return Z.replace(/@json\(\s*([^,)]+)(?:,\s*(true|false))?\)/g,(Y,J,G)=>{try{let Q=Function(...Object.keys($),`
7562
+ ${r}`);else X=r+`
7563
+ `+X}X=X.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>\s*/gi,"");let KZ=$.__stx_event_bindings||[],g=!1,C=[],d=/\s:[a-z][\w.-]*\s*=/.test(X);X.replace(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,(x,r,a)=>{return C.push({match:x,attrs:r||"",content:a}),x});for(let{match:x,attrs:r,content:a}of C){g=!0;let YZ=a;if(iZ(r))YZ=EZ(a);HG(YZ,Y,J.strict),X=X.replace(x,E4(YZ,{eventBindings:KZ,attrs:r,hasColonDirectives:d}))}if(g)$.__stx_event_bindings=[];return X}async function qG(Z,$,Y,J,G){let X=Z;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[_,j]=q,B=j.split(",").map((W)=>W.trim().replace(/^['"]|['"]$/g,"")).filter((W)=>W.length>0);for(let W of B){let U=W.split("/"),H=U[U.length-1].replace(/\.stx$/,""),F=H.includes("-")?H.split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),O=null,L=[GZ.resolve(GZ.dirname(Y),`${W}.stx`),GZ.resolve(GZ.dirname(Y),W),GZ.resolve(J.componentsDir||"components",`${W}.stx`),GZ.resolve(J.componentsDir||"components",W),W.endsWith(".stx")?W:`${W}.stx`];for(let A of L)try{if(await Bun.file(A).exists()){O=A;break}}catch{}if(O){Q.set(F,O),Q.set(H,O),Q.set(H.toLowerCase(),O);let A=F.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(A,O),G.add(O),J.debug)console.log(`Imported component: ${F} -> ${O}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${W}`)}X=X.replace(_,"")}return X}async function _G(Z,$,Y,J,G,X){let Q=Z;if(!$.__processedComponents)$.__processedComponents=new Set;let K=$.__processedComponents,q=/@component\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,_;while(_=q.exec(Q)){let[j,B,W]=_,U={};if(W)try{U=Function(...Object.keys($),`return ${W}`)(...Object.values($))}catch(H){let F=H instanceof Error?H.message:String(H);Q=Q.replace(j,`[Error parsing component props: ${F}]`);continue}let z=await nZ(B,U,"",J,$,Y,G,K,X);Q=Q.replace(j,z),q.lastIndex=0}return Q}async function jG(Z,$,Y,J,G,X){let Q=Z;if(!$.__processedComponents)$.__processedComponents=new Set;let K=$.__processedComponents,q=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);return Q=await W(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await W(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await W(Q,/[a-z][a-z0-9]*/,!1,q),Q;async function W(U,z,H,F){let O=U,L=XG(O,z,F);for(let A=L.length-1;A>=0;A--){let M=L[A],V=H?JG(M.tagName):M.tagName,N=GG(M.attributes),R={};for(let[D,E]of Object.entries(N)){if(D.startsWith("@"))continue;if(D.startsWith("__stx_")){let k=D.slice(6);try{let T=E.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");R[k]=JSON.parse(T)}catch(T){if(G.debug)console.error(`Error parsing __stx_${k}:`,T);R[k]=E}continue}if(D.startsWith(":")){let k=D.slice(1),T=E==="true"?k:E;try{let S=Function(...Object.keys($),`return ${T}`);R[k]=S(...Object.values($))}catch(S){if(G.debug)console.error(`Error evaluating :${k} binding:`,S);R[k]=E}continue}if(typeof E==="string"&&E.includes("{{")&&E.includes("}}")){let k=E.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(k)try{let T=Function(...Object.keys($),`return ${k[1]}`);R[D]=T(...Object.values($))}catch(T){if(G.debug)console.error(`Error evaluating expression for ${D}:`,T);R[D]=E}else{let T=E,S=/\{\{\s*([\s\S]+?)\s*\}\}/g,h;while((h=S.exec(E))!==null)try{let b=Function(...Object.keys($),`return ${h[1]}`)(...Object.values($));T=T.replace(h[0],String(b??""))}catch(c){if(G.debug)console.error(`Error evaluating expression in ${D}:`,c)}R[D]=T}}else R[D]=E}let w=await nZ(V,R,M.content,J,$,Y,G,K,X);O=O.substring(0,M.startIndex)+w+O.substring(M.endIndex)}return O}}function BG(Z,$){return Z.replace(/@json\(\s*([^,)]+)(?:,\s*(true|false))?\)/g,(Y,J,G)=>{try{let Q=Function(...Object.keys($),`
6731
7564
  try { return ${J.trim()}; } catch (e) { return undefined; }
6732
- `)(...Object.values($));if(G==="true")return JSON.stringify(Q,null,2);return JSON.stringify(Q)}catch(X){return eZ.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),Y}})}function qG(Z){let $=new Map,Y=[],J=/@once\s*([\s\S]*?)@endonce/g,G=J.exec(Z);while(G!==null){let q=G[0],_=G[1],j=G.index,B=j+q.length;Y.push({match:q,content:_.trim(),start:j,end:B}),G=J.exec(Z)}let X=new Set;for(let q=0;q<Y.length;q++){let{content:_}=Y[q];if($.has(_))X.add(q);else $.set(_,{content:_,index:q})}let Q=Z,K=Array.from(X).map((q)=>Y[q]).sort((q,_)=>_.start-q.start);for(let{start:q,end:_}of K)Q=Q.substring(0,q)+Q.substring(_);return Q=Q.replace(/@once\s*([\s\S]*?)@endonce/g,"$1"),Q}function _G(Z){let $=Z.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/\sref="([^"]+)"/g,' data-stx-ref="$1"'),$}function BG(Z,$){let Y=[];for(let{pattern:J,message:G,suggestion:X}of jG){J.lastIndex=0;let Q=Z.match(J);if(Q&&Q.length>0){let K=Z.split(`
6733
- `),q=[];K.forEach((j,B)=>{if(J.lastIndex=0,J.test(j))q.push(B+1)});let _=q.length>0?` (line${q.length>1?"s":""}: ${q.join(", ")})`:"";Y.push(` \u2717 ${G}${_}
6734
- \u2192 ${X}`)}}if(Y.length>0){let G=`
6735
- \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
6736
- \u2551 STX: Prohibited DOM API Usage Detected \u2551
6737
- \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
6738
-
6739
- File: ${$.split("/").pop()||$}
6740
-
6741
- STX enforces Vue-style patterns. Direct DOM manipulation via document.* is not allowed.
6742
- Use the STX API instead for cleaner, more maintainable code.
6743
-
6744
- Errors found:
6745
- ${Y.join(`
6746
-
7565
+ `)(...Object.values($));if(G==="true")return JSON.stringify(Q,null,2);return JSON.stringify(Q)}catch(X){return eZ.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),Y}})}function WG(Z){let $=new Map,Y=[],J=/@once\s*([\s\S]*?)@endonce/g,G=J.exec(Z);while(G!==null){let q=G[0],_=G[1],j=G.index,B=j+q.length;Y.push({match:q,content:_.trim(),start:j,end:B}),G=J.exec(Z)}let X=new Set;for(let q=0;q<Y.length;q++){let{content:_}=Y[q];if($.has(_))X.add(q);else $.set(_,{content:_,index:q})}let Q=Z,K=Array.from(X).map((q)=>Y[q]).sort((q,_)=>_.start-q.start);for(let{start:q,end:_}of K)Q=Q.substring(0,q)+Q.substring(_);return Q=Q.replace(/@once\s*([\s\S]*?)@endonce/g,"$1"),Q}function zG(Z){let $=Z.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/\sref="([^"]+)"/g,' data-stx-ref="$1"'),$}function HG(Z,$,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},G=J.allowPatterns??[],X=[];for(let{pattern:Q,message:K,suggestion:q}of UG){if(G.some((j)=>K.includes(j)||Q.source.includes(j)))continue;Q.lastIndex=0;let _=Z.match(Q);if(_&&_.length>0){let j=Z.split(`
7566
+ `),B=[];j.forEach((U,z)=>{if(Q.lastIndex=0,Q.test(U))B.push(z+1)});let W=B.length>0?` (line${B.length>1?"s":""}: ${B.join(", ")})`:"";X.push(` \u2717 ${K}${W}
7567
+ \u2192 ${q}`)}}if(X.length>0){let K=`[STX] DOM API violation in ${$.split("/").pop()||$}:
7568
+ ${X.join(`
6747
7569
  `)}
6748
-
6749
- Quick Reference:
6750
- \u2022 STX.useRefs() \u2192 Get all refs from template
6751
- \u2022 STX.useRef("name") \u2192 Get single ref by name
6752
- \u2022 STX.el(tag, attrs) \u2192 Create element
6753
- \u2022 STX.onKey(key, fn) \u2192 Global keyboard listener
6754
- \u2022 STX.activeElement() \u2192 Get focused element
6755
- \u2022 STX.escapeHtml(text) \u2192 Escape HTML
6756
-
6757
- Documentation: https://stx.stacksjs.org/refs
6758
- `;throw new O4(G,$)}}async function WG(Z,$,Y){let J=Z,G=JZ.dirname($),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=X.exec(J))!==null){let[_,j,B,W]=Q;if(l3(B))continue;let U=i3(B,G,$);if(U)try{let z=await Bun.file(U).text();if(Y.add(U),B.endsWith(".ts")||B.endsWith(".tsx")){let L=await Bun.build({entrypoints:[U],target:"browser",minify:!1});if(L.outputs.length>0)z=await L.outputs[0].text()}let H=`<script>
7570
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.enabled&&J.failOnViolation)throw Error(K);else console.warn(K)}}async function OG(Z,$,Y){let J=Z,G=GZ.dirname($),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=X.exec(J))!==null){let[_,j,B,W]=Q;if(n3(B))continue;let U=s3(B,G,$);if(U)try{let z=await Bun.file(U).text();if(Y.add(U),B.endsWith(".ts")||B.endsWith(".tsx")){let F=await Bun.build({entrypoints:[U],target:"browser",minify:!1});if(F.outputs.length>0)z=await F.outputs[0].text()}let H=`<script>
6759
7571
  // Source: ${B}
6760
7572
  ${z}
6761
- </script>`;J=J.replace(_,H),X.lastIndex=0}catch(z){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[_,j,B,W]=q,U=j+W;if(l3(B))continue;if(/rel=["']stylesheet["']/.test(U)||B.endsWith(".css")){let H=i3(B,G,$);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
7573
+ </script>`;J=J.replace(_,H),X.lastIndex=0}catch(z){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[_,j,B,W]=q,U=j+W;if(n3(B))continue;if(/rel=["']stylesheet["']/.test(U)||B.endsWith(".css")){let H=s3(B,G,$);if(H)try{let F=await Bun.file(H).text();Y.add(H);let O=`<style>
6762
7574
  /* Source: ${B} */
6763
- ${L}
6764
- </style>`;J=J.replace(_,F),K.lastIndex=0}catch(L){}}}return J}function l3(Z){return Z.startsWith("http://")||Z.startsWith("https://")||Z.startsWith("//")}function i3(Z,$,Y){try{let J;if(Z.startsWith("/")){let G=$;for(let X=0;X<5;X++){let Q=JZ.join(G,Z);if(KZ("fs").existsSync(Q))return Q;G=JZ.dirname(G)}J=JZ.join($,Z)}else if(Z.startsWith("./")||Z.startsWith("../"))J=JZ.resolve($,Z);else J=JZ.resolve($,Z);if(KZ("fs").existsSync(J))return J;return null}catch{return null}}var jG;var y5=I(()=>{Y0();F5();K0();B0();z0();R5();N5();E0();V5();P$();K5();u$();l$();s$();EZ();cZ();t$();G8();W8();O8();f7();x5();N8();lZ();w8();R7();K4();MZ();I8();E8();b8();C8();jG=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use STX.useRef("name") or STX.useRefs() instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use STX.useRef("name") or refs.container?.querySelector() instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:"Use refs.container?.querySelectorAll() instead"},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:"Use STX.useRefs() or refs.container?.querySelectorAll() instead"},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use STX.el(tag, attrs, content) instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use STX.activeElement() instead"}]});import o from"fs";import qZ from"path";import o7 from"fs";import G4 from"path";function r7(Z,$){let Y=[];if(!o7.existsSync(Z))return Y;let J=o7.readdirSync(Z,{withFileTypes:!0});for(let G of J){let X=G4.join(Z,G.name);if(G.isDirectory()){if(G.name.startsWith("_")||G.name.startsWith("."))continue;Y.push(...r7(X,$))}else if(G.isFile()){let Q=G4.extname(G.name);if($.includes(Q)){if(!G.name.startsWith("_"))Y.push(X)}}}return Y}function e3(Z,$){let J=G4.relative($,Z).replace(/\.(stx|md)$/,"");if(J=J.split(G4.sep).join("/"),J==="index")return"/";if(J.endsWith("/index"))J=J.slice(0,-6);return J=J.replace(/\[([^\]]+)\]/g,":$1"),J=J.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${J}`}function Z1(Z){let $=[],Y=Z.replace(/[.+?^${}()|[\]\\]/g,"\\$&");return Y=Y.replace(/:([^/]+)\*/g,(J,G)=>{return $.push(G),"(.+)"}),Y=Y.replace(/:([^/]+)/g,(J,G)=>{return $.push(G),"([^/]+)"}),Y=`^${Y}$`,{regex:new RegExp(Y),params:$}}function O5(Z,$={}){let Y=G4.resolve(Z,$.pagesDir||"pages"),J=$.extensions||[".stx"],X=r7(Y,J).map((Q)=>{let K=e3(Q,Y),{regex:q,params:_}=Z1(K);return{pattern:K,regex:q,params:_,filePath:Q,isDynamic:_.length>0}});return X.sort((Q,K)=>{if(!Q.isDynamic&&K.isDynamic)return-1;if(Q.isDynamic&&!K.isDynamic)return 1;let q=Q.pattern.split("/").length,_=K.pattern.split("/").length;if(q!==_)return _-q;return Q.pattern.localeCompare(K.pattern)}),X}y5();N7();class n3{cacheDir;cache=new Map;loaded=!1;constructor(Z){this.cacheDir=Z}async load(){if(this.loaded)return;let Z=qZ.join(this.cacheDir,"build-cache.json");if(o.existsSync(Z))try{let $=JSON.parse(await Bun.file(Z).text());for(let[Y,J]of Object.entries($))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await o.promises.mkdir(this.cacheDir,{recursive:!0});let Z=qZ.join(this.cacheDir,"build-cache.json"),$={};for(let[Y,J]of this.cache)$[Y]=J;await Bun.write(Z,JSON.stringify($))}getHash(Z,$){let Y=o.statSync(Z),J=`${Z}:${Y.mtimeMs}`;for(let X of $)if(o.existsSync(X)){let Q=o.statSync(X);J+=`:${X}:${Q.mtimeMs}`}let G=0;for(let X=0;X<J.length;X++){let Q=J.charCodeAt(X);G=(G<<5)-G+Q,G=G&G}return Math.abs(G).toString(36)}get(Z,$,Y){let J=this.cache.get(Z);if(!J)return null;let G=this.getHash($,Y);if(J.hash!==G)return this.cache.delete(Z),null;return J.html}set(Z,$,Y,J){let G=this.getHash($,Y);this.cache.set(Z,{hash:G,html:J,generatedAt:Date.now(),dependencies:Y})}}class s3{cacheDir;constructor(Z){this.cacheDir=Z}getFilePath(Z){let $=Z.replace(/[^a-zA-Z0-9]/g,"_")+".json";return qZ.join(this.cacheDir,"isr",$)}async get(Z){let $=this.getFilePath(Z);if(!o.existsSync($))return null;try{return JSON.parse(await Bun.file($).text())}catch{return null}}async set(Z,$){let Y=this.getFilePath(Z);await o.promises.mkdir(qZ.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify($))}async invalidate(Z){let $=this.getFilePath(Z);if(o.existsSync($))await o.promises.unlink($)}async invalidatePattern(Z){let $=qZ.join(this.cacheDir,"isr");if(!o.existsSync($))return;let Y=await o.promises.readdir($);for(let J of Y){let G=J.replace(/_/g,"/").replace(".json","");if(Z.test(G))await o.promises.unlink(qZ.join($,J))}}async needsRevalidation(Z){let $=await this.get(Z);if(!$)return!0;return Date.now()>$.revalidateAfter}}async function zG(Z){try{let Y=(await Bun.file(Z).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let G=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!G)return null;return await Function(`
7575
+ ${F}
7576
+ </style>`;J=J.replace(_,O),K.lastIndex=0}catch(F){}}}return J}function n3(Z){return Z.startsWith("http://")||Z.startsWith("https://")||Z.startsWith("//")}function s3(Z,$,Y){try{let J;if(Z.startsWith("/")){let G=$;for(let X=0;X<5;X++){let Q=GZ.join(G,Z);if(qZ("fs").existsSync(Q))return Q;G=GZ.dirname(G)}J=GZ.join($,Z)}else if(Z.startsWith("./")||Z.startsWith("../"))J=GZ.resolve($,Z);else J=GZ.resolve($,Z);if(qZ("fs").existsSync(J))return J;return null}catch{return null}}var UG;var C5=I(()=>{J0();N5();q0();W0();U0();V5();M5();k0();P5();y$();_5();c$();n$();r$();kZ();cZ();Z8();K8();U8();F8();g7();v5();M8();lZ();I8();R7();K4();NZ();E8();S8();C8();x8();UG=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import o from"fs";import _Z from"path";import r7 from"fs";import G4 from"path";function a7(Z,$){let Y=[];if(!r7.existsSync(Z))return Y;let J=r7.readdirSync(Z,{withFileTypes:!0});for(let G of J){let X=G4.join(Z,G.name);if(G.isDirectory()){if(G.name.startsWith("_")||G.name.startsWith("."))continue;Y.push(...a7(X,$))}else if(G.isFile()){let Q=G4.extname(G.name);if($.includes(Q)){if(!G.name.startsWith("_"))Y.push(X)}}}return Y}function Y1(Z,$){let J=G4.relative($,Z).replace(/\.(stx|md)$/,"");if(J=J.split(G4.sep).join("/"),J==="index")return"/";if(J.endsWith("/index"))J=J.slice(0,-6);return J=J.replace(/\[([^\]]+)\]/g,":$1"),J=J.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${J}`}function J1(Z){let $=[],Y=Z.replace(/[.+?^${}()|[\]\\]/g,"\\$&");return Y=Y.replace(/:([^/]+)\*/g,(J,G)=>{return $.push(G),"(.+)"}),Y=Y.replace(/:([^/]+)/g,(J,G)=>{return $.push(G),"([^/]+)"}),Y=`^${Y}$`,{regex:new RegExp(Y),params:$}}function F5(Z,$={}){let Y=G4.resolve(Z,$.pagesDir||"pages"),J=$.extensions||[".stx"],X=a7(Y,J).map((Q)=>{let K=Y1(Q,Y),{regex:q,params:_}=J1(K);return{pattern:K,regex:q,params:_,filePath:Q,isDynamic:_.length>0}});return X.sort((Q,K)=>{if(!Q.isDynamic&&K.isDynamic)return-1;if(Q.isDynamic&&!K.isDynamic)return 1;let q=Q.pattern.split("/").length,_=K.pattern.split("/").length;if(q!==_)return _-q;return Q.pattern.localeCompare(K.pattern)}),X}C5();V7();class o3{cacheDir;cache=new Map;loaded=!1;constructor(Z){this.cacheDir=Z}async load(){if(this.loaded)return;let Z=_Z.join(this.cacheDir,"build-cache.json");if(o.existsSync(Z))try{let $=JSON.parse(await Bun.file(Z).text());for(let[Y,J]of Object.entries($))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await o.promises.mkdir(this.cacheDir,{recursive:!0});let Z=_Z.join(this.cacheDir,"build-cache.json"),$={};for(let[Y,J]of this.cache)$[Y]=J;await Bun.write(Z,JSON.stringify($))}getHash(Z,$){let Y=o.statSync(Z),J=`${Z}:${Y.mtimeMs}`;for(let X of $)if(o.existsSync(X)){let Q=o.statSync(X);J+=`:${X}:${Q.mtimeMs}`}let G=0;for(let X=0;X<J.length;X++){let Q=J.charCodeAt(X);G=(G<<5)-G+Q,G=G&G}return Math.abs(G).toString(36)}get(Z,$,Y){let J=this.cache.get(Z);if(!J)return null;let G=this.getHash($,Y);if(J.hash!==G)return this.cache.delete(Z),null;return J.html}set(Z,$,Y,J){let G=this.getHash($,Y);this.cache.set(Z,{hash:G,html:J,generatedAt:Date.now(),dependencies:Y})}}class r3{cacheDir;constructor(Z){this.cacheDir=Z}getFilePath(Z){let $=Z.replace(/[^a-zA-Z0-9]/g,"_")+".json";return _Z.join(this.cacheDir,"isr",$)}async get(Z){let $=this.getFilePath(Z);if(!o.existsSync($))return null;try{return JSON.parse(await Bun.file($).text())}catch{return null}}async set(Z,$){let Y=this.getFilePath(Z);await o.promises.mkdir(_Z.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify($))}async invalidate(Z){let $=this.getFilePath(Z);if(o.existsSync($))await o.promises.unlink($)}async invalidatePattern(Z){let $=_Z.join(this.cacheDir,"isr");if(!o.existsSync($))return;let Y=await o.promises.readdir($);for(let J of Y){let G=J.replace(/_/g,"/").replace(".json","");if(Z.test(G))await o.promises.unlink(_Z.join($,J))}}async needsRevalidation(Z){let $=await this.get(Z);if(!$)return!0;return Date.now()>$.revalidateAfter}}async function LG(Z){try{let Y=(await Bun.file(Z).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticPaths"))return null;let G=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!G)return null;return await Function(`
6765
7577
  return (async function getStaticPaths() {
6766
7578
  ${G[1]}
6767
7579
  })()
6768
- `)()}catch($){return console.error(`Error extracting static paths from ${Z}:`,$),null}}async function UG(Z){let $=[];if(!Z.isDynamic)$.push({url:Z.pattern,params:{}});else{let Y=await zG(Z.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${Z.pattern} has no getStaticPaths or returned empty paths`),$;for(let J of Y.paths){let G=Z.pattern;for(let[X,Q]of Object.entries(J.params))G=G.replace(`:${X}`,Q).replace(`:${X}*`,Q);$.push({url:G,params:J.params,props:J.props,revalidate:J.revalidate})}}return $}async function HG(Z){let $=[Z.replace(/\.stx$/,".data.ts"),Z.replace(/\.stx$/,".data.js"),Z+".data.ts",Z+".data.js"];for(let Y of $)if(o.existsSync(Y))try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:G,...X}=J;return X}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function OG(Z,$,Y){let J=Z.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let G=J[1];if(!G.includes("getStaticProps"))return null;try{let X=G.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
7580
+ `)()}catch($){return console.error(`Error extracting static paths from ${Z}:`,$),null}}async function FG(Z){let $=[];if(!Z.isDynamic)$.push({url:Z.pattern,params:{}});else{let Y=await LG(Z.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${Z.pattern} has no getStaticPaths or returned empty paths`),$;for(let J of Y.paths){let G=Z.pattern;for(let[X,Q]of Object.entries(J.params))G=G.replace(`:${X}`,Q).replace(`:${X}*`,Q);$.push({url:G,params:J.params,props:J.props,revalidate:J.revalidate})}}return $}async function AG(Z){let $=[Z.replace(/\.stx$/,".data.ts"),Z.replace(/\.stx$/,".data.js"),Z+".data.ts",Z+".data.js"];for(let Y of $)if(o.existsSync(Y))try{let J=await import(Y);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:G,...X}=J;return X}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function NG(Z,$,Y){let J=Z.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let G=J[1];if(!G.includes("getStaticProps"))return null;try{let X=G.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
6769
7581
  return (async function getStaticProps() {
6770
7582
  ${X[1]}
6771
7583
  })()
6772
- `)($)}catch(X){return console.error(`Error executing getStaticProps in ${Y}:`,X),null}}async function o3(Z,$,Y={},J,G){let X=await Bun.file(Z.filePath).text(),Q=await HG(Z.filePath),K=await OG(X,$,Z.filePath),q={...Q||{},...K||{},...Y,params:$,$route:{path:Z.pattern,params:$}},_=new Set,j={...G,debug:!1,cache:!1},B=await oZ(X,q,Z.filePath,j,_);if(J.minify!==!1)return LG(B);return B}function LG(Z){return Z.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><").trim()}function FG(Z){let $=0;for(let Y=0;Y<Z.length;Y++){let J=Z.charCodeAt(Y);$=($<<5)-$+J,$=$&$}return`"${Math.abs($).toString(36)}"`}function AG(Z,$){return`<?xml version="1.0" encoding="UTF-8"?>
7584
+ `)($)}catch(X){return console.error(`Error executing getStaticProps in ${Y}:`,X),null}}async function a3(Z,$,Y={},J,G){let X=await Bun.file(Z.filePath).text(),Q=await AG(Z.filePath),K=await NG(X,$,Z.filePath),q={...Q||{},...K||{},...Y,params:$,$route:{path:Z.pattern,params:$}},_=new Set,j={...G,debug:!1,cache:!1},B=await sZ(X,q,Z.filePath,j,_);if(J.minify!==!1)return RG(B);return B}function RG(Z){return Z.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><").trim()}function VG(Z){let $=0;for(let Y=0;Y<Z.length;Y++){let J=Z.charCodeAt(Y);$=($<<5)-$+J,$=$&$}return`"${Math.abs($).toString(36)}"`}function MG(Z,$){return`<?xml version="1.0" encoding="UTF-8"?>
6773
7585
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
6774
7586
  ${Z.map((J)=>{let G=new URL(J.loc,$).href,X=` <url>
6775
- <loc>${RZ(G)}</loc>`;if(J.lastmod)X+=`
7587
+ <loc>${MZ(G)}</loc>`;if(J.lastmod)X+=`
6776
7588
  <lastmod>${J.lastmod}</lastmod>`;if(J.changefreq)X+=`
6777
7589
  <changefreq>${J.changefreq}</changefreq>`;if(J.priority!==void 0)X+=`
6778
7590
  <priority>${J.priority}</priority>`;return X+=`
6779
7591
  </url>`,X}).join(`
6780
7592
  `)}
6781
- </urlset>`}function RZ(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function RG(Z,$){let Y=$.map((J)=>{let G=" <item>";if(G+=`
6782
- <title>${RZ(J.title)}</title>`,G+=`
6783
- <link>${RZ(J.link)}</link>`,J.description)G+=`
6784
- <description>${RZ(J.description)}</description>`;if(J.pubDate)G+=`
7593
+ </urlset>`}function MZ(Z){return Z.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function wG(Z,$){let Y=$.map((J)=>{let G=" <item>";if(G+=`
7594
+ <title>${MZ(J.title)}</title>`,G+=`
7595
+ <link>${MZ(J.link)}</link>`,J.description)G+=`
7596
+ <description>${MZ(J.description)}</description>`;if(J.pubDate)G+=`
6785
7597
  <pubDate>${J.pubDate.toUTCString()}</pubDate>`;if(J.author)G+=`
6786
- <author>${RZ(J.author)}</author>`;if(J.categories)for(let X of J.categories)G+=`
6787
- <category>${RZ(X)}</category>`;if(J.guid)G+=`
6788
- <guid>${RZ(J.guid)}</guid>`;return G+=`
7598
+ <author>${MZ(J.author)}</author>`;if(J.categories)for(let X of J.categories)G+=`
7599
+ <category>${MZ(X)}</category>`;if(J.guid)G+=`
7600
+ <guid>${MZ(J.guid)}</guid>`;return G+=`
6789
7601
  </item>`,G});return`<?xml version="1.0" encoding="UTF-8"?>
6790
7602
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
6791
7603
  <channel>
6792
- <title>${RZ(Z.title)}</title>
6793
- <link>${RZ(Z.link)}</link>
6794
- <description>${RZ(Z.description)}</description>
7604
+ <title>${MZ(Z.title)}</title>
7605
+ <link>${MZ(Z.link)}</link>
7606
+ <description>${MZ(Z.description)}</description>
6795
7607
  ${Z.language?`<language>${Z.language}</language>`:""}
6796
- ${Z.copyright?`<copyright>${RZ(Z.copyright)}</copyright>`:""}
7608
+ ${Z.copyright?`<copyright>${MZ(Z.copyright)}</copyright>`:""}
6797
7609
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
6798
7610
  <atom:link href="${Z.link}/rss.xml" rel="self" type="application/rss+xml"/>
6799
7611
  ${Y.join(`
6800
7612
  `)}
6801
7613
  </channel>
6802
- </rss>`}async function NG(Z={}){let $=Date.now(),Y=await J5(),J={pagesDir:Z.pagesDir||"pages",outputDir:Z.outputDir||"dist",baseUrl:Z.baseUrl||"/",domain:Z.domain||"http://localhost",revalidate:Z.revalidate??!1,sitemap:Z.sitemap??!0,rss:Z.rss??!1,concurrency:Z.concurrency||10,cache:Z.cache??!0,cacheDir:Z.cacheDir||".stx/ssg-cache",contentLoaders:Z.contentLoaders||[],hooks:Z.hooks||{},minify:Z.minify??!1,generate404:Z.generate404??!0,publicDir:Z.publicDir||"public",trailingSlash:Z.trailingSlash??!1,cleanOutput:Z.cleanOutput??!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&o.existsSync(J.outputDir))await o.promises.rm(J.outputDir,{recursive:!0});await o.promises.mkdir(J.outputDir,{recursive:!0});let X=new n3(J.cacheDir);if(J.cache)await X.load();let Q=O5(".",{pagesDir:J.pagesDir});console.log(`Found ${Q.length} routes`);let K=[];for(let j of Q){let B=await UG(j);for(let W of B)K.push({route:j,url:W.url,params:W.params,props:W.props,revalidate:W.revalidate??J.revalidate})}G.totalPages=K.length,console.log(`Generating ${G.totalPages} pages...`);let q=[],_=[];for(let j=0;j<K.length;j+=J.concurrency)_.push(K.slice(j,j+J.concurrency));for(let j of _)await Promise.all(j.map(async(B)=>{let{route:W,url:U,params:z,props:H,revalidate:L}=B;try{await J.hooks.onPageStart?.(U);let F=null,O=!1;if(J.cache){if(F=X.get(U,W.filePath,[]),F)O=!0,G.cachedCount++}if(!F){if(F=await o3(W,z,H,J,Y),J.cache)X.set(U,W.filePath,[],F)}let A;if(J.trailingSlash)A=qZ.join(J.outputDir,U,"index.html");else A=U==="/"?qZ.join(J.outputDir,"index.html"):qZ.join(J.outputDir,`${U}.html`);await o.promises.mkdir(qZ.dirname(A),{recursive:!0}),await Bun.write(A,F),q.push({loc:U,lastmod:new Date().toISOString().split("T")[0],priority:U==="/"?1:0.8});let M={route:U,outputPath:A,size:Buffer.byteLength(F,"utf8"),cached:O};if(L!==!1)M.revalidateAt=Date.now()+L*1000;G.pages.push(M),G.successCount++,await J.hooks.onPageEnd?.(U,F)}catch(F){G.failedCount++,G.errors.push({route:U,error:F}),await J.hooks.onError?.(F,U),console.error(`Error generating ${U}:`,F)}}));if(J.cache)await X.save();if(J.generate404){let j=qZ.join(J.pagesDir,"404.stx");if(o.existsSync(j)){let B=new Set,W={...Y,debug:!1,cache:!1},U=await oZ(await Bun.file(j).text(),{},j,W,B);await Bun.write(qZ.join(J.outputDir,"404.html"),U)}else await Bun.write(qZ.join(J.outputDir,"404.html"),`<!DOCTYPE html>
7614
+ </rss>`}async function TG(Z={}){let $=Date.now(),Y=await G5(),J={pagesDir:Z.pagesDir||"pages",outputDir:Z.outputDir||"dist",baseUrl:Z.baseUrl||"/",domain:Z.domain||"http://localhost",revalidate:Z.revalidate??!1,sitemap:Z.sitemap??!0,rss:Z.rss??!1,concurrency:Z.concurrency||10,cache:Z.cache??!0,cacheDir:Z.cacheDir||".stx/ssg-cache",contentLoaders:Z.contentLoaders||[],hooks:Z.hooks||{},minify:Z.minify??!1,generate404:Z.generate404??!0,publicDir:Z.publicDir||"public",trailingSlash:Z.trailingSlash??!1,cleanOutput:Z.cleanOutput??!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&o.existsSync(J.outputDir))await o.promises.rm(J.outputDir,{recursive:!0});await o.promises.mkdir(J.outputDir,{recursive:!0});let X=new o3(J.cacheDir);if(J.cache)await X.load();let Q=F5(".",{pagesDir:J.pagesDir});console.log(`Found ${Q.length} routes`);let K=[];for(let j of Q){let B=await FG(j);for(let W of B)K.push({route:j,url:W.url,params:W.params,props:W.props,revalidate:W.revalidate??J.revalidate})}G.totalPages=K.length,console.log(`Generating ${G.totalPages} pages...`);let q=[],_=[];for(let j=0;j<K.length;j+=J.concurrency)_.push(K.slice(j,j+J.concurrency));for(let j of _)await Promise.all(j.map(async(B)=>{let{route:W,url:U,params:z,props:H,revalidate:F}=B;try{await J.hooks.onPageStart?.(U);let O=null,L=!1;if(J.cache){if(O=X.get(U,W.filePath,[]),O)L=!0,G.cachedCount++}if(!O){if(O=await a3(W,z,H,J,Y),J.cache)X.set(U,W.filePath,[],O)}let A;if(J.trailingSlash)A=_Z.join(J.outputDir,U,"index.html");else A=U==="/"?_Z.join(J.outputDir,"index.html"):_Z.join(J.outputDir,`${U}.html`);await o.promises.mkdir(_Z.dirname(A),{recursive:!0}),await Bun.write(A,O),q.push({loc:U,lastmod:new Date().toISOString().split("T")[0],priority:U==="/"?1:0.8});let M={route:U,outputPath:A,size:Buffer.byteLength(O,"utf8"),cached:L};if(F!==!1)M.revalidateAt=Date.now()+F*1000;G.pages.push(M),G.successCount++,await J.hooks.onPageEnd?.(U,O)}catch(O){G.failedCount++,G.errors.push({route:U,error:O}),await J.hooks.onError?.(O,U),console.error(`Error generating ${U}:`,O)}}));if(J.cache)await X.save();if(J.generate404){let j=_Z.join(J.pagesDir,"404.stx");if(o.existsSync(j)){let B=new Set,W={...Y,debug:!1,cache:!1},U=await sZ(await Bun.file(j).text(),{},j,W,B);await Bun.write(_Z.join(J.outputDir,"404.html"),U)}else await Bun.write(_Z.join(J.outputDir,"404.html"),`<!DOCTYPE html>
6803
7615
  <html lang="en">
6804
7616
  <head>
6805
7617
  <meta charset="UTF-8">
@@ -6820,12 +7632,12 @@ ${Y.join(`
6820
7632
  <a href="/">Go home</a>
6821
7633
  </div>
6822
7634
  </body>
6823
- </html>`)}if(J.sitemap&&q.length>0){let j=AG(q,J.domain),B=qZ.join(J.outputDir,"sitemap.xml");await Bun.write(B,j),G.sitemapPath=B,console.log(`Generated sitemap.xml with ${q.length} URLs`)}if(J.rss){let j=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},B=[];if(j.getItems)B=await j.getItems();let W=RG(j,B),U=qZ.join(J.outputDir,"rss.xml");await Bun.write(U,W),G.rssPath=U,console.log(`Generated rss.xml with ${B.length} items`)}if(J.publicDir&&o.existsSync(J.publicDir))await r3(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(X){throw await J.hooks.onError?.(X),X}return G.buildTime=Date.now()-$,await J.hooks.onBuildEnd?.(G),console.log(`
7635
+ </html>`)}if(J.sitemap&&q.length>0){let j=MG(q,J.domain),B=_Z.join(J.outputDir,"sitemap.xml");await Bun.write(B,j),G.sitemapPath=B,console.log(`Generated sitemap.xml with ${q.length} URLs`)}if(J.rss){let j=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},B=[];if(j.getItems)B=await j.getItems();let W=wG(j,B),U=_Z.join(J.outputDir,"rss.xml");await Bun.write(U,W),G.rssPath=U,console.log(`Generated rss.xml with ${B.length} items`)}if(J.publicDir&&o.existsSync(J.publicDir))await t3(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(X){throw await J.hooks.onError?.(X),X}return G.buildTime=Date.now()-$,await J.hooks.onBuildEnd?.(G),console.log(`
6824
7636
  Build complete!
6825
7637
  Total: ${G.totalPages} pages
6826
7638
  Success: ${G.successCount}
6827
7639
  Cached: ${G.cachedCount}
6828
7640
  Failed: ${G.failedCount}
6829
7641
  Time: ${G.buildTime}ms
6830
- `),G}async function r3(Z,$){let Y=await o.promises.readdir(Z,{withFileTypes:!0});for(let J of Y){let G=qZ.join(Z,J.name),X=qZ.join($,J.name);if(J.isDirectory())await o.promises.mkdir(X,{recursive:!0}),await r3(G,X);else await o.promises.copyFile(G,X)}}function VG(Z={}){let $=Z.cacheDir||".stx/ssg-cache",Y=new s3($),J=Z.revalidate||3600;return{async get(G){let X=await Y.get(G);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(G).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(G){let Q=O5(".",{pagesDir:Z.pagesDir||"pages"}).find((B)=>{return G.match(B.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${G}`);return}let K=G.match(Q.regex),q={};if(K)Q.params.forEach((B,W)=>{q[B]=K[W+1]});let _=await J5(),j=await o3(Q,q,{},Z,_);await Y.set(G,{html:j,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:FG(j)}),console.log(`Revalidated: ${G}`)},async invalidate(G){if(typeof G==="string")await Y.invalidate(G);else await Y.invalidatePattern(G)}}}function MG(Z){return async()=>{return{paths:await Z(),fallback:!1}}}function wG(){return{name:"markdown",extensions:[".md",".mdx"],async load(Z){let $=await Bun.file(Z).text(),Y=$.match(/^---\n([\s\S]*?)\n---/),J={},G=$;if(Y){let _=Y[1];G=$.slice(Y[0].length).trim();for(let j of _.split(`
6831
- `)){let B=j.indexOf(":");if(B>0){let W=j.slice(0,B).trim(),U=j.slice(B+1).trim();if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^\d+$/.test(U))U=parseInt(U,10);else if(/^\d+\.\d+$/.test(U))U=parseFloat(U);else if(U.startsWith("[")&&U.endsWith("]"))U=U.slice(1,-1).split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,""));J[W]=U}}}let X=G.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),Q=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(X))!==null){let _=parseInt(q[1],10),j=q[2],B=j.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:B,text:j,level:_})}return{content:X,data:J,toc:Q}}}}var qB={generateStaticSite:NG,createISRHandler:VG,defineStaticPaths:MG,createMarkdownLoader:wG};export{NG as generateStaticSite,MG as defineStaticPaths,qB as default,wG as createMarkdownLoader,VG as createISRHandler};
7642
+ `),G}async function t3(Z,$){let Y=await o.promises.readdir(Z,{withFileTypes:!0});for(let J of Y){let G=_Z.join(Z,J.name),X=_Z.join($,J.name);if(J.isDirectory())await o.promises.mkdir(X,{recursive:!0}),await t3(G,X);else await o.promises.copyFile(G,X)}}function IG(Z={}){let $=Z.cacheDir||".stx/ssg-cache",Y=new r3($),J=Z.revalidate||3600;return{async get(G){let X=await Y.get(G);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(G).catch(console.error);return{html:X.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:X.etag,"X-ISR-Generated":new Date(X.generatedAt).toISOString(),...X.headers}}},async revalidate(G){let Q=F5(".",{pagesDir:Z.pagesDir||"pages"}).find((B)=>{return G.match(B.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${G}`);return}let K=G.match(Q.regex),q={};if(K)Q.params.forEach((B,W)=>{q[B]=K[W+1]});let _=await G5(),j=await a3(Q,q,{},Z,_);await Y.set(G,{html:j,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:VG(j)}),console.log(`Revalidated: ${G}`)},async invalidate(G){if(typeof G==="string")await Y.invalidate(G);else await Y.invalidatePattern(G)}}}function DG(Z){return async()=>{return{paths:await Z(),fallback:!1}}}function EG(){return{name:"markdown",extensions:[".md",".mdx"],async load(Z){let $=await Bun.file(Z).text(),Y=$.match(/^---\n([\s\S]*?)\n---/),J={},G=$;if(Y){let _=Y[1];G=$.slice(Y[0].length).trim();for(let j of _.split(`
7643
+ `)){let B=j.indexOf(":");if(B>0){let W=j.slice(0,B).trim(),U=j.slice(B+1).trim();if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^\d+$/.test(U))U=parseInt(U,10);else if(/^\d+\.\d+$/.test(U))U=parseFloat(U);else if(U.startsWith("[")&&U.endsWith("]"))U=U.slice(1,-1).split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,""));J[W]=U}}}let X=G.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),Q=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(X))!==null){let _=parseInt(q[1],10),j=q[2],B=j.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:B,text:j,level:_})}return{content:X,data:J,toc:Q}}}}var zB={generateStaticSite:TG,createISRHandler:IG,defineStaticPaths:DG,createMarkdownLoader:EG};export{TG as generateStaticSite,DG as defineStaticPaths,zB as default,EG as createMarkdownLoader,IG as createISRHandler};