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,28 +1,28 @@
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
  var Snice=function(t){"use strict";
8
8
  /*!
9
- * snice v4.13.0
10
- * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
11
- * (c) 2024
12
- * Released under the MIT License.
13
- */globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const e=globalThis.snice;function n(t){return e.symbols.has(t)||e.symbols.set(t,Symbol.for(`snice:${t}`)),e.symbols.get(t)}const o=n("is-controller-class"),r=n("is-controller-instance"),s=n("is-element-class"),i=n("channel-handlers"),a=n("ready-promise"),l=n("ready-resolve");n("rendered-promise"),n("rendered-resolve");const c=n("controller"),u=n("initialized");n("on-handlers");const h=n("controller-key"),d=n("controller-name"),m=n("controller-id"),f=n("controller-operations"),p=n("native-controller"),y=n("cleanup"),g=n("properties"),b=n("property-values"),w=n("pre-init-property-values"),v=n("properties-initialized"),T=n("property-watchers"),S=n("explicitly-set-properties"),N=n("router-context");n("current-page-marker"),n("context-request-handler");const E=n("page-transition"),A=n("created-at"),_=n("ready-handlers"),x=n("dispose-handlers"),C=n("moved-handlers"),O=n("adopted-handlers"),k=n("observers");n("parts"),n("part-timers");const L=n("moved-timers"),$=n("adopted-timers"),M=n("dispatch-timers"),P=n("render-method"),R=n("render-options"),I=n("render-instance"),D=n("render-scheduled"),F=n("render-timers"),q=n("render-callbacks"),V=n("styles-method"),z=n("styles-applied"),j=n("context-handler");n("context-method-name");const B=n("navigation-context-instance"),W=n("registered-elements"),H=n("is-updating"),U=n("context-register"),G=n("context-unregister"),K=n("context-notify-element");n("context-options");const J=n("context-timer"),Q=n("context-called"),X=n("context-update"),Y=new Map,Z=new WeakMap;function tt(t,e){const n=t.constructor[k];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].observers||(t[y].observers=[]):t[y]={events:[],channels:[],observers:[]};for(const o of n){const n=o.method.bind(t),r=o.options?.throttle?st(n,o.options.throttle):n;switch(o.type){case"intersection":et(t,e,o,r);break;case"resize":nt(t,e,o,r);break;case"media":ot(t,e,o,r);break;case"mutation":rt(t,e,o,r);break;default:console.warn(`Unknown observer type: ${o.type}`)}}}}function et(t,e,n,o){const r={threshold:n.options?.threshold??0,rootMargin:n.options?.rootMargin??"0px",root:n.options?.root??null},s=JSON.stringify(r),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=Z.get({instance:t,options:s});a||(a=new IntersectionObserver(i,r),Z.set({instance:t,options:s},a));const l=n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):[e];l.forEach(t=>a.observe(t)),t[y].observers.push(()=>{l.forEach(t=>a.unobserve(t)),0===a.takeRecords().length&&a.disconnect()})}function nt(t,e,n,o){const r=n.options?.box||"content-box";if("undefined"==typeof ResizeObserver)return void console.warn("ResizeObserver is not available in this environment");const s=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=>{s.observe(t,{box:r})}),t[y].observers.push(()=>{s.disconnect()})}function ot(t,e,n,o){const r=n.target;if(!r)return void console.warn("Media query observer requires a query string");let s=Y.get(r);if(!s)try{s=window.matchMedia(r),Y.set(r,s)}catch(t){return void console.error(`Invalid media query: ${r}`,t)}const i=t=>{try{o(t.matches)}catch(t){console.error(`Error in media query observer ${n.methodName}:`,t)}};i(s);const a=t=>i(t);s.addEventListener?(s.addEventListener("change",a),t[y].observers.push(()=>{s.removeEventListener("change",a)})):(s.addListener(a),t[y].observers.push(()=>{s.removeListener(a)}))}function rt(t,e,n,o){const s=n.target.split(":"),i=s[0]||"childList",a=s[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 r=n.options.maxDepth,s=t.filter(t=>{let n=0,o=t.target;const s=e.shadowRoot||e;for(;o&&o!==s&&n<r;)o=o.parentNode,n++;return n<r});s.length>0&&o(s)}else o(t)}catch(t){console.error(`Error in mutation observer ${n.methodName}:`,t)}}),u=!0===t[r];(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):u&&e.shadowRoot?[e.shadowRoot]:[e]).forEach(t=>{c.observe(t,l)}),t[y].observers.push(()=>{c.disconnect()})}function st(t,e){let n=0,o=null;return function(...r){const s=Date.now(),i=e-(s-n);if(i<=0)return o&&(clearTimeout(o),o=null),n=s,t.apply(this,r);o||(o=setTimeout(()=>{n=Date.now(),o=null,t.apply(this,r)},i))}}function it(t){if(t[y]?.observers){for(const e of t[y].observers)e();t[y].observers=[]}}function at(t,e){const n=t.constructor[i];if(n){t[y]||(t[y]={events:[],channels:[]});for(const o of n){const n=o.method.bind(t),r=`@request/${o.channelName}`;let s,i,a=0;const l=(t=>o.options?.debounce?(...e)=>new Promise((n,r)=>{clearTimeout(s),s=setTimeout(async()=>{try{const o=await t(...e);n(o)}catch(t){r(t)}},o.options.debounce)}):o.options?.throttle?(...e)=>{const n=Date.now(),r=o.options.throttle-(n-a);return r<=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)}},r)})}:t)(n),c=t=>{const{data:e,discovery:n,payload:r}=t.detail;t.preventDefault(),t.stopImmediatePropagation(),t.stopPropagation(),n.resolve(),Promise.resolve(l(r)).then(t=>{e.resolve(t)}).catch(t=>{e.reject(t),console.error(`Error in response handler ${o.methodName}:`,t)})};e.addEventListener(r,c),t[y].channels.push(()=>{e.removeEventListener(r,c)})}}}function lt(t){if(t[y]?.channels){for(const e of t[y].channels)e();t[y].channels=[]}}const ct=Symbol.for("snice:html-result"),ut=Symbol.for("snice:css-result");function ht(t){return t&&t._$litType$===ct}const dt=Symbol.for("snice:nothing"),mt=Symbol.for("snice:unsafe-html");const ft=`snice$${Math.random().toFixed(9).slice(2)}$`,pt="?"+ft,yt=`<${pt}>`,gt=new RegExp(ft,"g"),bt=new WeakMap,wt=Symbol("not-committed"),vt=Symbol.for("snice:no-change"),Tt=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class St{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 r=0;const s=[];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(ft)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-if",index:r++,element:t}));continue}if("case"===e){const e=t.getAttribute("value");e&&e.includes(ft)&&(t.removeAttribute("value"),this.parts.push({type:"conditional-case",index:r++,element:t}));continue}if(t.hasAttributes()){const e=t.attributes,o=[];for(let s=0;s<e.length;s++){const i=e[s],a=i.value;if(a.includes(ft)){o.push(i);const e=n[r]||i.name,s=a.split(ft),l=s.length-1;e.startsWith("@@")||e.startsWith("@")?(this.parts.push({type:"event",index:r,name:e.slice(1),element:t}),r+=1):e.startsWith(".")?(this.parts.push({type:"property",index:r,name:e.slice(1),element:t}),r+=1):e.startsWith("?")?(this.parts.push({type:"boolean-attribute",index:r,name:e.slice(1),element:t}),r+=1):(this.parts.push({type:"attribute",index:r,name:i.name,element:t,attrStrings:s}),r+=l)}}for(const e of o)t.removeAttribute(e.name)}}else if(i.nodeType===Node.COMMENT_NODE){const t=i;if(t.data===pt){const e=t.parentNode,n=document.createComment("");e.insertBefore(n,t.nextSibling),this.parts.push({type:"node",index:r++,startNode:t,endNode:n})}}else if(i.nodeType===Node.TEXT_NODE){const t=i,e=t.data;if(e.includes(ft)){const n=t.parentNode,o=e.split(gt),i=o.length-1;for(let e=0;e<i;e++){n.insertBefore(document.createTextNode(o[e]),t);const s=document.createComment(""),i=document.createComment("");n.insertBefore(s,t),n.insertBefore(i,t),this.parts.push({type:"node",index:r++,startNode:s,endNode:i})}""!==o[i]?t.data=o[i]:s.push(t)}}for(const t of s)t.parentNode?.removeChild(t)}}class Nt{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=bt.get(e);if(n)return n;const o=[],r=[];let s=!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(s){if(i)e===a&&(i=!1,a="");else if(">"===e)s=!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&&(s=!0)}if(i)r.push(l),o.push(ft);else if(s){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(),r.push(l),o.push(ft)}else n.match(/<(if|case)\s*$/)?(l="value",r.push("value"),o.push(`value="${ft}"`)):(r.push(""),o.push(ft))}else r.push(""),o.push(yt)}}const c=o.join(""),u=document.createElement("template");u.innerHTML=c;const h=new St(t,u,r);return bt.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,r=e.currentNode;for(;o&&r;)n.set(o,r),o=t.nextNode(),r=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),r=n.get(e.endNode);o=new At(t,r);break;case"attribute":const s=n.get(e.element);o=new _t(s,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);o=new xt(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);o=new Ct(a,e.name);break;case"event":const l=n.get(e.element);o=new Ot(l,e.name);break;case"conditional-if":const c=n.get(e.element);o=new Pt(c);break;case"conditional-case":const u=n.get(e.element);o=new Rt(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(o),o instanceof Pt||o instanceof Rt?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 _t&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class Et{}class At extends Et{constructor(t,e){super(),this._committedValue=wt,this.startNode=t,this.endNode=e}commit(t){if(t!==vt)return t===dt||null==t||""===t?(this._committedValue!==dt&&this._clear(),void(this._committedValue=dt)):void(Tt(t)?t!==this._committedValue&&this._commitText(t):ht(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===mt}(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!==wt&&this._committedValue!==dt&&Tt(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 Nt){const n=bt.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new Nt(t),o=n.renderFragment();this._insertBefore(o),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof At||(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 At(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=dt}clear(){this._clear()}}class _t extends Et{constructor(t,e,n){super(),this._committedValue=wt,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(wt),this.strings=n):this._committedValue=wt}commit(t,e=0){let n,o=!1;if(void 0===this.strings){if(t===vt)return;if(o=!Tt(t)||t!==this._committedValue&&t!==vt,!o)return;this._committedValue=t,n=t}else{const r=t,s=this._committedValue;n=this.strings[0];for(let t=0;t<this.strings.length-1;t++){let i=r[e+t];i===vt&&(i=s[t]),o=o||!Tt(i)||i!==s[t],i===dt?n=dt:n!==dt&&(n=n+(i??"")+this.strings[t+1]),s[t]=i}if(!o)return}this._commitValue(n)}_commitValue(t){t===dt||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class xt extends Et{constructor(t,e){super(),this._committedValue=wt,this.element=t,this.name=e}commit(t){t!==vt&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===dt?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=wt}}class Ct extends Et{constructor(t,e){super(),this._committedValue=wt,this.element=t,this.name=e}commit(t){if(t===vt)return;const e=!!t&&t!==dt;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=wt}}class Ot extends Et{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("."),r=n?e.indexOf(":"):-1,s=o>0&&r>0?Math.min(o,r):Math.max(o,r);if(s>0){const t=e.substring(0,s),n=e.substring(s+1);this.eventName=t,this.keyFilter=kt(n)}else this.eventName=e}commit(t){if(t!==vt&&(t===dt&&(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&&!$t(n,this.keyFilter)||t.call(e,n)}}else this.listener=e=>{this.keyFilter&&!$t(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 kt(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=Lt(t)}return o}function Lt(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 $t(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,r=e.shift?t.shiftKey:!t.shiftKey,s=e.meta?t.metaKey:!t.metaKey;return n&&o&&r&&s}const Mt=Symbol("not-set");class Pt extends Et{constructor(t){super(),this.value=Mt,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 Rt extends Et{constructor(t){super(),this.value=Mt,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 It=n("on-handlers");function Dt(t,e){let n=null;return function(...o){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,o),n=null},e)}}function Ft(t,e){let n=0;return function(...o){const r=Date.now();r-n>=e&&(n=r,t.apply(this,o))}}const qt=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function Vt(t,e){const n=t.constructor[It];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].events?t[y].events.length>0&&zt(t):t[y].events=[]:t[y]={events:[],channels:[],observers:[]};for(const o of n){const n=t[o.methodName];let r=n?n.bind(t):o.method.bind(t);const s=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;s.debounce&&s.debounce>0?r=Dt(r,s.debounce):s.throttle&&s.throttle>0&&(r=Ft(r,s.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=kt(h));const m=(t=>d?e=>{$t(e,d)&&t(e)}:t)(r);if(o.selector){const n=e.shadowRoot||e,r=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){s.preventDefault&&t.preventDefault(),s.stopPropagation&&(t.stopPropagation(),t.stopImmediatePropagation());try{m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},i=qt.has(u),a={capture:void 0!==s.capture?s.capture:i,once:s.once||!1,passive:s.passive||!1};n.addEventListener(u,r,a),t[y].events.push({target:n,eventName:u,handler:r,options:a})}else{const n=e.shadowRoot,r=Symbol.for(`snice:event-handled:${o.methodName}`),i=t=>{if(!t[r]){t[r]=!0;try{s.preventDefault&&t.preventDefault(),s.stopPropagation&&t.stopPropagation(),m(t)}catch(t){console.error(`Error in event handler ${o.methodName}:`,t)}}},a={capture:s.capture||!1,once:s.once||!1,passive:s.passive||!1};n&&(n.addEventListener(u,i,a),t[y].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[y].events.push({target:e,eventName:u,handler:i,options:a})}}}}function zt(t){if(t[y]?.events){for(const{target:e,eventName:n,handler:o,options:r}of t[y].events)e.removeEventListener(n,o,r);t[y].events=[]}}class jt{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}}}async function Bt(t,n){const o=t[h],s=t[d],i=t[p];if(void 0!==i&&i!==n)return;if(s===n&&o)return;o&&await Wt(t);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;e.controllerIdCounter+=1;const u=e.controllerIdCounter,y=new jt;c[r]=!0,c[m]=u,c.element=t;const g=t[N];void 0!==g&&(c[N]=g),t[h]=c,t[d]=n,t[f]=y,await t.ready,await y.runOperation(async()=>{await c.attach(t)}),tt(c,t),at(c,t),Vt(c,t),t.dispatchEvent(new CustomEvent("@snice/controller-attached",{detail:{name:n,controller:c}}))}async function Wt(t){const e=t[h],n=t[d],o=t[f];e&&(o?await o.runOperation(async()=>{await e.detach(t)}):await e.detach(t),e.element=null,it(e),lt(e),zt(e),o&&await o.cleanup(),delete e[N],delete t[h],delete t[d],delete t[f],t.dispatchEvent(new CustomEvent("@snice/controller-detached",{detail:{name:n,controller:e}})))}const Ht=n("context-handlers");function Ut(t){const e=t.constructor[Ht];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[j];if(n){t[B]=n;for(const o of e){const{methodName:e,method:r,options:s}=o,i=`__wrapped_${e}`;t[i]=function(e){if(s.once&&t[Q])return;const n=()=>{if(r.call(t,e),s.once){t[Q]=!0;const e=t[B];e&&"function"==typeof e[G]&&e[G](t)}};if(s.debounce)clearTimeout(t[J]),t[J]=setTimeout(n,s.debounce);else if(s.throttle){const e=Date.now();e-(t[J]||0)>=s.throttle&&(t[J]=e,n())}else n()},"function"==typeof n[U]&&n[U](t,i)}}}class Gt{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(Gt.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${Gt.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(Gt.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(Gt.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var Kt,Jt,Qt;const Xt=Symbol.for("snice:registered-elements-set");let Yt=0;class Zt{constructor(t={},e=[],n="",o={},r){if(this[Kt]=new WeakMap,this[Jt]=new Set,this[Qt]=!1,this.id=Yt++,this.application=t,this.navigation={placards:e,route:n,params:o},r&&"function"==typeof r.create)this.fetch=r.create(this);else{if("function"!=typeof fetch)throw new Error("No fetch implementation available");this.fetch=fetch.bind(this)}}[(Kt=W,Jt=Xt,Qt=H,U)](t,e){this[W].set(t,e),this[Xt].add(t)}[G](t){this[W].delete(t),this[Xt].delete(t)}[X](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[Xt],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}[K](t){const e=this[W].get(t);e&&"function"==typeof t[e]&&t[e](this)}}function te(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 ee(t,e,n,o){switch(e.type||te(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 Gt:return Gt.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 ne=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?oe(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){oe(e,e[R]||{})}}};function oe(t,e,n){const o=t[P];if(o&&(!e.once||!t[I]))try{const r=void 0!==n?n:o.call(t);if(!(!1!==e.differential)){if("string"!=typeof r)return void console.warn("Render method with differential: false must return a string");t.shadowRoot||t.attachShadow({mode:"open"}),t.shadowRoot.innerHTML=r,t[D]=!1;const e=t[q];if(e&&e.length>0){const n=[...e];t[q]=[],n.forEach(t=>t())}return}if(!ht(r))return void console.warn("Render method must return html`` template result");let s=t[I];if(t.shadowRoot||t.attachShadow({mode:"open"}),s&&s.isSameTemplate(r.strings))s.update(r.values);else{s&&(t.shadowRoot.innerHTML=""),s=new Nt(r),t[I]=s;const e=s.renderFragment();t.shadowRoot.appendChild(e),s.update(r.values)}t[D]=!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 re(t,e=!1){const n=t[R]||{};if(!n.once||!t[I])if(e)oe(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[F]||(t[F]={}),clearTimeout(t[F].debounce),void(t[F].debounce=setTimeout(()=>{ne.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[F]||(t[F]={lastThrottle:0});const e=t[F],o=Date.now();if(0===e.lastThrottle||o-e.lastThrottle>=n.throttle)e.lastThrottle=o,ne.schedule(t,n);else if(!e.throttleTimer){const r=n.throttle-(o-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),ne.schedule(t,n)},r)}return}ne.schedule(t,n)}}function se(t){const e=t[V];if(e&&!t[z]){t[z]=!0;try{const o=e.call(t);if(!(n=o)||n._$litType$!==ut)return void console.warn("Styles method must return css`` template result");t.shadowRoot||t.attachShadow({mode:"open"});const r=new CSSStyleSheet;if(r.replaceSync("if, case { display: contents; }"),t.shadowRoot&&o.styleSheet&&"adoptedStyleSheets"in t.shadowRoot)t.shadowRoot.adoptedStyleSheets=[r,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 ie(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 i=t[g];if(i)for(const[t,e]of i){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[a]||(this[a]=new Promise(t=>{this[l]=t})),this[a]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[c]},set(t){const e=this[c];this[c]=t,t!==e&&t?Bt(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):!t&&e&&Wt(this).catch(t=>{console.error("Failed to detach controller:",t)})},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[a]||(this[a]=new Promise(t=>{this[l]=t})),this[u]){Vt(this,this),at(this,this),Ut(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[v]=!0;const n=t[g];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[S]||(this[S]=new Set),this[S].add(t),e.type===Boolean&&""===o&&this.setAttribute(n,"true"),this[t]=ee(o,e)}}if(this[w]){for(const[t,e]of Array.from(this[w].entries())){const o=n?.get(t),r="string"==typeof o?.attribute?o.attribute:t.toLowerCase();this.hasAttribute(r)?this[w].delete(t):(this[w].delete(t),this[t]=e)}delete this[w]}if(se(this),this[P])queueMicrotask(()=>{re(this,!0);try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[l]&&(this[l](),this[l]=null)});else{try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[l]&&(this[l](),this[l]=null)}Vt(this,this),at(this,this),Ut(this),this[u]=!0,e&&e.call(this)}finally{}const n=t[_];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[x];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[c]&&Wt(this).catch(t=>{console.error("Failed to detach controller:",t)}),zt(this),lt(this),function(t){const e=t.constructor[Ht];if(!e||!Array.isArray(e)||0===e.length)return;for(const n of e)n.options.debounce&&t[J]&&(clearTimeout(t[J]),delete t[J]),delete t[`__wrapped_${n.methodName}`];const n=t[B];n&&"function"==typeof n[G]&&n[G](t),delete t[B],delete t[Q]}(this),it(this)},t.prototype.attributeChangedCallback=function(e,n,r){if(o?.call(this,e,n,r),"controller"===e)this.controller=r;else{const n=t[g];if(n)for(const[o,s]of n){if(("string"==typeof s.attribute?s.attribute:o.toLowerCase()).toLowerCase()===e.toLowerCase()){const n=this[b]?.[o],i=ee(r,s,n,void 0);if(n!==i){this[S]||(this[S]=new Set),this[S].add(o),this[b]||(this[b]={}),this[b][o]=i;const r=this._settingFromProperty?.has(e.toLowerCase());if(!r){const e=t[T];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[u]&&re(this)}}break}}}},t.prototype.connectedMoveCallback=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 @moved handler ${t.methodName}:`,e)}},t.prototype.adoptedCallback=async function(){const e=t[O];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @adopted handler ${t.methodName}:`,e)}}}
9
+ * snice v4.15.0
10
+ * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
11
+ * (c) 2024
12
+ * Released under the MIT License.
13
+ */globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const e=globalThis.snice;function n(t){return e.symbols.has(t)||e.symbols.set(t,Symbol.for(`snice:${t}`)),e.symbols.get(t)}const o=n("is-controller-class"),s=n("is-controller-instance"),r=n("is-element-class"),i=n("channel-handlers"),a=n("ready-promise"),l=n("ready-resolve");n("rendered-promise"),n("rendered-resolve");const c=n("controller"),u=n("initialized");n("on-handlers");const h=n("controller-key"),d=n("controller-name"),m=n("controller-id"),p=n("controller-operations"),f=n("native-controller"),y=n("cleanup"),g=n("properties"),b=n("property-values"),w=n("pre-init-property-values"),v=n("properties-initialized"),T=n("property-watchers"),S=n("explicitly-set-properties"),_=n("router-context");n("current-page-marker"),n("context-request-handler");const x=n("page-transition"),E=n("created-at"),N=n("ready-handlers"),A=n("dispose-handlers"),C=n("moved-handlers"),k=n("adopted-handlers"),L=n("observers");n("parts"),n("part-timers");const O=n("moved-timers"),$=n("adopted-timers"),P=n("dispatch-timers"),M=n("render-method"),I=n("render-options"),R=n("render-instance"),D=n("render-scheduled"),q=n("render-timers"),F=n("render-callbacks"),z=n("styles-method"),j=n("styles-applied"),V=n("context-handler");n("context-method-name");const W=n("navigation-context-instance"),H=n("registered-elements"),B=n("is-updating"),U=n("context-register"),G=n("context-unregister"),K=n("context-notify-element");n("context-options");const J=n("context-timer"),Q=n("context-called"),X=n("context-update"),Y=new Map,Z=new WeakMap;function tt(t,e){const n=t.constructor[L];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].observers||(t[y].observers=[]):t[y]={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=Z.get({instance:t,options:r});a||(a=new IntersectionObserver(i,s),Z.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[y].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[y].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=Y.get(s);if(!r)try{r=window.matchMedia(s),Y.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[y].observers.push(()=>{r.removeEventListener("change",a)})):(r.addListener(a),t[y].observers.push(()=>{r.removeListener(a)}))}function st(t,e,n,o){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 s=n.options.maxDepth,r=t.filter(t=>{let n=0,o=t.target;const r=e.shadowRoot||e;for(;o&&o!==r&&n<s;)o=o.parentNode,n++;return n<s});r.length>0&&o(r)}else o(t)}catch(t){console.error(`Error in mutation observer ${n.methodName}:`,t)}}),u=!0===t[s];(n.selector?Array.from(e.shadowRoot?.querySelectorAll(n.selector)||[]):u&&e.shadowRoot?[e.shadowRoot]:[e]).forEach(t=>{c.observe(t,l)}),t[y].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[y]?.observers){for(const e of t[y].observers)e();t[y].observers=[]}}function at(t,e){const n=t.constructor[i];if(n){t[y]||(t[y]={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[y].channels.push(()=>{e.removeEventListener(s,c)})}}}function lt(t){if(t[y]?.channels){for(const e of t[y].channels)e();t[y].channels=[]}}const ct=Symbol.for("snice:html-result"),ut=Symbol.for("snice:css-result");function ht(t){return t&&t._$litType$===ct}const dt=Symbol.for("snice:nothing"),mt=Symbol.for("snice:unsafe-html");const pt=`snice$${Math.random().toFixed(9).slice(2)}$`,ft="?"+pt,yt=`<${ft}>`,gt=new RegExp(pt,"g"),bt=new WeakMap,wt=Symbol("not-committed"),vt=Symbol.for("snice:no-change"),Tt=t=>null===t||"object"!=typeof t&&"function"!=typeof t;class St{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(pt)&&(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(pt)&&(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(pt)){o.push(i);const e=n[s]||i.name,r=a.split(pt),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===ft){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(pt)){const n=t.parentNode,o=e.split(gt),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 _t{constructor(t){this.parts=[],this.fragment=null,this.conditionalParts=[],this.regularParts=[],this.template=function(t){const{strings:e}=t,n=bt.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(pt);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(pt)}else n.match(/<(if|case)\s*$/)?(l="value",s.push("value"),o.push(`value="${pt}"`)):(s.push(""),o.push(pt))}else s.push(""),o.push(yt)}}const c=o.join(""),u=document.createElement("template");u.innerHTML=c;const h=new St(t,u,s);return bt.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 Et(t,s);break;case"attribute":const r=n.get(e.element);o=new Nt(r,e.name,e.attrStrings);break;case"property":const i=n.get(e.element);o=new At(i,e.name);break;case"boolean-attribute":const a=n.get(e.element);o=new Ct(a,e.name);break;case"event":const l=n.get(e.element);o=new kt(l,e.name);break;case"conditional-if":const c=n.get(e.element);o=new Mt(c);break;case"conditional-case":const u=n.get(e.element);o=new It(u);break;default:throw new Error(`Unknown part type: ${e.type}`)}this.parts.push(o),o instanceof Mt||o instanceof It?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 Nt&&void 0!==e.strings?e.commit(t,n):e.commit(t[n])}clear(){for(const t of this.parts)t.clear()}}class xt{}class Et extends xt{constructor(t,e){super(),this._committedValue=wt,this.startNode=t,this.endNode=e}commit(t){if(t!==vt)return t===dt||null==t||""===t?(this._committedValue!==dt&&this._clear(),void(this._committedValue=dt)):void(Tt(t)?t!==this._committedValue&&this._commitText(t):ht(t)?this._commitTemplateResult(t):!function(t){return t&&t._$litType$===mt}(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!==wt&&this._committedValue!==dt&&Tt(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 _t){const n=bt.get(t.strings);if(n&&e.template===n)return void e.update(t.values)}this._clear();const n=new _t(t),o=n.renderFragment();this._insertBefore(o),n.update(t.values),this._committedValue=n}_commitIterable(t){Array.isArray(this._committedValue)&&this._committedValue[0]instanceof Et||(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 Et(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=dt}clear(){this._clear()}}class Nt extends xt{constructor(t,e,n){super(),this._committedValue=wt,this.element=t,this.name=e,n&&(n.length>2||""!==n[0]||""!==n[1])?(this._committedValue=new Array(n.length-1).fill(wt),this.strings=n):this._committedValue=wt}commit(t,e=0){let n,o=!1;if(void 0===this.strings){if(t===vt)return;if(o=!Tt(t)||t!==this._committedValue&&t!==vt,!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===vt&&(i=r[t]),o=o||!Tt(i)||i!==r[t],i===dt?n=dt:n!==dt&&(n=n+(i??"")+this.strings[t+1]),r[t]=i}if(!o)return}this._commitValue(n)}_commitValue(t){t===dt||null==t?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,String(t))}clear(){this.element.removeAttribute(this.name)}}class At extends xt{constructor(t,e){super(),this._committedValue=wt,this.element=t,this.name=e}commit(t){t!==vt&&t!==this._committedValue&&(this._committedValue=t,this.element[this.name]=t===dt?void 0:t)}clear(){this.element[this.name]=void 0,this._committedValue=wt}}class Ct extends xt{constructor(t,e){super(),this._committedValue=wt,this.element=t,this.name=e}commit(t){if(t===vt)return;const e=!!t&&t!==dt;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=wt}}class kt extends xt{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=Lt(n)}else this.eventName=e}commit(t){if(t!==vt&&(t===dt&&(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&&!$t(n,this.keyFilter)||t.call(e,n)}}else this.listener=e=>{this.keyFilter&&!$t(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 Lt(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=Ot(t)}return o}function Ot(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 $t(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 Pt=Symbol("not-set");class Mt extends xt{constructor(t){super(),this.value=Pt,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 It extends xt{constructor(t){super(),this.value=Pt,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 Rt=n("on-handlers");function Dt(t,e){let n=null;return function(...o){null!==n&&clearTimeout(n),n=setTimeout(()=>{t.apply(this,o),n=null},e)}}function qt(t,e){let n=0;return function(...o){const s=Date.now();s-n>=e&&(n=s,t.apply(this,o))}}const Ft=new Set(["scroll","focus","blur","load","unload","error","resize","abort","mouseenter","mouseleave","pointerenter","pointerleave"]);function zt(t,e){const n=t.constructor[Rt];if(n&&Array.isArray(n)&&0!==n.length){t[y]?t[y].events?t[y].events.length>0&&jt(t):t[y].events=[]:t[y]={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=Dt(s,r.debounce):r.throttle&&r.throttle>0&&(s=qt(s,r.throttle));let d=null;h&&["keydown","keyup","keypress"].includes(u)&&(d=Lt(h));const m=(t=>d?e=>{$t(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=Ft.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[y].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[y].events.push({target:n,eventName:u,handler:i,options:a})),e.addEventListener(u,i,a),t[y].events.push({target:e,eventName:u,handler:i,options:a})}}}}function jt(t){if(t[y]?.events){for(const{target:e,eventName:n,handler:o,options:s}of t[y].events)e.removeEventListener(n,o,s);t[y].events=[]}}class Vt{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}}}async function Wt(t,n){const o=t[h],r=t[d],i=t[f];if(void 0!==i&&i!==n)return;if(r===n&&o)return;o&&await Ht(t);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;e.controllerIdCounter+=1;const u=e.controllerIdCounter,y=new Vt;c[s]=!0,c[m]=u,c.element=t;const g=t[_];void 0!==g&&(c[_]=g),t[h]=c,t[d]=n,t[p]=y,await t.ready,await y.runOperation(async()=>{await c.attach(t)}),tt(c,t),at(c,t),zt(c,t),t.dispatchEvent(new CustomEvent("controller-attached",{detail:{name:n,controller:c}}))}async function Ht(t){const e=t[h],n=t[d],o=t[p];e&&(o?await o.runOperation(async()=>{await e.detach(t)}):await e.detach(t),e.element=null,it(e),lt(e),jt(e),o&&await o.cleanup(),delete e[_],delete t[h],delete t[d],delete t[p],t.dispatchEvent(new CustomEvent("controller-detached",{detail:{name:n,controller:e}})))}const Bt=n("context-handlers");function Ut(t){const e=t.constructor[Bt];if(!e||!Array.isArray(e)||0===e.length)return;const n=t[V];if(n){t[W]=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[Q])return;const n=()=>{if(s.call(t,e),r.once){t[Q]=!0;const e=t[W];e&&"function"==typeof e[G]&&e[G](t)}};if(r.debounce)clearTimeout(t[J]),t[J]=setTimeout(n,r.debounce);else if(r.throttle){const e=Date.now();e-(t[J]||0)>=r.throttle&&(t[J]=e,n())}else n()},"function"==typeof n[U]&&n[U](t,i)}}}class Gt{static{this.SEPARATOR=","}static serialize(t){return Array.isArray(t)?t.map(t=>{if("string"==typeof t){if(t.includes(Gt.SEPARATOR))throw new Error(`SimpleArray strings cannot contain the character "${Gt.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(Gt.SEPARATOR):""}static parse(t){return null==t||""===t?[]:t.split(Gt.SEPARATOR).map(t=>{if(/^-?\d+\.?\d*$/.test(t)){const e=Number(t);if(!isNaN(e))return e}return"true"===t||"false"!==t&&t})}}var Kt,Jt,Qt;const Xt=Symbol.for("snice:registered-elements-set");let Yt=0;class Zt{constructor(t={},e=[],n="",o={},s){if(this[Kt]=new WeakMap,this[Jt]=new Set,this[Qt]=!1,this.id=Yt++,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)}}[(Kt=H,Jt=Xt,Qt=B,U)](t,e){this[H].set(t,e),this[Xt].add(t)}[G](t){this[H].delete(t),this[Xt].delete(t)}[X](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[B])return;this[B]=!0;const t=this[Xt],e=this[H];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[B]=!1}[K](t){const e=this[H].get(t);e&&"function"==typeof t[e]&&t[e](this)}}function te(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 ee(t,e,n,o){switch(e.type||te(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 Gt:return Gt.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 ne=new class{constructor(){this.pending=new Set,this.scheduled=!1}schedule(t,e){e.sync?oe(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){oe(e,e[I]||{})}}};function oe(t,e,n){const o=t[M];if(o&&(!e.once||!t[R]))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[D]=!1;const e=t[F];if(e&&e.length>0){const n=[...e];t[F]=[],n.forEach(t=>t())}return}if(!ht(s))return void console.warn("Render method must return html`` template result");let r=t[R];if(t.shadowRoot||t.attachShadow({mode:"open"}),r&&r.isSameTemplate(s.strings))r.update(s.values);else{r&&(t.shadowRoot.innerHTML=""),r=new _t(s),t[R]=r;const e=r.renderFragment();t.shadowRoot.appendChild(e),r.update(s.values)}t[D]=!1;const i=t[F];if(i&&i.length>0){const e=[...i];t[F]=[],e.forEach(t=>t())}}catch(t){console.error("Error rendering element:",t)}}function se(t,e=!1){const n=t[I]||{};if(!n.once||!t[R])if(e)oe(t,n);else{if(void 0!==n.debounce&&n.debounce>0)return t[q]||(t[q]={}),clearTimeout(t[q].debounce),void(t[q].debounce=setTimeout(()=>{ne.schedule(t,n)},n.debounce));if(void 0!==n.throttle&&n.throttle>0){t[q]||(t[q]={lastThrottle:0});const e=t[q],o=Date.now();if(0===e.lastThrottle||o-e.lastThrottle>=n.throttle)e.lastThrottle=o,ne.schedule(t,n);else if(!e.throttleTimer){const s=n.throttle-(o-e.lastThrottle);e.throttleTimer=setTimeout(()=>{e.throttleTimer=null,e.lastThrottle=Date.now(),ne.schedule(t,n)},s)}return}ne.schedule(t,n)}}function re(t){const e=t[z];if(e&&!t[j]){t[j]=!0;try{const o=e.call(t);if(!(n=o)||n._$litType$!==ut)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 ie(t){t.prototype[r]=!0;const e=t.prototype.connectedCallback,n=t.prototype.disconnectedCallback,o=t.prototype.attributeChangedCallback,s=t.observedAttributes||[];s.includes("controller")||s.push("controller");const i=t[g];if(i)for(const[t,e]of i){if(!1===e.attribute)continue;const n="string"==typeof e.attribute?e.attribute:t.toLowerCase();s.includes(n)||s.push(n)}Object.defineProperty(t,"observedAttributes",{get:()=>s,configurable:!0}),Object.defineProperty(t.prototype,"ready",{get(){return this[a]||(this[a]=new Promise(t=>{this[l]=t})),this[a]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"controller",{get(){return this[c]},set(t){const e=this[c];this[c]=t,t!==e&&t?Wt(this,t).catch(e=>{console.error(`Failed to attach controller "${t}":`,e)}):!t&&e&&Ht(this).catch(t=>{console.error("Failed to detach controller:",t)})},enumerable:!0,configurable:!0}),t.prototype.connectedCallback=async function(){if(this[a]||(this[a]=new Promise(t=>{this[l]=t})),this[u]){zt(this,this),at(this,this),Ut(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[v]=!0;const n=t[g];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[S]||(this[S]=new Set),this[S].add(t),e.type===Boolean&&""===o&&this.setAttribute(n,"true"),this[t]=ee(o,e)}}if(this[w]){for(const[t,e]of Array.from(this[w].entries())){const o=n?.get(t),s="string"==typeof o?.attribute?o.attribute:t.toLowerCase();this.hasAttribute(s)?this[w].delete(t):(this[w].delete(t),this[t]=e)}delete this[w]}if(re(this),this[M])queueMicrotask(()=>{se(this,!0);try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[l]&&(this[l](),this[l]=null)});else{try{tt(this,this)}catch(t){console.error(`Error setting up observers for ${this.tagName}:`,t)}this[l]&&(this[l](),this[l]=null)}zt(this,this),at(this,this),Ut(this),this[u]=!0,e&&e.call(this)}finally{}const n=t[N];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[A];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[c]&&Ht(this).catch(t=>{console.error("Failed to detach controller:",t)}),jt(this),lt(this),function(t){const e=t.constructor[Bt];if(!e||!Array.isArray(e)||0===e.length)return;for(const n of e)n.options.debounce&&t[J]&&(clearTimeout(t[J]),delete t[J]),delete t[`__wrapped_${n.methodName}`];const n=t[W];n&&"function"==typeof n[G]&&n[G](t),delete t[W],delete t[Q]}(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[g];if(n)for(const[o,r]of n){if(("string"==typeof r.attribute?r.attribute:o.toLowerCase()).toLowerCase()===e.toLowerCase()){const n=this[b]?.[o],i=ee(s,r,n,void 0);if(n!==i){this[S]||(this[S]=new Set),this[S].add(o),this[b]||(this[b]={}),this[b][o]=i;const s=this._settingFromProperty?.has(e.toLowerCase());if(!s){const e=t[T];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[M]&&this[u]&&se(this)}}break}}}},t.prototype.connectedMoveCallback=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 @moved handler ${t.methodName}:`,e)}},t.prototype.adoptedCallback=async function(){const e=t[k];if(e)for(const t of e)try{await t.method.call(this)}catch(e){console.error(`Error in @adopted handler ${t.methodName}:`,e)}}}
14
14
  /*!
15
- * pica-route v1.1.2
16
- * A pure URL pattern matching library compatible with route-parser API
17
- * (c) 2024
18
- * Released under the MIT License.
19
- */
20
- class ae{constructor(t){this.parsed=this.parsePattern(t)}get spec(){return this.parsed.template}parsePattern(t){let e=t,n="",o=!1;const r=t.indexOf("?");return-1!==r&&(e=t.slice(0,r),n=t.slice(r+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:r}=this.parseOptionalGroup(t,n);e.push({type:"optional",segments:o}),n=r+1;break;case":":const{name:s,endIndex:i}=this.parseIdentifier(t,n+1);e.push({type:"param",name:s}),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 r=t.slice(e+1,o-1);return{segments:this.parseSegments(r),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:r}=this.parseIdentifier(e,o+1);n.push({type:"param",name:t}),o=r}else{const{value:t,endIndex:r}=this.parseQueryLiteral(e,o);t&&n.push({type:"literal",value:t}),o=r}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 r=this.matchQuery(n||"",this.parsed.querySegments);if(!1===r)return!1;const s=this.getAllParamNames(),i={};for(const t of s)i[t]=void 0;return Object.assign(i,o,r),i}matchPath(t,e){const n={};let o=0;for(let r=0;r<e.length;r++){const s=e[r],i=e.slice(r+1),a=this.matchSegment(t,o,s,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 r=e;const s=o[0];let i,a=["/","?"];if(s&&"literal"===s.type){const n=s.value,o=t.indexOf(n,e);if(-1===o)return!1;r=o}else for(;r<t.length&&!a.includes(t[r]);)r++;if(r===e)return!1;try{i=decodeURIComponent(t.slice(e,r))}catch(n){i=t.slice(e,r)}return!(r<t.length&&"?"===t[r]&&o.length>0)&&{params:{[n.name]:i},nextIndex:r}}case"splat":{let r=t.length;const s=o[0];if(s)switch(s.type){case"literal":if("."===s.value){const n=t.indexOf(".",e);-1!==n&&(r=n)}else{const n=t.lastIndexOf(s.value);-1!==n&&n>=e&&(r=n)}break;case"param":let n=-1;for(let o=t.length-1;o>=e;o--)if("/"===t[o]){n=o;break}-1!==n&&(r=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)r=o;else{const n=t.slice(e).split("/").filter(t=>t);r=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(s.segments);if(a){const n=t.lastIndexOf(a);-1!==n&&n>=e&&(r=n)}}const i=t.indexOf("?",e);let a;-1!==i&&i<r&&(r=i);try{a=decodeURIComponent(t.slice(e,r))}catch(n){a=t.slice(e,r)}return{params:{[n.name]:a},nextIndex:r}}case"optional":{let r=e,s={},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,r,o,a);if(!1===l){i=!1;break}Object.assign(s,l.params),r=l.nextIndex}if(i){if(this.canMatchRemainingSegments(t,r,o))return{params:s,nextIndex:r}}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 r of e)switch(r.type){case"literal":if(t.slice(o,o+r.value.length)!==r.value)return!1;o+=r.value.length;break;case"param":{let e,s=o;for(;s<t.length&&"&"!==t[s];)s++;if(s===o)return!1;try{e=decodeURIComponent(t.slice(o,s))}catch(n){e=t.slice(o,s)}n[r.name]=e,o=s;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 r=0;r<t.length;r++){const s=t[r],i=t.slice(r+1);switch(s.type){case"literal":o+=s.value;break;case"param":case"splat":if(!(s.name in e))return!1;o+=String(e[s.name]);break;case"optional":if(this.hasAllParams(s.segments,e,n)||this.hasLaterOptionalGroupNeedingParams(i,e,s.segments)){const t=this.reverseSegments(s.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,r=!1,s=!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:s=!0}const a=n||o&&!s;for(const n of t)if("optional"===n.type){this.hasAllParams(n.segments,e,a)&&(r=!0)}return!(!o||s)||(!(!r||s)||!(!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 ce;!function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(ce||(ce={}));let ue=!1;async function he(t,e=500){if(customElements.get(t))return;let n=null;ue||(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 he(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}const me=n("debounce-timers"),fe=n("throttle-timers"),pe=n("once-called"),ye=n("memoize-cache");
15
+ * pica-route v1.1.2
16
+ * A pure URL pattern matching library compatible with route-parser API
17
+ * (c) 2024
18
+ * Released under the MIT License.
19
+ */
20
+ class ae{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 ce;!function(t){t.SUCCESS="success",t.GUARDS_FAILED="guards-failed",t.NOT_FOUND="not-found"}(ce||(ce={}));const ue=".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}",he=new WeakMap;let de=!1;function me(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 pe(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 fe(t){const e=t.getAttribute("tooltip");if(!e)return;!function(){if(!de)try{if("adoptedStyleSheets"in document&&"CSSStyleSheet"in window){const t=new CSSStyleSheet;t.replaceSync(ue),document.adoptedStyleSheets=[...document.adoptedStyleSheets,t]}else{const t=document.createElement("style");t.textContent=ue,document.head.appendChild(t)}de=!0}catch(t){console.warn("Failed to inject tooltip portal styles:",t)}}();const n=me(t);let o=he.get(t);if(o||(o={portal:null,listeners:[],activePosition:n.position},he.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=pe(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=pe(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 ye(t){const e=he.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 ge(t){const e=he.get(t);if(!e)return;we(e);const n=me(t);n.delay>0?e.showTimeout=window.setTimeout(()=>fe(t),n.delay):fe(t)}function be(t){const e=he.get(t);if(!e)return;we(e);const n=me(t);n.hideDelay>0?e.hideTimeout=window.setTimeout(()=>ye(t),n.hideDelay):ye(t)}function we(t){void 0!==t.showTimeout&&(clearTimeout(t.showTimeout),t.showTimeout=void 0),void 0!==t.hideTimeout&&(clearTimeout(t.hideTimeout),t.hideTimeout=void 0)}function ve(t){if(he.has(t))return;const e=me(t),n={portal:null,listeners:[],activePosition:e.position};he.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",()=>ge(t)),o("mouseleave",()=>be(t)),o("focusin",()=>ge(t)),o("focusout",()=>be(t));break;case"focus":o("focusin",()=>ge(t)),o("focusout",()=>be(t));break;case"click":{const e=n=>{t.contains(n.target)||(be(t),document.removeEventListener("click",e))};o("click",()=>{const n=he.get(t),o=n?.portal?.classList.contains("snice-tooltip--visible");o?be(t):(ge(t),setTimeout(()=>document.addEventListener("click",e),0))});break}}}function Te(t){const e=he.get(t);if(e){we(e);for(const{type:n,fn:o}of e.listeners)t.removeEventListener(n,o);e.portal&&e.portal.remove(),he.delete(t)}}function Se(t){if(!(t instanceof HTMLElement))return;t.getAttribute("tooltip")&&ve(t)}let _e=!1;async function xe(t,e=500){if(customElements.get(t))return;let n=null;_e||(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 Ee(t,e=500){const n=t.tagName.toLowerCase();await xe(n,e),"ready"in t&&"function"==typeof t.ready?.then&&await t.ready}const Ne=n("debounce-timers"),Ae=n("throttle-timers"),Ce=n("once-called"),ke=n("memoize-cache");
21
21
  /*!
22
- * snice v4.13.0
23
- * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
24
- * (c) 2024
25
- * Released under the MIT License.
26
- */
27
- globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const ge=globalThis.snice;function be(t){return ge.symbols.has(t)||ge.symbols.set(t,Symbol.for(`snice:${t}`)),ge.symbols.get(t)}return be("is-controller-class"),be("is-controller-instance"),be("is-element-class"),be("channel-handlers"),be("ready-promise"),be("ready-resolve"),be("rendered-promise"),be("rendered-resolve"),be("controller"),be("initialized"),be("on-handlers"),be("controller-key"),be("controller-name"),be("controller-id"),be("controller-operations"),be("native-controller"),be("cleanup"),be("properties"),be("property-values"),be("pre-init-property-values"),be("properties-initialized"),be("property-watchers"),be("explicitly-set-properties"),be("router-context"),be("current-page-marker"),be("context-request-handler"),be("page-transition"),be("created-at"),be("ready-handlers"),be("dispose-handlers"),be("moved-handlers"),be("adopted-handlers"),be("observers"),be("parts"),be("part-timers"),be("moved-timers"),be("adopted-timers"),be("dispatch-timers"),be("render-method"),be("render-options"),be("render-instance"),be("render-scheduled"),be("render-timers"),be("render-callbacks"),be("styles-method"),be("styles-applied"),be("context-handler"),be("context-method-name"),be("navigation-context-instance"),be("registered-elements"),be("is-updating"),be("context-register"),be("context-unregister"),be("context-notify-element"),be("context-options"),be("context-timer"),be("context-called"),be("context-update"),t.Context=Zt,t.ContextAwareFetcher=class{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 r=new Request(t,o);let s=0;const i=async()=>{if(s<e.length){return e[s++].call(this,r,i)}const t=await fetch(r);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)}},t.IS_CONTROLLER_INSTANCE=r,t.Router=function(t){const e=[];let n,o,r,s=!1,i=[],a=null,l=null;const c=t.context||{},u=new Zt(c,[],"",{},t.fetcher);function h(t){if(!a||!l)return null;const e=t.querySelectorAll(a);for(const t of e){if(t[A]===l)return t}return null}function d(t,i,a,l,c,u){e.push({route:new ae(t),tag:i,transition:a,guards:l,layout:c,placard:u}),s=!1,"/404"===t&&(n=i),"/403"===t&&(o=i),"/"===t&&(r=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[X](c,i,e,n)}function p(){switch(t.type){case"hash":return window.location.hash.slice(1);case"pushstate":return window.location.pathname}}function y(t){let e;const n=!!o;if(n&&(e=document.createElement(o),e[N]=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 y(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[N]=c,n[A]=e,{element:n,needsNewLayout:!0}}return l=null,{element:null,needsNewLayout:!0}}async function T(t,e,n,o,r,s,a){const l=o||h(t);if(!l)return;!function(t,e,n){"function"==typeof t.update&&t.update(c,i,e,n)}(l,s,a);const u=l.querySelector('[slot="page"]');if(!(!n||!u))return e.setAttribute("slot","page"),await x(l,u,e,n),void(r&&(t.innerHTML="",t.appendChild(l)));l.querySelectorAll('[slot="page"]').forEach(t=>t.remove()),e.setAttribute("slot","page"),l.appendChild(e),r&&(t.innerHTML="",t.appendChild(l))}async function S(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 s=document.querySelector(t.target);if(!s)throw new Error(`Target element not found: ${t.target}`);m(),window.scrollTo(0,0);if((""===o?.trim()||"/"===o)&&!!r){const n=e.find(t=>t.route.match("/"));if(!b(n?.guards,{},s))return;const{element:i,transition:a,layout:l}=function(){const t=document.createElement(r);t[N]=c;const n=customElements.get(r),o=n?.[E],s=e.find(t=>t.route.match("/"));return{element:t,transition:o,layout:s?.layout}}(),u=w(l),{element:d,needsNewLayout:m}=v(u),p=a||t.transition;return null!==d||null!==h(s)?(await T(s,i,p,d,m,o,{}),void f(0,o,{})):(await S(s,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:ce.GUARDS_FAILED};const r=document.createElement(o.tag);r[N]=c,r[j]=u;const s=e;return Object.keys(s).forEach(t=>r.setAttribute(t,s[t])),{result:ce.SUCCESS,element:r,transition:o.transition,layout:o.layout,routeParams:s}}return{result:ce.NOT_FOUND}}(o,s);if(i.result===ce.GUARDS_FAILED)return;if(i.result===ce.SUCCESS){const{element:e,transition:n,layout:r,routeParams:a={}}=i,l=w(r),{element:c,needsNewLayout:u}=v(l),d=n||t.transition;return null!==c||null!==h(s)?(await T(s,e,d,c,u,o,a),void f(0,o,a)):(await S(s,e,d),void f(0,o,a))}const{element:a,transition:l,layout:d}=function(){if(n){const t=document.createElement(n);t[N]=c;const e=customElements.get(n),o=e?.[E];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),A=l||t.transition;if(null!==y||null!==h(s))return await T(s,a,A,y,g,o,{}),void f(0,o,{});await S(s,a,A),f(0,o,{})}async function x(t,e,n,o){return async function(t,e,n,o={}){const r=o.outDuration||300,s=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 ${r}ms ease-in-out`,n.style.position="absolute",n.style.width="100%",n.style.height="100%",n.style.transition=`opacity ${s}ms ease-in-out`):(e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.width="100%",e.style.transition=`all ${r}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 ${s}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(r,s)))):(Object.assign(e.style,a),await new Promise(t=>setTimeout(t,r)),Object.assign(n.style,c),await new Promise(t=>setTimeout(t,s))),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[g]){e[g]||(e[g]=new Map);for(const[t,o]of n.metadata[g])e[g].set(t,o)}ie(e),e[E]=t.transition;const o=e.prototype.connectedCallback;e.prototype.connectedCallback=function(){this[j]=u,o?.call(this)};const r=e.prototype.disconnectedCallback;return e.prototype.disconnectedCallback=function(){r?.call(this),delete this[N],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}`);!s&&(e.sort((t,e)=>e.route.spec.length-t.route.spec.length),s=!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}},t.SimpleArray=Gt,t.adopted=function(t={}){return function(e,n){const o=n.name;return n.addInitializer(function(){const n=this.constructor;n[O]||(n[O]=[]),n[O].push({methodName:o,method:e,options:t})}),function(...n){this[$]||(this[$]=new Map),this[$].has(o)||this[$].set(o,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const r=this[$].get(o),s=(...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(r.debounceTimer),void(r.debounceTimer=setTimeout(()=>s(...n),t.debounce));case a:{const e=t.throttle,o=Date.now();if(0===r.lastThrottleCall||o-r.lastThrottleCall>=e)return r.lastThrottleCall=o,s(...n);if(!!!r.throttleTimer){const t=e-(o-r.lastThrottleCall);r.throttleTimer=setTimeout(()=>{r.throttleTimer=null,r.lastThrottleCall=Date.now(),s(...n)},t)}return}default:return s(...n)}}}},t.applyElementFunctionality=ie,t.clearDebounceTimers=function(t){if(t[me]){for(const e in t[me])t[me][e]?.timeout&&clearTimeout(t[me][e].timeout);t[me]={}}},t.clearMemoizeCache=function(t,e){t[ye]&&(e?delete t[ye][e]:t[ye]={})},t.clearThrottleTimers=function(t){if(t[fe]){for(const e in t[fe])t[fe][e]?.timeout&&clearTimeout(t[fe][e].timeout);t[fe]={}}},t.context=function(t={}){return function(e,n){const o=n.name,r=`__context_init_${o}`;return n.addInitializer(function(){const n=this.constructor;n[r]||(n[r]=!0,n[Ht]||(n[Ht]=[]),n[Ht].push({methodName:o,method:e,options:t}))}),e}},t.contextProperty=function(){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[N])return this[N];const t={target:this},e=new CustomEvent("@context/request",{bubbles:!0,cancelable:!0,detail:t});let n=!0===this[r]&&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[N]=t.context,t.context):void 0}},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,n,t)}return t}}},t.controller=function(t){return function(e,n){const r=globalThis.snice?.controllerRegistry;if(!r)throw new Error("Snice global registry not initialized");return r.set(t,e),e.prototype[o]=!0,e}},t.css=function(t,...e){let n=t[0];for(let o=0;o<e.length;o++)n+=String(e[o])+t[o+1];const o={_$litType$:ut,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},t.debounce=function(t=300,e={}){const{leading:n=!1,trailing:o=!0,maxWait:r}=e;return function(e,s){const i=s.name;return function(...s){this[me]||(this[me]={});const a=this[me],l=i;a[l]&&clearTimeout(a[l].timeout);const c=Date.now(),u=!a[l],h=u?c:a[l].startTime,d=void 0!==r&&c-h>=r;if(n&&u){const t=e.apply(this,s);return a[l]={timeout:null,startTime:h,lastArgs:s},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:s}}}},t.dispatch=function(t,e){return function(n,o){return function(...r){this[M]||(this[M]=new Map);const s=`${t}_${o.name}`;this[M].has(s)||this[M].set(s,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[M].get(s),a=n.apply(this,r),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)}}},t.dispose=function(){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[x]||(e[x]=[]),e[x].push({methodName:n,method:t}))})}},t.element=function(t,e){return function(n,o){if(o.metadata&&o.metadata[g]){n[g]||(n[g]=new Map);for(const[t,e]of o.metadata[g])n[g].set(t,e)}return!0===e?.formAssociated&&(n.formAssociated=!0),ie(n),customElements.get(t)?(console.warn(`[snice] Element "${t}" is already registered. Skipping duplicate registration.`),n):(customElements.define(t,n),n)}},t.getSymbol=n,t.html=function(t,...e){return{_$litType$:ct,strings:t,values:e}},t.layout=function(t){return function(e,n){if(n.metadata&&n.metadata[g]){e[g]||(e[g]=new Map);for(const[t,o]of n.metadata[g])e[g].set(t,o)}return ie(e),customElements.get(t)?(console.warn(`[snice] Layout "${t}" is already registered. Skipping duplicate registration.`),e):(customElements.define(t,e),e)}},t.memoize=function(t={}){const{keyGenerator:e=(...t)=>JSON.stringify(t),maxSize:n=100,ttl:o}=t;return function(t,r){const s=r.name;return function(...r){this[ye]||(this[ye]={}),this[ye][s]||(this[ye][s]=new Map);const i=this[ye][s],a=e(...r);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,r);if(i.set(a,{value:l,timestamp:Date.now()}),i.size>n){const t=i.keys().next().value;i.delete(t)}return l}}},t.moved=function(t={}){return function(e,n){const o=n.name,r=`__moved_init_${o}`;return n.addInitializer(function(){const n=this.constructor;n[r]||(n[r]=!0,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 r=this[L].get(o),s=(...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(r.debounceTimer),void(r.debounceTimer=setTimeout(()=>s(...n),t.debounce));case a:{const e=t.throttle,o=Date.now();if(0===r.lastThrottleCall||o-r.lastThrottleCall>=e)return r.lastThrottleCall=o,s(...n);if(!!!r.throttleTimer){const t=e-(o-r.lastThrottleCall);r.throttleTimer=setTimeout(()=>{r.throttleTimer=null,r.lastThrottleCall=Date.now(),s(...n)},t)}return}default:return s(...n)}}}},t.noChange=vt,t.nothing=dt,t.observe=function(t,e,n){let o,r;return"string"==typeof e?(o=e,r=n):(o=void 0,r=e),function(e,n){const s=n.name,i=`__observe_init_${s}`;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:s,method:e,options:r})}})}},t.on=function(t,e,n){let o=null,r={};return"string"==typeof e?(o=e,r=n||{}):null===e&&n?r=n:e&&"object"==typeof e&&(r=e),function(e,n){const s=n.name,i=`__on_init_${s}_${o||""}_${JSON.stringify(t)}`;return n.addInitializer(function(){const n=this.constructor;if(n[i])return;n[i]=!0,n[It]||(n[It]=[]);const a=Array.isArray(t)?t:[t];for(const t of a)n[It].push({eventName:t,selector:o,methodName:s,method:e,options:r})}),e}},t.once=function(t=!0){let e,n=!1;return function(o,r){const s=r.name;return function(...r){return t?(this[pe]||(this[pe]={}),this[pe][s]||(this[pe][s]={called:!0,result:o.apply(this,r)}),this[pe][s].result):(n||(n=!0,e=o.apply(this,r)),e)}}},t.property=function(t){return function(e,n){const o=n.name;return n.metadata||(n.metadata={}),n.metadata[g]||(n.metadata[g]=new Map),n.metadata[g].set(o,t||{}),function(e){const n=this.constructor;n[g]||(n[g]=new Map);const r={...t};if(r.type||void 0===e||(r.type=te(e)),n[g].set(o,r),!Object.hasOwnProperty.call(this.constructor.prototype,o)){const t={get(){const t="string"==typeof r?.attribute?r?.attribute:o.toLowerCase(),n=this.getAttribute?.(t);if(null!==n)return ee(n,r||{},void 0,e);return((r?.type||te(e))!==Boolean||!this[S]?.has(o))&&(this[w]?.has(o)?this[w].get(o):e)},set(t){const n=this[o];if(n===t)return;if(!this[v])return this[w]||(this[w]=new Map),void this[w].set(o,t);const s="string"==typeof r.attribute?r.attribute:o.toLowerCase(),i=function(t,e,n){if(null==t||!1===t||e?.type===Gt&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||te(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 Gt:return Array.isArray(t)?Gt.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,r,e);this[S]||(this[S]=new Set),this[S].add(o),this._settingFromProperty||(this._settingFromProperty=new Set),this._settingFromProperty.add(s.toLowerCase()),null===i?this.removeAttribute?.(s):this.setAttribute?.(s,i),setTimeout(()=>{this._settingFromProperty?.delete(s.toLowerCase())},0);const a=this.constructor[T];if(a){if(a.has(o)){const e=a.get(o);for(const r of e)try{r.method.call(this,n,t,o)}catch(t){console.error(`Error in @watch('${o}') method ${r.methodName}:`,t)}}if(a.has("*")){const e=a.get("*");for(const r of e)try{r.method.call(this,n,t,o)}catch(t){console.error(`Error in @watch('*') method ${r.methodName}:`,t)}}}this[P]&&this[u]&&re(this)},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,o,t)}return this[b]||(this[b]={}),this[b][o]=e,e}}},t.query=function(t,e={}){return function(n,o){const{light:s=!1,shadow:i=!0}=e,a=o.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[r]&&this.element?this.element:this;let n=null;return i&&e.shadowRoot&&(n=e.shadowRoot.querySelector(t)),!n&&s&&(n=e.querySelector(t)),n||null},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,a,e)}return e}}},t.queryAll=function(t,e={}){return function(n,o){const{light:s=!1,shadow:i=!0}=e,a=o.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[r]&&this.element?this.element:this,n=[];if(i&&e.shadowRoot){const o=e.shadowRoot.querySelectorAll(t);n.push(...o)}if(s){const o=e.querySelectorAll(t);n.push(...o)}return n},set(){},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,a,e)}return e}}},t.ready=function(){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[_].push({methodName:n,method:t}))})}},t.render=function(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[P]=e,this[R]=t}),function(...t){const n=e.apply(this,t);return oe(this,{},n),n}}},t.request=function(t,e){return function(n,o){let s,i,a=0;return async function(...o){const l=async()=>{const s=e?.timeout??12e4,i=e?.discoveryTimeout??50,a=n.apply(this,o),{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[r]&&this.element?this.element:this).dispatchEvent(g);try{await y;const e=setTimeout(()=>{h(new Error(`Request "${t}" timed out after ${s}ms`))},s),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(s),s=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()}}},t.resetOnce=function(t,e){t[pe]&&(e?delete t[pe][e]:t[pe]={})},t.respond=function(t,e){return function(n,o){const r=o.name,s=`__respond_init_${t}_${r}`;o.addInitializer(function(){const o=this.constructor;o[s]||(o[s]=!0,o[i]||(o[i]=[]),o[i].push({channelName:t,methodName:r,method:n,options:e}))})}},t.setDisableElementReadyWarnings=function(t){ue=t},t.styles=function(){return function(t,e){return e.addInitializer(function(){this[V]=t}),t}},t.throttle=function(t=300,e={}){const{leading:n=!0,trailing:o=!0}=e;return function(e,r){const s=r.name;return function(...r){this[fe]||(this[fe]={});const i=this[fe],a=s,l=Date.now();if(i[a]){const n=l-i[a].lastInvoke;if(i[a].lastArgs=r,i[a].timeout&&clearTimeout(i[a].timeout),n>=t)e.apply(this,r),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,r),i[a]={lastInvoke:l,timeout:null,lastArgs:r},o&&!n&&(i[a].timeout=setTimeout(()=>{e.apply(this,i[a].lastArgs),delete i[a]},t))}}},t.trackRenders=async function*(t){for(;;)await new Promise(e=>{t[q]||(t[q]=[]),t[q].push(e)}),yield},t.unsafeHTML=function(t){return{_$litType$:mt,html:t}},t.useNativeElementControllers=function(){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&&Wt(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),Bt(t,e).catch(t=>{console.error(`Failed to attach controller "${e}" to native element:`,t)})):!e&&n&&(delete t[p],delete t[d],Wt(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},t.waitForAllCustomElements=async function(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)))},t.waitForElementDefined=he,t.waitForElementReady=de,t.watch=function(...t){return function(e,n){const o=n.name,r=`__watch_init_${o}`;n.addInitializer(function(){const n=this.constructor;if(!n[r]){n[r]=!0,n[T]||(n[T]=new Map);for(const r of t)n[T].has(r)||n[T].set(r,[]),n[T].get(r).push({methodName:o,method:e})}})}},t}({});
22
+ * snice v4.15.0
23
+ * Imperative TypeScript framework for building vanilla web components with decorators, differential rendering, routing, and controllers. No virtual DOM, no build complexity.
24
+ * (c) 2024
25
+ * Released under the MIT License.
26
+ */
27
+ globalThis.snice||(globalThis.snice={controllerRegistry:new Map,controllerIdCounter:0,symbols:new Map});const Le=globalThis.snice;function Oe(t){return Le.symbols.has(t)||Le.symbols.set(t,Symbol.for(`snice:${t}`)),Le.symbols.get(t)}return Oe("is-controller-class"),Oe("is-controller-instance"),Oe("is-element-class"),Oe("channel-handlers"),Oe("ready-promise"),Oe("ready-resolve"),Oe("rendered-promise"),Oe("rendered-resolve"),Oe("controller"),Oe("initialized"),Oe("on-handlers"),Oe("controller-key"),Oe("controller-name"),Oe("controller-id"),Oe("controller-operations"),Oe("native-controller"),Oe("cleanup"),Oe("properties"),Oe("property-values"),Oe("pre-init-property-values"),Oe("properties-initialized"),Oe("property-watchers"),Oe("explicitly-set-properties"),Oe("router-context"),Oe("current-page-marker"),Oe("context-request-handler"),Oe("page-transition"),Oe("created-at"),Oe("ready-handlers"),Oe("dispose-handlers"),Oe("moved-handlers"),Oe("adopted-handlers"),Oe("observers"),Oe("parts"),Oe("part-timers"),Oe("moved-timers"),Oe("adopted-timers"),Oe("dispatch-timers"),Oe("render-method"),Oe("render-options"),Oe("render-instance"),Oe("render-scheduled"),Oe("render-timers"),Oe("render-callbacks"),Oe("styles-method"),Oe("styles-applied"),Oe("context-handler"),Oe("context-method-name"),Oe("navigation-context-instance"),Oe("registered-elements"),Oe("is-updating"),Oe("context-register"),Oe("context-unregister"),Oe("context-notify-element"),Oe("context-options"),Oe("context-timer"),Oe("context-called"),Oe("context-update"),t.Context=Zt,t.ContextAwareFetcher=class{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)}},t.IS_CONTROLLER_INSTANCE=s,t.Router=function(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 Zt(h,[],"",{},t.fetcher);function m(t){if(!c||!u)return null;const e=t.querySelectorAll(c);for(const t of e){if(t[E]===u)return t}return null}function p(t,e,n,l,c,u){o.push({route:new ae(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 y(t,e,n){d[X](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 S(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[E]=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?.[x],a=o.find(t=>t.route.match("/"));return{element:t,transition:r,layout:a?.layout}}(),d=T(u),{element:p,needsNewLayout:f}=S(d),g=c||t.transition;return null!==p||null!==m(a)?(await N(a,l,g,p,f,r,{}),void y(0,r,{})):(await A(a,l,g),void y(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:ce.GUARDS_FAILED};const r=n.createElement(s.tag);r[_]=h,r[V]=d;const i=o;return Object.keys(i).forEach(t=>r.setAttribute(t,i[t])),{result:ce.SUCCESS,element:r,transition:s.transition,layout:s.layout,routeParams:i}}return{result:ce.NOT_FOUND}}(r,a);if(l.result===ce.GUARDS_FAILED)return;if(l.result===ce.SUCCESS){const{element:e,transition:n,layout:o,routeParams:s={}}=l,i=T(o),{element:c,needsNewLayout:u}=S(i),h=n||t.transition;return null!==c||null!==m(a)?(await N(a,e,h,c,u,r,s),void y(0,r,s)):(await A(a,e,h),void y(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?.[x];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}}(),g=T(p),{element:b,needsNewLayout:w}=S(g),E=u||t.transition;if(null!==b||null!==m(a))return await N(a,c,E,b,w,r,{}),void y(0,r,{});await A(a,c,E),y(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[g]){n[g]||(n[g]=new Map);for(const[t,e]of o.metadata[g])n[g].set(t,e)}ie(n),n[x]=t.transition;const s=n.prototype.connectedCallback;n.prototype.connectedCallback=function(){this[V]=d,s?.call(this)};const r=n.prototype.disconnectedCallback;return n.prototype.disconnectedCallback=function(){r?.call(this),delete this[_],delete this[V]},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}},t.SimpleArray=Gt,t.adopted=function(t={}){return function(e,n){const o=n.name;return n.addInitializer(function(){const n=this.constructor;n[k]||(n[k]=[]),n[k].push({methodName:o,method:e,options:t})}),function(...n){this[$]||(this[$]=new Map),this[$].has(o)||this[$].set(o,{throttleTimer:null,debounceTimer:null,lastThrottleCall:0});const s=this[$].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)}}}},t.applyElementFunctionality=ie,t.cleanupTooltips=function(){const t=globalThis.sniceTooltipObserver;t&&(t.disconnect(),globalThis.sniceTooltipObserver=void 0),document.querySelectorAll("[tooltip]").forEach(t=>{t instanceof HTMLElement&&Te(t)}),globalThis.sniceTooltipsInitialized=!1},t.clearDebounceTimers=function(t){if(t[Ne]){for(const e in t[Ne])t[Ne][e]?.timeout&&clearTimeout(t[Ne][e].timeout);t[Ne]={}}},t.clearMemoizeCache=function(t,e){t[ke]&&(e?delete t[ke][e]:t[ke]={})},t.clearThrottleTimers=function(t){if(t[Ae]){for(const e in t[Ae])t[Ae][e]?.timeout&&clearTimeout(t[Ae][e].timeout);t[Ae]={}}},t.context=function(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[Bt]||(n[Bt]=[]),n[Bt].push({methodName:o,method:e,options:t}))}),e}},t.contextProperty=function(){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[s]&&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}}},t.controller=function(t){return function(e,n){const s=globalThis.snice?.controllerRegistry;if(!s)throw new Error("Snice global registry not initialized");return s.set(t,e),e.prototype[o]=!0,e}},t.css=function(t,...e){let n=t[0];for(let o=0;o<e.length;o++)n+=String(e[o])+t[o+1];const o={_$litType$:ut,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},t.debounce=function(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[Ne]||(this[Ne]={});const a=this[Ne],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}}}},t.dispatch=function(t,e){return function(n,o){return function(...s){this[P]||(this[P]=new Map);const r=`${t}_${o.name}`;this[P].has(r)||this[P].set(r,{debounceTimeout:null,throttleLastCall:0,throttleTimeout:null});const i=this[P].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)}}},t.dispose=function(){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[A]||(e[A]=[]),e[A].push({methodName:n,method:t}))})}},t.element=function(t,e){return function(n,o){if(o.metadata&&o.metadata[g]){n[g]||(n[g]=new Map);for(const[t,e]of o.metadata[g])n[g].set(t,e)}return!0===e?.formAssociated&&(n.formAssociated=!0),ie(n),customElements.get(t)?(console.warn(`[snice] Element "${t}" is already registered. Skipping duplicate registration.`),n):(customElements.define(t,n),n)}},t.getSymbol=n,t.html=function(t,...e){return{_$litType$:ct,strings:t,values:e}},t.layout=function(t){return function(e,n){if(n.metadata&&n.metadata[g]){e[g]||(e[g]=new Map);for(const[t,o]of n.metadata[g])e[g].set(t,o)}return ie(e),customElements.get(t)?(console.warn(`[snice] Layout "${t}" is already registered. Skipping duplicate registration.`),e):(customElements.define(t,e),e)}},t.memoize=function(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[ke]||(this[ke]={}),this[ke][r]||(this[ke][r]=new Map);const i=this[ke][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}}},t.moved=function(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[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)}}}},t.noChange=vt,t.nothing=dt,t.observe=function(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[L]||(n[L]=[]);const a=Array.isArray(t)?t:[t];for(const t of a){const[i,...a]=t.split(":"),l=a.join(":");n[L].push({type:i,target:l,selector:o,methodName:r,method:e,options:s})}})}},t.on=function(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[Rt]||(n[Rt]=[]);const a=Array.isArray(t)?t:[t];for(const t of a)n[Rt].push({eventName:t,selector:o,methodName:r,method:e,options:s})}),e}},t.once=function(t=!0){let e,n=!1;return function(o,s){const r=s.name;return function(...s){return t?(this[Ce]||(this[Ce]={}),this[Ce][r]||(this[Ce][r]={called:!0,result:o.apply(this,s)}),this[Ce][r].result):(n||(n=!0,e=o.apply(this,s)),e)}}},t.property=function(t){return function(e,n){const o=n.name;return n.metadata||(n.metadata={}),n.metadata[g]||(n.metadata[g]=new Map),n.metadata[g].set(o,t||{}),function(e){const n=this.constructor;n[g]||(n[g]=new Map);const s={...t};if(s.type||void 0===e||(s.type=te(e)),n[g].set(o,s),!Object.hasOwnProperty.call(this.constructor.prototype,o)){const t={get(){if(!1===s?.attribute)return this[b]&&o in this[b]?this[b][o]:this[w]?.has(o)?this[w].get(o):e;const t="string"==typeof s?.attribute?s?.attribute:o.toLowerCase(),n=this.getAttribute?.(t);if(null!==n)return ee(n,s||{},void 0,e);return((s?.type||te(e))!==Boolean||!this[S]?.has(o))&&(this[w]?.has(o)?this[w].get(o):e)},set(t){const n=this[o];if(n===t)return;if(!this[v])return this[w]||(this[w]=new Map),void this[w].set(o,t);if(!1===s?.attribute)this[b]||(this[b]={}),this[b][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===Gt&&Array.isArray(t)&&0===t.length)return null;if(e.converter?.toAttribute)return e.converter.toAttribute(t,e.type);switch(e.type||te(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 Gt:return Array.isArray(t)?Gt.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[S]||(this[S]=new Set),this[S].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[T];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[M]&&this[u]&&se(this)},configurable:!0,enumerable:!0};Object.defineProperty(this.constructor.prototype,o,t)}return this[b]||(this[b]={}),this[b][o]=e,e}}},t.query=function(t,e={}){return function(n,o){const{light:r=!1,shadow:i=!0}=e,a=o.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[s]&&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}}},t.queryAll=function(t,e={}){return function(n,o){const{light:r=!1,shadow:i=!0}=e,a=o.name;return function(e){if(!Object.hasOwnProperty.call(this.constructor.prototype,a)){const e={get(){const e=!0===this[s]&&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}}},t.ready=function(){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[N]||(e[N]=[]),e[N].push({methodName:n,method:t}))})}},t.render=function(t={}){return function(e,n){return n.name,n.addInitializer(function(){this[M]=e,this[I]=t}),function(...t){const n=e.apply(this,t);return oe(this,{},n),n}}},t.request=function(t,e){return function(n,o){let r,i,a=0;return async function(...o){const l=async()=>{const r=e?.timeout??12e4,i=e?.discoveryTimeout??50,a=n.apply(this,o),{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[s]&&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()}}},t.resetOnce=function(t,e){t[Ce]&&(e?delete t[Ce][e]:t[Ce]={})},t.respond=function(t,e){return function(n,o){const s=o.name,r=`__respond_init_${t}_${s}`;o.addInitializer(function(){const o=this.constructor;o[r]||(o[r]=!0,o[i]||(o[i]=[]),o[i].push({channelName:t,methodName:s,method:n,options:e}))})}},t.setDisableElementReadyWarnings=function(t){_e=t},t.styles=function(){return function(t,e){return e.addInitializer(function(){this[z]=t}),t}},t.throttle=function(t=300,e={}){const{leading:n=!0,trailing:o=!0}=e;return function(e,s){const r=s.name;return function(...s){this[Ae]||(this[Ae]={});const i=this[Ae],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))}}},t.trackRenders=async function*(t){for(;;)await new Promise(e=>{t[F]||(t[F]=[]),t[F].push(e)}),yield},t.unsafeHTML=function(t){return{_$litType$:mt,html:t}},t.useNativeElementControllers=function(){if(globalThis.sniceNativeControllersInitialized)return;function t(t){if(!(t instanceof HTMLElement))return;if(t.tagName.includes("-"))return;if(t[r])return;const e=t.getAttribute("controller"),n=t[f];e&&e!==n?(t[f]=e,t.ready||(t.ready=Promise.resolve()),n&&Ht(t).catch(t=>{console.error("Failed to detach old controller from native element:",t)}),Wt(t,e).catch(t=>{console.error(`Failed to attach controller "${e}" to native element:`,t)})):!e&&n&&(delete t[f],delete t[d],Ht(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},t.useTooltips=function(){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")?(Te(t),ve(t)):Te(t)}else"childList"===e.type&&(e.addedNodes.forEach(t=>{t instanceof HTMLElement&&(Se(t),t.querySelectorAll("[tooltip]").forEach(Se))}),e.removedNodes.forEach(t=>{t instanceof HTMLElement&&(Te(t),t.querySelectorAll("[tooltip]").forEach(t=>{t instanceof HTMLElement&&Te(t)}))}))}),e=()=>{document.querySelectorAll("[tooltip]").forEach(Se),t.observe(document.body,{attributes:!0,attributeFilter:["tooltip"],childList:!0,subtree:!0})};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",e):e(),globalThis.sniceTooltipObserver=t},t.waitForAllCustomElements=async function(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=>Ee(t,e)))},t.waitForElementDefined=xe,t.waitForElementReady=Ee,t.watch=function(...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[T]||(n[T]=new Map);for(const s of t)n[T].has(s)||n[T].set(s,[]),n[T].get(s).push({methodName:o,method:e})}})}},t}({});
28
28
  //# sourceMappingURL=snice-runtime.min.js.map