snice 4.14.0 → 4.16.0

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 (384) hide show
  1. package/adapters/react/doc.d.ts +1 -0
  2. package/adapters/react/doc.d.ts.map +1 -1
  3. package/adapters/react/doc.js +1 -1
  4. package/adapters/react/doc.js.map +1 -1
  5. package/adapters/react/doc.tsx +2 -1
  6. package/adapters/react/input.d.ts +3 -0
  7. package/adapters/react/input.d.ts.map +1 -1
  8. package/adapters/react/input.js +1 -1
  9. package/adapters/react/input.js.map +1 -1
  10. package/adapters/react/input.tsx +4 -1
  11. package/adapters/react/modal.d.ts +2 -0
  12. package/adapters/react/modal.d.ts.map +1 -1
  13. package/adapters/react/modal.js +1 -1
  14. package/adapters/react/modal.js.map +1 -1
  15. package/adapters/react/modal.tsx +3 -1
  16. package/dist/cdn/accordion/snice-accordion.js +1 -1
  17. package/dist/cdn/accordion/snice-accordion.min.js +1 -1
  18. package/dist/cdn/alert/snice-alert.js +1 -1
  19. package/dist/cdn/alert/snice-alert.min.js +1 -1
  20. package/dist/cdn/app-tiles/snice-app-tiles.js +1 -1
  21. package/dist/cdn/app-tiles/snice-app-tiles.min.js +1 -1
  22. package/dist/cdn/audio-recorder/snice-audio-recorder.js +1 -1
  23. package/dist/cdn/audio-recorder/snice-audio-recorder.min.js +1 -1
  24. package/dist/cdn/avatar/snice-avatar.js +1 -1
  25. package/dist/cdn/avatar/snice-avatar.min.js +1 -1
  26. package/dist/cdn/badge/snice-badge.js +1 -1
  27. package/dist/cdn/badge/snice-badge.min.js +1 -1
  28. package/dist/cdn/banner/snice-banner.js +1 -1
  29. package/dist/cdn/banner/snice-banner.min.js +1 -1
  30. package/dist/cdn/book/README.md +2 -2
  31. package/dist/cdn/book/snice-book.js +29 -8
  32. package/dist/cdn/book/snice-book.js.map +1 -1
  33. package/dist/cdn/book/snice-book.min.js +3 -3
  34. package/dist/cdn/book/snice-book.min.js.map +1 -1
  35. package/dist/cdn/breadcrumbs/snice-breadcrumbs.js +1 -1
  36. package/dist/cdn/breadcrumbs/snice-breadcrumbs.min.js +1 -1
  37. package/dist/cdn/button/snice-button.js +1 -1
  38. package/dist/cdn/button/snice-button.min.js +1 -1
  39. package/dist/cdn/calendar/snice-calendar.js +1 -1
  40. package/dist/cdn/calendar/snice-calendar.min.js +1 -1
  41. package/dist/cdn/camera/snice-camera.js +1 -1
  42. package/dist/cdn/camera/snice-camera.min.js +1 -1
  43. package/dist/cdn/camera-annotate/snice-camera-annotate.js +1 -1
  44. package/dist/cdn/camera-annotate/snice-camera-annotate.min.js +1 -1
  45. package/dist/cdn/candlestick/snice-candlestick.js +1 -1
  46. package/dist/cdn/candlestick/snice-candlestick.min.js +1 -1
  47. package/dist/cdn/card/snice-card.js +1 -1
  48. package/dist/cdn/card/snice-card.min.js +1 -1
  49. package/dist/cdn/carousel/snice-carousel.js +1 -1
  50. package/dist/cdn/carousel/snice-carousel.min.js +1 -1
  51. package/dist/cdn/chart/snice-chart.js +1 -1
  52. package/dist/cdn/chart/snice-chart.min.js +1 -1
  53. package/dist/cdn/chat/snice-chat.js +1 -1
  54. package/dist/cdn/chat/snice-chat.min.js +1 -1
  55. package/dist/cdn/checkbox/snice-checkbox.js +1 -1
  56. package/dist/cdn/checkbox/snice-checkbox.min.js +1 -1
  57. package/dist/cdn/chip/snice-chip.js +1 -1
  58. package/dist/cdn/chip/snice-chip.min.js +1 -1
  59. package/dist/cdn/code-block/snice-code-block.js +4 -4
  60. package/dist/cdn/code-block/snice-code-block.js.map +1 -1
  61. package/dist/cdn/code-block/snice-code-block.min.js +2 -2
  62. package/dist/cdn/code-block/snice-code-block.min.js.map +1 -1
  63. package/dist/cdn/color-display/snice-color-display.js +1 -1
  64. package/dist/cdn/color-display/snice-color-display.min.js +1 -1
  65. package/dist/cdn/color-picker/snice-color-picker.js +1 -1
  66. package/dist/cdn/color-picker/snice-color-picker.min.js +1 -1
  67. package/dist/cdn/command-palette/snice-command-palette.js +1 -1
  68. package/dist/cdn/command-palette/snice-command-palette.min.js +1 -1
  69. package/dist/cdn/comments/snice-comments.js +1 -1
  70. package/dist/cdn/comments/snice-comments.min.js +1 -1
  71. package/dist/cdn/countdown/snice-countdown.js +1 -1
  72. package/dist/cdn/countdown/snice-countdown.min.js +1 -1
  73. package/dist/cdn/cropper/snice-cropper.js +1 -1
  74. package/dist/cdn/cropper/snice-cropper.min.js +1 -1
  75. package/dist/cdn/date-picker/README.md +1 -1
  76. package/dist/cdn/date-picker/snice-date-picker.js +49 -39
  77. package/dist/cdn/date-picker/snice-date-picker.js.map +1 -1
  78. package/dist/cdn/date-picker/snice-date-picker.min.js +4 -4
  79. package/dist/cdn/date-picker/snice-date-picker.min.js.map +1 -1
  80. package/dist/cdn/diff/snice-diff.js +1 -1
  81. package/dist/cdn/diff/snice-diff.min.js +1 -1
  82. package/dist/cdn/divider/snice-divider.js +1 -1
  83. package/dist/cdn/divider/snice-divider.min.js +1 -1
  84. package/dist/cdn/doc/README.md +2 -2
  85. package/dist/cdn/doc/snice-doc.js +221 -35
  86. package/dist/cdn/doc/snice-doc.js.map +1 -1
  87. package/dist/cdn/doc/snice-doc.min.js +2 -2
  88. package/dist/cdn/doc/snice-doc.min.js.map +1 -1
  89. package/dist/cdn/draw/snice-draw.js +1 -1
  90. package/dist/cdn/draw/snice-draw.min.js +1 -1
  91. package/dist/cdn/drawer/snice-drawer.js +1 -1
  92. package/dist/cdn/drawer/snice-drawer.min.js +1 -1
  93. package/dist/cdn/empty-state/snice-empty-state.js +1 -1
  94. package/dist/cdn/empty-state/snice-empty-state.min.js +1 -1
  95. package/dist/cdn/file-gallery/snice-file-gallery.js +1 -1
  96. package/dist/cdn/file-gallery/snice-file-gallery.min.js +1 -1
  97. package/dist/cdn/file-upload/snice-file-upload.js +1 -1
  98. package/dist/cdn/file-upload/snice-file-upload.min.js +1 -1
  99. package/dist/cdn/flip-card/snice-flip-card.js +1 -1
  100. package/dist/cdn/flip-card/snice-flip-card.min.js +1 -1
  101. package/dist/cdn/flow/snice-flow.js +1 -1
  102. package/dist/cdn/flow/snice-flow.min.js +1 -1
  103. package/dist/cdn/funnel/snice-funnel.js +1 -1
  104. package/dist/cdn/funnel/snice-funnel.min.js +1 -1
  105. package/dist/cdn/gantt/snice-gantt.js +1 -1
  106. package/dist/cdn/gantt/snice-gantt.min.js +1 -1
  107. package/dist/cdn/gauge/snice-gauge.js +1 -1
  108. package/dist/cdn/gauge/snice-gauge.min.js +1 -1
  109. package/dist/cdn/heatmap/snice-heatmap.js +1 -1
  110. package/dist/cdn/heatmap/snice-heatmap.min.js +1 -1
  111. package/dist/cdn/image/snice-image.js +1 -1
  112. package/dist/cdn/image/snice-image.min.js +1 -1
  113. package/dist/cdn/input/README.md +2 -2
  114. package/dist/cdn/input/snice-input.js +21 -3
  115. package/dist/cdn/input/snice-input.js.map +1 -1
  116. package/dist/cdn/input/snice-input.min.js +3 -3
  117. package/dist/cdn/input/snice-input.min.js.map +1 -1
  118. package/dist/cdn/kanban/snice-kanban.js +1 -1
  119. package/dist/cdn/kanban/snice-kanban.min.js +1 -1
  120. package/dist/cdn/kpi/snice-kpi.js +1 -1
  121. package/dist/cdn/kpi/snice-kpi.min.js +1 -1
  122. package/dist/cdn/layout/snice-layout.js +1 -1
  123. package/dist/cdn/layout/snice-layout.min.js +1 -1
  124. package/dist/cdn/link/snice-link.js +1 -1
  125. package/dist/cdn/link/snice-link.min.js +1 -1
  126. package/dist/cdn/link-preview/snice-link-preview.js +2 -2
  127. package/dist/cdn/link-preview/snice-link-preview.js.map +1 -1
  128. package/dist/cdn/link-preview/snice-link-preview.min.js +2 -2
  129. package/dist/cdn/link-preview/snice-link-preview.min.js.map +1 -1
  130. package/dist/cdn/list/snice-list.js +4 -4
  131. package/dist/cdn/list/snice-list.js.map +1 -1
  132. package/dist/cdn/list/snice-list.min.js +2 -2
  133. package/dist/cdn/list/snice-list.min.js.map +1 -1
  134. package/dist/cdn/location/snice-location.js +1 -1
  135. package/dist/cdn/location/snice-location.min.js +1 -1
  136. package/dist/cdn/login/snice-login.js +1 -1
  137. package/dist/cdn/login/snice-login.min.js +1 -1
  138. package/dist/cdn/map/snice-map.js +1 -1
  139. package/dist/cdn/map/snice-map.min.js +1 -1
  140. package/dist/cdn/markdown/snice-markdown.js +1 -1
  141. package/dist/cdn/markdown/snice-markdown.min.js +1 -1
  142. package/dist/cdn/masonry/snice-masonry.js +1 -1
  143. package/dist/cdn/masonry/snice-masonry.min.js +1 -1
  144. package/dist/cdn/menu/snice-menu.js +2 -2
  145. package/dist/cdn/menu/snice-menu.js.map +1 -1
  146. package/dist/cdn/menu/snice-menu.min.js +2 -2
  147. package/dist/cdn/menu/snice-menu.min.js.map +1 -1
  148. package/dist/cdn/modal/README.md +2 -2
  149. package/dist/cdn/modal/snice-modal.js +34 -18
  150. package/dist/cdn/modal/snice-modal.js.map +1 -1
  151. package/dist/cdn/modal/snice-modal.min.js +24 -20
  152. package/dist/cdn/modal/snice-modal.min.js.map +1 -1
  153. package/dist/cdn/music-player/README.md +2 -2
  154. package/dist/cdn/music-player/snice-music-player.js +8 -1
  155. package/dist/cdn/music-player/snice-music-player.js.map +1 -1
  156. package/dist/cdn/music-player/snice-music-player.min.js +3 -3
  157. package/dist/cdn/music-player/snice-music-player.min.js.map +1 -1
  158. package/dist/cdn/nav/snice-nav.js +1 -1
  159. package/dist/cdn/nav/snice-nav.min.js +1 -1
  160. package/dist/cdn/network-graph/snice-network-graph.js +1 -1
  161. package/dist/cdn/network-graph/snice-network-graph.min.js +1 -1
  162. package/dist/cdn/notification-center/snice-notification-center.js +1 -1
  163. package/dist/cdn/notification-center/snice-notification-center.min.js +1 -1
  164. package/dist/cdn/org-chart/snice-org-chart.js +1 -1
  165. package/dist/cdn/org-chart/snice-org-chart.min.js +1 -1
  166. package/dist/cdn/pagination/snice-pagination.js +1 -1
  167. package/dist/cdn/pagination/snice-pagination.min.js +1 -1
  168. package/dist/cdn/paint/snice-paint.js +1 -1
  169. package/dist/cdn/paint/snice-paint.min.js +1 -1
  170. package/dist/cdn/pdf-viewer/snice-pdf-viewer.js +1 -1
  171. package/dist/cdn/pdf-viewer/snice-pdf-viewer.min.js +1 -1
  172. package/dist/cdn/podcast-player/snice-podcast-player.js +1 -1
  173. package/dist/cdn/podcast-player/snice-podcast-player.min.js +1 -1
  174. package/dist/cdn/pricing-table/snice-pricing-table.js +1 -1
  175. package/dist/cdn/pricing-table/snice-pricing-table.min.js +1 -1
  176. package/dist/cdn/progress/snice-progress.js +1 -1
  177. package/dist/cdn/progress/snice-progress.min.js +1 -1
  178. package/dist/cdn/qr-code/snice-qr-code.js +1 -1
  179. package/dist/cdn/qr-code/snice-qr-code.min.js +1 -1
  180. package/dist/cdn/qr-reader/snice-qr-reader.js +1 -1
  181. package/dist/cdn/qr-reader/snice-qr-reader.min.js +1 -1
  182. package/dist/cdn/radio/README.md +2 -2
  183. package/dist/cdn/radio/snice-radio.js +23 -3
  184. package/dist/cdn/radio/snice-radio.js.map +1 -1
  185. package/dist/cdn/radio/snice-radio.min.js +3 -3
  186. package/dist/cdn/radio/snice-radio.min.js.map +1 -1
  187. package/dist/cdn/rating/snice-rating.js +1 -1
  188. package/dist/cdn/rating/snice-rating.min.js +1 -1
  189. package/dist/cdn/recipe/snice-recipe.js +1 -1
  190. package/dist/cdn/recipe/snice-recipe.min.js +1 -1
  191. package/dist/cdn/runtime/README.md +2 -2
  192. package/dist/cdn/runtime/snice-runtime.esm.js +513 -46
  193. package/dist/cdn/runtime/snice-runtime.esm.js.map +1 -1
  194. package/dist/cdn/runtime/snice-runtime.esm.min.js +6 -6
  195. package/dist/cdn/runtime/snice-runtime.esm.min.js.map +1 -1
  196. package/dist/cdn/runtime/snice-runtime.js +6420 -5951
  197. package/dist/cdn/runtime/snice-runtime.js.map +1 -1
  198. package/dist/cdn/runtime/snice-runtime.min.js +18 -18
  199. package/dist/cdn/runtime/snice-runtime.min.js.map +1 -1
  200. package/dist/cdn/sankey/snice-sankey.js +1 -1
  201. package/dist/cdn/sankey/snice-sankey.min.js +1 -1
  202. package/dist/cdn/select/README.md +2 -2
  203. package/dist/cdn/select/snice-select.js +46 -92
  204. package/dist/cdn/select/snice-select.js.map +1 -1
  205. package/dist/cdn/select/snice-select.min.js +5 -13
  206. package/dist/cdn/select/snice-select.min.js.map +1 -1
  207. package/dist/cdn/skeleton/snice-skeleton.js +1 -1
  208. package/dist/cdn/skeleton/snice-skeleton.min.js +1 -1
  209. package/dist/cdn/slider/snice-slider.js +1 -1
  210. package/dist/cdn/slider/snice-slider.min.js +1 -1
  211. package/dist/cdn/sortable/snice-sortable.js +1 -1
  212. package/dist/cdn/sortable/snice-sortable.min.js +1 -1
  213. package/dist/cdn/sparkline/snice-sparkline.js +1 -1
  214. package/dist/cdn/sparkline/snice-sparkline.min.js +1 -1
  215. package/dist/cdn/spinner/snice-spinner.js +1 -1
  216. package/dist/cdn/spinner/snice-spinner.min.js +1 -1
  217. package/dist/cdn/split-pane/snice-split-pane.js +1 -1
  218. package/dist/cdn/split-pane/snice-split-pane.min.js +1 -1
  219. package/dist/cdn/spotlight/snice-spotlight.js +1 -1
  220. package/dist/cdn/spotlight/snice-spotlight.min.js +1 -1
  221. package/dist/cdn/spreadsheet/snice-spreadsheet.js +1 -1
  222. package/dist/cdn/spreadsheet/snice-spreadsheet.min.js +1 -1
  223. package/dist/cdn/stepper/snice-stepper.js +1 -1
  224. package/dist/cdn/stepper/snice-stepper.min.js +1 -1
  225. package/dist/cdn/switch/README.md +1 -1
  226. package/dist/cdn/switch/snice-switch.js +33 -23
  227. package/dist/cdn/switch/snice-switch.js.map +1 -1
  228. package/dist/cdn/switch/snice-switch.min.js +3 -3
  229. package/dist/cdn/switch/snice-switch.min.js.map +1 -1
  230. package/dist/cdn/table/README.md +2 -2
  231. package/dist/cdn/table/snice-table.js +2876 -111
  232. package/dist/cdn/table/snice-table.js.map +1 -1
  233. package/dist/cdn/table/snice-table.min.js +187 -47
  234. package/dist/cdn/table/snice-table.min.js.map +1 -1
  235. package/dist/cdn/tabs/snice-tabs.js +1 -1
  236. package/dist/cdn/tabs/snice-tabs.min.js +1 -1
  237. package/dist/cdn/tag-input/snice-tag-input.js +1 -1
  238. package/dist/cdn/tag-input/snice-tag-input.min.js +1 -1
  239. package/dist/cdn/terminal/snice-terminal.js +1 -1
  240. package/dist/cdn/terminal/snice-terminal.min.js +1 -1
  241. package/dist/cdn/testimonial/snice-testimonial.js +1 -1
  242. package/dist/cdn/testimonial/snice-testimonial.min.js +1 -1
  243. package/dist/cdn/textarea/snice-textarea.js +1 -1
  244. package/dist/cdn/textarea/snice-textarea.min.js +1 -1
  245. package/dist/cdn/time-range-picker/snice-time-range-picker.js +1 -1
  246. package/dist/cdn/time-range-picker/snice-time-range-picker.min.js +1 -1
  247. package/dist/cdn/timeline/snice-timeline.js +1 -1
  248. package/dist/cdn/timeline/snice-timeline.min.js +1 -1
  249. package/dist/cdn/timer/snice-timer.js +1 -1
  250. package/dist/cdn/timer/snice-timer.min.js +1 -1
  251. package/dist/cdn/toast/README.md +1 -1
  252. package/dist/cdn/toast/snice-toast.js +3 -3
  253. package/dist/cdn/toast/snice-toast.js.map +1 -1
  254. package/dist/cdn/toast/snice-toast.min.js +2 -2
  255. package/dist/cdn/toast/snice-toast.min.js.map +1 -1
  256. package/dist/cdn/tooltip/snice-tooltip.js +1 -1
  257. package/dist/cdn/tooltip/snice-tooltip.min.js +1 -1
  258. package/dist/cdn/tree/snice-tree.js +1 -1
  259. package/dist/cdn/tree/snice-tree.min.js +1 -1
  260. package/dist/cdn/treemap/snice-treemap.js +1 -1
  261. package/dist/cdn/treemap/snice-treemap.min.js +1 -1
  262. package/dist/cdn/video-player/snice-video-player.js +1 -1
  263. package/dist/cdn/video-player/snice-video-player.min.js +1 -1
  264. package/dist/cdn/virtual-scroller/snice-virtual-scroller.js +1 -1
  265. package/dist/cdn/virtual-scroller/snice-virtual-scroller.min.js +1 -1
  266. package/dist/cdn/waterfall/snice-waterfall.js +1 -1
  267. package/dist/cdn/waterfall/snice-waterfall.min.js +1 -1
  268. package/dist/cdn/weather/snice-weather.js +1 -1
  269. package/dist/cdn/weather/snice-weather.min.js +1 -1
  270. package/dist/components/book/snice-book.d.ts +2 -0
  271. package/dist/components/book/snice-book.js +28 -7
  272. package/dist/components/book/snice-book.js.map +1 -1
  273. package/dist/components/book/snice-book.types.d.ts +7 -0
  274. package/dist/components/code-block/snice-code-block.js +3 -3
  275. package/dist/components/code-block/snice-code-block.js.map +1 -1
  276. package/dist/components/code-block/snice-code-block.types.d.ts +3 -3
  277. package/dist/components/date-picker/snice-date-picker.d.ts +2 -0
  278. package/dist/components/date-picker/snice-date-picker.js +49 -39
  279. package/dist/components/date-picker/snice-date-picker.js.map +1 -1
  280. package/dist/components/doc/snice-doc.d.ts +20 -0
  281. package/dist/components/doc/snice-doc.js +220 -34
  282. package/dist/components/doc/snice-doc.js.map +1 -1
  283. package/dist/components/input/snice-input.d.ts +3 -0
  284. package/dist/components/input/snice-input.js +20 -2
  285. package/dist/components/input/snice-input.js.map +1 -1
  286. package/dist/components/input/snice-input.types.d.ts +3 -0
  287. package/dist/components/link-preview/snice-link-preview.js +1 -1
  288. package/dist/components/link-preview/snice-link-preview.js.map +1 -1
  289. package/dist/components/list/snice-list.js +3 -3
  290. package/dist/components/list/snice-list.js.map +1 -1
  291. package/dist/components/menu/snice-menu.js +1 -1
  292. package/dist/components/menu/snice-menu.js.map +1 -1
  293. package/dist/components/modal/snice-modal.d.ts +2 -0
  294. package/dist/components/modal/snice-modal.js +33 -17
  295. package/dist/components/modal/snice-modal.js.map +1 -1
  296. package/dist/components/modal/snice-modal.types.d.ts +2 -0
  297. package/dist/components/music-player/snice-music-player.d.ts +1 -0
  298. package/dist/components/music-player/snice-music-player.js +7 -0
  299. package/dist/components/music-player/snice-music-player.js.map +1 -1
  300. package/dist/components/notification-center/snice-notification-center.d.ts +1 -1
  301. package/dist/components/notification-center/snice-notification-center.js.map +1 -1
  302. package/dist/components/notification-center/snice-notification-center.types.d.ts +1 -0
  303. package/dist/components/radio/snice-radio.d.ts +1 -0
  304. package/dist/components/radio/snice-radio.js +22 -2
  305. package/dist/components/radio/snice-radio.js.map +1 -1
  306. package/dist/components/select/snice-select.d.ts +2 -4
  307. package/dist/components/select/snice-select.js +46 -92
  308. package/dist/components/select/snice-select.js.map +1 -1
  309. package/dist/components/switch/snice-switch.d.ts +2 -0
  310. package/dist/components/switch/snice-switch.js +32 -22
  311. package/dist/components/switch/snice-switch.js.map +1 -1
  312. package/dist/components/table/snice-table.d.ts +2 -0
  313. package/dist/components/table/snice-table.js +17 -3
  314. package/dist/components/table/snice-table.js.map +1 -1
  315. package/dist/components/toast/snice-toast-container.js +2 -2
  316. package/dist/components/toast/snice-toast-container.js.map +1 -1
  317. package/dist/index.cjs +512 -43
  318. package/dist/index.cjs.map +1 -1
  319. package/dist/index.d.ts +1 -0
  320. package/dist/index.esm.js +511 -44
  321. package/dist/index.esm.js.map +1 -1
  322. package/dist/index.iife.js +512 -43
  323. package/dist/index.iife.js.map +1 -1
  324. package/dist/symbols.cjs +1 -1
  325. package/dist/symbols.esm.js +1 -1
  326. package/dist/tooltip-observer.d.ts +11 -0
  327. package/dist/transitions.cjs +1 -1
  328. package/dist/transitions.esm.js +1 -1
  329. package/docs/ai/DEVELOPMENT.md +1 -1
  330. package/docs/ai/api.md +14 -10
  331. package/docs/ai/architecture.md +18 -5
  332. package/docs/ai/components/app-tiles.md +1 -1
  333. package/docs/ai/components/book.md +5 -6
  334. package/docs/ai/components/camera-annotate.md +3 -3
  335. package/docs/ai/components/candlestick.md +3 -3
  336. package/docs/ai/components/chart.md +1 -1
  337. package/docs/ai/components/code-block.md +3 -3
  338. package/docs/ai/components/doc.md +26 -15
  339. package/docs/ai/components/file-gallery.md +1 -1
  340. package/docs/ai/components/input.md +10 -0
  341. package/docs/ai/components/link-preview.md +1 -1
  342. package/docs/ai/components/list.md +2 -2
  343. package/docs/ai/components/markdown.md +13 -6
  344. package/docs/ai/components/modal.md +2 -0
  345. package/docs/ai/components/music-player.md +3 -2
  346. package/docs/ai/components/network-graph.md +5 -5
  347. package/docs/ai/components/notification-center.md +1 -0
  348. package/docs/ai/components/pdf-viewer.md +1 -1
  349. package/docs/ai/components/radio.md +2 -2
  350. package/docs/ai/components/sankey.md +3 -3
  351. package/docs/ai/components/select.md +1 -1
  352. package/docs/ai/components/tooltip.md +54 -0
  353. package/docs/ai/decorators.md +4 -4
  354. package/docs/code-block.md +4 -4
  355. package/docs/components/app-tiles.md +1 -1
  356. package/docs/components/book.md +3 -4
  357. package/docs/components/button.md +2 -2
  358. package/docs/components/camera-annotate.md +6 -6
  359. package/docs/components/candlestick.md +6 -6
  360. package/docs/components/chart.md +4 -6
  361. package/docs/components/checkbox.md +3 -3
  362. package/docs/components/chip.md +4 -4
  363. package/docs/components/code-block.md +4 -3
  364. package/docs/components/doc.md +99 -58
  365. package/docs/components/file-gallery.md +25 -3
  366. package/docs/components/input.md +20 -0
  367. package/docs/components/kpi.md +2 -3
  368. package/docs/components/link-preview.md +2 -2
  369. package/docs/components/list.md +3 -3
  370. package/docs/components/markdown.md +14 -36
  371. package/docs/components/modal.md +2 -0
  372. package/docs/components/music-player.md +3 -2
  373. package/docs/components/network-graph.md +7 -7
  374. package/docs/components/notification-center.md +1 -0
  375. package/docs/components/pdf-viewer.md +1 -1
  376. package/docs/components/sankey.md +6 -6
  377. package/docs/components/switch.md +1 -1
  378. package/docs/components/table.md +2 -2
  379. package/docs/components/tooltip.md +133 -0
  380. package/docs/controllers.md +3 -14
  381. package/docs/elements.md +0 -1
  382. package/docs/events.md +3 -0
  383. package/docs/request-response.md +2 -0
  384. package/package.json +1 -1
