@stacksjs/stx 0.2.95 → 0.2.97

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 (612) hide show
  1. package/dist/a11y.js +598 -2
  2. package/dist/analytics.js +159 -2
  3. package/dist/analyzer.js +240 -2
  4. package/dist/animation.js +688 -2
  5. package/dist/app-shell.js +220 -2
  6. package/dist/app.js +79 -2
  7. package/dist/assets.js +155 -2
  8. package/dist/ast.js +630 -2
  9. package/dist/async-components.js +428 -2
  10. package/dist/auth.js +12 -2
  11. package/dist/broadcasting.js +102 -2
  12. package/dist/browser-composables.js +565 -2
  13. package/dist/build-assets.js +29 -2
  14. package/dist/build-mode-detector.js +50 -2
  15. package/dist/build-optimizer.js +433 -2
  16. package/dist/build-views.js +180 -2
  17. package/dist/build.js +33 -2
  18. package/dist/builtins/drawer.js +37 -2
  19. package/dist/builtins/escape.js +3 -2
  20. package/dist/builtins/icon.js +83 -2
  21. package/dist/builtins/index.js +34 -2
  22. package/dist/builtins/modal.js +38 -2
  23. package/dist/builtins/safe-image.js +51 -2
  24. package/dist/builtins/stx-image.js +200 -2
  25. package/dist/builtins/stx-link.js +41 -2
  26. package/dist/builtins/stx-loading-indicator.js +35 -2
  27. package/dist/builtins/suspense.js +24 -2
  28. package/dist/builtins/toast.js +42 -2
  29. package/dist/builtins/tooltip.js +106 -2
  30. package/dist/builtins/transition-group.js +22 -2
  31. package/dist/bundle-analyzer/collector.js +233 -2
  32. package/dist/bundle-analyzer/index.js +82 -2
  33. package/dist/bundle-analyzer/report.js +318 -2
  34. package/dist/bundle-analyzer/treemap.js +594 -2
  35. package/dist/caching.js +131 -2
  36. package/dist/cli.js +11317 -10982
  37. package/dist/client/directive.js +14 -2
  38. package/dist/client/index.js +2 -2
  39. package/dist/client-helpers.js +312 -2
  40. package/dist/client-script-bundler.js +216 -6
  41. package/dist/client-script.js +754 -2
  42. package/dist/client.js +73 -4
  43. package/dist/component-hmr.js +585 -2
  44. package/dist/component-library.d.ts +6 -0
  45. package/dist/component-library.js +683 -0
  46. package/dist/component-processing.js +613 -2
  47. package/dist/component-registry.js +90 -2
  48. package/dist/component-renderer.js +660 -2
  49. package/dist/components.js +213 -2
  50. package/dist/composables/index.js +220 -2
  51. package/dist/composables/use-battery.js +101 -2
  52. package/dist/composables/use-broadcast-channel.js +80 -2
  53. package/dist/composables/use-channel.js +124 -2
  54. package/dist/composables/use-clipboard.js +79 -2
  55. package/dist/composables/use-color-mode.js +131 -2
  56. package/dist/composables/use-cookie.js +86 -2
  57. package/dist/composables/use-device-orientation.js +181 -2
  58. package/dist/composables/use-event-listener.js +27 -2
  59. package/dist/composables/use-event-source.js +166 -2
  60. package/dist/composables/use-eye-dropper.js +142 -2
  61. package/dist/composables/use-fetch.js +223 -2
  62. package/dist/composables/use-fullscreen.js +110 -2
  63. package/dist/composables/use-geolocation.js +101 -2
  64. package/dist/composables/use-idle.js +182 -2
  65. package/dist/composables/use-intersection-observer.js +168 -2
  66. package/dist/composables/use-keyboard.js +224 -2
  67. package/dist/composables/use-media-query.js +62 -2
  68. package/dist/composables/use-meta.js +48 -2
  69. package/dist/composables/use-mouse.js +286 -2
  70. package/dist/composables/use-mutation-observer.js +129 -2
  71. package/dist/composables/use-network.js +85 -2
  72. package/dist/composables/use-notification.js +94 -2
  73. package/dist/composables/use-permissions.js +132 -2
  74. package/dist/composables/use-query.js +0 -1
  75. package/dist/composables/use-resize-observer.js +157 -2
  76. package/dist/composables/use-router.js +51 -2
  77. package/dist/composables/use-share.js +104 -2
  78. package/dist/composables/use-speech.js +294 -2
  79. package/dist/composables/use-storage.js +130 -2
  80. package/dist/composables/use-text-selection.js +205 -4
  81. package/dist/composables/use-timer.js +183 -2
  82. package/dist/composables/use-utilities.js +176 -2
  83. package/dist/composables/use-wake-lock.js +122 -2
  84. package/dist/composables/use-websocket.js +165 -2
  85. package/dist/composables/use-window.js +163 -2
  86. package/dist/composables.js +552 -2
  87. package/dist/composition-api.js +190 -2
  88. package/dist/computed.js +376 -8
  89. package/dist/conditionals.js +599 -2
  90. package/dist/config.js +751 -2
  91. package/dist/craft-bridge.js +432 -2
  92. package/dist/craft-compiler.js +810 -2
  93. package/dist/craft-components.js +945 -2
  94. package/dist/craft-entry.js +5 -2
  95. package/dist/craft-ssr.js +559 -2
  96. package/dist/csp.js +220 -2
  97. package/dist/csrf.js +38 -2
  98. package/dist/custom-directives.js +136 -2
  99. package/dist/defer.js +156 -2
  100. package/dist/deploy/config-generators.js +214 -2
  101. package/dist/deploy/index.js +203 -2
  102. package/dist/deploy/netlify.js +167 -2
  103. package/dist/dev-server/crosswind.js +379 -2
  104. package/dist/dev-server/index.js +7 -2
  105. package/dist/dev-server/keyboard-shortcuts.js +81 -2
  106. package/dist/dev-server/native-window.js +91 -2
  107. package/dist/dev-server/port-utils.js +40 -2
  108. package/dist/dev-server/serve-app.js +682 -2
  109. package/dist/dev-server/serve-file.js +439 -2
  110. package/dist/dev-server/serve-markdown.js +281 -2
  111. package/dist/dev-server/serve-multi.js +579 -2
  112. package/dist/dev-server/terminal-colors.js +45 -2
  113. package/dist/dev-server/theme-selector.js +111 -2
  114. package/dist/dev-server/types.js +43 -2
  115. package/dist/dev-server.js +4 -2
  116. package/dist/devtools.js +462 -18
  117. package/dist/directive-api.js +355 -2
  118. package/dist/docs.js +567 -2
  119. package/dist/doctor.js +123 -2
  120. package/dist/document-shell.js +105 -2
  121. package/dist/dynamic-components.js +78 -2
  122. package/dist/edge-runtime.js +539 -2
  123. package/dist/env.js +9 -2
  124. package/dist/error-boundaries.js +62 -12
  125. package/dist/error-handling.js +1 -2
  126. package/dist/errors/codes.js +97 -2
  127. package/dist/errors/formatter.js +196 -2
  128. package/dist/errors/index.js +44 -2
  129. package/dist/errors/logger.js +250 -2
  130. package/dist/errors/sanitizer.js +181 -2
  131. package/dist/errors/types.js +86 -2
  132. package/dist/events.js +382 -2
  133. package/dist/expressions.js +650 -2
  134. package/dist/formatter.js +265 -2
  135. package/dist/forms-validation.js +510 -4
  136. package/dist/forms.js +709 -2
  137. package/dist/head.js +224 -2
  138. package/dist/heatmap.js +566 -2
  139. package/dist/hot-reload.js +367 -2
  140. package/dist/html-masking.js +73 -2
  141. package/dist/hydration-runtime.js +195 -2
  142. package/dist/hydration.js +654 -2
  143. package/dist/i18n.js +633 -2
  144. package/dist/image-optimization/auto-sibling.js +88 -2
  145. package/dist/image-optimization/build-plugin.js +241 -2
  146. package/dist/image-optimization/component.js +244 -2
  147. package/dist/image-optimization/directive.js +203 -2
  148. package/dist/image-optimization/index.js +54 -2
  149. package/dist/image-optimization/processor.js +262 -2
  150. package/dist/image-optimization/serve.js +102 -2
  151. package/dist/includes.js +733 -2
  152. package/dist/index.d.ts +1 -0
  153. package/dist/index.js +134 -2
  154. package/dist/init.js +505 -2
  155. package/dist/inline-assets.js +82 -2
  156. package/dist/interactive.js +383 -2
  157. package/dist/internal-markdown.js +141 -2
  158. package/dist/island-chunking.js +52 -2
  159. package/dist/js-ts.js +57 -2
  160. package/dist/jsx-runtime.js +289 -2
  161. package/dist/keep-alive.js +421 -2
  162. package/dist/lazy-loader.js +245 -2
  163. package/dist/loading-indicator.js +322 -2
  164. package/dist/loops.js +643 -2
  165. package/dist/manifest.js +31 -2
  166. package/dist/markdown.js +68 -2
  167. package/dist/media/client/blur-up.js +217 -2
  168. package/dist/media/client/index.js +53 -2
  169. package/dist/media/client/lazy-load.js +283 -2
  170. package/dist/media/client/upload-handler.js +354 -2
  171. package/dist/media/image/component.js +574 -2
  172. package/dist/media/image/directive.js +160 -2
  173. package/dist/media/image/editing.js +193 -2
  174. package/dist/media/image/index.js +80 -2
  175. package/dist/media/image/placeholder.js +188 -2
  176. package/dist/media/image/processor/cache.js +51 -2
  177. package/dist/media/image/processor/index.js +3 -2
  178. package/dist/media/image/processor/optimizer.js +202 -2
  179. package/dist/media/image/processor/responsive.js +162 -2
  180. package/dist/media/image/srcset.js +194 -2
  181. package/dist/media/index.js +198 -2
  182. package/dist/media/manager/embed.js +253 -2
  183. package/dist/media/protected/component.js +235 -2
  184. package/dist/media/protected/index.js +20 -2
  185. package/dist/media/protected/signature.js +205 -2
  186. package/dist/media/shared/cache.js +132 -2
  187. package/dist/media/shared/hash.js +35 -2
  188. package/dist/media/shared/index.js +2 -2
  189. package/dist/media/types.js +0 -1
  190. package/dist/media/upload/component.js +320 -2
  191. package/dist/media/upload/index.js +1 -2
  192. package/dist/media/video/directive.js +142 -2
  193. package/dist/media/video/index.js +583 -2
  194. package/dist/media/video/processor/cache.js +52 -2
  195. package/dist/media/video/processor/index.js +4 -2
  196. package/dist/media/video/processor/streaming.js +197 -2
  197. package/dist/media/video/processor/thumbnail.js +134 -2
  198. package/dist/media/video/processor/transcoder.js +283 -2
  199. package/dist/method-spoofing.js +17 -2
  200. package/dist/middleware.js +40 -2
  201. package/dist/misc-directives.js +222 -2
  202. package/dist/native-build.js +511 -2
  203. package/dist/parser/directive-parser.js +239 -2
  204. package/dist/parser/expression-parser.js +358 -2
  205. package/dist/parser/index.js +23 -2
  206. package/dist/parser/tokenizer.js +534 -2
  207. package/dist/partial-hydration.js +427 -2
  208. package/dist/performance-utils.js +430 -2
  209. package/dist/placeholder.js +35 -2
  210. package/dist/plugin-system.js +214 -2
  211. package/dist/plugin.js +173 -2
  212. package/dist/precompiler.js +660 -81
  213. package/dist/process.js +711 -2
  214. package/dist/production-build.js +596 -2
  215. package/dist/production-builder.js +132 -2
  216. package/dist/production-server.js +188 -2
  217. package/dist/props.js +224 -2
  218. package/dist/public-env.js +19 -2
  219. package/dist/pwa/audit.js +255 -2
  220. package/dist/pwa/directives.js +332 -2
  221. package/dist/pwa/icons.js +109 -2
  222. package/dist/pwa/index.js +47 -2
  223. package/dist/pwa/inject.js +102 -2
  224. package/dist/pwa/manifest.js +186 -2
  225. package/dist/pwa/offline.js +259 -2
  226. package/dist/pwa/precache.js +116 -2
  227. package/dist/pwa/service-worker.js +860 -2
  228. package/dist/pwa/workbox-strategies.js +167 -2
  229. package/dist/pwa/workbox.js +382 -2
  230. package/dist/pwa.js +427 -427
  231. package/dist/reactive-bindings.js +266 -2
  232. package/dist/reactive.js +569 -2
  233. package/dist/reactivity.js +559 -2
  234. package/dist/release.js +1 -2
  235. package/dist/render.js +165 -2
  236. package/dist/route-middleware.js +17 -2
  237. package/dist/router.js +9 -2
  238. package/dist/routes.js +14 -2
  239. package/dist/runtime-injection.js +120 -2
  240. package/dist/runtime.js +94 -2
  241. package/dist/safe-evaluator.js +444 -2
  242. package/dist/scaffolding.js +897 -2
  243. package/dist/screenshot.js +87 -2
  244. package/dist/script-classifier.js +32 -2
  245. package/dist/script-validation.js +158 -2
  246. package/dist/seo.js +457 -2
  247. package/dist/serve.js +237 -2
  248. package/dist/server-bindings.js +108 -2
  249. package/dist/server-components.js +338 -11
  250. package/dist/signal-processing.js +946 -2
  251. package/dist/signals-api.js +154 -2
  252. package/dist/signals.js +5287 -2
  253. package/dist/site-builder/build.js +224 -2
  254. package/dist/site-builder/i18n.js +140 -2
  255. package/dist/site-builder/index.js +15 -2
  256. package/dist/site-builder/robots.js +26 -2
  257. package/dist/site-builder/router.js +27 -2
  258. package/dist/site-builder/seo.js +36 -2
  259. package/dist/site-builder/sitemap.js +26 -2
  260. package/dist/site-builder/theme.js +33 -2
  261. package/dist/site-builder/types.js +0 -1
  262. package/dist/slots.js +201 -2
  263. package/dist/source-maps.js +350 -2
  264. package/dist/spa-shell.js +34 -2
  265. package/dist/ssg.js +389 -389
  266. package/dist/ssr.js +355 -2
  267. package/dist/state-management.js +533 -2
  268. package/dist/store-imports.js +13 -2
  269. package/dist/store-loader.js +72 -5
  270. package/dist/stores-client.js +132 -2
  271. package/dist/story/addons.js +261 -2
  272. package/dist/story/analytics.js +235 -2
  273. package/dist/story/auto-stories.js +158 -2
  274. package/dist/story/bookmarks.js +277 -2
  275. package/dist/story/bun-test.js +102 -2
  276. package/dist/story/cli.js +155 -2
  277. package/dist/story/collect/analyzer.js +305 -2
  278. package/dist/story/collect/index.js +27 -2
  279. package/dist/story/collect/parser.js +129 -2
  280. package/dist/story/collect/scanner.js +101 -2
  281. package/dist/story/collect/tree.js +110 -2
  282. package/dist/story/commands/build.js +172 -2
  283. package/dist/story/commands/dev.js +78 -2
  284. package/dist/story/commands/index.js +3 -2
  285. package/dist/story/commands/preview.js +56 -2
  286. package/dist/story/compiled-output.js +151 -2
  287. package/dist/story/composition.js +261 -2
  288. package/dist/story/config-watcher.js +67 -2
  289. package/dist/story/config.js +64 -2
  290. package/dist/story/context.js +27 -2
  291. package/dist/story/controls/index.js +320 -2
  292. package/dist/story/crosswind.js +189 -2
  293. package/dist/story/desktop-preview.js +105 -2
  294. package/dist/story/docs-generator.js +186 -2
  295. package/dist/story/errors.js +239 -2
  296. package/dist/story/figma-export.js +224 -2
  297. package/dist/story/generator.js +165 -2
  298. package/dist/story/hmr.js +131 -2
  299. package/dist/story/hot-swap.js +207 -2
  300. package/dist/story/index.js +49 -2
  301. package/dist/story/interactions.js +225 -2
  302. package/dist/story/keyboard-shortcuts.js +345 -2
  303. package/dist/story/output.js +153 -2
  304. package/dist/story/performance.js +252 -2
  305. package/dist/story/presets.js +289 -2
  306. package/dist/story/props-validation.js +215 -2
  307. package/dist/story/renderer.js +209 -2
  308. package/dist/story/search-index.js +106 -2
  309. package/dist/story/search.js +140 -2
  310. package/dist/story/server.js +965 -2
  311. package/dist/story/setup.js +78 -2
  312. package/dist/story/snapshots.js +170 -2
  313. package/dist/story/testing.js +163 -2
  314. package/dist/story/theme.js +170 -2
  315. package/dist/story/types.js +0 -2
  316. package/dist/story/ui/code-panel.js +175 -2
  317. package/dist/story/ui/controls-panel.js +168 -2
  318. package/dist/story/ui/index.js +4 -2
  319. package/dist/story/ui/navigation.js +250 -2
  320. package/dist/story/ui/preview.js +251 -2
  321. package/dist/story/visual-testing.js +247 -2
  322. package/dist/streaming.js +537 -2
  323. package/dist/strict-lint.js +288 -2
  324. package/dist/style-scoping.js +50 -2
  325. package/dist/suspense.js +398 -2
  326. package/dist/teleport.js +109 -2
  327. package/dist/template-compiler.js +63 -2
  328. package/dist/template-hydrator.js +82 -2
  329. package/dist/template-tag-balance.js +93 -2
  330. package/dist/testing.js +581 -2
  331. package/dist/transitions.js +443 -2
  332. package/dist/type-checker.js +581 -2
  333. package/dist/types/component-types.d.ts +54 -0
  334. package/dist/types/component-types.js +0 -1
  335. package/dist/types/config-types.js +0 -1
  336. package/dist/types/context-types.js +0 -1
  337. package/dist/types/csp-types.js +0 -1
  338. package/dist/types/directive-types.js +3 -2
  339. package/dist/types/index.d.ts +5 -0
  340. package/dist/types/index.js +1 -2
  341. package/dist/types/pwa-types.js +0 -1
  342. package/dist/types.js +1 -2
  343. package/dist/typescript-templates.js +386 -4
  344. package/dist/utils.js +942 -2
  345. package/dist/validator.js +171 -2
  346. package/dist/variable-extractor.js +1094 -2
  347. package/dist/view-composers.js +29 -2
  348. package/dist/virtual-scrolling.js +454 -2
  349. package/dist/visual-editor.js +688 -28
  350. package/dist/vue-template.js +475 -2
  351. package/dist/web-components/css-scoping.js +177 -2
  352. package/dist/web-components/index.js +13 -2
  353. package/dist/web-components/reactive-generator.js +121 -56
  354. package/dist/web-components.js +1447 -2
  355. package/dist/x-element.js +17 -5
  356. package/package.json +5 -6
  357. package/dist/chunk-04n64bnt.js +0 -5
  358. package/dist/chunk-06w68hyg.js +0 -7
  359. package/dist/chunk-07y6m5xx.js +0 -3
  360. package/dist/chunk-095s3972.js +0 -99
  361. package/dist/chunk-09k66d8a.js +0 -3
  362. package/dist/chunk-0a61y94n.js +0 -24
  363. package/dist/chunk-0b9w2w1y.js +0 -1
  364. package/dist/chunk-0dx4q6yq.js +0 -3
  365. package/dist/chunk-0dz85jrp.js +0 -3
  366. package/dist/chunk-0jd0pndq.js +0 -3
  367. package/dist/chunk-0p0nyq50.js +0 -6
  368. package/dist/chunk-0p1h3p3w.js +0 -3
  369. package/dist/chunk-0qakwen3.js +0 -1
  370. package/dist/chunk-0qnz93q2.js +0 -3
  371. package/dist/chunk-10debkj5.js +0 -71
  372. package/dist/chunk-15nesxgt.js +0 -5224
  373. package/dist/chunk-1sr54zp8.js +0 -3
  374. package/dist/chunk-1v49fwr5.js +0 -3
  375. package/dist/chunk-1xz0w746.js +0 -1539
  376. package/dist/chunk-1z5nhbjt.js +0 -90
  377. package/dist/chunk-1zgsgk4b.js +0 -1
  378. package/dist/chunk-20swzkx3.js +0 -216
  379. package/dist/chunk-27zsyhrd.js +0 -4
  380. package/dist/chunk-29y0hk5z.js +0 -3
  381. package/dist/chunk-2cdvw21b.js +0 -274
  382. package/dist/chunk-2j21d3ka.js +0 -161
  383. package/dist/chunk-2jxbwnkz.js +0 -2
  384. package/dist/chunk-31dr4bys.js +0 -6
  385. package/dist/chunk-35faj94w.js +0 -15
  386. package/dist/chunk-39gm08bn.js +0 -39
  387. package/dist/chunk-3a4qsygv.js +0 -51
  388. package/dist/chunk-3te20hqw.js +0 -3
  389. package/dist/chunk-43t7faps.js +0 -24
  390. package/dist/chunk-44hd3kab.js +0 -1
  391. package/dist/chunk-47kpewks.js +0 -71
  392. package/dist/chunk-4aj7ftqb.js +0 -1
  393. package/dist/chunk-4d2y57k7.js +0 -3
  394. package/dist/chunk-4deg33rw.js +0 -57
  395. package/dist/chunk-4k7d8p8d.js +0 -188
  396. package/dist/chunk-4qcy5tx6.js +0 -53
  397. package/dist/chunk-4x7kae4j.js +0 -3
  398. package/dist/chunk-55nwdnsd.js +0 -3
  399. package/dist/chunk-55yp0q8t.js +0 -201
  400. package/dist/chunk-5f43yz6z.js +0 -12
  401. package/dist/chunk-5shey2e4.js +0 -3
  402. package/dist/chunk-6b5k6w2q.js +0 -7
  403. package/dist/chunk-6djzdes9.js +0 -14
  404. package/dist/chunk-6e4c6g46.js +0 -3
  405. package/dist/chunk-6eqbxcrd.js +0 -8
  406. package/dist/chunk-7074g241.js +0 -3
  407. package/dist/chunk-7b6s3g65.js +0 -179
  408. package/dist/chunk-7cgmq685.js +0 -33
  409. package/dist/chunk-7dkz6z2s.js +0 -3
  410. package/dist/chunk-7ed3tean.js +0 -3
  411. package/dist/chunk-7gd339hd.js +0 -109
  412. package/dist/chunk-7j5e8sdj.js +0 -3
  413. package/dist/chunk-7n8g0nfn.js +0 -38
  414. package/dist/chunk-7sqdeqsw.js +0 -1
  415. package/dist/chunk-80g54ncj.js +0 -3
  416. package/dist/chunk-8a5bxece.js +0 -4
  417. package/dist/chunk-8ahwt6a4.js +0 -721
  418. package/dist/chunk-8b3z0zd5.js +0 -8
  419. package/dist/chunk-8dhdpa5h.js +0 -4
  420. package/dist/chunk-8n9nnqr6.js +0 -3
  421. package/dist/chunk-8qc1bsym.js +0 -3
  422. package/dist/chunk-8va64c9n.js +0 -3
  423. package/dist/chunk-8vtm0m84.js +0 -3
  424. package/dist/chunk-8xj7c3mf.js +0 -8
  425. package/dist/chunk-988dw6q3.js +0 -9
  426. package/dist/chunk-9b6cec0v.js +0 -321
  427. package/dist/chunk-9cf97f9p.js +0 -3
  428. package/dist/chunk-9ecv8aqj.js +0 -14
  429. package/dist/chunk-9eq3ht5f.js +0 -8
  430. package/dist/chunk-9jtj77jx.js +0 -3
  431. package/dist/chunk-9t14se2t.js +0 -83
  432. package/dist/chunk-9wmq2272.js +0 -3
  433. package/dist/chunk-9zbk5zx5.js +0 -57
  434. package/dist/chunk-a2g2qb2y.js +0 -386
  435. package/dist/chunk-a3hyn4we.js +0 -79
  436. package/dist/chunk-a87qqft6.js +0 -194
  437. package/dist/chunk-ah88wzbg.js +0 -10
  438. package/dist/chunk-akf1r75r.js +0 -102
  439. package/dist/chunk-amaa1bev.js +0 -2
  440. package/dist/chunk-avx8aydt.js +0 -3
  441. package/dist/chunk-ay9qf4zj.js +0 -6
  442. package/dist/chunk-aywxfqev.js +0 -3
  443. package/dist/chunk-azkegjd8.js +0 -61
  444. package/dist/chunk-b77wjyn7.js +0 -84
  445. package/dist/chunk-baf1hfwh.js +0 -231
  446. package/dist/chunk-bdk6g1vj.js +0 -3
  447. package/dist/chunk-bhqgmyqw.js +0 -36
  448. package/dist/chunk-bk3j0n82.js +0 -341
  449. package/dist/chunk-bndmdahk.js +0 -3
  450. package/dist/chunk-bpgg59wa.js +0 -3
  451. package/dist/chunk-bs3gmfxz.js +0 -5
  452. package/dist/chunk-bxc7kjsk.js +0 -32
  453. package/dist/chunk-c7jg8w13.js +0 -3
  454. package/dist/chunk-ckxjqqn9.js +0 -3
  455. package/dist/chunk-cn8az1b4.js +0 -1
  456. package/dist/chunk-d0zjtdw4.js +0 -29
  457. package/dist/chunk-d1qh1x2g.js +0 -3
  458. package/dist/chunk-djddhmcc.js +0 -60
  459. package/dist/chunk-dqn9gyhb.js +0 -21
  460. package/dist/chunk-drjq2zwg.js +0 -3
  461. package/dist/chunk-dvfs1h3c.js +0 -117
  462. package/dist/chunk-e2q9c5vq.js +0 -8
  463. package/dist/chunk-e98v1bc6.js +0 -12
  464. package/dist/chunk-ejayeex8.js +0 -2
  465. package/dist/chunk-ejh8fyak.js +0 -3
  466. package/dist/chunk-ek2w6zvy.js +0 -4
  467. package/dist/chunk-ewa88139.js +0 -6
  468. package/dist/chunk-fjk3x41y.js +0 -3
  469. package/dist/chunk-frg705zq.js +0 -302
  470. package/dist/chunk-fzm3y0r3.js +0 -267
  471. package/dist/chunk-g1vt329s.js +0 -21
  472. package/dist/chunk-g4ps1dj8.js +0 -140
  473. package/dist/chunk-gkzq8zw4.js +0 -23
  474. package/dist/chunk-gz5fmp3q.js +0 -3
  475. package/dist/chunk-h0hjy0kn.js +0 -292
  476. package/dist/chunk-h5jxydqq.js +0 -147
  477. package/dist/chunk-h5wa62ek.js +0 -145
  478. package/dist/chunk-h7aq56qj.js +0 -28
  479. package/dist/chunk-h82kjdr4.js +0 -83
  480. package/dist/chunk-hbehnm18.js +0 -3
  481. package/dist/chunk-hbgxbgam.js +0 -58
  482. package/dist/chunk-hc2mf5h6.js +0 -4
  483. package/dist/chunk-hjm2xab3.js +0 -3
  484. package/dist/chunk-hjv76kcw.js +0 -1
  485. package/dist/chunk-hrnnh4tq.js +0 -142
  486. package/dist/chunk-ht43ds42.js +0 -236
  487. package/dist/chunk-hxx3za24.js +0 -62
  488. package/dist/chunk-hy8820vc.js +0 -6
  489. package/dist/chunk-j447q024.js +0 -28
  490. package/dist/chunk-j58vh0w6.js +0 -314
  491. package/dist/chunk-j8tn8enq.js +0 -3
  492. package/dist/chunk-jc0fc4ht.js +0 -11
  493. package/dist/chunk-jcs0ymw7.js +0 -3
  494. package/dist/chunk-jjamhxpm.js +0 -139
  495. package/dist/chunk-jjb05d21.js +0 -3
  496. package/dist/chunk-jjdq01dv.js +0 -128
  497. package/dist/chunk-jnmgm2xw.js +0 -5
  498. package/dist/chunk-jpndqst5.js +0 -3
  499. package/dist/chunk-jt0ezawy.js +0 -351
  500. package/dist/chunk-jz73j3qs.js +0 -169
  501. package/dist/chunk-k21df0pg.js +0 -10
  502. package/dist/chunk-k848dzsa.js +0 -429
  503. package/dist/chunk-kdfe4t91.js +0 -3
  504. package/dist/chunk-keawsbpn.js +0 -5
  505. package/dist/chunk-kgym7ch9.js +0 -8
  506. package/dist/chunk-khdn7jwe.js +0 -3
  507. package/dist/chunk-km25cwz6.js +0 -3
  508. package/dist/chunk-knm8a8yx.js +0 -398
  509. package/dist/chunk-krqn0ddk.js +0 -3
  510. package/dist/chunk-ktkmvaa8.js +0 -1
  511. package/dist/chunk-kx6eb6ma.js +0 -4
  512. package/dist/chunk-kypas8vy.js +0 -4
  513. package/dist/chunk-m167kjhv.js +0 -4
  514. package/dist/chunk-m491r0rj.js +0 -358
  515. package/dist/chunk-m8448qby.js +0 -11
  516. package/dist/chunk-mgj88zeq.js +0 -64
  517. package/dist/chunk-mhgk632d.js +0 -3
  518. package/dist/chunk-mv4fb50w.js +0 -1
  519. package/dist/chunk-n5kg7fpx.js +0 -7
  520. package/dist/chunk-n98x35xd.js +0 -8
  521. package/dist/chunk-n9dhs1dw.js +0 -106
  522. package/dist/chunk-nd9rmddh.js +0 -6
  523. package/dist/chunk-ngxfwzq3.js +0 -3
  524. package/dist/chunk-nhv099jv.js +0 -19
  525. package/dist/chunk-nm15ccsg.js +0 -5
  526. package/dist/chunk-npfmdb6y.js +0 -71
  527. package/dist/chunk-nvwb4x04.js +0 -3
  528. package/dist/chunk-nw34xajc.js +0 -8
  529. package/dist/chunk-p077sw22.js +0 -3
  530. package/dist/chunk-p1h8065h.js +0 -3
  531. package/dist/chunk-p3e0cqtt.js +0 -34
  532. package/dist/chunk-p3fpb79v.js +0 -477
  533. package/dist/chunk-p52yzjq6.js +0 -498
  534. package/dist/chunk-p73meypx.js +0 -134
  535. package/dist/chunk-pa9zb7ty.js +0 -4
  536. package/dist/chunk-payfb24w.js +0 -207
  537. package/dist/chunk-pcm1vd8w.js +0 -3
  538. package/dist/chunk-pcntd9h4.js +0 -3
  539. package/dist/chunk-pg1fvqb9.js +0 -167
  540. package/dist/chunk-psc3wfcf.js +0 -1115
  541. package/dist/chunk-pznnww6k.js +0 -6
  542. package/dist/chunk-q6zhd9yf.js +0 -3
  543. package/dist/chunk-qa59zejf.js +0 -246
  544. package/dist/chunk-qvrbjpdc.js +0 -3
  545. package/dist/chunk-qygvvygy.js +0 -12
  546. package/dist/chunk-r0jcmpv6.js +0 -68
  547. package/dist/chunk-r5m9xtm7.js +0 -3
  548. package/dist/chunk-rh80q1nd.js +0 -1
  549. package/dist/chunk-rkffm9sy.js +0 -128
  550. package/dist/chunk-rpx5fa65.js +0 -3
  551. package/dist/chunk-rqxf5hns.js +0 -3
  552. package/dist/chunk-rtr974rc.js +0 -30
  553. package/dist/chunk-rvptcndz.js +0 -3
  554. package/dist/chunk-rw26rpek.js +0 -171
  555. package/dist/chunk-rw7937v4.js +0 -19
  556. package/dist/chunk-rwrv9wbf.js +0 -3
  557. package/dist/chunk-rz2ec6g7.js +0 -347
  558. package/dist/chunk-s6ja2bdg.js +0 -66
  559. package/dist/chunk-scpkdrdb.js +0 -4
  560. package/dist/chunk-shv88d2d.js +0 -10
  561. package/dist/chunk-t0c9wvpr.js +0 -3
  562. package/dist/chunk-tffh3b1e.js +0 -35
  563. package/dist/chunk-tg2f1mzq.js +0 -11
  564. package/dist/chunk-trfswy66.js +0 -77
  565. package/dist/chunk-tzwtg722.js +0 -3
  566. package/dist/chunk-v7f8jj15.js +0 -4
  567. package/dist/chunk-v8j49spx.js +0 -3
  568. package/dist/chunk-v97390pe.js +0 -1
  569. package/dist/chunk-vcr5pzpx.js +0 -233
  570. package/dist/chunk-veeerpwa.js +0 -3
  571. package/dist/chunk-vg5kt6az.js +0 -4
  572. package/dist/chunk-vgv7jvyz.js +0 -219
  573. package/dist/chunk-vjbefncc.js +0 -3
  574. package/dist/chunk-vmxjghsm.js +0 -3
  575. package/dist/chunk-vw7vqd76.js +0 -3
  576. package/dist/chunk-vx22he47.js +0 -1
  577. package/dist/chunk-w3b6m427.js +0 -45
  578. package/dist/chunk-wazkqv7n.js +0 -3
  579. package/dist/chunk-wf7zrjsw.js +0 -138
  580. package/dist/chunk-wfg2gm11.js +0 -3
  581. package/dist/chunk-wg9k6h8w.js +0 -12
  582. package/dist/chunk-wkz2vwkr.js +0 -81
  583. package/dist/chunk-wvef3ngh.js +0 -127
  584. package/dist/chunk-wvf31nzs.js +0 -3
  585. package/dist/chunk-x05nxhyv.js +0 -262
  586. package/dist/chunk-x0770gt9.js +0 -4
  587. package/dist/chunk-x24s4heg.js +0 -1166
  588. package/dist/chunk-x3r64r0c.js +0 -6
  589. package/dist/chunk-x5g9w4hh.js +0 -5
  590. package/dist/chunk-xgkv66q5.js +0 -2230
  591. package/dist/chunk-xqq1vxb6.js +0 -1
  592. package/dist/chunk-xs03kc1h.js +0 -196
  593. package/dist/chunk-xv34zbp4.js +0 -3
  594. package/dist/chunk-xw36p73h.js +0 -90
  595. package/dist/chunk-xyg1r5w0.js +0 -4
  596. package/dist/chunk-xys2sxh6.js +0 -16
  597. package/dist/chunk-y0qg6rrv.js +0 -3
  598. package/dist/chunk-y1k17c8b.js +0 -21
  599. package/dist/chunk-y5xz0jc4.js +0 -141
  600. package/dist/chunk-y6xsqe9a.js +0 -10
  601. package/dist/chunk-yb1t2h8h.js +0 -11
  602. package/dist/chunk-ygvyc6wv.js +0 -90
  603. package/dist/chunk-yj4x5ehw.js +0 -21
  604. package/dist/chunk-yn38c15w.js +0 -4
  605. package/dist/chunk-ynhngsdh.js +0 -3
  606. package/dist/chunk-yrsb6j3z.js +0 -3
  607. package/dist/chunk-yywfvfph.js +0 -2
  608. package/dist/chunk-zcxzdrn7.js +0 -5
  609. package/dist/chunk-zen6ax1y.js +0 -27
  610. package/dist/chunk-zf2pek72.js +0 -3
  611. package/dist/chunk-zk3d0jjf.js +0 -7
  612. package/dist/chunk-zy3rp1ab.js +0 -93
package/dist/ssg.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var gJ=Object.defineProperty;var hJ=($)=>$;function dJ($,Z){this[$]=hJ.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)gJ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:dJ.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var q0=import.meta.require;var B0;var x3=b(()=>{B0={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"}});function f3($,Z,Y,J){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,z,K)=>{let q={"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"}[z]||"Make this element accessible";return`<!-- a11y-hint: ${K||q} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,z)=>{return`<span class="sr-only">${z.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,z,K)=>{return`<span id="${`desc-${z}`}" class="sr-only">${K}</span>`}),Q}var g3,h3;var N4=b(()=>{g3={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"",z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||z} -->${$}`},hasEndTag:!1},h3={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function uJ($,Z={}){let{duration:Y,delay:J,ease:Q,direction:X,custom:G}={...e0,...Z};if($==="custom"&&G)return G;switch($){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);"}
2
+ var lJ=Object.defineProperty;var cJ=($)=>$;function iJ($,Z){this[$]=cJ.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)lJ($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:iJ.bind(Z,Y)})};var S=($,Z)=>()=>($&&(Z=$($=0)),Z);var z0=import.meta.require;var B0;var K6=S(()=>{B0={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"}});function q6($,Z,Y,J){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let z={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||z} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(X,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var z6,W6;var T$=S(()=>{z6={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[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"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},W6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function oJ($,Z={}){let{duration:Y,delay:J,ease:Q,direction:X,custom:G}={...e0,...Z};if($==="custom"&&G)return G;switch($){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);"}
3
3
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
4
4
  @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);"}
5
5
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -9,7 +9,7 @@ var gJ=Object.defineProperty;var hJ=($)=>$;function dJ($,Z){this[$]=hJ.bind(null
9
9
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
10
10
  @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);"}
11
11
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
12
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function pJ(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function sJ(){return`
13
13
  <script data-stx-scoped>
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function cJ($){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($))}function lJ($=0.1,Z="0px"){return`
40
+ `}function rJ($){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($))}function aJ($=0.1,Z="0px"){return`
41
41
  <script data-stx-scoped>
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function iJ(){return`
83
+ `}function tJ(){return`
84
84
  <style id="stx-animation-base">
85
85
  :root {
86
86
  --stx-transition-duration: 300ms;
@@ -195,7 +195,7 @@ else {
195
195
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
196
196
  }
197
197
  </style>
198
- `}function nJ($,Z,Y={}){let{staggerDelay:J=50,sequence:Q=!1}=Y;return`
198
+ `}function eJ($,Z,Y={}){let{staggerDelay:J=50,sequence:Q=!1}=Y;return`
199
199
  <script data-stx-scoped>
200
200
  // Animation Group: ${$}
201
201
  (function() {
@@ -232,11 +232,11 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function c3($,Z,Y,J){let Q=$;if(J.animation?.enabled===!1)return Q;let X=Y.includes("test")&&Y.includes("animation");if(!cJ(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let z=iJ();Q=Q.replace("</head>",`${z}
236
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let K=lJ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+K+`
237
- `+Q.slice(W)}}return Q}var e0,d3,m3,u3,p3;var R4=b(()=>{e0={duration:300,delay:0,ease:"ease",direction:"both"};d3={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,z=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,K=Z.length>4?Z[4]||e0.direction:e0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,q=uJ(Q,{duration:X,delay:z,ease:G,direction:K}),U="stx-transition",_="";if(Q==="fade")_="stx-fade";else if(Q==="slide")_="stx-slide";else if(Q==="scale")_="stx-scale";else if(Q==="flip")_="stx-flip";else if(Q==="rotate")_="stx-rotate";return`<div id="${W}" class="${U} ${_} ${K==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${z}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},m3={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",z=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,K=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,q=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${W}" class="${U}" style="${q}" data-threshold="${z}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},u3={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,z=Y.sequence||!0,K=nJ(Q,X,{staggerDelay:G,sequence:z});return`${$}
239
- ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},p3={name:"motion",handler:($,Z,Y,J)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=pJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as l3}from"stx-router";var i3=b(()=>{T4()});async function oJ($,Z,Y,J){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=l3();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var n3;var T4=b(()=>{i3();n3={name:"stxRouter",handler:oJ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function o3($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...sJ,...Z};return`
235
+ `}function H6($,Z,Y,J){let Q=$;if(J.animation?.enabled===!1)return Q;let X=Y.includes("test")&&Y.includes("animation");if(!rJ(Q)&&!X)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=tJ();Q=Q.replace("</head>",`${K}
236
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=aJ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
237
+ `+Q.slice(W)}}return Q}var e0,U6,_6,B6,j6;var M$=S(()=>{e0={duration:300,delay:0,ease:"ease",direction:"both"};U6={name:"transition",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||e0.duration:e0.duration,G=Z.length>2?Z[2]||e0.ease:e0.ease,K=Z.length>3?Number.parseInt(Z[3],10)||e0.delay:e0.delay,q=Z.length>4?Z[4]||e0.direction:e0.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=oJ(Q,{duration:X,delay:K,ease:G,direction:q}),U="stx-transition",_="";if(Q==="fade")_="stx-fade";else if(Q==="slide")_="stx-slide";else if(Q==="scale")_="stx-scale";else if(Q==="flip")_="stx-flip";else if(Q==="rotate")_="stx-rotate";return`<div id="${W}" class="${U} ${_} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},_6={name:"scrollAnimate",handler:($,Z,Y,J)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Q=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},B6={name:"animationGroup",handler:($,Z,Y,J)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Q=Z[0],X=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=eJ(Q,X,{staggerDelay:G,sequence:K});return`${$}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},j6={name:"motion",handler:($,Z,Y,J)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,X=sJ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as O6}from"stx-router";var L6=S(()=>{I$()});async function $X($,Z,Y,J){let Q=Z[0]?.replace(/['"]/g,"")||"main",X=O6();if(Q!=="main")X=X.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${X}</script>`}var F6;var I$=S(()=>{L6();F6={name:"stxRouter",handler:$X,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function V6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...ZX,...Z};return`
240
240
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
241
241
  <script>
242
242
  (function() {
@@ -619,9 +619,9 @@ else {
619
619
  };
620
620
  })();
621
621
  </script>
622
- `}function s3($,Z){let Y=o3(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function rJ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[Q,X]=J.split("="),G=X?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var sJ,r3;var M4=b(()=>{sJ={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};r3={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let Q=Y.__stx_config||{};if(Z.length>0){let X=rJ(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return o3(Q)}}});function Q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function a3($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function t3($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],Q=$.slice(Y[0].length),X={};for(let G of J.split(`
623
- `)){let z=G.trim();if(!z||z.startsWith("#"))continue;let K=z.indexOf(":");if(K===-1)continue;let W=z.slice(0,K).trim(),q=z.slice(K+1).trim();if(typeof q==="string"){if(q.startsWith('"')&&q.endsWith('"')||q.startsWith("'")&&q.endsWith("'"))q=q.slice(1,-1);else if(q.startsWith("[")&&q.endsWith("]"))try{q=JSON.parse(q)}catch{}else if(q==="true")q=!0;else if(q==="false")q=!1;else if(/^-?\d+(?:\.\d+)?$/.test(q))q=Number(q)}X[W]=q}return{data:X,content:Q.trim()}}function W5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(q,U,_)=>{let B=X.length,j=U?` class="language-${Q1(U)}"`:"";return X.push(`<pre><code${j}>${Q1(_.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Q=Q.replace(/`([^`]*)`/g,(q,U)=>`<code>${Q1(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(q,U,_)=>{return`<img src="${a3(_)?Q1(_):""}" alt="${Q1(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(q,U,_)=>{return`<a href="${a3(_)?Q1(_):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
- `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(q,U,_)=>{let j=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${Q1(L)}</th>`).join("")}</tr>`,H=_.trim().split(`
622
+ `}function w6($,Z){let Y=V6(Z);if(!Y)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}function YX($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[Q,X]=J.split("="),G=X?.replace(/["']/g,"");switch(Q){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var ZX,A6;var D$=S(()=>{ZX={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};A6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let Q=Y.__stx_config||{};if(Z.length>0){let X=YX(Z.join(" "));Q.heatmap={...Q.heatmap,...X,enabled:!0}}return V6(Q)}}});function Q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function N6($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function R6($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],Q=$.slice(Y[0].length),X={};for(let G of J.split(`
623
+ `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),z=K.slice(q+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}X[W]=z}return{data:X,content:Q.trim()}}function W5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,Q=$,X=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,_)=>{let B=X.length,j=U?` class="language-${Q1(U)}"`:"";return X.push(`<pre><code${j}>${Q1(_.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Q=Q.replace(/`([^`]*)`/g,(z,U)=>`<code>${Q1(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,_)=>{return`<img src="${N6(_)?Q1(_):""}" alt="${Q1(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,_)=>{return`<a href="${N6(_)?Q1(_):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
624
+ `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,_)=>{let j=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${Q1(L)}</th>`).join("")}</tr>`,H=_.trim().split(`
625
625
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${Q1(O)}</td>`).join("")}</tr>`}).join(`
626
626
  `);return`<table>
627
627
  <thead>
@@ -631,33 +631,33 @@ ${j}
631
631
  ${H}
632
632
  </tbody>
633
633
  </table>`});if(Y)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
634
- `),z=[],K=!1,W=[];for(let q of G){let U=q.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(K&&W.length>0)z.push(`<p>${W.join(J?`<br />
634
+ `),K=[],q=!1,W=[];for(let z of G){let U=z.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(q&&W.length>0)K.push(`<p>${W.join(J?`<br />
635
635
  `:`
636
- `)}</p>`),W=[],K=!1;z.push(q)}else K=!0,W.push(U)}if(K&&W.length>0)z.push(`<p>${W.join(J?`<br />
636
+ `)}</p>`),W=[],q=!1;K.push(z)}else q=!0,W.push(U)}if(q&&W.length>0)K.push(`<p>${W.join(J?`<br />
637
637
  `:`
638
- `)}</p>`);if(Q=z.join(`
638
+ `)}</p>`);if(Q=K.join(`
639
639
  `),J)Q=Q.replace(/\n/g,`<br />
640
- `);for(let q=0;q<X.length;q++)Q=Q.replace(`\x00CODEBLOCK${q}\x00`,X[q]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function $1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
640
+ `);for(let z=0;z<X.length;z++)Q=Q.replace(`\x00CODEBLOCK${z}\x00`,X[z]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function $1($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
641
641
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
642
- `}),$}import aJ from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,Q]of Object.entries(aJ.env)){if(!J.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Q),Y[J]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var d1=()=>{};var l5={};r(l5,{hasUserImports:()=>tJ,bundleClientScript:()=>$X});import O0 from"path";import h0 from"fs";function tJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=J.exec($))!==null){let G=Q[1];if(!e3.some((K)=>K.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!e3.some((K)=>K.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function eJ($,Z,Y,J){let Q=(X,G)=>{let z=X===Y?Z:O0.dirname(X),K=O0.resolve(z,G),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,O0.join(K,"index.ts"),O0.join(K,"index.tsx"),O0.join(K,"index.js"),O0.join(K,"index.mjs")];for(let q of W)try{if(h0.existsSync(q)&&h0.statSync(q,{throwIfNoEntry:!1})?.isFile())return q}catch{}return K};return{name:"stx-client-bundle",setup(X){X.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),X.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),X.onResolve({filter:/^\.\.?\//},(G)=>{let z=Q(G.importer,G.path);return J.add(z),{path:z}}),X.onResolve({filter:/^[@~]\//},(G)=>{let z=O0.resolve($,G.path.slice(2)),K=[z,`${z}.ts`,`${z}.tsx`,`${z}.js`,`${z}.mjs`,`${z}.jsx`,O0.join(z,"index.ts"),O0.join(z,"index.tsx"),O0.join(z,"index.js"),O0.join(z,"index.mjs")];for(let W of K)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:z}})}}}async function $X($,Z,Y={}){let J=Y.projectRoot||process.cwd(),Q=Y.minify??!1,X=Y.cacheDir||O0.join(J,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let z=G.digest("hex").slice(0,12),K=O0.join(X,`${z}.js`),W=O0.join(X,`${z}.deps.json`),q=Bun.file(K);if(await q.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(h0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",z),await q.text();console.log("[stx:bundler] cache invalidated by dep change:",z)}let U=O0.join(J,".stx","bundle-tmp"),_=O0.join(U,`${z}.ts`),B=O0.join(U,"out",z);h0.mkdirSync(U,{recursive:!0}),h0.mkdirSync(B,{recursive:!0});let j=O0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
643
- export { ${H.join(", ")} }`:"";await Bun.write(_,$+V),console.log("[stx:bundler] bundling:",z,"from:",O0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[_],outdir:B,target:"browser",format:"esm",minify:Q,plugins:[eJ(J,j,_,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...o0()},root:J});if(!A.success){let M=A.logs.filter((D)=>D.level==="error").map((D)=>D.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let R=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let D of M[1].split(",")){let I=D.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(I&&I[1]!==I[2])R.push([I[2],I[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let M=R.map(([D,I])=>`${JSON.stringify(D)}: ${I}`).join(", ");N+=`
644
- var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",z,"output:",N.length,"bytes"),h0.mkdirSync(X,{recursive:!0}),await Bun.write(K,N);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:h0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),R=A?.errors,T=Array.isArray(R)&&R.length>0?`
642
+ `}),$}import JX from"process";function o0($="STX_PUBLIC_"){let Z={},Y={};for(let[J,Q]of Object.entries(JX.env)){if(!J.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${J}`]=JSON.stringify(Q),Y[J]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var m1=()=>{};var i5={};r(i5,{hasUserImports:()=>XX,bundleClientScript:()=>GX});import O0 from"path";import h0 from"fs";function XX($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let J=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=J.exec($))!==null){let G=Q[1];if(!T6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let X=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=X.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!T6.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function QX($,Z,Y,J){let Q=(X,G)=>{let K=X===Y?Z:O0.dirname(X),q=O0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,O0.join(q,"index.ts"),O0.join(q,"index.tsx"),O0.join(q,"index.js"),O0.join(q,"index.mjs")];for(let z of W)try{if(h0.existsSync(z)&&h0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(X){X.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),X.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),X.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return J.add(K),{path:K}}),X.onResolve({filter:/^[@~]\//},(G)=>{let K=O0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,O0.join(K,"index.ts"),O0.join(K,"index.tsx"),O0.join(K,"index.js"),O0.join(K,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function GX($,Z,Y={}){let J=Y.projectRoot||process.cwd(),Q=Y.minify??!1,X=Y.cacheDir||O0.join(J,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=O0.join(X,`${K}.js`),W=O0.join(X,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(h0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=O0.join(J,".stx","bundle-tmp"),_=O0.join(U,`${K}.ts`),B=O0.join(U,"out",K);h0.mkdirSync(U,{recursive:!0}),h0.mkdirSync(B,{recursive:!0});let j=O0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
643
+ export { ${H.join(", ")} }`:"";await Bun.write(_,$+V),console.log("[stx:bundler] bundling:",K,"from:",O0.basename(Z));let w=new Set;try{let A=await Bun.build({entrypoints:[_],outdir:B,target:"browser",format:"esm",minify:Q,plugins:[QX(J,j,_,w)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...o0()},root:J});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let R=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])R.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let M=R.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
644
+ var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),h0.mkdirSync(X,{recursive:!0}),await Bun.write(q,N);let T=Array.from(w).map((M)=>{try{return{path:M,mtimeMs:h0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),R=A?.errors,T=Array.isArray(R)&&R.length>0?`
645
645
  ${R.map((M)=>`- ${M?.message??M}`).join(`
646
- `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{h0.rmSync(_,{force:!0}),h0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var e3;var i5=b(()=>{d1();e3=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var J6={};r(J6,{renderVendorStyleTags:()=>Y6,processClientScript:()=>B5,generateServerDataBridge:()=>n5,extractBridgeData:()=>_5,extractAndStripCssImports:()=>Z6});import w1 from"path";import U5 from"fs";function YX($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function JX($,Z){let Y=Z;while(!0){let J=w1.join(Y,"node_modules",$,"package.json");if(U5.existsSync(J))return w1.dirname(J);let Q=w1.dirname(Y);if(Q===Y)return null;Y=Q}}function XX($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let Q of Object.keys($)){let X=Q.indexOf("*");if(X===-1)continue;let G=Q.slice(0,X),z=Q.slice(X+1);if(!Z.startsWith(G)||!Z.endsWith(z))continue;if(Z.length<G.length+z.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Q,prefix:G,suffix:z}}if(J){let Q=Z.slice(J.prefix.length,Z.length-J.suffix.length),X=Y($[J.pattern]);if(X)return X.replace("*",Q)}return null}function QX($,Z){let Y=YX($);if(!Y||!Y.subpath)return null;let J=JX(Y.pkg,Z);if(!J)return null;let Q;try{Q=JSON.parse(U5.readFileSync(w1.join(J,"package.json"),"utf8"))}catch{return null}let X=`.${Y.subpath}`,G=XX(Q.exports,X);if(!G)return null;let z=w1.resolve(J,G);return U5.existsSync(z)?z:null}function Z6($,Z){let Y=Z.filePath?w1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Q=new Set,X=[];return{code:$.replace(ZX,(z,K)=>{let W;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(W=K.startsWith("/")?K:w1.resolve(Y,K),!U5.existsSync(W))throw Error(`file not found: ${W}`)}else{let q=null;try{q=Bun.resolveSync(K,J)}catch{q=QX(K,J)}if(!q)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);W=q}}catch(q){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${Z.filePath||"<unknown>"}): ${q?.message||q}`),""}if(Q.has(W))return"";Q.add(W);try{let q=U5.readFileSync(W,"utf8");X.push({source:K,resolvedPath:W,contents:q})}catch(q){console.warn(`[stx:vendor-css] could not read ${W}: ${q?.message||q}`)}return""}),styles:X}}function GX($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Y6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${GX(Z.source)}" data-stx-layer="vendor">
646
+ `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{h0.rmSync(_,{force:!0}),h0.rmSync(B,{recursive:!0,force:!0})}catch{}}}var T6;var n5=S(()=>{m1();T6=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var E6={};r(E6,{renderVendorStyleTags:()=>D6,processClientScript:()=>B5,generateServerDataBridge:()=>o5,extractBridgeData:()=>_5,extractAndStripCssImports:()=>I6});import w1 from"path";import U5 from"fs";function qX($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function zX($,Z){let Y=Z;while(!0){let J=w1.join(Y,"node_modules",$,"package.json");if(U5.existsSync(J))return w1.dirname(J);let Q=w1.dirname(Y);if(Q===Y)return null;Y=Q}}function WX($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let J=null;for(let Q of Object.keys($)){let X=Q.indexOf("*");if(X===-1)continue;let G=Q.slice(0,X),K=Q.slice(X+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!J||G.length>J.prefix.length)J={pattern:Q,prefix:G,suffix:K}}if(J){let Q=Z.slice(J.prefix.length,Z.length-J.suffix.length),X=Y($[J.pattern]);if(X)return X.replace("*",Q)}return null}function UX($,Z){let Y=qX($);if(!Y||!Y.subpath)return null;let J=zX(Y.pkg,Z);if(!J)return null;let Q;try{Q=JSON.parse(U5.readFileSync(w1.join(J,"package.json"),"utf8"))}catch{return null}let X=`.${Y.subpath}`,G=WX(Q.exports,X);if(!G)return null;let K=w1.resolve(J,G);return U5.existsSync(K)?K:null}function I6($,Z){let Y=Z.filePath?w1.dirname(Z.filePath):Z.projectRoot||process.cwd(),J=Z.projectRoot||process.cwd(),Q=new Set,X=[];return{code:$.replace(KX,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:w1.resolve(Y,q),!U5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,J)}catch{z=UX(q,J)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(Q.has(W))return"";Q.add(W);try{let z=U5.readFileSync(W,"utf8");X.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:X}}function _X($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D6($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${_X(Z.source)}" data-stx-layer="vendor">
647
647
  @layer vendor {
648
648
  ${Z.contents}
649
649
  }
650
650
  </style>`}).join(`
651
651
  `)}
652
- `}function WX($){let Z=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($))!==null)if(!qX.has(J[1]))Z.add(J[1]);return Array.from(Z)}function UX($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let K=G[1],W=G[2];if(G[0].includes("import type"))continue;K.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(Q.add(U),W==="stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let K of zX){if(Q.has(K))continue;if(new RegExp(`\\b${K}\\s*\\(`,"g").test(J))Z.add(K)}for(let K of KX){if(Q.has(K))continue;if(new RegExp(`\\b${K}\\b`,"g").test(J))Y.add(K)}let z=WX(J);for(let K of z)if(!Q.has(K))Y.add(K);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function _X($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
652
+ `}function OX($){let Z=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($))!==null)if(!HX.has(J[1]))Z.add(J[1]);return Array.from(Z)}function LX($){let Z=new Set,Y=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Q=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,G;while((G=X.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(Q.add(U),W==="stx")Z.add(U);else Y.add(U)}),J=J.replace(G[0],"// [auto-import processed]")}for(let q of BX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of jX){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=OX(J);for(let q of K)if(!Q.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function FX($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
653
653
  ${Y.join(`
654
654
  `)}
655
- `;return""}function _5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function n5($,Z){if(!Z)return"";let Y=[];for(let[J,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(new RegExp(`(?:const|let|var|function|class)\\s+${J}\\b`).test($))continue;let X;try{X=JSON.stringify(Q)}catch{continue}if(X===void 0)continue;Y.push(` var ${J} = ${X.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
655
+ `;return""}function _5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function o5($,Z){if(!Z)return"";let Y=[];for(let[J,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(J))continue;if(!new RegExp(`\\b${J}\\b`).test($))continue;if(new RegExp(`(?:const|let|var|function|class)\\s+${J}\\b`).test($))continue;let X;try{X=JSON.stringify(Q)}catch{continue}if(X===void 0)continue;Y.push(` var ${J} = ${X.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
656
656
  ${Y.join(`
657
657
  `)}
658
- `}function jX($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=BX[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function HX($,Z){let{elementId:Y,event:J,handler:Q,modifiers:X}=$,G=jX(X),z=[];if(X.once)z.push("once: true");if(X.capture)z.push("capture: true");if(X.passive)z.push("passive: true");let K=z.length>0?`, { ${z.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let q=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(_){return`var scope = $el.closest('[data-stx-scope]');
658
+ `}function wX($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=VX[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function AX($,Z){let{elementId:Y,event:J,handler:Q,modifiers:X}=$,G=wX(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(", ")} }`:"",W="";if(G)W+=`${G}; `;let z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'");function U(_){return`var scope = $el.closest('[data-stx-scope]');
659
659
  if (scope && scope.__stx_execute) {
660
- scope.__stx_execute('${q}', $event, $el);
660
+ scope.__stx_execute('${z}', $event, $el);
661
661
  }
662
662
  else {
663
663
  ${_}
@@ -669,7 +669,7 @@ else {
669
669
  $el.addEventListener('${J}', function($event) {
670
670
  ${G?G+"; ":""}clearTimeout(__timer)
671
671
  __timer = setTimeout(function() { ${U(Q)} }, ${X.debounce})
672
- }${K})
672
+ }${q})
673
673
  })()`;if(X.throttle!==null)return` ;(function() {
674
674
  // eslint-disable-next-line pickier/no-unused-vars
675
675
  var $el = document.getElementById('${Y}')
@@ -681,21 +681,21 @@ else {
681
681
  __last = __now
682
682
  ${U(Q)}
683
683
  }
684
- }${K})
684
+ }${q})
685
685
  })()`;return` var $el = document.getElementById('${Y}')
686
686
  if ($el) $el.addEventListener('${J}', function($event) {
687
687
  ${W}var scope = $el.closest('[data-stx-scope]');
688
688
  if (scope && scope.__stx_execute) {
689
- scope.__stx_execute('${q}', $event, $el);
689
+ scope.__stx_execute('${z}', $event, $el);
690
690
  }
691
691
  else {
692
692
  ${Q}
693
693
  }
694
- }${K})`}function OX($){if($.length===0)return"";return`
694
+ }${q})`}function NX($){if($.length===0)return"";return`
695
695
  // STX: auto-generated event bindings
696
- ${$.map((Y,J)=>HX(Y,J)).join(`
697
- `)}`}function $6($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Q=0,X=J.length,G=0;while(G<X){let z=J[G];if(z==="'"||z==='"'||z==="`"){let K=z;if(G++,K==="`"){let W=0;while(G<X){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<X){if(J[G]==="\\"){G+=2;continue}if(J[G]===K){G++;break}G++}continue}if(z==="/"&&J[G+1]==="/"){while(G<X&&J[G]!==`
698
- `)G++;continue}if(z==="/"&&J[G+1]==="*"){G+=2;while(G<X-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(z==="{"){Q++,G++;continue}if(z==="}"){Q--,G++;continue}if(Q===0){let K=J.slice(G),W=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let _=W[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=W[0].length;continue}let q=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(q){q[1].split(",").forEach((_)=>{let B=_.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=q[0].length;continue}let U=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let _=U[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=U[0].length;continue}}G++}return Z}function FX($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(_){let B;while((B=Y.exec(_))!==null){let j=B[0];if(!LX.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)J(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)J(X[1]);let z=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=z.exec($))!==null)J(X[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=K.exec($))!==null)J(X[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=W.exec($))!==null)J(X[1]);let q=/@model\s*=\s*["']([^"']*)["']/gi;while((X=q.exec($))!==null)J(X[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=U.exec($))!==null)J(X[1]);return Z}async function B5($,Z={}){let Y=$,J="",Q=!1,X=Z6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=X.code;let G=Y6(X.styles),{hasUserImports:z,bundleClientScript:K}=await Promise.resolve().then(() => (i5(),l5));if(z(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await K(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=UX(Y);Y=L.code,J=_X(L.stxImports,L.browserImports)}if(J=`${n5(Y,Z.serverData)}${J}`,Y=$1(Y),!Q&&A1(Z.attrs||""))Y=N1(Y);let W=OX(Z.eventBindings||[]),q=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(q)){let L=q.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
696
+ ${$.map((Y,J)=>AX(Y,J)).join(`
697
+ `)}`}function M6($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Q=0,X=J.length,G=0;while(G<X){let K=J[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<X){if(J[G]==="\\"){G+=2;continue}if(J[G]==="`"&&W===0){G++;break}if(J[G]==="$"&&J[G+1]==="{"){W++,G+=2;continue}if(J[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<X){if(J[G]==="\\"){G+=2;continue}if(J[G]===q){G++;break}G++}continue}if(K==="/"&&J[G+1]==="/"){while(G<X&&J[G]!==`
698
+ `)G++;continue}if(K==="/"&&J[G+1]==="*"){G+=2;while(G<X-1&&!(J[G]==="*"&&J[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=J.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let _=W[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((_)=>{let B=_.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let _=U[1];if(!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_);G+=U[0].length;continue}}G++}return Z}function TX($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(_){let B;while((B=Y.exec(_))!==null){let j=B[0];if(!RX.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,X;while((X=Q.exec($))!==null)J(X[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((X=G.exec($))!==null)J(X[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((X=K.exec($))!==null)J(X[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((X=q.exec($))!==null)J(X[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((X=W.exec($))!==null)J(X[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((X=z.exec($))!==null)J(X[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((X=U.exec($))!==null)J(X[1]);return Z}async function B5($,Z={}){let Y=$,J="",Q=!1,X=I6(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=X.code;let G=D6(X.styles),{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (n5(),i5));if(K(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await q(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let L=LX(Y);Y=L.code,J=FX(L.stxImports,L.browserImports)}if(J=`${o5(Y,Z.serverData)}${J}`,Y=$1(Y),!Q&&A1(Z.attrs||""))Y=N1(Y);let W=NX(Z.eventBindings||[]),z=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${G}<script ${F}>
699
699
  ${J}${Y}
700
700
  ${W}
701
701
  </script>`}let _=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),B=/function __stx_setup_/.test(Y),j=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function H(L){let F=L.length>0?`
@@ -704,12 +704,12 @@ window.stx.mount(function() {
704
704
  'use strict';
705
705
  ${J}${Y}
706
706
  ${W}${F}
707
- })</script>`}if(!j&&!B){if(_)return H($6($));if(Z.templateContent){let L=$6($);if(L.length>0){let F=FX(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
707
+ })</script>`}if(!j&&!B){if(_)return H(M6($));if(Z.templateContent){let L=M6($);if(L.length>0){let F=TX(Z.templateContent);if(L.some((V)=>F.has(V)))return H(L)}}}return`${G}<script data-stx-scoped>
708
708
  ;(function() {
709
709
  'use strict';
710
710
  ${J}${Y}
711
711
  ${W}
712
- })()</script>`}var ZX,zX,KX,qX,BX,LX;var j5=b(()=>{N0();ZX=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;zX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","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","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],KX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],qX=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"]);BX={left:0,middle:1,right:2};LX=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function NX($){let Z="",Y=null,J=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(J){J=!1;continue}if(X==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}Z+=X}return Z}function RX($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let Q=J[0],X=$[J.index-1];if(wX.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(X==="."&&z6.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function TX($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!z6.has(J))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],X=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&X===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function o5($){let Z=$.trim(),Y=NX(Z);RX(Y,Z),TX(Z);for(let J of G6)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!Q6.allowBracketNotation&&AX.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function MX($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||G6.some((Q)=>Q.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=D4(J);else Z[Y]=J}return Z}function D4($,Z=0){if(Z>=Q6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>D4(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,Q]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Q&&typeof Q==="object")Y[J]=D4(Q,Z+1);else Y[J]=Q}return Y}function Y0($,Z){try{let Y=MX(Z),J=Object.keys(Y),Q=Object.values(Y);return G0($,J)(...Q)}catch{return}}function Q0($){try{return o5($),!0}catch{return!1}}function R0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=o5($),J=/^[A-Za-z_$][\w$]*$/,Q=[],X=[];for(let W=0;W<Z.length;W++){let q=Z[W];if(!J.test(q))continue;if(K6.has(q))continue;Q.push(W),X.push(q)}let G=(W)=>Function(...X,...W,`
712
+ })()</script>`}var KX,BX,jX,HX,VX,RX;var j5=S(()=>{A0();KX=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;BX=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","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","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],jX=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],HX=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"]);VX={left:0,middle:1,right:2};RX=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});function EX($){let Z="",Y=null,J=!1;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(J){J=!1;continue}if(X==="\\"&&Y){J=!0;continue}if(Y){if(Y==="`"&&X==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(X===Y)Y=null;continue}if(X==='"'||X==="'"||X==="`"){Y=X;continue}Z+=X}return Z}function kX($,Z){let Y=/[$A-Z_a-z][$\w]*/g,J;while((J=Y.exec($))!==null){let Q=J[0],X=$[J.index-1];if(IX.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(X==="."&&y6.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function bX($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let J=Y[2];if(!y6.has(J))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],X=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&X===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function s5($){let Z=$.trim(),Y=EX(Z);kX(Y,Z),bX(Z);for(let J of S6)if(J.test(Y))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${Z}`);if(!b6.allowBracketNotation&&DX.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function SX($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||S6.some((Q)=>Q.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=E$(J);else Z[Y]=J}return Z}function E$($,Z=0){if(Z>=b6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>E$(J,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[J,Q]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Q&&typeof Q==="object")Y[J]=E$(Q,Z+1);else Y[J]=Q}return Y}function Y0($,Z){try{let Y=SX(Z),J=Object.keys(Y),Q=Object.values(Y);return G0($,J)(...Q)}catch{return}}function Q0($){try{return s5($),!0}catch{return!1}}function N0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=s5($),J=/^[A-Za-z_$][\w$]*$/,Q=[],X=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!J.test(z))continue;if(C6.has(z))continue;Q.push(W),X.push(z)}let G=(W)=>Function(...X,...W,`
713
713
  'use strict';
714
714
  try {
715
715
  return ${Y};
@@ -720,10 +720,10 @@ catch (e) {
720
720
  }
721
721
  throw e;
722
722
  }
723
- `),z=G([]);if(X.length===Z.length)return X6(z,X,G);return X6((...W)=>{let q=Array(Q.length);for(let U=0;U<Q.length;U++)q[U]=W[Q[U]];return z(...q)},X,G,(W)=>{z=G(W)})}function X6($,Z,Y,J){let X=/^(\w+) is not defined$/,G=$,z=[],K=new Set(Z);return(...W)=>{for(let q=0;q<=8;q++)try{return G(...W)}catch(U){let _=U instanceof Error?U.message:"",B=X.exec(_);if(!(U instanceof ReferenceError)||!B)return;let j=B[1];if(K.has(j)||K6.has(j))return;K.add(j),z.push(j),G=Y(z),J?.(z)}return}}function s5($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var VX,Q6,G6,wX,z6,AX,K6;var T0=b(()=>{VX={maxSanitizeDepth:10,allowBracketNotation:!1},Q6={...VX},G6=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],wX=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),z6=new Set(["__proto__","constructor","prototype"]),AX=/[\w)\]]\s*\[\s*['"]/;K6=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function r5($,Z){let Y=DX++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return IX.set(J,{type:$,expression:Z}),J}var DX=0,IX;var q6=b(()=>{IX=new Map});function W6($,Z,Y,J){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;J.lastIndex=Y.lastIndex;let X=J.exec($);if(!X)return-1;return X.index+X[0].length}function a5($,Z){return W6($,Z,EX,kX)}function U6($,Z){return W6($,Z,SX,bX)}function _6($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function H5($,Z,Y){let J=[],Q="",X=0,G=$.length,z=!1,K=null;while(X<G){let W=$[X];if(z){if(Q+=W,K){if(W===K)K=null}else if(W==='"'||W==="'")K=W;else if(W===">")z=!1;X++;continue}if(W==="<"){let q=Z($,X);if(q>X){Q+=Y($.slice(X,q),J.length),J.push($.slice(X,q)),X=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))z=!0;Q+=W,X++;continue}Q+=W,X++}return{output:Q,tokens:J}}function I4($){let{output:Z,tokens:Y}=H5($,a5,(J,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function E4($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var EX,kX,SX,bX;var t5=b(()=>{EX=/<script\b[^>]*>/iy,kX=/<\/script\s*>/ig,SX=/<style\b[^>]*>/iy,bX=/<\/style\s*>/ig});var V6={};r(V6,{usesSignalsInScript:()=>m1,unescapeHtml:()=>k4,registerFilters:()=>CX,registerFilter:()=>H6,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>vX,interpolateScriptExpressions:()=>L6,getAllFilters:()=>O6,evaluateExpression:()=>d0,escapeHtml:()=>u0,defaultFilters:()=>L5,clearCustomFilters:()=>PX,applyFilters:()=>F6});function yX($){let Z=B6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),B6.set($,Z)}return Z.lastIndex=0,Z}function H6($,Z){if($ in L5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);O5[$]=Z}function CX($){for(let[Z,Y]of Object.entries($))H6(Z,Y)}function O6(){return{...L5,...O5}}function PX(){for(let $ of Object.keys(O5))delete O5[$]}function u0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function m1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function j6($,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=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let W=0;W<J.length;W++){let q=J[W];if(!X&&q==="`"){X=!0,G=0;continue}if(X){if(q==="`"&&G===0){X=!1;continue}if(q==="$"&&J[W+1]==="{"){G++,W++;continue}if(q==="}"&&G>0){G--;continue}continue}Q+=q}J=Q;let z=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,K;while((K=z.exec(J))!==null){let W=K[1];if(!J.substring(0,K.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function L6($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=d0(Q,Z);if(X===void 0)return J;return X===null?"":String(X)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return J;try{let G=d0(Q,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function vX($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,Q,X)=>{if(/\bsrc\s*=/.test(Q))return J;if(/\bdata-raw\b/.test(Q))return J;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return J;if(Y.skipServer&&/\bserver\b/.test(Q))return J;let G=L6(X,Z);return`<script${Q}>${G}</script>`})}function s0($,Z,Y,J){let Q=$,X=(q,U)=>{let _=U6(q,U);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(q.slice(U,_))?-1:_},G=(q,U,_,B)=>{let j=_.length,{output:H,tokens:L}=H5(q,U,(F,O)=>B(j+O));return _.push(...L),H},z=[];Q=G(Q,X,z,(q)=>`<!--__STX_STYLE_${q}__-->`);let K=[];Q=G(Q,a5,K,(q)=>`<!--__STX_SCRIPT_EXPR_${q}__-->`);let W=J?.forceSignals===!0||m1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(q,U,_)=>{try{let B=d0(U,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${j}`,Y,$,_,q)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(q,U,_)=>{try{let B=d0(U,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return r5("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return r5("raw",U.trim());let j=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${j}`,Y,$,_,q)}}),Q=G(Q,a5,K,(q)=>`<!--__STX_SCRIPT_EXPR_${q}__-->`),Q=G(Q,X,z,(q)=>`<!--__STX_STYLE_${q}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(q,U,_)=>{let B=U.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=B.match(V),A=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=d0(U,Z);if(N===void 0&&W&&!j6(B,Z))return q;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return r5("expr",B);return N!==void 0&&N!==null?u0(String(N)):""}catch(N){if(W&&!j6(B,Z))return q;if(A)return q;let R=N instanceof Error?N.message:String(N);return z0("Expression",`Error evaluating: {{ ${B} }}: ${R}`,Y,$,_,q)}});for(let q=0;q<K.length;q++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${q}__-->`,()=>K[q]);for(let q=0;q<z.length;q++)Q=Q.replace(`<!--__STX_STYLE_${q}__-->`,()=>z[q]);return Q}function F6($,Z,Y){if(!Z.trim())return $;let J=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let z=O5[G]||L5[G];if(!z)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(O6()).join(", ")}`);let K=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let q=W[1].trim();try{let U=Number(q);K=[Number.isNaN(U)?q:U]}catch{K=[q]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,q=1;while(W>0&&q<Q.length){if(Q[q]==="(")W++;if(Q[q]===")")W--;q++}if(W===0){let U=Q.substring(1,q-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))K=[d0(`(${U})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);K=_.map((V)=>{let w=V.trim();return d0(w,Y,!0)})}}catch{K=[U]}Q=Q.substring(q).trim()}}try{J=z(J,Y,...K)}catch(W){let q=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${q}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return J}function xX($){let Z=!1,Y="",J=0,Q=0,X=0,G=!1;for(let z=0;z<$.length;z++){let K=$[z],W=$[z+1];if(Z&&G){G=!1;continue}if(Z&&K==="\\"){G=!0;continue}if(G=!1,(K==='"'||K==="'"||K==="`")&&!G){if(!Z)Z=!0,Y=K;else if(K===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&K==="$"&&W==="{"){let q=1;z+=2;while(z<$.length&&q>0){if($[z]==="{")q++;else if($[z]==="}")q--;if(q>0)z++}continue}if(Z)continue;if(K==="(")J++;else if(K===")")J--;else if(K==="[")Q++;else if(K==="]")Q--;else if(K==="{")X++;else if(K==="}")X--;if(K==="|"&&J===0&&Q===0&&X===0){if(W==="|"){z++;continue}if(W==="="){z++;continue}return z}}return-1}function d0($,Z,Y=!1){try{let J=$.trim(),Q=xX(J);if(Q>0){let X=J.substring(0,Q).trim(),G=J.substring(Q+1).trim(),z=d0(X,Z,!0);return F6(z,G,Z)}if(!Q0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Y0(J,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return G0(J,X)(...G)}catch{return Y0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(J.message);if(Q){let X=Q[1],G=fX(X,Object.keys(Z));if(G&&G!==X)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function fX($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let X=gX($,Q);if(Y===null||X<Y.dist)Y={key:Q,dist:X}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function gX($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),X=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=J.length;G++){X[0]=G;for(let z=1;z<=Y.length;z++){let K=Y[z-1]===J[G-1]?0:1;X[z]=Math.min(X[z-1]+1,Q[z]+1,Q[z-1]+K)}for(let z=0;z<=Y.length;z++)Q[z]=X[z]}return Q[Y.length]}function k4($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var O5,B6,L5;var r0=b(()=>{T0();N0();q6();t5();O5={},B6=new Map;L5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return u0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=J;for(let K of X){if(G===void 0||G===null)break;G=G[K]}if(G===void 0||G===null)return Q?$:"";let z=String(G);return Object.entries(Y).forEach(([K,W])=>{z=z.replace(yX(K),String(W))}),z},t:($,Z,Y={})=>{return L5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=J.length)return J.substring(0,Y);return Q.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);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 Q.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let X=J||`${Y}s`;return Q===1?Y:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Q=10**Y;return Math.round(J*Q)/Q}}});class F5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);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($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function p1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!u1.has(Y)){if(u1.size>=hX){let J=u1.keys().next().value;if(J)u1.delete(J)}u1.set(Y,new RegExp($,Z))}return u1.get(Y)}class w6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((z)=>z.context.join(",")===Y);if(J)return J.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...z)=>{return(K)=>{try{let W=`${Y}:${K}`,q=Q.get(W);if(!q){if(Q.size>=X){let U=Q.keys().next().value;if(U)Q.delete(U)}q=Function(...Z,`
723
+ `),K=G([]);if(X.length===Z.length)return k6(K,X,G);return k6((...W)=>{let z=Array(Q.length);for(let U=0;U<Q.length;U++)z[U]=W[Q[U]];return K(...z)},X,G,(W)=>{K=G(W)})}function k6($,Z,Y,J){let X=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let _=U instanceof Error?U.message:"",B=X.exec(_);if(!(U instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||C6.has(j))return;q.add(j),K.push(j),G=Y(K),J?.(K)}return}}function r5($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let J of Y)if(J.test(Z))return!1;return!0}var MX,b6,S6,IX,y6,DX,C6;var R0=S(()=>{MX={maxSanitizeDepth:10,allowBracketNotation:!1},b6={...MX},S6=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],IX=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),y6=new Set(["__proto__","constructor","prototype"]),DX=/[\w)\]]\s*\[\s*['"]/;C6=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function a5($,Z){let Y=yX++,J=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return CX.set(J,{type:$,expression:Z}),J}var yX=0,CX;var P6=S(()=>{CX=new Map});function v6($,Z,Y,J){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;J.lastIndex=Y.lastIndex;let X=J.exec($);if(!X)return-1;return X.index+X[0].length}function t5($,Z){return v6($,Z,PX,vX)}function x6($,Z){return v6($,Z,xX,fX)}function f6($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function H5($,Z,Y){let J=[],Q="",X=0,G=$.length,K=!1,q=null;while(X<G){let W=$[X];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;X++;continue}if(W==="<"){let z=Z($,X);if(z>X){Q+=Y($.slice(X,z),J.length),J.push($.slice(X,z)),X=z;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))K=!0;Q+=W,X++;continue}Q+=W,X++}return{output:Q,tokens:J}}function k$($){let{output:Z,tokens:Y}=H5($,t5,(J,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function b$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,J)=>Z[+J]??"")}var PX,vX,xX,fX;var e5=S(()=>{PX=/<script\b[^>]*>/iy,vX=/<\/script\s*>/ig,xX=/<style\b[^>]*>/iy,fX=/<\/style\s*>/ig});var l6={};r(l6,{usesSignalsInScript:()=>u1,unescapeHtml:()=>S$,registerFilters:()=>hX,registerFilter:()=>d6,processExpressions:()=>s0,interpolateScriptsInTemplate:()=>mX,interpolateScriptExpressions:()=>u6,getAllFilters:()=>m6,evaluateExpression:()=>d0,escapeHtml:()=>u0,defaultFilters:()=>L5,clearCustomFilters:()=>dX,applyFilters:()=>p6});function gX($){let Z=g6.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),g6.set($,Z)}return Z.lastIndex=0,Z}function d6($,Z){if($ in L5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);O5[$]=Z}function hX($){for(let[Z,Y]of Object.entries($))d6(Z,Y)}function m6(){return{...L5,...O5}}function dX(){for(let $ of Object.keys(O5))delete O5[$]}function u0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function u1($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function h6($,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=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",X=!1,G=0;for(let W=0;W<J.length;W++){let z=J[W];if(!X&&z==="`"){X=!0,G=0;continue}if(X){if(z==="`"&&G===0){X=!1;continue}if(z==="$"&&J[W+1]==="{"){G++,W++;continue}if(z==="}"&&G>0){G--;continue}continue}Q+=z}J=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function u6($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=d0(Q,Z);if(X===void 0)return J;return X===null?"":String(X)}catch{return J}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{let X=Q.trim();if(/^__[A-Z_]+__$/.test(X))return J;try{let G=d0(Q,Z);if(G===void 0)return J;return JSON.stringify(G)}catch{return J}}),Y}function mX($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(J,Q,X)=>{if(/\bsrc\s*=/.test(Q))return J;if(/\bdata-raw\b/.test(Q))return J;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return J;if(Y.skipServer&&/\bserver\b/.test(Q))return J;let G=u6(X,Z);return`<script${Q}>${G}</script>`})}function s0($,Z,Y,J){let Q=$,X=(z,U)=>{let _=x6(z,U);if(_===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,_))?-1:_},G=(z,U,_,B)=>{let j=_.length,{output:H,tokens:L}=H5(z,U,(F,O)=>B(j+O));return _.push(...L),H},K=[];Q=G(Q,X,K,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];Q=G(Q,t5,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=J?.forceSignals===!0||u1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,_)=>{try{let B=d0(U,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${j}`,Y,$,_,z)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,_)=>{try{let B=d0(U,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return a5("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return a5("raw",U.trim());let j=B instanceof Error?B.message:String(B);return K0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${j}`,Y,$,_,z)}}),Q=G(Q,t5,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Q=G(Q,X,K,(z)=>`<!--__STX_STYLE_${z}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,_)=>{let B=U.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=B.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,w=B.match(V),A=w&&!j.includes(w[1])&&!(w[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let N=d0(U,Z);if(N===void 0&&W&&!h6(B,Z))return z;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return a5("expr",B);return N!==void 0&&N!==null?u0(String(N)):""}catch(N){if(W&&!h6(B,Z))return z;if(A)return z;let R=N instanceof Error?N.message:String(N);return K0("Expression",`Error evaluating: {{ ${B} }}: ${R}`,Y,$,_,z)}});for(let z=0;z<q.length;z++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<K.length;z++)Q=Q.replace(`<!--__STX_STYLE_${z}__-->`,()=>K[z]);return Q}function p6($,Z,Y){if(!Z.trim())return $;let J=$,Q=Z.trim();while(Q.length>0){let X=Q.match(/^(\w+)/);if(!X)break;let G=X[1];Q=Q.substring(G.length).trim();let K=O5[G]||L5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(m6()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,z=1;while(W>0&&z<Q.length){if(Q[z]==="(")W++;if(Q[z]===")")W--;z++}if(W===0){let U=Q.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[d0(`(${U})`,Y,!0)];else{let _=[],B="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){B+=w,O=!1;continue}if(w==="\\"){B+=w,O=!0;continue}if(j){if(B+=w,w===j)j=null;continue}if(w==='"'||w==="'"||w==="`"){j=w,B+=w;continue}if(w==="(")H++;else if(w===")")H--;else if(w==="[")L++;else if(w==="]")L--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&H===0&&L===0&&F===0){_.push(B),B="";continue}B+=w}if(B)_.push(B);q=_.map((V)=>{let w=V.trim();return d0(w,Y,!0)})}}catch{q=[U]}Q=Q.substring(z).trim()}}try{J=K(J,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return J}function uX($){let Z=!1,Y="",J=0,Q=0,X=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")J++;else if(q===")")J--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")X++;else if(q==="}")X--;if(q==="|"&&J===0&&Q===0&&X===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function d0($,Z,Y=!1){try{let J=$.trim(),Q=uX(J);if(Q>0){let X=J.substring(0,Q).trim(),G=J.substring(Q+1).trim(),K=d0(X,Z,!0);return p6(K,G,Z)}if(!Q0(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Y0(J,Z)}try{let X=Object.keys(Z),G=Object.values(Z);return G0(J,X)(...G)}catch{return Y0(J,Z)}}catch(J){if(J instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(J.message);if(Q){let X=Q[1],G=pX(X,Object.keys(Z));if(G&&G!==X)J.message=`${J.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function pX($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let X=lX($,Q);if(Y===null||X<Y.dist)Y={key:Q,dist:X}}if(!Y)return null;let J=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/J<=0.35)return Y.key;return null}function lX($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,J]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),X=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=J.length;G++){X[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===J[G-1]?0:1;X[K]=Math.min(X[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=X[K]}return Q[Y.length]}function S$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var O5,g6,L5;var r0=S(()=>{R0();A0();P6();e5();O5={},g6=new Map;L5={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return u0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),G=J;for(let q of X){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(gX(q),String(W))}),K},t:($,Z,Y={})=>{return L5.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=J.length)return J.substring(0,Y);return Q.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);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 Q.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let X=J||`${Y}s`;return Q===1?Y:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,J);return $},replace:($,Z,Y,J="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Q=10**Y;return Math.round(J*Q)/Q}}});class F5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);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($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function l1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!p1.has(Y)){if(p1.size>=cX){let J=p1.keys().next().value;if(J)p1.delete(J)}p1.set(Y,new RegExp($,Z))}return p1.get(Y)}class c6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((K)=>K.context.join(",")===Y);if(J)return J.func;let Q=this.fnCache,X=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=Q.get(W);if(!z){if(Q.size>=X){let U=Q.keys().next().value;if(U)Q.delete(U)}z=Function(...Z,`
724
724
  'use strict';
725
725
  try {
726
- return ${K};
726
+ return ${q};
727
727
  }
728
728
  catch (e) {
729
729
  if (e instanceof ReferenceError || e instanceof TypeError) {
@@ -731,38 +731,38 @@ catch (e) {
731
731
  }
732
732
  throw e;
733
733
  }
734
- `),Q.set(W,q)}return q(...z)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class A6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,X=Z>=Y.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let K of this.violationHandlers)try{K(G)}catch{}let z=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(J-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(z);break;case"warn":console.warn(z);break;case"error":console.error(z);break;case"throw":if(X)throw Error(z);else console.warn(z);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);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 Z={};for(let[Y,J]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Q?.maxTime,budgetUtilization:Q?J.totalTime/J.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,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 dX(){if(!S4)S4=new A6;return S4}var u1,hX=500,e_,S4=null,N6;var c1=b(()=>{u1=new Map;e_=new w6;N6=new Proxy({},{get($,Z){return dX()[Z]}})});function R6($,Z=""){let Y=`${$}${Z}`,J=0;for(let Q=0;Q<Y.length;Q++){let X=Y.charCodeAt(Q);J=(J<<5)-J+X,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function T6($,Z,Y={}){let{prefix:J="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let z=b4($),K=[],W=new Map;if(X)for(let q of z){let U=q.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let _=U[1],B=`${Z}_${_}`;W.set(_,B)}}for(let q of z){let U=M6(q,Z,J,Q,W,G);K.push(U)}return K.join(`
734
+ `),Q.set(W,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class i6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,X=Z>=Y.maxTime;if(!Q&&!X)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${J.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.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($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let J=this.budgets.get($);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 Z={};for(let[Y,J]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Q?.maxTime,budgetUtilization:Q?J.totalTime/J.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,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 iX(){if(!y$)y$=new i6;return y$}var p1,cX=500,GB,y$=null,n6;var c1=S(()=>{p1=new Map;GB=new c6;n6=new Proxy({},{get($,Z){return iX()[Z]}})});function o6($,Z=""){let Y=`${$}${Z}`,J=0;for(let Q=0;Q<Y.length;Q++){let X=Y.charCodeAt(Q);J=(J<<5)-J+X,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function s6($,Z,Y={}){let{prefix:J="",preserveHost:Q=!0,scopeKeyframes:X=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=C$($),q=[],W=new Map;if(X)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let _=U[1],B=`${Z}_${_}`;W.set(_,B)}}for(let z of K){let U=r6(z,Z,J,Q,W,G);q.push(U)}return q.join(`
735
735
 
736
- `)}function b4($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Q="",X=!1,G="";for(let z=0;z<Y.length;z++){let K=Y[z];if(K==="@"&&J===0)X=!0;if(K==="{")J++;else if(K==="}"){if(J--,J===0){if(X){G+=K;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,q,U,_]=W;if(q==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:_.trim()});else if(q==="media"||q==="supports"||q==="container"){let B=b4(_);Z.push({selector:`@${q} ${U.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
737
- `)})}else Z.push({selector:`@${q} ${U.trim()}`,declarations:_.trim()})}G="",X=!1}else if(Q.trim()){Q+=K;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(X)G+=K;else Q+=K}return Z}function M6($,Z,Y,J,Q,X){let{selector:G,declarations:z}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let q=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(q)||q} { ${z} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=b4(`x { ${z} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>M6(_,Z,Y,J,Q,X)).join(`
736
+ `)}function C$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Q="",X=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&J===0)X=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(X){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,z,U,_]=W;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:_.trim()});else if(z==="media"||z==="supports"||z==="container"){let B=C$(_);Z.push({selector:`@${z} ${U.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
737
+ `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:_.trim()})}G="",X=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(X)G+=q;else Q+=q}return Z}function r6($,Z,Y,J,Q,X){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=C$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((_)=>r6(_,Z,Y,J,Q,X)).join(`
738
738
  `);return`${G} {
739
739
  ${U}
740
- }`}return`${G} { ${z} }`}let K=mX(G,Z,Y,J),W=z;for(let[q,U]of Q)W=W.replace(new RegExp(`\\b${q}\\b`,"g"),U);if(X)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${K} { ${W} }`}function mX($,Z,Y,J){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(J)X.push(G);else{let K=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(K)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let z=Y?`${Y} .${Z}`:`.${Z}`;X.push(`${z} ${G}`)}return X.join(", ")}function e5($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=R6(Z),J=`data-v-${Y}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(z,K,W)=>{G=!0;let q=uX(W,J),U=K.replace(/\bscoped\b/gi,"").trim(),_=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${_}>${q}</style>`}),!G)return{html:$,hasScoped:!1};return Q=pX(Q,J),{html:Q,hasScoped:!0}}function uX($,Z){return T6($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function pX($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Q,X)=>{if(Y.has(Q.toLowerCase()))return J;if(J.includes(Z))return J;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return J;if(X)return J.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(J.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var y4=()=>{};function C0($,Z,Y,J=0){let Q=0,X=J,G=null,z=0,K=!1;while(X<$.length){let W=$[X];if(G&&K){K=!1,X++;continue}if(G&&W==="\\"){K=!0,X++;continue}if(K=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,X++;continue}if(W===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&W==="$"&&$[X+1]==="{"){z++,X+=2;continue}if(z>0&&W==="}"){z--,X++;continue}if(W==="`"&&G==="`"&&z===0){G=null,X++;continue}if(G){X++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return X}X++}return-1}var C4={};r(C4,{useTitle:()=>sX,useSeoMeta:()=>Z$,usePageTitle:()=>sX,useHead:()=>T1,resetHead:()=>iX,renderHtmlAttrs:()=>aX,renderHead:()=>rX,renderBodyAttrs:()=>tX,processTitleDirective:()=>ZQ,processMetaDirective:()=>YQ,processHeadDirective:()=>$Q,getPageMeta:()=>lX,getHead:()=>V5,definePageMeta:()=>oX,applyHead:()=>eX});function V5(){return G1}function lX(){return $$}function iX(){G1={},cX.length=0,$$={}}function T1($){G1=nX(G1,$)}function nX($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function Z$($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let K=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:K})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let K of $.articleTags)Z.push({property:"article:tag",content:K});let z=[];if($.canonical)z.push({rel:"canonical",href:$.canonical});T1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:z})}function oX($){if($$={...$$,...$},$.title||$.description)Z$({title:$.title,description:$.description})}function sX($){let Z=typeof $==="function"?$():$;T1({title:Z})}function rX($=G1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${R1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,Q])=>`${J}="${R1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${R1(String(X))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${R1(String(X))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...Q}=Y,X=Object.entries(Q).filter(([G,z])=>z!==void 0).map(([G,z])=>{if(typeof z==="boolean")return z?G:"";return`${G}="${R1(String(z))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${X}>${J}</script>`);else Z.push(`<script ${X}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
741
- `)}function aX($=G1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function tX($=G1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function R1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function eX($=G1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[Q,X]of Object.entries(Z))if(X!==void 0)J.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function $Q($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Q)=>{return Z+=Q.trim()+`
742
- `,""}),headContent:Z.trim()}}function ZQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,Q,X)=>{let G=J?Q:Z[(X||"").trim()]??X;return T1({title:G}),""})}function YQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,Q,X,G,z)=>{let K=X?G:z,W=X?K:Z[(K||"").trim()]??K,U=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return T1({meta:[U]}),""})}var G1,cX,$$;var w5=b(()=>{G1={},cX=[],$$={}});var Y$={};r(Y$,{stripTypeScript:()=>S6,hasVariables:()=>v6,extractVariables:()=>M1,extractScriptFromTemplate:()=>P6,convertToCommonJS:()=>v4});import l1 from"path";import A5 from"process";function JQ($){let Z=[],Y=0,J=$.split(`
743
- `);for(let Q of J){let X=Y,G=null,z=!1;for(let K=0;K<Q.length;K++){let W=Q[K];if(z){z=!1;continue}if(W==="\\"){z=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&K+1<Q.length&&Q[K+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(X===0){let K=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((_)=>{let B=_.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((_)=>/^\w+$/.test(_));Z.push(...U)}}}}return[...new Set(Z)]}function S6($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let Q=[],X="",G=0,z=0,K=null;for(let W=0;W<J.length;W++){let q=J[W];if(K){if(X+=q,q===K)K=null;continue}if(q==='"'||q==="'"||q==="`"){K=q,X+=q;continue}if(q==="<")G++;else if(q===">"&&G>0)G--;else if(q==="(")z++;else if(q===")")z--;if(q===","&&G===0&&z===0){Q.push(X),X="";continue}X+=q}if(X)Q.push(X);return Q.map((W)=>{let q=W.trim(),U=q.startsWith("..."),_=U?q.slice(3):q,B=-1,j=0;for(let A=0;A<_.length;A++)if(_[A]==="<")j++;else if(_[A]===">")j--;else if(_[A]===":"&&j===0){B=A;break}if(B===-1)return W;let L=_.substring(0,B).trim().replace(/\?$/,""),F=_.substring(B+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Q,X)=>{if(!X.includes(":"))return J;return`${Q}(${Y(X)})`});{let J=/\b(function\s+\w*\s*)\(/g,Q,X=[];while((Q=J.exec(Z))!==null){let G=Q.index+Q[0].length-1,z=1,K=G+1,W=0,q=null;while(K<Z.length&&z>0){let B=Z[K];if(q){if(B===q)q=null;K++;continue}if(B==='"'||B==="'"||B==="`"){q=B,K++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")z++;else if(B===")")z--}if(z>0)K++}if(z!==0)continue;let U=Z.substring(G+1,K);if(!U.includes(":"))continue;let _=Y(U);X.push({start:G+1,end:K,replacement:_})}for(let G=X.length-1;G>=0;G--){let{start:z,end:K,replacement:W}=X[G];Z=Z.substring(0,z)+W+Z.substring(K)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Q)=>{if(!Q.includes(":"))return J;if(Q.includes("{")||Q.includes("}"))return J;return`(${Q.split(",").map((G)=>{let[z,...K]=G.split("="),W=z.split(":")[0].trim();if(K.length>0)return`${W} = ${K.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
740
+ }`}return`${G} { ${K} }`}let q=nX(G,Z,Y,J),W=K;for(let[z,U]of Q)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(X)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function nX($,Z,Y,J){let Q=$.split(",").map((G)=>G.trim()),X=[];for(let G of Q){if(G.startsWith(":host")){if(J)X.push(G);else{let q=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);X.push(q)}continue}if(G.includes("::slotted")){X.push(G);continue}if(G===":root"){X.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;X.push(`${K} ${G}`)}return X.join(", ")}function $4($,Z){if(!/<style\s+[^>]*\bscoped\b/i.test($))return{html:$,hasScoped:!1};let Y=o6(Z),J=`data-v-${Y}`,Q=$,X=/<style\s+([^>]*\bscoped\b[^>]*)>([\s\S]*?)<\/style>/gi,G=!1;if(Q=Q.replace(X,(K,q,W)=>{G=!0;let z=oX(W,J),U=q.replace(/\bscoped\b/gi,"").trim(),_=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${_}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return Q=sX(Q,J),{html:Q,hasScoped:!0}}function oX($,Z){return s6($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function sX($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Q,X)=>{if(Y.has(Q.toLowerCase()))return J;if(J.includes(Z))return J;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return J;if(X)return J.replace(`<${Q}${X}`,`<${Q} ${Z}${X}`);if(J.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var P$=()=>{};var a6=()=>{};function S0($,Z,Y,J=0){let Q=0,X=J,G=null,K=0,q=!1;while(X<$.length){let W=$[X];if(G&&q){q=!1,X++;continue}if(G&&W==="\\"){q=!0,X++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,X++;continue}if(W===G&&G!=="`"){G=null,X++;continue}if(G==="`"&&W==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&W==="}"){K--,X++;continue}if(W==="`"&&G==="`"&&K===0){G=null,X++;continue}if(G){X++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return X}X++}return-1}var v$={};r(v$,{useTitle:()=>ZQ,useSeoMeta:()=>Y4,usePageTitle:()=>ZQ,useHead:()=>T1,resetHead:()=>tX,renderHtmlAttrs:()=>JQ,renderHead:()=>YQ,renderBodyAttrs:()=>XQ,processTitleDirective:()=>KQ,processMetaDirective:()=>qQ,processHeadDirective:()=>GQ,getPageMeta:()=>aX,getHead:()=>V5,definePageMeta:()=>$Q,applyHead:()=>QQ});function V5(){return G1}function aX(){return Z4}function tX(){G1={},rX.length=0,Z4={}}function T1($){G1=eX(G1,$)}function eX($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function Y4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(J)Z.push({property:"og:description",content:J});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let Q=$.twitterTitle??$.title,X=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(X)Z.push({name:"twitter:description",content:X});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});T1({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function $Q($){if(Z4={...Z4,...$},$.title||$.description)Y4({title:$.title,description:$.description})}function ZQ($){let Z=typeof $==="function"?$():$;T1({title:Z})}function YQ($=G1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${R1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,Q])=>`${J}="${R1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([Q,X])=>X!==void 0).map(([Q,X])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${R1(String(X))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([Q,X])=>X!==void 0).map(([Q,X])=>`${Q}="${R1(String(X))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...Q}=Y,X=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${R1(String(K))}"`}).filter(Boolean).join(" ");if(J)Z.push(`<script ${X}>${J}</script>`);else Z.push(`<script ${X}></script>`)}for(let Y of $.style||[]){let J=Y.type?` type="${Y.type}"`:"";Z.push(`<style${J}>${Y.content}</style>`)}return Z.join(`
741
+ `)}function JQ($=G1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function XQ($=G1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${R1(Y)}"`).join(" ")}function R1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function QQ($=G1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let J=document.querySelector(Y);if(!J){if(J=document.createElement("meta"),Z.name)J.setAttribute("name",Z.name);if(Z.property)J.setAttribute("property",Z.property);document.head.appendChild(J)}J.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,J=document.querySelector(Y);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[Q,X]of Object.entries(Z))if(X!==void 0)J.setAttribute(Q,String(X))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function GQ($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Q)=>{return Z+=Q.trim()+`
742
+ `,""}),headContent:Z.trim()}}function KQ($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,J,Q,X)=>{let G=J?Q:Z[(X||"").trim()]??X;return T1({title:G}),""})}function qQ($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,J,Q,X,G,K)=>{let q=X?G:K,W=X?q:Z[(q||"").trim()]??q,U=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W};return T1({meta:[U]}),""})}var G1,rX,Z4;var w5=S(()=>{G1={},rX=[],Z4={}});var J4={};r(J4,{stripTypeScript:()=>Y9,hasVariables:()=>K9,extractVariables:()=>M1,extractScriptFromTemplate:()=>G9,convertToCommonJS:()=>f$});import i1 from"path";import A5 from"process";function zQ($){let Z=[],Y=0,J=$.split(`
743
+ `);for(let Q of J){let X=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(X===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((_)=>{let B=_.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((_)=>/^\w+$/.test(_));Z.push(...U)}}}}return[...new Set(Z)]}function Y9($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(J){if(!J.includes(":"))return J;let Q=[],X="",G=0,K=0,q=null;for(let W=0;W<J.length;W++){let z=J[W];if(q){if(X+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,X+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){Q.push(X),X="";continue}X+=z}if(X)Q.push(X);return Q.map((W)=>{let z=W.trim(),U=z.startsWith("..."),_=U?z.slice(3):z,B=-1,j=0;for(let A=0;A<_.length;A++)if(_[A]==="<")j++;else if(_[A]===">")j--;else if(_[A]===":"&&j===0){B=A;break}if(B===-1)return W;let L=_.substring(0,B).trim().replace(/\?$/,""),F=_.substring(B+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let w=U?"...":"";if(O!==-1)return`${w}${L} = ${F.substring(O+1).trim()}`;return`${w}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Q,X)=>{if(!X.includes(":"))return J;return`${Q}(${Y(X)})`});{let J=/\b(function\s+\w*\s*)\(/g,Q,X=[];while((Q=J.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let B=Z[q];if(z){if(B===z)z=null;q++;continue}if(B==='"'||B==="'"||B==="`"){z=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")K++;else if(B===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let _=Y(U);X.push({start:G+1,end:q,replacement:_})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=X[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Q)=>{if(!Q.includes(":"))return J;if(Q.includes("{")||Q.includes("}"))return J;return`(${Q.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
744
744
 
745
- `),Z}async function M1($,Z,Y,J={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=S6($)}let X={exports:{}},G=X.exports,z=A5.cwd(),K={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let f=l1.resolve(z,"node_modules",v),C=l1.join(f,"package.json"),x=JSON.parse(q0("fs").readFileSync(C,"utf8")),u=x.main||"index.js";if(x.exports){let p=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof p==="string")u=p;else if(p?.bun)u=p.bun;else if(p?.import)u=p.import;else if(p?.default)u=p.default}K[v]=await import(l1.resolve(f,u))}catch{}let q=(v)=>{if(K[v])return K[v];return q0(v)},U=Z.props||{},_=(v)=>{if(!v)return U;let f={};for(let[C,x]of Object.entries(v)){let u=U[C];if(u!==void 0)f[C]=u;else if(typeof x==="function")f[C]=x();else f[C]=x}return f};for(let[v,f]of Object.entries(U))Object.defineProperty(_,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let B=(v)=>{if(!v)return U;let f={...U};for(let[C,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[C]===void 0&&u.default!==void 0)f[C]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let C={...v};for(let[x,u]of Object.entries(f))if(C[x]===void 0)if(typeof u==="function")C[x]=u();else C[x]=u;return C},L=(v)=>{let f=()=>v;return f.set=(C)=>{},f.update=(C)=>{},f},F=(v)=>{let f,C=!1;return()=>{if(!C)try{f=v(),C=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),w=(v)=>{},A=(v)=>{},N=(v)=>{},R=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",C=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:C,name:"",fullPath:C+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{T1(v);let f=Z.__stx_runtime_head||{},C=v||{};Z.__stx_runtime_head={...f,...C.title&&{title:C.title},meta:[...f.meta||[],...C.meta||[]],link:[...f.link||[],...C.link||[]],script:[...f.script||[],...C.script||[]],htmlAttrs:{...f.htmlAttrs||{},...C.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...C.bodyAttrs||{}}}},D=(v)=>{Z$(v);let f=V5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},I=(v)=>({value:v}),E=(v)=>v,P=(v)=>({value:typeof v==="function"?v():v}),S=(v,f)=>{},k=(v)=>{},y=(v)=>{},g=(v)=>v?v():Promise.resolve(),h=(v)=>(f,...C)=>{},m=(v)=>{},i=(v,f)=>{},c=(v,f)=>f,K0=()=>({value:"light"}),V0=()=>({value:!1}),_0={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:{}},Z0=new Proxy(_0,{get(v,f){if(f in v)return v[f];return},set(v,f,C){return v[f]=C,!0}}),k0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},f0=console;try{let v=v4(Q,Y),f=new Set(Object.keys(U)),C=Object.keys(Z).filter((a)=>!f.has(a)&&a!=="props"),x=C.map((a)=>Z[a]),u=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),p=[],X0=[];for(let[a,V1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(u.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(v))continue;p.push(a),X0.push(V1)}let S0=JQ(v).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
746
- `),h1=Z.params??{},g0=[],X1=[];for(let a=0;a<C.length;a++){if(C[a]==="params")continue;g0.push(C[a]),X1.push(x[a])}let F1=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...p,...g0,`return (async () => {
745
+ `),Z}async function M1($,Z,Y,J={}){if(!$.trim())return;let Q;try{let v=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}),f=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");f=f.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=v.transformSync(f)}catch{Q=Y9($)}let X={exports:{}},G=X.exports,K=A5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((v)=>v[1]).filter((v)=>!v.startsWith("node:")&&!v.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(v));for(let v of W)try{let f=i1.resolve(K,"node_modules",v),C=i1.join(f,"package.json"),x=JSON.parse(z0("fs").readFileSync(C,"utf8")),u=x.main||"index.js";if(x.exports){let p=typeof x.exports==="string"?x.exports:x.exports["."];if(typeof p==="string")u=p;else if(p?.bun)u=p.bun;else if(p?.import)u=p.import;else if(p?.default)u=p.default}q[v]=await import(i1.resolve(f,u))}catch{}let z=(v)=>{if(q[v])return q[v];return z0(v)},U=Z.props||{},_=(v)=>{if(!v)return U;let f={};for(let[C,x]of Object.entries(v)){let u=U[C];if(u!==void 0)f[C]=u;else if(typeof x==="function")f[C]=x();else f[C]=x}return f};for(let[v,f]of Object.entries(U))Object.defineProperty(_,v,{value:f,enumerable:!0,configurable:!0,writable:!0});let B=(v)=>{if(!v)return U;let f={...U};for(let[C,x]of Object.entries(v)){let u=x&&typeof x==="object"&&!Array.isArray(x)?x:{type:x};if(f[C]===void 0&&u.default!==void 0)f[C]=typeof u.default==="function"?u.default():u.default}return f},j=()=>Z.slots||{},H=(v,f)=>{let C={...v};for(let[x,u]of Object.entries(f))if(C[x]===void 0)if(typeof u==="function")C[x]=u();else C[x]=u;return C},L=(v)=>{let f=()=>v;return f.set=(C)=>{},f.update=(C)=>{},f},F=(v)=>{let f,C=!1;return()=>{if(!C)try{f=v(),C=!0}catch{f=void 0}return f}},O=(v)=>{},V=(v)=>v(),w=(v)=>{},A=(v)=>{},N=(v)=>{},R=()=>{let v=Z.__stxServeContext,f=Z.__stxServeSearch??v?.search??"",C=v?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(f)),path:C,name:"",fullPath:C+f,hash:"",matched:[]}},T=()=>({push:(v)=>{},replace:(v)=>{},back:()=>{},forward:()=>{},go:(v)=>{}}),M=(v)=>{T1(v);let f=Z.__stx_runtime_head||{},C=v||{};Z.__stx_runtime_head={...f,...C.title&&{title:C.title},meta:[...f.meta||[],...C.meta||[]],link:[...f.link||[],...C.link||[]],script:[...f.script||[],...C.script||[]],htmlAttrs:{...f.htmlAttrs||{},...C.htmlAttrs||{}},bodyAttrs:{...f.bodyAttrs||{},...C.bodyAttrs||{}}}},I=(v)=>{Y4(v);let f=V5();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...f.title&&{title:f.title},meta:f.meta?[...f.meta]:[]}},D=(v)=>({value:v}),E=(v)=>v,P=(v)=>({value:typeof v==="function"?v():v}),b=(v,f)=>{},k=(v)=>{},y=(v)=>{},g=(v)=>v?v():Promise.resolve(),h=(v)=>(f,...C)=>{},m=(v)=>{},i=(v,f)=>{},l=(v,f)=>f,q0=()=>({value:"light"}),V0=()=>({value:!1}),_0={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:{}},Z0=new Proxy(_0,{get(v,f){if(f in v)return v[f];return},set(v,f,C){return v[f]=C,!0}}),k0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},f0=console;try{let v=f$(Q,Y),f=new Set(Object.keys(U)),C=Object.keys(Z).filter((a)=>!f.has(a)&&a!=="props"),x=C.map((a)=>Z[a]),u=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),p=[],X0=[];for(let[a,V1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(u.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(v))continue;p.push(a),X0.push(V1)}let b0=zQ(v).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
746
+ `),d1=Z.params??{},g0=[],X1=[];for(let a=0;a<C.length;a++){if(C[a]==="params")continue;g0.push(C[a]),X1.push(x[a])}let F1=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","window","document","console","confirm","alert","fetch","params",...p,...g0,`return (async () => {
747
747
  ${v}
748
- ${S0}
748
+ ${b0}
749
749
  return module.exports
750
- })()`)(X,G,q,U,_,B,H,L,F,O,V,w,A,N,R,T,M,D,I,E,P,S,k,y,g,h,m,j,i,c,K0,V0,Z0,k0,f0,_0.confirm,_0.alert,_0.fetch,h1,...X0,...X1);if(J.preserveExisting){for(let[a,V1]of Object.entries(F1))if(!(a in Z)||Z[a]===void 0)Z[a]=V1}else Object.assign(Z,F1);for(let[a,V1]of Object.entries(U))if(!(a in Z))Z[a]=V1}catch(v){if(A5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await KQ(Q,Z,Y)}catch(f){if(A5.env.STX_DEBUG){let C=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${C}`)}}}}function v4($,Z){let Y=Z?l1.dirname(Z):A5.cwd(),J=$.split(`
751
- `),Q=[],X=0;while(X<J.length){let G=J[X].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let z=0;for(;X<J.length;X++){for(let K of J[X])if(K==="{")z++;else if(K==="}")z--;if(z<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let z=0,K=!1;for(let W=X;W<J.length&&!K;W++){let q=null,U=!1,_=J[W];for(let B=0;B<_.length;B++){let j=_[B];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(q){if(j===q)q=null;continue}if(j==='"'||j==="'"||j==="`"){q=j;continue}if(j==="(")z++;else if(j===")"){if(z--,z===0){X=W+1,K=!0;break}}}}if(!K)X=J.length;continue}if(G.startsWith("import ")){let z=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),K=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),q=(U)=>{if(U.startsWith("."))return l1.resolve(Y,U);return U};if(z){let[,U,_]=z,B=q(_);Q.push(`const ${U} = await import('${B}')`),Q.push(`module.exports.${U} = ${U};`)}else if(K){let[,U,_]=K,B=U.trim(),j=q(_);Q.push(`const { ${B} } = await import('${j}')`);for(let H of B.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let U=q(W[1]);Q.push(`await import('${U}')`)}else Q.push(G);X++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(J[X]),X++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let z=D6(J,X),{type:K,name:W,value:q}=z;Q.push(`${K} ${W} = ${q};`),Q.push(`module.exports.${W} = ${W};`),X=z.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let z=P4(J,X);Q.push(z.functionCode),Q.push(`module.exports.${z.name} = ${z.name};`),X=z.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let z=D6(J,X),{type:K,name:W,value:q}=z;Q.push(`${K} ${W} = ${q};`),Q.push(`module.exports.${W} = ${W};`),X=z.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let z=P4(J,X);Q.push(z.functionCode),Q.push(`module.exports.${z.name} = ${z.name};`),X=z.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let z=J[X].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...J];K[X]=z;let W=P4(K,X);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);X=W.nextIndex}else if(G.startsWith("export default ")){let z=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${z};`),X++}else if(G.startsWith("class ")||G.startsWith("export class ")){let z=G.match(/(?:export\s+)?class\s+(\w+)/);if(z){let K=z[1],W=J[X].replace(/^export\s+/,""),q=0,U=X;for(;U<J.length;U++){let _=J[U];for(let B of _)if(B==="{")q++;else if(B==="}")q--;if(U>X)W+=`
752
- `+_;if(q<=0&&U>=X)break}Q.push(W),Q.push(`module.exports.${K} = ${K};`),X=U+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return XQ(Q.join(`
753
- `),Y)}function XQ($,Z){let Y=$.length,J="",Q=0,X=null,G=!1,z=!1,K=0;while(Q<Y){let W=$[Q],q=$[Q+1];if(G){if(J+=W,W===`
754
- `)G=!1;Q++;continue}if(z){if(J+=W,W==="*"&&q==="/"){J+=q,Q+=2,z=!1;continue}Q++;continue}if(!X&&W==="/"&&q==="/"){G=!0,J+=W,Q++;continue}if(!X&&W==="/"&&q==="*"){z=!0,J+=W,Q++;continue}if(X){if(J+=W,W==="\\"){J+=q,Q+=2;continue}if(W===X&&X!=="`"){X=null,Q++;continue}if(X==="`"){if(W==="$"&&q==="{"){K++,J+=q,Q+=2;continue}if(W==="`"){X=null,Q++;continue}}Q++;continue}if(K>0){if(W==="{")K++;else if(W==="}")K--}if(W==='"'||W==="'"||W==="`"){X=W,J+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=QQ($,Q);if(U){let{quote:_,path:B,end:j}=U;if(B.startsWith(".")){let H=l1.resolve(Z,B);J+=`await import(${_}${H}${_})`,Q=j;continue}}}J+=W,Q++}return J}function QQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let X=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:X,end:Y+1}}function b6($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=C0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function y6($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,Q=0,X="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(Q++,Q===1){let z=b6(Y,J);if(z){let K=y6(z.pattern);Z.push(...K),J=z.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){J++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",J++;continue}if(G===":"){X="",J++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&Q===0){if(Y[J]==="{"||Y[J]==="[")Q++;else if(Y[J]==="}"||Y[J]==="]")Q--;J++}continue}if(/[\w$]/.test(G))X+=G;J++}if(X.trim())Z.push(X.trim());return Z}function D6($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let q=Y.slice(W[0].length),U=Z;if((q.startsWith("{")||q.startsWith("["))&&!q.includes(q.startsWith("{")?"}":"]")){let B=q.startsWith("{")?"}":"]",j=q;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(B))break;q=j}let _=b6(q,0);if(_){let B=W[1],j=_.pattern,H=q.slice(_.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(I6(L)){let N=E6($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=y6(j),w=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
750
+ })()`)(X,G,z,U,_,B,H,L,F,O,V,w,A,N,R,T,M,I,D,E,P,b,k,y,g,h,m,j,i,l,q0,V0,Z0,k0,f0,_0.confirm,_0.alert,_0.fetch,d1,...X0,...X1);if(J.preserveExisting){for(let[a,V1]of Object.entries(F1))if(!(a in Z)||Z[a]===void 0)Z[a]=V1}else Object.assign(Z,F1);for(let[a,V1]of Object.entries(U))if(!(a in Z))Z[a]=V1}catch(v){if(A5.env.STX_DEBUG){let f=v instanceof Error?v.message:String(v);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${f}`)}try{await jQ(Q,Z,Y)}catch(f){if(A5.env.STX_DEBUG){let C=f instanceof Error?f.message:String(f);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${C}`)}}}}function f$($,Z){let Y=Z?i1.dirname(Z):A5.cwd(),J=$.split(`
751
+ `),Q=[],X=0;while(X<J.length){let G=J[X].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;X<J.length;X++){for(let q of J[X])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}X++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=X;W<J.length&&!q;W++){let z=null,U=!1,_=J[W];for(let B=0;B<_.length;B++){let j=_[B];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(z){if(j===z)z=null;continue}if(j==='"'||j==="'"||j==="`"){z=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){X=W+1,q=!0;break}}}}if(!q)X=J.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),z=(U)=>{if(U.startsWith("."))return i1.resolve(Y,U);return U};if(K){let[,U,_]=K,B=z(_);Q.push(`const ${U} = await import('${B}')`),Q.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,_]=q,B=U.trim(),j=z(_);Q.push(`const { ${B} } = await import('${j}')`);for(let H of B.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let U=z(W[1]);Q.push(`await import('${U}')`)}else Q.push(G);X++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(J[X]),X++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=t6(J,X),{type:q,name:W,value:z}=K;Q.push(`${q} ${W} = ${z};`),Q.push(`module.exports.${W} = ${W};`),X=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=x$(J,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=t6(J,X),{type:q,name:W,value:z}=K;Q.push(`${q} ${W} = ${z};`),Q.push(`module.exports.${W} = ${W};`),X=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=x$(J,X);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),X=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=J[X].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...J];q[X]=K;let W=x$(q,X);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);X=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),X++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=J[X].replace(/^export\s+/,""),z=0,U=X;for(;U<J.length;U++){let _=J[U];for(let B of _)if(B==="{")z++;else if(B==="}")z--;if(U>X)W+=`
752
+ `+_;if(z<=0&&U>=X)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),X=U+1}else Q.push(G),X++}else if(G.includes("module.exports"))Q.push(G),X++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),X++;else X++}return WQ(Q.join(`
753
+ `),Y)}function WQ($,Z){let Y=$.length,J="",Q=0,X=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],z=$[Q+1];if(G){if(J+=W,W===`
754
+ `)G=!1;Q++;continue}if(K){if(J+=W,W==="*"&&z==="/"){J+=z,Q+=2,K=!1;continue}Q++;continue}if(!X&&W==="/"&&z==="/"){G=!0,J+=W,Q++;continue}if(!X&&W==="/"&&z==="*"){K=!0,J+=W,Q++;continue}if(X){if(J+=W,W==="\\"){J+=z,Q+=2;continue}if(W===X&&X!=="`"){X=null,Q++;continue}if(X==="`"){if(W==="$"&&z==="{"){q++,J+=z,Q+=2;continue}if(W==="`"){X=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){X=W,J+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=UQ($,Q);if(U){let{quote:_,path:B,end:j}=U;if(B.startsWith(".")){let H=i1.resolve(Z,B);J+=`await import(${_}${H}${_})`,Q=j;continue}}}J+=W,Q++}return J}function UQ($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let J=$[Y];if(J!=="'"&&J!=='"')return null;Y++;let Q=Y;while(Y<$.length&&$[Y]!==J)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let X=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:J,path:X,end:Y+1}}function J9($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=S0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function X9($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,Q=0,X="";while(J<Y.length){let G=Y[J];if(G==="{"||G==="["){if(Q++,Q===1){let K=J9(Y,J);if(K){let q=X9(K.pattern);Z.push(...q),J=K.endPos,X="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){J++;continue}if(G===","){if(X.trim())Z.push(X.trim());X="",J++;continue}if(G===":"){X="",J++;continue}if(G==="="){if(X.trim())Z.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&Q===0){if(Y[J]==="{"||Y[J]==="[")Q++;else if(Y[J]==="}"||Y[J]==="]")Q--;J++}continue}if(/[\w$]/.test(G))X+=G;J++}if(X.trim())Z.push(X.trim());return Z}function t6($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let z=Y.slice(W[0].length),U=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let B=z.startsWith("{")?"}":"]",j=z;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(B))break;z=j}let _=J9(z,0);if(_){let B=W[1],j=_.pattern,H=z.slice(_.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(e6(L)){let N=$9($,O,L);F=N.value,O=N.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=X9(j),w=`__stx_src_${Z}`,A=V.map((N)=>`module.exports.${N} = ${N};`).join(`
755
755
  `);return{type:B,name:w,value:`${F}; ${B} ${j} = ${w};
756
- ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,X,G]=J,z=G,K=Z;if(I6(G)){let W=E6($,Z,G);z=W.value,K=W.nextIndex}else K=Z+1;while(K<$.length){let W=$[K].trim();if(W.startsWith(".")||W.startsWith("?."))z+=`
757
- ${$[K]}`,K++;else break}return z=z.trim().replace(/;$/,""),{type:Q,name:X,value:z,nextIndex:K}}function P4($,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[,Q]=J,X=Y.replace(/^export\s+/,""),G=Z;if(GQ(Y)){let z=zQ($,Z,X);X=z.functionCode,G=z.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function I6($){let Z=$.trim();if(Z.startsWith("{"))return C0(Z,"{","}",0)===-1;if(Z.startsWith("["))return C0(Z,"[","]",0)===-1;return!C6(Z)}function C6($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-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==="$"&&$[Q+1]==="{"){J++,Q++;continue}if(J>0&&X==="{"){J++;continue}if(J>0&&X==="}"){J--;continue}if(Y)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function GQ($){let Z=$.indexOf("{");if(Z===-1)return!0;return C0($,"{","}",Z)===-1}function E6($,Z,Y){let J=Y,Q=Z+1;while(Q<$.length&&!C6(J)){let X=$[Q];J+=`
756
+ ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,X,G]=J,K=G,q=Z;if(e6(G)){let W=$9($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
757
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:X,value:K,nextIndex:q}}function x$($,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[,Q]=J,X=Y.replace(/^export\s+/,""),G=Z;if(_Q(Y)){let K=BQ($,Z,X);X=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:X,nextIndex:G}}function e6($){let Z=$.trim();if(Z.startsWith("{"))return S0(Z,"{","}",0)===-1;if(Z.startsWith("["))return S0(Z,"[","]",0)===-1;return!Q9(Z)}function Q9($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if((Q>0?$[Q-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==="$"&&$[Q+1]==="{"){J++,Q++;continue}if(J>0&&X==="{"){J++;continue}if(J>0&&X==="}"){J--;continue}if(Y)continue;if(X==="(")Z.paren++;else if(X===")")Z.paren--;else if(X==="[")Z.bracket++;else if(X==="]")Z.bracket--;else if(X==="{")Z.brace++;else if(X==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function _Q($){let Z=$.indexOf("{");if(Z===-1)return!0;return S0($,"{","}",Z)===-1}function $9($,Z,Y){let J=Y,Q=Z+1;while(Q<$.length&&!Q9(J)){let X=$[Q];J+=`
758
758
  ${X}`,Q++}while(Q<$.length){let X=$[Q].trim();if(X.startsWith(".")||X.startsWith("?."))J+=`
759
- ${$[Q]}`,Q++;else break}return{value:J,nextIndex:Q}}function zQ($,Z,Y){let J=Y,Q=Z+1;while(Q<$.length){let X=J.indexOf("{");if(X!==-1){if(C0(J,"{","}",X)!==-1)break}let G=$[Q];J+=`
760
- ${G}`,Q++}return{functionCode:J,nextIndex:Q}}function k6($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...A5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function KQ($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of J){let[,,G,z]=X;try{let K=z.trim().replace(/;$/,""),W=k6(K,Z);if(W!==void 0)Z[G]=W}catch(K){console.warn(`Failed to parse export ${G} in fallback:`,K)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,z]=X;if(!(G in Z))try{let K=z.trim().replace(/;$/,""),W=k6(K,Z);if(W!==void 0)Z[G]=W}catch{}}}function P6($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function v6($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var N5=b(()=>{w5();d1();T0()});var x4={};r(x4,{renderSlot:()=>f6,processSlots:()=>h6,parseSlots:()=>x6,parseSlotElement:()=>WQ,extractSlotContent:()=>BQ,applySlots:()=>jQ});function qQ($,Z){let Y=1,J=Z,Q="<template",X="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(Q,J)&&(J+Q.length>=$.length||/[\s>\/]/.test($[J+Q.length]))){Y++,J+=Q.length;continue}if($.startsWith(X,J)){let z=$.indexOf(">",J+X.length);if(z!==-1){if(Y--,Y===0)return z+1;J=z+1;continue}}J++}return Y===0?J:-1}function x6($){let Z={default:"",named:new Map},Y=$,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=J.exec($))!==null){let[q,U,_,B,j]=X,H=U||_||B,L=X.index+q.length,F=qQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:X.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((q,U)=>U.start-q.start);for(let q of Q)Y=Y.slice(0,q.start)+Y.slice(q.end);let G=[],z=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,K;while((K=z.exec(Y))!==null){let[q,U,_,B,j,H]=K,L=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${U}${O?" "+O:""}>${H}</${U}>`;G.push({start:K.index,end:K.index+q.length,slotName:B,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((K=W.exec(Y))!==null){let[q,U,_,B,j]=K,H=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${U}${F?" "+F:""} />`;G.push({start:K.index,end:K.index+q.length,slotName:B,element:O})}G.sort((q,U)=>U.start-q.start);for(let q of G){let U=Z.named.get(q.slotName);if(U)U.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function WQ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)J[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),z=G?G[1].trim():"";return{name:Y,props:J,defaultContent:z}}async function f6($,Z,Y,J){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...J};if(X.startsWith("{")&&X.endsWith("}")){let z=X.slice(1,-1).split(",").map((K)=>K.trim()).filter(Boolean);for(let K of z){let[W,q]=K.split(":").map((_)=>_.trim()),U=q||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[X]=Z;Q=UQ(Q,G)}return Q}function UQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let Q=J.trim(),X=g6(Q,Z);return u0(String(X??""))}catch{return`{{ ${J} }}`}})}function g6($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Q=Z;for(let X of J)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,Q,X]=Y,G=Z[J],z=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+z;case"-":return G-z;case"*":return G*z;case"/":return G/z}}try{if(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function h6($,Z,Y){let J=$;J=await _Q(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,z,K,W)=>{let q=Z.named.get(z),U=W?.trim()||"",_=K||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(_))!==null){let L=H[1],F=H[2];B[L]=g6(F,Y)}return await f6(q,B,U,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(G,z)=>{if(G.includes("name="))return G;let K=z?.trim()||"";return Z.default||K}),J}async function _Q($,Z,Y){let J=[],Q=[];$.replace(Z,(z,...K)=>{let W=K[K.length-2];return Q.push({match:z,index:W}),J.push(Y(z,...K.slice(0,-2))),z});let X=await Promise.all(J),G=$;for(let z=Q.length-1;z>=0;z--){let{match:K,index:W}=Q[z];G=G.slice(0,W)+X[z]+G.slice(W+K.length)}return G}function BQ($){let Z=x6($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function jQ($,Z,Y,J){return await h6($,{default:Z,named:Y},J)}var f4=b(()=>{r0();T0()});import HQ from"fs";import d from"path";function d6($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function LQ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!LQ($)}function N1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}).transformSync(Z);for(let X=0;X<Y.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,Y[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,Y[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function FQ($){let Z=[],Y=new Set,J=0,Q=0,X=$.length,G=(q)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===q){Q++;return}Q++}},z=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let q=1;while(Q<X&&q>0)if($[Q]==="{")q++,Q++;else if($[Q]==="}")q--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")z();else Q++;continue}Q++}},K=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
761
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(J!==0)return;let q=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(q){let j=q[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<X){if(K())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){z();continue}if($[Q]==="{"){J++,Q++;continue}if($[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function VQ($){let Z=[],Y=0,J=0,Q=null;for(let X=0;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,X)),J=X+1}if(J<$.length)Z.push($.slice(J));return Z}function wQ($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let Q=$[J];if(Y){if(Q==="\\"){J++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let X=$[J-1],G=$[J+1];if(X==="!"||X==="<"||X===">"||X==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function AQ($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Q=J,X=0,G=-1;for(;J>=0;J--){let K=$[J];if(K==="}")X++;else if(K==="{"){if(X--,X===0){G=J;break}}}if(G===-1)return;let z=$.slice(G+1,Q);for(let K of VQ(z)){let W=K.trim();if(!W||W.startsWith("..."))continue;let q=wQ(W);if(q===-1)continue;let U=W.slice(0,q).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let _=W.slice(q+1).trim();if(!_)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${_});`);Z[U]=j(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function m6($,Z,Y,J,Q){let X=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),z=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=Y.__importedComponents;if(K){for(let L of[X,X.toLowerCase(),G(X),z(X)])if(K.has(L))return!0}let W=[...new Set([`${X}.stx`,`${G(X)}.stx`,`${z(X)}.stx`])],q=typeof Q.root==="string"?d.resolve(Q.root):void 0,U=q??d.dirname(J),_=[],B=(L)=>{if(L&&!_.includes(L))_.push(L)},j=Y.__originalFilePath;if(j)B(d.join(d.dirname(j),"components"));B(Z),B(d.join(d.dirname(J),"components")),B(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(q)B(d.resolve(q,"resources/views/components")),B(d.resolve(q,"resources/components")),B(d.resolve(q,"src/components")),B(d.resolve(q,"components"));if(X.startsWith("./")||X.startsWith("../"))return n(d.resolve(d.dirname(J),`${X}.stx`));for(let L of _){let F=d.isAbsolute(L)?L:d.resolve(U,L);for(let O of W)if(await n(d.join(F,O)))return!0}return!1}function NQ($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function i1($,Z,Y,J,Q,X,G,z=new Set,K){let{extractVariables:W}=await Promise.resolve().then(() => (N5(),Y$)),q=z??new Set;if(q.has($))return`[Circular component reference: ${$}]`;let U=new Set(q);U.add($);let _=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=_&&_!=="load"&&NQ(_)?_:"";try{let j=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let C=[L,L.toLowerCase(),j(L),H(L)];for(let x of C)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let C=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(C)],u=Q.__originalFilePath,p=[];if(u){let H0=d.join(d.dirname(u),"components");p.push(H0)}if(J)p.push(J);let X0=d.join(d.dirname(X),"components");if(!p.includes(X0))p.push(X0);if(G.componentsDir&&G.componentsDir!==J&&!p.includes(G.componentsDir))p.push(G.componentsDir);let W0=G._pluginComponentDirs;if(Array.isArray(W0)){for(let H0 of W0)if(typeof H0==="string"&&!p.includes(H0))p.push(H0)}let S0=typeof G.root==="string"?d.resolve(G.root):void 0,h1=S0??d.dirname(X),g0=[];if(S0)g0.push(d.resolve(S0,"resources/views/components")),g0.push(d.resolve(S0,"resources/components")),g0.push(d.resolve(S0,"src/components")),g0.push(d.resolve(S0,"components"));g0.push(d.resolve(import.meta.dir,"components"));for(let H0 of g0)if(!p.includes(H0))p.push(H0);let X1=[...new Set(p.map((H0)=>{if(!H0)return H0;return d.isAbsolute(H0)?H0:d.resolve(h1,H0)}))];if(p.length=0,p.push(...X1),L.startsWith("./")||L.startsWith("../"))F=d.resolve(d.dirname(X),`${L}.stx`),V.push(F);else for(let H0 of p){if(!H0)continue;for(let F1 of x){let a=d.join(H0,F1);if(V.push(a),await n(a)){F=a;break}}if(F)break;if(!F)try{let F1=await import("fs");if(!F1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let V1=8,u5=[{path:H0,depth:0}];while(u5.length>0&&!F){let p5=u5.pop();if(p5.depth>=V1)continue;let P3;try{P3=F1.readdirSync(p5.path,{withFileTypes:!0})}catch{continue}for(let c5 of P3){if(!c5.isDirectory())continue;if(c5.name==="node_modules"||c5.name.startsWith("."))continue;let v3=d.join(p5.path,c5.name);for(let fJ of x){let w4=d.join(v3,fJ);if(V.push(w4),await n(w4)){F=w4;break}}if(F)break;u5.push({path:v3,depth:p5.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let C=V.length>0?`
759
+ ${$[Q]}`,Q++;else break}return{value:J,nextIndex:Q}}function BQ($,Z,Y){let J=Y,Q=Z+1;while(Q<$.length){let X=J.indexOf("{");if(X!==-1){if(S0(J,"{","}",X)!==-1)break}let G=$[Q];J+=`
760
+ ${G}`,Q++}return{functionCode:J,nextIndex:Q}}function Z9($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let J={...Z,process:Object.freeze({env:{...A5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function jQ($,Z,Y){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let X of J){let[,,G,K]=X;try{let q=K.trim().replace(/;$/,""),W=Z9(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of Q){let[,,G,K]=X;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=Z9(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function G9($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",J=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:J}}function K9($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var N5=S(()=>{w5();m1();R0()});var g$={};r(g$,{renderSlot:()=>z9,processSlots:()=>U9,parseSlots:()=>q9,parseSlotElement:()=>OQ,extractSlotContent:()=>VQ,applySlots:()=>wQ});function HQ($,Z){let Y=1,J=Z,Q="<template",X="</template";while(J<$.length&&Y>0){let G=$.indexOf("<",J);if(G===-1)break;if(J=G,$.startsWith(Q,J)&&(J+Q.length>=$.length||/[\s>\/]/.test($[J+Q.length]))){Y++,J+=Q.length;continue}if($.startsWith(X,J)){let K=$.indexOf(">",J+X.length);if(K!==-1){if(Y--,Y===0)return K+1;J=K+1;continue}}J++}return Y===0?J:-1}function q9($){let Z={default:"",named:new Map},Y=$,J=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,Q=[],X;while((X=J.exec($))!==null){let[z,U,_,B,j]=X,H=U||_||B,L=X.index+z.length,F=HQ($,L);if(F!==-1){let O=$.slice(L,F-11).trim();Q.push({start:X.index,end:F,slotName:H,content:O,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:O,propsBinding:j||void 0})}}Q.sort((z,U)=>U.start-z.start);for(let z of Q)Y=Y.slice(0,z.start)+Y.slice(z.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,q;while((q=K.exec(Y))!==null){let[z,U,_,B,j,H]=q,L=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(L+F).trim(),V=`<${U}${O?" "+O:""}>${H}</${U}>`;G.push({start:q.index,end:q.index+z.length,slotName:B,element:V})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((q=W.exec(Y))!==null){let[z,U,_,B,j]=q,H=_.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+L).trim(),O=`<${U}${F?" "+F:""} />`;G.push({start:q.index,end:q.index+z.length,slotName:B,element:O})}G.sort((z,U)=>U.start-z.start);for(let z of G){let U=Z.named.get(z.slotName);if(U)U.content+=z.element;else Z.named.set(z.slotName,{name:z.slotName,content:z.element});Y=Y.slice(0,z.start)+Y.slice(z.end)}return Z.default=Y.trim(),Z}function OQ($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=Q.exec($))!==null)J[X[1]]=X[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function z9($,Z,Y,J){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),G={...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[W,z]=q.split(":").map((_)=>_.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[X]=Z;Q=LQ(Q,G)}return Q}function LQ($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let Q=J.trim(),X=W9(Q,Z);return u0(String(X??""))}catch{return`{{ ${J} }}`}})}function W9($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Q=Z;for(let X of J)if(Q&&typeof Q==="object"&&X in Q)Q=Q[X];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,Q,X]=Y,G=Z[J],K=parseInt(X,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function U9($,Z,Y){let J=$;J=await FQ(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",_=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(_))!==null){let L=H[1],F=H[2];B[L]=W9(F,Y)}return await z9(z,B,U,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),J}async function FQ($,Z,Y){let J=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),J.push(Y(K,...q.slice(0,-2))),K});let X=await Promise.all(J),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+X[K]+G.slice(W+q.length)}return G}function VQ($){let Z=q9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function wQ($,Z,Y,J){return await U9($,{default:Z,named:Y},J)}var h$=S(()=>{r0();R0()});import AQ from"fs";import d from"path";function _9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RQ($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function A1($){return!RQ($)}function N1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(X)=>{let G=Y.length;return Y.push(X),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()}).transformSync(Z);for(let X=0;X<Y.length;X++)Q=Q.replace(`"__STX_EXPR_${X}__"`,Y[X]),Q=Q.replace(`'__STX_EXPR_${X}__'`,Y[X]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function TQ($){let Z=[],Y=new Set,J=0,Q=0,X=$.length,G=(z)=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]===z){Q++;return}Q++}},K=()=>{Q++;while(Q<X){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let z=1;while(Q<X&&z>0)if($[Q]==="{")z++,Q++;else if($[Q]==="}")z--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<X&&$[Q]!==`
761
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<X-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<X){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){J++,Q++;continue}if($[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function MQ($){let Z=[],Y=0,J=0,Q=null;for(let X=0;X<$.length;X++){let G=$[X];if(Q){if(G==="\\"){X++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(J,X)),J=X+1}if(J<$.length)Z.push($.slice(J));return Z}function IQ($){let Z=0,Y=null;for(let J=0;J<$.length;J++){let Q=$[J];if(Y){if(Q==="\\"){J++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let X=$[J-1],G=$[J+1];if(X==="!"||X==="<"||X===">"||X==="=")continue;if(G==="="||G===">")continue;return J}}return-1}function DQ($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let J=Y.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Q=J,X=0,G=-1;for(;J>=0;J--){let q=$[J];if(q==="}")X++;else if(q==="{"){if(X--,X===0){G=J;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of MQ(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=IQ(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let _=W.slice(z+1).trim();if(!_)continue;try{let B=Object.keys(Z),j=Function(...B,`"use strict"; return (${_});`);Z[U]=j(...B.map((H)=>Z[H]))}catch{}}}catch{}}async function B9($,Z,Y,J,Q){let X=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[X,X.toLowerCase(),G(X),K(X)])if(q.has(L))return!0}let W=[...new Set([`${X}.stx`,`${G(X)}.stx`,`${K(X)}.stx`])],z=typeof Q.root==="string"?d.resolve(Q.root):void 0,U=z??d.dirname(J),_=[],B=(L)=>{if(L&&!_.includes(L))_.push(L)},j=Y.__originalFilePath;if(j)B(d.join(d.dirname(j),"components"));B(Z),B(d.join(d.dirname(J),"components")),B(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)B(typeof L==="string"?L:null);if(z)B(d.resolve(z,"resources/views/components")),B(d.resolve(z,"resources/components")),B(d.resolve(z,"src/components")),B(d.resolve(z,"components"));if(X.startsWith("./")||X.startsWith("../"))return n(d.resolve(d.dirname(J),`${X}.stx`));for(let L of _){let F=d.isAbsolute(L)?L:d.resolve(U,L);for(let O of W)if(await n(d.join(F,O)))return!0}return!1}function EQ($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function I1($,Z,Y,J,Q,X,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (N5(),J4)),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let _=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let B=_&&_!=="load"&&EQ(_)?_:"";try{let j=(C)=>C.split("-").map((x)=>x.charAt(0).toUpperCase()+x.slice(1)).join(""),H=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let C=[L,L.toLowerCase(),j(L),H(L)];for(let x of C)if(O.has(x)){F=O.get(x);break}}let V=[];if(!F){let C=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],x=[...new Set(C)],u=Q.__originalFilePath,p=[];if(u){let H0=d.join(d.dirname(u),"components");p.push(H0)}if(J)p.push(J);let X0=d.join(d.dirname(X),"components");if(!p.includes(X0))p.push(X0);if(G.componentsDir&&G.componentsDir!==J&&!p.includes(G.componentsDir))p.push(G.componentsDir);let W0=G._pluginComponentDirs;if(Array.isArray(W0)){for(let H0 of W0)if(typeof H0==="string"&&!p.includes(H0))p.push(H0)}let b0=typeof G.root==="string"?d.resolve(G.root):void 0,d1=b0??d.dirname(X),g0=[];if(b0)g0.push(d.resolve(b0,"resources/views/components")),g0.push(d.resolve(b0,"resources/components")),g0.push(d.resolve(b0,"src/components")),g0.push(d.resolve(b0,"components"));g0.push(d.resolve(import.meta.dir,"components"));for(let H0 of g0)if(!p.includes(H0))p.push(H0);let X1=[...new Set(p.map((H0)=>{if(!H0)return H0;return d.isAbsolute(H0)?H0:d.resolve(d1,H0)}))];if(p.length=0,p.push(...X1),L.startsWith("./")||L.startsWith("../"))F=d.resolve(d.dirname(X),`${L}.stx`),V.push(F);else for(let H0 of p){if(!H0)continue;for(let F1 of x){let a=d.join(H0,F1);if(V.push(a),await n(a)){F=a;break}}if(F)break;if(!F)try{let F1=await import("fs");if(!F1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let V1=8,p5=[{path:H0,depth:0}];while(p5.length>0&&!F){let l5=p5.pop();if(l5.depth>=V1)continue;let Q6;try{Q6=F1.readdirSync(l5.path,{withFileTypes:!0})}catch{continue}for(let c5 of Q6){if(!c5.isDirectory())continue;if(c5.name==="node_modules"||c5.name.startsWith("."))continue;let G6=d.join(l5.path,c5.name);for(let pJ of x){let N$=d.join(G6,pJ);if(V.push(N$),await n(N$)){F=N$;break}}if(F)break;p5.push({path:G6,depth:l5.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let C=V.length>0?`
762
762
  Searched paths:
763
763
  ${V.map((x)=>` - ${x}`).join(`
764
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}K.add(F);let w;if(g4.has(F))w=g4.get(F);else try{w=await Bun.file(F).text(),g4.set(F,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,x]of Object.entries(Q))if(!C.startsWith("__")||A.has(C))N[C]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (f4(),x4)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let D={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{}};AQ(w,D);let I=w,E=I.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)I=E[1].trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...w.matchAll(P)],k=[];for(let C of S){let x=C[1]||"",u=C[2]||"",p=x.includes("server");if(A1(x)&&u.trim())u=N1(u);if(p&&u)try{await W(u,D,F)}catch(W0){}if(!p){let W0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(W0.includes("{{")&&W0.includes("}}"))W0=s0(W0,D,F);let S0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${S0}>${W0}</script>`)}}let y=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g=y?y[1]:"",h=y?y[2]:"",m="",i=g&&/\bscoped\b/i.test(g);if(y)m=`<style${g}>${h}</style>`;let c=I;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(c=c.replace(C,(u,p)=>{let X0=p.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(X0)x.push(`<style${X0[1]}>${X0[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
765
- `)}`}if(Y&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:K0}=await Promise.resolve().then(() => (f4(),x4)),{defaultSlot:V0,namedSlots:_0}=T;c=await K0(c,V0||Y,_0,D);for(let[C,x]of Object.entries(D))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=k4(x);D[C]=u}}let Z0=k.some((C)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),k0={...G,componentsDir:d.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Z0,defaultLayout:void 0};D.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let f0=await j0(c,D,F,k0,K),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++OQ}_${Math.random().toString(36).slice(2,8)}`,f=f0;if(Z0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${d6(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${d6(B)}"`:"";if(f=`<div data-stx-scope="${v}"${C}${x}>${f0}</div>`,f=k.map((p)=>{let X0=p.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!X0)return p;let[,W0,S0]=X0,h1=$1(S0),g0=`
764
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(F);let w;if(d$.has(F))w=d$.get(F);else try{w=await Bun.file(F).text(),d$.set(F,w)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),N={};for(let[C,x]of Object.entries(Q))if(!C.startsWith("__")||A.has(C))N[C]=x;let{extractSlotContent:R}=await Promise.resolve().then(() => (h$(),g$)),T=R(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[C,x]of T.namedSlots)M[C]=x.content;let I={...N,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{}};DQ(w,I);let D=w,E=D.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(E)D=E[1].trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...w.matchAll(P)],k=[];for(let C of b){let x=C[1]||"",u=C[2]||"",p=x.includes("server");if(A1(x)&&u.trim())u=N1(u);if(p&&u)try{await W(u,I,F)}catch(W0){}if(!p){let W0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(W0.includes("{{")&&W0.includes("}}"))W0=s0(W0,I,F);let b0=x.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");k.push(`<script${b0}>${W0}</script>`)}}let y=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),g=y?y[1]:"",h=y?y[2]:"",m="",i=g&&/\bscoped\b/i.test(g);if(y)m=`<style${g}>${h}</style>`;let l=D;if(l=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),y)l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,x=[];if(l=l.replace(C,(u,p)=>{let X0=p.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(X0)x.push(`<style${X0[1]}>${X0[2]}</style>`);return""}),l=l.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),x.length>0)m=`${m}${x.join(`
765
+ `)}`}if(Y&&l.includes("{{ text || slot }}"))l=l.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:q0}=await Promise.resolve().then(() => (h$(),g$)),{defaultSlot:V0,namedSlots:_0}=T;l=await q0(l,V0||Y,_0,I);for(let[C,x]of Object.entries(I))if(typeof x==="string"){if(x.includes("<")&&x.includes(">")||x.includes("&lt;")||x.includes("&quot;")){let u=S$(x);I[C]=u}}let Z0=k.some((C)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),k0={...G,componentsDir:d.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Z0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let f0=await j0(l,I,F,k0,q),v=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++NQ}_${Math.random().toString(36).slice(2,8)}`,f=f0;if(Z0){let C="";if(Object.keys(Z).length>0)try{C=` data-stx-props="${_9(JSON.stringify(Z))}"`}catch{}let x=B?` stx-hydrate="${_9(B)}"`:"";if(f=`<div data-stx-scope="${v}"${C}${x}>${f0}</div>`,f=k.map((p)=>{let X0=p.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!X0)return p;let[,W0,b0]=X0,d1=$1(b0),g0=`
766
766
  (function() {
767
767
  const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
768
768
  const __scope = window.stx._scopes = window.stx._scopes || {};
@@ -774,12 +774,12 @@ ${V.map((x)=>` - ${x}`).join(`
774
774
  const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
775
775
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
776
776
 
777
- ${h1}
777
+ ${d1}
778
778
 
779
779
  // Register all defined signals and functions in this scope
780
780
  const __localVars = {};
781
781
  try {
782
- ${FQ(h1).map((X1)=>`if (typeof ${X1} !== 'undefined') __localVars['${X1}'] = ${X1};`).join(`
782
+ ${TQ(d1).map((X1)=>`if (typeof ${X1} !== 'undefined') __localVars['${X1}'] = ${X1};`).join(`
783
783
  `)}
784
784
  }
785
785
  catch (e) {}
@@ -788,25 +788,25 @@ catch (e) {}
788
788
  `)+`
789
789
  `+f,m)f+=`
790
790
  `+m}else{if(m)f+=`
791
- `+m;if(k.length>0){let C=D.__stx_event_bindings||[],x=_5(D),u=await Promise.all(k.map(async(p)=>{let X0=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!X0)return p;return await B5(X0[1],{eventBindings:C,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
791
+ `+m;if(k.length>0){let C=I.__stx_event_bindings||[],x=_5(I),u=await Promise.all(k.map(async(p)=>{let X0=p.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!X0)return p;return await B5(X0[1],{eventBindings:C,templateContent:f,filePath:F,projectRoot:process.cwd(),serverData:x})}));f+=`
792
792
  `+u.join(`
793
- `),D.__stx_event_bindings=[]}}if(i){let C=e5(f,F);if(C.hasScoped)f=C.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{q.delete($)}}async function n($){return Bun.file($).exists()}function h4($,Z){let Y=d.resolve(Z),J=d.resolve($),Q=Y.endsWith(d.sep)?Y:Y+d.sep;if(J===Y||J.startsWith(Q))return J;return null}async function d4($,Z,Y,J){let Q=await RQ($,Z,Y,J);if(Q===null)return null;let X=h4(Q,process.cwd());if(X)return X;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((z)=>typeof z==="string"&&z.length>0);for(let z of G){let K=d.isAbsolute(z)?z:d.resolve(process.cwd(),z);if(h4(Q,K))return d.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function RQ($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=d.dirname(Z),X=process.cwd();if($.startsWith("/")){let _=d.join(X,$),B=h4(_,X);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await n(B)&&J)J.add(B);return B}let G=d.join(Q,$);if(await n(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let B=`${G}${_}`;if(await n(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let z="",K=d.resolve(Q),W=process.cwd();for(let _=0;_<10;_++){let B=d.join(K,"layouts"),j=!1;try{j=HQ.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){z=B;break}let H=d.dirname(K);if(H===K||H.length<W.length)break;K=H}if(z){let _=$.startsWith("layouts/")?$.slice(8):$,B=d.join(z,_);if(await n(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!_.endsWith(".stx")){let j=`${B}.stx`;if(await n(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 _=d.isAbsolute(Y.layoutsDir)?Y.layoutsDir:d.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=d.join(_,B);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),B=d.join(Y.partialsDir||Q,"layouts",_[1]);if(await n(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.partialsDir){if(z=d.join(Y.partialsDir,"layouts"),await n(z)){let _=d.join(z,$);if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let q=Y.partialsDir||d.join(process.cwd(),"views"),U=d.join(q,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let _=`${U}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(Q.includes("temp")){let _=d.join(d.dirname(Q),"layouts",$);if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function u6($,Z,Y){let J=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
794
- `),z=0;for(let K=0;K<G.length;K++)if(z+=G[K].length+1,z>=Z){J=K+1,Q=G[K].trim();let W=Math.max(0,K-2),q=Math.min(G.length,K+3);X=G.slice(W,q).map((U,_)=>{let B=W+_+1;return`${B===J?"> ":" "}${B}: ${U}`}).join(`
795
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return u6($,G)}}catch{}return{lineNumber:J,lineContent:Q,context:X}}function z0($,Z,Y,J,Q,X){let{lineNumber:G,context:z}=u6(J,Q,X),K=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&J){let U=J.lastIndexOf(`
796
- `,Math.max(0,Q-1));W=Q-(U+1)+1}let q="";if(G>0)q+=`
793
+ `),I.__stx_event_bindings=[]}}if(i){let C=$4(f,F);if(C.hasScoped)f=C.html}return f}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function n($){return Bun.file($).exists()}function m$($,Z){let Y=d.resolve(Z),J=d.resolve($),Q=Y.endsWith(d.sep)?Y:Y+d.sep;if(J===Y||J.startsWith(Q))return J;return null}async function u$($,Z,Y,J){let Q=await kQ($,Z,Y,J);if(Q===null)return null;let X=m$(Q,process.cwd());if(X)return X;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=d.isAbsolute(K)?K:d.resolve(process.cwd(),K);if(m$(Q,q))return d.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function kQ($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=d.dirname(Z),X=process.cwd();if($.startsWith("/")){let _=d.join(X,$),B=m$(_,X);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${B}`);if(await n(B)&&J)J.add(B);return B}let G=d.join(Q,$);if(await n(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(J)J.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let B=`${G}${_}`;if(await n(B)){if(Y.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let K="",q=d.resolve(Q),W=process.cwd();for(let _=0;_<10;_++){let B=d.join(q,"layouts"),j=!1;try{j=AQ.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=B;break}let H=d.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let _=$.startsWith("layouts/")?$.slice(8):$,B=d.join(K,_);if(await n(B)){if(Y.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!_.endsWith(".stx")){let j=`${B}.stx`;if(await n(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 _=d.isAbsolute(Y.layoutsDir)?Y.layoutsDir:d.resolve(process.cwd(),Y.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=d.join(_,B);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(J)J.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),B=d.join(Y.partialsDir||Q,"layouts",_[1]);if(await n(B)){if(Y.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.partialsDir){if(K=d.join(Y.partialsDir,"layouts"),await n(K)){let _=d.join(K,$);if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let z=Y.partialsDir||d.join(process.cwd(),"views"),U=d.join(z,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let _=`${U}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(Q.includes("temp")){let _=d.join(d.dirname(Q),"layouts",$);if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let B=`${_}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function j9($,Z,Y){let J=0,Q="",X="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
794
+ `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){J=q+1,Q=G[q].trim();let W=Math.max(0,q-2),z=Math.min(G.length,q+3);X=G.slice(W,z).map((U,_)=>{let B=W+_+1;return`${B===J?"> ":" "}${B}: ${U}`}).join(`
795
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return j9($,G)}}catch{}return{lineNumber:J,lineContent:Q,context:X}}function K0($,Z,Y,J,Q,X){let{lineNumber:G,context:K}=j9(J,Q,X),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&J){let U=J.lastIndexOf(`
796
+ `,Math.max(0,Q-1));W=Q-(U+1)+1}let z="";if(G>0)z+=`
797
797
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
798
- `;if(q+=`
798
+ `;if(z+=`
799
799
  ${t.bold}${t.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${t.reset}
800
- `,q+=`${t.bold}${t.red}\u2502${t.reset} ${t.bold}${t.bgRed} ERROR ${t.reset} ${t.red}${$} Error${t.reset}${" ".repeat(Math.max(0,43-$.length))}${t.bold}${t.red}\u2502${t.reset}
801
- `,q+=`${t.bold}${t.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${t.reset}
802
- `,q+=`
803
- ${t.cyan}${t.bold}File:${t.reset} ${t.dim}${K}${t.reset}`,G>0)q+=` ${t.gray}(line ${G}${W>0?`, col ${W}`:""})${t.reset}`;if(q+=`
800
+ `,z+=`${t.bold}${t.red}\u2502${t.reset} ${t.bold}${t.bgRed} ERROR ${t.reset} ${t.red}${$} Error${t.reset}${" ".repeat(Math.max(0,43-$.length))}${t.bold}${t.red}\u2502${t.reset}
801
+ `,z+=`${t.bold}${t.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${t.reset}
802
+ `,z+=`
803
+ ${t.cyan}${t.bold}File:${t.reset} ${t.dim}${q}${t.reset}`,G>0)z+=` ${t.gray}(line ${G}${W>0?`, col ${W}`:""})${t.reset}`;if(z+=`
804
804
  ${t.yellow}${t.bold}Message:${t.reset} ${Z}
805
- `,z)q+=`
805
+ `,K)z+=`
806
806
  ${t.blue}${t.bold}Context:${t.reset}
807
- ${t.dim}${z}${t.reset}
808
- `;return q}var g4,OQ=0,t;var N0=b(()=>{j5();r0();c1();J$();d1();y4();N5();g4=new F5(500);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function p6($,Z,Y=""){let J=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let z=G.index,K=G[0].match(/@markdown\(([^)]*)\)/),W=K?K[1]:"",q=z+G[0].length,U=1,_=q,B=-1;while(U>0&&_<$.length){let L=$.indexOf("@markdown",_),F=$.indexOf("@endmarkdown",_);if(F===-1)break;if(L!==-1&&L<F&&L!==z){let O=$[L+9];if(O==="("||O===`
809
- `||O==="\r"||O===" "||O===void 0)U++;_=L+9}else{if(U--,U===0){B=F;break}_=F+12}}if(B===-1)continue;let j=$.slice(q,B),H=$.slice(z,B+12);Q.push({fullMatch:H,options:W,content:j,index:z}),X.lastIndex=B+12}for(let{fullMatch:z,options:K,content:W,index:q}of Q)try{let U={};if(K)K.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let _={gfm:U.gfm??!0,breaks:U.breaks??!1},B=W5(W.trim(),_);J=J.split(z).join(B)}catch(U){let _=U instanceof Error?U.message:String(U),B=z0("Markdown Directive",`Error processing markdown: ${_}`,Y,$,q,z);J=J.split(z).join(B)}return J}async function c6($,Z,Y,J){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),W5($.trim(),Q)}var m4=b(()=>{N0()});function DQ($){if(TQ.set($.name,$),$.client)MQ.set($.name,$.client)}function X$($){return DQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,Q,X)=>{let G=IQ(J,$.defaults);if($.validate){let K=$.validate(G);if(K!==!0){let W=typeof K==="string"?K:`Invalid parameters for @${$.name}`;throw Error(W)}}let z=Y;if($.transform)z=await $.transform(Y,G,Q,X);if($.clientScript){let K=$.clientScript(G);z+=`<script>${K}</script>`}if($.css){let K=$.css(G);z+=`<style>${K}</style>`}return z}}}function IQ($,Z){let Y={...Z};for(let J of $){let Q=J.indexOf(":"),X=J.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let z=J.slice(0,G).trim(),K=J.slice(G+1).trim();if(K==="true")K=!0;else if(K==="false")K=!1;else if(K==="null")K=null;else if(!Number.isNaN(Number(K)))K=Number(K);else if(typeof K==="string"&&K.startsWith("{"))try{K=JSON.parse(K)}catch{}Y[z]=K}else{let z=Object.keys(Y).filter((K)=>!Z||!(K in Z)).length;Y[z===0?"value":`arg${z}`]=J}}return Y}var TQ,MQ;var u4=b(()=>{TQ=new Map,MQ=new Map});function p4($,Z=n1,Y={},J){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${T5($,{...Y,w:Q,fm:J})} ${Q}w`}).join(", ")}function l6($,Z,Y=EQ,J={},Q){return Y.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${T5($,{...J,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function c4($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return J.push(Z),J.join(", ")}function T5($,Z={}){let Y=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(Y.length===0)return $;let J=Y.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${J}`}function l4($){return kQ[$]||"application/octet-stream"}var n1,EQ,R5,kQ;var i4=b(()=>{n1=[320,480,640,768,1024,1280,1536,1920,2560],EQ=[1,1.5,2,3],R5=["avif","webp","jpeg"],kQ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function bQ(){try{return await import("ts-images")}catch{return null}}async function yQ($,Z={}){let Y={...SQ,...Z},J=await bQ();if(J)try{return await CQ($,Y,J)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return PQ($,Y)}async function CQ($,Z,Y){let{generatePlaceholder:J,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let z=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:z.dataURL,width:z.width,height:z.height,aspectRatio:z.aspectRatio,originalWidth:z.originalWidth,originalHeight:z.originalHeight,strategy:Z.strategy,dominantColor:z.dominantColor,css:z.css}}function PQ($,Z){let Y=Z.width||20,J=Z.height||Y,Q="#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:Z.strategy,dominantColor:"#e5e7eb"}}function i6($,Z,Y={}){let J=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
807
+ ${t.dim}${K}${t.reset}
808
+ `;return z}var d$,NQ=0,t;var A0=S(()=>{j5();r0();c1();X4();m1();P$();a6();N5();d$=new F5(500);t={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function H9($,Z,Y=""){let J=$,Q=[],X=/@markdown(?:\([^)]*\))?/g,G;while((G=X.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,_=z,B=-1;while(U>0&&_<$.length){let L=$.indexOf("@markdown",_),F=$.indexOf("@endmarkdown",_);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
809
+ `||O==="\r"||O===" "||O===void 0)U++;_=L+9}else{if(U--,U===0){B=F;break}_=F+12}}if(B===-1)continue;let j=$.slice(z,B),H=$.slice(K,B+12);Q.push({fullMatch:H,options:W,content:j,index:K}),X.lastIndex=B+12}for(let{fullMatch:K,options:q,content:W,index:z}of Q)try{let U={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let _={gfm:U.gfm??!0,breaks:U.breaks??!1},B=W5(W.trim(),_);J=J.split(K).join(B)}catch(U){let _=U instanceof Error?U.message:String(U),B=K0("Markdown Directive",`Error processing markdown: ${_}`,Y,$,z,K);J=J.split(K).join(B)}return J}async function O9($,Z,Y,J){let Q={gfm:!0,breaks:!1};return Z.forEach((X)=>{let G=X.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),W5($.trim(),Q)}var p$=S(()=>{A0()});function yQ($){if(bQ.set($.name,$),$.client)SQ.set($.name,$.client)}function Q4($){return yQ($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,Q,X)=>{let G=CQ(J,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,Q,X);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function CQ($,Z){let Y={...Z};for(let J of $){let Q=J.indexOf(":"),X=J.indexOf("="),G=Q>=0&&(X<0||Q<X)?Q:X;if(G>=0){let K=J.slice(0,G).trim(),q=J.slice(G+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)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var bQ,SQ;var l$=S(()=>{bQ=new Map,SQ=new Map});function c$($,Z=n1,Y={},J){return Z.sort((Q,X)=>Q-X).map((Q)=>{return`${T5($,{...Y,w:Q,fm:J})} ${Q}w`}).join(", ")}function L9($,Z,Y=PQ,J={},Q){return Y.sort((X,G)=>X-G).map((X)=>{let G=Math.round(Z*X);return`${T5($,{...J,w:G,dpr:X,fm:Q})} ${X}x`}).join(", ")}function i$($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([Q,X])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:X,numericBp:Number.parseInt(G)||0}}).sort((Q,X)=>Q.numericBp-X.numericBp).map(({bp:Q,size:X})=>`(max-width: ${Q}) ${X}`);return J.push(Z),J.join(", ")}function T5($,Z={}){let Y=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,G])=>{if(Array.isArray(G))return[X,G.join(",")];return[X,String(G)]});if(Y.length===0)return $;let J=Y.map(([X,G])=>`${X}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${J}`}function n$($){return vQ[$]||"application/octet-stream"}var n1,PQ,R5,vQ;var o$=S(()=>{n1=[320,480,640,768,1024,1280,1536,1920,2560],PQ=[1,1.5,2,3],R5=["avif","webp","jpeg"],vQ={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function fQ(){try{return await import("ts-images")}catch{return null}}async function gQ($,Z={}){let Y={...xQ,...Z},J=await fQ();if(J)try{return await hQ($,Y,J)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return dQ($,Y)}async function hQ($,Z,Y){let{generatePlaceholder:J,generateThumbHash:Q}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await Q($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await J($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function dQ($,Z){let Y=Z.width||20,J=Z.height||Y,Q="#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:Z.strategy,dominantColor:"#e5e7eb"}}function F9($,Z,Y={}){let J=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
810
810
  #${$} {
811
811
  --stx-img-transition-duration: ${J}ms;
812
812
  --stx-img-transition-easing: ${Q};
@@ -823,7 +823,7 @@ ${t.dim}${z}${t.reset}
823
823
  #${$}.stx-img-loaded img {
824
824
  opacity: 1;
825
825
  }
826
- `.trim()}async function n6($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(n4.has(Y))return n4.get(Y);let J=await yQ($,Z);return n4.set(Y,J),J}var SQ,o4,n4;var o6=b(()=>{SQ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},o4=`
826
+ `.trim()}async function V9($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(s$.has(Y))return s$.get(Y);let J=await gQ($,Z);return s$.set(Y,J),J}var xQ,r$,s$;var w9=S(()=>{xQ={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},r$=`
827
827
  .stx-img-placeholder {
828
828
  position: relative;
829
829
  overflow: hidden;
@@ -852,20 +852,20 @@ ${t.dim}${z}${t.reset}
852
852
  filter: blur(0);
853
853
  transform: scale(1);
854
854
  }
855
- `.trim();n4=new Map});import{createHash as r6}from"crypto";import{readFile as vQ,stat as a6}from"fs/promises";async function D0($){try{let Z=await vQ($);return r6("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function s6($){return r6("sha256").update($).digest("hex").slice(0,16)}function Q$($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${s6($)}-${s6(Y)}`}async function s4($){try{return(await a6($)).mtimeMs}catch{return 0}}async function M0($){try{return await a6($),!0}catch{return!1}}var D1=()=>{};import{mkdir as xQ,readFile as fQ,writeFile as gQ,readdir as vB,rm as hQ,stat as xB}from"fs/promises";import{join as e6,dirname as dQ}from"path";async function mQ($){try{await xQ($,{recursive:!0})}catch{}}function $Z($,Z,Y){return e6($,Y,`${Z}.json`)}async function t6($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await s4(Z)!==$.srcMtime)return!1;return!0}async function G$($,Z,Y,J=r4){if(!J.enabled)return null;let Q=Q$($,Z),X=o1.get(Q);if(X){if(await t6(X,$,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;o1.delete(Q)}let G=$Z(J.directory,Q,Y);if(await M0(G))try{let z=await fQ(G,"utf-8"),K=JSON.parse(z);if(await t6(K,$,J.maxAge))return K.lastAccessedAt=Date.now(),o1.set(Q,K),K.data}catch{}return null}async function z$($,Z,Y,J,Q=r4){if(!Q.enabled)return;let X=Q$($,Z),G=await D0($),z=await s4($),K={key:X,src:$,srcHash:G,srcMtime:z,optionsHash:Q$("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};o1.set(X,K);let W=$Z(Q.directory,X,J);try{await mQ(dQ(W)),await gQ(W,JSON.stringify(K,null,2))}catch(q){console.warn(`[stx-media] Failed to write cache: ${q}`)}}async function K$($,Z=r4){if($==="all")o1.clear();else o1.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let Q=e6(Z.directory,J);try{await hQ(Q,{recursive:!0,force:!0})}catch{}}}var o1,r4;var a4=b(()=>{D1();o1=new Map,r4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class W${config;constructor($={}){this.config={...uQ,...$}}async get($,Z){return G$($,Z,"image",this.config)}async set($,Z,Y){return z$($,Z,Y,"image",this.config)}async clear(){return K$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function t4($){if(!q$)q$=new W$($);else if($)q$.updateConfig($);return q$}async function U$($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return t4(J).get($,Z)}async function _$($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return t4(Q).set($,Z,Y)}async function ZZ(){return t4().clear()}var uQ,q$=null;var e4=b(()=>{a4();uQ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as pQ,basename as cQ,extname as lQ,join as iQ}from"path";import{mkdir as nQ}from"fs/promises";async function $7(){try{return await import("ts-images")}catch{return null}}function YZ($){switch($){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 oQ($,Z){let Y=Z?YZ(Z):YZ("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function JZ($,Z,Y){let J=await $7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await U$($,Z,Y);if(Q)return Q;try{let X=pQ($);if(!await M0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=oQ(Y,Z.preset),z=Y.outputDir||"dist/images",K=Y.baseUrl||"/images";await nQ(z,{recursive:!0});let W=await D0(X),q=cQ($,lQ($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await Z7(X,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${q}-${W}.${j}`,F=iQ(z,L);try{let O=await J.optimizeImage({input:B||X,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${K}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(X);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(X,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await _$($,Z,_,Y),_}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function XZ($,Z,Y,J){let Q=await $7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function Z7($,Z,Y){let J=Y||await $7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await J.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await J.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await J.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await J.sharpen(Q,G.amount);break;case"grayscale":Q=await J.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await J.rotate(Q,G.angle);break;case"flip":Q=await J.flip(Q);break;case"flop":Q=await J.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await J.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await J.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await J.saturation(Q,G.value);break}}return await J.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var QZ=b(()=>{D1();e4()});import{resolve as sQ,basename as rQ,extname as aQ,join as tQ}from"path";import{mkdir as eQ}from"fs/promises";async function $G(){try{return await import("ts-images")}catch{return null}}async function GZ($,Z,Y){let J=await $G();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=sQ($);if(!await M0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||Y.breakpoints||ZG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],z=Y.outputDir||"dist/images",K=Y.baseUrl||"/images";await eQ(z,{recursive:!0});let W=await D0(Q),q=rQ($,aQ($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of X){let F=`${q}-${L}w-${W}.${j}`,O=tQ(z,F),V=`${K}/${F}`;try{let w=U[j]?.quality||80;if(await M0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(Q);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Q,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||YG(X),_}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function YG($){let Z=[...$].sort((J,Q)=>J-Q),Y=[];for(let J=0;J<Z.length-1;J++){let Q=Z[J];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function zZ($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var ZG;var KZ=b(()=>{D1();ZG=[320,480,640,768,1024,1280,1536,1920]});var qZ={};r(qZ,{setCachedImageResult:()=>_$,processImage:()=>JZ,optimizeImage:()=>XZ,getCachedImageResult:()=>U$,generateSrcset:()=>zZ,generateResponsiveVariants:()=>GZ,clearImageCache:()=>ZZ,applyTransformations:()=>Z7,ImageProcessorCache:()=>W$});var WZ=b(()=>{QZ();KZ();e4()});async function JG(){try{return await Promise.resolve().then(() => (WZ(),qZ))}catch($){if(!UZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),UZ=!0;return null}}async function B$($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return zG(J,Y)}if(Y.processedResult?.processed)return Q7($,Y.processedResult,Z);if(Y.responsiveVariants)return HZ($,Y.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:z,sizes:K,widths:W=n1,dpr:q,formats:U=R5,quality:_=Y7,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":H$,decoding:V=j$,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,D=$.style,I=$.id,E=$.data||{},{isDev:P=!1,baseUrl:S=""}=Z;if(P&&!Z.optimize)return GG($);let k,y,g=I||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await n6(Q,{strategy:j,...H}),y=i6(g,k,H)}catch{}let h=q!==void 0&&G!==void 0,m;if(h)m=QG($,g,k,Z);else m=await XG($,g,k,Z);let i;if(F){let V0=U.includes("webp")?"webp":U[0],_0=p4(Q,W,{...B,q:_},V0),Z0=typeof K==="object"?c4(K):K||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${Z0}" />`}let c=[];if(!_Z&&j!=="none")c.push(o4),_Z=!0;if(y)c.push(y);let K0=L?jZ(g):void 0;return{html:m,preloadLink:i,css:c.length>0?c.join(`
856
- `):void 0,script:K0}}async function XG($,Z,Y,J){let{src:Q,alt:X,width:G,height:z,sizes:K,widths:W=n1,formats:q=R5,quality:U=Y7,params:_={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":H$,decoding:L=j$,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof K==="object"?c4(K):K||"100vw",D=[];for(let P of q){let S=p4(Q,W,{..._,q:U},P),k=l4(P);if(B&&!j)D.push(` <source type="${k}" data-srcset="${S}" data-sizes="${M}" />`);else D.push(` <source type="${k}" srcset="${S}" sizes="${M}" />`)}let I=J7({src:T5(Q,{..._,q:U}),alt:X,width:G,height:z,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:BZ(N,Y),style:X7(R,O,V,Y),lazy:B&&!j,data:T}),E;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
855
+ `.trim();s$=new Map});import{createHash as N9}from"crypto";import{readFile as mQ,stat as R9}from"fs/promises";async function I0($){try{let Z=await mQ($);return N9("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function A9($){return N9("sha256").update($).digest("hex").slice(0,16)}function G4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${A9($)}-${A9(Y)}`}async function a$($){try{return(await R9($)).mtimeMs}catch{return 0}}async function M0($){try{return await R9($),!0}catch{return!1}}var D1=()=>{};import{mkdir as uQ,readFile as pQ,writeFile as lQ,readdir as sB,rm as cQ,stat as rB}from"fs/promises";import{join as M9,dirname as iQ}from"path";async function nQ($){try{await uQ($,{recursive:!0})}catch{}}function I9($,Z,Y){return M9($,Y,`${Z}.json`)}async function T9($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await a$(Z)!==$.srcMtime)return!1;return!0}async function K4($,Z,Y,J=t$){if(!J.enabled)return null;let Q=G4($,Z),X=o1.get(Q);if(X){if(await T9(X,$,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;o1.delete(Q)}let G=I9(J.directory,Q,Y);if(await M0(G))try{let K=await pQ(G,"utf-8"),q=JSON.parse(K);if(await T9(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),o1.set(Q,q),q.data}catch{}return null}async function q4($,Z,Y,J,Q=t$){if(!Q.enabled)return;let X=G4($,Z),G=await I0($),K=await a$($),q={key:X,src:$,srcHash:G,srcMtime:K,optionsHash:G4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};o1.set(X,q);let W=I9(Q.directory,X,J);try{await nQ(iQ(W)),await lQ(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function z4($,Z=t$){if($==="all")o1.clear();else o1.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let Q=M9(Z.directory,J);try{await cQ(Q,{recursive:!0,force:!0})}catch{}}}var o1,t$;var e$=S(()=>{D1();o1=new Map,t$={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class U4{config;constructor($={}){this.config={...oQ,...$}}async get($,Z){return K4($,Z,"image",this.config)}async set($,Z,Y){return q4($,Z,Y,"image",this.config)}async clear(){return z4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function $7($){if(!W4)W4=new U4($);else if($)W4.updateConfig($);return W4}async function _4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return $7(J).get($,Z)}async function B4($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return $7(Q).set($,Z,Y)}async function D9(){return $7().clear()}var oQ,W4=null;var Z7=S(()=>{e$();oQ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as sQ,basename as rQ,extname as aQ,join as tQ}from"path";import{mkdir as eQ}from"fs/promises";async function Y7(){try{return await import("ts-images")}catch{return null}}function E9($){switch($){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 $G($,Z){let Y=Z?E9(Z):E9("web"),J=$.formatQuality||{};return{jpeg:{...Y.jpeg,...J.jpeg},png:{...Y.png,...J.png},webp:{...Y.webp,...J.webp},avif:{...Y.avif,...J.avif}}}async function k9($,Z,Y){let J=await Y7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await _4($,Z,Y);if(Q)return Q;try{let X=sQ($);if(!await M0(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=$G(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await eQ(K,{recursive:!0});let W=await I0(X),z=rQ($,aQ($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],_={src:$,processed:!0,variants:[],hash:W},B=null;if(Z.transformations&&Z.transformations.length>0)B=await J7(X,Z.transformations,J);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=tQ(K,L);try{let O=await J.optimizeImage({input:B||X,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(_.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!_.originalWidth&&O.width)_.originalWidth=O.width,_.originalHeight=O.height}}catch(O){_.errors=_.errors||[],_.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await J.generateThumbHash(X);_.placeholder=j.dataUrl}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await J.generatePlaceholder(X,{strategy:"dominant-color"});_.dominantColor=j.dominantColor}catch(j){_.errors=_.errors||[],_.errors.push(`Failed to extract dominant color: ${j}`)}return await B4($,Z,_,Y),_}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function b9($,Z,Y,J){let Q=await Y7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function J7($,Z,Y){let J=Y||await Y7();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await J.decode($);for(let X of Z){let G=X.options||{};switch(X.type){case"resize":if(G.width||G.height)Q=await J.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await J.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await J.sharpen(Q,G.amount);break;case"grayscale":Q=await J.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await J.rotate(Q,G.angle);break;case"flip":Q=await J.flip(Q);break;case"flop":Q=await J.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await J.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await J.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await J.saturation(Q,G.value);break}}return await J.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var S9=S(()=>{D1();Z7()});import{resolve as ZG,basename as YG,extname as JG,join as XG}from"path";import{mkdir as QG}from"fs/promises";async function GG(){try{return await import("ts-images")}catch{return null}}async function y9($,Z,Y){let J=await GG();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=ZG($);if(!await M0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||Y.breakpoints||KG,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await QG(K,{recursive:!0});let W=await I0(Q),z=YG($,JG($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},_={src:$,byFormat:{},srcsets:{}};for(let j of G){_.byFormat[j]=[];let H=[];for(let L of X){let F=`${z}-${L}w-${W}.${j}`,O=XG(K,F),V=`${q}/${F}`;try{let w=U[j]?.quality||80;if(await M0(O)){_.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await J.processImage({input:Q,output:O,format:j,quality:w,resize:{width:L}});if(A)_.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${w}`)}}_.srcsets[j]=H.join(", ")}let B=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(Q);_.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Q,{strategy:B,width:20});_.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return _.sizes=Z.sizes||qG(X),_}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function qG($){let Z=[...$].sort((J,Q)=>J-Q),Y=[];for(let J=0;J<Z.length-1;J++){let Q=Z[J];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function C9($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var KG;var P9=S(()=>{D1();KG=[320,480,640,768,1024,1280,1536,1920]});var v9={};r(v9,{setCachedImageResult:()=>B4,processImage:()=>k9,optimizeImage:()=>b9,getCachedImageResult:()=>_4,generateSrcset:()=>C9,generateResponsiveVariants:()=>y9,clearImageCache:()=>D9,applyTransformations:()=>J7,ImageProcessorCache:()=>U4});var x9=S(()=>{S9();P9();Z7()});async function zG(){try{return await Promise.resolve().then(() => (x9(),v9))}catch($){if(!f9)console.warn("[stx-media] Image processor not available, some features disabled:",$),f9=!0;return null}}async function j4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return BG(J,Y)}if(Y.processedResult?.processed)return K7($,Y.processedResult,Z);if(Y.responsiveVariants)return m9($,Y.responsiveVariants,Z);let{src:Q,alt:X,width:G,height:K,sizes:q,widths:W=n1,dpr:z,formats:U=R5,quality:_=X7,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":O4,decoding:V=H4,fetchpriority:w,objectFit:A,objectPosition:N,crossorigin:R,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:P=!1,baseUrl:b=""}=Z;if(P&&!Z.optimize)return _G($);let k,y,g=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await V9(Q,{strategy:j,...H}),y=F9(g,k,H)}catch{}let h=z!==void 0&&G!==void 0,m;if(h)m=UG($,g,k,Z);else m=await WG($,g,k,Z);let i;if(F){let V0=U.includes("webp")?"webp":U[0],_0=c$(Q,W,{...B,q:_},V0),Z0=typeof q==="object"?i$(q):q||"100vw";i=`<link rel="preload" as="image" imagesrcset="${_0}" imagesizes="${Z0}" />`}let l=[];if(!g9&&j!=="none")l.push(r$),g9=!0;if(y)l.push(y);let q0=L?d9(g):void 0;return{html:m,preloadLink:i,css:l.length>0?l.join(`
856
+ `):void 0,script:q0}}async function WG($,Z,Y,J){let{src:Q,alt:X,width:G,height:K,sizes:q,widths:W=n1,formats:z=R5,quality:U=X7,params:_={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":O4,decoding:L=H4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A}=$,N=$.class,R=$.style,T=$.data||{},M=typeof q==="object"?i$(q):q||"100vw",I=[];for(let P of z){let b=c$(Q,W,{..._,q:U},P),k=n$(P);if(B&&!j)I.push(` <source type="${k}" data-srcset="${b}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${b}" sizes="${M}" />`)}let D=Q7({src:T5(Q,{..._,q:U}),alt:X,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:w,referrerpolicy:A,className:h9(N,Y),style:G7(R,O,V,Y),lazy:B&&!j,data:T}),E;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
857
857
  <picture>
858
- ${D.join(`
858
+ ${I.join(`
859
859
  `)}
860
- <img ${I} />
860
+ <img ${D} />
861
861
  </picture>
862
862
  </div>`}else E=`<picture${Z?` id="${Z}"`:""}>
863
- ${D.join(`
863
+ ${I.join(`
864
864
  `)}
865
- <img ${I} />
866
- </picture>`;return E}function QG($,Z,Y,J){let{src:Q,alt:X,width:G,height:z,dpr:K=[1,2,3],quality:W=Y7,params:q={},lazy:U=!0,priority:_=!1,loading:B=_?"eager":H$,decoding:j=j$,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=l6(Q,R,K,{...q,q:W}),M=J7({src:T5(Q,{...q,w:R,q:W}),alt:X,width:G,height:z,loading:_?void 0:B,decoding:j,fetchpriority:_?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:BZ(w,Y),style:X7(A,L,F,Y),lazy:U&&!_,data:N}),D=U&&!_?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let I=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${I}">
867
- <img ${M} ${D} />
868
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${D} />`}function GG($){let{src:Z,alt:Y,width:J,height:Q,loading:X=H$,decoding:G=j$,fetchpriority:z,objectFit:K,objectPosition:W,crossorigin:q,referrerpolicy:U,priority:_=!1}=$,B=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${J7({src:Z,alt:Y,width:J,height:Q,loading:_?"eager":X,decoding:G,fetchpriority:_?"high":z,objectFit:K,objectPosition:W,crossorigin:q,referrerpolicy:U,className:B,style:X7(j,K,W),id:H,data:L})} />`}}function J7($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function BZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function X7($,Z,Y,J){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(J)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function jZ($){return`
865
+ <img ${D} />
866
+ </picture>`;return E}function UG($,Z,Y,J){let{src:Q,alt:X,width:G,height:K,dpr:q=[1,2,3],quality:W=X7,params:z={},lazy:U=!0,priority:_=!1,loading:B=_?"eager":O4,decoding:j=H4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,w=$.class,A=$.style,N=$.data||{},R=typeof G==="number"?G:Number.parseInt(String(G),10),T=L9(Q,R,q,{...z,q:W}),M=Q7({src:T5(Q,{...z,w:R,q:W}),alt:X,width:G,height:K,loading:_?void 0:B,decoding:j,fetchpriority:_?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:h9(w,Y),style:G7(A,L,F,Y),lazy:U&&!_,data:N}),I=U&&!_?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let D=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${D}">
867
+ <img ${M} ${I} />
868
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function _G($){let{src:Z,alt:Y,width:J,height:Q,loading:X=O4,decoding:G=H4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:_=!1}=$,B=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${Q7({src:Z,alt:Y,width:J,height:Q,loading:_?"eager":X,decoding:G,fetchpriority:_?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:B,style:G7(j,q,W),id:H,data:L})} />`}}function Q7($){let Z=[];if($.lazy)Z.push(`data-src="${p0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${p0($.src)}"`);if(Z.push(`alt="${p0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${p0($.className)}"`);if($.style)Z.push(`style="${p0($.style)}"`);if($.id)Z.push(`id="${p0($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${p0(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function h9($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function G7($,Z,Y,J){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(J)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function p0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d9($){return`
869
869
  (function() {
870
870
  const container = document.getElementById('${$}');
871
871
  if (!container) return;
@@ -902,7 +902,7 @@ ${D.join(`
902
902
 
903
903
  observer.observe(container);
904
904
  })();
905
- `.trim()}async function zG($,Z){let Y=await JG();if(!Y)return B$({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await Y.generateResponsiveVariants($.src,$,J);if(X)return HZ($,X,Z)}else{let X=await Y.processImage($.src,$,J);if(X.processed)return Q7($,X,Z)}return B$({...$,process:!1},Z)}async function Q7($,Z,Y){let{alt:J,width:Q,height:X,lazy:G=!0,priority:z=!1,objectFit:K,objectPosition:W,crossorigin:q,referrerpolicy:U}=$,_=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of L){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let A=[],N=["avif","webp","jpeg","png"];for(let y of N){let g=w.get(y);if(g&&g.length>0){let h=g.map((i)=>`${i.url} ${i.width}w`).join(", "),m=l4(y);if(G&&!z)A.push(` <source type="${m}" data-srcset="${h}" />`);else A.push(` <source type="${m}" srcset="${h}" />`)}}let R=[];if(G&&!z){if(R.push(`data-src="${p0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${p0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${p0(J)}"`);let T=Q||Z.originalWidth,M=X||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!z)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),z)R.push('fetchpriority="high"');if(q)R.push(`crossorigin="${q}"`);if(U)R.push(`referrerpolicy="${U}"`);let D=[];if(K)D.push(`object-fit: ${K}`);if(W)D.push(`object-position: ${W}`);if(Z.placeholder&&G)D.push("opacity: 0; transition: opacity 300ms ease-out");if(B)D.push(B);if(D.length>0)R.push(`style="${D.join("; ")}"`);let I=[];if(_)I.push(_);if(Z.placeholder)I.push("stx-img-blur");if(I.length>0)R.push(`class="${I.join(" ")}"`);if(G&&!z)R.push("data-stx-lazy");for(let[y,g]of Object.entries(H))R.push(`data-${y}="${p0(g)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
905
+ `.trim()}async function BG($,Z){let Y=await zG();if(!Y)return j4({...$,process:!1},Z);let J=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let X=await Y.generateResponsiveVariants($.src,$,J);if(X)return m9($,X,Z)}else{let X=await Y.processImage($.src,$,J);if(X.processed)return K7($,X,Z)}return j4({...$,process:!1},Z)}async function K7($,Z,Y){let{alt:J,width:Q,height:X,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,_=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((y)=>y.format==="jpeg")||L.find((y)=>y.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((y)=>y.format===(F?.format||"jpeg")).map((y)=>`${y.url} ${y.width}w`).join(", "),w=new Map;for(let y of L){if(!w.has(y.format))w.set(y.format,[]);w.get(y.format).push(y)}let A=[],N=["avif","webp","jpeg","png"];for(let y of N){let g=w.get(y);if(g&&g.length>0){let h=g.map((i)=>`${i.url} ${i.width}w`).join(", "),m=n$(y);if(G&&!K)A.push(` <source type="${m}" data-srcset="${h}" />`);else A.push(` <source type="${m}" srcset="${h}" />`)}}let R=[];if(G&&!K){if(R.push(`data-src="${p0(O)}"`),R.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)R.push(`data-srcset="${V}"`)}else if(R.push(`src="${p0(O)}"`),V)R.push(`srcset="${V}"`);R.push(`alt="${p0(J)}"`);let T=Q||Z.originalWidth,M=X||Z.originalHeight;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(!K)R.push(`loading="${G?"lazy":"eager"}"`);if(R.push('decoding="async"'),K)R.push('fetchpriority="high"');if(z)R.push(`crossorigin="${z}"`);if(U)R.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(B)I.push(B);if(I.length>0)R.push(`style="${I.join("; ")}"`);let D=[];if(_)D.push(_);if(Z.placeholder)D.push("stx-img-blur");if(D.length>0)R.push(`class="${D.join(" ")}"`);if(G&&!K)R.push("data-stx-lazy");for(let[y,g]of Object.entries(H))R.push(`data-${y}="${p0(g)}"`);let E;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let y=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;E=`<div id="${j}" class="stx-img-placeholder" style="${y}">
906
906
  <picture>
907
907
  ${A.join(`
908
908
  `)}
@@ -912,12 +912,12 @@ ${A.join(`
912
912
  ${A.join(`
913
913
  `)}
914
914
  <img ${R.join(" ")} />
915
- </picture>`;let P=[];if(Z.placeholder)P.push(o4);let S=G?jZ(j):void 0,k;if(z&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:P.length>0?P.join(`
916
- `):void 0,script:S}}async function HZ($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)J.variants.push(...X);return Q7($,J,Y)}var UZ=!1,Y7=80,j$="async",H$="lazy",_Z=!1;var OZ=b(()=>{i4();o6()});function KG(){return X$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:Q,alt:X,options:G}=qG($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let z={src:Q,alt:X||"",widths:G.widths||n1,formats:G.formats||R5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},K=Y.__isDev||!1,W=await B$(z,{isDev:K}),q=W.html;if(W.preloadLink)q=W.preloadLink+`
917
- `+q;if(W.css)q+=`
918
- <style>${W.css}</style>`;if(W.script)q+=`
919
- <script>${W.script}</script>`;return q},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function qG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=WG(J),X=G7(Q[0],Y)||"",G=G7(Q[1],Y)||"",z={};if(Q[2]){let K=G7(Q[2],Y);if(typeof K==="object"&&K!==null)z=K;else if(typeof Q[2]==="string")try{z=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:z}}function WG($){let Z=[],Y="",J=!1,Q="",X=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],W=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&W!=="\\"){if(!J)J=!0,Q=K;else if(K===Q)J=!1,Q="";else Y+=K;continue}if(!J){if(K==="{")X++;if(K==="}")X--;if(K==="[")G++;if(K==="]")G--;if(K===","&&X===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function G7($,Z){if(typeof $!=="string")return $;let Y=$.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=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var LZ;var FZ=b(()=>{u4();OZ();i4();LZ=KG()});class L${config;constructor($={}){this.config={...UG,...$}}async get($,Z){return G$($,Z,"video",this.config)}async set($,Z,Y){return z$($,Z,Y,"video",this.config)}async clear(){return K$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function z7($){if(!O$)O$=new L$($);else if($)O$.updateConfig($);return O$}async function F$($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z7(J).get($,Z)}async function V$($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return z7(Q).set($,Z,Y)}async function VZ(){return z7().clear()}var UG,O$=null;var K7=b(()=>{a4();UG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as q7,basename as W7,extname as U7,join as w$}from"path";import{mkdir as _7}from"fs/promises";async function B7(){try{return await import("ts-videos")}catch{return null}}async function A$($,Z,Y,J){let Q=await B7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=q7($);if(!await M0(X))return null;await _7(Y,{recursive:!0});let G=await D0(X),z=W7($,U7($)),K=Z.format||"webp",W=Z.timestamp||0,q=`${z}-poster-${G}.${K}`,U=w$(Y,q),_=await Q.extractThumbnails(X,{timestamps:[W],width:Z.width||1280,height:Z.height,format:K,quality:Z.quality||85,outputDir:Y,outputPattern:q.replace(`.${K}`,"")});if(_&&_.length>0){let B=_[0];return{path:U,url:`${J}/${q}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function N$($,Z,Y,J){let Q=await B7();if(!Q)return[];try{let X=q7($);if(!await M0(X))return[];await _7(Y,{recursive:!0});let G=await D0(X),z=W7($,U7($)),K=Z.format||"webp",U=(await new Q.Input(X).getInfo()).duration||60,_=Z.count||10,B=Z.interval||U/_,j=[];for(let L=0;L<_&&L*B<U;L++)j.push(L*B);let H=await Q.extractThumbnails(X,{timestamps:j,width:Z.width||320,format:K,quality:Z.quality||80,outputDir:Y,outputPattern:`${z}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||w$(Y,`${z}-thumb-${G}-${F}.${K}`),url:`${J}/${z}-thumb-${G}-${F}.${K}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function wZ($,Z,Y,J){let Q=await B7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=q7($);if(!await M0(X))return null;await _7(Y,{recursive:!0});let G=await D0(X),z=W7($,U7($)),q=(await new Q.Input(X).getInfo()).duration||60,U=Z.columns||10,_=Z.interval||5,B=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(q/_),F=Math.ceil(L/U),O=`${z}-sprite-${G}.${H}`,V=w$(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*_);let A=await Q.extractThumbnails(X,{timestamps:w,width:B,height:j,format:H,quality:Z.quality||70,outputDir:w$(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=U*B,T=F*j,M=await N.createSprite({images:A.map((D)=>D.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:B,thumbnailHeight:j,interval:_,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 j7=b(()=>{D1()});import{resolve as NZ,basename as RZ,extname as TZ,join as I1}from"path";import{mkdir as R$,writeFile as MZ}from"fs/promises";async function DZ(){try{return await import("ts-videos")}catch{return null}}async function T$($,Z,Y,J,Q){let X=await DZ();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=NZ($);if(!await M0(G))return null;let z=await D0(G),K=RZ($,TZ($)),W=I1(Y,`${K}-${z}-hls`);await R$(W,{recursive:!0});let q=Z.length>0?Z:IZ,U=Q?.segmentDuration||6,j=(await new X.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of q){let w=I1(W,V.label);await R$(w,{recursive:!0});let A=`${V.label}.m3u8`,N=I1(w,A);try{let R=await X.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${J}/${K}-${z}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(j/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=I1(W,"master.m3u8"),O=_G(H,J,K,z);return await MZ(F,O),{manifestUrl:`${J}/${K}-${z}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function _G($,Z,Y,J){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,z=G.bitrate+(G.audioBitrate||128000),K=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${z},RESOLUTION=${K},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
920
- `)}async function M$($,Z,Y,J,Q){let X=await DZ();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=NZ($);if(!await M0(G))return null;let z=await D0(G),K=RZ($,TZ($)),W=I1(Y,`${K}-${z}-dash`);await R$(W,{recursive:!0});let q=Z.length>0?Z:IZ,U=Q?.segmentDuration||4,_=Q?.minBufferTime||2,H=(await new X.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of q){let N=I1(W,A.label);await R$(N,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:N,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${K}-${z}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${K}-${z}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=I1(W,"manifest.mpd"),V=BG(L,F,H,U,_);await MZ(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${K}-${z}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function BG($,Z,Y,J,Q){let X=AZ(Y),G=AZ(Q),z=`<?xml version="1.0" encoding="UTF-8"?>
915
+ </picture>`;let P=[];if(Z.placeholder)P.push(r$);let b=G?d9(j):void 0,k;if(K&&V)k=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:E,preloadLink:k,css:P.length>0?P.join(`
916
+ `):void 0,script:b}}async function m9($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,X]of Object.entries(Z.byFormat))if(X)J.variants.push(...X);return K7($,J,Y)}var f9=!1,X7=80,H4="async",O4="lazy",g9=!1;var u9=S(()=>{o$();w9()});function jG(){return Q4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:Q,alt:X,options:G}=HG($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:X||"",widths:G.widths||n1,formats:G.formats||R5,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await j4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
917
+ `+z;if(W.css)z+=`
918
+ <style>${W.css}</style>`;if(W.script)z+=`
919
+ <script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function HG($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=OG(J),X=q7(Q[0],Y)||"",G=q7(Q[1],Y)||"",K={};if(Q[2]){let q=q7(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:X,alt:G,options:K}}function OG($){let Z=[],Y="",J=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,Q=q;else if(q===Q)J=!1,Q="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function q7($,Z){if(typeof $!=="string")return $;let Y=$.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=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var p9;var l9=S(()=>{l$();u9();o$();p9=jG()});class F4{config;constructor($={}){this.config={...LG,...$}}async get($,Z){return K4($,Z,"video",this.config)}async set($,Z,Y){return q4($,Z,Y,"video",this.config)}async clear(){return z4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function z7($){if(!L4)L4=new F4($);else if($)L4.updateConfig($);return L4}async function V4($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return z7(J).get($,Z)}async function w4($,Z,Y,J){let Q=J?{directory:`${J.outputDir}/../.cache`}:{};return z7(Q).set($,Z,Y)}async function c9(){return z7().clear()}var LG,L4=null;var W7=S(()=>{e$();LG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as U7,basename as _7,extname as B7,join as A4}from"path";import{mkdir as j7}from"fs/promises";async function H7(){try{return await import("ts-videos")}catch{return null}}async function N4($,Z,Y,J){let Q=await H7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=U7($);if(!await M0(X))return null;await j7(Y,{recursive:!0});let G=await I0(X),K=_7($,B7($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=A4(Y,z),_=await Q.extractThumbnails(X,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(_&&_.length>0){let B=_[0];return{path:U,url:`${J}/${z}`,width:B.width||Z.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function R4($,Z,Y,J){let Q=await H7();if(!Q)return[];try{let X=U7($);if(!await M0(X))return[];await j7(Y,{recursive:!0});let G=await I0(X),K=_7($,B7($)),q=Z.format||"webp",U=(await new Q.Input(X).getInfo()).duration||60,_=Z.count||10,B=Z.interval||U/_,j=[];for(let L=0;L<_&&L*B<U;L++)j.push(L*B);let H=await Q.extractThumbnails(X,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||A4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${J}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function i9($,Z,Y,J){let Q=await H7();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=U7($);if(!await M0(X))return null;await j7(Y,{recursive:!0});let G=await I0(X),K=_7($,B7($)),z=(await new Q.Input(X).getInfo()).duration||60,U=Z.columns||10,_=Z.interval||5,B=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/_),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=A4(Y,O),w=[];for(let N=0;N<L;N++)w.push(N*_);let A=await Q.extractThumbnails(X,{timestamps:w,width:B,height:j,format:H,quality:Z.quality||70,outputDir:A4(Y,".temp")});if(!A||A.length===0)return null;try{let N=await import("ts-images"),R=U*B,T=F*j,M=await N.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${J}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:B,thumbnailHeight:j,interval:_,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 O7=S(()=>{D1()});import{resolve as o9,basename as s9,extname as r9,join as E1}from"path";import{mkdir as T4,writeFile as a9}from"fs/promises";async function t9(){try{return await import("ts-videos")}catch{return null}}async function M4($,Z,Y,J,Q){let X=await t9();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=o9($);if(!await M0(G))return null;let K=await I0(G),q=s9($,r9($)),W=E1(Y,`${q}-${K}-hls`);await T4(W,{recursive:!0});let z=Z.length>0?Z:e9,U=Q?.segmentDuration||6,j=(await new X.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of z){let w=E1(W,V.label);await T4(w,{recursive:!0});let A=`${V.label}.m3u8`,N=E1(w,A);try{let R=await X.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(R)H.push({quality:V,url:`${J}/${q}-${K}-hls/${V.label}/${A}`,path:N}),L+=R.segmentCount||Math.ceil(j/U)}catch(R){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${R}`)}}if(H.length===0)return null;let F=E1(W,"master.m3u8"),O=FG(H,J,q,K);return await a9(F,O),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function FG($,Z,Y,J){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:G}=X,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
920
+ `)}async function I4($,Z,Y,J,Q){let X=await t9();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=o9($);if(!await M0(G))return null;let K=await I0(G),q=s9($,r9($)),W=E1(Y,`${q}-${K}-dash`);await T4(W,{recursive:!0});let z=Z.length>0?Z:e9,U=Q?.segmentDuration||4,_=Q?.minBufferTime||2,H=(await new X.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of z){let N=E1(W,A.label);await T4(N,{recursive:!0});try{if(await X.generateDASH(G,{outputDir:N,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${K}-dash/${A.label}/audio`})}}catch(R){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${R}`)}}if(L.length===0)return null;let O=E1(W,"manifest.mpd"),V=VG(L,F,H,U,_);await a9(O,V);let w=[{type:"video",representations:L}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:w,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function VG($,Z,Y,J,Q){let X=n9(Y),G=n9(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
921
921
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
922
922
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
923
923
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -927,29 +927,29 @@ ${A.join(`
927
927
  profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
928
928
  <Period>
929
929
  <AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
930
- `;for(let K=0;K<$.length;K++){let W=$[K];z+=` <Representation id="video${K}" bandwidth="${W.bandwidth}" width="${W.width}" height="${W.height}">
930
+ `;for(let q=0;q<$.length;q++){let W=$[q];K+=` <Representation id="video${q}" bandwidth="${W.bandwidth}" width="${W.width}" height="${W.height}">
931
931
  <BaseURL>${W.url}/</BaseURL>
932
932
  <SegmentBase indexRange="0-999">
933
933
  <Initialization range="0-999"/>
934
934
  </SegmentBase>
935
935
  </Representation>
936
- `}if(z+=` </AdaptationSet>
937
- `,Z.length>0){z+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
938
- `;for(let K=0;K<Z.length;K++){let W=Z[K];z+=` <Representation id="audio${K}" bandwidth="${W.bandwidth}">
936
+ `}if(K+=` </AdaptationSet>
937
+ `,Z.length>0){K+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
938
+ `;for(let q=0;q<Z.length;q++){let W=Z[q];K+=` <Representation id="audio${q}" bandwidth="${W.bandwidth}">
939
939
  <BaseURL>${W.url}/</BaseURL>
940
940
  <SegmentBase indexRange="0-999">
941
941
  <Initialization range="0-999"/>
942
942
  </SegmentBase>
943
943
  </Representation>
944
- `}z+=` </AdaptationSet>
945
- `}return z+=` </Period>
946
- </MPD>`,z}function AZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${J}S`,Q}var IZ;var H7=b(()=>{D1();IZ=[{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 EZ,basename as jG,extname as HG,join as OG}from"path";import{mkdir as LG}from"fs/promises";async function kZ(){try{return await import("ts-videos")}catch{return null}}function FG($){switch($){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 VG($){switch($){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 O7($){let Z=await kZ();if(!Z)return null;try{let Y=EZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function SZ($,Z,Y,J){let Q=await kZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await F$($,Z,Y);if(X)return X;try{let G=EZ($);if(!await M0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let z=Y.outputDir||"dist/videos",K=Y.baseUrl||"/videos";await LG(z,{recursive:!0});let W=await D0(G),q=jG($,HG($)),U={src:$,processed:!0,hash:W};J?.({percentage:5,stage:"analyzing"}),U.metadata=await O7(G)||void 0;let _={};if(Z.quality)_.bitrate=FG(Z.quality);if(Z.platform)Object.assign(_,VG(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let B=`${q}-${W}.mp4`,j=OG(z,B);try{let H=await wG(G,j,_,Q,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${K}/${B}`,duration:H.duration,size:H.size,video:{codec:_.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await A$(G,B,z,K);if(j)U.poster=j}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await N$(G,Y.thumbnails,z,K);if(B.length>0)U.thumbnails=B}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await T$(G,B.qualities||Y.streaming?.defaultQualities||[],z,K);if(j)U.streaming={...U.streaming,hls:j}}if(B.format==="dash"){let j=await M$(G,B.qualities||Y.streaming?.defaultQualities||[],z,K);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await V$($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function wG($,Z,Y,J,Q){try{let G=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((z)=>{Q?.(z.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var bZ=b(()=>{D1();K7();j7();H7()});var yZ={};r(yZ,{setCachedVideoResult:()=>V$,processVideo:()=>SZ,getCachedVideoResult:()=>F$,generateThumbnails:()=>N$,generateSpriteSheet:()=>wZ,generatePoster:()=>A$,generateHLSManifest:()=>T$,generateDASHManifest:()=>M$,clearVideoCache:()=>VZ,analyzeVideo:()=>O7,VideoProcessorCache:()=>L$});var CZ=b(()=>{bZ();j7();H7();K7()});async function vZ(){try{return await Promise.resolve().then(() => (CZ(),yZ))}catch($){if(!PZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),PZ=!0;return null}}async function D$($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return DG(J,Y)}if(Y.processedResult?.processed)return hZ($,Y.processedResult,Z);let Q;if(J.generatePoster&&J.src&&!$.poster)Q=await IG(J,Y);let{src:X,sources:G=[],poster:z,posterPlaceholder:K,controls:W=xZ,autoplay:q=!1,muted:U=!1,loop:_=!1,preload:B=fZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=Q||z,T=$.class,M=$.style,D=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return RG($,Z);if(F&&F!=="video")return NG(X||"",F,$);let I=G.length>0?G:X?[{src:X,type:gZ(X)}]:[],E=[`id="${D}"`];if(W)E.push("controls");if(q)E.push("autoplay");if(U)E.push("muted");if(_)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(N)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${B}"`),E.push('preload="none"'),R)E.push(`data-poster="${w0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${B}"`),R)E.push(`poster="${w0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${w0(T)}"`);if(M)E.push(`style="${w0(M)}"`);let P=I.map((y)=>{return` <source ${H?`data-src="${w0(y.src)}"`:`src="${w0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
947
- `),S=`<video ${E.join(" ")}>
944
+ `}K+=` </AdaptationSet>
945
+ `}return K+=` </Period>
946
+ </MPD>`,K}function n9($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${J}S`,Q}var e9;var L7=S(()=>{D1();e9=[{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 $8,basename as wG,extname as AG,join as NG}from"path";import{mkdir as RG}from"fs/promises";async function Z8(){try{return await import("ts-videos")}catch{return null}}function TG($){switch($){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 MG($){switch($){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 F7($){let Z=await Z8();if(!Z)return null;try{let Y=$8($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function Y8($,Z,Y,J){let Q=await Z8();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await V4($,Z,Y);if(X)return X;try{let G=$8($);if(!await M0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await RG(K,{recursive:!0});let W=await I0(G),z=wG($,AG($)),U={src:$,processed:!0,hash:W};J?.({percentage:5,stage:"analyzing"}),U.metadata=await F7(G)||void 0;let _={};if(Z.quality)_.bitrate=TG(Z.quality);if(Z.platform)Object.assign(_,MG(Z.platform));if(Z.transcode)Object.assign(_,Z.transcode);if(Object.keys(_).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let B=`${z}-${W}.mp4`,j=NG(K,B);try{let H=await IG(G,j,_,Q,(L)=>J?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${B}`,duration:H.duration,size:H.size,video:{codec:_.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:_.audioCodec||"aac",bitrate:_.audioBitrate||128000,sampleRate:_.sampleRate||48000,channels:_.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await N4(G,B,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await R4(G,Y.thumbnails,K,q);if(B.length>0)U.thumbnails=B}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await M4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(B.format==="dash"){let j=await I4(G,B.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await w4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function IG($,Z,Y,J,Q){try{let G=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)=>{Q?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var J8=S(()=>{D1();W7();O7();L7()});var X8={};r(X8,{setCachedVideoResult:()=>w4,processVideo:()=>Y8,getCachedVideoResult:()=>V4,generateThumbnails:()=>R4,generateSpriteSheet:()=>i9,generatePoster:()=>N4,generateHLSManifest:()=>M4,generateDASHManifest:()=>I4,clearVideoCache:()=>c9,analyzeVideo:()=>F7,VideoProcessorCache:()=>F4});var Q8=S(()=>{J8();O7();L7();W7()});async function K8(){try{return await Promise.resolve().then(() => (Q8(),X8))}catch($){if(!G8)console.warn("[stx-media] Video processor not available, some features disabled:",$),G8=!0;return null}}async function D4($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return yG(J,Y)}if(Y.processedResult?.processed)return U8($,Y.processedResult,Z);let Q;if(J.generatePoster&&J.src&&!$.poster)Q=await CG(J,Y);let{src:X,sources:G=[],poster:K,posterPlaceholder:q,controls:W=q8,autoplay:z=!1,muted:U=!1,loop:_=!1,preload:B=z8,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:w,disablePictureInPicture:A=!1,disableRemotePlayback:N=!1}=$,R=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return kG($,Z);if(F&&F!=="video")return EG(X||"",F,$);let D=G.length>0?G:X?[{src:X,type:W8(X)}]:[],E=[`id="${I}"`];if(W)E.push("controls");if(z)E.push("autoplay");if(U)E.push("muted");if(_)E.push("loop");if(j)E.push("playsinline");if(A)E.push("disablepictureinpicture");if(N)E.push("disableremoteplayback");if(w)E.push(`crossorigin="${w}"`);if(H){if(E.push(`data-preload="${B}"`),E.push('preload="none"'),R)E.push(`data-poster="${w0(R)}"`);E.push("data-stx-lazy")}else if(E.push(`preload="${B}"`),R)E.push(`poster="${w0(R)}"`);if(O)E.push(`width="${O}"`);if(V)E.push(`height="${V}"`);if(T)E.push(`class="${w0(T)}"`);if(M)E.push(`style="${w0(M)}"`);let P=D.map((y)=>{return` <source ${H?`data-src="${w0(y.src)}"`:`src="${w0(y.src)}"`} type="${y.type}"${y.media?` media="${y.media}"`:""} />`}).join(`
947
+ `),b=`<video ${E.join(" ")}>
948
948
  ${P}
949
949
  Your browser does not support the video tag.
950
950
  </video>`,k;if(H)k=`
951
951
  (function() {
952
- var video = document.getElementById('${D}');
952
+ var video = document.getElementById('${I}');
953
953
  if (!video) return;
954
954
 
955
955
  var observer = new IntersectionObserver(function(entries) {
@@ -982,9 +982,9 @@ ${P}
982
982
 
983
983
  observer.observe(video);
984
984
  })();
985
- `.trim();return{html:S,script:k}}function NG($,Z,Y){let{width:J=640,height:Q=360}=Y,X=Y.class,G=Y.style,z=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,W=null;switch(Z){case"youtube":W=TG($),K=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=MG($),K=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",K=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=$}let q=[`id="${z}"`,`src="${w0(K)}"`,`width="${J}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)q.push(`class="${w0(X)}"`);if(G)q.push(`style="${w0(G)}"`);if(Y.lazy)q.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
986
- <iframe ${q.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
987
- </div>`}}function RG($,Z={}){let{src:Y,sources:J=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:z=!1,loop:K=!1,preload:W="metadata",playsinline:q=!0,lazy:U=!0,width:_,height:B}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:K,muted:z,playsinline:q,preload:W,poster:Q,controls:X,title:$.title},O=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),V=`
985
+ `.trim();return{html:b,script:k}}function EG($,Z,Y){let{width:J=640,height:Q=360}=Y,X=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=bG($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=SG($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let z=[`id="${K}"`,`src="${w0(q)}"`,`width="${J}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)z.push(`class="${w0(X)}"`);if(G)z.push(`style="${w0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
986
+ <iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
987
+ </div>`}}function kG($,Z={}){let{src:Y,sources:J=[],poster:Q,controls:X=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:z=!0,lazy:U=!0,width:_,height:B}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:G,loop:q,muted:K,playsinline:z,preload:W,poster:Q,controls:X,title:$.title},O=["position: relative",_?`width: ${typeof _==="number"?_+"px":_}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),V=`
988
988
  <div
989
989
  id="${L}"
990
990
  class="ts-video-player${j?" "+w0(j):""}"
@@ -1021,7 +1021,7 @@ ${P}
1021
1021
 
1022
1022
  // Load ts-video-player from CDN
1023
1023
  var script = document.createElement('script');
1024
- script.src = '${AG}';
1024
+ script.src = '${DG}';
1025
1025
  script.onload = initPlayer;
1026
1026
  script.onerror = function() {
1027
1027
  console.error('[stx] Failed to load ts-video-player');
@@ -1151,11 +1151,11 @@ else {
1151
1151
  .ts-video-player__play-button svg {
1152
1152
  margin-left: 4px;
1153
1153
  }
1154
- `.trim();return{html:V,script:w,css:A}}function gZ($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function TG($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function MG($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function DG($,Z){let Y=await vZ();if(!Y)return D$({...$,process:!1},Z);let J=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,J,$.onProcessProgress);if(Q.processed)return hZ($,Q,Z);return D$({...$,process:!1},Z)}async function IG($,Z){let Y=await vZ();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,Q.outputDir,Q.baseUrl||"/videos"))?.url}function hZ($,Z,Y){let{controls:J=xZ,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:z=fZ,playsinline:K=!0,lazy:W=!0,width:q,height:U,crossorigin:_,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=gZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(J)N.push("controls");if(Q)N.push("autoplay");if(X)N.push("muted");if(G)N.push("loop");if(K)N.push("playsinline");if(B)N.push("disablepictureinpicture");if(j)N.push("disableremoteplayback");if(_)N.push(`crossorigin="${_}"`);if(W){if(N.push(`data-preload="${z}"`),N.push('preload="none"'),A)N.push(`data-poster="${w0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${z}"`),A)N.push(`poster="${w0(A)}"`);let R=q||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${w0(H)}"`);if(L)N.push(`style="${w0(L)}"`);let D=` <source ${W?`data-src="${w0(O)}"`:`src="${w0(O)}"`} type="${V}" />`,I=`<video ${N.join(" ")}>
1155
- ${D}
1156
- Your browser does not support the video tag.
1157
- </video>`;if(Z.spriteSheet)I=`<div class="stx-video-wrapper" data-sprite-sheet="${w0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
1154
+ `.trim();return{html:V,script:w,css:A}}function W8($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function bG($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let J=$.match(Y);if(J)return J[1]}return null}function SG($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function w0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function yG($,Z){let Y=await K8();if(!Y)return D4({...$,process:!1},Z);let J=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,J,$.onProcessProgress);if(Q.processed)return U8($,Q,Z);return D4({...$,process:!1},Z)}async function CG($,Z){let Y=await K8();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,Q.outputDir,Q.baseUrl||"/videos"))?.url}function U8($,Z,Y){let{controls:J=q8,autoplay:Q=!1,muted:X=!1,loop:G=!1,preload:K=z8,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:_,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=W8(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,N=[`id="${F}"`];if(J)N.push("controls");if(Q)N.push("autoplay");if(X)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(B)N.push("disablepictureinpicture");if(j)N.push("disableremoteplayback");if(_)N.push(`crossorigin="${_}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),A)N.push(`data-poster="${w0(A)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),A)N.push(`poster="${w0(A)}"`);let R=z||Z.metadata?.width,T=U||Z.metadata?.height;if(R)N.push(`width="${R}"`);if(T)N.push(`height="${T}"`);if(H)N.push(`class="${w0(H)}"`);if(L)N.push(`style="${w0(L)}"`);let I=` <source ${W?`data-src="${w0(O)}"`:`src="${w0(O)}"`} type="${V}" />`,D=`<video ${N.join(" ")}>
1158
1155
  ${I}
1156
+ Your browser does not support the video tag.
1157
+ </video>`;if(Z.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${w0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
1158
+ ${D}
1159
1159
  </div>`;let E;if(W)E=`
1160
1160
  (function() {
1161
1161
  var video = document.getElementById('${F}');
@@ -1200,9 +1200,9 @@ ${I}
1200
1200
  width: 100%;
1201
1201
  height: auto;
1202
1202
  }
1203
- `.trim();return{html:I,script:E,css:P}}var PZ=!1,xZ=!0,fZ="metadata",AG="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var dZ=()=>{};function EG(){return X$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:Q,options:X}=kG($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,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},K={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await D$(G,K),q=W.html;if(W.css)q+=`
1204
- <style>${W.css}</style>`;if(W.script)q+=`
1205
- <script>${W.script}</script>`;return q},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function kG($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=SG(J),X=mZ(Q[0],Y)||"",G={};if(Q[1]){let z=mZ(Q[1],Y);if(typeof z==="object"&&z!==null)G=z;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function SG($){let Z=[],Y="",J=!1,Q="",X=0,G=0;for(let z=0;z<$.length;z++){let K=$[z],W=z>0?$[z-1]:"";if((K==='"'||K==="'"||K==="`")&&W!=="\\"){if(!J)J=!0,Q=K;else if(K===Q)J=!1,Q="";else Y+=K;continue}if(!J){if(K==="{")X++;if(K==="}")X--;if(K==="[")G++;if(K==="]")G--;if(K===","&&X===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function mZ($,Z){if(typeof $!=="string")return $;let Y=$.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=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var uZ;var pZ=b(()=>{u4();dZ();uZ=EG()});function bG($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1203
+ `.trim();return{html:D,script:E,css:P}}var G8=!1,q8=!0,z8="metadata",DG="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var _8=S(()=>{w7()});function B8(){return Q4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:Q,options:X}=PG($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,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},W=await D4(G,q),z=W.html;if(W.css)z+=`
1204
+ <style>${W.css}</style>`;if(W.script)z+=`
1205
+ <script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function PG($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Q=vG(J),X=j8(Q[0],Y)||"",G={};if(Q[1]){let K=j8(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:X,options:G}}function vG($){let Z=[],Y="",J=!1,Q="",X=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,Q=q;else if(q===Q)J=!1,Q="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")G++;if(q==="]")G--;if(q===","&&X===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function j8($,Z){if(typeof $!=="string")return $;let Y=$.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=Z[Y];if(J!==void 0)return J}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var V7;var w7=S(()=>{l$();_8();V7=B8()});function xG($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
1206
1206
  ${$}
1207
1207
  </div>
1208
1208
  <script>
@@ -1247,7 +1247,7 @@ ${I}
1247
1247
  }
1248
1248
  }
1249
1249
  })();
1250
- </script>`}function yG($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,X=$.trim().length>0,G=`
1250
+ </script>`}function fG($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,X=$.trim().length>0,G=`
1251
1251
  <div class="stx-pwa-update-banner" style="
1252
1252
  position: fixed;
1253
1253
  bottom: 0;
@@ -1358,7 +1358,7 @@ else {
1358
1358
  // Also listen for custom event
1359
1359
  window.addEventListener('pwa-update-available', showUpdate);
1360
1360
  })();
1361
- </script>`}function CG($,Z){let Y=$.trim().length>0,J=`
1361
+ </script>`}function gG($,Z){let Y=$.trim().length>0,J=`
1362
1362
  <div class="stx-offline-indicator" style="
1363
1363
  position: fixed;
1364
1364
  top: 16px;
@@ -1419,7 +1419,7 @@ else {
1419
1419
  window.addEventListener('offline', updateStatus);
1420
1420
  updateStatus();
1421
1421
  })();
1422
- </script>`}function PG($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1422
+ </script>`}function hG($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
1423
1423
  ${$}
1424
1424
  </div>
1425
1425
  <script>
@@ -1501,71 +1501,71 @@ catch (error) {
1501
1501
  init();
1502
1502
  }
1503
1503
  })();
1504
- </script>`}var vG,xG,fG,gG,cZ;var lZ=b(()=>{vG={name:"pwa.installButton",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return bG($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},xG={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return yG($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},fG={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return CG($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},gG={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return PG($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},cZ=[vG,xG,fG,gG]});function L7($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var I$=b(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function M5(){return!1}function D5(){return!M5()||process.env.STX_DEBUG==="true"}function E$(){return!1}import hG from"path";function k$(){return{...F7}}function S$($){if(!F7.showRelativePaths||!$)return $;let Z=F7.baseDir||process.cwd();try{let Y=hG.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var dG,F7,b$,E1,y$;var C$=b(()=>{I$();dG={showRelativePaths:!1,enableAutoRecovery:D5(),logRecoveryWarnings:!0},F7={...dG};b$=class b$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,Q,X,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=S$(this.filePath)}};E1=class E1 extends b${constructor($,Z,Y,J,Q,X){super($,"stx_RUNTIME_ERROR",Z,Y,J,Q,X||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};y$=class y$ extends b${isFatal=!0;constructor($,Z,Y,J,Q,X){super($,"stx_VALIDATION_ERROR",Z,Y,J,Q,X||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function nZ($){let{type:Z,message:Y,code:J,filePath:Q,line:X,column:G,template:z,offset:K,snippet:W,suggestion:q,format:U="text"}=$,_=X,B=G;if(!_&&z&&K!==void 0){let O=iG(z,K);_=O.line,B=O.column}let j=Q?S$(Q):void 0,H=J?L7(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:j,line:_,column:B,snippet:W,suggestion:q,timestamp:new Date().toISOString()},F;switch(U){case"html":F=uG(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=pG(L,z,K);break;case"text":default:F=mG(L,z,K);break}return{formatted:F,data:L}}function mG($,Z,Y){let J=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}J.push(`at ${X}`)}if(J.push(`
1505
- ${$.message}`),Z&&$.line){let X=cG(Z,$.line,2);if(X)J.push(`
1504
+ </script>`}var dG,mG,uG,pG,H8;var O8=S(()=>{dG={name:"pwa.installButton",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return xG($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},mG={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return fG($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},uG={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return gG($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},pG={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let Q=Y.__stx_options||{};return hG($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},H8=[dG,mG,uG,pG]});function A7($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var E4=S(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function M5(){return!1}function I5(){return!M5()||process.env.STX_DEBUG==="true"}function k4(){return!1}import lG from"path";function b4(){return{...N7}}function S4($){if(!N7.showRelativePaths||!$)return $;let Z=N7.baseDir||process.cwd();try{let Y=lG.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var cG,N7,y4,k1,C4;var P4=S(()=>{E4();cG={showRelativePaths:!1,enableAutoRecovery:I5(),logRecoveryWarnings:!0},N7={...cG};y4=class y4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,Q,X,G){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=Q;this.context=X;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=S4(this.filePath)}};k1=class k1 extends y4{constructor($,Z,Y,J,Q,X){super($,"stx_RUNTIME_ERROR",Z,Y,J,Q,X||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};C4=class C4 extends y4{isFatal=!0;constructor($,Z,Y,J,Q,X){super($,"stx_VALIDATION_ERROR",Z,Y,J,Q,X||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function F8($){let{type:Z,message:Y,code:J,filePath:Q,line:X,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,_=X,B=G;if(!_&&K&&q!==void 0){let O=aG(K,q);_=O.line,B=O.column}let j=Q?S4(Q):void 0,H=J?A7(J):void 0,L={type:Z,code:J,codeName:H,message:Y,filePath:j,line:_,column:B,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=nG(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=oG(L,K,q);break;case"text":default:F=iG(L,K,q);break}return{formatted:F,data:L}}function iG($,Z,Y){let J=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Q}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}J.push(`at ${X}`)}if(J.push(`
1505
+ ${$.message}`),Z&&$.line){let X=sG(Z,$.line,2);if(X)J.push(`
1506
1506
  ${X}`)}if($.snippet)J.push(`
1507
1507
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
1508
- Suggestion: ${$.suggestion}`);return J.join(" ")}function uG($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${iZ($.message)}`;if($.suggestion)J+=` | Suggestion: ${iZ($.suggestion)}`;return J+=" -->",J}function pG($,Z,Y){let W=[],q=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${q} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
1508
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function nG($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${L8($.message)}`;if($.suggestion)J+=` | Suggestion: ${L8($.suggestion)}`;return J+=" -->",J}function oG($,Z,Y){let W=[],z=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
1509
1509
  \x1B[90mat\x1B[0m ${U}`)}if(W.push(`
1510
1510
 
1511
- ${$.message}`),Z&&$.line){let U=lG(Z,$.line,2);if(U)W.push(`
1511
+ ${$.message}`),Z&&$.line){let U=rG(Z,$.line,2);if(U)W.push(`
1512
1512
 
1513
1513
  \x1B[90mContext:\x1B[0m
1514
1514
  ${U}`)}if($.suggestion)W.push(`
1515
1515
 
1516
1516
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
1517
- ${"\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"}`),W.join("")}function cG($,Z,Y){let J=$.split(`
1518
- `),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G=[];for(let z=Q;z<=X;z++){let K=(z+1).toString().padStart(4),W=z===Z-1?">":" ";G.push(`${W}${K} | ${J[z]}`)}return G.join(`
1519
- `)}function lG($,Z,Y){let J=$.split(`
1520
- `),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",z="\x1B[31m",K="\x1B[0m",W=[];for(let q=Q;q<=X;q++){let U=(q+1).toString().padStart(4),_=q===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${J[q]}\x1B[0m`:`\x1B[90m${J[q]}\x1B[0m`;W.push(`${B}\x1B[90m${U}\x1B[0m | ${j}`)}return W.join(`
1521
- `)}function iZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function iG($,Z){let J=$.substring(0,Z).split(`
1522
- `);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return nZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function s1($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var oZ=b(()=>{I$();C$()});class w7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,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($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1517
+ ${"\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"}`),W.join("")}function sG($,Z,Y){let J=$.split(`
1518
+ `),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G=[];for(let K=Q;K<=X;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${J[K]}`)}return G.join(`
1519
+ `)}function rG($,Z,Y){let J=$.split(`
1520
+ `),Q=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let z=Q;z<=X;z++){let U=(z+1).toString().padStart(4),_=z===Z-1,B=_?"\x1B[31m>\x1B[0m":" ",j=_?`\x1B[31m${J[z]}\x1B[0m`:`\x1B[90m${J[z]}\x1B[0m`;W.push(`${B}\x1B[90m${U}\x1B[0m | ${j}`)}return W.join(`
1521
+ `)}function L8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function aG($,Z){let J=$.substring(0,Z).split(`
1522
+ `);return{line:J.length,column:J[J.length-1].length}}function e($,Z,Y){return F8({type:$,message:Z,code:Y,format:"html"}).formatted}async function s1($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var V8=S(()=>{E4();P4()});class T7{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let J={timestamp:new Date,error:$,context:Z,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($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
1523
1523
  `).slice(1).join(`
1524
1524
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
1525
1525
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(Z);let Q=`${this.formatEntry($)}
1526
1526
  `;Z.appendFileSync(this.logFilePath,Q,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let J=`${this.logFilePath}.${Y}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,Q)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let J=Y.error.constructor.name;$[J]=($[J]||0)+1;let Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let X=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,X.join(`
1527
1527
 
1528
- `),"utf-8")}}async flush(){await this.writeQueue}}var V7,c0,A7;var sZ=b(()=>{C$();V7={isEnabled(){return k$().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=k$();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],Q=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(Q>X){let z=Q-X;Y+="}}".repeat(z),J.push(`Added ${z} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let z of G){let K=(Y.match(new RegExp(`@${z}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${z}\\b`,"g"))||[]).length;if(K>W){let q=K-W;for(let U=0;U<q;U++)Y+=`
1529
- @end${z}`;J.push(`Added ${q} missing @end${z}`)}}if(J.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((z)=>console.warn(` - ${z}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:J}},createFallbackContent($,Z){if(D5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};c0=new w7,A7={isDevelopment(){return D5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1530
- `)}}});var rZ=b(()=>{I$();oZ();sZ();C$()});var Z1=b(()=>{rZ()});function aZ($,Z,Y,J){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(z,K,W)=>{if(!W&&K.includes(":")){let q=K.split(":"),U=K,_=q.length>1?q[1]:"";if(_&&Z[_])W=Z[_];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[q[1]])W=Z.openGraph[q[1]];else W="";return W?`<meta property="${l(U)}" content="${l(W)}">`:""}return W?`<meta name="${l(K)}" content="${l(W)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let z=G.index,K=z+G[0].length-1,W=1,q=K+1;while(q<Q.length&&W>0){if(Q[q]==="(")W++;else if(Q[q]===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=Q.substring(K+1,q).trim(),_=q+1,B=(()=>{try{let j=R0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${l(String(j.name))}"`;if(j.property)H+=` property="${l(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${l(String(j.httpEquiv))}"`;if(j.content)H+=` content="${l(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return e("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,z)+B+Q.substring(_),X.lastIndex=0}return Q}function tZ($,Z,Y){let J=$,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(J))!==null){let G=X.index,z=G+X[0].length-1,K=1,W=z+1;while(W<J.length&&K>0){if(J[W]==="(")K++;else if(J[W]===")"){if(K--,K===0)break}W++}if(K!==0)break;let q=J.substring(z+1,W).trim(),U=W+1,_=(()=>{try{let B=R0(q,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return e("StructuredData",j,o.EVALUATION_ERROR)}})();J=J.substring(0,G)+_+J.substring(U),Q.lastIndex=0}return J}function eZ($,Z,Y,J){let Q=$,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let z=Q.indexOf("{",G.index+4),K=1,W=z+1,q=null,U=!1;while(W<Q.length&&K>0){let F=Q[W];if(U){U=!1,W++;continue}if(F==="\\"&&q){U=!0,W++;continue}if(q){if(F===q)q=null;W++;continue}if(F==='"'||F==="'"||F==="`"){q=F,W++;continue}if(F==="{")K++;else if(F==="}")K--;W++}if(K!==0)break;let _=Q.substring(W).match(/^\s*\)/);if(!_)break;let B=W+_[0].length,j=Q.substring(z,W),H=Q.substring(G.index,B),L=((F)=>{try{let O=R0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${l(O.title)}</title>
1531
- `,V+=`<meta name="title" content="${l(O.title)}">
1532
- `;if(O.description)V+=`<meta name="description" content="${l(O.description)}">
1533
- `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${l(w)}">
1534
- `}if(O.robots)V+=`<meta name="robots" content="${l(O.robots)}">
1535
- `;if(O.canonical)V+=`<link rel="canonical" href="${l(O.canonical)}">
1536
- `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${l(w.type||"website")}">
1537
- `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta property="og:title" content="${l(A)}">
1538
- `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta property="og:description" content="${l(A)}">
1539
- `}if(w.url||O.canonical){let A=w.url||O.canonical||"";V+=`<meta property="og:url" content="${l(A)}">
1540
- `}if(w.image){if(V+=`<meta property="og:image" content="${l(w.image)}">
1541
- `,w.imageAlt)V+=`<meta property="og:image:alt" content="${l(w.imageAlt)}">
1542
- `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${l(String(w.imageWidth))}">
1543
- `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${l(String(w.imageHeight))}">
1544
- `}if(w.siteName)V+=`<meta property="og:site_name" content="${l(w.siteName)}">
1545
- `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${l(w.card||"summary_large_image")}">
1546
- `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta name="twitter:title" content="${l(A)}">
1547
- `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta name="twitter:description" content="${l(A)}">
1548
- `}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${l(A)}">
1549
- `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
1550
- `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
1528
+ `),"utf-8")}}async flush(){await this.writeQueue}}var R7,l0,M7;var w8=S(()=>{P4();R7={isEnabled(){return b4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=b4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],Q=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(Q>X){let K=Q-X;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let z=q-W;for(let U=0;U<z;U++)Y+=`
1529
+ @end${K}`;J.push(`Added ${z} missing @end${K}`)}}if(J.length>0&&Z.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(I5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};l0=new T7,M7={isDevelopment(){return I5()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
1530
+ `)}}});var A8=()=>{};var N8=S(()=>{E4();V8();w8();A8();P4()});var Z1=S(()=>{N8()});function R8($,Z,Y,J){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,_=z.length>1?z[1]:"";if(_&&Z[_])W=Z[_];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${c(U)}" content="${c(W)}">`:""}return W?`<meta name="${c(q)}" content="${c(W)}">`:""});let X=/@metaTag\s*\(/g,G;while((G=X.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<Q.length&&W>0){if(Q[z]==="(")W++;else if(Q[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=Q.substring(q+1,z).trim(),_=z+1,B=(()=>{try{let j=N0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${c(String(j.name))}"`;if(j.property)H+=` property="${c(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)H+=` content="${c(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return e("MetaTag",H,s.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+B+Q.substring(_),X.lastIndex=0}return Q}function T8($,Z,Y){let J=$,Q=/@structuredData\s*\(/g,X;while((X=Q.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=J.substring(K+1,W).trim(),U=W+1,_=(()=>{try{let B=N0(z,Z);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return e("StructuredData",j,s.EVALUATION_ERROR)}})();J=J.substring(0,G)+_+J.substring(U),Q.lastIndex=0}return J}function M8($,Z,Y,J){let Q=$,X=/@seo\s*\(\s*\{/g,G;while((G=X.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<Q.length&&q>0){let F=Q[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let _=Q.substring(W).match(/^\s*\)/);if(!_)break;let B=W+_[0].length,j=Q.substring(K,W),H=Q.substring(G.index,B),L=((F)=>{try{let O=N0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${c(O.title)}</title>
1531
+ `,V+=`<meta name="title" content="${c(O.title)}">
1532
+ `;if(O.description)V+=`<meta name="description" content="${c(O.description)}">
1533
+ `;if(O.keywords){let w=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${c(w)}">
1534
+ `}if(O.robots)V+=`<meta name="robots" content="${c(O.robots)}">
1535
+ `;if(O.canonical)V+=`<link rel="canonical" href="${c(O.canonical)}">
1536
+ `;if(O.openGraph){let w=O.openGraph;if(V+=`<meta property="og:type" content="${c(w.type||"website")}">
1537
+ `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta property="og:title" content="${c(A)}">
1538
+ `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta property="og:description" content="${c(A)}">
1539
+ `}if(w.url||O.canonical){let A=w.url||O.canonical||"";V+=`<meta property="og:url" content="${c(A)}">
1540
+ `}if(w.image){if(V+=`<meta property="og:image" content="${c(w.image)}">
1541
+ `,w.imageAlt)V+=`<meta property="og:image:alt" content="${c(w.imageAlt)}">
1542
+ `;if(w.imageWidth)V+=`<meta property="og:image:width" content="${c(String(w.imageWidth))}">
1543
+ `;if(w.imageHeight)V+=`<meta property="og:image:height" content="${c(String(w.imageHeight))}">
1544
+ `}if(w.siteName)V+=`<meta property="og:site_name" content="${c(w.siteName)}">
1545
+ `}if(O.twitter){let w=O.twitter;if(V+=`<meta name="twitter:card" content="${c(w.card||"summary_large_image")}">
1546
+ `,w.title||O.title){let A=w.title||O.title||"";V+=`<meta name="twitter:title" content="${c(A)}">
1547
+ `}if(w.description||O.description){let A=w.description||O.description||"";V+=`<meta name="twitter:description" content="${c(A)}">
1548
+ `}if(w.image||O.openGraph&&O.openGraph.image){let A=w.image||(O.openGraph?O.openGraph.image:"")||"";V+=`<meta name="twitter:image" content="${c(A)}">
1549
+ `}if(w.site)V+=`<meta name="twitter:site" content="${c(w.site)}">
1550
+ `;if(w.creator)V+=`<meta name="twitter:creator" content="${c(w.creator)}">
1551
1551
  `}if(O.structuredData){let w=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
1552
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(B),X.lastIndex=G.index+L.length}return Q}function $8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let z="";if(Z.description)z=Z.description;else if(Z.meta&&Z.meta.description)z=Z.meta.description;else if(Y.seo?.defaultConfig?.description)z=Y.seo.defaultConfig.description;else z=Y.defaultDescription||"A website built with stx templating engine";let K="";if(Z.image)K=Z.image;else if(Z.meta&&Z.meta.image)K=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)K=Z.openGraph.image;else if(Y.seo?.defaultImage)K=Y.seo.defaultImage;else if(Y.defaultImage)K=Y.defaultImage;let W=`
1552
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return e("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(B),X.lastIndex=G.index+L.length}return Q}function I8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let J=Z.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
1553
1553
  <!-- stx SEO Tags -->
1554
- <meta name="title" content="${l(G)}">
1555
- <meta name="description" content="${l(z)}">
1556
- <meta property="og:title" content="${l(G)}">
1557
- <meta property="og:description" content="${l(z)}">
1554
+ <meta name="title" content="${c(G)}">
1555
+ <meta name="description" content="${c(K)}">
1556
+ <meta property="og:title" content="${c(G)}">
1557
+ <meta property="og:description" content="${c(K)}">
1558
1558
  <meta property="og:type" content="website">
1559
1559
  <meta name="twitter:card" content="summary_large_image">
1560
- <meta name="twitter:title" content="${l(G)}">
1561
- <meta name="twitter:description" content="${l(z)}">
1562
- `;if(K)W+=`
1563
- <meta property="og:image" content="${l(K)}">
1564
- <meta name="twitter:image" content="${l(K)}">
1565
- `;let q=$;if(!X)q=q.replace(/<head[^>]*>/,`$&
1566
- <title>${l(G)}</title>`);return q.replace(/<head[^>]*>/,`$&
1560
+ <meta name="twitter:title" content="${c(G)}">
1561
+ <meta name="twitter:description" content="${c(K)}">
1562
+ `;if(q)W+=`
1563
+ <meta property="og:image" content="${c(q)}">
1564
+ <meta name="twitter:image" content="${c(q)}">
1565
+ `;let z=$;if(!X)z=z.replace(/<head[^>]*>/,`$&
1566
+ <title>${c(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
1567
1567
  ${W}
1568
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Z8,Y8;var N7=b(()=>{Z1();T0();Z8={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(Q)}" content="${l(X)}">`},hasEndTag:!1},Y8={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return e("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return e("StructuredData",X,o.EVALUATION_ERROR)}},hasEndTag:!0}});import I5 from"path";function nG($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",Q=Z,X=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let _=U[1],B=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Q=B[1];let j=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)X=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=_.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let z=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=z?z[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),q=W?W[1].trim():"";return{tag:Q,props:X,template:K,styles:q,script:J,shadowDOM:G}}function oG($){let{tag:Z,props:Y,template:J,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),z=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),q=Y.map((U)=>`
1568
+ `)}function c($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var D8,E8;var I7=S(()=>{Z1();R0();D8={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return e("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${c(Q)}" content="${c(X)}">`},hasEndTag:!1},E8={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return e("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return e("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let X=Q instanceof Error?Q.message:String(Q);return e("StructuredData",X,s.EVALUATION_ERROR)}},hasEndTag:!0}});import D5 from"path";function tG($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",Q=Z,X=[],G=!0;if(J){let U=J.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let _=U[1],B=_.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Q=B[1];let j=_.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)X=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=_.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=W?W[1].trim():"";return{tag:Q,props:X,template:q,styles:z,script:J,shadowDOM:G}}function eG($){let{tag:Z,props:Y,template:J,styles:Q,shadowDOM:X}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
1569
1569
  get ${U}() {
1570
1570
  return this.getAttribute('${U}') || '';
1571
1571
  }
@@ -1597,10 +1597,10 @@ class ${G} extends HTMLElement {
1597
1597
  this._render();
1598
1598
  }
1599
1599
  }
1600
- ${q}
1600
+ ${z}
1601
1601
 
1602
1602
  _render() {
1603
- const template = \`${K?`<style>${K}</style>`:""}${z}\`;
1603
+ const template = \`${q?`<style>${q}</style>`:""}${K}\`;
1604
1604
 
1605
1605
  // Interpolate {{ prop }} with attribute values
1606
1606
  const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
@@ -1616,16 +1616,16 @@ ${q}
1616
1616
  }
1617
1617
 
1618
1618
  customElements.define('${Z}', ${G});
1619
- `}async function J8($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",z=[I5.join(I5.dirname(J),G,`${Q}.stx`),I5.join(process.cwd(),G,`${Q}.stx`),I5.join(I5.dirname(J),`${Q}.stx`)],K=null;for(let U of z)if(await n(U)){K=await Bun.file(U).text();break}if(!K)return e("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=nG(K,Q);return`<script type="module">
1620
- ${oG(W)}
1621
- </script>`}var X8=b(()=>{Z1();N0()});var Q8={};r(Q8,{timingPlugin:()=>eG,pluginManager:()=>sG,definePlugin:()=>P$,debugPlugin:()=>tG,createVariablesPlugin:()=>$z,createFilterPlugin:()=>aG,createDirectivePlugin:()=>rG,PluginManager:()=>R7});function P$($){return $}class R7{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let X=await Q(Y);if(X){if(X.template!==void 0)Y.template=X.template;if(X.context)Y.context={...Y.context,...X.context};if(X.metadata)Y.metadata={...Y.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${J.name}" ${$} hook:`,X)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return J}}function rG($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function aG($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function $z($){return P$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var sG,tG,eG;var G8=b(()=>{sG=new R7;tG=P$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),eG=P$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var K8={};r(K8,{validateConfig:()=>Xz,loadStxConfig:()=>S1,defineStxConfig:()=>Jz,defaultConfig:()=>k1,config:()=>M7});import T7 from"fs";import I0 from"path";import{loadConfigWithResult as Zz}from"bunfig";function Yz($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=I0.join(process.cwd(),"resources","views"),Q=I0.join(process.cwd(),"resources","layouts");if(T7.existsSync(J)&&T7.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=I0.join(process.cwd(),"resources","views","pages");if(T7.existsSync(X))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function S1($){if(!$){if(r1)return r1;if(v$)return v$}let Z=$?I0.resolve($):process.cwd(),Y=z8.get(Z);if(Y)return Y;let J=(async()=>{let X=(await Zz({name:"stx",alias:"ui",cwd:Z,defaultConfig:k1,verbose:!1})).config,G=Yz(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let z=X.root;if(X.partialsDir&&!I0.isAbsolute(X.partialsDir))X.partialsDir=I0.join(z,X.partialsDir);if(X.componentsDir&&!I0.isAbsolute(X.componentsDir))X.componentsDir=I0.join(z,X.componentsDir);if(X.layoutsDir&&!I0.isAbsolute(X.layoutsDir))X.layoutsDir=I0.join(z,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:z}=await Promise.resolve().then(() => (G8(),Q8)),K=[],W=[];for(let q of X.plugins){let U=typeof q==="string"?q:q[0],_=typeof q==="string"?{}:q[1]||{};try{let B,j;try{B=await import(U),j=I0.dirname(q0.resolve(U))}catch{let L=I0.resolve(process.cwd(),U);B=await import(L),j=I0.dirname(L)}let H=B.default||B;if(z.register(H,X),H.components){let L=I0.resolve(j,H.components);K.push(L)}if(H.pages){let L=I0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(F)},addRoute:(F,O)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[F]=O},addMiddleware:(F)=>{X.middleware=X.middleware||[],X.middleware.push(F)},pluginDir:j,config:X};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}X._pluginComponentDirs=K,X._pluginPageDirs=W}return X})();if(z8.set(Z,J),!$)v$=J,J.then((Q)=>{r1=Q}).catch(()=>{});return J}function Jz($){return $}function Xz($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!J.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var k1,r1=null,z8,v$=null,M7;var a1=b(()=>{N4();R4();T4();M4();m4();FZ();pZ();lZ();N7();X8();k1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",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:c6,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:J8,hasEndTag:!1,description:"Include a web component in the template"},g3,h3,Z8,Y8,d3,u3,p3,m3,n3,r3,LZ,uZ,...cZ],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};z8=new Map;M7=new Proxy(k1,{get($,Z){if(r1&&Z in r1)return r1[Z];if(!v$)S1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var B8={};r(B8,{resetCssCache:()=>qz,resetCrosswindCache:()=>Wz,rebuildCrosswindCSS:()=>Uz,loadCrosswindConfig:()=>S7,loadCrosswind:()=>k7,injectCrosswindCSS:()=>k5,getCachedCSS:()=>_z,generateCrosswindCSS:()=>_8,extractClassNames:()=>U8,buildCrosswindCSS:()=>W8});import f$ from"fs";import $0 from"path";function E7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function D7($,Z){if(Y1.has($))Y1.delete($);else if(Y1.size>=Qz)Y1.delete(Y1.keys().next().value);Y1.set($,Z)}async function Gz($){if(!z1)return null;try{let Z=Bun.file($0.join(z1,`cw-${E7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function zz($,Z){if(!z1)return;try{if(!f$.existsSync(z1))f$.mkdirSync(z1,{recursive:!0});await Bun.write($0.join(z1,`cw-${E7($)}.css`),Z)}catch{}}async function q8($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function Kz(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==$0.dirname(Y))$.push($0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push($0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push($0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push($0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push($0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push($0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=$0.dirname(Y);if(Z){let J=[$0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),$0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),$0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),$0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),$0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),$0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push($0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push($0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function k7(){if(I7)return e1;I7=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await q8(Y);if(J){if(e1=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return e1}}let Z=Kz();for(let Y of Z)if(await Bun.file(Y).exists()){let J=await q8(Y);if(J){if(e1=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${$0.dirname($0.dirname(Y))}`);return e1}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function qz(){Y1.clear()}function Wz(){e1=null,I7=!1,l0=null,E5="",Y1.clear(),x$=null}async function S7($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let J=$0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${J||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function W8($){if(t1)return E5;t1=!0;try{let Z=await k7();if(!Z||!Z.build)return t1=!1,"";if(!l0)l0=await S7($);if(!l0)return t1=!1,"";let Y=Z.defaultConfig?.theme||{},J=l0.theme||{},Q={...Z.defaultConfig,...l0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},X=performance.now(),G=await Z.build(Q),z=performance.now()-X;if(E5=G.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${G.classes.size} classes in ${z.toFixed(1)}ms`),Q.output){let K=$0.isAbsolute(Q.output)?Q.output:$0.join($,Q.output),W=$0.dirname(K);if(!f$.existsSync(W))f$.mkdirSync(W,{recursive:!0});await Bun.write(K,G.css)}return t1=!1,G.css}catch(Z){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,Z),t1=!1,E5}}async function Uz($){l0=null,await W8($)}function _z(){return E5}function U8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[1].match(/'([^']+)'/g);if(G){for(let z of G)for(let K of z.slice(1,-1).split(/\s+/))if(K.trim())Z.add(K.trim())}X=Q.exec($)}return Z}async function _8($,Z){try{let Y=await k7();if(!Y)return"";let J=U8($);if(J.size===0)return"";let Q=Z?$0.resolve(Z):process.cwd();if(!z1)z1=$0.join(Q,".stx/cache");let X=[...J].sort().join(" "),G=`${x$||"default"}::${X}`,z=Y1.get(G);if(z!==void 0)return D7(G,z),z;let K=await Gz(G);if(K!==null)return D7(G,K),K;if(!l0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (a1(),K8)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let T=$0.isAbsolute(R.css)?R.css:$0.resolve(Q,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=$0.isAbsolute(R.css.config)?R.css.config:$0.resolve(Q,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}l0=A||await S7(Q);try{x$=E7(JSON.stringify(l0??{}))}catch{x$="unhashable"}}let W=Y.defaultConfig||Y.config,q=l0||{},U=W.theme||{},B=(q.theme||{}).extend||{},j={...U};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...q.safelist||[]],L={...W,...q,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||q.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
1622
- `);for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let D of R){let I=D.startsWith("dark:"),S=`.${(I?D.slice(5):D).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let y=w[k].trim();if(y===`${S} {`||y.startsWith(`${S} {`)){let g=k,h="";while(g<w.length){if(h+=w[g],w[g].includes("}"))break;g++}let m=h.match(/\{([^}]+)\}/);if(m)if(I)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
1619
+ `}async function k8($,Z,Y,J){if(Z.length<1)return e("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[D5.join(D5.dirname(J),G,`${Q}.stx`),D5.join(process.cwd(),G,`${Q}.stx`),D5.join(D5.dirname(J),`${Q}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return e("WebComponent",`Component file not found: ${Q}.stx`,s.FILE_NOT_FOUND);let W=tG(q,Q);return`<script type="module">
1620
+ ${eG(W)}
1621
+ </script>`}var b8=S(()=>{Z1();A0()});var S8={};r(S8,{timingPlugin:()=>XK,pluginManager:()=>$K,definePlugin:()=>v4,debugPlugin:()=>JK,createVariablesPlugin:()=>QK,createFilterPlugin:()=>YK,createDirectivePlugin:()=>ZK,PluginManager:()=>D7});function v4($){return $}class D7{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let X=await Q(Y);if(X){if(X.template!==void 0)Y.template=X.template;if(X.context)Y.context={...Y.context,...X.context};if(X.metadata)Y.metadata={...Y.metadata,...X.metadata};if(X.skip)break}}catch(X){console.error(`Error in plugin "${J.name}" ${$} hook:`,X)}}return Y}async runDirectiveHooks($,Z,Y){let J={...Y};for(let Q of this.sortedPlugins){let X=Q[$];if(X)try{let G=await X(Z,J);if(G){if(G.template!==void 0)J.template=G.template;if(G.context)J.context={...J.context,...G.context};if(G.metadata)J.metadata={...J.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Q.name}" ${$} hook:`,G)}}return J}}function ZK($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function YK($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function QK($){return v4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var $K,JK,XK;var y8=S(()=>{$K=new D7;JK=v4({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),XK=v4({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var P8={};r(P8,{validateConfig:()=>zK,loadStxConfig:()=>S1,defineStxConfig:()=>qK,defaultConfig:()=>b1,config:()=>k7});import E7 from"fs";import D0 from"path";import{loadConfigWithResult as GK}from"bunfig";function KK($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let J=D0.join(process.cwd(),"resources","views"),Q=D0.join(process.cwd(),"resources","layouts");if(E7.existsSync(J)&&E7.existsSync(Q))return{root:"resources",pagesDir:"views"};let X=D0.join(process.cwd(),"resources","views","pages");if(E7.existsSync(X))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function S1($){if(!$){if(r1)return r1;if(x4)return x4}let Z=$?D0.resolve($):process.cwd(),Y=C8.get(Z);if(Y)return Y;let J=(async()=>{let X=(await GK({name:"stx",alias:"ui",cwd:Z,defaultConfig:b1,verbose:!1})).config,G=KK(X.root,X.pagesDir);if(X.root=G.root,X.pagesDir=G.pagesDir,X.root&&X.root!=="."){let K=X.root;if(X.partialsDir&&!D0.isAbsolute(X.partialsDir))X.partialsDir=D0.join(K,X.partialsDir);if(X.componentsDir&&!D0.isAbsolute(X.componentsDir))X.componentsDir=D0.join(K,X.componentsDir);if(X.layoutsDir&&!D0.isAbsolute(X.layoutsDir))X.layoutsDir=D0.join(K,X.layoutsDir)}if(X.plugins&&X.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (y8(),S8)),q=[],W=[];for(let z of X.plugins){let U=typeof z==="string"?z:z[0],_=typeof z==="string"?{}:z[1]||{};try{let B,j;try{B=await import(U),j=D0.dirname(z0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);B=await import(L),j=D0.dirname(L)}let H=B.default||B;if(K.register(H,X),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=_.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{X.customDirectives=X.customDirectives||[],X.customDirectives.push(F)},addRoute:(F,O)=>{X.apiRoutes=X.apiRoutes||{},X.apiRoutes[F]=O},addMiddleware:(F)=>{X.middleware=X.middleware||[],X.middleware.push(F)},pluginDir:j,config:X};await H.setup(_,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(B){console.warn(`[stx] Failed to load plugin ${U}:`,B.message)}}X._pluginComponentDirs=q,X._pluginPageDirs=W}return X})();if(C8.set(Z,J),!$)x4=J,J.then((Q)=>{r1=Q}).catch(()=>{});return J}function qK($){return $}function zK($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`customDirectives[${Q}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Q)=>{if(!J.name||typeof J.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))Z.push({path:`middleware[${Q}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Q,X)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${X}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Q.strategy))Z.push({path:`pwa.routes[${X}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${X}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${X}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Q)=>typeof Q!=="number"||Q<16||Q>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((X)=>!J.includes(X)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var b1,r1=null,C8,x4=null,k7;var a1=S(()=>{T$();M$();I$();D$();p$();l9();w7();O8();I7();b8();b1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",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:O9,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:k8,hasEndTag:!1,description:"Include a web component in the template"},z6,W6,D8,E8,U6,B6,j6,_6,F6,A6,p9,V7,...H8],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};C8=new Map;k7=new Proxy(b1,{get($,Z){if(r1&&Z in r1)return r1[Z];if(!x4)S1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var h8={};r(h8,{resetCssCache:()=>jK,resetCrosswindCache:()=>HK,rebuildCrosswindCSS:()=>OK,loadCrosswindConfig:()=>P7,loadCrosswind:()=>C7,injectCrosswindCSS:()=>b5,getCachedCSS:()=>LK,generateCrosswindCSS:()=>g8,extractClassNames:()=>f8,buildCrosswindCSS:()=>x8});import k5 from"fs";import $0 from"path";function y7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function b7($,Z){if(Y1.has($))Y1.delete($);else if(Y1.size>=WK)Y1.delete(Y1.keys().next().value);Y1.set($,Z)}async function UK($){if(!K1)return null;try{let Z=Bun.file($0.join(K1,`cw-${y7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function _K($,Z){if(!K1)return;try{if(!k5.existsSync(K1))k5.mkdirSync(K1,{recursive:!0});await Bun.write($0.join(K1,`cw-${y7($)}.css`),Z)}catch{}}async function v8($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function BK(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==$0.dirname(Y))$.push($0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push($0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push($0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push($0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push($0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push($0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=$0.dirname(Y);if(Z){let J=[$0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),$0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),$0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),$0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),$0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),$0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push($0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push($0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function C7(){if(S7)return e1;S7=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await v8(Y);if(J){if(e1=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return e1}}let Z=BK();for(let Y of Z)if(await Bun.file(Y).exists()){let J=await v8(Y);if(J){if(e1=J,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${$0.dirname($0.dirname(Y))}`);return e1}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function jK(){Y1.clear()}function HK(){e1=null,S7=!1,c0=null,E5="",Y1.clear(),f4=null}async function P7($){try{let Z=["","config",".config"],Y=["crosswind.config","crosswind",".crosswind.config",".crosswind"],J=[".ts",".js",".mjs",".cjs",".json"];if(!Z.flatMap((q)=>Y.flatMap((W)=>J.map((z)=>$0.join(q,`${W}${z}`)))).some((q)=>k5.existsSync($0.join($,q))))return null;let{loadConfigWithResult:X}=await import("bunfig"),G=await X({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!G?.path||!G.config||Object.keys(G.config).length===0)return null;let K=$0.relative($,G.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${K||G.path}`);return G.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function x8($){if(t1)return E5;t1=!0;try{let Z=await C7();if(!Z||!Z.build)return t1=!1,"";if(!c0)c0=await P7($);if(!c0)return t1=!1,"";let Y=Z.defaultConfig?.theme||{},J=c0.theme||{},Q={...Z.defaultConfig,...c0,theme:{...Y,...J,extend:{...Y.extend||{},...J.extend||{}}}},X=performance.now(),G=await Z.build(Q),K=performance.now()-X;if(E5=G.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),Q.output){let q=$0.isAbsolute(Q.output)?Q.output:$0.join($,Q.output),W=$0.dirname(q);if(!k5.existsSync(W))k5.mkdirSync(W,{recursive:!0});await Bun.write(q,G.css)}return t1=!1,G.css}catch(Z){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,Z),t1=!1,E5}}async function OK($){c0=null,await x8($)}function LK(){return E5}function f8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,J=Y.exec($);while(J!==null){for(let G of J[1].split(/\s+/))if(G.trim())Z.add(G.trim());J=Y.exec($)}let Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,X=Q.exec($);while(X!==null){let G=X[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}X=Q.exec($)}return Z}async function g8($,Z){try{let Y=await C7();if(!Y)return"";let J=f8($);if(J.size===0)return"";let Q=Z?$0.resolve(Z):process.cwd();if(!K1)K1=$0.join(Q,".stx/cache");let X=[...J].sort().join(" "),G=`${f4||"default"}::${X}`,K=Y1.get(G);if(K!==void 0)return b7(G,K),K;let q=await UK(G);if(q!==null)return b7(G,q),q;if(!c0){let A=null;try{let{loadStxConfig:N}=await Promise.resolve().then(() => (a1(),P8)),R=await N(Q);if(R.css)if(typeof R.css==="string"){let T=$0.isAbsolute(R.css)?R.css:$0.resolve(Q,R.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=$0.isAbsolute(R.css.config)?R.css.config:$0.resolve(Q,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}c0=A||await P7(Q);try{f4=y7(JSON.stringify(c0??{}))}catch{f4="unhashable"}}let W=Y.defaultConfig||Y.config,z=c0||{},U=W.theme||{},B=(z.theme||{}).extend||{},j={...U};if(Object.keys(B).length>0)j.extend=B;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of J)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}O=F.toCSS(!0,!1);let w=O.split(`
1622
+ `);for(let[A,N]of Object.entries(V)){if(!J.has(A)&&!H.includes(A))continue;let R=N.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of R){let D=I.startsWith("dark:"),b=`.${(D?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let k=0;k<w.length;k++){let y=w[k].trim();if(y===`${b} {`||y.startsWith(`${b} {`)){let g=k,h="";while(g<w.length){if(h+=w[g],w[g].includes("}"))break;g++}let m=h.match(/\{([^}]+)\}/);if(m)if(D)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
1623
1623
  .${A} { ${T.join(" ")} }`;if(M.length)O+=`
1624
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return D7(G,O),zz(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function k5($,Z){let Y=await _8($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
1624
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return b7(G,O),_K(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function b5($,Z){let Y=await g8($,Z);if(!Y)return $;let J=`<style data-crosswind="generated">
1625
1625
  ${Y}
1626
1626
  </style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let X=!1;return $.replace(Q,()=>{if(X)return"";return X=!0,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
1627
1627
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
1628
- ${J}`);return J+$}var e1=null,I7=!1,l0=null,E5="",t1=!1,Qz=256,Y1,z1=null,x$=null;var g$=b(()=>{x3();Y1=new Map});function j8(){return`
1628
+ ${J}`);return J+$}var e1=null,S7=!1,c0=null,E5="",t1=!1,WK=256,Y1,K1=null,f4=null;var g4=S(()=>{K6();Y1=new Map});function d8(){return`
1629
1629
  // STX Lifecycle Runtime
1630
1630
  (function() {
1631
1631
  if (typeof window === 'undefined') return;
@@ -1970,7 +1970,7 @@ else {
1970
1970
 
1971
1971
  console.log('[stx] Lifecycle runtime initialized');
1972
1972
  })();
1973
- `}function b7($){return Symbol($)}var gH,hH,dH;var H8=b(()=>{gH=b7("theme"),hH=b7("router"),dH=b7("i18n")});import*as L8 from"crypto";function O8($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function Bz(){return`stx-${L8.randomBytes(4).toString("hex")}`}function jz($){return/\$\w+\./.test($)}function Hz($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(J,(X,G,z,K)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let W=[],q=!1,U=z,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...z.matchAll(_)];for(let L of B){let F=L[0],O=L[1],V=L[2];if(jz(V)){q=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),O8(A).forEach((R)=>Y.add(R)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!q)return X;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Bz(),U=` id="${H}"${U}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:O8(L.expr)});return`<${G}${U}${K}`}),{html:Q,bindings:Z,stores:Y}}function Oz($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1973
+ `}function v7($){return Symbol($)}var KO,qO,zO;var m8=S(()=>{KO=v7("theme"),qO=v7("router"),zO=v7("i18n")});import*as p8 from"crypto";function u8($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function FK(){return`stx-${p8.randomBytes(4).toString("hex")}`}function VK($){return/\$\w+\./.test($)}function wK($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(J,(X,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return X;let W=[],z=!1,U=K,_=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...K.matchAll(_)];for(let L of B){let F=L[0],O=L[1],V=L[2];if(VK(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let A=w[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),u8(A).forEach((R)=>Y.add(R)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!z)return X;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=FK(),U=` id="${H}"${U}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:u8(L.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:Y}}function AK($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1974
1974
  <script>
1975
1975
  (function() {
1976
1976
  'use strict';
@@ -1990,11 +1990,11 @@ else {
1990
1990
  `;J+=`
1991
1991
  // Binding update functions
1992
1992
  function updateBindings() {
1993
- `;for(let Q of $){let{elementId:X,attribute:G,expression:z}=Q,K=z.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")J+=` (function() {
1993
+ `;for(let Q of $){let{elementId:X,attribute:G,expression:K}=Q,q=K.replace(/\$(\w+)\./g,"$state.$1.");if(G==="text")J+=` (function() {
1994
1994
  var el = document.getElementById('${X}');
1995
1995
  if (el) {
1996
1996
  try {
1997
- el.textContent = ${K};
1997
+ el.textContent = ${q};
1998
1998
  }
1999
1999
  catch (e) { console.error('Binding error:', e); }
2000
2000
  }
@@ -2003,7 +2003,7 @@ catch (e) { console.error('Binding error:', e); }
2003
2003
  var el = document.getElementById('${X}');
2004
2004
  if (el) {
2005
2005
  try {
2006
- el.innerHTML = ${K};
2006
+ el.innerHTML = ${q};
2007
2007
  }
2008
2008
  catch (e) { console.error('Binding error:', e); }
2009
2009
  }
@@ -2012,7 +2012,7 @@ catch (e) { console.error('Binding error:', e); }
2012
2012
  var el = document.getElementById('${X}');
2013
2013
  if (el) {
2014
2014
  try {
2015
- var value = ${K};
2015
+ var value = ${q};
2016
2016
  if (typeof value === 'string') {
2017
2017
  // Dynamic class string - merge with existing static classes
2018
2018
  // eslint-disable-next-line pickier/no-unused-vars
@@ -2041,7 +2041,7 @@ catch (e) { console.error('Binding error:', e); }
2041
2041
  var el = document.getElementById('${X}');
2042
2042
  if (el) {
2043
2043
  try {
2044
- el.style.display = (${K}) ? '' : 'none';
2044
+ el.style.display = (${q}) ? '' : 'none';
2045
2045
  }
2046
2046
  catch (e) { console.error('Binding error:', e); }
2047
2047
  }
@@ -2050,7 +2050,7 @@ catch (e) { console.error('Binding error:', e); }
2050
2050
  var el = document.getElementById('${X}');
2051
2051
  if (el) {
2052
2052
  try {
2053
- el.style.visibility = (${K}) ? 'visible' : 'hidden';
2053
+ el.style.visibility = (${q}) ? 'visible' : 'hidden';
2054
2054
  }
2055
2055
  catch (e) { console.error('Binding error:', e); }
2056
2056
  }
@@ -2059,7 +2059,7 @@ catch (e) { console.error('Binding error:', e); }
2059
2059
  var el = document.getElementById('${X}');
2060
2060
  if (el) {
2061
2061
  try {
2062
- var value = ${K};
2062
+ var value = ${q};
2063
2063
  if (value === false || value === null || value === undefined) {
2064
2064
  el.removeAttribute('${G}');
2065
2065
  }
@@ -2128,10 +2128,10 @@ else {
2128
2128
  }
2129
2129
  })();
2130
2130
  </script>
2131
- `,J}function F8($){let{html:Z,bindings:Y,stores:J}=Hz($);if(Y.length===0)return $;let Q=Oz(Y,J),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var V8=()=>{};function Lz($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return Fz(Z);case"google-analytics":return Vz(Z);case"plausible":return wz(Z);case"self-hosted":return Az(Z);case"custom":return Nz(Z);default:return""}}function Fz($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Q=[`data-site="${P0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${P0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2131
+ `,J}function l8($){let{html:Z,bindings:Y,stores:J}=wK($);if(Y.length===0)return $;let Q=AK(Y,J),X=Z.lastIndexOf("</body>");if(X!==-1)return Z.slice(0,X)+Q+Z.slice(X);return Z+Q}var c8=()=>{};function NK($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return RK(Z);case"google-analytics":return TK(Z);case"plausible":return MK(Z);case"self-hosted":return IK(Z);case"custom":return DK(Z);default:return""}}function RK($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",Q=[`data-site="${P0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${P0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
2132
2132
  <!-- Fathom Analytics -->
2133
2133
  <script src="${P0(Y)}" ${Q.join(" ")}${J}></script>
2134
- `}function Vz($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=P0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
2134
+ `}function TK($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=P0(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
2135
2135
  <!-- Google Analytics -->
2136
2136
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
2137
2137
  <script>
@@ -2141,10 +2141,10 @@ else {
2141
2141
  gtag('config', '${Y}');
2142
2142
  ${J}
2143
2143
  </script>
2144
- `}function wz($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${P0(Z.domain)}"`],Q=Y,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
2144
+ `}function MK($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${P0(Z.domain)}"`],Q=Y,X=[];if(Z.trackLocalhost)X.push("local");if(Z.hashMode)X.push("hash");if(X.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${X.join(".")}.js`;return`
2145
2145
  <!-- Plausible Analytics -->
2146
2146
  <script defer data-domain="${P0(Z.domain)}" src="${P0(Q)}"></script>
2147
- `}function Az($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=P0(Z.siteId),J=P0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2147
+ `}function IK($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=P0(Z.siteId),J=P0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
2148
2148
  d.addEventListener('click',function(e){
2149
2149
  var a=e.target.closest('a');
2150
2150
  if(a&&a.hostname!==location.hostname){
@@ -2177,7 +2177,7 @@ else {
2177
2177
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
2178
2178
  })();
2179
2179
  </script>
2180
- `}function Nz($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2180
+ `}function DK($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
2181
2181
  <!-- Custom Analytics -->
2182
2182
  <script>
2183
2183
  ${Z.inlineScript}
@@ -2185,17 +2185,17 @@ ${Z.inlineScript}
2185
2185
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${P0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,X]of Object.entries(Z.attributes))Y.push(`${P0(Q)}="${P0(X)}"`);return`
2186
2186
  <!-- Custom Analytics -->
2187
2187
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${P0(Z.scriptUrl)}" defer></script>
2188
- `}function w8($,Z){let Y=Lz(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var A8=()=>{};function T8($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(Rz.has(J))Z.systemKeys.push(J);else if(J in M8)Z.mouse=J;else if(J in R8||/^[a-z]$/.test(J))Z.keys.push(R8[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Q=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(J.startsWith("throttle")){let Q=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function D8($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=J.exec($))!==null){let[X,G,z]=Q,K=Q.index,W=K+X.length,q=`__stx_evt_${Y++}`,U=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=_.exec(z))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!N8.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:T8(F.slice(1)),elementId:q})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(z))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!N8.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:T8(F.slice(1)),elementId:q})}if(U.length>0)Z.push({originalTag:X,elementId:q,events:U,startIndex:K,endIndex:W})}return Z}function Tz($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=M8[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Mz($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function Dz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Tz($),Q=Mz($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2188
+ `}function i8($,Z){let Y=NK(Z);if(!Y)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Y+$.slice(J);return $+Y}return $.replace("</head>",`${Y}</head>`)}function P0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var n8=()=>{};function r8($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let J=Y.toLowerCase();if(J==="prevent")Z.prevent=!0;else if(J==="stop")Z.stop=!0;else if(J==="once")Z.once=!0;else if(J==="capture")Z.capture=!0;else if(J==="self")Z.self=!0;else if(J==="passive")Z.passive=!0;else if(EK.has(J))Z.systemKeys.push(J);else if(J in a8)Z.mouse=J;else if(J in s8||/^[a-z]$/.test(J))Z.keys.push(s8[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Q=J.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(J.startsWith("throttle")){let Q=J.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function t8($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=J.exec($))!==null){let[X,G,K]=Q,q=Q.index,W=q+X.length,z=`__stx_evt_${Y++}`,U=[],_=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=_.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!o8.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:r8(F.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(K))!==null){let[,H,L]=B,F=H.split("."),O=F[0];if(!o8.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:r8(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:X,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function kK($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let J of Y.systemKeys)Z.push(`if (!$event.${J}Key) return`);if(Y.keys.length>0){let J=Y.keys.map((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=a8[Y.mouse];Z.push(`if ($event.button !== ${J}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function bK($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function SK($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=kK($),Q=bK($.handler,Z),X=[];if(Z.once)X.push("once: true");if(Z.capture)X.push("capture: true");if(Z.passive)X.push("passive: true");let G=X.length>0?`, { ${X.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2189
2189
  (function() {
2190
2190
  var $el = document.getElementById('${Y}');
2191
2191
  if (!$el) return;
2192
2192
  // Run mounted handler immediately (DOM is ready)
2193
2193
  var scope = $el.closest('[data-stx-scope]');
2194
2194
  if (scope && scope.__stx_execute) {
2195
- scope.__stx_execute('${z}', null, $el);
2195
+ scope.__stx_execute('${K}', null, $el);
2196
2196
  }
2197
2197
  else {
2198
- __stx_runHandler('${z}', null, $el);
2198
+ __stx_runHandler('${K}', null, $el);
2199
2199
  }
2200
2200
  })();`;if($.event==="unmounted")return`
2201
2201
  (function() {
@@ -2209,10 +2209,10 @@ else {
2209
2209
  observer.disconnect();
2210
2210
  var scope = $el.closest('[data-stx-scope]');
2211
2211
  if (scope && scope.__stx_execute) {
2212
- scope.__stx_execute('${z}', null, $el);
2212
+ scope.__stx_execute('${K}', null, $el);
2213
2213
  }
2214
2214
  else {
2215
- __stx_runHandler('${z}', null, $el);
2215
+ __stx_runHandler('${K}', null, $el);
2216
2216
  }
2217
2217
  return;
2218
2218
  }
@@ -2232,14 +2232,14 @@ else {
2232
2232
  // Find the closest reactive scope and execute within its context
2233
2233
  var scope = $el.closest('[data-stx-scope]');
2234
2234
  if (scope && scope.__stx_execute) {
2235
- scope.__stx_execute('${z}', $event, $el);
2235
+ scope.__stx_execute('${K}', $event, $el);
2236
2236
  }
2237
2237
  else {
2238
2238
  // Fallback for non-reactive context (entity-safe; decoded + run in memory)
2239
- __stx_runHandler('${z}', $event, $el);
2239
+ __stx_runHandler('${K}', $event, $el);
2240
2240
  }
2241
2241
  }${G});
2242
- })();`}function Iz($){if($.length===0)return"";return`
2242
+ })();`}function yK($){if($.length===0)return"";return`
2243
2243
  <script data-stx-events>
2244
2244
  (function() {
2245
2245
  'use strict';
@@ -2287,11 +2287,11 @@ else {
2287
2287
  }
2288
2288
 
2289
2289
  // Event listeners
2290
- ${$.flatMap((Y)=>Y.events).map(Dz).join(`
2290
+ ${$.flatMap((Y)=>Y.events).map(SK).join(`
2291
2291
  `)}
2292
2292
  })();
2293
- </script>`}function Ez($){let Z=D8($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let z=G.match(/id=["']([^"']+)["']/);if(z)for(let K of X.events)K.elementId=z[1]}for(let z of X.events){let K=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),q=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(q,"")}Y=Y.slice(0,X.startIndex)+G+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function I8($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:W}=Ez($),q=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...q,...W],K}let Q=D8($);if(Q.length===0)return $;let X=$;for(let K=Q.length-1;K>=0;K--){let W=Q[K],q=W.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=q.match(/id=["']([^"']+)["']/);if(U)for(let _ of W.events)_.elementId=U[1]}for(let U of W.events){let _=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");q=q.replace(B,""),q=q.replace(j,"")}X=X.slice(0,W.startIndex)+q+X.slice(W.endIndex)}let G=Iz(Q),z=X.lastIndexOf("</body>");if(z!==-1)X=X.slice(0,z)+G+`
2294
- `+X.slice(z);else X+=G;return X}var N8,R8,Rz,M8;var E8=b(()=>{N8=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"]),R8={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"},Rz=new Set(["ctrl","alt","shift","meta"]),M8={left:0,middle:1,right:2}});function h$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function k8($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function Sz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[Q,X,G]=J,z=J.index,K=k8(G,"x-data");if(!K)continue;let W=`__stx_scope_${b8++}`,q=k8(G,"x-init"),U=bz($,X,z+Q.length),_=$.slice(z,U.endIndex),B=yz(_);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:K,initExpr:q,bindings:[],refs:B})}return Z}function bz($,Z,Y){let J=1,Q=Y,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),z=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,z.lastIndex=Q;let K=X.exec($),W=G.exec($),q=z.exec($);if(q&&q.index<(K?.index??1/0)){Q=q.index+q[0].length;continue}if(!W)return{endIndex:$.length};if(K&&K.index<W.index)J++,Q=K.index+K[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function yz($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=J.exec(Y))!==null){let[,X,G]=Q,z=Cz(X);Z.set(G,z)}return Z}function Cz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${kz++}`}function Pz(){return`
2293
+ </script>`}function CK($){let Z=t8($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let Q=Z.length-1;Q>=0;Q--){let X=Z[Q],G=X.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=G.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,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}Y=Y.slice(0,X.startIndex)+G+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function e8($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=CK($),z=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...z,...W],q}let Q=t8($);if(Q.length===0)return $;let X=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],z=W.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=z.match(/id=["']([^"']+)["']/);if(U)for(let _ of W.events)_.elementId=U[1]}for(let U of W.events){let _=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),B=new RegExp(`\\s*${_}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${_}\\s*=\\s*'[^']*'`,"g");z=z.replace(B,""),z=z.replace(j,"")}X=X.slice(0,W.startIndex)+z+X.slice(W.endIndex)}let G=yK(Q),K=X.lastIndexOf("</body>");if(K!==-1)X=X.slice(0,K)+G+`
2294
+ `+X.slice(K);else X+=G;return X}var o8,s8,EK,a8;var $Z=S(()=>{o8=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"]),s8={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"},EK=new Set(["ctrl","alt","shift","meta"]),a8={left:0,middle:1,right:2}});function h4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ZZ($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let J=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function vK($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[Q,X,G]=J,K=J.index,q=ZZ(G,"x-data");if(!q)continue;let W=`__stx_scope_${JZ++}`,z=ZZ(G,"x-init"),U=xK($,X,K+Q.length),_=$.slice(K,U.endIndex),B=fK(_);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:z,bindings:[],refs:B})}return Z}function xK($,Z,Y){let J=1,Q=Y,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=X.exec($),W=G.exec($),z=K.exec($);if(z&&z.index<(q?.index??1/0)){Q=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)J++,Q=q.index+q[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function fK($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Q;while((Q=J.exec(Y))!==null){let[,X,G]=Q,K=gK(X);Z.set(G,K)}return Z}function gK($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${PK++}`}function hK(){return`
2295
2295
  // STX Reactive Runtime - x-cloak and transition CSS
2296
2296
  (function() {
2297
2297
  var style = document.createElement('style');
@@ -2498,25 +2498,25 @@ window.__stx_reactive = (function() {
2498
2498
 
2499
2499
  return { initScope: initScope, reactive: reactive };
2500
2500
  })();
2501
- `}function S8($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=d0(Q,Z,!0);if(X===void 0)return J;return String(X)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{try{let X=d0(Q,Z,!0);if(X===void 0)return J;if(typeof X==="string"){let G=X.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(X)}catch{return J}}),Y}function vz($,Z){if($.length===0)return"";let Y=$.map((J)=>{let Q=JSON.stringify(Object.fromEntries(J.refs)),X=S8(J.stateExpr,Z),G=J.initExpr?S8(J.initExpr,Z):null,z=JSON.stringify(X),K=G?JSON.stringify(G):"null";return`
2501
+ `}function YZ($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(J,Q)=>{try{let X=d0(Q,Z,!0);if(X===void 0)return J;return String(X)}catch{return J}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(J,Q)=>{try{let X=d0(Q,Z,!0);if(X===void 0)return J;if(typeof X==="string"){let G=X.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(X)}catch{return J}}),Y}function dK($,Z){if($.length===0)return"";let Y=$.map((J)=>{let Q=JSON.stringify(Object.fromEntries(J.refs)),X=YZ(J.stateExpr,Z),G=J.initExpr?YZ(J.initExpr,Z):null,K=JSON.stringify(X),q=G?JSON.stringify(G):"null";return`
2502
2502
  (function() {
2503
2503
  var scopeEl = document.querySelector('${J.selector}');
2504
2504
  if (!scopeEl) return;
2505
2505
  var refs = ${Q};
2506
- __stx_reactive.initScope(scopeEl, ${z}, [], refs, ${K});
2506
+ __stx_reactive.initScope(scopeEl, ${K}, [], refs, ${q});
2507
2507
  })();`}).join(`
2508
2508
  `);return`
2509
2509
  <script data-stx-scoped data-stx-reactive>
2510
- ${Pz()}
2510
+ ${hK()}
2511
2511
  ${Y}
2512
- </script>`}function y8($,Z,Y){if(b8=0,!fz($))return $;let J=Sz($);if(J.length===0)return $;let Q=xz($,J),X=vz(J,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2513
- `+Q.slice(G);else Q+=X;return Q}function xz($,Z){let Y=$;for(let J of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${h$(J.stateExpr)}["']`,"gi").exec(Y);if(X)J.id=X[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let z=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${h$(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(z)J.id=z[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${h$(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*'${h$(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function fz($){return/x-data\s*=\s*["']/.test($)}var b8=0,kz=0;var C8=b(()=>{r0()});import gz from"fs";import y7 from"path";import{createHighlighter as hz}from"ts-syntax-highlighter";async function dz($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await gz.promises.stat($)).mtime.getTime();if(Z.cache&&C7.has($)){let U=C7.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:X,content:G}=t3(Q),z=Z.markdown||M7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(z.syntaxHighlighting?.enabled&&z.syntaxHighlighting?.serverSide)W=await mz(W,z.syntaxHighlighting?.defaultTheme||"github-dark",z.syntaxHighlighting?.highlightUnknownLanguages||!1);let q={content:W,data:X||{}};if(Z.cache)C7.set($,{...q,updatedAt:J});return q}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function mz($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!d$)try{d$=await hz({theme:Z||"github-dark",cache:!0})}catch(z){return console.error("Failed to initialize ts-syntax-highlighter:",z),$}let Q=async(z,K,W,q)=>{let U=q.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=W||(Y?"text":"");if(!_)return z;try{if(!d$.getSupportedLanguages().includes(_))return z;return(await d$.highlight(U,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return z},X=$,G=$.matchAll(J);for(let z of G){let[K,W,q,U]=z,_=await Q(K,W,q,U);X=X.replace(K,_)}return X}async function P8($,Z,Y="",J={}){return await uz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,z,K,W)=>{try{let q=z;if(!y7.isAbsolute(z))q=y7.resolve(y7.dirname(Y),z);let U={};if(K)try{try{U=JSON.parse(K)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await dz(q,J),j={...Z,...B,...U},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(q){let U=q instanceof Error?q.message:String(q);return z0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function uz($,Z,Y){let J=[],Q;while((Q=Z.exec($))!==null){let z=Q[0],K=Q.index,W=Q;J.push(Y(...W).then((q)=>({match:z,replacement:q,index:K})))}let X=await Promise.all(J);X.sort((z,K)=>K.index-z.index);let G=$;for(let{match:z,replacement:K}of X)G=G.replace(z,()=>K);return G}var C7,d$=null;var v8=b(()=>{a1();N0();C7=new Map});function K1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var x8=b(()=>{T0()});function q1($,Z){let Y=pz($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function pz($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=C0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function b1($,Z,Y,J){let Q=1,X=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),z=new RegExp(`@${Y}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,z.lastIndex=X;let K=G.exec($),W=z.exec($),q=K?K.index:1/0,U=W?W.index:1/0;if(q<U)Q++,X=q+K[0].length;else if(U<1/0){if(Q--,Q===0)return U;X=U+W[0].length}else break}return-1}function f8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=q1($,J);if(!Q)return null;let X=Q.endPos,G=b1($,"if","endif",X);if(G===-1)return null;let z=$.slice(X,G),K=[],W=0,q="if",U=Q.expression,_=0,B=0;while(W<z.length){let j=z.indexOf("@",W);if(j===-1)break;W=j;let H=z.substring(j);if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){K.push({type:q,condition:U,content:z.substring(_,W),start:X+_,end:X+W});let F=W+L[0].length,O=q1(z,F);if(!O){W++;continue}q="elseif",U=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){K.push({type:q,condition:U,content:z.substring(_,W),start:X+_,end:X+W}),q="else",U=void 0,W+=5,_=W;continue}}W++}return K.push({type:q,condition:U,content:z.slice(_),start:X+_,end:X+z.length}),{fullMatch:$.slice(Z,G+6),branches:K,start:Z,end:G+6}}function S5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let X=f8($,J.index);if(X)Z.push(X),Y.lastIndex=X.end;J=Y.exec($)}return Z}function m$($,Z,Y){let J=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=Q.exec($);continue}let z=X.index,K=z+X[0].length-1,W=C0($,"(",")",K);if(W===-1){X=Q.exec($);continue}let q=$.slice(K+1,W),U=W+1,_=b1($,Z,Y,U);if(_===-1){X=Q.exec($);continue}let B=$.slice(U,_),j=_+`@${Y}`.length;J.push({fullMatch:$.slice(z,j),name:Z,params:q,content:B,start:z,end:j}),Q.lastIndex=j,X=Q.exec($)}return J}function P7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=q1($,J);if(!Q)return null;let X=Q.endPos,G=b1($,"switch","endswitch",X);if(G===-1)return null;let z=$.slice(X,G),K=[],W=0,q=null,U=0;while(W<z.length){let _=z.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(U++,q)q.content+=B[0];W+=B[0].length;continue}if(j){if(U--,q)q.content+=j[0];W+=j[0].length;continue}if(U>0){if(q)q.content+=z[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(q)K.push(q);let O=W+H[0].length,V=q1(z,O);if(!V){W++;continue}q={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(q)K.push(q);q={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(q)q.content+=z[W];W++}}if(q)K.push(q);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:K,start:Z,end:G+10}}var g8=()=>{};var u$=b(()=>{g8()});function cz($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,z=P7(J,G);if(!z)break;try{let K;if(Q0(z.expression))K=G0(z.expression,Object.keys(Z))(...Object.values(Z));else K=Y0(z.expression,Z);let W="",q=!1;for(let U of z.cases)if(U.type==="default"){if(!q)W=U.content.trim()}else try{let _;if(U.value&&Q0(U.value))_=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=Y0(U.value,Z);if(K===_){W=U.content.trim(),q=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(z.end),Q=!0}catch(K){let W=K instanceof Error?K.message:String(K),q=e("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,G)+q+J.substring(z.end);break}}return J}function y1($,Z,Y){let J=$;J=cz(J,Z,Y);{let X=!0;while(X){X=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=q1(J,z+7);if(!K)break;let W=K.endPos,q=b1(J,"unless","endunless",W);if(q===-1){console.warn(`[stx] @unless directive at position ${z} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(W,q),_=K.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${U}@endif`;J=J.substring(0,z)+j+J.substring(q+10),X=!0}}J=x7(J,Z,Y),J=f7(J,Z,Y),J=v7(J,Z);let Q=()=>{let X=S5(J);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let z=X[G];try{let K="",W=!1;for(let q of z.branches){if(W)break;if(q.type==="else")K=q.content,W=!0;else try{let U;if(q.condition&&Q0(q.condition))U=G0(q.condition,Object.keys(Z))(...Object.values(Z));else if(q.condition)U=Y0(q.condition,Z);if(U)K=q.content,W=!0}catch(U){K=e(q.type==="if"?"If":"Elseif",`Error in @${q.type}(${q.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),W=!0}}J=J.substring(0,z.start)+K+J.substring(z.end)}catch(K){let W=K instanceof Error?K.message:String(K),q=e("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,z.start)+q+J.substring(z.end)}}return!0};while(!0){let X=J;if(!Q())break;if(J===X)break}return J}function h8($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}J.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function v7($,Z){let Y=$;function J(z,K,W,q){let U=1,_=q,B=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<z.length&&U>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(z),L=j.exec(z),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,_=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;_=O+L[0].length}else break}return-1}function Q(z,K,W){let q=0,U=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=U.exec(z))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(z))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(z))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")q++;else if(L.type==="close")q--;else if(L.type==="else"&&q===0)return L.pos;return-1}{let z=!0;while(z){z=!1;let K=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let W=K.index,q,U,_=Y.slice(W+5),B=h8(_);if(B)q=B.value,U=W+5+B.consumed;else U=W+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=q?K1(`auth?.check && auth?.user?.[${q}]`,Z):K1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),z=!0}}{let z=!0;while(z){z=!1;let K=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let W=K.index,q,U,_=Y.slice(W+6),B=h8(_);if(B)q=B.value,U=W+6+B.consumed;else U=W+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=q?K1(`!auth?.check || !auth?.user?.[${q}]`,Z):K1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),z=!0}}function X(z,K,W){if(Z.userCan&&typeof Z.userCan[z]==="boolean")return Z.userCan[z];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let q=[z];if(K)q.push(K);if(W){let U=K1(W,Z);q.push(U)}return Z.permissions.check(...q)}catch{return!1}return!1}function G(z){let K=z.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let z of["can","cannot"]){let K=`end${z}`,W=z==="can"?"elsecan":"elsecannot",q=!0;while(q){q=!1;let U=Y.match(new RegExp(`@${z}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,B=Y.slice(_+`@${z}`.length),j=G(B);if(!j)break;let H=_+`@${z}`.length+j.paramsEnd,L=J(Y,z,K,H);if(L===-1){console.warn(`[stx] @${z} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${z}\\s*\\(`,"g"),A=new RegExp(`@${K}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let D=[],I=0;for(let k=0;k<O.length;k++){let y=O[k];if(D.push({content:F.slice(I,y.pos),ability:void 0}),y.type==="elseDirective"){let g=F.slice(y.pos+`@${W}`.length),h=G(g);if(h){D[D.length-1]={content:F.slice(I,y.pos)},I=y.pos+`@${W}`.length+h.paramsEnd,D.push({content:"",ability:h.ability,type:h.type,id:h.id}),D.pop();let m=O[k+1],i=m?m.pos:F.length;D.push({content:F.slice(I,i),ability:h.ability,type:h.type,id:h.id}),I=i}}else I=y.pos+5}if(I<F.length){let k=D[D.length-1];if(O.length>0&&O[O.length-1].type==="else")D.push({content:F.slice(I),isFinalElse:!0});else if(D.length===0)D.push({content:F.slice(I)})}let E=X(j.ability,j.type,j.id),P=z==="can"?E:!E,S="";if(P)S=D[0]?.content||"";else{let k=!1;for(let y=1;y<D.length;y++){let g=D[y];if(g.isFinalElse){S=g.content,k=!0;break}if(g.ability){let h=X(g.ability,g.type,g.id);if(z==="can"?h:!h){S=g.content,k=!0;break}}}if(!k&&D.length>0){let y=D[D.length-1];if(y.isFinalElse)S=y.content}}Y=Y.substring(0,_)+S+Y.substring(L+`@${K}`.length),q=!0}}return Y}function x7($,Z,Y){let J=$;function Q(X,G,z,K,W){let q=!0;while(q){q=!1;let U=new RegExp(`@${G}\\s*\\(`),_=X.match(U);if(!_||_.index===void 0)break;let B=_.index,j=q1(X,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=b1(X,G,z,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${z} \u2014 the block was skipped.`);break}let F=X.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=K(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";X=X.substring(0,B)+R+X.substring(L+`@${z}`.length),q=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(W,`Error processing @${G} directive: ${R}`,o.EVALUATION_ERROR);X=X.substring(0,B)+T+X.substring(L+`@${z}`.length);break}}return X}return J=Q(J,"isset","endisset",(X)=>{let G=K1(X,Z);return G!==void 0&&G!==null},"Isset"),J=Q(J,"empty","endempty",(X)=>{let G=K1(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function f7($,Z,Y){let J=$,Q="development";function X(G,z,K,W){let q=new RegExp(`@${z}(?![a-z])`,"g"),U=new RegExp(`@${K}(?![a-z])`,"g"),_=new RegExp(`^@${z}(?![a-z])`),B=new RegExp(`^@${K}(?![a-z])`),j=G,H=!0;while(H){H=!1,q.lastIndex=0;let L=q.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(z==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){q.lastIndex=w,U.lastIndex=w;let E=q.exec(j),P=U.exec(j),S=E?E.index:1/0,k=P?P.index:1/0;if(S<k)V++,w=S+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+P[0].length}else break}if(A===-1){console.warn(`[stx] @${z} directive at position ${F} has no matching @${K} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let P=N.substring(E);if(_.test(P)){T++,M=E+1;continue}if(B.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){R=E;break}M=E+1}let D;if(R!==-1){let E=N.slice(0,R),P=N.slice(R+5);D=W?E:P}else D=W?N:"";let I=`@${K}`.length;j=j.substring(0,F)+D+j.substring(A+I),H=!0}return j}return J=X(J,"env","endenv",!1),J=X(J,"production","endproduction",Q==="production"),J=X(J,"development","enddevelopment",Q==="development"),J=X(J,"staging","endstaging",Q==="staging"),J=X(J,"testing","endtesting",Q==="testing"),J}var p$=b(()=>{x8();Z1();u$();T0()});function m8($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function c$($,Z){if(!$)return Z?.nonceGenerator?.()??m8();let Y=d8.get($);if(!Y)Y=Z?.nonceGenerator?.()??m8(),d8.set($,Y);return Y}function lz($,Z){let Y=[];for(let[J,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(J);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(J==="script-src"||J==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function u8($,Z){return`<meta http-equiv="Content-Security-Policy" content="${lz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function p8($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?c$(Y,Z):void 0,Q=u8(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
2514
- ${Q}`)}function c8($,Z,Y,J){let Q=$,X=J.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?c$(Z,X):void 0;return u8(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return c$(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=c$(Z,X);return Q}var d8;var l8=b(()=>{d8=new WeakMap});import iz from"crypto";function oz($=nz){let Z=iz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return g7=Z,Z}function sz(){if(!g7)oz();return g7}function rz($=i8){let Z=sz();return`<input type="hidden" name="${$}" value="${Z}">`}function n8($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return rz(J||i8)})}var nz=40,i8="_token",g7=null;var o8=()=>{};async function s8($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Q=$;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)Q=await az(Q,X,Z,Y,J);else Q=await tz(Q,X,Z,Y,J)}return Q}async function az($,Z,Y,J,Q){let{name:X,handler:G}=Z,z=`@${X}`,K=`@end${X}`,W=$,q=p1(`${z}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),U=[],_=q.exec(W);while(_!==null){let[B,j="",H=""]=_,L=_.index||0;try{let F=j?r8(j):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:B,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);U.push({original:B,processed:e("CustomDirective",`Error in @${X}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}_=q.exec(W)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:H}=U[B];W=W.replace(j,H)}return W}async function tz($,Z,Y,J,Q){let{name:X,handler:G}=Z,z=$,K=p1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],q=K.exec(z);while(q!==null){let[B,j=""]=q,H=q.index||0;try{let L=r8(j),F=await G("",L,Y,J);W.push({original:B,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);W.push({original:B,processed:e("CustomDirective",`Error in @${X}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}q=K.exec(z)}let U=p1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),_=U.exec(z);while(_!==null){let[B]=_,j=_.index||0;try{let H=await G("",[],Y,J);W.push({original:B,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${X}:`,H);W.push({original:B,processed:e("CustomDirective",`Error in @${X}: ${L}`,o.EVALUATION_ERROR),startIndex:j})}_=U.exec(z)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:H}=W[B];z=z.replace(j,H)}return z}function r8($){if(!$.trim())return[];let Z=[],Y="",J=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!J)J=!0,Q=G;else if(G===Q)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var a8=b(()=>{Z1();c1()});import ez from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function l$($,Z,Y,J){let Q=$||Z;return Y?`${Q} ${J}`:Q}function $K(){return ez.randomUUID()}function i$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=$K();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${A0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${A0(X)}">`;return J}),Y}function $9($,Z,Y=e8){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,z,K,W="")=>{let q=X||G||"POST",U=z||K||"",_=W1(W),B=q.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${A0(j)}" action="${A0(U)}"${_?` ${_}`:""}>`;if(H+=`
2515
- ${i$("@csrf",Z)}`,!["GET","POST"].includes(B))H+=`
2516
- ${i$(`@method('${B}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,z,K,W="")=>{let q=X||G||"",U=z||K||"",_=W1(W),B=b5(q,Z),j=B!==void 0&&B!==null?B:U||"",H=_.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=y5(q,Z),O=_.match(/class=['"]([^'"]+)['"]/i),V=l$(O?O[1]:"",Y.input,F,Y.inputError),w=_.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(L)}" name="${A0(q)}" value="${A0(j)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",z="")=>{let K=W1(G),W=b5(X,Z)||z.trim(),q=y5(X,Z),U=K.match(/class=['"]([^'"]+)['"]/i),_=l$(U?U[1]:"",Y.input,q,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(X)}" class="${_}"${B?` ${B}`:""}>${A0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",z)=>{let K=W1(G),W=b5(X,Z),q=y5(X,Z),U=K.match(/class=['"]([^'"]+)['"]/i),_=l$(U?U[1]:"",Y.input,q,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/i,""),j=z;if(W!==void 0)j=z.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${A0(X)}" class="${_}"${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",z="")=>{let K=W1(z),W=b5(X,Z),q=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),U=K.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(X)}" value="${A0(G)}" class="${_}"${q?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,z="")=>{let K=W1(z),W=b5(X,Z),q=W!==void 0&&W===G,U=K.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(X)}" value="${A0(G)}" class="${_}"${q?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let z=W1(G),K=z.match(/accept=['"]([^'"]+)['"]/i),W=K?K[1]:"",q=z.includes("multiple"),U=y5(X,Z),_=z.match(/class=['"]([^'"]+)['"]/i),B=l$(_?_[1]:"",Y.input,U,Y.inputError),j=z.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${A0(X)}"`,`class="${B}"`];if(W)H.push(`accept="${A0(W)}"`);if(q)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",z)=>{let K=W1(G),W=K.match(/class=['"]([^'"]+)['"]/i),q=W?W[1]:Y.label,U=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(X)}" class="${q}"${U?` ${U}`:""}>${z}</label>`}),J}function Z9($,Z,Y=e8){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Q,X)=>{try{if(y5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,z)=>{try{if(z.trim()==="$message"||z.trim()==="message")return t8(Q,Z);if(z.trim().includes("errors.first")||z.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return t8(Q,Z)}let K=z.trim();if(Q0(K)){let W=Y0(K,Z);return W!==void 0?String(W):K}return K}catch{return z}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function y5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function t8($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function b5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function W1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=J.exec(Y))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var e8;var Y9=b(()=>{T0();e8={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import m7 from"path";async function ZK(){if(C5!==void 0)return C5;try{C5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{C5=null}return C5}function YK($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function JK($,Z){if({...c7,...Z.i18n}.cache&&u7[$]){let Q=u7[$],X=Z.i18n?.cacheMaxAge??0;if(!YK(Q,X))return Q.translations}if(P5[$]?.state==="loading")return P5[$].promise;h7[$]="loading";let J=p7($,Z).then((Q)=>{return h7[$]="loaded",delete P5[$],Q}).catch((Q)=>{throw h7[$]="error",P5[$]={promise:J,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return P5[$]={promise:J,state:"loading"},J}async function p7($,Z){let Y={...c7,...Z.i18n},J=m7.isAbsolute(Y.translationsDir)?Y.translationsDir:m7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await ZK(),X=Q?await Q($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:KK(Y.format)}):await XK($,Y,J);if(X===void 0){if($!==Y.defaultLocale)return p7(Y.defaultLocale,Z);return{}}let G=X;if(Y.cache)u7[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return p7(Y.defaultLocale,Z);return{}}}async function XK($,Z,Y){let J=m7.join(Y,`${$}${QK(Z.format)}`);try{let Q=await import(J);return Q.default||Q}catch(Q){try{let X=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return GK(X);if(Z.format==="json")return JSON.parse(X);throw Q}catch{return}}}function QK($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function GK($){let Z={},Y=$.split(`
2517
- `),J=[{obj:Z,indent:-1}];for(let Q of Y){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let z=J[J.length-1].obj,K=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(K){let[,,W,q]=K,U=W.trim(),_=q.trim();if(_==="")z[U]={},J.push({obj:z[U],indent:G});else z[U]=zK(_)}}return Z}function zK($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function KK($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function qK($,Z){return JK($,Z)}function WK($,Z){for(let Y of $){let J=Y.trim(),Q=J.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),z=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=z)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function UK($,Z={}){return Q9($,Z)}function Q9($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let Q=_K($,J);if(Q===-1){Y+=$[J],J++;continue}let X=$.slice(J+1,Q);Y+=BK(X,Z),J=Q+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function _K($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function BK($,Z){let Y=jK($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),Q=Z[J];if(Y.length===1)return Q!==void 0?String(Q):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return HK(Q,Y.slice(2).join(","),Z);case"select":return LK(Q,Y.slice(2).join(","));case"selectordinal":return FK(Q,Y.slice(2).join(","));case"number":return wK(Q,Y[2]?.trim());case"date":return AK(Q,Y[2]?.trim());case"time":return NK(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function jK($){let Z=[],Y="",J=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")J++,Y+=X;else if(X==="}")J--,Y+=X;else if(X===","&&J===0)Z.push(Y),Y="";else Y+=X}if(Y)Z.push(Y);return Z}function HK($,Z,Y){let J=Number($)||0,Q=l7(Z),X=`=${J}`;if(Q[X])return d7(Q[X],J,Y);let G=OK(J);if(Q[G])return d7(Q[G],J,Y);if(Q.other)return d7(Q.other,J,Y);return String(J)}function d7($,Z,Y){let J=$.replace(/#/g,String(Z));return Q9(J,Y)}function OK($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function LK($,Z){let Y=String($||""),J=l7(Z);if(J[Y])return J[Y];return J.other||String($)}function FK($,Z){let Y=Number($)||0,J=l7(Z),Q=VK(Y);if(J[Q])return J[Q].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function VK($){let Z=Math.abs($),Y=Z%10,J=Z%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 l7($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function wK($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){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 AK($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){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 NK($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){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 RK($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function J9($,Z,Y=!0,J={}){let Q=$.split("."),X=Z;for(let z of Q){if(X===void 0||X===null)break;X=X[z]}if(X===void 0||X===null)return Y?$:"";let G=String(X);if(RK(G))return UK(G,J);if(G.includes("|")&&"count"in J){let z=Number(J.count),K=G.split("|");G=WK(K,z)}for(let[z,K]of Object.entries(J)){let W=z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(K))}return G}async function G9($,Z,Y,J){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...c7,...J.i18n},z=await qK(G.locale,J);Z.__translations=z,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await X9(Q,X,async(q,U,_,B,j)=>{try{let H={};if(_)try{let F=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return R0(_,Z)}];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 J9(U,z,G.fallbackToKey,H)||B.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let K=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let q=[...Q.matchAll(K)];console.warn(`Found ${q.length} @translate matches`),q.forEach((U,_)=>console.warn(`Match ${_}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await X9(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(q,U,_,B)=>{try{let j={};if(_)try{let H=[()=>JSON.parse(_),()=>{let L=`{"data":${_}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return R0(_,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return J9(U,z,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return e("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Q}async function X9($,Z,Y){let J=[];return $.replace(Z,(X,...G)=>{let z=Y(X,...G).then((K)=>({match:X,replacement:K}));return J.push(z),X}),(await Promise.all(J)).reduce((X,{match:G,replacement:z})=>X.replace(G,z),$)}var C5,c7,u7,P5,h7;var z9=b(()=>{Z1();T0();c7={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},u7={},P5={},h7={}});var o7={};r(o7,{streamingSuspenseDirective:()=>W9,streamToResponse:()=>vK,streamTemplateSimple:()=>bK,streamTemplate:()=>MK,renderStreamingPage:()=>IK,registerStreamingDirectives:()=>CK,processStreamDirectives:()=>kK,processSectionDirectives:()=>PK,islandDirective:()=>U9,generateHydrationRuntime:()=>xK,extractStreamBoundaries:()=>SK,createStreamRenderer:()=>yK,buildSuspenseResolveScript:()=>n7,SUSPENSE_RESOLVER_RUNTIME:()=>q9});import n$ from"path";function TK($){let Z=[],Y=0,J;K9.lastIndex=0;while((J=K9.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=J[1],X=J[2];Z.push({type:"suspense",name:Q,content:X}),Y=J.index+J[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function MK($,Z={},Y={}){let J={...k1,...Y,streaming:{...i7,...Y.streaming}},Q=J.streaming?.bufferSize||16384;return new ReadableStream({async start(X){try{let G=await Bun.file($).text(),z=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=z?z[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:n$.dirname($)};if(K.trim())await M1(K,q,$);let U=TK(W),_=new Set;if(!U.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(C1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await j0(W,q,$,J,_);for(let O=0;O<F.length;O+=Q)X.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(C1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let T=await j0(R,q,$,J,_);X.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await j0(A.content,q,$,J,_);X.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await j0(A,q,$,J,_);X.enqueue(N)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await j0(L.content,q,$,J,_);X.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;X.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
2512
+ </script>`}function XZ($,Z,Y){if(JZ=0,!uK($))return $;let J=vK($);if(J.length===0)return $;let Q=mK($,J),X=dK(J,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+X+`
2513
+ `+Q.slice(G);else Q+=X;return Q}function mK($,Z){let Y=$;for(let J of Z){let X=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${h4(J.stateExpr)}["']`,"gi").exec(Y);if(X)J.id=X[1],J.selector=`[data-stx-scope="${J.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${h4(J.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)J.id=K[1],J.selector=`[data-stx-scope="${J.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${h4(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*'${h4(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function uK($){return/x-data\s*=\s*["']/.test($)}var JZ=0,PK=0;var QZ=S(()=>{r0()});import pK from"fs";import x7 from"path";import{createHighlighter as lK}from"ts-syntax-highlighter";async function cK($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await pK.promises.stat($)).mtime.getTime();if(Z.cache&&f7.has($)){let U=f7.get($);if(U.updatedAt>=J)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:X,content:G}=R6(Q),K=Z.markdown||k7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=W5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await iK(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:X||{}};if(Z.cache)f7.set($,{...z,updatedAt:J});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function iK($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!d4)try{d4=await lK({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),_=W||(Y?"text":"");if(!_)return K;try{if(!d4.getSupportedLanguages().includes(_))return K;return(await d4.highlight(U,_,{theme:Z})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return K},X=$,G=$.matchAll(J);for(let K of G){let[q,W,z,U]=K,_=await Q(q,W,z,U);X=X.replace(q,_)}return X}async function GZ($,Z,Y="",J={}){return await nK($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!x7.isAbsolute(K))z=x7.resolve(x7.dirname(Y),K);let U={};if(q)try{try{U=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 V of O){let w=V.indexOf(":");if(w>0){let A=V.substring(0,w).trim(),N=V.substring(w+1).trim(),R=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(R||T)N=N.substring(1,N.length-1);U[A]=N}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:_,data:B}=await cK(z,J),j={...Z,...B,...U},H=_,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return K0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function nK($,Z,Y){let J=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;J.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of X)G=G.replace(K,()=>q);return G}var f7,d4=null;var KZ=S(()=>{a1();A0();f7=new Map});function q1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var qZ=S(()=>{R0()});function z1($,Z){let Y=oK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function oK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let J=S0($,"(",")",Y);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,J),endPos:J+1}}function y1($,Z,Y,J){let Q=1,X=J,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<$.length&&Q>0){G.lastIndex=X,K.lastIndex=X;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)Q++,X=z+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;X=U+W[0].length}else break}return-1}function zZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=z1($,J);if(!Q)return null;let X=Q.endPos,G=y1($,"if","endif",X);if(G===-1)return null;let K=$.slice(X,G),q=[],W=0,z="if",U=Q.expression,_=0,B=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){B++,W++;continue}if(/^@endif(?![a-z])/.test(H)){B--,W+=6;continue}if(B===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:z,condition:U,content:K.substring(_,W),start:X+_,end:X+W});let F=W+L[0].length,O=z1(K,F);if(!O){W++;continue}z="elseif",U=O.expression,W=O.endPos,_=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:z,condition:U,content:K.substring(_,W),start:X+_,end:X+W}),z="else",U=void 0,W+=5,_=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(_),start:X+_,end:X+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function S5($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((G)=>J.index>G.start&&J.index<G.end)){J=Y.exec($);continue}let X=zZ($,J.index);if(X)Z.push(X),Y.lastIndex=X.end;J=Y.exec($)}return Z}function m4($,Z,Y){let J=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),X=Q.exec($);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=Q.exec($);continue}let K=X.index,q=K+X[0].length-1,W=S0($,"(",")",q);if(W===-1){X=Q.exec($);continue}let z=$.slice(q+1,W),U=W+1,_=y1($,Z,Y,U);if(_===-1){X=Q.exec($);continue}let B=$.slice(U,_),j=_+`@${Y}`.length;J.push({fullMatch:$.slice(K,j),name:Z,params:z,content:B,start:K,end:j}),Q.lastIndex=j,X=Q.exec($)}return J}function g7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,Q=z1($,J);if(!Q)return null;let X=Q.endPos,G=y1($,"switch","endswitch",X);if(G===-1)return null;let K=$.slice(X,G),q=[],W=0,z=null,U=0;while(W<K.length){let _=K.slice(W),B=_.match(/^@switch\s*\(/),j=_.match(/^@endswitch(?![a-z])/);if(B){if(U++,z)z.content+=B[0];W+=B[0].length;continue}if(j){if(U--,z)z.content+=j[0];W+=j[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let H=_.match(/^@case\s*/),L=_.match(/^@default(?![a-z])/),F=_.match(/^@break(?![a-z])/);if(H&&_.startsWith("@case")){if(z)q.push(z);let O=W+H[0].length,V=z1(K,O);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&_.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=L[0].length}else if(F&&_.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var WZ=()=>{};var UZ=()=>{};var u4=S(()=>{WZ();UZ()});function tK($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=g7(J,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let _;if(U.value&&Q0(U.value))_=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)_=Y0(U.value,Z);if(q===_){W=U.content.trim(),z=!0;break}}catch{continue}J=J.substring(0,G)+W+J.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=e("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,G)+z+J.substring(K.end);break}}return J}function C1($,Z,Y){let J=$;J=tK(J,Z,Y);{let X=!0;while(X){X=!1;let G=J.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=z1(J,K+7);if(!q)break;let W=q.endPos,z=y1(J,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=J.slice(W,z),_=q.expression,B=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],w;while((w=L.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=O.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){B=A.pos;break}}let j;if(B!==-1){let H=U.slice(0,B),L=U.slice(B+5);j=`@if (${_})${L}@else ${H}@endif`}else j=`@if (!(${_}))${U}@endif`;J=J.substring(0,K)+j+J.substring(z+10),X=!0}}J=d7(J,Z,Y),J=m7(J,Z,Y),J=h7(J,Z);let Q=()=>{let X=S5(J);if(X.length===0)return!1;for(let G=X.length-1;G>=0;G--){let K=X[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Y0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=e(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=e("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,K.start)+z+J.substring(K.end)}}return!0};while(!0){let X=J;if(!Q())break;if(J===X)break}return J}function _Z($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){J.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}J.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:J.join(""),consumed:Z}}function h7($,Z){let Y=$;function J(K,q,W,z){let U=1,_=z,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(_<K.length&&U>0){B.lastIndex=_,j.lastIndex=_;let H=B.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,_=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;_=O+L[0].length}else break}return-1}function Q(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+5),B=_Z(_);if(B)z=B.value,U=W+5+B.consumed;else U=W+5;let j=J(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?q1(`auth?.check && auth?.user?.[${z}]`,Z):q1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,_=Y.slice(W+6),B=_Z(_);if(B)z=B.value,U=W+6+B.consumed;else U=W+6;let j=J(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?q1(`!auth?.check || !auth?.user?.[${z}]`,Z):q1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),w=H.slice(L+5);O=F?V:w}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function X(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=q1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let _=U.index,B=Y.slice(_+`@${K}`.length),j=G(B);if(!j)break;let H=_+`@${K}`.length+j.paramsEnd,L=J(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${_} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],M;while((M=w.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=R.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,y)=>k.pos-y.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let y=O[k];if(I.push({content:F.slice(D,y.pos),ability:void 0}),y.type==="elseDirective"){let g=F.slice(y.pos+`@${W}`.length),h=G(g);if(h){I[I.length-1]={content:F.slice(D,y.pos)},D=y.pos+`@${W}`.length+h.paramsEnd,I.push({content:"",ability:h.ability,type:h.type,id:h.id}),I.pop();let m=O[k+1],i=m?m.pos:F.length;I.push({content:F.slice(D,i),ability:h.ability,type:h.type,id:h.id}),D=i}}else D=y.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=X(j.ability,j.type,j.id),P=K==="can"?E:!E,b="";if(P)b=I[0]?.content||"";else{let k=!1;for(let y=1;y<I.length;y++){let g=I[y];if(g.isFinalElse){b=g.content,k=!0;break}if(g.ability){let h=X(g.ability,g.type,g.id);if(K==="can"?h:!h){b=g.content,k=!0;break}}}if(!k&&I.length>0){let y=I[I.length-1];if(y.isFinalElse)b=y.content}}Y=Y.substring(0,_)+b+Y.substring(L+`@${q}`.length),z=!0}}return Y}function d7($,Z,Y){let J=$;function Q(X,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),_=X.match(U);if(!_||_.index===void 0)break;let B=_.index,j=z1(X,B+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(X,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${B} has no matching @${K} \u2014 the block was skipped.`);break}let F=X.slice(H,L),O=j.expression,V=-1,w=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let R=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){w++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){w--,A=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(R)){V=N;break}A=N+1}try{let N=q(O.trim()),R;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);R=N?T:M}else R=N?F:"";X=X.substring(0,B)+R+X.substring(L+`@${K}`.length),z=!0}catch(N){let R=N instanceof Error?N.message:String(N),T=e(W,`Error processing @${G} directive: ${R}`,s.EVALUATION_ERROR);X=X.substring(0,B)+T+X.substring(L+`@${K}`.length);break}}return X}return J=Q(J,"isset","endisset",(X)=>{let G=q1(X,Z);return G!==void 0&&G!==null},"Isset"),J=Q(J,"empty","endempty",(X)=>{let G=q1(X,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),J}function m7($,Z,Y){let J=$,Q="development";function X(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),_=new RegExp(`^@${K}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,w=O,A=-1;while(V>0&&w<j.length){z.lastIndex=w,U.lastIndex=w;let E=z.exec(j),P=U.exec(j),b=E?E.index:1/0,k=P?P.index:1/0;if(b<k)V++,w=b+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}w=k+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),R=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let P=N.substring(E);if(_.test(P)){T++,M=E+1;continue}if(B.test(P)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){R=E;break}M=E+1}let I;if(R!==-1){let E=N.slice(0,R),P=N.slice(R+5);I=W?E:P}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return J=X(J,"env","endenv",!1),J=X(J,"production","endproduction",Q==="production"),J=X(J,"development","enddevelopment",Q==="development"),J=X(J,"staging","endstaging",Q==="staging"),J=X(J,"testing","endtesting",Q==="testing"),J}var p4=S(()=>{qZ();Z1();u4();R0()});function jZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function l4($,Z){if(!$)return Z?.nonceGenerator?.()??jZ();let Y=BZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??jZ(),BZ.set($,Y);return Y}function eK($,Z){let Y=[];for(let[J,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(J);continue}if(Array.isArray(Q)){let X=[...Q];if(Z&&(J==="script-src"||J==="style-src"))X=X.filter((G)=>!G.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function HZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${eK($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function OZ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=Z.useNonce?l4(Y,Z):void 0,Q=HZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
2514
+ ${Q}`)}function LZ($,Z,Y,J){let Q=$,X=J.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let G=X.useNonce?l4(Z,X):void 0;return HZ(X.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return l4(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=l4(Z,X);return Q}var BZ;var FZ=S(()=>{BZ=new WeakMap});import $q from"crypto";function Yq($=Zq){let Z=$q.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return u7=Z,Z}function Jq(){if(!u7)Yq();return u7}function Xq($=VZ){let Z=Jq();return`<input type="hidden" name="${$}" value="${Z}">`}function wZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return Xq(J||VZ)})}var Zq=40,VZ="_token",u7=null;var AZ=()=>{};async function NZ($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Q=$;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)Q=await Qq(Q,X,Z,Y,J);else Q=await Gq(Q,X,Z,Y,J)}return Q}async function Qq($,Z,Y,J,Q){let{name:X,handler:G}=Z,K=`@${X}`,q=`@end${X}`,W=$,z=l1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],_=z.exec(W);while(_!==null){let[B,j="",H=""]=_,L=_.index||0;try{let F=j?RZ(j):[],O=H.trim(),V=await G(O,F,Y,J);U.push({original:B,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${X}:`,F);U.push({original:B,processed:e("CustomDirective",`Error in @${X}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:L})}_=z.exec(W)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:H}=U[B];W=W.replace(j,H)}return W}async function Gq($,Z,Y,J,Q){let{name:X,handler:G}=Z,K=$,q=l1(`@${X}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[B,j=""]=z,H=z.index||0;try{let L=RZ(j),F=await G("",L,Y,J);W.push({original:B,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${X}:`,L);W.push({original:B,processed:e("CustomDirective",`Error in @${X}(${j}): ${F}`,s.EVALUATION_ERROR),startIndex:H})}z=q.exec(K)}let U=l1(`@${X}(?!\\w)(?!\\s*\\()`,"g"),_=U.exec(K);while(_!==null){let[B]=_,j=_.index||0;try{let H=await G("",[],Y,J);W.push({original:B,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${X}:`,H);W.push({original:B,processed:e("CustomDirective",`Error in @${X}: ${L}`,s.EVALUATION_ERROR),startIndex:j})}_=U.exec(K)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:H}=W[B];K=K.replace(j,H)}return K}function RZ($){if(!$.trim())return[];let Z=[],Y="",J=!1,Q="";for(let X=0;X<$.length;X++){let G=$[X];if((G==='"'||G==="'")&&(X===0||$[X-1]!=="\\"))if(!J)J=!0,Q=G;else if(G===Q)J=!1;else Y+=G;else if(G===","&&!J)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((X)=>{let G=X.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var TZ=S(()=>{Z1();c1()});import Kq from"crypto";function T0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function c4($,Z,Y,J){let Q=$||Z;return Y?`${Q} ${J}`:Q}function qq(){return Kq.randomUUID()}function i4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=qq();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${T0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Q)=>{let X=Q.toUpperCase();if(Q&&!["GET","POST"].includes(X))return`<input type="hidden" name="_method" value="${T0(X)}">`;return J}),Y}function DZ($,Z,Y=IZ){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,X,G,K,q,W="")=>{let z=X||G||"POST",U=K||q||"",_=W1(W),B=z.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${T0(j)}" action="${T0(U)}"${_?` ${_}`:""}>`;if(H+=`
2515
+ ${i4("@csrf",Z)}`,!["GET","POST"].includes(B))H+=`
2516
+ ${i4(`@method('${B}')`,Z)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,X,G,K,q,W="")=>{let z=X||G||"",U=K||q||"",_=W1(W),B=y5(z,Z),j=B!==void 0&&B!==null?B:U||"",H=_.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=C5(z,Z),O=_.match(/class=['"]([^'"]+)['"]/i),V=c4(O?O[1]:"",Y.input,F,Y.inputError),w=_.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(L)}" name="${T0(z)}" value="${T0(j)}" class="${V}"${w?` ${w}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,X,G="",K="")=>{let q=W1(G),W=y5(X,Z)||K.trim(),z=C5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=c4(U?U[1]:"",Y.input,z,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(X)}" class="${_}"${B?` ${B}`:""}>${T0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,X,G="",K)=>{let q=W1(G),W=y5(X,Z),z=C5(X,Z),U=q.match(/class=['"]([^'"]+)['"]/i),_=c4(U?U[1]:"",Y.input,z,Y.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(X)}" class="${_}"${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="1",K="")=>{let q=W1(K),W=y5(X,Z),z=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(X)}" value="${T0(G)}" class="${_}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G,K="")=>{let q=W1(K),W=y5(X,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),_=U?U[1]:Y.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(X)}" value="${T0(G)}" class="${_}"${z?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,X,G="")=>{let K=W1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=C5(X,Z),_=K.match(/class=['"]([^'"]+)['"]/i),B=c4(_?_[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(X)}"`,`class="${B}"`];if(W)H.push(`accept="${T0(W)}"`);if(z)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,X,G="",K)=>{let q=W1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${T0(X)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),J}function EZ($,Z,Y=IZ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Q,X)=>{try{if(C5(Q,Z))return X.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return MZ(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return MZ(Q,Z)}let q=K.trim();if(Q0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),J}})}function C5($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function MZ($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function y5($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Y=Z[J],Y!==void 0)return Y}return Z[$]}function W1($){if(!$.trim())return"";let Z=[],Y=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=J.exec(Y))!==null){let[,X,,G]=Q;Z.push(`${X}="${G.trim()}"`)}return Z.join(" ")}var IZ;var kZ=S(()=>{R0();IZ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import c7 from"path";async function zq(){if(P5!==void 0)return P5;try{P5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{P5=null}return P5}function Wq($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Uq($,Z){if({...o7,...Z.i18n}.cache&&i7[$]){let Q=i7[$],X=Z.i18n?.cacheMaxAge??0;if(!Wq(Q,X))return Q.translations}if(v5[$]?.state==="loading")return v5[$].promise;p7[$]="loading";let J=n7($,Z).then((Q)=>{return p7[$]="loaded",delete v5[$],Q}).catch((Q)=>{throw p7[$]="error",v5[$]={promise:J,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return v5[$]={promise:J,state:"loading"},J}async function n7($,Z){let Y={...o7,...Z.i18n},J=c7.isAbsolute(Y.translationsDir)?Y.translationsDir:c7.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await zq(),X=Q?await Q($,{translationsDir:J,defaultLocale:Y.defaultLocale,sources:Oq(Y.format)}):await _q($,Y,J);if(X===void 0){if($!==Y.defaultLocale)return n7(Y.defaultLocale,Z);return{}}let G=X;if(Y.cache)i7[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return n7(Y.defaultLocale,Z);return{}}}async function _q($,Z,Y){let J=c7.join(Y,`${$}${Bq(Z.format)}`);try{let Q=await import(J);return Q.default||Q}catch(Q){try{let X=await Bun.file(J).text();if(Z.format==="yaml"||Z.format==="yml")return jq(X);if(Z.format==="json")return JSON.parse(X);throw Q}catch{return}}}function Bq($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function jq($){let Z={},Y=$.split(`
2517
+ `),J=[{obj:Z,indent:-1}];for(let Q of Y){let X=Q.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let G=X.search(/\S/);if(G===-1)continue;while(J.length>1&&J[J.length-1].indent>=G)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),_=z.trim();if(_==="")K[U]={},J.push({obj:K[U],indent:G});else K[U]=Hq(_)}}return Z}function Hq($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function Oq($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function Lq($,Z){return Uq($,Z)}function Fq($,Z){for(let Y of $){let J=Y.trim(),Q=J.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let G=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=G&&Z<=K)return X[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function Vq($,Z={}){return yZ($,Z)}function yZ($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let Q=wq($,J);if(Q===-1){Y+=$[J],J++;continue}let X=$.slice(J+1,Q);Y+=Aq(X,Z),J=Q+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Y+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Y+=$[J+1],J+=2;else Y+=$[J],J++;else Y+=$[J],J++;return Y}function wq($,Z){let Y=0;for(let J=Z;J<$.length;J++)if($[J]==="{")Y++;else if($[J]==="}"){if(Y--,Y===0)return J}return-1}function Aq($,Z){let Y=Nq($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),Q=Z[J];if(Y.length===1)return Q!==void 0?String(Q):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return Rq(Q,Y.slice(2).join(","),Z);case"select":return Mq(Q,Y.slice(2).join(","));case"selectordinal":return Iq(Q,Y.slice(2).join(","));case"number":return Eq(Q,Y[2]?.trim());case"date":return kq(Q,Y[2]?.trim());case"time":return bq(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function Nq($){let Z=[],Y="",J=0;for(let Q=0;Q<$.length;Q++){let X=$[Q];if(X==="{")J++,Y+=X;else if(X==="}")J--,Y+=X;else if(X===","&&J===0)Z.push(Y),Y="";else Y+=X}if(Y)Z.push(Y);return Z}function Rq($,Z,Y){let J=Number($)||0,Q=s7(Z),X=`=${J}`;if(Q[X])return l7(Q[X],J,Y);let G=Tq(J);if(Q[G])return l7(Q[G],J,Y);if(Q.other)return l7(Q.other,J,Y);return String(J)}function l7($,Z,Y){let J=$.replace(/#/g,String(Z));return yZ(J,Y)}function Tq($){let Z=Math.abs($),Y=Math.floor(Z),J=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&J===0)return"one";return"other"}function Mq($,Z){let Y=String($||""),J=s7(Z);if(J[Y])return J[Y];return J.other||String($)}function Iq($,Z){let Y=Number($)||0,J=s7(Z),Q=Dq(Y);if(J[Q])return J[Q].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function Dq($){let Z=Math.abs($),Y=Z%10,J=Z%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 s7($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function Eq($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){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 kq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){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 bq($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let J={};switch(Z){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 Sq($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function bZ($,Z,Y=!0,J={}){let Q=$.split("."),X=Z;for(let K of Q){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return Y?$:"";let G=String(X);if(Sq(G))return Vq(G,J);if(G.includes("|")&&"count"in J){let K=Number(J.count),q=G.split("|");G=Fq(q,K)}for(let[K,q]of Object.entries(J)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function CZ($,Z,Y,J){let Q=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...o7,...J.i18n},K=await Lq(G.locale,J);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await SZ(Q,X,async(z,U,_,B,j)=>{try{let H={};if(_)try{let F=[()=>JSON.parse(_),()=>{let O=`{"data":${_}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return N0(_,Z)}];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 bZ(U,K,G.fallbackToKey,H)||B.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return e("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...Q.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,_)=>console.warn(`Match ${_}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await SZ(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,_,B)=>{try{let j={};if(_)try{let H=[()=>JSON.parse(_),()=>{let L=`{"data":${_}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return N0(_,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return bZ(U,K,G.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return e("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),Q}async function SZ($,Z,Y){let J=[];return $.replace(Z,(X,...G)=>{let K=Y(X,...G).then((q)=>({match:X,replacement:q}));return J.push(K),X}),(await Promise.all(J)).reduce((X,{match:G,replacement:K})=>X.replace(G,K),$)}var P5,o7,i7,v5,p7;var PZ=S(()=>{Z1();R0();o7={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},i7={},v5={},p7={}});var t7={};r(t7,{streamingSuspenseDirective:()=>fZ,streamToResponse:()=>pq,streamTemplateSimple:()=>hq,streamTemplate:()=>Cq,renderStreamingPage:()=>vq,registerStreamingDirectives:()=>mq,processStreamDirectives:()=>fq,processSectionDirectives:()=>uq,islandDirective:()=>gZ,generateHydrationRuntime:()=>lq,extractStreamBoundaries:()=>gq,createStreamRenderer:()=>dq,buildSuspenseResolveScript:()=>a7,SUSPENSE_RESOLVER_RUNTIME:()=>xZ});import n4 from"path";function yq($){let Z=[],Y=0,J;vZ.lastIndex=0;while((J=vZ.exec($))!==null){if(J.index>Y){let G=$.slice(Y,J.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=J[1],X=J[2];Z.push({type:"suspense",name:Q,content:X}),Y=J.index+J[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function Cq($,Z={},Y={}){let J={...b1,...Y,streaming:{...r7,...Y.streaming}},Q=J.streaming?.bufferSize||16384;return new ReadableStream({async start(X){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:n4.dirname($)};if(q.trim())await M1(q,z,$);let U=yq(W),_=new Set;if(!U.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(P1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await j0(W,z,$,J,_);for(let O=0;O<F.length;O+=Q)X.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(P1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let A of F){if(A.start>w){let R=W.slice(w,A.start);if(R.trim()){let T=await j0(R,z,$,J,_);X.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await j0(A.content,z,$,J,_);X.enqueue(N),await new Promise((R)=>setTimeout(R,0)),w=A.end}if(w<W.length){let A=W.slice(w);if(A.trim()){let N=await j0(A,z,$,J,_);X.enqueue(N)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await j0(L.content,z,$,J,_);X.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;X.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
2518
2518
  <template data-suspense-fallback>Loading...</template>
2519
- </div>`),j.set(L.name,j0(L.content,q,$,J,_))}X.enqueue(`
2519
+ </div>`),j.set(L.name,j0(L.content,z,$,J,_))}X.enqueue(`
2520
2520
  <script>
2521
2521
  (function() {
2522
2522
  window.__stxSuspense = window.__stxSuspense || {
@@ -2532,13 +2532,13 @@ ${Q}`)}function c8($,Z,Y,J){let Q=$,X=J.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!X?
2532
2532
  }
2533
2533
  };
2534
2534
  })();
2535
- </script>`);let H=Array.from(j.entries()).map(async([L,F])=>{X.enqueue(await n7(L,F))});await Promise.all(H)}X.close()}catch(G){X.error(G)}}})}async function n7($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
2535
+ </script>`);let H=Array.from(j.entries()).map(async([L,F])=>{X.enqueue(await a7(L,F))});await Promise.all(H)}X.close()}catch(G){X.error(G)}}})}async function a7($,Z){try{let J=(await Z).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
2536
2536
  <script>
2537
2537
  window.__stxSuspense.resolve('${$}', \`${J}\`);
2538
2538
  </script>`}catch(Y){let J=Y instanceof Error?Y.message:String(Y);return`
2539
2539
  <script>
2540
2540
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${u0(J)}</div>');
2541
- </script>`}}function DK($,Z,Y){if(!Z||Z<=0)return $;let J,Q=new Promise((X,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(J))}function IK($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(q9),await Promise.all(Z.map(async(X)=>{let G=DK(X.render(),J,X.id);Q.enqueue(await n7(X.id,G))}));Q.close()}catch(X){Q.error(X)}}})}function kK($,Z){return $.replace(EK,(Y,J,Q)=>{let X=J.trim(),G=Q.split(/@fallback/i),z=G[0].trim(),K=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[X]=z,`<div data-suspense="${X}">${K}</div>`})}function SK($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,Q])=>({id:J,render:Q})):void 0}async function bK($,Z={},Y={}){let J={...k1,...Y,streaming:{...i7,...Y.streaming}},Q=J.streaming?.bufferSize||16384;return new ReadableStream({async start(X){try{let G=await Bun.file($).text(),z=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=z?z[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q={...Z,__filename:$,__dirname:n$.dirname($)};if(K.trim())await M1(K,q,$);let U=new Set,_=J.streaming?.strategy||"auto",B=new RegExp(C1.source,"g");if(!(_!=="manual"&&B.test(W))){let H=await j0(W,q,$,J,U);for(let L=0;L<H.length;L+=Q)X.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(C1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await j0(A,q,$,J,U);X.enqueue(N)}}let w=await j0(V.content,q,$,J,U);X.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await j0(V,q,$,J,U);X.enqueue(w)}}}X.close()}catch(G){X.error(G)}}})}async function yK($,Z={}){let Y={...k1,...Z,streaming:{...i7,...Z.streaming}},J=await Bun.file($).text(),Q=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),X=Q?Q[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z=G,K={},W;C1.lastIndex=0;while((W=C1.exec(G))!==null){let _=W[1],B=W[2];K[_]=B}let q=G.replace(C1,"");return{renderShell:async(_={})=>{let B={..._,__filename:$,__dirname:n$.dirname($)};return await M1(X,B,$),j0(q,B,$,Y,new Set)},renderSection:async(_,B={})=>{try{if(!K[_])return`<div class="error-message">Section "${u0(_)}" not found in template "${u0($)}"</div>`;let j={...B,__filename:$,__dirname:n$.dirname($)};await M1(X,j,$);let H=new Set;return await j0(K[_],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return z0("Expression",H,$,K[_]||"",0,K[_]||"")}},getSections:()=>{return Object.keys(K)},getTemplate:()=>{return z}}}function CK($={}){let Z=[];if($.streaming?.enabled)Z.push(W9);if($.hydration?.enabled)Z.push(U9);return Z}async function PK($,Z,Y,J={}){return $}function vK($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(X,G){G.enqueue(Y.encode(X))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:Q})}function xK($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,Q=Object.entries(Y).map(([X,G])=>`'${X}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
2541
+ </script>`}}function Pq($,Z,Y){if(!Z||Z<=0)return $;let J,Q=new Promise((X,G)=>{J=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(J))}function vq($,Z=[],Y={}){let J=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(xZ),await Promise.all(Z.map(async(X)=>{let G=Pq(X.render(),J,X.id);Q.enqueue(await a7(X.id,G))}));Q.close()}catch(X){Q.error(X)}}})}function fq($,Z){return $.replace(xq,(Y,J,Q)=>{let X=J.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[X]=K,`<div data-suspense="${X}">${q}</div>`})}function gq($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,J])=>typeof J==="function");return Y.length>0?Y.map(([J,Q])=>({id:J,render:Q})):void 0}async function hq($,Z={},Y={}){let J={...b1,...Y,streaming:{...r7,...Y.streaming}},Q=J.streaming?.bufferSize||16384;return new ReadableStream({async start(X){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:n4.dirname($)};if(q.trim())await M1(q,z,$);let U=new Set,_=J.streaming?.strategy||"auto",B=new RegExp(P1.source,"g");if(!(_!=="manual"&&B.test(W))){let H=await j0(W,z,$,J,U);for(let L=0;L<H.length;L+=Q)X.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(P1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await j0(A,z,$,J,U);X.enqueue(N)}}let w=await j0(V.content,z,$,J,U);X.enqueue(w),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let w=await j0(V,z,$,J,U);X.enqueue(w)}}}X.close()}catch(G){X.error(G)}}})}async function dq($,Z={}){let Y={...b1,...Z,streaming:{...r7,...Z.streaming}},J=await Bun.file($).text(),Q=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),X=Q?Q[1]:"",G=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;P1.lastIndex=0;while((W=P1.exec(G))!==null){let _=W[1],B=W[2];q[_]=B}let z=G.replace(P1,"");return{renderShell:async(_={})=>{let B={..._,__filename:$,__dirname:n4.dirname($)};return await M1(X,B,$),j0(z,B,$,Y,new Set)},renderSection:async(_,B={})=>{try{if(!q[_])return`<div class="error-message">Section "${u0(_)}" not found in template "${u0($)}"</div>`;let j={...B,__filename:$,__dirname:n4.dirname($)};await M1(X,j,$);let H=new Set;return await j0(q[_],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return K0("Expression",H,$,q[_]||"",0,q[_]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function mq($={}){let Z=[];if($.streaming?.enabled)Z.push(fZ);if($.hydration?.enabled)Z.push(gZ);return Z}async function uq($,Z,Y,J={}){return $}function pq($,Z={}){let Y=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(X,G){G.enqueue(Y.encode(X))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(J,{...Z,headers:Q})}function lq($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:J=!0}=$,Q=Object.entries(Y).map(([X,G])=>`'${X}': ${J?`() => import('${G}')`:`require('${G}')`}`).join(`,
2542
2542
  `);if(Z==="loader")return`
2543
2543
  (function() {
2544
2544
  window.__stx = window.__stx || {};
@@ -2680,7 +2680,7 @@ else {
2680
2680
  else {
2681
2681
  stx.hydrate();
2682
2682
  }
2683
- })();`}var i7,C1,K9,q9=`
2683
+ })();`}var r7,P1,vZ,xZ=`
2684
2684
  <script>
2685
2685
  (function(){
2686
2686
  window.__stxSuspense = window.__stxSuspense || {
@@ -2700,25 +2700,25 @@ else {
2700
2700
  }
2701
2701
  };
2702
2702
  })();
2703
- </script>`,EK,W9,U9;var s7=b(()=>{a1();r0();J$();N0();i7={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},C1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,K9=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;EK=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;W9={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},U9={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),X=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,z=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),K=z?z[1].trim():"",W=z?$.replace(z[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${X}">
2703
+ </script>`,xq,fZ,gZ;var e7=S(()=>{a1();r0();X4();A0();r7={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},P1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,vZ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;xq=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;fZ={name:"suspense",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},gZ={name:"island",hasEndTag:!0,handler:($,Z,Y,J)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),X=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${X}">
2704
2704
  ${W}
2705
2705
  <script type="application/json" data-island-props="${G}">
2706
- ${K?`{${K}}`:"{}"}
2706
+ ${q?`{${q}}`:"{}"}
2707
2707
  </script>
2708
- </div>`}}});var j9={};r(j9,{warnUnbalancedTags:()=>r7,findUnbalancedTags:()=>B9});function U1($){return $.replace(/[^\n]/g," ")}function B9($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,U1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,U1).replace(/<!--[\s\S]*?-->/g,U1).replace(/\{\{\{[\s\S]*?\}\}\}/g,U1).replace(/\{\{[\s\S]*?\}\}/g,U1).replace(/\{!![\s\S]*?!!\}/g,U1).replace(/"[^"]*"/g,U1).replace(/'[^']*'/g,U1),Y=new Map,J=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,X;while((X=Q.exec(Z))!==null){let z=X[1]==="/",K=X[2],W=X[3]==="/";if(fK.has(K.toLowerCase()))continue;if(W)continue;if(z)J.set(K,(J.get(K)??0)+1);else{let q=Y.get(K);if(q)q.count++;else{let U=Z.slice(0,X.index).split(`
2709
- `).length;Y.set(K,{count:1,firstLine:U})}}}let G=[];for(let z of new Set([...Y.keys(),...J.keys()])){if(gK.has(z.toLowerCase()))continue;let K=Y.get(z)?.count??0,W=J.get(z)??0;if(K!==W)G.push({tag:z,opened:K,closed:W,firstOpenLine:Y.get(z)?.firstLine??0})}return G}function r7($,Z){let Y;try{Y=B9($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(_9.has(J))return;_9.add(J);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:X,opened:G,closed:z,firstOpenLine:K}of Y)if(G>z){let W=K?` (first opened at line ${K})`:"";console.warn(`[stx] ${Q}: <${X}> ${G} opened, ${z} closed \u2014 an unclosed <${X}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${X}> ${G} opened, ${z} closed \u2014 ${z-G} stray </${X}>.`)}var fK,gK,_9;var a7=b(()=>{fK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),gK=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);_9=new Set});import m0 from"path";import t7 from"fs";function H9($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function O9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class L9{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=J?.__importedComponents;if(X){let B=[Q,Q.toLowerCase(),H9(Q),O9(Q)];for(let j of B)if(X.has(j))return X.get(j)}let G=[...new Set([`${Q}.stx`,`${H9(Q)}.stx`,`${O9(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let B=m0.resolve(m0.dirname(Z),`${Q}.stx`);if(await n(B))return B;return null}let z=[],K=Y.componentsDir||"",W=J?.__originalFilePath;if(W)z.push(m0.join(m0.dirname(W),"components"));if(K)z.push(K);let q=m0.join(m0.dirname(Z),"components");if(!z.includes(q))z.push(q);let U=process.cwd(),_=[m0.resolve(U,"src/components"),m0.resolve(U,"components"),m0.resolve(import.meta.dir,"components")];for(let B of _)if(!z.includes(B))z.push(B);for(let B of z){if(!B)continue;for(let j of G){let H=m0.join(B,j);if(await n(H))return H}try{if(!t7.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=t7.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=m0.join(B,L.name);for(let O of G){let V=m0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var b0;var e7=b(()=>{N0();b0=new L9});function _1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function hK($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var F9;var V9=b(()=>{F9={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=hK($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",z=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,K=[];if(J.reactive)K.push(`:href="${_1(J.value)}"`);else K.push(`href="${_1(J.value)}"`);if(Q)K.push(`class="${_1(Q)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${_1(X)}"`),K.push(`data-stx-exact-active-class="${_1(G)}"`),z)K.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[q,U]of Object.entries($.static)){if(W.has(q))continue;if(typeof U==="boolean"){if(U)K.push(_1(q))}else K.push(`${_1(q)}="${_1(U)}"`)}return`<a ${K.join(" ")}>${Z}</a>`}}});function L0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Z3($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function w9($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[Q,X]=J.split(":"),G=dK[Q];if(G)Y.push(`(max-width: ${G}px) ${X}`);else{let z=Number.parseInt(Q);if(!Number.isNaN(z))Y.push(`(max-width: ${z}px) ${X}`)}}else Y.push(J);return Y.join(", ")}function Y3($,Z,Y,J){return Z.map((Q)=>`${v5($,Q,void 0,Y,J)} ${Q}w`).join(", ")}function mK($,Z,Y,J,Q){return Z.map((X)=>{let G=Y?Y*X:void 0;return`${v5($,G,void 0,J,Q)} ${X}x`}).join(", ")}function v5($,Z,Y,J,Q){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(Y)X.push(`h_${Y}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(Y)X.set("h",String(Y));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(J==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(Y)X.set("height",String(Y));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function uK($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var dK,$3,A9;var N9=b(()=>{dK={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$3=[320,640,768,1024,1280,1536,1920];A9={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=E0($,"src")||"",Q=E0($,"alt")||"",X=E0($,"width"),G=E0($,"height"),z=E0($,"sizes"),K=E0($,"srcset"),W=E0($,"densities"),q=E0($,"format"),U=E0($,"placeholder"),_=E0($,"placeholderColor")||"#e5e7eb",B=E0($,"provider"),j=E0($,"class")||E0($,"className")||"",H=E0($,"style")||"",L=E0($,"quality"),F=Z3($,"lazy",!0),O=Z3($,"preload",!1),V=Z3($,"picture",!1)||!!q,w=X?Number.parseInt(X):void 0,A=G?Number.parseInt(G):void 0,N=K||"",R="";if(!N&&z)N=Y3(J,$3,B,q),R=w9(z);else if(!N&&W){let S=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=mK(J,S,w,B,q)}else if(z)R=w9(z);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=uK(w||16,A||9,_);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${L0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=v5(J,w,A,B,q),D=[];if(D.push(`src="${L0(M)}"`),D.push(`alt="${L0(Q)}"`),X)D.push(`width="${L0(X)}"`);if(G)D.push(`height="${L0(G)}"`);if(F)D.push('loading="lazy"');if(D.push('decoding="async"'),j)D.push(`class="${L0(j)}"`);if(T.length>0)D.push(`style="${L0(T.join(";"))}"`);if(N)D.push(`srcset="${L0(N)}"`);if(R)D.push(`sizes="${L0(R)}"`);let I=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,k]of Object.entries($.static)){if(I.has(S))continue;if(typeof k==="boolean"){if(k)D.push(L0(S))}else D.push(`${L0(S)}="${L0(k)}"`)}let E=`<img ${D.join(" ")} />`,P="";if(O){let k=q==="webp"?"image/webp":q==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${L0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${L0(N)}"`:""}${R?` imagesizes="${L0(R)}"`:""} />
2710
- `}if(V){let S=[];if(q==="avif"||q==="auto"){let k=v5(J,w,A,B,"avif"),y=N?Y3(J,$3,B,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${L0(y)}"${R?` sizes="${L0(R)}"`:""} />`)}if(q==="webp"||q==="auto"){let k=v5(J,w,A,B,"webp"),y=N?Y3(J,$3,B,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${L0(y)}"${R?` sizes="${L0(R)}"`:""} />`)}return`${P}<picture>
2711
- ${S.join(`
2708
+ </div>`}}});var mZ={};r(mZ,{warnUnbalancedTags:()=>$3,findUnbalancedTags:()=>dZ});function U1($){return $.replace(/[^\n]/g," ")}function dZ($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,U1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,U1).replace(/<!--[\s\S]*?-->/g,U1).replace(/\{\{\{[\s\S]*?\}\}\}/g,U1).replace(/\{\{[\s\S]*?\}\}/g,U1).replace(/\{!![\s\S]*?!!\}/g,U1).replace(/"[^"]*"/g,U1).replace(/'[^']*'/g,U1),Y=new Map,J=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b[^>]*?(\/?)>/g,X;while((X=Q.exec(Z))!==null){let K=X[1]==="/",q=X[2],W=X[3]==="/";if(cq.has(q.toLowerCase()))continue;if(W)continue;if(K)J.set(q,(J.get(q)??0)+1);else{let z=Y.get(q);if(z)z.count++;else{let U=Z.slice(0,X.index).split(`
2709
+ `).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...J.keys()])){if(iq.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=J.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function $3($,Z){let Y;try{Y=dZ($)}catch{return}if(Y.length===0)return;let J=`${Z}:${$.length}`;if(hZ.has(J))return;hZ.add(J);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:X,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${X}> ${G} opened, ${K} closed \u2014 an unclosed <${X}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${X}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${X}>.`)}var cq,iq,hZ;var Z3=S(()=>{cq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),iq=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);hZ=new Set});import m0 from"path";import Y3 from"fs";function uZ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function pZ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class lZ{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,X=J?.__importedComponents;if(X){let B=[Q,Q.toLowerCase(),uZ(Q),pZ(Q)];for(let j of B)if(X.has(j))return X.get(j)}let G=[...new Set([`${Q}.stx`,`${uZ(Q)}.stx`,`${pZ(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let B=m0.resolve(m0.dirname(Z),`${Q}.stx`);if(await n(B))return B;return null}let K=[],q=Y.componentsDir||"",W=J?.__originalFilePath;if(W)K.push(m0.join(m0.dirname(W),"components"));if(q)K.push(q);let z=m0.join(m0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),_=[m0.resolve(U,"src/components"),m0.resolve(U,"components"),m0.resolve(import.meta.dir,"components")];for(let B of _)if(!K.includes(B))K.push(B);for(let B of K){if(!B)continue;for(let j of G){let H=m0.join(B,j);if(await n(H))return H}try{if(!Y3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Y3.readdirSync(B,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=m0.join(B,L.name);for(let O of G){let V=m0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var y0;var J3=S(()=>{A0();y0=new lZ});function _1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nq($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var X3;var Q3=S(()=>{X3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let J=nq($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),X=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(J.reactive)q.push(`:href="${_1(J.value)}"`);else q.push(`href="${_1(J.value)}"`);if(Q)q.push(`class="${_1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${_1(X)}"`),q.push(`data-stx-exact-active-class="${_1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[z,U]of Object.entries($.static)){if(W.has(z))continue;if(typeof U==="boolean"){if(U)q.push(_1(z))}else q.push(`${_1(z)}="${_1(U)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function L0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function K3($,Z,Y=!1){let J=$.serverDynamic[Z];if(J!==void 0)return J!==!1&&J!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function cZ($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let J of Z)if(J.includes(":")){let[Q,X]=J.split(":"),G=oq[Q];if(G)Y.push(`(max-width: ${G}px) ${X}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${X}`)}}else Y.push(J);return Y.join(", ")}function q3($,Z,Y,J){return Z.map((Q)=>`${x5($,Q,void 0,Y,J)} ${Q}w`).join(", ")}function sq($,Z,Y,J,Q){return Z.map((X)=>{let G=Y?Y*X:void 0;return`${x5($,G,void 0,J,Q)} ${X}x`}).join(", ")}function x5($,Z,Y,J,Q){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let X=[];if(Z)X.push(`w_${Z}`);if(Y)X.push(`h_${Y}`);if(Q)X.push(`f_${Q}`);X.push("q_auto");let G=X.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(J==="imgix"){let X=new URLSearchParams;if(Z)X.set("w",String(Z));if(Y)X.set("h",String(Y));if(Q)X.set("fm",Q);X.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}if(J==="bunny"){let X=new URLSearchParams;if(Z)X.set("width",String(Z));if(Y)X.set("height",String(Y));if(Q)X.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${X.toString()}`}return $}function rq($,Z,Y="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var oq,G3,z3;var W3=S(()=>{oq={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},G3=[320,640,768,1024,1280,1536,1920];z3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let J=E0($,"src")||"",Q=E0($,"alt")||"",X=E0($,"width"),G=E0($,"height"),K=E0($,"sizes"),q=E0($,"srcset"),W=E0($,"densities"),z=E0($,"format"),U=E0($,"placeholder"),_=E0($,"placeholderColor")||"#e5e7eb",B=E0($,"provider"),j=E0($,"class")||E0($,"className")||"",H=E0($,"style")||"",L=E0($,"quality"),F=K3($,"lazy",!0),O=K3($,"preload",!1),V=K3($,"picture",!1)||!!z,w=X?Number.parseInt(X):void 0,A=G?Number.parseInt(G):void 0,N=q||"",R="";if(!N&&K)N=q3(J,G3,B,z),R=cZ(K);else if(!N&&W){let b=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=sq(J,b,w,B,z)}else if(K)R=cZ(K);let T=[];if(H)T.push(H);if(w&&A)T.push(`aspect-ratio:${w}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let b=rq(w||16,A||9,_);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${L0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=x5(J,w,A,B,z),I=[];if(I.push(`src="${L0(M)}"`),I.push(`alt="${L0(Q)}"`),X)I.push(`width="${L0(X)}"`);if(G)I.push(`height="${L0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${L0(j)}"`);if(T.length>0)I.push(`style="${L0(T.join(";"))}"`);if(N)I.push(`srcset="${L0(N)}"`);if(R)I.push(`sizes="${L0(R)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[b,k]of Object.entries($.static)){if(D.has(b))continue;if(typeof k==="boolean"){if(k)I.push(L0(b))}else I.push(`${L0(b)}="${L0(k)}"`)}let E=`<img ${I.join(" ")} />`,P="";if(O){let k=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${L0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${L0(N)}"`:""}${R?` imagesizes="${L0(R)}"`:""} />
2710
+ `}if(V){let b=[];if(z==="avif"||z==="auto"){let k=x5(J,w,A,B,"avif"),y=N?q3(J,G3,B,"avif"):`${k}`;b.push(`<source type="image/avif" srcset="${L0(y)}"${R?` sizes="${L0(R)}"`:""} />`)}if(z==="webp"||z==="auto"){let k=x5(J,w,A,B,"webp"),y=N?q3(J,G3,B,"webp"):`${k}`;b.push(`<source type="image/webp" srcset="${L0(y)}"${R?` sizes="${L0(R)}"`:""} />`)}return`${P}<picture>
2711
+ ${b.join(`
2712
2712
  `)}
2713
2713
  ${E}
2714
- </picture>`}return`${P}${E}`}}});function B1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var pK="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",R9;var T9=b(()=>{R9={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=$5($,"src")||"",Q=$5($,"alt")||"",X=$5($,"fallback")||"/images/safe-image-default.svg",G=$5($,"class")||$5($,"className")||"",z=$5($,"fallbackClassName")||"",K=[];if(K.push(`src="${B1(J)}"`),K.push(`alt="${B1(Q)}"`),G)K.push(`class="${B1(G)}"`);if(K.push(`data-fallback="${B1(X)}"`),z)K.push(`data-fallback-class="${B1(z)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[_,B]of Object.entries($.static)){if(W.has(_))continue;if(typeof B==="boolean"){if(B)K.push(B1(_))}else K.push(`${B1(_)}="${B1(B)}"`)}let q=`<img ${K.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${pK}${q}`;return q}}});function J3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function x5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function o$($,Z,Y){let J=x5($,Z);if(J!==void 0){let Q=Number.parseInt(J,10);if(!Number.isNaN(Q))return Q}return Y}var M9;var D9=b(()=>{M9={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=J3(x5($,"color")||"#6366f1"),Q=J3(x5($,"initialColor")||x5($,"initial-color")||""),X=J3(x5($,"height")||"3px"),G=o$($,"duration",2000),z=o$($,"throttle",200),K=o$($,"zIndex",999999)||o$($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${J})`:J;return`
2715
- <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${X};background:${W};z-index:${K};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
2714
+ </picture>`}return`${P}${E}`}}});function B1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var aq="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",U3;var _3=S(()=>{U3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let J=$5($,"src")||"",Q=$5($,"alt")||"",X=$5($,"fallback")||"/images/safe-image-default.svg",G=$5($,"class")||$5($,"className")||"",K=$5($,"fallbackClassName")||"",q=[];if(q.push(`src="${B1(J)}"`),q.push(`alt="${B1(Q)}"`),G)q.push(`class="${B1(G)}"`);if(q.push(`data-fallback="${B1(X)}"`),K)q.push(`data-fallback-class="${B1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[_,B]of Object.entries($.static)){if(W.has(_))continue;if(typeof B==="boolean"){if(B)q.push(B1(_))}else q.push(`${B1(_)}="${B1(B)}"`)}let z=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${aq}${z}`;return z}}});function B3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function f5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function o4($,Z,Y){let J=f5($,Z);if(J!==void 0){let Q=Number.parseInt(J,10);if(!Number.isNaN(Q))return Q}return Y}var j3;var H3=S(()=>{j3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let J=B3(f5($,"color")||"#6366f1"),Q=B3(f5($,"initialColor")||f5($,"initial-color")||""),X=B3(f5($,"height")||"3px"),G=o4($,"duration",2000),K=o4($,"throttle",200),q=o4($,"zIndex",999999)||o4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${J})`:J;return`
2715
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${X};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
2716
2716
  <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>
2717
2717
  </div>
2718
2718
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
2719
2719
  <script>
2720
- (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${z})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
2721
- </script>`}}});function i0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E9($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function cK($,Z,Y){let J=E9($,Z);if(J!==void 0){let Q=Number.parseInt(J,10);if(!Number.isNaN(Q))return Q}return Y}var I9,k9;var S9=b(()=>{I9={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},k9={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=i0(E9($,"position")||"top-right"),Q=cK($,"max",5),X=I9[J]||I9["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
2720
+ (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)},${K})},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()})})();
2721
+ </script>`}}});function i0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nZ($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function tq($,Z,Y){let J=nZ($,Z);if(J!==void 0){let Q=Number.parseInt(J,10);if(!Number.isNaN(Q))return Q}return Y}var iZ,O3;var L3=S(()=>{iZ={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},O3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let J=i0(nZ($,"position")||"top-right"),Q=tq($,"max",5),X=iZ[J]||iZ["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Q}" style="position:fixed;${X};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
2722
2722
  <style>
2723
2723
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
2724
2724
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -2726,8 +2726,8 @@ ${E}
2726
2726
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
2727
2727
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
2728
2728
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
2729
- </style>`}}});function s$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var b9,y9;var C9=b(()=>{b9={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},y9={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=s$($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=i0(J),X=s$($,"size")||"md",G=s$($,"closeOnBackdrop")!=="false",z=s$($,"closeOnEscape")!=="false",K=b9[X]||b9.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${z}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
2730
- <div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
2729
+ </style>`}}});function s4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var oZ,F3;var V3=S(()=>{oZ={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},F3={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let J=s4($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=i0(J),X=s4($,"size")||"md",G=s4($,"closeOnBackdrop")!=="false",K=s4($,"closeOnEscape")!=="false",q=oZ[X]||oZ.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" data-close-backdrop="${G}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
2730
+ <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
2731
2731
  <div style="padding:1.5rem">${Z}</div>
2732
2732
  </div>
2733
2733
  </div>
@@ -2735,8 +2735,8 @@ ${E}
2735
2735
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
2736
2736
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
2737
2737
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
2738
- </style>`}}});function Z5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var P9,v9;var x9=b(()=>{P9={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},v9={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=Z5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=i0(J),X=Z5($,"side")||"right",G=Z5($,"size")||"md",z=Z5($,"closeOnBackdrop")!=="false",K=Z5($,"closeOnEscape")!=="false",W=Z5($,"overlay")!=="false",q=P9[G]||P9.md,U=X==="left",_=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${z}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
2739
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${_};width:${q};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
2738
+ </style>`}}});function Z5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var sZ,w3;var A3=S(()=>{sZ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},w3={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let J=Z5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=i0(J),X=Z5($,"side")||"right",G=Z5($,"size")||"md",K=Z5($,"closeOnBackdrop")!=="false",q=Z5($,"closeOnEscape")!=="false",W=Z5($,"overlay")!=="false",z=sZ[G]||sZ.md,U=X==="left",_=U?"left:0":"right:0",B=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" data-close-backdrop="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
2739
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${_};width:${z};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
2740
2740
  <div style="padding:1.5rem">${Z}</div>
2741
2741
  </div>
2742
2742
  </div>
@@ -2744,18 +2744,18 @@ ${E}
2744
2744
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
2745
2745
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
2746
2746
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
2747
- </style>`}}});var g9={};r(g9,{preloadIconCollection:()=>sK,IconBuiltin:()=>X3});import{existsSync as lK,readFileSync as iK}from"fs";function f9($){try{return q0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(lK(Y))return Y;return null}function nK($){if(P1.has($))return P1.get($);let Z=f9($);if(!Z)return null;try{let Y=JSON.parse(iK(Z,"utf8"));return P1.set($,Y.icons),Y.icons}catch{return null}}async function oK($){if(P1.has($))return P1.get($);let Z=f9($);if(!Z)return null;try{let Y=await Bun.file(Z).json();return P1.set($,Y.icons),Y.icons}catch{return null}}function Y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function sK($="lucide"){await oK($)}var P1,X3;var Q3=b(()=>{P1=new Map;X3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=Y5($,"name")??Y5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=J;if(J.includes(":")){let O=J.split(":");Q=O[0],X=O[1]}let G=i0(Y5($,"size")||"24"),z=i0(Y5($,"color")||"currentColor"),K=i0(Y5($,"class")||""),W=i0(Y5($,"style")||""),q=P1.get(Q)??nK(Q);if(!q)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=q[X];if(!U)return`<!-- Icon: "${X}" not found in ${Q} -->`;let _=U.width||24,B=U.height||24,j=`0 0 ${_} ${B}`,H=U.body;if(z!=="currentColor")H=H.replace(/currentColor/g,z);let L=K?` class="${K}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function h9($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function d9($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var m9;var u9=b(()=>{m9={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=d9(Z,"fallback"),Q=J.rest,X=d9(Q,"error"),G=X.rest,z=J.region??h9($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=X.region??h9($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${z}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function r$($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var p9;var c9=b(()=>{p9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(r$($,"name")||"v").replace(/["'<>]/g,""),Q=(r$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",X=r$($,"class"),G=r$($,"id"),z=[`data-stx-transition-group="${J}"`,X?`class="${X}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${z}>${Z}</${Q}>`}}});function l9(){b0.registerBuiltin(F9),b0.registerBuiltin(A9),b0.registerBuiltin(R9),b0.registerBuiltin(M9),b0.registerBuiltin(k9),b0.registerBuiltin(y9),b0.registerBuiltin(v9),b0.registerBuiltin(X3),b0.registerBuiltin(m9),b0.registerBuiltin(p9)}var i9=b(()=>{e7();V9();N9();T9();D9();S9();C9();x9();Q3();u9();c9()});function n9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function o9($,Z,Y){let J=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let z=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!z){Q=X+1;continue}let K=z[1];if(Y&&Y.has(K.toLowerCase())){let H=X+1+K.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=X+1+K.length,q=null,U=W,_=-1,B=!1;while(W<$.length){let H=$[W];if(q){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===q)q=null;W++;continue}if(H==='"'||H==="'"){q=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){_=W+2,B=!0;break}if(H===">"){_=W+1;break}W++}if(_===-1){Q=X+1;continue}let j=$.slice(U,B?_-2:_-1).trim();if(B)J.push({fullMatch:$.slice(X,_),tagName:K,attributes:j,content:"",startIndex:X,endIndex:_,isSelfClosing:!0}),Q=_;else{let H=`<${K}`,L=`</${K}>`,F=1,O=_,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
2748
- `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=_;continue}let w=$.slice(_,V),A=V+L.length;J.push({fullMatch:$.slice(X,A),tagName:K,attributes:j,content:w,startIndex:X,endIndex:A,isSelfClosing:!1}),Q=A}}return J}function s9($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var r9=b(()=>{t5()});var YY={};r(YY,{processESImports:()=>ZY,processComponents:()=>t$});import a$ from"fs";import v0 from"path";function aK($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),X=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(z,K)=>K.toUpperCase())};for(let[G,z]of Object.entries($)){let K=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(K.startsWith("@")){J.events[K]=z;continue}if(K.startsWith("__stx_")){let W=X(K.slice(6));J.serverDynamic[W]=s9(z,Y);continue}if(K.startsWith(":")){let W=X(K.slice(1)),q=z==="true"?W:z;try{if(!Q0(q)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${q}`);J.clientReactive[W]=q;continue}let U=Object.keys(Z),B=G0(q,U)(...Object.values(Z));if(B===void 0){let j=q.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[W]=q;continue}}J.serverDynamic[W]=B}catch{J.clientReactive[W]=q}continue}if(typeof z==="string"&&z.includes("{{")&&z.includes("}}")){let W=z.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let q=W[1];if(Q0(q)){let _=G0(q,Object.keys(Z))(...Object.values(Z));J.static[K]=_!=null?String(_):""}else{if(Y.debug)console.error(`Unsafe expression in ${K}: ${q}`);J.static[K]=z}}catch(q){if(Y.debug)console.error(`Error evaluating expression for ${K}:`,q);J.static[K]=z}else{let q=z,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(z))!==null)try{let B=_[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${K}: ${B}`);continue}let H=G0(B,Object.keys(Z))(...Object.values(Z));q=q.replace(_[0],String(H??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${K}:`,B)}J.static[K]=q}continue}J.static[K]=z}return J}function tK($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let Q="";while(Y<J&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let X="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let z=$[Y];if(z==="\\"&&Y+1<J){Y++,X+=$[Y],Y++;continue}if(z===G){Y++;break}X+=z,Y++}}else while(Y<J&&!/\s/.test($[Y]))X+=$[Y],Y++;Z[Q]=X}else Z[Q]="true"}return Z}function t9($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function eK($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let Q=J[1];if(b0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function $q($){let Z=e9.get($);if(Z)return Z;let Y=new Map,J=[v0.join($,"src"),v0.join($,"dist"),$];function Q(X,G){if(G>6)return;let z;try{z=a$.readdirSync(X,{withFileTypes:!0})}catch{return}for(let K of z){let W=v0.join(X,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;Q(W,G+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let q=K.name.slice(0,-4);if(!Y.has(q))Y.set(q,W);let U=q.toLowerCase();if(!Y.has(U))Y.set(U,W);let _=q.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let X of J)if(Q(X,0),Y.size>0)break;return e9.set($,Y),Y}function Zq($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=v0.join(Y,"node_modules",$);try{if(a$.statSync(J).isDirectory())return J}catch{}let Q=v0.dirname(Y);if(Q===Y)return null;Y=Q}}async function ZY($,Z,Y,J,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let X=Z.__importedComponents,G=v0.dirname(Y),z=$,K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return z=z.replace(K,(W,q,U)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,j,H=[];while((j=_.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(a$.statSync(M).isFile())A=M}catch{try{if(a$.statSync(T).isDirectory())w=T}catch{}}}}else w=Zq(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{X.set(T,M),X.set(T.toLowerCase(),M);let D=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();X.set(D,M),Q.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((D)=>D.trim()).filter(Boolean).map((D)=>{let I=D.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(I)return{source:I[1],local:I[2]};return{source:D,local:D}}),M=w?$q(w):null;for(let{source:D,local:I}of T){let E=null;if(A)E=A;else if(M)E=M.get(D)??M.get(D.toLowerCase())??M.get(D.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(I,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${q}>${B}</script>`}),z}async function Yq($,Z,Y,J,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,z=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=z.exec(X))!==null){let[W,q]=K,U=q.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${_}.stx`),v0.resolve(v0.dirname(Y),_),v0.resolve(J.componentsDir||"components",`${_}.stx`),v0.resolve(J.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${_}`)}X=X.replace(W,""),z.lastIndex=0}return X}async function Jq($,Z,Y,J,Q){let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=/@component\s*\(/g,W;while((W=K.exec(X))!==null){let q=W.index,U=q+W[0].length-1,_=1,B=U+1;while(B<X.length&&_>0){if(X[B]==="(")_++;else if(X[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=X.substring(U+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){K.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=R0(O,Z)}catch(I){let E=I instanceof Error?I.message:String(I);X=X.replace(X.substring(q,H),`[Error parsing component props: ${E}]`);continue}let N="",R=H,M=X.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let D=await i1(F,A,N,G,Z,Y,J,z,Q);X=X.substring(0,q)+D+X.substring(R),K.lastIndex=0}return X}async function Xq($,Z,Y,J,Q){if(!$)return $;let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let z=Z.__processedComponents,K=I4(X);return X=K.output,X=await _(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await _(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await _(X,/[a-z][a-z0-9]*/,!1,rK),X=E4(X,K.scripts),X;async function _(B,j,H,L){if(!B)return B;let F=B,O=o9(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?n9(w.tagName):w.tagName,N=tK(w.attributes),R=aK(N,Z,J),T=b0.getBuiltin(w.tagName),M=T?await m6(A,G,Z,Y,J):!1;if(T&&!M){let P={context:Z,filePath:Y,options:J,dependencies:Q},S=T.render(R,w.content,P);if(Object.keys(R.clientReactive).length>0)S=$Y(S,R.clientReactive);if(Object.keys(R.events).length>0){let k=Object.entries(R.events).map(([y,g])=>`${y}="${t9(g)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+S+F.substring(w.endIndex);continue}let D={};for(let[P,S]of Object.entries(R.static))D[P]=S;for(let[P,S]of Object.entries(R.serverDynamic))D[P]=S;let E=await i1(A,D,w.content,G,Z,Y,J,z,Q);if(Object.keys(R.clientReactive).length>0)E=$Y(E,R.clientReactive);if(Object.keys(R.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let S=Object.entries(R.events).map(([y,g])=>`${y}="${t9(g)}"`).join(" "),k=P[1].length+P[2].length;E=E.substring(0,k)+" "+S+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function $Y($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let J=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+J+$.substring(Q)}async function t$($,Z,Y,J,Q){if(!a9)l9(),a9=!0;let X=await ZY($,Z,Y,J,Q);X=await Yq(X,Z,Y,J,Q),X=await Jq(X,Z,Y,J,Q);for(let G=0;G<3;G++){let z=X;if(X=await Xq(X,Z,Y,J,Q),X===z)break}if(J.debug){let G=eK(X);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return X}var a9=!1,rK,e9;var G3=b(()=>{e7();i9();r9();N0();T0();rK=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"]);e9=new Map});var qY={};r(qY,{processLoops:()=>z3});function zq($,Z){let Y=/@component\s*\(/g,J=$,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q.index,z=G+Q[0].length-1,K=1,W=z+1;while(W<J.length&&K>0){if(J[W]==="(")K++;else if(J[W]===")"){if(K--,K===0)break}W++}if(K!==0)continue;let q=J.substring(z+1,W),U=W+1,_=q.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=q.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=R0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;X.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:z,end:K,replacement:W}=X[G];J=J.substring(0,z)+W+J.substring(K)}return J}function e$($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(J))!==null){let G=X.index,z=G+X[0].length-1,K=1,W=z+1,q=null,U=!1;while(W<J.length&&K>0){let j=J[W];if(U){U=!1,W++;continue}if(j==="\\"&&q){U=!0,W++;continue}if(q){if(j===q)q=null;W++;continue}if(j==='"'||j==="'"||j==="`"){q=j,W++;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0)break}W++}if(K!==0)break;let _=J.substring(z+1,W),B=Y(_);J=J.substring(0,G)+B+J.substring(W+1)}return J}function Kq($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Q,X)=>{try{let G=Object.keys(Z),z=Object.values(Z);o5(X);let W=G0(X,G)(...z),q=JSON.stringify(W),U=Buffer.from(q,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return J}}),Y}function qq($,Z){let Y=$;return Y=e$(Y,"@break",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let z=G0(X,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Y0(X,Z));return G?$4:""}catch{return""}}),Y=e$(Y,"@continue",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let z=G0(X,Object.keys(Z));G=Boolean(z(...Object.values(Z)))}else G=Boolean(Y0(X,Z));return G?Z4:""}catch{return""}}),Y}function Wq($){let Z=$;return Z=Z.replace(/@break(?!\()/g,$4),Z=Z.replace(/@continue(?!\()/g,Z4),Z}function JY($){let Z=$.includes($4),Y=Z?$.substring(0,$.indexOf($4)):$;return{hasBreak:Z,content:Y}}function XY($){let Z=$.includes(Z4),Y=Z?$.substring(0,$.indexOf(Z4)):$;return{hasContinue:Z,content:Y}}function GY($){let Z=$;return Z=e$(Z,"@break",(Y)=>{let J=Y.trim();if(!s5(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=e$(Z,"@continue",(Y)=>{let J=Y.trim();if(!s5(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Uq($){let Z=/@forelse\s*\(/g,Y,J=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)J.push({pos:G.index,delta:1});while((G=X.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((q,U)=>q.pos-U.pos);let z=[],K=0;for(let q of J)K+=q.delta,z.push({pos:q.pos,depth:K});function W(q){let U=0,_=z.length-1,B=0;while(U<=_){let j=U+_>>1;if(z[j].pos<=q)B=z[j].depth,U=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let q=Y.index,U=Y.index+Y[0].length-1,_=1,B=U+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let S=N.exec($),k=R.exec($);if(!k)break;if(S&&S.index<k.index)w++,A=S.index+S[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),D=T+11,I=-1,E=0,P=0;while(P<M.length){let S=M.indexOf("@",P);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))E++,P=S+1;else if(k.startsWith("@endforelse"))E--,P=S+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){I=S;break}P=S+1}else P=S+1}if(I===-1)continue;return{start:q,end:D,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,I),emptyContent:M.substring(I+6)}}return null}function QY($,Z){let Y=$;while(!0){let J=Uq(Y);if(!J)break;let{start:Q,end:X,arrayExpr:G,itemVar:z,foreachContent:K,emptyContent:W}=J;try{let q;if(Q0(G))q=G0(G,Object.keys(Z))(...Object.values(Z));else q=Y0(G,Z);let U;if(!Array.isArray(q)||q.length===0)U=W;else U=`@foreach (${G} as ${z})${K}@endforeach`;Y=Y.substring(0,Q)+U+Y.substring(X)}catch(q){let U=q instanceof Error?q.message:String(q),_=e("Forelse",`Error in @forelse(${G} as ${z}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(X)}}return Y}function z3($,Z,Y,J){let Q=$;Q=QY(Q,Z);function X(K){let W=/@foreach\s*\(/g,q;while((q=W.exec(K))!==null){let U=q.index,_=q.index+q[0].length-1,B=1,j=_+1,H=-1;while(j<K.length&&B>0){if(K[j]==="(")B++;else if(K[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=K.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<K.length){T.lastIndex=R,M.lastIndex=R;let D=T.exec(K),I=M.exec(K);if(!I)break;if(D&&D.index<I.index)N++,R=D.index+D[0].length;else{if(N--,N===0){let E=K.substring(A,I.index),P=I.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}R=I.index+11}}}return null}function G(K,W){let q=K;while(!0){let U=X(q);if(!U)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(Q0(F))O=G0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let I=e("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);q=q.substring(0,_)+I+q.substring(B);continue}let w=J?.loops?.useAltLoopVariable??Gq,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let I=A.split("=>").map((E)=>E.trim());if(I.length===2&&I[0]&&I[1])N=I[0],R=I[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let I=A.split(",").map((E)=>E.trim());if(I.length===2&&I[0]&&I[1])R=I[0],N=I[1],T=!0;else R=A}else R=A;let M="",D=O;for(let I=0;I<D.length;I++){let E=D[I],P={index:I,iteration:I+1,first:I===0,last:I===D.length-1,count:D.length},S={...W,loop:P,$loop:P};if(R.startsWith("[")&&R.endsWith("]")){let h=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))h.forEach((m,i)=>{if(m)S[m]=E[i]});else S[R]=E}else S[R]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)S[N]=E[0],S[R]=E[1];else S[N]=I;let k=qq(L,S),y=XY(k);if(y.hasContinue){M+=y.content;continue}let g=JY(k);if(g.hasBreak){M+=g.content;break}if(k=QY(k,S),k=G(k,S),k=y1(k,S,Y),k=Wq(k),g=JY(k),g.hasBreak){M+=g.content;break}if(y=XY(k),y.hasContinue){M+=y.content;continue}k=s0(k,S,Y),k=Kq(k,S),k=zq(k,S),M+=k}q=q.substring(0,_)+M+q.substring(B)}catch(F){let O=e("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);q=q.substring(0,_)+O+q.substring(B)}}return q}Q=G(Q,Z),Q=KY(Q,Z,Y,J);let z=J?.loops?.maxWhileIterations??Qq;return Q=jq(Q,Z,z),Q}function zY($){return s5($)}function KY($,Z,Y,J){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let z=G.index,K=z+G[0].length-1,W=C0(Q,"(",")",K);if(W===-1)break;let q=Q.slice(K+1,W),U=W+1,_=m$(Q.slice(z),"for","endfor");if(_.length===0)break;let B=_[0].content,j=z+_[0].end;if(!zY(q)){let H=e("For",`Unsafe expression in @for: ${q}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,z)+H+Q.substring(j),X=!0;continue}try{let H=_q(q),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let N=Bq({forExpr:q,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});Q=Q.substring(0,z)+N+Q.substring(j),X=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=GY(V);let A=Function(...F,`
2747
+ </style>`}}});var tZ={};r(tZ,{preloadIconCollection:()=>aZ,IconBuiltin:()=>r4});import{existsSync as eq,readFileSync as $z}from"fs";function rZ($){try{return z0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(eq(Y))return Y;return null}function Zz($){if(v1.has($))return v1.get($);let Z=rZ($);if(!Z)return null;try{let Y=JSON.parse($z(Z,"utf8"));return v1.set($,Y.icons),Y.icons}catch{return null}}async function Yz($){if(v1.has($))return v1.get($);let Z=rZ($);if(!Z)return null;try{let Y=await Bun.file(Z).json();return v1.set($,Y.icons),Y.icons}catch{return null}}function Y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function aZ($="lucide"){await Yz($)}var v1,r4;var a4=S(()=>{v1=new Map;r4={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let J=Y5($,"name")??Y5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",X=J;if(J.includes(":")){let O=J.split(":");Q=O[0],X=O[1]}let G=i0(Y5($,"size")||"24"),K=i0(Y5($,"color")||"currentColor"),q=i0(Y5($,"class")||""),W=i0(Y5($,"style")||""),z=v1.get(Q)??Zz(Q);if(!z)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=z[X];if(!U)return`<!-- Icon: "${X}" not found in ${Q} -->`;let _=U.width||24,B=U.height||24,j=`0 0 ${_} ${B}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function eZ($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}function $2($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Y);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var N3;var R3=S(()=>{N3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let J=$2(Z,"fallback"),Q=J.rest,X=$2(Q,"error"),G=X.rest,K=J.region??eZ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=X.region??eZ($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function t4($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let J=$.static[Y];if(typeof J==="string")return J}return}var T3;var M3=S(()=>{T3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let J=(t4($,"name")||"v").replace(/["'<>]/g,""),Q=(t4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",X=t4($,"class"),G=t4($,"id"),K=[`data-stx-transition-group="${J}"`,X?`class="${X}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function Z2(){y0.registerBuiltin(X3),y0.registerBuiltin(z3),y0.registerBuiltin(U3),y0.registerBuiltin(j3),y0.registerBuiltin(O3),y0.registerBuiltin(F3),y0.registerBuiltin(w3),y0.registerBuiltin(r4),y0.registerBuiltin(N3),y0.registerBuiltin(T3)}var Y2=S(()=>{Q3();W3();_3();H3();L3();V3();A3();a4();R3();M3();J3();Q3();W3();_3();H3();L3();V3();A3();a4();R3();M3()});function J2($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function X2($,Z,Y){let J=[],Q=0;while(Q<$.length){let X=$.indexOf("<",Q);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=X+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=X+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=X+1+q.length,z=null,U=W,_=-1,B=!1;while(W<$.length){let H=$[W];if(z){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===z)z=null;W++;continue}if(H==='"'||H==="'"){z=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){_=W+2,B=!0;break}if(H===">"){_=W+1;break}W++}if(_===-1){Q=X+1;continue}let j=$.slice(U,B?_-2:_-1).trim();if(B)J.push({fullMatch:$.slice(X,_),tagName:q,attributes:j,content:"",startIndex:X,endIndex:_,isSelfClosing:!0}),Q=_;else{let H=`<${q}`,L=`</${q}>`,F=1,O=_,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),R=$.indexOf(L,O);if(R===-1)break;if(N!==-1&&N<R){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
2748
+ `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=R;break}O=R+L.length}}if(V===-1){Q=_;continue}let w=$.slice(_,V),A=V+L.length;J.push({fullMatch:$.slice(X,A),tagName:q,attributes:j,content:w,startIndex:X,endIndex:A,isSelfClosing:!1}),Q=A}}return J}function Q2($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var G2=S(()=>{R0();A0();e5()});var _2={};r(_2,{processESImports:()=>U2,processComponents:()=>$$});import e4 from"fs";import v0 from"path";function Xz($,Z,Y){let J={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),X=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){J.events[q]=K;continue}if(q.startsWith("__stx_")){let W=X(q.slice(6));J.serverDynamic[W]=Q2(K,Y);continue}if(q.startsWith(":")){let W=X(q.slice(1)),z=K==="true"?W:K;try{if(!Q0(z)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${z}`);J.clientReactive[W]=z;continue}let U=Object.keys(Z),B=G0(z,U)(...Object.values(Z));if(B===void 0){let j=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!U.includes(F))){J.clientReactive[W]=z;continue}}J.serverDynamic[W]=B}catch{J.clientReactive[W]=z}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let z=W[1];if(Q0(z)){let _=G0(z,Object.keys(Z))(...Object.values(Z));J.static[q]=_!=null?String(_):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${z}`);J.static[q]=K}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,z);J.static[q]=K}else{let z=K,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=U.exec(K))!==null)try{let B=_[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${B}`);continue}let H=G0(B,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(H??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,B)}J.static[q]=z}continue}J.static[q]=K}return J}function Qz($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let Q="";while(Y<J&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<J&&/\s/.test($[Y]))Y++;if(Y<J&&$[Y]==="="){Y++;while(Y<J&&/\s/.test($[Y]))Y++;let X="";if(Y<J&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,X+=$[Y],Y++;continue}if(K===G){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))X+=$[Y],Y++;Z[Q]=X}else Z[Q]="true"}return Z}function q2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gz($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Y.exec($))!==null){let Q=J[1];if(y0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function Kz($){let Z=z2.get($);if(Z)return Z;let Y=new Map,J=[v0.join($,"src"),v0.join($,"dist"),$];function Q(X,G){if(G>6)return;let K;try{K=e4.readdirSync(X,{withFileTypes:!0})}catch{return}for(let q of K){let W=v0.join(X,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let _=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(_))Y.set(_,W)}}}for(let X of J)if(Q(X,0),Y.size>0)break;return z2.set($,Y),Y}function qz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let J=v0.join(Y,"node_modules",$);try{if(e4.statSync(J).isDirectory())return J}catch{}let Q=v0.dirname(Y);if(Q===Y)return null;Y=Q}}async function U2($,Z,Y,J,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let X=Z.__importedComponents,G=v0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let _=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,j,H=[];while((j=_.exec(U))!==null){let[L,F,O,V]=j,w=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=v0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(e4.statSync(M).isFile())A=M}catch{try{if(e4.statSync(T).isDirectory())w=T}catch{}}}}else w=qz(V,G);if(!w&&!A)continue;let N=!1,R=(T,M)=>{X.set(T,M),X.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();X.set(I,M),Q.add(M)};if(O&&A)R(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=w?Kz(w):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)R(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)B=B.slice(0,H[L].start)+B.slice(H[L].end);return`<script${z}>${B}</script>`}),K}async function zz($,Z,Y,J,Q){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[W,z]=q,U=z.split(",").map((_)=>_.trim().replace(/^['"]|['"]$/g,"")).filter((_)=>_.length>0);for(let _ of U){let B=_.split("/"),H=B[B.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[v0.resolve(v0.dirname(Y),`${_}.stx`),v0.resolve(v0.dirname(Y),_),v0.resolve(J.componentsDir||"components",`${_}.stx`),v0.resolve(J.componentsDir||"components",_),_.endsWith(".stx")?_:`${_}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),J.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${_}`)}X=X.replace(W,""),K.lastIndex=0}return X}async function Wz($,Z,Y,J,Q){let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(X))!==null){let z=W.index,U=z+W[0].length-1,_=1,B=U+1;while(B<X.length&&_>0){if(X[B]==="(")_++;else if(X[B]===")"){if(_--,_===0)break}B++}if(_!==0)break;let j=X.substring(U+1,B),H=B+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),w=V.match(/^\s*,\s*/);if(w)O=V.slice(w[0].length).trim();let A={};if(O)try{A=N0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);X=X.replace(X.substring(z,H),`[Error parsing component props: ${E}]`);continue}let N="",R=H,M=X.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),R=H+M[0].length;let I=await I1(F,A,N,G,Z,Y,J,K,Q);X=X.substring(0,z)+I+X.substring(R),q.lastIndex=0}return X}async function Uz($,Z,Y,J,Q){if(!$)return $;let X=$,G=J.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=k$(X);return X=q.output,X=await _(X,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),X=await _(X,/[A-Z][a-zA-Z0-9]*/,!0),X=await _(X,/[a-z][a-z0-9]*/,!1,Jz),X=b$(X,q.scripts),X;async function _(B,j,H,L){if(!B)return B;let F=B,O=X2(F,j,L);for(let V=O.length-1;V>=0;V--){let w=O[V],A=H?J2(w.tagName):w.tagName,N=Qz(w.attributes),R=Xz(N,Z,J),T=y0.getBuiltin(w.tagName),M=T?await B9(A,G,Z,Y,J):!1;if(T&&!M){let P={context:Z,filePath:Y,options:J,dependencies:Q},b=T.render(R,w.content,P);if(Object.keys(R.clientReactive).length>0)b=W2(b,R.clientReactive);if(Object.keys(R.events).length>0){let k=Object.entries(R.events).map(([y,g])=>`${y}="${q2(g)}"`).join(" ");b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,w.startIndex)+b+F.substring(w.endIndex);continue}let I={};for(let[P,b]of Object.entries(R.static))I[P]=b;for(let[P,b]of Object.entries(R.serverDynamic))I[P]=b;let E=await I1(A,I,w.content,G,Z,Y,J,K,Q);if(Object.keys(R.clientReactive).length>0)E=W2(E,R.clientReactive);if(Object.keys(R.events).length>0){let P=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(P){let b=Object.entries(R.events).map(([y,g])=>`${y}="${q2(g)}"`).join(" "),k=P[1].length+P[2].length;E=E.substring(0,k)+" "+b+E.substring(k)}}F=F.substring(0,w.startIndex)+E+F.substring(w.endIndex)}return F}}function W2($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let J=Object.entries(Z).map(([X,G])=>`:${X}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+J+$.substring(Q)}async function $$($,Z,Y,J,Q){if(!K2)Z2(),K2=!0;let X=await U2($,Z,Y,J,Q);X=await zz(X,Z,Y,J,Q),X=await Wz(X,Z,Y,J,Q);for(let G=0;G<3;G++){let K=X;if(X=await Uz(X,Z,Y,J,Q),X===K)break}if(J.debug){let G=Gz(X);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return X}var K2=!1,Jz,z2;var I3=S(()=>{J3();Y2();G2();A0();R0();Jz=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"]);z2=new Map});var V2={};r(V2,{processLoops:()=>D3});function jz($,Z){let Y=/@component\s*\(/g,J=$,Q,X=[];while((Q=Y.exec(J))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=J.substring(K+1,W),U=W+1,_=z.match(/^\s*['"]([^'"]+)['"]/);if(!_)continue;let B=_[1],j=z.slice(_[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=N0(L,Z),O=JSON.stringify(F),V=`@component('${B}', ${O})`;X.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=X[G];J=J.substring(0,K)+W+J.substring(q)}return J}function Z$($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),X;while((X=Q.exec(J))!==null){let G=X.index,K=G+X[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let j=J[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let _=J.substring(K+1,W),B=Y(_);J=J.substring(0,G)+B+J.substring(W+1)}return J}function Hz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Q,X)=>{try{let G=Object.keys(Z),K=Object.values(Z);s5(X);let W=G0(X,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return J}}),Y}function Oz($,Z){let Y=$;return Y=Z$(Y,"@break",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let K=G0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(X,Z));return G?Y$:""}catch{return""}}),Y=Z$(Y,"@continue",(J)=>{try{let X=`!!(${J.trim()})`,G;if(Q0(X)){let K=G0(X,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(X,Z));return G?J$:""}catch{return""}}),Y}function Lz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,Y$),Z=Z.replace(/@continue(?!\()/g,J$),Z}function B2($){let Z=$.includes(Y$),Y=Z?$.substring(0,$.indexOf(Y$)):$;return{hasBreak:Z,content:Y}}function j2($){let Z=$.includes(J$),Y=Z?$.substring(0,$.indexOf(J$)):$;return{hasContinue:Z,content:Y}}function O2($){let Z=$;return Z=Z$(Z,"@break",(Y)=>{let J=Y.trim();if(!r5(J))return"";return`\`; if (${J}) { break; } result += \``}),Z=Z$(Z,"@continue",(Y)=>{let J=Y.trim();if(!r5(J))return"";return`\`; if (${J}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function Fz($){let Z=/@forelse\s*\(/g,Y,J=[],Q=/@foreach\s*\(/g,X=/@endforeach/g,G;while((G=Q.exec($))!==null)J.push({pos:G.index,delta:1});while((G=X.exec($))!==null)J.push({pos:G.index,delta:-1});J.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of J)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,_=K.length-1,B=0;while(U<=_){let j=U+_>>1;if(K[j].pos<=z)B=K[j].depth,U=j+1;else _=j-1}return B}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,_=1,B=U+1,j=-1;while(B<$.length&&_>0){if($[B]==="(")_++;else if($[B]===")"){if(_--,_===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,w=1,A=V,N=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(w>0&&A<$.length){N.lastIndex=A,R.lastIndex=A;let b=N.exec($),k=R.exec($);if(!k)break;if(b&&b.index<k.index)w++,A=b.index+b[0].length;else{if(w--,w===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,P=0;while(P<M.length){let b=M.indexOf("@",P);if(b===-1)break;let k=M.substring(b);if(/^@forelse\s*\(/.test(k))E++,P=b+1;else if(k.startsWith("@endforelse"))E--,P=b+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}P=b+1}else P=b+1}if(D===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function H2($,Z){let Y=$;while(!0){let J=Fz(Y);if(!J)break;let{start:Q,end:X,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=J;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Y0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+U+Y.substring(X)}catch(z){let U=z instanceof Error?z.message:String(z),_=e("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(X)}}return Y}function D3($,Z,Y,J){let Q=$;Q=H2(Q,Z);function X(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,_=z.index+z[0].length-1,B=1,j=_+1,H=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(_+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),w=L.substring(F+4),A=H+1,N=1,R=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&R<q.length){T.lastIndex=R,M.lastIndex=R;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,R=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),P=D.index+11;return{start:O,end:P,arrayExpr:V,itemVar:w,content:E}}R=D.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=X(z);if(!U)break;let{start:_,end:B,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(Q0(F))O=G0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=e("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,_)+D+z.substring(B);continue}let w=J?.loops?.useAltLoopVariable??Bz,A=H.trim(),N=null,R,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1],T=!0;else R=A}else R=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],P={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},b={...W,loop:P,$loop:P};if(R.startsWith("[")&&R.endsWith("]")){let h=R.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))h.forEach((m,i)=>{if(m)b[m]=E[i]});else b[R]=E}else b[R]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)b[N]=E[0],b[R]=E[1];else b[N]=D;let k=Oz(L,b),y=j2(k);if(y.hasContinue){M+=y.content;continue}let g=B2(k);if(g.hasBreak){M+=g.content;break}if(k=H2(k,b),k=G(k,b),k=C1(k,b,Y),k=Lz(k),g=B2(k),g.hasBreak){M+=g.content;break}if(y=j2(k),y.hasContinue){M+=y.content;continue}k=s0(k,b,Y),k=Hz(k,b),k=jz(k,b),M+=k}z=z.substring(0,_)+M+z.substring(B)}catch(F){let O=e("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,_)+O+z.substring(B)}}return z}Q=G(Q,Z),Q=F2(Q,Z,Y,J);let K=J?.loops?.maxWhileIterations??_z;return Q=Az(Q,Z,K),Q}function L2($){return r5($)}function F2($,Z,Y,J){let Q=$,X=!0;while(X){X=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=S0(Q,"(",")",q);if(W===-1)break;let z=Q.slice(q+1,W),U=W+1,_=m4(Q.slice(K),"for","endfor");if(_.length===0)break;let B=_[0].content,j=K+_[0].end;if(!L2(z)){let H=e("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),X=!0;continue}try{let H=Vz(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&L){let N=wz({forExpr:z,content:B,iterVarNames:H,context:Z,filePath:Y,options:J});Q=Q.substring(0,K)+N+Q.substring(j),X=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,R)=>{return`\${${R}}`});V=O2(V);let A=Function(...F,`
2749
2749
  let result = '';
2750
- for (${q}) {
2750
+ for (${z}) {
2751
2751
  result += \`${V}\`;
2752
2752
  }
2753
2753
  return result;
2754
- `)(...O);Q=Q.substring(0,z)+A+Q.substring(j),X=!0}catch(H){let L=e("For",`Error in @for(${q}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,z)+L+Q.substring(j),X=!0}}return Q}function _q($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let X=Y[1];return X.slice(1,-1).split(",").map((z)=>{let K=z.trim();if(!K)return"";let W=K.indexOf(":");if(W>=0&&X.startsWith("{")){let _=K.slice(W+1).trim(),B=_.indexOf("=");return(B>=0?_.slice(0,B):_).trim()}let q=K.indexOf("="),U=(q>=0?K.slice(0,q):K).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function Bq($){let{forExpr:Z,content:Y,iterVarNames:J,context:Q,filePath:X,options:G}=$,z=Object.keys(Q),K=Object.values(Q),W=Function(...z,"__pushIter",`
2754
+ `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),X=!0}catch(H){let L=e("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),X=!0}}return Q}function Vz($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let X=Y[1];return X.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&X.startsWith("{")){let _=q.slice(W+1).trim(),B=_.indexOf("=");return(B>=0?_.slice(0,B):_).trim()}let z=q.indexOf("="),U=(z>=0?q.slice(0,z):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function wz($){let{forExpr:Z,content:Y,iterVarNames:J,context:Q,filePath:X,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
2755
2755
  for (${Z}) {
2756
2756
  __pushIter([${J.join(", ")}])
2757
2757
  }
2758
- `),q=[];W(...K,(B)=>{q.push(B)});let U=X??"inline.stx",_="";for(let B of q){let j={...Q};J.forEach((L,F)=>{j[L]=B[F]});let H=KY(Y,j,X,G);H=y1(H,j,U),H=s0(H,j,U),_+=H}return _}function jq($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,z=G+X[0].length-1,K=C0(J,"(",")",z);if(K===-1)break;let W=J.slice(z+1,K),q=m$(J.slice(G),"while","endwhile");if(q.length===0)break;let U=q[0].content,_=G+q[0].end;if(!zY(W)){let B=e("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(_),Q=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=GY(H);let F=Function(...B,`
2758
+ `),z=[];W(...q,(B)=>{z.push(B)});let U=X??"inline.stx",_="";for(let B of z){let j={...Q};J.forEach((L,F)=>{j[L]=B[F]});let H=F2(Y,j,X,G);H=C1(H,j,U),H=s0(H,j,U),_+=H}return _}function Az($,Z,Y){let J=$,Q=!0;while(Q){Q=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let G=X.index,K=G+X[0].length-1,q=S0(J,"(",")",K);if(q===-1)break;let W=J.slice(K+1,q),z=m4(J.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,_=G+z[0].end;if(!L2(W)){let B=e("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,G)+B+J.substring(_),Q=!0;continue}try{let B=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=O2(H);let F=Function(...B,`
2759
2759
  let result = '';
2760
2760
  let maxIterations = ${Y}; // Configurable safety limit
2761
2761
  let counter = 0;
@@ -2767,8 +2767,8 @@ ${E}
2767
2767
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
2768
2768
  }
2769
2769
  return result;
2770
- `)(...j);J=J.substring(0,G)+F+J.substring(_),Q=!0}catch(B){let j=e("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(_),Q=!0}}return J}var Qq=1000,Gq=!1,$4="<!--__STX_BREAK__-->",Z4="<!--__STX_CONTINUE__-->";var K3=b(()=>{p$();Z1();r0();u$();T0()});import U0 from"path";function q3($,Z){let Y=0;for(let J=Z;J<$.length;J++){let Q=$[J];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return J}return-1}function Hq($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(J);while(X){let G=X.index,z=G+X[0].length-1,K=1,W=z+1;while(W<J.length&&K>0){if(J[W]==="(")K++;else if(J[W]===")")K--;W++}if(K!==0)break;let q=J.substring(z+1,W-1),U=`${Y}(${q})`;J=J.substring(0,G)+U+J.substring(W),Q.lastIndex=G+U.length,X=Q.exec(J)}return J}function Oq($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function Lq($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,z=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},K=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++,X++;else if(Z[X]==="}")U--,X++;else if(Z[X]==="'"||Z[X]==='"')z(Z[X]);else if(Z[X]==="`")K();else X++;continue}X++}},W=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2771
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},q=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!J.has(j))Y.push(j),J.add(j);return}let _=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!J.has(j))Y.push(j),J.add(j);return}let B=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Y.push(j),J.add(j)}};while(X<G){if(W())continue;if(Z[X]==="'"||Z[X]==='"'){z(Z[X]);continue}if(Z[X]==="`"){K();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))q();X++}return Y.join(", ")}function UY($,Z=""){return`
2770
+ `)(...j);J=J.substring(0,G)+F+J.substring(_),Q=!0}catch(B){let j=e("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);J=J.substring(0,G)+j+J.substring(_),Q=!0}}return J}var _z=1000,Bz=!1,Y$="<!--__STX_BREAK__-->",J$="<!--__STX_CONTINUE__-->";var E3=S(()=>{p4();Z1();r0();u4();R0()});import U0 from"path";function k3($,Z){let Y=0;for(let J=Z;J<$.length;J++){let Q=$[J];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return J}return-1}function Nz($,Z,Y){let J=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),X=Q.exec(J);while(X){let G=X.index,K=G+X[0].length-1,q=1,W=K+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let z=J.substring(K+1,W-1),U=`${Y}(${z})`;J=J.substring(0,G)+U+J.substring(W),Q.lastIndex=G+U.length,X=Q.exec(J)}return J}function Rz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function Tz($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,K=(U)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===U){X++;return}X++}},q=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let U=1;while(X<G&&U>0)if(Z[X]==="{")U++,X++;else if(Z[X]==="}")U--,X++;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},W=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
2771
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},z=()=>{if(Q!==0)return;let U=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!J.has(j))Y.push(j),J.add(j);return}let _=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!J.has(j))Y.push(j),J.add(j);return}let B=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Y.push(j),J.add(j)}};while(X<G){if(W())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){Q++,X++;continue}if(Z[X]==="}"){Q--,X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))z();X++}return Y.join(", ")}function A2($,Z=""){return`
2772
2772
  (function() {
2773
2773
  var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
2774
2774
  var __destroyHooks = [];
@@ -2777,11 +2777,11 @@ ${E}
2777
2777
 
2778
2778
  ${$}
2779
2779
  ${Z}})();
2780
- `}function Fq($,Z){let X=`
2780
+ `}function Mz($,Z){let X=`
2781
2781
  // Register scope variables for STX runtime
2782
2782
  if (!window.stx._scopes) window.stx._scopes = {};
2783
2783
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
2784
- ${Lq($).split(",").map((K)=>K.trim()).filter(Boolean).map((K)=>` try { __scopeRegistration[${JSON.stringify(K)}] = ${K}; } catch (e) { /* not actually top-level */ }`).join(`
2784
+ ${Tz($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
2785
2785
  `)}
2786
2786
  // #1767: when the bundler renamed a component const that collided with an
2787
2787
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -2794,40 +2794,40 @@ ${Lq($).split(",").map((K)=>K.trim()).filter(Boolean).map((K)=>` try { __scopeR
2794
2794
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
2795
2795
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
2796
2796
  if (__stxScopeEl && typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxScopeEl;
2797
- try {`,z=`
2797
+ try {`,K=`
2798
2798
  } finally {
2799
2799
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2800
2800
  }
2801
- })();`;return G+UY($,X)+`
2801
+ })();`;return G+A2($,X)+`
2802
2802
  } finally {
2803
2803
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
2804
2804
  }
2805
- })();`}function Vq($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=Y[1],G=Y[2],z=Y[3];return{html:`${X}${G} data-stx-scope="${Z}"${z}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function Aq($){if($.__onceStore instanceof Set)return $.__onceStore;return wq}async function W3($,Z,Y,J,Q,X=new Set){let G=J.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let z=Hq($,"@partial","@include"),K=Aq(Z);z=z.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(K.has(O))return"";return K.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(z))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<z.length&&O>0){if(z[V]==="(")O++;else if(z[V]===")")O--;V++}if(O!==0)break;let w=z.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${w})`;z=z.substring(0,L)+T+z.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(z))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<z.length&&w>0){if(z[A]==="(")w++;else if(z[A]===")")w--;A++}if(w!==0)break;let N=z.substring(V+1,A-1),R=q3(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),D=M.match(/^\s*['"]([^'"]+)['"]/);if(!D){L.lastIndex=A;continue}let I=D[1],E=M.substring(D[0].length),P,S=q3(E,0);if(S!==-1)P=E.substring(S+1).trim();try{let k=`Boolean(${T})`,y;if(Q0(k)){let m=G0(k,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean(Y0(k,Z));let g=H?!y:y,h="";if(g){let m=W(I,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);h=`@include('${I}'${P?`, ${P}`:""})`}z=z.substring(0,O)+h+z.substring(A),L.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k),g=z0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);z=z.substring(0,O)+g+z.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(z))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<z.length&&O>0){if(z[V]==="(")O++;else if(z[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=z.substring(F+1,V),A=z.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,z=z.replace(A,"");continue}let[,R,T,M,D]=N;try{let I,E=T.trim();if(Q0(E))I=G0(E,Object.keys(Z))(...Object.values(Z));else I=Y0(E,Z);let P="";if(Array.isArray(I)&&I.length>0)for(let S of I){let k={...Z,[M]:S},y=await U(R,k,$,L);P+=y}else if(D)P=await U(D,{},$,L);z=z.substring(0,L)+P+z.substring(V+1),j.lastIndex=0}catch(I){let E=I instanceof Error?I.message:String(I);z=z.substring(0,L)+z0("Each",`Error in @each: ${E}`,Y,$,L)+z.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(z))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<z.length&&O>0){if(z[V]==="(")O++;else if(z[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=z.substring(F+1,V),A=z.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,z=z.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,D=T.match(/^\s*,\s*\{/);if(D){T=T.slice(D[0].length-1);let P=1,S=1;while(S<T.length&&P>0){if(T[S]==="{")P++;else if(T[S]==="}"){if(P--,P===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let I,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)I=E[1];try{let P=JSON.parse(R.replace(/'/g,'"')),S={};if(M)try{S=R0(M,Z)}catch(y){let g=y instanceof Error?y.message:String(y);if(J.debug){let h=z0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);z=z.replace(A,()=>h)}else z=z.replace(A,()=>I||"");continue}let k=!1;for(let y of P){let g=W(y,G,Y);if(!g)continue;if(await n(g)){let h=await U(y,S,$,L);z=z.replace(A,()=>h),k=!0;break}}if(!k)if(I!==void 0)z=z.replace(A,()=>I);else if(J.debug){let y=z0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);z=z.replace(A,()=>y)}else z=z.replace(A,"")}catch(P){let S=P instanceof Error?P.message:String(P),k=z0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);z=z.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let q=U0.resolve(Y);X.add(q);async function U(j,H={},L,F){let O=W(j,G,Y);if(!O)return z0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(X.has(V)){let w=[...X,V].map((A)=>U0.basename(A)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(h){let m=h instanceof Error?h.message:String(h);return z0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:h}=await Promise.resolve().then(() => (s7(),o7));w=h(w,Z)}if(w&&(J.debug||!M5()&&!E$()))try{let{warnUnbalancedTags:h}=await Promise.resolve().then(() => (a7(),j9));h(w,O)}catch{}let A=w;try{let{processESImports:h}=await Promise.resolve().then(() => (G3(),YY));await h(w,Z,O,J,Q)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,h instanceof Error?h.message:h)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...Z};for(let[h,m]of Object.entries(H))D[h]=m;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(I)],P="",S=null;for(let h of E){let m=h[1]||"",i=h[2]||"",c=m.includes("server"),K0=A1(m),V0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:k0}=await Promise.resolve().then(() => (j5(),J6)),f0=Z0(i,{filePath:O,projectRoot:process.cwd()});i=f0.code,V0=k0(f0.styles)}catch(Z0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}if(K0&&i.trim())i=N1(i);if(!c)try{let{hasUserImports:Z0,bundleClientScript:k0}=await Promise.resolve().then(() => (i5(),l5));if(Z0(i))i=await k0(i,O,{projectRoot:process.cwd()})}catch(Z0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}let _0=Oq(i);if(_0&&!c){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++WY}`;let Z0=$1(i),k0=Fq(Z0,S);P+=`${V0}<script data-stx-scoped>${k0}</script>
2806
- `;continue}if(c)try{let{extractVariables:Z0}=await Promise.resolve().then(() => (N5(),Y$));await Z0(i,D,O)}catch(Z0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Z0)}if(!c&&!_0){let Z0=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++WY}`;let k0=$1(i),f0=`
2805
+ })();`}function Iz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let X=Y[1],G=Y[2],K=Y[3];return{html:`${X}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function Ez($){if($.__onceStore instanceof Set)return $.__onceStore;return Dz}async function b3($,Z,Y,J,Q,X=new Set){let G=J.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=Nz($,"@partial","@include"),q=Ez(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let w=K.substring(F+1,V-1),A=w.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],R=W(N,G,Y),T="";if(R&&await Bun.file(R).exists())Q.add(R),T=`@include(${w})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,w=1,A=V+1;while(A<K.length&&w>0){if(K[A]==="(")w++;else if(K[A]===")")w--;A++}if(w!==0)break;let N=K.substring(V+1,A-1),R=k3(N,0);if(R===-1){L.lastIndex=A;continue}let T=N.substring(0,R).trim(),M=N.substring(R+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),P,b=k3(E,0);if(b!==-1)P=E.substring(b+1).trim();try{let k=`Boolean(${T})`,y;if(Q0(k)){let m=G0(k,Object.keys(Z));y=Boolean(m(...Object.values(Z)))}else y=Boolean(Y0(k,Z));let g=H?!y:y,h="";if(g){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);h=`@include('${D}'${P?`, ${P}`:""})`}K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}catch(k){let y=k instanceof Error?k.message:String(k),g=K0("Include",`Error evaluating ${j} condition: ${y}`,Y,$,O);K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,M,I]=N;try{let D,E=T.trim();if(Q0(E))D=G0(E,Object.keys(Z))(...Object.values(Z));else D=Y0(E,Z);let P="";if(Array.isArray(D)&&D.length>0)for(let b of D){let k={...Z,[M]:b},y=await U(R,k,$,L);P+=y}else if(I)P=await U(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+K0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let w=K.substring(F+1,V),A=K.substring(L,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let R=N[1],T=w.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,b=1;while(b<T.length&&P>0){if(T[b]==="{")P++;else if(T[b]==="}"){if(P--,P===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let P=JSON.parse(R.replace(/'/g,'"')),b={};if(M)try{b=N0(M,Z)}catch(y){let g=y instanceof Error?y.message:String(y);if(J.debug){let h=K0("Include",`Error parsing includeFirst variables: ${g}`,Y,$,L,A);K=K.replace(A,()=>h)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let y of P){let g=W(y,G,Y);if(!g)continue;if(await n(g)){let h=await U(y,b,$,L);K=K.replace(A,()=>h),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(J.debug){let y=K0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,L,A);K=K.replace(A,()=>y)}else K=K.replace(A,"")}catch(P){let b=P instanceof Error?P.message:String(P),k=K0("Include",`Error processing @includeFirst: ${b}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=U0.resolve(H,F);else w=U0.resolve(V,F);let A=U0.normalize(w),N=A.startsWith(O+U0.sep)||A===O,R=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!N&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let z=U0.resolve(Y);X.add(z);async function U(j,H={},L,F){let O=W(j,G,Y);if(!O)return K0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(X.has(V)){let w=[...X,V].map((A)=>U0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${w}`,Y,L,F)}try{Q.add(O);let w;if(!w)try{w=await Bun.file(O).text()}catch(h){let m=h instanceof Error?h.message:String(h);return K0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(w&&w.includes("@stream")){let{processStreamDirectives:h}=await Promise.resolve().then(() => (e7(),t7));w=h(w,Z)}if(w&&(J.debug||!M5()&&!k4()))try{let{warnUnbalancedTags:h}=await Promise.resolve().then(() => (Z3(),mZ));h(w,O)}catch{}let A=w;try{let{processESImports:h}=await Promise.resolve().then(() => (I3(),_2));await h(w,Z,O,J,Q)}catch(h){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,h instanceof Error?h.message:h)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[h,m]of Object.entries(H))I[h]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...w.matchAll(D)],P="",b=null;for(let h of E){let m=h[1]||"",i=h[2]||"",l=m.includes("server"),q0=A1(m),V0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:k0}=await Promise.resolve().then(() => (j5(),E6)),f0=Z0(i,{filePath:O,projectRoot:process.cwd()});i=f0.code,V0=k0(f0.styles)}catch(Z0){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}if(q0&&i.trim())i=N1(i);if(!l)try{let{hasUserImports:Z0,bundleClientScript:k0}=await Promise.resolve().then(() => (n5(),i5));if(Z0(i))i=await k0(i,O,{projectRoot:process.cwd()})}catch(Z0){if(J.debug)console.warn(`[stx] bundler skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}let _0=Rz(i);if(_0&&!l){b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++w2}`;let Z0=$1(i),k0=Mz(Z0,b);P+=`${V0}<script data-stx-scoped>${k0}</script>
2806
+ `;continue}if(l)try{let{extractVariables:Z0}=await Promise.resolve().then(() => (N5(),J4));await Z0(i,I,O)}catch(Z0){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Z0)}if(!l&&!_0){let Z0=m.replace(/\bclient\b/i,"").trim();b=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++w2}`;let k0=$1(i),f0=`
2807
2807
  if (!window.stx._scopes) window.stx._scopes = {};
2808
- window.stx._scopes['${S}'] = { __destroyCallbacks: __destroyHooks };
2809
- `,v=UY(k0,f0);P+=`${V0}<script data-stx-scoped${Z0?` ${Z0}`:""}>${v}</script>
2810
- `}}if(S){let h=Vq(A,S);if(A=h.html,h.mergedIntoExisting)P=P.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),S=h.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await W3(A,D,O,J,Q,X);let{processLoops:k}=await Promise.resolve().then(() => (K3(),qY)),y=k(A,D,O);y=y1(y,D,O);let g=m1(w);if(y=s0(y,D,O,{forceSignals:g}),M)y+=`
2808
+ window.stx._scopes['${b}'] = { __destroyCallbacks: __destroyHooks };
2809
+ `,v=A2(k0,f0);P+=`${V0}<script data-stx-scoped${Z0?` ${Z0}`:""}>${v}</script>
2810
+ `}}if(b){let h=Iz(A,b);if(A=h.html,h.mergedIntoExisting)P=P.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${h.mergedIntoExisting}']`),b=h.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await b3(A,I,O,J,Q,X);let{processLoops:k}=await Promise.resolve().then(() => (E3(),V2)),y=k(A,I,O);y=C1(y,I,O);let g=u1(w);if(y=s0(y,I,O,{forceSignals:g}),M)y+=`
2811
2811
  `+M;if(P)y+=`
2812
- `+P;return y}catch(w){let A=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let _=/@include\s*\(/g,B;while((B=_.exec(z))!==null){let j=B.index,H=j+B[0].length-1,L=1,F=H+1;while(F<z.length&&L>0){if(z[F]==="(")L++;else if(z[F]===")")L--;F++}if(L!==0)break;let O=z.substring(j,F),V=z.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){_.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=q3(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=R0(N,Z)}catch(I){let E=I instanceof Error?I.message:String(I);z=z.replace(O,z0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),_.lastIndex=0;continue}let D=await U(A,M,$,j);z=z.substring(0,j)+D+z.substring(F),_.lastIndex=0}return z}function U3($,Z){let Y=$;function J(Q,X,G,z){let K=Q,W=!0;while(W){W=!1;let q=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),U=K.match(q);if(!U||U.index===void 0)break;let _=U.index,B=U[1],j=_+U[0].length,H=new RegExp(`@${X}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<K.length){let A=K.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=K.slice(j,V);if(!Z[B])Z[B]=[];if(z)Z[B].unshift(w);else Z[B].push(w);K=K.substring(0,_)+K.substring(V+`@${G}`.length),W=!0}return K}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function _3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2813
- `)})}var WY=0,mL,wq;var _Y=b(()=>{p$();r0();c1();T0();N0();mL=new F5(500),wq=new Set});import*as B3 from"path";async function BY($,Z,Y=""){if(B3.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return HY($,Z,Y,"@js","@endjs")}async function jY($,Z,Y=""){if(B3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return HY($,Z,Y,"@ts","@endts")}async function HY($,Z,Y,J,Q){let X=$,G=p1(`${J}([\\s\\S]*?)${Q}`,"g"),z=[],K;while((K=G.exec($))!==null)z.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:W,content:q,index:U}of z)try{let _=Object.keys(Z),B=Object.values(Z),j=q.trim();if(J==="@ts")j=j.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=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
2812
+ `+P;return y}catch(w){let A=w instanceof Error?w.message:String(w);return K0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let _=/@include\s*\(/g,B;while((B=_.exec(K))!==null){let j=B.index,H=j+B[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){_.lastIndex=F;continue}let A=w[1],N,R=V.substring(w[0].length),T=k3(R,0);if(T!==-1)N=R.substring(T+1).trim();let M={};if(N)try{M=N0(N,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,K0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),_.lastIndex=0;continue}let I=await U(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),_.lastIndex=0}return K}function S3($,Z){let Y=$;function J(Q,X,G,K){let q=Q,W=!0;while(W){W=!1;let z=new RegExp(`@${X}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let _=U.index,B=U[1],j=_+U[0].length,H=new RegExp(`@${X}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),R=A.match(L),T=N?O+N.index:1/0,M=R?O+R.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let w=q.slice(j,V);if(!Z[B])Z[B]=[];if(K)Z[B].unshift(w);else Z[B].push(w);q=q.substring(0,_)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=J(Y,"push","endpush",!1),Y=J(Y,"prepend","endprepend",!0),Y}function y3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
2813
+ `)})}var w2=0,TF,Dz;var N2=S(()=>{p4();r0();c1();R0();A0();TF=new F5(500),Dz=new Set});import*as C3 from"path";async function R2($,Z,Y=""){if(C3.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return M2($,Z,Y,"@js","@endjs")}async function T2($,Z,Y=""){if(C3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((X)=>({...X,displayName:`User ${X.id}: ${X.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return M2($,Z,Y,"@ts","@endts")}async function M2($,Z,Y,J,Q){let X=$,G=l1(`${J}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let _=Object.keys(Z),B=Object.values(Z),j=z.trim();if(J==="@ts")j=j.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=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
2814
2814
  ${j}
2815
2815
  ${F}
2816
- `,w=Function(..._,O)(...B);if(w&&typeof w==="object")Object.assign(Z,w);X=X.replace(W,"")}catch(_){console.error(`Error executing ${J} code block in ${Y}:`,_);let B=_ instanceof Error?_.message:String(_),j=z0(`${J} Directive`,`Error executing code: ${B}`,Y,$,U,W);console.error(j),X=X.replace(W,"")}return X}var OY=b(()=>{c1();N0()});function Nq($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function LY($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,Q,X)=>{return Nq(J,X||"_method")})}async function FY($,Z,Y,J,Q){if(!J.middleware||J.middleware.length===0)return $;let X=$,G=J.middleware.filter((z)=>z.timing===Q);if(G.length===0)return X;for(let z of G){if(!z.name||typeof z.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",z);continue}try{let K=await z.handler(X,Z,Y,J);if(typeof K==="string")X=K;else if(J.debug)console.warn(`Middleware ${z.name} did not return a string`)}catch(K){if(J.debug)console.error(`Error in middleware ${z.name}:`,K);if(J.debug){let W=z0("Middleware",`Error in middleware '${z.name}': ${K instanceof Error?K.message:String(K)}`,Y,$);X=X.replace(/<body[^>]*>/,`$&
2816
+ `,w=Function(..._,O)(...B);if(w&&typeof w==="object")Object.assign(Z,w);X=X.replace(W,"")}catch(_){console.error(`Error executing ${J} code block in ${Y}:`,_);let B=_ instanceof Error?_.message:String(_),j=K0(`${J} Directive`,`Error executing code: ${B}`,Y,$,U,W);console.error(j),X=X.replace(W,"")}return X}var I2=S(()=>{c1();A0()});function kz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function D2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,Q,X)=>{return kz(J,X||"_method")})}async function E2($,Z,Y,J,Q){if(!J.middleware||J.middleware.length===0)return $;let X=$,G=J.middleware.filter((K)=>K.timing===Q);if(G.length===0)return X;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,Z,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 W=K0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);X=X.replace(/<body[^>]*>/,`$&
2817
2817
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${u0(W)}</div>
2818
- `)}}}return X}async function VY($,Z,Y,J){return FY($,Z,Y,J,"before")}async function wY($,Z,Y,J){return FY($,Z,Y,J,"after")}var AY=b(()=>{r0();N0()});import{defineRoute as $F,defineRoutes as ZF,resetRoutes as YF,route as JF,setAppUrl as XF}from"stx-router";import{route as Rq}from"stx-router";function NY($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,Q,X)=>{try{let G=Q?R0(Q,{}):{};return Rq(J,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var RY=b(()=>{T0()});async function TY($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(f5.exact[$])for(let J of f5.exact[$])await Promise.resolve(J(Z,$));if(f5.exact[Y])for(let J of f5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Q}of f5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(Q(Z,$))}var f5;var MY=b(()=>{f5={patterns:[],exact:{}}});function DY($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>DY(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function IY($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=J.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(W){return Q.some(([q,U])=>W>=q&&W<U)}let z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,K=[];while((X=z.exec(Y))!==null){if(G(X.index))continue;let W=X[0],q=X[2];if(!q||!q.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,B=q,j=!1;while((_=U.exec(q))!==null){let H=_[1],L=_[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=DY(A);if(N){let R=B.match(/\sclass="([^"]*)"/);if(R)B=B.replace(R[0],` class="${R[1]} ${N}"`);else B=B.replace(_[0],` class="${N}"`)}else B=B.replace(_[0],"");j=!0;continue}if(Tq.has(H)){if(A)B=B.replace(_[0],` ${H}`);else B=B.replace(_[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(_[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(_[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${X[1]}${B}${H}>`;K.push({start:X.index,end:X.index+W.length,replacement:F})}}for(let W=K.length-1;W>=0;W--){let{start:q,end:U,replacement:_}=K[W];Y=Y.slice(0,q)+_+Y.slice(U)}return Y}var Tq;var EY=b(()=>{Tq=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function v1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||Mq.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function Iq($,Z,Y){let J=1,Q=Y,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let z=X.exec($),K=G.exec($);if(!K)return-1;if(z&&z.index<K.index)J++,Q=z.index+z[0].length;else{if(J--,J===0)return K.index+K[0].length;Q=K.index+K[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Iq($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function kY($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function J5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function j1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function H1($,Z,Y){let J=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function Eq($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function kq($){let Z=$,Y=0;while(Y<Z.length){let J=v1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-for");if(Q===null){Y=J.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let G=X[1].trim(),z=X[2].trim(),K;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];K=`${z} as ${O} => ${F}`}else K=`${z} as ${G}`;let W=j1(J.attrs,"v-for"),q=j1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},q),j=`@foreach(${K})
2818
+ `)}}}return X}async function k2($,Z,Y,J){return E2($,Z,Y,J,"before")}async function b2($,Z,Y,J){return E2($,Z,Y,J,"after")}var S2=S(()=>{r0();A0()});import{defineRoute as fF,defineRoutes as gF,resetRoutes as hF,route as dF,setAppUrl as mF}from"stx-router";import{route as bz}from"stx-router";function y2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,Q,X)=>{try{let G=Q?N0(Q,{}):{};return bz(J,G,X==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var C2=S(()=>{R0()});async function P2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(g5.exact[$])for(let J of g5.exact[$])await Promise.resolve(J(Z,$));if(g5.exact[Y])for(let J of g5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:Q}of g5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(Q(Z,$))}var g5;var v2=S(()=>{g5={patterns:[],exact:{}}});function x2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>x2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function f2($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],X;while((X=J.exec($))!==null)Q.push([X.index,X.index+X[0].length]);function G(W){return Q.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((X=K.exec(Y))!==null){if(G(X.index))continue;let W=X[0],z=X[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,_,B=z,j=!1;while((_=U.exec(z))!==null){let H=_[1],L=_[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let N=x2(A);if(N){let R=B.match(/\sclass="([^"]*)"/);if(R)B=B.replace(R[0],` class="${R[1]} ${N}"`);else B=B.replace(_[0],` class="${N}"`)}else B=B.replace(_[0],"");j=!0;continue}if(Sz.has(H)){if(A)B=B.replace(_[0],` ${H}`);else B=B.replace(_[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(_[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(_[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${X[1]}${B}${H}>`;q.push({start:X.index,end:X.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:_}=q[W];Y=Y.slice(0,z)+_+Y.slice(U)}return Y}var Sz;var g2=S(()=>{Sz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function x1($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let J=Y.exec($);if(!J)return null;return{full:J[0],tag:J[1],attrs:J[2],selfClosing:J[3].includes("/")||yz.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function Pz($,Z,Y){let J=1,Q=Y,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&Q<$.length){X.lastIndex=Q,G.lastIndex=Q;let K=X.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,Q=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function a0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=Pz($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function h2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function J5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function j1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function H1($,Z,Y){let J=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function vz($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function xz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-for");if(Q===null){Y=J.end;continue}let X=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let G=X[1].trim(),K=X[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=j1(J.attrs,"v-for"),z=j1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z),j=`@foreach(${q})
2819
2819
  `,H=`${j}${B}
2820
- @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function Sq($){let Z=$,Y=0;while(Y<Z.length){let J=v1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-if");if(Q===null){Y=J.end;continue}let X=[],G=a0(Z,J),z=j1(J.attrs,"v-if"),K=H1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},z);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:K,parsedTag:J});let W=G.outerEnd,q=!0;while(q){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=v1(Z,W+L);if(!F){q=!1;break}let O=J5(F.attrs,"v-else-if"),V=kY(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),A=j1(F.attrs,"v-else-if"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);X.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=a0(Z,F),A=j1(F.attrs,"v-else"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);X.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),q=!1}else q=!1}let U=[];for(let H of X)if(H.type==="if")U.push(`@if(${H.expr})
2820
+ @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function fz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-if");if(Q===null){Y=J.end;continue}let X=[],G=a0(Z,J),K=j1(J.attrs,"v-if"),q=H1(Z.slice(G.outerStart,G.outerEnd),{...J,start:0,end:J.end-J.start},K);X.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:J});let W=G.outerEnd,z=!0;while(z){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=x1(Z,W+L);if(!F){z=!1;break}let O=J5(F.attrs,"v-else-if"),V=h2(F.attrs,"v-else");if(O!==null){let w=a0(Z,F),A=j1(F.attrs,"v-else-if"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);X.push({type:"else-if",expr:O,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=a0(Z,F),A=j1(F.attrs,"v-else"),N=H1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},A);X.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let H of X)if(H.type==="if")U.push(`@if(${H.expr})
2821
2821
  ${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
2822
2822
  ${H.element}`);else U.push(`@else
2823
2823
  ${H.element}`);U.push("@endif");let _=U.join(`
2824
- `),B=X[0].outerStart,j=X[X.length-1].outerEnd;Z=Z.slice(0,B)+_+Z.slice(j),Y=B+_.length}return Z}function bq($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function yq($){let Z=$,Y=0;while(Y<Z.length){let J=v1(Z,Y);if(!J)break;let Q=J.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,z=Q.match(G);while(z){X=!0;let q=z[1],U=z[2],_=z[3];Q=Q.replace(z[0],""),Q+=` :${q}="${_}" @update:${q}="${_} = $event"`,z=Q.match(G)}if(X){let q=a0(Z,J),U=Z.slice(q.outerStart,q.outerEnd),_=H1(U,{...J,start:0,end:J.end-J.start},Q);Z=Z.slice(0,q.outerStart)+_+Z.slice(q.outerEnd),Y=q.outerStart+_.length;continue}let K=J5(J.attrs,"v-model");if(K===null){Y=J.end;continue}if(Dq.has(J.tag.toLowerCase())){let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${K}"`,U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}else{let q=J.attrs.replace(/\s*v-model="[^"]*"/g,"");q+=` :modelValue="${K}" @update:modelValue="${K} = $event"`;let U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}}return Z}function Cq($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Pq($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function vq($){let Z=$,Y=0;while(Y<Z.length){let J=v1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-html");if(Q===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=a0(Z,J),G=j1(J.attrs,"v-html"),z=J.selfClosing?" /":"",K=`<${J.tag}${G}${z}>{!! ${Q} !!}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+K+Z.slice(X.outerEnd),Y=X.outerStart+K.length}return Z}function xq($){let Z=$,Y=0;while(Y<Z.length){let J=v1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-text");if(Q===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=a0(Z,J),G=j1(J.attrs,"v-text"),z=J.selfClosing?" /":"",K=`<${J.tag}${G}${z}>{{ ${Q} }}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+K+Z.slice(X.outerEnd),Y=X.outerStart+K.length}return Z}function fq($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function gq($){let Z=$,Y=0;while(Y<Z.length){let J=v1(Z,Y);if(!J)break;if(!kY(J.attrs,"v-once")){Y=J.end;continue}let Q=j1(J.attrs,"v-once"),X=a0(Z,J),G=Z.slice(X.outerStart,X.outerEnd),K=`@once
2824
+ `),B=X[0].outerStart,j=X[X.length-1].outerEnd;Z=Z.slice(0,B)+_+Z.slice(j),Y=B+_.length}return Z}function gz($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function hz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=J.attrs,X=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){X=!0;let z=K[1],U=K[2],_=K[3];Q=Q.replace(K[0],""),Q+=` :${z}="${_}" @update:${z}="${_} = $event"`,K=Q.match(G)}if(X){let z=a0(Z,J),U=Z.slice(z.outerStart,z.outerEnd),_=H1(U,{...J,start:0,end:J.end-J.start},Q);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length;continue}let q=J5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(Cz.has(J.tag.toLowerCase())){let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}else{let z=J.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=a0(Z,J),_=Z.slice(U.outerStart,U.outerEnd),B=H1(_,{...J,start:0,end:J.end-J.start},z);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length}}return Z}function dz($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function mz($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function uz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-html");if(Q===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=a0(Z,J),G=j1(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{!! ${Q} !!}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function pz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;let Q=J5(J.attrs,"v-text");if(Q===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=a0(Z,J),G=j1(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${G}${K}>{{ ${Q} }}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function lz($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function cz($){let Z=$,Y=0;while(Y<Z.length){let J=x1(Z,Y);if(!J)break;if(!h2(J.attrs,"v-once")){Y=J.end;continue}let Q=j1(J.attrs,"v-once"),X=a0(Z,J),G=Z.slice(X.outerStart,X.outerEnd),q=`@once
2825
2825
  ${H1(G,{...J,start:0,end:J.end-J.start},Q)}
2826
- @endonce`;Z=Z.slice(0,X.outerStart)+K+Z.slice(X.outerEnd),Y=X.outerStart+K.length}return Z}function hq($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function dq($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function SY($){if(!Eq($))return $;let Z=$;return Z=kq(Z),Z=Sq(Z),Z=gq(Z),Z=Cq(Z),Z=Pq(Z),Z=yq(Z),Z=bq(Z),Z=dq(Z),Z=vq(Z),Z=xq(Z),Z=fq(Z),Z=hq(Z),Z}var Mq,Dq;var bY=b(()=>{Mq=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Dq=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function Y4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function yY($,Z,Y,J,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,z=[],K;while((K=G.exec(X))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let W=z.length-1;W>=0;W--){let q=z[W];try{let U=Y0(q.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${Y4(q.expr)}" -->`;X=X.slice(0,q.index)+O+X.slice(q.index+q.full.length);continue}let _=q.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(_))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{B[O]=Y0(V,Z)}catch{B[O]=V}else B[O]=V}let L=J.componentsDir||"components",F=await i1(U,B,q.slotContent,L,Z,Y,J,new Set,Q??new Set);X=X.slice(0,q.index)+F+X.slice(q.index+q.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${Y4(_)} -->`;X=X.slice(0,q.index)+B+X.slice(q.index+q.full.length)}}return X=await mq(X,Z,Y,J,Q),X}async function mq($,Z,Y,J,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,z=[],K;while((K=G.exec(X))!==null)z.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let W=z.length-1;W>=0;W--){let q=z[W];try{let U=Y0(q.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${Y4(q.expr)}" -->`;X=X.slice(0,q.index)+j+X.slice(q.index+q.full.length);continue}let _=J.componentsDir||"components",B=await i1(U,{},"",_,Z,Y,J,new Set,Q??new Set);X=X.slice(0,q.index)+B+X.slice(q.index+q.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${Y4(_)} -->`;X=X.slice(0,q.index)+B+X.slice(q.index+q.full.length)}}return X}var CY=b(()=>{N0();T0()});function PY($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
2827
- ${$.slice(Z)}`}function uq($,Z={},Y={}){let{title:J="stx App",lang:Q="en",meta:X=[],link:G=[],script:z=[],headRaw:K="",bodyClass:W="",bodyAttrs:q={}}=Z,U=Y.title||J,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((A)=>{return` <meta ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2826
+ @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function iz($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function nz($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function d2($){if(!vz($))return $;let Z=$;return Z=xz(Z),Z=fz(Z),Z=cz(Z),Z=dz(Z),Z=mz(Z),Z=hz(Z),Z=gz(Z),Z=nz(Z),Z=uz(Z),Z=pz(Z),Z=lz(Z),Z=iz(Z),Z}var yz,Cz;var m2=S(()=>{yz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),Cz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function X$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function u2($,Z,Y,J,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Y0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${X$(z.expr)}" -->`;X=X.slice(0,z.index)+O+X.slice(z.index+z.full.length);continue}let _=z.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(_))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{B[O]=Y0(V,Z)}catch{B[O]=V}else B[O]=V}let L=J.componentsDir||"components",F=await I1(U,B,z.slotContent,L,Z,Y,J,new Set,Q??new Set);X=X.slice(0,z.index)+F+X.slice(z.index+z.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${X$(_)} -->`;X=X.slice(0,z.index)+B+X.slice(z.index+z.full.length)}}return X=await oz(X,Z,Y,J,Q),X}async function oz($,Z,Y,J,Q){let X=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Y0(z.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${X$(z.expr)}" -->`;X=X.slice(0,z.index)+j+X.slice(z.index+z.full.length);continue}let _=J.componentsDir||"components",B=await I1(U,{},"",_,Z,Y,J,new Set,Q??new Set);X=X.slice(0,z.index)+B+X.slice(z.index+z.full.length)}catch(U){let _=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${X$(_)} -->`;X=X.slice(0,z.index)+B+X.slice(z.index+z.full.length)}}return X}var p2=S(()=>{A0();R0()});function l2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
2827
+ ${$.slice(Z)}`}function sz($,Z={},Y={}){let{title:J="stx App",lang:Q="en",meta:X=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:z={}}=Z,U=Y.title||J,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...X].map((A)=>{return` <meta ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2828
2828
  `),H=G.map((A)=>{return` <link ${Object.entries(A).map(([R,T])=>`${R}="${T}"`).join(" ")}>`}).join(`
2829
- `),L=z.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([R])=>R!=="content").map(([R,T])=>`${R}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
2830
- `),F=Object.entries(q).map(([A,N])=>` ${A}="${N}"`).join(""),O=W?` class="${W}"`:"",V=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,K?` ${K}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),w=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2829
+ `),L=K.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([R])=>R!=="content").map(([R,T])=>`${R}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
2830
+ `),F=Object.entries(z).map(([A,N])=>` ${A}="${N}"`).join(""),O=W?` class="${W}"`:"",V=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),w=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
2831
2831
  <html lang="${Q}">
2832
2832
  <head>
2833
2833
  ${V.join(`
@@ -2837,9 +2837,9 @@ ${V.join(`
2837
2837
  ${w.join(`
2838
2838
  `)}
2839
2839
  </body>
2840
- </html>`}function j3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function vY($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:Q=[],script:X=[],headRaw:G=""}=Z,z=$.slice(0,Y),K=[];for(let W of J){let q=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(q&&z.includes(q))continue;K.push(` <meta ${Object.entries(W).map(([U,_])=>`${U}="${_}"`).join(" ")}>`)}for(let W of Q){if(W.href&&z.includes(`href="${W.href}"`))continue;K.push(` <link ${Object.entries(W).map(([q,U])=>`${q}="${U}"`).join(" ")}>`)}for(let W of X)if(W.src){if(z.includes(`src="${W.src}"`))continue;K.push(` <script ${Object.entries(W).filter(([q])=>q!=="content").map(([q,U])=>`${q}="${U}"`).join(" ")}></script>`)}else if(W.content){if(z.includes(W.content))continue;K.push(` <script>${W.content}</script>`)}if(G&&!z.includes(G))K.push(` ${G}`);if(K.length===0)return $;return`${$.slice(0,Y)}${K.join(`
2840
+ </html>`}function P3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function c2($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:J=[],link:Q=[],script:X=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of J){let z=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(z&&K.includes(z))continue;q.push(` <meta ${Object.entries(W).map(([U,_])=>`${U}="${_}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([z,U])=>`${z}="${U}"`).join(" ")}>`)}for(let W of X)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([z])=>z!=="content").map(([z,U])=>`${z}="${U}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
2841
2841
  `)}
2842
- ${$.slice(Y)}`}function xY($,Z={},Y={}){if(j3($))return $;return uq($,Z,Y)}function Q4($){let Z=$,Y=new Set,J=new Set,Q=()=>{if(x0)J.add(x0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,Y.forEach((z)=>z(Z,G)),g5)J.forEach((z)=>X4.add(z));else J.forEach((z)=>z())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return Y.add(X),()=>Y.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function G4($){let Z,Y=!0,J=new Set,Q=()=>{if(!Y)if(Y=!0,g5)J.forEach((G)=>X4.add(G));else J.forEach((G)=>G())},X=()=>{if(x0)J.add(x0);if(Y){let G=x0;x0=Q,J4.push(Q);try{Z=$()}finally{J4.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function z4($,Z={}){let Y,J=!1,Q=()=>{if(J)return;if(Y)Y(),Y=void 0;let X=x0;x0=Q,J4.push(Q);try{Y=$()}finally{J4.pop(),x0=X}};if(Z.immediate!==!1)Q();return()=>{if(J=!0,Y)Y()}}function H3($){if(g5){$();return}g5=!0;try{$()}finally{g5=!1,X4.forEach((Z)=>Z()),X4.clear()}}function O3($){pq.push($)}function L3($){cq.push($)}function K4($){return typeof $==="function"&&$._isSignal===!0}function q4($){return typeof $==="function"&&$._isDerived===!0}function F3($){if(K4($)||q4($))return $();return $}function W4($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function lq($,Z){let Y=typeof $==="function"?$:()=>$,J=Q4([]),Q=G4(()=>J().reduce((z,K)=>Z(z,K.action),Y())),X=!1;return z4(()=>{if(Y(),!X){X=!0;return}if(W4(()=>J().length))J.set([])}),[Q,(z,K)=>{let W={action:z};J.set([...J(),W]);let q=()=>{let U=J().filter((_)=>_!==W);if(U.length!==J().length)J.set(U)};if(K&&typeof K.then==="function")Promise.resolve(K).then(q,q);return q}]}var x0=null,J4,g5=!1,X4,pq,cq;var V3=b(()=>{J4=[],X4=new Set,pq=[],cq=[]});var gY={};r(gY,{useOptimistic:()=>lq,untrack:()=>F3,state:()=>Q4,peek:()=>W4,onMount:()=>O3,onDestroy:()=>L3,isSignal:()=>K4,isDerived:()=>q4,generateSignalsRuntimeDev:()=>U4,generateSignalsRuntime:()=>fY,effect:()=>z4,derived:()=>G4,default:()=>nq,batch:()=>H3});function fY(){try{let $=iq(U4()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return U4()}}function iq($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let Q=$.indexOf(J,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let X=1,G=Q+J.length;while(G<$.length&&X>0){let z=$[G];if(z==='"'||z==="'"||z==="`"){let K=z;G++;while(G<$.length&&$[G]!==K){if($[G]==="\\")G++;G++}G++;continue}if(z==="(")X++;else if(z===")")X--;G++}Z.push("0"),Y=G}return Z.join("")}function U4(){return`
2842
+ ${$.slice(Y)}`}function i2($,Z={},Y={}){if(P3($))return $;return sz($,Z,Y)}function K$($){let Z=$,Y=new Set,J=new Set,Q=()=>{if(x0)J.add(x0);return Z};return Q.set=(X)=>{if(!Object.is(X,Z)){let G=Z;if(Z=X,Y.forEach((K)=>K(Z,G)),h5)J.forEach((K)=>G$.add(K));else J.forEach((K)=>K())}},Q.update=(X)=>{Q.set(X(Z))},Q.subscribe=(X)=>{return Y.add(X),()=>Y.delete(X)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function q$($){let Z,Y=!0,J=new Set,Q=()=>{if(!Y)if(Y=!0,h5)J.forEach((G)=>G$.add(G));else J.forEach((G)=>G())},X=()=>{if(x0)J.add(x0);if(Y){let G=x0;x0=Q,Q$.push(Q);try{Z=$()}finally{Q$.pop(),x0=G}Y=!1}return Z};return Object.defineProperty(X,"_isDerived",{value:!0,writable:!1}),X}function z$($,Z={}){let Y,J=!1,Q=()=>{if(J)return;if(Y)Y(),Y=void 0;let X=x0;x0=Q,Q$.push(Q);try{Y=$()}finally{Q$.pop(),x0=X}};if(Z.immediate!==!1)Q();return()=>{if(J=!0,Y)Y()}}function v3($){if(h5){$();return}h5=!0;try{$()}finally{h5=!1,G$.forEach((Z)=>Z()),G$.clear()}}function x3($){rz.push($)}function f3($){az.push($)}function W$($){return typeof $==="function"&&$._isSignal===!0}function U$($){return typeof $==="function"&&$._isDerived===!0}function g3($){if(W$($)||U$($))return $();return $}function _$($){let Z=x0;x0=null;try{return $()}finally{x0=Z}}function tz($,Z){let Y=typeof $==="function"?$:()=>$,J=K$([]),Q=q$(()=>J().reduce((K,q)=>Z(K,q.action),Y())),X=!1;return z$(()=>{if(Y(),!X){X=!0;return}if(_$(()=>J().length))J.set([])}),[Q,(K,q)=>{let W={action:K};J.set([...J(),W]);let z=()=>{let U=J().filter((_)=>_!==W);if(U.length!==J().length)J.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var x0=null,Q$,h5=!1,G$,rz,az;var h3=S(()=>{Q$=[],G$=new Set,rz=[],az=[]});var o2={};r(o2,{useOptimistic:()=>tz,untrack:()=>g3,state:()=>K$,peek:()=>_$,onMount:()=>x3,onDestroy:()=>f3,isSignal:()=>W$,isDerived:()=>U$,generateSignalsRuntimeDev:()=>B$,generateSignalsRuntime:()=>n2,effect:()=>z$,derived:()=>q$,default:()=>$W,batch:()=>v3});function n2(){try{let $=ez(B$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return B$()}}function ez($){let Z=[],Y=0,J="console.log(";while(Y<$.length){let Q=$.indexOf(J,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let X=1,G=Q+J.length;while(G<$.length&&X>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")X++;else if(K===")")X--;G++}Z.push("0"),Y=G}return Z.join("")}function B$(){return`
2843
2843
  // STX Signals Runtime (Development Build)
2844
2844
  console.log('[stx] signals runtime loading');
2845
2845
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -8060,60 +8060,60 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8060
8060
  }
8061
8061
  }
8062
8062
  })();
8063
- `}var nq;var hY=b(()=>{V3();V3();nq={state:Q4,derived:G4,effect:z4,batch:H3,onMount:O3,onDestroy:L3,isSignal:K4,isDerived:q4,untrack:F3,peek:W4,generateSignalsRuntime:fY,generateSignalsRuntimeDev:U4}});var w3={};r(w3,{templateCache:()=>dY,readFileCached:()=>oq,invalidateFileCacheByDir:()=>rq,invalidateFileCache:()=>sq,hashFilePath:()=>h5,getCachedSignalsRuntime:()=>eq,getCachedRouterScript:()=>$W,clearDevCaches:()=>ZW,checkCache:()=>YW,cacheTemplate:()=>JW,__setSignalsGeneratorsForTest:()=>tq});import O1 from"fs";import X5 from"path";async function oq($){let Y;for(let J=0;J<3;J++)try{let X=(await O1.promises.stat($)).mtime.getTime(),G=x1.get($);if(G&&G.mtime===X)return G.content;let z=await Bun.file($).text(),W=(await O1.promises.stat($)).mtime.getTime();if(W!==X)continue;return x1.set($,{content:z,mtime:W}),z}catch(Q){Y=Q;break}throw x1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function sq($){x1.delete($)}function rq($){for(let Z of x1.keys())if(Z.startsWith($))x1.delete(Z)}function tq($){mY=$}async function eq($=!1){let Z=mY??await Promise.resolve().then(() => (hY(),gY));if($)return Z.generateSignalsRuntimeDev();if(_4===null)_4=Z.generateSignalsRuntime();return _4}async function $W(){if(B4===null){let{getRouterScript:$}=await import("stx-router");B4=$()}return B4}function ZW(){x1.clear(),_4=null,aq=null,B4=null}function uY($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function YW($,Z){try{if(!Z.cachePath)return null;let Y=X5.resolve(Z.cachePath),J=X5.join(Y,`${h5($)}.html`),Q=X5.join(Y,`${h5($)}.meta.json`);if(!await n(J)||!await n(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==uY(Z))return null;if((await O1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let K of G.dependencies)if(await n(K)){if((await O1.promises.stat(K)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function JW($,Z,Y,J){try{if(!J.cachePath)return;let Q=X5.resolve(J.cachePath);await O1.promises.mkdir(Q,{recursive:!0});let X=X5.join(Q,`${h5($)}.html`),G=X5.join(Q,`${h5($)}.meta.json`),z=await O1.promises.stat($);await Bun.write(X,Z);let K={sourcePath:$,mtime:z.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:uY(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(K,null,2)),dY.set($,{output:Z,mtime:z.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function h5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,XW)}var dY,x1,_4=null,aq=null,mY=null,B4=null,XW=16;var A3=b(()=>{N0();dY=new Map,x1=new Map});function pY($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
8063
+ `}var $W;var s2=S(()=>{h3();h3();$W={state:K$,derived:q$,effect:z$,batch:v3,onMount:x3,onDestroy:f3,isSignal:W$,isDerived:U$,untrack:g3,peek:_$,generateSignalsRuntime:n2,generateSignalsRuntimeDev:B$}});var d3={};r(d3,{templateCache:()=>r2,readFileCached:()=>ZW,invalidateFileCacheByDir:()=>JW,invalidateFileCache:()=>YW,hashFilePath:()=>d5,getCachedSignalsRuntime:()=>GW,getCachedRouterScript:()=>KW,clearDevCaches:()=>qW,checkCache:()=>zW,cacheTemplate:()=>WW,__setSignalsGeneratorsForTest:()=>QW});import O1 from"fs";import X5 from"path";async function ZW($){let Y;for(let J=0;J<3;J++)try{let X=(await O1.promises.stat($)).mtime.getTime(),G=f1.get($);if(G&&G.mtime===X)return G.content;let K=await Bun.file($).text(),W=(await O1.promises.stat($)).mtime.getTime();if(W!==X)continue;return f1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw f1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function YW($){f1.delete($)}function JW($){for(let Z of f1.keys())if(Z.startsWith($))f1.delete(Z)}function QW($){a2=$}async function GW($=!1){let Z=a2??await Promise.resolve().then(() => (s2(),o2));if($)return Z.generateSignalsRuntimeDev();if(j$===null)j$=Z.generateSignalsRuntime();return j$}async function KW(){if(H$===null){let{getRouterScript:$}=await import("stx-router");H$=$()}return H$}function qW(){f1.clear(),j$=null,XW=null,H$=null}function t2($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function zW($,Z){try{if(!Z.cachePath)return null;let Y=X5.resolve(Z.cachePath),J=X5.join(Y,`${d5($)}.html`),Q=X5.join(Y,`${d5($)}.meta.json`);if(!await n(J)||!await n(Q))return null;let X=await Bun.file(Q).text(),G=JSON.parse(X);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==t2(Z))return null;if((await O1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await O1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(J).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function WW($,Z,Y,J){try{if(!J.cachePath)return;let Q=X5.resolve(J.cachePath);await O1.promises.mkdir(Q,{recursive:!0});let X=X5.join(Q,`${d5($)}.html`),G=X5.join(Q,`${d5($)}.meta.json`),K=await O1.promises.stat($);await Bun.write(X,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:J.cacheVersion,optionsSignature:t2(J),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),r2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function d5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,UW)}var r2,f1,j$=null,XW=null,a2=null,H$=null,UW=16;var m3=S(()=>{A0();r2=new Map,f1=new Map});function e2($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",J;while((J=Z.exec($))!==null)Y+=J[1]+`
8064
8064
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((J=Q.exec($))!==null)Y+=J[1]+`
8065
- `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((_)=>{return new RegExp(`\\b${_}\\b`).test(Y)}),z=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"]),K=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,q=!1;while((W=K.exec(Y))!==null)if(!z.has(W[1])){q=!0;break}if(!G&&!q)return $;let U=`<script type="module">
8065
+ `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((_)=>{return new RegExp(`\\b${_}\\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,W,z=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){z=!0;break}if(!G&&!z)return $;let U=`<script type="module">
8066
8066
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
8067
8067
  import '@stacksjs/browser'
8068
8068
  </script>`;if($.includes("</head>")){let _=$.indexOf("</head>"),j=$.slice(0,_).indexOf("<script");if(j!==-1)return $.slice(0,j)+U+`
8069
8069
  `+$.slice(j);return $.replace("</head>",`${U}
8070
8070
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8071
8071
  ${U}`);return U+`
8072
- `+$}async function cY($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let z=$.indexOf("<script");if(z!==-1)return $.slice(0,z)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8073
- `+$.slice(z);if($.includes("</head>")){let K=$.indexOf("</head>");return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8074
- `+$.slice(K)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8075
- `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (A3(),w3)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
8072
+ `+$}async function $Y($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8073
+ `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8074
+ `+$.slice(q)}return`<script src="/__stx/runtime.__STX_HASH__.js"></script>
8075
+ `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (m3(),d3)),Q=`<script data-stx-scoped>${await Y(Z.debug)}</script>`,X=$.indexOf("<script");if(X!==-1)return $.slice(0,X)+Q+`
8076
8076
  `+$.slice(X);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
8077
- `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),z=$.indexOf(">",G);return $.slice(0,z+1)+`
8078
- `+Q+$.slice(z+1)}return Q+`
8079
- `+$}async function N3($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let z={};if(Y.container)z.container=Y.container;if(Y.interceptAllLinks!==void 0)z.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)z.progress=Y.progress;if(Y.viewTransitions!==void 0)z.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)z.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)z.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)z.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)z.prefetch=Y.prefetch;if(Y.cache!==void 0)z.cache=Y.cache;if(Y.progressColor!==void 0)z.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)z.progressHeight=Y.progressHeight;if(Object.keys(z).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(z)};</script>
8080
- `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (A3(),w3)),X=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+X+`
8081
- </body>`+$.slice(G+7)}var eY={};r(eY,{scanScriptTags:()=>sY,processSignals:()=>I3,processScriptSetup:()=>aY,preEvalLiteralReactiveIfs:()=>M3,parseLoopExpression:()=>rY,hasSignalsSyntax:()=>O4,extractExports:()=>tY,convertSignalLoopsToAttributes:()=>D3,convertSignalDirectivesToAttributes:()=>T3});function sY($,Z={}){let Y=[];j4.lastIndex=0;let J;while((J=j4.exec($))!==null){let Q=J[1],X=J.index+J[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let z=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){j4.lastIndex=z;continue}Y.push({fullMatch:$.slice(J.index,z),attrs:Q,body:$.slice(X,G),start:J.index,end:z}),j4.lastIndex=z}return Y}function rY($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:z}=lY(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:z}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:z}=lY(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:z}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function lY($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function O4($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function GW($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let Q=J[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function zW($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G;while((G=J.exec(X))!==null)Z.add(G[1])}return Z}function KW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function nY($,Z,Y){if(!$)return!1;let J=KW($),Q=!1,X=!1,G=!1,z=/([a-zA-Z_$][\w$]*)/g,K;while((K=z.exec(J))!==null){let _=K[1];if(J.slice(0,K.index).trimEnd().endsWith("."))continue;if(iY.has(_))continue;if(Z.has(_))Q=!0;else if(Y&&_ in Y)X=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,q;while((q=W.exec(J))!==null){let _=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(iY.has(_)||Y&&_ in Y)continue;G=!0}return(Q||G)&&!X}function H4($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),X=Q.match(oY);if(X&&qW(X[3],X[1])){let[,G,z,K]=X;return`<${G}${z}${J}>${K}</${G}>`}return`<template${J}>${Q}</template>`}function qW($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(J--,J<0)return!1}else J++;return!0}function T3($,Z){let Y=$,J=zW($),Q=/@if\s*\(/g,X,G=[];while((X=Q.exec(Y))!==null){let z=X.index,K=z+X[0].length,W=1,q=K;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")")W--;q++}if(W!==0)continue;let U=Y.substring(K,q-1).trim(),_=q,B=1,j=_,H=/@(if\s*\(|endif)/g;H.lastIndex=_;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))B++;else if(L[1]==="endif"){if(B--,B===0){j=L.index+L[0].length;break}}if(B!==0)continue;let F=Y.substring(_,j-6).trim(),O;if(GW(F)){let V=S5(Y.substring(z,j));if(V.length===0)continue;let w=V[0].branches.filter((R)=>R.type!=="else");if(!(w.length>0&&w.every((R)=>nY(R.condition,J,Z))))continue;O=V[0].branches.map((R)=>{if(R.type==="elseif")return H4(R.content,"@else-if",R.condition??"");if(R.type==="else")return H4(R.content,"@else");return H4(R.content,"@if",R.condition??"")}).join(`
8082
- `)}else{if(!nY(U,J,Z))continue;O=H4(F,"@if",U)}G.push({start:z,end:j,replacement:O})}for(let z=G.length-1;z>=0;z--){let{start:K,end:W,replacement:q}=G[z];Y=Y.substring(0,K)+q+Y.substring(W)}return Y}function WW($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function UW($,Z,Y,J){if(R3.has(Y.toLowerCase()))return J;let Q=Y.toLowerCase(),X=$.toLowerCase(),G=$.length,z=1,K=J;while(K<G){let W=$.indexOf("<",K);if(W===-1)return-1;if(K=W,$.startsWith("<!--",K)){let B=$.indexOf("-->",K+4);if(B===-1)return-1;K=B+3;continue}let q=/^<(script|style)\b/i.exec($.slice(K,K+8));if(q){let B=$.indexOf(">",K);if(B===-1)return-1;if($[B-1]==="/"){K=B+1;continue}let j=X.indexOf(`</${q[1].toLowerCase()}`,K);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;K=H+1;continue}if($[K+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(K,K+64));if(!B){K++;continue}if(B[1].toLowerCase()===Q){if(z--,K+=B[0].length,z===0)return K;continue}K+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(K,K+64));if(!U){K++;continue}let _=$.indexOf(">",K);if(_===-1)return-1;if(U[1].toLowerCase()===Q){let B=$.slice(K,_+1);if(!(/\/\s*>$/.test(B)||R3.has(Q)))z++}K=_+1}return-1}function BW($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let X=$.slice(Y,Q+1);return _W.test(X)}function M3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Q=(U)=>Z.some(([_,B])=>U>=_&&U<B),X=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],z;while((z=X.exec($))!==null){if(Q(z.index))continue;let[U,_,B,j,H,L,F]=z,O=WW(H);if(O===void 0)continue;let V=z.index,w=V+U.length,R=!!F||/\/\s*>$/.test(U)||R3.has(_.toLowerCase())?w:UW($,V,_,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&BW($,R)){X.lastIndex=w;continue}if(O===!0){let M=`<${_}${B}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),X.lastIndex=R}if(G.length===0)return $;G.sort((U,_)=>U.start-_.start);let K=[],W=-1;for(let U of G){if(U.start<W)continue;K.push(U),W=U.end}let q=$;for(let U=K.length-1;U>=0;U--){let{start:_,end:B,replacement:j}=K[U];q=q.substring(0,_)+j+q.substring(B)}return q}function D3($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q[1],z=Q.index,K=z+Q[0].length,W=1,q=K;while(q<Y.length&&W>0){if(Y[q]==="(")W++;else if(Y[q]===")")W--;q++}if(W!==0)continue;let U=Y.substring(K,q-1).trim(),_=q,B=rY(U);if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=_,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=_;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(_,L-j.length).trim(),w=V.match(oY),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${U}">${T}</${N}>`}else A=`<template @for="${U}">${V}</template>`;X.push({start:z,end:L,replacement:A})}for(let G=X.length-1;G>=0;G--){let{start:z,end:K,replacement:W}=X[G];Y=Y.substring(0,z)+W+Y.substring(K)}return Y}function jW($){let Z=new Set,Y=[],J=0,Q=0,X=$.length,G=(q)=>{let U=J+1;while(U<X){let _=$[U];if(_==="\\"){U+=2;continue}if(_===q)return U+1;U++}return X},z=()=>{let q=J+2;while(q<X&&$[q]!==`
8083
- `)q++;return q},K=()=>{let q=J+2;while(q<X-1){if($[q]==="*"&&$[q+1]==="/")return q+2;q++}return X},W=(q)=>{let U=q,_=0;while(U<X){let B=$[U];if(B==="/"&&$[U+1]==="/"){let j=U+2;while(j<X&&$[j]!==`
8084
- `)j++;U=j;continue}if(B==="/"&&$[U+1]==="*"){let j=U+2;while(j<X-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=U+1;while(j<X){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}U=j;continue}if(B==="("||B==="["||B==="{"){_++,U++;continue}if(B===")"||B==="]"||B==="}"){_--,U++;continue}if(B===";"&&_===0)return U+1;U++}return X};while(J<X){let q=$[J];if(q==="/"&&$[J+1]==="/"){let U=z();Y.push($.slice(J,U)),J=U;continue}if(q==="/"&&$[J+1]==="*"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(q==='"'||q==="'"||q==="`"){let U=G(q);Y.push($.slice(J,U)),J=U;continue}if(q==="{"){Q++,Y.push(q),J++;continue}if(q==="}"){Q--,Y.push(q),J++;continue}if(Q===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=W(J+B[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),J=H;continue}Z.add(j),Y.push($.slice(J,H)),J=H;continue}}}Y.push(q),J++}return Y.join("")}async function aY($,Z,Y){let J=sY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,X=[];for(let H of J){let L=H.body;if(A1(H.attrs))L=N1(L);if(Q.test(L))X.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(X.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${QW++}`,{hasUserImports:z,bundleClientScript:K}=await Promise.resolve().then(() => (i5(),l5)),W=[];for(let H=0;H<X.length;H++){let L=X[H].content;if(z(L))console.log("[stx:bundler] bundling signal script imports"),L=await K(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let F=$1(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
8085
- ${F}`)}let q=W.join(`
8086
-
8087
- `);q=jW(q);let U=tY(q),_=n5(q,Y),B=`
8077
+ `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8078
+ `+Q+$.slice(K+1)}return Q+`
8079
+ `+$}async function u3($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,J="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)J=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8080
+ `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (m3(),d3)),X=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+J+X+`
8081
+ </body>`+$.slice(G+7)}var zY={};r(zY,{scanScriptTags:()=>QY,processSignals:()=>n3,processScriptSetup:()=>KY,preEvalLiteralReactiveIfs:()=>c3,parseLoopExpression:()=>GY,hasSignalsSyntax:()=>F$,extractExports:()=>qY,convertSignalLoopsToAttributes:()=>i3,convertSignalDirectivesToAttributes:()=>l3});function QY($,Z={}){let Y=[];O$.lastIndex=0;let J;while((J=O$.exec($))!==null){let Q=J[1],X=J.index+J[0].length,G=$.toLowerCase().indexOf("</script>",X);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){O$.lastIndex=K;continue}Y.push({fullMatch:$.slice(J.index,K),attrs:Q,body:$.slice(X,G),start:J.index,end:K}),O$.lastIndex=K}return Y}function GY($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),X=Y[2].trim(),{itemVar:G,indexVar:K}=ZY(X);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let J=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Q=J[1].trim(),X=J[2].trim(),{itemVar:G,indexVar:K}=ZY(Q);if(G)return{style:"in",iterable:X,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function ZY($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let J=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let X=Z.match(/^(\w+)$/);if(X)return{itemVar:X[1],indexVar:null};return{itemVar:null,indexVar:null}}function F$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function BW($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,J;while((J=Z.exec($))!==null){let Q=J[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function jW($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let X=Q[1],G;while((G=J.exec(X))!==null)Z.add(G[1])}return Z}function HW($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function JY($,Z,Y){if(!$)return!1;let J=HW($),Q=!1,X=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(J))!==null){let _=q[1];if(J.slice(0,q.index).trimEnd().endsWith("."))continue;if(YY.has(_))continue;if(Z.has(_))Q=!0;else if(Y&&_ in Y)X=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(J))!==null){let _=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(YY.has(_)||Y&&_ in Y)continue;G=!0}return(Q||G)&&!X}function L$($,Z,Y){let J=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),X=Q.match(XY);if(X&&OW(X[3],X[1])){let[,G,K,q]=X;return`<${G}${K}${J}>${q}</${G}>`}return`<template${J}>${Q}</template>`}function OW($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),J=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(J--,J<0)return!1}else J++;return!0}function l3($,Z){let Y=$,J=jW($),Q=/@if\s*\(/g,X,G=[];while((X=Q.exec(Y))!==null){let K=X.index,q=K+X[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),_=z,B=1,j=_,H=/@(if\s*\(|endif)/g;H.lastIndex=_;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))B++;else if(L[1]==="endif"){if(B--,B===0){j=L.index+L[0].length;break}}if(B!==0)continue;let F=Y.substring(_,j-6).trim(),O;if(BW(F)){let V=S5(Y.substring(K,j));if(V.length===0)continue;let w=V[0].branches.filter((R)=>R.type!=="else");if(!(w.length>0&&w.every((R)=>JY(R.condition,J,Z))))continue;O=V[0].branches.map((R)=>{if(R.type==="elseif")return L$(R.content,"@else-if",R.condition??"");if(R.type==="else")return L$(R.content,"@else");return L$(R.content,"@if",R.condition??"")}).join(`
8082
+ `)}else{if(!JY(U,J,Z))continue;O=L$(F,"@if",U)}G.push({start:K,end:j,replacement:O})}for(let K=G.length-1;K>=0;K--){let{start:q,end:W,replacement:z}=G[K];Y=Y.substring(0,q)+z+Y.substring(W)}return Y}function LW($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let J=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function FW($,Z,Y,J){if(p3.has(Y.toLowerCase()))return J;let Q=Y.toLowerCase(),X=$.toLowerCase(),G=$.length,K=1,q=J;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=X.indexOf(`</${z[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===Q){if(K--,q+=B[0].length,K===0)return q;continue}q+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let _=$.indexOf(">",q);if(_===-1)return-1;if(U[1].toLowerCase()===Q){let B=$.slice(q,_+1);if(!(/\/\s*>$/.test(B)||p3.has(Q)))K++}q=_+1}return-1}function wW($,Z){let Y=Z,J=$.length;for(;;){while(Y<J&&$[Y]!=="<")Y++;if(Y>=J)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let X=$.slice(Y,Q+1);return VW.test(X)}function c3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);let Q=(U)=>Z.some(([_,B])=>U>=_&&U<B),X=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=X.exec($))!==null){if(Q(K.index))continue;let[U,_,B,j,H,L,F]=K,O=LW(H);if(O===void 0)continue;let V=K.index,w=V+U.length,R=!!F||/\/\s*>$/.test(U)||p3.has(_.toLowerCase())?w:FW($,V,_,w);if(R===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&wW($,R)){X.lastIndex=w;continue}if(O===!0){let M=`<${_}${B}${L}${F}>`;G.push({start:V,end:w,replacement:M});continue}G.push({start:V,end:R,replacement:""}),X.lastIndex=R}if(G.length===0)return $;G.sort((U,_)=>U.start-_.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:_,end:B,replacement:j}=q[U];z=z.substring(0,_)+j+z.substring(B)}return z}function i3($,Z){let Y=$,J=/@(for|foreach)\s*\(/g,Q,X=[];while((Q=J.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),_=z,B=GY(U);if(B.iterable){let N=B.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let R=N.split(/[.[(]/)[0].trim();if(R&&R in Z)continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=_,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=_;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(_,L-j.length).trim(),w=V.match(XY),A;if(w){let[,N,R,T]=w;A=`<${N}${R} @for="${U}">${T}</${N}>`}else A=`<template @for="${U}">${V}</template>`;X.push({start:K,end:L,replacement:A})}for(let G=X.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=X[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function AW($){let Z=new Set,Y=[],J=0,Q=0,X=$.length,G=(z)=>{let U=J+1;while(U<X){let _=$[U];if(_==="\\"){U+=2;continue}if(_===z)return U+1;U++}return X},K=()=>{let z=J+2;while(z<X&&$[z]!==`
8083
+ `)z++;return z},q=()=>{let z=J+2;while(z<X-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return X},W=(z)=>{let U=z,_=0;while(U<X){let B=$[U];if(B==="/"&&$[U+1]==="/"){let j=U+2;while(j<X&&$[j]!==`
8084
+ `)j++;U=j;continue}if(B==="/"&&$[U+1]==="*"){let j=U+2;while(j<X-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=U+1;while(j<X){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}U=j;continue}if(B==="("||B==="["||B==="{"){_++,U++;continue}if(B===")"||B==="]"||B==="}"){_--,U++;continue}if(B===";"&&_===0)return U+1;U++}return X};while(J<X){let z=$[J];if(z==="/"&&$[J+1]==="/"){let U=K();Y.push($.slice(J,U)),J=U;continue}if(z==="/"&&$[J+1]==="*"){let U=q();Y.push($.slice(J,U)),J=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(J,U)),J=U;continue}if(z==="{"){Q++,Y.push(z),J++;continue}if(z==="}"){Q--,Y.push(z),J++;continue}if(Q===0){let U=J>0?$[J-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=W(J+B[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),J=H;continue}Z.add(j),Y.push($.slice(J,H)),J=H;continue}}}Y.push(z),J++}return Y.join("")}async function KY($,Z,Y){let J=QY($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,X=[];for(let H of J){let L=H.body;if(A1(H.attrs))L=N1(L);if(Q.test(L))X.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(X.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${_W++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (n5(),i5)),W=[];for(let H=0;H<X.length;H++){let L=X[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{[^}]*\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,"// [stx import stripped \u2014 resolved via window.stx in __stx_setup]");let F=$1(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
8085
+ ${F}`)}let z=W.join(`
8086
+
8087
+ `);z=AW(z);let U=qY(z),_=o5(z,Y),B=`
8088
8088
  <script data-stx-scoped>
8089
8089
  function ${G}() {
8090
8090
  const { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
8091
- ${_}${q}
8091
+ ${_}${z}
8092
8092
  return { ${U} };
8093
8093
  }
8094
8094
  if(window.stx)window.stx._latestSetup=${G};
8095
- </script>`,j=$;for(let H of X)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function tY($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,z="",K=()=>{X++;let j=!1;while(X<G){let H=Z[X];if(H==="\\"){X+=2;continue}if(H==="["&&!j){j=!0,X++;continue}if(H==="]"&&j){j=!1,X++;continue}if(H==="/"&&!j){X++;while(X<G&&/[gimsuyd]/.test(Z[X]))X++;return}if(H===`
8096
- `)return;X++}},W=()=>{if(!z)return!0;if(/[\w)\]]/.test(z))return!1;return!0},q=(j)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===j){X++;return}X++}},U=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let j=1;while(X<G&&j>0)if(Z[X]==="{")j++,X++;else if(Z[X]==="}")j--,X++;else if(Z[X]==="'"||Z[X]==='"')q(Z[X]);else if(Z[X]==="`")U();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
8097
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(X).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(X).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let F=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let O=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){q(Z[X]),z=Z[X-1];continue}if(Z[X]==="`"){U(),z="`";continue}if(Z[X]==="/"&&Z[X+1]!=="/"&&Z[X+1]!=="*"&&W()){K(),z="/";continue}if(Z[X]==="{"){Q++,z="{",X++;continue}if(Z[X]==="}"){Q--,z="}",X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))B();if(!/\s/.test(Z[X]))z=Z[X];X++}return Y.join(", ")}async function I3($,Z,Y,J){if(!O4($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:X,setupCode:G}=await aY(Q,Y,J);if(Q=X,Q=await cY(Q,Z),Q=pY(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
8095
+ </script>`,j=$;for(let H of X)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;j=j.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/gi,(F,O,V)=>{if(L||H.includes(O.toLowerCase()))return F;return L=!0,`<${O}${V} data-stx="${G}">`})}return{output:j,setupCode:B}}function qY($){let Z=$,Y=[],J=new Set,Q=0,X=0,G=Z.length,K="",q=()=>{X++;let j=!1;while(X<G){let H=Z[X];if(H==="\\"){X+=2;continue}if(H==="["&&!j){j=!0,X++;continue}if(H==="]"&&j){j=!1,X++;continue}if(H==="/"&&!j){X++;while(X<G&&/[gimsuyd]/.test(Z[X]))X++;return}if(H===`
8096
+ `)return;X++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===j){X++;return}X++}},U=()=>{X++;while(X<G){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let j=1;while(X<G&&j>0)if(Z[X]==="{")j++,X++;else if(Z[X]==="}")j--,X++;else if(Z[X]==="'"||Z[X]==='"')z(Z[X]);else if(Z[X]==="`")U();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<G&&Z[X]!==`
8097
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<G-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},B=()=>{if(Q!==0)return;let j=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!J.has(V))Y.push(V),J.add(V);return}let H=Z.slice(X).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let A=w.indexOf(":"),R=(A>=0?w.slice(A+1).trim():w).split(/[\s=]/)[0];if(R&&!J.has(R))Y.push(R),J.add(R)});return}let L=Z.slice(X).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let A=w.split(/[\s=]/)[0];if(A&&!J.has(A))Y.push(A),J.add(A)});return}let F=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!J.has(V))Y.push(V),J.add(V);return}let O=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!J.has(V))Y.push(V),J.add(V)}};while(X<G){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){z(Z[X]),K=Z[X-1];continue}if(Z[X]==="`"){U(),K="`";continue}if(Z[X]==="/"&&Z[X+1]!=="/"&&Z[X+1]!=="*"&&W()){q(),K="/";continue}if(Z[X]==="{"){Q++,K="{",X++;continue}if(Z[X]==="}"){Q--,K="}",X++;continue}if(Q===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))B();if(!/\s/.test(Z[X]))K=Z[X];X++}return Y.join(", ")}async function n3($,Z,Y,J){if(!F$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:X,setupCode:G}=await KY(Q,Y,J);if(Q=X,Q=await $Y(Q,Z),Q=e2(Q),G)if(Q.includes("</head>"))Q=Q.replace("</head>",`${G}
8098
8098
  </head>`);else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
8099
8099
  ${G}`);else Q=Q+`
8100
- `+G;let K=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=K&&/data-stx/.test(K[1]);if(!G&&!W&&K&&!/data-stx-auto/.test(K[1])){let q=/<body[^>]*>/i,U=/<(script|style)\b[\s\S]*?<\/\1>/gi,_=[],B;while((B=U.exec(Q))!==null)_.push([B.index,B.index+B[0].length]);let j=0,H=-1;while(j<Q.length){q.lastIndex=j;let L=q.exec(Q.slice(j));if(!L)break;let F=j+L.index;if(!_.some(([V,w])=>F>=V&&F<w)){H=F;break}j=F+L[0].length}if(H!==-1){let L=Q.slice(0,H),F=Q.slice(H).replace(q,(O)=>O.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=L+F}}return Q}var QW=0,j4,oY,iY,R3,_W;var E3=b(()=>{j5();u$();N0();j4=/<script\b([^>]*)>/gi,oY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;iY=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);R3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);_W=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Q5 from"path";function $2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function Z2($,Z,Y){try{let J;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=Q5.join(Q,$);if(await Bun.file(G).exists())return G;Q=Q5.dirname(Q)}J=Q5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=Q5.resolve(Z,$);else J=Q5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function Y2($,Z,Y){let J=$,Q=Q5.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(J))!==null){let[W,q,U,_]=G;if($2(U))continue;let B=await Z2(U,Q,Z);if(B)try{let j=await Bun.file(B).text();if(Y.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
8100
+ `+G;let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=/<(script|style)\b[\s\S]*?<\/\1>/gi,_=[],B;while((B=U.exec(Q))!==null)_.push([B.index,B.index+B[0].length]);let j=0,H=-1;while(j<Q.length){z.lastIndex=j;let L=z.exec(Q.slice(j));if(!L)break;let F=j+L.index;if(!_.some(([V,w])=>F>=V&&F<w)){H=F;break}j=F+L[0].length}if(H!==-1){let L=Q.slice(0,H),F=Q.slice(H).replace(z,(O)=>O.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=L+F}}return Q}var _W=0,O$,XY,YY,p3,VW;var o3=S(()=>{j5();u4();A0();O$=/<script\b([^>]*)>/gi,XY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;YY=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);p3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);VW=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Q5 from"path";function WY($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function UY($,Z,Y){try{let J;if($.startsWith("/")){let Q=Z;for(let X=0;X<5;X++){let G=Q5.join(Q,$);if(await Bun.file(G).exists())return G;Q=Q5.dirname(Q)}J=Q5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=Q5.resolve(Z,$);else J=Q5.resolve(Z,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function _Y($,Z,Y){let J=$,Q=Q5.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=X.exec(J))!==null){let[W,z,U,_]=G;if(WY(U))continue;let B=await UY(U,Q,Z);if(B)try{let j=await Bun.file(B).text();if(Y.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:o0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
8101
8101
  // Source: ${U}
8102
8102
  ${j}
8103
- </script>`;J=J.replace(W,H),X.lastIndex=0}catch(j){}}let z=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=z.exec(J))!==null){let[W,q,U,_]=K,B=q+_;if($2(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let H=await Z2(U,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
8103
+ </script>`;J=J.replace(W,H),X.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[W,z,U,_]=q,B=z+_;if(WY(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let H=await UY(U,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
8104
8104
  /* Source: ${U} */
8105
8105
  ${L}
8106
- </style>`;J=J.replace(W,F),z.lastIndex=0}catch(L){}}}return J}var J2=b(()=>{d1()});function X2($,Z){let Y=$,J=/@json\s*\(/g,Q;while((Q=J.exec(Y))!==null){let X=Q.index,G=X+Q[0].length-1,z=1,K=G+1,W=null,q=!1;while(K<Y.length&&z>0){let V=Y[K];if(q){q=!1,K++;continue}if(V==="\\"&&W){q=!0,K++;continue}if(W){if(V===W)W=null;K++;continue}if(V==='"'||V==="'"||V==="`"){W=V,K++;continue}if(V==="(")z++;else if(V===")"){if(z--,z===0)break}K++}if(z!==0)break;let U=Y.substring(G+1,K).trim(),_=Y.substring(X,K+1),B=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=V;break}}let F=B>=0?U.substring(0,B).trim():U,O=B>=0?U.substring(B+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,X)+N+Y.substring(K+1),J.lastIndex=X+N.length}catch(V){c0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=X+_.length}}return Y}function Q2($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function G2($){let Z=$,Y=/@memo\s*\(/g,J,Q=[];while((J=Y.exec(Z))!==null){let X=J.index,G=X+J[0].length,z=1,K=G;while(K<Z.length&&z>0){if(Z[K]==="(")z++;else if(Z[K]===")")z--;K++}if(z!==0)continue;let W=Z.slice(G,K-1).trim(),q=K,U=Z.slice(q),_=U.indexOf("@endmemo");if(_===-1)continue;let B=U.slice(0,_),j=q+_+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=B.slice(L),O=B.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",D]=A,I=`<${T}${M} data-stx-memo="${W}"${D}>`;N=B.slice(0,L)+I+w.slice(R.length)+B.slice(L+w.length)}else N=`${B.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${B.slice(L+w.length)}`;Q.push({start:X,end:j,replacement:N}),Y.lastIndex=j}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function k3($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function z2($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Q=0,X;while((X=Y.exec($))!==null){let G=X.index,z=G+X[0].length,K=!1,W=!1,q=-1;while(z<$.length){let H=$[z];if(K){if(H==="'")K=!1}else if(W){if(H==='"')W=!1}else if(H==="'")K=!0;else if(H==='"')W=!0;else if(H===">"){q=z;break}z++}if(q===-1)continue;if($.slice(G,q+1).includes("x-cloak"))continue;let _=$.slice(q+1),B=_.indexOf("</"),j=B>=0?_.slice(0,B):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Q,q)+" x-cloak>",Q=q+1}return J+=$.slice(Q),J}function K2($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,Q;while((Q=Z.exec($))!==null){let X=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,X);if(H!==-1)Z.lastIndex=H+j.length;continue}let z=X+Q[0].length,K=!1,W=!1,q=-1;while(z<$.length){let j=$[z];if(K){if(j==="'")K=!1}else if(W){if(j==='"')W=!1}else if(j==="'")K=!0;else if(j==='"')W=!0;else if(j===">"){q=z;break}z++}if(q===-1)continue;let U=$.slice(X+Q[0].length,q);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!HW.test(U))continue;let _=$[q-1]==="/",B=_?q-1:q;Y+=`${$.slice(J,B)} x-cloak${_?" ":""}`,J=B}return Y+=$.slice(J),Y}var HW;var q2=b(()=>{Z1();T0();HW=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function W2($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],X=[];for(let{pattern:G,message:z,suggestion:K}of OW){if(Q.some((q)=>z.includes(q)||G.source.includes(q)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let q=$.split(`
8107
- `),U=[];q.forEach((B,j)=>{if(G.lastIndex=0,G.test(B))U.push(j+1)});let _=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";X.push(` \u2717 ${z}${_}
8108
- \u2192 ${K}`)}}if(X.length>0&&J.enabled){let z=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
8106
+ </style>`;J=J.replace(W,F),K.lastIndex=0}catch(L){}}}return J}var BY=S(()=>{m1()});function s3($,Z){let Y=$,J=/@json\s*\(/g,Q;while((Q=J.exec(Y))!==null){let X=Q.index,G=X+Q[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),_=Y.substring(X,q+1),B=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){L=!1;continue}if(w==="\\"&&H){L=!0;continue}if(H){if(w===H)H=null;continue}if(w==='"'||w==="'"||w==="`"){H=w;continue}if(w==="("||w==="["||w==="{")j++;else if(w===")"||w==="]"||w==="}")j--;if(w===","&&j===0){B=V;break}}let F=B>=0?U.substring(0,B).trim():U,O=B>=0?U.substring(B+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let A;if(O==="true")A=JSON.stringify(w,null,2);else A=JSON.stringify(w);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,X)+N+Y.substring(q+1),J.lastIndex=X+N.length}catch(V){l0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),J.lastIndex=X+_.length}}return Y}function r3($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function jY($){let Z=$,Y=/@memo\s*\(/g,J,Q=[];while((J=Y.exec(Z))!==null){let X=J.index,G=X+J[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),_=U.indexOf("@endmemo");if(_===-1)continue;let B=U.slice(0,_),j=z+_+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=B.slice(L),O=B.match(/(\s*)$/),V=O?O[0].length:0,w=F.slice(0,F.length-V),A=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[R,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${W}"${I}>`;N=B.slice(0,L)+D+w.slice(R.length)+B.slice(L+w.length)}else N=`${B.slice(0,L)}<div data-stx-memo="${W}">${w}</div>${B.slice(L+w.length)}`;Q.push({start:X,end:j,replacement:N}),Y.lastIndex=j}for(let X=Q.length-1;X>=0;X--){let G=Q[X];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function a3($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function HY($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),J="",Q=0,X;while((X=Y.exec($))!==null){let G=X.index,K=G+X[0].length,q=!1,W=!1,z=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let _=$.slice(z+1),B=_.indexOf("</"),j=B>=0?_.slice(0,B):_.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Q,z)+" x-cloak>",Q=z+1}return J+=$.slice(Q),J}function OY($){let Z=/<[a-z][\w-]*/gi,Y="",J=0,Q;while((Q=Z.exec($))!==null){let X=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,X);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=X+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(X+Q[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!NW.test(U))continue;let _=$[z-1]==="/",B=_?z-1:z;Y+=`${$.slice(J,B)} x-cloak${_?" ":""}`,J=B}return Y+=$.slice(J),Y}var NW;var t3=S(()=>{Z1();R0();NW=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function e3($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],X=[];for(let{pattern:G,message:K,suggestion:q}of RW){if(Q.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let z=$.split(`
8107
+ `),U=[];z.forEach((B,j)=>{if(G.lastIndex=0,G.test(B))U.push(j+1)});let _=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";X.push(` \u2717 ${K}${_}
8108
+ \u2192 ${q}`)}}if(X.length>0&&J.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
8109
8109
  ${X.join(`
8110
8110
  `)}
8111
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(z);else console.warn(z)}}var OW;var U2=b(()=>{OW=[{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"}]});var _2={};r(_2,{getStoreScript:()=>LW,clearStoreCache:()=>FW});import L4 from"path";async function LW($){let Z;if($)Z=L4.resolve($);else{let q=await S1();Z=L4.resolve(q.root||process.cwd(),q.storesDir||"stores")}let Y=G5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),Q=[];try{for await(let q of J.scan({cwd:Z,absolute:!0})){let U=L4.basename(q,".ts");if(["index","types"].includes(U))continue;if(q.includes(".d.ts"))continue;Q.push(q)}}catch{return G5.set(Z,""),null}if(Q.length===0)return G5.set(Z,""),null;let X=[];for(let q of Q){let U=await Bun.file(q).text();X.push({file:q,hasUseStore:/useStore\s*\(/.test(U)})}X.sort((q,U)=>{if(q.hasUseStore===U.hasUseStore)return 0;return q.hasUseStore?1:-1});let G=X.map((q)=>q.file),z=[],K=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let q of G)try{let U=await Bun.file(q).text(),_=L4.basename(q,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=K.transformSync(U),z.push(`// Store: ${_}
8112
- ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${q}:`,U)}if(z.length===0)return G5.set(Z,""),null;let W=`;(function(){
8113
- ${z.join(`
8111
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(K);else console.warn(K)}}var RW;var $6=S(()=>{RW=[{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"}]});var LY={};r(LY,{getStoreScript:()=>TW,clearStoreCache:()=>MW});import V$ from"path";async function TW($){let Z;if($)Z=V$.resolve($);else{let z=await S1();Z=V$.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=G5.get(Z);if(Y!==void 0)return Y||null;let J=new Bun.Glob("*.ts"),Q=[];try{for await(let z of J.scan({cwd:Z,absolute:!0})){let U=V$.basename(z,".ts");if(["index","types"].includes(U))continue;if(z.includes(".d.ts"))continue;Q.push(z)}}catch{return G5.set(Z,""),null}if(Q.length===0)return G5.set(Z,""),null;let X=[];for(let z of Q){let U=await Bun.file(z).text();X.push({file:z,hasUseStore:/useStore\s*\(/.test(U)})}X.sort((z,U)=>{if(z.hasUseStore===U.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=X.map((z)=>z.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:o0()});for(let z of G)try{let U=await Bun.file(z).text(),_=V$.basename(z,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=q.transformSync(U),K.push(`// Store: ${_}
8112
+ ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${z}:`,U)}if(K.length===0)return G5.set(Z,""),null;let W=`;(function(){
8113
+ ${K.join(`
8114
8114
 
8115
8115
  `)}
8116
- })();`;return G5.set(Z,W),W}function FW(){G5.clear()}var G5;var B2=b(()=>{a1();d1();G5=new Map});var H2={};r(H2,{processDeferDirectives:()=>RW});function VW(){return`stx-defer-${++j2}`}function wW($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function AW($,Z,Y){let{trigger:J,value:Q}=wW(Z),X=Y,G,z,K,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let q=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(q)z=q[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)K=U[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:Q,content:X,placeholder:G,loading:z,error:K}}function NW($,Z){let{trigger:Y,triggerValue:J}=Z,Q;switch(Y){case"visible":Q=`
8116
+ })();`;return G5.set(Z,W),W}function MW(){G5.clear()}var G5;var FY=S(()=>{a1();m1();G5=new Map});var wY={};r(wY,{processDeferDirectives:()=>bW});function IW(){return`stx-defer-${++VY}`}function DW($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function EW($,Z,Y){let{trigger:J,value:Q}=DW(Z),X=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:Q,content:X,placeholder:G,loading:K,error:q}}function kW($,Z){let{trigger:Y,triggerValue:J}=Z,Q;switch(Y){case"visible":Q=`
8117
8117
  const observer = new IntersectionObserver((entries) => {
8118
8118
  if (entries[0].isIntersecting) {
8119
8119
  observer.disconnect();
@@ -8186,15 +8186,15 @@ else {
8186
8186
  ${Q}
8187
8187
  })();
8188
8188
  </script>
8189
- `}function RW($,Z,Y){j2=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Q,X,G)=>{let z=VW(),K=AW(Q,X,G),W=K.placeholder?`<div data-defer-placeholder>${K.placeholder}</div>`:"",q=K.loading?`<div data-defer-loading style="display: none;">${K.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=K.error?`<div data-defer-error style="display: none;">${K.error}</div>`:"",_=`<div data-defer-content style="display: none;">${K.content}</div>`,B=NW(z,K);return`
8190
- <div id="${z}" class="stx-defer" data-defer-trigger="${K.trigger}">
8189
+ `}function bW($,Z,Y){VY=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Q,X,G)=>{let K=IW(),q=EW(Q,X,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",z=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",_=`<div data-defer-content style="display: none;">${q.content}</div>`,B=kW(K,q);return`
8190
+ <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
8191
8191
  ${W}
8192
- ${q}
8192
+ ${z}
8193
8193
  ${_}
8194
8194
  ${U}
8195
8195
  </div>
8196
8196
  ${B}
8197
- `})}var j2=0;var L2={};r(L2,{processTeleportDirectives:()=>IW,ensureTeleportTargets:()=>EW});function TW(){return`stx-teleport-${++O2}`}function MW($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function DW($,Z){return`
8197
+ `})}var VY=0;var NY={};r(NY,{processTeleportDirectives:()=>PW,ensureTeleportTargets:()=>vW});function SW(){return`stx-teleport-${++AY}`}function yW($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let Q=1;Q<Z.length;Q++){let X=Z[Q].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function CW($,Z){return`
8198
8198
  <script>
8199
8199
  (function() {
8200
8200
  const source = document.getElementById('${$}');
@@ -8240,12 +8240,12 @@ else {
8240
8240
  });
8241
8241
  })();
8242
8242
  </script>
8243
- `}function IW($,Z,Y){O2=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Q,X,G)=>{let z=TW(),{target:K,disabled:W}=MW(X),q=G.trim();if(W)try{let _=!1;if(W==="true")_=!0;else if(W==="false")_=!1;else if(W in Z)_=Boolean(Z[W]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${q}</div>`}catch{}let U=DW(z,K);return`
8244
- <div id="${z}" class="stx-teleport-source" style="display: none;">
8245
- <template>${q}</template>
8243
+ `}function PW($,Z,Y){AY=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Q,X,G)=>{let K=SW(),{target:q,disabled:W}=yW(X),z=G.trim();if(W)try{let _=!1;if(W==="true")_=!0;else if(W==="false")_=!1;else if(W in Z)_=Boolean(Z[W]);if(_)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=CW(K,q);return`
8244
+ <div id="${K}" class="stx-teleport-source" style="display: none;">
8245
+ <template>${z}</template>
8246
8246
  </div>
8247
8247
  ${U}
8248
- `})}function EW(){return`
8248
+ `})}function vW(){return`
8249
8249
  <script>
8250
8250
  (function() {
8251
8251
  // Common teleport targets
@@ -8262,22 +8262,22 @@ else {
8262
8262
  });
8263
8263
  })();
8264
8264
  </script>
8265
- `}var O2=0;var A2={};r(A2,{processTransitionDirectives:()=>yW,processTransitionAttributes:()=>xW,performLeave:()=>bW,performEnter:()=>SW,generateTransitionRuntime:()=>vW,generateTransitionCSS:()=>PW});function F2($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function kW($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let z=parseFloat(G[1]);return(G[2]||"s")==="ms"?z:z*1000};return Math.max(Q(Y),Q(J))}function V2($,Z){return new Promise((Y)=>{let J=Z??kW($);if(J===0){Y();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(z)=>{if(z.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,J+50)})}function w2($){$.offsetHeight}async function SW($,Z={}){let Y=Z.name||"stx",J=F2(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),w2($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await V2($,Q);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function bW($,Z={}){let Y=Z.name||"stx",J=F2(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),w2($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await V2($,Q);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function yW($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Q,X,G)=>{let z=CW(X),K=z.name||"stx",W=z.duration||300,q=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8265
+ `}var AY=0;var IY={};r(IY,{processTransitionDirectives:()=>hW,processTransitionAttributes:()=>pW,performLeave:()=>gW,performEnter:()=>fW,generateTransitionRuntime:()=>uW,generateTransitionCSS:()=>mW});function RY($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function xW($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",Q=(X)=>{let G=X.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(J))}function TY($,Z){return new Promise((Y)=>{let J=Z??xW($);if(J===0){Y();return}let Q=!1,X=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(X,J+50)})}function MY($){$.offsetHeight}async function fW($,Z={}){let Y=Z.name||"stx",J=RY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),MY($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await TY($,Q);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function gW($,Z={}){let Y=Z.name||"stx",J=RY(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),MY($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await TY($,Q);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function hW($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Q,X,G)=>{let K=dW(X),q=K.name||"stx",W=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
8266
8266
  <div
8267
8267
  class="stx-transition-wrapper"
8268
- data-transition="${K}"
8269
- data-transition-id="${q}"
8268
+ data-transition="${q}"
8269
+ data-transition-id="${z}"
8270
8270
  data-transition-duration="${W}"
8271
- ${z.mode?`data-transition-mode="${z.mode}"`:""}
8271
+ ${K.mode?`data-transition-mode="${K.mode}"`:""}
8272
8272
  >
8273
8273
  ${G.trim()}
8274
8274
  </div>
8275
8275
  <script>
8276
8276
  (function() {
8277
- const wrapper = document.querySelector('[data-transition-id="${q}"]');
8277
+ const wrapper = document.querySelector('[data-transition-id="${z}"]');
8278
8278
  if (!wrapper) return;
8279
8279
 
8280
- const name = '${K}';
8280
+ const name = '${q}';
8281
8281
  const duration = ${W};
8282
8282
 
8283
8283
  // Observe for child changes to trigger transitions
@@ -8304,7 +8304,7 @@ else {
8304
8304
  });
8305
8305
  })();
8306
8306
  </script>
8307
- `})}function CW($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3]||J[4]||J[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function PW(){return`
8307
+ `})}function dW($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3]||J[4]||J[5];switch(Q){case"name":Z.name=X;break;case"duration":Z.duration=parseInt(X,10);break;case"mode":Z.mode=X;break;case"easing":Z.easing=X;break}}return Z}function mW(){return`
8308
8308
  /* STX Transition Presets */
8309
8309
 
8310
8310
  /* Fade */
@@ -8491,7 +8491,7 @@ else {
8491
8491
  opacity: 1;
8492
8492
  max-height: 1000px;
8493
8493
  }
8494
- `}function vW(){return`
8494
+ `}function uW(){return`
8495
8495
  // STX Transition Runtime
8496
8496
  (function() {
8497
8497
  if (typeof window === 'undefined') return;
@@ -8580,7 +8580,7 @@ else {
8580
8580
 
8581
8581
  console.log('[stx] Transition runtime initialized');
8582
8582
  })();
8583
- `}function xW($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,Q,X)=>{let G=Q||"300",z=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${z}"`})}var R2={};r(R2,{withErrorBoundary:()=>N2,processErrorBoundaryDirectives:()=>hW,generateErrorBoundaryRuntime:()=>cW,generateErrorBoundaryCSS:()=>pW,createErrorBoundary:()=>uW});function gW(){return`eb-${++fW}-${Date.now().toString(36)}`}function hW($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Q,X,G,z)=>{let K=gW(),W=dW(X||"");return mW(K,G.trim(),z.trim(),W)})}function dW($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3]||J[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function mW($,Z,Y,J){let Q=J.logErrors!==!1;return`
8583
+ `}function pW($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,Q,X)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${G}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var EY={};r(EY,{withErrorBoundary:()=>DY,processErrorBoundaryDirectives:()=>iW,generateErrorBoundaryRuntime:()=>aW,generateErrorBoundaryCSS:()=>rW,createErrorBoundary:()=>sW});function cW(){return`eb-${++lW}-${Date.now().toString(36)}`}function iW($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Q,X,G,K)=>{let q=cW(),W=nW(X||"");return oW(q,G.trim(),K.trim(),W)})}function nW($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3]||J[4];switch(Q){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function oW($,Z,Y,J){let Q=J.logErrors!==!1;return`
8584
8584
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
8585
8585
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
8586
8586
  ${Z}
@@ -8700,7 +8700,7 @@ else {
8700
8700
  };
8701
8701
  })();
8702
8702
  </script>
8703
- `}async function N2($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function uW($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>N2(J,$,Y)}function pW(){return`
8703
+ `}async function DY($,Z,Y){try{return await $()}catch(J){if(Y)Y(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return Z}}function sW($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>DY(J,$,Y)}function rW(){return`
8704
8704
  /* STX Error Boundary Styles */
8705
8705
  .stx-error-boundary {
8706
8706
  position: relative;
@@ -8744,7 +8744,7 @@ else {
8744
8744
  color: #fecaca;
8745
8745
  }
8746
8746
  }
8747
- `}function cW(){return`
8747
+ `}function aW(){return`
8748
8748
  // STX Error Boundary Runtime
8749
8749
  (function() {
8750
8750
  if (typeof window === 'undefined') return;
@@ -8809,7 +8809,7 @@ else {
8809
8809
 
8810
8810
  console.log('[stx] Error boundary runtime initialized');
8811
8811
  })();
8812
- `}var fW=0;var T2={};r(T2,{renderSSRSuspense:()=>aW,processSuspenseDirectives:()=>nW,generateSuspenseRuntime:()=>eW,generateSuspenseCSS:()=>tW,createSSRSuspense:()=>rW});function iW(){return`suspense-${++lW}-${Date.now().toString(36)}`}function nW($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Q,X,G,z)=>{let K=iW(),W=oW(X||"");return sW(K,G.trim(),z.trim(),W)})}function oW($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function sW($,Z,Y,J){let Q=J.timeout||30000,X=J.id||$;return`
8812
+ `}var lW=0;var kY={};r(kY,{renderSSRSuspense:()=>XU,processSuspenseDirectives:()=>$U,generateSuspenseRuntime:()=>GU,generateSuspenseCSS:()=>QU,createSSRSuspense:()=>JU});function eW(){return`suspense-${++tW}-${Date.now().toString(36)}`}function $U($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Q,X,G,K)=>{let q=eW(),W=ZU(X||"");return YU(q,G.trim(),K.trim(),W)})}function ZU($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4];switch(Q){case"id":Z.id=X;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function YU($,Z,Y,J){let Q=J.timeout||30000,X=J.id||$;return`
8813
8813
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${X}" data-status="pending">
8814
8814
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
8815
8815
  ${Y}
@@ -8999,7 +8999,7 @@ else {
8999
8999
  }, 0);
9000
9000
  })();
9001
9001
  </script>
9002
- `}function rW($,Z,Y){return{id:$,fallback:Y,content:Z}}async function aW($){let Z=$.map((J)=>`
9002
+ `}function JU($,Z,Y){return{id:$,fallback:Y,content:Z}}async function XU($){let Z=$.map((J)=>`
9003
9003
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
9004
9004
  ${J.fallback}
9005
9005
  </div>
@@ -9024,7 +9024,7 @@ else {
9024
9024
  }
9025
9025
  })();
9026
9026
  </script>
9027
- `}}return{initial:Z,streaming:Y()}}function tW(){return`
9027
+ `}}return{initial:Z,streaming:Y()}}function QU(){return`
9028
9028
  /* STX Suspense Styles */
9029
9029
  .stx-suspense {
9030
9030
  position: relative;
@@ -9080,7 +9080,7 @@ else {
9080
9080
  background-size: 200% 100%;
9081
9081
  }
9082
9082
  }
9083
- `}function eW(){return`
9083
+ `}function GU(){return`
9084
9084
  // STX Suspense Runtime
9085
9085
  (function() {
9086
9086
  if (typeof window === 'undefined') return;
@@ -9147,7 +9147,7 @@ else {
9147
9147
 
9148
9148
  console.log('[stx] Suspense runtime initialized');
9149
9149
  })();
9150
- `}var lW=0;var E2={};r(E2,{processAsyncDirectives:()=>ZU,isAsyncComponent:()=>JU,generateAsyncComponentRuntime:()=>QU,generateAsyncComponentCSS:()=>XU,defineAsyncComponent:()=>YU});function M2(){return`async-${++$U}-${Date.now().toString(36)}`}function ZU($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(J,(G,z,K,W)=>{let q=M2(),U=D2(z);return I2(q,U,K.trim(),W.trim())}),X=X.replace(Q,(G,z,K)=>{let W=M2(),q=D2(z);return I2(W,q,K.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function D2($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4],z=J[5];switch(Q){case"component":Z.component=X||z||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=z==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=X||z;break;case"errorComponent":Z.errorComponent=X||z;break}}return Z}function I2($,Z,Y,J){let{component:Q,timeout:X,delay:G,suspensible:z,retries:K}=Z;return`
9150
+ `}var tW=0;var CY={};r(CY,{processAsyncDirectives:()=>qU,isAsyncComponent:()=>WU,generateAsyncComponentRuntime:()=>_U,generateAsyncComponentCSS:()=>UU,defineAsyncComponent:()=>zU});function bY(){return`async-${++KU}-${Date.now().toString(36)}`}function qU($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(J,(G,K,q,W)=>{let z=bY(),U=SY(K);return yY(z,U,q.trim(),W.trim())}),X=X.replace(Q,(G,K,q)=>{let W=bY(),z=SY(K);return yY(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function SY($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4],K=J[5];switch(Q){case"component":Z.component=X||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function yY($,Z,Y,J){let{component:Q,timeout:X,delay:G,suspensible:K,retries:q}=Z;return`
9151
9151
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
9152
9152
  <div class="stx-async-loading" data-async-loading="${$}">
9153
9153
  ${Y}
@@ -9164,8 +9164,8 @@ else {
9164
9164
  const componentPath = '${Q}';
9165
9165
  const timeout = ${X};
9166
9166
  const delay = ${G};
9167
- const suspensible = ${z};
9168
- const maxRetries = ${K};
9167
+ const suspensible = ${K};
9168
+ const maxRetries = ${q};
9169
9169
 
9170
9170
  const container = document.querySelector('[data-async-id="' + asyncId + '"]');
9171
9171
  const loadingEl = document.querySelector('[data-async-loading="' + asyncId + '"]');
@@ -9374,7 +9374,7 @@ catch (error) {
9374
9374
  loadComponent();
9375
9375
  })();
9376
9376
  </script>
9377
- `}function YU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function JU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function XU(){return`
9377
+ `}function zU($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function WU($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function UU(){return`
9378
9378
  /* STX Async Component Styles */
9379
9379
  .stx-async-component {
9380
9380
  position: relative;
@@ -9448,7 +9448,7 @@ catch (error) {
9448
9448
  background-size: 200% 100%;
9449
9449
  }
9450
9450
  }
9451
- `}function QU(){return`
9451
+ `}function _U(){return`
9452
9452
  // STX Async Component Runtime
9453
9453
  (function() {
9454
9454
  if (typeof window === 'undefined') return;
@@ -9502,7 +9502,7 @@ catch (error) {
9502
9502
 
9503
9503
  console.log('[stx] Async component runtime initialized');
9504
9504
  })();
9505
- `}var $U=0;var S2={};r(S2,{shouldCacheComponent:()=>UU,processKeepAliveDirectives:()=>zU,onDeactivated:()=>HU,onActivated:()=>jU,generateKeepAliveRuntime:()=>BU,generateKeepAliveCSS:()=>_U,createKeepAliveCache:()=>WU});function k2(){return`keep-alive-${++GU}-${Date.now().toString(36)}`}function zU($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Q,X,G)=>{let z=k2(),K=KU(X||"");return qU(z,G.trim(),K)})}function KU($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function qU($,Z,Y){let{max:J,include:Q,exclude:X}=Y,G=Y.id||$;return`
9505
+ `}var KU=0;var vY={};r(vY,{shouldCacheComponent:()=>FU,processKeepAliveDirectives:()=>jU,onDeactivated:()=>NU,onActivated:()=>AU,generateKeepAliveRuntime:()=>wU,generateKeepAliveCSS:()=>VU,createKeepAliveCache:()=>LU});function PY(){return`keep-alive-${++BU}-${Date.now().toString(36)}`}function jU($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Q,X,G)=>{let K=PY(),q=HU(X||"");return OU(K,G.trim(),q)})}function HU($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let Q=J[1],X=J[2]||J[3],G=J[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function OU($,Z,Y){let{max:J,include:Q,exclude:X}=Y,G=Y.id||$;return`
9506
9506
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
9507
9507
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
9508
9508
  ${Z}
@@ -9515,8 +9515,8 @@ catch (error) {
9515
9515
  const keepAliveId = '${$}';
9516
9516
  const customId = '${G}';
9517
9517
  const maxCache = ${J||10};
9518
- const includeFilter = ${Q?JSON.stringify(Q.split(",").map((z)=>z.trim())):"null"};
9519
- const excludeFilter = ${X?JSON.stringify(X.split(",").map((z)=>z.trim())):"null"};
9518
+ const includeFilter = ${Q?JSON.stringify(Q.split(",").map((K)=>K.trim())):"null"};
9519
+ const excludeFilter = ${X?JSON.stringify(X.split(",").map((K)=>K.trim())):"null"};
9520
9520
 
9521
9521
  const container = document.querySelector('[data-keep-alive-id="' + keepAliveId + '"]');
9522
9522
  const contentEl = document.querySelector('[data-keep-alive-content="' + keepAliveId + '"]');
@@ -9789,7 +9789,7 @@ else {
9789
9789
  });
9790
9790
  })();
9791
9791
  </script>
9792
- `}function WU($={}){return{id:$.id||k2(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function UU($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function _U(){return`
9792
+ `}function LU($={}){return{id:$.id||PY(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function FU($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function VU(){return`
9793
9793
  /* STX Keep-Alive Styles */
9794
9794
  .stx-keep-alive {
9795
9795
  position: relative;
@@ -9814,7 +9814,7 @@ else {
9814
9814
  .stx-keep-alive-content > [data-activated] {
9815
9815
  opacity: 1;
9816
9816
  }
9817
- `}function BU(){return`
9817
+ `}function wU(){return`
9818
9818
  // STX Keep-Alive Runtime
9819
9819
  (function() {
9820
9820
  if (typeof window === 'undefined') return;
@@ -9850,19 +9850,19 @@ else {
9850
9850
 
9851
9851
  console.log('[stx] Keep-alive runtime initialized');
9852
9852
  })();
9853
- `}function jU($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function HU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var GU=0;var v2={};r(v2,{useVirtualList:()=>y2,processVirtualListDirectives:()=>b3,processVirtualGridDirectives:()=>P2,processInfiniteListDirectives:()=>C2,generateVirtualListCSS:()=>b2,default:()=>OU,createVirtualList:()=>S3});function S3($,Z){let{itemHeight:Y,containerHeight:J,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:z=Y,direction:K="vertical"}=Z,W=[...$],q=0,U=new Map;function _(){if(G)return B();let N=Math.max(0,Math.floor(q/Y)-Q),R=Math.ceil(J/Y),T=Math.min(W.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function B(){let N=0,R=0,T=W.length-1;for(let M=0;M<W.length;M++){let D=U.get(M)||z;if(N+D>q){R=Math.max(0,M-Q);break}N+=D}N=0;for(let M=0;M<W.length;M++){let D=U.get(M)||z;if(N+=D,N>q+J){T=Math.min(W.length-1,M+Q);break}}return{startIndex:R,endIndex:T}}function j(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=U.get(R)||z;return N}return W.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||z;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=_();return{startIndex:N,endIndex:R,scrollTop:q,totalHeight:j(),visibleItems:W.slice(N,R+1),itemHeights:new Map(U)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){q=Math.max(0,Math.min(N,j()-J))}function V(){_()}function w(N){W=[...N],U.clear(),V()}function A(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function b3($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Q,X,G,z)=>{let K=X.trim(),W=Z[K];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${K}" not found or not an array -->`;let q={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();q={...q,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(q.containerHeight/q.itemHeight),B=q.overscan||3,j=0,H=Math.min(W.length-1,_+B),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=z.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
9854
- <div class="virtual-item ${q.itemClass||""}"
9855
- style="position: absolute; top: ${O*q.itemHeight}px; height: ${q.itemHeight}px; width: 100%;"
9853
+ `}function AU($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function NU($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var BU=0;var dY={};r(dY,{useVirtualList:()=>fY,processVirtualListDirectives:()=>Y6,processVirtualGridDirectives:()=>hY,processInfiniteListDirectives:()=>gY,generateVirtualListCSS:()=>xY,default:()=>RU,createVirtualList:()=>Z6});function Z6($,Z){let{itemHeight:Y,containerHeight:J,overscan:Q=3,keyProperty:X="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function _(){if(G)return B();let N=Math.max(0,Math.floor(z/Y)-Q),R=Math.ceil(J/Y),T=Math.min(W.length-1,N+R+Q*2);return{startIndex:N,endIndex:T}}function B(){let N=0,R=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(N+I>z){R=Math.max(0,M-Q);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(N+=I,N>z+J){T=Math.min(W.length-1,M+Q);break}}return{startIndex:R,endIndex:T}}function j(){if(G){let N=0;for(let R=0;R<W.length;R++)N+=U.get(R)||K;return N}return W.length*Y}function H(N){if(G){let R=0;for(let T=0;T<N;T++)R+=U.get(T)||K;return R}return N*Y}function L(){let{startIndex:N,endIndex:R}=_();return{startIndex:N,endIndex:R,scrollTop:z,totalHeight:j(),visibleItems:W.slice(N,R+1),itemHeights:new Map(U)}}function F(N,R="auto"){let T=H(N);O(T,R)}function O(N,R="auto"){z=Math.max(0,Math.min(N,j()-J))}function V(){_()}function w(N){W=[...N],U.clear(),V()}function A(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:w,destroy:A}}function Y6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Q,X,G,K)=>{let q=X.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(z.containerHeight/z.itemHeight),B=z.overscan||3,j=0,H=Math.min(W.length-1,_+B),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
9854
+ <div class="virtual-item ${z.itemClass||""}"
9855
+ style="position: absolute; top: ${O*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
9856
9856
  data-index="${O}">
9857
9857
  ${w}
9858
- </div>`}let F=W.length*q.itemHeight;return`
9858
+ </div>`}let F=W.length*z.itemHeight;return`
9859
9859
  <div id="${U}"
9860
- class="virtual-list-container ${q.containerClass||""}"
9861
- style="position: relative; height: ${q.containerHeight}px; overflow-y: auto;"
9862
- data-item-height="${q.itemHeight}"
9860
+ class="virtual-list-container ${z.containerClass||""}"
9861
+ style="position: relative; height: ${z.containerHeight}px; overflow-y: auto;"
9862
+ data-item-height="${z.itemHeight}"
9863
9863
  data-total-items="${W.length}"
9864
9864
  data-overscan="${B}">
9865
- <div class="virtual-list-viewport ${q.viewportClass||""}"
9865
+ <div class="virtual-list-viewport ${z.viewportClass||""}"
9866
9866
  style="position: relative; height: ${F}px; width: 100%;">
9867
9867
  ${L}
9868
9868
  </div>
@@ -9873,12 +9873,12 @@ else {
9873
9873
  if (!container) return;
9874
9874
 
9875
9875
  const viewport = container.querySelector('.virtual-list-viewport');
9876
- const itemHeight = ${q.itemHeight};
9876
+ const itemHeight = ${z.itemHeight};
9877
9877
  const totalItems = ${W.length};
9878
9878
  const overscan = ${B};
9879
- const containerHeight = ${q.containerHeight};
9879
+ const containerHeight = ${z.containerHeight};
9880
9880
  const items = ${JSON.stringify(W)};
9881
- const template = ${JSON.stringify(z.trim())};
9881
+ const template = ${JSON.stringify(K.trim())};
9882
9882
 
9883
9883
  let lastStartIndex = 0;
9884
9884
 
@@ -9896,7 +9896,7 @@ else {
9896
9896
  for (let i = startIndex; i <= endIndex; i++) {
9897
9897
  const item = items[i];
9898
9898
  const div = document.createElement('div');
9899
- div.className = 'virtual-item ${q.itemClass||""}';
9899
+ div.className = 'virtual-item ${z.itemClass||""}';
9900
9900
  div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
9901
9901
  div.dataset.index = i;
9902
9902
 
@@ -9927,7 +9927,7 @@ else {
9927
9927
  };
9928
9928
  })();
9929
9929
  </script>
9930
- `})}function b2(){return`
9930
+ `})}function xY(){return`
9931
9931
  .virtual-list-container {
9932
9932
  position: relative;
9933
9933
  overflow-y: auto;
@@ -9975,7 +9975,7 @@ else {
9975
9975
  0% { background-position: 200% 0; }
9976
9976
  100% { background-position: -200% 0; }
9977
9977
  }
9978
- `}function y2($,Z){let Y=null,J=()=>{if(!Y)Y=S3($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{J().scrollToIndex(Q)}}}function C2($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(Q,X,G,z,K)=>{let W=X.trim(),q=Z[W];if(!q||!Array.isArray(q))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,B=b3(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${z}@endvirtualList`,Z);return B=B.replace("</script>",`
9978
+ `}function fY($,Z){let Y=null,J=()=>{if(!Y)Y=Z6($(),Z);return Y};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Q)=>{let X=Q.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{J().scrollToIndex(Q)}}}function gY($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(Q,X,G,K,q)=>{let W=X.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let _=`ilist-${Math.random().toString(36).substring(2,9)}`,B=Y6(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return B=B.replace("</script>",`
9979
9979
  // Infinite scroll detection
9980
9980
  container.addEventListener('scroll', function() {
9981
9981
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -9990,18 +9990,18 @@ else {
9990
9990
  <div id="${_}" class="infinite-list-wrapper">
9991
9991
  ${B}
9992
9992
  <div class="infinite-list-loading" style="display: none;">
9993
- ${K}
9993
+ ${q}
9994
9994
  </div>
9995
9995
  </div>
9996
- `})}function P2($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Q,X,G,z)=>{let K=X.trim(),W=Z[K];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${K}" not found or not an array -->`;let q={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();q={...q,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(W.length/q.columns),B=_*(q.rowHeight+(q.gap||0)),j=Math.ceil(q.containerHeight/(q.rowHeight+(q.gap||0))),H=q.overscan||2,L=0,F=Math.min(_-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<q.columns;w++){let A=V*q.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/q.columns),T=V*(q.rowHeight+(q.gap||0)),M=z.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(D,I)=>{if(typeof N==="object"&&N!==null)return String(N[I]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
9996
+ `})}function hY($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Q,X,G,K)=>{let q=X.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,_=Math.ceil(W.length/z.columns),B=_*(z.rowHeight+(z.gap||0)),j=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(_-1,j+H),O="";for(let V=L;V<=F;V++)for(let w=0;w<z.columns;w++){let A=V*z.columns+w;if(A>=W.length)break;let N=W[A],R=w*(100/z.columns),T=V*(z.rowHeight+(z.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,D)=>{if(typeof N==="object"&&N!==null)return String(N[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
9997
9997
  <div class="virtual-grid-item"
9998
- style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/q.columns}% - ${q.gap||0}px); height: ${q.rowHeight}px;"
9998
+ style="position: absolute; top: ${T}px; left: ${R}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
9999
9999
  data-index="${A}">
10000
10000
  ${M}
10001
10001
  </div>`}return`
10002
10002
  <div id="${U}"
10003
10003
  class="virtual-grid-container"
10004
- style="position: relative; height: ${q.containerHeight}px; overflow-y: auto;">
10004
+ style="position: relative; height: ${z.containerHeight}px; overflow-y: auto;">
10005
10005
  <div class="virtual-grid-viewport"
10006
10006
  style="position: relative; height: ${B}px; width: 100%;">
10007
10007
  ${O}
@@ -10013,14 +10013,14 @@ else {
10013
10013
  if (!container) return;
10014
10014
 
10015
10015
  const viewport = container.querySelector('.virtual-grid-viewport');
10016
- const columns = ${q.columns};
10017
- const rowHeight = ${q.rowHeight};
10018
- const gap = ${q.gap||0};
10016
+ const columns = ${z.columns};
10017
+ const rowHeight = ${z.rowHeight};
10018
+ const gap = ${z.gap||0};
10019
10019
  const totalItems = ${W.length};
10020
10020
  const overscan = ${H};
10021
- const containerHeight = ${q.containerHeight};
10021
+ const containerHeight = ${z.containerHeight};
10022
10022
  const items = ${JSON.stringify(W)};
10023
- const template = ${JSON.stringify(z.trim())};
10023
+ const template = ${JSON.stringify(K.trim())};
10024
10024
 
10025
10025
  let lastStartRow = 0;
10026
10026
 
@@ -10063,7 +10063,7 @@ else {
10063
10063
  });
10064
10064
  })();
10065
10065
  </script>
10066
- `})}var OU;var x2=b(()=>{OU={createVirtualList:S3,processVirtualListDirectives:b3,processInfiniteListDirectives:C2,processVirtualGridDirectives:P2,generateVirtualListCSS:b2,useVirtualList:y2}});function f2(){return`<script data-stx-hydration-runtime>
10066
+ `})}var RU;var mY=S(()=>{RU={createVirtualList:Z6,processVirtualListDirectives:Y6,processInfiniteListDirectives:gY,processVirtualGridDirectives:hY,generateVirtualListCSS:xY,useVirtualList:fY}});function uY(){return`<script data-stx-hydration-runtime>
10067
10067
  (function() {
10068
10068
  'use strict';
10069
10069
 
@@ -10223,7 +10223,7 @@ else {
10223
10223
  stxIslands.initIslands();
10224
10224
  }
10225
10225
  })();
10226
- </script>`}function g2($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function h2($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=J.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)Y[X]=Z[G];else Y[X]=G}return Y}var r2={};r(r2,{processStaticDirectives:()=>o2,processPartialHydrationDirectives:()=>m2,onHydrated:()=>n2,isHydrated:()=>i2,hydrateIsland:()=>p2,hydrateByStrategy:()=>c2,hydrateAll:()=>l2,generatePartialHydrationCSS:()=>u2,generateIslandManifest:()=>s2,default:()=>TU,createIslandRegistry:()=>d2});function d2(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function LU($){return`
10226
+ </script>`}function pY($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function lY($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=J.exec($))!==null){let X=Q[1],G=Q[2];if(G in Z)Y[X]=Z[G];else Y[X]=G}return Y}var ZJ={};r(ZJ,{processStaticDirectives:()=>eY,processPartialHydrationDirectives:()=>iY,onHydrated:()=>tY,isHydrated:()=>aY,hydrateIsland:()=>oY,hydrateByStrategy:()=>sY,hydrateAll:()=>rY,generatePartialHydrationCSS:()=>nY,generateIslandManifest:()=>$J,default:()=>SU,createIslandRegistry:()=>cY});function cY(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function TU($){return`
10227
10227
  <script data-hydrate="${$}">
10228
10228
  (function() {
10229
10229
  const island = document.querySelector('[data-island="${$}"]');
@@ -10234,7 +10234,7 @@ else {
10234
10234
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
10235
10235
  })();
10236
10236
  </script>
10237
- `}function FU($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
10237
+ `}function MU($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
10238
10238
  <script data-hydrate="${$}">
10239
10239
  (function() {
10240
10240
  const island = document.querySelector('[data-island="${$}"]');
@@ -10270,7 +10270,7 @@ else {
10270
10270
  }
10271
10271
  })();
10272
10272
  </script>
10273
- `}function VU($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
10273
+ `}function IU($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
10274
10274
  <script data-hydrate="${$}">
10275
10275
  (function() {
10276
10276
  const island = document.querySelector('[data-island="${$}"]');
@@ -10303,7 +10303,7 @@ else {
10303
10303
  }
10304
10304
  })();
10305
10305
  </script>
10306
- `}function wU($,Z){let Y=Z.media||"(min-width: 768px)";return`
10306
+ `}function DU($,Z){let Y=Z.media||"(min-width: 768px)";return`
10307
10307
  <script data-hydrate="${$}">
10308
10308
  (function() {
10309
10309
  const island = document.querySelector('[data-island="${$}"]');
@@ -10332,7 +10332,7 @@ else {
10332
10332
  }
10333
10333
  })();
10334
10334
  </script>
10335
- `}function AU($){return`
10335
+ `}function EU($){return`
10336
10336
  <script data-hydrate="${$}">
10337
10337
  (function() {
10338
10338
  const island = document.querySelector('[data-island="${$}"]');
@@ -10354,7 +10354,7 @@ else {
10354
10354
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
10355
10355
  })();
10356
10356
  </script>
10357
- `}function NU($,Z){let Y=Z.event||"stx:activate";return`
10357
+ `}function kU($,Z){let Y=Z.event||"stx:activate";return`
10358
10358
  <script data-hydrate="${$}">
10359
10359
  (function() {
10360
10360
  const island = document.querySelector('[data-island="${$}"]');
@@ -10375,10 +10375,10 @@ else {
10375
10375
  });
10376
10376
  })();
10377
10377
  </script>
10378
- `}function m2($,Z={},Y){let J=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=z5(J,"load",Z),J=z5(J,"idle",Z),J=z5(J,"visible",Z),J=z5(J,"media",Z),J=RU(J),J=z5(J,"hover",Z),J=z5(J,"event",Z),Q=X&&J!==$,Q)J+=`
10379
- `+f2();return J}function z5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(Q,X,G)=>{let z={strategy:Z};if(X)try{let H=X.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");z[F]=V}}}catch{}let K=`island-${Math.random().toString(36).substring(2,9)}`,W=g2(G.trim()),q=h2(G.trim(),Y),U=[];if(z.rootMargin)U.push(`data-root-margin="${z.rootMargin}"`);if(z.threshold!==void 0)U.push(`data-threshold="${z.threshold}"`);if(z.media)U.push(`data-media="${z.media}"`);if(z.event)U.push(`data-event="${z.event}"`);if(W)U.push(`data-component="${W}"`);let B=Object.keys(q).length>0?`
10380
- <script type="application/json" data-island-props="${K}">${JSON.stringify(q)}</script>`:"",j="";switch(Z){case"load":j=LU(K);break;case"idle":j=FU(K,z);break;case"visible":j=VU(K,z);break;case"media":j=wU(K,z);break;case"hover":j=AU(K);break;case"event":j=NU(K,z);break}return`
10381
- <div data-island="${K}"
10378
+ `}function iY($,Z={},Y){let J=$,Q=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=K5(J,"load",Z),J=K5(J,"idle",Z),J=K5(J,"visible",Z),J=K5(J,"media",Z),J=bU(J),J=K5(J,"hover",Z),J=K5(J,"event",Z),Q=X&&J!==$,Q)J+=`
10379
+ `+uY();return J}function K5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(Q,X,G)=>{let K={strategy:Z};if(X)try{let H=X.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=pY(G.trim()),z=lY(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(W)U.push(`data-component="${W}"`);let B=Object.keys(z).length>0?`
10380
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",j="";switch(Z){case"load":j=TU(q);break;case"idle":j=MU(q,K);break;case"visible":j=IU(q,K);break;case"media":j=DU(q,K);break;case"hover":j=EU(q);break;case"event":j=kU(q,K);break}return`
10381
+ <div data-island="${q}"
10382
10382
  data-strategy="${Z}"
10383
10383
  ${U.join(`
10384
10384
  `)}
@@ -10387,7 +10387,7 @@ else {
10387
10387
  ${G.trim()}${B}
10388
10388
  </div>
10389
10389
  ${j}
10390
- `})}function RU($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10390
+ `})}function bU($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
10391
10391
  <div data-island="${Q}"
10392
10392
  data-strategy="only"
10393
10393
  class="stx-island stx-client-only">
@@ -10406,7 +10406,7 @@ else {
10406
10406
  }
10407
10407
  })();
10408
10408
  </script>
10409
- `})}function u2(){return`
10409
+ `})}function nY(){return`
10410
10410
  /* Island base styles */
10411
10411
  .stx-island {
10412
10412
  display: contents;
@@ -10447,11 +10447,11 @@ else {
10447
10447
  .stx-island.hydrated {
10448
10448
  opacity: 1;
10449
10449
  }
10450
- `}function p2($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function c2($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function l2(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function i2($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function n2($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function o2($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function s2($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
10450
+ `}function oY($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function sY($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function rY(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function aY($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function tY($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function eY($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function $J($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
10451
10451
  <script type="application/json" id="stx-island-manifest">
10452
10452
  ${JSON.stringify(Z)}
10453
10453
  </script>
10454
- `}var TU;var a2=b(()=>{TU={processPartialHydrationDirectives:m2,processStaticDirectives:o2,generatePartialHydrationCSS:u2,generateIslandManifest:s2,createIslandRegistry:d2,hydrateIsland:p2,hydrateByStrategy:c2,hydrateAll:l2,isHydrated:i2,onHydrated:n2}});var KJ={};r(KJ,{watchMultiple:()=>YJ,watchEffect:()=>JJ,watch:()=>ZJ,unref:()=>t2,toRefs:()=>e2,throttledComputed:()=>zJ,stxWatchMultiple:()=>YJ,stxWatchEffect:()=>JJ,stxWatch:()=>ZJ,stxUnref:()=>t2,stxToRefs:()=>e2,stxThrottledComputed:()=>zJ,stxShallowRef:()=>$J,stxRef:()=>K5,stxIsRef:()=>L1,stxDebouncedComputed:()=>GJ,stxComputed:()=>m5,shallowRef:()=>$J,ref:()=>K5,processWatchDirectives:()=>QJ,processComputedDirectives:()=>XJ,isRef:()=>L1,default:()=>MU,debouncedComputed:()=>GJ,computed:()=>m5});function K5($){let Z=$,Y=new Set,J={get value(){if(t0){let Q=d5.get(J);if(!Q)Q=new Set,d5.set(J,Q);Q.add(t0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let X=d5.get(J);if(X)X.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return J}function L1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function t2($){return L1($)?$.value:$}function e2($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=K5($[Y]);return Z}function $J($){return K5($)}function m5($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,z=new Set,K=new Set,W=()=>{if(G=!0,K.size>0){let _=U.value;K.forEach((B)=>B(_))}};function q(){z.clear();let _=t0;t0=W,F4.push(W);try{return Y()}finally{F4.pop(),t0=_}}let U={get value(){if(t0){let _=d5.get(U);if(!_)_=new Set,d5.set(U,_);_.add(t0)}if(G){let _=q();if(!Q(X,_))X=_;G=!1}return X},set value(_){if(J)J(_);else console.warn("Computed property is readonly")},subscribe(_){return K.add(_),()=>K.delete(_)},peek(){if(G)X=Y(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return z}};return U}function ZJ($,Z,Y={}){let{immediate:J=!1,deep:Q=!1,flush:X="pre",once:G=!1}=Y,z,K=!0,W=!1,q=()=>{if(L1($))return Q?f1($.value):$.value;return $()},U=()=>{if(!K||W)return;let j=q();if(z!==void 0&&Object.is(z,j)&&!Q)return;let H=()=>{if(Z(j,z),z=Q?f1(j):j,G)B()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},_=null;if(L1($))_=$.subscribe(()=>U());else _=m5($).subscribe(()=>U());if(J)z=void 0,U();else z=q();let B=()=>{if(K=!1,_)_(),_=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function YJ($,Z,Y={}){let{immediate:J=!1,once:Q=!1}=Y,X=$.map((U)=>L1(U)?U.value:void 0),G=!0,z=!1,K=()=>{if(!G||z)return;let U=$.map((_)=>L1(_)?_.value:void 0);if(Z(U,X),X=[...U],Q)q()},W=$.map((U)=>{if(L1(U))return U.subscribe(()=>K());return()=>{}});if(J)K();let q=()=>{G=!1,W.forEach((U)=>U())};return q.pause=()=>{z=!0},q.resume=()=>{z=!1},q}function JJ($,Z={}){let{flush:Y="pre"}=Z,J,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(J)J();let K=t0;t0=G,F4.push(G);try{J=$()}finally{F4.pop(),t0=K}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let z=()=>{if(Q=!1,J)J()};return z.pause=()=>{X=!0},z.resume=()=>{X=!1},z}function XJ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Q,X,G)=>{try{let K=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=K,`<!-- computed: ${X} = ${K} -->`}catch(z){return`<!-- computed error: ${X} - ${z} -->`}})}function QJ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Q,X,G)=>{return`
10454
+ `}var SU;var YJ=S(()=>{SU={processPartialHydrationDirectives:iY,processStaticDirectives:eY,generatePartialHydrationCSS:nY,generateIslandManifest:$J,createIslandRegistry:cY,hydrateIsland:oY,hydrateByStrategy:sY,hydrateAll:rY,isHydrated:aY,onHydrated:tY}});var BJ={};r(BJ,{watchMultiple:()=>KJ,watchEffect:()=>qJ,watch:()=>GJ,unref:()=>JJ,toRefs:()=>XJ,throttledComputed:()=>_J,stxWatchMultiple:()=>KJ,stxWatchEffect:()=>qJ,stxWatch:()=>GJ,stxUnref:()=>JJ,stxToRefs:()=>XJ,stxThrottledComputed:()=>_J,stxShallowRef:()=>QJ,stxRef:()=>q5,stxIsRef:()=>L1,stxDebouncedComputed:()=>UJ,stxComputed:()=>u5,shallowRef:()=>QJ,ref:()=>q5,processWatchDirectives:()=>WJ,processComputedDirectives:()=>zJ,isRef:()=>L1,default:()=>yU,debouncedComputed:()=>UJ,computed:()=>u5});function q5($){let Z=$,Y=new Set,J={get value(){if(t0){let Q=m5.get(J);if(!Q)Q=new Set,m5.set(J,Q);Q.add(t0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let X=m5.get(J);if(X)X.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return J}function L1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function JJ($){return L1($)?$.value:$}function XJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=q5($[Y]);return Z}function QJ($){return q5($)}function u5($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,X,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let _=U.value;q.forEach((B)=>B(_))}};function z(){K.clear();let _=t0;t0=W,w$.push(W);try{return Y()}finally{w$.pop(),t0=_}}let U={get value(){if(t0){let _=m5.get(U);if(!_)_=new Set,m5.set(U,_);_.add(t0)}if(G){let _=z();if(!Q(X,_))X=_;G=!1}return X},set value(_){if(J)J(_);else console.warn("Computed property is readonly")},subscribe(_){return q.add(_),()=>q.delete(_)},peek(){if(G)X=Y(),G=!1;return X},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function GJ($,Z,Y={}){let{immediate:J=!1,deep:Q=!1,flush:X="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(L1($))return Q?g1($.value):$.value;return $()},U=()=>{if(!q||W)return;let j=z();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?g1(j):j,G)B()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},_=null;if(L1($))_=$.subscribe(()=>U());else _=u5($).subscribe(()=>U());if(J)K=void 0,U();else K=z();let B=()=>{if(q=!1,_)_(),_=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function KJ($,Z,Y={}){let{immediate:J=!1,once:Q=!1}=Y,X=$.map((U)=>L1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((_)=>L1(_)?_.value:void 0);if(Z(U,X),X=[...U],Q)z()},W=$.map((U)=>{if(L1(U))return U.subscribe(()=>q());return()=>{}});if(J)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function qJ($,Z={}){let{flush:Y="pre"}=Z,J,Q=!0,X=!1,G=()=>{if(!Q||X)return;if(J)J();let q=t0;t0=G,w$.push(G);try{J=$()}finally{w$.pop(),t0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,J)J()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function zJ($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Q,X,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function WJ($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Q,X,G)=>{return`
10455
10455
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
10456
10456
  (function() {
10457
10457
  // Watch implementation for ${X}
@@ -10463,9 +10463,9 @@ else {
10463
10463
  }
10464
10464
  })();
10465
10465
  </script>
10466
- `})}function f1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>f1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,Q)=>Y.set(f1(Q),f1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(f1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=f1($[Y]);return Z}function GJ($,Z=100){let Y=K5($()),J=null,Q=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return m5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function zJ($,Z=100){let Y=K5($()),J=0,Q=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return m5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var t0=null,F4,d5,MU;var qJ=b(()=>{F4=[],d5=new WeakMap;MU={ref:K5,computed:m5,watch:ZJ,watchMultiple:YJ,watchEffect:JJ,isRef:L1,unref:t2,toRefs:e2,shallowRef:$J,debouncedComputed:GJ,throttledComputed:zJ,processComputedDirectives:XJ,processWatchDirectives:QJ}});var BJ={};r(BJ,{v:()=>DU,processHasErrorsDirective:()=>_J,processFormValidationDirectives:()=>EU,processErrorsDirective:()=>UJ,processErrorDirective:()=>WJ,defineForm:()=>IU,Validator:()=>q5});class q5{rules=[];defaultValue="";addRule($){let Z=new q5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,Q)=>{if(!Q)return!0;return J===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new q5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return J.validate(Q,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new q5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let Q=await J.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let Q=J.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function IU($,Z){let Y=Object.keys($),J={},Q={},X={},G={},z={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1,z[O]=!1;let K=!1;async function W(O){z[O]=!0;let V=await $[O].validate(J[O],J);return Q[O]=V,z[O]=!1,V.length===0}async function q(){K=!0;let O=await Promise.all(Y.map(W));return K=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1}function _(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function B(O,V){J[O]=V,G[O]=!0}function j(O,V=!0){if(X[O]=V,V)W(O)}function H(O){return{value:J[O],errors:Q[O],touched:X[O],dirty:G[O],valid:Q[O].length===0,validating:z[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)X[A]=!0;if(await q())await O(J)}}return{values:J,errors:Q,touched:X,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return K||Y.some((O)=>z[O])},get isDirty(){return Y.some((O)=>G[O])},validate:q,validateField:W,reset:U,setValues:_,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function WJ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Q,X,G)=>{try{let z=X.trim().split("."),K=Z;for(let q of z)if(K&&typeof K==="object"&&q in K)K=K[q];else return"";let W=K;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((q)=>{return G.replace(/\{\{\s*message\s*\}\}/g,q)}).join(`
10467
- `)}catch{return""}})}function UJ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Q,X,G)=>{try{let z=X.trim().split("."),K=Z;for(let q of z)if(K&&typeof K==="object"&&q in K)K=K[q];else return"";let W=K;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((q)=>G.replace(/\{\{\s*message\s*\}\}/g,q)).join(`
10468
- `)}catch{return""}})}function _J($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Q,X,G)=>{try{let z=X.trim().split("."),K=Z;for(let q of z)if(K&&typeof K==="object"&&q in K)K=K[q];else return"";let W=K;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function EU($,Z,Y){let J=$;return J=WJ(J,Z,Y),J=UJ(J,Z,Y),J=_J(J,Z,Y),J}var DU;var jJ=b(()=>{DU=new q5});var LJ={};r(LJ,{processXElementDirectives:()=>kU,hasXElementDirectives:()=>OJ,generateXElementRuntime:()=>HJ});function HJ(){return`<script data-stx-scoped>
10466
+ `})}function g1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>g1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,Q)=>Y.set(g1(Q),g1(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(g1(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=g1($[Y]);return Z}function UJ($,Z=100){let Y=q5($()),J=null,Q=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return u5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function _J($,Z=100){let Y=q5($()),J=0,Q=()=>{let G=Date.now();if(G-J>=Z)J=G,Y.value=$()};return u5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var t0=null,w$,m5,yU;var jJ=S(()=>{w$=[],m5=new WeakMap;yU={ref:q5,computed:u5,watch:GJ,watchMultiple:KJ,watchEffect:qJ,isRef:L1,unref:JJ,toRefs:XJ,shallowRef:QJ,debouncedComputed:UJ,throttledComputed:_J,processComputedDirectives:zJ,processWatchDirectives:WJ}});var FJ={};r(FJ,{v:()=>CU,processHasErrorsDirective:()=>LJ,processFormValidationDirectives:()=>vU,processErrorsDirective:()=>OJ,processErrorDirective:()=>HJ,defineForm:()=>PU,Validator:()=>z5});class z5{rules=[];defaultValue="";addRule($){let Z=new z5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Y}})}length($,Z,Y){let J=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:J,validate:(Q)=>{if(!Q)return!0;let X=String(Q).length;return X>=$&&X<=Z||J}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Y}})}between($,Z,Y){let J=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:J,validate:(Q)=>{if(!Q&&Q!==0)return!0;let X=Number(Q);return X>=$&&X<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,Q)=>{if(!Q)return!0;return J===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(J)=>{if(!J)return!0;return $.includes(J)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),J=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new z5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(Q,X)=>{if(!$(Q,X||{}))return!0;return J.validate(Q,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new z5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let Q=await J.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let Q=J.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function PU($,Z){let Y=Object.keys($),J={},Q={},X={},G={},K={};for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(J[O],J);return Q[O]=V,K[O]=!1,V.length===0}async function z(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function U(){for(let O of Y)J[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],X[O]=!1,G[O]=!1}function _(O){for(let V of Y)if(V in O)J[V]=O[V],G[V]=!0}function B(O,V){J[O]=V,G[O]=!0}function j(O,V=!0){if(X[O]=V,V)W(O)}function H(O){return{value:J[O],errors:Q[O],touched:X[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)X[A]=!0;if(await z())await O(J)}}return{values:J,errors:Q,touched:X,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:W,reset:U,setValues:_,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function HJ($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
10467
+ `)}catch{return""}})}function OJ($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
10468
+ `)}catch{return""}})}function LJ($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Q,X,G)=>{try{let K=X.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function vU($,Z,Y){let J=$;return J=HJ(J,Z,Y),J=OJ(J,Z,Y),J=LJ(J,Z,Y),J}var CU;var VJ=S(()=>{CU=new z5});var NJ={};r(NJ,{processXElementDirectives:()=>xU,hasXElementDirectives:()=>AJ,generateXElementRuntime:()=>wJ});function wJ(){return`<script data-stx-scoped>
10469
10469
  (function() {
10470
10470
  'use strict';
10471
10471
 
@@ -10749,16 +10749,16 @@ else {
10749
10749
  // Expose for manual initialization
10750
10750
  window.XElement = XElement;
10751
10751
  })();
10752
- </script>`}function OJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function kU($){if(!OJ($))return $;let Z=HJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
10752
+ </script>`}function AJ($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function xU($){if(!AJ($))return $;let Z=wJ(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
10753
10753
  `+$.slice(Y);return $+`
10754
- `+Z}var FJ={};r(FJ,{rewriteImagesWithSiblings:()=>yU});import J1 from"path";async function yU($,Z){let Y=Z.formats??bU;if(!Z.publicDir)return $;let J=vU($),Q=[],X=/<img\b[^>]*?>/gi,G=[],z;while((z=X.exec($))!==null){let U=z[0],_=U.match(/\bsrc=["']([^"']+)["']/i);if(!_)continue;if(xU(z.index,J))continue;G.push({idx:z.index,length:U.length,src:_[1],raw:U})}if(G.length===0)return $;let K=await Promise.all(G.map(async(U)=>{let _=await CU(U.src,Z.publicDir,Y);return{match:U,sources:_}}));for(let{match:U,sources:_}of K){if(_.length===0)continue;let j=`<picture>${_.map((H)=>`<source type="${H.mime}" srcset="${fU(H.url)}">`).join("")}${U.raw}</picture>`;Q.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(Q.length===0)return $;let W="",q=0;for(let U of Q)W+=$.slice(q,U.start),W+=U.replacement,q=U.end;return W+=$.slice(q),W}async function CU($,Z,Y){if(!PU($))return[];let J=J1.extname($).toLowerCase();if(!SU.has(J))return[];if(!$.startsWith("/"))return[];let Q=J1.join(Z,$.slice(1)),X=J1.dirname(Q),G=J1.basename(Q,J),z=J1.resolve(X),K=J1.resolve(Z);if(!z.startsWith(K))return[];let W=J1.posix.dirname($),q=Y.map(async(_)=>{let B=J1.join(X,`${G}${_.ext}`);if(!await Bun.file(B).exists())return null;return{url:J1.posix.join(W,`${G}${_.ext}`),mime:_.mime}});return(await Promise.all(q)).filter((_)=>_!==null)}function PU($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function vU($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function xU($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function fU($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var SU,bU;var VJ=b(()=>{SU=new Set([".jpg",".jpeg",".png",".gif"]),bU=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});function y3($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var wJ=()=>{};var AJ={};r(AJ,{injectPwaTags:()=>gU,generateThemeColorMeta:()=>mU,generateSwRegistrationScript:()=>hU,generatePwaTags:()=>V4,generateManifestLink:()=>dU});function V4($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=y3($),X=`
10754
+ `+Z}var RJ={};r(RJ,{rewriteImagesWithSiblings:()=>hU});import J1 from"path";async function hU($,Z){let Y=Z.formats??gU;if(!Z.publicDir)return $;let J=uU($),Q=[],X=/<img\b[^>]*?>/gi,G=[],K;while((K=X.exec($))!==null){let U=K[0],_=U.match(/\bsrc=["']([^"']+)["']/i);if(!_)continue;if(pU(K.index,J))continue;G.push({idx:K.index,length:U.length,src:_[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let _=await dU(U.src,Z.publicDir,Y);return{match:U,sources:_}}));for(let{match:U,sources:_}of q){if(_.length===0)continue;let j=`<picture>${_.map((H)=>`<source type="${H.mime}" srcset="${lU(H.url)}">`).join("")}${U.raw}</picture>`;Q.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(Q.length===0)return $;let W="",z=0;for(let U of Q)W+=$.slice(z,U.start),W+=U.replacement,z=U.end;return W+=$.slice(z),W}async function dU($,Z,Y){if(!mU($))return[];let J=J1.extname($).toLowerCase();if(!fU.has(J))return[];if(!$.startsWith("/"))return[];let Q=J1.join(Z,$.slice(1)),X=J1.dirname(Q),G=J1.basename(Q,J),K=J1.resolve(X),q=J1.resolve(Z);if(!K.startsWith(q))return[];let W=J1.posix.dirname($),z=Y.map(async(_)=>{let B=J1.join(X,`${G}${_.ext}`);if(!await Bun.file(B).exists())return null;return{url:J1.posix.join(W,`${G}${_.ext}`),mime:_.mime}});return(await Promise.all(z)).filter((_)=>_!==null)}function mU($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function uU($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Y.exec($))!==null)Z.push([J.index,J.index+J[0].length]);return Z}function pU($,Z){for(let[Y,J]of Z)if($>=Y&&$<J)return!0;return!1}function lU($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var fU,gU;var TJ=S(()=>{fU=new Set([".jpg",".jpeg",".png",".gif"]),gU=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var MJ=()=>{};function J6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var IJ=S(()=>{MJ()});var DJ={};r(DJ,{injectPwaTags:()=>cU,generateThemeColorMeta:()=>oU,generateSwRegistrationScript:()=>iU,generatePwaTags:()=>A$,generateManifestLink:()=>nU});function A$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=J6($),X=`
10755
10755
  <!-- stx PWA Meta Tags -->
10756
10756
  <link rel="manifest" href="/manifest.json">
10757
- <meta name="theme-color" content="${C3(Y?.themeColor||"#000000")}">
10757
+ <meta name="theme-color" content="${X6(Y?.themeColor||"#000000")}">
10758
10758
  <meta name="mobile-web-app-capable" content="yes">
10759
10759
  <meta name="apple-mobile-web-app-capable" content="yes">
10760
10760
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
10761
- <meta name="apple-mobile-web-app-title" content="${C3(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)X+=`
10761
+ <meta name="apple-mobile-web-app-title" content="${X6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)X+=`
10762
10762
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
10763
10763
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
10764
10764
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -10795,12 +10795,12 @@ if ('serviceWorker' in navigator) {
10795
10795
  });
10796
10796
  }
10797
10797
  </script>
10798
- <!-- End stx PWA -->`,X}function gU($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=V4(Z);return $.slice(0,Q)+X+`
10799
- `+$.slice(Q)}return $+V4(Z)}let J=V4(Z);return $.replace("</head>",`${J}
10800
- </head>`)}function hU($){if(!$.pwa?.enabled)return"";return`<script>
10798
+ <!-- End stx PWA -->`,X}function cU($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let X=A$(Z);return $.slice(0,Q)+X+`
10799
+ `+$.slice(Q)}return $+A$(Z)}let J=A$(Z);return $.replace("</head>",`${J}
10800
+ </head>`)}function iU($){if(!$.pwa?.enabled)return"";return`<script>
10801
10801
  if ('serviceWorker' in navigator) {
10802
10802
  window.addEventListener('load', function() {
10803
- navigator.serviceWorker.register('/${y3($)}')
10803
+ navigator.serviceWorker.register('/${J6($)}')
10804
10804
  .then(function(registration) {
10805
10805
  console.log('[PWA] Service Worker registered:', registration.scope);
10806
10806
  })
@@ -10809,43 +10809,43 @@ if ('serviceWorker' in navigator) {
10809
10809
  });
10810
10810
  });
10811
10811
  }
10812
- </script>`}function dU(){return'<link rel="manifest" href="/manifest.json">'}function mU($){return`<meta name="theme-color" content="${C3($)}">`}function C3($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var NJ=b(()=>{wJ()});import y0 from"path";import{deriveLayoutGroup as uU}from"stx-router/layout-metadata";function RJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pU($,Z){let Y=$.length,J=Z,Q=!0,X=[],G=(z)=>z+9<=Y&&$[z]==="<"&&$[z+1]==="/"&&($[z+2]==="s"||$[z+2]==="S")&&($[z+3]==="c"||$[z+3]==="C")&&($[z+4]==="r"||$[z+4]==="R")&&($[z+5]==="i"||$[z+5]==="I")&&($[z+6]==="p"||$[z+6]==="P")&&($[z+7]==="t"||$[z+7]==="T")&&($[z+8]===">"||/\s/.test($[z+8]));while(J<Y){let z=$[J];if(G(J))return J;if(z==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
10813
- `,J+2),J===-1)return-1;J+=1,Q=!0;continue}if(z==="/"&&$[J+1]==="*"){let K=$.indexOf("*/",J+2);if(K===-1)return-1;J=K+2,Q=!0;continue}if(z==="/"&&Q){let K=J+1,W=!1;while(K<Y){let q=$[K];if(q==="\\"){K+=2;continue}if(q==="[")W=!0;else if(q==="]")W=!1;else if(q==="/"&&!W){K++;break}else if(q===`
10814
- `){K=-1;break}K++}if(K===-1){J++,Q=!1;continue}while(K<Y&&/[a-z]/.test($[K]))K++;J=K,Q=!1;continue}if(z==="'"||z==='"'){let K=z;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===K){J++;break}if($[J]===`
10815
- `)break;J++}Q=!1;continue}if(z==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}if(X.length===0)Q=!1;continue}if(z==="}"&&X.length>0){X.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Q=!1;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}continue}if(/\s/.test(z));else if(/[)\].\w$]/.test(z))Q=!1;else Q=!0;J++}return-1}async function j0($,Z,Y,J,Q){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!M5()&&!E$())&&Y&&Y.endsWith(".stx"))r7($,Y);try{return await N6.timeAsync("template-processing",async()=>{let G=await cU($,Z,Y,J,Q);if(X)G=k3(G);if(X&&J.autoShell&&J.buildMode!=="compile"){let z=J.app?.head||{},W=(Z.__stx_runtime_head||null)??V5(),q=(Z.__stx_head_raw||"").trim(),U,_=q.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)U=_[1].trim(),q=q.replace(_[0],"").trim();let B=Z.__sections?.title,j=W.title||U||B,H={...z,...j&&{title:j},meta:[...z.meta||[],...W.meta||[]],link:[...z.link||[],...W.link||[]],script:[...z.script||[],...W.script||[]],headRaw:[z.headRaw,q].filter(Boolean).join(`
10816
- `),...W.htmlAttrs&&{htmlAttrs:{...z.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...z.bodyAttrs||{},...W.bodyAttrs}}},L=j3(G);if(G=xY(G,H),L)G=vY(G,z);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=uU(V);G=G.replace("<head>",`<head>
10817
- <meta name="stx-layout" content="${RJ(V)}">
10818
- <meta name="stx-layout-group" content="${RJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(X)G=PY(G);if(X)try{let{getStoreScript:z}=await Promise.resolve().then(() => (B2(),_2)),K=J.storesDir,W=await z(K);if(W){let q=`<script data-stx-stores>${W}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let _=G.indexOf("</script>",U+24);if(_!==-1){let B=_+9;G=G.slice(0,B)+`
10819
- `+q+G.slice(B)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await k5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof y$)throw G;let z=G instanceof Error?G.message:String(G),K=new E1(`Template processing failed: ${z}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(c0.log(K,{filePath:Y,context:Z}),A7.logDetailedError(K,{filePath:Y,template:$.substring(0,500)}),J.debug)throw K;return V7.createFallbackContent("Template Processing",K)}}async function cU($,Z,Y,J,Q){let X=process.cwd(),G={...J,partialsDir:J.partialsDir&&!y0.isAbsolute(J.partialsDir)?y0.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!y0.isAbsolute(J.componentsDir)?y0.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!y0.isAbsolute(J.layoutsDir)?y0.resolve(X,J.layoutsDir):J.layoutsDir},z=G,K=$;await nU(Y,Z),iU(Z,z),K=await s1(()=>VY(K,Z,Y,z),K,(O)=>{c0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=H5(K,_6,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);K=W.output;let q=W.tokens,U=(O)=>q.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>q[Number(w)]??""),_="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,_),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),K=SY(K),K=await Y2(K,Y,Q);let B={};K=U3(K,B);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(K);if(L)K=K.replace(/@nolayout\b\s*/g,"");let F=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&z.defaultLayout){let O=/<!DOCTYPE\s/i.test(K),V=/@section\s*\(/.test(K);if(!O||V){let w="",A=y0.dirname(Y),N=z.layoutsDir?y0.dirname(z.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=y0.join(A,"_layout.stx");if(await n(T)){w=T;break}let M=y0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(z.layoutsDir){let R=y0.isAbsolute(z.layoutsDir)?z.layoutsDir:y0.resolve(process.cwd(),z.layoutsDir),T=y0.join(R,`${z.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)K=`@section('content')
10820
- ${K.trim()}
10821
- @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Y0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",g1);else j[V]=w.trim();return""}),Z.__sections=j,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(K=_3(K,B),H){let O=[];if(K=K.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
10812
+ </script>`}function nU(){return'<link rel="manifest" href="/manifest.json">'}function oU($){return`<meta name="theme-color" content="${X6($)}">`}function X6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var EJ=S(()=>{IJ()});import C0 from"path";import{deriveLayoutGroup as sU}from"stx-router/layout-metadata";function kJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rU($,Z){let Y=$.length,J=Z,Q=!0,X=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(J<Y){let K=$[J];if(G(J))return J;if(K==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
10813
+ `,J+2),J===-1)return-1;J+=1,Q=!0;continue}if(K==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Q=!0;continue}if(K==="/"&&Q){let q=J+1,W=!1;while(q<Y){let z=$[q];if(z==="\\"){q+=2;continue}if(z==="[")W=!0;else if(z==="]")W=!1;else if(z==="/"&&!W){q++;break}else if(z===`
10814
+ `){q=-1;break}q++}if(q===-1){J++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;J=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
10815
+ `)break;J++}Q=!1;continue}if(K==="`"){J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}if(X.length===0)Q=!1;continue}if(K==="}"&&X.length>0){X.pop(),J++;while(J<Y){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Q=!1;break}if($[J]==="$"&&$[J+1]==="{"){X.push(!0),J+=2,Q=!0;break}J++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;J++}return-1}async function j0($,Z,Y,J,Q){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((J.debug||!M5()&&!k4())&&Y&&Y.endsWith(".stx"))$3($,Y);try{return await n6.timeAsync("template-processing",async()=>{let G=await aU($,Z,Y,J,Q);if(X)G=a3(G);if(X&&J.autoShell&&J.buildMode!=="compile"){let K=J.app?.head||{},W=(Z.__stx_runtime_head||null)??V5(),z=(Z.__stx_head_raw||"").trim(),U,_=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(_)U=_[1].trim(),z=z.replace(_[0],"").trim();let B=Z.__sections?.title,j=W.title||U||B,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
10816
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=P3(G);if(G=i2(G,H),L)G=c2(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],w=sU(V);G=G.replace("<head>",`<head>
10817
+ <meta name="stx-layout" content="${kJ(V)}">
10818
+ <meta name="stx-layout-group" content="${kJ(w)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(X)G=l2(G);if(X)try{let{getStoreScript:K}=await Promise.resolve().then(() => (FY(),LY)),q=J.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=G.indexOf("<script data-stx-scoped>");if(U!==-1){let _=G.indexOf("</script>",U+24);if(_!==-1){let B=_+9;G=G.slice(0,B)+`
10819
+ `+z+G.slice(B)}}}}catch{}if(X&&Z.__stx_inject_css!==!1)G=await b5(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof C4)throw G;let K=G instanceof Error?G.message:String(G),q=new k1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(l0.log(q,{filePath:Y,context:Z}),M7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return R7.createFallbackContent("Template Processing",q)}}async function aU($,Z,Y,J,Q){let X=process.cwd(),G={...J,partialsDir:J.partialsDir&&!C0.isAbsolute(J.partialsDir)?C0.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!C0.isAbsolute(J.componentsDir)?C0.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!C0.isAbsolute(J.layoutsDir)?C0.resolve(X,J.layoutsDir):J.layoutsDir},K=G,q=$;await $_(Y,Z),eU(Z,K),q=await s1(()=>k2(q,Z,Y,K),q,(O)=>{l0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=H5(q,f6,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let z=W.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,w)=>z[Number(w)]??""),_="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,_),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=d2(q),q=await _Y(q,Y,Q);let B={};q=S3(q,B);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let w="",A=C0.dirname(Y),N=K.layoutsDir?C0.dirname(K.layoutsDir):process.cwd();for(let R=0;R<20;R++){let T=C0.join(A,"_layout.stx");if(await n(T)){w=T;break}let M=C0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(w)H=w;else if(K.layoutsDir){let R=C0.isAbsolute(K.layoutsDir)?K.layoutsDir:C0.resolve(process.cwd(),K.layoutsDir),T=C0.join(R,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
10820
+ ${q.trim()}
10821
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,w)=>{return j[V]=w,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,w)=>{if(/^(['"]).*\1$/.test(w.trim()))return O;try{let A=Y0(w.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,w)=>{if(w.includes("@parent"))j[V]=w.replace("@parent",h1);else j[V]=w.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,w)=>{return j[V]||w||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=y3(q,B),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
10822
10822
  `);j.content=j.content?`${j.content}
10823
- ${V}`:V,Z.__sections=j}}if(H)try{let O;if(y0.isAbsolute(H))O=H,Q.add(H);else O=await s1(()=>d4(H,Y,G,Q),null,()=>{throw new E1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(c0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new E1(T,Y);return K}let V=await s1(()=>Bun.file(O).text(),"",()=>{throw new E1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,P,S)=>{return T[P]=S.trim(),""});for(let[E,P]of Object.entries(T))if(j[E]&&j[E].includes(g1)){let S=j[E].indexOf(g1);j[E]=j[E].slice(0,S)+P+j[E].slice(S+g1.length)}else if(!j[E])j[E]=P;let D={...Z,__sections:j},I=`@layout('${w[1]}')${M}`;return await j0(I,D,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=U3(A,B),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,D)=>{return R[M]=D.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,D)=>{if(j[M]){let I=j[M];if(I.includes(g1)){let E=R[M]||"",P=I.indexOf(g1);I=I.slice(0,P)+E+I.slice(P+g1.length)}return I}return D||""}),N=lU(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=_3(N,B),Z.__originalFilePath=Y,K=await TJ(N,Z,O,G,Q),K=`<!-- stx-layout: ${H} -->
10824
- ${K}`,U(K)}catch(O){return c0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await TJ(K,Z,Y,G,Q))}function lU($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,Q)=>{let X=Z[J];if(X!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(X))return X}return Q||""})}function iU($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Q,X]of Object.entries(process.env))if(Q.startsWith(Y)&&X!==void 0)J[Q]=X;$.$env=J}async function nU($,Z){await s1(()=>TY($,Z),void 0,(Y)=>{c0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function oU($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let X=Q[1],G=Q[2];if(!/\bserver\b/.test(X)||!G.trim())continue;try{let{extractVariables:K}=await Promise.resolve().then(() => (N5(),Y$));await K(G,Z,Y,{preserveExisting:!0})}catch(K){let W=K instanceof Error?K:Error(String(K));c0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function sU($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (r0(),V6));return J($,Z,{skipServer:!0})}catch(J){let Q=J instanceof Error?J:Error(String(J));return c0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function TJ($,Z,Y,J,Q){let X=$,G=J;if(await oU(X,Z,Y),X=await sU(X,Z,Y),X=await BY(X,Z,Y),X=await jY(X,Z,Y),X=await s8(X,Z,Y,G),m1(X))X=T3(X,Z),X=D3(X,Z);X=M3(X);let{processStreamDirectives:z}=await Promise.resolve().then(() => (s7(),o7));X=z(X,Z),X=z3(X,Z,Y,G),X=await t$(X,Z,Y,G,Q),X=await yY(X,Z,Y,G,Q),X=c3(X,Z,Y,G);let{processDeferDirectives:K}=await Promise.resolve().then(() => H2);X=K(X,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => L2);X=W(X,Z,Y);let{processTransitionDirectives:q,processTransitionAttributes:U}=await Promise.resolve().then(() => A2);X=q(X,Z,Y),X=U(X);let{processErrorBoundaryDirectives:_}=await Promise.resolve().then(() => R2);X=_(X,Z,Y);let{processSuspenseDirectives:B}=await Promise.resolve().then(() => T2);X=B(X,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => E2);X=j(X,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => S2);X=H(X,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (x2(),v2));X=L(X,Z,Y),X=F(X,Z,Y),X=O(X,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (a2(),r2));X=V(X,Z,Y),X=w(X);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (qJ(),KJ));X=A(X,Z,Y),X=N(X,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (jJ(),BJ));X=R(X,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:D,resetHead:I}=await Promise.resolve().then(() => (w5(),C4));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)I();let E=T(X);if(X=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
10825
- `;if(X=M(X,Z),X=D(X,Z),X=NY(X),X=v7(X,Z),X=n8(X),X=LY(X),X=await W3(X,Z,Y,G,Q),X=await t$(X,Z,Y,G,Q),X=X.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),X=k3(X),X=y1(X,Z,Y),X=x7(X,Z),X=f7(X,Z),X=i$(X,Z),X=$9(X,Z),X=Z9(X,Z),X=await P8(X,Z,Y,G),X=await p6(X,Z,Y),X=await G9(X,Z,Y,G),X=f3(X,Z,Y,G),X=aZ(X,Z,Y,G),X=tZ(X,Z,Y),X=eZ(X,Z,Y,G),X=c8(X,Z,Y,G),X=X2(X,Z),X=Q2(X),X=G2(X),!G.skipEventDirectives)X=I8(X,Z,Y);if(X=y8(X,Z,Y),G.debug){let C=/\bx-data\s*=/.test(X),x=O4($);if(C&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10823
+ ${V}`:V,Z.__sections=j}}if(H)try{let O;if(C0.isAbsolute(H))O=H,Q.add(H);else O=await s1(()=>u$(H,Y,G,Q),null,()=>{throw new k1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(l0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new k1(T,Y);return q}let V=await s1(()=>Bun.file(O).text(),"",()=>{throw new k1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),w=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(w){if(G.debug)console.log(`Found nested layout: ${w[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,P,b)=>{return T[P]=b.trim(),""});for(let[E,P]of Object.entries(T))if(j[E]&&j[E].includes(h1)){let b=j[E].indexOf(h1);j[E]=j[E].slice(0,b)+P+j[E].slice(b+h1.length)}else if(!j[E])j[E]=P;let I={...Z,__sections:j},D=`@layout('${w[1]}')${M}`;return await j0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=S3(A,B),R={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return R[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(h1)){let E=R[M]||"",P=D.indexOf(h1);D=D.slice(0,P)+E+D.slice(P+h1.length)}return D}return I||""}),N=tU(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=y3(N,B),Z.__originalFilePath=Y,q=await bJ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
10824
+ ${q}`,U(q)}catch(O){return l0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await bJ(q,Z,Y,G,Q))}function tU($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,J,Q)=>{let X=Z[J];if(X!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(X))return X}return Q||""})}function eU($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",J={};for(let[Q,X]of Object.entries(process.env))if(Q.startsWith(Y)&&X!==void 0)J[Q]=X;$.$env=J}async function $_($,Z){await s1(()=>P2($,Z),void 0,(Y)=>{l0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function Z_($,Z,Y){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=J.exec($))!==null){let X=Q[1],G=Q[2];if(!/\bserver\b/.test(X)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (N5(),J4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));l0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function Y_($,Z,Y){try{let{interpolateScriptsInTemplate:J}=await Promise.resolve().then(() => (r0(),l6));return J($,Z,{skipServer:!0})}catch(J){let Q=J instanceof Error?J:Error(String(J));return l0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function bJ($,Z,Y,J,Q){let X=$,G=J;if(await Z_(X,Z,Y),X=await Y_(X,Z,Y),X=await R2(X,Z,Y),X=await T2(X,Z,Y),X=await NZ(X,Z,Y,G),u1(X))X=l3(X,Z),X=i3(X,Z);X=c3(X);let{processStreamDirectives:K}=await Promise.resolve().then(() => (e7(),t7));X=K(X,Z),X=D3(X,Z,Y,G),X=await $$(X,Z,Y,G,Q),X=await u2(X,Z,Y,G,Q),X=H6(X,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => wY);X=q(X,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => NY);X=W(X,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await Promise.resolve().then(() => IY);X=z(X,Z,Y),X=U(X);let{processErrorBoundaryDirectives:_}=await Promise.resolve().then(() => EY);X=_(X,Z,Y);let{processSuspenseDirectives:B}=await Promise.resolve().then(() => kY);X=B(X,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => CY);X=j(X,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => vY);X=H(X,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (mY(),dY));X=L(X,Z,Y),X=F(X,Z,Y),X=O(X,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await Promise.resolve().then(() => (YJ(),ZJ));X=V(X,Z,Y),X=w(X);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (jJ(),BJ));X=A(X,Z,Y),X=N(X,Z,Y);let{processFormValidationDirectives:R}=await Promise.resolve().then(() => (VJ(),FJ));X=R(X,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (w5(),v$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(X);if(X=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
10825
+ `;if(X=M(X,Z),X=I(X,Z),X=y2(X),X=h7(X,Z),X=wZ(X),X=D2(X),X=await b3(X,Z,Y,G,Q),X=await $$(X,Z,Y,G,Q),X=X.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),X=a3(X),X=C1(X,Z,Y),X=d7(X,Z),X=m7(X,Z),X=i4(X,Z),X=DZ(X,Z),X=EZ(X,Z),X=await GZ(X,Z,Y,G),X=await H9(X,Z,Y),X=await CZ(X,Z,Y,G),X=q6(X,Z,Y,G),X=R8(X,Z,Y,G),X=T8(X,Z,Y),X=M8(X,Z,Y,G),X=LZ(X,Z,Y,G),X=s3(X,Z),X=r3(X),X=jY(X),!G.skipEventDirectives)X=e8(X,Z,Y);if(X=XZ(X,Z,Y),G.debug){let C=/\bx-data\s*=/.test(X),x=F$($);if(C&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
10826
10826
  Both work on the same page, but they manage separate scopes.
10827
- Prefer signals (state/derived/effect) for new components.`)}X=IY(X,Z),X=await s0(X,Z,Y),X=z2(X),X=K2(X),X=F8(X);let{processXElementDirectives:P}=await Promise.resolve().then(() => LJ);X=P(X);let S=Z.__originalFilePath||Y,k=_5(Z);if(X=await I3(X,G,S,k),X=await wY(X,Z,Y,G),G.media?.image?.autoSiblings){let C=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (VJ(),FJ));X=await x(X,{publicDir:C})}if(G.seo?.enabled)X=$8(X,Z,G);let y=(C,x)=>{if(!x)return C;if(/<\/head>/i.test(C))return C.replace(/<\/head>/i,`${x}
10827
+ Prefer signals (state/derived/effect) for new components.`)}X=f2(X,Z),X=await s0(X,Z,Y),X=HY(X),X=OY(X),X=l8(X);let{processXElementDirectives:P}=await Promise.resolve().then(() => NJ);X=P(X);let b=Z.__originalFilePath||Y,k=_5(Z);if(X=await n3(X,G,b,k),X=await b2(X,Z,Y,G),G.media?.image?.autoSiblings){let C=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (TJ(),RJ));X=await x(X,{publicDir:C})}if(G.seo?.enabled)X=I8(X,Z,G);let y=(C,x)=>{if(!x)return C;if(/<\/head>/i.test(C))return C.replace(/<\/head>/i,`${x}
10828
10828
  </head>`);if(/<head\b[^>]*>/i.test(C))return C.replace(/(<head\b[^>]*>)/i,`$1
10829
10829
  ${x}`);if(/<html\b[^>]*>/i.test(C))return C.replace(/(<html\b[^>]*>)/i,`$1
10830
10830
  <head>
10831
10831
  ${x}
10832
- </head>`);return C},{renderHead:g,getHead:h}=await Promise.resolve().then(() => (w5(),C4)),m=Z.__stx_runtime_head,i=m&&(m.title||m.meta?.length||m.link?.length)?m:h();if(i.title||i.meta?.length||i.link?.length){let C=g(i);if(C)X=y(X,C)}if(E.headContent)X=y(X,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)X=p8(X,G.csp,Z);if(G.analytics?.enabled)X=w8(X,G);if(G.heatmap?.enabled)X=s3(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:C}=await Promise.resolve().then(() => (NJ(),AJ));X=C(X,G)}let c=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),K0=/\bSTX\.\w+/.test(X),V0=/window\.STX\s*=/.test(X);if(c&&K0&&!V0){let x=`<script data-stx-scoped>
10833
- ${j8()}
10834
- </script>`;if(X.includes("</head>")){let u=X.indexOf("</head>"),X0=X.slice(0,u).indexOf("<script");if(X0!==-1){let W0=X.slice(0,X0),S0=X.slice(X0);X=W0+x+`
10835
- `+S0}else X=X.replace("</head>",`${x}
10832
+ </head>`);return C},{renderHead:g,getHead:h}=await Promise.resolve().then(() => (w5(),v$)),m=Z.__stx_runtime_head,i=m&&(m.title||m.meta?.length||m.link?.length)?m:h();if(i.title||i.meta?.length||i.link?.length){let C=g(i);if(C)X=y(X,C)}if(E.headContent)X=y(X,E.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)X=OZ(X,G.csp,Z);if(G.analytics?.enabled)X=i8(X,G);if(G.heatmap?.enabled)X=w6(X,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:C}=await Promise.resolve().then(() => (EJ(),DJ));X=C(X,G)}let l=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),q0=/\bSTX\.\w+/.test(X),V0=/window\.STX\s*=/.test(X);if(l&&q0&&!V0){let x=`<script data-stx-scoped>
10833
+ ${d8()}
10834
+ </script>`;if(X.includes("</head>")){let u=X.indexOf("</head>"),X0=X.slice(0,u).indexOf("<script");if(X0!==-1){let W0=X.slice(0,X0),b0=X.slice(X0);X=W0+x+`
10835
+ `+b0}else X=X.replace("</head>",`${x}
10836
10836
  </head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
10837
10837
  ${x}`);else X=x+`
10838
- `+X}{let C=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=C.exec(X))!==null){let p=x.index+x[0].length,X0=pU(X,p);if(X0===-1)continue;let W0=X0+9;while(W0<X.length&&/\s/.test(X[W0]))W0++;u.push({start:x.index,end:W0}),C.lastIndex=W0}for(let p=u.length-1;p>=0;p--){let{start:X0,end:W0}=u[p];X=X.substring(0,X0)+X.substring(W0)}}let _0=e5(X,Y);if(_0.hasScoped)X=_0.html;let Z0=Z.__stx_event_bindings||[],k0=!1,f0=[],v=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:f}=await Promise.resolve().then(() => (E3(),eY));for(let C of f(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))f0.push({match:C.fullMatch,attrs:C.attrs,content:C.body});for(let{match:C,attrs:x,content:u}of f0){k0=!0;let p=u;W2(u,Y,J.strict);let X0=await B5(u,{eventBindings:Z0,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});X=X.replace(C,()=>X0)}if(k0)Z.__stx_event_bindings=[];return X}var g1="<!--PARENT_CONTENT_PLACEHOLDER-->";var J$=b(()=>{g$();t5();N4();H8();V8();A8();M4();R4();E8();j5();C8();v8();p$();l8();o8();a8();Z1();w5();r0();Y9();z9();_Y();OY();K3();m4();AY();c1();RY();N7();N0();MY();EY();bY();CY();y4();E3();G3();J2();q2();U2();T0();a7()});import F0 from"fs";import J0 from"path";import{matchRoute as F_,Router as mJ}from"stx-router";import{findErrorPage as A_,formatRoutes as N_,generateRouteManifest as R_,generateRouteTypes as T_,matchRoute as M_}from"stx-router";function A4($,Z={}){return new mJ($,Z).routes}J$();import{createHash as rU}from"crypto";function aU($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var tU=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function eU($){return Bun.hash($).toString(16)}function MJ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(tU,(X,G,z,K)=>{let W=K.trim();if(!W)return X;if(/\bdata-stx-src=/.test(z))return X;if(Z.minify)W=aU(W);let q=eU(W);if(!Y.has(q))Y.set(q,W);let U=Z.integrity?` data-stx-integrity="sha384-${rU("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${q}.js"${U}${z}></script>`}),Q=Array.from(Y,([X,G])=>({hash:X,code:G}));return{html:J,chunks:Q}}var $_=new Set(["visible","idle"]);function DJ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let Q=new Set,X=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=X.exec($))!==null)if($_.has(Z.get(G[1])||""))Q.add(G[2]);let z=$.lastIndexOf("</head>");if(Q.size===0||z===-1)return $;let K=Array.from(Q).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!K)return $;return $.slice(0,z)+K+$.slice(z)}a1();g$();import{abortNavigation as hV,clearMiddleware as IJ,createClientCookieManager as dV,createMiddlewareContext as EJ,createRouteLocation as kJ,createServerCookieManager as mV,createStorageManager as uV,defineMiddleware as pV,getMiddleware as cV,getMiddlewareNames as SJ,hasMiddleware as lV,loadMiddlewareFromDirectory as bJ,navigateTo as iV,registerMiddleware as nV,runMiddleware as yJ}from"stx-router";class CJ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=J0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=J0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=F0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let X of Z)if(F0.existsSync(X)){let G=F0.statSync(X);J+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let Q=this.getHash(Z,Y);this.cache.set($,{hash:Q,html:J,generatedAt:Date.now(),dependencies:Y})}}class PJ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return J0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await F0.promises.mkdir(J0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await F0.promises.unlink(Z)}async invalidatePattern($){let Z=J0.join(this.cacheDir,"isr");if(!F0.existsSync(Z))return;let Y=await F0.promises.readdir(Z);for(let J of Y){let Q=J.replace(/_/g,"/").replace(".json","");if($.test(Q))await F0.promises.unlink(J0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function Z_($){try{let Y=(await Bun.file($).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 Q=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
10838
+ `+X}{let C=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=C.exec(X))!==null){let p=x.index+x[0].length,X0=rU(X,p);if(X0===-1)continue;let W0=X0+9;while(W0<X.length&&/\s/.test(X[W0]))W0++;u.push({start:x.index,end:W0}),C.lastIndex=W0}for(let p=u.length-1;p>=0;p--){let{start:X0,end:W0}=u[p];X=X.substring(0,X0)+X.substring(W0)}}let _0=$4(X,Y);if(_0.hasScoped)X=_0.html;let Z0=Z.__stx_event_bindings||[],k0=!1,f0=[],v=/\s:[a-z][\w.-]*\s*=/.test(X),{scanScriptTags:f}=await Promise.resolve().then(() => (o3(),zY));for(let C of f(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))f0.push({match:C.fullMatch,attrs:C.attrs,content:C.body});for(let{match:C,attrs:x,content:u}of f0){k0=!0;let p=u;e3(u,Y,J.strict);let X0=await B5(u,{eventBindings:Z0,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:k});X=X.replace(C,()=>X0)}if(k0)Z.__stx_event_bindings=[];return X}var h1="<!--PARENT_CONTENT_PLACEHOLDER-->";var X4=S(()=>{g4();e5();T$();m8();c8();n8();D$();M$();$Z();j5();QZ();KZ();p4();FZ();AZ();TZ();Z1();w5();r0();kZ();PZ();N2();I2();E3();p$();S2();c1();C2();I7();A0();v2();g2();m2();p2();P$();o3();I3();BY();t3();$6();R0();Z3();t3();$6()});import F0 from"fs";import J0 from"path";import{matchRoute as M_,Router as nJ}from"stx-router";import{findErrorPage as E_,formatRoutes as k_,generateRouteManifest as b_,generateRouteTypes as S_,matchRoute as y_}from"stx-router";function R$($,Z={}){return new nJ($,Z).routes}X4();import{createHash as J_}from"crypto";function X_($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var Q_=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function G_($){return Bun.hash($).toString(16)}function SJ($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,J=$.replace(Q_,(X,G,K,q)=>{let W=q.trim();if(!W)return X;if(/\bdata-stx-src=/.test(K))return X;if(Z.minify)W=X_(W);let z=G_(W);if(!Y.has(z))Y.set(z,W);let U=Z.integrity?` data-stx-integrity="sha384-${J_("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${z}.js"${U}${K}></script>`}),Q=Array.from(Y,([X,G])=>({hash:X,code:G}));return{html:J,chunks:Q}}var K_=new Set(["visible","idle"]);function yJ($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Y.exec($))!==null)Z.set(J[1],J[2]);let Q=new Set,X=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=X.exec($))!==null)if(K_.has(Z.get(G[1])||""))Q.add(G[2]);let K=$.lastIndexOf("</head>");if(Q.size===0||K===-1)return $;let q=Array.from(Q).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,K)+q+$.slice(K)}a1();g4();import{abortNavigation as kw,clearMiddleware as CJ,createClientCookieManager as bw,createMiddlewareContext as PJ,createRouteLocation as vJ,createServerCookieManager as Sw,createStorageManager as yw,defineMiddleware as Cw,getMiddleware as Pw,getMiddlewareNames as xJ,hasMiddleware as vw,loadMiddlewareFromDirectory as fJ,navigateTo as xw,registerMiddleware as fw,runMiddleware as gJ}from"stx-router";class hJ{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=J0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,J]of Object.entries(Z))this.cache.set(Y,J)}catch{}this.loaded=!0}async save(){await F0.promises.mkdir(this.cacheDir,{recursive:!0});let $=J0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,J]of this.cache)Z[Y]=J;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=F0.statSync($),J=`${$}:${Y.mtimeMs}`;for(let X of Z)if(F0.existsSync(X)){let G=F0.statSync(X);J+=`:${X}:${G.mtimeMs}`}let Q=0;for(let X=0;X<J.length;X++){let G=J.charCodeAt(X);Q=(Q<<5)-Q+G,Q=Q&Q}return Math.abs(Q).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let J=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==J)return this.cache.delete($),null;return Y.html}set($,Z,Y,J){let Q=this.getHash(Z,Y);this.cache.set($,{hash:Q,html:J,generatedAt:Date.now(),dependencies:Y})}}class dJ{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return J0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await F0.promises.mkdir(J0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await F0.promises.unlink(Z)}async invalidatePattern($){let Z=J0.join(this.cacheDir,"isr");if(!F0.existsSync(Z))return;let Y=await F0.promises.readdir(Z);for(let J of Y){let Q=J.replace(/_/g,"/").replace(".json","");if($.test(Q))await F0.promises.unlink(J0.join(Z,J))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function q_($){try{let Y=(await Bun.file($).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 Q=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Q)return null;return await Function(`
10839
10839
  return (async function getStaticPaths() {
10840
10840
  ${Q[1]}
10841
10841
  })()
10842
- `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function Y_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await Z_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let Q=$.pattern;for(let[X,G]of Object.entries(J.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function J_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())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:Q,...X}=J;return X}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function X_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Q=J[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
10842
+ `)()}catch(Z){return console.error(`Error extracting static paths from ${$}:`,Z),null}}async function z_($){let Z=[];if(!$.isDynamic)Z.push({url:$.pattern,params:{}});else{let Y=await q_($.filePath);if(!Y||Y.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),Z;for(let J of Y.paths){let Q=$.pattern;for(let[X,G]of Object.entries(J.params))Q=Q.replace(`:${X}`,G).replace(`:${X}*`,G);Z.push({url:Q,params:J.params,props:J.props,revalidate:J.revalidate})}}return Z}async function W_($){let Z=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Y of Z)if(await Bun.file(Y).exists())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:Q,...X}=J;return X}}catch(J){console.error(`Error loading data file ${Y}:`,J)}return null}async function U_($,Z,Y){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Q=J[1];if(!Q.includes("getStaticProps"))return null;try{let X=Q.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!X)return null;return await Function("params",`
10843
10843
  return (async function getStaticProps() {
10844
10844
  ${X[1]}
10845
10845
  })()
10846
- `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${Y}:`,X),null}}async function vJ($,Z,Y={},J,Q){let X=await Bun.file($.filePath).text(),G=await J_($.filePath),z=await X_(X,Z,$.filePath),K={...G||{},...z||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},W=new Set,q={...Q,debug:!1,cache:!1,autoShell:!0},U=await j0(X,K,$.filePath,q,W);if(Object.keys(Z).length>0){let _=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${_}
10846
+ `)(Z)}catch(X){return console.error(`Error executing getStaticProps in ${Y}:`,X),null}}async function mJ($,Z,Y={},J,Q){let X=await Bun.file($.filePath).text(),G=await W_($.filePath),K=await U_(X,Z,$.filePath),q={...G||{},...K||{},...Y,params:Z,$route:{path:$.pattern,params:Z}},W=new Set,z={...Q,debug:!1,cache:!1,autoShell:!0},U=await j0(X,q,$.filePath,z,W);if(Object.keys(Z).length>0){let _=`<script>if(window.stx)window.stx._rp=${JSON.stringify(Z)};else window.__stx_rp=${JSON.stringify(Z)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${_}
10847
10847
  </head>`);else U=`${_}
10848
- ${U}`}if(U=await N3(U),U=await k5(U),J.minify!==!1)return{html:Q_(U),dependencies:Array.from(W)};return{html:U,dependencies:Array.from(W)}}function Q_($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=J.exec($))!==null){let G=$.slice(Y,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let z=Q[1],K=Q[2],W=Q[3];K=K.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(z+K+W),Y=Q.index+Q[0].length}let X=$.slice(Y);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function G_($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function z_($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
10848
+ ${U}`}if(U=await u3(U),U=await b5(U),J.minify!==!1)return{html:__(U),dependencies:Array.from(W)};return{html:U,dependencies:Array.from(W)}}function __($){let Z=[],Y=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Q;while((Q=J.exec($))!==null){let G=$.slice(Y,Q.index);Z.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let K=Q[1],q=Q[2],W=Q[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),Z.push(K+q+W),Y=Q.index+Q[0].length}let X=$.slice(Y);return Z.push(X.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),Z.join("").trim()}function B_($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$.charCodeAt(Y);Z=(Z<<5)-Z+J,Z=Z&Z}return`"${Math.abs(Z).toString(36)}"`}function j_($,Z){return`<?xml version="1.0" encoding="UTF-8"?>
10849
10849
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
10850
10850
  ${$.map((J)=>{let Q=new URL(J.loc,Z).href,X=` <url>
10851
10851
  <loc>${n0(Q)}</loc>`;if(J.lastmod)X+=`
@@ -10854,7 +10854,7 @@ ${$.map((J)=>{let Q=new URL(J.loc,Z).href,X=` <url>
10854
10854
  <priority>${J.priority}</priority>`;return X+=`
10855
10855
  </url>`,X}).join(`
10856
10856
  `)}
10857
- </urlset>`}function n0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function K_($,Z){let Y=Z.map((J)=>{let Q=" <item>";if(Q+=`
10857
+ </urlset>`}function n0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function H_($,Z){let Y=Z.map((J)=>{let Q=" <item>";if(Q+=`
10858
10858
  <title>${n0(J.title)}</title>`,Q+=`
10859
10859
  <link>${n0(J.link)}</link>`,J.description)Q+=`
10860
10860
  <description>${n0(J.description)}</description>`;if(J.pubDate)Q+=`
@@ -10875,10 +10875,10 @@ ${$.map((J)=>{let Q=new URL(J.loc,Z).href,X=` <url>
10875
10875
  ${Y.join(`
10876
10876
  `)}
10877
10877
  </channel>
10878
- </rss>`}async function q_($={}){let Z=Date.now(),Y=await S1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||".stx/ssg-cache",contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},X=new Set,G=0,z={},K={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&F0.existsSync(J.outputDir))await F0.promises.rm(J.outputDir,{recursive:!0});await F0.promises.mkdir(J.outputDir,{recursive:!0});let q=new CJ(J.cacheDir);if(J.cache)await q.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (Q3(),g9));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (g$(),B8));await V('<div class="bg-black"></div>')}catch{}IJ();let U=Y?.routeMiddleware?.dir||"middleware";await bJ(process.cwd(),U);let _=SJ();if(_.length>0)console.log(`Loaded ${_.length} middleware: ${_.join(", ")}`);let B=Y?.routeMiddleware?.global||[],j=A4(".",{pagesDir:J.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let w=await Y_(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}Q.totalPages=H.length,console.log(`Generating ${Q.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:N,params:R,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(N);let D=await Bun.file(A.filePath).text(),I=B_(D),E=I?.middleware?Array.isArray(I.middleware)?I.middleware:[I.middleware]:[],P=[...B,...E];if(P.length>0){let m=kJ(N,R,I||{}),i=EJ(m,null),c=await yJ(P,i);if(c.redirect){let K0=typeof c.redirect==="string"?c.redirect:c.redirect.path||c.redirect,V0=j_(String(K0),N),_0=H_(N,J);await F0.promises.mkdir(J0.dirname(_0),{recursive:!0}),await Bun.write(_0,V0),Q.successCount++,Q.pages.push({route:N,outputPath:_0,size:Buffer.byteLength(V0),cached:!1}),L.push({loc:N,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${N} \u2192 redirect to ${K0}`);return}if(c.abort){let K0=typeof c.abort==="string"?c.abort:c.abort?.error?.message||"aborted";console.warn(` \u21B3 ${N} \u2014 middleware aborted: ${K0}`);return}}let S=D.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(S)try{if(!await Function("route",`
10879
- const validate = ${S[1]};
10878
+ </rss>`}async function O_($={}){let Z=Date.now(),Y=await S1(),J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||".stx/ssg-cache",contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},X=new Set,G=0,K={},q={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&F0.existsSync(J.outputDir))await F0.promises.rm(J.outputDir,{recursive:!0});await F0.promises.mkdir(J.outputDir,{recursive:!0});let z=new hJ(J.cacheDir);if(J.cache)await z.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (a4(),tZ));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (g4(),h8));await V('<div class="bg-black"></div>')}catch{}CJ();let U=Y?.routeMiddleware?.dir||"middleware";await fJ(process.cwd(),U);let _=xJ();if(_.length>0)console.log(`Loaded ${_.length} middleware: ${_.join(", ")}`);let B=Y?.routeMiddleware?.global||[],j=R$(".",{pagesDir:J.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let w=await z_(V);for(let A of w)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??J.revalidate})}Q.totalPages=H.length,console.log(`Generating ${Q.totalPages} pages...`);let L=[],F=[];for(let V=0;V<H.length;V+=J.concurrency)F.push(H.slice(V,V+J.concurrency));for(let V of F)await Promise.all(V.map(async(w)=>{let{route:A,url:N,params:R,props:T,revalidate:M}=w;try{await J.hooks.onPageStart?.(N);let I=await Bun.file(A.filePath).text(),D=w_(I),E=D?.middleware?Array.isArray(D.middleware)?D.middleware:[D.middleware]:[],P=[...B,...E];if(P.length>0){let m=vJ(N,R,D||{}),i=PJ(m,null),l=await gJ(P,i);if(l.redirect){let q0=typeof l.redirect==="string"?l.redirect:l.redirect.path||l.redirect,V0=A_(String(q0),N),_0=N_(N,J);await F0.promises.mkdir(J0.dirname(_0),{recursive:!0}),await Bun.write(_0,V0),Q.successCount++,Q.pages.push({route:N,outputPath:_0,size:Buffer.byteLength(V0),cached:!1}),L.push({loc:N,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${N} \u2192 redirect to ${q0}`);return}if(l.abort){let q0=typeof l.abort==="string"?l.abort:l.abort?.error?.message||"aborted";console.warn(` \u21B3 ${N} \u2014 middleware aborted: ${q0}`);return}}let b=I.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(b)try{if(!await Function("route",`
10879
+ const validate = ${b[1]};
10880
10880
  return validate(route);
10881
- `)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let k=null,y=!1;if(J.cache){if(k=q.get(N,A.filePath),k)y=!0,Q.cachedCount++}if(!k){let m=await vJ(A,R,T,J,Y);if(k=m.html,J.cache)q.set(N,A.filePath,m.dependencies,k)}let g;if(J.trailingSlash)g=J0.join(J.outputDir,N,"index.html");else g=N==="/"?J0.join(J.outputDir,"index.html"):J0.join(J.outputDir,`${N}.html`);if(J.chunkIslands){let{html:m,chunks:i}=MJ(k,{integrity:J.integrityIslands,minify:J.minify});if(i.length>0){let c=J0.join(J.outputDir,"_stx","islands");await F0.promises.mkdir(c,{recursive:!0});for(let K0 of i){let V0=J0.join(c,`${K0.hash}.js`);if(!await Bun.file(V0).exists())await Bun.write(V0,K0.code);if(!X.has(K0.hash)){X.add(K0.hash);let _0=Buffer.byteLength(K0.code,"utf8");G+=_0,z[K0.hash]={bytes:_0,file:`/_stx/islands/${K0.hash}.js`}}}if(K[N]=i.map((K0)=>K0.hash),k=m,J.prefetchIslands)k=DJ(k)}}await F0.promises.mkdir(J0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:N,lastmod:new Date().toISOString().split("T")[0],priority:N==="/"?1:0.8});let h={route:N,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:y};if(M!==!1)h.revalidateAt=Date.now()+M*1000;Q.pages.push(h),Q.successCount++,await J.hooks.onPageEnd?.(N,k)}catch(D){Q.failedCount++,Q.errors.push({route:N,error:D}),await J.hooks.onError?.(D,N),console.error(`Error generating ${N}:`,D)}}));if(J.cache)await q.save();if(J.generate404){let V=J0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},N=await j0(await Bun.file(V).text(),{},V,A,w);await Bun.write(J0.join(J.outputDir,"404.html"),N)}else await Bun.write(J0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
10881
+ `)({params:R})){console.warn(`Validation failed for ${N}, skipping...`);return}}catch{}let k=null,y=!1;if(J.cache){if(k=z.get(N,A.filePath),k)y=!0,Q.cachedCount++}if(!k){let m=await mJ(A,R,T,J,Y);if(k=m.html,J.cache)z.set(N,A.filePath,m.dependencies,k)}let g;if(J.trailingSlash)g=J0.join(J.outputDir,N,"index.html");else g=N==="/"?J0.join(J.outputDir,"index.html"):J0.join(J.outputDir,`${N}.html`);if(J.chunkIslands){let{html:m,chunks:i}=SJ(k,{integrity:J.integrityIslands,minify:J.minify});if(i.length>0){let l=J0.join(J.outputDir,"_stx","islands");await F0.promises.mkdir(l,{recursive:!0});for(let q0 of i){let V0=J0.join(l,`${q0.hash}.js`);if(!await Bun.file(V0).exists())await Bun.write(V0,q0.code);if(!X.has(q0.hash)){X.add(q0.hash);let _0=Buffer.byteLength(q0.code,"utf8");G+=_0,K[q0.hash]={bytes:_0,file:`/_stx/islands/${q0.hash}.js`}}}if(q[N]=i.map((q0)=>q0.hash),k=m,J.prefetchIslands)k=yJ(k)}}await F0.promises.mkdir(J0.dirname(g),{recursive:!0}),await Bun.write(g,k),L.push({loc:N,lastmod:new Date().toISOString().split("T")[0],priority:N==="/"?1:0.8});let h={route:N,outputPath:g,size:Buffer.byteLength(k,"utf8"),cached:y};if(M!==!1)h.revalidateAt=Date.now()+M*1000;Q.pages.push(h),Q.successCount++,await J.hooks.onPageEnd?.(N,k)}catch(I){Q.failedCount++,Q.errors.push({route:N,error:I}),await J.hooks.onError?.(I,N),console.error(`Error generating ${N}:`,I)}}));if(J.cache)await z.save();if(J.generate404){let V=J0.join(J.pagesDir,"404.stx");if(await Bun.file(V).exists()){let w=new Set,A={...Y,debug:!1,cache:!1},N=await j0(await Bun.file(V).text(),{},V,A,w);await Bun.write(J0.join(J.outputDir,"404.html"),N)}else await Bun.write(J0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
10882
10882
  <html lang="en">
10883
10883
  <head>
10884
10884
  <meta charset="UTF-8">
@@ -10899,7 +10899,7 @@ ${Y.join(`
10899
10899
  <a href="/">Go home</a>
10900
10900
  </div>
10901
10901
  </body>
10902
- </html>`)}for(let V of[500]){let w=J0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await j0(await Bun.file(w).text(),{},w,N,A);await Bun.write(J0.join(J.outputDir,`${V}.html`),R)}}let O=J0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await j0(await Bun.file(O).text(),{},O,w,V);await Bun.write(J0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=z_(L,J.domain),w=J0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),Q.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=K_(V,w),N=J0.join(J.outputDir,"rss.xml");await Bun.write(N,A),Q.rssPath=N,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&F0.existsSync(J.publicDir))await xJ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(q){throw await J.hooks.onError?.(q),q}if(Q.buildTime=Date.now()-Z,X.size>0){Q.islandChunks={count:X.size,totalBytes:G};let q={generatedChunks:X.size,totalBytes:G,chunks:z,pages:K};await Bun.write(J0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(q,null,2))}await J.hooks.onBuildEnd?.(Q);let W=Q.islandChunks?`
10902
+ </html>`)}for(let V of[500]){let w=J0.join(J.pagesDir,`${V}.stx`);if(await Bun.file(w).exists()){let A=new Set,N={...Y,debug:!1,cache:!1},R=await j0(await Bun.file(w).text(),{},w,N,A);await Bun.write(J0.join(J.outputDir,`${V}.html`),R)}}let O=J0.join(J.pagesDir,"error.stx");if(await Bun.file(O).exists()){let V=new Set,w={...Y,debug:!1,cache:!1},A=await j0(await Bun.file(O).text(),{},O,w,V);await Bun.write(J0.join(J.outputDir,"error.html"),A)}if(J.sitemap&&L.length>0){let V=j_(L,J.domain),w=J0.join(J.outputDir,"sitemap.xml");await Bun.write(w,V),Q.sitemapPath=w,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.rss){let V=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},w=[];if(V.getItems)w=await V.getItems();let A=H_(V,w),N=J0.join(J.outputDir,"rss.xml");await Bun.write(N,A),Q.rssPath=N,console.log(`Generated rss.xml with ${w.length} items`)}if(J.publicDir&&F0.existsSync(J.publicDir))await uJ(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`)}catch(z){throw await J.hooks.onError?.(z),z}if(Q.buildTime=Date.now()-Z,X.size>0){Q.islandChunks={count:X.size,totalBytes:G};let z={generatedChunks:X.size,totalBytes:G,chunks:K,pages:q};await Bun.write(J0.join(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await J.hooks.onBuildEnd?.(Q);let W=Q.islandChunks?`
10903
10903
  Island chunks: ${Q.islandChunks.count} (${(Q.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
10904
10904
  Build complete!
10905
10905
  Total: ${Q.totalPages} pages
@@ -10907,8 +10907,8 @@ Build complete!
10907
10907
  Cached: ${Q.cachedCount}
10908
10908
  Failed: ${Q.failedCount}
10909
10909
  Time: ${Q.buildTime}ms${W}
10910
- `),Q}async function xJ($,Z){let Y=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let Q=J0.join($,J.name),X=J0.join(Z,J.name);if(J.isDirectory())await F0.promises.mkdir(X,{recursive:!0}),await xJ(Q,X);else await F0.promises.copyFile(Q,X)}}function W_($={}){let Z=$.cacheDir||".stx/ssg-cache",Y=new PJ(Z),J=$.revalidate||3600;return{async get(Q){let X=await Y.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).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(Q){let G=A4(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return Q.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let z=Q.match(G.regex),K={};if(z)G.params.forEach((U,_)=>{K[U]=z[_+1]});let W=await S1(),{html:q}=await vJ(G,K,{},$,W);await Y.set(Q,{html:q,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:G_(q)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await Y.invalidate(Q);else await Y.invalidatePattern(Q)}}}function U_($){return async()=>{return{paths:await $(),fallback:!1}}}function __(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},Q=Z;if(Y){let W=Y[1];Q=Z.slice(Y[0].length).trim();for(let q of W.split(`
10911
- `)){let U=q.indexOf(":");if(U>0){let _=q.slice(0,U).trim(),B=q.slice(U+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[_]=B}}}let X=Q.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>"),G=[],z=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,K;while((K=z.exec(X))!==null){let W=parseInt(K[1],10),q=K[2],U=q.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:q,level:W})}return{content:X,data:J,toc:G}}}}function B_($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function j_($,Z){return`<!DOCTYPE html>
10910
+ `),Q}async function uJ($,Z){let Y=await F0.promises.readdir($,{withFileTypes:!0});for(let J of Y){let Q=J0.join($,J.name),X=J0.join(Z,J.name);if(J.isDirectory())await F0.promises.mkdir(X,{recursive:!0}),await uJ(Q,X);else await F0.promises.copyFile(Q,X)}}function L_($={}){let Z=$.cacheDir||".stx/ssg-cache",Y=new dJ(Z),J=$.revalidate||3600;return{async get(Q){let X=await Y.get(Q);if(!X)return null;if(Date.now()>X.revalidateAfter)this.revalidate(Q).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(Q){let G=R$(".",{pagesDir:$.pagesDir||"pages"}).find((U)=>{return Q.match(U.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${Q}`);return}let K=Q.match(G.regex),q={};if(K)G.params.forEach((U,_)=>{q[U]=K[_+1]});let W=await S1(),{html:z}=await mJ(G,q,{},$,W);await Y.set(Q,{html:z,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:B_(z)}),console.log(`Revalidated: ${Q}`)},async invalidate(Q){if(typeof Q==="string")await Y.invalidate(Q);else await Y.invalidatePattern(Q)}}}function F_($){return async()=>{return{paths:await $(),fallback:!1}}}function V_(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),J={},Q=Z;if(Y){let W=Y[1];Q=Z.slice(Y[0].length).trim();for(let z of W.split(`
10911
+ `)){let U=z.indexOf(":");if(U>0){let _=z.slice(0,U).trim(),B=z.slice(U+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[_]=B}}}let X=Q.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>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,q;while((q=K.exec(X))!==null){let W=parseInt(q[1],10),z=q[2],U=z.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:U,text:z,level:W})}return{content:X,data:J,toc:G}}}}function w_($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function A_($,Z){return`<!DOCTYPE html>
10912
10912
  <html>
10913
10913
  <head>
10914
10914
  <meta charset="utf-8">
@@ -10920,4 +10920,4 @@ Build complete!
10920
10920
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
10921
10921
  <script>window.location.replace('${$}')</script>
10922
10922
  </body>
10923
- </html>`}function H_($,Z){if($==="/"||$==="")return J0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return J0.join(Z.outputDir,Y,"index.html");return J0.join(Z.outputDir,`${Y}.html`)}var Yw={generateStaticSite:q_,createISRHandler:W_,defineStaticPaths:U_,createMarkdownLoader:__};export{q_ as generateStaticSite,U_ as defineStaticPaths,Yw as default,__ as createMarkdownLoader,W_ as createISRHandler};
10923
+ </html>`}function N_($,Z){if($==="/"||$==="")return J0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return J0.join(Z.outputDir,Y,"index.html");return J0.join(Z.outputDir,`${Y}.html`)}var iw={generateStaticSite:O_,createISRHandler:L_,defineStaticPaths:F_,createMarkdownLoader:V_};export{O_ as generateStaticSite,F_ as defineStaticPaths,iw as default,V_ as createMarkdownLoader,L_ as createISRHandler};