@stacksjs/stx 0.2.5 → 0.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/dist/a11y.d.ts +2 -6
  2. package/dist/analytics.d.ts +1 -1
  3. package/dist/analyzer.d.ts +1 -1
  4. package/dist/animation.d.ts +10 -86
  5. package/dist/app.d.ts +2 -4
  6. package/dist/assets.d.ts +1 -1
  7. package/dist/ast.d.ts +3 -24
  8. package/dist/async-components.d.ts +1 -1
  9. package/dist/auth.d.ts +1 -1
  10. package/dist/browser-composables.d.ts +6 -4
  11. package/dist/build-optimizer.d.ts +4 -29
  12. package/dist/build-views.d.ts +20 -1
  13. package/dist/bundle-analyzer/collector.d.ts +1 -1
  14. package/dist/bundle-analyzer/index.d.ts +40 -4
  15. package/dist/bundle-analyzer/report.d.ts +1 -1
  16. package/dist/bundle-analyzer/treemap.d.ts +1 -1
  17. package/dist/caching.d.ts +1 -1
  18. package/dist/cli.js +1323 -511
  19. package/dist/client/directive.d.ts +1 -1
  20. package/dist/client/index.d.ts +6 -1
  21. package/dist/client/router.d.ts +3 -11
  22. package/dist/client/stx-router.browser.d.ts +1 -0
  23. package/dist/client-script.d.ts +2 -1
  24. package/dist/client.d.ts +2 -2
  25. package/dist/component-hmr.d.ts +4 -18
  26. package/dist/components.d.ts +1 -1
  27. package/dist/composables/index.d.ts +114 -1
  28. package/dist/composables/use-battery.d.ts +1 -1
  29. package/dist/composables/use-broadcast-channel.d.ts +2 -2
  30. package/dist/composables/use-clipboard.d.ts +1 -1
  31. package/dist/composables/use-color-mode.d.ts +52 -0
  32. package/dist/composables/use-cookie.d.ts +1 -1
  33. package/dist/composables/use-device-orientation.d.ts +1 -1
  34. package/dist/composables/use-event-listener.d.ts +35 -0
  35. package/dist/composables/use-event-source.d.ts +1 -1
  36. package/dist/composables/use-eye-dropper.d.ts +3 -2
  37. package/dist/composables/use-fetch.d.ts +1 -1
  38. package/dist/composables/use-fullscreen.d.ts +1 -1
  39. package/dist/composables/use-geolocation.d.ts +1 -1
  40. package/dist/composables/use-idle.d.ts +2 -2
  41. package/dist/composables/use-intersection-observer.d.ts +1 -1
  42. package/dist/composables/use-keyboard.d.ts +1 -2
  43. package/dist/composables/use-media-query.d.ts +1 -1
  44. package/dist/composables/use-meta.d.ts +35 -0
  45. package/dist/composables/use-mouse.d.ts +1 -1
  46. package/dist/composables/use-mutation-observer.d.ts +1 -1
  47. package/dist/composables/use-network.d.ts +1 -1
  48. package/dist/composables/use-notification.d.ts +10 -1
  49. package/dist/composables/use-permissions.d.ts +17 -7
  50. package/dist/composables/use-query.d.ts +43 -0
  51. package/dist/composables/use-resize-observer.d.ts +1 -1
  52. package/dist/composables/use-router.d.ts +59 -0
  53. package/dist/composables/use-share.d.ts +1 -1
  54. package/dist/composables/use-speech.d.ts +1 -1
  55. package/dist/composables/use-storage.d.ts +1 -1
  56. package/dist/composables/use-text-selection.d.ts +1 -1
  57. package/dist/composables/use-timer.d.ts +92 -0
  58. package/dist/composables/use-utilities.d.ts +103 -0
  59. package/dist/composables/use-wake-lock.d.ts +1 -1
  60. package/dist/composables/use-websocket.d.ts +3 -3
  61. package/dist/composables/use-window.d.ts +1 -1
  62. package/dist/composables.d.ts +10 -7
  63. package/dist/composition-api.d.ts +1 -14
  64. package/dist/computed.d.ts +10 -4
  65. package/dist/conditionals.d.ts +1 -1
  66. package/dist/config.d.ts +1 -1
  67. package/dist/craft-bridge.d.ts +1 -1
  68. package/dist/craft-compiler.d.ts +6 -3
  69. package/dist/craft-components.d.ts +1 -8
  70. package/dist/craft-entry.d.ts +1 -1
  71. package/dist/craft-ssr.d.ts +1 -1
  72. package/dist/csp.d.ts +2 -2
  73. package/dist/csrf.d.ts +1 -1
  74. package/dist/custom-directives.d.ts +1 -1
  75. package/dist/database.d.ts +8 -26
  76. package/dist/defer.d.ts +1 -1
  77. package/dist/deploy/config-generators.d.ts +1 -1
  78. package/dist/deploy/index.d.ts +6 -3
  79. package/dist/deploy/netlify.d.ts +1 -1
  80. package/dist/dev-server/crosswind.d.ts +11 -1
  81. package/dist/dev-server/index.d.ts +16 -1
  82. package/dist/dev-server/keyboard-shortcuts.d.ts +1 -1
  83. package/dist/dev-server/native-window.d.ts +1 -1
  84. package/dist/dev-server/port-utils.d.ts +2 -2
  85. package/dist/dev-server/terminal-colors.d.ts +1 -5
  86. package/dist/dev-server/theme-selector.d.ts +1 -1
  87. package/dist/dev-server/types.d.ts +3 -8
  88. package/dist/dev-server.d.ts +1 -4
  89. package/dist/devtools.d.ts +4 -1
  90. package/dist/directive-api.d.ts +3 -3
  91. package/dist/docs.d.ts +2 -2
  92. package/dist/dynamic-components.d.ts +1 -1
  93. package/dist/edge-runtime.d.ts +3 -3
  94. package/dist/env.d.ts +1 -1
  95. package/dist/error-boundaries.d.ts +1 -1
  96. package/dist/error-handling.d.ts +14 -1
  97. package/dist/errors/codes.d.ts +2 -17
  98. package/dist/errors/formatter.d.ts +1 -1
  99. package/dist/errors/index.d.ts +13 -1
  100. package/dist/errors/logger.d.ts +2 -15
  101. package/dist/errors/sanitizer.d.ts +1 -1
  102. package/dist/errors/types.d.ts +1 -1
  103. package/dist/events.d.ts +1 -1
  104. package/dist/expressions.d.ts +64 -90
  105. package/dist/formatter.d.ts +1 -1
  106. package/dist/forms-validation.d.ts +23 -24
  107. package/dist/forms.d.ts +5 -22
  108. package/dist/head.d.ts +5 -1
  109. package/dist/heatmap.d.ts +4 -7
  110. package/dist/hot-reload.d.ts +3 -8
  111. package/dist/hydration-runtime.d.ts +1 -1
  112. package/dist/hydration.d.ts +5 -32
  113. package/dist/i18n.d.ts +1 -9
  114. package/dist/image-optimization/build-plugin.d.ts +2 -2
  115. package/dist/image-optimization/component.d.ts +2 -2
  116. package/dist/image-optimization/directive.d.ts +2 -2
  117. package/dist/image-optimization/index.d.ts +55 -1
  118. package/dist/image-optimization/processor.d.ts +9 -4
  119. package/dist/includes.d.ts +1 -1
  120. package/dist/index.d.ts +29 -1
  121. package/dist/index.js +1387 -542
  122. package/dist/init.d.ts +1 -1
  123. package/dist/interactive.d.ts +1 -1
  124. package/dist/internal-markdown.d.ts +1 -1
  125. package/dist/js-ts.d.ts +1 -1
  126. package/dist/jsx-runtime.d.ts +1 -20
  127. package/dist/keep-alive.d.ts +1 -1
  128. package/dist/lazy-loader.d.ts +3 -35
  129. package/dist/loading-indicator.d.ts +2 -1
  130. package/dist/loops.d.ts +1 -1
  131. package/dist/markdown.d.ts +1 -1
  132. package/dist/media/client/blur-up.d.ts +1 -1
  133. package/dist/media/client/index.d.ts +17 -1
  134. package/dist/media/client/lazy-load.d.ts +1 -1
  135. package/dist/media/client/upload-handler.d.ts +1 -1
  136. package/dist/media/image/component.d.ts +2 -4
  137. package/dist/media/image/directive.d.ts +1 -1
  138. package/dist/media/image/editing.d.ts +1 -1
  139. package/dist/media/image/index.d.ts +25 -1
  140. package/dist/media/image/placeholder.d.ts +1 -1
  141. package/dist/media/image/processor/cache.d.ts +3 -4
  142. package/dist/media/image/processor/index.d.ts +9 -1
  143. package/dist/media/image/processor/optimizer.d.ts +2 -2
  144. package/dist/media/image/processor/responsive.d.ts +3 -2
  145. package/dist/media/image/srcset.d.ts +6 -4
  146. package/dist/media/index.d.ts +37 -1
  147. package/dist/media/manager/embed.d.ts +1 -1
  148. package/dist/media/protected/component.d.ts +2 -3
  149. package/dist/media/protected/index.d.ts +14 -1
  150. package/dist/media/protected/signature.d.ts +2 -2
  151. package/dist/media/shared/cache.d.ts +1 -1
  152. package/dist/media/shared/hash.d.ts +1 -1
  153. package/dist/media/shared/index.d.ts +6 -1
  154. package/dist/media/types.d.ts +16 -72
  155. package/dist/media/upload/component.d.ts +2 -16
  156. package/dist/media/upload/index.d.ts +8 -1
  157. package/dist/media/video/directive.d.ts +1 -1
  158. package/dist/media/video/index.d.ts +11 -2
  159. package/dist/media/video/processor/cache.d.ts +3 -4
  160. package/dist/media/video/processor/index.d.ts +9 -1
  161. package/dist/media/video/processor/streaming.d.ts +2 -2
  162. package/dist/media/video/processor/thumbnail.d.ts +2 -2
  163. package/dist/media/video/processor/transcoder.d.ts +2 -2
  164. package/dist/method-spoofing.d.ts +1 -1
  165. package/dist/middleware.d.ts +1 -1
  166. package/dist/native-build.d.ts +3 -6
  167. package/dist/parser/directive-parser.d.ts +1 -1
  168. package/dist/parser/expression-parser.d.ts +2 -1
  169. package/dist/parser/index.d.ts +14 -1
  170. package/dist/parser/tokenizer.d.ts +2 -18
  171. package/dist/partial-hydration.d.ts +5 -6
  172. package/dist/performance-utils.d.ts +5 -18
  173. package/dist/plugin-system.d.ts +2 -8
  174. package/dist/plugin.d.ts +1 -1
  175. package/dist/precompiler.d.ts +2 -67
  176. package/dist/process.d.ts +12 -2
  177. package/dist/production-build.d.ts +1 -37
  178. package/dist/props.d.ts +3 -30
  179. package/dist/pwa/audit.d.ts +1 -1
  180. package/dist/pwa/directives.d.ts +1 -1
  181. package/dist/pwa/icons.d.ts +7 -4
  182. package/dist/pwa/index.d.ts +46 -1
  183. package/dist/pwa/inject.d.ts +1 -1
  184. package/dist/pwa/manifest.d.ts +1 -1
  185. package/dist/pwa/offline.d.ts +1 -1
  186. package/dist/pwa/precache.d.ts +1 -1
  187. package/dist/pwa/service-worker.d.ts +1 -1
  188. package/dist/pwa/workbox-strategies.d.ts +1 -1
  189. package/dist/pwa/workbox.d.ts +1 -10
  190. package/dist/pwa.d.ts +1 -1
  191. package/dist/pwa.js +1242 -430
  192. package/dist/reactive-bindings.d.ts +1 -1
  193. package/dist/reactive.d.ts +1 -1
  194. package/dist/reactivity.d.ts +6 -50
  195. package/dist/release.d.ts +1 -1
  196. package/dist/route-middleware.d.ts +3 -3
  197. package/dist/router.d.ts +1 -1
  198. package/dist/routes.d.ts +2 -2
  199. package/dist/runtime.d.ts +4 -4
  200. package/dist/safe-evaluator.d.ts +1 -4
  201. package/dist/scaffolding.d.ts +1 -1
  202. package/dist/seo.d.ts +1 -5
  203. package/dist/serve.d.ts +1 -1
  204. package/dist/server-components.d.ts +1 -1
  205. package/dist/signals.d.ts +8 -168
  206. package/dist/slots.d.ts +2 -2
  207. package/dist/source-maps.d.ts +3 -22
  208. package/dist/spa-shell.d.ts +20 -0
  209. package/dist/ssg.d.ts +4 -6
  210. package/dist/ssg.js +1242 -430
  211. package/dist/ssr.d.ts +6 -14
  212. package/dist/state-management.d.ts +5 -45
  213. package/dist/stores-client.d.ts +3 -3
  214. package/dist/story/addons.d.ts +1 -1
  215. package/dist/story/analytics.d.ts +4 -11
  216. package/dist/story/auto-stories.d.ts +1 -1
  217. package/dist/story/bookmarks.d.ts +2 -6
  218. package/dist/story/bun-test.d.ts +1 -1
  219. package/dist/story/cli.d.ts +0 -25
  220. package/dist/story/collect/analyzer.d.ts +1 -1
  221. package/dist/story/collect/index.d.ts +5 -1
  222. package/dist/story/collect/parser.d.ts +1 -1
  223. package/dist/story/collect/scanner.d.ts +1 -1
  224. package/dist/story/collect/tree.d.ts +2 -2
  225. package/dist/story/commands/build.d.ts +1 -1
  226. package/dist/story/commands/dev.d.ts +1 -1
  227. package/dist/story/commands/index.d.ts +4 -1
  228. package/dist/story/commands/preview.d.ts +1 -1
  229. package/dist/story/compiled-output.d.ts +1 -1
  230. package/dist/story/composition.d.ts +1 -1
  231. package/dist/story/config-watcher.d.ts +1 -1
  232. package/dist/story/config.d.ts +2 -2
  233. package/dist/story/context.d.ts +1 -1
  234. package/dist/story/controls/index.d.ts +1 -1
  235. package/dist/story/crosswind.d.ts +1 -1
  236. package/dist/story/desktop-preview.d.ts +1 -1
  237. package/dist/story/docs-generator.d.ts +1 -1
  238. package/dist/story/errors.d.ts +1 -1
  239. package/dist/story/figma-export.d.ts +2 -2
  240. package/dist/story/generator.d.ts +1 -1
  241. package/dist/story/hmr.d.ts +1 -1
  242. package/dist/story/hot-swap.d.ts +1 -1
  243. package/dist/story/index.d.ts +49 -1
  244. package/dist/story/interactions.d.ts +1 -1
  245. package/dist/story/keyboard-shortcuts.d.ts +1 -1
  246. package/dist/story/output.d.ts +1 -1
  247. package/dist/story/performance.d.ts +3 -12
  248. package/dist/story/presets.d.ts +3 -8
  249. package/dist/story/props-validation.d.ts +11 -1
  250. package/dist/story/renderer.d.ts +1 -1
  251. package/dist/story/search-index.d.ts +2 -2
  252. package/dist/story/search.d.ts +2 -2
  253. package/dist/story/server.d.ts +1 -1
  254. package/dist/story/setup.d.ts +1 -1
  255. package/dist/story/snapshots.d.ts +1 -1
  256. package/dist/story/testing.d.ts +1 -1
  257. package/dist/story/theme.d.ts +1 -1
  258. package/dist/story/types.d.ts +3 -12
  259. package/dist/story/ui/code-panel.d.ts +1 -1
  260. package/dist/story/ui/controls-panel.d.ts +1 -1
  261. package/dist/story/ui/index.d.ts +5 -1
  262. package/dist/story/ui/navigation.d.ts +1 -1
  263. package/dist/story/ui/preview.d.ts +1 -1
  264. package/dist/story/visual-testing.d.ts +1 -1
  265. package/dist/streaming.d.ts +0 -59
  266. package/dist/suspense.d.ts +1 -1
  267. package/dist/teleport.d.ts +1 -1
  268. package/dist/testing.d.ts +62 -80
  269. package/dist/transitions.d.ts +1 -1
  270. package/dist/type-checker.d.ts +2 -26
  271. package/dist/types/component-types.d.ts +3 -3
  272. package/dist/types/config-types.d.ts +15 -30
  273. package/dist/types/context-types.d.ts +6 -5
  274. package/dist/types/csp-types.d.ts +2 -2
  275. package/dist/types/directive-types.d.ts +5 -5
  276. package/dist/types/index.d.ts +21 -1
  277. package/dist/types/pwa-types.d.ts +1 -6
  278. package/dist/types.d.ts +28 -1
  279. package/dist/typescript-templates.d.ts +1 -34
  280. package/dist/utils.d.ts +2 -1
  281. package/dist/validator.d.ts +1 -1
  282. package/dist/variable-extractor.d.ts +1 -1
  283. package/dist/view-composers.d.ts +1 -1
  284. package/dist/virtual-scrolling.d.ts +4 -1
  285. package/dist/visual-editor.d.ts +2 -30
  286. package/dist/visual-testing.d.ts +4 -1
  287. package/dist/vue-template.d.ts +1 -1
  288. package/dist/web-components/css-scoping.d.ts +1 -1
  289. package/dist/web-components/index.d.ts +10 -1
  290. package/dist/web-components/reactive-generator.d.ts +1 -1
  291. package/dist/web-components.d.ts +1 -1
  292. package/dist/x-element.d.ts +13 -6
  293. package/package.json +4 -4
package/dist/pwa.js CHANGED
@@ -1,26 +1,26 @@
1
1
  // @bun
2
- var{defineProperty:T7,getOwnPropertyNames:M1,getOwnPropertyDescriptor:T1}=Object,w1=Object.prototype.hasOwnProperty;var Q6=new WeakMap,K6=($)=>{var Z=Q6.get($),Y;if(Z)return Z;if(Z=T7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")M1($).map((J)=>!w1.call(Z,J)&&T7(Z,J,{get:()=>$[J],enumerable:!(Y=T1($,J))||Y.enumerable}));return Q6.set($,Z),Z};var o=($,Z)=>{for(var Y in Z)T7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:(J)=>Z[Y]=()=>J})};var I=($,Z)=>()=>($&&(Z=$($=0)),Z);var t=import.meta.require;import I5 from"fs";import D5 from"path";function E1($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$[Y];Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function k1($,Z){let Y=D5.basename($);for(let J of Z)if(J.startsWith("*.")){let G=J.slice(1);if(Y.endsWith(G))return!0}else if(J.includes("*")){let G=new RegExp(`^${J.replace(/\*/g,".*")}$`);if(G.test(Y)||G.test($))return!0}else if(Y===J||$.includes(J))return!0;return!1}function S1($,Z,Y){let J=D5.extname($).toLowerCase(),G=D1[J],X=(Y.maxFileSizeKB||500)*1024;if(Z>X)return!1;if(Y.exclude&&k1($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let Q of Y.include)if(Q.startsWith("*.")){if($.endsWith(Q.slice(1)))return!0}else if($.includes(Q))return!0}if(G&&Y[G]===!0)return!0;if(!G)return!1;return!1}function z6($,Z,Y,J){let G=I5.readdirSync($,{withFileTypes:!0});for(let X of G){let Q=D5.join($,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;z6(Q,Z,Y,J)}else if(X.isFile()){let K=I5.statSync(Q),q=D5.relative(Z,Q);if(S1(q,K.size,Y)){let _=I5.readFileSync(Q),j=E1(_),B=`/${q.replace(/\\/g,"/")}`;J.push({url:B,revision:j,size:K.size})}}}}function b4($,Z){let Y=Z.pwa?.precache,J=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!I5.existsSync($))return{entries:[],totalSize:0,fileCount:0};z6($,$,Y,J),J.sort((X,Q)=>X.url.localeCompare(Q.url));let G=J.reduce((X,Q)=>X+Q.size,0);return{entries:J,totalSize:G,fileCount:J.length}}function E5($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:w7,getOwnPropertyNames:D1,getOwnPropertyDescriptor:E1}=Object,k1=Object.prototype.hasOwnProperty;var K6=new WeakMap,q6=($)=>{var Z=K6.get($),Y;if(Z)return Z;if(Z=w7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function")D1($).map((J)=>!k1.call(Z,J)&&w7(Z,J,{get:()=>$[J],enumerable:!(Y=E1($,J))||Y.enumerable}));return K6.set($,Z),Z};var o=($,Z)=>{for(var Y in Z)w7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:(J)=>Z[Y]=()=>J})};var w=($,Z)=>()=>($&&(Z=$($=0)),Z);var $4=import.meta.require;import w5 from"fs";import D5 from"path";function P1($){let Z=0;for(let Y=0;Y<$.length;Y++){let J=$[Y];Z=(Z<<5)-Z+J,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function y1($,Z){let Y=D5.basename($);for(let J of Z)if(J.startsWith("*.")){let G=J.slice(1);if(Y.endsWith(G))return!0}else if(J.includes("*")){let G=new RegExp(`^${J.replace(/\*/g,".*")}$`);if(G.test(Y)||G.test($))return!0}else if(Y===J||$.includes(J))return!0;return!1}function C1($,Z,Y){let J=D5.extname($).toLowerCase(),G=b1[J],X=(Y.maxFileSizeKB||500)*1024;if(Z>X)return!1;if(Y.exclude&&y1($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let Q of Y.include)if(Q.startsWith("*.")){if($.endsWith(Q.slice(1)))return!0}else if($.includes(Q))return!0}if(G&&Y[G]===!0)return!0;if(!G)return!1;return!1}function H6($,Z,Y,J){let G=w5.readdirSync($,{withFileTypes:!0});for(let X of G){let Q=D5.join($,X.name);if(X.isDirectory()){if(["node_modules",".git",".stx"].includes(X.name))continue;H6(Q,Z,Y,J)}else if(X.isFile()){let K=w5.statSync(Q),q=D5.relative(Z,Q);if(C1(q,K.size,Y)){let _=w5.readFileSync(Q),j=P1(_),B=`/${q.replace(/\\/g,"/")}`;J.push({url:B,revision:j,size:K.size})}}}}function P4($,Z){let Y=Z.pwa?.precache,J=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!w5.existsSync($))return{entries:[],totalSize:0,fileCount:0};H6($,$,Y,J),J.sort((X,Q)=>X.url.localeCompare(Q.url));let G=J.reduce((X,Q)=>X+Q.size,0);return{entries:J,totalSize:G,fileCount:J.length}}function E5($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function H6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var D1;var G5=I(()=>{D1={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function b1($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function w7($){return b1($).className}function O6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],J=Z.cacheStorage,G=[];for(let X of Y){let Q=w7(X.strategy),K=[];if(X.maxAgeSeconds||X.maxEntries||J?.maxEntries){let _=X.maxEntries||J?.maxEntries||100,j=X.maxAgeSeconds||(J?.maxAge?J.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function O6($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var b1;var G5=w(()=>{b1={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function x1($){let Z={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return Z[$]||Z["network-first"]}function D7($){return x1($).className}function L6($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],J=Z.cacheStorage,G=[];for(let X of Y){let Q=D7(X.strategy),K=[];if(X.maxAgeSeconds||X.maxEntries||J?.maxEntries){let _=X.maxEntries||J?.maxEntries||100,j=X.maxAgeSeconds||(J?.maxAge?J.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${_},
7
7
  ${j?`maxAgeSeconds: ${j},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(X.strategy==="network-first"||X.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=P1(X.pattern);G.push(`
11
+ })`);let q=v1(X.pattern);G.push(`
12
12
  // ${X.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${Q}({
16
- cacheName: '${X.cacheName||C1(X.pattern)}',
16
+ cacheName: '${X.cacheName||g1(X.pattern)}',
17
17
  ${K.length>0?`plugins: [
18
18
  ${K.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return G.join(`
23
- `)}function P1($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${y1(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${v1($).replace(/\\\*/g,".*")}')`}function y1($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function C1($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function v1($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var A6={};o(A6,{isWorkboxEnabled:()=>R6,getServiceWorkerGenerator:()=>d1,generateWorkboxServiceWorker:()=>F6,generateWorkboxConfig:()=>L6});function L6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let J=Y.serviceWorker||{},G=Y.routes||[],X=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Q=new Set;for(let _ of G)Q.add(w7(_.strategy));if(Q.size>0)X.push({name:"workbox-strategies",exports:Array.from(Q)});if(G.some((_)=>_.maxAgeSeconds||_.maxEntries)||Y.cacheStorage)X.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(G.some((_)=>_.strategy==="network-first"||_.strategy==="stale-while-revalidate"))X.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)X.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(J.navigationPreload)X.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?b4(Z,$):void 0;return{mode:"generate",modules:X,precacheManifest:q?.entries,skipWaiting:J.skipWaiting??!0,clientsClaim:J.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:J.navigationPreload??!1,cacheVersion:J.cacheVersion||"1.0.0"}}function F6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let J=L6($,Z),G=Y.serviceWorker||{},X=Y.push,Q=Y.backgroundSync,K=Z?b4(Z,$):null,q=K?E5(K):"[]",_=x1(J.modules),j=O6($);return`/**
23
+ `)}function v1($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${f1(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${h1($).replace(/\\\*/g,".*")}')`}function f1($){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[$.toLowerCase()]||"empty"}function g1($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function h1($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var N6={};o(N6,{isWorkboxEnabled:()=>R6,getServiceWorkerGenerator:()=>c1,generateWorkboxServiceWorker:()=>A6,generateWorkboxConfig:()=>F6});function F6($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let J=Y.serviceWorker||{},G=Y.routes||[],X=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Q=new Set;for(let _ of G)Q.add(D7(_.strategy));if(Q.size>0)X.push({name:"workbox-strategies",exports:Array.from(Q)});if(G.some((_)=>_.maxAgeSeconds||_.maxEntries)||Y.cacheStorage)X.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(G.some((_)=>_.strategy==="network-first"||_.strategy==="stale-while-revalidate"))X.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)X.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(J.navigationPreload)X.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?P4(Z,$):void 0;return{mode:"generate",modules:X,precacheManifest:q?.entries,skipWaiting:J.skipWaiting??!0,clientsClaim:J.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:J.navigationPreload??!1,cacheVersion:J.cacheVersion||"1.0.0"}}function A6($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let J=F6($,Z),G=Y.serviceWorker||{},X=Y.push,Q=Y.backgroundSync,K=Z?P4(Z,$):null,q=K?E5(K):"[]",_=d1(J.modules),j=L6($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${J.cacheVersion}
26
26
  *
@@ -168,13 +168,13 @@ self.addEventListener('message', (event) => {
168
168
  }
169
169
  });
170
170
 
171
- ${X?.enabled?g1(X):"// Push notifications disabled"}
171
+ ${X?.enabled?u1(X):"// Push notifications disabled"}
172
172
 
173
- ${Q?.enabled?h1(Q):"// Background sync disabled"}
173
+ ${Q?.enabled?p1(Q):"// Background sync disabled"}
174
174
 
175
175
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
176
- `}function x1($){let Z=[];for(let Y of $){let J=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${f1(J)};`)}return Z.join(`
177
- `)}function f1($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function g1($){return`
176
+ `}function d1($){let Z=[];for(let Y of $){let J=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${m1(J)};`)}return Z.join(`
177
+ `)}function m1($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function u1($){return`
178
178
  // ============================================================================
179
179
  // Push Notifications
180
180
  // ============================================================================
@@ -242,7 +242,7 @@ self.addEventListener('notificationclick', (event) => {
242
242
  })
243
243
  );
244
244
  });
245
- `}function h1($){return`
245
+ `}function p1($){return`
246
246
  // ============================================================================
247
247
  // Background Sync
248
248
  // ============================================================================
@@ -303,7 +303,7 @@ self.addEventListener('message', (event) => {
303
303
  event.waitUntil(syncQueue.pushRequest({ request }));
304
304
  }
305
305
  });
306
- `}function R6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function d1($){if(R6($))return F6;let{generateServiceWorker:Z}=(Q5(),K6(V6));return Z}var N6=I(()=>{G5()});var V6={};o(V6,{isWorkboxEnabled:()=>M6,getServiceWorkerFileName:()=>m4,generateServiceWorkerAuto:()=>p1,generateServiceWorker:()=>k5});function k5($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let J=Y.serviceWorker||{},G=Y.routes||[],X=J.cacheVersion||"1.0.0",Q=Y.offline,K=Q?.page?"/offline.html":"/offline.html",q=Y.push,_=Y.backgroundSync,j=Y.cacheStorage,B=Z?b4(Z,$):null,U=B?E5(B):"[]",z=["/","/manifest.json",...Q?.enabled?[K]:[],...Q?.precacheAssets||[]];return`/**
306
+ `}function R6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function c1($){if(R6($))return A6;let{generateServiceWorker:Z}=(Q5(),q6(M6));return Z}var V6=w(()=>{G5()});var M6={};o(M6,{isWorkboxEnabled:()=>T6,getServiceWorkerFileName:()=>u4,generateServiceWorkerAuto:()=>n1,generateServiceWorker:()=>k5});function k5($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let J=Y.serviceWorker||{},G=Y.routes||[],X=J.cacheVersion||"1.0.0",Q=Y.offline,K=Q?.page?"/offline.html":"/offline.html",q=Y.push,_=Y.backgroundSync,j=Y.cacheStorage,B=Z?P4(Z,$):null,W=B?E5(B):"[]",z=["/","/manifest.json",...Q?.enabled?[K]:[],...Q?.precacheAssets||[]];return`/**
307
307
  * Service Worker - Auto-generated by stx
308
308
  * Cache Version: ${X}
309
309
  *
@@ -317,7 +317,7 @@ self.addEventListener('message', (event) => {
317
317
  * Additional features:
318
318
  * - Push notifications: ${q?.enabled?"enabled":"disabled"}
319
319
  * - Background sync: ${_?.enabled?"enabled":"disabled"}
320
- * - Cache limits: ${j?.maxSize?`${H6(j.maxSize*1024*1024)}`:"unlimited"}
320
+ * - Cache limits: ${j?.maxSize?`${O6(j.maxSize*1024*1024)}`:"unlimited"}
321
321
  */
322
322
 
323
323
  const CACHE_VERSION = '${X}';
@@ -328,7 +328,7 @@ const OFFLINE_PAGE = '${K}';
328
328
  const PRECACHE_ASSETS = ${JSON.stringify(z,null,2)};
329
329
 
330
330
  // Auto-generated precache manifest from build output
331
- const BUILD_PRECACHE_MANIFEST = ${U};
331
+ const BUILD_PRECACHE_MANIFEST = ${W};
332
332
 
333
333
  // Route caching strategies
334
334
  const ROUTE_STRATEGIES = ${JSON.stringify(G,null,2)};
@@ -497,9 +497,9 @@ self.addEventListener('message', (event) => {
497
497
  }
498
498
  });
499
499
 
500
- ${q?.enabled?m1():"// Push notifications disabled"}
500
+ ${q?.enabled?l1():"// Push notifications disabled"}
501
501
 
502
- ${_?.enabled?u1():"// Background sync disabled"}
502
+ ${_?.enabled?i1():"// Background sync disabled"}
503
503
 
504
504
  /**
505
505
  * Check if a route should be excluded from caching
@@ -861,7 +861,7 @@ async function purgeByEntryCount(entries, cache, maxEntries) {
861
861
  }
862
862
 
863
863
  console.log('[SW] Service Worker loaded - Version:', CACHE_VERSION);
864
- `}function m1(){return`
864
+ `}function l1(){return`
865
865
  /**
866
866
  * Push event - handle incoming push notifications
867
867
  */
@@ -942,7 +942,7 @@ self.addEventListener('notificationclose', (event) => {
942
942
  // Could send analytics here
943
943
  }
944
944
  });
945
- `}function u1(){return`
945
+ `}function i1(){return`
946
946
  /**
947
947
  * Background sync queue storage (IndexedDB)
948
948
  */
@@ -1122,14 +1122,14 @@ self.addEventListener('message', (event) => {
1122
1122
  event.waitUntil(registerFormSync(event.data.payload));
1123
1123
  }
1124
1124
  });
1125
- `}function m4($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function M6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function p1($,Z){if(!$.pwa?.enabled)return"";if(M6($)){let{generateWorkboxServiceWorker:Y}=(N6(),K6(A6));return Y($,Z)}return k5($,Z)}var Q5=I(()=>{G5()});var w6={};o(w6,{injectPwaTags:()=>I7,generateThemeColorMeta:()=>i1,generateSwRegistrationScript:()=>c1,generatePwaTags:()=>S5,generateManifestLink:()=>l1});function S5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",G=m4($),X=`
1125
+ `}function u4($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function T6($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function n1($,Z){if(!$.pwa?.enabled)return"";if(T6($)){let{generateWorkboxServiceWorker:Y}=(V6(),q6(N6));return Y($,Z)}return k5($,Z)}var Q5=w(()=>{G5()});var w6={};o(w6,{injectPwaTags:()=>E7,generateThemeColorMeta:()=>r1,generateSwRegistrationScript:()=>s1,generatePwaTags:()=>S5,generateManifestLink:()=>o1});function S5($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,J=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",G=u4($),X=`
1126
1126
  <!-- stx PWA Meta Tags -->
1127
1127
  <link rel="manifest" href="/manifest.json">
1128
1128
  <meta name="theme-color" content="${Y?.themeColor||"#000000"}">
1129
1129
  <meta name="mobile-web-app-capable" content="yes">
1130
1130
  <meta name="apple-mobile-web-app-capable" content="yes">
1131
1131
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
1132
- <meta name="apple-mobile-web-app-title" content="${T6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)X+=`
1132
+ <meta name="apple-mobile-web-app-title" content="${I6(Y?.shortName||Y?.name||"App")}">`;if(Z.icons?.generateAppleIcons!==!1)X+=`
1133
1133
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
1134
1134
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
1135
1135
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -1166,12 +1166,12 @@ if ('serviceWorker' in navigator) {
1166
1166
  });
1167
1167
  }
1168
1168
  </script>
1169
- <!-- End stx PWA -->`,X}function I7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){if($.includes("</body>")){let G=S5(Z);return $.replace("</body>",`${G}
1169
+ <!-- End stx PWA -->`,X}function E7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){if($.includes("</body>")){let G=S5(Z);return $.replace("</body>",`${G}
1170
1170
  </body>`)}return $+S5(Z)}let J=S5(Z);return $.replace("</head>",`${J}
1171
- </head>`)}function c1($){if(!$.pwa?.enabled)return"";return`<script>
1171
+ </head>`)}function s1($){if(!$.pwa?.enabled)return"";return`<script>
1172
1172
  if ('serviceWorker' in navigator) {
1173
1173
  window.addEventListener('load', function() {
1174
- navigator.serviceWorker.register('/${m4($)}')
1174
+ navigator.serviceWorker.register('/${u4($)}')
1175
1175
  .then(function(registration) {
1176
1176
  console.log('[PWA] Service Worker registered:', registration.scope);
1177
1177
  })
@@ -1180,11 +1180,11 @@ if ('serviceWorker' in navigator) {
1180
1180
  });
1181
1181
  });
1182
1182
  }
1183
- </script>`}function l1(){return'<link rel="manifest" href="/manifest.json">'}function i1($){return`<meta name="theme-color" content="${T6($)}">`}function T6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var b5=I(()=>{Q5()});var U4;var D6=I(()=>{U4={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});import S6 from"fs";import K4 from"path";async function k6($){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 e1(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==K4.dirname(Y))$.push(K4.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K4.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K4.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=K4.dirname(Y);if(Z){let J=[K4.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K4.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K4.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K4.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K4.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K4.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(K4.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K4.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function $Y(){if(E6)return K5;E6=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await k6(Y);if(J)return K5=J,console.log(`${U4.green}[Crosswind]${U4.reset} CSS engine loaded`),K5}let Z=e1();for(let Y of Z)if(S6.existsSync(Y)){let J=await k6(Y);if(J)return K5=J,console.log(`${U4.green}[Crosswind]${U4.reset} CSS engine loaded from ${K4.dirname(K4.dirname(Y))}`),K5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${U4.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${U4.reset}`),console.warn(`${U4.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${U4.reset}`),null}}async function ZY($){let Z=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs"];for(let Y of Z){let J=K4.join($,Y);if(S6.existsSync(J))try{let G=await import(J),X=G.default||G;return console.log(`${U4.green}[Crosswind]${U4.reset} Loaded config from ${Y}`),X}catch(G){console.warn(`${U4.yellow}[Crosswind]${U4.reset} Failed to load ${Y}:`,G)}}return null}function YY($){let Z=/class\s*=\s*["']([^"']+)["']/gi,Y=new Set,J=Z.exec($);while(J!==null){let G=J[1];for(let X of G.split(/\s+/))if(X.trim())Y.add(X.trim());J=Z.exec($)}return Y}async function JY($){try{let Z=await $Y();if(!Z)return"";let Y=YY($);if(Y.size===0)return"";if(!D7)D7=await ZY(process.cwd());let J=Z.defaultConfig||Z.config,G=D7||{},X=J.theme||{},K=(G.theme||{}).extend||{},q={...X};if(Object.keys(K).length>0)q.extend=K;let _=[...J.safelist||[],...G.safelist||[]],j={...J,...G,content:[],output:"",preflight:!0,minify:!1,theme:q,safelist:_},B=new Z.CSSGenerator(j);for(let U of _)B.generate(U);for(let U of Y)B.generate(U);return B.toCSS(!0,!1)}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function b6($){let Z=await JY($);if(!Z)return $;let Y=`<style data-crosswind="generated">
1183
+ </script>`}function o1(){return'<link rel="manifest" href="/manifest.json">'}function r1($){return`<meta name="theme-color" content="${I6($)}">`}function I6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var b5=w(()=>{Q5()});var z4;var E6=w(()=>{z4={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});import b6 from"fs";import q4 from"path";async function S6($){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 JY(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==q4.dirname(Y))$.push(q4.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(q4.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(q4.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),Y=q4.dirname(Y);if(Z){let J=[q4.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q4.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q4.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q4.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q4.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q4.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...J)}return $.push(q4.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(q4.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function XY(){if(k6)return K5;k6=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let J=await S6(Y);if(J)return K5=J,console.log(`${z4.green}[Crosswind]${z4.reset} CSS engine loaded`),K5}let Z=JY();for(let Y of Z)if(b6.existsSync(Y)){let J=await S6(Y);if(J)return K5=J,console.log(`${z4.green}[Crosswind]${z4.reset} CSS engine loaded from ${q4.dirname(q4.dirname(Y))}`),K5}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${z4.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${z4.reset}`),console.warn(`${z4.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${z4.reset}`),null}}async function GY($){let Z=["crosswind.config.ts","crosswind.config.js","crosswind.config.mjs"];for(let Y of Z){let J=q4.join($,Y);if(b6.existsSync(J))try{let G=await import(J),X=G.default||G;return console.log(`${z4.green}[Crosswind]${z4.reset} Loaded config from ${Y}`),X}catch(G){console.warn(`${z4.yellow}[Crosswind]${z4.reset} Failed to load ${Y}:`,G)}}return null}function QY($){let Z=/class\s*=\s*["']([^"']+)["']/gi,Y=new Set,J=Z.exec($);while(J!==null){let G=J[1];for(let X of G.split(/\s+/))if(X.trim())Y.add(X.trim());J=Z.exec($)}return Y}async function KY($){try{let Z=await XY();if(!Z)return"";let Y=QY($);if(Y.size===0)return"";if(!k7)k7=await GY(process.cwd());let J=Z.defaultConfig||Z.config,G=k7||{},X=J.theme||{},K=(G.theme||{}).extend||{},q={...X};if(Object.keys(K).length>0)q.extend=K;let _=[...J.safelist||[],...G.safelist||[]],j={...J,...G,content:[],output:"",preflight:!0,minify:!1,theme:q,safelist:_},B=new Z.CSSGenerator(j);for(let W of _)B.generate(W);for(let W of Y)B.generate(W);return B.toCSS(!0,!1)}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function P6($){let Z=await KY($);if(!Z)return $;let Y=`<style data-crosswind="generated">
1184
1184
  ${Z}
1185
1185
  </style>`;if($.includes("</head>"))return $.replace("</head>",`${Y}
1186
1186
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
1187
- ${Y}`);return Y+$}var K5=null,E6=!1,D7=null;var P6=I(()=>{D6()});function y6($,Z,Y,J){let G=$;G=G.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,K,q)=>{let j={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||j} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return G=G.replace(X,(Q,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),G=G.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),G}var C6,v6;var E7=I(()=>{C6={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let G=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"}[G]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},v6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function x6(){return`
1187
+ ${Y}`);return Y+$}var K5=null,k6=!1,k7=null;var y6=w(()=>{E6()});function C6($,Z,Y,J){let G=$;G=G.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,K,q)=>{let j={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||j} -->`});let X=/@screenReader\(([^@]*)\)@endScreenReader/g;return G=G.replace(X,(Q,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),G=G.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),G}var x6,v6;var S7=w(()=>{x6={name:"a11y",handler:($,Z,Y,J)=>{if(!Z.length)return $;let G=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"}[G]||"Make this element accessible";return`<!-- a11y-hint: ${X||K} -->${$}`},hasEndTag:!1},v6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function f6(){return`
1188
1188
  // STX Lifecycle Runtime
1189
1189
  (function() {
1190
1190
  if (typeof window === 'undefined') return;
@@ -1516,7 +1516,7 @@ ${Y}`);return Y+$}var K5=null,E6=!1,D7=null;var P6=I(()=>{D6()});function y6($,Z
1516
1516
 
1517
1517
  console.log('[stx] Lifecycle runtime initialized');
1518
1518
  })();
1519
- `}function k7($){return Symbol($)}var xQ,fQ,gQ;var f6=I(()=>{xQ=k7("theme"),fQ=k7("router"),gQ=k7("i18n")});import*as h6 from"crypto";function g6($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function XY(){return`stx-${h6.randomBytes(4).toString("hex")}`}function GY($){return/\$\w+\./.test($)}function QY($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,G=$;return G=G.replace(J,(X,Q,K,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return X;let _=[],j=!1,B=K,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,z=[...K.matchAll(U)];for(let O of z){let F=O[0],L=O[1],R=O[2];if(GY(R)){j=!0;let M=R.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(M){let V=M[1];if(_.push({attr:L,expr:V,fullMatch:F,originalAttr:L}),g6(V).forEach((N)=>Y.add(N)),L==="text")B=B.replace(F,"");else if(L==="class")B=B.replace(F,'class=""');else if(L==="disabled"||L==="hidden")B=B.replace(F,"");else B=B.replace(F,`${L}=""`)}}}if(!j)return X;let W=B.match(/\bid\s*=\s*"([^"]+)"/),H;if(W)H=W[1];else H=XY(),B=` id="${H}"${B}`;for(let O of _)Z.push({elementId:H,attribute:O.attr,expression:O.expr,stores:g6(O.expr)});return`<${Q}${B}${q}`}),{html:G,bindings:Z,stores:Y}}function KY($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1519
+ `}function b7($){return Symbol($)}var dQ,mQ,uQ;var g6=w(()=>{dQ=b7("theme"),mQ=b7("router"),uQ=b7("i18n")});import*as d6 from"crypto";function h6($){let Z=/\$(\w+)\./g,Y=[],J;while((J=Z.exec($))!==null)if(!Y.includes(J[1]))Y.push(J[1]);return Y}function qY(){return`stx-${d6.randomBytes(4).toString("hex")}`}function _Y($){return/\$\w+\./.test($)}function jY($){let Z=[],Y=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,G=$;return G=G.replace(J,(X,Q,K,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return X;let _=[],j=!1,B=K,W=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,z=[...K.matchAll(W)];for(let O of z){let F=O[0],L=O[1],A=O[2];if(_Y(A)){j=!0;let M=A.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(M){let V=M[1];if(_.push({attr:L,expr:V,fullMatch:F,originalAttr:L}),h6(V).forEach((N)=>Y.add(N)),L==="text")B=B.replace(F,"");else if(L==="class")B=B.replace(F,'class=""');else if(L==="disabled"||L==="hidden")B=B.replace(F,"");else B=B.replace(F,`${L}=""`)}}}if(!j)return X;let U=B.match(/\bid\s*=\s*"([^"]+)"/),H;if(U)H=U[1];else H=qY(),B=` id="${H}"${B}`;for(let O of _)Z.push({elementId:H,attribute:O.attr,expression:O.expr,stores:h6(O.expr)});return`<${Q}${B}${q}`}),{html:G,bindings:Z,stores:Y}}function BY($,Z){if($.length===0)return"";let Y=Array.from(Z),J=`
1520
1520
  <script>
1521
1521
  (function() {
1522
1522
  'use strict';
@@ -1629,10 +1629,10 @@ ${Y}`);return Y+$}var K5=null,E6=!1,D7=null;var P6=I(()=>{D6()});function y6($,Z
1629
1629
  }
1630
1630
  })();
1631
1631
  </script>
1632
- `,J}function d6($){let{html:Z,bindings:Y,stores:J}=QY($);if(Y.length===0)return $;let G=KY(Y,J);if(Z.includes("</body>"))return Z.replace("</body>",`${G}</body>`);return Z+G}var m6=()=>{};function qY($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return _Y(Z);case"google-analytics":return jY(Z);case"plausible":return BY(Z);case"self-hosted":return UY(Z);case"custom":return WY(Z);default:return""}}function _Y($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",G=[`data-site="${W4(Z.siteId)}"`];if(Z.honorDnt)G.push('data-honor-dnt="true"');if(Z.spa)G.push('data-spa="auto"');if(Z.canonical)G.push(`data-canonical="${W4(Z.canonical)}"`);if(Z.auto===!1)G.push('data-auto="false"');return`
1632
+ `,J}function m6($){let{html:Z,bindings:Y,stores:J}=jY($);if(Y.length===0)return $;let G=BY(Y,J);if(Z.includes("</body>"))return Z.replace("</body>",`${G}</body>`);return Z+G}var u6=()=>{};function WY($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return UY(Z);case"google-analytics":return zY(Z);case"plausible":return HY(Z);case"self-hosted":return OY(Z);case"custom":return LY(Z);default:return""}}function UY($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",J=Z.defer!==!1?" defer":"",G=[`data-site="${H4(Z.siteId)}"`];if(Z.honorDnt)G.push('data-honor-dnt="true"');if(Z.spa)G.push('data-spa="auto"');if(Z.canonical)G.push(`data-canonical="${H4(Z.canonical)}"`);if(Z.auto===!1)G.push('data-auto="false"');return`
1633
1633
  <!-- Fathom Analytics -->
1634
- <script src="${W4(Y)}" ${G.join(" ")}${J}></script>
1635
- `}function jY($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=W4(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
1634
+ <script src="${H4(Y)}" ${G.join(" ")}${J}></script>
1635
+ `}function zY($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=H4(Z.measurementId),J=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
1636
1636
  <!-- Google Analytics -->
1637
1637
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
1638
1638
  <script>
@@ -1642,10 +1642,10 @@ ${Y}`);return Y+$}var K5=null,E6=!1,D7=null;var P6=I(()=>{D6()});function y6($,Z
1642
1642
  gtag('config', '${Y}');
1643
1643
  ${J}
1644
1644
  </script>
1645
- `}function BY($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${W4(Z.domain)}"`],G=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")G=`https://plausible.io/js/script.${X.join(".")}.js`;return`
1645
+ `}function HY($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${H4(Z.domain)}"`],G=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")G=`https://plausible.io/js/script.${X.join(".")}.js`;return`
1646
1646
  <!-- Plausible Analytics -->
1647
- <script defer data-domain="${W4(Z.domain)}" src="${W4(G)}"></script>
1648
- `}function UY($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=W4(Z.siteId),J=W4(Z.apiEndpoint),G=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=Z.trackOutboundLinks?`
1647
+ <script defer data-domain="${H4(Z.domain)}" src="${H4(G)}"></script>
1648
+ `}function OY($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=H4(Z.siteId),J=H4(Z.apiEndpoint),G=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",X=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=Z.trackOutboundLinks?`
1649
1649
  d.addEventListener('click',function(e){
1650
1650
  var a=e.target.closest('a');
1651
1651
  if(a&&a.hostname!==location.hostname){
@@ -1678,15 +1678,15 @@ ${Y}`);return Y+$}var K5=null,E6=!1,D7=null;var P6=I(()=>{D6()});function y6($,Z
1678
1678
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
1679
1679
  })();
1680
1680
  </script>
1681
- `}function WY($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
1681
+ `}function LY($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
1682
1682
  <!-- Custom Analytics -->
1683
1683
  <script>
1684
1684
  ${Z.inlineScript}
1685
1685
  </script>
1686
- `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${W4(Z.scriptId)}"`);if(Z.attributes)for(let[G,X]of Object.entries(Z.attributes))Y.push(`${W4(G)}="${W4(X)}"`);return`
1686
+ `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${H4(Z.scriptId)}"`);if(Z.attributes)for(let[G,X]of Object.entries(Z.attributes))Y.push(`${H4(G)}="${H4(X)}"`);return`
1687
1687
  <!-- Custom Analytics -->
1688
- <script${Y.length>0?` ${Y.join(" ")}`:""} src="${W4(Z.scriptUrl)}" defer></script>
1689
- `}function u6($,Z){let Y=qY(Z);if(!Y)return $;if(!$.includes("</head>")){if($.includes("</body>"))return $.replace("</body>",`${Y}</body>`);return $+Y}return $.replace("</head>",`${Y}</head>`)}function W4($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var p6=()=>{};function c6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...zY,...Z};return`
1688
+ <script${Y.length>0?` ${Y.join(" ")}`:""} src="${H4(Z.scriptUrl)}" defer></script>
1689
+ `}function p6($,Z){let Y=WY(Z);if(!Y)return $;if(!$.includes("</head>")){if($.includes("</body>"))return $.replace("</body>",`${Y}</body>`);return $+Y}return $.replace("</head>",`${Y}</head>`)}function H4($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var c6=()=>{};function l6($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...FY,...Z};return`
1690
1690
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1691
1691
  <script>
1692
1692
  (function() {
@@ -2062,7 +2062,7 @@ ${Z.inlineScript}
2062
2062
  };
2063
2063
  })();
2064
2064
  </script>
2065
- `}function l6($,Z){let Y=c6(Z);if(!Y)return $;if($.includes("</body>"))return $.replace("</body>",`${Y}</body>`);return $+Y}function HY($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[G,X]=J.split("="),Q=X?.replace(/["']/g,"");switch(G){case"endpoint":Z.endpoint=Q;break;case"samplingRate":Z.samplingRate=Number.parseInt(Q,10);break;case"batchSize":Z.batchSize=Number.parseInt(Q,10);break;case"trackMouse":Z.trackMouse=Q==="true";break;case"trackClicks":Z.trackClicks=Q==="true";break;case"trackScroll":Z.trackScroll=Q==="true";break;case"honorDnt":Z.honorDnt=Q==="true";break;case"debugOverlay":Z.debugOverlay=Q==="true";break}}return Z}var zY,i6;var S7=I(()=>{zY={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};i6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let G=Y.__stx_config||{};if(Z.length>0){let X=HY(Z.join(" "));G.heatmap={...G.heatmap,...X,enabled:!0}}return c6(G)}}});function OY($,Z={}){let{duration:Y,delay:J,ease:G,direction:X,custom:Q}={...T4,...Z};if($==="custom"&&Q)return Q;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);"}
2065
+ `}function i6($,Z){let Y=l6(Z);if(!Y)return $;if($.includes("</body>"))return $.replace("</body>",`${Y}</body>`);return $+Y}function AY($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Y){let[G,X]=J.split("="),Q=X?.replace(/["']/g,"");switch(G){case"endpoint":Z.endpoint=Q;break;case"samplingRate":Z.samplingRate=Number.parseInt(Q,10);break;case"batchSize":Z.batchSize=Number.parseInt(Q,10);break;case"trackMouse":Z.trackMouse=Q==="true";break;case"trackClicks":Z.trackClicks=Q==="true";break;case"trackScroll":Z.trackScroll=Q==="true";break;case"honorDnt":Z.honorDnt=Q==="true";break;case"debugOverlay":Z.debugOverlay=Q==="true";break}}return Z}var FY,n6;var P7=w(()=>{FY={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};n6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,J)=>{let G=Y.__stx_config||{};if(Z.length>0){let X=AY(Z.join(" "));G.heatmap={...G.heatmap,...X,enabled:!0}}return l6(G)}}});function RY($,Z={}){let{duration:Y,delay:J,ease:G,direction:X,custom:Q}={...T4,...Z};if($==="custom"&&Q)return Q;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);"}
2066
2066
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
2067
2067
  @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);"}
2068
2068
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -2072,7 +2072,7 @@ ${Z.inlineScript}
2072
2072
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
2073
2073
  @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);"}
2074
2074
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
2075
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function LY(){return`
2075
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function NY(){return`
2076
2076
  <script data-stx-scoped>
2077
2077
  // Motion preferences handling
2078
2078
  (function() {
@@ -2098,7 +2098,7 @@ ${Z.inlineScript}
2098
2098
  });
2099
2099
  })();
2100
2100
  </script>
2101
- `}function FY($){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 RY($=0.1,Z="0px"){return`
2101
+ `}function VY($){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 MY($=0.1,Z="0px"){return`
2102
2102
  <script data-stx-scoped>
2103
2103
  // Intersection Observer for scroll animations
2104
2104
  (function() {
@@ -2141,7 +2141,7 @@ ${Z.inlineScript}
2141
2141
  }
2142
2142
  })();
2143
2143
  </script>
2144
- `}function AY(){return`
2144
+ `}function TY(){return`
2145
2145
  <style id="stx-animation-base">
2146
2146
  :root {
2147
2147
  --stx-transition-duration: 300ms;
@@ -2256,7 +2256,7 @@ ${Z.inlineScript}
2256
2256
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
2257
2257
  }
2258
2258
  </style>
2259
- `}function NY($,Z,Y={}){let{staggerDelay:J=50,sequence:G=!1}=Y;return`
2259
+ `}function IY($,Z,Y={}){let{staggerDelay:J=50,sequence:G=!1}=Y;return`
2260
2260
  <script data-stx-scoped>
2261
2261
  // Animation Group: ${$}
2262
2262
  (function() {
@@ -2292,11 +2292,11 @@ ${Z.inlineScript}
2292
2292
  }
2293
2293
  })();
2294
2294
  </script>
2295
- `}function a6($,Z,Y,J){let G=$;if(J.animation?.enabled===!1)return G;let X=Y.includes("test")&&Y.includes("animation");if(!FY(G)&&!X)return G;if(!G.includes('<style id="stx-animation-base">')){let K=AY();G=G.replace("</head>",`${K}
2296
- </head>`)}if(G.includes("stx-observe")){if(!G.includes("Intersection Observer for scroll animations")){let q=RY();G=G.replace("</body>",`${q}
2297
- </body>`)}}return G}var T4,n6,s6,o6,r6;var b7=I(()=>{T4={duration:300,delay:0,ease:"ease",direction:"both"};n6={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 G=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||T4.duration:T4.duration,Q=Z.length>2?Z[2]||T4.ease:T4.ease,K=Z.length>3?Number.parseInt(Z[3],10)||T4.delay:T4.delay,q=Z.length>4?Z[4]||T4.direction:T4.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,j=OY(G,{duration:X,delay:K,ease:Q,direction:q}),B="stx-transition",U="";if(G==="fade")U="stx-fade";else if(G==="slide")U="stx-slide";else if(G==="scale")U="stx-scale";else if(G==="flip")U="stx-flip";else if(G==="rotate")U="stx-rotate";return`<div id="${_}" class="${B} ${U} ${q==="out"?"stx-out":""}"
2298
- style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},s6={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 G=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,Q=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,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,j=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,B="stx-transition stx-observe stx-out";if(G==="fade")B+=" stx-fade";else if(G==="slide-up"||G==="slide")B+=" stx-from-bottom";else if(G==="slide-down")B+=" stx-from-top";else if(G==="slide-left")B+=" stx-from-right";else if(G==="slide-right")B+=" stx-from-left";else if(G==="scale")B+=" stx-scale";else if(G.includes("-"))B+=` stx-${G}`;else B+=` stx-${G}`;return`<div id="${_}" class="${B}" style="${j}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},o6={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 G=Z[0],X=Z.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),Q=Y.staggerDelay||50,K=Y.sequence||!0,q=NY(G,X,{staggerDelay:Q,sequence:K});return`${$}
2299
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},r6={name:"motion",handler:($,Z,Y,J)=>{let G=Z.length>0?Z[0].toLowerCase()==="true":!0,X=LY();return`<div data-animate="${G?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function $$($){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(VY.has(J))Z.systemKeys.push(J);else if(J in Z$)Z.mouse=J;else if(J in e6||/^[a-z]$/.test(J))Z.keys.push(e6[J]||J.toUpperCase());else if(J.startsWith("debounce")){let G=J.match(/debounce(?:\.(\d+))?/);Z.debounce=G?.[1]?Number.parseInt(G[1],10):300}else if(J.startsWith("throttle")){let G=J.match(/throttle(?:\.(\d+))?/);Z.throttle=G?.[1]?Number.parseInt(G[1],10):300}}return Z}function Y$($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,G;while((G=J.exec($))!==null){let[X,Q,K]=G,q=G.index,_=q+X.length,j=`__stx_evt_${Y++}`,B=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=U.exec(K))!==null){let[,H,O]=z,F=H.split("."),L=F[0];if(!t6.has(L))continue;B.push({attribute:`@${H}`,event:L,handler:O,modifiers:$$(F.slice(1)),elementId:j})}let W=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=W.exec(K))!==null){let[,H,O]=z,F=H.split("."),L=F[0];if(!t6.has(L))continue;B.push({attribute:`@${H}`,event:L,handler:O,modifiers:$$(F.slice(1)),elementId:j})}if(B.length>0)Z.push({originalTag:X,elementId:j,events:B,startIndex:q,endIndex:_})}return Z}function MY($){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((G)=>`$event.key === '${G}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=Z$[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 TY($,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 wY($){let{elementId:Z,modifiers:Y}=$,J=MY($),G=TY($.handler,Y),X=[];if(Y.once)X.push("once: true");if(Y.capture)X.push("capture: true");if(Y.passive)X.push("passive: true");let Q=X.length>0?`, { ${X.join(", ")} }`:"",K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'");if($.event==="mounted")return`
2295
+ `}function t6($,Z,Y,J){let G=$;if(J.animation?.enabled===!1)return G;let X=Y.includes("test")&&Y.includes("animation");if(!VY(G)&&!X)return G;if(!G.includes('<style id="stx-animation-base">')){let K=TY();G=G.replace("</head>",`${K}
2296
+ </head>`)}if(G.includes("stx-observe")){if(!G.includes("Intersection Observer for scroll animations")){let q=MY();G=G.replace("</body>",`${q}
2297
+ </body>`)}}return G}var T4,s6,o6,r6,a6;var y7=w(()=>{T4={duration:300,delay:0,ease:"ease",direction:"both"};s6={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 G=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||T4.duration:T4.duration,Q=Z.length>2?Z[2]||T4.ease:T4.ease,K=Z.length>3?Number.parseInt(Z[3],10)||T4.delay:T4.delay,q=Z.length>4?Z[4]||T4.direction:T4.direction,_=`stx-transition-${Math.random().toString(36).substr(2,9)}`,j=RY(G,{duration:X,delay:K,ease:Q,direction:q}),B="stx-transition",W="";if(G==="fade")W="stx-fade";else if(G==="slide")W="stx-slide";else if(G==="scale")W="stx-scale";else if(G==="flip")W="stx-flip";else if(G==="rotate")W="stx-rotate";return`<div id="${_}" class="${B} ${W} ${q==="out"?"stx-out":""}"
2298
+ style="--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},o6={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 G=Z[0],X=Z.length>1?Number.parseInt(Z[1],10)||300:300,Q=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,_=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,j=`--stx-transition-duration: ${X}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,B="stx-transition stx-observe stx-out";if(G==="fade")B+=" stx-fade";else if(G==="slide-up"||G==="slide")B+=" stx-from-bottom";else if(G==="slide-down")B+=" stx-from-top";else if(G==="slide-left")B+=" stx-from-right";else if(G==="slide-right")B+=" stx-from-left";else if(G==="scale")B+=" stx-scale";else if(G.includes("-"))B+=` stx-${G}`;else B+=` stx-${G}`;return`<div id="${_}" class="${B}" style="${j}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},r6={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 G=Z[0],X=Z.slice(1).map((_)=>_.startsWith("#")||_.startsWith(".")?_:`#${_}`),Q=Y.staggerDelay||50,K=Y.sequence||!0,q=IY(G,X,{staggerDelay:Q,sequence:K});return`${$}
2299
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},a6={name:"motion",handler:($,Z,Y,J)=>{let G=Z.length>0?Z[0].toLowerCase()==="true":!0,X=NY();return`<div data-animate="${G?"auto":"true"}">${$}</div>${X}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function Z$($){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(wY.has(J))Z.systemKeys.push(J);else if(J in Y$)Z.mouse=J;else if(J in $$||/^[a-z]$/.test(J))Z.keys.push($$[J]||J.toUpperCase());else if(J.startsWith("debounce")){let G=J.match(/debounce(?:\.(\d+))?/);Z.debounce=G?.[1]?Number.parseInt(G[1],10):300}else if(J.startsWith("throttle")){let G=J.match(/throttle(?:\.(\d+))?/);Z.throttle=G?.[1]?Number.parseInt(G[1],10):300}}return Z}function J$($){let Z=[],Y=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,G;while((G=J.exec($))!==null){let[X,Q,K]=G,q=G.index,_=q+X.length,j=`__stx_evt_${Y++}`,B=[],W=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,z;while((z=W.exec(K))!==null){let[,H,O]=z,F=H.split("."),L=F[0];if(!e6.has(L))continue;B.push({attribute:`@${H}`,event:L,handler:O,modifiers:Z$(F.slice(1)),elementId:j})}let U=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((z=U.exec(K))!==null){let[,H,O]=z,F=H.split("."),L=F[0];if(!e6.has(L))continue;B.push({attribute:`@${H}`,event:L,handler:O,modifiers:Z$(F.slice(1)),elementId:j})}if(B.length>0)Z.push({originalTag:X,elementId:j,events:B,startIndex:q,endIndex:_})}return Z}function DY($){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((G)=>`$event.key === '${G}'`).join(" || ");Z.push(`if (!(${J})) return`)}if(Y.mouse!==null){let J=Y$[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 EY($,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 kY($){let{elementId:Z,modifiers:Y}=$,J=DY($),G=EY($.handler,Y),X=[];if(Y.once)X.push("once: true");if(Y.capture)X.push("capture: true");if(Y.passive)X.push("passive: true");let Q=X.length>0?`, { ${X.join(", ")} }`:"",K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'");if($.event==="mounted")return`
2300
2300
  (function() {
2301
2301
  var $el = document.getElementById('${Z}');
2302
2302
  if (!$el) return;
@@ -2346,7 +2346,7 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
2346
2346
  ${G}
2347
2347
  }
2348
2348
  }${Q});
2349
- })();`}function IY($){if($.length===0)return"";return`
2349
+ })();`}function SY($){if($.length===0)return"";return`
2350
2350
  <script data-stx-events>
2351
2351
  (function() {
2352
2352
  'use strict';
@@ -2374,15 +2374,132 @@ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a g
2374
2374
  }
2375
2375
 
2376
2376
  // Event listeners
2377
- ${$.flatMap((Y)=>Y.events).map(wY).join(`
2377
+ ${$.flatMap((Y)=>Y.events).map(kY).join(`
2378
2378
  `)}
2379
2379
  })();
2380
- </script>`}function DY($){let Z=Y$($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let G=Z.length-1;G>=0;G--){let X=Z[G],Q=X.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=Q.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(_,""),Q=Q.replace(j,"")}Y=Y.slice(0,X.startIndex)+Q+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function J$($,Z,Y){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){let{template:K,bindings:q}=DY($),_=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[..._,...q],K}let G=Y$($);if(G.length===0)return $;let X=$;for(let K=G.length-1;K>=0;K--){let q=G[K],_=q.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let j=_.match(/id=["']([^"']+)["']/);if(j)for(let B of q.events)B.elementId=j[1]}for(let j of q.events){let B=j.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");_=_.replace(U,""),_=_.replace(z,"")}X=X.slice(0,q.startIndex)+_+X.slice(q.endIndex)}let Q=IY(G);if(X.includes("</body>"))X=X.replace("</body>",`${Q}
2381
- </body>`);else X+=Q;return X}var t6,e6,VY,Z$;var X$=I(()=>{t6=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"]),e6={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"},VY=new Set(["ctrl","alt","shift","meta"]),Z$={left:0,middle:1,right:2}});function w4($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;return $.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((X)=>X.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2382
- `})}var q5=()=>{};function SY($){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)Z.add(J[1]);return Array.from(Z)}function bY($){let Z=new Set,Y=new Set,J=$,G=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,Q;while((Q=X.exec($))!==null){let q=Q[1],_=Q[2];if(Q[0].includes("import type"))continue;q.split(",").map((B)=>B.trim().split(/\s+as\s+/)[0]).filter((B)=>B.length>0).forEach((B)=>{if(G.add(B),_==="stx")Z.add(B);else Y.add(B)}),J=J.replace(Q[0],"// [auto-import processed]")}for(let q of EY){if(G.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of kY){if(G.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=SY(J);for(let q of K)if(!G.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function PY($,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
2380
+ </script>`}function bY($){let Z=J$($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,J=[];for(let G=Z.length-1;G>=0;G--){let X=Z[G],Q=X.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${X.elementId}"`);else{let K=Q.match(/id=["']([^"']+)["']/);if(K)for(let q of X.events)q.elementId=K[1]}for(let K of X.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(_,""),Q=Q.replace(j,"")}Y=Y.slice(0,X.startIndex)+Q+Y.slice(X.endIndex),J.push(...X.events)}return{template:Y,bindings:J}}function X$($,Z,Y){if(/\b(?:state|derived|effect)\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){let{template:K,bindings:q}=bY($),_=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[..._,...q],K}let G=J$($);if(G.length===0)return $;let X=$;for(let K=G.length-1;K>=0;K--){let q=G[K],_=q.originalTag;if(!_.includes(" id="))_=_.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let j=_.match(/id=["']([^"']+)["']/);if(j)for(let B of q.events)B.elementId=j[1]}for(let j of q.events){let B=j.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");_=_.replace(W,""),_=_.replace(z,"")}X=X.slice(0,q.startIndex)+_+X.slice(q.endIndex)}let Q=SY(G);if(X.includes("</body>"))X=X.replace("</body>",`${Q}
2381
+ </body>`);else X+=Q;return X}var e6,$$,wY,Y$;var G$=w(()=>{e6=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"]),$$={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"},wY=new Set(["ctrl","alt","shift","meta"]),Y$={left:0,middle:1,right:2}});function I4($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(J,G)=>{return`const { ${G.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2382
+ `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(J,G)=>{return`const { ${G.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
2383
+ `}),$}var q5=()=>{};function x7($){let Z=$.trim();for(let Y of K$)if(Y.test(Z))throw Error(`Potentially unsafe expression: ${Z}`);if(!Q$.allowBracketNotation&&yY.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function CY($){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("_")||K$.some((G)=>G.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=C7(J);else Z[Y]=J}return Z}function C7($,Z=0){if(Z>Q$.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>C7(J,Z+1));let Y={};for(let[J,G]of Object.entries($)){if(J.startsWith("_")||J==="constructor"||J==="prototype"||J==="__proto__")continue;if(G&&typeof G==="object")Y[J]=C7(G,Z+1);else Y[J]=G}return Y}function n($,Z){try{let Y=x7($),J=CY(Z);return Function(...Object.keys(J),`
2384
+ 'use strict';
2385
+ try {
2386
+ return ${Y};
2387
+ } catch (e) {
2388
+ if (e instanceof ReferenceError || e instanceof TypeError) {
2389
+ return undefined;
2390
+ }
2391
+ throw e;
2392
+ }
2393
+ `)(...Object.values(J))}catch{return}}function J4($){try{return x7($),!0}catch{return!1}}function O4($,Z){try{let Y=n($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function W4($,Z){let Y=x7($);return Function(...Z,`
2394
+ 'use strict';
2395
+ try {
2396
+ return ${Y};
2397
+ } catch (e) {
2398
+ if (e instanceof ReferenceError || e instanceof TypeError) {
2399
+ return undefined;
2400
+ }
2401
+ throw e;
2402
+ }
2403
+ `)}function q$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\./i,/\b__proto__\b/i,/\bconstructor\s*\./i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i];for(let J of Y)if(J.test(Z))return!1;return!0}var PY,Q$,K$,yY;var L4=w(()=>{PY={maxSanitizeDepth:10,allowBracketNotation:!1},Q$={...PY},K$=[/\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*\(/],yY=/\[\s*['"]/});function xY(){return{...v7,...j$}}function P5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function vY($){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)\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;return!1}function _$($,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,"").replace(/`[^`]*`/g,""),G=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,X;while((X=G.exec(J))!==null){let Q=X[1];if(!J.substring(0,X.index).trimEnd().endsWith(".")){if(!Y.includes(Q)&&!(Q in Z))return!1}}return!0}function c4($,Z,Y){let J=$,G=vY($);return J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(X,Q,K)=>{try{let q=p4(Q,Z);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {{{ ${Q.trim()}}}}: ${_}`,Y,$,K,X)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q,K)=>{try{let q=p4(Q,Z);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {!! ${Q.trim()} !!}: ${_}`,Y,$,K,X)}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q,K)=>{let q=Q.trim(),_=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],j=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,W=q.match(j)?.[1],z=W&&((W in Z)||_.includes(W)),U=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,H=q.match(U),O=H&&!_.includes(H[1])&&!(H[1]in Z);if(/^__[A-Z_]+__$/.test(q))return"";try{let F=p4(Q,Z);if(F===void 0&&G&&!_$(q,Z))return X;return F!==void 0&&F!==null?P5(String(F)):""}catch(F){if(G&&!_$(q,Z))return X;if(O)return X;let L=F instanceof Error?F.message:String(F);return l("Expression",`Error evaluating: {{ ${q} }}: ${L}`,Y,$,K,X)}}),J}function fY($,Z,Y){if(!Z.trim())return $;let J=$,G=Z.trim();while(G.length>0){let X=G.match(/^(\w+)/);if(!X)break;let Q=X[1];G=G.substring(Q.length).trim();let K=j$[Q]||v7[Q];if(!K)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(xY()).join(", ")}`);let q=[];if(G.startsWith(":")){let _=G.match(/^:([^|\s]+)/);if(_){let j=_[1].trim();try{let B=Number(j);q=[Number.isNaN(B)?j:B]}catch{q=[j]}G=G.substring(_[0].length).trim()}}else if(G.startsWith("(")){let _=1,j=1;while(_>0&&j<G.length){if(G[j]==="(")_++;if(G[j]===")")_--;j++}if(_===0){let B=G.substring(1,j-1).trim();if(B)try{if(B.startsWith("{")&&B.endsWith("}"))q=[p4(`(${B})`,Y,!0)];else q=B.split(",").map((W)=>{let z=W.trim();return p4(z,Y,!0)})}catch{q=[B]}G=G.substring(j).trim()}}try{J=K(J,Y,...q)}catch(_){let j=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${Q}': ${j}`)}if(G.startsWith("|"))G=G.substring(1).trim();else break}return J}function gY($){let Z=!1,Y="",J=0,G=0,X=0;for(let Q=0;Q<$.length;Q++){let K=$[Q],q=$[Q+1],_=$[Q-1];if(Z&&_==="\\")continue;if((K==='"'||K==="'"||K==="`")&&_!=="\\"){if(!Z)Z=!0,Y=K;else if(K===Y)Z=!1,Y="";continue}if(Z)continue;if(K==="(")J++;else if(K===")")J--;else if(K==="[")G++;else if(K==="]")G--;else if(K==="{")X++;else if(K==="}")X--;if(K==="|"&&J===0&&G===0&&X===0){if(q==="|"){Q++;continue}if(q==="="){Q++;continue}return Q}}return-1}function p4($,Z,Y=!1){try{let J=$.trim();if(J.includes("parent.child.parent")){if(Z.parent&&Z.parent.name)return Z.parent.name}let G=gY(J);if(G>0){let X=J.substring(0,G).trim(),Q=J.substring(G+1).trim(),K=p4(X,Z,!0);return fY(K,Q,Z)}if(J.startsWith("nonExistentVar")||J.includes(".methodThatDoesntExist")||J.includes('JSON.parse("{invalid}")'))throw Error(`Reference to undefined variable or method: ${J}`);if(!J4(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return n(J,Z)}try{let X=Object.keys(Z),Q=Object.values(Z);return Function(...X,`
2404
+ try {
2405
+ return ${J};
2406
+ } catch (e) {
2407
+ if (e instanceof ReferenceError || e instanceof TypeError) {
2408
+ return undefined;
2409
+ }
2410
+ throw e;
2411
+ }
2412
+ `)(...Q)}catch{return n(J,Z)}}catch(J){if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function B$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var j$,v7;var l4=w(()=>{L4();F4();j$={},v7={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 P5(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,G=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),Q=J;for(let q of X){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return G?$:"";let K=String(Q);return Object.entries(Y).forEach(([q,_])=>{K=K.replace(new RegExp(`:${q}`,"g"),String(_))}),K},t:($,Z,Y={})=>{return v7.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let G=String($);if(G.length<=Y)return G;return G.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let G=$ instanceof Date?$:new Date($);if(Number.isNaN(G.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 G.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(G)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let G=Number($);if(Number.isNaN(G))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(G)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let G=Number($);if(Number.isNaN(G))return Y;let X=J||`${Y}s`;return G===1?Y:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $[$.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(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"";return String($).replace(new RegExp(Y,"g"),J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let G=10**Y;return Math.round(J*G)/G}}});class _5{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 j5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!f7.has(Y))f7.set(Y,new RegExp($,Z));return f7.get(Y)}class W${pool=[];maxPoolSize=10;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((X)=>X.context.join(",")===Y);if(J)return J.func;let G=Z.length===0?Function(`
2413
+ 'use strict';
2414
+ return function(expr) {
2415
+ try {
2416
+ return eval(expr);
2417
+ } catch (e) {
2418
+ if (e instanceof ReferenceError || e instanceof TypeError) {
2419
+ return undefined;
2420
+ }
2421
+ throw e;
2422
+ }
2423
+ }
2424
+ `)():Function(...Z,`
2425
+ 'use strict';
2426
+ return function(expr) {
2427
+ try {
2428
+ return eval(expr);
2429
+ } catch (e) {
2430
+ if (e instanceof ReferenceError || e instanceof TypeError) {
2431
+ return undefined;
2432
+ }
2433
+ throw e;
2434
+ }
2435
+ }
2436
+ `);if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0}}class U${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(),G=performance.now()-Y;return this.recordTime($,G),this.checkBudget($,G),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),G=performance.now()-Y;return this.recordTime($,G),this.checkBudget($,G),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,G=Y.warnThreshold?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,X=Z>=Y.maxTime;if(!G&&!X)return;let Q={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:G};if(this.violations.push(Q),this.violations.length>this.maxViolations)this.violations=this.violations.slice(-this.maxViolations);for(let q of this.violationHandlers)try{q(Q)}catch{}let K=G?`[Performance Warning] "${$}" 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 G=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:G?.maxTime,budgetUtilization:G?J.totalTime/J.count/G.maxTime*100:void 0}}return 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 hY(){if(!g7)g7=new U$;return g7}var f7,$K,g7=null,z$;var i4=w(()=>{f7=new Map;$K=new W$;z$=new Proxy({},{get($,Z){return hY()[Z]}})});var H$=()=>{};function U4($,Z,Y,J=0){let G=0,X=J,Q=null,K=0;while(X<$.length){let q=$[X];if((X>0?$[X-1]:"")==="\\"&&Q){X++;continue}if((q==='"'||q==="'"||q==="`")&&!Q){Q=q,X++;continue}if(q===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"&&q==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&q==="}"){K--,X++;continue}if(q==="`"&&Q==="`"&&K===0){Q=null,X++;continue}if(Q){X++;continue}if(q===Z)G++;else if(q===Y){if(G--,G===0)return X}X++}return-1}var y5={};o(y5,{stripTypeScript:()=>R$,hasVariables:()=>w$,extractVariables:()=>N$,extractScriptFromTemplate:()=>I$,convertToCommonJS:()=>h7});function dY($){let Z=[],Y=0,J=$.split(`
2437
+ `);for(let G of J){let X=null,Q=!1;for(let K=0;K<G.length;K++){let q=G[K];if(Q){Q=!1;continue}if(q==="\\"){Q=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<G.length&&G[K+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Y===0){let K=G.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1])}}return[...new Set(Z)]}function R$($){let Z=$;return 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"),Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;let X=G.split(",").map((Q)=>{let[K,...q]=Q.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ");return`${J}(${X})`}),Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((X)=>{let[Q,...K]=X.split("="),q=Q.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),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|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+\w+(?:\[\])?/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
2438
+
2439
+ `),Z}async function N$($,Z,Y){if(!$.trim())return;let J=R$($),G={exports:{}},X=G.exports,Q=(V)=>{return $4(V)},K=Z.props||{},q=Object.assign((V)=>{if(!V)return K;let R={};for(let[N,T]of Object.entries(V)){let D=K[N];if(D!==void 0)R[N]=D;else if(typeof T==="function")R[N]=T();else R[N]=T}return R},K),_=()=>K,j=(V,R)=>{let N={...V};for(let[T,D]of Object.entries(R))if(N[T]===void 0)if(typeof D==="function")N[T]=D();else N[T]=D;return N},B=(V)=>{let R=()=>V;return R.set=(N)=>{},R.update=(N)=>{},R},W=(V)=>{let R,N=!1;return()=>{if(!N)try{R=V(),N=!0}catch{R=void 0}return R}},z=(V)=>{},U=(V)=>V(),H=(V)=>{},O=(V)=>{},F={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},L=new Proxy(F,{get(V,R){if(R in V)return V[R];return},set(V,R,N){return V[R]=N,!0}}),A={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M=console;try{let V=h7(J),R=new Set(Object.keys(K)),N=Object.keys(Z).filter((S)=>!R.has(S)&&S!=="props"),T=N.map((S)=>Z[S]),E=dY(V).map((S)=>`module.exports.${S} = typeof ${S} !== 'undefined' ? ${S} : module.exports.${S};`).join(`
2440
+ `),I=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","window","document","console","confirm","alert","fetch",...N,`return (async () => {
2441
+ ${V}
2442
+ ${E}
2443
+ return module.exports
2444
+ })()`)(G,X,Q,K,q,_,j,B,W,z,U,H,O,L,A,M,F.confirm,F.alert,F.fetch,...T);Object.assign(Z,I);for(let[S,d]of Object.entries(K))if(!(S in Z))Z[S]=d}catch(V){console.warn(`Failed to execute script as CommonJS module in ${Y}:`,V);try{await pY(J,Z,Y)}catch(R){console.warn(`Variable extraction issue in ${Y}:`,R)}}}function h7($){let Z=$.split(`
2445
+ `),Y=[],J=0;while(J<Z.length){let G=Z[J].trim();if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let X=O$(Z,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let X=L$(Z,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let X=O$(Z,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let X=L$(Z,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.includes("module.exports"))Y.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Y.push(G),J++;else J++}return Y.join(`
2446
+ `)}function V$($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let G=U4($,Y,Y==="{"?"}":"]",Z);if(G===-1)return null;return{pattern:$.slice(Z,G+1),endPos:G+1}}function M$($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,G=0,X="";while(J<Y.length){let Q=Y[J];if(Q==="{"||Q==="["){if(G++,G===1){let K=V$(Y,J);if(K){let q=M$(K.pattern);Z.push(...q),J=K.endPos,X="";continue}}}else if(Q==="}"||Q==="]")G--;if(G>0){J++;continue}if(Q===","){if(X.trim())Z.push(X.trim());X="",J++;continue}if(Q===":"){X="",J++;continue}if(Q==="="){if(X.trim())Z.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&G===0){if(Y[J]==="{"||Y[J]==="[")G++;else if(Y[J]==="}"||Y[J]==="]")G--;J++}continue}if(/[\w$]/.test(Q))X+=Q;J++}if(X.trim())Z.push(X.trim());return Z}function O$($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let _=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let j=Y.slice(_[0].length),B=V$(j,0);if(B){let W=_[1],z=B.pattern,U=j.slice(B.endPos).trim();if(U.startsWith("=")){let H=U.slice(1).trim(),O=H,F=Z;if(F$(H)){let V=A$($,Z,H);O=V.value,F=V.nextIndex}else F=Z+1;O=O.trim().replace(/;$/,"");let L=M$(z),A=`__stx_src_${Z}`,M=L.map((V)=>`module.exports.${V} = ${V};`).join(`
2447
+ `);return{type:W,name:A,value:`${O}; ${W} ${z} = ${A};
2448
+ ${M}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,G,X,Q]=J,K=Q,q=Z;if(F$(Q)){let _=A$($,Z,Q);K=_.value,q=_.nextIndex}else q=Z+1;return K=K.trim().replace(/;$/,""),{type:G,name:X,value:K,nextIndex:q}}function L$($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,G]=J,X=Y.replace(/^export\s+/,""),Q=Z;if(mY(Y)){let K=uY($,Z,X);X=K.functionCode,Q=K.nextIndex}else Q=Z+1;return{name:G,functionCode:X,nextIndex:Q}}function F$($){let Z=$.trim();if(Z.startsWith("{"))return U4(Z,"{","}",0)===-1;if(Z.startsWith("["))return U4(Z,"[","]",0)===-1;return!T$(Z)}function T$($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let G=0;G<$.length;G++){let X=$[G];if((G>0?$[G-1]:"")==="\\"&&Y)continue;if((X==='"'||X==="'")&&!Y){Y=X;continue}if(X===Y&&Y!=="`"){Y=null;continue}if(X==="`"&&!Y){Y="`";continue}if(X==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&X==="$"&&$[G+1]==="{"){J++,G++;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 mY($){let Z=$.indexOf("{");if(Z===-1)return!0;return U4($,"{","}",Z)===-1}function A$($,Z,Y){let J=Y,G=Z+1;while(G<$.length&&!T$(J)){let X=$[G];J+=`
2449
+ ${X}`,G++}return{value:J,nextIndex:G}}function uY($,Z,Y){let J=Y,G=Z+1;while(G<$.length){let X=J.indexOf("{");if(X!==-1){if(U4(J,"{","}",X)!==-1)break}let Q=$[G];J+=`
2450
+ ${Q}`,G++}return{functionCode:J,nextIndex:G}}async function pY($,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[,,Q,K]=X;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[Q]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Z[Q]=_()}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}}let G=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of G){let[,,Q,K]=X;if(!(Q in Z))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[Q]=_()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
2451
+ ${X}
2452
+ const result = {};
2453
+ ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
2454
+ `)}
2455
+ return result;
2456
+ `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Z))Z[q]=_})}catch{}}function I$($){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 w$($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var B5=()=>{};var b$={};o(b$,{renderSlot:()=>E$,processSlots:()=>S$,parseSlots:()=>D$,parseSlotElement:()=>lY,extractSlotContent:()=>sY,applySlots:()=>oY});function cY($,Z){let Y=1,J=Z;while(J<$.length&&Y>0){let G=$.slice(J).match(/^<template\b/);if(G){Y++,J+=G[0].length;continue}let X=$.slice(J).match(/^<\/template\s*>/);if(X){if(Y--,Y===0)return J+X[0].length;J+=X[0].length;continue}J++}return Y===0?J:-1}function D$($){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,G=[],X;while((X=J.exec($))!==null){let[Q,K,q,_,j]=X,B=K||q||_,W=X.index+Q.length,z=cY($,W);if(z!==-1){let U=$.slice(W,z-11).trim();G.push({start:X.index,end:z,slotName:B,content:U,propsBinding:j||void 0}),Z.named.set(B,{name:B,content:U,propsBinding:j||void 0})}}G.sort((Q,K)=>K.start-Q.start);for(let Q of G)Y=Y.slice(0,Q.start)+Y.slice(Q.end);return Z.default=Y.trim(),Z}function lY($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec($))!==null)J[X[1]]=X[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=Q?Q[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function E$($,Z,Y,J){if(!$)return Y;let G=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),Q={...J};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,j]=q.split(":").map((W)=>W.trim()),B=j||_;if(Z[_]!==void 0)Q[B]=Z[_]}}else Q[X]=Z;G=iY(G,Q)}return G}function iY($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let G=J.trim(),X=k$(G,Z);return String(X??"")}catch{return`{{ ${J} }}`}})}function k$($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),G=Z;for(let X of J)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,G,X]=Y,Q=Z[J],K=parseInt(X,10);if(typeof Q==="number")switch(G){case"+":return Q+K;case"-":return Q-K;case"*":return Q*K;case"/":return Q/K}}try{let J=Object.keys(Z),G=Object.values(Z);return Function(...J,`return ${$}`)(...G)}catch{return}}async function S$($,Z,Y){let J=$;J=await nY(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,K,q,_)=>{let j=Z.named.get(K),B=_?.trim()||"",W=q||"",z={},U=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=U.exec(W))!==null){let O=H[1],F=H[2];z[O]=k$(F,Y)}return await E$(j,z,B,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(Q,K)=>{if(Q.includes("name="))return Q;let q=K?.trim()||"";return Z.default||q}),J}async function nY($,Z,Y){let J=[],G=[];$.replace(Z,(K,...q)=>{let _=q[q.length-2];return G.push({match:K,index:_}),J.push(Y(K,...q.slice(0,-2))),K});let X=await Promise.all(J),Q=$;for(let K=G.length-1;K>=0;K--){let{match:q,index:_}=G[K];Q=Q.slice(0,_)+X[K]+Q.slice(_+q.length)}return Q}function sY($){let Z=D$($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function oY($,Z,Y,J){return await S$($,{default:Z,named:Y},J)}import rY from"fs";import i from"path";import C5 from"process";function aY($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function n4($){return!aY($)}function w4($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");return Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),new Bun.Transpiler({loader:"ts",target:"browser"}).transformSync(Z)}catch(Z){return console.warn("[STX] TypeScript transpilation error:",Z),$}}function tY($){let Z=[],Y=new Set,J=0,G=0,X=$.length,Q=(j)=>{G++;while(G<X){if($[G]==="\\"){G+=2;continue}if($[G]===j){G++;return}G++}},K=()=>{G++;while(G<X){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let j=1;while(G<X&&j>0)if($[G]==="{")j++;else if($[G]==="}")j--;else if($[G]==="'"||$[G]==='"')Q($[G]);else if($[G]==="`")K();else G++;continue}G++}},q=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<X&&$[G]!==`
2457
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<X-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},_=()=>{if(J!==0)return;let j=$.slice(G).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let U=j[2].split(",").map((H)=>{let O=H.trim().split(":");return O[O.length-1].trim()});for(let H of U)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let B=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let U=B[2];if(!Y.has(U))Z.push(U),Y.add(U);return}let W=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let U=W[1];if(!Y.has(U))Z.push(U),Y.add(U);return}let z=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let U=z[1];if(!Y.has(U))Z.push(U),Y.add(U)}};while(G<X){if(q())continue;if($[G]==="'"||$[G]==='"'){Q($[G]);continue}if($[G]==="`"){K();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))_();G++}return Z}async function s4($,Z,Y,J,G,X,Q,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (B5(),y5)),j=K??new Set;if(j.has($))return`[Circular component reference: ${$}]`;j.add($);try{let B=(g)=>g.split("-").map((y)=>y.charAt(0).toUpperCase()+y.slice(1)).join(""),W=(g)=>g.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=$.endsWith(".stx")?$.slice(0,-4):$,U=null,H=G.__importedComponents;if(H){let g=[z,z.toLowerCase(),B(z),W(z)];for(let y of g)if(H.has(y)){U=H.get(y);break}}let O=[];if(!U){let g=[`${z}.stx`,`${B(z)}.stx`,`${W(z)}.stx`],y=[...new Set(g)],m=[J,i.join(i.dirname(X),"components")].filter(Boolean);if(Q.componentsDir&&Q.componentsDir!==J)m.push(Q.componentsDir);let x=C5.cwd(),r=[i.resolve(x,"src/components"),i.resolve(x,"components")];for(let a of r)if(!m.includes(a))m.push(a);if(z.startsWith("./")||z.startsWith("../"))U=i.resolve(i.dirname(X),`${z}.stx`),O.push(U);else for(let a of m){if(!a)continue;for(let Y4 of y){let B4=i.join(a,Y4);if(O.push(B4),await p(B4)){U=B4;break}}if(U)break;if(!U)try{let Y4=await import("fs");if(!Y4.statSync(a,{throwIfNoEntry:!1})?.isDirectory())continue;let T7=Y4.readdirSync(a,{withFileTypes:!0});for(let I5 of T7)if(I5.isDirectory()){let I1=i.join(a,I5.name);for(let w1 of y){let I7=i.join(I1,w1);if(O.push(I7),await p(I7)){U=I7;break}}if(U)break}}catch{}if(U)break}}if(!U||!await p(U)){let g=O.length>0?`
2458
+ Searched paths:
2459
+ ${O.map((y)=>` - ${y}`).join(`
2460
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${g}`}q.add(U);let F;if(d7.has(U))F=d7.get(U);else try{F=await Bun.file(U).text(),d7.set(U,F)}catch(g){return`[Error loading component: ${g instanceof Error?g.message:String(g)}]`}let L={...G,...Z,props:Z,slot:Y},A=F,M=A.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)A=M[1].trim();let V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,R=[...F.matchAll(V)],N=[];for(let g of R){let y=g[1]||"",m=g[2]||"",x=y.includes("server"),r=y.includes("client")||y.includes('type="module"');if(n4(y)&&m.trim())m=w4(m);if(!r&&m)try{await _(m,L,U)}catch(Y4){}if(!x){let Y4=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),B4=y.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");N.push(`<script${B4}>${Y4}</script>`)}}let T=F.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=T?T[1]:"",E=T?T[2]:"",k="";if(T)k=`<style${D}>${E}</style>`;let I=A;if(I=I.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),T)I=I.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&I.includes("{{ text || slot }}"))I=I.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,Y);let{extractSlotContent:S,applySlots:d}=await Promise.resolve().then(() => b$),{defaultSlot:c,namedSlots:b}=S(Y);I=await d(I,c||Y,b,L);for(let[g,y]of Object.entries(L))if(typeof y==="string"){if(y.includes("<")&&y.includes(">")||y.includes("&lt;")||y.includes("&quot;")){let m=B$(y);L[g]=m}}let u=N.some((g)=>/\b(state|derived|effect)\s*\(/.test(g)),Q4={...Q,componentsDir:i.dirname(U),skipSignalsRuntime:!0,skipEventDirectives:u},s=await v5(I,L,U,Q4,q),e=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,K4=s;if(u){if(K4=`<div data-stx-scope="${e}">${s}</div>`,K4=N.map((y)=>{let m=y.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!m)return y;let[,x,r]=m,a=I4(r),Y4=`
2461
+ (function() {
2462
+ const { state, derived, effect, batch } = window.stx;
2463
+ const __scope = window.stx._scopes = window.stx._scopes || {};
2464
+ const __scopeVars = __scope['${e}'] = __scope['${e}'] || {};
2465
+
2466
+ // Scope-specific lifecycle callbacks
2467
+ __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
2468
+ __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
2469
+ const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
2470
+ const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
2471
+
2472
+ ${a}
2473
+
2474
+ // Register all defined signals and functions in this scope
2475
+ const __localVars = {};
2476
+ try {
2477
+ ${tY(a).map((B4)=>`if (typeof ${B4} !== 'undefined') __localVars['${B4}'] = ${B4};`).join(`
2478
+ `)}
2479
+ } catch(e) {}
2480
+ Object.assign(__scopeVars, __localVars);
2481
+ })();`;return`<script data-stx-scoped${x}>${Y4}</script>`}).join(`
2482
+ `)+`
2483
+ `+K4,k)K4+=`
2484
+ `+k}else{if(k)K4+=`
2485
+ `+k;if(N.length>0){let g=L.__stx_event_bindings||[],y=N.map((m)=>{let x=m.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!x)return m;return x5(x[1],{eventBindings:g})});K4+=`
2486
+ `+y.join(`
2487
+ `),L.__stx_event_bindings=[]}}return K4}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{j.delete($)}}async function p($){try{return(await rY.promises.stat($)).isFile()}catch{return!1}}async function m7($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let G=i.dirname(Z);if($.startsWith("/")){let _=i.join(C5.cwd(),$);if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await p(_)&&J)J.add(_);return _}let X=i.join(G,$);if(await p(X)){if(Y.debug)console.log(`Found direct path: ${X}`);if(J)J.add(X);return X}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let j=`${X}${_}`;if(await p(j)){if(Y.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let Q=i.join(G,"layouts");if(await p(Q)){let _=i.join(Q,$);if(await p(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let _=i.isAbsolute(Y.layoutsDir)?Y.layoutsDir:i.resolve(C5.cwd(),Y.layoutsDir),j=i.join(_,$);if(await p(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${B}`);if(J)J.add(B);return B}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),j=i.join(Y.partialsDir||G,"layouts",_[1]);if(await p(j)){if(Y.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(Q=i.join(Y.partialsDir,"layouts"),await p(Q)){let _=i.join(Q,$);if(await p(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=Y.partialsDir||i.join(C5.cwd(),"views"),q=i.join(K,$);if(await p(q)){if(Y.debug)console.log(`Found in views path: ${q}`);if(J)J.add(q);return q}if(!$.endsWith(".stx")){let _=`${q}.stx`;if(await p(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(G.includes("temp")){let _=i.join(i.dirname(G),"layouts",$);if(await p(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function P$($,Z,Y){let J=0,G="",X="";try{if(typeof Z==="number"&&Z>=0){let Q=$.split(`
2488
+ `),K=0;for(let q=0;q<Q.length;q++)if(K+=Q[q].length+1,K>=Z){J=q+1,G=Q[q].trim();let _=Math.max(0,q-2),j=Math.min(Q.length,q+3);X=Q.slice(_,j).map((B,W)=>{let z=_+W+1;return`${z===J?"> ":" "}${z}: ${B}`}).join(`
2489
+ `);break}}else if(Y){let Q=$.indexOf(Y);if(Q>=0)return P$($,Q)}}catch{}return{lineNumber:J,lineContent:G,context:X}}function l($,Z,Y,J,G,X){let{lineNumber:Q,context:K}=P$(J,G,X),q=Y.split("/").pop(),_=`
2490
+ ${v.bold}${v.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${v.reset}
2491
+ `;if(_+=`${v.bold}${v.red}\u2502${v.reset} ${v.bold}${v.bgRed} ERROR ${v.reset} ${v.red}${$} Error${v.reset}${" ".repeat(Math.max(0,43-$.length))}${v.bold}${v.red}\u2502${v.reset}
2492
+ `,_+=`${v.bold}${v.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${v.reset}
2493
+ `,_+=`
2494
+ ${v.cyan}${v.bold}File:${v.reset} ${v.dim}${q}${v.reset}`,Q>0)_+=` ${v.gray}(line ${Q})${v.reset}`;if(_+=`
2495
+ ${v.yellow}${v.bold}Message:${v.reset} ${Z}
2496
+ `,K)_+=`
2497
+ ${v.blue}${v.bold}Context:${v.reset}
2498
+ ${v.dim}${K}${v.reset}
2499
+ `;return _}var d7,v;var F4=w(()=>{u7();l4();q5();i4();p7();H$();B5();d7=new _5(500);v={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});function Y9($){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(!Z9.has(J[1]))Z.add(J[1]);return Array.from(Z)}function J9($){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 G=new Set,X=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|stx)['"]\s*;?\s*$/gm,Q;while((Q=X.exec($))!==null){let q=Q[1],_=Q[2];if(Q[0].includes("import type"))continue;q.split(",").map((B)=>B.trim().split(/\s+as\s+/)[0]).filter((B)=>B.length>0).forEach((B)=>{if(G.add(B),_==="stx")Z.add(B);else Y.add(B)}),J=J.replace(Q[0],"// [auto-import processed]")}for(let q of eY){if(G.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(J))Z.add(q)}for(let q of $9){if(G.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Y.add(q)}let K=Y9(J);for(let q of K)if(!G.has(q))Y.add(q);return{code:J,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function X9($,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
2383
2500
  ${Y.join(`
2384
2501
  `)}
2385
- `;return""}function CY($){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=yY[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function vY($,Z){let{elementId:Y,event:J,handler:G,modifiers:X}=$,Q=CY(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(Q)_+=`${Q}; `;if(X.debounce!==null)return` ;(function() {
2502
+ `;return""}function Q9($){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=G9[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function K9($,Z){let{elementId:Y,event:J,handler:G,modifiers:X}=$,Q=Q9(X),K=[];if(X.once)K.push("once: true");if(X.capture)K.push("capture: true");if(X.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",_="";if(Q)_+=`${Q}; `;if(X.debounce!==null)return` ;(function() {
2386
2503
  var $el = document.getElementById('${Y}')
2387
2504
  if (!$el) return
2388
2505
  var __timer
@@ -2404,18 +2521,24 @@ ${Y.join(`
2404
2521
  })()`;return` var $el = document.getElementById('${Y}')
2405
2522
  if ($el) $el.addEventListener('${J}', function($event) {
2406
2523
  ${_}${G}
2407
- }${q})`}function xY($){if($.length===0)return"";return`
2524
+ }${q})`}function q9($){if($.length===0)return"";return`
2408
2525
  // STX: auto-generated event bindings
2409
- ${$.map((Y,J)=>vY(Y,J)).join(`
2410
- `)}`}function P5($,Z={}){let Y=$,J="";if(Z.autoImports!==!1){let K=bY(Y);Y=K.code,J=PY(K.stxImports,K.browserImports)}Y=w4(Y);let G=xY(Z.eventBindings||[]),X=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(X)){let K=X.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${K?` ${K}`:""}`}>
2526
+ ${$.map((Y,J)=>K9(Y,J)).join(`
2527
+ `)}`}function _9($){let Z=[],Y=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),G=/^[ \t]*(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*=/gm,X;while(X=G.exec(J))if(!X[1].startsWith("_")&&!Y.has(X[1]))Z.push(X[1]),Y.add(X[1]);let Q=/^[ \t]*(?:const|let|var)\s+\{([^}]+)\}\s*=/gm;while(X=Q.exec(J))X[1].split(",").forEach((q)=>{let _=q.trim().split(/[\s:]/)[0].trim();if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)});let K=/^[ \t]*(?:async\s+)?function\s+([a-zA-Z_$]\w*)/gm;while(X=K.exec(J))if(!X[1].startsWith("_")&&!Y.has(X[1]))Z.push(X[1]),Y.add(X[1]);return Z}function x5($,Z={}){let Y=$,J="";if(Z.autoImports!==!1){let _=J9(Y);Y=_.code,J=X9(_.stxImports,_.browserImports)}Y=I4(Y),Y=w4(Y);let G=q9(Z.eventBindings||[]),X=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(X)){let _=X.replace(/\btype\s*=\s*["']module["']/i,"").trim();return`<script ${`type="module" data-stx-scoped${_?` ${_}`:""}`}>
2411
2528
  ${J}${Y}
2412
2529
  ${G}
2413
- </script>`}return`<script data-stx-scoped>
2530
+ </script>`}let K=/\b(state|derived|effect)\s*\(/.test($),q=/function __stx_setup_/.test(Y);if(K&&!q){let _=_9($),j=_.length>0?`
2531
+ return { ${_.join(", ")} };`:"";return`<script data-stx-scoped>
2532
+ window.stx.mount(function() {
2533
+ 'use strict';
2534
+ ${J}${Y}
2535
+ ${G}${j}
2536
+ })</script>`}return`<script data-stx-scoped>
2414
2537
  ;(function() {
2415
2538
  'use strict';
2416
2539
  ${J}${Y}
2417
2540
  ${G}
2418
- })()</script>`}var EY,kY,yY;var P7=I(()=>{q5();EY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","action","createSelector","h","Fragment"],kY=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","auth","useAuth","initApi","formatAreaSize","formatDistance","formatElevation","formatDuration","getRelativeTime","fetchData"];yY={left:0,middle:1,right:2}});function G$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Q$($,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 fY($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[G,X,Q]=J,K=J.index,q=Q$(Q,"x-data");if(!q)continue;let _=`__stx_scope_${_$++}`,j=Q$(Q,"x-init"),B=gY($,X,K+G.length),U=$.slice(K,B.endIndex),z=hY(U,K),W=dY(U);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:j,bindings:z,refs:W})}return Z}function gY($,Z,Y){let J=1,G=Y,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),Q=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&G<$.length){X.lastIndex=G,Q.lastIndex=G,K.lastIndex=G;let q=X.exec($),_=Q.exec($),j=K.exec($);if(j&&j.index<(q?.index??1/0)){G=j.index+j[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)J++,G=q.index+q[0].length;else{if(J--,J===0)return{endIndex:_.index+_[0].length};G=_.index+_[0].length}}return{endIndex:$.length}}function hY($,Z){let Y=[];function J(K,q){let _=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*"([^"]*)"[^>]*)>`,"gi"),j;while((j=_.exec($))!==null){let[,U,z,W]=j,H=_5(z),O=q==="model"?K$(z,U):void 0,F=q==="show"||q==="hide"?q$(z):void 0;Y.push({elementId:H,type:q,expression:W,inputType:O,transition:F})}let B=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*'([^']*)'[^>]*)>`,"gi");while((j=B.exec($))!==null){let[,U,z,W]=j,H=_5(z),O=q==="model"?K$(z,U):void 0,F=q==="show"||q==="hide"?q$(z):void 0;Y.push({elementId:H,type:q,expression:W,inputType:O,transition:F})}}J("x-model","model"),J("x-show","show"),J("x-hide","hide"),J("x-text","text"),J("x-html","html");let G=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*"([^"]*)"[^>]*)>/gi,X;while((X=G.exec($))!==null){let[,K,q,_]=X,j=_5(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}let Q=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*'([^']*)'[^>]*)>/gi;while((X=Q.exec($))!==null){let[,K,q,_]=X,j=_5(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}return Y}function dY($){let Z=new Map,Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec($))!==null){let[,G,X]=J,Q=_5(G);Z.set(X,Q)}return Z}function _5($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${y5++}`}function K$($,Z){if(Z.toLowerCase()==="select")return"select";if(Z.toLowerCase()==="textarea")return"textarea";let Y=$.match(/\btype\s*=\s*["']([^"']*)["']/);return Y?Y[1].toLowerCase():"text"}function q$($){if(/\bx-transition(?:\s|>|$|=)/.test($)){let Z={enabled:!0};if(/\bx-transition(?:\s|>|$)/.test($)&&!/\bx-transition\s*=/.test($))return Z;let J=$.match(/x-transition:enter\s*=\s*["']([^"']*)["']/);if(J)Z.enter=J[1];let G=$.match(/x-transition:enter-start\s*=\s*["']([^"']*)["']/);if(G)Z.enterStart=G[1];let X=$.match(/x-transition:enter-end\s*=\s*["']([^"']*)["']/);if(X)Z.enterEnd=X[1];let Q=$.match(/x-transition:leave\s*=\s*["']([^"']*)["']/);if(Q)Z.leave=Q[1];let K=$.match(/x-transition:leave-start\s*=\s*["']([^"']*)["']/);if(K)Z.leaveStart=K[1];let q=$.match(/x-transition:leave-end\s*=\s*["']([^"']*)["']/);if(q)Z.leaveEnd=q[1];let _=$.match(/x-transition\.duration\.(\d+)(?:ms)?/);if(_)Z.duration=parseInt(_[1],10);return Z}return}function mY(){return`
2541
+ })()</script>`}var eY,$9,Z9,G9;var u7=w(()=>{q5();F4();eY=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","useSearchParams","useQuery","useMutation","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","action","createSelector","h","Fragment"],$9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],Z9=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"]);G9={left:0,middle:1,right:2}});function y$($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function C$($,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 j9($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Y.exec($))!==null){let[G,X,Q]=J,K=J.index,q=C$(Q,"x-data");if(!q)continue;let _=`__stx_scope_${f$++}`,j=C$(Q,"x-init"),B=B9($,X,K+G.length),W=$.slice(K,B.endIndex),z=W9(W,K),U=U9(W);Z.push({id:_,selector:`[data-stx-scope="${_}"]`,stateExpr:q,initExpr:j,bindings:z,refs:U})}return Z}function B9($,Z,Y){let J=1,G=Y,X=new RegExp(`<${Z}(?:\\s|>)`,"gi"),Q=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(J>0&&G<$.length){X.lastIndex=G,Q.lastIndex=G,K.lastIndex=G;let q=X.exec($),_=Q.exec($),j=K.exec($);if(j&&j.index<(q?.index??1/0)){G=j.index+j[0].length;continue}if(!_)return{endIndex:$.length};if(q&&q.index<_.index)J++,G=q.index+q[0].length;else{if(J--,J===0)return{endIndex:_.index+_[0].length};G=_.index+_[0].length}}return{endIndex:$.length}}function W9($,Z){let Y=[];function J(K,q){let _=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*"([^"]*)"[^>]*)>`,"gi"),j;while((j=_.exec($))!==null){let[,W,z,U]=j,H=W5(z),O=q==="model"?x$(z,W):void 0,F=q==="show"||q==="hide"?v$(z):void 0;Y.push({elementId:H,type:q,expression:U,inputType:O,transition:F})}let B=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${K}\\s*=\\s*'([^']*)'[^>]*)>`,"gi");while((j=B.exec($))!==null){let[,W,z,U]=j,H=W5(z),O=q==="model"?x$(z,W):void 0,F=q==="show"||q==="hide"?v$(z):void 0;Y.push({elementId:H,type:q,expression:U,inputType:O,transition:F})}}J("x-model","model"),J("x-show","show"),J("x-hide","hide"),J("x-text","text"),J("x-html","html");let G=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*"([^"]*)"[^>]*)>/gi,X;while((X=G.exec($))!==null){let[,K,q,_]=X,j=W5(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}let Q=/<[a-z][a-z0-9-]*\s+([^>]*(?:x-bind:|:)([a-z][a-z0-9-]*)\s*=\s*'([^']*)'[^>]*)>/gi;while((X=Q.exec($))!==null){let[,K,q,_]=X,j=W5(K);Y.push({elementId:j,type:q==="class"?"class":q==="style"?"style":"bind",expression:_,attribute:q})}return Y}function U9($){let Z=new Map,Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec($))!==null){let[,G,X]=J,Q=W5(G);Z.set(X,Q)}return Z}function W5($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${f5++}`}function x$($,Z){if(Z.toLowerCase()==="select")return"select";if(Z.toLowerCase()==="textarea")return"textarea";let Y=$.match(/\btype\s*=\s*["']([^"']*)["']/);return Y?Y[1].toLowerCase():"text"}function v$($){if(/\bx-transition(?:\s|>|$|=)/.test($)){let Z={enabled:!0};if(/\bx-transition(?:\s|>|$)/.test($)&&!/\bx-transition\s*=/.test($))return Z;let J=$.match(/x-transition:enter\s*=\s*["']([^"']*)["']/);if(J)Z.enter=J[1];let G=$.match(/x-transition:enter-start\s*=\s*["']([^"']*)["']/);if(G)Z.enterStart=G[1];let X=$.match(/x-transition:enter-end\s*=\s*["']([^"']*)["']/);if(X)Z.enterEnd=X[1];let Q=$.match(/x-transition:leave\s*=\s*["']([^"']*)["']/);if(Q)Z.leave=Q[1];let K=$.match(/x-transition:leave-start\s*=\s*["']([^"']*)["']/);if(K)Z.leaveStart=K[1];let q=$.match(/x-transition:leave-end\s*=\s*["']([^"']*)["']/);if(q)Z.leaveEnd=q[1];let _=$.match(/x-transition\.duration\.(\d+)(?:ms)?/);if(_)Z.duration=parseInt(_[1],10);return Z}return}function z9(){return`
2419
2542
  // STX Reactive Runtime - x-cloak and transition CSS
2420
2543
  (function() {
2421
2544
  var style = document.createElement('style');
@@ -2774,7 +2897,7 @@ window.__stx_reactive = (function() {
2774
2897
 
2775
2898
  return { initScope, evaluate, execute, reactive, transitionIn, transitionOut };
2776
2899
  })();
2777
- `}function uY($){if($.length===0)return"";let Z=$.map((Y)=>{let J=JSON.stringify(Y.bindings.map((X)=>({elementId:X.elementId,type:X.type,expression:X.expression,attribute:X.attribute,inputType:X.inputType,transition:X.transition}))),G=JSON.stringify(Object.fromEntries(Y.refs));return`
2900
+ `}function H9($){if($.length===0)return"";let Z=$.map((Y)=>{let J=JSON.stringify(Y.bindings.map((X)=>({elementId:X.elementId,type:X.type,expression:X.expression,attribute:X.attribute,inputType:X.inputType,transition:X.transition}))),G=JSON.stringify(Object.fromEntries(Y.refs));return`
2778
2901
  (function() {
2779
2902
  var scopeEl = document.querySelector('${Y.selector}');
2780
2903
  if (!scopeEl) return;
@@ -2784,17 +2907,18 @@ window.__stx_reactive = (function() {
2784
2907
  })();`}).join(`
2785
2908
  `);return`
2786
2909
  <script data-stx-reactive>
2787
- ${mY()}
2910
+ ${z9()}
2788
2911
 
2789
2912
  // Initialize all reactive scopes
2790
2913
  document.addEventListener('DOMContentLoaded', function() {
2791
2914
  ${Z}
2792
2915
  });
2793
- </script>`}function P4($,Z){let Y=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${Z.source}[^>]*)>`,"gi");return $.replace(Y,(J,G,X)=>{if(/\bid\s*=\s*["']/.test(X))return J;let Q=`__stx_el_${y5++}`;return`<${G} id="${Q}" ${X}>`})}function pY($){let Z=$,Y=[/\s*x-data\s*=\s*"[^"]*"/g,/\s*x-init\s*=\s*"[^"]*"/g,/\s*x-model\s*=\s*"[^"]*"/g,/\s*x-show\s*=\s*"[^"]*"/g,/\s*x-hide\s*=\s*"[^"]*"/g,/\s*x-text\s*=\s*"[^"]*"/g,/\s*x-html\s*=\s*"[^"]*"/g,/\s*x-ref\s*=\s*"[^"]*"/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*:[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*x-transition:enter\s*=\s*"[^"]*"/g,/\s*x-transition:enter-start\s*=\s*"[^"]*"/g,/\s*x-transition:enter-end\s*=\s*"[^"]*"/g,/\s*x-transition:leave\s*=\s*"[^"]*"/g,/\s*x-transition:leave-start\s*=\s*"[^"]*"/g,/\s*x-transition:leave-end\s*=\s*"[^"]*"/g,/\s*x-transition\s*=\s*"[^"]*"/g,/\s*x-data\s*=\s*'[^']*'/g,/\s*x-init\s*=\s*'[^']*'/g,/\s*x-model\s*=\s*'[^']*'/g,/\s*x-show\s*=\s*'[^']*'/g,/\s*x-hide\s*=\s*'[^']*'/g,/\s*x-text\s*=\s*'[^']*'/g,/\s*x-html\s*=\s*'[^']*'/g,/\s*x-ref\s*=\s*'[^']*'/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*:[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*x-transition:enter\s*=\s*'[^']*'/g,/\s*x-transition:enter-start\s*=\s*'[^']*'/g,/\s*x-transition:enter-end\s*=\s*'[^']*'/g,/\s*x-transition:leave\s*=\s*'[^']*'/g,/\s*x-transition:leave-start\s*=\s*'[^']*'/g,/\s*x-transition:leave-end\s*=\s*'[^']*'/g,/\s*x-transition\s*=\s*'[^']*'/g,/\s*x-transition\.duration\.\d+(?:ms)?/g,/\s*x-transition(?=[\s>\/])/g];for(let J of Y)Z=Z.replace(J,"");return Z}function j$($,Z,Y){if(_$=0,y5=0,!iY($))return $;let J=cY($),G=fY(J);if(G.length===0)return $;J=lY(J,G);let X=uY(G);if(J.includes("</body>"))J=J.replace("</body>",`${X}
2794
- </body>`);else J+=X;return J}function cY($){let Z=$;return y5=0,Z=P4(Z,/x-model\s*=\s*["']/),Z=P4(Z,/x-show\s*=\s*["']/),Z=P4(Z,/x-hide\s*=\s*["']/),Z=P4(Z,/x-text\s*=\s*["']/),Z=P4(Z,/x-html\s*=\s*["']/),Z=P4(Z,/(?:x-bind:|:)[a-z]/),Z=P4(Z,/x-ref\s*=\s*["']/),Z}function lY($,Z){let Y=$;for(let J of Z)Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${G$(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*'${G$(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`);return Y=pY(Y),Y}function iY($){return/x-data\s*=\s*["']/.test($)}var _$=0,y5=0;class y7{options;cache=new Map;isNavigating=!1;currentUrl;constructor($={}){this.options={container:$.container??"main",linkSelector:$.linkSelector??"a[href]",loadingClass:$.loadingClass??"stx-navigating",viewTransitions:$.viewTransitions??!0,cache:$.cache??!0,scrollToTop:$.scrollToTop??!0,onBeforeNavigate:$.onBeforeNavigate??(()=>!0),onAfterNavigate:$.onAfterNavigate??(()=>{}),onError:$.onError??((Z)=>console.error("[STX Router]",Z))},this.currentUrl=window.location.href}init(){if(document.addEventListener("click",this.handleClick.bind(this)),window.addEventListener("popstate",this.handlePopState.bind(this)),this.options.cache)this.cacheCurrentPage()}async navigate($,Z=!0){if(this.isNavigating)return;let Y=new URL($,window.location.origin);if(Y.href===this.currentUrl)return;if(Y.origin!==window.location.origin){window.location.href=$;return}if(this.options.onBeforeNavigate($)===!1)return;this.isNavigating=!0,document.body.classList.add(this.options.loadingClass);try{let J=await this.fetchPage(Y.href);if(J){if(await this.swapContent(J),Z)window.history.pushState({url:Y.href},"",Y.href);if(this.currentUrl=Y.href,this.options.scrollToTop)window.scrollTo({top:0,behavior:"instant"});this.options.onAfterNavigate(Y.href)}}catch(J){this.options.onError(J,$),window.location.href=$}finally{this.isNavigating=!1,document.body.classList.remove(this.options.loadingClass)}}async prefetch($){let Z=new URL($,window.location.origin);if(Z.origin!==window.location.origin)return;if(this.cache.has(Z.href))return;try{await this.fetchPage(Z.href)}catch{}}clearCache(){this.cache.clear()}handleClick($){let Z=$.target.closest(this.options.linkSelector);if(!Z)return;if($.metaKey||$.ctrlKey||$.shiftKey||$.altKey)return;if($.button!==0)return;if(Z.target&&Z.target!=="_self")return;if(Z.hasAttribute("download"))return;let Y=Z.getAttribute("href");if(!Y||Y.startsWith("#")||Y.startsWith("mailto:")||Y.startsWith("tel:"))return;if(Z.hasAttribute("data-stx-no-router"))return;if(new URL(Y,window.location.origin).origin!==window.location.origin)return;$.preventDefault(),this.navigate(Y)}handlePopState($){let Z=$.state?.url||window.location.href;this.navigate(Z,!1)}async fetchPage($){if(this.options.cache&&this.cache.has($)){let K=this.cache.get($);if(Date.now()-K.timestamp<300000)return{html:K.html,title:K.title};this.cache.delete($)}let Z=await fetch($,{headers:{"X-STX-Router":"true",Accept:"text/html"}});if(!Z.ok)throw Error(`Failed to fetch ${$}: ${Z.status}`);let Y=await Z.text(),G=new DOMParser().parseFromString(Y,"text/html"),X=G.querySelector(this.options.container);if(!X)throw Error(`Container "${this.options.container}" not found in response`);let Q={html:X.innerHTML,title:G.title};if(this.options.cache)this.cache.set($,{...Q,timestamp:Date.now()});return Q}async swapContent($){let Z=document.querySelector(this.options.container);if(!Z)throw Error(`Container "${this.options.container}" not found`);let Y=()=>{Z.innerHTML=$.html,document.title=$.title,Z.querySelectorAll("script").forEach((G)=>{let X=document.createElement("script");Array.from(G.attributes).forEach((Q)=>{X.setAttribute(Q.name,Q.value)}),X.textContent=G.textContent,G.parentNode?.replaceChild(X,G)}),window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url:this.currentUrl}}))};if(this.options.viewTransitions&&"startViewTransition"in document)await document.startViewTransition(Y).finished;else Y()}cacheCurrentPage(){let $=document.querySelector(this.options.container);if($)this.cache.set(this.currentUrl,{html:$.innerHTML,title:document.title,timestamp:Date.now()})}}function nY($){if(u4)return u4;return u4=new y7($),u4.init(),u4}function sY(){return u4}var u4=null;var B$=I(()=>{if(typeof window<"u")window.STXRouter={init:nY,get:sY,Router:y7}});function U$(){return`
2916
+ </script>`}function y4($,Z){let Y=new RegExp(`<([a-z][a-z0-9-]*)\\s+([^>]*${Z.source}[^>]*)>`,"gi");return $.replace(Y,(J,G,X)=>{if(/\bid\s*=\s*["']/.test(X))return J;let Q=`__stx_el_${f5++}`;return`<${G} id="${Q}" ${X}>`})}function O9($){let Z=$,Y=[/\s*x-data\s*=\s*"[^"]*"/g,/\s*x-init\s*=\s*"[^"]*"/g,/\s*x-model\s*=\s*"[^"]*"/g,/\s*x-show\s*=\s*"[^"]*"/g,/\s*x-hide\s*=\s*"[^"]*"/g,/\s*x-text\s*=\s*"[^"]*"/g,/\s*x-html\s*=\s*"[^"]*"/g,/\s*x-ref\s*=\s*"[^"]*"/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*:(?!click|dblclick|submit|input|change|keydown|keyup|keypress|focus|blur|mousedown|mouseup|mousemove|mouseenter|mouseleave|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove|if|for|show|model|class|text|html|ref|style)[a-z][a-z0-9-]*\s*=\s*"[^"]*"/g,/\s*x-transition:enter\s*=\s*"[^"]*"/g,/\s*x-transition:enter-start\s*=\s*"[^"]*"/g,/\s*x-transition:enter-end\s*=\s*"[^"]*"/g,/\s*x-transition:leave\s*=\s*"[^"]*"/g,/\s*x-transition:leave-start\s*=\s*"[^"]*"/g,/\s*x-transition:leave-end\s*=\s*"[^"]*"/g,/\s*x-transition\s*=\s*"[^"]*"/g,/\s*x-data\s*=\s*'[^']*'/g,/\s*x-init\s*=\s*'[^']*'/g,/\s*x-model\s*=\s*'[^']*'/g,/\s*x-show\s*=\s*'[^']*'/g,/\s*x-hide\s*=\s*'[^']*'/g,/\s*x-text\s*=\s*'[^']*'/g,/\s*x-html\s*=\s*'[^']*'/g,/\s*x-ref\s*=\s*'[^']*'/g,/\s*x-bind:[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*:(?!click|dblclick|submit|input|change|keydown|keyup|keypress|focus|blur|mousedown|mouseup|mousemove|mouseenter|mouseleave|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove|if|for|show|model|class|text|html|ref|style)[a-z][a-z0-9-]*\s*=\s*'[^']*'/g,/\s*x-transition:enter\s*=\s*'[^']*'/g,/\s*x-transition:enter-start\s*=\s*'[^']*'/g,/\s*x-transition:enter-end\s*=\s*'[^']*'/g,/\s*x-transition:leave\s*=\s*'[^']*'/g,/\s*x-transition:leave-start\s*=\s*'[^']*'/g,/\s*x-transition:leave-end\s*=\s*'[^']*'/g,/\s*x-transition\s*=\s*'[^']*'/g,/\s*x-transition\.duration\.\d+(?:ms)?/g,/\s*x-transition(?=[\s>\/])/g];for(let J of Y)Z=Z.replace(J,"");return Z}function g$($,Z,Y){if(f$=0,f5=0,!A9($))return $;let J=L9($),G=j9(J);if(G.length===0)return $;J=F9(J,G);let X=H9(G);if(J.includes("</body>"))J=J.replace("</body>",`${X}
2917
+ </body>`);else J+=X;return J}function L9($){let Z=$;return f5=0,Z=y4(Z,/x-model\s*=\s*["']/),Z=y4(Z,/x-show\s*=\s*["']/),Z=y4(Z,/x-hide\s*=\s*["']/),Z=y4(Z,/x-text\s*=\s*["']/),Z=y4(Z,/x-html\s*=\s*["']/),Z=y4(Z,/(?:x-bind:|:)[a-z]/),Z=y4(Z,/x-ref\s*=\s*["']/),Z}function F9($,Z){let Y=$;for(let J of Z)Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${y$(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*'${y$(J.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${J.id}" $2$3$4`);return Y=O9(Y),Y}function A9($){return/x-data\s*=\s*["']/.test($)}var f$=0,f5=0;class c7{options;cache=new Map;isNavigating=!1;currentUrl;constructor($={}){this.options={container:$.container??"main",linkSelector:$.linkSelector??"a[href]",loadingClass:$.loadingClass??"stx-navigating",viewTransitions:$.viewTransitions??!0,cache:$.cache??!0,scrollToTop:$.scrollToTop??!0,onBeforeNavigate:$.onBeforeNavigate??(()=>!0),onAfterNavigate:$.onAfterNavigate??(()=>{}),onError:$.onError??((Z)=>console.error("[STX Router]",Z))},this.currentUrl=window.location.href}init(){if(document.addEventListener("click",this.handleClick.bind(this)),window.addEventListener("popstate",this.handlePopState.bind(this)),this.options.cache)this.cacheCurrentPage()}async navigate($,Z=!0){if(this.isNavigating)return;let Y=new URL($,window.location.origin);if(Y.href===this.currentUrl)return;if(Y.origin!==window.location.origin){window.location.href=$;return}if(this.options.onBeforeNavigate($)===!1)return;this.isNavigating=!0,document.body.classList.add(this.options.loadingClass);try{let J=await this.fetchPage(Y.href);if(J){if(await this.swapContent(J),Z)window.history.pushState({url:Y.href},"",Y.href);if(this.currentUrl=Y.href,this.options.scrollToTop)window.scrollTo({top:0,behavior:"instant"});this.options.onAfterNavigate(Y.href)}}catch(J){this.options.onError(J,$),window.location.href=$}finally{this.isNavigating=!1,document.body.classList.remove(this.options.loadingClass)}}async prefetch($){let Z=new URL($,window.location.origin);if(Z.origin!==window.location.origin)return;if(this.cache.has(Z.href))return;try{await this.fetchPage(Z.href)}catch{}}clearCache(){this.cache.clear()}handleClick($){let Z=$.target.closest(this.options.linkSelector);if(!Z)return;if($.metaKey||$.ctrlKey||$.shiftKey||$.altKey)return;if($.button!==0)return;if(Z.target&&Z.target!=="_self")return;if(Z.hasAttribute("download"))return;let Y=Z.getAttribute("href");if(!Y||Y.startsWith("#")||Y.startsWith("mailto:")||Y.startsWith("tel:"))return;if(Z.hasAttribute("data-stx-no-router"))return;if(new URL(Y,window.location.origin).origin!==window.location.origin)return;$.preventDefault(),this.navigate(Y)}handlePopState($){let Z=$.state?.url||window.location.href;this.navigate(Z,!1)}async fetchPage($){if(this.options.cache&&this.cache.has($)){let K=this.cache.get($);if(Date.now()-K.timestamp<300000)return{html:K.html,title:K.title};this.cache.delete($)}let Z=await fetch($,{headers:{"X-STX-Router":"true",Accept:"text/html"}});if(!Z.ok)throw Error(`Failed to fetch ${$}: ${Z.status}`);let Y=await Z.text(),G=new DOMParser().parseFromString(Y,"text/html"),X=G.querySelector(this.options.container);if(!X)throw Error(`Container "${this.options.container}" not found in response`);let Q={html:X.innerHTML,title:G.title};if(this.options.cache)this.cache.set($,{...Q,timestamp:Date.now()});return Q}async swapContent($){let Z=document.querySelector(this.options.container);if(!Z)throw Error(`Container "${this.options.container}" not found`);let Y=()=>{Z.innerHTML=$.html,document.title=$.title,Z.querySelectorAll("script").forEach((G)=>{let X=document.createElement("script");Array.from(G.attributes).forEach((Q)=>{X.setAttribute(Q.name,Q.value)}),X.textContent=G.textContent,G.parentNode?.replaceChild(X,G)}),window.dispatchEvent(new CustomEvent("stx:navigate",{detail:{url:this.currentUrl}}))};if(this.options.viewTransitions&&"startViewTransition"in document)await document.startViewTransition(Y).finished;else Y()}cacheCurrentPage(){let $=document.querySelector(this.options.container);if($)this.cache.set(this.currentUrl,{html:$.innerHTML,title:document.title,timestamp:Date.now()})}}function R9($){if(o4)return o4;return o4=new c7($),o4.init(),o4}function N9(){return o4}var o4=null;var h$=w(()=>{if(typeof window<"u")window.STXRouter={init:R9,get:N9,Router:c7}});function d$(){return`
2795
2918
  ;(function(){
2796
2919
  'use strict';
2797
- var o={container:'main',linkSelector:'a[href]',loadingClass:'stx-navigating',viewTransitions:!0,cache:!0,scrollToTop:!0,prefetch:!0};
2920
+ var d={container:'main',linkSelector:'a[href]',loadingClass:'stx-navigating',viewTransitions:!0,cache:!0,scrollToTop:!0,prefetch:!0};
2921
+ var o=Object.assign({},d,window.STX_ROUTER_OPTIONS||{});
2798
2922
  var c=new Map(),p=new Set(),n=!1,u=location.href;
2799
2923
  function init(){
2800
2924
  document.addEventListener('click',handleClick,!0);
@@ -2871,9 +2995,9 @@ ${Z}
2871
2995
  window.stxRouter={navigate:navigate,clearCache:function(){c.clear()}};
2872
2996
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
2873
2997
  })();
2874
- `}var W$=I(()=>{B$();C7()});async function oY($,Z,Y,J){let G=Z[0]?.replace(/['"]/g,"")||"main",X=U$();if(G!=="main")X=X.replace("container:'main'",`container:'${G}'`);return`<script>${X}</script>`}var z$;var C7=I(()=>{W$();z$={name:"stxRouter",handler:oY,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function H$($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],G=$.slice(Y[0].length),X={};for(let Q of J.split(`
2875
- `)){let K=Q.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),j=K.slice(q+1).trim();if(typeof j==="string"){if(j.startsWith('"')&&j.endsWith('"')||j.startsWith("'")&&j.endsWith("'"))j=j.slice(1,-1);else if(j.startsWith("[")&&j.endsWith("]"))try{j=JSON.parse(j)}catch{}else if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^-?\d+(?:\.\d+)?$/.test(j))j=Number(j)}X[_]=j}return{data:X,content:G.trim()}}function j5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,G=$,X=[];if(G=G.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,W)=>{let H=X.length,O=z?` class="language-${z}"`:"";return X.push(`<pre><code${O}>${W.trim()}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),G=G.replace(/`([^`]+)`/g,"<code>$1</code>"),G=G.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),G=G.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),G=G.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),G=G.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),G=G.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),G=G.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),G=G.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),G=G.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),G=G.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),G=G.replace(/__(.+?)__/g,"<strong>$1</strong>"),G=G.replace(/\*(.+?)\*/g,"<em>$1</em>"),G=G.replace(/_(.+?)_/g,"<em>$1</em>"),Y)G=G.replace(/~~(.+?)~~/g,"<del>$1</del>");G=G.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" />'),G=G.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),G=G.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),G=G.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),G=G.replace(/<\/blockquote>\n<blockquote>/g,`
2876
- `),G=G.replace(/^[*\-+]\s+(.*)$/gm,"<li>$1</li>"),G=G.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),G=G.replace(/<\/ul>\n<ul>/g,""),G=G.replace(/^\d+\.\s+(.*)$/gm,"<li>$1</li>");let Q=/(<li>.*<\/li>\n?)+/g,K=G.match(Q);if(K){for(let U of K)if(!G.includes(`<ul>${U}</ul>`)){let z=`<ol>${U}</ol>`;G=G.replace(U,z)}}if(Y)G=G.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,W)=>{let O=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${L}</th>`).join("")}</tr>`,F=W.trim().split(`
2998
+ `}var m$=w(()=>{h$();l7()});async function V9($,Z,Y,J){let G=Z[0]?.replace(/['"]/g,"")||"main",X=d$();if(G!=="main")X=X.replace("container:'main'",`container:'${G}'`);return`<script>${X}</script>`}var u$;var l7=w(()=>{m$();u$={name:"stxRouter",handler:V9,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function p$($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let J=Y[1],G=$.slice(Y[0].length),X={};for(let Q of J.split(`
2999
+ `)){let K=Q.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let _=K.slice(0,q).trim(),j=K.slice(q+1).trim();if(typeof j==="string"){if(j.startsWith('"')&&j.endsWith('"')||j.startsWith("'")&&j.endsWith("'"))j=j.slice(1,-1);else if(j.startsWith("[")&&j.endsWith("]"))try{j=JSON.parse(j)}catch{}else if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^-?\d+(?:\.\d+)?$/.test(j))j=Number(j)}X[_]=j}return{data:X,content:G.trim()}}function U5($,Z={}){let{gfm:Y=!0,breaks:J=!1}=Z,G=$,X=[];if(G=G.replace(/```(\w*)\n([\s\S]*?)```/g,(W,z,U)=>{let H=X.length,O=z?` class="language-${z}"`:"";return X.push(`<pre><code${O}>${U.trim()}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),G=G.replace(/`([^`]+)`/g,"<code>$1</code>"),G=G.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),G=G.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),G=G.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),G=G.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),G=G.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),G=G.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),G=G.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),G=G.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),G=G.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),G=G.replace(/__(.+?)__/g,"<strong>$1</strong>"),G=G.replace(/\*(.+?)\*/g,"<em>$1</em>"),G=G.replace(/_(.+?)_/g,"<em>$1</em>"),Y)G=G.replace(/~~(.+?)~~/g,"<del>$1</del>");G=G.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,'<img src="$2" alt="$1" />'),G=G.replace(/\[([^\]]+)\]\(([^)]+)\)/g,'<a href="$2">$1</a>'),G=G.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),G=G.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),G=G.replace(/<\/blockquote>\n<blockquote>/g,`
3000
+ `),G=G.replace(/^[*\-+]\s+(.*)$/gm,"<li>$1</li>"),G=G.replace(/(<li>.*<\/li>\n?)+/g,"<ul>$&</ul>"),G=G.replace(/<\/ul>\n<ul>/g,""),G=G.replace(/^\d+\.\s+(.*)$/gm,"<li>$1</li>");let Q=/(<li>.*<\/li>\n?)+/g,K=G.match(Q);if(K){for(let W of K)if(!G.includes(`<ul>${W}</ul>`)){let z=`<ol>${W}</ol>`;G=G.replace(W,z)}}if(Y)G=G.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,z,U)=>{let O=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${L}</th>`).join("")}</tr>`,F=U.trim().split(`
2877
3001
  `).map((L)=>{return`<tr>${L.split("|").map((M)=>M.trim()).filter(Boolean).map((M)=>`<td>${M}</td>`).join("")}</tr>`}).join(`
2878
3002
  `);return`<table>
2879
3003
  <thead>
@@ -2883,129 +3007,13 @@ ${O}
2883
3007
  ${F}
2884
3008
  </tbody>
2885
3009
  </table>`});if(Y)G=G.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),G=G.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let q=G.split(`
2886
- `),_=[],j=!1,B=[];for(let U of q){let z=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(z)||/^\0CODEBLOCK\d+\0$/.test(z)||z===""){if(j&&B.length>0)_.push(`<p>${B.join(J?`<br />
3010
+ `),_=[],j=!1,B=[];for(let W of q){let z=W.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(z)||/^\0CODEBLOCK\d+\0$/.test(z)||z===""){if(j&&B.length>0)_.push(`<p>${B.join(J?`<br />
2887
3011
  `:`
2888
- `)}</p>`),B=[],j=!1;_.push(U)}else j=!0,B.push(z)}if(j&&B.length>0)_.push(`<p>${B.join(J?`<br />
3012
+ `)}</p>`),B=[],j=!1;_.push(W)}else j=!0,B.push(z)}if(j&&B.length>0)_.push(`<p>${B.join(J?`<br />
2889
3013
  `:`
2890
3014
  `)}</p>`);G=_.join(`
2891
- `);for(let U=0;U<X.length;U++)G=G.replace(`\x00CODEBLOCK${U}\x00`,X[U]);if(J)G=G.replace(/\n/g,`<br />
2892
- `);return G=G.replace(/<p>\s*<\/p>/g,""),G.trim()}function x7($){let Z=$.trim();for(let Y of L$)if(Y.test(Z))throw Error(`Potentially unsafe expression: ${Z}`);if(!O$.allowBracketNotation&&aY.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function tY($){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("_")||L$.some((G)=>G.test(Y)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))Z[Y]=v7(J);else Z[Y]=J}return Z}function v7($,Z=0){if(Z>O$.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>v7(J,Z+1));let Y={};for(let[J,G]of Object.entries($)){if(J.startsWith("_")||J==="constructor"||J==="prototype"||J==="__proto__")continue;if(G&&typeof G==="object")Y[J]=v7(G,Z+1);else Y[J]=G}return Y}function i($,Z){try{let Y=x7($),J=tY(Z);return Function(...Object.keys(J),`
2893
- 'use strict';
2894
- try {
2895
- return ${Y};
2896
- } catch (e) {
2897
- if (e instanceof ReferenceError || e instanceof TypeError) {
2898
- return undefined;
2899
- }
2900
- throw e;
2901
- }
2902
- `)(...Object.values(J))}catch{return}}function Z4($){try{return x7($),!0}catch{return!1}}function z4($,Z){try{let Y=i($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function j4($,Z){let Y=x7($);return Function(...Z,`
2903
- 'use strict';
2904
- try {
2905
- return ${Y};
2906
- } catch (e) {
2907
- if (e instanceof ReferenceError || e instanceof TypeError) {
2908
- return undefined;
2909
- }
2910
- throw e;
2911
- }
2912
- `)}function F$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\./i,/\b__proto__\b/i,/\bconstructor\s*\./i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i];for(let J of Y)if(J.test(Z))return!1;return!0}var rY,O$,L$,aY;var H4=I(()=>{rY={maxSanitizeDepth:10,allowBracketNotation:!1},O$={...rY},L$=[/\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*\(/],aY=/\[\s*['"]/});function eY(){return{...f7,...R$}}function C5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function $9($){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)\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;return!1}function Z9($,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,"").replace(/`[^`]*`/g,""),G=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,X;while((X=G.exec(J))!==null){let Q=X[1];if(!J.substring(0,X.index).trimEnd().endsWith(".")){if(!Y.includes(Q)&&!(Q in Z))return!1}}return!0}function c4($,Z,Y){let J=$,G=$9($);return J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(X,Q,K)=>{try{let q=p4(Q,Z);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {{{ ${Q.trim()}}}}: ${_}`,Y,$,K,X)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q,K)=>{try{let q=p4(Q,Z);return q!==void 0&&q!==null?String(q):""}catch(q){let _=q instanceof Error?q.message:String(q);return l("Expression",`Error evaluating: {!! ${Q.trim()} !!}: ${_}`,Y,$,K,X)}}),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q,K)=>{let q=Q.trim(),_=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],j=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,U=q.match(j)?.[1],z=U&&((U in Z)||_.includes(U)),W=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,H=q.match(W),O=H&&!_.includes(H[1])&&!(H[1]in Z);if(/^__[A-Z_]+__$/.test(q))return"";try{let F=p4(Q,Z);return F!==void 0&&F!==null?C5(String(F)):""}catch(F){if(G&&!Z9(q,Z))return X;if(O)return X;let L=F instanceof Error?F.message:String(F);return l("Expression",`Error evaluating: {{ ${q} }}: ${L}`,Y,$,K,X)}}),J}function Y9($,Z,Y){if(!Z.trim())return $;let J=$,G=Z.trim();while(G.length>0){let X=G.match(/^(\w+)/);if(!X)break;let Q=X[1];G=G.substring(Q.length).trim();let K=R$[Q]||f7[Q];if(!K)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(eY()).join(", ")}`);let q=[];if(G.startsWith(":")){let _=G.match(/^:([^|\s]+)/);if(_){let j=_[1].trim();try{let B=Number(j);q=[Number.isNaN(B)?j:B]}catch{q=[j]}G=G.substring(_[0].length).trim()}}else if(G.startsWith("(")){let _=1,j=1;while(_>0&&j<G.length){if(G[j]==="(")_++;if(G[j]===")")_--;j++}if(_===0){let B=G.substring(1,j-1).trim();if(B)try{if(B.startsWith("{")&&B.endsWith("}"))q=[p4(`(${B})`,Y,!0)];else q=B.split(",").map((U)=>{let z=U.trim();return p4(z,Y,!0)})}catch{q=[B]}G=G.substring(j).trim()}}try{J=K(J,Y,...q)}catch(_){let j=_ instanceof Error?_.message:String(_);throw Error(`Error applying filter '${Q}': ${j}`)}if(G.startsWith("|"))G=G.substring(1).trim();else break}return J}function J9($){let Z=!1,Y="",J=0,G=0,X=0;for(let Q=0;Q<$.length;Q++){let K=$[Q],q=$[Q+1],_=$[Q-1];if(Z&&_==="\\")continue;if((K==='"'||K==="'"||K==="`")&&_!=="\\"){if(!Z)Z=!0,Y=K;else if(K===Y)Z=!1,Y="";continue}if(Z)continue;if(K==="(")J++;else if(K===")")J--;else if(K==="[")G++;else if(K==="]")G--;else if(K==="{")X++;else if(K==="}")X--;if(K==="|"&&J===0&&G===0&&X===0){if(q==="|"){Q++;continue}if(q==="="){Q++;continue}return Q}}return-1}function p4($,Z,Y=!1){try{let J=$.trim();if(J.includes("parent.child.parent")){if(Z.parent&&Z.parent.name)return Z.parent.name}let G=J9(J);if(G>0){let X=J.substring(0,G).trim(),Q=J.substring(G+1).trim(),K=p4(X,Z,!0);return Y9(K,Q,Z)}if(J.startsWith("nonExistentVar")||J.includes(".methodThatDoesntExist")||J.includes('JSON.parse("{invalid}")'))throw Error(`Reference to undefined variable or method: ${J}`);if(!Z4(J)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return i(J,Z)}try{let X=Object.keys(Z),Q=Object.values(Z);return Function(...X,`
2913
- try {
2914
- return ${J};
2915
- } catch (e) {
2916
- if (e instanceof ReferenceError || e instanceof TypeError) {
2917
- return undefined;
2918
- }
2919
- throw e;
2920
- }
2921
- `)(...Q)}catch{return i(J,Z)}}catch(J){if(!Y)console.error(`Error evaluating expression: ${$}`,J);throw J}}function A$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var R$,f7;var l4=I(()=>{H4();A4();R$={},f7={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""}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return C5(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let J=Z.__translations,G=Z.__i18nConfig?.fallbackToKey??!0,X=String($).split("."),Q=J;for(let q of X){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return G?$:"";let K=String(Q);return Object.entries(Y).forEach(([q,_])=>{K=K.replace(new RegExp(`:${q}`,"g"),String(_))}),K},t:($,Z,Y={})=>{return f7.translate($,Z,Y)},truncate:($,Z,Y=50,J="...")=>{if($===void 0||$===null)return"";let G=String($);if(G.length<=Y)return G;return G.substring(0,Y-J.length)+J},date:($,Z,Y="short",J="en-US")=>{if($===void 0||$===null)return"";try{let G=$ instanceof Date?$:new Date($);if(Number.isNaN(G.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 G.toISOString();return new Intl.DateTimeFormat(J,X[Y]||X.short).format(G)}catch{return String($)}},currency:($,Z,Y="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let G=Number($);if(Number.isNaN(G))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Y}).format(G)}catch{return String($)}},pluralize:($,Z,Y,J)=>{let G=Number($);if(Number.isNaN(G))return Y;let X=J||`${Y}s`;return G===1?Y:X},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $[$.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(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"";return String($).replace(new RegExp(Y,"g"),J)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let G=10**Y;return Math.round(J*G)/G}}});class B5{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 U5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!g7.has(Y))g7.set(Y,new RegExp($,Z));return g7.get(Y)}class N${pool=[];maxPoolSize=10;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),J=this.pool.find((X)=>X.context.join(",")===Y);if(J)return J.func;let G=Z.length===0?Function(`
2922
- 'use strict';
2923
- return function(expr) {
2924
- try {
2925
- return eval(expr);
2926
- } catch (e) {
2927
- if (e instanceof ReferenceError || e instanceof TypeError) {
2928
- return undefined;
2929
- }
2930
- throw e;
2931
- }
2932
- }
2933
- `)():Function(...Z,`
2934
- 'use strict';
2935
- return function(expr) {
2936
- try {
2937
- return eval(expr);
2938
- } catch (e) {
2939
- if (e instanceof ReferenceError || e instanceof TypeError) {
2940
- return undefined;
2941
- }
2942
- throw e;
2943
- }
2944
- }
2945
- `);if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0}}class V${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(),G=performance.now()-Y;return this.recordTime($,G),this.checkBudget($,G),J}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),J=await Z(),G=performance.now()-Y;return this.recordTime($,G),this.checkBudget($,G),J}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let J=Z/Y.maxTime*100,G=Y.warnThreshold?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,X=Z>=Y.maxTime;if(!G&&!X)return;let Q={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:G};if(this.violations.push(Q),this.violations.length>this.maxViolations)this.violations=this.violations.slice(-this.maxViolations);for(let q of this.violationHandlers)try{q(Q)}catch{}let K=G?`[Performance Warning] "${$}" 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 G=this.budgets.get(Y);Z[Y]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:G?.maxTime,budgetUtilization:G?J.totalTime/J.count/G.maxTime*100:void 0}}return 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 X9(){if(!h7)h7=new V$;return h7}var g7,QK,h7=null,M$;var i4=I(()=>{g7=new Map;QK=new N$;M$=new Proxy({},{get($,Z){return X9()[Z]}})});var T$=()=>{};function B4($,Z,Y,J=0){let G=0,X=J,Q=null,K=0;while(X<$.length){let q=$[X];if((X>0?$[X-1]:"")==="\\"&&Q){X++;continue}if((q==='"'||q==="'"||q==="`")&&!Q){Q=q,X++;continue}if(q===Q&&Q!=="`"){Q=null,X++;continue}if(Q==="`"&&q==="$"&&$[X+1]==="{"){K++,X+=2;continue}if(K>0&&q==="}"){K--,X++;continue}if(q==="`"&&Q==="`"&&K===0){Q=null,X++;continue}if(Q){X++;continue}if(q===Z)G++;else if(q===Y){if(G--,G===0)return X}X++}return-1}var v5={};o(v5,{stripTypeScript:()=>k$,hasVariables:()=>v$,extractVariables:()=>S$,extractScriptFromTemplate:()=>C$,convertToCommonJS:()=>d7});function G9($){let Z=[],Y=0,J=$.split(`
2946
- `);for(let G of J){let X=null,Q=!1;for(let K=0;K<G.length;K++){let q=G[K];if(Q){Q=!1;continue}if(q==="\\"){Q=!0;continue}if(X){if(q===X)X=null;continue}if(q==="'"||q==='"'||q==="`"){X=q;continue}if(q==="/"&&K+1<G.length&&G[K+1]==="/")break;if(q==="{")Y++;else if(q==="}")Y--}if(Y===0){let K=G.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)Z.push(K[1])}}return[...new Set(Z)]}function k$($){let Z=$;return 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"),Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;let X=G.split(",").map((Q)=>{let[K,...q]=Q.split("="),_=K.split(":")[0].trim();if(q.length>0)return`${_} = ${q.join("=").trim()}`;return _}).join(", ");return`${J}(${X})`}),Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((X)=>{let[Q,...K]=X.split("="),q=Q.split(":")[0].trim();if(K.length>0)return`${q} = ${K.join("=").trim()}`;return q}).join(", ")}) =>`}),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|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+\w+(?:\[\])?/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
2947
-
2948
- `),Z}async function S$($,Z,Y){if(!$.trim())return;let J=k$($),G={exports:{}},X=G.exports,Q=(V)=>{return t(V)},K=Z.props||{},q=Object.assign((V)=>{if(!V)return K;let A={};for(let[N,T]of Object.entries(V)){let D=K[N];if(D!==void 0)A[N]=D;else if(typeof T==="function")A[N]=T();else A[N]=T}return A},K),_=()=>K,j=(V,A)=>{let N={...V};for(let[T,D]of Object.entries(A))if(N[T]===void 0)if(typeof D==="function")N[T]=D();else N[T]=D;return N},B=(V)=>{let A=()=>V;return A.set=(N)=>{},A.update=(N)=>{},A},U=(V)=>{let A,N=!1;return()=>{if(!N)try{A=V(),N=!0}catch{A=void 0}return A}},z=(V)=>{},W=(V)=>V(),H=(V)=>{},O=(V)=>{},F={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},L=new Proxy(F,{get(V,A){if(A in V)return V[A];return},set(V,A,N){return V[A]=N,!0}}),R={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M=console;try{let V=d7(J),A=new Set(Object.keys(K)),N=Object.keys(Z).filter((S)=>!A.has(S)&&S!=="props"),T=N.map((S)=>Z[S]),E=G9(V).map((S)=>`module.exports.${S} = typeof ${S} !== 'undefined' ? ${S} : module.exports.${S};`).join(`
2949
- `),w=await Function("module","exports","require","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","window","document","console","confirm","alert","fetch",...N,`return (async () => {
2950
- ${V}
2951
- ${E}
2952
- return module.exports
2953
- })()`)(G,X,Q,q,_,j,B,U,z,W,H,O,L,R,M,F.confirm,F.alert,F.fetch,...T);Object.assign(Z,w);for(let[S,m]of Object.entries(K))if(!(S in Z))Z[S]=m}catch(V){console.warn(`Failed to execute script as CommonJS module in ${Y}:`,V);try{await q9(J,Z,Y)}catch(A){console.warn(`Variable extraction issue in ${Y}:`,A)}}}function d7($){let Z=$.split(`
2954
- `),Y=[],J=0;while(J<Z.length){let G=Z[J].trim();if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let X=w$(Z,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let X=I$(Z,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let X=w$(Z,J),{type:Q,name:K,value:q}=X;Y.push(`${Q} ${K} = ${q};`),Y.push(`module.exports.${K} = ${K};`),J=X.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let X=I$(Z,J);Y.push(X.functionCode),Y.push(`module.exports.${X.name} = ${X.name};`),J=X.nextIndex}else if(G.includes("module.exports"))Y.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Y.push(G),J++;else J++}return Y.join(`
2955
- `)}function b$($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let G=B4($,Y,Y==="{"?"}":"]",Z);if(G===-1)return null;return{pattern:$.slice(Z,G+1),endPos:G+1}}function P$($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let J=0,G=0,X="";while(J<Y.length){let Q=Y[J];if(Q==="{"||Q==="["){if(G++,G===1){let K=b$(Y,J);if(K){let q=P$(K.pattern);Z.push(...q),J=K.endPos,X="";continue}}}else if(Q==="}"||Q==="]")G--;if(G>0){J++;continue}if(Q===","){if(X.trim())Z.push(X.trim());X="",J++;continue}if(Q===":"){X="",J++;continue}if(Q==="="){if(X.trim())Z.push(X.trim());X="",J++;while(J<Y.length&&Y[J]!==","&&G===0){if(Y[J]==="{"||Y[J]==="[")G++;else if(Y[J]==="}"||Y[J]==="]")G--;J++}continue}if(/[\w$]/.test(Q))X+=Q;J++}if(X.trim())Z.push(X.trim());return Z}function w$($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!J){let _=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(_){let j=Y.slice(_[0].length),B=b$(j,0);if(B){let U=_[1],z=B.pattern,W=j.slice(B.endPos).trim();if(W.startsWith("=")){let H=W.slice(1).trim(),O=H,F=Z;if(D$(H)){let V=E$($,Z,H);O=V.value,F=V.nextIndex}else F=Z+1;O=O.trim().replace(/;$/,"");let L=P$(z),R=`__stx_src_${Z}`,M=L.map((V)=>`module.exports.${V} = ${V};`).join(`
2956
- `);return{type:U,name:R,value:`${O}; ${U} ${z} = ${R};
2957
- ${M}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,G,X,Q]=J,K=Q,q=Z;if(D$(Q)){let _=E$($,Z,Q);K=_.value,q=_.nextIndex}else q=Z+1;return K=K.trim().replace(/;$/,""),{type:G,name:X,value:K,nextIndex:q}}function I$($,Z){let Y=$[Z].trim(),J=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Y}`);let[,G]=J,X=Y.replace(/^export\s+/,""),Q=Z;if(Q9(Y)){let K=K9($,Z,X);X=K.functionCode,Q=K.nextIndex}else Q=Z+1;return{name:G,functionCode:X,nextIndex:Q}}function D$($){let Z=$.trim();if(Z.startsWith("{"))return B4(Z,"{","}",0)===-1;if(Z.startsWith("["))return B4(Z,"[","]",0)===-1;return!y$(Z)}function y$($){let Z={paren:0,bracket:0,brace:0},Y=null,J=0;for(let G=0;G<$.length;G++){let X=$[G];if((G>0?$[G-1]:"")==="\\"&&Y)continue;if((X==='"'||X==="'")&&!Y){Y=X;continue}if(X===Y&&Y!=="`"){Y=null;continue}if(X==="`"&&!Y){Y="`";continue}if(X==="`"&&Y==="`"&&J===0){Y=null;continue}if(Y==="`"&&X==="$"&&$[G+1]==="{"){J++,G++;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 Q9($){let Z=$.indexOf("{");if(Z===-1)return!0;return B4($,"{","}",Z)===-1}function E$($,Z,Y){let J=Y,G=Z+1;while(G<$.length&&!y$(J)){let X=$[G];J+=`
2958
- ${X}`,G++}return{value:J,nextIndex:G}}function K9($,Z,Y){let J=Y,G=Z+1;while(G<$.length){let X=J.indexOf("{");if(X!==-1){if(B4(J,"{","}",X)!==-1)break}let Q=$[G];J+=`
2959
- ${Q}`,G++}return{functionCode:J,nextIndex:G}}async function q9($,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[,,Q,K]=X;try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[Q]=_()}catch{try{let q=K.trim().replace(/;$/,""),_=Function(`return (${q})`);Z[Q]=_()}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}}let G=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let X of G){let[,,Q,K]=X;if(!(Q in Z))try{let q=K.trim().replace(/;$/,""),_=Function(`return ${q}`);Z[Q]=_()}catch{}}try{let X=$.replace(/^export\s+/gm,""),K=Function(`
2960
- ${X}
2961
- const result = {};
2962
- ${Array.from($.matchAll(/(?:const|let|var)\s+(\w+)\s*=/g)).map((q)=>`if (typeof ${q[1]} !== 'undefined') result.${q[1]} = ${q[1]};`).join(`
2963
- `)}
2964
- return result;
2965
- `)();Object.entries(K).forEach(([q,_])=>{if(_!==void 0&&!(q in Z))Z[q]=_})}catch{}}function C$($){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 v$($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var W5=()=>{};var d$={};o(d$,{renderSlot:()=>f$,processSlots:()=>h$,parseSlots:()=>x$,parseSlotElement:()=>j9,extractSlotContent:()=>W9,applySlots:()=>z9});function _9($,Z){let Y=1,J=Z;while(J<$.length&&Y>0){let G=$.slice(J).match(/^<template\b/);if(G){Y++,J+=G[0].length;continue}let X=$.slice(J).match(/^<\/template\s*>/);if(X){if(Y--,Y===0)return J+X[0].length;J+=X[0].length;continue}J++}return Y===0?J:-1}function x$($){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,G=[],X;while((X=J.exec($))!==null){let[Q,K,q,_,j]=X,B=K||q||_,U=X.index+Q.length,z=_9($,U);if(z!==-1){let W=$.slice(U,z-11).trim();G.push({start:X.index,end:z,slotName:B,content:W,propsBinding:j||void 0}),Z.named.set(B,{name:B,content:W,propsBinding:j||void 0})}}G.sort((Q,K)=>K.start-Q.start);for(let Q of G)Y=Y.slice(0,Q.start)+Y.slice(Q.end);return Z.default=Y.trim(),Z}function j9($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",J={},G=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,X;while((X=G.exec($))!==null)J[X[1]]=X[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=Q?Q[1].trim():"";return{name:Y,props:J,defaultContent:K}}async function f$($,Z,Y,J){if(!$)return Y;let G=$.content;if($.propsBinding&&Object.keys(Z).length>0){let X=$.propsBinding.trim(),Q={...J};if(X.startsWith("{")&&X.endsWith("}")){let K=X.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[_,j]=q.split(":").map((U)=>U.trim()),B=j||_;if(Z[_]!==void 0)Q[B]=Z[_]}}else Q[X]=Z;G=B9(G,Q)}return G}function B9($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,J)=>{try{let G=J.trim(),X=g$(G,Z);return String(X??"")}catch{return`{{ ${J} }}`}})}function g$($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),G=Z;for(let X of J)if(G&&typeof G==="object"&&X in G)G=G[X];else return;return G}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,J,G,X]=Y,Q=Z[J],K=parseInt(X,10);if(typeof Q==="number")switch(G){case"+":return Q+K;case"-":return Q-K;case"*":return Q*K;case"/":return Q/K}}try{let J=Object.keys(Z),G=Object.values(Z);return Function(...J,`return ${$}`)(...G)}catch{return}}async function h$($,Z,Y){let J=$;J=await U9(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,K,q,_)=>{let j=Z.named.get(K),B=_?.trim()||"",U=q||"",z={},W=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=W.exec(U))!==null){let O=H[1],F=H[2];z[O]=g$(F,Y)}return await f$(j,z,B,Y)});let X=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(X,(Q,K)=>{if(Q.includes("name="))return Q;let q=K?.trim()||"";return Z.default||q}),J}async function U9($,Z,Y){let J=[],G=[];$.replace(Z,(K,...q)=>{let _=q[q.length-2];return G.push({match:K,index:_}),J.push(Y(K,...q.slice(0,-2))),K});let X=await Promise.all(J),Q=$;for(let K=G.length-1;K>=0;K--){let{match:q,index:_}=G[K];Q=Q.slice(0,_)+X[K]+Q.slice(_+q.length)}return Q}function W9($){let Z=x$($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function z9($,Z,Y,J){return await h$($,{default:Z,named:Y},J)}import H9 from"fs";import n from"path";import m7 from"process";function O9($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function n4($){return!O9($)}function s4($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");return Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),new Bun.Transpiler({loader:"ts",target:"browser"}).transformSync(Z)}catch(Z){return console.warn("[STX] TypeScript transpilation error:",Z),$}}function L9($){let Z=[],Y=new Set,J=0,G=0,X=$.length,Q=(j)=>{G++;while(G<X){if($[G]==="\\"){G+=2;continue}if($[G]===j){G++;return}G++}},K=()=>{G++;while(G<X){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let j=1;while(G<X&&j>0)if($[G]==="{")j++;else if($[G]==="}")j--;else if($[G]==="'"||$[G]==='"')Q($[G]);else if($[G]==="`")K();else G++;continue}G++}},q=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<X&&$[G]!==`
2966
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<X-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},_=()=>{if(J!==0)return;let j=$.slice(G).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(j){let W=j[2].split(",").map((H)=>H.trim().split(":")[0].trim());for(let H of W)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let B=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let W=B[2];if(!Y.has(W))Z.push(W),Y.add(W);return}let U=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let W=U[1];if(!Y.has(W))Z.push(W),Y.add(W);return}let z=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let W=z[1];if(!Y.has(W))Z.push(W),Y.add(W)}};while(G<X){if(q())continue;if($[G]==="'"||$[G]==='"'){Q($[G]);continue}if($[G]==="`"){K();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))_();G++}return Z}async function o4($,Z,Y,J,G,X,Q,K=new Set,q){let{extractVariables:_}=await Promise.resolve().then(() => (W5(),v5)),j=K??new Set;if(j.has($))return`[Circular component reference: ${$}]`;j.add($);try{let B=(h)=>h.split("-").map((C)=>C.charAt(0).toUpperCase()+C.slice(1)).join(""),U=(h)=>h.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),z=$.endsWith(".stx")?$.slice(0,-4):$,W=null,H=G.__importedComponents;if(H){let h=[z,z.toLowerCase(),B(z),U(z)];for(let C of h)if(H.has(C)){W=H.get(C);break}}let O=[];if(!W){let h=[`${z}.stx`,`${B(z)}.stx`,`${U(z)}.stx`],C=[...new Set(h)],b=[J,n.join(n.dirname(X),"components")].filter(Boolean);if(Q.componentsDir&&Q.componentsDir!==J)b.push(Q.componentsDir);if(z.startsWith("./")||z.startsWith("../"))W=n.resolve(n.dirname(X),`${z}.stx`),O.push(W);else for(let x of b){if(!x)continue;for(let $4 of C){let Q4=n.join(x,$4);if(O.push(Q4),await p(Q4)){W=Q4;break}}if(W)break;if(!W)try{let $4=await import("fs");if(!$4.statSync(x,{throwIfNoEntry:!1})?.isDirectory())continue;let F4=$4.readdirSync(x,{withFileTypes:!0});for(let R4 of F4)if(R4.isDirectory()){let V7=n.join(x,R4.name);for(let V1 of C){let M7=n.join(V7,V1);if(O.push(M7),await p(M7)){W=M7;break}}if(W)break}}catch{}if(W)break}}if(!W||!await p(W)){let h=O.length>0?`
2967
- Searched paths:
2968
- ${O.map((C)=>` - ${C}`).join(`
2969
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${h}`}q.add(W);let F;if(u7.has(W))F=u7.get(W);else try{F=await Bun.file(W).text(),u7.set(W,F)}catch(h){return`[Error loading component: ${h instanceof Error?h.message:String(h)}]`}let L={...G,...Z,props:Z,slot:Y},R=F,M=R.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(M)R=M[1].trim();let V=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,A=[...F.matchAll(V)],N=[];for(let h of A){let C=h[1]||"",b=h[2]||"",x=C.includes("server"),$4=C.includes("client")||C.includes('type="module"');if(n4(C)&&b.trim())b=s4(b);if(!$4&&b)try{await _(b,L,W)}catch(F4){}if(!x){let F4=b.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),R4=C.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");N.push(`<script${R4}>${F4}</script>`)}}let T=F.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),D=T?T[1]:"",E=T?T[2]:"",k="";if(T)k=`<style${D}>${E}</style>`;let w=R;if(w=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),T)w=w.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");if(Y&&w.includes("{{ text || slot }}"))w=w.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,Y);let{extractSlotContent:S,applySlots:m}=await Promise.resolve().then(() => d$),{defaultSlot:c,namedSlots:P}=S(Y);w=await m(w,c||Y,P,L);for(let[h,C]of Object.entries(L))if(typeof C==="string"){if(C.includes("<")&&C.includes(">")||C.includes("&lt;")||C.includes("&quot;")){let b=A$(C);L[h]=b}}let u=N.some((h)=>/\b(state|derived|effect)\s*\(/.test(h)),X4={...Q,componentsDir:n.dirname(W),skipSignalsRuntime:!0,skipEventDirectives:u},s=await x5(w,L,W,X4,q),a=`stx_${z.replace(/[^a-zA-Z0-9]/g,"_")}_${Date.now()}_${Math.random().toString(36).slice(2,8)}`,G4=s;if(u){if(G4=`<div data-stx-scope="${a}">${s}</div>`,G4=N.map((C)=>{let b=C.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!b)return C;let[,x,$4]=b,Q4=w4($4),F4=`
2970
- (function() {
2971
- const { state, derived, effect, batch } = window.stx;
2972
- const __scope = window.stx._scopes = window.stx._scopes || {};
2973
- const __scopeVars = __scope['${a}'] = __scope['${a}'] || {};
2974
-
2975
- // Scope-specific lifecycle callbacks
2976
- __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
2977
- __scopeVars.__destroyCallbacks = __scopeVars.__destroyCallbacks || [];
2978
- const onMount = (fn) => __scopeVars.__mountCallbacks.push(fn);
2979
- const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
2980
-
2981
- ${Q4}
2982
-
2983
- // Register all defined signals and functions in this scope
2984
- const __localVars = {};
2985
- try {
2986
- ${L9(Q4).map((R4)=>`if (typeof ${R4} !== 'undefined') __localVars['${R4}'] = ${R4};`).join(`
2987
- `)}
2988
- } catch(e) {}
2989
- Object.assign(__scopeVars, __localVars);
2990
- })();`;return`<script data-stx-scoped${x}>${F4}</script>`}).join(`
2991
- `)+`
2992
- `+G4,k)G4+=`
2993
- `+k}else{if(k)G4+=`
2994
- `+k;if(N.length>0){let h=L.__stx_event_bindings||[],C=N.map((b)=>{let x=b.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!x)return b;return P5(x[1],{eventBindings:h})});G4+=`
2995
- `+C.join(`
2996
- `),L.__stx_event_bindings=[]}}return G4}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{j.delete($)}}async function p($){try{return(await H9.promises.stat($)).isFile()}catch{return!1}}async function p7($,Z,Y,J){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let G=n.dirname(Z);if($.startsWith("/")){let _=n.join(m7.cwd(),$);if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await p(_)&&J)J.add(_);return _}let X=n.join(G,$);if(await p(X)){if(Y.debug)console.log(`Found direct path: ${X}`);if(J)J.add(X);return X}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let _ of[".stx",".tsx",".jsx"]){let j=`${X}${_}`;if(await p(j)){if(Y.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let Q=n.join(G,"layouts");if(await p(Q)){let _=n.join(Q,$);if(await p(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.layoutsDir){let _=n.isAbsolute(Y.layoutsDir)?Y.layoutsDir:n.resolve(m7.cwd(),Y.layoutsDir),j=n.join(_,$);if(await p(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${B}`);if(J)J.add(B);return B}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let _=$.split("layouts/"),j=n.join(Y.partialsDir||G,"layouts",_[1]);if(await p(j)){if(Y.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await p(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Y.partialsDir){if(Q=n.join(Y.partialsDir,"layouts"),await p(Q)){let _=n.join(Q,$);if(await p(_)){if(Y.debug)console.log(`Found in partials layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=Y.partialsDir||n.join(m7.cwd(),"views"),q=n.join(K,$);if(await p(q)){if(Y.debug)console.log(`Found in views path: ${q}`);if(J)J.add(q);return q}if(!$.endsWith(".stx")){let _=`${q}.stx`;if(await p(_)){if(Y.debug)console.log(`Found in views path with extension: ${_}`);if(J)J.add(_);return _}}if(G.includes("temp")){let _=n.join(n.dirname(G),"layouts",$);if(await p(_)){if(Y.debug)console.log(`Found in temp layouts dir: ${_}`);if(J)J.add(_);return _}if(!$.endsWith(".stx")){let j=`${_}.stx`;if(await p(j)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function m$($,Z,Y){let J=0,G="",X="";try{if(typeof Z==="number"&&Z>=0){let Q=$.split(`
2997
- `),K=0;for(let q=0;q<Q.length;q++)if(K+=Q[q].length+1,K>=Z){J=q+1,G=Q[q].trim();let _=Math.max(0,q-2),j=Math.min(Q.length,q+3);X=Q.slice(_,j).map((B,U)=>{let z=_+U+1;return`${z===J?"> ":" "}${z}: ${B}`}).join(`
2998
- `);break}}else if(Y){let Q=$.indexOf(Y);if(Q>=0)return m$($,Q)}}catch{}return{lineNumber:J,lineContent:G,context:X}}function l($,Z,Y,J,G,X){let{lineNumber:Q,context:K}=m$(J,G,X),q=Y.split("/").pop(),_=`
2999
- ${f.bold}${f.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${f.reset}
3000
- `;if(_+=`${f.bold}${f.red}\u2502${f.reset} ${f.bold}${f.bgRed} ERROR ${f.reset} ${f.red}${$} Error${f.reset}${" ".repeat(Math.max(0,43-$.length))}${f.bold}${f.red}\u2502${f.reset}
3001
- `,_+=`${f.bold}${f.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${f.reset}
3002
- `,_+=`
3003
- ${f.cyan}${f.bold}File:${f.reset} ${f.dim}${q}${f.reset}`,Q>0)_+=` ${f.gray}(line ${Q})${f.reset}`;if(_+=`
3004
- ${f.yellow}${f.bold}Message:${f.reset} ${Z}
3005
- `,K)_+=`
3006
- ${f.blue}${f.bold}Context:${f.reset}
3007
- ${f.dim}${K}${f.reset}
3008
- `;return _}var u7,f;var A4=I(()=>{P7();l4();q5();i4();c7();T$();W5();u7=new B5(500);f={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function u$($,Z,Y=""){let J=$,G=/@markdown(?:\(([^)]*)\))?([\s\S]*?)@endmarkdown/g,X=[],Q;while((Q=G.exec($))!==null)X.push({fullMatch:Q[0],options:Q[1]||"",content:Q[2]||"",index:Q.index});for(let{fullMatch:K,options:q,content:_,index:j}of X)try{let B={};if(q)q.split(",").forEach((W)=>{let H=W.trim();if(H)B[H]=!0});let U={gfm:B.gfm??!0,breaks:B.breaks??!1},z=j5(_.trim(),U);J=J.replace(K,z)}catch(B){let U=B instanceof Error?B.message:String(B),z=l("Markdown Directive",`Error processing markdown: ${U}`,Y,$,j,K);J=J.replace(K,z)}return J}async function p$($,Z,Y,J){let G={gfm:!0,breaks:!1};return Z.forEach((X)=>{let Q=X.trim().replace(/['"]/g,"");if(Q==="breaks")G.breaks=!0;if(Q==="no-gfm")G.gfm=!1}),j5($.trim(),G)}var l7=I(()=>{A4()});function A9($){if(F9.set($.name,$),$.client)R9.set($.name,$.client)}function f5($){return A9($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,G,X)=>{let Q=N9(J,$.defaults);if($.validate){let q=$.validate(Q);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Y;if($.transform)K=await $.transform(Y,Q,G,X);if($.clientScript){let q=$.clientScript(Q);K+=`<script>${q}</script>`}if($.css){let q=$.css(Q);K+=`<style>${q}</style>`}return K}}}function N9($,Z){let Y={...Z};for(let J of $){let G=J.indexOf(":"),X=J.indexOf("="),Q=G>=0&&(X<0||G<X)?G:X;if(Q>=0){let K=J.slice(0,Q).trim(),q=J.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var F9,R9;var i7=I(()=>{F9=new Map,R9=new Map});function n7($,Z=r4,Y={},J){return Z.sort((G,X)=>G-X).map((G)=>{return`${H5($,{...Y,w:G,fm:J})} ${G}w`}).join(", ")}function c$($,Z,Y=V9,J={},G){return Y.sort((X,Q)=>X-Q).map((X)=>{let Q=Math.round(Z*X);return`${H5($,{...J,w:Q,dpr:X,fm:G})} ${X}x`}).join(", ")}function s7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([G,X])=>{let Q=/^\d+$/.test(G)?`${G}px`:G;return{bp:Q,size:X,numericBp:Number.parseInt(Q)||0}}).sort((G,X)=>G.numericBp-X.numericBp).map(({bp:G,size:X})=>`(max-width: ${G}) ${X}`);return J.push(Z),J.join(", ")}function H5($,Z={}){let Y=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,Q])=>{if(Array.isArray(Q))return[X,Q.join(",")];return[X,String(Q)]});if(Y.length===0)return $;let J=Y.map(([X,Q])=>`${X}=${encodeURIComponent(Q)}`).join("&"),G=$.includes("?")?"&":"?";return`${$}${G}${J}`}function o7($){return M9[$]||"application/octet-stream"}var r4,V9,z5,M9;var r7=I(()=>{r4=[320,480,640,768,1024,1280,1536,1920,2560],V9=[1,1.5,2,3],z5=["avif","webp","jpeg"],M9={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function w9(){try{return await import("ts-images")}catch{return null}}async function I9($,Z={}){let Y={...T9,...Z},J=await w9();if(J)try{return await D9($,Y,J)}catch(G){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${G}`)}return E9($,Y)}async function D9($,Z,Y){let{generatePlaceholder:J,generateThumbHash:G}=Y,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await G($)).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:Q,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 E9($,Z){let Y=Z.width||20,J=Z.height||Y,G="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function l$($,Z,Y={}){let J=Y.transitionDuration||300,G=Y.easing||"ease-out";return`
3015
+ `);for(let W=0;W<X.length;W++)G=G.replace(`\x00CODEBLOCK${W}\x00`,X[W]);if(J)G=G.replace(/\n/g,`<br />
3016
+ `);return G=G.replace(/<p>\s*<\/p>/g,""),G.trim()}async function c$($,Z,Y=""){let J=$,G=/@markdown(?:\(([^)]*)\))?([\s\S]*?)@endmarkdown/g,X=[],Q;while((Q=G.exec($))!==null)X.push({fullMatch:Q[0],options:Q[1]||"",content:Q[2]||"",index:Q.index});for(let{fullMatch:K,options:q,content:_,index:j}of X)try{let B={};if(q)q.split(",").forEach((U)=>{let H=U.trim();if(H)B[H]=!0});let W={gfm:B.gfm??!0,breaks:B.breaks??!1},z=U5(_.trim(),W);J=J.replace(K,z)}catch(B){let W=B instanceof Error?B.message:String(B),z=l("Markdown Directive",`Error processing markdown: ${W}`,Y,$,j,K);J=J.replace(K,z)}return J}async function l$($,Z,Y,J){let G={gfm:!0,breaks:!1};return Z.forEach((X)=>{let Q=X.trim().replace(/['"]/g,"");if(Q==="breaks")G.breaks=!0;if(Q==="no-gfm")G.gfm=!1}),U5($.trim(),G)}var i7=w(()=>{F4()});function I9($){if(M9.set($.name,$),$.client)T9.set($.name,$.client)}function g5($){return I9($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,J,G,X)=>{let Q=w9(J,$.defaults);if($.validate){let q=$.validate(Q);if(q!==!0){let _=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(_)}}let K=Y;if($.transform)K=await $.transform(Y,Q,G,X);if($.clientScript){let q=$.clientScript(Q);K+=`<script>${q}</script>`}if($.css){let q=$.css(Q);K+=`<style>${q}</style>`}return K}}}function w9($,Z){let Y={...Z};for(let J of $){let G=J.indexOf(":"),X=J.indexOf("="),Q=G>=0&&(X<0||G<X)?G:X;if(Q>=0){let K=J.slice(0,Q).trim(),q=J.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=J}}return Y}var M9,T9;var n7=w(()=>{M9=new Map,T9=new Map});function s7($,Z=r4,Y={},J){return Z.sort((G,X)=>G-X).map((G)=>{return`${H5($,{...Y,w:G,fm:J})} ${G}w`}).join(", ")}function i$($,Z,Y=D9,J={},G){return Y.sort((X,Q)=>X-Q).map((X)=>{let Q=Math.round(Z*X);return`${H5($,{...J,w:Q,dpr:X,fm:G})} ${X}x`}).join(", ")}function o7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let J=Object.entries($).map(([G,X])=>{let Q=/^\d+$/.test(G)?`${G}px`:G;return{bp:Q,size:X,numericBp:Number.parseInt(Q)||0}}).sort((G,X)=>G.numericBp-X.numericBp).map(({bp:G,size:X})=>`(max-width: ${G}) ${X}`);return J.push(Z),J.join(", ")}function H5($,Z={}){let Y=Object.entries(Z).filter(([,X])=>X!==void 0&&X!==null).map(([X,Q])=>{if(Array.isArray(Q))return[X,Q.join(",")];return[X,String(Q)]});if(Y.length===0)return $;let J=Y.map(([X,Q])=>`${X}=${encodeURIComponent(Q)}`).join("&"),G=$.includes("?")?"&":"?";return`${$}${G}${J}`}function r7($){return E9[$]||"application/octet-stream"}var r4,D9,z5,E9;var a7=w(()=>{r4=[320,480,640,768,1024,1280,1536,1920,2560],D9=[1,1.5,2,3],z5=["avif","webp","jpeg"],E9={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function S9(){try{return await import("ts-images")}catch{return null}}async function b9($,Z={}){let Y={...k9,...Z},J=await S9();if(J)try{return await P9($,Y,J)}catch(G){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${G}`)}return y9($,Y)}async function P9($,Z,Y){let{generatePlaceholder:J,generateThumbHash:G}=Y,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await G($)).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:Q,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 y9($,Z){let Y=Z.width||20,J=Z.height||Y,G="#e5e7eb",X=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${J}" viewBox="0 0 ${Y} ${J}"><rect fill="#e5e7eb" width="${Y}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(X)}`,width:Y,height:J,aspectRatio:Y/J,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function n$($,Z,Y={}){let J=Y.transitionDuration||300,G=Y.easing||"ease-out";return`
3009
3017
  #${$} {
3010
3018
  --stx-img-transition-duration: ${J}ms;
3011
3019
  --stx-img-transition-easing: ${G};
@@ -3022,7 +3030,7 @@ ${f.dim}${K}${f.reset}
3022
3030
  #${$}.stx-img-loaded img {
3023
3031
  opacity: 1;
3024
3032
  }
3025
- `.trim()}async function i$($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(a7.has(Y))return a7.get(Y);let J=await I9($,Z);return a7.set(Y,J),J}var T9,t7,a7;var n$=I(()=>{T9={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},t7=`
3033
+ `.trim()}async function s$($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(t7.has(Y))return t7.get(Y);let J=await b9($,Z);return t7.set(Y,J),J}var k9,e7,t7;var o$=w(()=>{k9={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},e7=`
3026
3034
  .stx-img-placeholder {
3027
3035
  position: relative;
3028
3036
  overflow: hidden;
@@ -3051,20 +3059,20 @@ ${f.dim}${K}${f.reset}
3051
3059
  filter: blur(0);
3052
3060
  transform: scale(1);
3053
3061
  }
3054
- `.trim();a7=new Map});import{createHash as o$}from"crypto";import{readFile as k9,stat as r$}from"fs/promises";async function _4($){try{let Z=await k9($);return o$("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function s$($){return o$("sha256").update($).digest("hex").slice(0,16)}function g5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${s$($)}-${s$(Y)}`}async function e7($){try{return(await r$($)).mtimeMs}catch{return 0}}async function q4($){try{return await r$($),!0}catch{return!1}}var y4=()=>{};import{mkdir as S9,readFile as b9,writeFile as P9,readdir as gK,rm as y9,stat as hK}from"fs/promises";import{join as t$,dirname as C9}from"path";async function v9($){try{await S9($,{recursive:!0})}catch{}}function e$($,Z,Y){return t$($,Y,`${Z}.json`)}async function a$($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await e7(Z)!==$.srcMtime)return!1;return!0}async function h5($,Z,Y,J=$0){if(!J.enabled)return null;let G=g5($,Z),X=a4.get(G);if(X){if(await a$(X,$,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;a4.delete(G)}let Q=e$(J.directory,G,Y);if(await q4(Q))try{let K=await b9(Q,"utf-8"),q=JSON.parse(K);if(await a$(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),a4.set(G,q),q.data}catch{}return null}async function d5($,Z,Y,J,G=$0){if(!G.enabled)return;let X=g5($,Z),Q=await _4($),K=await e7($),q={key:X,src:$,srcHash:Q,srcMtime:K,optionsHash:g5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};a4.set(X,q);let _=e$(G.directory,X,J);try{await v9(C9(_)),await P9(_,JSON.stringify(q,null,2))}catch(j){console.warn(`[stx-media] Failed to write cache: ${j}`)}}async function m5($,Z=$0){if($==="all")a4.clear();else a4.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let G=t$(Z.directory,J);try{await y9(G,{recursive:!0,force:!0})}catch{}}}var a4,$0;var Z0=I(()=>{y4();a4=new Map,$0={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class p5{config;constructor($={}){this.config={...x9,...$}}async get($,Z){return h5($,Z,"image",this.config)}async set($,Z,Y){return d5($,Z,Y,"image",this.config)}async clear(){return m5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function Y0($){if(!u5)u5=new p5($);else if($)u5.updateConfig($);return u5}async function c5($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return Y0(J).get($,Z)}async function l5($,Z,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return Y0(G).set($,Z,Y)}async function $8(){return Y0().clear()}var x9,u5=null;var J0=I(()=>{Z0();x9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as f9,basename as g9,extname as h9,join as d9}from"path";import{mkdir as m9}from"fs/promises";async function X0(){try{return await import("ts-images")}catch{return null}}function Z8($){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 u9($,Z){let Y=Z?Z8(Z):Z8("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 Y8($,Z,Y){let J=await X0();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let G=await c5($,Z,Y);if(G)return G;try{let X=f9($);if(!await q4(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=u9(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await m9(K,{recursive:!0});let _=await _4(X),j=g9($,h9($)),B=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:_},z=null;if(Z.transformations&&Z.transformations.length>0)z=await G0(X,Z.transformations,J);for(let W of B){let H=Q[W]||{},O=`${j}-${_}.${W}`,F=d9(K,O);try{let L=await J.optimizeImage({input:z||X,output:F,format:W,quality:H.quality,progressive:H.progressive});if(L){if(U.variants.push({path:F,url:`${q}/${O}`,width:L.width||0,height:L.height||0,format:W,size:L.outputSize||0}),!U.originalWidth&&L.width)U.originalWidth=L.width,U.originalHeight=L.height}}catch(L){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${W}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let W=await J.generateThumbHash(X);U.placeholder=W.dataUrl}catch(W){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${W}`)}if(Z.useDominantColor)try{let W=await J.generatePlaceholder(X,{strategy:"dominant-color"});U.dominantColor=W.dominantColor}catch(W){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${W}`)}return await l5($,Z,U,Y),U}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function J8($,Z,Y,J){let G=await X0();if(!G)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await G.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function G0($,Z,Y){let J=Y||await X0();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let G=await J.decode($);for(let X of Z){let Q=X.options||{};switch(X.type){case"resize":if(Q.width||Q.height)G=await J.resize(G,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)G=await J.blur(G,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)G=await J.sharpen(G,Q.amount);break;case"grayscale":G=await J.grayscale(G);break;case"rotate":if(Q.angle!==void 0)G=await J.rotate(G,Q.angle);break;case"flip":G=await J.flip(G);break;case"flop":G=await J.flop(G);break;case"brightness":if(Q.value!==void 0)G=await J.brightness(G,Q.value);break;case"contrast":if(Q.value!==void 0)G=await J.contrast(G,Q.value);break;case"saturation":if(Q.value!==void 0)G=await J.saturation(G,Q.value);break}}return await J.encode(G,"png")}catch(G){return console.error(`[stx-media] Transformation failed: ${G}`),null}}var X8=I(()=>{y4();J0()});import{resolve as p9,basename as c9,extname as l9,join as i9}from"path";import{mkdir as n9}from"fs/promises";async function s9(){try{return await import("ts-images")}catch{return null}}async function G8($,Z,Y){let J=await s9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let G=p9($);if(!await q4(G))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||Y.breakpoints||o9,Q=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await n9(K,{recursive:!0});let _=await _4(G),j=c9($,l9($)),B=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let W of Q){U.byFormat[W]=[];let H=[];for(let O of X){let F=`${j}-${O}w-${_}.${W}`,L=i9(K,F),R=`${q}/${F}`;try{let M=B[W]?.quality||80;if(await q4(L)){U.byFormat[W].push({path:L,url:R,width:O,height:0,format:W,size:0}),H.push(`${R} ${O}w`);continue}let V=await J.processImage({input:G,output:L,format:W,quality:M,resize:{width:O}});if(V)U.byFormat[W].push({path:L,url:R,width:O,height:V.height||Math.round(O*(V.height||1)/(V.width||1)),format:W,size:V.outputSize||0}),H.push(`${R} ${O}w`)}catch(M){console.warn(`[stx-media] Failed to generate ${W} at ${O}w: ${M}`)}}U.srcsets[W]=H.join(", ")}let z=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(z!=="none")try{if(z==="thumbhash"){let W=await J.generateThumbHash(G);U.placeholder={dataURL:W.dataUrl,width:W.width||32,height:W.height||32,strategy:"thumbhash"}}else{let W=await J.generatePlaceholder(G,{strategy:z,width:20});U.placeholder={dataURL:W.dataURL,width:W.width,height:W.height,strategy:z}}}catch(W){console.warn(`[stx-media] Failed to generate placeholder: ${W}`)}return U.sizes=Z.sizes||r9(X),U}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function r9($){let Z=[...$].sort((J,G)=>J-G),Y=[];for(let J=0;J<Z.length-1;J++){let G=Z[J];Y.push(`(max-width: ${G}px) ${G}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function Q8($,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 o9;var K8=I(()=>{y4();o9=[320,480,640,768,1024,1280,1536,1920]});var q8={};o(q8,{setCachedImageResult:()=>l5,processImage:()=>Y8,optimizeImage:()=>J8,getCachedImageResult:()=>c5,generateSrcset:()=>Q8,generateResponsiveVariants:()=>G8,clearImageCache:()=>$8,applyTransformations:()=>G0,ImageProcessorCache:()=>p5});var _8=I(()=>{X8();K8();J0()});async function a9(){try{return await Promise.resolve().then(() => (_8(),q8))}catch($){if(!j8)console.warn("[stx-media] Image processor not available, some features disabled:",$),j8=!0;return null}}async function i5($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return ZJ(J,Y)}if(Y.processedResult?.processed)return _0($,Y.processedResult,Z);if(Y.responsiveVariants)return z8($,Y.responsiveVariants,Z);let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=r4,dpr:j,formats:B=z5,quality:U=Q0,params:z={},placeholder:W="none",placeholderOptions:H={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":s5,decoding:R=n5,fetchpriority:M,objectFit:V,objectPosition:A,crossorigin:N,referrerpolicy:T}=$,D=$.class,E=$.style,k=$.id,w=$.data||{},{isDev:S=!1,baseUrl:m=""}=Z;if(S&&!Z.optimize)return $J($);let c,P,u=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(W!=="none"&&!F)try{c=await i$(G,{strategy:W,...H}),P=l$(u,c,H)}catch{}let X4=j!==void 0&&Q!==void 0,s;if(X4)s=e9($,u,c,Z);else s=await t9($,u,c,Z);let a;if(F){let C=B.includes("webp")?"webp":B[0],b=n7(G,_,{...z,q:U},C),x=typeof q==="object"?s7(q):q||"100vw";a=`<link rel="preload" as="image" imagesrcset="${b}" imagesizes="${x}" />`}let G4=[];if(!B8&&W!=="none")G4.push(t7),B8=!0;if(P)G4.push(P);let h=O?W8(u):void 0;return{html:s,preloadLink:a,css:G4.length>0?G4.join(`
3055
- `):void 0,script:h}}async function t9($,Z,Y,J){let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=r4,formats:j=z5,quality:B=Q0,params:U={},lazy:z=!0,priority:W=!1,loading:H=W?"eager":s5,decoding:O=n5,fetchpriority:F,objectFit:L,objectPosition:R,crossorigin:M,referrerpolicy:V}=$,A=$.class,N=$.style,T=$.data||{},D=typeof q==="object"?s7(q):q||"100vw",E=[];for(let S of j){let m=n7(G,_,{...U,q:B},S),c=o7(S);if(z&&!W)E.push(` <source type="${c}" data-srcset="${m}" data-sizes="${D}" />`);else E.push(` <source type="${c}" srcset="${m}" sizes="${D}" />`)}let k=K0({src:H5(G,{...U,q:B}),alt:X,width:Q,height:K,loading:W?void 0:H,decoding:O,fetchpriority:W?"high":F,objectFit:L,objectPosition:R,crossorigin:M,referrerpolicy:V,className:U8(A,Y),style:q0(N,L,R,Y),lazy:z&&!W,data:T}),w;if(Y){let S=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;w=`<div id="${Z}" class="stx-img-placeholder" style="${S}">
3062
+ `.trim();t7=new Map});import{createHash as a$}from"crypto";import{readFile as C9,stat as t$}from"fs/promises";async function j4($){try{let Z=await C9($);return a$("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function r$($){return a$("sha256").update($).digest("hex").slice(0,16)}function h5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${r$($)}-${r$(Y)}`}async function $0($){try{return(await t$($)).mtimeMs}catch{return 0}}async function _4($){try{return await t$($),!0}catch{return!1}}var C4=()=>{};import{mkdir as x9,readFile as v9,writeFile as f9,readdir as pK,rm as g9,stat as cK}from"fs/promises";import{join as $8,dirname as h9}from"path";async function d9($){try{await x9($,{recursive:!0})}catch{}}function Z8($,Z,Y){return $8($,Y,`${Z}.json`)}async function e$($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await $0(Z)!==$.srcMtime)return!1;return!0}async function d5($,Z,Y,J=Z0){if(!J.enabled)return null;let G=h5($,Z),X=a4.get(G);if(X){if(await e$(X,$,J.maxAge))return X.lastAccessedAt=Date.now(),X.data;a4.delete(G)}let Q=Z8(J.directory,G,Y);if(await _4(Q))try{let K=await v9(Q,"utf-8"),q=JSON.parse(K);if(await e$(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),a4.set(G,q),q.data}catch{}return null}async function m5($,Z,Y,J,G=Z0){if(!G.enabled)return;let X=h5($,Z),Q=await j4($),K=await $0($),q={key:X,src:$,srcHash:Q,srcMtime:K,optionsHash:h5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};a4.set(X,q);let _=Z8(G.directory,X,J);try{await d9(h9(_)),await f9(_,JSON.stringify(q,null,2))}catch(j){console.warn(`[stx-media] Failed to write cache: ${j}`)}}async function u5($,Z=Z0){if($==="all")a4.clear();else a4.clear();let Y=$==="all"?["image","video"]:[$];for(let J of Y){let G=$8(Z.directory,J);try{await g9(G,{recursive:!0,force:!0})}catch{}}}var a4,Z0;var Y0=w(()=>{C4();a4=new Map,Z0={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class c5{config;constructor($={}){this.config={...m9,...$}}async get($,Z){return d5($,Z,"image",this.config)}async set($,Z,Y){return m5($,Z,Y,"image",this.config)}async clear(){return u5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function J0($){if(!p5)p5=new c5($);else if($)p5.updateConfig($);return p5}async function l5($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J0(J).get($,Z)}async function i5($,Z,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return J0(G).set($,Z,Y)}async function Y8(){return J0().clear()}var m9,p5=null;var X0=w(()=>{Y0();m9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as u9,basename as p9,extname as c9,join as l9}from"path";import{mkdir as i9}from"fs/promises";async function G0(){try{return await import("ts-images")}catch{return null}}function J8($){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 n9($,Z){let Y=Z?J8(Z):J8("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 X8($,Z,Y){let J=await G0();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let G=await l5($,Z,Y);if(G)return G;try{let X=u9($);if(!await _4(X))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=n9(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await i9(K,{recursive:!0});let _=await j4(X),j=p9($,c9($)),B=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],W={src:$,processed:!0,variants:[],hash:_},z=null;if(Z.transformations&&Z.transformations.length>0)z=await Q0(X,Z.transformations,J);for(let U of B){let H=Q[U]||{},O=`${j}-${_}.${U}`,F=l9(K,O);try{let L=await J.optimizeImage({input:z||X,output:F,format:U,quality:H.quality,progressive:H.progressive});if(L){if(W.variants.push({path:F,url:`${q}/${O}`,width:L.width||0,height:L.height||0,format:U,size:L.outputSize||0}),!W.originalWidth&&L.width)W.originalWidth=L.width,W.originalHeight=L.height}}catch(L){W.errors=W.errors||[],W.errors.push(`Failed to optimize ${U}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let U=await J.generateThumbHash(X);W.placeholder=U.dataUrl}catch(U){W.errors=W.errors||[],W.errors.push(`Failed to generate thumbhash: ${U}`)}if(Z.useDominantColor)try{let U=await J.generatePlaceholder(X,{strategy:"dominant-color"});W.dominantColor=U.dominantColor}catch(U){W.errors=W.errors||[],W.errors.push(`Failed to extract dominant color: ${U}`)}return await i5($,Z,W,Y),W}catch(X){return{src:$,processed:!1,errors:[`Processing failed: ${X}`]}}}async function G8($,Z,Y,J){let G=await G0();if(!G)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await G.optimizeImage({input:$,output:J,format:Z,quality:Y}))?.outputSize}}catch(X){return{success:!1,error:String(X)}}}async function Q0($,Z,Y){let J=Y||await G0();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let G=await J.decode($);for(let X of Z){let Q=X.options||{};switch(X.type){case"resize":if(Q.width||Q.height)G=await J.resize(G,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)G=await J.blur(G,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)G=await J.sharpen(G,Q.amount);break;case"grayscale":G=await J.grayscale(G);break;case"rotate":if(Q.angle!==void 0)G=await J.rotate(G,Q.angle);break;case"flip":G=await J.flip(G);break;case"flop":G=await J.flop(G);break;case"brightness":if(Q.value!==void 0)G=await J.brightness(G,Q.value);break;case"contrast":if(Q.value!==void 0)G=await J.contrast(G,Q.value);break;case"saturation":if(Q.value!==void 0)G=await J.saturation(G,Q.value);break}}return await J.encode(G,"png")}catch(G){return console.error(`[stx-media] Transformation failed: ${G}`),null}}var Q8=w(()=>{C4();X0()});import{resolve as s9,basename as o9,extname as r9,join as a9}from"path";import{mkdir as t9}from"fs/promises";async function e9(){try{return await import("ts-images")}catch{return null}}async function K8($,Z,Y){let J=await e9();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let G=s9($);if(!await _4(G))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let X=Z.responsiveWidths||Y.breakpoints||$J,Q=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await t9(K,{recursive:!0});let _=await j4(G),j=o9($,r9($)),B=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},W={src:$,byFormat:{},srcsets:{}};for(let U of Q){W.byFormat[U]=[];let H=[];for(let O of X){let F=`${j}-${O}w-${_}.${U}`,L=a9(K,F),A=`${q}/${F}`;try{let M=B[U]?.quality||80;if(await _4(L)){W.byFormat[U].push({path:L,url:A,width:O,height:0,format:U,size:0}),H.push(`${A} ${O}w`);continue}let V=await J.processImage({input:G,output:L,format:U,quality:M,resize:{width:O}});if(V)W.byFormat[U].push({path:L,url:A,width:O,height:V.height||Math.round(O*(V.height||1)/(V.width||1)),format:U,size:V.outputSize||0}),H.push(`${A} ${O}w`)}catch(M){console.warn(`[stx-media] Failed to generate ${U} at ${O}w: ${M}`)}}W.srcsets[U]=H.join(", ")}let z=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(z!=="none")try{if(z==="thumbhash"){let U=await J.generateThumbHash(G);W.placeholder={dataURL:U.dataUrl,width:U.width||32,height:U.height||32,strategy:"thumbhash"}}else{let U=await J.generatePlaceholder(G,{strategy:z,width:20});W.placeholder={dataURL:U.dataURL,width:U.width,height:U.height,strategy:z}}}catch(U){console.warn(`[stx-media] Failed to generate placeholder: ${U}`)}return W.sizes=Z.sizes||ZJ(X),W}catch(X){return console.error(`[stx-media] Responsive generation failed: ${X}`),null}}function ZJ($){let Z=[...$].sort((J,G)=>J-G),Y=[];for(let J=0;J<Z.length-1;J++){let G=Z[J];Y.push(`(max-width: ${G}px) ${G}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function q8($,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 $J;var _8=w(()=>{C4();$J=[320,480,640,768,1024,1280,1536,1920]});var j8={};o(j8,{setCachedImageResult:()=>i5,processImage:()=>X8,optimizeImage:()=>G8,getCachedImageResult:()=>l5,generateSrcset:()=>q8,generateResponsiveVariants:()=>K8,clearImageCache:()=>Y8,applyTransformations:()=>Q0,ImageProcessorCache:()=>c5});var B8=w(()=>{Q8();_8();X0()});async function YJ(){try{return await Promise.resolve().then(() => (B8(),j8))}catch($){if(!W8)console.warn("[stx-media] Image processor not available, some features disabled:",$),W8=!0;return null}}async function n5($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return QJ(J,Y)}if(Y.processedResult?.processed)return j0($,Y.processedResult,Z);if(Y.responsiveVariants)return O8($,Y.responsiveVariants,Z);let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=r4,dpr:j,formats:B=z5,quality:W=K0,params:z={},placeholder:U="none",placeholderOptions:H={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":o5,decoding:A=s5,fetchpriority:M,objectFit:V,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,D=$.class,E=$.style,k=$.id,I=$.data||{},{isDev:S=!1,baseUrl:d=""}=Z;if(S&&!Z.optimize)return GJ($);let c,b,u=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(U!=="none"&&!F)try{c=await s$(G,{strategy:U,...H}),b=n$(u,c,H)}catch{}let Q4=j!==void 0&&Q!==void 0,s;if(Q4)s=XJ($,u,c,Z);else s=await JJ($,u,c,Z);let e;if(F){let y=B.includes("webp")?"webp":B[0],m=s7(G,_,{...z,q:W},y),x=typeof q==="object"?o7(q):q||"100vw";e=`<link rel="preload" as="image" imagesrcset="${m}" imagesizes="${x}" />`}let K4=[];if(!U8&&U!=="none")K4.push(e7),U8=!0;if(b)K4.push(b);let g=O?H8(u):void 0;return{html:s,preloadLink:e,css:K4.length>0?K4.join(`
3063
+ `):void 0,script:g}}async function JJ($,Z,Y,J){let{src:G,alt:X,width:Q,height:K,sizes:q,widths:_=r4,formats:j=z5,quality:B=K0,params:W={},lazy:z=!0,priority:U=!1,loading:H=U?"eager":o5,decoding:O=s5,fetchpriority:F,objectFit:L,objectPosition:A,crossorigin:M,referrerpolicy:V}=$,R=$.class,N=$.style,T=$.data||{},D=typeof q==="object"?o7(q):q||"100vw",E=[];for(let S of j){let d=s7(G,_,{...W,q:B},S),c=r7(S);if(z&&!U)E.push(` <source type="${c}" data-srcset="${d}" data-sizes="${D}" />`);else E.push(` <source type="${c}" srcset="${d}" sizes="${D}" />`)}let k=q0({src:H5(G,{...W,q:B}),alt:X,width:Q,height:K,loading:U?void 0:H,decoding:O,fetchpriority:U?"high":F,objectFit:L,objectPosition:A,crossorigin:M,referrerpolicy:V,className:z8(R,Y),style:_0(N,L,A,Y),lazy:z&&!U,data:T}),I;if(Y){let S=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${Z}" class="stx-img-placeholder" style="${S}">
3056
3064
  <picture>
3057
3065
  ${E.join(`
3058
3066
  `)}
3059
3067
  <img ${k} />
3060
3068
  </picture>
3061
- </div>`}else w=`<picture${Z?` id="${Z}"`:""}>
3069
+ </div>`}else I=`<picture${Z?` id="${Z}"`:""}>
3062
3070
  ${E.join(`
3063
3071
  `)}
3064
3072
  <img ${k} />
3065
- </picture>`;return w}function e9($,Z,Y,J){let{src:G,alt:X,width:Q,height:K,dpr:q=[1,2,3],quality:_=Q0,params:j={},lazy:B=!0,priority:U=!1,loading:z=U?"eager":s5,decoding:W=n5,fetchpriority:H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:R}=$,M=$.class,V=$.style,A=$.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=c$(G,N,q,{...j,q:_}),D=K0({src:H5(G,{...j,w:N,q:_}),alt:X,width:Q,height:K,loading:U?void 0:z,decoding:W,fetchpriority:U?"high":H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:R,className:U8(M,Y),style:q0(V,O,F,Y),lazy:B&&!U,data:A}),E=B&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
3073
+ </picture>`;return I}function XJ($,Z,Y,J){let{src:G,alt:X,width:Q,height:K,dpr:q=[1,2,3],quality:_=K0,params:j={},lazy:B=!0,priority:W=!1,loading:z=W?"eager":o5,decoding:U=s5,fetchpriority:H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:A}=$,M=$.class,V=$.style,R=$.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=i$(G,N,q,{...j,q:_}),D=q0({src:H5(G,{...j,w:N,q:_}),alt:X,width:Q,height:K,loading:W?void 0:z,decoding:U,fetchpriority:W?"high":H,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:A,className:z8(M,Y),style:_0(V,O,F,Y),lazy:B&&!W,data:R}),E=B&&!W?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
3066
3074
  <img ${D} ${E} />
3067
- </div>`}return`<img ${Z?`id="${Z}" `:""}${D} ${E} />`}function $J($){let{src:Z,alt:Y,width:J,height:G,loading:X=s5,decoding:Q=n5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,priority:U=!1}=$,z=$.class,W=$.style,H=$.id,O=$.data||{};return{html:`<img ${K0({src:Z,alt:Y,width:J,height:G,loading:U?"eager":X,decoding:Q,fetchpriority:U?"high":K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,className:z,style:q0(W,q,_),id:H,data:O})} />`}}function K0($){let Z=[];if($.lazy)Z.push(`data-src="${O4($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${O4($.src)}"`);if(Z.push(`alt="${O4($.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="${O4($.className)}"`);if($.style)Z.push(`style="${O4($.style)}"`);if($.id)Z.push(`id="${O4($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${O4(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function U8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function q0($,Z,Y,J){let G=[];if(Z)G.push(`object-fit: ${Z}`);if(Y)G.push(`object-position: ${Y}`);if(J)G.push("opacity: 0; transition: opacity 300ms ease-out");if($)G.push($);return G.join("; ")}function O4($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function W8($){return`
3075
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${D} ${E} />`}function GJ($){let{src:Z,alt:Y,width:J,height:G,loading:X=o5,decoding:Q=s5,fetchpriority:K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,priority:W=!1}=$,z=$.class,U=$.style,H=$.id,O=$.data||{};return{html:`<img ${q0({src:Z,alt:Y,width:J,height:G,loading:W?"eager":X,decoding:Q,fetchpriority:W?"high":K,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B,className:z,style:_0(U,q,_),id:H,data:O})} />`}}function q0($){let Z=[];if($.lazy)Z.push(`data-src="${A4($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${A4($.src)}"`);if(Z.push(`alt="${A4($.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="${A4($.className)}"`);if($.style)Z.push(`style="${A4($.style)}"`);if($.id)Z.push(`id="${A4($.id)}"`);if($.data)for(let[Y,J]of Object.entries($.data))Z.push(`data-${Y}="${A4(J)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function z8($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function _0($,Z,Y,J){let G=[];if(Z)G.push(`object-fit: ${Z}`);if(Y)G.push(`object-position: ${Y}`);if(J)G.push("opacity: 0; transition: opacity 300ms ease-out");if($)G.push($);return G.join("; ")}function A4($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function H8($){return`
3068
3076
  (function() {
3069
3077
  const container = document.getElementById('${$}');
3070
3078
  if (!container) return;
@@ -3101,22 +3109,22 @@ ${E.join(`
3101
3109
 
3102
3110
  observer.observe(container);
3103
3111
  })();
3104
- `.trim()}async function ZJ($,Z){let Y=await a9();if(!Y)return i5({...$,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 z8($,X,Z)}else{let X=await Y.processImage($.src,$,J);if(X.processed)return _0($,X,Z)}return i5({...$,process:!1},Z)}async function _0($,Z,Y){let{alt:J,width:G,height:X,lazy:Q=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B}=$,U=$.class,z=$.style,W=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},O=Z.variants||[],F=O.find((P)=>P.format==="jpeg")||O.find((P)=>P.format==="webp")||O[0],L=F?.url||$.src,R=O.filter((P)=>P.format===(F?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),M=new Map;for(let P of O){if(!M.has(P.format))M.set(P.format,[]);M.get(P.format).push(P)}let V=[],A=["avif","webp","jpeg","png"];for(let P of A){let u=M.get(P);if(u&&u.length>0){let X4=u.map((a)=>`${a.url} ${a.width}w`).join(", "),s=o7(P);if(Q&&!K)V.push(` <source type="${s}" data-srcset="${X4}" />`);else V.push(` <source type="${s}" srcset="${X4}" />`)}}let N=[];if(Q&&!K){if(N.push(`data-src="${O4(L)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),R)N.push(`data-srcset="${R}"`)}else if(N.push(`src="${O4(L)}"`),R)N.push(`srcset="${R}"`);N.push(`alt="${O4(J)}"`);let T=G||Z.originalWidth,D=X||Z.originalHeight;if(T)N.push(`width="${T}"`);if(D)N.push(`height="${D}"`);if(!K)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(j)N.push(`crossorigin="${j}"`);if(B)N.push(`referrerpolicy="${B}"`);let E=[];if(q)E.push(`object-fit: ${q}`);if(_)E.push(`object-position: ${_}`);if(Z.placeholder&&Q)E.push("opacity: 0; transition: opacity 300ms ease-out");if(z)E.push(z);if(E.length>0)N.push(`style="${E.join("; ")}"`);let k=[];if(U)k.push(U);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(Q&&!K)N.push("data-stx-lazy");for(let[P,u]of Object.entries(H))N.push(`data-${P}="${O4(u)}"`);let w;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let P=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;w=`<div id="${W}" class="stx-img-placeholder" style="${P}">
3112
+ `.trim()}async function QJ($,Z){let Y=await YJ();if(!Y)return n5({...$,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 O8($,X,Z)}else{let X=await Y.processImage($.src,$,J);if(X.processed)return j0($,X,Z)}return n5({...$,process:!1},Z)}async function j0($,Z,Y){let{alt:J,width:G,height:X,lazy:Q=!0,priority:K=!1,objectFit:q,objectPosition:_,crossorigin:j,referrerpolicy:B}=$,W=$.class,z=$.style,U=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},O=Z.variants||[],F=O.find((b)=>b.format==="jpeg")||O.find((b)=>b.format==="webp")||O[0],L=F?.url||$.src,A=O.filter((b)=>b.format===(F?.format||"jpeg")).map((b)=>`${b.url} ${b.width}w`).join(", "),M=new Map;for(let b of O){if(!M.has(b.format))M.set(b.format,[]);M.get(b.format).push(b)}let V=[],R=["avif","webp","jpeg","png"];for(let b of R){let u=M.get(b);if(u&&u.length>0){let Q4=u.map((e)=>`${e.url} ${e.width}w`).join(", "),s=r7(b);if(Q&&!K)V.push(` <source type="${s}" data-srcset="${Q4}" />`);else V.push(` <source type="${s}" srcset="${Q4}" />`)}}let N=[];if(Q&&!K){if(N.push(`data-src="${A4(L)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),A)N.push(`data-srcset="${A}"`)}else if(N.push(`src="${A4(L)}"`),A)N.push(`srcset="${A}"`);N.push(`alt="${A4(J)}"`);let T=G||Z.originalWidth,D=X||Z.originalHeight;if(T)N.push(`width="${T}"`);if(D)N.push(`height="${D}"`);if(!K)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(j)N.push(`crossorigin="${j}"`);if(B)N.push(`referrerpolicy="${B}"`);let E=[];if(q)E.push(`object-fit: ${q}`);if(_)E.push(`object-position: ${_}`);if(Z.placeholder&&Q)E.push("opacity: 0; transition: opacity 300ms ease-out");if(z)E.push(z);if(E.length>0)N.push(`style="${E.join("; ")}"`);let k=[];if(W)k.push(W);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)N.push(`class="${k.join(" ")}"`);if(Q&&!K)N.push("data-stx-lazy");for(let[b,u]of Object.entries(H))N.push(`data-${b}="${A4(u)}"`);let I;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let b=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;I=`<div id="${U}" class="stx-img-placeholder" style="${b}">
3105
3113
  <picture>
3106
3114
  ${V.join(`
3107
3115
  `)}
3108
3116
  <img ${N.join(" ")} />
3109
3117
  </picture>
3110
- </div>`}else w=`<picture${W?` id="${W}"`:""}>
3118
+ </div>`}else I=`<picture${U?` id="${U}"`:""}>
3111
3119
  ${V.join(`
3112
3120
  `)}
3113
3121
  <img ${N.join(" ")} />
3114
- </picture>`;let S=[];if(Z.placeholder)S.push(t7);let m=Q?W8(W):void 0,c;if(K&&R)c=`<link rel="preload" as="image" imagesrcset="${R}" />`;return{html:w,preloadLink:c,css:S.length>0?S.join(`
3115
- `):void 0,script:m}}async function z8($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[G,X]of Object.entries(Z.byFormat))if(X)J.variants.push(...X);return _0($,J,Y)}var j8=!1,Q0=80,n5="async",s5="lazy",B8=!1;var H8=I(()=>{r7();n$()});function YJ(){return f5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:G,alt:X,options:Q}=JJ($,Z,Y);if(!G)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:G,alt:X||"",widths:Q.widths||r4,formats:Q.formats||z5,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Y.__isDev||!1,_=await i5(K,{isDev:q}),j=_.html;if(_.preloadLink)j=_.preloadLink+`
3122
+ </picture>`;let S=[];if(Z.placeholder)S.push(e7);let d=Q?H8(U):void 0,c;if(K&&A)c=`<link rel="preload" as="image" imagesrcset="${A}" />`;return{html:I,preloadLink:c,css:S.length>0?S.join(`
3123
+ `):void 0,script:d}}async function O8($,Z,Y){let J={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[G,X]of Object.entries(Z.byFormat))if(X)J.variants.push(...X);return j0($,J,Y)}var W8=!1,K0=80,s5="async",o5="lazy",U8=!1;var L8=w(()=>{a7();o$()});function KJ(){return g5({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,J)=>{let{src:G,alt:X,options:Q}=qJ($,Z,Y);if(!G)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:G,alt:X||"",widths:Q.widths||r4,formats:Q.formats||z5,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Y.__isDev||!1,_=await n5(K,{isDev:q}),j=_.html;if(_.preloadLink)j=_.preloadLink+`
3116
3124
  `+j;if(_.css)j+=`
3117
3125
  <style>${_.css}</style>`;if(_.script)j+=`
3118
- <script>${_.script}</script>`;return j},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function JJ($,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 G=XJ(J),X=j0(G[0],Y)||"",Q=j0(G[1],Y)||"",K={};if(G[2]){let q=j0(G[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof G[2]==="string")try{K=JSON.parse(G[2])}catch{}}return{src:X,alt:Q,options:K}}function XJ($){let Z=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function j0($,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 O8;var L8=I(()=>{i7();H8();r7();O8=YJ()});class r5{config;constructor($={}){this.config={...GJ,...$}}async get($,Z){return h5($,Z,"video",this.config)}async set($,Z,Y){return d5($,Z,Y,"video",this.config)}async clear(){return m5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function B0($){if(!o5)o5=new r5($);else if($)o5.updateConfig($);return o5}async function a5($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return B0(J).get($,Z)}async function t5($,Z,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return B0(G).set($,Z,Y)}async function F8(){return B0().clear()}var GJ,o5=null;var U0=I(()=>{Z0();GJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as W0,basename as z0,extname as H0,join as e5}from"path";import{mkdir as O0}from"fs/promises";async function L0(){try{return await import("ts-videos")}catch{return null}}async function $7($,Z,Y,J){let G=await L0();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=W0($);if(!await q4(X))return null;await O0(Y,{recursive:!0});let Q=await _4(X),K=z0($,H0($)),q=Z.format||"webp",_=Z.timestamp||0,j=`${K}-poster-${Q}.${q}`,B=e5(Y,j),U=await G.extractThumbnails(X,{timestamps:[_],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:j.replace(`.${q}`,"")});if(U&&U.length>0){let z=U[0];return{path:B,url:`${J}/${j}`,width:z.width||Z.width||1280,height:z.height||720,timestamp:_,size:z.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function Z7($,Z,Y,J){let G=await L0();if(!G)return[];try{let X=W0($);if(!await q4(X))return[];await O0(Y,{recursive:!0});let Q=await _4(X),K=z0($,H0($)),q=Z.format||"webp",B=(await new G.Input(X).getInfo()).duration||60,U=Z.count||10,z=Z.interval||B/U,W=[];for(let O=0;O<U&&O*z<B;O++)W.push(O*z);let H=await G.extractThumbnails(X,{timestamps:W,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${Q}`});if(H&&H.length>0)return H.map((O,F)=>({path:O.path||e5(Y,`${K}-thumb-${Q}-${F}.${q}`),url:`${J}/${K}-thumb-${Q}-${F}.${q}`,width:O.width||Z.width||320,height:O.height||180,timestamp:W[F],size:O.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function R8($,Z,Y,J){let G=await L0();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=W0($);if(!await q4(X))return null;await O0(Y,{recursive:!0});let Q=await _4(X),K=z0($,H0($)),j=(await new G.Input(X).getInfo()).duration||60,B=Z.columns||10,U=Z.interval||5,z=Z.thumbnailWidth||160,W=Z.thumbnailHeight||90,H=Z.format||"jpeg",O=Math.ceil(j/U),F=Math.ceil(O/B),L=`${K}-sprite-${Q}.${H}`,R=e5(Y,L),M=[];for(let A=0;A<O;A++)M.push(A*U);let V=await G.extractThumbnails(X,{timestamps:M,width:z,height:W,format:H,quality:Z.quality||70,outputDir:e5(Y,".temp")});if(!V||V.length===0)return null;try{let A=await import("ts-images"),N=B*z,T=F*W,D=await A.createSprite({images:V.map((E)=>E.path),columns:B,padding:0,outputPath:R,format:H,quality:Z.quality||70});return{url:`${J}/${L}`,path:R,columns:B,rows:F,thumbnailWidth:z,thumbnailHeight:W,interval:U,totalFrames:O}}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 F0=I(()=>{y4()});import{resolve as N8,basename as V8,extname as M8,join as C4}from"path";import{mkdir as Y7,writeFile as T8}from"fs/promises";async function w8(){try{return await import("ts-videos")}catch{return null}}async function J7($,Z,Y,J,G){let X=await w8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=N8($);if(!await q4(Q))return null;let K=await _4(Q),q=V8($,M8($)),_=C4(Y,`${q}-${K}-hls`);await Y7(_,{recursive:!0});let j=Z.length>0?Z:I8,B=G?.segmentDuration||6,W=(await new X.Input(Q).getInfo()).duration||0,H=[],O=0;for(let R of j){let M=C4(_,R.label);await Y7(M,{recursive:!0});let V=`${R.label}.m3u8`,A=C4(M,V);try{let N=await X.generateHLS(Q,{outputDir:M,segmentDuration:B,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate,playlistName:R.label});if(N)H.push({quality:R,url:`${J}/${q}-${K}-hls/${R.label}/${V}`,path:A}),O+=N.segmentCount||Math.ceil(W/B)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${R.label}: ${N}`)}}if(H.length===0)return null;let F=C4(_,"master.m3u8"),L=QJ(H,J,q,K);return await T8(F,L),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:O,duration:W}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function QJ($,Z,Y,J){let G=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:Q}=X,K=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;G.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return G.join(`
3119
- `)}async function X7($,Z,Y,J,G){let X=await w8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=N8($);if(!await q4(Q))return null;let K=await _4(Q),q=V8($,M8($)),_=C4(Y,`${q}-${K}-dash`);await Y7(_,{recursive:!0});let j=Z.length>0?Z:I8,B=G?.segmentDuration||4,U=G?.minBufferTime||2,H=(await new X.Input(Q).getInfo()).duration||0,O=[],F=[];for(let V of j){let A=C4(_,V.label);await Y7(A,{recursive:!0});try{if(await X.generateDASH(Q,{outputDir:A,segmentDuration:B,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate})){if(O.push({bandwidth:V.bitrate,width:V.width,height:V.height||Math.round(V.width*9/16),url:`${J}/${q}-${K}-dash/${V.label}/video`}),V.audioBitrate)F.push({bandwidth:V.audioBitrate,url:`${J}/${q}-${K}-dash/${V.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${V.label}: ${N}`)}}if(O.length===0)return null;let L=C4(_,"manifest.mpd"),R=KJ(O,F,H,B,U);await T8(L,R);let M=[{type:"video",representations:O}];if(F.length>0)M.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:M,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function KJ($,Z,Y,J,G){let X=A8(Y),Q=A8(G),K=`<?xml version="1.0" encoding="UTF-8"?>
3126
+ <script>${_.script}</script>`;return j},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function qJ($,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 G=_J(J),X=B0(G[0],Y)||"",Q=B0(G[1],Y)||"",K={};if(G[2]){let q=B0(G[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof G[2]==="string")try{K=JSON.parse(G[2])}catch{}}return{src:X,alt:Q,options:K}}function _J($){let Z=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function B0($,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 F8;var A8=w(()=>{n7();L8();a7();F8=KJ()});class a5{config;constructor($={}){this.config={...jJ,...$}}async get($,Z){return d5($,Z,"video",this.config)}async set($,Z,Y){return m5($,Z,Y,"video",this.config)}async clear(){return u5("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function W0($){if(!r5)r5=new a5($);else if($)r5.updateConfig($);return r5}async function t5($,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return W0(J).get($,Z)}async function e5($,Z,Y,J){let G=J?{directory:`${J.outputDir}/../.cache`}:{};return W0(G).set($,Z,Y)}async function R8(){return W0().clear()}var jJ,r5=null;var U0=w(()=>{Y0();jJ={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as z0,basename as H0,extname as O0,join as $7}from"path";import{mkdir as L0}from"fs/promises";async function F0(){try{return await import("ts-videos")}catch{return null}}async function Z7($,Z,Y,J){let G=await F0();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let X=z0($);if(!await _4(X))return null;await L0(Y,{recursive:!0});let Q=await j4(X),K=H0($,O0($)),q=Z.format||"webp",_=Z.timestamp||0,j=`${K}-poster-${Q}.${q}`,B=$7(Y,j),W=await G.extractThumbnails(X,{timestamps:[_],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:j.replace(`.${q}`,"")});if(W&&W.length>0){let z=W[0];return{path:B,url:`${J}/${j}`,width:z.width||Z.width||1280,height:z.height||720,timestamp:_,size:z.size||0}}return null}catch(X){return console.warn(`[stx-media] Failed to generate poster: ${X}`),null}}async function Y7($,Z,Y,J){let G=await F0();if(!G)return[];try{let X=z0($);if(!await _4(X))return[];await L0(Y,{recursive:!0});let Q=await j4(X),K=H0($,O0($)),q=Z.format||"webp",B=(await new G.Input(X).getInfo()).duration||60,W=Z.count||10,z=Z.interval||B/W,U=[];for(let O=0;O<W&&O*z<B;O++)U.push(O*z);let H=await G.extractThumbnails(X,{timestamps:U,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${Q}`});if(H&&H.length>0)return H.map((O,F)=>({path:O.path||$7(Y,`${K}-thumb-${Q}-${F}.${q}`),url:`${J}/${K}-thumb-${Q}-${F}.${q}`,width:O.width||Z.width||320,height:O.height||180,timestamp:U[F],size:O.size||0}));return[]}catch(X){return console.warn(`[stx-media] Failed to generate thumbnails: ${X}`),[]}}async function N8($,Z,Y,J){let G=await F0();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let X=z0($);if(!await _4(X))return null;await L0(Y,{recursive:!0});let Q=await j4(X),K=H0($,O0($)),j=(await new G.Input(X).getInfo()).duration||60,B=Z.columns||10,W=Z.interval||5,z=Z.thumbnailWidth||160,U=Z.thumbnailHeight||90,H=Z.format||"jpeg",O=Math.ceil(j/W),F=Math.ceil(O/B),L=`${K}-sprite-${Q}.${H}`,A=$7(Y,L),M=[];for(let R=0;R<O;R++)M.push(R*W);let V=await G.extractThumbnails(X,{timestamps:M,width:z,height:U,format:H,quality:Z.quality||70,outputDir:$7(Y,".temp")});if(!V||V.length===0)return null;try{let R=await import("ts-images"),N=B*z,T=F*U,D=await R.createSprite({images:V.map((E)=>E.path),columns:B,padding:0,outputPath:A,format:H,quality:Z.quality||70});return{url:`${J}/${L}`,path:A,columns:B,rows:F,thumbnailWidth:z,thumbnailHeight:U,interval:W,totalFrames:O}}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 A0=w(()=>{C4()});import{resolve as M8,basename as T8,extname as I8,join as x4}from"path";import{mkdir as J7,writeFile as w8}from"fs/promises";async function D8(){try{return await import("ts-videos")}catch{return null}}async function X7($,Z,Y,J,G){let X=await D8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=M8($);if(!await _4(Q))return null;let K=await j4(Q),q=T8($,I8($)),_=x4(Y,`${q}-${K}-hls`);await J7(_,{recursive:!0});let j=Z.length>0?Z:E8,B=G?.segmentDuration||6,U=(await new X.Input(Q).getInfo()).duration||0,H=[],O=0;for(let A of j){let M=x4(_,A.label);await J7(M,{recursive:!0});let V=`${A.label}.m3u8`,R=x4(M,V);try{let N=await X.generateHLS(Q,{outputDir:M,segmentDuration:B,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate,playlistName:A.label});if(N)H.push({quality:A,url:`${J}/${q}-${K}-hls/${A.label}/${V}`,path:R}),O+=N.segmentCount||Math.ceil(U/B)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${A.label}: ${N}`)}}if(H.length===0)return null;let F=x4(_,"master.m3u8"),L=BJ(H,J,q,K);return await w8(F,L),{manifestUrl:`${J}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:O,duration:U}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function BJ($,Z,Y,J){let G=["#EXTM3U","#EXT-X-VERSION:3"];for(let X of $){let{quality:Q}=X,K=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;G.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return G.join(`
3127
+ `)}async function G7($,Z,Y,J,G){let X=await D8();if(!X)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=M8($);if(!await _4(Q))return null;let K=await j4(Q),q=T8($,I8($)),_=x4(Y,`${q}-${K}-dash`);await J7(_,{recursive:!0});let j=Z.length>0?Z:E8,B=G?.segmentDuration||4,W=G?.minBufferTime||2,H=(await new X.Input(Q).getInfo()).duration||0,O=[],F=[];for(let V of j){let R=x4(_,V.label);await J7(R,{recursive:!0});try{if(await X.generateDASH(Q,{outputDir:R,segmentDuration:B,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate})){if(O.push({bandwidth:V.bitrate,width:V.width,height:V.height||Math.round(V.width*9/16),url:`${J}/${q}-${K}-dash/${V.label}/video`}),V.audioBitrate)F.push({bandwidth:V.audioBitrate,url:`${J}/${q}-${K}-dash/${V.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${V.label}: ${N}`)}}if(O.length===0)return null;let L=x4(_,"manifest.mpd"),A=WJ(O,F,H,B,W);await w8(L,A);let M=[{type:"video",representations:O}];if(F.length>0)M.push({type:"audio",representations:F});return{manifestUrl:`${J}/${q}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:M,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function WJ($,Z,Y,J,G){let X=V8(Y),Q=V8(G),K=`<?xml version="1.0" encoding="UTF-8"?>
3120
3128
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
3121
3129
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3122
3130
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -3142,8 +3150,8 @@ ${V.join(`
3142
3150
  </Representation>
3143
3151
  `}K+=` </AdaptationSet>
3144
3152
  `}return K+=` </Period>
3145
- </MPD>`,K}function A8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),G="PT";if(Z>0)G+=`${Z}H`;if(Y>0)G+=`${Y}M`;return G+=`${J}S`,G}var I8;var R0=I(()=>{y4();I8=[{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 D8,basename as qJ,extname as _J,join as jJ}from"path";import{mkdir as BJ}from"fs/promises";async function E8(){try{return await import("ts-videos")}catch{return null}}function UJ($){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 WJ($){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 A0($){let Z=await E8();if(!Z)return null;try{let Y=D8($),G=await new Z.Input(Y).getInfo();return{duration:G.duration||0,width:G.width||0,height:G.height||0,frameRate:G.frameRate||0,bitrate:G.bitrate||0,codec:G.videoCodec||"",audioCodec:G.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function k8($,Z,Y,J){let G=await E8();if(!G)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await a5($,Z,Y);if(X)return X;try{let Q=D8($);if(!await q4(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await BJ(K,{recursive:!0});let _=await _4(Q),j=qJ($,_J($)),B={src:$,processed:!0,hash:_};J?.({percentage:5,stage:"analyzing"}),B.metadata=await A0(Q)||void 0;let U={};if(Z.quality)U.bitrate=UJ(Z.quality);if(Z.platform)Object.assign(U,WJ(Z.platform));if(Z.transcode)Object.assign(U,Z.transcode);if(Object.keys(U).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let z=`${j}-${_}.mp4`,W=jJ(K,z);try{let H=await zJ(Q,W,U,G,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)B.transcoded={path:W,url:`${q}/${z}`,duration:H.duration,size:H.size,video:{codec:U.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(H){B.errors=B.errors||[],B.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let z=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},W=await $7(Q,z,K,q);if(W)B.poster=W}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let z=await Z7(Q,Y.thumbnails,K,q);if(z.length>0)B.thumbnails=z}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let z=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(z.format==="hls"||z.format===void 0){let W=await J7(Q,z.qualities||Y.streaming?.defaultQualities||[],K,q);if(W)B.streaming={...B.streaming,hls:W}}if(z.format==="dash"){let W=await X7(Q,z.qualities||Y.streaming?.defaultQualities||[],K,q);if(W)B.streaming={...B.streaming,dash:W}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await t5($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function zJ($,Z,Y,J,G){try{let Q=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{G?.(K.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Y.maxWidth||0,height:Q.height||Y.maxHeight||0,bitrate:Q.bitrate||Y.bitrate||0,frameRate:Q.frameRate||Y.frameRate||30,audioCodec:Q.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var S8=I(()=>{y4();U0();F0();R0()});var b8={};o(b8,{setCachedVideoResult:()=>t5,processVideo:()=>k8,getCachedVideoResult:()=>a5,generateThumbnails:()=>Z7,generateSpriteSheet:()=>R8,generatePoster:()=>$7,generateHLSManifest:()=>J7,generateDASHManifest:()=>X7,clearVideoCache:()=>F8,analyzeVideo:()=>A0,VideoProcessorCache:()=>r5});var P8=I(()=>{S8();F0();R0();U0()});async function C8(){try{return await Promise.resolve().then(() => (P8(),b8))}catch($){if(!y8)console.warn("[stx-media] Video processor not available, some features disabled:",$),y8=!0;return null}}async function G7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return AJ(J,Y)}if(Y.processedResult?.processed)return g8($,Y.processedResult,Z);let G;if(J.generatePoster&&J.src&&!$.poster)G=await NJ(J,Y);let{src:X,sources:Q=[],poster:K,posterPlaceholder:q,controls:_=v8,autoplay:j=!1,muted:B=!1,loop:U=!1,preload:z=x8,playsinline:W=!0,lazy:H=!0,player:O="native",type:F,width:L,height:R,crossorigin:M,disablePictureInPicture:V=!1,disableRemotePlayback:A=!1}=$,N=G||K,T=$.class,D=$.style,E=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return LJ($,Z);if(F&&F!=="video")return OJ(X||"",F,$);let k=Q.length>0?Q:X?[{src:X,type:f8(X)}]:[],w=[`id="${E}"`];if(_)w.push("controls");if(j)w.push("autoplay");if(B)w.push("muted");if(U)w.push("loop");if(W)w.push("playsinline");if(V)w.push("disablepictureinpicture");if(A)w.push("disableremoteplayback");if(M)w.push(`crossorigin="${M}"`);if(H){if(w.push(`data-preload="${z}"`),w.push('preload="none"'),N)w.push(`data-poster="${Y4(N)}"`);w.push("data-stx-lazy")}else if(w.push(`preload="${z}"`),N)w.push(`poster="${Y4(N)}"`);if(L)w.push(`width="${L}"`);if(R)w.push(`height="${R}"`);if(T)w.push(`class="${Y4(T)}"`);if(D)w.push(`style="${Y4(D)}"`);let S=k.map((P)=>{return` <source ${H?`data-src="${Y4(P.src)}"`:`src="${Y4(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
3146
- `),m=`<video ${w.join(" ")}>
3153
+ </MPD>`,K}function V8($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),J=Math.floor($%60),G="PT";if(Z>0)G+=`${Z}H`;if(Y>0)G+=`${Y}M`;return G+=`${J}S`,G}var E8;var R0=w(()=>{C4();E8=[{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 k8,basename as UJ,extname as zJ,join as HJ}from"path";import{mkdir as OJ}from"fs/promises";async function S8(){try{return await import("ts-videos")}catch{return null}}function LJ($){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 FJ($){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 N0($){let Z=await S8();if(!Z)return null;try{let Y=k8($),G=await new Z.Input(Y).getInfo();return{duration:G.duration||0,width:G.width||0,height:G.height||0,frameRate:G.frameRate||0,bitrate:G.bitrate||0,codec:G.videoCodec||"",audioCodec:G.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function b8($,Z,Y,J){let G=await S8();if(!G)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let X=await t5($,Z,Y);if(X)return X;try{let Q=k8($);if(!await _4(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await OJ(K,{recursive:!0});let _=await j4(Q),j=UJ($,zJ($)),B={src:$,processed:!0,hash:_};J?.({percentage:5,stage:"analyzing"}),B.metadata=await N0(Q)||void 0;let W={};if(Z.quality)W.bitrate=LJ(Z.quality);if(Z.platform)Object.assign(W,FJ(Z.platform));if(Z.transcode)Object.assign(W,Z.transcode);if(Object.keys(W).length>0||Z.process){J?.({percentage:10,stage:"transcoding"});let z=`${j}-${_}.mp4`,U=HJ(K,z);try{let H=await AJ(Q,U,W,G,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)B.transcoded={path:U,url:`${q}/${z}`,duration:H.duration,size:H.size,video:{codec:W.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:W.audioCodec||"aac",bitrate:W.audioBitrate||128000,sampleRate:W.sampleRate||48000,channels:W.channels||2}:void 0}}catch(H){B.errors=B.errors||[],B.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){J?.({percentage:65,stage:"generating-poster"});let z=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},U=await Z7(Q,z,K,q);if(U)B.poster=U}if(Y.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let z=await Y7(Q,Y.thumbnails,K,q);if(z.length>0)B.thumbnails=z}if(Z.streaming){J?.({percentage:80,stage:"generating-manifests"});let z=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(z.format==="hls"||z.format===void 0){let U=await X7(Q,z.qualities||Y.streaming?.defaultQualities||[],K,q);if(U)B.streaming={...B.streaming,hls:U}}if(z.format==="dash"){let U=await G7(Q,z.qualities||Y.streaming?.defaultQualities||[],K,q);if(U)B.streaming={...B.streaming,dash:U}}}if(Z.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await e5($,Z,B,Y),B}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function AJ($,Z,Y,J,G){try{let Q=await new J.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{G?.(K.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Y.maxWidth||0,height:Q.height||Y.maxHeight||0,bitrate:Q.bitrate||Y.bitrate||0,frameRate:Q.frameRate||Y.frameRate||30,audioCodec:Q.audioCodec}}catch(X){return console.error(`[stx-media] Transcoding failed: ${X}`),null}}var P8=w(()=>{C4();U0();A0();R0()});var y8={};o(y8,{setCachedVideoResult:()=>e5,processVideo:()=>b8,getCachedVideoResult:()=>t5,generateThumbnails:()=>Y7,generateSpriteSheet:()=>N8,generatePoster:()=>Z7,generateHLSManifest:()=>X7,generateDASHManifest:()=>G7,clearVideoCache:()=>R8,analyzeVideo:()=>N0,VideoProcessorCache:()=>a5});var C8=w(()=>{P8();A0();R0();U0()});async function v8(){try{return await Promise.resolve().then(() => (C8(),y8))}catch($){if(!x8)console.warn("[stx-media] Video processor not available, some features disabled:",$),x8=!0;return null}}async function Q7($,Z={}){let Y=Z,J=$;if(J.process&&!J.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return IJ(J,Y)}if(Y.processedResult?.processed)return d8($,Y.processedResult,Z);let G;if(J.generatePoster&&J.src&&!$.poster)G=await wJ(J,Y);let{src:X,sources:Q=[],poster:K,posterPlaceholder:q,controls:_=f8,autoplay:j=!1,muted:B=!1,loop:W=!1,preload:z=g8,playsinline:U=!0,lazy:H=!0,player:O="native",type:F,width:L,height:A,crossorigin:M,disablePictureInPicture:V=!1,disableRemotePlayback:R=!1}=$,N=G||K,T=$.class,D=$.style,E=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return VJ($,Z);if(F&&F!=="video")return NJ(X||"",F,$);let k=Q.length>0?Q:X?[{src:X,type:h8(X)}]:[],I=[`id="${E}"`];if(_)I.push("controls");if(j)I.push("autoplay");if(B)I.push("muted");if(W)I.push("loop");if(U)I.push("playsinline");if(V)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(M)I.push(`crossorigin="${M}"`);if(H){if(I.push(`data-preload="${z}"`),I.push('preload="none"'),N)I.push(`data-poster="${X4(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${z}"`),N)I.push(`poster="${X4(N)}"`);if(L)I.push(`width="${L}"`);if(A)I.push(`height="${A}"`);if(T)I.push(`class="${X4(T)}"`);if(D)I.push(`style="${X4(D)}"`);let S=k.map((b)=>{return` <source ${H?`data-src="${X4(b.src)}"`:`src="${X4(b.src)}"`} type="${b.type}"${b.media?` media="${b.media}"`:""} />`}).join(`
3154
+ `),d=`<video ${I.join(" ")}>
3147
3155
  ${S}
3148
3156
  Your browser does not support the video tag.
3149
3157
  </video>`,c;if(H)c=`
@@ -3181,12 +3189,12 @@ ${S}
3181
3189
 
3182
3190
  observer.observe(video);
3183
3191
  })();
3184
- `.trim();return{html:m,script:c}}function OJ($,Z,Y){let{width:J=640,height:G=360}=Y,X=Y.class,Q=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Z){case"youtube":_=FJ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=RJ($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let j=[`id="${K}"`,`src="${Y4(q)}"`,`width="${J}"`,`height="${G}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)j.push(`class="${Y4(X)}"`);if(Q)j.push(`style="${Y4(Q)}"`);if(Y.lazy)j.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
3192
+ `.trim();return{html:d,script:c}}function NJ($,Z,Y){let{width:J=640,height:G=360}=Y,X=Y.class,Q=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,_=null;switch(Z){case"youtube":_=MJ($),q=_?`https://www.youtube-nocookie.com/embed/${_}`:$;break;case"vimeo":_=TJ($),q=_?`https://player.vimeo.com/video/${_}`:$;break;case"dailymotion":_=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${_}`;break;case"twitch":_=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${_}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let j=[`id="${K}"`,`src="${X4(q)}"`,`width="${J}"`,`height="${G}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(X)j.push(`class="${X4(X)}"`);if(Q)j.push(`style="${X4(Q)}"`);if(Y.lazy)j.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
3185
3193
  <iframe ${j.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
3186
- </div>`}}function LJ($,Z={}){let{src:Y,sources:J=[],poster:G,controls:X=!0,autoplay:Q=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:j=!0,lazy:B=!0,width:U,height:z}=$,W=$.class,H=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:Q,loop:q,muted:K,playsinline:j,preload:_,poster:G,controls:X,title:$.title},L=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",z?`height: ${typeof z==="number"?z+"px":z}`:"",H||""].filter(Boolean).join("; "),R=`
3194
+ </div>`}}function VJ($,Z={}){let{src:Y,sources:J=[],poster:G,controls:X=!0,autoplay:Q=!1,muted:K=!1,loop:q=!1,preload:_="metadata",playsinline:j=!0,lazy:B=!0,width:W,height:z}=$,U=$.class,H=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:J.length>0?J:Y,autoplay:Q,loop:q,muted:K,playsinline:j,preload:_,poster:G,controls:X,title:$.title},L=["position: relative",W?`width: ${typeof W==="number"?W+"px":W}`:"width: 100%",z?`height: ${typeof z==="number"?z+"px":z}`:"",H||""].filter(Boolean).join("; "),A=`
3187
3195
  <div
3188
3196
  id="${O}"
3189
- class="ts-video-player${W?" "+Y4(W):""}"
3197
+ class="ts-video-player${U?" "+X4(U):""}"
3190
3198
  style="${L}"
3191
3199
  data-ts-video-player
3192
3200
  data-config='${JSON.stringify(F)}'
@@ -3194,7 +3202,7 @@ ${S}
3194
3202
  >
3195
3203
  <div class="ts-video-player__container">
3196
3204
  ${G?`
3197
- <div class="ts-video-player__placeholder" style="background-image: url('${Y4(G)}');">
3205
+ <div class="ts-video-player__placeholder" style="background-image: url('${X4(G)}');">
3198
3206
  <button class="ts-video-player__play-button" aria-label="Play video">
3199
3207
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
3200
3208
  <path d="M8 5v14l11-7z"/>
@@ -3220,7 +3228,7 @@ ${S}
3220
3228
 
3221
3229
  // Load ts-video-player from CDN
3222
3230
  var script = document.createElement('script');
3223
- script.src = '${HJ}';
3231
+ script.src = '${RJ}';
3224
3232
  script.onload = initPlayer;
3225
3233
  script.onerror = function() {
3226
3234
  console.error('[stx] Failed to load ts-video-player');
@@ -3348,12 +3356,12 @@ ${S}
3348
3356
  .ts-video-player__play-button svg {
3349
3357
  margin-left: 4px;
3350
3358
  }
3351
- `.trim();return{html:R,script:M,css:V}}function f8($){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 FJ($){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 RJ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function Y4($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function AJ($,Z){let Y=await C8();if(!Y)return G7({...$,process:!1},Z);let J=Z.tsVideosConfig,G=await Y.processVideo($.src,$,J,$.onProcessProgress);if(G.processed)return g8($,G,Z);return G7({...$,process:!1},Z)}async function NJ($,Z){let Y=await C8();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},G=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,G.outputDir,G.baseUrl||"/videos"))?.url}function g8($,Z,Y){let{controls:J=v8,autoplay:G=!1,muted:X=!1,loop:Q=!1,preload:K=x8,playsinline:q=!0,lazy:_=!0,width:j,height:B,crossorigin:U,disablePictureInPicture:z=!1,disableRemotePlayback:W=!1}=$,H=$.class,O=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,R=f8(L);if(Z.transcoded)L=Z.transcoded.url,R="video/mp4";let M=Z.streaming?.hls||Z.streaming?.dash;if(M){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,R="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,R="application/dash+xml"}let V=Z.poster?.url||$.poster,A=[`id="${F}"`];if(J)A.push("controls");if(G)A.push("autoplay");if(X)A.push("muted");if(Q)A.push("loop");if(q)A.push("playsinline");if(z)A.push("disablepictureinpicture");if(W)A.push("disableremoteplayback");if(U)A.push(`crossorigin="${U}"`);if(_){if(A.push(`data-preload="${K}"`),A.push('preload="none"'),V)A.push(`data-poster="${Y4(V)}"`);A.push("data-stx-lazy")}else if(A.push(`preload="${K}"`),V)A.push(`poster="${Y4(V)}"`);let N=j||Z.metadata?.width,T=B||Z.metadata?.height;if(N)A.push(`width="${N}"`);if(T)A.push(`height="${T}"`);if(H)A.push(`class="${Y4(H)}"`);if(O)A.push(`style="${Y4(O)}"`);let E=` <source ${_?`data-src="${Y4(L)}"`:`src="${Y4(L)}"`} type="${R}" />`,k=`<video ${A.join(" ")}>
3359
+ `.trim();return{html:A,script:M,css:V}}function h8($){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 MJ($){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 TJ($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function X4($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function IJ($,Z){let Y=await v8();if(!Y)return Q7({...$,process:!1},Z);let J=Z.tsVideosConfig,G=await Y.processVideo($.src,$,J,$.onProcessProgress);if(G.processed)return d8($,G,Z);return Q7({...$,process:!1},Z)}async function wJ($,Z){let Y=await v8();if(!Y||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},G=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,J,G.outputDir,G.baseUrl||"/videos"))?.url}function d8($,Z,Y){let{controls:J=f8,autoplay:G=!1,muted:X=!1,loop:Q=!1,preload:K=g8,playsinline:q=!0,lazy:_=!0,width:j,height:B,crossorigin:W,disablePictureInPicture:z=!1,disableRemotePlayback:U=!1}=$,H=$.class,O=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,A=h8(L);if(Z.transcoded)L=Z.transcoded.url,A="video/mp4";let M=Z.streaming?.hls||Z.streaming?.dash;if(M){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,A="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,A="application/dash+xml"}let V=Z.poster?.url||$.poster,R=[`id="${F}"`];if(J)R.push("controls");if(G)R.push("autoplay");if(X)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(z)R.push("disablepictureinpicture");if(U)R.push("disableremoteplayback");if(W)R.push(`crossorigin="${W}"`);if(_){if(R.push(`data-preload="${K}"`),R.push('preload="none"'),V)R.push(`data-poster="${X4(V)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${K}"`),V)R.push(`poster="${X4(V)}"`);let N=j||Z.metadata?.width,T=B||Z.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(H)R.push(`class="${X4(H)}"`);if(O)R.push(`style="${X4(O)}"`);let E=` <source ${_?`data-src="${X4(L)}"`:`src="${X4(L)}"`} type="${A}" />`,k=`<video ${R.join(" ")}>
3352
3360
  ${E}
3353
3361
  Your browser does not support the video tag.
3354
- </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${Y4(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
3362
+ </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${X4(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
3355
3363
  ${k}
3356
- </div>`;let w;if(_)w=`
3364
+ </div>`;let I;if(_)I=`
3357
3365
  (function() {
3358
3366
  var video = document.getElementById('${F}');
3359
3367
  if (!video) return;
@@ -3397,9 +3405,9 @@ ${k}
3397
3405
  width: 100%;
3398
3406
  height: auto;
3399
3407
  }
3400
- `.trim();return{html:k,script:w,css:S}}var y8=!1,v8=!0,x8="metadata",HJ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var h8=I(()=>{V0()});function d8(){return f5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:G,options:X}=VJ($,Z,Y);if(!G)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:G,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await G7(Q,q),j=_.html;if(_.css)j+=`
3408
+ `.trim();return{html:k,script:I,css:S}}var x8=!1,f8=!0,g8="metadata",RJ="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var m8=w(()=>{M0()});function u8(){return g5({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,J)=>{let{src:G,options:X}=DJ($,Z,Y);if(!G)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:G,poster:X.poster,controls:X.controls!==!1,autoplay:X.autoplay||!1,muted:X.muted||!1,loop:X.loop||!1,preload:X.preload||"metadata",playsinline:X.playsinline!==!1,lazy:X.lazy!==!1,player:X.player||"native",type:X.type,width:X.width,height:X.height,class:X.class,style:X.style,id:X.id,crossorigin:X.crossorigin,disablePictureInPicture:X.disablePictureInPicture,disableRemotePlayback:X.disableRemotePlayback,title:X.title,quality:X.quality,platform:X.platform,process:X.process,generatePoster:X.generatePoster,streaming:X.streaming,transcode:X.transcode,spriteSheet:X.spriteSheet,waveform:X.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},_=await Q7(Q,q),j=_.html;if(_.css)j+=`
3401
3409
  <style>${_.css}</style>`;if(_.script)j+=`
3402
- <script>${_.script}</script>`;return j},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function VJ($,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 G=MJ(J),X=m8(G[0],Y)||"",Q={};if(G[1]){let K=m8(G[1],Y);if(typeof K==="object"&&K!==null)Q=K;else if(typeof G[1]==="string")try{Q=JSON.parse(G[1])}catch{}}return{src:X,options:Q}}function MJ($){let Z=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function m8($,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 N0;var V0=I(()=>{i7();h8();N0=d8()});function TJ($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
3410
+ <script>${_.script}</script>`;return j},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function DJ($,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 G=EJ(J),X=p8(G[0],Y)||"",Q={};if(G[1]){let K=p8(G[1],Y);if(typeof K==="object"&&K!==null)Q=K;else if(typeof G[1]==="string")try{Q=JSON.parse(G[1])}catch{}}return{src:X,options:Q}}function EJ($){let Z=[],Y="",J=!1,G="",X=0,Q=0;for(let K=0;K<$.length;K++){let q=$[K],_=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&_!=="\\"){if(!J)J=!0,G=q;else if(q===G)J=!1,G="";else Y+=q;continue}if(!J){if(q==="{")X++;if(q==="}")X--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&X===0&&Q===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function p8($,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 V0;var M0=w(()=>{n7();m8();V0=u8()});function kJ($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
3403
3411
  ${$}
3404
3412
  </div>
3405
3413
  <script>
@@ -3444,7 +3452,7 @@ ${k}
3444
3452
  }
3445
3453
  }
3446
3454
  })();
3447
- </script>`}function wJ($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",G=Y?.autoReload||!1,X=$.trim().length>0,Q=`
3455
+ </script>`}function SJ($,Z){let Y=Z.pwa?.updates,J=Y?.message||"A new version is available. Reload to update?",G=Y?.autoReload||!1,X=$.trim().length>0,Q=`
3448
3456
  <div class="stx-pwa-update-banner" style="
3449
3457
  position: fixed;
3450
3458
  bottom: 0;
@@ -3553,7 +3561,7 @@ ${k}
3553
3561
  // Also listen for custom event
3554
3562
  window.addEventListener('pwa-update-available', showUpdate);
3555
3563
  })();
3556
- </script>`}function IJ($,Z){let Y=$.trim().length>0,J=`
3564
+ </script>`}function bJ($,Z){let Y=$.trim().length>0,J=`
3557
3565
  <div class="stx-offline-indicator" style="
3558
3566
  position: fixed;
3559
3567
  top: 16px;
@@ -3614,7 +3622,7 @@ ${k}
3614
3622
  window.addEventListener('offline', updateStatus);
3615
3623
  updateStatus();
3616
3624
  })();
3617
- </script>`}function DJ($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",G=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
3625
+ </script>`}function PJ($,Z){let Y=Z.pwa?.push,J=Y?.vapidPublicKey||"",G=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
3618
3626
  ${$}
3619
3627
  </div>
3620
3628
  <script>
@@ -3695,71 +3703,71 @@ ${k}
3695
3703
  init();
3696
3704
  }
3697
3705
  })();
3698
- </script>`}function gq($){return[...$,...M0]}var EJ,kJ,SJ,bJ,M0;var T0=I(()=>{EJ={name:"pwa.installButton",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return TJ($,G)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},kJ={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return wJ($,G)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},SJ={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return IJ($,G)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},bJ={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return DJ($,G)},hasEndTag:!0,description:"Renders a push notification subscription button"},M0=[EJ,kJ,SJ,bJ]});function w0($){for(let[Z,Y]of Object.entries(y))if(Y===$)return Z;return}var y;var Q7=I(()=>{y={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});import u8 from"process";function PJ(){return u8.env.NODE_ENV==="production"}function O5(){return!PJ()||u8.env.STX_DEBUG==="true"}var I0=()=>{};import yJ from"path";import CJ from"process";function K7(){return{...D0}}function q7($){if(!D0.showRelativePaths||!$)return $;let Z=D0.baseDir||CJ.cwd();try{let Y=yJ.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var vJ,D0,_7,v4,L5;var j7=I(()=>{I0();Q7();vJ={showRelativePaths:!1,enableAutoRecovery:O5(),logRecoveryWarnings:!0},D0={...vJ};_7=class _7 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,G,X,Q){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=G;this.context=X;if(this.name="StxError",this.numericCode=Q||y.EVALUATION_ERROR,this.filePath)this.filePath=q7(this.filePath)}};v4=class v4 extends _7{constructor($,Z,Y,J,G,X){super($,"stx_RUNTIME_ERROR",Z,Y,J,G,X||y.EVALUATION_ERROR);this.name="StxRuntimeError"}};L5=class L5 extends _7{isFatal=!0;constructor($,Z,Y,J,G,X){super($,"stx_VALIDATION_ERROR",Z,Y,J,G,X||y.DOM_API_VIOLATION);this.name="StxValidationError"}}});function c8($){let{type:Z,message:Y,code:J,filePath:G,line:X,column:Q,template:K,offset:q,snippet:_,suggestion:j,format:B="text"}=$,U=X,z=Q;if(!U&&K&&q!==void 0){let L=mJ(K,q);U=L.line,z=L.column}let W=G?q7(G):void 0,H=J?w0(J):void 0,O={type:Z,code:J,codeName:H,message:Y,filePath:W,line:U,column:z,snippet:_,suggestion:j,timestamp:new Date().toISOString()},F;switch(B){case"html":F=fJ(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=gJ(O,K,q);break;case"text":default:F=xJ(O,K,q);break}return{formatted:F,data:O}}function xJ($,Z,Y){let J=[],G=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${G}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}J.push(`at ${X}`)}if(J.push(`
3699
- ${$.message}`),Z&&$.line){let X=hJ(Z,$.line,2);if(X)J.push(`
3706
+ </script>`}function pq($){return[...$,...T0]}var yJ,CJ,xJ,vJ,T0;var I0=w(()=>{yJ={name:"pwa.installButton",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return kJ($,G)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},CJ={name:"pwa.updatePrompt",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return SJ($,G)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},xJ={name:"pwa.offlineIndicator",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return bJ($,G)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},vJ={name:"pwa.pushSubscribe",handler:($,Z,Y,J)=>{let G=Y.__stx_options||{};return PJ($,G)},hasEndTag:!0,description:"Renders a push notification subscription button"},T0=[yJ,CJ,xJ,vJ]});function w0($){for(let[Z,Y]of Object.entries(P))if(Y===$)return Z;return}var P;var K7=w(()=>{P={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});import c8 from"process";function fJ(){return c8.env.NODE_ENV==="production"}function O5(){return!fJ()||c8.env.STX_DEBUG==="true"}var D0=()=>{};import gJ from"path";import hJ from"process";function q7(){return{...E0}}function _7($){if(!E0.showRelativePaths||!$)return $;let Z=E0.baseDir||hJ.cwd();try{let Y=gJ.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var dJ,E0,j7,v4,B7;var W7=w(()=>{D0();K7();dJ={showRelativePaths:!1,enableAutoRecovery:O5(),logRecoveryWarnings:!0},E0={...dJ};j7=class j7 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,J,G,X,Q){super($);this.code=Z;this.filePath=Y;this.line=J;this.column=G;this.context=X;if(this.name="StxError",this.numericCode=Q||P.EVALUATION_ERROR,this.filePath)this.filePath=_7(this.filePath)}};v4=class v4 extends j7{constructor($,Z,Y,J,G,X){super($,"stx_RUNTIME_ERROR",Z,Y,J,G,X||P.EVALUATION_ERROR);this.name="StxRuntimeError"}};B7=class B7 extends j7{isFatal=!0;constructor($,Z,Y,J,G,X){super($,"stx_VALIDATION_ERROR",Z,Y,J,G,X||P.DOM_API_VIOLATION);this.name="StxValidationError"}}});function i8($){let{type:Z,message:Y,code:J,filePath:G,line:X,column:Q,template:K,offset:q,snippet:_,suggestion:j,format:B="text"}=$,W=X,z=Q;if(!W&&K&&q!==void 0){let L=iJ(K,q);W=L.line,z=L.column}let U=G?_7(G):void 0,H=J?w0(J):void 0,O={type:Z,code:J,codeName:H,message:Y,filePath:U,line:W,column:z,snippet:_,suggestion:j,timestamp:new Date().toISOString()},F;switch(B){case"html":F=uJ(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=pJ(O,K,q);break;case"text":default:F=mJ(O,K,q);break}return{formatted:F,data:O}}function mJ($,Z,Y){let J=[],G=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${G}]`),$.filePath){let X=$.filePath;if($.line){if(X+=`:${$.line}`,$.column)X+=`:${$.column}`}J.push(`at ${X}`)}if(J.push(`
3707
+ ${$.message}`),Z&&$.line){let X=cJ(Z,$.line,2);if(X)J.push(`
3700
3708
  ${X}`)}if($.snippet)J.push(`
3701
3709
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
3702
- Suggestion: ${$.suggestion}`);return J.join(" ")}function fJ($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${Z}]${Y}: ${p8($.message)}`;if($.suggestion)J+=` | Suggestion: ${p8($.suggestion)}`;return J+=" -->",J}function gJ($,Z,Y){let _=[],j=$.code?` [${$.codeName||$.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${j} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let B=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(B+=`\x1B[90m:${$.line}\x1B[0m`,$.column)B+=`\x1B[90m:${$.column}\x1B[0m`}_.push(`
3710
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function uJ($){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 pJ($,Z,Y){let _=[],j=$.code?` [${$.codeName||$.code}]`:"";if(_.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${j} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let B=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(B+=`\x1B[90m:${$.line}\x1B[0m`,$.column)B+=`\x1B[90m:${$.column}\x1B[0m`}_.push(`
3703
3711
  \x1B[90mat\x1B[0m ${B}`)}if(_.push(`
3704
3712
 
3705
- ${$.message}`),Z&&$.line){let B=dJ(Z,$.line,2);if(B)_.push(`
3713
+ ${$.message}`),Z&&$.line){let B=lJ(Z,$.line,2);if(B)_.push(`
3706
3714
 
3707
3715
  \x1B[90mContext:\x1B[0m
3708
3716
  ${B}`)}if($.suggestion)_.push(`
3709
3717
 
3710
3718
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return _.push(`
3711
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),_.join("")}function hJ($,Z,Y){let J=$.split(`
3719
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),_.join("")}function cJ($,Z,Y){let J=$.split(`
3712
3720
  `),G=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),Q=[];for(let K=G;K<=X;K++){let q=(K+1).toString().padStart(4),_=K===Z-1?">":" ";Q.push(`${_}${q} | ${J[K]}`)}return Q.join(`
3713
- `)}function dJ($,Z,Y){let J=$.split(`
3714
- `),G=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),Q="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let j=G;j<=X;j++){let B=(j+1).toString().padStart(4),U=j===Z-1,z=U?"\x1B[31m>\x1B[0m":" ",W=U?`\x1B[31m${J[j]}\x1B[0m`:`\x1B[90m${J[j]}\x1B[0m`;_.push(`${z}\x1B[90m${B}\x1B[0m | ${W}`)}return _.join(`
3715
- `)}function p8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function mJ($,Z){let J=$.substring(0,Z).split(`
3716
- `);return{line:J.length,column:J[J.length-1].length}}function g($,Z,Y){return c8({type:$,message:Z,code:Y,format:"html"}).formatted}async function t4($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var l8=I(()=>{Q7();j7()});import E0 from"process";class S0{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(`
3721
+ `)}function lJ($,Z,Y){let J=$.split(`
3722
+ `),G=Math.max(0,Z-Y-1),X=Math.min(J.length-1,Z+Y-1),Q="\x1B[90m",K="\x1B[31m",q="\x1B[0m",_=[];for(let j=G;j<=X;j++){let B=(j+1).toString().padStart(4),W=j===Z-1,z=W?"\x1B[31m>\x1B[0m":" ",U=W?`\x1B[31m${J[j]}\x1B[0m`:`\x1B[90m${J[j]}\x1B[0m`;_.push(`${z}\x1B[90m${B}\x1B[0m | ${U}`)}return _.join(`
3723
+ `)}function l8($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function iJ($,Z){let J=$.substring(0,Z).split(`
3724
+ `);return{line:J.length,column:J[J.length-1].length}}function f($,Z,Y){return i8({type:$,message:Z,code:Y,format:"html"}).formatted}async function t4($,Z,Y){try{return await $()}catch(J){if(Y&&J instanceof Error)Y(J);return Z}}var n8=w(()=>{K7();W7()});import k0 from"process";class b0{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(`
3717
3725
  `).slice(1).join(`
3718
3726
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
3719
3727
  `)}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 G=`${this.formatEntry($)}
3720
- `;Z.appendFileSync(this.logFilePath,G,"utf-8")}catch(Z){if(E0.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}`,G=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y===this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,G)}$.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(E0.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(E0.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 G=Y.level||"error";Z[G]=(Z[G]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),G=(await import("path")).dirname($);if(!Y.existsSync(G))Y.mkdirSync(G,{recursive:!0});if(Z==="json"){let X=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Y.writeFileSync($,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((Q)=>this.formatEntry(Q));Y.writeFileSync($,X.join(`
3721
-
3722
- `),"utf-8")}}async flush(){await this.writeQueue}}var k0,e4,b0;var i8=I(()=>{I0();j7();k0={isEnabled(){return K7().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=K7();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],G=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(G>X){let K=G-X;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let K of Q){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let j=q-_;for(let B=0;B<j;B++)Y+=`
3723
- @end${K}`;J.push(`Added ${j} 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(O5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};e4=new S0,b0={isDevelopment(){return O5()},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(`
3724
- `)}}});var n8=()=>{};var s8=I(()=>{Q7();l8();i8();n8();j7()});var I4=I(()=>{s8()});function o8($,Z,Y,J){let G=$;return G=G.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Q,K)=>{if(!K&&Q.includes(":")){let q=Q.split(":"),_=Q,j=q.length>1?q[1]:"";if(j&&Z[j])K=Z[j];else if(_.startsWith("og:")&&Z.openGraph&&Z.openGraph[q[1]])K=Z.openGraph[q[1]];else K="";return K?`<meta property="${_}" content="${v(K)}">`:""}return K?`<meta name="${Q}" content="${v(K)}">`:""}),G=G.replace(/@metaTag\(\s*(\{[^}]+\})\s*\)/g,(X,Q)=>{try{let K=z4(Q,Z);if(!K)return"";let q="<meta";if(K.name)q+=` name="${v(String(K.name))}"`;if(K.property)q+=` property="${v(String(K.property))}"`;if(K.httpEquiv)q+=` http-equiv="${v(String(K.httpEquiv))}"`;if(K.content)q+=` content="${v(String(K.content))}"`;return q+=">",q}catch(K){let q=K instanceof Error?K.message:String(K);return g("MetaTag",q,y.EVALUATION_ERROR)}}),G}function r8($,Z,Y){let J=$;return J=J.replace(/@structuredData\(\s*(\{[\s\S]*?\})\s*\)/g,(G,X)=>{try{let Q=z4(X,Z);if(!Q)return"";if(!Q["@context"])Q["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let K=Q instanceof Error?Q.message:String(Q);return g("StructuredData",K,y.EVALUATION_ERROR)}}),J}function a8($,Z,Y,J){let G=$;return G=G.replace(/@seo\(\s*(\{[\s\S]*?\})\s*\)/g,(X,Q)=>{try{let K=z4(Q,Z);if(!K)return"";let q="";if(K.title)q+=`<title>${v(K.title)}</title>
3725
- `,q+=`<meta name="title" content="${v(K.title)}">
3726
- `;if(K.description)q+=`<meta name="description" content="${v(K.description)}">
3727
- `;if(K.keywords){let _=Array.isArray(K.keywords)?K.keywords.join(", "):K.keywords;q+=`<meta name="keywords" content="${v(_)}">
3728
- `}if(K.robots)q+=`<meta name="robots" content="${v(K.robots)}">
3729
- `;if(K.canonical)q+=`<link rel="canonical" href="${v(K.canonical)}">
3730
- `;if(K.openGraph){let _=K.openGraph;if(q+=`<meta property="og:type" content="${v(_.type||"website")}">
3731
- `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta property="og:title" content="${v(j)}">
3732
- `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta property="og:description" content="${v(j)}">
3733
- `}if(_.url||K.canonical){let j=_.url||K.canonical||"";q+=`<meta property="og:url" content="${v(j)}">
3734
- `}if(_.image){if(q+=`<meta property="og:image" content="${v(_.image)}">
3735
- `,_.imageAlt)q+=`<meta property="og:image:alt" content="${v(_.imageAlt)}">
3728
+ `;Z.appendFileSync(this.logFilePath,G,"utf-8")}catch(Z){if(k0.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}`,G=`${this.logFilePath}.${Y+1}`;if($.existsSync(J))if(Y===this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,G)}$.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(k0.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(k0.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 G=Y.level||"error";Z[G]=(Z[G]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),G=(await import("path")).dirname($);if(!Y.existsSync(G))Y.mkdirSync(G,{recursive:!0});if(Z==="json"){let X=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Y.writeFileSync($,JSON.stringify(X,null,2),"utf-8")}else{let X=this.errors.map((Q)=>this.formatEntry(Q));Y.writeFileSync($,X.join(`
3729
+
3730
+ `),"utf-8")}}async flush(){await this.writeQueue}}var S0,e4,P0;var s8=w(()=>{D0();W7();S0={isEnabled(){return q7().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=q7();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,J=[],G=(Y.match(/\{\{/g)||[]).length,X=(Y.match(/\}\}/g)||[]).length;if(G>X){let K=G-X;Y+="}}".repeat(K),J.push(`Added ${K} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let K of Q){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,_=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>_){let j=q-_;for(let B=0;B<j;B++)Y+=`
3731
+ @end${K}`;J.push(`Added ${j} 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(O5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};e4=new b0,P0={isDevelopment(){return O5()},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(`
3732
+ `)}}});var o8=()=>{};var r8=w(()=>{K7();n8();s8();o8();W7()});var D4=w(()=>{r8()});function a8($,Z,Y,J){let G=$;return G=G.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(X,Q,K)=>{if(!K&&Q.includes(":")){let q=Q.split(":"),_=Q,j=q.length>1?q[1]:"";if(j&&Z[j])K=Z[j];else if(_.startsWith("og:")&&Z.openGraph&&Z.openGraph[q[1]])K=Z.openGraph[q[1]];else K="";return K?`<meta property="${_}" content="${C(K)}">`:""}return K?`<meta name="${Q}" content="${C(K)}">`:""}),G=G.replace(/@metaTag\(\s*(\{[^}]+\})\s*\)/g,(X,Q)=>{try{let K=O4(Q,Z);if(!K)return"";let q="<meta";if(K.name)q+=` name="${C(String(K.name))}"`;if(K.property)q+=` property="${C(String(K.property))}"`;if(K.httpEquiv)q+=` http-equiv="${C(String(K.httpEquiv))}"`;if(K.content)q+=` content="${C(String(K.content))}"`;return q+=">",q}catch(K){let q=K instanceof Error?K.message:String(K);return f("MetaTag",q,P.EVALUATION_ERROR)}}),G}function t8($,Z,Y){let J=$;return J=J.replace(/@structuredData\(\s*(\{[\s\S]*?\})\s*\)/g,(G,X)=>{try{let Q=O4(X,Z);if(!Q)return"";if(!Q["@context"])Q["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let K=Q instanceof Error?Q.message:String(Q);return f("StructuredData",K,P.EVALUATION_ERROR)}}),J}function e8($,Z,Y,J){let G=$;return G=G.replace(/@seo\(\s*(\{[\s\S]*?\})\s*\)/g,(X,Q)=>{try{let K=O4(Q,Z);if(!K)return"";let q="";if(K.title)q+=`<title>${C(K.title)}</title>
3733
+ `,q+=`<meta name="title" content="${C(K.title)}">
3734
+ `;if(K.description)q+=`<meta name="description" content="${C(K.description)}">
3735
+ `;if(K.keywords){let _=Array.isArray(K.keywords)?K.keywords.join(", "):K.keywords;q+=`<meta name="keywords" content="${C(_)}">
3736
+ `}if(K.robots)q+=`<meta name="robots" content="${C(K.robots)}">
3737
+ `;if(K.canonical)q+=`<link rel="canonical" href="${C(K.canonical)}">
3738
+ `;if(K.openGraph){let _=K.openGraph;if(q+=`<meta property="og:type" content="${C(_.type||"website")}">
3739
+ `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta property="og:title" content="${C(j)}">
3740
+ `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta property="og:description" content="${C(j)}">
3741
+ `}if(_.url||K.canonical){let j=_.url||K.canonical||"";q+=`<meta property="og:url" content="${C(j)}">
3742
+ `}if(_.image){if(q+=`<meta property="og:image" content="${C(_.image)}">
3743
+ `,_.imageAlt)q+=`<meta property="og:image:alt" content="${C(_.imageAlt)}">
3736
3744
  `;if(_.imageWidth)q+=`<meta property="og:image:width" content="${_.imageWidth}">
3737
3745
  `;if(_.imageHeight)q+=`<meta property="og:image:height" content="${_.imageHeight}">
3738
- `}if(_.siteName)q+=`<meta property="og:site_name" content="${v(_.siteName)}">
3739
- `}if(K.twitter){let _=K.twitter;if(q+=`<meta name="twitter:card" content="${v(_.card||"summary_large_image")}">
3740
- `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta name="twitter:title" content="${v(j)}">
3741
- `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta name="twitter:description" content="${v(j)}">
3742
- `}if(_.image||K.openGraph&&K.openGraph.image){let j=_.image||(K.openGraph?K.openGraph.image:"")||"";q+=`<meta name="twitter:image" content="${v(j)}">
3743
- `}if(_.site)q+=`<meta name="twitter:site" content="${v(_.site)}">
3744
- `;if(_.creator)q+=`<meta name="twitter:creator" content="${v(_.creator)}">
3746
+ `}if(_.siteName)q+=`<meta property="og:site_name" content="${C(_.siteName)}">
3747
+ `}if(K.twitter){let _=K.twitter;if(q+=`<meta name="twitter:card" content="${C(_.card||"summary_large_image")}">
3748
+ `,_.title||K.title){let j=_.title||K.title||"";q+=`<meta name="twitter:title" content="${C(j)}">
3749
+ `}if(_.description||K.description){let j=_.description||K.description||"";q+=`<meta name="twitter:description" content="${C(j)}">
3750
+ `}if(_.image||K.openGraph&&K.openGraph.image){let j=_.image||(K.openGraph?K.openGraph.image:"")||"";q+=`<meta name="twitter:image" content="${C(j)}">
3751
+ `}if(_.site)q+=`<meta name="twitter:site" content="${C(_.site)}">
3752
+ `;if(_.creator)q+=`<meta name="twitter:creator" content="${C(_.creator)}">
3745
3753
  `}if(K.structuredData)q+=`<script type="application/ld+json">${JSON.stringify(K.structuredData)}</script>
3746
- `;return q.trim()}catch(K){let q=K instanceof Error?K.message:String(K);return g("SEO",`Error processing @seo directive: ${q}`,y.EVALUATION_ERROR)}}),G}function t8($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.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 X="";if(Z.description)X=Z.description;else if(Z.meta&&Z.meta.description)X=Z.meta.description;else if(Y.seo?.defaultConfig?.description)X=Y.seo.defaultConfig.description;else X=Y.defaultDescription||"A website built with stx templating engine";let Q="";if(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 K=`
3754
+ `;return q.trim()}catch(K){let q=K instanceof Error?K.message:String(K);return f("SEO",`Error processing @seo directive: ${q}`,P.EVALUATION_ERROR)}}),G}function $Z($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.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 X="";if(Z.description)X=Z.description;else if(Z.meta&&Z.meta.description)X=Z.meta.description;else if(Y.seo?.defaultConfig?.description)X=Y.seo.defaultConfig.description;else X=Y.defaultDescription||"A website built with stx templating engine";let Q="";if(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 K=`
3747
3755
  <!-- stx SEO Tags -->
3748
- <meta name="title" content="${v(G)}">
3749
- <meta name="description" content="${v(X)}">
3750
- <meta property="og:title" content="${v(G)}">
3751
- <meta property="og:description" content="${v(X)}">
3756
+ <meta name="title" content="${C(G)}">
3757
+ <meta name="description" content="${C(X)}">
3758
+ <meta property="og:title" content="${C(G)}">
3759
+ <meta property="og:description" content="${C(X)}">
3752
3760
  <meta property="og:type" content="website">
3753
3761
  <meta name="twitter:card" content="summary_large_image">
3754
- <meta name="twitter:title" content="${v(G)}">
3755
- <meta name="twitter:description" content="${v(X)}">
3762
+ <meta name="twitter:title" content="${C(G)}">
3763
+ <meta name="twitter:description" content="${C(X)}">
3756
3764
  `;if(Q)K+=`
3757
- <meta property="og:image" content="${v(Q)}">
3758
- <meta name="twitter:image" content="${v(Q)}">
3765
+ <meta property="og:image" content="${C(Q)}">
3766
+ <meta name="twitter:image" content="${C(Q)}">
3759
3767
  `;let q=$;if(!J)q=q.replace(/<head[^>]*>/,`$&
3760
- <title>${v(G)}</title>`);return q.replace(/<head[^>]*>/,`$&
3768
+ <title>${C(G)}</title>`);return q.replace(/<head[^>]*>/,`$&
3761
3769
  ${K}
3762
- `)}function v($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var e8,$Z;var P0=I(()=>{I4();H4();e8={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return g("Meta","meta directive requires at least the meta name",y.INVALID_DIRECTIVE_SYNTAX);let G=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${v(G)}" content="${v(X)}">`},hasEndTag:!1},$Z={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return g("StructuredData","structuredData directive requires JSON-LD content",y.INVALID_DIRECTIVE_SYNTAX);try{let G=JSON.parse($);if(!G["@context"])G["@context"]="https://schema.org";if(!G["@type"])return g("StructuredData","structuredData requires @type property",y.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(G)}</script>`}catch(G){let X=G instanceof Error?G.message:String(G);return g("StructuredData",X,y.EVALUATION_ERROR)}},hasEndTag:!0}});import F5 from"path";import uJ from"process";function pJ($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",G=Z,X=[],Q=!0;if(J){let B=J.match(/export\s+default\s+({[\s\S]*})/);if(B)try{let U=B[1],z=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(z)G=z[1];let W=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(W)X=W[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let H=U.match(/shadowDOM\s*:\s*(true|false)/);if(H)Q=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),j=_?_[1].trim():"";return{tag:G,props:X,template:q,styles:j,script:J,shadowDOM:Q}}function cJ($){let{tag:Z,props:Y,template:J,styles:G,shadowDOM:X}=$,Q=Z.split("-").map((B)=>B.charAt(0).toUpperCase()+B.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=G.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Y.map((B)=>`'${B}'`).join(", "),j=Y.map((B)=>`
3770
+ `)}function C($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}var ZZ,YZ;var y0=w(()=>{D4();L4();ZZ={name:"meta",handler:($,Z,Y,J)=>{if(Z.length<1)return f("Meta","meta directive requires at least the meta name",P.INVALID_DIRECTIVE_SYNTAX);let G=Z[0].replace(/['"]/g,""),X=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${C(G)}" content="${C(X)}">`},hasEndTag:!1},YZ={name:"structuredData",handler:($,Z,Y,J)=>{if($.trim()==="")return f("StructuredData","structuredData directive requires JSON-LD content",P.INVALID_DIRECTIVE_SYNTAX);try{let G=JSON.parse($);if(!G["@context"])G["@context"]="https://schema.org";if(!G["@type"])return f("StructuredData","structuredData requires @type property",P.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(G)}</script>`}catch(G){let X=G instanceof Error?G.message:String(G);return f("StructuredData",X,P.EVALUATION_ERROR)}},hasEndTag:!0}});import L5 from"path";import nJ from"process";function sJ($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Y?Y[1].trim():"",G=Z,X=[],Q=!0;if(J){let B=J.match(/export\s+default\s+({[\s\S]*})/);if(B)try{let W=B[1],z=W.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(z)G=z[1];let U=W.match(/props\s*:\s*\[([\s\S]*?)\]/);if(U)X=U[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let H=W.match(/shadowDOM\s*:\s*(true|false)/);if(H)Q=H[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",_=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),j=_?_[1].trim():"";return{tag:G,props:X,template:q,styles:j,script:J,shadowDOM:Q}}function oJ($){let{tag:Z,props:Y,template:J,styles:G,shadowDOM:X}=$,Q=Z.split("-").map((B)=>B.charAt(0).toUpperCase()+B.slice(1)).join(""),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=G.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),_=Y.map((B)=>`'${B}'`).join(", "),j=Y.map((B)=>`
3763
3771
  get ${B}() {
3764
3772
  return this.getAttribute('${B}') || '';
3765
3773
  }
@@ -3809,17 +3817,17 @@ ${j}
3809
3817
  }
3810
3818
 
3811
3819
  customElements.define('${Z}', ${Q});
3812
- `}async function ZZ($,Z,Y,J){if(Z.length<1)return g("WebComponent","@webcomponent directive requires at least the tag name parameter",y.INVALID_DIRECTIVE_SYNTAX);let G=Z[0].replace(/['"]/g,""),Q=(Y.__stx_options||{}).componentsDir||"components",K=[F5.join(F5.dirname(J),Q,`${G}.stx`),F5.join(uJ.cwd(),Q,`${G}.stx`),F5.join(F5.dirname(J),`${G}.stx`)],q=null;for(let B of K)if(await p(B)){q=await Bun.file(B).text();break}if(!q)return g("WebComponent",`Component file not found: ${G}.stx`,y.FILE_NOT_FOUND);let _=pJ(q,G);return`<script type="module">
3813
- ${cJ(_)}
3814
- </script>`}var YZ=I(()=>{I4();A4()});import{loadConfigWithResult as lJ}from"bunfig";async function iJ(){if(x4)return x4;if(R5)return R5;return R5=(async()=>{return x4=(await lJ({name:"stx",cwd:process.cwd(),defaultConfig:JZ,verbose:!1})).config,x4})(),R5}var JZ,x4=null,R5=null,XZ;var GZ=I(()=>{E7();b7();C7();S7();l7();L8();V0();T0();P0();YZ();JZ={enabled:!0,partialsDir:"partials",componentsDir:"components",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:p$,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:ZZ,hasEndTag:!1,description:"Include a web component in the template"},C6,v6,e8,$Z,n6,o6,r6,s6,z$,i6,O8,N0,...M0],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}}};XZ=new Proxy(JZ,{get($,Z){if(x4&&Z in x4)return x4[Z];if(!R5)iJ().catch(()=>{});return $[Z]}})});import nJ from"fs";import y0 from"path";import{createHighlighter as sJ}from"ts-syntax-highlighter";async function oJ($,Z={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let J=(await nJ.promises.stat($)).mtime.getTime();if(Z.cache&&C0.has($)){let B=C0.get($);if(B.updatedAt>=J)return{content:B.content,data:B.data}}let G=await Bun.file($).text(),{data:X,content:Q}=H$(G),K=Z.markdown||XZ.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=j5(Q,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await rJ(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let j={content:_,data:X||{}};if(Z.cache)C0.set($,{...j,updatedAt:J});return j}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:l("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function rJ($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!B7)try{B7=await sJ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let G=async(K,q,_,j)=>{let B=j.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=_||(Y?"text":"");if(!U)return K;try{if(!B7.getSupportedLanguages().includes(U))return K;return(await B7.highlight(B,U,{theme:Z})).html}catch(z){console.error(`Error highlighting code block with language ${_}:`,z)}return K},X=$,Q=$.matchAll(J);for(let K of Q){let[q,_,j,B]=K,U=await G(q,_,j,B);X=X.replace(q,U)}return X}async function QZ($,Z,Y="",J={}){return await aJ($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,K,q,_)=>{try{let j=K;if(!y0.isAbsolute(K))j=y0.resolve(y0.dirname(Y),K);let B={};if(q)try{try{B=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let R of L){let M=R.indexOf(":");if(M>0){let V=R.substring(0,M).trim(),A=R.substring(M+1).trim(),N=A.startsWith('"')&&A.endsWith('"'),T=A.startsWith("'")&&A.endsWith("'");if(N||T)A=A.substring(1,A.length-1);B[V]=A}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:U,data:z}=await oJ(j,J),W={...Z,...z,...B},H=U,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(F,L)=>{let R=L.trim();return W[R]!==void 0?String(W[R]):F}),H}catch(j){let B=j instanceof Error?j.message:String(j);return l("Markdown File",`Error including markdown file: ${B}`,Y,$,_,Q)}})}async function aJ($,Z,Y){let J=[],G;while((G=Z.exec($))!==null){let K=G[0],q=G.index,_=G;J.push(Y(..._).then((j)=>({match:K,replacement:j,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let Q=$;for(let{match:K,replacement:q}of X)Q=Q.replace(K,q);return Q}var C0,B7=null;var KZ=I(()=>{GZ();A4();C0=new Map});function L4($,Z){try{let Y=$.trim();if(Z4(Y))return j4(Y,Object.keys(Z))(...Object.values(Z));else return i(Y,Z)}catch{return!1}}var qZ=I(()=>{H4()});function A5($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let J=B4($,"(",")",Y);if(J===-1)return null;return{expression:$.slice(Y+1,J),endPos:J+1}}function U7($,Z,Y,J){let G=1,X=J,Q=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<$.length&&G>0){Q.lastIndex=X,K.lastIndex=X;let q=Q.exec($),_=K.exec($),j=q?q.index:1/0,B=_?_.index:1/0;if(j<B)G++,X=j+q[0].length;else if(B<1/0){if(G--,G===0)return B;X=B+_[0].length}else break}return-1}function _Z($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,G=A5($,J);if(!G)return null;let X=G.endPos,Q=U7($,"if","endif",X);if(Q===-1)return null;let K=$.slice(X,Q),q=[],_=0,j="if",B=G.expression,U=0;while(_<K.length){let z=K.slice(_).match(/^@elseif\s*/),W=K.slice(_).match(/^@else(?![a-z])/);if(z&&K.slice(_).startsWith("@elseif")){q.push({type:j,condition:B,content:K.slice(U,_),start:X+U,end:X+_});let H=_+z[0].length,O=A5(K,H);if(!O){_++;continue}j="elseif",B=O.expression,_=O.endPos,U=_}else if(W&&K.slice(_).startsWith("@else"))q.push({type:j,condition:B,content:K.slice(U,_),start:X+U,end:X+_}),j="else",B=void 0,_+=W[0].length,U=_;else _++}return q.push({type:j,condition:B,content:K.slice(U),start:X+U,end:X+K.length}),{fullMatch:$.slice(Z,Q+6),branches:q,start:Z,end:Q+6}}function v0($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Y.exec($);continue}let X=_Z($,J.index);if(X)Z.push(X),Y.lastIndex=X.end;J=Y.exec($)}return Z}function W7($,Z,Y){let J=[],G=new RegExp(`@${Z}\\s*\\(`,"g"),X=G.exec($);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=G.exec($);continue}let K=X.index,q=K+X[0].length-1,_=B4($,"(",")",q);if(_===-1){X=G.exec($);continue}let j=$.slice(q+1,_),B=_+1,U=U7($,Z,Y,B);if(U===-1){X=G.exec($);continue}let z=$.slice(B,U),W=U+`@${Y}`.length;J.push({fullMatch:$.slice(K,W),name:Z,params:j,content:z,start:K,end:W}),G.lastIndex=W,X=G.exec($)}return J}function x0($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,G=A5($,J);if(!G)return null;let X=G.endPos,Q=U7($,"switch","endswitch",X);if(Q===-1)return null;let K=$.slice(X,Q),q=[],_=0,j=null;while(_<K.length){let B=K.slice(_).match(/^@case\s*/),U=K.slice(_).match(/^@default(?![a-z])/),z=K.slice(_).match(/^@break(?![a-z])/);if(B&&K.slice(_).startsWith("@case")){if(j)q.push(j);let W=_+B[0].length,H=A5(K,W);if(!H){_++;continue}j={type:"case",value:H.expression,content:""},_=H.endPos}else if(U&&K.slice(_).startsWith("@default")){if(j)q.push(j);j={type:"default",content:""},_+=U[0].length}else if(z&&K.slice(_).startsWith("@break"))_+=z[0].length;else{if(j)j.content+=K[_];_++}}if(j)q.push(j);return{fullMatch:$.slice(Z,Q+10),expression:G.expression,cases:q,start:Z,end:Q+10}}var jZ=()=>{};var BZ=()=>{};var f0=I(()=>{jZ();BZ()});import r from"process";function ZX($,Z,Y){let J=$,G=!0;while(G){G=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=x0(J,Q);if(!K)break;try{let q;if(Z4(K.expression))q=j4(K.expression,Object.keys(Z))(...Object.values(Z));else q=i(K.expression,Z);let _="",j=!1;for(let B of K.cases)if(B.type==="default"){if(!j)_=B.content.replace(/@break/g,"").trim()}else try{let U;if(B.value&&Z4(B.value))U=j4(B.value,Object.keys(Z))(...Object.values(Z));else if(B.value)U=i(B.value,Z);if(q===U){_=B.content.replace(/@break/g,"").trim(),j=!0;break}}catch{continue}J=J.substring(0,Q)+_+J.substring(K.end),G=!0}catch(q){let _=q instanceof Error?q.message:String(q),j=g("Switch",`Error evaluating @switch expression: ${_}`,y.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(K.end);break}}return J}function $5($,Z,Y){let J=$;J=ZX(J,Z,Y),J=J.replace(/@unless\s*\(([^)]+)\)([\s\S]*?)@endunless/g,(X,Q,K)=>{let q=K.match(/^([\s\S]*?)@else([\s\S]*)$/);if(q){let _=q[1],j=q[2];return`@if (${Q})${j}@else${_}@endif`}else return`@if (!(${Q}))${K}@endif`}),J=h0(J,Z,Y),J=d0(J,Z,Y),J=g0(J,Z);let G=()=>{let X=v0(J);if(X.length===0)return!1;for(let Q=X.length-1;Q>=0;Q--){let K=X[Q];try{let q="",_=!1;for(let j of K.branches){if(_)break;if(j.type==="else")q=j.content,_=!0;else try{let B;if(j.condition&&Z4(j.condition))B=j4(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=i(j.condition,Z);if(B)q=j.content,_=!0}catch(B){q=g(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,y.EVALUATION_ERROR),_=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),j=g("If",`Error processing @if block: ${_}`,y.EVALUATION_ERROR);J=J.substring(0,K.start)+j+J.substring(K.end)}}return!0};while(G());return J}function g0($,Z){let Y=$;return Y=Y.replace(/@auth\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endauth/g,(J,G,X,Q)=>{return(G?L4(`auth?.check && auth?.user?.[${G}]`,Z):L4("auth?.check",Z))?X:Q||""}),Y=Y.replace(/@guest\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endguest/g,(J,G,X,Q)=>{return(G?L4(`!auth?.check || !auth?.user?.[${G}]`,Z):L4("!auth?.check",Z))?X:Q||""}),Y=Y.replace(/@can\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecan\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcan/g,(J,G,X,Q,K,q,_,j,B,U)=>{let z=!1;if(Z.userCan&&typeof Z.userCan[G]==="boolean")z=Z.userCan[G];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[G];if(X)W.push(X);if(Q){let H=L4(Q,Z);W.push(H)}z=Z.permissions.check(...W)}catch{z=!1}if(z)return K;else if(q){let W=!1;if(Z.userCan&&typeof Z.userCan[q]==="boolean")W=Z.userCan[q];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let O=L4(j,Z);H.push(O)}W=Z.permissions.check(...H)}catch{W=!1}return W?B:U||""}else return U||""}),Y=Y.replace(/@cannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcannot/g,(J,G,X,Q,K,q,_,j,B,U)=>{let z=!0;if(Z.userCan&&typeof Z.userCan[G]==="boolean")z=!Z.userCan[G];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let W=[G];if(X)W.push(X);if(Q){let H=L4(Q,Z);W.push(H)}z=!Z.permissions.check(...W)}catch{z=!0}if(z)return K;else if(q){let W=!0;if(Z.userCan&&typeof Z.userCan[q]==="boolean")W=!Z.userCan[q];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let O=L4(j,Z);H.push(O)}W=!Z.permissions.check(...H)}catch{W=!0}return W?B:U||""}else return U||""}),Y}function h0($,Z,Y){let J=$;return J=J.replace(/@isset\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endisset/g,(G,X,Q,K,q)=>{try{let _=L4(X.trim(),Z);if(_!==void 0&&_!==null)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return g("Isset",`Error processing @isset directive: ${j}`,y.EVALUATION_ERROR)}}),J=J.replace(/@empty\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endempty/g,(G,X,Q,K,q)=>{try{let _=L4(X.trim(),Z);if(_===void 0||_===null||_===""||Array.isArray(_)&&_.length===0||typeof _==="object"&&_!==null&&Object.keys(_).length===0)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return g("Empty",`Error processing @empty directive: ${j}`,y.EVALUATION_ERROR)}}),J}function d0($,Z,Y){let J=$;return J=J.replace(/@env\s*\(\s*(['"])([^'"]+)\1\s*\)([\s\S]*?)(?:@else([\s\S]*?))?@endenv/g,(G,X,Q,K,q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")===Q?K:q}),J=J.replace(/@production([\s\S]*?)(?:@else([\s\S]*?))?@endproduction/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="production"?X:Q}),J=J.replace(/@development([\s\S]*?)(?:@else([\s\S]*?))?@enddevelopment/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="development"?X:Q}),J=J.replace(/@staging([\s\S]*?)(?:@else([\s\S]*?))?@endstaging/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="staging"?X:Q}),J=J.replace(/@testing([\s\S]*?)(?:@else([\s\S]*?))?@endtesting/g,(G,X,Q="")=>{return(r.env.NODE_ENV||r.env.BUN_ENV||"development")==="testing"?X:Q}),J}var z7=I(()=>{qZ();I4();f0();H4()});function WZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function H7($,Z){if(!$)return Z?.nonceGenerator?.()??WZ();let Y=UZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??WZ(),UZ.set($,Y);return Y}function YX($,Z){let Y=[];for(let[J,G]of Object.entries($)){if(G===void 0||G===null)continue;if(typeof G==="boolean"){if(G)Y.push(J);continue}if(Array.isArray(G)){let X=[...G];if(Z&&(J==="script-src"||J==="style-src"))X=X.filter((Q)=>!Q.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function zZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${YX($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function HZ($,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?H7(Y,Z):void 0,G=zZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
3815
- ${G}`)}function OZ($,Z,Y,J){let G=$,X=J.csp;if(G=G.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let Q=X.useNonce?H7(Z,X):void 0;return zZ(X.directives,Q)}),G=G.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return H7(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=H7(Z,X);return G}var UZ;var LZ=I(()=>{UZ=new WeakMap});import JX from"crypto";function GX($=XX){let Z=JX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return m0=Z,Z}function QX(){if(!m0)GX();return m0}function KX($=FZ){let Z=QX();return`<input type="hidden" name="${$}" value="${Z}">`}function RZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return KX(J||FZ)})}var XX=40,FZ="_token",m0=null;var AZ=()=>{};async function NZ($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let G=$;for(let X of J.customDirectives){if(!X.name||typeof X.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)G=await qX(G,X,Z,Y,J);else G=await _X(G,X,Z,Y,J)}return G}async function qX($,Z,Y,J,G){let{name:X,handler:Q}=Z,K=`@${X}`,q=`@end${X}`,_=$,j=U5(`${K}(?:\\s*\\(([^)]+)\\))?([\\s\\S]*?)${q}`,"g"),B=[],U=j.exec(_);while(U!==null){let[z,W="",H=""]=U,O=U.index||0;try{let F=W?VZ(W):[],L=H.trim(),R=await Q(L,F,Y,J);B.push({original:z,processed:R,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(G.debug)console.error(`Error processing custom directive @${X}:`,F);B.push({original:z,processed:g("CustomDirective",`Error in @${X}${W?`(${W})`:""}: ${L}`,y.EVALUATION_ERROR),startIndex:O})}U=j.exec(_)}for(let z=B.length-1;z>=0;z--){let{original:W,processed:H}=B[z];_=_.replace(W,H)}return _}async function _X($,Z,Y,J,G){let{name:X,handler:Q}=Z,K=$,q=U5(`@${X}\\s*\\(([^)]+)\\)`,"g"),_=[],j=q.exec(K);while(j!==null){let[B,U=""]=j,z=j.index||0;try{let W=VZ(U),H=await Q("",W,Y,J);_.push({original:B,processed:H,startIndex:z})}catch(W){let H=W instanceof Error?W.message:String(W);if(G.debug)console.error(`Error processing custom directive @${X}:`,W);_.push({original:B,processed:g("CustomDirective",`Error in @${X}(${U}): ${H}`,y.EVALUATION_ERROR),startIndex:z})}j=q.exec(K)}for(let B=_.length-1;B>=0;B--){let{original:U,processed:z}=_[B];K=K.replace(U,z)}return K}function VZ($){if(!$.trim())return[];let Z=[],Y="",J=!1,G="";for(let X=0;X<$.length;X++){let Q=$[X];if((Q==='"'||Q==="'")&&(X===0||$[X-1]!=="\\"))if(!J)J=!0,G=Q;else if(Q===G)J=!1;else Y+=Q;else if(Q===","&&!J)Z.push(Y.trim()),Y="";else Y+=Q}if(Y.trim())Z.push(Y.trim());return Z.map((X)=>{let Q=X.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var MZ=I(()=>{I4();i4()});import jX from"crypto";function UX(){return jX.randomUUID()}function wZ($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=UX();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${Z.csrf.token}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,G)=>{if(G&&["PUT","PATCH","DELETE"].includes(G.toUpperCase()))return`<input type="hidden" name="_method" value="${G.toUpperCase()}">`;return J}),Y}function IZ($,Z,Y=BX){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,G,X)=>{try{if(WX(G,Z))return X.replace(/\{\{([^}]+)\}\}/g,(Q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return TZ(G,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(G);return TZ(G,Z)}let q=K.trim();if(Z4(q)){let _=i(q,Z);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function WX($,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 TZ($,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""}var BX;var DZ=I(()=>{H4();BX={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import EZ from"path";function zX($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function HX($,Z){if({...l0,...Z.i18n}.cache&&c0[$]){let G=c0[$],X=Z.i18n?.cacheMaxAge??0;if(!zX(G,X))return G.translations}if(N5[$]?.state==="loading")return N5[$].promise;u0[$]="loading";let J=bZ($,Z).then((G)=>{return u0[$]="loaded",delete N5[$],G}).catch((G)=>{throw u0[$]="error",N5[$]={promise:J,state:"error",error:G instanceof Error?G:Error(String(G))},G});return N5[$]={promise:J,state:"loading"},J}async function bZ($,Z){let Y={...l0,...Z.i18n},J=EZ.resolve(import.meta.dir,"..",Y.translationsDir),G=RX(Y.format),X=EZ.join(J,`${$}${G}`);try{let Q={};try{let K=await import(X);Q=K.default||K}catch(K){let q=await Bun.file(X).text();if(Y.format==="yaml"||Y.format==="yml")Q=LX(q);else if(Y.format==="json")Q=JSON.parse(q);else throw K}if(Y.cache)c0[$]={translations:Q,loadedAt:Date.now(),locale:$};return Q}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return bZ(Y.defaultLocale,Z);return{}}}async function OX($,Z){return HX($,Z)}function LX($){let Z={},Y=$.split(`
3816
- `),J=[{obj:Z,indent:-1}];for(let G of Y){let X=G.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let Q=X.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,j]=q,B=_.trim(),U=j.trim();if(U==="")K[B]={},J.push({obj:K[B],indent:Q});else K[B]=FX(U)}}return Z}function FX($){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 RX($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function AX($,Z){for(let Y of $){let J=Y.trim(),G=J.match(/^\{(\d+)\}\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10);if(Z===Q)return G[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let Q=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=Q&&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 NX($,Z={}){return PZ($,Z)}function PZ($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let G=VX($,J);if(G===-1){Y+=$[J],J++;continue}let X=$.slice(J+1,G);Y+=MX(X,Z),J=G+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 VX($,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 MX($,Z){let Y=TX($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),G=Z[J];if(Y.length===1)return G!==void 0?String(G):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return wX(G,Y.slice(2).join(","),Z);case"select":return DX(G,Y.slice(2).join(","));case"selectordinal":return EX(G,Y.slice(2).join(","));case"number":return SX(G,Y[2]?.trim());case"date":return bX(G,Y[2]?.trim());case"time":return PX(G,Y[2]?.trim());default:return G!==void 0?String(G):`{${$}}`}}function TX($){let Z=[],Y="",J=0;for(let G=0;G<$.length;G++){let X=$[G];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 wX($,Z,Y){let J=Number($)||0,G=i0(Z),X=`=${J}`;if(G[X])return p0(G[X],J,Y);let Q=IX(J);if(G[Q])return p0(G[Q],J,Y);if(G.other)return p0(G.other,J,Y);return String(J)}function p0($,Z,Y){let J=$.replace(/#/g,String(Z));return PZ(J,Y)}function IX($){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 DX($,Z){let Y=String($||""),J=i0(Z);if(J[Y])return J[Y];return J.other||String($)}function EX($,Z){let Y=Number($)||0,J=i0(Z),G=kX(Y);if(J[G])return J[G].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function kX($){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 i0($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function SX($,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 bX($,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 PX($,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 yX($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function kZ($,Z,Y=!0,J={}){let G=$.split("."),X=Z;for(let K of G){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return Y?$:"";let Q=String(X);if(yX(Q))return NX(Q,J);if(Q.includes("|")&&"count"in J){let K=Number(J.count),q=Q.split("|");Q=AX(q,K)}for(let[K,q]of Object.entries(J))Q=Q.replace(new RegExp(`:${K}`,"g"),String(q));return Q}async function yZ($,Z,Y,J){let G=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...l0,...J.i18n},K=await OX(Q.locale,J);Z.__translations=K,Z.__locale=Q.locale,Z.__i18nConfig=Q,G=await SZ(G,X,async(j,B,U,z,W)=>{try{let H={};if(U)try{let F=[()=>JSON.parse(U),()=>{let L=`{"data":${U}}`,R=JSON.parse(L);return typeof R.data==="object"?R.data:{}},()=>{return z4(U,Z)}];for(let L of F)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return kZ(B,K,Q.fallbackToKey,H)||z.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return g("Translate",`Error in @translate('${B}'): ${H instanceof Error?H.message:String(H)}`,y.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${G.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let j=[...G.matchAll(q)];console.warn(`Found ${j.length} @translate matches`),j.forEach((B,U)=>console.warn(`Match ${U}: ${B[0]}, Key: ${B[1]}, Params: ${B[2]||"none"}`))}return G=await SZ(G,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(j,B,U,z)=>{try{let W={};if(U)try{let H=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return z4(U,Z)}];for(let O of H)try{if(W=O(),Object.keys(W).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return kZ(B,K,Q.fallbackToKey,W)}catch(W){if(J.debug)console.error("Error processing @translate directive:",W);return g("Translate",`Error in @translate('${B}'): ${W instanceof Error?W.message:String(W)}`,y.EVALUATION_ERROR)}}),G}async function SZ($,Z,Y){let J=[];return $.replace(Z,(X,...Q)=>{let K=Y(X,...Q).then((q)=>({match:X,replacement:q}));return J.push(K),X}),(await Promise.all(J)).reduce((X,{match:Q,replacement:K})=>X.replace(Q,K),$)}var l0,c0,N5,u0;var CZ=I(()=>{I4();H4();l0={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},c0={},N5={},u0={}});var hZ={};o(hZ,{processLoops:()=>n0});function xX($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,G)=>{if(G in Z)return`:${G}="${G}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,G,X)=>{try{let Q=Object.keys(Z),K=Object.values(Z),_=Function(...Q,`return ${X}`)(...K),B=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${G}="${B}"`}catch(Q){return J}}),Y}function fX($,Z){let Y=$;return Y=Y.replace(/@break\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if(Z4(Q)){let q=j4(Q,Object.keys(Z));K=Boolean(q(...Object.values(Z)))}else K=Boolean(i(Q,Z));return K?O7:""}catch{return""}}),Y=Y.replace(/@continue\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if(Z4(Q)){let q=j4(Q,Object.keys(Z));K=Boolean(q(...Object.values(Z)))}else K=Boolean(i(Q,Z));return K?L7:""}catch{return""}}),Y}function gX($){let Z=$;return Z=Z.replace(/@break(?!\()/g,O7),Z=Z.replace(/@continue(?!\()/g,L7),Z}function vZ($){let Z=$.includes(O7),Y=Z?$.substring(0,$.indexOf(O7)):$;return{hasBreak:Z,content:Y}}function xZ($){let Z=$.includes(L7),Y=Z?$.substring(0,$.indexOf(L7)):$;return{hasContinue:Z,content:Y}}function fZ($){let Z=$;return Z=Z.replace(/@break\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { break; } result += \``}),Z=Z.replace(/@continue\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function n0($,Z,Y,J){let G=$;G=G.replace(/@forelse\s*\(([^)]+)as([^)]+)\)([\s\S]*?)@empty([\s\S]*?)@endforelse/g,(q,_,j,B,U,z)=>{try{let W=_.trim(),H;if(Z4(W))H=j4(W,Object.keys(Z))(...Object.values(Z));else H=i(W,Z);if(!Array.isArray(H)||H.length===0)return U;return`@foreach (${W} as ${j.trim()})${B}@endforeach`}catch(W){return g("Forelse",`Error in @forelse(${_.trim()} as ${j.trim()}): ${W instanceof Error?W.message:String(W)}`,y.EVALUATION_ERROR)}});function X(q){let _=/@foreach\s*\(/g,j;while((j=_.exec(q))!==null){let B=j.index,U=j.index+j[0].length-1,z=1,W=U+1,H=-1;while(W<q.length&&z>0){if(q[W]==="(")z++;else if(q[W]===")"){if(z--,z===0){H=W;break}}W++}if(H===-1)continue;let O=q.substring(U+1,H),F=O.indexOf(" as ");if(F===-1)continue;let L=B,R=O.substring(0,F),M=O.substring(F+4),V=H+1,A=1,N=V,T=/@foreach\s*\(/g,D=/@endforeach/g;while(A>0&&N<q.length){T.lastIndex=N,D.lastIndex=N;let E=T.exec(q),k=D.exec(q);if(!k)break;if(E&&E.index<k.index)A++,N=E.index+E[0].length;else{if(A--,A===0){let w=q.substring(V,k.index),S=k.index+11;return{start:L,end:S,arrayExpr:R,itemVar:M,content:w}}N=k.index+11}}}return null}function Q(q,_){let j=q;while(!0){let B=X(j);if(!B)break;let{start:U,end:z,arrayExpr:W,itemVar:H,content:O}=B;try{let F=W.trim(),L;if(Z4(F))L=j4(F,Object.keys(_))(...Object.values(_));else L=i(F,_);if(!Array.isArray(L)){let T=g("Foreach",`Error in @foreach: ${F} is not an array`,y.TYPE_ERROR);j=j.substring(0,U)+T+j.substring(z);continue}let R=J?.loops?.useAltLoopVariable??vX,M=H.trim(),V=null,A;if(M.includes("=>")){let T=M.split("=>").map((D)=>D.trim());if(T.length===2)V=T[0],A=T[1];else A=M}else A=M;let N="";for(let T=0;T<L.length;T++){let D=L[T],E={index:T,iteration:T+1,first:T===0,last:T===L.length-1,count:L.length},k={..._,[A]:D,loop:E,$loop:E};if(V)k[V]=T;let w=fX(O,k),S=xZ(w);if(S.hasContinue){N+=S.content;continue}let m=vZ(w);if(m.hasBreak){N+=m.content;break}if(w=Q(w,k),w=$5(w,k,Y),w=gX(w),m=vZ(w),m.hasBreak){N+=m.content;break}if(S=xZ(w),S.hasContinue){N+=S.content;continue}w=c4(w,k,Y),w=xX(w,k),N+=w}j=j.substring(0,U)+N+j.substring(z)}catch(F){let L=g("Foreach",`Error in @foreach(${W.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,y.EVALUATION_ERROR);j=j.substring(0,U)+L+j.substring(z)}}return j}G=Q(G,Z),G=hX(G,Z);let K=J?.loops?.maxWhileIterations??CX;return G=dX(G,Z,K),G}function gZ($){return F$($)}function hX($,Z){let Y=$,J=!0;while(J){J=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let X=G.index,Q=X+G[0].length-1,K=B4(Y,"(",")",Q);if(K===-1)break;let q=Y.slice(Q+1,K),_=K+1,j=W7(Y.slice(X),"for","endfor");if(j.length===0)break;let B=j[0].content,U=X+j[0].end;if(!gZ(q)){let z=g("For",`Unsafe expression in @for: ${q}`,y.UNSAFE_EXPRESSION);Y=Y.substring(0,X)+z+Y.substring(U),J=!0;continue}try{let z=Object.keys(Z),W=Object.values(Z),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(L,R)=>{return`\${${R}}`});H=fZ(H);let F=Function(...z,`
3820
+ `}async function JZ($,Z,Y,J){if(Z.length<1)return f("WebComponent","@webcomponent directive requires at least the tag name parameter",P.INVALID_DIRECTIVE_SYNTAX);let G=Z[0].replace(/['"]/g,""),Q=(Y.__stx_options||{}).componentsDir||"components",K=[L5.join(L5.dirname(J),Q,`${G}.stx`),L5.join(nJ.cwd(),Q,`${G}.stx`),L5.join(L5.dirname(J),`${G}.stx`)],q=null;for(let B of K)if(await p(B)){q=await Bun.file(B).text();break}if(!q)return f("WebComponent",`Component file not found: ${G}.stx`,P.FILE_NOT_FOUND);let _=sJ(q,G);return`<script type="module">
3821
+ ${oJ(_)}
3822
+ </script>`}var XZ=w(()=>{D4();F4()});import{loadConfigWithResult as rJ}from"bunfig";async function aJ(){if(f4)return f4;if(F5)return F5;return F5=(async()=>{return f4=(await rJ({name:"stx",cwd:process.cwd(),defaultConfig:GZ,verbose:!1})).config,f4})(),F5}var GZ,f4=null,F5=null,QZ;var KZ=w(()=>{S7();y7();l7();P7();i7();A8();M0();I0();y0();XZ();GZ={enabled:!0,ssr:!0,partialsDir:"partials",componentsDir:"components",debug:!1,cache:!0,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:l$,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:JZ,hasEndTag:!1,description:"Include a web component in the template"},x6,v6,ZZ,YZ,s6,r6,a6,o6,u$,n6,F8,V0,...T0],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}}};QZ=new Proxy(GZ,{get($,Z){if(f4&&Z in f4)return f4[Z];if(!F5)aJ().catch(()=>{});return $[Z]}})});import tJ from"fs";import C0 from"path";import{createHighlighter as eJ}from"ts-syntax-highlighter";async function $X($,Z={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let J=(await tJ.promises.stat($)).mtime.getTime();if(Z.cache&&x0.has($)){let B=x0.get($);if(B.updatedAt>=J)return{content:B.content,data:B.data}}let G=await Bun.file($).text(),{data:X,content:Q}=p$(G),K=Z.markdown||QZ.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},_=U5(Q,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)_=await ZX(_,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let j={content:_,data:X||{}};if(Z.cache)x0.set($,{...j,updatedAt:J});return j}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let J=Y instanceof Error?Y.message:String(Y);return{content:l("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function ZX($,Z,Y){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!U7)try{U7=await eJ({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let G=async(K,q,_,j)=>{let B=j.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),W=_||(Y?"text":"");if(!W)return K;try{if(!U7.getSupportedLanguages().includes(W))return K;return(await U7.highlight(B,W,{theme:Z})).html}catch(z){console.error(`Error highlighting code block with language ${_}:`,z)}return K},X=$,Q=$.matchAll(J);for(let K of Q){let[q,_,j,B]=K,W=await G(q,_,j,B);X=X.replace(q,W)}return X}async function qZ($,Z,Y="",J={}){return await YX($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,K,q,_)=>{try{let j=K;if(!C0.isAbsolute(K))j=C0.resolve(C0.dirname(Y),K);let B={};if(q)try{try{B=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let A of L){let M=A.indexOf(":");if(M>0){let V=A.substring(0,M).trim(),R=A.substring(M+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);B[V]=R}}}}catch(F){if(J.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:W,data:z}=await $X(j,J),U={...Z,...z,...B},H=W,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(F,L)=>{let A=L.trim();return U[A]!==void 0?String(U[A]):F}),H}catch(j){let B=j instanceof Error?j.message:String(j);return l("Markdown File",`Error including markdown file: ${B}`,Y,$,_,Q)}})}async function YX($,Z,Y){let J=[],G;while((G=Z.exec($))!==null){let K=G[0],q=G.index,_=G;J.push(Y(..._).then((j)=>({match:K,replacement:j,index:q})))}let X=await Promise.all(J);X.sort((K,q)=>q.index-K.index);let Q=$;for(let{match:K,replacement:q}of X)Q=Q.replace(K,q);return Q}var x0,U7=null;var _Z=w(()=>{KZ();F4();x0=new Map});function R4($,Z){try{let Y=$.trim();if(J4(Y))return W4(Y,Object.keys(Z))(...Object.values(Z));else return n(Y,Z)}catch{return!1}}var jZ=w(()=>{L4()});function A5($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let J=U4($,"(",")",Y);if(J===-1)return null;return{expression:$.slice(Y+1,J),endPos:J+1}}function z7($,Z,Y,J){let G=1,X=J,Q=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(X<$.length&&G>0){Q.lastIndex=X,K.lastIndex=X;let q=Q.exec($),_=K.exec($),j=q?q.index:1/0,B=_?_.index:1/0;if(j<B)G++,X=j+q[0].length;else if(B<1/0){if(G--,G===0)return B;X=B+_[0].length}else break}return-1}function BZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let J=Z+Y[0].length,G=A5($,J);if(!G)return null;let X=G.endPos,Q=z7($,"if","endif",X);if(Q===-1)return null;let K=$.slice(X,Q),q=[],_=0,j="if",B=G.expression,W=0;while(_<K.length){let z=K.slice(_).match(/^@elseif\s*/),U=K.slice(_).match(/^@else(?![a-z])/);if(z&&K.slice(_).startsWith("@elseif")){q.push({type:j,condition:B,content:K.slice(W,_),start:X+W,end:X+_});let H=_+z[0].length,O=A5(K,H);if(!O){_++;continue}j="elseif",B=O.expression,_=O.endPos,W=_}else if(U&&K.slice(_).startsWith("@else"))q.push({type:j,condition:B,content:K.slice(W,_),start:X+W,end:X+_}),j="else",B=void 0,_+=U[0].length,W=_;else _++}return q.push({type:j,condition:B,content:K.slice(W),start:X+W,end:X+K.length}),{fullMatch:$.slice(Z,Q+6),branches:q,start:Z,end:Q+6}}function v0($){let Z=[],Y=/@if\s*\(/g,J=Y.exec($);while(J!==null){if(Z.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Y.exec($);continue}let X=BZ($,J.index);if(X)Z.push(X),Y.lastIndex=X.end;J=Y.exec($)}return Z}function H7($,Z,Y){let J=[],G=new RegExp(`@${Z}\\s*\\(`,"g"),X=G.exec($);while(X!==null){if(J.some((H)=>X.index>H.start&&X.index<H.end)){X=G.exec($);continue}let K=X.index,q=K+X[0].length-1,_=U4($,"(",")",q);if(_===-1){X=G.exec($);continue}let j=$.slice(q+1,_),B=_+1,W=z7($,Z,Y,B);if(W===-1){X=G.exec($);continue}let z=$.slice(B,W),U=W+`@${Y}`.length;J.push({fullMatch:$.slice(K,U),name:Z,params:j,content:z,start:K,end:U}),G.lastIndex=U,X=G.exec($)}return J}function f0($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let J=Z+Y[0].length,G=A5($,J);if(!G)return null;let X=G.endPos,Q=z7($,"switch","endswitch",X);if(Q===-1)return null;let K=$.slice(X,Q),q=[],_=0,j=null;while(_<K.length){let B=K.slice(_).match(/^@case\s*/),W=K.slice(_).match(/^@default(?![a-z])/),z=K.slice(_).match(/^@break(?![a-z])/);if(B&&K.slice(_).startsWith("@case")){if(j)q.push(j);let U=_+B[0].length,H=A5(K,U);if(!H){_++;continue}j={type:"case",value:H.expression,content:""},_=H.endPos}else if(W&&K.slice(_).startsWith("@default")){if(j)q.push(j);j={type:"default",content:""},_+=W[0].length}else if(z&&K.slice(_).startsWith("@break"))_+=z[0].length;else{if(j)j.content+=K[_];_++}}if(j)q.push(j);return{fullMatch:$.slice(Z,Q+10),expression:G.expression,cases:q,start:Z,end:Q+10}}var WZ=()=>{};var UZ=()=>{};var g0=w(()=>{WZ();UZ()});import t from"process";function QX($,Z,Y){let J=$,G=!0;while(G){G=!1;let X=J.match(/@switch\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=f0(J,Q);if(!K)break;try{let q;if(J4(K.expression))q=W4(K.expression,Object.keys(Z))(...Object.values(Z));else q=n(K.expression,Z);let _="",j=!1;for(let B of K.cases)if(B.type==="default"){if(!j)_=B.content.replace(/@break/g,"").trim()}else try{let W;if(B.value&&J4(B.value))W=W4(B.value,Object.keys(Z))(...Object.values(Z));else if(B.value)W=n(B.value,Z);if(q===W){_=B.content.replace(/@break/g,"").trim(),j=!0;break}}catch{continue}J=J.substring(0,Q)+_+J.substring(K.end),G=!0}catch(q){let _=q instanceof Error?q.message:String(q),j=f("Switch",`Error evaluating @switch expression: ${_}`,P.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(K.end);break}}return J}function $5($,Z,Y){let J=$;J=QX(J,Z,Y),J=J.replace(/@unless\s*\(([^)]+)\)([\s\S]*?)@endunless/g,(X,Q,K)=>{let q=K.match(/^([\s\S]*?)@else([\s\S]*)$/);if(q){let _=q[1],j=q[2];return`@if (${Q})${j}@else${_}@endif`}else return`@if (!(${Q}))${K}@endif`}),J=d0(J,Z,Y),J=m0(J,Z,Y),J=h0(J,Z);let G=()=>{let X=v0(J);if(X.length===0)return!1;for(let Q=X.length-1;Q>=0;Q--){let K=X[Q];try{let q="",_=!1;for(let j of K.branches){if(_)break;if(j.type==="else")q=j.content,_=!0;else try{let B;if(j.condition&&J4(j.condition))B=W4(j.condition,Object.keys(Z))(...Object.values(Z));else if(j.condition)B=n(j.condition,Z);if(B)q=j.content,_=!0}catch(B){q=f(j.type==="if"?"If":"Elseif",`Error in @${j.type}(${j.condition}): ${B instanceof Error?B.message:String(B)}`,P.EVALUATION_ERROR),_=!0}}J=J.substring(0,K.start)+q+J.substring(K.end)}catch(q){let _=q instanceof Error?q.message:String(q),j=f("If",`Error processing @if block: ${_}`,P.EVALUATION_ERROR);J=J.substring(0,K.start)+j+J.substring(K.end)}}return!0};while(G());return J}function h0($,Z){let Y=$;return Y=Y.replace(/@auth\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endauth/g,(J,G,X,Q)=>{return(G?R4(`auth?.check && auth?.user?.[${G}]`,Z):R4("auth?.check",Z))?X:Q||""}),Y=Y.replace(/@guest\s*(?:\((.*?)\)\s*)?\n([\s\S]*?)(?:@else\s*\n([\s\S]*?))?@endguest/g,(J,G,X,Q)=>{return(G?R4(`!auth?.check || !auth?.user?.[${G}]`,Z):R4("!auth?.check",Z))?X:Q||""}),Y=Y.replace(/@can\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecan\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcan/g,(J,G,X,Q,K,q,_,j,B,W)=>{let z=!1;if(Z.userCan&&typeof Z.userCan[G]==="boolean")z=Z.userCan[G];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[G];if(X)U.push(X);if(Q){let H=R4(Q,Z);U.push(H)}z=Z.permissions.check(...U)}catch{z=!1}if(z)return K;else if(q){let U=!1;if(Z.userCan&&typeof Z.userCan[q]==="boolean")U=Z.userCan[q];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let O=R4(j,Z);H.push(O)}U=Z.permissions.check(...H)}catch{U=!1}return U?B:W||""}else return W||""}),Y=Y.replace(/@cannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?)(?:@elsecannot\('([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)\s*\n([\s\S]*?))?(?:@else\s*\n([\s\S]*?))?@endcannot/g,(J,G,X,Q,K,q,_,j,B,W)=>{let z=!0;if(Z.userCan&&typeof Z.userCan[G]==="boolean")z=!Z.userCan[G];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[G];if(X)U.push(X);if(Q){let H=R4(Q,Z);U.push(H)}z=!Z.permissions.check(...U)}catch{z=!0}if(z)return K;else if(q){let U=!0;if(Z.userCan&&typeof Z.userCan[q]==="boolean")U=!Z.userCan[q];else if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let H=[q];if(_)H.push(_);if(j){let O=R4(j,Z);H.push(O)}U=!Z.permissions.check(...H)}catch{U=!0}return U?B:W||""}else return W||""}),Y}function d0($,Z,Y){let J=$;return J=J.replace(/@isset\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endisset/g,(G,X,Q,K,q)=>{try{let _=R4(X.trim(),Z);if(_!==void 0&&_!==null)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return f("Isset",`Error processing @isset directive: ${j}`,P.EVALUATION_ERROR)}}),J=J.replace(/@empty\(([^)]+)\)((?:.|\n)*?)(?:@else((?:.|\n)*?))?@endempty/g,(G,X,Q,K,q)=>{try{let _=R4(X.trim(),Z);if(_===void 0||_===null||_===""||Array.isArray(_)&&_.length===0||typeof _==="object"&&_!==null&&Object.keys(_).length===0)return Q;return K||""}catch(_){let j=_ instanceof Error?_.message:String(_);return f("Empty",`Error processing @empty directive: ${j}`,P.EVALUATION_ERROR)}}),J}function m0($,Z,Y){let J=$;return J=J.replace(/@env\s*\(\s*(['"])([^'"]+)\1\s*\)([\s\S]*?)(?:@else([\s\S]*?))?@endenv/g,(G,X,Q,K,q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")===Q?K:q}),J=J.replace(/@production([\s\S]*?)(?:@else([\s\S]*?))?@endproduction/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="production"?X:Q}),J=J.replace(/@development([\s\S]*?)(?:@else([\s\S]*?))?@enddevelopment/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="development"?X:Q}),J=J.replace(/@staging([\s\S]*?)(?:@else([\s\S]*?))?@endstaging/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="staging"?X:Q}),J=J.replace(/@testing([\s\S]*?)(?:@else([\s\S]*?))?@endtesting/g,(G,X,Q="")=>{return(t.env.NODE_ENV||t.env.BUN_ENV||"development")==="testing"?X:Q}),J}var O7=w(()=>{jZ();D4();g0();L4()});function HZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function L7($,Z){if(!$)return Z?.nonceGenerator?.()??HZ();let Y=zZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??HZ(),zZ.set($,Y);return Y}function KX($,Z){let Y=[];for(let[J,G]of Object.entries($)){if(G===void 0||G===null)continue;if(typeof G==="boolean"){if(G)Y.push(J);continue}if(Array.isArray(G)){let X=[...G];if(Z&&(J==="script-src"||J==="style-src"))X=X.filter((Q)=>!Q.startsWith("'nonce-")),X.push(`'nonce-${Z}'`);if(X.length>0)Y.push(`${J} ${X.join(" ")}`)}}return Y.join("; ")}function OZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${KX($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function LZ($,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?L7(Y,Z):void 0,G=OZ(Z.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
3823
+ ${G}`)}function FZ($,Z,Y,J){let G=$,X=J.csp;if(G=G.replace(/@csp\b/g,()=>{if(!X?.enabled||!X.directives)return"<!-- CSP not configured -->";let Q=X.useNonce?L7(Z,X):void 0;return OZ(X.directives,Q)}),G=G.replace(/@cspNonce\b/g,()=>{if(!X?.enabled||!X.useNonce)return"";return L7(Z,X)}),X?.enabled&&X.useNonce)Z.cspNonce=L7(Z,X);return G}var zZ;var AZ=w(()=>{zZ=new WeakMap});import qX from"crypto";function jX($=_X){let Z=qX.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return u0=Z,Z}function BX(){if(!u0)jX();return u0}function WX($=RZ){let Z=BX();return`<input type="hidden" name="${$}" value="${Z}">`}function NZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,J)=>{return WX(J||RZ)})}var _X=40,RZ="_token",u0=null;var VZ=()=>{};async function MZ($,Z,Y,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let G=$;for(let X of J.customDirectives){if(!X.name||typeof X.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",X);continue}if(X.hasEndTag)G=await UX(G,X,Z,Y,J);else G=await zX(G,X,Z,Y,J)}return G}async function UX($,Z,Y,J,G){let{name:X,handler:Q}=Z,K=`@${X}`,q=`@end${X}`,_=$,j=j5(`${K}(?:\\s*\\(([^)]+)\\))?([\\s\\S]*?)${q}`,"g"),B=[],W=j.exec(_);while(W!==null){let[z,U="",H=""]=W,O=W.index||0;try{let F=U?TZ(U):[],L=H.trim(),A=await Q(L,F,Y,J);B.push({original:z,processed:A,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(G.debug)console.error(`Error processing custom directive @${X}:`,F);B.push({original:z,processed:f("CustomDirective",`Error in @${X}${U?`(${U})`:""}: ${L}`,P.EVALUATION_ERROR),startIndex:O})}W=j.exec(_)}for(let z=B.length-1;z>=0;z--){let{original:U,processed:H}=B[z];_=_.replace(U,H)}return _}async function zX($,Z,Y,J,G){let{name:X,handler:Q}=Z,K=$,q=j5(`@${X}\\s*\\(([^)]+)\\)`,"g"),_=[],j=q.exec(K);while(j!==null){let[B,W=""]=j,z=j.index||0;try{let U=TZ(W),H=await Q("",U,Y,J);_.push({original:B,processed:H,startIndex:z})}catch(U){let H=U instanceof Error?U.message:String(U);if(G.debug)console.error(`Error processing custom directive @${X}:`,U);_.push({original:B,processed:f("CustomDirective",`Error in @${X}(${W}): ${H}`,P.EVALUATION_ERROR),startIndex:z})}j=q.exec(K)}for(let B=_.length-1;B>=0;B--){let{original:W,processed:z}=_[B];K=K.replace(W,z)}return K}function TZ($){if(!$.trim())return[];let Z=[],Y="",J=!1,G="";for(let X=0;X<$.length;X++){let Q=$[X];if((Q==='"'||Q==="'")&&(X===0||$[X-1]!=="\\"))if(!J)J=!0,G=Q;else if(Q===G)J=!1;else Y+=Q;else if(Q===","&&!J)Z.push(Y.trim()),Y="";else Y+=Q}if(Y.trim())Z.push(Y.trim());return Z.map((X)=>{let Q=X.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var IZ=w(()=>{D4();i4()});import HX from"crypto";function LX(){return HX.randomUUID()}function DZ($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let J=LX();Z.csrf={token:J}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${Z.csrf.token}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,G)=>{if(G&&["PUT","PATCH","DELETE"].includes(G.toUpperCase()))return`<input type="hidden" name="_method" value="${G.toUpperCase()}">`;return J}),Y}function EZ($,Z,Y=OX){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,G,X)=>{try{if(FX(G,Z))return X.replace(/\{\{([^}]+)\}\}/g,(Q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return wZ(G,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(G);return wZ(G,Z)}let q=K.trim();if(J4(q)){let _=n(q,Z);return _!==void 0?String(_):q}return q}catch{return K}});return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function FX($,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 wZ($,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""}var OX;var kZ=w(()=>{L4();OX={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import SZ from"path";function AX($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function RX($,Z){if({...i0,...Z.i18n}.cache&&l0[$]){let G=l0[$],X=Z.i18n?.cacheMaxAge??0;if(!AX(G,X))return G.translations}if(R5[$]?.state==="loading")return R5[$].promise;p0[$]="loading";let J=yZ($,Z).then((G)=>{return p0[$]="loaded",delete R5[$],G}).catch((G)=>{throw p0[$]="error",R5[$]={promise:J,state:"error",error:G instanceof Error?G:Error(String(G))},G});return R5[$]={promise:J,state:"loading"},J}async function yZ($,Z){let Y={...i0,...Z.i18n},J=SZ.resolve(import.meta.dir,"..",Y.translationsDir),G=TX(Y.format),X=SZ.join(J,`${$}${G}`);try{let Q={};try{let K=await import(X);Q=K.default||K}catch(K){let q=await Bun.file(X).text();if(Y.format==="yaml"||Y.format==="yml")Q=VX(q);else if(Y.format==="json")Q=JSON.parse(q);else throw K}if(Y.cache)l0[$]={translations:Q,loadedAt:Date.now(),locale:$};return Q}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return yZ(Y.defaultLocale,Z);return{}}}async function NX($,Z){return RX($,Z)}function VX($){let Z={},Y=$.split(`
3824
+ `),J=[{obj:Z,indent:-1}];for(let G of Y){let X=G.replace(/#.*$/,"").trimEnd();if(!X.trim())continue;let Q=X.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let K=J[J.length-1].obj,q=X.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,_,j]=q,B=_.trim(),W=j.trim();if(W==="")K[B]={},J.push({obj:K[B],indent:Q});else K[B]=MX(W)}}return Z}function MX($){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 TX($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"json":default:return".json"}}function IX($,Z){for(let Y of $){let J=Y.trim(),G=J.match(/^\{(\d+)\}\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10);if(Z===Q)return G[2];continue}let X=J.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(X){let Q=Number.parseInt(X[1],10),K=X[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(X[2],10);if(Z>=Q&&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 wX($,Z={}){return CZ($,Z)}function CZ($,Z){let Y="",J=0;while(J<$.length)if($[J]==="{"){let G=DX($,J);if(G===-1){Y+=$[J],J++;continue}let X=$.slice(J+1,G);Y+=EX(X,Z),J=G+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 DX($,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 EX($,Z){let Y=kX($);if(Y.length===0)return`{${$}}`;let J=Y[0].trim(),G=Z[J];if(Y.length===1)return G!==void 0?String(G):`{${J}}`;switch(Y[1].trim().toLowerCase()){case"plural":return SX(G,Y.slice(2).join(","),Z);case"select":return PX(G,Y.slice(2).join(","));case"selectordinal":return yX(G,Y.slice(2).join(","));case"number":return xX(G,Y[2]?.trim());case"date":return vX(G,Y[2]?.trim());case"time":return fX(G,Y[2]?.trim());default:return G!==void 0?String(G):`{${$}}`}}function kX($){let Z=[],Y="",J=0;for(let G=0;G<$.length;G++){let X=$[G];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 SX($,Z,Y){let J=Number($)||0,G=n0(Z),X=`=${J}`;if(G[X])return c0(G[X],J,Y);let Q=bX(J);if(G[Q])return c0(G[Q],J,Y);if(G.other)return c0(G.other,J,Y);return String(J)}function c0($,Z,Y){let J=$.replace(/#/g,String(Z));return CZ(J,Y)}function bX($){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 PX($,Z){let Y=String($||""),J=n0(Z);if(J[Y])return J[Y];return J.other||String($)}function yX($,Z){let Y=Number($)||0,J=n0(Z),G=CX(Y);if(J[G])return J[G].replace(/#/g,String(Y));if(J.other)return J.other.replace(/#/g,String(Y));return String(Y)}function CX($){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 n0($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Y.exec($);while(J!==null)Z[J[1]]=J[2],J=Y.exec($);return Z}function xX($,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 vX($,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 fX($,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 gX($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function bZ($,Z,Y=!0,J={}){let G=$.split("."),X=Z;for(let K of G){if(X===void 0||X===null)break;X=X[K]}if(X===void 0||X===null)return Y?$:"";let Q=String(X);if(gX(Q))return wX(Q,J);if(Q.includes("|")&&"count"in J){let K=Number(J.count),q=Q.split("|");Q=IX(q,K)}for(let[K,q]of Object.entries(J))Q=Q.replace(new RegExp(`:${K}`,"g"),String(q));return Q}async function xZ($,Z,Y,J){let G=$,X=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...i0,...J.i18n},K=await NX(Q.locale,J);Z.__translations=K,Z.__locale=Q.locale,Z.__i18nConfig=Q,G=await PZ(G,X,async(j,B,W,z,U)=>{try{let H={};if(W)try{let F=[()=>JSON.parse(W),()=>{let L=`{"data":${W}}`,A=JSON.parse(L);return typeof A.data==="object"?A.data:{}},()=>{return O4(W,Z)}];for(let L of F)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(F){if(J.debug)console.error("Error parsing parameters for @translate directive:",F)}return bZ(B,K,Q.fallbackToKey,H)||z.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return f("Translate",`Error in @translate('${B}'): ${H instanceof Error?H.message:String(H)}`,P.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${G.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let j=[...G.matchAll(q)];console.warn(`Found ${j.length} @translate matches`),j.forEach((B,W)=>console.warn(`Match ${W}: ${B[0]}, Key: ${B[1]}, Params: ${B[2]||"none"}`))}return G=await PZ(G,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(j,B,W,z)=>{try{let U={};if(W)try{let H=[()=>JSON.parse(W),()=>{let O=`{"data":${W}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return O4(W,Z)}];for(let O of H)try{if(U=O(),Object.keys(U).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return bZ(B,K,Q.fallbackToKey,U)}catch(U){if(J.debug)console.error("Error processing @translate directive:",U);return f("Translate",`Error in @translate('${B}'): ${U instanceof Error?U.message:String(U)}`,P.EVALUATION_ERROR)}}),G}async function PZ($,Z,Y){let J=[];return $.replace(Z,(X,...Q)=>{let K=Y(X,...Q).then((q)=>({match:X,replacement:q}));return J.push(K),X}),(await Promise.all(J)).reduce((X,{match:Q,replacement:K})=>X.replace(Q,K),$)}var i0,l0,R5,p0;var vZ=w(()=>{D4();L4();i0={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},l0={},R5={},p0={}});var mZ={};o(mZ,{processLoops:()=>s0});function mX($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,G)=>{if(G in Z)return`:${G}="${G}"`;return J}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,G,X)=>{try{let Q=Object.keys(Z),K=Object.values(Z),_=Function(...Q,`return ${X}`)(...K),B=JSON.stringify(_).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");return`__stx_${G}="${B}"`}catch(Q){return J}}),Y}function uX($,Z){let Y=$;return Y=Y.replace(/@break\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if(J4(Q)){let q=W4(Q,Object.keys(Z));K=Boolean(q(...Object.values(Z)))}else K=Boolean(n(Q,Z));return K?F7:""}catch{return""}}),Y=Y.replace(/@continue\(([^)]+)\)/g,(J,G)=>{try{let Q=`!!(${G.trim()})`,K;if(J4(Q)){let q=W4(Q,Object.keys(Z));K=Boolean(q(...Object.values(Z)))}else K=Boolean(n(Q,Z));return K?A7:""}catch{return""}}),Y}function pX($){let Z=$;return Z=Z.replace(/@break(?!\()/g,F7),Z=Z.replace(/@continue(?!\()/g,A7),Z}function fZ($){let Z=$.includes(F7),Y=Z?$.substring(0,$.indexOf(F7)):$;return{hasBreak:Z,content:Y}}function gZ($){let Z=$.includes(A7),Y=Z?$.substring(0,$.indexOf(A7)):$;return{hasContinue:Z,content:Y}}function hZ($){let Z=$;return Z=Z.replace(/@break\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { break; } result += \``}),Z=Z.replace(/@continue\(([^)]+)\)/g,(Y,J)=>{return`\`; if (${J.trim()}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function s0($,Z,Y,J){let G=$;G=G.replace(/@forelse\s*\(([^)]+)as([^)]+)\)([\s\S]*?)@empty([\s\S]*?)@endforelse/g,(q,_,j,B,W,z)=>{try{let U=_.trim(),H;if(J4(U))H=W4(U,Object.keys(Z))(...Object.values(Z));else H=n(U,Z);if(!Array.isArray(H)||H.length===0)return W;return`@foreach (${U} as ${j.trim()})${B}@endforeach`}catch(U){return f("Forelse",`Error in @forelse(${_.trim()} as ${j.trim()}): ${U instanceof Error?U.message:String(U)}`,P.EVALUATION_ERROR)}});function X(q){let _=/@foreach\s*\(/g,j;while((j=_.exec(q))!==null){let B=j.index,W=j.index+j[0].length-1,z=1,U=W+1,H=-1;while(U<q.length&&z>0){if(q[U]==="(")z++;else if(q[U]===")"){if(z--,z===0){H=U;break}}U++}if(H===-1)continue;let O=q.substring(W+1,H),F=O.indexOf(" as ");if(F===-1)continue;let L=B,A=O.substring(0,F),M=O.substring(F+4),V=H+1,R=1,N=V,T=/@foreach\s*\(/g,D=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,D.lastIndex=N;let E=T.exec(q),k=D.exec(q);if(!k)break;if(E&&E.index<k.index)R++,N=E.index+E[0].length;else{if(R--,R===0){let I=q.substring(V,k.index),S=k.index+11;return{start:L,end:S,arrayExpr:A,itemVar:M,content:I}}N=k.index+11}}}return null}function Q(q,_){let j=q;while(!0){let B=X(j);if(!B)break;let{start:W,end:z,arrayExpr:U,itemVar:H,content:O}=B;try{let F=U.trim(),L;if(J4(F))L=W4(F,Object.keys(_))(...Object.values(_));else L=n(F,_);if(!Array.isArray(L)){let T=f("Foreach",`Error in @foreach: ${F} is not an array`,P.TYPE_ERROR);j=j.substring(0,W)+T+j.substring(z);continue}let A=J?.loops?.useAltLoopVariable??dX,M=H.trim(),V=null,R;if(M.includes("=>")){let T=M.split("=>").map((D)=>D.trim());if(T.length===2)V=T[0],R=T[1];else R=M}else R=M;let N="";for(let T=0;T<L.length;T++){let D=L[T],E={index:T,iteration:T+1,first:T===0,last:T===L.length-1,count:L.length},k={..._,[R]:D,loop:E,$loop:E};if(V)k[V]=T;let I=uX(O,k),S=gZ(I);if(S.hasContinue){N+=S.content;continue}let d=fZ(I);if(d.hasBreak){N+=d.content;break}if(I=Q(I,k),I=$5(I,k,Y),I=pX(I),d=fZ(I),d.hasBreak){N+=d.content;break}if(S=gZ(I),S.hasContinue){N+=S.content;continue}I=c4(I,k,Y),I=mX(I,k),N+=I}j=j.substring(0,W)+N+j.substring(z)}catch(F){let L=f("Foreach",`Error in @foreach(${U.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,P.EVALUATION_ERROR);j=j.substring(0,W)+L+j.substring(z)}}return j}G=Q(G,Z),G=cX(G,Z);let K=J?.loops?.maxWhileIterations??hX;return G=lX(G,Z,K),G}function dZ($){return q$($)}function cX($,Z){let Y=$,J=!0;while(J){J=!1;let G=Y.match(/@for\s*\(/);if(!G||G.index===void 0)break;let X=G.index,Q=X+G[0].length-1,K=U4(Y,"(",")",Q);if(K===-1)break;let q=Y.slice(Q+1,K),_=K+1,j=H7(Y.slice(X),"for","endfor");if(j.length===0)break;let B=j[0].content,W=X+j[0].end;if(!dZ(q)){let z=f("For",`Unsafe expression in @for: ${q}`,P.UNSAFE_EXPRESSION);Y=Y.substring(0,X)+z+Y.substring(W),J=!0;continue}try{let z=Object.keys(Z),U=Object.values(Z),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(L,A)=>{return`\${${A}}`});H=hZ(H);let F=Function(...z,`
3817
3825
  let result = '';
3818
3826
  for (${q}) {
3819
3827
  result += \`${H}\`;
3820
3828
  }
3821
3829
  return result;
3822
- `)(...W);Y=Y.substring(0,X)+F+Y.substring(U),J=!0}catch(z){let W=g("For",`Error in @for(${q}): ${z instanceof Error?z.message:String(z)}`,y.EVALUATION_ERROR);Y=Y.substring(0,X)+W+Y.substring(U),J=!0}}return Y}function dX($,Z,Y){let J=$,G=!0;while(G){G=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=Q+X[0].length-1,q=B4(J,"(",")",K);if(q===-1)break;let _=J.slice(K+1,q),j=W7(J.slice(Q),"while","endwhile");if(j.length===0)break;let B=j[0].content,U=Q+j[0].end;if(!gZ(_)){let z=g("While",`Unsafe expression in @while: ${_}`,y.UNSAFE_EXPRESSION);J=J.substring(0,Q)+z+J.substring(U),G=!0;continue}try{let z=Object.keys(Z),W=Object.values(Z),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(L,R)=>{return`\${${R}}`});H=fZ(H);let F=Function(...z,`
3830
+ `)(...U);Y=Y.substring(0,X)+F+Y.substring(W),J=!0}catch(z){let U=f("For",`Error in @for(${q}): ${z instanceof Error?z.message:String(z)}`,P.EVALUATION_ERROR);Y=Y.substring(0,X)+U+Y.substring(W),J=!0}}return Y}function lX($,Z,Y){let J=$,G=!0;while(G){G=!1;let X=J.match(/@while\s*\(/);if(!X||X.index===void 0)break;let Q=X.index,K=Q+X[0].length-1,q=U4(J,"(",")",K);if(q===-1)break;let _=J.slice(K+1,q),j=H7(J.slice(Q),"while","endwhile");if(j.length===0)break;let B=j[0].content,W=Q+j[0].end;if(!dZ(_)){let z=f("While",`Unsafe expression in @while: ${_}`,P.UNSAFE_EXPRESSION);J=J.substring(0,Q)+z+J.substring(W),G=!0;continue}try{let z=Object.keys(Z),U=Object.values(Z),H=B.replace(/`/g,"\\`").replace(/\{\{([^}]+)\}\}/g,(L,A)=>{return`\${${A}}`});H=hZ(H);let F=Function(...z,`
3823
3831
  let result = '';
3824
3832
  let maxIterations = ${Y}; // Configurable safety limit
3825
3833
  let counter = 0;
@@ -3831,8 +3839,8 @@ ${G}`)}function OZ($,Z,Y,J){let G=$,X=J.csp;if(G=G.replace(/@csp\b/g,()=>{if(!X?
3831
3839
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3832
3840
  }
3833
3841
  return result;
3834
- `)(...W);J=J.substring(0,Q)+F+J.substring(U),G=!0}catch(z){let W=g("While",`Error in @while(${_}): ${z instanceof Error?z.message:String(z)}`,y.EVALUATION_ERROR);J=J.substring(0,Q)+W+J.substring(U),G=!0}}return J}var CX=1000,vX=!1,O7="<!--__STX_BREAK__-->",L7="<!--__STX_CONTINUE__-->";var s0=I(()=>{z7();I4();l4();f0();H4()});import o0 from"fs";import e from"path";function mX($){return/\b(state|derived|effect)\s*\(/.test($)}function uX($){let Z=$,Y=[],J=new Set,G=0,X=0,Q=Z.length,K=(B)=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if(Z[X]==="{")B++;else if(Z[X]==="}")B--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<Q&&Z[X]!==`
3835
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<Q-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let W=B[2];if(!J.has(W))Y.push(W),J.add(W);return}let U=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let W=U[1];if(!J.has(W))Y.push(W),J.add(W);return}let z=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let W=z[1];if(!J.has(W))Y.push(W),J.add(W)}};while(X<Q){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){G++,X++;continue}if(Z[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))j();X++}return Y.join(", ")}function pX($,Z){let Y=uX($);return`
3842
+ `)(...U);J=J.substring(0,Q)+F+J.substring(W),G=!0}catch(z){let U=f("While",`Error in @while(${_}): ${z instanceof Error?z.message:String(z)}`,P.EVALUATION_ERROR);J=J.substring(0,Q)+U+J.substring(W),G=!0}}return J}var hX=1000,dX=!1,F7="<!--__STX_BREAK__-->",A7="<!--__STX_CONTINUE__-->";var o0=w(()=>{O7();D4();l4();g0();L4()});import r0 from"fs";import Z4 from"path";function iX($){return/\b(state|derived|effect)\s*\(/.test($)}function nX($){let Z=$,Y=[],J=new Set,G=0,X=0,Q=Z.length,K=(B)=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if(Z[X]==="{")B++;else if(Z[X]==="}")B--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<Q&&Z[X]!==`
3843
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<Q-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let U=B[2];if(!J.has(U))Y.push(U),J.add(U);return}let W=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let U=W[1];if(!J.has(U))Y.push(U),J.add(U);return}let z=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let U=z[1];if(!J.has(U))Y.push(U),J.add(U)}};while(X<Q){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){G++,X++;continue}if(Z[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))j();X++}return Y.join(", ")}function sX($,Z){let Y=nX($);return`
3836
3844
  (function() {
3837
3845
  var __stx = window.stx || {};
3838
3846
  var state = __stx.state || function(v) { var s = function() { return s._v; }; s._v = v; s.set = function(nv) { s._v = nv; }; s.update = function(fn) { s._v = fn(s._v); }; return s; };
@@ -3849,17 +3857,17 @@ ${$}
3849
3857
  if (!window.stx._scopes) window.stx._scopes = {};
3850
3858
  window.stx._scopes['${Z}'] = { ${Y} };
3851
3859
  })();
3852
- `}function cX($,Z){let Y=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)([\s>])/s);if(Y){let[,J,G,X]=Y;if($.includes("data-stx-scope"))return $;return`${J}${G} data-stx-scope="${Z}"${X}${$.slice(Y[0].length)}`}return $}function nX($){if($.__onceStore instanceof Set)return $.__onceStore;return iX}async function r0($,Z,Y,J,G,X=new Set){let Q=J.partialsDir||e.join(e.dirname(Y),"partials");if(Q&&!e.isAbsolute(Q)){let O=e.resolve(__dirname,"..");Q=e.resolve(O,Q)}let K=$.replace(/@partial\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L)=>`@include('${F}'${L?`, ${L}`:""})`),q=nX(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(O,F,L)=>{let R=F.trim(),M=`${Y}:${R}`;if(q.has(M))return"";return q.add(M),F}),K=K.replace(/@includeIf\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L)=>{let R=B(F,Q,Y);if(R&&o0.existsSync(R))return G.add(R),`@include('${F}'${L?`, ${L}`:""})`;return""}),K=K.replace(/@includeWhen\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L,R,M)=>{try{let V=`Boolean(${F})`,A;if(Z4(V)){let N=j4(V,Object.keys(Z));A=Boolean(N(...Object.values(Z)))}else A=Boolean(i(V,Z));if(A){let N=B(L,Q,Y);if(N&&o0.existsSync(N))G.add(N);return`@include('${L}'${R?`, ${R}`:""})`}return""}catch(V){let A=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeWhen condition: ${A}`,Y,$,M,O)}}),K=K.replace(/@includeUnless\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L,R,M)=>{try{let V=`Boolean(${F})`,A;if(Z4(V)){let N=j4(V,Object.keys(Z));A=Boolean(N(...Object.values(Z)))}else A=Boolean(i(V,Z));if(!A){let N=B(L,Q,Y);if(N&&o0.existsSync(N))G.add(N);return`@include('${L}'${R?`, ${R}`:""})`}return""}catch(V){let A=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeUnless condition: ${A}`,Y,$,M,O)}});let _=/@includeFirst\s*\(\s*(\[[^\]]+\])\s*(?:,\s*(\{[^}]*\})\s*)?(?:,\s*['"]([^'"]*)['"]\s*)?\)/g,j;while(j=_.exec(K)){let[O,F,L,R]=j,M=j.index;try{let V=JSON.parse(F.replace(/'/g,'"')),A={};if(L)try{A=z4(L,Z)}catch(T){let D=T instanceof Error?T.message:String(T);if(J.debug)K=K.replace(O,l("Include",`Error parsing includeFirst variables: ${D}`,Y,$,M,O));else K=K.replace(O,R||"");continue}let N=!1;for(let T of V){let D=B(T,Q,Y);if(!D)continue;if(await p(D)){let E=await z(T,A,$,M);K=K.replace(O,E),N=!0;break}}if(!N)if(R!==void 0)K=K.replace(O,R);else if(J.debug)K=K.replace(O,l("Include",`None of the includeFirst paths exist: ${F}`,Y,$,M,O));else K=K.replace(O,"")}catch(V){let A=V instanceof Error?V.message:String(V);K=K.replace(O,l("Include",`Error processing @includeFirst: ${A}`,Y,$,M,O))}_.lastIndex=0}function B(O,F,L){try{let R=O;if(!O.endsWith(".stx"))R=`${O}.stx`;let M=e.resolve(F),V=e.resolve(e.dirname(L)),A;if(!R.startsWith("./")&&!R.startsWith("../"))A=e.resolve(F,R);else A=e.resolve(V,R);let N=e.normalize(A),T=N.startsWith(M+e.sep)||N===M,D=N.startsWith(V+e.sep)||N===V,E=!1,k=V;for(let w=0;w<3;w++)if(k=e.dirname(k),N.startsWith(k+e.sep)){E=!0;break}if(!T&&!D&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${O}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${M}, ${V}`),null;return N}catch(R){return console.error(`Error resolving path ${O}: ${R}`),null}}let U=e.resolve(Y);X.add(U);async function z(O,F={},L,R){let M=B(O,Q,Y);if(!M)return l("Include",`Could not resolve path for include: ${O}`,Y,L,R);let V=e.resolve(M);if(X.has(V)){let A=[...X,V].map((N)=>e.basename(N)).join(" -> ");return l("Include",`Circular include detected: ${A}`,Y,L,R)}try{if(!M)return l("Include",`Could not resolve path for include: ${O}`,Y,L,R);G.add(M);let A=dZ.get(M);if(!A)try{A=await Bun.file(M).text(),dZ.set(M,A)}catch(X4){let s=X4 instanceof Error?X4.message:String(X4);return l("Include",`Error loading include file ${O}: ${s}`,Y,L,R)}let N=A,T=N.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(T)N=T[1].trim();let D=A.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),E="";if(D)E=`<style${D[1]}>${D[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};for(let[X4,s]of Object.entries(F))k[X4]=s;let w=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(w)],m="",c=null;for(let X4 of S){let s=X4[1]||"",a=X4[2]||"",G4=s.includes("server"),h=s.includes("client")||s.includes('type="module"');if(n4(s)&&a.trim())a=s4(a);let b=mX(a);if(b&&!G4){c=`stx_scope_${e.basename(M,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++lX}`;let x=w4(a),$4=pX(x,c);m+=`<script data-stx-scoped>${$4}</script>
3853
- `;continue}if(G4||!h&&!s.includes("src")&&!b)try{let{extractVariables:x}=await Promise.resolve().then(() => (W5(),v5));await x(a,k,M)}catch(x){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${M}:`,x)}if(h&&!b)m+=`<script${s}>${a}</script>
3854
- `}if(c)N=cX(N,c);if(N.includes("@include")||N.includes("@partial"))N=await r0(N,k,M,J,G,X);let{processLoops:P}=await Promise.resolve().then(() => (s0(),hZ)),u=P(N,k,M);if(u=$5(u,k,M),u=c4(u,k,M),E)u+=`
3855
- `+E;if(m)u+=`
3856
- `+m;return u}catch(A){let N=A instanceof Error?A.message:String(A);return l("Include",`Error processing include ${O}: ${N}`,Y,L,R)}}let W=/@include\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,H;while(H=W.exec(K)){let[O,F,L]=H,R=H.index,M={};if(L)try{M=z4(L,Z)}catch(A){let N=A instanceof Error?A.message:String(A);K=K.replace(O,l("Include",`Error parsing include variables for ${F}: ${N}`,Y,$,R));continue}let V=await z(F,M,$,R);K=K.replace(O,V),W.lastIndex=0}return K}function a0($,Z){let Y=$;return Y=Y.replace(/@push\(['"]([^'"]+)['"]\)([\s\S]*?)@endpush/g,(J,G,X)=>{if(!Z[G])Z[G]=[];return Z[G].push(X),""}),Y=Y.replace(/@prepend\(['"]([^'"]+)['"]\)([\s\S]*?)@endprepend/g,(J,G,X)=>{if(!Z[G])Z[G]=[];return Z[G].unshift(X),""}),Y}function t0($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3857
- `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",lX=0,dZ,iX;var mZ=I(()=>{z7();l4();i4();H4();q5();A4();dZ=new B5(500),iX=new Set});import*as e0 from"path";async function uZ($,Z,Y=""){if(e0.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 cZ($,Z,Y,"@js","@endjs")}async function pZ($,Z,Y=""){if(e0.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 cZ($,Z,Y,"@ts","@endts")}async function cZ($,Z,Y,J,G){let X=$,Q=U5(`${J}([\\s\\S]*?)${G}`,"g"),K=[],q;while((q=Q.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:_,content:j,index:B}of K)try{let U=Object.keys(Z),z=Object.values(Z),W=j.trim();if(J==="@ts")W=W.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 O=(W.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((V)=>V.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3858
- ${W}
3860
+ `}function oX($,Z){let Y=$.match(/^(\s*(?:<!--[\s\S]*?-->\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)([\s>])/s);if(Y){let[,J,G,X]=Y;if($.includes("data-stx-scope"))return $;return`${J}${G} data-stx-scope="${Z}"${X}${$.slice(Y[0].length)}`}return $}function tX($){if($.__onceStore instanceof Set)return $.__onceStore;return aX}async function a0($,Z,Y,J,G,X=new Set){let Q=J.partialsDir||Z4.join(Z4.dirname(Y),"partials");if(Q&&!Z4.isAbsolute(Q)){let O=Z4.resolve(__dirname,"..");Q=Z4.resolve(O,Q)}let K=$.replace(/@partial\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L)=>`@include('${F}'${L?`, ${L}`:""})`),q=tX(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(O,F,L)=>{let A=F.trim(),M=`${Y}:${A}`;if(q.has(M))return"";return q.add(M),F}),K=K.replace(/@includeIf\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L)=>{let A=B(F,Q,Y);if(A&&r0.existsSync(A))return G.add(A),`@include('${F}'${L?`, ${L}`:""})`;return""}),K=K.replace(/@includeWhen\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L,A,M)=>{try{let V=`Boolean(${F})`,R;if(J4(V)){let N=W4(V,Object.keys(Z));R=Boolean(N(...Object.values(Z)))}else R=Boolean(n(V,Z));if(R){let N=B(L,Q,Y);if(N&&r0.existsSync(N))G.add(N);return`@include('${L}'${A?`, ${A}`:""})`}return""}catch(V){let R=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeWhen condition: ${R}`,Y,$,M,O)}}),K=K.replace(/@includeUnless\s*\(([^,]+),\s*['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,(O,F,L,A,M)=>{try{let V=`Boolean(${F})`,R;if(J4(V)){let N=W4(V,Object.keys(Z));R=Boolean(N(...Object.values(Z)))}else R=Boolean(n(V,Z));if(!R){let N=B(L,Q,Y);if(N&&r0.existsSync(N))G.add(N);return`@include('${L}'${A?`, ${A}`:""})`}return""}catch(V){let R=V instanceof Error?V.message:String(V);return l("Include",`Error evaluating @includeUnless condition: ${R}`,Y,$,M,O)}});let _=/@includeFirst\s*\(\s*(\[[^\]]+\])\s*(?:,\s*(\{[^}]*\})\s*)?(?:,\s*['"]([^'"]*)['"]\s*)?\)/g,j;while(j=_.exec(K)){let[O,F,L,A]=j,M=j.index;try{let V=JSON.parse(F.replace(/'/g,'"')),R={};if(L)try{R=O4(L,Z)}catch(T){let D=T instanceof Error?T.message:String(T);if(J.debug)K=K.replace(O,l("Include",`Error parsing includeFirst variables: ${D}`,Y,$,M,O));else K=K.replace(O,A||"");continue}let N=!1;for(let T of V){let D=B(T,Q,Y);if(!D)continue;if(await p(D)){let E=await z(T,R,$,M);K=K.replace(O,E),N=!0;break}}if(!N)if(A!==void 0)K=K.replace(O,A);else if(J.debug)K=K.replace(O,l("Include",`None of the includeFirst paths exist: ${F}`,Y,$,M,O));else K=K.replace(O,"")}catch(V){let R=V instanceof Error?V.message:String(V);K=K.replace(O,l("Include",`Error processing @includeFirst: ${R}`,Y,$,M,O))}_.lastIndex=0}function B(O,F,L){try{let A=O;if(!O.endsWith(".stx"))A=`${O}.stx`;let M=Z4.resolve(F),V=Z4.resolve(Z4.dirname(L)),R;if(!A.startsWith("./")&&!A.startsWith("../"))R=Z4.resolve(F,A);else R=Z4.resolve(V,A);let N=Z4.normalize(R),T=N.startsWith(M+Z4.sep)||N===M,D=N.startsWith(V+Z4.sep)||N===V,E=!1,k=V;for(let I=0;I<3;I++)if(k=Z4.dirname(k),N.startsWith(k+Z4.sep)){E=!0;break}if(!T&&!D&&!E)return console.error(`Security: Path traversal attempt blocked for include path: ${O}`),console.error(` Resolved to: ${N}`),console.error(` Allowed dirs: ${M}, ${V}`),null;return N}catch(A){return console.error(`Error resolving path ${O}: ${A}`),null}}let W=Z4.resolve(Y);X.add(W);async function z(O,F={},L,A){let M=B(O,Q,Y);if(!M)return l("Include",`Could not resolve path for include: ${O}`,Y,L,A);let V=Z4.resolve(M);if(X.has(V)){let R=[...X,V].map((N)=>Z4.basename(N)).join(" -> ");return l("Include",`Circular include detected: ${R}`,Y,L,A)}try{if(!M)return l("Include",`Could not resolve path for include: ${O}`,Y,L,A);G.add(M);let R=uZ.get(M);if(!R)try{R=await Bun.file(M).text(),uZ.set(M,R)}catch(Q4){let s=Q4 instanceof Error?Q4.message:String(Q4);return l("Include",`Error loading include file ${O}: ${s}`,Y,L,A)}let N=R,T=N.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(T)N=T[1].trim();let D=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),E="";if(D)E=`<style${D[1]}>${D[2]}</style>`;N=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N=N.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...Z};for(let[Q4,s]of Object.entries(F))k[Q4]=s;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(I)],d="",c=null;for(let Q4 of S){let s=Q4[1]||"",e=Q4[2]||"",K4=s.includes("server"),g=s.includes("client")||s.includes('type="module"');if(n4(s)&&e.trim())e=w4(e);let m=iX(e);if(m&&!K4){c=`stx_scope_${Z4.basename(M,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++rX}`;let x=I4(e),r=sX(x,c);d+=`<script data-stx-scoped>${r}</script>
3861
+ `;continue}if(K4||!g&&!s.includes("src")&&!m)try{let{extractVariables:x}=await Promise.resolve().then(() => (B5(),y5));await x(e,k,M)}catch(x){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${M}:`,x)}if(g&&!m)d+=`<script${s}>${e}</script>
3862
+ `}if(c)N=oX(N,c);if(N.includes("@include")||N.includes("@partial"))N=await a0(N,k,M,J,G,X);let{processLoops:b}=await Promise.resolve().then(() => (o0(),mZ)),u=b(N,k,M);if(u=$5(u,k,M),u=c4(u,k,M),E)u+=`
3863
+ `+E;if(d)u+=`
3864
+ `+d;return u}catch(R){let N=R instanceof Error?R.message:String(R);return l("Include",`Error processing include ${O}: ${N}`,Y,L,A)}}let U=/@include\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,H;while(H=U.exec(K)){let[O,F,L]=H,A=H.index,M={};if(L)try{M=O4(L,Z)}catch(R){let N=R instanceof Error?R.message:String(R);K=K.replace(O,l("Include",`Error parsing include variables for ${F}: ${N}`,Y,$,A));continue}let V=await z(F,M,$,A);K=K.replace(O,V),U.lastIndex=0}return K}function t0($,Z){let Y=$;return Y=Y.replace(/@push\(['"]([^'"]+)['"]\)([\s\S]*?)@endpush/g,(J,G,X)=>{if(!Z[G])Z[G]=[];return Z[G].push(X),""}),Y=Y.replace(/@prepend\(['"]([^'"]+)['"]\)([\s\S]*?)@endprepend/g,(J,G,X)=>{if(!Z[G])Z[G]=[];return Z[G].unshift(X),""}),Y}function e0($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,J)=>{if(!Z[J]||Z[J].length===0)return"";return Z[J].join(`
3865
+ `)})}var __dirname="/home/runner/work/stx/stx/packages/stx/src",rX=0,uZ,aX;var pZ=w(()=>{O7();l4();i4();L4();q5();F4();uZ=new _5(500),aX=new Set});import*as $6 from"path";async function cZ($,Z,Y=""){if($6.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 iZ($,Z,Y,"@js","@endjs")}async function lZ($,Z,Y=""){if($6.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 iZ($,Z,Y,"@ts","@endts")}async function iZ($,Z,Y,J,G){let X=$,Q=j5(`${J}([\\s\\S]*?)${G}`,"g"),K=[],q;while((q=Q.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:_,content:j,index:B}of K)try{let W=Object.keys(Z),z=Object.values(Z),U=j.trim();if(J==="@ts")U=U.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 O=(U.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((V)=>V.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
3866
+ ${U}
3859
3867
  ${F}
3860
- `,M=Function(...U,L)(...z);if(M&&typeof M==="object")Object.assign(Z,M);X=X.replace(_,"")}catch(U){console.error(`Error executing ${J} code block in ${Y}:`,U);let z=U instanceof Error?U.message:String(U),W=l(`${J} Directive`,`Error executing code: ${z}`,Y,$,B,_);console.error(W),X=X.replace(_,"")}return X}var lZ=I(()=>{i4();A4()});function sX($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function iZ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,G,X)=>{return sX(J,X||"_method")})}async function nZ($,Z,Y,J,G){if(!J.middleware||J.middleware.length===0)return $;let X=$,Q=J.middleware.filter((K)=>K.timing===G);if(Q.length===0)return X;for(let K of Q){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,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 _=l("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);X=X.replace(/<body[^>]*>/,`$&
3861
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${C5(_)}</div>
3862
- `)}}}return X}async function sZ($,Z,Y,J){return nZ($,Z,Y,J,"before")}async function oZ($,Z,Y,J){return nZ($,Z,Y,J,"after")}var rZ=I(()=>{l4();A4()});function rX($,Z={},Y=!1){let J=oX[$];if(!J)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let G={...J.params,...Z},X=J.path;X=X.replace(/:(\w+)/g,(K,q)=>{let _=G[q];if(_===void 0)return console.warn(`Missing parameter [${q}] for route [${$}].`),`:${q}`;return delete G[q],encodeURIComponent(String(_))});let Q=Object.entries(G);if(Q.length>0){let K=Q.map(([q,_])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(_))}`).join("&");X+=(X.includes("?")?"&":"?")+K}return Y&&aZ?`${aZ}${X}`:X}function tZ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,G,X)=>{try{let Q=G?z4(G,{}):{};return rX(J,Q,X==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var oX,aZ="";var eZ=I(()=>{H4();oX={}});async function $3($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(V5.exact[$])for(let J of V5.exact[$])await Promise.resolve(J(Z,$));if(V5.exact[Y])for(let J of V5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:G}of V5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(G(Z,$))}var V5;var Z3=I(()=>{V5={patterns:[],exact:{}}});function Y3(){return $6().replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n\s*/g," ").replace(/\s+/g," ").replace(/\s*([{}();,:])\s*/g,"$1").replace(/;\}/g,"}").trim()}function $6(){return`
3868
+ `,M=Function(...W,L)(...z);if(M&&typeof M==="object")Object.assign(Z,M);X=X.replace(_,"")}catch(W){console.error(`Error executing ${J} code block in ${Y}:`,W);let z=W instanceof Error?W.message:String(W),U=l(`${J} Directive`,`Error executing code: ${z}`,Y,$,B,_);console.error(U),X=X.replace(_,"")}return X}var nZ=w(()=>{i4();F4()});function eX($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function sZ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,J,G,X)=>{return eX(J,X||"_method")})}async function oZ($,Z,Y,J,G){if(!J.middleware||J.middleware.length===0)return $;let X=$,Q=J.middleware.filter((K)=>K.timing===G);if(Q.length===0)return X;for(let K of Q){if(!K.name||typeof K.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(X,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 _=l("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);X=X.replace(/<body[^>]*>/,`$&
3869
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${P5(_)}</div>
3870
+ `)}}}return X}async function rZ($,Z,Y,J){return oZ($,Z,Y,J,"before")}async function aZ($,Z,Y,J){return oZ($,Z,Y,J,"after")}var tZ=w(()=>{l4();F4()});function Z2($,Z={},Y=!1){let J=$2[$];if(!J)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let G={...J.params,...Z},X=J.path;X=X.replace(/:(\w+)/g,(K,q)=>{let _=G[q];if(_===void 0)return console.warn(`Missing parameter [${q}] for route [${$}].`),`:${q}`;return delete G[q],encodeURIComponent(String(_))});let Q=Object.entries(G);if(Q.length>0){let K=Q.map(([q,_])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(_))}`).join("&");X+=(X.includes("?")?"&":"?")+K}return Y&&eZ?`${eZ}${X}`:X}function $3($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,J,G,X)=>{try{let Q=G?O4(G,{}):{};return Z2(J,Q,X==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var $2,eZ="";var Z3=w(()=>{L4();$2={}});async function Y3($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(N5.exact[$])for(let J of N5.exact[$])await Promise.resolve(J(Z,$));if(N5.exact[Y])for(let J of N5.exact[Y])await Promise.resolve(J(Z,$));for(let{pattern:J,callback:G}of N5.patterns)if(J.test($)||J.test(Y))await Promise.resolve(G(Z,$))}var N5;var J3=w(()=>{N5={patterns:[],exact:{}}});function X3(){return Z6().replace(/\/\/[^\n]*/g,"").replace(/\/\*[\s\S]*?\*\//g,"").replace(/\n\s*/g," ").replace(/\s+/g," ").replace(/\s*([{}();,:])\s*/g,"$1").replace(/;\}/g,"}").trim()}function Z6(){return`
3863
3871
  // STX Signals Runtime (Development Build)
3864
3872
  (function() {
3865
3873
  'use strict';
@@ -4436,6 +4444,220 @@ ${$}
4436
4444
  };
4437
4445
  }
4438
4446
 
4447
+ // ==========================================================================
4448
+ // Template Refs (useRef)
4449
+ // ==========================================================================
4450
+
4451
+ function useRef(name) {
4452
+ return {
4453
+ get current() {
4454
+ return componentScope.$refs ? componentScope.$refs[name] : null;
4455
+ },
4456
+ get value() {
4457
+ return this.current;
4458
+ }
4459
+ };
4460
+ }
4461
+
4462
+ // ==========================================================================
4463
+ // Navigation API
4464
+ // ==========================================================================
4465
+
4466
+ function navigate(url) {
4467
+ if (window.stxRouter && typeof window.stxRouter.navigate === 'function') {
4468
+ window.stxRouter.navigate(url);
4469
+ } else {
4470
+ window.location.href = url;
4471
+ }
4472
+ }
4473
+
4474
+ function goBack() { window.history.back(); }
4475
+ function goForward() { window.history.forward(); }
4476
+
4477
+ function useRoute() {
4478
+ return {
4479
+ get path() { return window.location.pathname; },
4480
+ get fullPath() { return window.location.pathname + window.location.search + window.location.hash; },
4481
+ get hash() { return window.location.hash; },
4482
+ get query() {
4483
+ var params = {};
4484
+ new URLSearchParams(window.location.search).forEach(function(v, k) { params[k] = v; });
4485
+ return params;
4486
+ },
4487
+ get params() { return window.stxRouter && window.stxRouter.params ? window.stxRouter.params : {}; }
4488
+ };
4489
+ }
4490
+
4491
+ function useSearchParams() {
4492
+ var params = state(Object.fromEntries(new URLSearchParams(window.location.search)));
4493
+ var syncFromUrl = function() {
4494
+ params.set(Object.fromEntries(new URLSearchParams(window.location.search)));
4495
+ };
4496
+ window.addEventListener('popstate', syncFromUrl);
4497
+ window.addEventListener('stx:navigate', syncFromUrl);
4498
+ return {
4499
+ data: params,
4500
+ get: function(key) { return params()[key]; },
4501
+ set: function(key, value) {
4502
+ var url = new URL(window.location.href);
4503
+ url.searchParams.set(key, value);
4504
+ window.history.pushState({}, '', url);
4505
+ syncFromUrl();
4506
+ },
4507
+ setAll: function(obj) {
4508
+ var url = new URL(window.location.href);
4509
+ Object.keys(obj).forEach(function(k) { url.searchParams.set(k, obj[k]); });
4510
+ window.history.pushState({}, '', url);
4511
+ syncFromUrl();
4512
+ }
4513
+ };
4514
+ }
4515
+
4516
+ // ==========================================================================
4517
+ // Advanced Data Fetching (useQuery / useMutation)
4518
+ // ==========================================================================
4519
+
4520
+ var _queryCache = {};
4521
+
4522
+ function useQuery(url, options) {
4523
+ options = options || {};
4524
+ var staleTime = options.staleTime || 0;
4525
+ var cacheTime = options.cacheTime || 300000; // 5 min default
4526
+ var cacheKey = options.cacheKey || (typeof url === 'function' ? null : url);
4527
+ var data = state(options.initialData || null);
4528
+ var loading = state(true);
4529
+ var error = state(null);
4530
+ var isStale = state(false);
4531
+
4532
+ var fetchData = async function() {
4533
+ var resolvedUrl = typeof url === 'function' ? url() : url;
4534
+ if (!resolvedUrl) { loading.set(false); return; }
4535
+ var key = cacheKey || resolvedUrl;
4536
+
4537
+ // Check cache
4538
+ var cached = _queryCache[key];
4539
+ if (cached && (Date.now() - cached.timestamp < staleTime)) {
4540
+ data.set(cached.data);
4541
+ loading.set(false);
4542
+ isStale.set(false);
4543
+ if (options.onSuccess) options.onSuccess(cached.data);
4544
+ return;
4545
+ }
4546
+
4547
+ // Stale-while-revalidate
4548
+ if (cached) {
4549
+ data.set(cached.data);
4550
+ isStale.set(true);
4551
+ }
4552
+
4553
+ loading.set(true);
4554
+ error.set(null);
4555
+ try {
4556
+ var fetchOpts = { method: 'GET', headers: { 'Content-Type': 'application/json', ...(options.headers || {}) } };
4557
+ var response = await fetch(resolvedUrl, fetchOpts);
4558
+ if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + response.statusText);
4559
+ var result = await response.json();
4560
+ var transformed = options.transform ? options.transform(result) : result;
4561
+ data.set(transformed);
4562
+ isStale.set(false);
4563
+ _queryCache[key] = { data: transformed, timestamp: Date.now() };
4564
+ if (options.onSuccess) options.onSuccess(transformed);
4565
+ // Schedule cache eviction
4566
+ setTimeout(function() { delete _queryCache[key]; }, cacheTime);
4567
+ } catch (e) {
4568
+ error.set(e.message || 'Query failed');
4569
+ if (options.onError) options.onError(e);
4570
+ } finally {
4571
+ loading.set(false);
4572
+ }
4573
+ };
4574
+
4575
+ if (options.immediate !== false) {
4576
+ onMount(fetchData);
4577
+ }
4578
+
4579
+ // refetchOnFocus
4580
+ if (options.refetchOnFocus) {
4581
+ document.addEventListener('visibilitychange', function() {
4582
+ if (!document.hidden) fetchData();
4583
+ });
4584
+ }
4585
+
4586
+ // refetchInterval
4587
+ if (options.refetchInterval) {
4588
+ var intervalId = setInterval(fetchData, options.refetchInterval);
4589
+ onDestroy(function() { clearInterval(intervalId); });
4590
+ }
4591
+
4592
+ return {
4593
+ data: data,
4594
+ loading: loading,
4595
+ error: error,
4596
+ isStale: isStale,
4597
+ refetch: fetchData,
4598
+ invalidate: function() {
4599
+ var key = cacheKey || (typeof url === 'function' ? url() : url);
4600
+ delete _queryCache[key];
4601
+ return fetchData();
4602
+ }
4603
+ };
4604
+ }
4605
+
4606
+ function useMutation(url, options) {
4607
+ options = options || {};
4608
+ var data = state(null);
4609
+ var loading = state(false);
4610
+ var error = state(null);
4611
+
4612
+ var mutate = async function(body) {
4613
+ loading.set(true);
4614
+ error.set(null);
4615
+ var previousData = data();
4616
+
4617
+ // Optimistic update
4618
+ if (options.optimisticData) {
4619
+ var optimistic = typeof options.optimisticData === 'function' ? options.optimisticData(body) : options.optimisticData;
4620
+ data.set(optimistic);
4621
+ }
4622
+
4623
+ try {
4624
+ var resolvedUrl = typeof url === 'function' ? url() : url;
4625
+ var fetchOpts = {
4626
+ method: options.method || 'POST',
4627
+ headers: { 'Content-Type': 'application/json', ...(options.headers || {}) },
4628
+ body: typeof body === 'string' ? body : JSON.stringify(body)
4629
+ };
4630
+ var response = await fetch(resolvedUrl, fetchOpts);
4631
+ if (!response.ok) throw new Error('HTTP ' + response.status + ': ' + response.statusText);
4632
+ var result = await response.json();
4633
+ var transformed = options.transform ? options.transform(result) : result;
4634
+ data.set(transformed);
4635
+ if (options.onSuccess) options.onSuccess(transformed);
4636
+ // Invalidate related queries
4637
+ if (options.invalidateQueries) {
4638
+ options.invalidateQueries.forEach(function(key) { delete _queryCache[key]; });
4639
+ }
4640
+ return transformed;
4641
+ } catch (e) {
4642
+ error.set(e.message || 'Mutation failed');
4643
+ // Rollback optimistic update
4644
+ if (options.optimisticData) data.set(previousData);
4645
+ if (options.onError) options.onError(e);
4646
+ throw e;
4647
+ } finally {
4648
+ loading.set(false);
4649
+ }
4650
+ };
4651
+
4652
+ return {
4653
+ data: data,
4654
+ loading: loading,
4655
+ error: error,
4656
+ mutate: mutate,
4657
+ reset: function() { data.set(null); error.set(null); loading.set(false); }
4658
+ };
4659
+ }
4660
+
4439
4661
  // ==========================================================================
4440
4662
  // Template Binding
4441
4663
  // ==========================================================================
@@ -4626,8 +4848,16 @@ ${$}
4626
4848
  span.textContent = fn(...Object.values(unwrapScope));
4627
4849
  }
4628
4850
  } catch (e) {
4629
- console.warn('[STX] Expression error:', expr, e);
4630
- span.textContent = '';
4851
+ // Auto-unwrap can break explicit signal calls like errorData().message
4852
+ // because it converts the signal to its value before the expression runs.
4853
+ // Retry without auto-unwrap so signal functions remain callable.
4854
+ try {
4855
+ const fn = new Function(...Object.keys(capturedScope), 'return ' + expr);
4856
+ span.textContent = fn(...Object.values(capturedScope));
4857
+ } catch (e2) {
4858
+ console.warn('[STX] Expression error:', expr, e2);
4859
+ span.textContent = '';
4860
+ }
4631
4861
  }
4632
4862
  });
4633
4863
  } else if (part) {
@@ -4642,26 +4872,28 @@ ${$}
4642
4872
 
4643
4873
  if (el.nodeType !== Node.ELEMENT_NODE) return;
4644
4874
 
4645
- // Handle @for first (reactive list)
4646
- if (el.hasAttribute('@for')) {
4647
- bindFor(el, scope);
4875
+ // Handle @for / :for first (reactive list)
4876
+ if (el.hasAttribute('@for') || el.hasAttribute(':for')) {
4877
+ bindFor(el, scope, el.hasAttribute(':for') ? ':for' : '@for');
4648
4878
  return;
4649
4879
  }
4650
4880
 
4651
- // Handle @if (conditional rendering)
4652
- if (el.hasAttribute('@if')) {
4653
- bindIf(el, scope);
4881
+ // Handle @if / :if (conditional rendering)
4882
+ if (el.hasAttribute('@if') || el.hasAttribute(':if')) {
4883
+ bindIf(el, scope, el.hasAttribute(':if') ? ':if' : '@if');
4654
4884
  return;
4655
4885
  }
4656
4886
 
4657
- // Handle @show (visibility toggle - keeps element in DOM)
4658
- if (el.hasAttribute('@show')) {
4659
- bindShow(el, el.getAttribute('@show'), scope);
4887
+ // Handle @show / :show (visibility toggle - keeps element in DOM)
4888
+ if (el.hasAttribute('@show') || el.hasAttribute(':show')) {
4889
+ var showAttr = el.hasAttribute(':show') ? ':show' : '@show';
4890
+ bindShow(el, el.getAttribute(showAttr), scope, showAttr);
4660
4891
  }
4661
4892
 
4662
- // Handle @model (two-way binding)
4663
- if (el.hasAttribute('@model')) {
4664
- bindModel(el, el.getAttribute('@model'), scope);
4893
+ // Handle @model / :model (two-way binding)
4894
+ if (el.hasAttribute('@model') || el.hasAttribute(':model')) {
4895
+ var modelAttr = el.hasAttribute(':model') ? ':model' : '@model';
4896
+ bindModel(el, el.getAttribute(modelAttr), scope, modelAttr);
4665
4897
  }
4666
4898
 
4667
4899
  // Capture scope once for all attribute bindings on this element
@@ -4684,18 +4916,33 @@ ${$}
4684
4916
  const fn = new Function(...Object.keys(attrCapturedScope), 'return ' + expr);
4685
4917
  return fn(...Object.values(unwrapScope));
4686
4918
  } catch (e) {
4687
- console.warn('[STX] Attribute expression error:', expr, e);
4688
- return '';
4919
+ // Auto-unwrap can break explicit signal calls like errorData().message
4920
+ // Retry without auto-unwrap so signal functions remain callable
4921
+ try {
4922
+ const fn = new Function(...Object.keys(attrCapturedScope), 'return ' + expr);
4923
+ return fn(...Object.values(attrCapturedScope));
4924
+ } catch (e2) {
4925
+ console.warn('[STX] Attribute expression error:', expr, e2);
4926
+ return '';
4927
+ }
4689
4928
  }
4690
4929
  };
4691
4930
 
4931
+ // Known directive names to exclude from generic :attr binding
4932
+ var DIRECTIVE_NAMES = {class:1, style:1, text:1, html:1, show:1, model:1, 'if':1, 'for':1, ref:1};
4933
+ var EVENT_RE = /^(click|dblclick|mousedown|mouseup|mousemove|mouseenter|mouseleave|keydown|keyup|keypress|input|change|submit|focus|blur|scroll|resize|touchstart|touchend|touchmove|contextmenu|wheel|pointerdown|pointerup|pointermove)/;
4934
+ var KEY_MAP = {enter:'Enter', tab:'Tab', escape:'Escape', space:' ', up:'ArrowUp', down:'ArrowDown', left:'ArrowLeft', right:'ArrowRight', 'delete':'Delete', backspace:'Backspace'};
4935
+
4692
4936
  // Handle attributes
4693
4937
  Array.from(el.attributes).forEach(attr => {
4694
4938
  const name = attr.name;
4695
4939
  const value = attr.value;
4696
4940
 
4697
4941
  // @bind:attr OR :attr shorthand (Feature #4) for dynamic attribute binding
4698
- if (name.startsWith('@bind:') || (name.startsWith(':') && !name.startsWith('::'))) {
4942
+ // Only match :attr that is NOT a known directive and NOT an event name
4943
+ if (name.startsWith('@bind:') || (name.startsWith(':') && !name.startsWith('::')
4944
+ && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]]
4945
+ && !EVENT_RE.test(name.slice(1)))) {
4699
4946
  const attrName = name.startsWith('@bind:') ? name.slice(6) : name.slice(1);
4700
4947
  effect(() => {
4701
4948
  const v = evalAttrExpr(value);
@@ -4708,37 +4955,63 @@ ${$}
4708
4955
  }
4709
4956
  });
4710
4957
  el.removeAttribute(name);
4711
- } else if (name === '@class') {
4958
+ } else if (name === '@class' || name === ':class') {
4712
4959
  bindClass(el, value, scope);
4713
4960
  el.removeAttribute(name);
4714
- } else if (name === '@style') {
4961
+ } else if (name === '@style' || name === ':style') {
4715
4962
  bindStyle(el, value, scope);
4716
4963
  el.removeAttribute(name);
4717
- } else if (name === '@text') {
4964
+ } else if (name === '@text' || name === ':text') {
4718
4965
  effect(() => {
4719
4966
  el.textContent = evalAttrExpr(value);
4720
4967
  });
4721
4968
  el.removeAttribute(name);
4722
- } else if (name === '@html') {
4969
+ } else if (name === '@html' || name === ':html') {
4723
4970
  effect(() => {
4724
4971
  el.innerHTML = evalAttrExpr(value);
4725
4972
  });
4726
4973
  el.removeAttribute(name);
4727
- } else if (name.startsWith('@')) {
4728
- // Event handlers: @click, @submit.prevent, etc.
4974
+ } else if (name === ':ref' || name === 'data-stx-ref') {
4975
+ // Store ref in scope.$refs (from :ref directive or build-time ref="name" transform)
4976
+ if (scope.$refs) scope.$refs[value] = el;
4977
+ el.removeAttribute(name);
4978
+ } else if (name.startsWith('@') || name.startsWith(':')) {
4979
+ // Event handlers: @click, :click, @submit.prevent, :keydown.enter, etc.
4729
4980
  const parts = name.slice(1).split('.');
4730
4981
  const eventName = parts[0];
4731
4982
  const modifiers = parts.slice(1);
4732
4983
 
4733
4984
  // Skip special directives (already handled above or in processElement)
4734
- if (['if', 'for', 'show', 'model', 'class', 'style', 'text', 'html'].includes(eventName)) {
4985
+ if (['if', 'for', 'show', 'model', 'class', 'style', 'text', 'html', 'ref'].includes(eventName)) {
4735
4986
  return;
4736
4987
  }
4737
4988
 
4989
+ // Capture scope at setup time so @for loop variables are available when event fires
4990
+ const eventCapturedScope = { ...scope, ...(findElementScope(el) || {}), ...globalHelpers };
4991
+
4738
4992
  el.addEventListener(eventName, (event) => {
4993
+ // System key modifiers
4994
+ if (modifiers.includes('self') && event.target !== el) return;
4995
+ if (modifiers.includes('ctrl') && !event.ctrlKey) return;
4996
+ if (modifiers.includes('alt') && !event.altKey) return;
4997
+ if (modifiers.includes('shift') && !event.shiftKey) return;
4998
+ if (modifiers.includes('meta') && !event.metaKey) return;
4999
+ // Key modifiers
5000
+ for (var mi = 0; mi < modifiers.length; mi++) {
5001
+ if (KEY_MAP[modifiers[mi]] && event.key !== KEY_MAP[modifiers[mi]]) return;
5002
+ }
4739
5003
  if (modifiers.includes('prevent')) event.preventDefault();
4740
5004
  if (modifiers.includes('stop')) event.stopPropagation();
4741
- executeHandler(value, event, el);
5005
+ // Execute with captured scope (includes @for loop variables)
5006
+ try {
5007
+ if (!value || /^__[A-Z_]+__$/.test(value.trim())) return;
5008
+ var shorthandFn = parseEventShorthand(value, eventCapturedScope);
5009
+ if (shorthandFn) { shorthandFn(); return; }
5010
+ var fn = new Function(...Object.keys(eventCapturedScope), '$event', value);
5011
+ fn(...Object.values(eventCapturedScope), event);
5012
+ } catch (e) {
5013
+ console.warn('[STX] Handler error:', value, e);
5014
+ }
4742
5015
  }, {
4743
5016
  capture: modifiers.includes('capture'),
4744
5017
  passive: modifiers.includes('passive'),
@@ -4752,7 +5025,7 @@ ${$}
4752
5025
  Array.from(el.childNodes).forEach(child => processElement(child, scope));
4753
5026
  }
4754
5027
 
4755
- function bindShow(el, expr, passedScope = componentScope) {
5028
+ function bindShow(el, expr, passedScope = componentScope, attrName = '@show') {
4756
5029
  const originalDisplay = el.style.display || '';
4757
5030
  // Capture scope at setup time - use passed scope to preserve context
4758
5031
  const capturedScope = { ...passedScope, ...(findElementScope(el) || {}) };
@@ -4770,10 +5043,10 @@ ${$}
4770
5043
  effect(() => {
4771
5044
  el.style.display = evalExpr() ? originalDisplay : 'none';
4772
5045
  });
4773
- el.removeAttribute('@show');
5046
+ el.removeAttribute(attrName);
4774
5047
  }
4775
5048
 
4776
- function bindModel(el, expr, passedScope = componentScope) {
5049
+ function bindModel(el, expr, passedScope = componentScope, attrName = '@model') {
4777
5050
  const tag = el.tagName.toLowerCase();
4778
5051
  const type = el.type;
4779
5052
 
@@ -4791,7 +5064,7 @@ ${$}
4791
5064
  fn(...Object.values(scope), val);
4792
5065
  }
4793
5066
  } catch (e) {
4794
- console.warn('[STX] @model set error:', expr, e);
5067
+ console.warn('[STX] ' + attrName + ' set error:', expr, e);
4795
5068
  }
4796
5069
  };
4797
5070
 
@@ -4806,7 +5079,7 @@ ${$}
4806
5079
  el.addEventListener('input', () => setValue(el.value));
4807
5080
  }
4808
5081
 
4809
- el.removeAttribute('@model');
5082
+ el.removeAttribute(attrName);
4810
5083
  }
4811
5084
 
4812
5085
  function bindClass(el, expr, passedScope = componentScope) {
@@ -4862,12 +5135,12 @@ ${$}
4862
5135
  });
4863
5136
  }
4864
5137
 
4865
- function bindFor(el, passedScope = componentScope) {
4866
- const expr = el.getAttribute('@for');
5138
+ function bindFor(el, passedScope = componentScope, attrName = '@for') {
5139
+ const expr = el.getAttribute(attrName);
4867
5140
  const match = expr.match(/^\\s*(\\w+)(?:\\s*,\\s*(\\w+))?\\s+(?:in|of)\\s+(.+)\\s*$/);
4868
5141
 
4869
5142
  if (!match) {
4870
- console.warn('[STX] Invalid @for:', expr);
5143
+ console.warn('[STX] Invalid ' + attrName + ':', expr);
4871
5144
  return;
4872
5145
  }
4873
5146
 
@@ -4883,8 +5156,8 @@ ${$}
4883
5156
  const placeholder = document.createComment('stx-for');
4884
5157
  const isTemplate = el.tagName === 'TEMPLATE';
4885
5158
 
4886
- // Check if element also has @if - need to handle together
4887
- const ifExpr = el.getAttribute('@if');
5159
+ // Check if element also has @if / :if - need to handle together
5160
+ const ifExpr = el.getAttribute('@if') || el.getAttribute(':if');
4888
5161
 
4889
5162
  // Feature #3: Check for @loading and @empty siblings/content
4890
5163
  const loadingExpr = el.getAttribute('@loading');
@@ -4927,10 +5200,11 @@ ${$}
4927
5200
  } else {
4928
5201
  const wrapper = el.cloneNode(true);
4929
5202
  wrapper.removeAttribute('@for');
5203
+ wrapper.removeAttribute(':for');
4930
5204
  wrapper.removeAttribute('@loading');
4931
5205
  wrapper.removeAttribute('@empty');
4932
- // Also remove @if - we'll handle it inline
4933
- if (ifExpr) wrapper.removeAttribute('@if');
5206
+ // Also remove @if / :if - we'll handle it inline
5207
+ if (ifExpr) { wrapper.removeAttribute('@if'); wrapper.removeAttribute(':if'); }
4934
5208
  templateContent = wrapper;
4935
5209
  }
4936
5210
 
@@ -5062,8 +5336,8 @@ ${$}
5062
5336
  });
5063
5337
  }
5064
5338
 
5065
- function bindIf(el, passedScope = componentScope) {
5066
- const expr = el.getAttribute('@if');
5339
+ function bindIf(el, passedScope = componentScope, attrName = '@if') {
5340
+ const expr = el.getAttribute(attrName);
5067
5341
  const parent = el.parentNode;
5068
5342
 
5069
5343
  // Guard: if element has no parent, it's detached - skip processing
@@ -5085,7 +5359,7 @@ ${$}
5085
5359
  const capturedComponentScope = { ...passedScope };
5086
5360
 
5087
5361
  parent.insertBefore(placeholder, el);
5088
- el.removeAttribute('@if');
5362
+ el.removeAttribute(attrName);
5089
5363
 
5090
5364
  if (isTemplate) {
5091
5365
  // For templates, we need to handle the content fragment
@@ -5194,6 +5468,390 @@ ${$}
5194
5468
  });
5195
5469
  }
5196
5470
 
5471
+ // provide() \u2014 share values across components (like Vue's provide/inject)
5472
+ // Usage: provide('Modal', Modal) \u2014 makes Modal accessible in all components
5473
+ function provide(name, value) {
5474
+ window[name] = value;
5475
+ }
5476
+
5477
+ // ==========================================================================
5478
+ // Timer & Utility Composables
5479
+ // ==========================================================================
5480
+
5481
+ function useDebounce(fn, delay) {
5482
+ delay = delay || 250;
5483
+ var timer = null;
5484
+ var lastArgs = null;
5485
+ var debounced = function() {
5486
+ lastArgs = Array.prototype.slice.call(arguments);
5487
+ if (timer !== null) clearTimeout(timer);
5488
+ var args = lastArgs;
5489
+ timer = setTimeout(function() {
5490
+ timer = null;
5491
+ lastArgs = null;
5492
+ fn.apply(null, args);
5493
+ }, delay);
5494
+ };
5495
+ debounced.cancel = function() {
5496
+ if (timer !== null) { clearTimeout(timer); timer = null; lastArgs = null; }
5497
+ };
5498
+ debounced.flush = function() {
5499
+ if (timer !== null && lastArgs !== null) {
5500
+ clearTimeout(timer); timer = null;
5501
+ var args = lastArgs; lastArgs = null;
5502
+ fn.apply(null, args);
5503
+ }
5504
+ };
5505
+ debounced.pending = function() { return timer !== null; };
5506
+ onDestroy(debounced.cancel);
5507
+ return debounced;
5508
+ }
5509
+
5510
+ function useDebouncedValue(getter, delay) {
5511
+ delay = delay || 250;
5512
+ var current = getter();
5513
+ var listeners = [];
5514
+ var timer = null;
5515
+ function schedule() {
5516
+ if (timer !== null) clearTimeout(timer);
5517
+ timer = setTimeout(function() {
5518
+ timer = null;
5519
+ var next = getter();
5520
+ if (next !== current) {
5521
+ current = next;
5522
+ listeners.forEach(function(fn) { fn(current); });
5523
+ }
5524
+ }, delay);
5525
+ }
5526
+ schedule();
5527
+ onDestroy(function() { if (timer !== null) clearTimeout(timer); listeners = []; });
5528
+ return {
5529
+ get value() { return current; },
5530
+ subscribe: function(fn) {
5531
+ listeners.push(fn);
5532
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5533
+ }
5534
+ };
5535
+ }
5536
+
5537
+ function useThrottle(fn, limit) {
5538
+ limit = limit || 250;
5539
+ var timer = null;
5540
+ var lastRan = 0;
5541
+ var throttled = function() {
5542
+ var args = Array.prototype.slice.call(arguments);
5543
+ var now = Date.now();
5544
+ var remaining = limit - (now - lastRan);
5545
+ if (remaining <= 0) {
5546
+ if (timer !== null) { clearTimeout(timer); timer = null; }
5547
+ lastRan = now;
5548
+ fn.apply(null, args);
5549
+ } else if (timer === null) {
5550
+ timer = setTimeout(function() {
5551
+ lastRan = Date.now();
5552
+ timer = null;
5553
+ fn.apply(null, args);
5554
+ }, remaining);
5555
+ }
5556
+ };
5557
+ throttled.cancel = function() {
5558
+ if (timer !== null) { clearTimeout(timer); timer = null; }
5559
+ };
5560
+ onDestroy(throttled.cancel);
5561
+ return throttled;
5562
+ }
5563
+
5564
+ function useInterval(interval, options) {
5565
+ interval = interval || 1000;
5566
+ options = options || {};
5567
+ var count = 0;
5568
+ var id = null;
5569
+ var running = false;
5570
+ var listeners = [];
5571
+ function tick() {
5572
+ count++;
5573
+ listeners.forEach(function(fn) { fn(count); });
5574
+ }
5575
+ function resume() {
5576
+ if (running) return;
5577
+ running = true;
5578
+ id = setInterval(tick, interval);
5579
+ if (options.immediate) tick();
5580
+ }
5581
+ function pause() {
5582
+ if (!running) return;
5583
+ running = false;
5584
+ if (id !== null) { clearInterval(id); id = null; }
5585
+ }
5586
+ function reset() {
5587
+ pause();
5588
+ count = 0;
5589
+ listeners.forEach(function(fn) { fn(count); });
5590
+ resume();
5591
+ }
5592
+ resume();
5593
+ onDestroy(function() { pause(); listeners = []; });
5594
+ return {
5595
+ get counter() { return count; },
5596
+ pause: pause,
5597
+ resume: resume,
5598
+ reset: reset,
5599
+ subscribe: function(fn) {
5600
+ listeners.push(fn);
5601
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5602
+ }
5603
+ };
5604
+ }
5605
+
5606
+ function useTimeout(callback, delay) {
5607
+ delay = delay || 1000;
5608
+ var timer = null;
5609
+ var pending = false;
5610
+ var listeners = [];
5611
+ function setPending(v) {
5612
+ if (v !== pending) {
5613
+ pending = v;
5614
+ listeners.forEach(function(fn) { fn(pending); });
5615
+ }
5616
+ }
5617
+ function start() {
5618
+ stop();
5619
+ setPending(true);
5620
+ timer = setTimeout(function() {
5621
+ timer = null;
5622
+ setPending(false);
5623
+ callback();
5624
+ }, delay);
5625
+ }
5626
+ function stop() {
5627
+ if (timer !== null) { clearTimeout(timer); timer = null; }
5628
+ setPending(false);
5629
+ }
5630
+ start();
5631
+ onDestroy(stop);
5632
+ return {
5633
+ get isPending() { return pending; },
5634
+ start: start,
5635
+ stop: stop,
5636
+ subscribe: function(fn) {
5637
+ listeners.push(fn);
5638
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5639
+ }
5640
+ };
5641
+ }
5642
+
5643
+ function useToggle(initial) {
5644
+ var current = !!initial;
5645
+ var listeners = [];
5646
+ function notify() { listeners.forEach(function(fn) { fn(current); }); }
5647
+ function toggle() { current = !current; notify(); }
5648
+ function set(v) { v = !!v; if (v !== current) { current = v; notify(); } }
5649
+ var ref = {
5650
+ get value() { return current; },
5651
+ subscribe: function(fn) {
5652
+ listeners.push(fn);
5653
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5654
+ }
5655
+ };
5656
+ return [ref, toggle, set];
5657
+ }
5658
+
5659
+ function useCounter(initial, options) {
5660
+ initial = initial || 0;
5661
+ options = options || {};
5662
+ var min = options.min != null ? options.min : -Infinity;
5663
+ var max = options.max != null ? options.max : Infinity;
5664
+ function clamp(v) { return Math.min(max, Math.max(min, v)); }
5665
+ var current = clamp(initial);
5666
+ var listeners = [];
5667
+ function notify() { listeners.forEach(function(fn) { fn(current); }); }
5668
+ return {
5669
+ get count() { return current; },
5670
+ inc: function(step) { current = clamp(current + (step || 1)); notify(); },
5671
+ dec: function(step) { current = clamp(current - (step || 1)); notify(); },
5672
+ set: function(v) { current = clamp(v); notify(); },
5673
+ reset: function() { current = clamp(initial); notify(); },
5674
+ subscribe: function(fn) {
5675
+ listeners.push(fn);
5676
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5677
+ }
5678
+ };
5679
+ }
5680
+
5681
+ function useClickOutside(target, handler) {
5682
+ function listener(event) {
5683
+ var el = typeof target === 'string' ? document.querySelector(target) : target;
5684
+ if (!el) return;
5685
+ if (el === event.target || el.contains(event.target)) return;
5686
+ handler(event);
5687
+ }
5688
+ document.addEventListener('pointerdown', listener, true);
5689
+ function remove() { document.removeEventListener('pointerdown', listener, true); }
5690
+ onDestroy(remove);
5691
+ return { remove: remove };
5692
+ }
5693
+
5694
+ function useFocus(target) {
5695
+ var focused = false;
5696
+ var listeners = [];
5697
+ function resolve() {
5698
+ return typeof target === 'string' ? document.querySelector(target) : target;
5699
+ }
5700
+ function setFocused(v) {
5701
+ if (v !== focused) {
5702
+ focused = v;
5703
+ listeners.forEach(function(fn) { fn(focused); });
5704
+ }
5705
+ }
5706
+ var onFocusIn = function() { setFocused(true); };
5707
+ var onBlurOut = function() { setFocused(false); };
5708
+ var el = resolve();
5709
+ if (el) {
5710
+ el.addEventListener('focus', onFocusIn);
5711
+ el.addEventListener('blur', onBlurOut);
5712
+ focused = document.activeElement === el;
5713
+ }
5714
+ onDestroy(function() {
5715
+ var el = resolve();
5716
+ if (el) { el.removeEventListener('focus', onFocusIn); el.removeEventListener('blur', onBlurOut); }
5717
+ listeners = [];
5718
+ });
5719
+ return {
5720
+ get isFocused() { return focused; },
5721
+ focus: function() { var el = resolve(); if (el && el.focus) el.focus(); },
5722
+ blur: function() { var el = resolve(); if (el && el.blur) el.blur(); },
5723
+ subscribe: function(fn) {
5724
+ listeners.push(fn);
5725
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5726
+ }
5727
+ };
5728
+ }
5729
+
5730
+ function useAsync(fn, options) {
5731
+ options = options || {};
5732
+ var asyncState = 'idle';
5733
+ var data = null;
5734
+ var error = null;
5735
+ var listeners = [];
5736
+ function notify() {
5737
+ var snap = { state: asyncState, data: data, error: error };
5738
+ listeners.forEach(function(fn) { fn(snap); });
5739
+ }
5740
+ function execute() {
5741
+ var args = Array.prototype.slice.call(arguments);
5742
+ asyncState = 'loading'; error = null; notify();
5743
+ return fn.apply(null, args).then(function(result) {
5744
+ data = result; asyncState = 'success'; notify(); return data;
5745
+ }).catch(function(e) {
5746
+ error = e instanceof Error ? e : new Error(String(e));
5747
+ asyncState = 'error'; notify(); return null;
5748
+ });
5749
+ }
5750
+ if (options.immediate) execute();
5751
+ return {
5752
+ get state() { return asyncState; },
5753
+ get isLoading() { return asyncState === 'loading'; },
5754
+ get error() { return error; },
5755
+ get data() { return data; },
5756
+ execute: execute,
5757
+ subscribe: function(fn) {
5758
+ listeners.push(fn);
5759
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5760
+ }
5761
+ };
5762
+ }
5763
+
5764
+ function useColorMode(options) {
5765
+ options = options || {};
5766
+ var storageKey = options.storageKey || 'stx-color-mode';
5767
+ var initialMode = options.initialMode || 'auto';
5768
+ var darkClass = options.darkClass || 'dark';
5769
+ var attribute = options.attribute || null;
5770
+ var disableTransitions = options.disableTransitions !== false;
5771
+ var preference = initialMode;
5772
+ var resolved = 'light';
5773
+ var listeners = [];
5774
+ var cleanups = [];
5775
+
5776
+ function getSystem() {
5777
+ return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
5778
+ }
5779
+ function resolve(pref) { return pref === 'auto' ? getSystem() : pref; }
5780
+ function applyDOM(mode) {
5781
+ var el = document.documentElement;
5782
+ if (disableTransitions) el.style.setProperty('transition', 'none', 'important');
5783
+ if (attribute) { el.setAttribute(attribute, mode); }
5784
+ else { if (mode === 'dark') el.classList.add(darkClass); else el.classList.remove(darkClass); }
5785
+ if (disableTransitions) { el.offsetHeight; el.style.removeProperty('transition'); }
5786
+ }
5787
+ function persist(pref) { try { localStorage.setItem(storageKey, pref); } catch(e) {} }
5788
+ function readPersisted() {
5789
+ try { var v = localStorage.getItem(storageKey); if (v === 'light' || v === 'dark' || v === 'auto') return v; } catch(e) {}
5790
+ return null;
5791
+ }
5792
+ function update(pref) {
5793
+ preference = pref;
5794
+ resolved = resolve(pref);
5795
+ applyDOM(resolved);
5796
+ persist(pref);
5797
+ listeners.forEach(function(fn) { fn(resolved, preference); });
5798
+ }
5799
+
5800
+ var persisted = readPersisted();
5801
+ update(persisted || initialMode);
5802
+
5803
+ var mql = window.matchMedia('(prefers-color-scheme: dark)');
5804
+ var onSystemChange = function() {
5805
+ if (preference === 'auto') {
5806
+ resolved = getSystem();
5807
+ applyDOM(resolved);
5808
+ listeners.forEach(function(fn) { fn(resolved, preference); });
5809
+ }
5810
+ };
5811
+ mql.addEventListener('change', onSystemChange);
5812
+ cleanups.push(function() { mql.removeEventListener('change', onSystemChange); });
5813
+
5814
+ var onStorage = function(e) {
5815
+ if (e.key !== storageKey) return;
5816
+ var v = e.newValue;
5817
+ if (v === 'light' || v === 'dark' || v === 'auto') {
5818
+ preference = v; resolved = resolve(v); applyDOM(resolved);
5819
+ listeners.forEach(function(fn) { fn(resolved, preference); });
5820
+ }
5821
+ };
5822
+ window.addEventListener('storage', onStorage);
5823
+ cleanups.push(function() { window.removeEventListener('storage', onStorage); });
5824
+
5825
+ onDestroy(function() { cleanups.forEach(function(fn) { fn(); }); listeners = []; });
5826
+
5827
+ return {
5828
+ get mode() { return resolved; },
5829
+ get preference() { return preference; },
5830
+ get isDark() { return resolved === 'dark'; },
5831
+ set: function(mode) { update(mode); },
5832
+ toggle: function() { update(resolved === 'dark' ? 'light' : 'dark'); },
5833
+ subscribe: function(fn) {
5834
+ listeners.push(fn);
5835
+ return function() { listeners = listeners.filter(function(f) { return f !== fn; }); };
5836
+ }
5837
+ };
5838
+ }
5839
+
5840
+ function useDark(options) {
5841
+ var cm = useColorMode(options);
5842
+ return {
5843
+ get isDark() { return cm.isDark; },
5844
+ toggle: function() { cm.toggle(); },
5845
+ set: function(dark) { cm.set(dark ? 'dark' : 'light'); },
5846
+ subscribe: function(fn) {
5847
+ return cm.subscribe(function(mode) { fn(mode === 'dark'); });
5848
+ }
5849
+ };
5850
+ }
5851
+
5852
+ // Component mount system
5853
+ var mountQueue = [];
5854
+
5197
5855
  window.stx = {
5198
5856
  state,
5199
5857
  derived,
@@ -5205,12 +5863,81 @@ ${$}
5205
5863
  onMount,
5206
5864
  onDestroy,
5207
5865
  useFetch,
5866
+ useRef,
5867
+ navigate,
5868
+ goBack,
5869
+ goForward,
5870
+ useRoute,
5871
+ useSearchParams,
5872
+ useQuery,
5873
+ useMutation,
5874
+ provide,
5208
5875
  $computed,
5209
5876
  $watch,
5877
+ useDebounce,
5878
+ useDebouncedValue,
5879
+ useThrottle,
5880
+ useInterval,
5881
+ useTimeout,
5882
+ useToggle,
5883
+ useCounter,
5884
+ useClickOutside,
5885
+ useFocus,
5886
+ useAsync,
5887
+ useColorMode,
5888
+ useDark,
5210
5889
  helpers: globalHelpers,
5211
5890
  _mountCallbacks: mountCallbacks,
5212
5891
  _destroyCallbacks: destroyCallbacks,
5213
- _scopes: {} // Component-level scopes
5892
+ _scopes: {}, // Component-level scopes
5893
+ mount: function(setupFn) {
5894
+ // Capture script reference synchronously (only valid during execution)
5895
+ var scriptEl = document.currentScript;
5896
+
5897
+ function doMount() {
5898
+ // Find component root: next sibling element after the script tag
5899
+ var root = scriptEl ? scriptEl.nextElementSibling : null;
5900
+ if (!root && scriptEl) root = scriptEl.previousElementSibling || scriptEl.parentElement;
5901
+ if (!root) { console.warn('[stx] mount: no root element found'); return; }
5902
+
5903
+ // Track lifecycle hooks registered during setup
5904
+ var startLen = mountCallbacks.length;
5905
+
5906
+ // Run setup function \u2014 returns scope object with declarations
5907
+ var scope = setupFn();
5908
+
5909
+ // Capture mount hooks added during setup
5910
+ var localMountHooks = mountCallbacks.splice(startLen);
5911
+ var localDestroyHooks = [];
5912
+
5913
+ // Register scope
5914
+ if (typeof scope === 'object' && scope !== null) {
5915
+ scope.$el = root;
5916
+ scope.$refs = scope.$refs || {};
5917
+ Object.assign(componentScope, scope);
5918
+ }
5919
+
5920
+ // Walk DOM and bind directives
5921
+ processElement(root, scope || componentScope);
5922
+
5923
+ // Fire mount hooks
5924
+ localMountHooks.forEach(function(fn) {
5925
+ try {
5926
+ var cleanup = fn();
5927
+ if (typeof cleanup === 'function') localDestroyHooks.push(cleanup);
5928
+ } catch(e) { console.error('[stx] onMount error:', e); }
5929
+ });
5930
+
5931
+ // Store cleanup on element for auto-destroy
5932
+ root.__stx_destroy = localDestroyHooks;
5933
+ }
5934
+
5935
+ if (document.readyState === 'loading') {
5936
+ mountQueue.push(doMount);
5937
+ } else {
5938
+ doMount();
5939
+ }
5940
+ }
5214
5941
  };
5215
5942
 
5216
5943
  // Also expose globally for convenience
@@ -5221,14 +5948,39 @@ ${$}
5221
5948
  window.onMount = onMount;
5222
5949
  window.onDestroy = onDestroy;
5223
5950
  window.useFetch = useFetch;
5951
+ window.useRef = useRef;
5952
+ window.navigate = navigate;
5953
+ window.goBack = goBack;
5954
+ window.goForward = goForward;
5955
+ window.useRoute = useRoute;
5956
+ window.useSearchParams = useSearchParams;
5957
+ window.useQuery = useQuery;
5958
+ window.useMutation = useMutation;
5959
+ window.provide = provide;
5224
5960
  window.$computed = $computed;
5225
5961
  window.$watch = $watch;
5962
+ window.useDebounce = useDebounce;
5963
+ window.useDebouncedValue = useDebouncedValue;
5964
+ window.useThrottle = useThrottle;
5965
+ window.useInterval = useInterval;
5966
+ window.useTimeout = useTimeout;
5967
+ window.useToggle = useToggle;
5968
+ window.useCounter = useCounter;
5969
+ window.useClickOutside = useClickOutside;
5970
+ window.useFocus = useFocus;
5971
+ window.useAsync = useAsync;
5972
+ window.useColorMode = useColorMode;
5973
+ window.useDark = useDark;
5226
5974
 
5227
5975
  // ==========================================================================
5228
5976
  // Auto-initialization
5229
5977
  // ==========================================================================
5230
5978
 
5231
5979
  document.addEventListener('DOMContentLoaded', () => {
5980
+ // Process mount queue (from stx.mount() calls during loading)
5981
+ mountQueue.forEach(function(fn) { fn(); });
5982
+ mountQueue = [];
5983
+
5232
5984
  // Track which scoped elements have been processed
5233
5985
  const processedScopes = new Set();
5234
5986
 
@@ -5300,6 +6052,9 @@ ${$}
5300
6052
  } else if (el.tagName === 'META') {
5301
6053
  const content = el.getAttribute('content');
5302
6054
  if (content && content.includes('{{')) {
6055
+ // Skip build-time placeholders like {{__TITLE__}}
6056
+ const hasOnlyPlaceholders = !content.replace(/{{s*__[A-Z_]+__s*}}/g, '').includes('{{');
6057
+ if (hasOnlyPlaceholders) return;
5303
6058
  effect(() => {
5304
6059
  try {
5305
6060
  let result = content;
@@ -5307,6 +6062,7 @@ ${$}
5307
6062
  if (matches) {
5308
6063
  matches.forEach(match => {
5309
6064
  const expr = match.replace(/^{{s*|s*}}$/g, '');
6065
+ if (/^__[A-Z_]+__$/.test(expr.trim())) return;
5310
6066
  const fn = new Function(...Object.keys(componentScope), 'return ' + expr);
5311
6067
  const value = fn(...Object.values(componentScope));
5312
6068
  result = result.replace(match, value != null ? value : '');
@@ -5322,6 +6078,36 @@ ${$}
5322
6078
  });
5323
6079
  });
5324
6080
 
6081
+ // Re-initialize components after SPA content swap
6082
+ window.addEventListener('stx:load', function() {
6083
+ // Process mount queue (scripts in swapped content may have called stx.mount())
6084
+ mountQueue.forEach(function(fn) { fn(); });
6085
+ mountQueue = [];
6086
+
6087
+ // Re-process scoped components in new content
6088
+ var container = document.querySelector('#main-content') || document.body;
6089
+ container.querySelectorAll('[data-stx-scope]').forEach(function(el) {
6090
+ var scopeId = el.getAttribute('data-stx-scope');
6091
+ var scopeVars = window.stx._scopes && window.stx._scopes[scopeId];
6092
+ if (scopeVars) {
6093
+ componentScope = Object.assign({}, componentScope, scopeVars);
6094
+ }
6095
+ processElement(el);
6096
+ if (scopeVars && scopeVars.__mountCallbacks) {
6097
+ scopeVars.__mountCallbacks.forEach(function(fn) { fn(); });
6098
+ }
6099
+ });
6100
+
6101
+ container.querySelectorAll('[data-stx]').forEach(function(el) {
6102
+ var setupName = el.getAttribute('data-stx');
6103
+ if (setupName && window[setupName]) {
6104
+ var result = window[setupName]();
6105
+ if (typeof result === 'object') Object.assign(componentScope, result);
6106
+ }
6107
+ processElement(el);
6108
+ });
6109
+ });
6110
+
5325
6111
  // Helper to process elements while skipping already-processed scoped containers
5326
6112
  function processElementSkipScopes(el, processedScopes) {
5327
6113
  if (processedScopes.has(el)) return;
@@ -5334,26 +6120,32 @@ ${$}
5334
6120
  if (el.hasAttribute && el.hasAttribute('data-stx-scope')) return;
5335
6121
  // Process this element's directives without recursing into children
5336
6122
  // (we'll handle children manually to skip scoped ones)
5337
- const hasFor = el.hasAttribute && el.hasAttribute('@for');
5338
- const hasIf = el.hasAttribute && el.hasAttribute('@if');
5339
- if (hasFor) { bindFor(el); return; }
5340
- if (hasIf) { bindIf(el); return; }
6123
+ const hasFor = el.hasAttribute && (el.hasAttribute('@for') || el.hasAttribute(':for'));
6124
+ const hasIf = el.hasAttribute && (el.hasAttribute('@if') || el.hasAttribute(':if'));
6125
+ if (hasFor) { bindFor(el, componentScope, el.hasAttribute(':for') ? ':for' : '@for'); return; }
6126
+ if (hasIf) { bindIf(el, componentScope, el.hasAttribute(':if') ? ':if' : '@if'); return; }
5341
6127
  // Process other attributes...
5342
- if (el.hasAttribute && el.hasAttribute('@show')) bindShow(el, el.getAttribute('@show'));
5343
- if (el.hasAttribute && el.hasAttribute('@model')) bindModel(el, el.getAttribute('@model'));
6128
+ if (el.hasAttribute && (el.hasAttribute('@show') || el.hasAttribute(':show'))) {
6129
+ var sa = el.hasAttribute(':show') ? ':show' : '@show';
6130
+ bindShow(el, el.getAttribute(sa), componentScope, sa);
6131
+ }
6132
+ if (el.hasAttribute && (el.hasAttribute('@model') || el.hasAttribute(':model'))) {
6133
+ var ma = el.hasAttribute(':model') ? ':model' : '@model';
6134
+ bindModel(el, el.getAttribute(ma), componentScope, ma);
6135
+ }
5344
6136
  // Process children, skipping scoped containers
5345
6137
  Array.from(el.childNodes).forEach(child => processElementSkipScopes(child, processedScopes));
5346
6138
  }
5347
6139
  })();
5348
- `}var J3=()=>{};function f4($,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("/")||aX.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function eX($,Z,Y){let J=1,G=Y,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&G<$.length){X.lastIndex=G,Q.lastIndex=G;let K=X.exec($),q=Q.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,G=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;G=q.index+q[0].length}}return-1}function N4($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=eX($,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 X3($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function Z5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function D4($,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 E4($,Z,Y){let J=Z.selfClosing?" /":"",G=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+G+$.slice(Z.end)}function $2($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function Z2($){let Z=$,Y=0;while(Y<Z.length){let J=f4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-for");if(G===null){Y=J.end;continue}let X=G.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let Q=X[1].trim(),K=X[2].trim(),q;if(Q.includes(",")){let O=Q.split(",").map((R)=>R.trim()),F=O[0],L=O[1];q=`${K} as ${L} => ${F}`}else q=`${K} as ${Q}`;let _=D4(J.attrs,"v-for"),j=D4(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),B=N4(Z,J),U=Z.slice(B.outerStart,B.outerEnd),z=E4(U,{...J,start:0,end:J.end-J.start},j),W=`@foreach(${q})
5349
- `,H=`${W}${z}
5350
- @endforeach`;Z=Z.slice(0,B.outerStart)+H+Z.slice(B.outerEnd),Y=B.outerStart+W.length}return Z}function Y2($){let Z=$,Y=0;while(Y<Z.length){let J=f4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-if");if(G===null){Y=J.end;continue}let X=[],Q=N4(Z,J),K=D4(J.attrs,"v-if"),q=E4(Z.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},K);X.push({type:"if",expr:G,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let _=Q.outerEnd,j=!0;while(j){let H=Z.slice(_).match(/^\s*/),O=H?H[0].length:0,F=f4(Z,_+O);if(!F){j=!1;break}let L=Z5(F.attrs,"v-else-if"),R=X3(F.attrs,"v-else");if(L!==null){let M=N4(Z,F),V=D4(F.attrs,"v-else-if"),A=E4(Z.slice(M.outerStart,M.outerEnd),{...F,start:0,end:F.end-F.start},V);X.push({type:"else-if",expr:L,outerStart:_,outerEnd:M.outerEnd,element:A,parsedTag:F}),_=M.outerEnd}else if(R){let M=N4(Z,F),V=D4(F.attrs,"v-else"),A=E4(Z.slice(M.outerStart,M.outerEnd),{...F,start:0,end:F.end-F.start},V);X.push({type:"else",outerStart:_,outerEnd:M.outerEnd,element:A,parsedTag:F}),j=!1}else j=!1}let B=[];for(let H of X)if(H.type==="if")B.push(`@if(${H.expr})
6140
+ `}var G3=()=>{};function g4($,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("/")||Y2.has(J[1].toLowerCase()),start:J.index,end:J.index+J[0].length}}function X2($,Z,Y){let J=1,G=Y,X=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${Z}\\s*>`,"gi");while(J>0&&G<$.length){X.lastIndex=G,Q.lastIndex=G;let K=X.exec($),q=Q.exec($);if(!q)return-1;if(K&&K.index<q.index)J++,G=K.index+K[0].length;else{if(J--,J===0)return q.index+q[0].length;G=q.index+q[0].length}}return-1}function N4($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=X2($,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 Q3($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function Z5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return J?J[1]:null}function E4($,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 k4($,Z,Y){let J=Z.selfClosing?" /":"",G=`<${Z.tag}${Y}${J}>`;return $.slice(0,Z.start)+G+$.slice(Z.end)}function G2($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function Q2($){let Z=$,Y=0;while(Y<Z.length){let J=g4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-for");if(G===null){Y=J.end;continue}let X=G.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!X){Y=J.end;continue}let Q=X[1].trim(),K=X[2].trim(),q;if(Q.includes(",")){let O=Q.split(",").map((A)=>A.trim()),F=O[0],L=O[1];q=`${K} as ${L} => ${F}`}else q=`${K} as ${Q}`;let _=E4(J.attrs,"v-for"),j=E4(_,":key").replace(/\s*v-bind:key="[^"]*"/g,""),B=N4(Z,J),W=Z.slice(B.outerStart,B.outerEnd),z=k4(W,{...J,start:0,end:J.end-J.start},j),U=`@foreach(${q})
6141
+ `,H=`${U}${z}
6142
+ @endforeach`;Z=Z.slice(0,B.outerStart)+H+Z.slice(B.outerEnd),Y=B.outerStart+U.length}return Z}function K2($){let Z=$,Y=0;while(Y<Z.length){let J=g4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-if");if(G===null){Y=J.end;continue}let X=[],Q=N4(Z,J),K=E4(J.attrs,"v-if"),q=k4(Z.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},K);X.push({type:"if",expr:G,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:J});let _=Q.outerEnd,j=!0;while(j){let H=Z.slice(_).match(/^\s*/),O=H?H[0].length:0,F=g4(Z,_+O);if(!F){j=!1;break}let L=Z5(F.attrs,"v-else-if"),A=Q3(F.attrs,"v-else");if(L!==null){let M=N4(Z,F),V=E4(F.attrs,"v-else-if"),R=k4(Z.slice(M.outerStart,M.outerEnd),{...F,start:0,end:F.end-F.start},V);X.push({type:"else-if",expr:L,outerStart:_,outerEnd:M.outerEnd,element:R,parsedTag:F}),_=M.outerEnd}else if(A){let M=N4(Z,F),V=E4(F.attrs,"v-else"),R=k4(Z.slice(M.outerStart,M.outerEnd),{...F,start:0,end:F.end-F.start},V);X.push({type:"else",outerStart:_,outerEnd:M.outerEnd,element:R,parsedTag:F}),j=!1}else j=!1}let B=[];for(let H of X)if(H.type==="if")B.push(`@if(${H.expr})
5351
6143
  ${H.element}`);else if(H.type==="else-if")B.push(`@elseif(${H.expr})
5352
6144
  ${H.element}`);else B.push(`@else
5353
- ${H.element}`);B.push("@endif");let U=B.join(`
5354
- `),z=X[0].outerStart,W=X[X.length-1].outerEnd;Z=Z.slice(0,z)+U+Z.slice(W),Y=z+U.length}return Z}function J2($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function X2($){let Z=$,Y=0;while(Y<Z.length){let J=f4(Z,Y);if(!J)break;let G=J.attrs,X=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=G.match(Q);while(K){X=!0;let j=K[1],B=K[2],U=K[3];G=G.replace(K[0],""),G+=` :${j}="${U}" @update:${j}="${U} = $event"`,K=G.match(Q)}if(X){let j=N4(Z,J),B=Z.slice(j.outerStart,j.outerEnd),U=E4(B,{...J,start:0,end:J.end-J.start},G);Z=Z.slice(0,j.outerStart)+U+Z.slice(j.outerEnd),Y=j.outerStart+U.length;continue}let q=Z5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(tX.has(J.tag.toLowerCase())){let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,B=N4(Z,J),U=Z.slice(B.outerStart,B.outerEnd),z=E4(U,{...J,start:0,end:J.end-J.start},j);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length}else{let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"");j+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let B=N4(Z,J),U=Z.slice(B.outerStart,B.outerEnd),z=E4(U,{...J,start:0,end:J.end-J.start},j);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length}}return Z}function G2($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Q2($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function K2($){let Z=$,Y=0;while(Y<Z.length){let J=f4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-html");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=N4(Z,J),Q=D4(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{!! ${G} !!}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function q2($){let Z=$,Y=0;while(Y<Z.length){let J=f4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-text");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=N4(Z,J),Q=D4(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{{ ${G} }}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function _2($){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 j2($){let Z=$,Y=0;while(Y<Z.length){let J=f4(Z,Y);if(!J)break;if(!X3(J.attrs,"v-once")){Y=J.end;continue}let G=D4(J.attrs,"v-once"),X=N4(Z,J),Q=Z.slice(X.outerStart,X.outerEnd),q=`@once
5355
- ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5356
- @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function B2($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function U2($){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 G3($){if(!$2($))return $;let Z=$;return Z=Z2(Z),Z=Y2(Z),Z=j2(Z),Z=G2(Z),Z=Q2(Z),Z=X2(Z),Z=J2(Z),Z=U2(Z),Z=K2(Z),Z=q2(Z),Z=_2(Z),Z=B2(Z),Z}var aX,tX;var Q3=I(()=>{aX=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),tX=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});async function K3($,Z,Y,J,G){let X=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=i(j.expr,Z);if(!B||typeof B!=="string"){let L=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+L+X.slice(j.index+j.full.length);continue}let U=j.attrs.trim(),z={},W=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=W.exec(U))!==null){let L=H[1]||H[2],R=H[3];if(H[1])try{z[L]=i(R,Z)}catch{z[L]=R}else z[L]=R}let O=J.componentsDir||"components",F=await o4(B,z,j.slotContent,O,Z,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+F+X.slice(j.index+j.full.length)}catch(B){let z=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length)}}return X=await W2(X,Z,Y,J,G),X}async function W2($,Z,Y,J,G){let X=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=i(j.expr,Z);if(!B||typeof B!=="string"){let W=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+W+X.slice(j.index+j.full.length);continue}let U=J.componentsDir||"components",z=await o4(B,{},"",U,Z,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length)}catch(B){let z=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length)}}return X}var q3=I(()=>{A4();H4()});var j3={};o(j3,{processDeferDirectives:()=>F2});function z2(){return`stx-defer-${++_3}`}function H2($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function O2($,Z,Y){let{trigger:J,value:G}=H2(Z),X=Y,Q,K,q,_=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)Q=_[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let j=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(j)K=j[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let B=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(B)q=B[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:G,content:X,placeholder:Q,loading:K,error:q}}function L2($,Z){let{trigger:Y,triggerValue:J}=Z,G;switch(Y){case"visible":G=`
6145
+ ${H.element}`);B.push("@endif");let W=B.join(`
6146
+ `),z=X[0].outerStart,U=X[X.length-1].outerEnd;Z=Z.slice(0,z)+W+Z.slice(U),Y=z+W.length}return Z}function q2($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function _2($){let Z=$,Y=0;while(Y<Z.length){let J=g4(Z,Y);if(!J)break;let G=J.attrs,X=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=G.match(Q);while(K){X=!0;let j=K[1],B=K[2],W=K[3];G=G.replace(K[0],""),G+=` :${j}="${W}" @update:${j}="${W} = $event"`,K=G.match(Q)}if(X){let j=N4(Z,J),B=Z.slice(j.outerStart,j.outerEnd),W=k4(B,{...J,start:0,end:J.end-J.start},G);Z=Z.slice(0,j.outerStart)+W+Z.slice(j.outerEnd),Y=j.outerStart+W.length;continue}let q=Z5(J.attrs,"v-model");if(q===null){Y=J.end;continue}if(J2.has(J.tag.toLowerCase())){let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,B=N4(Z,J),W=Z.slice(B.outerStart,B.outerEnd),z=k4(W,{...J,start:0,end:J.end-J.start},j);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length}else{let j=J.attrs.replace(/\s*v-model="[^"]*"/g,"");j+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let B=N4(Z,J),W=Z.slice(B.outerStart,B.outerEnd),z=k4(W,{...J,start:0,end:J.end-J.start},j);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length}}return Z}function j2($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function B2($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function W2($){let Z=$,Y=0;while(Y<Z.length){let J=g4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-html");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=N4(Z,J),Q=E4(J.attrs,"v-html"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{!! ${G} !!}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function U2($){let Z=$,Y=0;while(Y<Z.length){let J=g4(Z,Y);if(!J)break;let G=Z5(J.attrs,"v-text");if(G===null){Y=J.end;continue}if(J.selfClosing){Y=J.end;continue}let X=N4(Z,J),Q=E4(J.attrs,"v-text"),K=J.selfClosing?" /":"",q=`<${J.tag}${Q}${K}>{{ ${G} }}</${J.tag}>`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function z2($){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 H2($){let Z=$,Y=0;while(Y<Z.length){let J=g4(Z,Y);if(!J)break;if(!Q3(J.attrs,"v-once")){Y=J.end;continue}let G=E4(J.attrs,"v-once"),X=N4(Z,J),Q=Z.slice(X.outerStart,X.outerEnd),q=`@once
6147
+ ${k4(Q,{...J,start:0,end:J.end-J.start},G)}
6148
+ @endonce`;Z=Z.slice(0,X.outerStart)+q+Z.slice(X.outerEnd),Y=X.outerStart+q.length}return Z}function O2($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function L2($){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 K3($){if(!G2($))return $;let Z=$;return Z=Q2(Z),Z=K2(Z),Z=H2(Z),Z=j2(Z),Z=B2(Z),Z=_2(Z),Z=q2(Z),Z=L2(Z),Z=W2(Z),Z=U2(Z),Z=z2(Z),Z=O2(Z),Z}var Y2,J2;var q3=w(()=>{Y2=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),J2=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});async function _3($,Z,Y,J,G){let X=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=n(j.expr,Z);if(!B||typeof B!=="string"){let L=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+L+X.slice(j.index+j.full.length);continue}let W=j.attrs.trim(),z={},U=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=U.exec(W))!==null){let L=H[1]||H[2],A=H[3];if(H[1])try{z[L]=n(A,Z)}catch{z[L]=A}else z[L]=A}let O=J.componentsDir||"components",F=await s4(B,z,j.slotContent,O,Z,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+F+X.slice(j.index+j.full.length)}catch(B){let z=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length)}}return X=await F2(X,Z,Y,J,G),X}async function F2($,Z,Y,J,G){let X=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=Q.exec(X))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let _=K.length-1;_>=0;_--){let j=K[_];try{let B=n(j.expr,Z);if(!B||typeof B!=="string"){let U=`<!-- dynamic component: could not resolve "${j.expr}" -->`;X=X.slice(0,j.index)+U+X.slice(j.index+j.full.length);continue}let W=J.componentsDir||"components",z=await s4(B,{},"",W,Z,Y,J,new Set,G??new Set);X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length)}catch(B){let z=`<!-- dynamic component error: ${B instanceof Error?B.message:String(B)} -->`;X=X.slice(0,j.index)+z+X.slice(j.index+j.full.length)}}return X}var j3=w(()=>{F4();L4()});var W3={};o(W3,{processDeferDirectives:()=>M2});function A2(){return`stx-defer-${++B3}`}function R2($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function N2($,Z,Y){let{trigger:J,value:G}=R2(Z),X=Y,Q,K,q,_=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(_)Q=_[1].trim(),X=X.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let j=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(j)K=j[1].trim(),X=X.replace(/@loading[\s\S]*?(?=@error|$)/,"");let B=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(B)q=B[2].trim(),X=X.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return X=X.trim(),{trigger:J,triggerValue:G,content:X,placeholder:Q,loading:K,error:q}}function V2($,Z){let{trigger:Y,triggerValue:J}=Z,G;switch(Y){case"visible":G=`
5357
6149
  const observer = new IntersectionObserver((entries) => {
5358
6150
  if (entries[0].isIntersecting) {
5359
6151
  observer.disconnect();
@@ -5425,15 +6217,15 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5425
6217
  ${G}
5426
6218
  })();
5427
6219
  </script>
5428
- `}function F2($,Z,Y){_3=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(G,X,Q)=>{let K=z2(),q=O2(G,X,Q),_=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",j=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',B=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",U=`<div data-defer-content style="display: none;">${q.content}</div>`,z=L2(K,q);return`
6220
+ `}function M2($,Z,Y){B3=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(G,X,Q)=>{let K=A2(),q=N2(G,X,Q),_=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",j=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',B=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",W=`<div data-defer-content style="display: none;">${q.content}</div>`,z=V2(K,q);return`
5429
6221
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
5430
6222
  ${_}
5431
6223
  ${j}
5432
- ${U}
6224
+ ${W}
5433
6225
  ${B}
5434
6226
  </div>
5435
6227
  ${z}
5436
- `})}var _3=0;var U3={};o(U3,{processTeleportDirectives:()=>V2,ensureTeleportTargets:()=>M2});function R2(){return`stx-teleport-${++B3}`}function A2($){let Z=$.split(",").map((G)=>G.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let G=1;G<Z.length;G++){let X=Z[G].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function N2($,Z){return`
6228
+ `})}var B3=0;var z3={};o(z3,{processTeleportDirectives:()=>D2,ensureTeleportTargets:()=>E2});function T2(){return`stx-teleport-${++U3}`}function I2($){let Z=$.split(",").map((G)=>G.trim()),Y=Z[0].replace(/['"]/g,""),J;for(let G=1;G<Z.length;G++){let X=Z[G].match(/disabled:\s*(.+)/);if(X)J=X[1].trim()}return{target:Y,disabled:J}}function w2($,Z){return`
5437
6229
  <script>
5438
6230
  (function() {
5439
6231
  const source = document.getElementById('${$}');
@@ -5469,12 +6261,12 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5469
6261
  }));
5470
6262
  })();
5471
6263
  </script>
5472
- `}function V2($,Z,Y){B3=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(G,X,Q)=>{let K=R2(),{target:q,disabled:_}=A2(X),j=Q.trim();if(_)try{let U=!1;if(_==="true")U=!0;else if(_==="false")U=!1;else if(_ in Z)U=Boolean(Z[_]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${j}</div>`}catch{}let B=N2(K,q);return`
6264
+ `}function D2($,Z,Y){U3=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(G,X,Q)=>{let K=T2(),{target:q,disabled:_}=I2(X),j=Q.trim();if(_)try{let W=!1;if(_==="true")W=!0;else if(_==="false")W=!1;else if(_ in Z)W=Boolean(Z[_]);if(W)return`<div class="stx-teleport-inline" data-teleport-disabled>${j}</div>`}catch{}let B=w2(K,q);return`
5473
6265
  <div id="${K}" class="stx-teleport-source" style="display: none;">
5474
6266
  <template>${j}</template>
5475
6267
  </div>
5476
6268
  ${B}
5477
- `})}function M2(){return`
6269
+ `})}function E2(){return`
5478
6270
  <script>
5479
6271
  (function() {
5480
6272
  // Common teleport targets
@@ -5491,7 +6283,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5491
6283
  });
5492
6284
  })();
5493
6285
  </script>
5494
- `}var B3=0;var O3={};o(O3,{processTransitionDirectives:()=>D2,processTransitionAttributes:()=>b2,performLeave:()=>I2,performEnter:()=>w2,generateTransitionRuntime:()=>S2,generateTransitionCSS:()=>k2});function W3($,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 T2($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",G=(X)=>{let Q=X.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let K=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?K:K*1000};return Math.max(G(Y),G(J))}function z3($,Z){return new Promise((Y)=>{let J=Z??T2($);if(J===0){Y();return}let G=!1,X=()=>{if(G)return;G=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Y()},Q=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(X,J+50)})}function H3($){$.offsetHeight}async function w2($,Z={}){let Y=Z.name||"stx",J=W3(Y,Z),G=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),H3($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await z3($,G);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function I2($,Z={}){let Y=Z.name||"stx",J=W3(Y,Z),G=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),H3($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await z3($,G);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function D2($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(G,X,Q)=>{let K=E2(X),q=K.name||"stx",_=K.duration||300,j=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
6286
+ `}var U3=0;var F3={};o(F3,{processTransitionDirectives:()=>P2,processTransitionAttributes:()=>v2,performLeave:()=>b2,performEnter:()=>S2,generateTransitionRuntime:()=>x2,generateTransitionCSS:()=>C2});function H3($,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 k2($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",J=Z.animationDuration||"0s",G=(X)=>{let Q=X.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let K=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?K:K*1000};return Math.max(G(Y),G(J))}function O3($,Z){return new Promise((Y)=>{let J=Z??k2($);if(J===0){Y();return}let G=!1,X=()=>{if(G)return;G=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Y()},Q=(K)=>{if(K.target===$)X()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(X,J+50)})}function L3($){$.offsetHeight}async function S2($,Z={}){let Y=Z.name||"stx",J=H3(Y,Z),G=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),L3($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),Z.onEnter)await new Promise((X)=>{Z.onEnter($,X)});else await O3($,G);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),Z.onAfterEnter?.($)}async function b2($,Z={}){let Y=Z.name||"stx",J=H3(Y,Z),G=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),L3($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),Z.onLeave)await new Promise((X)=>{Z.onLeave($,X)});else await O3($,G);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),Z.onAfterLeave?.($)}function P2($,Z={},Y){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(G,X,Q)=>{let K=y2(X),q=K.name||"stx",_=K.duration||300,j=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
5495
6287
  <div
5496
6288
  class="stx-transition-wrapper"
5497
6289
  data-transition="${q}"
@@ -5533,7 +6325,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5533
6325
  });
5534
6326
  })();
5535
6327
  </script>
5536
- `})}function E2($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3]||J[4]||J[5];switch(G){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 k2(){return`
6328
+ `})}function y2($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3]||J[4]||J[5];switch(G){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 C2(){return`
5537
6329
  /* STX Transition Presets */
5538
6330
 
5539
6331
  /* Fade */
@@ -5720,7 +6512,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5720
6512
  opacity: 1;
5721
6513
  max-height: 1000px;
5722
6514
  }
5723
- `}function S2(){return`
6515
+ `}function x2(){return`
5724
6516
  // STX Transition Runtime
5725
6517
  (function() {
5726
6518
  if (typeof window === 'undefined') return;
@@ -5808,7 +6600,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5808
6600
 
5809
6601
  console.log('[stx] Transition runtime initialized');
5810
6602
  })();
5811
- `}function b2($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,G,X)=>{let Q=G||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var F3={};o(F3,{withErrorBoundary:()=>L3,processErrorBoundaryDirectives:()=>C2,generateErrorBoundaryRuntime:()=>h2,generateErrorBoundaryCSS:()=>g2,createErrorBoundary:()=>f2});function y2(){return`eb-${++P2}-${Date.now().toString(36)}`}function C2($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(G,X,Q,K)=>{let q=y2(),_=v2(X||"");return x2(q,Q.trim(),K.trim(),_)})}function v2($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3]||J[4];switch(G){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function x2($,Z,Y,J){let G=J.logErrors!==!1;return`
6603
+ `}function v2($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,J,G,X)=>{let Q=G||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${X}" data-stx-transition-id="${K}"`})}var R3={};o(R3,{withErrorBoundary:()=>A3,processErrorBoundaryDirectives:()=>h2,generateErrorBoundaryRuntime:()=>c2,generateErrorBoundaryCSS:()=>p2,createErrorBoundary:()=>u2});function g2(){return`eb-${++f2}-${Date.now().toString(36)}`}function h2($,Z={},Y){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(G,X,Q,K)=>{let q=g2(),_=d2(X||"");return m2(q,Q.trim(),K.trim(),_)})}function d2($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3]||J[4];switch(G){case"id":Z.id=X;break;case"logErrors":Z.logErrors=X==="true";break}}return Z}function m2($,Z,Y,J){let G=J.logErrors!==!1;return`
5812
6604
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
5813
6605
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
5814
6606
  ${Z}
@@ -5928,7 +6720,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5928
6720
  };
5929
6721
  })();
5930
6722
  </script>
5931
- `}async function L3($,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 f2($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>L3(J,$,Y)}function g2(){return`
6723
+ `}async function A3($,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 u2($,Z={}){let Y=Z.onError?(J)=>Z.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>A3(J,$,Y)}function p2(){return`
5932
6724
  /* STX Error Boundary Styles */
5933
6725
  .stx-error-boundary {
5934
6726
  position: relative;
@@ -5972,7 +6764,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
5972
6764
  color: #fecaca;
5973
6765
  }
5974
6766
  }
5975
- `}function h2(){return`
6767
+ `}function c2(){return`
5976
6768
  // STX Error Boundary Runtime
5977
6769
  (function() {
5978
6770
  if (typeof window === 'undefined') return;
@@ -6037,7 +6829,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6037
6829
 
6038
6830
  console.log('[stx] Error boundary runtime initialized');
6039
6831
  })();
6040
- `}var P2=0;var R3={};o(R3,{renderSSRSuspense:()=>i2,processSuspenseDirectives:()=>u2,generateSuspenseRuntime:()=>s2,generateSuspenseCSS:()=>n2,createSSRSuspense:()=>l2});function m2(){return`suspense-${++d2}-${Date.now().toString(36)}`}function u2($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(G,X,Q,K)=>{let q=m2(),_=p2(X||"");return c2(q,Q.trim(),K.trim(),_)})}function p2($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"id":Z.id=X;break;case"timeout":Z.timeout=Q?parseInt(Q,10):void 0;break}}return Z}function c2($,Z,Y,J){let G=J.timeout||30000,X=J.id||$;return`
6832
+ `}var f2=0;var N3={};o(N3,{renderSSRSuspense:()=>a2,processSuspenseDirectives:()=>n2,generateSuspenseRuntime:()=>e2,generateSuspenseCSS:()=>t2,createSSRSuspense:()=>r2});function i2(){return`suspense-${++l2}-${Date.now().toString(36)}`}function n2($,Z={},Y){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(G,X,Q,K)=>{let q=i2(),_=s2(X||"");return o2(q,Q.trim(),K.trim(),_)})}function s2($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"id":Z.id=X;break;case"timeout":Z.timeout=Q?parseInt(Q,10):void 0;break}}return Z}function o2($,Z,Y,J){let G=J.timeout||30000,X=J.id||$;return`
6041
6833
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${X}" data-status="pending">
6042
6834
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
6043
6835
  ${Y}
@@ -6225,7 +7017,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6225
7017
  }, 0);
6226
7018
  })();
6227
7019
  </script>
6228
- `}function l2($,Z,Y){return{id:$,fallback:Y,content:Z}}async function i2($){let Z=$.map((J)=>`
7020
+ `}function r2($,Z,Y){return{id:$,fallback:Y,content:Z}}async function a2($){let Z=$.map((J)=>`
6229
7021
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
6230
7022
  ${J.fallback}
6231
7023
  </div>
@@ -6250,7 +7042,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6250
7042
  }
6251
7043
  })();
6252
7044
  </script>
6253
- `}}return{initial:Z,streaming:Y()}}function n2(){return`
7045
+ `}}return{initial:Z,streaming:Y()}}function t2(){return`
6254
7046
  /* STX Suspense Styles */
6255
7047
  .stx-suspense {
6256
7048
  position: relative;
@@ -6306,7 +7098,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6306
7098
  background-size: 200% 100%;
6307
7099
  }
6308
7100
  }
6309
- `}function s2(){return`
7101
+ `}function e2(){return`
6310
7102
  // STX Suspense Runtime
6311
7103
  (function() {
6312
7104
  if (typeof window === 'undefined') return;
@@ -6371,7 +7163,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6371
7163
 
6372
7164
  console.log('[stx] Suspense runtime initialized');
6373
7165
  })();
6374
- `}var d2=0;var M3={};o(M3,{processAsyncDirectives:()=>r2,isAsyncComponent:()=>t2,generateAsyncComponentRuntime:()=>$G,generateAsyncComponentCSS:()=>e2,defineAsyncComponent:()=>a2});function A3(){return`async-${++o2}-${Date.now().toString(36)}`}function r2($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,G=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(J,(Q,K,q,_)=>{let j=A3(),B=N3(K);return V3(j,B,q.trim(),_.trim())}),X=X.replace(G,(Q,K,q)=>{let _=A3(),j=N3(K);return V3(_,j,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function N3($){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 G=J[1],X=J[2]||J[3],Q=J[4],K=J[5];switch(G){case"component":Z.component=X||K||"";break;case"timeout":Z.timeout=Q?parseInt(Q,10):30000;break;case"delay":Z.delay=Q?parseInt(Q,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":Z.loadingComponent=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function V3($,Z,Y,J){let{component:G,timeout:X,delay:Q,suspensible:K,retries:q}=Z;return`
7166
+ `}var l2=0;var I3={};o(I3,{processAsyncDirectives:()=>ZG,isAsyncComponent:()=>JG,generateAsyncComponentRuntime:()=>GG,generateAsyncComponentCSS:()=>XG,defineAsyncComponent:()=>YG});function V3(){return`async-${++$G}-${Date.now().toString(36)}`}function ZG($,Z={},Y){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,G=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,X=$;return X=X.replace(J,(Q,K,q,_)=>{let j=V3(),B=M3(K);return T3(j,B,q.trim(),_.trim())}),X=X.replace(G,(Q,K,q)=>{let _=V3(),j=M3(K);return T3(_,j,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),X}function M3($){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 G=J[1],X=J[2]||J[3],Q=J[4],K=J[5];switch(G){case"component":Z.component=X||K||"";break;case"timeout":Z.timeout=Q?parseInt(Q,10):30000;break;case"delay":Z.delay=Q?parseInt(Q,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":Z.loadingComponent=X||K;break;case"errorComponent":Z.errorComponent=X||K;break}}return Z}function T3($,Z,Y,J){let{component:G,timeout:X,delay:Q,suspensible:K,retries:q}=Z;return`
6375
7167
  <div class="stx-async-component" data-async-id="${$}" data-component="${G}" data-status="pending">
6376
7168
  <div class="stx-async-loading" data-async-loading="${$}">
6377
7169
  ${Y}
@@ -6549,7 +7341,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6549
7341
  loadComponent();
6550
7342
  })();
6551
7343
  </script>
6552
- `}function a2($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function t2($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function e2(){return`
7344
+ `}function YG($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function JG($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function XG(){return`
6553
7345
  /* STX Async Component Styles */
6554
7346
  .stx-async-component {
6555
7347
  position: relative;
@@ -6623,7 +7415,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6623
7415
  background-size: 200% 100%;
6624
7416
  }
6625
7417
  }
6626
- `}function $G(){return`
7418
+ `}function GG(){return`
6627
7419
  // STX Async Component Runtime
6628
7420
  (function() {
6629
7421
  if (typeof window === 'undefined') return;
@@ -6675,7 +7467,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6675
7467
 
6676
7468
  console.log('[stx] Async component runtime initialized');
6677
7469
  })();
6678
- `}var o2=0;var w3={};o(w3,{shouldCacheComponent:()=>QG,processKeepAliveDirectives:()=>YG,onDeactivated:()=>jG,onActivated:()=>_G,generateKeepAliveRuntime:()=>qG,generateKeepAliveCSS:()=>KG,createKeepAliveCache:()=>GG});function T3(){return`keep-alive-${++ZG}-${Date.now().toString(36)}`}function YG($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(G,X,Q)=>{let K=T3(),q=JG(X||"");return XG(K,Q.trim(),q)})}function JG($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"max":Z.max=Q?parseInt(Q,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function XG($,Z,Y){let{max:J,include:G,exclude:X}=Y,Q=Y.id||$;return`
7470
+ `}var $G=0;var D3={};o(D3,{shouldCacheComponent:()=>BG,processKeepAliveDirectives:()=>KG,onDeactivated:()=>HG,onActivated:()=>zG,generateKeepAliveRuntime:()=>UG,generateKeepAliveCSS:()=>WG,createKeepAliveCache:()=>jG});function w3(){return`keep-alive-${++QG}-${Date.now().toString(36)}`}function KG($,Z={},Y){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(G,X,Q)=>{let K=w3(),q=qG(X||"");return _G(K,Q.trim(),q)})}function qG($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Y.exec($))!==null){let G=J[1],X=J[2]||J[3],Q=J[4];switch(G){case"max":Z.max=Q?parseInt(Q,10):10;break;case"include":Z.include=X;break;case"exclude":Z.exclude=X;break;case"id":Z.id=X;break}}return Z}function _G($,Z,Y){let{max:J,include:G,exclude:X}=Y,Q=Y.id||$;return`
6679
7471
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${Q}">
6680
7472
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
6681
7473
  ${Z}
@@ -6954,7 +7746,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6954
7746
  });
6955
7747
  })();
6956
7748
  </script>
6957
- `}function GG($={}){return{id:$.id||T3(),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 QG($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function KG(){return`
7749
+ `}function jG($={}){return{id:$.id||w3(),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 BG($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function WG(){return`
6958
7750
  /* STX Keep-Alive Styles */
6959
7751
  .stx-keep-alive {
6960
7752
  position: relative;
@@ -6979,7 +7771,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
6979
7771
  .stx-keep-alive-content > [data-activated] {
6980
7772
  opacity: 1;
6981
7773
  }
6982
- `}function qG(){return`
7774
+ `}function UG(){return`
6983
7775
  // STX Keep-Alive Runtime
6984
7776
  (function() {
6985
7777
  if (typeof window === 'undefined') return;
@@ -7015,7 +7807,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7015
7807
 
7016
7808
  console.log('[stx] Keep-alive runtime initialized');
7017
7809
  })();
7018
- `}function _G($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function jG($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var ZG=0;var S3={};o(S3,{useVirtualList:()=>D3,processVirtualListDirectives:()=>Y6,processVirtualGridDirectives:()=>k3,processInfiniteListDirectives:()=>E3,generateVirtualListCSS:()=>I3,default:()=>BG,createVirtualList:()=>Z6});function Z6($,Z){let{itemHeight:Y,containerHeight:J,overscan:G=3,keyProperty:X="id",dynamicHeight:Q=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,_=[...$],j=0,B=new Map;function U(){if(Q)return z();let A=Math.max(0,Math.floor(j/Y)-G),N=Math.ceil(J/Y),T=Math.min(_.length-1,A+N+G*2);return{startIndex:A,endIndex:T}}function z(){let A=0,N=0,T=_.length-1;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(A+E>j){N=Math.max(0,D-G);break}A+=E}A=0;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(A+=E,A>j+J){T=Math.min(_.length-1,D+G);break}}return{startIndex:N,endIndex:T}}function W(){if(Q){let A=0;for(let N=0;N<_.length;N++)A+=B.get(N)||K;return A}return _.length*Y}function H(A){if(Q){let N=0;for(let T=0;T<A;T++)N+=B.get(T)||K;return N}return A*Y}function O(){let{startIndex:A,endIndex:N}=U();return{startIndex:A,endIndex:N,scrollTop:j,totalHeight:W(),visibleItems:_.slice(A,N+1),itemHeights:new Map(B)}}function F(A,N="auto"){let T=H(A);L(T,N)}function L(A,N="auto"){j=Math.max(0,Math.min(A,W()-J))}function R(){U()}function M(A){_=[...A],B.clear(),R()}function V(){_=[],B.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:R,setItems:M,destroy:V}}function Y6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let j={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),R=Function(`return ${L}`)();j={...j,...R}}catch{}let B=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(j.containerHeight/j.itemHeight),z=j.overscan||3,W=0,H=Math.min(_.length-1,U+z),O="";for(let L=W;L<=H&&L<_.length;L++){let R=_[L],M=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(V,A)=>{if(typeof R==="object"&&R!==null)return String(R[A]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
7810
+ `}function zG($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function HG($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var QG=0;var P3={};o(P3,{useVirtualList:()=>k3,processVirtualListDirectives:()=>J6,processVirtualGridDirectives:()=>b3,processInfiniteListDirectives:()=>S3,generateVirtualListCSS:()=>E3,default:()=>OG,createVirtualList:()=>Y6});function Y6($,Z){let{itemHeight:Y,containerHeight:J,overscan:G=3,keyProperty:X="id",dynamicHeight:Q=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,_=[...$],j=0,B=new Map;function W(){if(Q)return z();let R=Math.max(0,Math.floor(j/Y)-G),N=Math.ceil(J/Y),T=Math.min(_.length-1,R+N+G*2);return{startIndex:R,endIndex:T}}function z(){let R=0,N=0,T=_.length-1;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(R+E>j){N=Math.max(0,D-G);break}R+=E}R=0;for(let D=0;D<_.length;D++){let E=B.get(D)||K;if(R+=E,R>j+J){T=Math.min(_.length-1,D+G);break}}return{startIndex:N,endIndex:T}}function U(){if(Q){let R=0;for(let N=0;N<_.length;N++)R+=B.get(N)||K;return R}return _.length*Y}function H(R){if(Q){let N=0;for(let T=0;T<R;T++)N+=B.get(T)||K;return N}return R*Y}function O(){let{startIndex:R,endIndex:N}=W();return{startIndex:R,endIndex:N,scrollTop:j,totalHeight:U(),visibleItems:_.slice(R,N+1),itemHeights:new Map(B)}}function F(R,N="auto"){let T=H(R);L(T,N)}function L(R,N="auto"){j=Math.max(0,Math.min(R,U()-J))}function A(){W()}function M(R){_=[...R],B.clear(),A()}function V(){_=[],B.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:A,setItems:M,destroy:V}}function J6($,Z={},Y){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualList: items "${q}" not found or not an array -->`;let j={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),A=Function(`return ${L}`)();j={...j,...A}}catch{}let B=`vlist-${Math.random().toString(36).substring(2,9)}`,W=Math.ceil(j.containerHeight/j.itemHeight),z=j.overscan||3,U=0,H=Math.min(_.length-1,W+z),O="";for(let L=U;L<=H&&L<_.length;L++){let A=_[L],M=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(V,R)=>{if(typeof A==="object"&&A!==null)return String(A[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
7019
7811
  <div class="virtual-item ${j.itemClass||""}"
7020
7812
  style="position: absolute; top: ${L*j.itemHeight}px; height: ${j.itemHeight}px; width: 100%;"
7021
7813
  data-index="${L}">
@@ -7092,7 +7884,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7092
7884
  };
7093
7885
  })();
7094
7886
  </script>
7095
- `})}function I3(){return`
7887
+ `})}function E3(){return`
7096
7888
  .virtual-list-container {
7097
7889
  position: relative;
7098
7890
  overflow-y: auto;
@@ -7140,7 +7932,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7140
7932
  0% { background-position: 200% 0; }
7141
7933
  100% { background-position: -200% 0; }
7142
7934
  }
7143
- `}function D3($,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:(G)=>{let X=G.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(G)=>({style:{position:"absolute",top:`${G*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":G}),scrollToIndex:(G)=>{J().scrollToIndex(G)}}}function E3($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(G,X,Q,K,q)=>{let _=X.trim(),j=Z[_];if(!j||!Array.isArray(j))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let B={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let W=Function(`return ${Q.trim()}`)();B={...B,...W}}catch{}let U=`ilist-${Math.random().toString(36).substring(2,9)}`,z=Y6(`@virtualList(${_}, ${JSON.stringify({itemHeight:B.itemHeight,containerHeight:B.containerHeight,overscan:B.overscan,containerClass:B.containerClass})})${K}@endvirtualList`,Z);return z=z.replace("</script>",`
7935
+ `}function k3($,Z){let Y=null,J=()=>{if(!Y)Y=Y6($(),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:(G)=>{let X=G.target;if(Y)Y.scrollToOffset(X.scrollTop)}}),itemProps:(G)=>({style:{position:"absolute",top:`${G*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":G}),scrollToIndex:(G)=>{J().scrollToIndex(G)}}}function S3($,Z={},Y){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(G,X,Q,K,q)=>{let _=X.trim(),j=Z[_];if(!j||!Array.isArray(j))return`<!-- infiniteList: items "${_}" not found or not an array -->`;let B={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let U=Function(`return ${Q.trim()}`)();B={...B,...U}}catch{}let W=`ilist-${Math.random().toString(36).substring(2,9)}`,z=J6(`@virtualList(${_}, ${JSON.stringify({itemHeight:B.itemHeight,containerHeight:B.containerHeight,overscan:B.overscan,containerClass:B.containerClass})})${K}@endvirtualList`,Z);return z=z.replace("</script>",`
7144
7936
  // Infinite scroll detection
7145
7937
  container.addEventListener('scroll', function() {
7146
7938
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -7152,13 +7944,13 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7152
7944
  }
7153
7945
  });
7154
7946
  </script>`),`
7155
- <div id="${U}" class="infinite-list-wrapper">
7947
+ <div id="${W}" class="infinite-list-wrapper">
7156
7948
  ${z}
7157
7949
  <div class="infinite-list-loading" style="display: none;">
7158
7950
  ${q}
7159
7951
  </div>
7160
7952
  </div>
7161
- `})}function k3($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let j={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let R=Function(`return ${Q.trim()}`)();j={...j,...R}}catch{}let B=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(_.length/j.columns),z=U*(j.rowHeight+(j.gap||0)),W=Math.ceil(j.containerHeight/(j.rowHeight+(j.gap||0))),H=j.overscan||2,O=0,F=Math.min(U-1,W+H),L="";for(let R=O;R<=F;R++)for(let M=0;M<j.columns;M++){let V=R*j.columns+M;if(V>=_.length)break;let A=_[V],N=M*(100/j.columns),T=R*(j.rowHeight+(j.gap||0)),D=K.replace(/\{\{\s*item\s*\}\}/g,typeof A==="object"?JSON.stringify(A):String(A)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(E,k)=>{if(typeof A==="object"&&A!==null)return String(A[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(V));L+=`
7953
+ `})}function b3($,Z={},Y){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(G,X,Q,K)=>{let q=X.trim(),_=Z[q];if(!_||!Array.isArray(_))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let j={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let A=Function(`return ${Q.trim()}`)();j={...j,...A}}catch{}let B=`vgrid-${Math.random().toString(36).substring(2,9)}`,W=Math.ceil(_.length/j.columns),z=W*(j.rowHeight+(j.gap||0)),U=Math.ceil(j.containerHeight/(j.rowHeight+(j.gap||0))),H=j.overscan||2,O=0,F=Math.min(W-1,U+H),L="";for(let A=O;A<=F;A++)for(let M=0;M<j.columns;M++){let V=A*j.columns+M;if(V>=_.length)break;let R=_[V],N=M*(100/j.columns),T=A*(j.rowHeight+(j.gap||0)),D=K.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(E,k)=>{if(typeof R==="object"&&R!==null)return String(R[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(V));L+=`
7162
7954
  <div class="virtual-grid-item"
7163
7955
  style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/j.columns}% - ${j.gap||0}px); height: ${j.rowHeight}px;"
7164
7956
  data-index="${V}">
@@ -7228,7 +8020,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7228
8020
  });
7229
8021
  })();
7230
8022
  </script>
7231
- `})}var BG;var b3=I(()=>{BG={createVirtualList:Z6,processVirtualListDirectives:Y6,processInfiniteListDirectives:E3,processVirtualGridDirectives:k3,generateVirtualListCSS:I3,useVirtualList:D3}});function P3(){return`<script data-stx-hydration-runtime>
8023
+ `})}var OG;var y3=w(()=>{OG={createVirtualList:Y6,processVirtualListDirectives:J6,processInfiniteListDirectives:S3,processVirtualGridDirectives:b3,generateVirtualListCSS:E3,useVirtualList:k3}});function C3(){return`<script data-stx-hydration-runtime>
7232
8024
  (function() {
7233
8025
  'use strict';
7234
8026
 
@@ -7382,7 +8174,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7382
8174
  stxIslands.initIslands();
7383
8175
  }
7384
8176
  })();
7385
- </script>`}function y3($){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 C3($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,G;while((G=J.exec($))!==null){let X=G[1],Q=G[2];if(Q in Z)Y[X]=Z[Q];else Y[X]=Q}return Y}var l3={};o(l3,{processStaticDirectives:()=>p3,processPartialHydrationDirectives:()=>x3,onHydrated:()=>u3,isHydrated:()=>m3,hydrateIsland:()=>g3,hydrateByStrategy:()=>h3,hydrateAll:()=>d3,generatePartialHydrationCSS:()=>f3,generateIslandManifest:()=>c3,default:()=>RG,createIslandRegistry:()=>v3});function v3(){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 UG($){return`
8177
+ </script>`}function x3($){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 v3($,Z){let Y={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,G;while((G=J.exec($))!==null){let X=G[1],Q=G[2];if(Q in Z)Y[X]=Z[Q];else Y[X]=Q}return Y}var n3={};o(n3,{processStaticDirectives:()=>l3,processPartialHydrationDirectives:()=>g3,onHydrated:()=>c3,isHydrated:()=>p3,hydrateIsland:()=>d3,hydrateByStrategy:()=>m3,hydrateAll:()=>u3,generatePartialHydrationCSS:()=>h3,generateIslandManifest:()=>i3,default:()=>TG,createIslandRegistry:()=>f3});function f3(){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 LG($){return`
7386
8178
  <script data-hydrate="${$}">
7387
8179
  (function() {
7388
8180
  const island = document.querySelector('[data-island="${$}"]');
@@ -7393,7 +8185,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7393
8185
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
7394
8186
  })();
7395
8187
  </script>
7396
- `}function WG($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
8188
+ `}function FG($,Z){let Y=Z.timeout||2000,J=Z.priority||"low";return`
7397
8189
  <script data-hydrate="${$}">
7398
8190
  (function() {
7399
8191
  const island = document.querySelector('[data-island="${$}"]');
@@ -7427,7 +8219,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7427
8219
  }
7428
8220
  })();
7429
8221
  </script>
7430
- `}function zG($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
8222
+ `}function AG($,Z){let Y=Z.rootMargin||"0px",J=Z.threshold||0;return`
7431
8223
  <script data-hydrate="${$}">
7432
8224
  (function() {
7433
8225
  const island = document.querySelector('[data-island="${$}"]');
@@ -7459,7 +8251,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7459
8251
  }
7460
8252
  })();
7461
8253
  </script>
7462
- `}function HG($,Z){let Y=Z.media||"(min-width: 768px)";return`
8254
+ `}function RG($,Z){let Y=Z.media||"(min-width: 768px)";return`
7463
8255
  <script data-hydrate="${$}">
7464
8256
  (function() {
7465
8257
  const island = document.querySelector('[data-island="${$}"]');
@@ -7487,7 +8279,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7487
8279
  }
7488
8280
  })();
7489
8281
  </script>
7490
- `}function OG($){return`
8282
+ `}function NG($){return`
7491
8283
  <script data-hydrate="${$}">
7492
8284
  (function() {
7493
8285
  const island = document.querySelector('[data-island="${$}"]');
@@ -7509,7 +8301,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7509
8301
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
7510
8302
  })();
7511
8303
  </script>
7512
- `}function LG($,Z){let Y=Z.event||"stx:activate";return`
8304
+ `}function VG($,Z){let Y=Z.event||"stx:activate";return`
7513
8305
  <script data-hydrate="${$}">
7514
8306
  (function() {
7515
8307
  const island = document.querySelector('[data-island="${$}"]');
@@ -7530,9 +8322,9 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7530
8322
  });
7531
8323
  })();
7532
8324
  </script>
7533
- `}function x3($,Z={},Y){let J=$,G=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=Y5(J,"load",Z),J=Y5(J,"idle",Z),J=Y5(J,"visible",Z),J=Y5(J,"media",Z),J=FG(J),J=Y5(J,"hover",Z),J=Y5(J,"event",Z),G=X&&J!==$,G)J+=`
7534
- `+P3();return J}function Y5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(G,X,Q)=>{let K={strategy:Z};if(X)try{let H=X.split(",").map((O)=>O.trim());for(let O of H){let[F,L]=O.split(":").map((R)=>R.trim());if(F&&L){let R=L.replace(/^['"]|['"]$/g,"");K[F]=R}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=y3(Q.trim()),j=C3(Q.trim(),Y),B=[];if(K.rootMargin)B.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)B.push(`data-threshold="${K.threshold}"`);if(K.media)B.push(`data-media="${K.media}"`);if(K.event)B.push(`data-event="${K.event}"`);if(_)B.push(`data-component="${_}"`);let z=Object.keys(j).length>0?`
7535
- <script type="application/json" data-island-props="${q}">${JSON.stringify(j)}</script>`:"",W="";switch(Z){case"load":W=UG(q);break;case"idle":W=WG(q,K);break;case"visible":W=zG(q,K);break;case"media":W=HG(q,K);break;case"hover":W=OG(q);break;case"event":W=LG(q,K);break}return`
8325
+ `}function g3($,Z={},Y){let J=$,G=!1,X=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=Y5(J,"load",Z),J=Y5(J,"idle",Z),J=Y5(J,"visible",Z),J=Y5(J,"media",Z),J=MG(J),J=Y5(J,"hover",Z),J=Y5(J,"event",Z),G=X&&J!==$,G)J+=`
8326
+ `+C3();return J}function Y5($,Z,Y){let J=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(G,X,Q)=>{let K={strategy:Z};if(X)try{let H=X.split(",").map((O)=>O.trim());for(let O of H){let[F,L]=O.split(":").map((A)=>A.trim());if(F&&L){let A=L.replace(/^['"]|['"]$/g,"");K[F]=A}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,_=x3(Q.trim()),j=v3(Q.trim(),Y),B=[];if(K.rootMargin)B.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)B.push(`data-threshold="${K.threshold}"`);if(K.media)B.push(`data-media="${K.media}"`);if(K.event)B.push(`data-event="${K.event}"`);if(_)B.push(`data-component="${_}"`);let z=Object.keys(j).length>0?`
8327
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(j)}</script>`:"",U="";switch(Z){case"load":U=LG(q);break;case"idle":U=FG(q,K);break;case"visible":U=AG(q,K);break;case"media":U=RG(q,K);break;case"hover":U=NG(q);break;case"event":U=VG(q,K);break}return`
7536
8328
  <div data-island="${q}"
7537
8329
  data-strategy="${Z}"
7538
8330
  ${B.join(`
@@ -7541,8 +8333,8 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7541
8333
  style="contents;">
7542
8334
  ${Q.trim()}${z}
7543
8335
  </div>
7544
- ${W}
7545
- `})}function FG($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let G=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
8336
+ ${U}
8337
+ `})}function MG($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,J)=>{let G=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
7546
8338
  <div data-island="${G}"
7547
8339
  data-strategy="only"
7548
8340
  class="stx-island stx-client-only">
@@ -7561,7 +8353,7 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7561
8353
  }
7562
8354
  })();
7563
8355
  </script>
7564
- `})}function f3(){return`
8356
+ `})}function h3(){return`
7565
8357
  /* Island base styles */
7566
8358
  .stx-island {
7567
8359
  display: contents;
@@ -7602,11 +8394,11 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7602
8394
  .stx-island.hydrated {
7603
8395
  opacity: 1;
7604
8396
  }
7605
- `}function g3($){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 h3($){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 d3(){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 m3($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function u3($){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 p3($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function c3($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
8397
+ `}function d3($){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 m3($){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 u3(){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 p3($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function c3($){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 l3($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function i3($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
7606
8398
  <script type="application/json" id="stx-island-manifest">
7607
8399
  ${JSON.stringify(Z)}
7608
8400
  </script>
7609
- `}var RG;var i3=I(()=>{RG={processPartialHydrationDirectives:x3,processStaticDirectives:p3,generatePartialHydrationCSS:f3,generateIslandManifest:c3,createIslandRegistry:v3,hydrateIsland:g3,hydrateByStrategy:h3,hydrateAll:d3,isHydrated:m3,onHydrated:u3}});var J1={};o(J1,{watchMultiple:()=>a3,watchEffect:()=>t3,watch:()=>r3,unref:()=>n3,toRefs:()=>s3,throttledComputed:()=>Y1,stxWatchMultiple:()=>a3,stxWatchEffect:()=>t3,stxWatch:()=>r3,stxUnref:()=>n3,stxToRefs:()=>s3,stxThrottledComputed:()=>Y1,stxShallowRef:()=>o3,stxRef:()=>J5,stxIsRef:()=>k4,stxDebouncedComputed:()=>Z1,stxComputed:()=>T5,shallowRef:()=>o3,ref:()=>J5,processWatchDirectives:()=>$1,processComputedDirectives:()=>e3,isRef:()=>k4,default:()=>AG,debouncedComputed:()=>Z1,computed:()=>T5});function J5($){let Z=$,Y=new Set,J={get value(){if(V4){let G=M5.get(J);if(!G)G=new Set,M5.set(J,G);G.add(V4)}return Z},set value(G){if(!Object.is(Z,G)){Z=G,Y.forEach((Q)=>Q(G));let X=M5.get(J);if(X)X.forEach((Q)=>Q())}},subscribe(G){return Y.add(G),()=>Y.delete(G)},peek(){return Z}};return J}function k4($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function n3($){return k4($)?$.value:$}function s3($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=J5($[Y]);return Z}function o3($){return J5($)}function T5($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,G=Z?Object.is:$.equals||Object.is,X,Q=!0,K=new Set,q=new Set,_=()=>{if(Q=!0,q.size>0){let U=B.value;q.forEach((z)=>z(U))}};function j(){K.clear();let U=V4;V4=_,F7.push(_);try{return Y()}finally{F7.pop(),V4=U}}let B={get value(){if(V4){let U=M5.get(B);if(!U)U=new Set,M5.set(B,U);U.add(V4)}if(Q){let U=j();if(!G(X,U))X=U;Q=!1}return X},set value(U){if(J)J(U);else console.warn("Computed property is readonly")},subscribe(U){return q.add(U),()=>q.delete(U)},peek(){if(Q)X=Y(),Q=!1;return X},invalidate(){Q=!0},get dirty(){return Q},get deps(){return K}};return B}function r3($,Z,Y={}){let{immediate:J=!1,deep:G=!1,flush:X="pre",once:Q=!1}=Y,K,q=!0,_=!1,j=()=>{if(k4($))return G?g4($.value):$.value;return $()},B=()=>{if(!q||_)return;let W=j();if(K!==void 0&&Object.is(K,W)&&!G)return;let H=()=>{if(Z(W,K),K=G?g4(W):W,Q)z()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},U=null;if(k4($))U=$.subscribe(()=>B());else U=T5($).subscribe(()=>B());if(J)K=void 0,B();else K=j();let z=()=>{if(q=!1,U)U(),U=null};return z.pause=()=>{_=!0},z.resume=()=>{_=!1},z}function a3($,Z,Y={}){let{immediate:J=!1,once:G=!1}=Y,X=$.map((B)=>k4(B)?B.value:void 0),Q=!0,K=!1,q=()=>{if(!Q||K)return;let B=$.map((U)=>k4(U)?U.value:void 0);if(Z(B,X),X=[...B],G)j()},_=$.map((B)=>{if(k4(B))return B.subscribe(()=>q());return()=>{}});if(J)q();let j=()=>{Q=!1,_.forEach((B)=>B())};return j.pause=()=>{K=!0},j.resume=()=>{K=!1},j}function t3($,Z={}){let{flush:Y="pre"}=Z,J,G=!0,X=!1,Q=()=>{if(!G||X)return;if(J)J();let q=V4;V4=Q,F7.push(Q);try{J=$()}finally{F7.pop(),V4=q}};if(Y==="sync")Q();else if(Y==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let K=()=>{if(G=!1,J)J()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function e3($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(G,X,Q)=>{try{let q=Function(...Object.keys(Z),`return ${Q}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function $1($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(G,X,Q)=>{return`
8401
+ `}var TG;var s3=w(()=>{TG={processPartialHydrationDirectives:g3,processStaticDirectives:l3,generatePartialHydrationCSS:h3,generateIslandManifest:i3,createIslandRegistry:f3,hydrateIsland:d3,hydrateByStrategy:m3,hydrateAll:u3,isHydrated:p3,onHydrated:c3}});var G1={};o(G1,{watchMultiple:()=>e3,watchEffect:()=>$1,watch:()=>t3,unref:()=>o3,toRefs:()=>r3,throttledComputed:()=>X1,stxWatchMultiple:()=>e3,stxWatchEffect:()=>$1,stxWatch:()=>t3,stxUnref:()=>o3,stxToRefs:()=>r3,stxThrottledComputed:()=>X1,stxShallowRef:()=>a3,stxRef:()=>J5,stxIsRef:()=>S4,stxDebouncedComputed:()=>J1,stxComputed:()=>M5,shallowRef:()=>a3,ref:()=>J5,processWatchDirectives:()=>Y1,processComputedDirectives:()=>Z1,isRef:()=>S4,default:()=>IG,debouncedComputed:()=>J1,computed:()=>M5});function J5($){let Z=$,Y=new Set,J={get value(){if(V4){let G=V5.get(J);if(!G)G=new Set,V5.set(J,G);G.add(V4)}return Z},set value(G){if(!Object.is(Z,G)){Z=G,Y.forEach((Q)=>Q(G));let X=V5.get(J);if(X)X.forEach((Q)=>Q())}},subscribe(G){return Y.add(G),()=>Y.delete(G)},peek(){return Z}};return J}function S4($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function o3($){return S4($)?$.value:$}function r3($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=J5($[Y]);return Z}function a3($){return J5($)}function M5($){let Z=typeof $==="function",Y=Z?$:$.get,J=Z?void 0:$.set,G=Z?Object.is:$.equals||Object.is,X,Q=!0,K=new Set,q=new Set,_=()=>{if(Q=!0,q.size>0){let W=B.value;q.forEach((z)=>z(W))}};function j(){K.clear();let W=V4;V4=_,R7.push(_);try{return Y()}finally{R7.pop(),V4=W}}let B={get value(){if(V4){let W=V5.get(B);if(!W)W=new Set,V5.set(B,W);W.add(V4)}if(Q){let W=j();if(!G(X,W))X=W;Q=!1}return X},set value(W){if(J)J(W);else console.warn("Computed property is readonly")},subscribe(W){return q.add(W),()=>q.delete(W)},peek(){if(Q)X=Y(),Q=!1;return X},invalidate(){Q=!0},get dirty(){return Q},get deps(){return K}};return B}function t3($,Z,Y={}){let{immediate:J=!1,deep:G=!1,flush:X="pre",once:Q=!1}=Y,K,q=!0,_=!1,j=()=>{if(S4($))return G?h4($.value):$.value;return $()},B=()=>{if(!q||_)return;let U=j();if(K!==void 0&&Object.is(K,U)&&!G)return;let H=()=>{if(Z(U,K),K=G?h4(U):U,Q)z()};if(X==="sync")H();else if(X==="post")queueMicrotask(H);else Promise.resolve().then(H)},W=null;if(S4($))W=$.subscribe(()=>B());else W=M5($).subscribe(()=>B());if(J)K=void 0,B();else K=j();let z=()=>{if(q=!1,W)W(),W=null};return z.pause=()=>{_=!0},z.resume=()=>{_=!1},z}function e3($,Z,Y={}){let{immediate:J=!1,once:G=!1}=Y,X=$.map((B)=>S4(B)?B.value:void 0),Q=!0,K=!1,q=()=>{if(!Q||K)return;let B=$.map((W)=>S4(W)?W.value:void 0);if(Z(B,X),X=[...B],G)j()},_=$.map((B)=>{if(S4(B))return B.subscribe(()=>q());return()=>{}});if(J)q();let j=()=>{Q=!1,_.forEach((B)=>B())};return j.pause=()=>{K=!0},j.resume=()=>{K=!1},j}function $1($,Z={}){let{flush:Y="pre"}=Z,J,G=!0,X=!1,Q=()=>{if(!G||X)return;if(J)J();let q=V4;V4=Q,R7.push(Q);try{J=$()}finally{R7.pop(),V4=q}};if(Y==="sync")Q();else if(Y==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let K=()=>{if(G=!1,J)J()};return K.pause=()=>{X=!0},K.resume=()=>{X=!1},K}function Z1($,Z={},Y){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(G,X,Q)=>{try{let q=Function(...Object.keys(Z),`return ${Q}`)(...Object.values(Z));return Z[X]=q,`<!-- computed: ${X} = ${q} -->`}catch(K){return`<!-- computed error: ${X} - ${K} -->`}})}function Y1($,Z={},Y){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(G,X,Q)=>{return`
7610
8402
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
7611
8403
  (function() {
7612
8404
  // Watch implementation for ${X}
@@ -7618,11 +8410,11 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7618
8410
  }
7619
8411
  })();
7620
8412
  </script>
7621
- `})}function g4($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>g4(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,G)=>Y.set(g4(G),g4(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(g4(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=g4($[Y]);return Z}function Z1($,Z=100){let Y=J5($()),J=null,G=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return T5($).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}function Y1($,Z=100){let Y=J5($()),J=0,G=()=>{let Q=Date.now();if(Q-J>=Z)J=Q,Y.value=$()};return T5($).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}var V4=null,F7,M5,AG;var X1=I(()=>{F7=[],M5=new WeakMap;AG={ref:J5,computed:T5,watch:r3,watchMultiple:a3,watchEffect:t3,isRef:k4,unref:n3,toRefs:s3,shallowRef:o3,debouncedComputed:Z1,throttledComputed:Y1,processComputedDirectives:e3,processWatchDirectives:$1}});var q1={};o(q1,{v:()=>NG,processHasErrorsDirective:()=>K1,processFormValidationDirectives:()=>MG,processErrorsDirective:()=>Q1,processErrorDirective:()=>G1,defineForm:()=>VG,Validator:()=>X5});class X5{rules=[];defaultValue="";addRule($){let Z=new X5;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:(G)=>{if(!G)return!0;let X=String(G).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:(G)=>{if(!G&&G!==0)return!0;let X=Number(G);return X>=$&&X<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,G)=>{if(!G)return!0;return J===G[$]||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:(G)=>{if(!G)return!0;return new Date(String(G))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(G)=>{if(!G)return!0;return new Date(String(G))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new X5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(G,X)=>{if(!$(G,X||{}))return!0;return J.validate(G,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new X5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let G=await J.validate($,Z);if(G!==!0)Y.push(G)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let G=J.validate($,Z);if(G!==!0)Y.push(G)}return Y}}function VG($,Z){let Y=Object.keys($),J={},G={},X={},Q={},K={};for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),G[L]=[],X[L]=!1,Q[L]=!1,K[L]=!1;let q=!1;async function _(L){K[L]=!0;let R=await $[L].validate(J[L],J);return G[L]=R,K[L]=!1,R.length===0}async function j(){q=!0;let L=await Promise.all(Y.map(_));return q=!1,L.every(Boolean)}function B(){for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),G[L]=[],X[L]=!1,Q[L]=!1}function U(L){for(let R of Y)if(R in L)J[R]=L[R],Q[R]=!0}function z(L,R){J[L]=R,Q[L]=!0}function W(L,R=!0){if(X[L]=R,R)_(L)}function H(L){return{value:J[L],errors:G[L],touched:X[L],dirty:Q[L],valid:G[L].length===0,validating:K[L]}}function O(L){return async(R)=>{R?.preventDefault?.();for(let V of Y)X[V]=!0;if(await j())await L(J)}}return{values:J,errors:G,touched:X,dirty:Q,get isValid(){return Y.every((L)=>G[L].length===0)},get isValidating(){return q||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>Q[L])},validate:j,validateField:_,reset:B,setValues:U,setFieldValue:z,setFieldTouched:W,getFieldState:H,handleSubmit:O}}function G1($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=Z;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,j)}).join(`
7622
- `)}catch{return""}})}function Q1($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=Z;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>Q.replace(/\{\{\s*message\s*\}\}/g,j)).join(`
7623
- `)}catch{return""}})}function K1($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=Z;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return Q}catch{return""}})}function MG($,Z,Y){let J=$;return J=G1(J,Z,Y),J=Q1(J,Z,Y),J=K1(J,Z,Y),J}var NG;var _1=I(()=>{NG=new X5});var J6={};o(J6,{useTitle:()=>SG,useSeoMeta:()=>j1,usePageTitle:()=>SG,useHead:()=>w5,resetHead:()=>DG,renderHtmlAttrs:()=>PG,renderHead:()=>bG,renderBodyAttrs:()=>yG,processTitleDirective:()=>xG,processMetaDirective:()=>fG,processHeadDirective:()=>vG,getPageMeta:()=>IG,getHead:()=>wG,definePageMeta:()=>kG,applyHead:()=>CG});function wG(){return S4}function IG(){return R7}function DG(){S4={},TG.length=0,R7={}}function w5($){S4=EG(S4,$)}function EG($,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 j1($){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 G=$.twitterTitle??$.title,X=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(G)Z.push({name:"twitter:title",content:G});if(X)Z.push({name:"twitter:description",content:X});if(Q)Z.push({name:"twitter:image",content:Q});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});w5({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function kG($){if(R7={...R7,...$},$.title||$.description)j1({title:$.title,description:$.description})}function SG($){let Z=typeof $==="function"?$():$;w5({title:Z})}function bG($=S4){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${h4(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,G])=>`${J}="${h4(G)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>{return`${G==="httpEquiv"?"http-equiv":G}="${h4(String(X))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>`${G}="${h4(String(X))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...G}=Y,X=Object.entries(G).filter(([Q,K])=>K!==void 0).map(([Q,K])=>{if(typeof K==="boolean")return K?Q:"";return`${Q}="${h4(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(`
7624
- `)}function PG($=S4){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${h4(Y)}"`).join(" ")}function yG($=S4){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${h4(Y)}"`).join(" ")}function h4($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function CG($=S4){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[G,X]of Object.entries(Z))if(X!==void 0)J.setAttribute(G,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 vG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,G)=>{return Z+=G.trim()+`
7625
- `,""}),headContent:Z.trim()}}function xG($,Z){return $.replace(/@title\s*\(\s*(['"`]?)([^)]+)\1\s*\)/g,(Y,J,G)=>{let X=J?G:Z[G.trim()]??G;return w5({title:X}),""})}function fG($,Z){return $.replace(/@meta\s*\(\s*(['"`])([^'"]+)\1\s*,\s*(['"`]?)([^)]+)\3\s*\)/g,(Y,J,G,X,Q)=>{let K=X?Q:Z[Q.trim()]??Q,_=G.includes(":")?{property:G,content:K}:{name:G,content:K};return w5({meta:[_]}),""})}var S4,TG,R7;var X6=I(()=>{S4={},TG=[],R7={}});var W1={};o(W1,{processXElementDirectives:()=>gG,hasXElementDirectives:()=>U1,generateXElementRuntime:()=>B1});function B1(){return`<script>
8413
+ `})}function h4($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>h4(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((J,G)=>Y.set(h4(G),h4(J))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((J)=>Y.add(h4(J))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=h4($[Y]);return Z}function J1($,Z=100){let Y=J5($()),J=null,G=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Y.value=$()},Z)};return M5($).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}function X1($,Z=100){let Y=J5($()),J=0,G=()=>{let Q=Date.now();if(Q-J>=Z)J=Q,Y.value=$()};return M5($).subscribe(()=>G()),{get value(){return Y.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){G()},get dirty(){return!1},get deps(){return new Set}}}var V4=null,R7,V5,IG;var Q1=w(()=>{R7=[],V5=new WeakMap;IG={ref:J5,computed:M5,watch:t3,watchMultiple:e3,watchEffect:$1,isRef:S4,unref:o3,toRefs:r3,shallowRef:a3,debouncedComputed:J1,throttledComputed:X1,processComputedDirectives:Z1,processWatchDirectives:Y1}});var j1={};o(j1,{v:()=>wG,processHasErrorsDirective:()=>_1,processFormValidationDirectives:()=>EG,processErrorsDirective:()=>q1,processErrorDirective:()=>K1,defineForm:()=>DG,Validator:()=>X5});class X5{rules=[];defaultValue="";addRule($){let Z=new X5;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:(G)=>{if(!G)return!0;let X=String(G).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:(G)=>{if(!G&&G!==0)return!0;let X=Number(G);return X>=$&&X<=Z||J}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(J,G)=>{if(!G)return!0;return J===G[$]||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:(G)=>{if(!G)return!0;return new Date(String(G))<Y||J}})}after($,Z){let Y=new Date($),J=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(G)=>{if(!G)return!0;return new Date(String(G))>Y||J}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new X5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let J of Z.getRules())Y.rules.push({...J,validate:(G,X)=>{if(!$(G,X||{}))return!0;return J.validate(G,X)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new X5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let J of this.rules){let G=await J.validate($,Z);if(G!==!0)Y.push(G)}return Y}validateSync($,Z){let Y=[];for(let J of this.rules){if(J.async)continue;let G=J.validate($,Z);if(G!==!0)Y.push(G)}return Y}}function DG($,Z){let Y=Object.keys($),J={},G={},X={},Q={},K={};for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),G[L]=[],X[L]=!1,Q[L]=!1,K[L]=!1;let q=!1;async function _(L){K[L]=!0;let A=await $[L].validate(J[L],J);return G[L]=A,K[L]=!1,A.length===0}async function j(){q=!0;let L=await Promise.all(Y.map(_));return q=!1,L.every(Boolean)}function B(){for(let L of Y)J[L]=Z?.[L]??$[L].getDefaultValue(),G[L]=[],X[L]=!1,Q[L]=!1}function W(L){for(let A of Y)if(A in L)J[A]=L[A],Q[A]=!0}function z(L,A){J[L]=A,Q[L]=!0}function U(L,A=!0){if(X[L]=A,A)_(L)}function H(L){return{value:J[L],errors:G[L],touched:X[L],dirty:Q[L],valid:G[L].length===0,validating:K[L]}}function O(L){return async(A)=>{A?.preventDefault?.();for(let V of Y)X[V]=!0;if(await j())await L(J)}}return{values:J,errors:G,touched:X,dirty:Q,get isValid(){return Y.every((L)=>G[L].length===0)},get isValidating(){return q||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>Q[L])},validate:j,validateField:_,reset:B,setValues:W,setFieldValue:z,setFieldTouched:U,getFieldState:H,handleSubmit:O}}function K1($,Z,Y){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=Z;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,j)}).join(`
8414
+ `)}catch{return""}})}function q1($,Z,Y){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=Z;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return _.map((j)=>Q.replace(/\{\{\s*message\s*\}\}/g,j)).join(`
8415
+ `)}catch{return""}})}function _1($,Z,Y){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(G,X,Q)=>{try{let K=X.trim().split("."),q=Z;for(let j of K)if(q&&typeof q==="object"&&j in q)q=q[j];else return"";let _=q;if(!_||!Array.isArray(_)||_.length===0)return"";return Q}catch{return""}})}function EG($,Z,Y){let J=$;return J=K1(J,Z,Y),J=q1(J,Z,Y),J=_1(J,Z,Y),J}var wG;var B1=w(()=>{wG=new X5});var X6={};o(X6,{useTitle:()=>xG,useSeoMeta:()=>W1,usePageTitle:()=>xG,useHead:()=>T5,resetHead:()=>PG,renderHtmlAttrs:()=>fG,renderHead:()=>vG,renderBodyAttrs:()=>gG,processTitleDirective:()=>mG,processMetaDirective:()=>uG,processHeadDirective:()=>dG,getPageMeta:()=>bG,getHead:()=>SG,definePageMeta:()=>CG,applyHead:()=>hG});function SG(){return b4}function bG(){return N7}function PG(){b4={},kG.length=0,N7={}}function T5($){b4=yG(b4,$)}function yG($,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 W1($){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 G=$.twitterTitle??$.title,X=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(G)Z.push({name:"twitter:title",content:G});if(X)Z.push({name:"twitter:description",content:X});if(Q)Z.push({name:"twitter:image",content:Q});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});T5({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function CG($){if(N7={...N7,...$},$.title||$.description)W1({title:$.title,description:$.description})}function xG($){let Z=typeof $==="function"?$():$;T5({title:Z})}function vG($=b4){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${d4(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([J,G])=>`${J}="${d4(G)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>{return`${G==="httpEquiv"?"http-equiv":G}="${d4(String(X))}"`}).join(" ");Z.push(`<meta ${J}>`)}for(let Y of $.link||[]){let J=Object.entries(Y).filter(([G,X])=>X!==void 0).map(([G,X])=>`${G}="${d4(String(X))}"`).join(" ");Z.push(`<link ${J}>`)}for(let Y of $.script||[]){let{content:J,...G}=Y,X=Object.entries(G).filter(([Q,K])=>K!==void 0).map(([Q,K])=>{if(typeof K==="boolean")return K?Q:"";return`${Q}="${d4(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(`
8416
+ `)}function fG($=b4){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${d4(Y)}"`).join(" ")}function gG($=b4){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${d4(Y)}"`).join(" ")}function d4($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function hG($=b4){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[G,X]of Object.entries(Z))if(X!==void 0)J.setAttribute(G,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 dG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,G)=>{return Z+=G.trim()+`
8417
+ `,""}),headContent:Z.trim()}}function mG($,Z){return $.replace(/@title\s*\(\s*(['"`]?)([^)]+)\1\s*\)/g,(Y,J,G)=>{let X=J?G:Z[G.trim()]??G;return T5({title:X}),""})}function uG($,Z){return $.replace(/@meta\s*\(\s*(['"`])([^'"]+)\1\s*,\s*(['"`]?)([^)]+)\3\s*\)/g,(Y,J,G,X,Q)=>{let K=X?Q:Z[Q.trim()]??Q,_=G.includes(":")?{property:G,content:K}:{name:G,content:K};return T5({meta:[_]}),""})}var b4,kG,N7;var G6=w(()=>{b4={},kG=[],N7={}});var H1={};o(H1,{processXElementDirectives:()=>pG,hasXElementDirectives:()=>z1,generateXElementRuntime:()=>U1});function U1(){return`<script>
7626
8418
  (function() {
7627
8419
  'use strict';
7628
8420
 
@@ -7709,11 +8501,23 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7709
8501
  this.watchExpression(expr, update);
7710
8502
  });
7711
8503
 
7712
- // Process @event (event handling)
8504
+ // Process x-show (toggle visibility)
8505
+ const shows = el.querySelectorAll('[x-show]');
8506
+ shows.forEach(elem => {
8507
+ const expr = elem.getAttribute('x-show');
8508
+ const update = () => {
8509
+ elem.style.display = this.evaluate(expr) ? '' : 'none';
8510
+ };
8511
+ update();
8512
+ this.watchExpression(expr, update);
8513
+ });
8514
+
8515
+ // Process @event and :bind attributes
7713
8516
  const allElements = el.querySelectorAll('*');
7714
8517
  allElements.forEach(elem => {
7715
8518
  Array.from(elem.attributes).forEach(attr => {
7716
8519
  if (attr.name.startsWith('@')) {
8520
+ // Event handling
7717
8521
  const eventName = attr.name.slice(1);
7718
8522
  const expr = attr.value;
7719
8523
 
@@ -7737,6 +8541,35 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7737
8541
 
7738
8542
  this.execute(expr, { $event: e, $el: elem });
7739
8543
  });
8544
+ } else if (attr.name.startsWith(':')) {
8545
+ // Attribute binding (:disabled, :class, :href, :src, etc.)
8546
+ const bindAttr = attr.name.slice(1);
8547
+ const expr = attr.value;
8548
+
8549
+ const update = () => {
8550
+ const val = this.evaluate(expr);
8551
+ if (bindAttr === 'class') {
8552
+ // :class supports object syntax { className: bool }
8553
+ if (val && typeof val === 'object') {
8554
+ for (const [cls, active] of Object.entries(val)) {
8555
+ elem.classList.toggle(cls, !!active);
8556
+ }
8557
+ } else if (typeof val === 'string') {
8558
+ elem.className = val;
8559
+ }
8560
+ } else if (typeof val === 'boolean') {
8561
+ // Boolean attributes (disabled, hidden, readonly, etc.)
8562
+ if (val) {
8563
+ elem.setAttribute(bindAttr, '');
8564
+ } else {
8565
+ elem.removeAttribute(bindAttr);
8566
+ }
8567
+ } else {
8568
+ elem.setAttribute(bindAttr, val != null ? String(val) : '');
8569
+ }
8570
+ };
8571
+ update();
8572
+ this.watchExpression(expr, update);
7740
8573
  }
7741
8574
  });
7742
8575
  });
@@ -7807,91 +8640,70 @@ ${E4(Q,{...J,start:0,end:J.end-J.start},G)}
7807
8640
  // Expose for manual initialization
7808
8641
  window.XElement = XElement;
7809
8642
  })();
7810
- </script>`}function U1($){return/\bx-(data|model|text)\b/.test($)}function gG($){if(!U1($))return $;let Z=B1();if($.includes("</body>"))return $.replace("</body>",`${Z}
8643
+ </script>`}function z1($){return/\bx-(data|model|text|show)\b/.test($)||/\s:[a-z]/.test($)}function pG($){if(!z1($))return $;let Z=U1();if($.includes("</body>"))return $.replace("</body>",`${Z}
7811
8644
  </body>`);return $+`
7812
- `+Z}var R1={};o(R1,{processOnceDirective:()=>F1,processJsonDirective:()=>L1,processDirectives:()=>x5});import J4 from"path";function hG($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bstate\s*\(/,/\bderived\s*\(/,/\beffect\s*\(/,/data-stx(?:-auto)?(?![-\w])/].some((Y)=>Y.test($))}function dG($){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)\s*\(/.test(J))return!0}return!1}function mG($){let Z=$,Y=/@if\s*\(/g,J,G=[];while((J=Y.exec(Z))!==null){let X=J.index,Q=X+J[0].length,K=1,q=Q;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.substring(Q,q-1).trim(),j=q,B=1,U=j,z=/@(if\s*\(|endif)/g;z.lastIndex=j;let W;while((W=z.exec(Z))!==null)if(W[1].startsWith("if"))B++;else if(W[1]==="endif"){if(B--,B===0){U=W.index+W[0].length;break}}if(B!==0)continue;let H=Z.substring(j,U-6).trim(),O=H.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),F;if(O){let[,L,R,M]=O;F=`<${L}${R} @if="${_}">${M}</${L}>`}else F=`<template @if="${_}">${H}</template>`;G.push({start:X,end:U,replacement:F})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];Z=Z.substring(0,Q)+q+Z.substring(K)}return Z}function uG($){let Z=$,Y=/@(for|foreach)\s*\(/g,J,G=[];while((J=Y.exec(Z))!==null){let X=J[1],Q=J.index,K=Q+J[0].length,q=1,_=K;while(_<Z.length&&q>0){if(Z[_]==="(")q++;else if(Z[_]===")")q--;_++}if(q!==0)continue;let j=Z.substring(K,_-1).trim(),B=_,U=X==="for"?"@endfor":"@endforeach",z=1,W=B,H=new RegExp(`@(${X}\\s*\\(|end${X})`,"g");H.lastIndex=B;let O;while((O=H.exec(Z))!==null)if(O[1].startsWith(X))z++;else if(z--,z===0){W=O.index+O[0].length;break}if(z!==0)continue;let F=Z.substring(B,W-U.length).trim(),L=F.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),R;if(L){let[,M,V,A]=L;R=`<${M}${V} @for="${j}">${A}</${M}>`}else R=`<template @for="${j}">${F}</template>`;G.push({start:Q,end:W,replacement:R})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];Z=Z.substring(0,Q)+q+Z.substring(K)}return Z}function pG($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,Y,J=null;while((Y=Z.exec($))!==null){let q=Y[1],_=Y[2];if(n4(q))_=s4(_);if(/\b(state|derived|effect)\s*\(/.test(_)){J={fullMatch:Y[0],attrs:q,content:_};break}}if(!J)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}`,X=w4(J.content),Q=`
7813
- <script>
8645
+ `+Z}var V1={};o(V1,{validateClientScript:()=>N1,processOnceDirective:()=>R1,processJsonDirective:()=>A1,processDirectives:()=>v5});import G4 from"path";function cG($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bstate\s*\(/,/\bderived\s*\(/,/\beffect\s*\(/,/data-stx(?:-auto)?(?![-\w])/].some((Y)=>Y.test($))}function lG($){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)\s*\(/.test(J))return!0}return!1}function iG($){let Z=$,Y=/@if\s*\(/g,J,G=[];while((J=Y.exec(Z))!==null){let X=J.index,Q=X+J[0].length,K=1,q=Q;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let _=Z.substring(Q,q-1).trim(),j=q,B=1,W=j,z=/@(if\s*\(|endif)/g;z.lastIndex=j;let U;while((U=z.exec(Z))!==null)if(U[1].startsWith("if"))B++;else if(U[1]==="endif"){if(B--,B===0){W=U.index+U[0].length;break}}if(B!==0)continue;let H=Z.substring(j,W-6).trim(),O=H.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),F;if(O){let[,L,A,M]=O;F=`<${L}${A} @if="${_}">${M}</${L}>`}else F=`<template @if="${_}">${H}</template>`;G.push({start:X,end:W,replacement:F})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];Z=Z.substring(0,Q)+q+Z.substring(K)}return Z}function nG($){let Z=$,Y=/@(for|foreach)\s*\(/g,J,G=[];while((J=Y.exec(Z))!==null){let X=J[1],Q=J.index,K=Q+J[0].length,q=1,_=K;while(_<Z.length&&q>0){if(Z[_]==="(")q++;else if(Z[_]===")")q--;_++}if(q!==0)continue;let j=Z.substring(K,_-1).trim(),B=_,W=X==="for"?"@endfor":"@endforeach",z=1,U=B,H=new RegExp(`@(${X}\\s*\\(|end${X})`,"g");H.lastIndex=B;let O;while((O=H.exec(Z))!==null)if(O[1].startsWith(X))z++;else if(z--,z===0){U=O.index+O[0].length;break}if(z!==0)continue;let F=Z.substring(B,U-W.length).trim(),L=F.match(/^<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>([\s\S]*)<\/\1>$/s),A;if(L){let[,M,V,R]=L;A=`<${M}${V} @for="${j}">${R}</${M}>`}else A=`<template @for="${j}">${F}</template>`;G.push({start:Q,end:U,replacement:A})}for(let X=G.length-1;X>=0;X--){let{start:Q,end:K,replacement:q}=G[X];Z=Z.substring(0,Q)+q+Z.substring(K)}return Z}function sG($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,Y,J=null;while((Y=Z.exec($))!==null){let q=Y[1],_=Y[2];if(n4(q))_=w4(_);if(/\b(state|derived|effect)\s*\(/.test(_)){J={fullMatch:Y[0],attrs:q,content:_};break}}if(!J)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}`,X=I4(J.content),Q=`
8646
+ <script data-stx-scoped>
7814
8647
  function ${G}() {
7815
8648
  const { state, derived, effect, batch, onMount, onDestroy } = window.stx;
7816
8649
  ${X}
7817
- return { ${cG(X)} };
8650
+ return { ${oG(X)} };
7818
8651
  }
7819
- </script>`,K=$.replace(J.fullMatch,"");if(K.includes("<body"))K=K.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let q=["script","style","html","head","meta","link","title","!doctype"];K=K.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(_,j,B)=>{if(q.includes(j.toLowerCase()))return _;return`<${j}${B} data-stx="${G}">`})}return{output:K,setupCode:Q}}function cG($){let Z=$,Y=[],J=new Set,G=0,X=0,Q=Z.length,K=(B)=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if(Z[X]==="{")B++;else if(Z[X]==="}")B--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<Q&&Z[X]!==`
7820
- `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<Q-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let W=B[2];if(!J.has(W))Y.push(W),J.add(W);return}let U=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let W=U[1];if(!J.has(W))Y.push(W),J.add(W);return}let z=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let W=z[1];if(!J.has(W))Y.push(W),J.add(W)}};while(X<Q){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){G++,X++;continue}if(Z[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))j();X++}return Y.join(", ")}function lG($){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]+`
8652
+ </script>`,K=$.replace(J.fullMatch,"");if(K.includes("<body"))K=K.replace(/<body([^>]*)>/,`<body$1 data-stx="${G}">`);else{let q=["script","style","html","head","meta","link","title","!doctype"];K=K.replace(/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*)>/i,(_,j,B)=>{if(q.includes(j.toLowerCase()))return _;return`<${j}${B} data-stx="${G}">`})}return{output:K,setupCode:Q}}function oG($){let Z=$,Y=[],J=new Set,G=0,X=0,Q=Z.length,K=(B)=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]===B){X++;return}X++}},q=()=>{X++;while(X<Q){if(Z[X]==="\\"){X+=2;continue}if(Z[X]==="`"){X++;return}if(Z[X]==="$"&&Z[X+1]==="{"){X+=2;let B=1;while(X<Q&&B>0)if(Z[X]==="{")B++;else if(Z[X]==="}")B--;else if(Z[X]==="'"||Z[X]==='"')K(Z[X]);else if(Z[X]==="`")q();else X++;continue}X++}},_=()=>{if(Z[X]==="/"&&Z[X+1]==="/"){while(X<Q&&Z[X]!==`
8653
+ `)X++;return!0}if(Z[X]==="/"&&Z[X+1]==="*"){X+=2;while(X<Q-1&&!(Z[X]==="*"&&Z[X+1]==="/"))X++;return X+=2,!0}return!1},j=()=>{if(G!==0)return;let B=Z.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let U=B[2];if(!J.has(U))Y.push(U),J.add(U);return}let W=Z.slice(X).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(W){let U=W[1];if(!J.has(U))Y.push(U),J.add(U);return}let z=Z.slice(X).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let U=z[1];if(!J.has(U))Y.push(U),J.add(U)}};while(X<Q){if(_())continue;if(Z[X]==="'"||Z[X]==='"'){K(Z[X]);continue}if(Z[X]==="`"){q();continue}if(Z[X]==="{"){G++,X++;continue}if(Z[X]==="}"){G--,X++;continue}if(G===0&&/[a-z]/i.test(Z[X])&&(X===0||/\s|[;{}()]/.test(Z[X-1])))j();X++}return Y.join(", ")}function rG($){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]+`
7821
8654
  `;let G=/\{\{([\s\S]*?)\}\}/g;while((J=G.exec($))!==null)Y+=J[1]+`
7822
- `;if(!Y.trim())return $;let Q=["auth","useAuth","formatAreaSize","formatDistance","formatElevation","formatDuration","getRelativeTime","fetchData","browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((j)=>{return new RegExp(`\\b${j}\\b`).test(Y)}),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g.test(Y);if(!Q&&!q)return $;let _=`<script type="module">
8655
+ `;if(!Y.trim())return $;let Q=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((W)=>{return new RegExp(`\\b${W}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,_,j=!1;while((_=q.exec(Y))!==null)if(!K.has(_[1])){j=!0;break}if(!Q&&!j)return $;let B=`<script type="module">
7823
8656
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
7824
8657
  import '@stacksjs/browser'
7825
- </script>`;if($.includes("</head>")){let j=$.indexOf("</head>"),U=$.slice(0,j).indexOf("<script");if(U!==-1)return $.slice(0,U)+_+`
7826
- `+$.slice(U);return $.replace("</head>",`${_}
8658
+ </script>`;if($.includes("</head>")){let W=$.indexOf("</head>"),U=$.slice(0,W).indexOf("<script");if(U!==-1)return $.slice(0,U)+B+`
8659
+ `+$.slice(U);return $.replace("</head>",`${B}
7827
8660
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
7828
- ${_}`);return _+`
7829
- `+$}function iG($,Z){if($.includes("window.stx =")||$.includes("window.stx=")||$.includes("window.stx.state"))return $;let G=`<script data-stx-scoped>${(Z.debug?$6():Y3()).replace(/\$/g,"$$$$")}</script>`;if($.includes("</head>")){let X=$.indexOf("</head>"),K=$.slice(0,X).indexOf("<script");if(K!==-1)return $.slice(0,K)+G+`
8661
+ ${B}`);return B+`
8662
+ `+$}function aG($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;let G=`<script data-stx-scoped>${(Z.debug?Z6():X3()).replace(/\$/g,"$$$$")}</script>`;if($.includes("</head>")){let X=$.indexOf("</head>"),K=$.slice(0,X).indexOf("<script");if(K!==-1)return $.slice(0,K)+G+`
7830
8663
  `+$.slice(K);return $.replace("</head>",`${G}
7831
8664
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
7832
8665
  ${G}`);return G+`
7833
- `+$}function nG($,Z){if(!hG($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:J,setupCode:G}=pG(Y);if(Y=J,Y=iG(Y,Z),Y=lG(Y),G)if(Y.includes("</head>"))Y=Y.replace("</head>",`${G}
8666
+ `+$}function tG($,Z){if(!cG($))return $;let Y=$;if(Z.skipSignalsRuntime)return Y;let{output:J,setupCode:G}=sG(Y);if(Y=J,Y=aG(Y,Z),Y=rG(Y),G)if(Y.includes("</head>"))Y=Y.replace("</head>",`${G}
7834
8667
  </head>`);else if(Y.includes("<body"))Y=Y.replace(/<body([^>]*)>/,`<body$1>
7835
8668
  ${G}`);else Y=Y+`
7836
- `+G;let X=Y.match(/<body([^>]*)>/i),Q=X&&/data-stx/.test(X[1]);if(!G&&!Q){if(Y.includes("<body")&&X&&!/data-stx-auto/.test(X[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}function sG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function oG($,Z,Y){let J=[],G=0;while(G<$.length){let X=$.indexOf("<",G);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){G=X+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=X+1+q.length;while(H<$.length&&$[H]!==">")H++;G=H+1;continue}let _=X+1+q.length,j=null,B=_,U=-1,z=!1;while(_<$.length){let H=$[_];if(j){if(H==="\\"&&_+1<$.length){_+=2;continue}if(H===j)j=null;_++;continue}if(H==='"'||H==="'"){j=H,_++;continue}if(H==="/"&&_+1<$.length&&$[_+1]===">"){U=_+2,z=!0;break}if(H===">"){U=_+1;break}_++}if(U===-1){G=X+1;continue}let W=$.slice(B,z?U-2:U-1).trim();if(z)J.push({fullMatch:$.slice(X,U),tagName:q,attributes:W,content:"",startIndex:X,endIndex:U,isSelfClosing:!0}),G=U;else{let H=`</${q}>`,O=$.indexOf(H,U);if(O===-1){G=U;continue}let F=$.slice(U,O),L=O+H.length;J.push({fullMatch:$.slice(X,L),tagName:q,attributes:W,content:F,startIndex:X,endIndex:L,isSelfClosing:!1}),G=L}}return J}function rG($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let G="";while(Y<J&&!/[\s=]/.test($[Y]))G+=$[Y],Y++;if(!G)break;if(G.startsWith("@")){while(Y<J&&$[Y]!=='"'&&$[Y]!=="'")Y++;if(Y<J){let X=$[Y];Y++;while(Y<J&&$[Y]!==X){if($[Y]==="\\")Y++;Y++}Y++}continue}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 Q=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,X+=$[Y],Y++;continue}if(K===Q){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))X+=$[Y],Y++;Z[G]=X}else Z[G]="true"}return Z}async function x5($,Z,Y,J,G){let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await M$.timeAsync("template-processing",async()=>{let Q=await aG($,Z,Y,J,G);if(X)Q=await b6(Q);return Q})}catch(Q){if(Q instanceof L5)throw Q;let K=Q instanceof Error?Q.message:String(Q),q=new v4(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(e4.log(q,{filePath:Y,context:Z}),b0.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return k0.createFallbackContent("Template Processing",q)}}async function aG($,Z,Y,J,G){let X=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!J4.isAbsolute(J.partialsDir)?J4.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!J4.isAbsolute(J.componentsDir)?J4.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!J4.isAbsolute(J.layoutsDir)?J4.resolve(X,J.layoutsDir):J.layoutsDir},K=Q,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,""),q=q.replace(/@@/g,"@"),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(z,W)=>{return`{{ ${W} }}`}),q=G3(q),q=await GQ(q,Y,G);let _={};q=a0(q,_);let j={...Z.__sections||{}},B="",U=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(U)B=U[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/,"");if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)([\s\S]*?)(?:@endsection|@show)/g,(z,W,H,O)=>{if(H)return j[W]=H,"";if(O.includes("@parent"))j[W]=O.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else j[W]=O.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(z,W,H)=>{return j[W]||H||""}),q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),q=t0(q,_),B)try{if(Q.debug)console.log(`Processing layout: ${B} for file ${Y}`);let z=await t4(()=>p7(B,Y,Q,G),null,()=>{throw new v4(`Failed to resolve layout path: ${B}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!z){let L=`Layout not found: ${B} (referenced from ${Y})`;if(e4.log(Error(L),{layoutPath:B,filePath:Y},"warning"),Q.debug)throw new v4(L,Y);return q}let W=await t4(()=>Bun.file(z).text(),"",()=>{throw new v4(`Failed to read layout file: ${z}`,Y,void 0,void 0,"Layout content could not be loaded")}),H=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(Q.debug)console.log(`Found nested layout: ${H[1]} in ${z}`);let L={},R=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,N,T)=>{return L[N]=T.trim(),""});for(let[A,N]of Object.entries(L))if(j[A]&&j[A].includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))j[A]=j[A].replace("<!--PARENT_CONTENT_PLACEHOLDER-->",N);else if(!j[A])j[A]=N;let M={...Z,__sections:j},V=`@layout('${H[1]}')${R}`;return await x5(V,M,z,Q,G)}let O=a0(W,_),F={};return O=O.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(L,R,M)=>{return F[R]=M.trim(),`@slot('${R}')`}),O=O.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(L,R,M)=>{if(j[R]){let V=j[R];if(V.includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))V=V.replace("<!--PARENT_CONTENT_PLACEHOLDER-->",F[R]||"");return V}return M||""}),O=O.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),O=t0(O,_),q=await z1(O,Z,z,Q,G),q}catch(z){return e4.log(z instanceof Error?z:Error(String(z)),{layoutPath:B,filePath:Y},"error"),`[Error processing layout: ${z instanceof Error?z.message:String(z)}]`}return await z1(q,Z,Y,Q,G)}async function tG($,Z,Y,J){let G=$;return G=G.replace(/<stx-loading-indicator([^>]*?)(?:\s*\/>|><\/stx-loading-indicator>)/gi,(X,Q)=>{let K=Q.match(/color=["']([^"']+)["']/i),q=Q.match(/initial-color=["']([^"']+)["']/i),_=Q.match(/height=["']([^"']+)["']/i),j=Q.match(/duration=["']([^"']+)["']/i),B=Q.match(/throttle=["']([^"']+)["']/i),U=Q.match(/z-index=["']([^"']+)["']/i),z={color:K?.[1]||"#6366f1",initialColor:q?.[1]||"",height:_?.[1]||"3px",duration:j?Number.parseInt(j[1]):2000,throttle:B?Number.parseInt(B[1]):200,zIndex:U?Number.parseInt(U[1]):999999},W=z.initialColor?`linear-gradient(to right, ${z.initialColor}, ${z.color})`:z.color;return`
7837
- <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${z.height};background:${W};z-index:${z.zIndex};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
8669
+ `+G;let X=Y.match(/<body([^>]*)>/i),Q=X&&/data-stx/.test(X[1]);if(!G&&!Q){if(Y.includes("<body")&&X&&!/data-stx-auto/.test(X[1]))Y=Y.replace(/<body([^>]*)>/,"<body$1 data-stx-auto>")}return Y}function eG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function $Q($,Z,Y){let J=[],G=0;while(G<$.length){let X=$.indexOf("<",G);if(X===-1)break;let K=$.slice(X+1).match(new RegExp(`^(${Z.source})`));if(!K){G=X+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=X+1+q.length;while(H<$.length&&$[H]!==">")H++;G=H+1;continue}let _=X+1+q.length,j=null,B=_,W=-1,z=!1;while(_<$.length){let H=$[_];if(j){if(H==="\\"&&_+1<$.length){_+=2;continue}if(H===j)j=null;_++;continue}if(H==='"'||H==="'"){j=H,_++;continue}if(H==="/"&&_+1<$.length&&$[_+1]===">"){W=_+2,z=!0;break}if(H===">"){W=_+1;break}_++}if(W===-1){G=X+1;continue}let U=$.slice(B,z?W-2:W-1).trim();if(z)J.push({fullMatch:$.slice(X,W),tagName:q,attributes:U,content:"",startIndex:X,endIndex:W,isSelfClosing:!0}),G=W;else{let H=`</${q}>`,O=$.indexOf(H,W);if(O===-1){G=W;continue}let F=$.slice(W,O),L=O+H.length;J.push({fullMatch:$.slice(X,L),tagName:q,attributes:U,content:F,startIndex:X,endIndex:L,isSelfClosing:!1}),G=L}}return J}function ZQ($){let Z={},Y=0,J=$.length;while(Y<J){while(Y<J&&/\s/.test($[Y]))Y++;if(Y>=J)break;let G="";while(Y<J&&!/[\s=]/.test($[Y]))G+=$[Y],Y++;if(!G)break;if(G.startsWith("@")||G.startsWith(":")){while(Y<J&&$[Y]!=='"'&&$[Y]!=="'")Y++;if(Y<J){let X=$[Y];Y++;while(Y<J&&$[Y]!==X){if($[Y]==="\\")Y++;Y++}Y++}continue}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 Q=$[Y];Y++;while(Y<J){let K=$[Y];if(K==="\\"&&Y+1<J){Y++,X+=$[Y],Y++;continue}if(K===Q){Y++;break}X+=K,Y++}}else while(Y<J&&!/\s/.test($[Y]))X+=$[Y],Y++;Z[G]=X}else Z[G]="true"}return Z}async function v5($,Z,Y,J,G){if(J.ssr===!1)return $;let X=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;try{return await z$.timeAsync("template-processing",async()=>{let Q=await YQ($,Z,Y,J,G);if(X)Q=await P6(Q);return Q})}catch(Q){if(Q instanceof B7)throw Q;let K=Q instanceof Error?Q.message:String(Q),q=new v4(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(e4.log(q,{filePath:Y,context:Z}),P0.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),J.debug)throw q;return S0.createFallbackContent("Template Processing",q)}}async function YQ($,Z,Y,J,G){let X=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!G4.isAbsolute(J.partialsDir)?G4.resolve(X,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!G4.isAbsolute(J.componentsDir)?G4.resolve(X,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!G4.isAbsolute(J.layoutsDir)?G4.resolve(X,J.layoutsDir):J.layoutsDir},K=Q,q=$;q=q.replace(/\{\{--[\s\S]*?--\}\}/g,""),q=q.replace(/@@/g,"@"),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(z,U)=>{return`{{ ${U} }}`}),q=K3(q),q=await _Q(q,Y,G);let _={};q=t0(q,_);let j={...Z.__sections||{}},B="",W=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(W)B=W[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/,"");if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)([\s\S]*?)(?:@endsection|@show)/g,(z,U,H,O)=>{if(H)return j[U]=H,"";if(O.includes("@parent"))j[U]=O.replace("@parent","<!--PARENT_CONTENT_PLACEHOLDER-->");else j[U]=O.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(z,U,H)=>{return j[U]||H||""}),q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),q=e0(q,_),B)try{if(Q.debug)console.log(`Processing layout: ${B} for file ${Y}`);let z=await t4(()=>m7(B,Y,Q,G),null,()=>{throw new v4(`Failed to resolve layout path: ${B}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!z){let A=`Layout not found: ${B} (referenced from ${Y})`;if(e4.log(Error(A),{layoutPath:B,filePath:Y},"warning"),Q.debug)throw new v4(A,Y);return q}let U=await t4(()=>Bun.file(z).text(),"",()=>{throw new v4(`Failed to read layout file: ${z}`,Y,void 0,void 0,"Layout content could not be loaded")}),H=U.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(H){if(Q.debug)console.log(`Found nested layout: ${H[1]} in ${z}`);let A={},M=U.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(N,T,D)=>{return A[T]=D.trim(),""});for(let[N,T]of Object.entries(A))if(j[N]&&j[N].includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))j[N]=j[N].replace("<!--PARENT_CONTENT_PLACEHOLDER-->",T);else if(!j[N])j[N]=T;let V={...Z,__sections:j},R=`@layout('${H[1]}')${M}`;return await v5(R,V,z,Q,G)}let O=U.replace(/\{\{--[\s\S]*?--\}\}/g,""),F=t0(O,_),L={};return F=F.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(A,M,V)=>{return L[M]=V.trim(),`@slot('${M}')`}),F=F.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(A,M,V)=>{if(j[M]){let R=j[M];if(R.includes("<!--PARENT_CONTENT_PLACEHOLDER-->"))R=R.replace("<!--PARENT_CONTENT_PLACEHOLDER-->",L[M]||"");return R}return V||""}),F=F.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),F=e0(F,_),q=await O1(F,Z,z,Q,G),q}catch(z){return e4.log(z instanceof Error?z:Error(String(z)),{layoutPath:B,filePath:Y},"error"),`[Error processing layout: ${z instanceof Error?z.message:String(z)}]`}return await O1(q,Z,Y,Q,G)}async function JQ($,Z,Y,J){let G=$;return G=G.replace(/<stx-loading-indicator([^>]*?)(?:\s*\/>|><\/stx-loading-indicator>)/gi,(X,Q)=>{let K=Q.match(/color=["']([^"']+)["']/i),q=Q.match(/initial-color=["']([^"']+)["']/i),_=Q.match(/height=["']([^"']+)["']/i),j=Q.match(/duration=["']([^"']+)["']/i),B=Q.match(/throttle=["']([^"']+)["']/i),W=Q.match(/z-index=["']([^"']+)["']/i),z={color:K?.[1]||"#6366f1",initialColor:q?.[1]||"",height:_?.[1]||"3px",duration:j?Number.parseInt(j[1]):2000,throttle:B?Number.parseInt(B[1]):200,zIndex:W?Number.parseInt(W[1]):999999},U=z.initialColor?`linear-gradient(to right, ${z.initialColor}, ${z.color})`:z.color;return`
8670
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${z.height};background:${U};z-index:${z.zIndex};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
7838
8671
  <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>
7839
8672
  </div>
7840
8673
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
7841
8674
  <script>
7842
8675
  (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.throttle})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
7843
- </script>`}),G}async function z1($,Z,Y,J,G){let X=$;Z.__stx_sfc_mode=!0;let Q=J;await t4(()=>$3(Y,Z),void 0,(b)=>{if(Q.debug)console.warn(`View composer error for ${Y}:`,b.message)}),Z.__stx_options=Q,X=await t4(()=>sZ(X,Z,Y,Q),X,(b)=>{if(Q.debug)console.warn("Pre-processing middleware error:",b.message)});let K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,q;while((q=K.exec(X))!==null){let b=q[1],x=q[2];if(/\bserver\b/.test(b)&&x.trim())try{let{extractVariables:Q4}=await Promise.resolve().then(() => (W5(),v5));await Q4(x,Z,Y)}catch(Q4){if(Q.debug)console.warn("Script extraction error:",Q4)}}if(X=await uZ(X,Z,Y),X=await pZ(X,Z,Y),X=await eG(X,Z,Y,Q,G),X=await NZ(X,Z,Y,Q),X=await tG(X,Z,Y,Q),X=n0(X,Z,Y,Q),Q.componentsDir)X=await $Q(X,Z,Y,Q.componentsDir,Q,G),X=await ZQ(X,Z,Y,Q.componentsDir,Q,G),X=await K3(X,Z,Y,Q,G);X=a6(X,Z,Y,Q);let{processDeferDirectives:_}=await Promise.resolve().then(() => j3);X=_(X,Z,Y);let{processTeleportDirectives:j}=await Promise.resolve().then(() => U3);X=j(X,Z,Y);let{processTransitionDirectives:B,processTransitionAttributes:U}=await Promise.resolve().then(() => O3);X=B(X,Z,Y),X=U(X);let{processErrorBoundaryDirectives:z}=await Promise.resolve().then(() => F3);X=z(X,Z,Y);let{processSuspenseDirectives:W}=await Promise.resolve().then(() => R3);X=W(X,Z,Y);let{processAsyncDirectives:H}=await Promise.resolve().then(() => M3);X=H(X,Z,Y);let{processKeepAliveDirectives:O}=await Promise.resolve().then(() => w3);X=O(X,Z,Y);let{processVirtualListDirectives:F,processVirtualGridDirectives:L,processInfiniteListDirectives:R}=await Promise.resolve().then(() => (b3(),S3));X=F(X,Z,Y),X=L(X,Z,Y),X=R(X,Z,Y);let{processPartialHydrationDirectives:M,processStaticDirectives:V}=await Promise.resolve().then(() => (i3(),l3));X=M(X,Z,Y),X=V(X);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (X1(),J1));X=A(X,Z,Y),X=N(X,Z,Y);let{processFormValidationDirectives:T}=await Promise.resolve().then(() => (_1(),q1));X=T(X,Z,Y);let{processHeadDirective:D,processTitleDirective:E,processMetaDirective:k,resetHead:w}=await Promise.resolve().then(() => (X6(),J6));w();let S=D(X);if(X=S.content,X=E(X,Z),X=k(X,Z),X=YQ(X),X=tZ(X),X=g0(X,Z),X=RZ(X),X=iZ(X),X=await r0(X,Z,Y,Q,G),dG(X))X=mG(X),X=uG(X);if(X=$5(X,Z,Y),X=h0(X,Z),X=d0(X,Z),X=wZ(X,Z),X=IZ(X,Z),X=await QZ(X,Z,Y,Q),X=await u$(X,Z,Y),X=await yZ(X,Z,Y,Q),X=y6(X,Z,Y,Q),X=o8(X,Z,Y,Q),X=r8(X,Z,Y),X=a8(X,Z,Y,Q),X=OZ(X,Z,Y,Q),X=L1(X,Z),X=F1(X),!Q.skipEventDirectives)X=J$(X,Z,Y);X=j$(X,Z,Y),X=await c4(X,Z,Y),X=d6(X);let{processXElementDirectives:m}=await Promise.resolve().then(() => W1);if(X=m(X),X=nG(X,Q),X=await oZ(X,Z,Y,Q),Q.seo?.enabled)X=t8(X,Z,Q);let{renderHead:c,getHead:P}=await Promise.resolve().then(() => (X6(),J6)),u=P();if(u.title||u.meta?.length||u.link?.length){let b=c();if(b){if(X.includes("</head>"))X=X.replace("</head>",`${b}
8676
+ </script>`}),G}async function O1($,Z,Y,J,G){let X=$;Z.__stx_sfc_mode=!0;let Q=J;await t4(()=>Y3(Y,Z),void 0,(x)=>{if(Q.debug)console.warn(`View composer error for ${Y}:`,x.message)}),Z.__stx_options=Q,X=await t4(()=>rZ(X,Z,Y,Q),X,(x)=>{if(Q.debug)console.warn("Pre-processing middleware error:",x.message)});let K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,q;while((q=K.exec(X))!==null){let x=q[1],r=q[2];if(/\bserver\b/.test(x)&&r.trim())try{let{extractVariables:Y4}=await Promise.resolve().then(() => (B5(),y5));await Y4(r,Z,Y)}catch(Y4){if(Q.debug)console.warn("Script extraction error:",Y4)}}if(X=await cZ(X,Z,Y),X=await lZ(X,Z,Y),X=await XQ(X,Z,Y,Q,G),X=await MZ(X,Z,Y,Q),X=await JQ(X,Z,Y,Q),X=s0(X,Z,Y,Q),Q.componentsDir)X=await GQ(X,Z,Y,Q.componentsDir,Q,G),X=await QQ(X,Z,Y,Q.componentsDir,Q,G),X=await _3(X,Z,Y,Q,G);X=t6(X,Z,Y,Q);let{processDeferDirectives:_}=await Promise.resolve().then(() => W3);X=_(X,Z,Y);let{processTeleportDirectives:j}=await Promise.resolve().then(() => z3);X=j(X,Z,Y);let{processTransitionDirectives:B,processTransitionAttributes:W}=await Promise.resolve().then(() => F3);X=B(X,Z,Y),X=W(X);let{processErrorBoundaryDirectives:z}=await Promise.resolve().then(() => R3);X=z(X,Z,Y);let{processSuspenseDirectives:U}=await Promise.resolve().then(() => N3);X=U(X,Z,Y);let{processAsyncDirectives:H}=await Promise.resolve().then(() => I3);X=H(X,Z,Y);let{processKeepAliveDirectives:O}=await Promise.resolve().then(() => D3);X=O(X,Z,Y);let{processVirtualListDirectives:F,processVirtualGridDirectives:L,processInfiniteListDirectives:A}=await Promise.resolve().then(() => (y3(),P3));X=F(X,Z,Y),X=L(X,Z,Y),X=A(X,Z,Y);let{processPartialHydrationDirectives:M,processStaticDirectives:V}=await Promise.resolve().then(() => (s3(),n3));X=M(X,Z,Y),X=V(X);let{processComputedDirectives:R,processWatchDirectives:N}=await Promise.resolve().then(() => (Q1(),G1));X=R(X,Z,Y),X=N(X,Z,Y);let{processFormValidationDirectives:T}=await Promise.resolve().then(() => (B1(),j1));X=T(X,Z,Y);let{processHeadDirective:D,processTitleDirective:E,processMetaDirective:k,resetHead:I}=await Promise.resolve().then(() => (G6(),X6));I();let S=D(X);if(X=S.content,X=E(X,Z),X=k(X,Z),X=KQ(X),X=$3(X),X=h0(X,Z),X=NZ(X),X=sZ(X),X=await a0(X,Z,Y,Q,G),lG(X))X=iG(X),X=nG(X);if(X=$5(X,Z,Y),X=d0(X,Z),X=m0(X,Z),X=DZ(X,Z),X=EZ(X,Z),X=await qZ(X,Z,Y,Q),X=await c$(X,Z,Y),X=await xZ(X,Z,Y,Q),X=C6(X,Z,Y,Q),X=a8(X,Z,Y,Q),X=t8(X,Z,Y),X=e8(X,Z,Y,Q),X=FZ(X,Z,Y,Q),X=A1(X,Z),X=R1(X),!Q.skipEventDirectives)X=X$(X,Z,Y);X=g$(X,Z,Y),X=await c4(X,Z,Y),X=m6(X);let{processXElementDirectives:d}=await Promise.resolve().then(() => H1);if(X=d(X),X=tG(X,Q),X=await aZ(X,Z,Y,Q),Q.seo?.enabled)X=$Z(X,Z,Q);let{renderHead:c,getHead:b}=await Promise.resolve().then(() => (G6(),X6)),u=b();if(u.title||u.meta?.length||u.link?.length){let x=c();if(x){if(X.includes("</head>"))X=X.replace("</head>",`${x}
7844
8677
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
7845
- ${b}`)}}if(S.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${S.headContent}
8678
+ ${x}`)}}if(S.headContent){if(X.includes("</head>"))X=X.replace("</head>",`${S.headContent}
7846
8679
  </head>`);else if(X.includes("<head>"))X=X.replace("<head>",`<head>
7847
- ${S.headContent}`)}if(Q.csp?.enabled&&Q.csp.addMetaTag)X=HZ(X,Q.csp,Z);if(Q.analytics?.enabled)X=u6(X,Q);if(Q.heatmap?.enabled)X=l6(X,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:b}=await Promise.resolve().then(() => (b5(),w6));X=b(X,Q)}let X4=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),s=/\bSTX\.\w+/.test(X),a=/window\.STX\s*=/.test(X);if(X4&&s&&!a){let x=`<script data-stx-scoped>
7848
- ${x6()}
7849
- </script>`;if(X.includes("</head>")){let $4=X.indexOf("</head>"),F4=X.slice(0,$4).indexOf("<script");if(F4!==-1){let R4=X.slice(0,F4),V7=X.slice(F4);X=R4+x+`
7850
- `+V7}else X=X.replace("</head>",`${x}
8680
+ ${S.headContent}`)}if(Q.csp?.enabled&&Q.csp.addMetaTag)X=LZ(X,Q.csp,Z);if(Q.analytics?.enabled)X=p6(X,Q);if(Q.heatmap?.enabled)X=i6(X,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:x}=await Promise.resolve().then(() => (b5(),w6));X=x(X,Q)}let Q4=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(X),s=/\bSTX\.\w+/.test(X),e=/window\.STX\s*=/.test(X);if(Q4&&s&&!e){let r=`<script data-stx-scoped>
8681
+ ${f6()}
8682
+ </script>`;if(X.includes("</head>")){let a=X.indexOf("</head>"),B4=X.slice(0,a).indexOf("<script");if(B4!==-1){let T7=X.slice(0,B4),I5=X.slice(B4);X=T7+r+`
8683
+ `+I5}else X=X.replace("</head>",`${r}
7851
8684
  </head>`)}else if(X.includes("<body"))X=X.replace(/<body([^>]*)>/,`<body$1>
7852
- ${x}`);else X=x+`
7853
- `+X}X=X.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>\s*/gi,"");let G4=Z.__stx_event_bindings||[],h=!1,C=[];X.replace(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,(b,x,$4)=>{return C.push({match:b,attrs:x||"",content:$4}),b});for(let{match:b,attrs:x,content:$4}of C){h=!0;let Q4=$4;if(n4(x))Q4=s4($4);XQ(Q4,Y),X=X.replace(b,P5(Q4,{eventBindings:G4,attrs:x}))}if(h)Z.__stx_event_bindings=[];return X}async function eG($,Z,Y,J,G){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[_,j]=q,B=j.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of B){let z=U.split("/"),H=z[z.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((R)=>R.charAt(0).toUpperCase()+R.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,L=[J4.resolve(J4.dirname(Y),`${U}.stx`),J4.resolve(J4.dirname(Y),U),J4.resolve(J.componentsDir||"components",`${U}.stx`),J4.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let R of L)try{if(await Bun.file(R).exists()){F=R;break}}catch{}if(F){Q.set(O,F),Q.set(H,F),Q.set(H.toLowerCase(),F);let R=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(R,F),G.add(F),J.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}X=X.replace(_,"")}return X}async function $Q($,Z,Y,J,G,X){let Q=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,_;while(_=q.exec(Q)){let[j,B,U]=_,z={};if(U)try{z=Function(...Object.keys(Z),`return ${U}`)(...Object.values(Z))}catch(H){let O=H instanceof Error?H.message:String(H);Q=Q.replace(j,`[Error parsing component props: ${O}]`);continue}let W=await o4(B,z,"",J,Z,Y,G,K,X);Q=Q.replace(j,W),q.lastIndex=0}return Q}async function ZQ($,Z,Y,J,G,X){let Q=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);return Q=await U(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await U(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await U(Q,/[a-z][a-z0-9]*/,!1,q),Q;async function U(z,W,H,O){let F=z,L=oG(F,W,O);for(let R=L.length-1;R>=0;R--){let M=L[R],V=H?sG(M.tagName):M.tagName,A=rG(M.attributes),N={};for(let[D,E]of Object.entries(A)){if(D.startsWith("@"))continue;if(D.startsWith("__stx_")){let k=D.slice(6);try{let w=E.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");N[k]=JSON.parse(w)}catch(w){if(G.debug)console.error(`Error parsing __stx_${k}:`,w);N[k]=E}continue}if(D.startsWith(":")){let k=D.slice(1),w=E==="true"?k:E;try{let S=Function(...Object.keys(Z),`return ${w}`);N[k]=S(...Object.values(Z))}catch(S){if(G.debug)console.error(`Error evaluating :${k} binding:`,S);N[k]=E}continue}if(typeof E==="string"&&E.includes("{{")&&E.includes("}}")){let k=E.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(k)try{let w=Function(...Object.keys(Z),`return ${k[1]}`);N[D]=w(...Object.values(Z))}catch(w){if(G.debug)console.error(`Error evaluating expression for ${D}:`,w);N[D]=E}else{let w=E,S=/\{\{\s*([\s\S]+?)\s*\}\}/g,m;while((m=S.exec(E))!==null)try{let P=Function(...Object.keys(Z),`return ${m[1]}`)(...Object.values(Z));w=w.replace(m[0],String(P??""))}catch(c){if(G.debug)console.error(`Error evaluating expression in ${D}:`,c)}N[D]=w}}else N[D]=E}let T=await o4(V,N,M.content,J,Z,Y,G,K,X);F=F.substring(0,M.startIndex)+T+F.substring(M.endIndex)}return F}}function L1($,Z){return $.replace(/@json\(\s*([^,)]+)(?:,\s*(true|false))?\)/g,(Y,J,G)=>{try{let Q=Function(...Object.keys(Z),`
8685
+ ${r}`);else X=r+`
8686
+ `+X}X=X.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>\s*/gi,"");let K4=Z.__stx_event_bindings||[],g=!1,y=[],m=/\s:[a-z][\w.-]*\s*=/.test(X);X.replace(/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)(?![^>]*\bdata-stx-scoped\b)([^>]*)>([\s\S]*?)<\/script>/gi,(x,r,a)=>{return y.push({match:x,attrs:r||"",content:a}),x});for(let{match:x,attrs:r,content:a}of y){g=!0;let Y4=a;if(n4(r))Y4=w4(a);N1(Y4,Y,J.strict),X=X.replace(x,x5(Y4,{eventBindings:K4,attrs:r,hasColonDirectives:m}))}if(g)Z.__stx_event_bindings=[];return X}async function XQ($,Z,Y,J,G){let X=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(X))!==null){let[_,j]=q,B=j.split(",").map((W)=>W.trim().replace(/^['"]|['"]$/g,"")).filter((W)=>W.length>0);for(let W of B){let z=W.split("/"),H=z[z.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((A)=>A.charAt(0).toUpperCase()+A.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,L=[G4.resolve(G4.dirname(Y),`${W}.stx`),G4.resolve(G4.dirname(Y),W),G4.resolve(J.componentsDir||"components",`${W}.stx`),G4.resolve(J.componentsDir||"components",W),W.endsWith(".stx")?W:`${W}.stx`];for(let A of L)try{if(await Bun.file(A).exists()){F=A;break}}catch{}if(F){Q.set(O,F),Q.set(H,F),Q.set(H.toLowerCase(),F);let A=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(A,F),G.add(F),J.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${W}`)}X=X.replace(_,"")}return X}async function GQ($,Z,Y,J,G,X){let Q=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(['"]([^'"]+)['"](?:,\s*(\{[^}]*\}))?\)/g,_;while(_=q.exec(Q)){let[j,B,W]=_,z={};if(W)try{z=Function(...Object.keys(Z),`return ${W}`)(...Object.values(Z))}catch(H){let O=H instanceof Error?H.message:String(H);Q=Q.replace(j,`[Error parsing component props: ${O}]`);continue}let U=await s4(B,z,"",J,Z,Y,G,K,X);Q=Q.replace(j,U),q.lastIndex=0}return Q}async function QQ($,Z,Y,J,G,X){let Q=$;if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);return Q=await W(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await W(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await W(Q,/[a-z][a-z0-9]*/,!1,q),Q;async function W(z,U,H,O){let F=z,L=$Q(F,U,O);for(let A=L.length-1;A>=0;A--){let M=L[A],V=H?eG(M.tagName):M.tagName,R=ZQ(M.attributes),N={};for(let[D,E]of Object.entries(R)){if(D.startsWith("@"))continue;if(D.startsWith("__stx_")){let k=D.slice(6);try{let I=E.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");N[k]=JSON.parse(I)}catch(I){if(G.debug)console.error(`Error parsing __stx_${k}:`,I);N[k]=E}continue}if(D.startsWith(":")){let k=D.slice(1),I=E==="true"?k:E;try{let S=Function(...Object.keys(Z),`return ${I}`);N[k]=S(...Object.values(Z))}catch(S){if(G.debug)console.error(`Error evaluating :${k} binding:`,S);N[k]=E}continue}if(typeof E==="string"&&E.includes("{{")&&E.includes("}}")){let k=E.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(k)try{let I=Function(...Object.keys(Z),`return ${k[1]}`);N[D]=I(...Object.values(Z))}catch(I){if(G.debug)console.error(`Error evaluating expression for ${D}:`,I);N[D]=E}else{let I=E,S=/\{\{\s*([\s\S]+?)\s*\}\}/g,d;while((d=S.exec(E))!==null)try{let b=Function(...Object.keys(Z),`return ${d[1]}`)(...Object.values(Z));I=I.replace(d[0],String(b??""))}catch(c){if(G.debug)console.error(`Error evaluating expression in ${D}:`,c)}N[D]=I}}else N[D]=E}let T=await s4(V,N,M.content,J,Z,Y,G,K,X);F=F.substring(0,M.startIndex)+T+F.substring(M.endIndex)}return F}}function A1($,Z){return $.replace(/@json\(\s*([^,)]+)(?:,\s*(true|false))?\)/g,(Y,J,G)=>{try{let Q=Function(...Object.keys(Z),`
7854
8687
  try { return ${J.trim()}; } catch (e) { return undefined; }
7855
- `)(...Object.values(Z));if(G==="true")return JSON.stringify(Q,null,2);return JSON.stringify(Q)}catch(X){return e4.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),Y}})}function F1($){let Z=new Map,Y=[],J=/@once\s*([\s\S]*?)@endonce/g,G=J.exec($);while(G!==null){let q=G[0],_=G[1],j=G.index,B=j+q.length;Y.push({match:q,content:_.trim(),start:j,end:B}),G=J.exec($)}let X=new Set;for(let q=0;q<Y.length;q++){let{content:_}=Y[q];if(Z.has(_))X.add(q);else Z.set(_,{content:_,index:q})}let Q=$,K=Array.from(X).map((q)=>Y[q]).sort((q,_)=>_.start-q.start);for(let{start:q,end:_}of K)Q=Q.substring(0,q)+Q.substring(_);return Q=Q.replace(/@once\s*([\s\S]*?)@endonce/g,"$1"),Q}function YQ($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/\sref="([^"]+)"/g,' data-stx-ref="$1"'),Z}function XQ($,Z){let Y=[];for(let{pattern:J,message:G,suggestion:X}of JQ){J.lastIndex=0;let Q=$.match(J);if(Q&&Q.length>0){let K=$.split(`
7856
- `),q=[];K.forEach((j,B)=>{if(J.lastIndex=0,J.test(j))q.push(B+1)});let _=q.length>0?` (line${q.length>1?"s":""}: ${q.join(", ")})`:"";Y.push(` \u2717 ${G}${_}
7857
- \u2192 ${X}`)}}if(Y.length>0){let G=`
7858
- \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
7859
- \u2551 STX: Prohibited DOM API Usage Detected \u2551
7860
- \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
7861
-
7862
- File: ${Z.split("/").pop()||Z}
7863
-
7864
- STX enforces Vue-style patterns. Direct DOM manipulation via document.* is not allowed.
7865
- Use the STX API instead for cleaner, more maintainable code.
7866
-
7867
- Errors found:
7868
- ${Y.join(`
7869
-
8688
+ `)(...Object.values(Z));if(G==="true")return JSON.stringify(Q,null,2);return JSON.stringify(Q)}catch(X){return e4.log(X instanceof Error?X:Error(String(X)),{directive:"@json"},"error"),Y}})}function R1($){let Z=new Map,Y=[],J=/@once\s*([\s\S]*?)@endonce/g,G=J.exec($);while(G!==null){let q=G[0],_=G[1],j=G.index,B=j+q.length;Y.push({match:q,content:_.trim(),start:j,end:B}),G=J.exec($)}let X=new Set;for(let q=0;q<Y.length;q++){let{content:_}=Y[q];if(Z.has(_))X.add(q);else Z.set(_,{content:_,index:q})}let Q=$,K=Array.from(X).map((q)=>Y[q]).sort((q,_)=>_.start-q.start);for(let{start:q,end:_}of K)Q=Q.substring(0,q)+Q.substring(_);return Q=Q.replace(/@once\s*([\s\S]*?)@endonce/g,"$1"),Q}function KQ($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/\sref="([^"]+)"/g,' data-stx-ref="$1"'),Z}function N1($,Z,Y){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},G=J.allowPatterns??[],X=[];for(let{pattern:Q,message:K,suggestion:q}of qQ){if(G.some((j)=>K.includes(j)||Q.source.includes(j)))continue;Q.lastIndex=0;let _=$.match(Q);if(_&&_.length>0){let j=$.split(`
8689
+ `),B=[];j.forEach((z,U)=>{if(Q.lastIndex=0,Q.test(z))B.push(U+1)});let W=B.length>0?` (line${B.length>1?"s":""}: ${B.join(", ")})`:"";X.push(` \u2717 ${K}${W}
8690
+ \u2192 ${q}`)}}if(X.length>0){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
8691
+ ${X.join(`
7870
8692
  `)}
7871
-
7872
- Quick Reference:
7873
- \u2022 STX.useRefs() \u2192 Get all refs from template
7874
- \u2022 STX.useRef("name") \u2192 Get single ref by name
7875
- \u2022 STX.el(tag, attrs) \u2192 Create element
7876
- \u2022 STX.onKey(key, fn) \u2192 Global keyboard listener
7877
- \u2022 STX.activeElement() \u2192 Get focused element
7878
- \u2022 STX.escapeHtml(text) \u2192 Escape HTML
7879
-
7880
- Documentation: https://stx.stacksjs.org/refs
7881
- `;throw new L5(G,Z)}}async function GQ($,Z,Y){let J=$,G=J4.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=X.exec(J))!==null){let[_,j,B,U]=Q;if(H1(B))continue;let z=O1(B,G,Z);if(z)try{let W=await Bun.file(z).text();if(Y.add(z),B.endsWith(".ts")||B.endsWith(".tsx")){let O=await Bun.build({entrypoints:[z],target:"browser",minify:!1});if(O.outputs.length>0)W=await O.outputs[0].text()}let H=`<script>
8693
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.enabled&&J.failOnViolation)throw Error(K);else console.warn(K)}}async function _Q($,Z,Y){let J=$,G=G4.dirname(Z),X=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=X.exec(J))!==null){let[_,j,B,W]=Q;if(L1(B))continue;let z=F1(B,G,Z);if(z)try{let U=await Bun.file(z).text();if(Y.add(z),B.endsWith(".ts")||B.endsWith(".tsx")){let O=await Bun.build({entrypoints:[z],target:"browser",minify:!1});if(O.outputs.length>0)U=await O.outputs[0].text()}let H=`<script>
7882
8694
  // Source: ${B}
7883
- ${W}
7884
- </script>`;J=J.replace(_,H),X.lastIndex=0}catch(W){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[_,j,B,U]=q,z=j+U;if(H1(B))continue;if(/rel=["']stylesheet["']/.test(z)||B.endsWith(".css")){let H=O1(B,G,Z);if(H)try{let O=await Bun.file(H).text();Y.add(H);let F=`<style>
8695
+ ${U}
8696
+ </script>`;J=J.replace(_,H),X.lastIndex=0}catch(U){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(J))!==null){let[_,j,B,W]=q,z=j+W;if(L1(B))continue;if(/rel=["']stylesheet["']/.test(z)||B.endsWith(".css")){let H=F1(B,G,Z);if(H)try{let O=await Bun.file(H).text();Y.add(H);let F=`<style>
7885
8697
  /* Source: ${B} */
7886
8698
  ${O}
7887
- </style>`;J=J.replace(_,F),K.lastIndex=0}catch(O){}}}return J}function H1($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function O1($,Z,Y){try{let J;if($.startsWith("/")){let G=Z;for(let X=0;X<5;X++){let Q=J4.join(G,$);if(t("fs").existsSync(Q))return Q;G=J4.dirname(G)}J=J4.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=J4.resolve(Z,$);else J=J4.resolve(Z,$);if(t("fs").existsSync(J))return J;return null}catch{return null}}var JQ;var c7=I(()=>{P6();E7();f6();m6();p6();S7();b7();X$();P7();KZ();z7();LZ();AZ();MZ();I4();l4();DZ();CZ();mZ();lZ();s0();l7();rZ();i4();eZ();P0();q5();A4();Z3();J3();Q3();q3();JQ=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use STX.useRef("name") or STX.useRefs() instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use STX.useRef("name") or refs.container?.querySelector() instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:"Use refs.container?.querySelectorAll() instead"},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:"Use STX.useRefs() or refs.container?.querySelectorAll() instead"},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use STX.el(tag, attrs, content) instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use STX.activeElement() instead"}]});import UQ from"fs";import G6 from"path";import q6 from"fs";import M4 from"path";import I1 from"process";var _6=[72,96,128,144,152,192,384,512],j6=[120,152,167,180],B6=[16,32];async function U6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},J=$.pwa?.icons;if(!J?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let G=M4.isAbsolute(J.src)?J.src:M4.resolve(I1.cwd(),J.src);if(!q6.existsSync(G))return Y.errors.push(`Source icon not found: ${G}`),Y.success=!1,Y;let X=M4.resolve(Z,J.outputDir||"pwa-icons");try{q6.mkdirSync(X,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${X}`),Y.success=!1,Y}let Q=J.sizes||_6,K=J.generateWebP??!0,q=J.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
7888
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let B=await _.default(G).metadata();if(B.width&&B.width<512)Y.warnings.push(`Source icon is ${B.width}x${B.height}. Recommend using at least 512x512 for best quality.`);for(let O of Q){let F=M4.join(X,`icon-${O}x${O}.png`);if(await _.default(G).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let L=M4.join(X,`icon-${O}x${O}.webp`);await _.default(G).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(L),Y.generatedFiles.push(L)}}if(q){for(let F of j6){let L=M4.join(X,`apple-touch-icon-${F}x${F}.png`);await _.default(G).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}let O=M4.join(X,"apple-touch-icon.png");await _.default(G).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}for(let O of B6){let F=M4.join(X,`favicon-${O}x${O}.png`);await _.default(G).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let U=512,z=M4.join(X,`icon-maskable-${U}x${U}.png`),W=Math.floor(U*0.1),H=U-W*2;await _.default(G).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:W,bottom:W,left:W,right:W,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(z),Y.generatedFiles.push(z)}catch(_){let j=_ instanceof Error?_.message:String(_);Y.errors.push(`Icon generation failed: ${j}`),Y.success=!1}return Y}function LQ($){let Z=$.sizes||_6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",J=$.generateWebP??!0,G=$.generateAppleIcons??!0,X=[];for(let Q of Z)if(X.push(`${Y}/icon-${Q}x${Q}.png`),J)X.push(`${Y}/icon-${Q}x${Q}.webp`);if(G){X.push(`${Y}/apple-touch-icon.png`);for(let Q of j6)X.push(`${Y}/apple-touch-icon-${Q}x${Q}.png`)}for(let Q of B6)X.push(`${Y}/favicon-${Q}x${Q}.png`);return X.push(`${Y}/icon-maskable-512x512.png`),X}async function W6(){try{return await import("sharp"),!0}catch{return!1}}b5();function n1($,Z,Y,J){let G=[],X=J.join(" ");for(let Q of $)if(G.push({src:`${Z}/icon-${Q}x${Q}.png`,sizes:`${Q}x${Q}`,type:"image/png",purpose:X}),Y)G.push({src:`${Z}/icon-${Q}x${Q}.webp`,sizes:`${Q}x${Q}`,type:"image/webp",purpose:X});return G}function s1($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function o1($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((J)=>({name:J.name,accept:J.accept}));return Y}function r1($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((J)=>({src:J.src,sizes:J.sizes,type:J.type}));return Y}function a1($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function t1($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:J}=Z,G=J?.sizes||[72,96,128,144,152,192,384,512],X=J?.outputDir?`/${J.outputDir}`:"/pwa-icons",Q=J?.generateWebP??!0,K=J?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:n1(G,X,Q,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=s1(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((U)=>({src:U.src,sizes:U.sizes,type:U.type,label:U.label,form_factor:U.platform}));let _=o1($);if(_)q.share_target=_;let j=r1($);if(j)q.file_handlers=j;let B=a1($);if(B)q.protocol_handlers=B;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function I6($){let Z=t1($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function DQ($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function EQ($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let J=Y.manifest;if(!J)return Z.push("PWA manifest configuration is missing"),Z;if(!J.name)Z.push("Manifest name is required");let G=["fullscreen","standalone","minimal-ui","browser"];if(J.display&&!G.includes(J.display))Z.push(`Invalid display mode: ${J.display}. Must be one of: ${G.join(", ")}`);let X=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(J.orientation&&!X.includes(J.orientation))Z.push(`Invalid orientation: ${J.orientation}`);let Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(J.themeColor&&!Q.test(J.themeColor))Z.push(`Invalid theme color: ${J.themeColor}. Must be a valid hex color.`);if(J.backgroundColor&&!Q.test(J.backgroundColor))Z.push(`Invalid background color: ${J.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import QQ from"fs";import A1 from"path";import KQ from"process";async function N1($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=A1.isAbsolute(Z.page)?Z.page:A1.resolve(KQ.cwd(),Z.page);if(QQ.existsSync(Y))try{let{processDirectives:J}=await Promise.resolve().then(() => (c7(),R1)),G=await Bun.file(Y).text();return await J(G,{},Y,$,new Set)}catch(J){console.warn(`[PWA] Failed to process custom offline page: ${J}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return qQ($)}function qQ($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,J=Z?.fallbackTitle||"You are offline",G=Z?.fallbackMessage||"Please check your internet connection and try again.",X=Y?.themeColor||"#4f46e5",Q=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
8699
+ </style>`;J=J.replace(_,F),K.lastIndex=0}catch(O){}}}return J}function L1($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}function F1($,Z,Y){try{let J;if($.startsWith("/")){let G=Z;for(let X=0;X<5;X++){let Q=G4.join(G,$);if($4("fs").existsSync(Q))return Q;G=G4.dirname(G)}J=G4.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))J=G4.resolve(Z,$);else J=G4.resolve(Z,$);if($4("fs").existsSync(J))return J;return null}catch{return null}}var qQ;var p7=w(()=>{y6();S7();g6();u6();c6();P7();y7();G$();u7();_Z();O7();AZ();VZ();IZ();D4();l4();kZ();vZ();pZ();nZ();o0();i7();tZ();i4();Z3();y0();q5();F4();J3();G3();q3();j3();qQ=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import OQ from"fs";import Q6 from"path";import _6 from"fs";import M4 from"path";import S1 from"process";var j6=[72,96,128,144,152,192,384,512],B6=[120,152,167,180],W6=[16,32];async function U6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},J=$.pwa?.icons;if(!J?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let G=M4.isAbsolute(J.src)?J.src:M4.resolve(S1.cwd(),J.src);if(!_6.existsSync(G))return Y.errors.push(`Source icon not found: ${G}`),Y.success=!1,Y;let X=M4.resolve(Z,J.outputDir||"pwa-icons");try{_6.mkdirSync(X,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${X}`),Y.success=!1,Y}let Q=J.sizes||j6,K=J.generateWebP??!0,q=J.generateAppleIcons??!0;try{let _;try{_=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
8700
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let B=await _.default(G).metadata();if(B.width&&B.width<512)Y.warnings.push(`Source icon is ${B.width}x${B.height}. Recommend using at least 512x512 for best quality.`);for(let O of Q){let F=M4.join(X,`icon-${O}x${O}.png`);if(await _.default(G).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let L=M4.join(X,`icon-${O}x${O}.webp`);await _.default(G).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(L),Y.generatedFiles.push(L)}}if(q){for(let F of B6){let L=M4.join(X,`apple-touch-icon-${F}x${F}.png`);await _.default(G).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}let O=M4.join(X,"apple-touch-icon.png");await _.default(G).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}for(let O of W6){let F=M4.join(X,`favicon-${O}x${O}.png`);await _.default(G).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let W=512,z=M4.join(X,`icon-maskable-${W}x${W}.png`),U=Math.floor(W*0.1),H=W-U*2;await _.default(G).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:U,bottom:U,left:U,right:U,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(z),Y.generatedFiles.push(z)}catch(_){let j=_ instanceof Error?_.message:String(_);Y.errors.push(`Icon generation failed: ${j}`),Y.success=!1}return Y}function NQ($){let Z=$.sizes||j6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",J=$.generateWebP??!0,G=$.generateAppleIcons??!0,X=[];for(let Q of Z)if(X.push(`${Y}/icon-${Q}x${Q}.png`),J)X.push(`${Y}/icon-${Q}x${Q}.webp`);if(G){X.push(`${Y}/apple-touch-icon.png`);for(let Q of B6)X.push(`${Y}/apple-touch-icon-${Q}x${Q}.png`)}for(let Q of W6)X.push(`${Y}/favicon-${Q}x${Q}.png`);return X.push(`${Y}/icon-maskable-512x512.png`),X}async function z6(){try{return await import("sharp"),!0}catch{return!1}}b5();function a1($,Z,Y,J){let G=[],X=J.join(" ");for(let Q of $)if(G.push({src:`${Z}/icon-${Q}x${Q}.png`,sizes:`${Q}x${Q}`,type:"image/png",purpose:X}),Y)G.push({src:`${Z}/icon-${Q}x${Q}.webp`,sizes:`${Q}x${Q}`,type:"image/webp",purpose:X});return G}function t1($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function e1($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((J)=>({name:J.name,accept:J.accept}));return Y}function $Y($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((J)=>({src:J.src,sizes:J.sizes,type:J.type}));return Y}function ZY($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function YY($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:J}=Z,G=J?.sizes||[72,96,128,144,152,192,384,512],X=J?.outputDir?`/${J.outputDir}`:"/pwa-icons",Q=J?.generateWebP??!0,K=J?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:a1(G,X,Q,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=t1(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((W)=>({src:W.src,sizes:W.sizes,type:W.type,label:W.label,form_factor:W.platform}));let _=e1($);if(_)q.share_target=_;let j=$Y($);if(j)q.file_handlers=j;let B=ZY($);if(B)q.protocol_handlers=B;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function D6($){let Z=YY($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function bQ($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function PQ($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let J=Y.manifest;if(!J)return Z.push("PWA manifest configuration is missing"),Z;if(!J.name)Z.push("Manifest name is required");let G=["fullscreen","standalone","minimal-ui","browser"];if(J.display&&!G.includes(J.display))Z.push(`Invalid display mode: ${J.display}. Must be one of: ${G.join(", ")}`);let X=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(J.orientation&&!X.includes(J.orientation))Z.push(`Invalid orientation: ${J.orientation}`);let Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(J.themeColor&&!Q.test(J.themeColor))Z.push(`Invalid theme color: ${J.themeColor}. Must be a valid hex color.`);if(J.backgroundColor&&!Q.test(J.backgroundColor))Z.push(`Invalid background color: ${J.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import jQ from"fs";import M1 from"path";import BQ from"process";async function T1($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=M1.isAbsolute(Z.page)?Z.page:M1.resolve(BQ.cwd(),Z.page);if(jQ.existsSync(Y))try{let{processDirectives:J}=await Promise.resolve().then(() => (p7(),V1)),G=await Bun.file(Y).text();return await J(G,{},Y,$,new Set)}catch(J){console.warn(`[PWA] Failed to process custom offline page: ${J}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return WQ($)}function WQ($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,J=Z?.fallbackTitle||"You are offline",G=Z?.fallbackMessage||"Please check your internet connection and try again.",X=Y?.themeColor||"#4f46e5",Q=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
7889
8701
  <html lang="en">
7890
8702
  <head>
7891
8703
  <meta charset="UTF-8">
7892
8704
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
7893
8705
  <meta name="theme-color" content="${X}">
7894
- <title>${A7(J)} - ${A7(Q)}</title>
8706
+ <title>${V7(J)} - ${V7(Q)}</title>
7895
8707
  <style>
7896
8708
  :root {
7897
8709
  --theme-color: ${X};
@@ -8061,8 +8873,8 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
8061
8873
  <circle cx="12" cy="20" r="1"/>
8062
8874
  </svg>
8063
8875
 
8064
- <h1>${A7(J)}</h1>
8065
- <p>${A7(G)}</p>
8876
+ <h1>${V7(J)}</h1>
8877
+ <p>${V7(G)}</p>
8066
8878
 
8067
8879
  <button class="retry-btn" onclick="window.location.reload()">
8068
8880
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -8116,9 +8928,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
8116
8928
  }, 5000);
8117
8929
  </script>
8118
8930
  </body>
8119
- </html>`}function A7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}G5();Q5();import d4 from"fs";import N7 from"path";function _Q($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let J=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:J.includes(192),message:J.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:J.includes(512),message:J.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let G=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:G.length>0,message:G.length>0?`${G.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function jQ($){let Z=[],Y=N7.join($,"manifest.json"),J=d4.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:J,message:J?"manifest.json exists":"manifest.json not found in build output"}),J)try{let j=JSON.parse(d4.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(j.icons)&&j.icons.length>0,message:j.icons?.length?`${j.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let G=N7.join($,"sw.js"),X=d4.existsSync(G);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:X,message:X?"Service worker (sw.js) exists":"Service worker not found in build output"});let Q=N7.join($,"offline.html"),K=d4.existsSync(Q);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=N7.join($,"pwa-icons");if(d4.existsSync(q)){let j=d4.readdirSync(q).filter((B)=>B.endsWith(".png")||B.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:j.length>0,message:j.length>0?`${j.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function BQ($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),J=Z.filter((q)=>q.passed).length,G=Y.filter((q)=>q.passed).length,X=Z.length>0?J/Z.length*70:70,Q=Y.length>0?G/Y.length*30:30;return{score:Math.round(X+Q),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function JU($,Z){let Y=_Q($),J=Z&&d4.existsSync(Z)?jQ(Z):[];return BQ([...Y,...J])}function XU($){let Z=[];Z.push(`
8931
+ </html>`}function V7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}G5();Q5();import m4 from"fs";import M7 from"path";function UQ($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let J=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:J.includes(192),message:J.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:J.includes(512),message:J.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let G=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:G.length>0,message:G.length>0?`${G.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function zQ($){let Z=[],Y=M7.join($,"manifest.json"),J=m4.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:J,message:J?"manifest.json exists":"manifest.json not found in build output"}),J)try{let j=JSON.parse(m4.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(j.icons)&&j.icons.length>0,message:j.icons?.length?`${j.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let G=M7.join($,"sw.js"),X=m4.existsSync(G);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:X,message:X?"Service worker (sw.js) exists":"Service worker not found in build output"});let Q=M7.join($,"offline.html"),K=m4.existsSync(Q);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=M7.join($,"pwa-icons");if(m4.existsSync(q)){let j=m4.readdirSync(q).filter((B)=>B.endsWith(".png")||B.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:j.length>0,message:j.length>0?`${j.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function HQ($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),J=Z.filter((q)=>q.passed).length,G=Y.filter((q)=>q.passed).length,X=Z.length>0?J/Z.length*70:70,Q=Y.length>0?G/Y.length*30:30;return{score:Math.round(X+Q),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function qW($,Z){let Y=UQ($),J=Z&&m4.existsSync(Z)?zQ(Z):[];return HQ([...Y,...J])}function _W($){let Z=[];Z.push(`
8120
8932
  === PWA Audit Report ===
8121
8933
  `);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
8122
8934
  `);let J=["required","recommended","optional"];for(let G of J){let X=$.checks.filter((Q)=>Q.category===G);if(X.length===0)continue;Z.push(`
8123
8935
  ${G.toUpperCase()}:`);for(let Q of X){let K=Q.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${Q.name}: ${Q.message}`),Q.details)Z.push(` ${Q.details}`)}}return Z.push(""),Z.join(`
8124
- `)}T0();b5();G5();Q5();async function zU($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},J=$.pwa;if(!J?.enabled)return Y;try{UQ.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let X=I6($);if(X){let Q=G6.join(Z,"manifest.json");await Bun.write(Q,X),Y.files.manifest=Q}}catch(X){let Q=X instanceof Error?X.message:String(X);Y.errors.push(`Failed to generate manifest.json: ${Q}`),Y.success=!1}if(J.icons?.src)if(await W6()){let Q=await U6($,Z);if(Y.files.icons=Q.generatedFiles,Y.warnings.push(...Q.warnings),!Q.success)Y.errors.push(...Q.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(J.offline?.enabled)try{let X=await N1($);if(X){let Q=G6.join(Z,"offline.html");await Bun.write(Q,X),Y.files.offlinePage=Q}}catch(X){let Q=X instanceof Error?X.message:String(X);Y.errors.push(`Failed to generate offline page: ${Q}`),Y.success=!1}let G;if(J.precache?.enabled){let X=b4(Z,$);G={fileCount:X.fileCount,totalSize:X.totalSize},Y.precacheStats=G}try{let X=k5($,Z);if(X){let Q=m4($),K=G6.join(Z,Q);await Bun.write(K,X),Y.files.serviceWorker=K}}catch(X){let Q=X instanceof Error?X.message:String(X);Y.errors.push(`Failed to generate service worker: ${Q}`),Y.success=!1}return Y}function HU($,Z){return I7($,Z)}function OU($){return $.pwa?.enabled===!0}export{EQ as validateManifest,JU as runPwaAudit,gq as registerPwaDirectives,kJ as pwaUpdateDirective,bJ as pwaPushDirective,SJ as pwaOfflineDirective,EJ as pwaInstallDirective,M0 as pwaDirectives,HU as processPwaHtml,DQ as mergeManifestConfig,M6 as isWorkboxEnabled,W6 as isSharpAvailable,OU as isPwaEnabled,I7 as injectPwaTags,m4 as getServiceWorkerFileName,LQ as getExpectedIconPaths,i1 as generateThemeColorMeta,c1 as generateSwRegistrationScript,p1 as generateServiceWorkerAuto,k5 as generateServiceWorker,S5 as generatePwaTags,U6 as generatePwaIcons,E5 as generatePrecacheManifestJs,b4 as generatePrecacheManifest,N1 as generateOfflinePage,l1 as generateManifestLink,I6 as generateManifestJson,t1 as generateManifest,H6 as formatSize,XU as formatAuditResult,BQ as calculateAuditResult,zU as buildPwaAssets,_Q as auditConfig,jQ as auditBuildOutput,B6 as FAVICON_SIZES,_6 as DEFAULT_ICON_SIZES,j6 as APPLE_TOUCH_ICON_SIZES};
8936
+ `)}I0();b5();G5();Q5();async function AW($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},J=$.pwa;if(!J?.enabled)return Y;try{OQ.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let X=D6($);if(X){let Q=Q6.join(Z,"manifest.json");await Bun.write(Q,X),Y.files.manifest=Q}}catch(X){let Q=X instanceof Error?X.message:String(X);Y.errors.push(`Failed to generate manifest.json: ${Q}`),Y.success=!1}if(J.icons?.src)if(await z6()){let Q=await U6($,Z);if(Y.files.icons=Q.generatedFiles,Y.warnings.push(...Q.warnings),!Q.success)Y.errors.push(...Q.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(J.offline?.enabled)try{let X=await T1($);if(X){let Q=Q6.join(Z,"offline.html");await Bun.write(Q,X),Y.files.offlinePage=Q}}catch(X){let Q=X instanceof Error?X.message:String(X);Y.errors.push(`Failed to generate offline page: ${Q}`),Y.success=!1}let G;if(J.precache?.enabled){let X=P4(Z,$);G={fileCount:X.fileCount,totalSize:X.totalSize},Y.precacheStats=G}try{let X=k5($,Z);if(X){let Q=u4($),K=Q6.join(Z,Q);await Bun.write(K,X),Y.files.serviceWorker=K}}catch(X){let Q=X instanceof Error?X.message:String(X);Y.errors.push(`Failed to generate service worker: ${Q}`),Y.success=!1}return Y}function RW($,Z){return E7($,Z)}function NW($){return $.pwa?.enabled===!0}export{PQ as validateManifest,qW as runPwaAudit,pq as registerPwaDirectives,CJ as pwaUpdateDirective,vJ as pwaPushDirective,xJ as pwaOfflineDirective,yJ as pwaInstallDirective,T0 as pwaDirectives,RW as processPwaHtml,bQ as mergeManifestConfig,T6 as isWorkboxEnabled,z6 as isSharpAvailable,NW as isPwaEnabled,E7 as injectPwaTags,u4 as getServiceWorkerFileName,NQ as getExpectedIconPaths,r1 as generateThemeColorMeta,s1 as generateSwRegistrationScript,n1 as generateServiceWorkerAuto,k5 as generateServiceWorker,S5 as generatePwaTags,U6 as generatePwaIcons,E5 as generatePrecacheManifestJs,P4 as generatePrecacheManifest,T1 as generateOfflinePage,o1 as generateManifestLink,D6 as generateManifestJson,YY as generateManifest,O6 as formatSize,_W as formatAuditResult,HQ as calculateAuditResult,AW as buildPwaAssets,UQ as auditConfig,zQ as auditBuildOutput,W6 as FAVICON_SIZES,j6 as DEFAULT_ICON_SIZES,B6 as APPLE_TOUCH_ICON_SIZES};