@@ -1,26 +1,26 @@
1
1
  /*!
2
- * snice v4.13.0
2
+ * snice v4.15.0
3
3
  * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
4
4
  * (c) 2024
5
5
  * Released under the MIT License.
6
6
  */
7
7
  /*!
8
- * snice v4.13.0
8
+ * snice v4.15.0
9
9
  * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
10
10
  * (c) 2024
11
11
  * Released under the MIT License.
12
12
  */
13
- globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const t=globalThis.snice;function e(e){return t.symbols.has(e)||t.symbols.set(e,Symbol.for(`snice:${e}`)),t.symbols.get(e)}const n=e("is-controller-class"),o=e("is-controller-instance"),s=e("is-element-class"),r=e("channel-handlers"),i=e("ready-promise"),a=e("ready-resolve");e("rendered-promise"),e("rendered-resolve");const l=e("controller"),c=e("initialized");e("on-handlers");const u=e("controller-key"),h=e("controller-name"),d=e("controller-id"),m=e("controller-operations"),f=e("native-controller"),p=e("cleanup"),y=e("properties"),g=e("property-values"),b=e("pre-init-property-values"),w=e("properties-initialized"),v=e("property-watchers"),T=e("explicitly-set-properties"),S=e("router-context");e("current-page-marker"),e("context-request-handler");const N=e("page-transition"),E=e("created-at"),A=e("ready-handlers"),_=e("dispose-handlers"),x=e("moved-handlers"),C=e("adopted-handlers"),O=e("observers");e("parts"),e("part-timers");const k=e("moved-timers"),L=e("adopted-timers"),$=e("dispatch-timers"),P=e("render-method"),M=e("render-options"),I=e("render-instance"),R=e("render-scheduled"),D=e("render-timers"),q=e("render-callbacks"),F=e("styles-method"),V=e("styles-applied"),j=e("context-handler");e("context-method-name");const z=e("navigation-context-instance"),B=e("registered-elements"),W=e("is-updating"),U=e("context-register"),H=e("context-unregister"),G=e("context-notify-element");e("context-options");const K=e("context-timer"),J=e("context-called"),Q=e("context-update"),X=new Map,Y=new WeakMap;function Z(t,e,n){let o,s;return"string"==typeof e?(o=e,s=n):(o=void 0,s=e),function(e,n){const r=n.name,i=`__observe_init_${r}`;n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[O]||(n[O]=[]);const a=Array.isArray(t)?t:[t];for(const t of a){const[i,...a]=t.split(":"),l=a.join(":");n[O].push({type:i,target:l,selector:o,methodName:r,method:e,options:s})}})}}function tt(t,e){const n=t.constructor[O];if(n&&Array.isArray(n)&&0!==n.length){t[p]?t[p].observers||(t[p].observers=[]):t[p]={events:[],channels:[],observers:[]};for(const o of n){const n=o.method.bind(t),s=o.options?.throttle?rt(n,o.options.throttle):n;switch(o.type){case"intersection":et(t,e,o,s);break;case"resize":nt(t,e,o,s);break;case"media":ot(t,e,o,s);break;case"mutation":st(t,e,o,s);break;default:console.warn(`Unknown observer type: ${o.type}`)}}}}function et(t,e,n,o){const s={threshold:n.options?.threshold??0,rootMargin:n.options?.rootMargin??"0px",root:n.options?.root??null},r=JSON.stringify(s),i=t=>{for(const e of t)try{!1===o(e)&&a&&a.unobserve(e.target)}catch(t){console.error(`Error in intersection observer ${n.methodName}:`,t)}};if("undefined"==typeof IntersectionObserver)return void console.warn("IntersectionObserver is not available in this environment");let a=Y.get({instance:t,options:r});a||(a=new IntersectionObserver(i,s),Y.set({instance:t,options:r},a));const l=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];l.forEach(t=>a.observe(t)),t[p].observers.push(()=>{l.forEach(t=>a.unobserve(t)),0===a.takeRecords().length&&a.disconnect()})}function nt(t,e,n,o){const s=n.options?.box||"content-box";if("undefined"==typeof ResizeObserver)return void console.warn("ResizeObserver is not available in this environment");const r=new ResizeObserver(t=>{for(const e of t)try{o(e)}catch(t){console.error(`Error in resize observer ${n.methodName}:`,t)}});(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e]).forEach(t=>{r.observe(t,{box:s})}),t[p].observers.push(()=>{r.disconnect()})}function ot(t,e,n,o){const s=n.target;if(!s)return void console.warn("Media query observer requires a query string");let r=X.get(s);if(!r)try{r=window.matchMedia(s),X.set(s,r)}catch(t){return void console.error(`Invalid media query: ${s}`,t)}const i=t=>{try{o(t.matches)}catch(t){console.error(`Error in media query observer ${n.methodName}:`,t)}};i(r);const a=t=>i(t);r.addEventListener?(r.addEventListener("change",a),t[p].observers.push(()=>{r.removeEventListener("change",a)})):(r.addListener(a),t[p].observers.push(()=>{r.removeListener(a)}))}function st(t,e,n,s){const r=n.target.split(":"),i=r[0]||"childList",a=r[1],l={};switch(i){case"childList":l.childList=!0;break;case"attributes":l.attributes=!0,a&&(l.attributeFilter=[a]);break;default:return void console.warn(`Unknown mutation type: ${i}`)}n.options?.subtree&&(l.subtree=!0,n.options.maxDepth&&console.warn("maxDepth is set but requires custom implementation"));const c=new MutationObserver(t=>{try{if(n.options?.maxDepth&&n.options.subtree){const o=n.options.maxDepth,r=t.filter(t=>{let n=0,s=t.target;const r=e.shadowRoot||e;for(;s&&s!==r&&n<o;)s=s.parentNode,n++;return n<o});r.length>0&&s(r)}else s(t)}catch(t){console.error(`Error in mutation observer ${n.methodName}:`,t)}}),u=!0===t[o];(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):u&&e.shadowRoot?[e.shadowRoot]:[e]).forEach(t=>{c.observe(t,l)}),t[p].observers.push(()=>{c.disconnect()})}function rt(t,e){let n=0,o=null;return function(...s){const r=Date.now(),i=e-(r-n);if(i<=0)return o&&(clearTimeout(o),o=null),n=r,t.apply(this,s);o||(o=setTimeout(()=>{n=Date.now(),o=null,t.apply(this,s)},i))}}function it(t){if(t[p]?.observers){for(const e of t[p].observers)e();t[p].observers=[]}}function at(t,e){return function(n,s){let r,i,a=0;return async function(...s){const l=async()=>{const r=e?.timeout??12e4,i=e?.discoveryTimeout??50,a=n.apply(this,s),{value:l,done:c}=await a.next();if(c)return l;let u,h;const d=new Promise((t,e)=>{u=t,h=e});let m,f,p;const y=new Promise((e,n)=>{m=e,f=n,p=setTimeout(()=>{n(new Error(`Request "${t}" timed out after ${i}ms - no handler found`))},i)}),g=new CustomEvent(`@request/${t}`,{bubbles:void 0===e?.bubbles||e.bubbles,cancelable:e?.cancelable||!1,composed:!0,detail:{payload:l,discovery:{resolve:()=>{clearTimeout(p),m()},reject:f},data:{resolve:u,reject:h}}});(!0===this[o]&&this.element?this.element:this).dispatchEvent(g);try{await y;const e=setTimeout(()=>{h(new Error(`Request "${t}" timed out after ${r}ms`))},r),n=await d;clearTimeout(e);const{value:o}=await a.next(n);return o}catch(t){try{await a.throw(t)}catch(t){throw t}}};if(e?.debounce)return new Promise((t,n)=>{clearTimeout(r),r=setTimeout(async()=>{try{const e=await l();t(e)}catch(t){n(t)}},e.debounce)});if(e?.throttle){const t=Date.now(),n=e.throttle-(t-a);return n<=0?(clearTimeout(i),a=t,l()):i?Promise.resolve():new Promise((t,e)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{const e=await l();t(e)}catch(t){e(t)}},n)})}return l()}}}function lt(t,e){return function(n,o){const s=o.name,i=`__respond_init_${t}_${s}`;o.addInitializer(function(){const o=this.constructor;o[i]||(o[i]=!0,o[r]||(o[r]=[]),o[r].push({channelName:t,methodName:s,method:n,options:e}))})}}function ct(t,e){const n=t.constructor[r];if(n){t[p]||(t[p]={events:[],channels:[]});for(const o of n){const n=o.method.bind(t),s=`@request/${o.channelName}`;let r,i,a=0;const l=(t=>o.options?.debounce?(...e)=>new Promise((n,s)=>{clearTimeout(r),r=setTimeout(async()=>{try{const o=await t(...e);n(o)}catch(t){s(t)}},o.options.debounce)}):o.options?.throttle?(...e)=>{const n=Date.now(),s=o.options.throttle-(n-a);return s<=0?(clearTimeout(i),a=n,t(...e)):i?Promise.resolve(void 0):new Promise((n,o)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{const o=await t(...e);n(o)}catch(t){o(t)}},s)})}:t)(n),c=t=>{const{data:e,discovery:n,payload:s}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(l(s)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${o.methodName}:`,t)})};e.addEventListener(s,c),t[p].channels.push(()=>{e.removeEventListener(s,c)})}}}function ut(t){if(t[p]?.channels){for(const e of t[p].channels)e();t[p].channels=[]}}const ht=Symbol.for("snice:html-result"),dt=Symbol.for("snice:css-result");function mt(t,...e){return{_$litType$:ht,strings:t,values:e}}function ft(t,...e){let n=t[0];for(let o=0;o<e.length;o++)n+=String(e[o])+t[o+1];const o={_$litType$:dt,cssText:n};if("undefined"!=typeof CSSStyleSheet&&"adoptedStyleSheets"in Document.prototype)try{const t=new CSSStyleSheet;t.replaceSync(n),o.styleSheet=t}catch(t){}return o}function pt(t){return t&&t._$litType$===ht}const yt=Symbol.for("snice:nothing"),gt=Symbol.for("snice:unsafe-html");function bt(t){return{_$litType$:gt,html:t}}const wt=`snice$${Math.random().toFixed(9).slice(2)}$`,vt="?"+wt,Tt=`<${vt}>`,St=new RegExp(wt,"g"),Nt=new WeakMap,Et=Symbol("not-committed"),At=Symbol.for("snice:no-change"),_t=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class xt{constructor(t,e,n){this.parts=[],this.element=e;const o=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let s=0;const r=[];let i;for(;null!==(i=o.nextNode());)if(i.nodeType===Node.ELEMENT_NODE){const t=i,e=t.tagName.toLowerCase();if("if"===e){const e=t.getAttribute("value");e&&e.includes(wt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:s++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(wt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:s++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,o=[];for(let r=0;r<e.length;r++){const i=e[r],a=i.value;if(a.includes(wt)){o.push(i);const e=n[s]||i.name,r=a.split(wt),l=r.length-1;e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:s,name:e.slice(1),element:t}),s+=1):e.startsWith(".")?(this.parts.push({type:"property",index:s,name:e.slice(1),element:t}),s+=1):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:s,name:e.slice(1),element:t}),s+=1):(this.parts.push({type:"attribute",index:s,name:i.name,element:t,attrStrings:r}),s+=l)}}for(const e of o)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===vt){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:s++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(wt)){const n=t.parentNode,o=e.split(St),i=o.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(o[e]),t);const r=document.createComment(""),i=document.createComment("");n.insertBefore(r,t),n.insertBefore(i,t),this.parts.push({type:"node",index:s++,startNode:r,endNode:i})}""!==o[i]?t.data=o[i]:r.push(t)}}for(const t of r)t.parentNode?.removeChild(t)}}class Ct{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=Nt.get(e);if(n)return n;const o=[],s=[];let r=!1,i=!1,a="",l="";for(let t=0;t<e.length;t++){const n=e[t];if(o.push(n),t<e.length-1){for(let t=0;t<n.length;t++){const e=n[t];if(r){if(i)e===a&&(i=!1,a="");else if(">"===e)r=!1;else if('"'===e||"'"===e)i=!0,a=e;else if("="===e){let e=t-1;for(;e>=0&&/[\w\-\.@\?]/.test(n[e]);)e--;l=n.substring(e+1,t).trim()}}else"<"===e&&(r=!0)}if(i)s.push(l),o.push(wt);else if(r){const t=n.trimEnd();if(t.endsWith("=")){let e=t.length-2;for(;e>=0&&/[\w\-\.@\?\/]/.test(t[e]);)e--;l=t.substring(e+1,t.length-1).trim(),s.push(l),o.push(wt)}else n.match(/<(if|case)\s*$/)?(l="value",s.push("value"),o.push(`value="${wt}"`)):(s.push(""),o.push(wt))}else s.push(""),o.push(Tt)}}const c=o.join(""),u=document.createElement("template");u.innerHTML=c;const h=new xt(t,u,s);return Nt.set(e,h),h}(t),this.strings=t.strings}isSameTemplate(t){return this.strings===t}renderFragment(){if(!this.fragment){this.fragment=this.template.element.content.cloneNode(!0);const t=document.createTreeWalker(this.template.element.content,NodeFilter.SHOW_ALL),e=document.createTreeWalker(this.fragment,NodeFilter.SHOW_ALL),n=new Map;let o=t.currentNode,s=e.currentNode;for(;o&&s;)n.set(o,s),o=t.nextNode(),s=e.nextNode();for(let t=0;t<this.template.parts.length;t++){const e=this.template.parts[t];let o;switch(e.type){case"node":const t=n.get(e.startNode),s=n.get(e.endNode);o=new kt(t,s);break;case"attribute":const r=n.get(e.element);o=new Lt(r,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);o=new $t(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);o=new Pt(a,e.name);break;case"event":const l=n.get(e.element);o=new Mt(l,e.name);break;case"conditional-if":const c=n.get(e.element);o=new Ft(c);break;case"conditional-case":const u=n.get(e.element);o=new Vt(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(o),o instanceof Ft||o instanceof Vt?this.conditionalParts.push({part:o,index:e.index}):this.regularParts.push({part:o,index:e.index})}}return this.fragment}render(t){const e=this.renderFragment();return this.update(t),e}update(t){for(const{part:e,index:n}of this.conditionalParts)e.commit(t[n]);for(const{part:e,index:n}of this.regularParts)e instanceof Lt&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class Ot{}class kt extends Ot{constructor(t,e){super(),this._committedValue=Et,this.startNode=t,this.endNode=e}commit(t){if(t!==At)return t===yt||null==t||""===t?(this._committedValue!==yt&&this._clear(),void(this._committedValue=yt)):void(_t(t)?t!==this._committedValue&&this._commitText(t):pt(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===gt}(t)?void 0===t.nodeType?(t=>Array.isArray(t)||"function"==typeof t?.[Symbol.iterator])(t)?this._commitIterable(t):this._commitText(t):this._commitNode(t):this._commitUnsafeHTML(t))}_commitText(t){if(this._committedValue!==Et&&this._committedValue!==yt&&_t(this._committedValue)&&!Array.isArray(this._committedValue)){const e=this.startNode.nextSibling;if(e&&e.nodeType===Node.TEXT_NODE)return e.data=String(t),void(this._committedValue=t)}this._clear();const e=document.createTextNode(String(t));this._insertBefore(e),this._committedValue=t}_commitTemplateResult(t){const e=this._committedValue;if(e instanceof Ct){const n=Nt.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new Ct(t),o=n.renderFragment();this._insertBefore(o),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof kt||(this._clear(),this._committedValue=[]);const e=this._committedValue;let n=0;for(const o of t){let t;if(n>=e.length){const n=document.createComment(""),o=document.createComment("");this._insertBefore(n),this._insertBefore(o),t=new kt(n,o),e.push(t)}else t=e[n];t.commit(o),n++}if(n<e.length){for(let t=n;t<e.length;t++){const n=e[t];n._clear(),n.startNode.remove(),n.endNode.remove()}e.length=n}}_commitNode(t){this._committedValue!==t&&(this._clear(),this._insertBefore(t),this._committedValue=t)}_commitUnsafeHTML(t){this._clear();const e=document.createElement("template");e.innerHTML=t.html,this._insertBefore(e.content),this._committedValue=t}_insertBefore(t){this.endNode.parentNode?.insertBefore(t,this.endNode)}_clear(){const t=this.startNode.parentNode;if(!t)return;let e=this.startNode.nextSibling;for(;e&&e!==this.endNode;){const n=e.nextSibling;t.removeChild(e),e=n}this._committedValue=yt}clear(){this._clear()}}class Lt extends Ot{constructor(t,e,n){super(),this._committedValue=Et,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(Et),this.strings=n):this._committedValue=Et}commit(t,e=0){let n,o=!1;if(void 0===this.strings){if(t===At)return;if(o=!_t(t)||t!==this._committedValue&&t!==At,!o)return;this._committedValue=t,n=t}else{const s=t,r=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=s[e+t];i===At&&(i=r[t]),o=o||!_t(i)||i!==r[t],i===yt?n=yt:n!==yt&&(n=n+(i??"")+this.strings[t+1]),r[t]=i}if(!o)return}this._commitValue(n)}_commitValue(t){t===yt||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class $t extends Ot{constructor(t,e){super(),this._committedValue=Et,this.element=t,this.name=e}commit(t){t!==At&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===yt?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=Et}}class Pt extends Ot{constructor(t,e){super(),this._committedValue=Et,this.element=t,this.name=e}commit(t){if(t===At)return;const e=!!t&&t!==yt;e!==this._committedValue&&(this._committedValue=e,e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name))}clear(){this.element.removeAttribute(this.name),this._committedValue=Et}}class Mt extends Ot{constructor(t,e){super(),this.listener=null,this.value=void 0,this.keyFilter=null,this.host=null,this.element=t;const n=["keydown","keyup","keypress"].includes(e.split(".")[0].split(":")[0]),o=e.indexOf("."),s=n?e.indexOf(":"):-1,r=o>0&&s>0?Math.min(o,s):Math.max(o,s);if(r>0){const t=e.substring(0,r),n=e.substring(r+1);this.eventName=t,this.keyFilter=It(n)}else this.eventName=e}commit(t){if(t!==At&&(t===yt&&(t=null),(t!==this.value||null==t)&&(this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null),this.value=t,null!=t&&"function"==typeof t))){if(!this.host){const t=this.element.getRootNode();this.host=t.host||null}if(this.host){const e=this.host;this.listener=n=>{this.keyFilter&&!Dt(n,this.keyFilter)||t.call(e,n)}}else this.listener=e=>{this.keyFilter&&!Dt(e,this.keyFilter)||t.call(null,e)};this.element.addEventListener(this.eventName,this.listener)}}clear(){this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null)}}function It(t){const e=t.startsWith("~");e&&(t=t.substring(1));const n=t.split("+"),o={key:"",anyModifiers:e};for(const t of n){const e=t.toLowerCase();"ctrl"===e||"control"===e?o.ctrl=!0:"alt"===e?o.alt=!0:"shift"===e?o.shift=!0:"meta"===e||"cmd"===e||"command"===e?o.meta=!0:o.key=Rt(t)}return o}function Rt(t){return{esc:"Escape",escape:"Escape",enter:"Enter",return:"Enter",space:" ",spacebar:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight",delete:"Delete",del:"Delete",backspace:"Backspace",tab:"Tab",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"}[t.toLowerCase()]||t}function Dt(t,e){if(t.key!==e.key)return!1;if(e.anyModifiers)return!0;const n=e.ctrl?t.ctrlKey:!t.ctrlKey,o=e.alt?t.altKey:!t.altKey,s=e.shift?t.shiftKey:!t.shiftKey,r=e.meta?t.metaKey:!t.metaKey;return n&&o&&s&&r}const qt=Symbol("not-set");class Ft extends Ot{constructor(t){super(),this.value=qt,this.fragment=null,this.ifElement=t,this.ifElement.style.display="contents"}commit(t){const e=Boolean(t);if(this.value!==t)if(this.value=t,e)this.fragment&&this.fragment.hasChildNodes()&&this.ifElement.appendChild(this.fragment);else for(this.fragment||(this.fragment=document.createDocumentFragment());this.ifElement.firstChild;)this.fragment.appendChild(this.ifElement.firstChild)}clear(){for(this.fragment||(this.fragment=document.createDocumentFragment());this.ifElement.firstChild;)this.fragment.appendChild(this.ifElement.firstChild)}}class Vt extends Ot{constructor(t){super(),this.value=qt,this.childrenMap=new Map,this.fragments=new Map,this.defaultChild=null,this.currentChild=null,this.caseElement=t;for(const t of Array.from(this.caseElement.children)){const e=t.tagName.toLowerCase();if("when"===e){const e=t.getAttribute("value")||"";this.childrenMap.set(e,t);const n=document.createDocumentFragment();n.appendChild(t),this.fragments.set(t,n)}else if("default"===e){this.defaultChild=t;const e=document.createDocumentFragment();e.appendChild(t),this.fragments.set(t,e)}}}commit(t){if(this.value===t)return;this.value=t;const e=String(t);if(this.currentChild){const t=this.fragments.get(this.currentChild);t&&!t.hasChildNodes()&&t.appendChild(this.currentChild)}const n=this.childrenMap.get(e)||this.defaultChild;if(n){const t=this.fragments.get(n);t&&t.hasChildNodes()&&this.caseElement.appendChild(t),this.currentChild=n}}clear(){if(this.currentChild){const t=this.fragments.get(this.currentChild);t&&!t.hasChildNodes()&&t.appendChild(this.currentChild),this.currentChild=null}}}const jt=e("on-handlers");function zt(t,e,n){let o=null,s={};return"string"==typeof e?(o=e,s=n||{}):null===e&&n?s=n:e&&"object"==typeof e&&(s=e),function(e,n){const r=n.name,i=`__on_init_${r}_${o||""}_${JSON.stringify(t)}`;return n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[jt]||(n[jt]=[]);const a=Array.isArray(t)?t:[t];for(const t of a)n[jt].push({eventName:t,selector:o,methodName:r,method:e,options:s})}),e}}function Bt(t,e){let n=null;return function(...o){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,o),n=null},e)}}function Wt(t,e){let n=0;return function(...o){const s=Date.now();s-n>=e&&(n=s,t.apply(this,o))}}const Ut=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Ht(t,e){const n=t.constructor[jt];if(n&&Array.isArray(n)&&0!==n.length){t[p]?t[p].events?t[p].events.length>0&&Gt(t):t[p].events=[]:t[p]={events:[],channels:[],observers:[]};for(const o of n){const n=t[o.methodName];let s=n?n.bind(t):o.method.bind(t);const r=o.options||{},i=["keydown","keyup","keypress"].includes(o.eventName.split(".")[0].split(":")[0]),a=o.eventName.indexOf("."),l=i?o.eventName.indexOf(":"):-1,c=a>0&&l>0?Math.min(a,l):Math.max(a,l),u=c>0?o.eventName.substring(0,c):o.eventName,h=c>0?o.eventName.substring(c+1):null;r.debounce&&r.debounce>0?s=Bt(s,r.debounce):r.throttle&&r.throttle>0&&(s=Wt(s,r.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=It(h));const m=(t=>d?e=>{Dt(e,d)&&t(e)}:t)(s);if(o.selector){const n=e.shadowRoot||e,s=t=>{const e=t.target;let n=null;if(e.matches&&e.matches(o.selector)?n=e:e.closest&&(n=e.closest(o.selector)),n){r.preventDefault&&t.preventDefault(),r.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},i=Ut.has(u),a={capture:void 0!==r.capture?r.capture:i,once:r.once||!1,passive:r.passive||!1};n.addEventListener(u,s,a),t[p].events.push({target:n,eventName:u,handler:s,options:a})}else{const n=e.shadowRoot,s=Symbol.for(`snice:event-handled:${o.methodName}`),i=t=>{if(!t[s]){t[s]=!0;try{r.preventDefault&&t.preventDefault(),r.stopPropagation&&t.stopPropagation(),m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},a={capture:r.capture||!1,once:r.once||!1,passive:r.passive||!1};n&&(n.addEventListener(u,i,a),t[p].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[p].events.push({target:e,eventName:u,handler:i,options:a})}}}}function Gt(t){if(t[p]?.events){for(const{target:e,eventName:n,handler:o,options:s}of t[p].events)e.removeEventListener(n,o,s);t[p].events=[]}}class Kt{constructor(){this.cleanupFns=new Map,this.pendingOperations=new Set}register(t,e){this.cleanupFns.set(t,e)}unregister(t){this.cleanupFns.delete(t)}async cleanup(){await Promise.all(this.pendingOperations);for(const t of this.cleanupFns.values())try{await t()}catch(t){console.error("Error during cleanup:",t)}this.cleanupFns.clear()}async runOperation(t){const e=t(),n=e.then(()=>{},()=>{});this.pendingOperations.add(n);try{const t=await e;return this.pendingOperations.delete(n),t}catch(t){throw this.pendingOperations.delete(n),t}}}function Jt(t){return function(e,o){const s=globalThis.snice?.controllerRegistry;if(!s)throw new Error("Snice global registry not initialized");return s.set(t,e),e.prototype[n]=!0,e}}async function Qt(e,n){const s=e[u],r=e[h],i=e[f];if(void 0!==i&&i!==n)return;if(r===n&&s)return;s&&await Xt(e);const a=globalThis.snice?.controllerRegistry;if(!a)throw new Error("Snice global registry not initialized");const l=a.get(n);if(!l)throw console.error(`Controller "${n}" not found. Available:`,Array.from(a.keys())),new Error(`Controller "${n}" not found in registry`);const c=new l;t.controllerIdCounter+=1;const p=t.controllerIdCounter,y=new Kt;c[o]=!0,c[d]=p,c.element=e;const g=e[S];void 0!==g&&(c[S]=g),e[u]=c,e[h]=n,e[m]=y,await e.ready,await y.runOperation(async()=>{await c.attach(e)}),tt(c,e),ct(c,e),Ht(c,e),e.dispatchEvent(new CustomEvent("@snice/controller-attached",{detail:{name:n,controller:c}}))}async function Xt(t){const e=t[u],n=t[h],o=t[m];e&&(o?await o.runOperation(async()=>{await e.detach(t)}):await e.detach(t),e.element=null,it(e),ut(e),Gt(e),o&&await o.cleanup(),delete e[S],delete t[u],delete t[h],delete t[m],t.dispatchEvent(new CustomEvent("@snice/controller-detached",{detail:{name:n,controller:e}})))}function Yt(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(t.tagName.includes("-"))return;if(t[s])return;const e=t.getAttribute("controller"),n=t[f];e&&e!==n?(t[f]=e,t.ready||(t.ready=Promise.resolve()),n&&Xt(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),Qt(t,e).catch(t=>{console.error(`Failed to attach controller "${e}" to native element:`,t)})):!e&&n&&(delete t[f],delete t[h],Xt(t).catch(t=>{console.error("Failed to detach controller from native element:",t)}))}globalThis.sniceNativeControllersInitialized=!0;const e=new MutationObserver(e=>{for(const n of e)"attributes"===n.type&&"controller"===n.attributeName?t(n.target):"childList"===n.type&&n.addedNodes.forEach(e=>{e instanceof HTMLElement&&(t(e),e.querySelectorAll('[controller]:not([class*="-"])').forEach(t))})});"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[controller]:not([class*="-"])').forEach(t),e.observe(document.body,{attributes:!0,attributeFilter:["controller"],childList:!0,subtree:!0})}):(document.querySelectorAll('[controller]:not([class*="-"])').forEach(t),e.observe(document.body,{attributes:!0,attributeFilter:["controller"],childList:!0,subtree:!0})),globalThis.sniceNativeControllerObserver=e}const Zt=e("context-handlers");function te(t={}){return function(e,n){const o=n.name,s=`__context_init_${o}`;return n.addInitializer(function(){const n=this.constructor;n[s]||(n[s]=!0,n[Zt]||(n[Zt]=[]),n[Zt].push({methodName:o,method:e,options:t}))}),e}}function ee(t){const e=t.constructor[Zt];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[j];if(n){t[z]=n;for(const o of e){const{methodName:e,method:s,options:r}=o,i=`__wrapped_${e}`;t[i]=function(e){if(r.once&&t[J])return;const n=()=>{if(s.call(t,e),r.once){t[J]=!0;const e=t[z];e&&"function"==typeof e[H]&&e[H](t)}};if(r.debounce)clearTimeout(t[K]),t[K]=setTimeout(n,r.debounce);else if(r.throttle){const e=Date.now();e-(t[K]||0)>=r.throttle&&(t[K]=e,n())}else n()},"function"==typeof n[U]&&n[U](t,i)}}}class ne{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(ne.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${ne.SEPARATOR}" (U+FF0C)`);return t}if("number"==typeof t||"boolean"==typeof t)return String(t);throw new Error("SimpleArray only supports string, number, and boolean types. Got: "+typeof t)}).join(ne.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(ne.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var oe,se,re;const ie=Symbol.for("snice:registered-elements-set");let ae=0;class le{constructor(t={},e=[],n="",o={},s){if(this[oe]=new WeakMap,this[se]=new Set,this[re]=!1,this.id=ae++,this.application=t,this.navigation={placards:e,route:n,params:o},s&&"function"==typeof s.create)this.fetch=s.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(oe=B,se=ie,re=W,U)](t,e){this[B].set(t,e),this[ie].add(t)}[H](t){this[B].delete(t),this[ie].delete(t)}[Q](t,e,n,o){this.application=t,this.navigation.placards=e,this.navigation.route=n,this.navigation.params=o,this.notify()}update(){this.notify()}notify(){if(this[W])return;this[W]=!0;const t=this[ie],e=this[B];for(const n of t){const t=e.get(n);if(t&&"function"==typeof n[t])try{n[t](this)}catch(e){console.error(`Error calling @context method ${t}:`,e)}}this[W]=!1}[G](t){const e=this[B].get(t);e&&"function"==typeof t[e]&&t[e](this)}}function ce(t){if(null!=t)return"string"==typeof t?String:"number"==typeof t?Number:"boolean"==typeof t?Boolean:t instanceof Date?Date:"bigint"==typeof t?BigInt:Array.isArray(t)?Array:void 0}function ue(t,e,n,o){switch(e.type||ce(o)){case Boolean:return null!==t&&"false"!==t;case Number:return null!==t?Number(t):null;case String:return t;case Date:return t?new Date(t):null;case BigInt:return t&&t.endsWith("n")?BigInt(t.slice(0,-1)):t?BigInt(t):null;case ne:return ne.parse(t);case Array:try{return t?JSON.parse(t):[]}catch{return[]}case Object:try{return t?JSON.parse(t):{}}catch{return{}}default:return"number"==typeof n&&null!==t?Number(t):t}}const he=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?de(t,e):(this.pending.add(t),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush())))}flush(){const t=Array.from(this.pending);this.pending.clear(),this.scheduled=!1;for(const e of t){de(e,e[M]||{})}}};function de(t,e,n){const o=t[P];if(o&&(!e.once||!t[I]))try{const s=void 0!==n?n:o.call(t);if(!(!1!==e.differential)){if("string"!=typeof s)return void console.warn("Render method with differential: false must return a string");t.shadowRoot||t.attachShadow({mode:"open"}),t.shadowRoot.innerHTML=s,t[R]=!1;const e=t[q];if(e&&e.length>0){const n=[...e];t[q]=[],n.forEach(t=>t())}return}if(!pt(s))return void console.warn("Render method must return html`` template result");let r=t[I];if(t.shadowRoot||t.attachShadow({mode:"open"}),r&&r.isSameTemplate(s.strings))r.update(s.values);else{r&&(t.shadowRoot.innerHTML=""),r=new Ct(s),t[I]=r;const e=r.renderFragment();t.shadowRoot.appendChild(e),r.update(s.values)}t[R]=!1;const i=t[q];if(i&&i.length>0){const e=[...i];t[q]=[],e.forEach(t=>t())}}catch(t){console.error("Error rendering element:",t)}}function me(t,e=!1){const n=t[M]||{};if(!n.once||!t[I])if(e)de(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[D]||(t[D]={}),clearTimeout(t[D].debounce),void(t[D].debounce=setTimeout(()=>{he.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[D]||(t[D]={lastThrottle:0});const e=t[D],o=Date.now();if(0===e.lastThrottle||o-e.lastThrottle>=n.throttle)e.lastThrottle=o,he.schedule(t,n);else if(!e.throttleTimer){const s=n.throttle-(o-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),he.schedule(t,n)},s)}return}he.schedule(t,n)}}function fe(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[P]=e,this[M]=t}),function(...t){const n=e.apply(this,t);return de(this,{},n),n}}}function pe(){return function(t,e){return e.addInitializer(function(){this[F]=t}),t}}function ye(t){const e=t[F];if(e&&!t[V]){t[V]=!0;try{const o=e.call(t);if(!(n=o)||n._$litType$!==dt)return void console.warn("Styles method must return css`` template result");t.shadowRoot||t.attachShadow({mode:"open"});const s=new CSSStyleSheet;if(s.replaceSync("if, case { display: contents; }"),t.shadowRoot&&o.styleSheet&&"adoptedStyleSheets"in t.shadowRoot)t.shadowRoot.adoptedStyleSheets=[s,o.styleSheet];else if(t.shadowRoot){const e=document.createElement("style");e.textContent="if, case { display: contents; }\n"+o.cssText,t.shadowRoot.appendChild(e)}}catch(t){console.error("Error applying styles:",t)}var n}}function ge(t){t.prototype[s]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,o=t.prototype.attributeChangedCallback,r=t.observedAttributes||[];r.includes("controller")||r.push("controller");const u=t[y];if(u)for(const[t,e]of u){const n="string"==typeof e.attribute?e.attribute:t.toLowerCase();r.includes(n)||r.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>r,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[i]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[l]},set(t){const e=this[l];this[l]=t,t!==e&&t?Qt(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):!t&&e&&Xt(this).catch(t=>{console.error("Failed to detach controller:",t)})},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[c]){Ht(this,this),ct(this,this),ee(this);try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName} on reconnection:`,t)}return void(e&&e.call(this))}try{this[w]=!0;const n=t[y];if(n)for(const[t,e]of n){const n="string"==typeof e.attribute?e.attribute:t.toLowerCase();if(this.hasAttribute(n)){const o=this.getAttribute(n);this[T]||(this[T]=new Set),this[T].add(t),e.type===Boolean&&""===o&&this.setAttribute(n,"true"),this[t]=ue(o,e)}}if(this[b]){for(const[t,e]of Array.from(this[b].entries())){const o=n?.get(t),s="string"==typeof o?.attribute?o.attribute:t.toLowerCase();this.hasAttribute(s)?this[b].delete(t):(this[b].delete(t),this[t]=e)}delete this[b]}if(ye(this),this[P])queueMicrotask(()=>{me(this,!0);try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[a]&&(this[a](),this[a]=null)});else{try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[a]&&(this[a](),this[a]=null)}Ht(this,this),ct(this,this),ee(this),this[c]=!0,e&&e.call(this)}finally{}const n=t[A];if(n)for(const t of n)try{await t.method.call(this)}catch(e){console.error(`Error in @ready handler ${t.methodName}:`,e)}},t.prototype.disconnectedCallback=async function(){const e=t[_];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @dispose handler ${t.methodName}:`,e)}n&&n.call(this),this[l]&&Xt(this).catch(t=>{console.error("Failed to detach controller:",t)}),Gt(this),ut(this),function(t){const e=t.constructor[Zt];if(!e||!Array.isArray(e)||0===e.length)return;for(const n of e)n.options.debounce&&t[K]&&(clearTimeout(t[K]),delete t[K]),delete t[`__wrapped_${n.methodName}`];const n=t[z];n&&"function"==typeof n[H]&&n[H](t),delete t[z],delete t[J]}(this),it(this)},t.prototype.attributeChangedCallback=function(e,n,s){if(o?.call(this,e,n,s),"controller"===e)this.controller=s;else{const n=t[y];if(n)for(const[o,r]of n){if(("string"==typeof r.attribute?r.attribute:o.toLowerCase()).toLowerCase()===e.toLowerCase()){const n=this[g]?.[o],i=ue(s,r,n,void 0);if(n!==i){this[T]||(this[T]=new Set),this[T].add(o),this[g]||(this[g]={}),this[g][o]=i;const s=this._settingFromProperty?.has(e.toLowerCase());if(!s){const e=t[v];if(e){if(e.has(o)){const t=e.get(o);for(const e of t)try{e.method.call(this,n,i,o)}catch(t){console.error(`Error in @watch('${o}') method ${e.methodName}:`,t)}}if(e.has("*")){const t=e.get("*");for(const e of t)try{e.method.call(this,n,i,o)}catch(t){console.error(`Error in @watch('*') method ${e.methodName}:`,t)}}}this[P]&&this[c]&&me(this)}}break}}}},t.prototype.connectedMoveCallback=async function(){const e=t[x];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @moved handler ${t.methodName}:`,e)}},t.prototype.adoptedCallback=async function(){const e=t[C];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @adopted handler ${t.methodName}:`,e)}}}function be(t,e){return function(n,o){if(o.metadata&&o.metadata[y]){n[y]||(n[y]=new Map);for(const[t,e]of o.metadata[y])n[y].set(t,e)}return!0===e?.formAssociated&&(n.formAssociated=!0),ge(n),customElements.get(t)?(console.warn(`[snice] Element "${t}" is already registered. Skipping duplicate registration.`),n):(customElements.define(t,n),n)}}function we(t){return function(e,n){if(n.metadata&&n.metadata[y]){e[y]||(e[y]=new Map);for(const[t,o]of n.metadata[y])e[y].set(t,o)}return ge(e),customElements.get(t)?(console.warn(`[snice] Layout "${t}" is already registered. Skipping duplicate registration.`),e):(customElements.define(t,e),e)}}function ve(t){return function(e,n){const o=n.name;return n.metadata||(n.metadata={}),n.metadata[y]||(n.metadata[y]=new Map),n.metadata[y].set(o,t||{}),function(e){const n=this.constructor;n[y]||(n[y]=new Map);const s={...t};if(s.type||void 0===e||(s.type=ce(e)),n[y].set(o,s),!Object.hasOwnProperty.call(this.constructor.prototype,o)){const t={get(){const t="string"==typeof s?.attribute?s?.attribute:o.toLowerCase(),n=this.getAttribute?.(t);if(null!==n)return ue(n,s||{},void 0,e);return((s?.type||ce(e))!==Boolean||!this[T]?.has(o))&&(this[b]?.has(o)?this[b].get(o):e)},set(t){const n=this[o];if(n===t)return;if(!this[w])return this[b]||(this[b]=new Map),void this[b].set(o,t);const r="string"==typeof s.attribute?s.attribute:o.toLowerCase(),i=function(t,e,n){if(null==t||!1===t||e?.type===ne&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||ce(n)){case Boolean:return"true";case Date:return t instanceof Date?t.toISOString():String(t);case BigInt:return"bigint"==typeof t?t.toString()+"n":String(t);case ne:return Array.isArray(t)?ne.serialize(t):String(t);case Array:return Array.isArray(t)?JSON.stringify(t):String(t);case Object:return"object"==typeof t&&null!==t?JSON.stringify(t):String(t);default:return String(t)}}(t,s,e);this[T]||(this[T]=new Set),this[T].add(o),this._settingFromProperty||(this._settingFromProperty=new Set),this._settingFromProperty.add(r.toLowerCase()),null===i?this.removeAttribute?.(r):this.setAttribute?.(r,i),setTimeout(()=>{this._settingFromProperty?.delete(r.toLowerCase())},0);const a=this.constructor[v];if(a){if(a.has(o)){const e=a.get(o);for(const s of e)try{s.method.call(this,n,t,o)}catch(t){console.error(`Error in @watch('${o}') method ${s.methodName}:`,t)}}if(a.has("*")){const e=a.get("*");for(const s of e)try{s.method.call(this,n,t,o)}catch(t){console.error(`Error in @watch('*') method ${s.methodName}:`,t)}}}this[P]&&this[c]&&me(this)},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,o,t)}return this[g]||(this[g]={}),this[g][o]=e,e}}}function Te(t,e={}){return function(n,s){const{light:r=!1,shadow:i=!0}=e,a=s.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[o]&&this.element?this.element:this;let n=null;return i&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&r&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,a,e)}return e}}}function Se(t,e={}){return function(n,s){const{light:r=!1,shadow:i=!0}=e,a=s.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[o]&&this.element?this.element:this,n=[];if(i&&e.shadowRoot){const o=e.shadowRoot.querySelectorAll(t);n.push(...o)}if(r){const o=e.querySelectorAll(t);n.push(...o)}return n},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,a,e)}return e}}}function Ne(...t){return function(e,n){const o=n.name,s=`__watch_init_${o}`;n.addInitializer(function(){const n=this.constructor;if(!n[s]){n[s]=!0,n[v]||(n[v]=new Map);for(const s of t)n[v].has(s)||n[v].set(s,[]),n[v].get(s).push({methodName:o,method:e})}})}}function Ee(){return function(t,e){const n=e.name;return function(t){if(!Object.hasOwnProperty.call(this.constructor.prototype,n)){const t={get(){if(void 0!==this[S])return this[S];const t={target:this},e=new CustomEvent("@context/request",{bubbles:!0,cancelable:!0,detail:t});let n=!0===this[o]&&this.element?this.element:this;if(n&&n.dispatchEvent){if(n.getRootNode&&n.getRootNode()instanceof ShadowRoot){const t=n.getRootNode();n=t.host}return n.dispatchEvent(e),void 0!==t.context?(this[S]=t.context,t.context):void 0}},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,n,t)}return t}}}function Ae(){return function(t,e){const n=e.name,o=`__ready_init_${n}`;e.addInitializer(function(){const e=this.constructor;e[o]||(e[o]=!0,e[A]||(e[A]=[]),e[A].push({methodName:n,method:t}))})}}function _e(){return function(t,e){const n=e.name,o=`__dispose_init_${n}`;e.addInitializer(function(){const e=this.constructor;e[o]||(e[o]=!0,e[_]||(e[_]=[]),e[_].push({methodName:n,method:t}))})}}function xe(t={}){return function(e,n){const o=n.name,s=`__moved_init_${o}`;return n.addInitializer(function(){const n=this.constructor;n[s]||(n[s]=!0,n[x]||(n[x]=[]),n[x].push({methodName:o,method:e,options:t}))}),function(...n){this[k]||(this[k]=new Map),this[k].has(o)||this[k].set(o,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const s=this[k].get(o),r=(...t)=>e.apply(this,t),i=void 0!==t.debounce&&t.debounce>0,a=void 0!==t.throttle&&t.throttle>0;switch(!0){case i:return clearTimeout(s.debounceTimer),void(s.debounceTimer=setTimeout(()=>r(...n),t.debounce));case a:{const e=t.throttle,o=Date.now();if(0===s.lastThrottleCall||o-s.lastThrottleCall>=e)return s.lastThrottleCall=o,r(...n);if(!!!s.throttleTimer){const t=e-(o-s.lastThrottleCall);s.throttleTimer=setTimeout(()=>{s.throttleTimer=null,s.lastThrottleCall=Date.now(),r(...n)},t)}return}default:return r(...n)}}}}function Ce(t={}){return function(e,n){const o=n.name;return n.addInitializer(function(){const n=this.constructor;n[C]||(n[C]=[]),n[C].push({methodName:o,method:e,options:t})}),function(...n){this[L]||(this[L]=new Map),this[L].has(o)||this[L].set(o,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const s=this[L].get(o),r=(...t)=>e.apply(this,t),i=void 0!==t.debounce&&t.debounce>0,a=void 0!==t.throttle&&t.throttle>0;switch(!0){case i:return clearTimeout(s.debounceTimer),void(s.debounceTimer=setTimeout(()=>r(...n),t.debounce));case a:{const e=t.throttle,o=Date.now();if(0===s.lastThrottleCall||o-s.lastThrottleCall>=e)return s.lastThrottleCall=o,r(...n);if(!!!s.throttleTimer){const t=e-(o-s.lastThrottleCall);s.throttleTimer=setTimeout(()=>{s.throttleTimer=null,s.lastThrottleCall=Date.now(),r(...n)},t)}return}default:return r(...n)}}}}
13
+ globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const t=globalThis.snice;function e(e){return t.symbols.has(e)||t.symbols.set(e,Symbol.for(`snice:${e}`)),t.symbols.get(e)}const n=e("is-controller-class"),o=e("is-controller-instance"),s=e("is-element-class"),r=e("channel-handlers"),i=e("ready-promise"),a=e("ready-resolve");e("rendered-promise"),e("rendered-resolve");const l=e("controller"),c=e("initialized");e("on-handlers");const u=e("controller-key"),h=e("controller-name"),d=e("controller-id"),m=e("controller-operations"),p=e("native-controller"),f=e("cleanup"),y=e("properties"),g=e("property-values"),b=e("pre-init-property-values"),w=e("properties-initialized"),v=e("property-watchers"),T=e("explicitly-set-properties"),_=e("router-context");e("current-page-marker"),e("context-request-handler");const S=e("page-transition"),x=e("created-at"),E=e("ready-handlers"),N=e("dispose-handlers"),A=e("moved-handlers"),C=e("adopted-handlers"),k=e("observers");e("parts"),e("part-timers");const L=e("moved-timers"),O=e("adopted-timers"),$=e("dispatch-timers"),P=e("render-method"),M=e("render-options"),I=e("render-instance"),R=e("render-scheduled"),D=e("render-timers"),q=e("render-callbacks"),F=e("styles-method"),z=e("styles-applied"),j=e("context-handler");e("context-method-name");const V=e("navigation-context-instance"),W=e("registered-elements"),H=e("is-updating"),B=e("context-register"),U=e("context-unregister"),G=e("context-notify-element");e("context-options");const K=e("context-timer"),J=e("context-called"),Q=e("context-update"),X=new Map,Y=new WeakMap;function Z(t,e,n){let o,s;return"string"==typeof e?(o=e,s=n):(o=void 0,s=e),function(e,n){const r=n.name,i=`__observe_init_${r}`;n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[k]||(n[k]=[]);const a=Array.isArray(t)?t:[t];for(const t of a){const[i,...a]=t.split(":"),l=a.join(":");n[k].push({type:i,target:l,selector:o,methodName:r,method:e,options:s})}})}}function tt(t,e){const n=t.constructor[k];if(n&&Array.isArray(n)&&0!==n.length){t[f]?t[f].observers||(t[f].observers=[]):t[f]={events:[],channels:[],observers:[]};for(const o of n){const n=o.method.bind(t),s=o.options?.throttle?rt(n,o.options.throttle):n;switch(o.type){case"intersection":et(t,e,o,s);break;case"resize":nt(t,e,o,s);break;case"media":ot(t,e,o,s);break;case"mutation":st(t,e,o,s);break;default:console.warn(`Unknown observer type: ${o.type}`)}}}}function et(t,e,n,o){const s={threshold:n.options?.threshold??0,rootMargin:n.options?.rootMargin??"0px",root:n.options?.root??null},r=JSON.stringify(s),i=t=>{for(const e of t)try{!1===o(e)&&a&&a.unobserve(e.target)}catch(t){console.error(`Error in intersection observer ${n.methodName}:`,t)}};if("undefined"==typeof IntersectionObserver)return void console.warn("IntersectionObserver is not available in this environment");let a=Y.get({instance:t,options:r});a||(a=new IntersectionObserver(i,s),Y.set({instance:t,options:r},a));const l=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];l.forEach(t=>a.observe(t)),t[f].observers.push(()=>{l.forEach(t=>a.unobserve(t)),0===a.takeRecords().length&&a.disconnect()})}function nt(t,e,n,o){const s=n.options?.box||"content-box";if("undefined"==typeof ResizeObserver)return void console.warn("ResizeObserver is not available in this environment");const r=new ResizeObserver(t=>{for(const e of t)try{o(e)}catch(t){console.error(`Error in resize observer ${n.methodName}:`,t)}});(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e]).forEach(t=>{r.observe(t,{box:s})}),t[f].observers.push(()=>{r.disconnect()})}function ot(t,e,n,o){const s=n.target;if(!s)return void console.warn("Media query observer requires a query string");let r=X.get(s);if(!r)try{r=window.matchMedia(s),X.set(s,r)}catch(t){return void console.error(`Invalid media query: ${s}`,t)}const i=t=>{try{o(t.matches)}catch(t){console.error(`Error in media query observer ${n.methodName}:`,t)}};i(r);const a=t=>i(t);r.addEventListener?(r.addEventListener("change",a),t[f].observers.push(()=>{r.removeEventListener("change",a)})):(r.addListener(a),t[f].observers.push(()=>{r.removeListener(a)}))}function st(t,e,n,s){const r=n.target.split(":"),i=r[0]||"childList",a=r[1],l={};switch(i){case"childList":l.childList=!0;break;case"attributes":l.attributes=!0,a&&(l.attributeFilter=[a]);break;default:return void console.warn(`Unknown mutation type: ${i}`)}n.options?.subtree&&(l.subtree=!0,n.options.maxDepth&&console.warn("maxDepth is set but requires custom implementation"));const c=new MutationObserver(t=>{try{if(n.options?.maxDepth&&n.options.subtree){const o=n.options.maxDepth,r=t.filter(t=>{let n=0,s=t.target;const r=e.shadowRoot||e;for(;s&&s!==r&&n<o;)s=s.parentNode,n++;return n<o});r.length>0&&s(r)}else s(t)}catch(t){console.error(`Error in mutation observer ${n.methodName}:`,t)}}),u=!0===t[o];(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):u&&e.shadowRoot?[e.shadowRoot]:[e]).forEach(t=>{c.observe(t,l)}),t[f].observers.push(()=>{c.disconnect()})}function rt(t,e){let n=0,o=null;return function(...s){const r=Date.now(),i=e-(r-n);if(i<=0)return o&&(clearTimeout(o),o=null),n=r,t.apply(this,s);o||(o=setTimeout(()=>{n=Date.now(),o=null,t.apply(this,s)},i))}}function it(t){if(t[f]?.observers){for(const e of t[f].observers)e();t[f].observers=[]}}function at(t,e){return function(n,s){let r,i,a=0;return async function(...s){const l=async()=>{const r=e?.timeout??12e4,i=e?.discoveryTimeout??50,a=n.apply(this,s),{value:l,done:c}=await a.next();if(c)return l;let u,h;const d=new Promise((t,e)=>{u=t,h=e});let m,p,f;const y=new Promise((e,n)=>{m=e,p=n,f=setTimeout(()=>{n(new Error(`Request "${t}" timed out after ${i}ms - no handler found`))},i)}),g=new CustomEvent(`@request/${t}`,{bubbles:void 0===e?.bubbles||e.bubbles,cancelable:e?.cancelable||!1,composed:!0,detail:{payload:l,discovery:{resolve:()=>{clearTimeout(f),m()},reject:p},data:{resolve:u,reject:h}}});(!0===this[o]&&this.element?this.element:this).dispatchEvent(g);try{await y;const e=setTimeout(()=>{h(new Error(`Request "${t}" timed out after ${r}ms`))},r),n=await d;clearTimeout(e);const{value:o}=await a.next(n);return o}catch(t){try{await a.throw(t)}catch(t){throw t}}};if(e?.debounce)return new Promise((t,n)=>{clearTimeout(r),r=setTimeout(async()=>{try{const e=await l();t(e)}catch(t){n(t)}},e.debounce)});if(e?.throttle){const t=Date.now(),n=e.throttle-(t-a);return n<=0?(clearTimeout(i),a=t,l()):i?Promise.resolve():new Promise((t,e)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{const e=await l();t(e)}catch(t){e(t)}},n)})}return l()}}}function lt(t,e){return function(n,o){const s=o.name,i=`__respond_init_${t}_${s}`;o.addInitializer(function(){const o=this.constructor;o[i]||(o[i]=!0,o[r]||(o[r]=[]),o[r].push({channelName:t,methodName:s,method:n,options:e}))})}}function ct(t,e){const n=t.constructor[r];if(n){t[f]||(t[f]={events:[],channels:[]});for(const o of n){const n=o.method.bind(t),s=`@request/${o.channelName}`;let r,i,a=0;const l=(t=>o.options?.debounce?(...e)=>new Promise((n,s)=>{clearTimeout(r),r=setTimeout(async()=>{try{const o=await t(...e);n(o)}catch(t){s(t)}},o.options.debounce)}):o.options?.throttle?(...e)=>{const n=Date.now(),s=o.options.throttle-(n-a);return s<=0?(clearTimeout(i),a=n,t(...e)):i?Promise.resolve(void 0):new Promise((n,o)=>{i=setTimeout(async()=>{a=Date.now(),i=null;try{const o=await t(...e);n(o)}catch(t){o(t)}},s)})}:t)(n),c=t=>{const{data:e,discovery:n,payload:s}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(l(s)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${o.methodName}:`,t)})};e.addEventListener(s,c),t[f].channels.push(()=>{e.removeEventListener(s,c)})}}}function ut(t){if(t[f]?.channels){for(const e of t[f].channels)e();t[f].channels=[]}}const ht=Symbol.for("snice:html-result"),dt=Symbol.for("snice:css-result");function mt(t,...e){return{_$litType$:ht,strings:t,values:e}}function pt(t,...e){let n=t[0];for(let o=0;o<e.length;o++)n+=String(e[o])+t[o+1];const o={_$litType$:dt,cssText:n};if("undefined"!=typeof CSSStyleSheet&&"adoptedStyleSheets"in Document.prototype)try{const t=new CSSStyleSheet;t.replaceSync(n),o.styleSheet=t}catch(t){}return o}function ft(t){return t&&t._$litType$===ht}const yt=Symbol.for("snice:nothing"),gt=Symbol.for("snice:unsafe-html");function bt(t){return{_$litType$:gt,html:t}}const wt=`snice$${Math.random().toFixed(9).slice(2)}$`,vt="?"+wt,Tt=`<${vt}>`,_t=new RegExp(wt,"g"),St=new WeakMap,xt=Symbol("not-committed"),Et=Symbol.for("snice:no-change"),Nt=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class At{constructor(t,e,n){this.parts=[],this.element=e;const o=document.createTreeWalker(e.content,NodeFilter.SHOW_ELEMENT|NodeFilter.SHOW_COMMENT|NodeFilter.SHOW_TEXT);let s=0;const r=[];let i;for(;null!==(i=o.nextNode());)if(i.nodeType===Node.ELEMENT_NODE){const t=i,e=t.tagName.toLowerCase();if("if"===e){const e=t.getAttribute("value");e&&e.includes(wt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:s++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(wt)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:s++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,o=[];for(let r=0;r<e.length;r++){const i=e[r],a=i.value;if(a.includes(wt)){o.push(i);const e=n[s]||i.name,r=a.split(wt),l=r.length-1;e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:s,name:e.slice(1),element:t}),s+=1):e.startsWith(".")?(this.parts.push({type:"property",index:s,name:e.slice(1),element:t}),s+=1):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:s,name:e.slice(1),element:t}),s+=1):(this.parts.push({type:"attribute",index:s,name:i.name,element:t,attrStrings:r}),s+=l)}}for(const e of o)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===vt){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:s++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(wt)){const n=t.parentNode,o=e.split(_t),i=o.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(o[e]),t);const r=document.createComment(""),i=document.createComment("");n.insertBefore(r,t),n.insertBefore(i,t),this.parts.push({type:"node",index:s++,startNode:r,endNode:i})}""!==o[i]?t.data=o[i]:r.push(t)}}for(const t of r)t.parentNode?.removeChild(t)}}class Ct{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=St.get(e);if(n)return n;const o=[],s=[];let r=!1,i=!1,a="",l="";for(let t=0;t<e.length;t++){const n=e[t];if(o.push(n),t<e.length-1){for(let t=0;t<n.length;t++){const e=n[t];if(r){if(i)e===a&&(i=!1,a="");else if(">"===e)r=!1;else if('"'===e||"'"===e)i=!0,a=e;else if("="===e){let e=t-1;for(;e>=0&&/[\w\-\.@\?]/.test(n[e]);)e--;l=n.substring(e+1,t).trim()}}else"<"===e&&(r=!0)}if(i)s.push(l),o.push(wt);else if(r){const t=n.trimEnd();if(t.endsWith("=")){let e=t.length-2;for(;e>=0&&/[\w\-\.@\?\/]/.test(t[e]);)e--;l=t.substring(e+1,t.length-1).trim(),s.push(l),o.push(wt)}else n.match(/<(if|case)\s*$/)?(l="value",s.push("value"),o.push(`value="${wt}"`)):(s.push(""),o.push(wt))}else s.push(""),o.push(Tt)}}const c=o.join(""),u=document.createElement("template");u.innerHTML=c;const h=new At(t,u,s);return St.set(e,h),h}(t),this.strings=t.strings}isSameTemplate(t){return this.strings===t}renderFragment(){if(!this.fragment){this.fragment=this.template.element.content.cloneNode(!0);const t=document.createTreeWalker(this.template.element.content,NodeFilter.SHOW_ALL),e=document.createTreeWalker(this.fragment,NodeFilter.SHOW_ALL),n=new Map;let o=t.currentNode,s=e.currentNode;for(;o&&s;)n.set(o,s),o=t.nextNode(),s=e.nextNode();for(let t=0;t<this.template.parts.length;t++){const e=this.template.parts[t];let o;switch(e.type){case"node":const t=n.get(e.startNode),s=n.get(e.endNode);o=new Lt(t,s);break;case"attribute":const r=n.get(e.element);o=new Ot(r,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);o=new $t(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);o=new Pt(a,e.name);break;case"event":const l=n.get(e.element);o=new Mt(l,e.name);break;case"conditional-if":const c=n.get(e.element);o=new Ft(c);break;case"conditional-case":const u=n.get(e.element);o=new zt(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(o),o instanceof Ft||o instanceof zt?this.conditionalParts.push({part:o,index:e.index}):this.regularParts.push({part:o,index:e.index})}}return this.fragment}render(t){const e=this.renderFragment();return this.update(t),e}update(t){for(const{part:e,index:n}of this.conditionalParts)e.commit(t[n]);for(const{part:e,index:n}of this.regularParts)e instanceof Ot&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class kt{}class Lt extends kt{constructor(t,e){super(),this._committedValue=xt,this.startNode=t,this.endNode=e}commit(t){if(t!==Et)return t===yt||null==t||""===t?(this._committedValue!==yt&&this._clear(),void(this._committedValue=yt)):void(Nt(t)?t!==this._committedValue&&this._commitText(t):ft(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===gt}(t)?void 0===t.nodeType?(t=>Array.isArray(t)||"function"==typeof t?.[Symbol.iterator])(t)?this._commitIterable(t):this._commitText(t):this._commitNode(t):this._commitUnsafeHTML(t))}_commitText(t){if(this._committedValue!==xt&&this._committedValue!==yt&&Nt(this._committedValue)&&!Array.isArray(this._committedValue)){const e=this.startNode.nextSibling;if(e&&e.nodeType===Node.TEXT_NODE)return e.data=String(t),void(this._committedValue=t)}this._clear();const e=document.createTextNode(String(t));this._insertBefore(e),this._committedValue=t}_commitTemplateResult(t){const e=this._committedValue;if(e instanceof Ct){const n=St.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new Ct(t),o=n.renderFragment();this._insertBefore(o),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof Lt||(this._clear(),this._committedValue=[]);const e=this._committedValue;let n=0;for(const o of t){let t;if(n>=e.length){const n=document.createComment(""),o=document.createComment("");this._insertBefore(n),this._insertBefore(o),t=new Lt(n,o),e.push(t)}else t=e[n];t.commit(o),n++}if(n<e.length){for(let t=n;t<e.length;t++){const n=e[t];n._clear(),n.startNode.remove(),n.endNode.remove()}e.length=n}}_commitNode(t){this._committedValue!==t&&(this._clear(),this._insertBefore(t),this._committedValue=t)}_commitUnsafeHTML(t){this._clear();const e=document.createElement("template");e.innerHTML=t.html,this._insertBefore(e.content),this._committedValue=t}_insertBefore(t){this.endNode.parentNode?.insertBefore(t,this.endNode)}_clear(){const t=this.startNode.parentNode;if(!t)return;let e=this.startNode.nextSibling;for(;e&&e!==this.endNode;){const n=e.nextSibling;t.removeChild(e),e=n}this._committedValue=yt}clear(){this._clear()}}class Ot extends kt{constructor(t,e,n){super(),this._committedValue=xt,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(xt),this.strings=n):this._committedValue=xt}commit(t,e=0){let n,o=!1;if(void 0===this.strings){if(t===Et)return;if(o=!Nt(t)||t!==this._committedValue&&t!==Et,!o)return;this._committedValue=t,n=t}else{const s=t,r=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=s[e+t];i===Et&&(i=r[t]),o=o||!Nt(i)||i!==r[t],i===yt?n=yt:n!==yt&&(n=n+(i??"")+this.strings[t+1]),r[t]=i}if(!o)return}this._commitValue(n)}_commitValue(t){t===yt||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class $t extends kt{constructor(t,e){super(),this._committedValue=xt,this.element=t,this.name=e}commit(t){t!==Et&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===yt?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=xt}}class Pt extends kt{constructor(t,e){super(),this._committedValue=xt,this.element=t,this.name=e}commit(t){if(t===Et)return;const e=!!t&&t!==yt;e!==this._committedValue&&(this._committedValue=e,e?this.element.setAttribute(this.name,""):this.element.removeAttribute(this.name))}clear(){this.element.removeAttribute(this.name),this._committedValue=xt}}class Mt extends kt{constructor(t,e){super(),this.listener=null,this.value=void 0,this.keyFilter=null,this.host=null,this.element=t;const n=["keydown","keyup","keypress"].includes(e.split(".")[0].split(":")[0]),o=e.indexOf("."),s=n?e.indexOf(":"):-1,r=o>0&&s>0?Math.min(o,s):Math.max(o,s);if(r>0){const t=e.substring(0,r),n=e.substring(r+1);this.eventName=t,this.keyFilter=It(n)}else this.eventName=e}commit(t){if(t!==Et&&(t===yt&&(t=null),(t!==this.value||null==t)&&(this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null),this.value=t,null!=t&&"function"==typeof t))){if(!this.host){const t=this.element.getRootNode();this.host=t.host||null}if(this.host){const e=this.host;this.listener=n=>{this.keyFilter&&!Dt(n,this.keyFilter)||t.call(e,n)}}else this.listener=e=>{this.keyFilter&&!Dt(e,this.keyFilter)||t.call(null,e)};this.element.addEventListener(this.eventName,this.listener)}}clear(){this.listener&&(this.element.removeEventListener(this.eventName,this.listener),this.listener=null)}}function It(t){const e=t.startsWith("~");e&&(t=t.substring(1));const n=t.split("+"),o={key:"",anyModifiers:e};for(const t of n){const e=t.toLowerCase();"ctrl"===e||"control"===e?o.ctrl=!0:"alt"===e?o.alt=!0:"shift"===e?o.shift=!0:"meta"===e||"cmd"===e||"command"===e?o.meta=!0:o.key=Rt(t)}return o}function Rt(t){return{esc:"Escape",escape:"Escape",enter:"Enter",return:"Enter",space:" ",spacebar:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",arrowup:"ArrowUp",arrowdown:"ArrowDown",arrowleft:"ArrowLeft",arrowright:"ArrowRight",delete:"Delete",del:"Delete",backspace:"Backspace",tab:"Tab",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"}[t.toLowerCase()]||t}function Dt(t,e){if(t.key!==e.key)return!1;if(e.anyModifiers)return!0;const n=e.ctrl?t.ctrlKey:!t.ctrlKey,o=e.alt?t.altKey:!t.altKey,s=e.shift?t.shiftKey:!t.shiftKey,r=e.meta?t.metaKey:!t.metaKey;return n&&o&&s&&r}const qt=Symbol("not-set");class Ft extends kt{constructor(t){super(),this.value=qt,this.fragment=null,this.ifElement=t,this.ifElement.style.display="contents"}commit(t){const e=Boolean(t);if(this.value!==t)if(this.value=t,e)this.fragment&&this.fragment.hasChildNodes()&&this.ifElement.appendChild(this.fragment);else for(this.fragment||(this.fragment=document.createDocumentFragment());this.ifElement.firstChild;)this.fragment.appendChild(this.ifElement.firstChild)}clear(){for(this.fragment||(this.fragment=document.createDocumentFragment());this.ifElement.firstChild;)this.fragment.appendChild(this.ifElement.firstChild)}}class zt extends kt{constructor(t){super(),this.value=qt,this.childrenMap=new Map,this.fragments=new Map,this.defaultChild=null,this.currentChild=null,this.caseElement=t,this.caseElement.style.display="contents";for(const t of Array.from(this.caseElement.children)){const e=t.tagName.toLowerCase();if("when"===e){t.style.display="contents";const e=t.getAttribute("value")||"";this.childrenMap.set(e,t);const n=document.createDocumentFragment();n.appendChild(t),this.fragments.set(t,n)}else if("default"===e){t.style.display="contents",this.defaultChild=t;const e=document.createDocumentFragment();e.appendChild(t),this.fragments.set(t,e)}}}commit(t){if(this.value===t)return;this.value=t;const e=String(t);if(this.currentChild){const t=this.fragments.get(this.currentChild);t&&!t.hasChildNodes()&&t.appendChild(this.currentChild)}const n=this.childrenMap.get(e)||this.defaultChild;if(n){const t=this.fragments.get(n);t&&t.hasChildNodes()&&this.caseElement.appendChild(t),this.currentChild=n}}clear(){if(this.currentChild){const t=this.fragments.get(this.currentChild);t&&!t.hasChildNodes()&&t.appendChild(this.currentChild),this.currentChild=null}}}const jt=e("on-handlers");function Vt(t,e,n){let o=null,s={};return"string"==typeof e?(o=e,s=n||{}):null===e&&n?s=n:e&&"object"==typeof e&&(s=e),function(e,n){const r=n.name,i=`__on_init_${r}_${o||""}_${JSON.stringify(t)}`;return n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[jt]||(n[jt]=[]);const a=Array.isArray(t)?t:[t];for(const t of a)n[jt].push({eventName:t,selector:o,methodName:r,method:e,options:s})}),e}}function Wt(t,e){let n=null;return function(...o){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,o),n=null},e)}}function Ht(t,e){let n=0;return function(...o){const s=Date.now();s-n>=e&&(n=s,t.apply(this,o))}}const Bt=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Ut(t,e){const n=t.constructor[jt];if(n&&Array.isArray(n)&&0!==n.length){t[f]?t[f].events?t[f].events.length>0&&Gt(t):t[f].events=[]:t[f]={events:[],channels:[],observers:[]};for(const o of n){const n=t[o.methodName];let s=n?n.bind(t):o.method.bind(t);const r=o.options||{},i=["keydown","keyup","keypress"].includes(o.eventName.split(".")[0].split(":")[0]),a=o.eventName.indexOf("."),l=i?o.eventName.indexOf(":"):-1,c=a>0&&l>0?Math.min(a,l):Math.max(a,l),u=c>0?o.eventName.substring(0,c):o.eventName,h=c>0?o.eventName.substring(c+1):null;r.debounce&&r.debounce>0?s=Wt(s,r.debounce):r.throttle&&r.throttle>0&&(s=Ht(s,r.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=It(h));const m=(t=>d?e=>{Dt(e,d)&&t(e)}:t)(s);if(o.selector){const n=e.shadowRoot||e,s=t=>{const e=t.target;let n=null;if(e.matches&&e.matches(o.selector)?n=e:e.closest&&(n=e.closest(o.selector)),n){r.preventDefault&&t.preventDefault(),r.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},i=Bt.has(u),a={capture:void 0!==r.capture?r.capture:i,once:r.once||!1,passive:r.passive||!1};n.addEventListener(u,s,a),t[f].events.push({target:n,eventName:u,handler:s,options:a})}else{const n=e.shadowRoot,s=Symbol.for(`snice:event-handled:${o.methodName}`),i=t=>{if(!t[s]){t[s]=!0;try{r.preventDefault&&t.preventDefault(),r.stopPropagation&&t.stopPropagation(),m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},a={capture:r.capture||!1,once:r.once||!1,passive:r.passive||!1};n&&(n.addEventListener(u,i,a),t[f].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[f].events.push({target:e,eventName:u,handler:i,options:a})}}}}function Gt(t){if(t[f]?.events){for(const{target:e,eventName:n,handler:o,options:s}of t[f].events)e.removeEventListener(n,o,s);t[f].events=[]}}class Kt{constructor(){this.cleanupFns=new Map,this.pendingOperations=new Set}register(t,e){this.cleanupFns.set(t,e)}unregister(t){this.cleanupFns.delete(t)}async cleanup(){await Promise.all(this.pendingOperations);for(const t of this.cleanupFns.values())try{await t()}catch(t){console.error("Error during cleanup:",t)}this.cleanupFns.clear()}async runOperation(t){const e=t(),n=e.then(()=>{},()=>{});this.pendingOperations.add(n);try{const t=await e;return this.pendingOperations.delete(n),t}catch(t){throw this.pendingOperations.delete(n),t}}}function Jt(t){return function(e,o){const s=globalThis.snice?.controllerRegistry;if(!s)throw new Error("Snice global registry not initialized");return s.set(t,e),e.prototype[n]=!0,e}}async function Qt(e,n){const s=e[u],r=e[h],i=e[p];if(void 0!==i&&i!==n)return;if(r===n&&s)return;s&&await Xt(e);const a=globalThis.snice?.controllerRegistry;if(!a)throw new Error("Snice global registry not initialized");const l=a.get(n);if(!l)throw console.error(`Controller "${n}" not found. Available:`,Array.from(a.keys())),new Error(`Controller "${n}" not found in registry`);const c=new l;t.controllerIdCounter+=1;const f=t.controllerIdCounter,y=new Kt;c[o]=!0,c[d]=f,c.element=e;const g=e[_];void 0!==g&&(c[_]=g),e[u]=c,e[h]=n,e[m]=y,await e.ready,await y.runOperation(async()=>{await c.attach(e)}),tt(c,e),ct(c,e),Ut(c,e),e.dispatchEvent(new CustomEvent("controller-attached",{detail:{name:n,controller:c}}))}async function Xt(t){const e=t[u],n=t[h],o=t[m];e&&(o?await o.runOperation(async()=>{await e.detach(t)}):await e.detach(t),e.element=null,it(e),ut(e),Gt(e),o&&await o.cleanup(),delete e[_],delete t[u],delete t[h],delete t[m],t.dispatchEvent(new CustomEvent("controller-detached",{detail:{name:n,controller:e}})))}function Yt(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(t.tagName.includes("-"))return;if(t[s])return;const e=t.getAttribute("controller"),n=t[p];e&&e!==n?(t[p]=e,t.ready||(t.ready=Promise.resolve()),n&&Xt(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),Qt(t,e).catch(t=>{console.error(`Failed to attach controller "${e}" to native element:`,t)})):!e&&n&&(delete t[p],delete t[h],Xt(t).catch(t=>{console.error("Failed to detach controller from native element:",t)}))}globalThis.sniceNativeControllersInitialized=!0;const e=new MutationObserver(e=>{for(const n of e)"attributes"===n.type&&"controller"===n.attributeName?t(n.target):"childList"===n.type&&n.addedNodes.forEach(e=>{e instanceof HTMLElement&&(t(e),e.querySelectorAll('[controller]:not([class*="-"])').forEach(t))})});"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{document.querySelectorAll('[controller]:not([class*="-"])').forEach(t),e.observe(document.body,{attributes:!0,attributeFilter:["controller"],childList:!0,subtree:!0})}):(document.querySelectorAll('[controller]:not([class*="-"])').forEach(t),e.observe(document.body,{attributes:!0,attributeFilter:["controller"],childList:!0,subtree:!0})),globalThis.sniceNativeControllerObserver=e}const Zt=e("context-handlers");function te(t={}){return function(e,n){const o=n.name,s=`__context_init_${o}`;return n.addInitializer(function(){const n=this.constructor;n[s]||(n[s]=!0,n[Zt]||(n[Zt]=[]),n[Zt].push({methodName:o,method:e,options:t}))}),e}}function ee(t){const e=t.constructor[Zt];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[j];if(n){t[V]=n;for(const o of e){const{methodName:e,method:s,options:r}=o,i=`__wrapped_${e}`;t[i]=function(e){if(r.once&&t[J])return;const n=()=>{if(s.call(t,e),r.once){t[J]=!0;const e=t[V];e&&"function"==typeof e[U]&&e[U](t)}};if(r.debounce)clearTimeout(t[K]),t[K]=setTimeout(n,r.debounce);else if(r.throttle){const e=Date.now();e-(t[K]||0)>=r.throttle&&(t[K]=e,n())}else n()},"function"==typeof n[B]&&n[B](t,i)}}}class ne{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(ne.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${ne.SEPARATOR}" (U+FF0C)`);return t}if("number"==typeof t||"boolean"==typeof t)return String(t);throw new Error("SimpleArray only supports string, number, and boolean types. Got: "+typeof t)}).join(ne.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(ne.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var oe,se,re;const ie=Symbol.for("snice:registered-elements-set");let ae=0;class le{constructor(t={},e=[],n="",o={},s){if(this[oe]=new WeakMap,this[se]=new Set,this[re]=!1,this.id=ae++,this.application=t,this.navigation={placards:e,route:n,params:o},s&&"function"==typeof s.create)this.fetch=s.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(oe=W,se=ie,re=H,B)](t,e){this[W].set(t,e),this[ie].add(t)}[U](t){this[W].delete(t),this[ie].delete(t)}[Q](t,e,n,o){this.application=t,this.navigation.placards=e,this.navigation.route=n,this.navigation.params=o,this.notify()}update(){this.notify()}notify(){if(this[H])return;this[H]=!0;const t=this[ie],e=this[W];for(const n of t){const t=e.get(n);if(t&&"function"==typeof n[t])try{n[t](this)}catch(e){console.error(`Error calling @context method ${t}:`,e)}}this[H]=!1}[G](t){const e=this[W].get(t);e&&"function"==typeof t[e]&&t[e](this)}}function ce(t){if(null!=t)return"string"==typeof t?String:"number"==typeof t?Number:"boolean"==typeof t?Boolean:t instanceof Date?Date:"bigint"==typeof t?BigInt:Array.isArray(t)?Array:void 0}function ue(t,e,n,o){switch(e.type||ce(o)){case Boolean:return null!==t&&"false"!==t;case Number:return null!==t?Number(t):null;case String:return t;case Date:return t?new Date(t):null;case BigInt:return t&&t.endsWith("n")?BigInt(t.slice(0,-1)):t?BigInt(t):null;case ne:return ne.parse(t);case Array:try{return t?JSON.parse(t):[]}catch{return[]}case Object:try{return t?JSON.parse(t):{}}catch{return{}}default:return"number"==typeof n&&null!==t?Number(t):t}}const he=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?de(t,e):(this.pending.add(t),this.scheduled||(this.scheduled=!0,queueMicrotask(()=>this.flush())))}flush(){const t=Array.from(this.pending);this.pending.clear(),this.scheduled=!1;for(const e of t){de(e,e[M]||{})}}};function de(t,e,n){const o=t[P];if(o&&(!e.once||!t[I]))try{const s=void 0!==n?n:o.call(t);if(!(!1!==e.differential)){if("string"!=typeof s)return void console.warn("Render method with differential: false must return a string");t.shadowRoot||t.attachShadow({mode:"open"}),t.shadowRoot.innerHTML=s,t[R]=!1;const e=t[q];if(e&&e.length>0){const n=[...e];t[q]=[],n.forEach(t=>t())}return}if(!ft(s))return void console.warn("Render method must return html`` template result");let r=t[I];if(t.shadowRoot||t.attachShadow({mode:"open"}),r&&r.isSameTemplate(s.strings))r.update(s.values);else{r&&(t.shadowRoot.innerHTML=""),r=new Ct(s),t[I]=r;const e=r.renderFragment();t.shadowRoot.appendChild(e),r.update(s.values)}t[R]=!1;const i=t[q];if(i&&i.length>0){const e=[...i];t[q]=[],e.forEach(t=>t())}}catch(t){console.error("Error rendering element:",t)}}function me(t,e=!1){const n=t[M]||{};if(!n.once||!t[I])if(e)de(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[D]||(t[D]={}),clearTimeout(t[D].debounce),void(t[D].debounce=setTimeout(()=>{he.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[D]||(t[D]={lastThrottle:0});const e=t[D],o=Date.now();if(0===e.lastThrottle||o-e.lastThrottle>=n.throttle)e.lastThrottle=o,he.schedule(t,n);else if(!e.throttleTimer){const s=n.throttle-(o-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),he.schedule(t,n)},s)}return}he.schedule(t,n)}}function pe(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[P]=e,this[M]=t}),function(...t){const n=e.apply(this,t);return de(this,{},n),n}}}function fe(){return function(t,e){return e.addInitializer(function(){this[F]=t}),t}}function ye(t){const e=t[F];if(e&&!t[z]){t[z]=!0;try{const o=e.call(t);if(!(n=o)||n._$litType$!==dt)return void console.warn("Styles method must return css`` template result");t.shadowRoot||t.attachShadow({mode:"open"});const s=new CSSStyleSheet;if(s.replaceSync("if, case { display: contents; }"),t.shadowRoot&&o.styleSheet&&"adoptedStyleSheets"in t.shadowRoot)t.shadowRoot.adoptedStyleSheets=[s,o.styleSheet];else if(t.shadowRoot){const e=document.createElement("style");e.textContent="if, case { display: contents; }\n"+o.cssText,t.shadowRoot.appendChild(e)}}catch(t){console.error("Error applying styles:",t)}var n}}function ge(t){t.prototype[s]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,o=t.prototype.attributeChangedCallback,r=t.observedAttributes||[];r.includes("controller")||r.push("controller");const u=t[y];if(u)for(const[t,e]of u){if(!1===e.attribute)continue;const n="string"==typeof e.attribute?e.attribute:t.toLowerCase();r.includes(n)||r.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>r,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[i]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[l]},set(t){const e=this[l];this[l]=t,t!==e&&t?Qt(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):!t&&e&&Xt(this).catch(t=>{console.error("Failed to detach controller:",t)})},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[i]||(this[i]=new Promise(t=>{this[a]=t})),this[c]){Ut(this,this),ct(this,this),ee(this);try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName} on reconnection:`,t)}return void(e&&e.call(this))}try{this[w]=!0;const n=t[y];if(n)for(const[t,e]of n){if(!1===e.attribute)continue;const n="string"==typeof e.attribute?e.attribute:t.toLowerCase();if(this.hasAttribute(n)){const o=this.getAttribute(n);this[T]||(this[T]=new Set),this[T].add(t),e.type===Boolean&&""===o&&this.setAttribute(n,"true"),this[t]=ue(o,e)}}if(this[b]){for(const[t,e]of Array.from(this[b].entries())){const o=n?.get(t),s="string"==typeof o?.attribute?o.attribute:t.toLowerCase();this.hasAttribute(s)?this[b].delete(t):(this[b].delete(t),this[t]=e)}delete this[b]}if(ye(this),this[P])queueMicrotask(()=>{me(this,!0);try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[a]&&(this[a](),this[a]=null)});else{try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[a]&&(this[a](),this[a]=null)}Ut(this,this),ct(this,this),ee(this),this[c]=!0,e&&e.call(this)}finally{}const n=t[E];if(n)for(const t of n)try{await t.method.call(this)}catch(e){console.error(`Error in @ready handler ${t.methodName}:`,e)}},t.prototype.disconnectedCallback=async function(){const e=t[N];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @dispose handler ${t.methodName}:`,e)}n&&n.call(this),this[l]&&Xt(this).catch(t=>{console.error("Failed to detach controller:",t)}),Gt(this),ut(this),function(t){const e=t.constructor[Zt];if(!e||!Array.isArray(e)||0===e.length)return;for(const n of e)n.options.debounce&&t[K]&&(clearTimeout(t[K]),delete t[K]),delete t[`__wrapped_${n.methodName}`];const n=t[V];n&&"function"==typeof n[U]&&n[U](t),delete t[V],delete t[J]}(this),it(this)},t.prototype.attributeChangedCallback=function(e,n,s){if(o?.call(this,e,n,s),"controller"===e)this.controller=s;else{const n=t[y];if(n)for(const[o,r]of n){if(("string"==typeof r.attribute?r.attribute:o.toLowerCase()).toLowerCase()===e.toLowerCase()){const n=this[g]?.[o],i=ue(s,r,n,void 0);if(n!==i){this[T]||(this[T]=new Set),this[T].add(o),this[g]||(this[g]={}),this[g][o]=i;const s=this._settingFromProperty?.has(e.toLowerCase());if(!s){const e=t[v];if(e){if(e.has(o)){const t=e.get(o);for(const e of t)try{e.method.call(this,n,i,o)}catch(t){console.error(`Error in @watch('${o}') method ${e.methodName}:`,t)}}if(e.has("*")){const t=e.get("*");for(const e of t)try{e.method.call(this,n,i,o)}catch(t){console.error(`Error in @watch('*') method ${e.methodName}:`,t)}}}this[P]&&this[c]&&me(this)}}break}}}},t.prototype.connectedMoveCallback=async function(){const e=t[A];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @moved handler ${t.methodName}:`,e)}},t.prototype.adoptedCallback=async function(){const e=t[C];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @adopted handler ${t.methodName}:`,e)}}}function be(t,e){return function(n,o){if(o.metadata&&o.metadata[y]){n[y]||(n[y]=new Map);for(const[t,e]of o.metadata[y])n[y].set(t,e)}return!0===e?.formAssociated&&(n.formAssociated=!0),ge(n),customElements.get(t)?(console.warn(`[snice] Element "${t}" is already registered. Skipping duplicate registration.`),n):(customElements.define(t,n),n)}}function we(t){return function(e,n){if(n.metadata&&n.metadata[y]){e[y]||(e[y]=new Map);for(const[t,o]of n.metadata[y])e[y].set(t,o)}return ge(e),customElements.get(t)?(console.warn(`[snice] Layout "${t}" is already registered. Skipping duplicate registration.`),e):(customElements.define(t,e),e)}}function ve(t){return function(e,n){const o=n.name;return n.metadata||(n.metadata={}),n.metadata[y]||(n.metadata[y]=new Map),n.metadata[y].set(o,t||{}),function(e){const n=this.constructor;n[y]||(n[y]=new Map);const s={...t};if(s.type||void 0===e||(s.type=ce(e)),n[y].set(o,s),!Object.hasOwnProperty.call(this.constructor.prototype,o)){const t={get(){if(!1===s?.attribute)return this[g]&&o in this[g]?this[g][o]:this[b]?.has(o)?this[b].get(o):e;const t="string"==typeof s?.attribute?s?.attribute:o.toLowerCase(),n=this.getAttribute?.(t);if(null!==n)return ue(n,s||{},void 0,e);return((s?.type||ce(e))!==Boolean||!this[T]?.has(o))&&(this[b]?.has(o)?this[b].get(o):e)},set(t){const n=this[o];if(n===t)return;if(!this[w])return this[b]||(this[b]=new Map),void this[b].set(o,t);if(!1===s?.attribute)this[g]||(this[g]={}),this[g][o]=t;else{const n="string"==typeof s.attribute?s.attribute:o.toLowerCase(),r=function(t,e,n){if(null==t||!1===t||e?.type===ne&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||ce(n)){case Boolean:return"true";case Date:return t instanceof Date?t.toISOString():String(t);case BigInt:return"bigint"==typeof t?t.toString()+"n":String(t);case ne:return Array.isArray(t)?ne.serialize(t):String(t);case Array:return Array.isArray(t)?JSON.stringify(t):String(t);case Object:return"object"==typeof t&&null!==t?JSON.stringify(t):String(t);default:return String(t)}}(t,s,e);this[T]||(this[T]=new Set),this[T].add(o),this._settingFromProperty||(this._settingFromProperty=new Set),this._settingFromProperty.add(n.toLowerCase()),null===r?this.removeAttribute?.(n):this.setAttribute?.(n,r),setTimeout(()=>{this._settingFromProperty?.delete(n.toLowerCase())},0)}const r=this.constructor[v];if(r){if(r.has(o)){const e=r.get(o);for(const s of e)try{s.method.call(this,n,t,o)}catch(t){console.error(`Error in @watch('${o}') method ${s.methodName}:`,t)}}if(r.has("*")){const e=r.get("*");for(const s of e)try{s.method.call(this,n,t,o)}catch(t){console.error(`Error in @watch('*') method ${s.methodName}:`,t)}}}this[P]&&this[c]&&me(this)},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,o,t)}return this[g]||(this[g]={}),this[g][o]=e,e}}}function Te(t,e={}){return function(n,s){const{light:r=!1,shadow:i=!0}=e,a=s.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[o]&&this.element?this.element:this;let n=null;return i&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&r&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,a,e)}return e}}}function _e(t,e={}){return function(n,s){const{light:r=!1,shadow:i=!0}=e,a=s.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[o]&&this.element?this.element:this,n=[];if(i&&e.shadowRoot){const o=e.shadowRoot.querySelectorAll(t);n.push(...o)}if(r){const o=e.querySelectorAll(t);n.push(...o)}return n},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,a,e)}return e}}}function Se(...t){return function(e,n){const o=n.name,s=`__watch_init_${o}`;n.addInitializer(function(){const n=this.constructor;if(!n[s]){n[s]=!0,n[v]||(n[v]=new Map);for(const s of t)n[v].has(s)||n[v].set(s,[]),n[v].get(s).push({methodName:o,method:e})}})}}function xe(){return function(t,e){const n=e.name;return function(t){if(!Object.hasOwnProperty.call(this.constructor.prototype,n)){const t={get(){if(void 0!==this[_])return this[_];const t={target:this},e=new CustomEvent("@context/request",{bubbles:!0,cancelable:!0,detail:t});let n=!0===this[o]&&this.element?this.element:this;if(n&&n.dispatchEvent){if(n.getRootNode&&n.getRootNode()instanceof ShadowRoot){const t=n.getRootNode();n=t.host}return n.dispatchEvent(e),void 0!==t.context?(this[_]=t.context,t.context):void 0}},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,n,t)}return t}}}function Ee(){return function(t,e){const n=e.name,o=`__ready_init_${n}`;e.addInitializer(function(){const e=this.constructor;e[o]||(e[o]=!0,e[E]||(e[E]=[]),e[E].push({methodName:n,method:t}))})}}function Ne(){return function(t,e){const n=e.name,o=`__dispose_init_${n}`;e.addInitializer(function(){const e=this.constructor;e[o]||(e[o]=!0,e[N]||(e[N]=[]),e[N].push({methodName:n,method:t}))})}}function Ae(t={}){return function(e,n){const o=n.name,s=`__moved_init_${o}`;return n.addInitializer(function(){const n=this.constructor;n[s]||(n[s]=!0,n[A]||(n[A]=[]),n[A].push({methodName:o,method:e,options:t}))}),function(...n){this[L]||(this[L]=new Map),this[L].has(o)||this[L].set(o,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const s=this[L].get(o),r=(...t)=>e.apply(this,t),i=void 0!==t.debounce&&t.debounce>0,a=void 0!==t.throttle&&t.throttle>0;switch(!0){case i:return clearTimeout(s.debounceTimer),void(s.debounceTimer=setTimeout(()=>r(...n),t.debounce));case a:{const e=t.throttle,o=Date.now();if(0===s.lastThrottleCall||o-s.lastThrottleCall>=e)return s.lastThrottleCall=o,r(...n);if(!!!s.throttleTimer){const t=e-(o-s.lastThrottleCall);s.throttleTimer=setTimeout(()=>{s.throttleTimer=null,s.lastThrottleCall=Date.now(),r(...n)},t)}return}default:return r(...n)}}}}function Ce(t={}){return function(e,n){const o=n.name;return n.addInitializer(function(){const n=this.constructor;n[C]||(n[C]=[]),n[C].push({methodName:o,method:e,options:t})}),function(...n){this[O]||(this[O]=new Map),this[O].has(o)||this[O].set(o,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const s=this[O].get(o),r=(...t)=>e.apply(this,t),i=void 0!==t.debounce&&t.debounce>0,a=void 0!==t.throttle&&t.throttle>0;switch(!0){case i:return clearTimeout(s.debounceTimer),void(s.debounceTimer=setTimeout(()=>r(...n),t.debounce));case a:{const e=t.throttle,o=Date.now();if(0===s.lastThrottleCall||o-s.lastThrottleCall>=e)return s.lastThrottleCall=o,r(...n);if(!!!s.throttleTimer){const t=e-(o-s.lastThrottleCall);s.throttleTimer=setTimeout(()=>{s.throttleTimer=null,s.lastThrottleCall=Date.now(),r(...n)},t)}return}default:return r(...n)}}}}
14
14
  /*!
15
15
  * pica-route v1.1.2
16
16
  * A pure URL pattern matching library compatible with route-parser API
17
17
  * (c) 2024
18
18
  * Released under the MIT License.
19
- */class Oe{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",o=!1;const s=t.indexOf("?");return-1!==s&&(e=t.slice(0,s),n=t.slice(s+1),e.endsWith("(")&&n.endsWith(")")&&(o=!0,e=e.slice(0,-1),n=n.slice(0,-1))),{pathSegments:this.parseSegments(e),querySegments:n?this.parseQuerySegments(n):[],queryOptional:o,template:t}}parseSegments(t){const e=[];let n=0;for(;n<t.length;){switch(t[n]){case"(":const{segments:o,endIndex:s}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:o}),n=s+1;break;case":":const{name:r,endIndex:i}=this.parseIdentifier(t,n+1);e.push({type:"param",name:r}),n=i;break;case"*":const{name:a,endIndex:l}=this.parseIdentifier(t,n+1);e.push({type:"splat",name:a}),n=l;break;default:const{value:c,endIndex:u}=this.parseLiteral(t,n);c&&e.push({type:"literal",value:c}),n=u}}return e}parseOptionalGroup(t,e){let n=1,o=e+1;for(;o<t.length&&n>0;)"("===t[o]&&n++,")"===t[o]&&n--,o++;const s=t.slice(e+1,o-1);return{segments:this.parseSegments(s),endIndex:o-1}}parseIdentifier(t,e){let n=e;for(;n<t.length&&/[\w-]/.test(t[n]);)n++;return{name:t.slice(e,n),endIndex:n}}parseLiteral(t,e){let n=e;for(;n<t.length&&!"(:*(".includes(t[n]);)n++;return{value:t.slice(e,n),endIndex:n}}parseQuerySegments(t){let e=t;e.startsWith("(")&&e.endsWith(")")&&(e=e.slice(1,-1));const n=[];let o=0;for(;o<e.length;)if(":"===e[o]){const{name:t,endIndex:s}=this.parseIdentifier(e,o+1);n.push({type:"param",name:t}),o=s}else{const{value:t,endIndex:s}=this.parseQueryLiteral(e,o);t&&n.push({type:"literal",value:t}),o=s}return n}parseQueryLiteral(t,e){let n=e;for(;n<t.length&&":"!==t[n];)n++;return{value:t.slice(e,n),endIndex:n}}getAllParamNames(){const t=new Set,e=n=>{for(const o of n)switch(o.type){case"param":case"splat":t.add(o.name);break;case"optional":e(o.segments)}};return e(this.parsed.pathSegments),e(this.parsed.querySegments),Array.from(t)}canMatchRemainingSegments(t,e,n){let o=e;for(const e of n)if("literal"===e.type){const n=t.indexOf(e.value,o);if(-1===n)return!1;o=n+e.value.length}return!0}match(t){const[e,n]=t.split("?"),o=this.matchPath(e,this.parsed.pathSegments);if(!1===o)return!1;const s=this.matchQuery(n||"",this.parsed.querySegments);if(!1===s)return!1;const r=this.getAllParamNames(),i={};for(const t of r)i[t]=void 0;return Object.assign(i,o,s),i}matchPath(t,e){const n={};let o=0;for(let s=0;s<e.length;s++){const r=e[s],i=e.slice(s+1),a=this.matchSegment(t,o,r,i);if(!1===a)return!1;Object.assign(n,a.params),o=a.nextIndex}return!(o<t.length)&&n}matchSegment(t,e,n,o=[]){switch(n.type){case"literal":return t.slice(e,e+n.value.length)===n.value&&{params:{},nextIndex:e+n.value.length};case"param":{let s=e;const r=o[0];let i,a=["/","?"];if(r&&"literal"===r.type){const n=r.value,o=t.indexOf(n,e);if(-1===o)return!1;s=o}else for(;s<t.length&&!a.includes(t[s]);)s++;if(s===e)return!1;try{i=decodeURIComponent(t.slice(e,s))}catch(n){i=t.slice(e,s)}return!(s<t.length&&"?"===t[s]&&o.length>0)&&{params:{[n.name]:i},nextIndex:s}}case"splat":{let s=t.length;const r=o[0];if(r)switch(r.type){case"literal":if("."===r.value){const n=t.indexOf(".",e);-1!==n&&(s=n)}else{const n=t.lastIndexOf(r.value);-1!==n&&n>=e&&(s=n)}break;case"param":let n=-1;for(let o=t.length-1;o>=e;o--)if("/"===t[o]){n=o;break}-1!==n&&(s=n);break;case"splat":let o=-1;for(let n=t.length-1;n>e;n--)if("/"===t[n]){o=n+1;break}if(-1!==o)s=o;else{const n=t.slice(e).split("/").filter(t=>t);s=n.length>1?e+n.slice(0,-1).join("/").length+1:e}break;case"optional":const i=t=>{for(const e of t){if("literal"===e.type)return e.value;if("optional"===e.type){const t=i(e.segments);if(t)return t}}return null},a=i(r.segments);if(a){const n=t.lastIndexOf(a);-1!==n&&n>=e&&(s=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<s&&(s=i);try{a=decodeURIComponent(t.slice(e,s))}catch(n){a=t.slice(e,s)}return{params:{[n.name]:a},nextIndex:s}}case"optional":{let s=e,r={},i=!0;for(let e=0;e<n.segments.length;e++){const o=n.segments[e],a=n.segments.slice(e+1),l=this.matchSegment(t,s,o,a);if(!1===l){i=!1;break}Object.assign(r,l.params),s=l.nextIndex}if(i){if(this.canMatchRemainingSegments(t,s,o))return{params:r,nextIndex:s}}return{params:{},nextIndex:e}}default:return!1}}findNextLiteral(t){for(const e of t){if("literal"===e.type)return e;if("optional"===e.type){const t=this.findNextLiteral(e.segments);if(t)return t}}return null}matchQuery(t,e){if(0===e.length)return{};const n={};let o=0;for(const s of e)switch(s.type){case"literal":if(t.slice(o,o+s.value.length)!==s.value)return!1;o+=s.value.length;break;case"param":{let e,r=o;for(;r<t.length&&"&"!==t[r];)r++;if(r===o)return!1;try{e=decodeURIComponent(t.slice(o,r))}catch(n){e=t.slice(o,r)}n[s.name]=e,o=r;break}}return n}reverse(t={}){const e=this.reverseSegments(this.parsed.pathSegments,t);if(!1===e)return!1;let n=e;if(this.parsed.querySegments.length>0){const e=this.reverseSegments(this.parsed.querySegments,t);if(!this.parsed.queryOptional&&!1===e)return!1;e&&""!==e&&(n+="?"+e)}return n}reverseSegments(t,e,n=!1){let o="";for(let s=0;s<t.length;s++){const r=t[s],i=t.slice(s+1);switch(r.type){case"literal":o+=r.value;break;case"param":case"splat":if(!(r.name in e))return!1;o+=String(e[r.name]);break;case"optional":if(this.hasAllParams(r.segments,e,n)||this.hasLaterOptionalGroupNeedingParams(i,e,r.segments)){const t=this.reverseSegments(r.segments,e,!0);if(!1===t)return!1;o+=t}}}return o}hasLaterOptionalGroupNeedingParams(t,e,n){for(const o of t)if("optional"===o.type&&this.hasAnyParamInSegments(o.segments,e))return this.hasOnlyLiteralsAndOptionals(n);return!1}hasOnlyLiteralsAndOptionals(t){for(const e of t)if("param"===e.type||"splat"===e.type)return!1;return!0}hasAllParams(t,e,n=!1){let o=!1,s=!1,r=!1,i=!0;for(const n of t)switch(n.type){case"param":case"splat":i=!1,n.name in e&&void 0!==e[n.name]?o=!0:r=!0}const a=n||o&&!r;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(s=!0)}return!(!o||r)||(!(!s||r)||!(!i||!n))}hasOnlyOptionalMissingParams(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(!(n.name in e))return!1}return!0}hasAnyParamInSegments(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(n.name in e)return!0;break;case"optional":if(this.hasAnyParamInSegments(n.segments,e))return!0}return!1}}function ke(t){const e={};return t.split(";").forEach(t=>{const[n,o]=t.split(":").map(t=>t.trim());n&&o&&(e[n]=o)}),e}var Le;function $e(t){const e=[];let n,o,s,r=!1,i=[],a=null,l=null;const c=t.context||{},u=new le(c,[],"",{},t.fetcher);function h(t){if(!a||!l)return null;const e=t.querySelectorAll(a);for(const t of e){if(t[E]===l)return t}return null}function d(t,i,a,l,c,u){e.push({route:new Oe(t),tag:i,transition:a,guards:l,layout:c,placard:u}),r=!1,"/404"===t&&(n=i),"/403"===t&&(o=i),"/"===t&&(s=i)}function m(){const t=new Set;i=e.filter(t=>t.placard).map(t=>{const e=t.placard;return"function"==typeof e?e(c):e}).filter(e=>!t.has(e.name)&&(t.add(e.name),!0))}function f(t,e,n){u[Q](c,i,e,n)}function p(){switch(t.type){case"hash":return window.location.hash.slice(1);case"pushstate":return window.location.pathname}}function g(t){let e;const n=!!o;if(n&&(e=document.createElement(o),e[S]=c),!n){const t=document.createElement("div");t.className="default-403",t.innerHTML="<h1>403</h1><p>Unauthorized</p>",e=t}t.innerHTML="",t.appendChild(e),a=null,l=null}function b(t,e,n){if(!!!t)return!0;const o=Array.isArray(t)?t:[t];for(const t of o){if(!t(c,e))return g(n),!1}return!0}function w(e){if(!1===e)return null;if(!!e)return e;return!!t.layout?t.layout:null}function v(t){if(!(t!==a))return{element:null,needsNewLayout:!1};a=t;if(!!t){const e=Date.now();l=e;const n=document.createElement(t);return n[S]=c,n[E]=e,{element:n,needsNewLayout:!0}}return l=null,{element:null,needsNewLayout:!0}}async function T(t,e,n,o,s,r,a){const l=o||h(t);if(!l)return;!function(t,e,n){"function"==typeof t.update&&t.update(c,i,e,n)}(l,r,a);const u=l.querySelector('[slot="page"]');if(!(!n||!u))return e.setAttribute("slot","page"),await x(l,u,e,n),void(s&&(t.innerHTML="",t.appendChild(l)));l.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),l.appendChild(e),s&&(t.innerHTML="",t.appendChild(l))}async function A(t,e,n){const o=t.children[0];!n||!o?(t.innerHTML="",t.appendChild(e)):await x(t,o,e,n)}async function _(o){const r=document.querySelector(t.target);if(!r)throw new Error(`Target element not found: ${t.target}`);m(),window.scrollTo(0,0);if((""===o?.trim()||"/"===o)&&!!s){const n=e.find(t=>t.route.match("/"));if(!b(n?.guards,{},r))return;const{element:i,transition:a,layout:l}=function(){const t=document.createElement(s);t[S]=c;const n=customElements.get(s),o=n?.[N],r=e.find(t=>t.route.match("/"));return{element:t,transition:o,layout:r?.layout}}(),u=w(l),{element:d,needsNewLayout:m}=v(u),p=a||t.transition;return null!==d||null!==h(r)?(await T(r,i,p,d,m,o,{}),void f(0,o,{})):(await A(r,i,p),void f(0,o,{}))}if(!o)return;const i=function(t,n){for(const o of e){const e=o.route.match(t);if(!1===e)continue;if(!b(o.guards,e,n))return{result:Le.GUARDS_FAILED};const s=document.createElement(o.tag);s[S]=c,s[j]=u;const r=e;return Object.keys(r).forEach(t=>s.setAttribute(t,r[t])),{result:Le.SUCCESS,element:s,transition:o.transition,layout:o.layout,routeParams:r}}return{result:Le.NOT_FOUND}}(o,r);if(i.result===Le.GUARDS_FAILED)return;if(i.result===Le.SUCCESS){const{element:e,transition:n,layout:s,routeParams:a={}}=i,l=w(s),{element:c,needsNewLayout:u}=v(l),d=n||t.transition;return null!==c||null!==h(r)?(await T(r,e,d,c,u,o,a),void f(0,o,a)):(await A(r,e,d),void f(0,o,a))}const{element:a,transition:l,layout:d}=function(){if(n){const t=document.createElement(n);t[S]=c;const e=customElements.get(n),o=e?.[N];return{element:t,transition:o,layout:void 0}}const t=document.createElement("div");return t.className="default-404",t.innerHTML="<h1>404</h1><p>Page not found</p>",{element:t,transition:void 0,layout:void 0}}(),p=w(d),{element:y,needsNewLayout:g}=v(p),E=l||t.transition;if(null!==y||null!==h(r))return await T(r,a,E,y,g,o,{}),void f(0,o,{});await A(r,a,E),f(0,o,{})}async function x(t,e,n,o){return async function(t,e,n,o={}){const s=o.outDuration||300,r=o.inDuration||300,i=o.mode||"sequential",a=o.out?ke(o.out):{opacity:"0"},l={opacity:"0"},c=o.in?ke(o.in):{opacity:"1"},u=t.style,h=u.position,d=t.tagName.includes("-")&&t.shadowRoot;d||(u.position="relative");const m=e.hasAttribute("slot")||n.hasAttribute("slot");m?(e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.transition=`opacity ${s}ms ease-in-out`,n.style.position="absolute",n.style.width="100%",n.style.height="100%",n.style.transition=`opacity ${r}ms ease-in-out`):(e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.transition=`all ${s}ms ease-in-out`,n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%"),Object.assign(n.style,l),n.style.transition=`all ${r}ms ease-in-out`,t.appendChild(n),n.offsetHeight,"simultaneous"===i?(Object.assign(e.style,a),Object.assign(n.style,c),await new Promise(t=>setTimeout(t,Math.max(s,r)))):(Object.assign(e.style,a),await new Promise(t=>setTimeout(t,s)),Object.assign(n.style,c),await new Promise(t=>setTimeout(t,r))),e.remove(),m?(n.style.position="",n.style.width="",n.style.height="",n.style.transition=""):(n.style.position="",n.style.top="",n.style.left="",n.style.width="",n.style.transition=""),Object.keys({...l,...c}).forEach(t=>{n.style[t]=""}),d||(u.position=h)}(t,e,n,o)}return{page:function(t){return function(e,n){if(n?.metadata&&n.metadata[y]){e[y]||(e[y]=new Map);for(const[t,o]of n.metadata[y])e[y].set(t,o)}ge(e),e[N]=t.transition;const o=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){this[j]=u,o?.call(this)};const s=e.prototype.disconnectedCallback;return e.prototype.disconnectedCallback=function(){s?.call(this),delete this[S],delete this[j]},customElements.get(t.tag)?console.warn(`[snice] Page "${t.tag}" is already registered. Skipping duplicate registration.`):customElements.define(t.tag,e),t.routes.forEach(e=>d(e,t.tag,t.transition,t.guards,t.layout,t.placard)),e}},initialize:function(){if(!document.querySelector(t.target))throw new Error(`Target element not found: ${t.target}`);!r&&(e.sort((t,e)=>e.route.spec.length-t.route.spec.length),r=!0),m(),function(){const e="hash"===t.type,n="pushstate"===t.type;e&&window.addEventListener("hashchange",()=>{document.querySelector(t.target)&&_(p())}),n&&window.addEventListener("popstate",()=>{document.querySelector(t.target)&&_(p())})}(),_(p())},navigate:_,register:d}}function Pe(t,e){return function(n,o){return function(...s){this[$]||(this[$]=new Map);const r=`${t}_${o.name}`;this[$].has(r)||this[$].set(r,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[$].get(r),a=n.apply(this,s),l=n=>{if(void 0===n&&!1===e?.dispatchOnUndefined)return;const o=new CustomEvent(t,{bubbles:!0,composed:!0,...e,detail:n});this.dispatchEvent(o)},c=t=>{if(e?.debounce)clearTimeout(i.debounceTimeout),i.debounceTimeout=setTimeout(()=>l(t),e.debounce);else if(e?.throttle){const n=Date.now(),o=e.throttle-(n-i.throttleLastCall);o<=0?(clearTimeout(i.throttleTimeout),i.throttleLastCall=n,l(t)):i.throttleTimeout||(i.throttleTimeout=setTimeout(()=>{i.throttleLastCall=Date.now(),i.throttleTimeout=null,l(t)},o))}else l(t)};return a instanceof Promise?a.then(t=>(c(t),t)):(c(a),a)}}}!function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(Le||(Le={}));let Me=!1;function Ie(t){Me=t}async function Re(t,e=500){if(customElements.get(t))return;let n=null;Me||(n=setTimeout(()=>{console.warn(`Custom element <${t}> is taking longer than ${e}ms to register. This may indicate a missing import or circular dependency. Set DISABLE_ELEMENT_READY_WARNINGS=true to disable this warning.`)},e));try{await customElements.whenDefined(t)}finally{n&&clearTimeout(n)}}async function De(t,e=500){const n=t.tagName.toLowerCase();await Re(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}async function qe(t,e=500){const n=[];if(t instanceof Element&&(t.tagName.includes("-")&&n.push(t),t.shadowRoot)){t.shadowRoot.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}if(t instanceof DocumentFragment){t.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}await Promise.all(n.map(t=>De(t,e)))}async function*Fe(t){for(;;)await new Promise(e=>{t[q]||(t[q]=[]),t[q].push(e)}),yield}const Ve=e("debounce-timers"),je=e("throttle-timers"),ze=e("once-called"),Be=e("memoize-cache");function We(t=300,e={}){const{leading:n=!1,trailing:o=!0,maxWait:s}=e;return function(e,r){const i=r.name;return function(...r){this[Ve]||(this[Ve]={});const a=this[Ve],l=i;a[l]&&clearTimeout(a[l].timeout);const c=Date.now(),u=!a[l],h=u?c:a[l].startTime,d=void 0!==s&&c-h>=s;if(n&&u){const t=e.apply(this,r);return a[l]={timeout:null,startTime:h,lastArgs:r},t}const m=setTimeout(()=>{(o||d)&&e.apply(this,a[l].lastArgs),delete a[l]},d?0:t);a[l]={timeout:m,startTime:h,lastArgs:r}}}}function Ue(t=300,e={}){const{leading:n=!0,trailing:o=!0}=e;return function(e,s){const r=s.name;return function(...s){this[je]||(this[je]={});const i=this[je],a=r,l=Date.now();if(i[a]){const n=l-i[a].lastInvoke;if(i[a].lastArgs=s,i[a].timeout&&clearTimeout(i[a].timeout),n>=t)e.apply(this,s),i[a].lastInvoke=l;else if(o){const o=t-n;i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),i[a].lastInvoke=Date.now(),i[a].timeout=null},o)}}else n&&e.apply(this,s),i[a]={lastInvoke:l,timeout:null,lastArgs:s},o&&!n&&(i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),delete i[a]},t))}}}function He(t=!0){let e,n=!1;return function(o,s){const r=s.name;return function(...s){return t?(this[ze]||(this[ze]={}),this[ze][r]||(this[ze][r]={called:!0,result:o.apply(this,s)}),this[ze][r].result):(n||(n=!0,e=o.apply(this,s)),e)}}}function Ge(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:o}=t;return function(t,s){const r=s.name;return function(...s){this[Be]||(this[Be]={}),this[Be][r]||(this[Be][r]=new Map);const i=this[Be][r],a=e(...s);if(i.has(a)){const t=i.get(a);if(void 0===o)return t.value;if(!(Date.now()-t.timestamp>o))return t.value;i.delete(a)}const l=t.apply(this,s);if(i.set(a,{value:l,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return l}}}function Ke(t){if(t[Ve]){for(const e in t[Ve])t[Ve][e]?.timeout&&clearTimeout(t[Ve][e].timeout);t[Ve]={}}}function Je(t){if(t[je]){for(const e in t[je])t[je][e]?.timeout&&clearTimeout(t[je][e].timeout);t[je]={}}}function Qe(t,e){t[Be]&&(e?delete t[Be][e]:t[Be]={})}function Xe(t,e){t[ze]&&(e?delete t[ze][e]:t[ze]={})}class Ye{constructor(){this.requestMiddlewares=[],this.responseMiddlewares=[]}use(t,e){"request"===t?this.requestMiddlewares.push(e):this.responseMiddlewares.push(e)}create(t){const e=this.requestMiddlewares,n=this.responseMiddlewares;return async function(t,o){const s=new Request(t,o);let r=0;const i=async()=>{if(r<e.length){return e[r++].call(this,s,i)}const t=await fetch(s);let o=0;const a=async()=>{if(o<n.length){return n[o++].call(this,t,a)}return t};return a()};return i()}.bind(t)}}
19
+ */class ke{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",o=!1;const s=t.indexOf("?");return-1!==s&&(e=t.slice(0,s),n=t.slice(s+1),e.endsWith("(")&&n.endsWith(")")&&(o=!0,e=e.slice(0,-1),n=n.slice(0,-1))),{pathSegments:this.parseSegments(e),querySegments:n?this.parseQuerySegments(n):[],queryOptional:o,template:t}}parseSegments(t){const e=[];let n=0;for(;n<t.length;){switch(t[n]){case"(":const{segments:o,endIndex:s}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:o}),n=s+1;break;case":":const{name:r,endIndex:i}=this.parseIdentifier(t,n+1);e.push({type:"param",name:r}),n=i;break;case"*":const{name:a,endIndex:l}=this.parseIdentifier(t,n+1);e.push({type:"splat",name:a}),n=l;break;default:const{value:c,endIndex:u}=this.parseLiteral(t,n);c&&e.push({type:"literal",value:c}),n=u}}return e}parseOptionalGroup(t,e){let n=1,o=e+1;for(;o<t.length&&n>0;)"("===t[o]&&n++,")"===t[o]&&n--,o++;const s=t.slice(e+1,o-1);return{segments:this.parseSegments(s),endIndex:o-1}}parseIdentifier(t,e){let n=e;for(;n<t.length&&/[\w-]/.test(t[n]);)n++;return{name:t.slice(e,n),endIndex:n}}parseLiteral(t,e){let n=e;for(;n<t.length&&!"(:*(".includes(t[n]);)n++;return{value:t.slice(e,n),endIndex:n}}parseQuerySegments(t){let e=t;e.startsWith("(")&&e.endsWith(")")&&(e=e.slice(1,-1));const n=[];let o=0;for(;o<e.length;)if(":"===e[o]){const{name:t,endIndex:s}=this.parseIdentifier(e,o+1);n.push({type:"param",name:t}),o=s}else{const{value:t,endIndex:s}=this.parseQueryLiteral(e,o);t&&n.push({type:"literal",value:t}),o=s}return n}parseQueryLiteral(t,e){let n=e;for(;n<t.length&&":"!==t[n];)n++;return{value:t.slice(e,n),endIndex:n}}getAllParamNames(){const t=new Set,e=n=>{for(const o of n)switch(o.type){case"param":case"splat":t.add(o.name);break;case"optional":e(o.segments)}};return e(this.parsed.pathSegments),e(this.parsed.querySegments),Array.from(t)}canMatchRemainingSegments(t,e,n){let o=e;for(const e of n)if("literal"===e.type){const n=t.indexOf(e.value,o);if(-1===n)return!1;o=n+e.value.length}return!0}match(t){const[e,n]=t.split("?"),o=this.matchPath(e,this.parsed.pathSegments);if(!1===o)return!1;const s=this.matchQuery(n||"",this.parsed.querySegments);if(!1===s)return!1;const r=this.getAllParamNames(),i={};for(const t of r)i[t]=void 0;return Object.assign(i,o,s),i}matchPath(t,e){const n={};let o=0;for(let s=0;s<e.length;s++){const r=e[s],i=e.slice(s+1),a=this.matchSegment(t,o,r,i);if(!1===a)return!1;Object.assign(n,a.params),o=a.nextIndex}return!(o<t.length)&&n}matchSegment(t,e,n,o=[]){switch(n.type){case"literal":return t.slice(e,e+n.value.length)===n.value&&{params:{},nextIndex:e+n.value.length};case"param":{let s=e;const r=o[0];let i,a=["/","?"];if(r&&"literal"===r.type){const n=r.value,o=t.indexOf(n,e);if(-1===o)return!1;s=o}else for(;s<t.length&&!a.includes(t[s]);)s++;if(s===e)return!1;try{i=decodeURIComponent(t.slice(e,s))}catch(n){i=t.slice(e,s)}return!(s<t.length&&"?"===t[s]&&o.length>0)&&{params:{[n.name]:i},nextIndex:s}}case"splat":{let s=t.length;const r=o[0];if(r)switch(r.type){case"literal":if("."===r.value){const n=t.indexOf(".",e);-1!==n&&(s=n)}else{const n=t.lastIndexOf(r.value);-1!==n&&n>=e&&(s=n)}break;case"param":let n=-1;for(let o=t.length-1;o>=e;o--)if("/"===t[o]){n=o;break}-1!==n&&(s=n);break;case"splat":let o=-1;for(let n=t.length-1;n>e;n--)if("/"===t[n]){o=n+1;break}if(-1!==o)s=o;else{const n=t.slice(e).split("/").filter(t=>t);s=n.length>1?e+n.slice(0,-1).join("/").length+1:e}break;case"optional":const i=t=>{for(const e of t){if("literal"===e.type)return e.value;if("optional"===e.type){const t=i(e.segments);if(t)return t}}return null},a=i(r.segments);if(a){const n=t.lastIndexOf(a);-1!==n&&n>=e&&(s=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<s&&(s=i);try{a=decodeURIComponent(t.slice(e,s))}catch(n){a=t.slice(e,s)}return{params:{[n.name]:a},nextIndex:s}}case"optional":{let s=e,r={},i=!0;for(let e=0;e<n.segments.length;e++){const o=n.segments[e],a=n.segments.slice(e+1),l=this.matchSegment(t,s,o,a);if(!1===l){i=!1;break}Object.assign(r,l.params),s=l.nextIndex}if(i){if(this.canMatchRemainingSegments(t,s,o))return{params:r,nextIndex:s}}return{params:{},nextIndex:e}}default:return!1}}findNextLiteral(t){for(const e of t){if("literal"===e.type)return e;if("optional"===e.type){const t=this.findNextLiteral(e.segments);if(t)return t}}return null}matchQuery(t,e){if(0===e.length)return{};const n={};let o=0;for(const s of e)switch(s.type){case"literal":if(t.slice(o,o+s.value.length)!==s.value)return!1;o+=s.value.length;break;case"param":{let e,r=o;for(;r<t.length&&"&"!==t[r];)r++;if(r===o)return!1;try{e=decodeURIComponent(t.slice(o,r))}catch(n){e=t.slice(o,r)}n[s.name]=e,o=r;break}}return n}reverse(t={}){const e=this.reverseSegments(this.parsed.pathSegments,t);if(!1===e)return!1;let n=e;if(this.parsed.querySegments.length>0){const e=this.reverseSegments(this.parsed.querySegments,t);if(!this.parsed.queryOptional&&!1===e)return!1;e&&""!==e&&(n+="?"+e)}return n}reverseSegments(t,e,n=!1){let o="";for(let s=0;s<t.length;s++){const r=t[s],i=t.slice(s+1);switch(r.type){case"literal":o+=r.value;break;case"param":case"splat":if(!(r.name in e))return!1;o+=String(e[r.name]);break;case"optional":if(this.hasAllParams(r.segments,e,n)||this.hasLaterOptionalGroupNeedingParams(i,e,r.segments)){const t=this.reverseSegments(r.segments,e,!0);if(!1===t)return!1;o+=t}}}return o}hasLaterOptionalGroupNeedingParams(t,e,n){for(const o of t)if("optional"===o.type&&this.hasAnyParamInSegments(o.segments,e))return this.hasOnlyLiteralsAndOptionals(n);return!1}hasOnlyLiteralsAndOptionals(t){for(const e of t)if("param"===e.type||"splat"===e.type)return!1;return!0}hasAllParams(t,e,n=!1){let o=!1,s=!1,r=!1,i=!0;for(const n of t)switch(n.type){case"param":case"splat":i=!1,n.name in e&&void 0!==e[n.name]?o=!0:r=!0}const a=n||o&&!r;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(s=!0)}return!(!o||r)||(!(!s||r)||!(!i||!n))}hasOnlyOptionalMissingParams(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(!(n.name in e))return!1}return!0}hasAnyParamInSegments(t,e){for(const n of t)switch(n.type){case"param":case"splat":if(n.name in e)return!0;break;case"optional":if(this.hasAnyParamInSegments(n.segments,e))return!0}return!1}}function Le(t){const e={};return t.split(";").forEach(t=>{const[n,o]=t.split(":").map(t=>t.trim());n&&o&&(e[n]=o)}),e}var Oe;function $e(t){const e=t.window??window,n=t.document??document,o=[];let s,r,i,a=!1,l=[],c=null,u=null;const h=t.context||{},d=new le(h,[],"",{},t.fetcher);function m(t){if(!c||!u)return null;const e=t.querySelectorAll(c);for(const t of e){if(t[x]===u)return t}return null}function p(t,e,n,l,c,u){o.push({route:new ke(t),tag:e,transition:n,guards:l,layout:c,placard:u}),a=!1,"/404"===t&&(s=e),"/403"===t&&(r=e),"/"===t&&(i=e)}function f(){const t=new Set;l=o.filter(t=>t.placard).map(t=>{const e=t.placard;return"function"==typeof e?e(h):e}).filter(e=>!t.has(e.name)&&(t.add(e.name),!0))}function g(t,e,n){d[Q](h,l,e,n)}function b(){switch(t.type){case"hash":return e.location.hash.slice(1);case"pushstate":return e.location.pathname}}function w(t){let e;const o=!!r;if(o&&(e=n.createElement(r),e[_]=h),!o){const t=n.createElement("div");t.className="default-403",t.innerHTML="<h1>403</h1><p>Unauthorized</p>",e=t}t.innerHTML="",t.appendChild(e),c=null,u=null}function v(t,e,n){if(!!!t)return!0;const o=Array.isArray(t)?t:[t];for(const t of o){if(!t(h,e))return w(n),!1}return!0}function T(e){if(!1===e)return null;if(!!e)return e;return!!t.layout?t.layout:null}function E(t){if(!(t!==c))return{element:null,needsNewLayout:!1};c=t;if(!!t){const e=Date.now();u=e;const o=n.createElement(t);return o[_]=h,o[x]=e,{element:o,needsNewLayout:!0}}return u=null,{element:null,needsNewLayout:!0}}async function N(t,e,n,o,s,r,i){const a=o||m(t);if(!a)return;!function(t,e,n){"function"==typeof t.update&&t.update(h,l,e,n)}(a,r,i);const c=a.querySelector('[slot="page"]');if(!(!n||!c))return e.setAttribute("slot","page"),await k(a,c,e,n),void(s&&(t.innerHTML="",t.appendChild(a)));a.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),a.appendChild(e),s&&(t.innerHTML="",t.appendChild(a))}async function A(t,e,n){const o=t.children[0];!n||!o?(t.innerHTML="",t.appendChild(e)):await k(t,o,e,n)}async function C(r){const a=n.querySelector(t.target);if(!a)throw new Error(`Target element not found: ${t.target}`);f(),e.scrollTo(0,0);if((""===r?.trim()||"/"===r)&&!!i){const s=o.find(t=>t.route.match("/"));if(!v(s?.guards,{},a))return;const{element:l,transition:c,layout:u}=function(){const t=n.createElement(i);t[_]=h;const s=e.customElements.get(i),r=s?.[S],a=o.find(t=>t.route.match("/"));return{element:t,transition:r,layout:a?.layout}}(),d=T(u),{element:p,needsNewLayout:f}=E(d),y=c||t.transition;return null!==p||null!==m(a)?(await N(a,l,y,p,f,r,{}),void g(0,r,{})):(await A(a,l,y),void g(0,r,{}))}if(!r)return;const l=function(t,e){for(const s of o){const o=s.route.match(t);if(!1===o)continue;if(!v(s.guards,o,e))return{result:Oe.GUARDS_FAILED};const r=n.createElement(s.tag);r[_]=h,r[j]=d;const i=o;return Object.keys(i).forEach(t=>r.setAttribute(t,i[t])),{result:Oe.SUCCESS,element:r,transition:s.transition,layout:s.layout,routeParams:i}}return{result:Oe.NOT_FOUND}}(r,a);if(l.result===Oe.GUARDS_FAILED)return;if(l.result===Oe.SUCCESS){const{element:e,transition:n,layout:o,routeParams:s={}}=l,i=T(o),{element:c,needsNewLayout:u}=E(i),h=n||t.transition;return null!==c||null!==m(a)?(await N(a,e,h,c,u,r,s),void g(0,r,s)):(await A(a,e,h),void g(0,r,s))}const{element:c,transition:u,layout:p}=function(){if(s){const t=n.createElement(s);t[_]=h;const o=e.customElements.get(s),r=o?.[S];return{element:t,transition:r,layout:void 0}}const t=n.createElement("div");return t.className="default-404",t.innerHTML="<h1>404</h1><p>Page not found</p>",{element:t,transition:void 0,layout:void 0}}(),y=T(p),{element:b,needsNewLayout:w}=E(y),x=u||t.transition;if(null!==b||null!==m(a))return await N(a,c,x,b,w,r,{}),void g(0,r,{});await A(a,c,x),g(0,r,{})}async function k(t,e,n,o){return async function(t,e,n,o={}){const s=o.outDuration||300,r=o.inDuration||300,i=o.mode||"sequential",a=o.out?Le(o.out):{opacity:"0"},l={opacity:"0"},c=o.in?Le(o.in):{opacity:"1"},u=t.style,h=u.position,d=t.tagName.includes("-")&&t.shadowRoot;d||(u.position="relative");const m=e.hasAttribute("slot")||n.hasAttribute("slot");m?(e.style.position="absolute",e.style.width="100%",e.style.height="100%",e.style.transition=`opacity ${s}ms ease-in-out`,n.style.position="absolute",n.style.width="100%",n.style.height="100%",n.style.transition=`opacity ${r}ms ease-in-out`):(e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.transition=`all ${s}ms ease-in-out`,n.style.position="absolute",n.style.top="0",n.style.left="0",n.style.width="100%"),Object.assign(n.style,l),n.style.transition=`all ${r}ms ease-in-out`,t.appendChild(n),n.offsetHeight,"simultaneous"===i?(Object.assign(e.style,a),Object.assign(n.style,c),await new Promise(t=>setTimeout(t,Math.max(s,r)))):(Object.assign(e.style,a),await new Promise(t=>setTimeout(t,s)),Object.assign(n.style,c),await new Promise(t=>setTimeout(t,r))),e.remove(),m?(n.style.position="",n.style.width="",n.style.height="",n.style.transition=""):(n.style.position="",n.style.top="",n.style.left="",n.style.width="",n.style.transition=""),Object.keys({...l,...c}).forEach(t=>{n.style[t]=""}),d||(u.position=h)}(t,e,n,o)}return{page:function(t){return function(n,o){if(o?.metadata&&o.metadata[y]){n[y]||(n[y]=new Map);for(const[t,e]of o.metadata[y])n[y].set(t,e)}ge(n),n[S]=t.transition;const s=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){this[j]=d,s?.call(this)};const r=n.prototype.disconnectedCallback;return n.prototype.disconnectedCallback=function(){r?.call(this),delete this[_],delete this[j]},e.customElements.get(t.tag)?console.warn(`[snice] Page "${t.tag}" is already registered. Skipping duplicate registration.`):e.customElements.define(t.tag,n),t.routes.forEach(e=>p(e,t.tag,t.transition,t.guards,t.layout,t.placard)),n}},initialize:function(){if(!n.querySelector(t.target))throw new Error(`Target element not found: ${t.target}`);!a&&(o.sort((t,e)=>e.route.spec.length-t.route.spec.length),a=!0),f(),function(){const o="hash"===t.type,s="pushstate"===t.type;o&&e.addEventListener("hashchange",()=>{n.querySelector(t.target)&&C(b())}),s&&e.addEventListener("popstate",()=>{n.querySelector(t.target)&&C(b())})}(),C(b())},navigate:C,register:p}}!function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(Oe||(Oe={}));const Pe=".snice-tooltip--visible{opacity:1!important;transform:scale(1)!important}.snice-tooltip__arrow{position:absolute;width:0;height:0;border-style:solid;border-color:transparent}.snice-tooltip--top .snice-tooltip__arrow,.snice-tooltip--top-start .snice-tooltip__arrow,.snice-tooltip--top-end .snice-tooltip__arrow{bottom:-6px;border-width:6px 6px 0;border-top-color:hsl(0 0% 20%)}.snice-tooltip--bottom .snice-tooltip__arrow,.snice-tooltip--bottom-start .snice-tooltip__arrow,.snice-tooltip--bottom-end .snice-tooltip__arrow{top:-6px;border-width:0 6px 6px;border-bottom-color:hsl(0 0% 20%)}.snice-tooltip--left .snice-tooltip__arrow,.snice-tooltip--left-start .snice-tooltip__arrow,.snice-tooltip--left-end .snice-tooltip__arrow{right:-6px;border-width:6px 0 6px 6px;border-left-color:hsl(0 0% 20%)}.snice-tooltip--right .snice-tooltip__arrow,.snice-tooltip--right-start .snice-tooltip__arrow,.snice-tooltip--right-end .snice-tooltip__arrow{left:-6px;border-width:6px 6px 6px 0;border-right-color:hsl(0 0% 20%)}.snice-tooltip--top .snice-tooltip__arrow,.snice-tooltip--bottom .snice-tooltip__arrow{left:50%;transform:translateX(-50%)}.snice-tooltip--top-start .snice-tooltip__arrow,.snice-tooltip--bottom-start .snice-tooltip__arrow{left:16px}.snice-tooltip--top-end .snice-tooltip__arrow,.snice-tooltip--bottom-end .snice-tooltip__arrow{right:16px}.snice-tooltip--left .snice-tooltip__arrow,.snice-tooltip--right .snice-tooltip__arrow{top:50%;transform:translateY(-50%)}.snice-tooltip--left-start .snice-tooltip__arrow,.snice-tooltip--right-start .snice-tooltip__arrow{top:16px}.snice-tooltip--left-end .snice-tooltip__arrow,.snice-tooltip--right-end .snice-tooltip__arrow{bottom:16px;top:auto}",Me=new WeakMap;let Ie=!1;function Re(t){const e=getComputedStyle(t),n=(t,n)=>e.getPropertyValue(t).trim()||n;return{position:n("--tooltip-position","top"),trigger:n("--tooltip-trigger","hover"),delay:parseInt(n("--tooltip-delay","0"),10),hideDelay:parseInt(n("--tooltip-hide-delay","0"),10),offset:parseInt(n("--tooltip-offset","12"),10),arrow:"none"!==n("--tooltip-arrow","auto"),maxWidth:parseInt(n("--tooltip-max-width","250"),10),zIndex:parseInt(n("--tooltip-z-index","10000"),10),strictPositioning:"true"===n("--tooltip-strict-positioning",""),bg:n("--tooltip-bg","hsl(0 0% 20%)"),color:n("--tooltip-color","white"),padding:n("--tooltip-padding","8px 12px"),radius:n("--tooltip-radius","6px"),fontSize:n("--tooltip-font-size","14px")}}function De(t,e,n,o,s){let r=0,i=0;const a=t.left+t.width/2,l=t.top+t.height/2,c=o,u=o+s;switch(n){case"top":r=a-e.width/2,i=t.top-e.height-c;break;case"top-start":r=t.left,i=t.top-e.height-c;break;case"top-end":r=t.right-e.width,i=t.top-e.height-c;break;case"bottom":r=a-e.width/2,i=t.bottom+c;break;case"bottom-start":r=t.left,i=t.bottom+c;break;case"bottom-end":r=t.right-e.width,i=t.bottom+c;break;case"left":r=t.left-e.width-u,i=l-e.height/2;break;case"left-start":r=t.left-e.width-u,i=t.top;break;case"left-end":r=t.left-e.width-u,i=t.bottom-e.height;break;case"right":r=t.right+u,i=l-e.height/2;break;case"right-start":r=t.right+u,i=t.top;break;case"right-end":r=t.right+u,i=t.bottom-e.height}return{left:r,top:i}}function qe(t){const e=t.getAttribute("tooltip");if(!e)return;!function(){if(!Ie)try{if("adoptedStyleSheets"in document&&"CSSStyleSheet"in window){const t=new CSSStyleSheet;t.replaceSync(Pe),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}else{const t=document.createElement("style");t.textContent=Pe,document.head.appendChild(t)}Ie=!0}catch(t){console.warn("Failed to inject tooltip portal styles:",t)}}();const n=Re(t);let o=Me.get(t);if(o||(o={portal:null,listeners:[],activePosition:n.position},Me.set(t,o)),o.portal){const t=o.portal;t.style.zIndex=String(n.zIndex),t.style.padding=n.padding,t.style.background=n.bg,t.style.color=n.color,t.style.borderRadius=n.radius,t.style.fontSize=n.fontSize,t.style.maxWidth=`${n.maxWidth}px`;let e=t.querySelector(".snice-tooltip__arrow");n.arrow&&!e?(e=document.createElement("div"),e.className="snice-tooltip__arrow",e.style.cssText="position:absolute;width:0;height:0;border-style:solid;",t.appendChild(e)):!n.arrow&&e?e.style.display="none":n.arrow&&e&&(e.style.display="")}else o.portal=function(t){const e=document.createElement("div");e.className=`snice-tooltip snice-tooltip--${t.position}`,e.setAttribute("role","tooltip"),e.style.cssText=`\n position: fixed;\n z-index: ${t.zIndex};\n padding: ${t.padding};\n background: ${t.bg};\n color: ${t.color};\n border-radius: ${t.radius};\n font-size: ${t.fontSize};\n line-height: 1.4;\n max-width: ${t.maxWidth}px;\n width: max-content;\n pointer-events: none;\n opacity: 0;\n transform: scale(0.95);\n transition: opacity 0.2s, transform 0.2s;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n display: none;\n `;const n=document.createElement("div");if(n.className="snice-tooltip__content",e.appendChild(n),t.arrow){const t=document.createElement("div");t.className="snice-tooltip__arrow",t.style.cssText="position:absolute;width:0;height:0;border-style:solid;",e.appendChild(t)}return document.body.appendChild(e),e}(n);const s=o.portal,r=s.querySelector(".snice-tooltip__content");r&&(r.textContent=e),s.style.display="block",s.offsetHeight,s.style.visibility="hidden",s.style.left="-9999px",s.style.top="-9999px";const i=t.getBoundingClientRect(),a=s.getBoundingClientRect();s.style.visibility="";const l=n.arrow?6:0,c=function(t,e,n,o,s,r){const i=window.innerWidth,a=window.innerHeight;let l=n,c=De(t,e,l,o,s);if(!(r||c.left>=0&&c.top>=0&&c.left+e.width<=i&&c.top+e.height<=a))for(const n of function(t){return{top:["bottom","left","right"],"top-start":["bottom-start","left","right"],"top-end":["bottom-end","left","right"],bottom:["top","left","right"],"bottom-start":["top-start","left","right"],"bottom-end":["top-end","left","right"],left:["right","top","bottom"],"left-start":["right-start","top","bottom"],"left-end":["right-end","top","bottom"],right:["left","top","bottom"],"right-start":["left-start","top","bottom"],"right-end":["left-end","top","bottom"]}[t]||["top","bottom","left","right"]}(l)){const r=De(t,e,n,o,s);if(r.left>=0&&r.top>=0&&r.left+e.width<=i&&r.top+e.height<=a){l=n,c=r;break}}return{left:c.left,top:c.top,adjustedPosition:l}}(i,a,n.position,n.offset,l,n.strictPositioning);c.adjustedPosition!==o.activePosition&&(s.classList.remove(`snice-tooltip--${o.activePosition}`),s.classList.add(`snice-tooltip--${c.adjustedPosition}`),o.activePosition=c.adjustedPosition),s.style.left=`${c.left}px`,s.style.top=`${c.top}px`,s.classList.add("snice-tooltip--visible")}function Fe(t){const e=Me.get(t);if(!e?.portal)return;e.portal.classList.remove("snice-tooltip--visible");const n=e.portal;setTimeout(()=>{n&&(n.style.display="none")},200)}function ze(t){const e=Me.get(t);if(!e)return;Ve(e);const n=Re(t);n.delay>0?e.showTimeout=window.setTimeout(()=>qe(t),n.delay):qe(t)}function je(t){const e=Me.get(t);if(!e)return;Ve(e);const n=Re(t);n.hideDelay>0?e.hideTimeout=window.setTimeout(()=>Fe(t),n.hideDelay):Fe(t)}function Ve(t){void 0!==t.showTimeout&&(clearTimeout(t.showTimeout),t.showTimeout=void 0),void 0!==t.hideTimeout&&(clearTimeout(t.hideTimeout),t.hideTimeout=void 0)}function We(t){if(Me.has(t))return;const e=Re(t),n={portal:null,listeners:[],activePosition:e.position};Me.set(t,n);const o=(e,o)=>{t.addEventListener(e,o),n.listeners.push({type:e,fn:o})};switch(e.trigger){case"hover":o("mouseenter",()=>ze(t)),o("mouseleave",()=>je(t)),o("focusin",()=>ze(t)),o("focusout",()=>je(t));break;case"focus":o("focusin",()=>ze(t)),o("focusout",()=>je(t));break;case"click":{const e=n=>{t.contains(n.target)||(je(t),document.removeEventListener("click",e))};o("click",()=>{const n=Me.get(t),o=n?.portal?.classList.contains("snice-tooltip--visible");o?je(t):(ze(t),setTimeout(()=>document.addEventListener("click",e),0))});break}}}function He(t){const e=Me.get(t);if(e){Ve(e);for(const{type:n,fn:o}of e.listeners)t.removeEventListener(n,o);e.portal&&e.portal.remove(),Me.delete(t)}}function Be(t){if(!(t instanceof HTMLElement))return;t.getAttribute("tooltip")&&We(t)}function Ue(){if(globalThis.sniceTooltipsInitialized)return;globalThis.sniceTooltipsInitialized=!0;const t=new MutationObserver(t=>{for(const e of t)if("attributes"===e.type&&"tooltip"===e.attributeName){const t=e.target;t.hasAttribute("tooltip")?(He(t),We(t)):He(t)}else"childList"===e.type&&(e.addedNodes.forEach(t=>{t instanceof HTMLElement&&(Be(t),t.querySelectorAll("[tooltip]").forEach(Be))}),e.removedNodes.forEach(t=>{t instanceof HTMLElement&&(He(t),t.querySelectorAll("[tooltip]").forEach(t=>{t instanceof HTMLElement&&He(t)}))}))}),e=()=>{document.querySelectorAll("[tooltip]").forEach(Be),t.observe(document.body,{attributes:!0,attributeFilter:["tooltip"],childList:!0,subtree:!0})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e(),globalThis.sniceTooltipObserver=t}function Ge(){const t=globalThis.sniceTooltipObserver;t&&(t.disconnect(),globalThis.sniceTooltipObserver=void 0),document.querySelectorAll("[tooltip]").forEach(t=>{t instanceof HTMLElement&&He(t)}),globalThis.sniceTooltipsInitialized=!1}function Ke(t,e){return function(n,o){return function(...s){this[$]||(this[$]=new Map);const r=`${t}_${o.name}`;this[$].has(r)||this[$].set(r,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[$].get(r),a=n.apply(this,s),l=n=>{if(void 0===n&&!1===e?.dispatchOnUndefined)return;const o=new CustomEvent(t,{bubbles:!0,composed:!0,...e,detail:n});this.dispatchEvent(o)},c=t=>{if(e?.debounce)clearTimeout(i.debounceTimeout),i.debounceTimeout=setTimeout(()=>l(t),e.debounce);else if(e?.throttle){const n=Date.now(),o=e.throttle-(n-i.throttleLastCall);o<=0?(clearTimeout(i.throttleTimeout),i.throttleLastCall=n,l(t)):i.throttleTimeout||(i.throttleTimeout=setTimeout(()=>{i.throttleLastCall=Date.now(),i.throttleTimeout=null,l(t)},o))}else l(t)};return a instanceof Promise?a.then(t=>(c(t),t)):(c(a),a)}}}let Je=!1;function Qe(t){Je=t}async function Xe(t,e=500){if(customElements.get(t))return;let n=null;Je||(n=setTimeout(()=>{console.warn(`Custom element <${t}> is taking longer than ${e}ms to register. This may indicate a missing import or circular dependency. Set DISABLE_ELEMENT_READY_WARNINGS=true to disable this warning.`)},e));try{await customElements.whenDefined(t)}finally{n&&clearTimeout(n)}}async function Ye(t,e=500){const n=t.tagName.toLowerCase();await Xe(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}async function Ze(t,e=500){const n=[];if(t instanceof Element&&(t.tagName.includes("-")&&n.push(t),t.shadowRoot)){t.shadowRoot.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}if(t instanceof DocumentFragment){t.querySelectorAll("*").forEach(t=>{t.tagName.includes("-")&&n.push(t)})}await Promise.all(n.map(t=>Ye(t,e)))}async function*tn(t){for(;;)await new Promise(e=>{t[q]||(t[q]=[]),t[q].push(e)}),yield}const en=e("debounce-timers"),nn=e("throttle-timers"),on=e("once-called"),sn=e("memoize-cache");function rn(t=300,e={}){const{leading:n=!1,trailing:o=!0,maxWait:s}=e;return function(e,r){const i=r.name;return function(...r){this[en]||(this[en]={});const a=this[en],l=i;a[l]&&clearTimeout(a[l].timeout);const c=Date.now(),u=!a[l],h=u?c:a[l].startTime,d=void 0!==s&&c-h>=s;if(n&&u){const t=e.apply(this,r);return a[l]={timeout:null,startTime:h,lastArgs:r},t}const m=setTimeout(()=>{(o||d)&&e.apply(this,a[l].lastArgs),delete a[l]},d?0:t);a[l]={timeout:m,startTime:h,lastArgs:r}}}}function an(t=300,e={}){const{leading:n=!0,trailing:o=!0}=e;return function(e,s){const r=s.name;return function(...s){this[nn]||(this[nn]={});const i=this[nn],a=r,l=Date.now();if(i[a]){const n=l-i[a].lastInvoke;if(i[a].lastArgs=s,i[a].timeout&&clearTimeout(i[a].timeout),n>=t)e.apply(this,s),i[a].lastInvoke=l;else if(o){const o=t-n;i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),i[a].lastInvoke=Date.now(),i[a].timeout=null},o)}}else n&&e.apply(this,s),i[a]={lastInvoke:l,timeout:null,lastArgs:s},o&&!n&&(i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),delete i[a]},t))}}}function ln(t=!0){let e,n=!1;return function(o,s){const r=s.name;return function(...s){return t?(this[on]||(this[on]={}),this[on][r]||(this[on][r]={called:!0,result:o.apply(this,s)}),this[on][r].result):(n||(n=!0,e=o.apply(this,s)),e)}}}function cn(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:o}=t;return function(t,s){const r=s.name;return function(...s){this[sn]||(this[sn]={}),this[sn][r]||(this[sn][r]=new Map);const i=this[sn][r],a=e(...s);if(i.has(a)){const t=i.get(a);if(void 0===o)return t.value;if(!(Date.now()-t.timestamp>o))return t.value;i.delete(a)}const l=t.apply(this,s);if(i.set(a,{value:l,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return l}}}function un(t){if(t[en]){for(const e in t[en])t[en][e]?.timeout&&clearTimeout(t[en][e].timeout);t[en]={}}}function hn(t){if(t[nn]){for(const e in t[nn])t[nn][e]?.timeout&&clearTimeout(t[nn][e].timeout);t[nn]={}}}function dn(t,e){t[sn]&&(e?delete t[sn][e]:t[sn]={})}function mn(t,e){t[on]&&(e?delete t[on][e]:t[on]={})}class pn{constructor(){this.requestMiddlewares=[],this.responseMiddlewares=[]}use(t,e){"request"===t?this.requestMiddlewares.push(e):this.responseMiddlewares.push(e)}create(t){const e=this.requestMiddlewares,n=this.responseMiddlewares;return async function(t,o){const s=new Request(t,o);let r=0;const i=async()=>{if(r<e.length){return e[r++].call(this,s,i)}const t=await fetch(s);let o=0;const a=async()=>{if(o<n.length){return n[o++].call(this,t,a)}return t};return a()};return i()}.bind(t)}}
20
20
  /*!
21
- * snice v4.13.0
21
+ * snice v4.15.0
22
22
  * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
23
23
  * (c) 2024
24
24
  * Released under the MIT License.
25
- */globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const Ze=globalThis.snice;function tn(t){return Ze.symbols.has(t)||Ze.symbols.set(t,Symbol.for(`snice:${t}`)),Ze.symbols.get(t)}tn("is-controller-class"),tn("is-controller-instance"),tn("is-element-class"),tn("channel-handlers"),tn("ready-promise"),tn("ready-resolve"),tn("rendered-promise"),tn("rendered-resolve"),tn("controller"),tn("initialized"),tn("on-handlers"),tn("controller-key"),tn("controller-name"),tn("controller-id"),tn("controller-operations"),tn("native-controller"),tn("cleanup"),tn("properties"),tn("property-values"),tn("pre-init-property-values"),tn("properties-initialized"),tn("property-watchers"),tn("explicitly-set-properties"),tn("router-context"),tn("current-page-marker"),tn("context-request-handler"),tn("page-transition"),tn("created-at"),tn("ready-handlers"),tn("dispose-handlers"),tn("moved-handlers"),tn("adopted-handlers"),tn("observers"),tn("parts"),tn("part-timers"),tn("moved-timers"),tn("adopted-timers"),tn("dispatch-timers"),tn("render-method"),tn("render-options"),tn("render-instance"),tn("render-scheduled"),tn("render-timers"),tn("render-callbacks"),tn("styles-method"),tn("styles-applied"),tn("context-handler"),tn("context-method-name"),tn("navigation-context-instance"),tn("registered-elements"),tn("is-updating"),tn("context-register"),tn("context-unregister"),tn("context-notify-element"),tn("context-options"),tn("context-timer"),tn("context-called"),tn("context-update");export{le as Context,Ye as ContextAwareFetcher,o as IS_CONTROLLER_INSTANCE,$e as Router,ne as SimpleArray,Ce as adopted,ge as applyElementFunctionality,Ke as clearDebounceTimers,Qe as clearMemoizeCache,Je as clearThrottleTimers,te as context,Ee as contextProperty,Jt as controller,ft as css,We as debounce,Pe as dispatch,_e as dispose,be as element,e as getSymbol,mt as html,we as layout,Ge as memoize,xe as moved,At as noChange,yt as nothing,Z as observe,zt as on,He as once,ve as property,Te as query,Se as queryAll,Ae as ready,fe as render,at as request,Xe as resetOnce,lt as respond,Ie as setDisableElementReadyWarnings,pe as styles,Ue as throttle,Fe as trackRenders,bt as unsafeHTML,Yt as useNativeElementControllers,qe as waitForAllCustomElements,Re as waitForElementDefined,De as waitForElementReady,Ne as watch};
25
+ */globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const fn=globalThis.snice;function yn(t){return fn.symbols.has(t)||fn.symbols.set(t,Symbol.for(`snice:${t}`)),fn.symbols.get(t)}yn("is-controller-class"),yn("is-controller-instance"),yn("is-element-class"),yn("channel-handlers"),yn("ready-promise"),yn("ready-resolve"),yn("rendered-promise"),yn("rendered-resolve"),yn("controller"),yn("initialized"),yn("on-handlers"),yn("controller-key"),yn("controller-name"),yn("controller-id"),yn("controller-operations"),yn("native-controller"),yn("cleanup"),yn("properties"),yn("property-values"),yn("pre-init-property-values"),yn("properties-initialized"),yn("property-watchers"),yn("explicitly-set-properties"),yn("router-context"),yn("current-page-marker"),yn("context-request-handler"),yn("page-transition"),yn("created-at"),yn("ready-handlers"),yn("dispose-handlers"),yn("moved-handlers"),yn("adopted-handlers"),yn("observers"),yn("parts"),yn("part-timers"),yn("moved-timers"),yn("adopted-timers"),yn("dispatch-timers"),yn("render-method"),yn("render-options"),yn("render-instance"),yn("render-scheduled"),yn("render-timers"),yn("render-callbacks"),yn("styles-method"),yn("styles-applied"),yn("context-handler"),yn("context-method-name"),yn("navigation-context-instance"),yn("registered-elements"),yn("is-updating"),yn("context-register"),yn("context-unregister"),yn("context-notify-element"),yn("context-options"),yn("context-timer"),yn("context-called"),yn("context-update");export{le as Context,pn as ContextAwareFetcher,o as IS_CONTROLLER_INSTANCE,$e as Router,ne as SimpleArray,Ce as adopted,ge as applyElementFunctionality,Ge as cleanupTooltips,un as clearDebounceTimers,dn as clearMemoizeCache,hn as clearThrottleTimers,te as context,xe as contextProperty,Jt as controller,pt as css,rn as debounce,Ke as dispatch,Ne as dispose,be as element,e as getSymbol,mt as html,we as layout,cn as memoize,Ae as moved,Et as noChange,yt as nothing,Z as observe,Vt as on,ln as once,ve as property,Te as query,_e as queryAll,Ee as ready,pe as render,at as request,mn as resetOnce,lt as respond,Qe as setDisableElementReadyWarnings,fe as styles,an as throttle,tn as trackRenders,bt as unsafeHTML,Yt as useNativeElementControllers,Ue as useTooltips,Ze as waitForAllCustomElements,Xe as waitForElementDefined,Ye as waitForElementReady,Se as watch};
26
26
  //# sourceMappingURL=snice-runtime.esm.min.js.map