@threadlabs/looma 0.4.0 → 0.5.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 (490) hide show
  1. package/README.md +43 -12
  2. package/components/shared/editor.js +69 -0
  3. package/components/shared/input-modality.js +20 -0
  4. package/components/shared/overlay.js +281 -0
  5. package/components/shared/trigger.js +17 -0
  6. package/components/ui-affordance-scope/ui-affordance-scope.html +22 -0
  7. package/components/ui-affordance-scope/ui-affordance-scope.js +76 -0
  8. package/components/ui-avatar/ui-avatar.html +59 -0
  9. package/components/ui-avatar/ui-avatar.js +47 -0
  10. package/components/ui-avatar-group/ui-avatar-group.html +62 -0
  11. package/components/ui-avatar-group/ui-avatar-group.js +27 -0
  12. package/components/ui-badge/ui-badge.html +94 -0
  13. package/components/ui-button/ui-button.html +198 -0
  14. package/components/ui-callout/ui-callout.html +104 -0
  15. package/components/ui-checkbox/ui-checkbox.html +107 -0
  16. package/components/ui-checkbox/ui-checkbox.js +24 -0
  17. package/components/ui-cluster/ui-cluster.html +49 -0
  18. package/components/ui-combobox/ui-combobox.html +377 -0
  19. package/components/ui-combobox/ui-combobox.js +432 -0
  20. package/components/ui-container/ui-container.html +39 -0
  21. package/components/ui-context-menu/ui-context-menu.html +75 -0
  22. package/components/ui-context-menu/ui-context-menu.js +143 -0
  23. package/components/ui-dialog/ui-dialog.html +178 -0
  24. package/components/ui-dialog/ui-dialog.js +105 -0
  25. package/components/ui-disclosure/ui-disclosure.html +109 -0
  26. package/components/ui-disclosure/ui-disclosure.js +28 -0
  27. package/components/ui-editable/ui-editable.html +163 -0
  28. package/components/ui-editable/ui-editable.js +113 -0
  29. package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.html +97 -0
  30. package/components/ui-editor-insert-table-grid/ui-editor-insert-table-grid.js +71 -0
  31. package/components/ui-editor-mention-menu/ui-editor-mention-menu.html +157 -0
  32. package/components/ui-editor-mention-menu/ui-editor-mention-menu.js +50 -0
  33. package/components/ui-editor-slash-menu/ui-editor-slash-menu.html +197 -0
  34. package/components/ui-editor-slash-menu/ui-editor-slash-menu.js +44 -0
  35. package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.html +164 -0
  36. package/components/ui-editor-table-context-menu/ui-editor-table-context-menu.js +75 -0
  37. package/components/ui-editor-table-overlay/ui-editor-table-overlay.html +422 -0
  38. package/components/ui-editor-table-overlay/ui-editor-table-overlay.js +119 -0
  39. package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.html +271 -0
  40. package/components/ui-editor-table-toolbar/ui-editor-table-toolbar.js +54 -0
  41. package/components/ui-editor-toolbar/ui-editor-toolbar.html +110 -0
  42. package/components/ui-floating-action-button/ui-floating-action-button.html +83 -0
  43. package/components/ui-form-field/ui-form-field.html +45 -0
  44. package/components/ui-form-field/ui-form-field.js +71 -0
  45. package/components/ui-grid/ui-grid.html +46 -0
  46. package/components/ui-icon/ui-icon.html +34 -0
  47. package/components/ui-icon/ui-icon.js +8 -0
  48. package/components/ui-icon-button/ui-icon-button.html +167 -0
  49. package/components/ui-icon-button/ui-icon-button.js +7 -0
  50. package/components/ui-input/ui-input.html +81 -0
  51. package/components/ui-input/ui-input.js +7 -0
  52. package/components/ui-menu/ui-menu.html +87 -0
  53. package/components/ui-menu/ui-menu.js +114 -0
  54. package/components/ui-menu-item/ui-menu-item.html +37 -0
  55. package/components/ui-popover/ui-popover.html +85 -0
  56. package/components/ui-popover/ui-popover.js +70 -0
  57. package/components/ui-radio/ui-radio.html +57 -0
  58. package/components/ui-radio/ui-radio.js +25 -0
  59. package/components/ui-radio-group/ui-radio-group.html +51 -0
  60. package/components/ui-radio-group/ui-radio-group.js +42 -0
  61. package/components/ui-reel/ui-reel.html +67 -0
  62. package/components/ui-search-result-row/ui-search-result-row.html +101 -0
  63. package/components/ui-search-shell/ui-search-shell.html +142 -0
  64. package/components/ui-search-shell/ui-search-shell.js +60 -0
  65. package/components/ui-select/ui-select.html +87 -0
  66. package/components/ui-select/ui-select.js +16 -0
  67. package/components/ui-separator/ui-separator.html +22 -0
  68. package/components/ui-sidebar/ui-sidebar.html +183 -0
  69. package/components/ui-sidebar/ui-sidebar.js +178 -0
  70. package/components/ui-stack/ui-stack.html +59 -0
  71. package/components/ui-switch/ui-switch.html +95 -0
  72. package/components/ui-switch/ui-switch.js +24 -0
  73. package/components/ui-switcher/ui-switcher.html +65 -0
  74. package/components/ui-tabs/ui-tabs.html +134 -0
  75. package/components/ui-tabs/ui-tabs.js +81 -0
  76. package/components/ui-textarea/ui-textarea.html +80 -0
  77. package/components/ui-textarea/ui-textarea.js +7 -0
  78. package/components/ui-toast-region/ui-toast-region.html +127 -0
  79. package/components/ui-toast-region/ui-toast-region.js +119 -0
  80. package/components/ui-tooltip/ui-tooltip.html +122 -0
  81. package/components/ui-tooltip/ui-tooltip.js +134 -0
  82. package/components/ui-top-bar/ui-top-bar.html +53 -0
  83. package/components/ui-tree/ui-tree.html +29 -0
  84. package/components/ui-tree/ui-tree.js +250 -0
  85. package/components/ui-tree-item/ui-tree-item.html +326 -0
  86. package/components/ui-tree-item/ui-tree-item.js +94 -0
  87. package/dist/index.d.ts +4 -414
  88. package/dist/index.js +55 -657
  89. package/editor/chunks/extensions.js +7267 -0
  90. package/editor/chunks/table-backgrounds.js +51 -0
  91. package/editor/chunks/ui.js +92 -0
  92. package/editor/extensions/callout.d.ts +20 -0
  93. package/editor/extensions/index.d.ts +12 -441
  94. package/editor/extensions/index.js +3 -64
  95. package/editor/extensions/list-behavior.d.ts +7 -0
  96. package/editor/extensions/mention.d.ts +35 -0
  97. package/editor/extensions/preset.d.ts +42 -0
  98. package/editor/extensions/slash-command.d.ts +80 -0
  99. package/editor/extensions/smart-paste.d.ts +13 -0
  100. package/editor/extensions/table-commands.d.ts +114 -0
  101. package/editor/extensions/table-formatting.d.ts +60 -0
  102. package/editor/icons.d.ts +55 -0
  103. package/editor/index.d.ts +8 -6
  104. package/editor/index.js +96 -71
  105. package/editor/insert-table-grid.d.ts +7 -0
  106. package/editor/mention-contract.d.ts +78 -0
  107. package/editor/mention-menu.d.ts +9 -0
  108. package/editor/slash-menu.d.ts +29 -0
  109. package/editor/table-backgrounds.d.ts +43 -0
  110. package/editor/table-context-menu.d.ts +12 -0
  111. package/editor/table-overlay.d.ts +79 -0
  112. package/editor/ui.d.ts +10 -50
  113. package/editor/ui.js +3 -14
  114. package/editor/viewport.d.ts +15 -0
  115. package/package.json +84 -60
  116. package/styles/ui-affordance-scope.css +19 -0
  117. package/styles/ui-avatar-group.css +56 -0
  118. package/styles/ui-avatar.css +47 -0
  119. package/styles/ui-badge.css +91 -0
  120. package/styles/ui-button.css +206 -0
  121. package/styles/ui-callout.css +76 -0
  122. package/styles/ui-checkbox.css +98 -0
  123. package/styles/ui-cluster.css +46 -0
  124. package/styles/ui-combobox.css +213 -0
  125. package/styles/ui-container.css +36 -0
  126. package/styles/ui-context-menu.css +68 -0
  127. package/styles/ui-dialog.css +160 -0
  128. package/styles/ui-disclosure.css +95 -0
  129. package/styles/ui-editable.css +139 -0
  130. package/styles/ui-editor-insert-table-grid.css +65 -0
  131. package/styles/ui-editor-mention-menu.css +121 -0
  132. package/styles/ui-editor-slash-menu.css +179 -0
  133. package/styles/ui-editor-table-context-menu.css +118 -0
  134. package/styles/ui-editor-table-overlay.css +318 -0
  135. package/styles/ui-editor-table-toolbar.css +191 -0
  136. package/styles/ui-editor-toolbar.css +115 -0
  137. package/styles/ui-floating-action-button.css +82 -0
  138. package/styles/ui-form-field.css +36 -0
  139. package/styles/ui-grid.css +43 -0
  140. package/styles/ui-icon-button.css +169 -0
  141. package/styles/ui-icon.css +23 -0
  142. package/styles/ui-input.css +82 -0
  143. package/styles/ui-menu-item.css +34 -0
  144. package/styles/ui-menu.css +80 -0
  145. package/styles/ui-popover.css +76 -0
  146. package/styles/ui-radio-group.css +38 -0
  147. package/styles/ui-radio.css +46 -0
  148. package/styles/ui-reel.css +63 -0
  149. package/styles/ui-search-result-row.css +92 -0
  150. package/styles/ui-search-shell.css +128 -0
  151. package/styles/ui-select.css +86 -0
  152. package/styles/ui-separator.css +16 -0
  153. package/styles/ui-sidebar.css +166 -0
  154. package/styles/ui-stack.css +55 -0
  155. package/styles/ui-switch.css +88 -0
  156. package/styles/ui-switcher.css +61 -0
  157. package/styles/ui-tabs.css +114 -0
  158. package/styles/ui-textarea.css +77 -0
  159. package/styles/ui-toast-region.css +103 -0
  160. package/styles/ui-tooltip.css +113 -0
  161. package/styles/ui-top-bar.css +51 -0
  162. package/styles/ui-tree-item.css +267 -0
  163. package/styles/ui-tree.css +16 -0
  164. package/vanilla/UiAffordanceScope.d.ts +14 -0
  165. package/vanilla/UiAffordanceScope.js +30 -0
  166. package/vanilla/UiAvatar.d.ts +17 -0
  167. package/vanilla/UiAvatar.js +41 -0
  168. package/vanilla/UiAvatarGroup.d.ts +15 -0
  169. package/vanilla/UiAvatarGroup.js +40 -0
  170. package/vanilla/UiBadge.d.ts +15 -0
  171. package/vanilla/UiBadge.js +30 -0
  172. package/vanilla/UiButton.d.ts +16 -0
  173. package/vanilla/UiButton.js +32 -0
  174. package/vanilla/UiCallout.d.ts +14 -0
  175. package/vanilla/UiCallout.js +124 -0
  176. package/vanilla/UiCheckbox.d.ts +19 -0
  177. package/vanilla/UiCheckbox.js +47 -0
  178. package/vanilla/UiCluster.d.ts +15 -0
  179. package/vanilla/UiCluster.js +30 -0
  180. package/vanilla/UiCombobox.d.ts +42 -0
  181. package/vanilla/UiCombobox.js +194 -0
  182. package/vanilla/UiContainer.d.ts +15 -0
  183. package/vanilla/UiContainer.js +30 -0
  184. package/vanilla/UiContextMenu.d.ts +18 -0
  185. package/vanilla/UiContextMenu.js +35 -0
  186. package/vanilla/UiDialog.d.ts +19 -0
  187. package/vanilla/UiDialog.js +53 -0
  188. package/vanilla/UiDisclosure.d.ts +18 -0
  189. package/vanilla/UiDisclosure.js +49 -0
  190. package/vanilla/UiEditable.d.ts +22 -0
  191. package/vanilla/UiEditable.js +59 -0
  192. package/vanilla/UiEditorInsertTableGrid.d.ts +18 -0
  193. package/vanilla/UiEditorInsertTableGrid.js +46 -0
  194. package/vanilla/UiEditorMentionMenu.d.ts +21 -0
  195. package/vanilla/UiEditorMentionMenu.js +63 -0
  196. package/vanilla/UiEditorSlashMenu.d.ts +20 -0
  197. package/vanilla/UiEditorSlashMenu.js +74 -0
  198. package/vanilla/UiEditorTableContextMenu.d.ts +17 -0
  199. package/vanilla/UiEditorTableContextMenu.js +69 -0
  200. package/vanilla/UiEditorTableOverlay.d.ts +16 -0
  201. package/vanilla/UiEditorTableOverlay.js +113 -0
  202. package/vanilla/UiEditorTableToolbar.d.ts +18 -0
  203. package/vanilla/UiEditorTableToolbar.js +121 -0
  204. package/vanilla/UiEditorToolbar.d.ts +14 -0
  205. package/vanilla/UiEditorToolbar.js +30 -0
  206. package/vanilla/UiFloatingActionButton.d.ts +16 -0
  207. package/vanilla/UiFloatingActionButton.js +35 -0
  208. package/vanilla/UiFormField.d.ts +16 -0
  209. package/vanilla/UiFormField.js +54 -0
  210. package/vanilla/UiGrid.d.ts +15 -0
  211. package/vanilla/UiGrid.js +30 -0
  212. package/vanilla/UiIcon.d.ts +14 -0
  213. package/vanilla/UiIcon.js +40 -0
  214. package/vanilla/UiIconButton.d.ts +19 -0
  215. package/vanilla/UiIconButton.js +37 -0
  216. package/vanilla/UiInput.d.ts +18 -0
  217. package/vanilla/UiInput.js +37 -0
  218. package/vanilla/UiMenu.d.ts +19 -0
  219. package/vanilla/UiMenu.js +35 -0
  220. package/vanilla/UiMenuItem.d.ts +15 -0
  221. package/vanilla/UiMenuItem.js +43 -0
  222. package/vanilla/UiPopover.d.ts +18 -0
  223. package/vanilla/UiPopover.js +33 -0
  224. package/vanilla/UiRadio.d.ts +19 -0
  225. package/vanilla/UiRadio.js +48 -0
  226. package/vanilla/UiRadioGroup.d.ts +21 -0
  227. package/vanilla/UiRadioGroup.js +35 -0
  228. package/vanilla/UiReel.d.ts +16 -0
  229. package/vanilla/UiReel.js +34 -0
  230. package/vanilla/UiSearchResultRow.d.ts +15 -0
  231. package/vanilla/UiSearchResultRow.js +82 -0
  232. package/vanilla/UiSearchShell.d.ts +18 -0
  233. package/vanilla/UiSearchShell.js +74 -0
  234. package/vanilla/UiSelect.d.ts +18 -0
  235. package/vanilla/UiSelect.js +42 -0
  236. package/vanilla/UiSeparator.d.ts +14 -0
  237. package/vanilla/UiSeparator.js +28 -0
  238. package/vanilla/UiSidebar.d.ts +24 -0
  239. package/vanilla/UiSidebar.js +47 -0
  240. package/vanilla/UiStack.d.ts +16 -0
  241. package/vanilla/UiStack.js +32 -0
  242. package/vanilla/UiSwitch.d.ts +18 -0
  243. package/vanilla/UiSwitch.js +46 -0
  244. package/vanilla/UiSwitcher.d.ts +16 -0
  245. package/vanilla/UiSwitcher.js +32 -0
  246. package/vanilla/UiTabs.d.ts +18 -0
  247. package/vanilla/UiTabs.js +47 -0
  248. package/vanilla/UiTextarea.d.ts +19 -0
  249. package/vanilla/UiTextarea.js +40 -0
  250. package/vanilla/UiToastRegion.d.ts +20 -0
  251. package/vanilla/UiToastRegion.js +58 -0
  252. package/vanilla/UiTooltip.d.ts +21 -0
  253. package/vanilla/UiTooltip.js +34 -0
  254. package/vanilla/UiTopBar.d.ts +13 -0
  255. package/vanilla/UiTopBar.js +59 -0
  256. package/vanilla/UiTree.d.ts +18 -0
  257. package/vanilla/UiTree.js +31 -0
  258. package/vanilla/UiTreeItem.d.ts +26 -0
  259. package/vanilla/UiTreeItem.js +164 -0
  260. package/vanilla/index.js +48 -0
  261. package/vue/UiAffordanceScope.d.ts +18 -0
  262. package/vue/UiAffordanceScope.js +2 -0
  263. package/vue/UiAffordanceScope.vue +118 -0
  264. package/vue/UiAvatar.d.ts +23 -0
  265. package/vue/UiAvatar.js +2 -0
  266. package/vue/UiAvatar.vue +152 -0
  267. package/vue/UiAvatarGroup.d.ts +20 -0
  268. package/vue/UiAvatarGroup.js +2 -0
  269. package/vue/UiAvatarGroup.vue +167 -0
  270. package/vue/UiBadge.d.ts +20 -0
  271. package/vue/UiBadge.js +2 -0
  272. package/vue/UiBadge.vue +123 -0
  273. package/vue/UiButton.d.ts +22 -0
  274. package/vue/UiButton.js +2 -0
  275. package/vue/UiButton.vue +229 -0
  276. package/vue/UiCallout.d.ts +18 -0
  277. package/vue/UiCallout.js +2 -0
  278. package/vue/UiCallout.vue +104 -0
  279. package/vue/UiCheckbox.d.ts +38 -0
  280. package/vue/UiCheckbox.js +2 -0
  281. package/vue/UiCheckbox.vue +216 -0
  282. package/vue/UiCluster.d.ts +17 -0
  283. package/vue/UiCluster.js +2 -0
  284. package/vue/UiCluster.vue +75 -0
  285. package/vue/UiCombobox.d.ts +255 -0
  286. package/vue/UiCombobox.js +2 -0
  287. package/vue/UiCombobox.vue +466 -0
  288. package/vue/UiContainer.d.ts +17 -0
  289. package/vue/UiContainer.js +2 -0
  290. package/vue/UiContainer.vue +65 -0
  291. package/vue/UiContextMenu.d.ts +50 -0
  292. package/vue/UiContextMenu.js +2 -0
  293. package/vue/UiContextMenu.vue +166 -0
  294. package/vue/UiDialog.d.ts +39 -0
  295. package/vue/UiDialog.js +2 -0
  296. package/vue/UiDialog.vue +273 -0
  297. package/vue/UiDisclosure.d.ts +44 -0
  298. package/vue/UiDisclosure.js +2 -0
  299. package/vue/UiDisclosure.vue +211 -0
  300. package/vue/UiEditable.d.ts +48 -0
  301. package/vue/UiEditable.js +2 -0
  302. package/vue/UiEditable.vue +267 -0
  303. package/vue/UiEditorInsertTableGrid.d.ts +26 -0
  304. package/vue/UiEditorInsertTableGrid.js +2 -0
  305. package/vue/UiEditorInsertTableGrid.vue +210 -0
  306. package/vue/UiEditorMentionMenu.d.ts +44 -0
  307. package/vue/UiEditorMentionMenu.js +2 -0
  308. package/vue/UiEditorMentionMenu.vue +284 -0
  309. package/vue/UiEditorSlashMenu.d.ts +41 -0
  310. package/vue/UiEditorSlashMenu.js +2 -0
  311. package/vue/UiEditorSlashMenu.vue +306 -0
  312. package/vue/UiEditorTableContextMenu.d.ts +19 -0
  313. package/vue/UiEditorTableContextMenu.js +2 -0
  314. package/vue/UiEditorTableContextMenu.vue +252 -0
  315. package/vue/UiEditorTableOverlay.d.ts +66 -0
  316. package/vue/UiEditorTableOverlay.js +2 -0
  317. package/vue/UiEditorTableOverlay.vue +455 -0
  318. package/vue/UiEditorTableToolbar.d.ts +21 -0
  319. package/vue/UiEditorTableToolbar.js +2 -0
  320. package/vue/UiEditorTableToolbar.vue +339 -0
  321. package/vue/UiEditorToolbar.d.ts +18 -0
  322. package/vue/UiEditorToolbar.js +2 -0
  323. package/vue/UiEditorToolbar.vue +138 -0
  324. package/vue/UiFloatingActionButton.d.ts +22 -0
  325. package/vue/UiFloatingActionButton.js +2 -0
  326. package/vue/UiFloatingActionButton.vue +116 -0
  327. package/vue/UiFormField.d.ts +28 -0
  328. package/vue/UiFormField.js +2 -0
  329. package/vue/UiFormField.vue +124 -0
  330. package/vue/UiGrid.d.ts +17 -0
  331. package/vue/UiGrid.js +2 -0
  332. package/vue/UiGrid.vue +72 -0
  333. package/vue/UiIcon.d.ts +8 -0
  334. package/vue/UiIcon.js +2 -0
  335. package/vue/UiIcon.vue +135 -0
  336. package/vue/UiIconButton.d.ts +27 -0
  337. package/vue/UiIconButton.js +2 -0
  338. package/vue/UiIconButton.vue +268 -0
  339. package/vue/UiInput.d.ts +20 -0
  340. package/vue/UiInput.js +2 -0
  341. package/vue/UiInput.vue +177 -0
  342. package/vue/UiMenu.d.ts +52 -0
  343. package/vue/UiMenu.js +2 -0
  344. package/vue/UiMenu.vue +194 -0
  345. package/vue/UiMenuItem.d.ts +20 -0
  346. package/vue/UiMenuItem.js +2 -0
  347. package/vue/UiMenuItem.vue +55 -0
  348. package/vue/UiPopover.d.ts +44 -0
  349. package/vue/UiPopover.js +2 -0
  350. package/vue/UiPopover.vue +188 -0
  351. package/vue/UiRadio.d.ts +38 -0
  352. package/vue/UiRadio.js +2 -0
  353. package/vue/UiRadio.vue +166 -0
  354. package/vue/UiRadioGroup.d.ts +50 -0
  355. package/vue/UiRadioGroup.js +2 -0
  356. package/vue/UiRadioGroup.vue +161 -0
  357. package/vue/UiReel.d.ts +18 -0
  358. package/vue/UiReel.js +2 -0
  359. package/vue/UiReel.vue +93 -0
  360. package/vue/UiSearchResultRow.d.ts +28 -0
  361. package/vue/UiSearchResultRow.js +2 -0
  362. package/vue/UiSearchResultRow.vue +124 -0
  363. package/vue/UiSearchShell.d.ts +42 -0
  364. package/vue/UiSearchShell.js +2 -0
  365. package/vue/UiSearchShell.vue +233 -0
  366. package/vue/UiSelect.d.ts +30 -0
  367. package/vue/UiSelect.js +2 -0
  368. package/vue/UiSelect.vue +183 -0
  369. package/vue/UiSeparator.d.ts +8 -0
  370. package/vue/UiSeparator.js +2 -0
  371. package/vue/UiSeparator.vue +38 -0
  372. package/vue/UiSidebar.d.ts +54 -0
  373. package/vue/UiSidebar.js +2 -0
  374. package/vue/UiSidebar.vue +288 -0
  375. package/vue/UiStack.d.ts +18 -0
  376. package/vue/UiStack.js +2 -0
  377. package/vue/UiStack.vue +85 -0
  378. package/vue/UiSwitch.d.ts +36 -0
  379. package/vue/UiSwitch.js +2 -0
  380. package/vue/UiSwitch.vue +203 -0
  381. package/vue/UiSwitcher.d.ts +18 -0
  382. package/vue/UiSwitcher.js +2 -0
  383. package/vue/UiSwitcher.vue +91 -0
  384. package/vue/UiTabs.d.ts +36 -0
  385. package/vue/UiTabs.js +2 -0
  386. package/vue/UiTabs.vue +269 -0
  387. package/vue/UiTextarea.d.ts +22 -0
  388. package/vue/UiTextarea.js +2 -0
  389. package/vue/UiTextarea.vue +177 -0
  390. package/vue/UiToastRegion.d.ts +48 -0
  391. package/vue/UiToastRegion.js +2 -0
  392. package/vue/UiToastRegion.vue +256 -0
  393. package/vue/UiTooltip.d.ts +50 -0
  394. package/vue/UiTooltip.js +2 -0
  395. package/vue/UiTooltip.vue +230 -0
  396. package/vue/UiTopBar.d.ts +19 -0
  397. package/vue/UiTopBar.js +2 -0
  398. package/vue/UiTopBar.vue +56 -0
  399. package/vue/UiTree.d.ts +62 -0
  400. package/vue/UiTree.js +2 -0
  401. package/vue/UiTree.vue +117 -0
  402. package/vue/UiTreeItem.d.ts +56 -0
  403. package/vue/UiTreeItem.js +2 -0
  404. package/vue/UiTreeItem.vue +418 -0
  405. package/vue/chunks/UiAffordanceScope.js +112 -0
  406. package/vue/chunks/UiAvatar.js +144 -0
  407. package/vue/chunks/UiAvatarGroup.js +142 -0
  408. package/vue/chunks/UiBadge.js +33 -0
  409. package/vue/chunks/UiButton.js +47 -0
  410. package/vue/chunks/UiCallout.js +117 -0
  411. package/vue/chunks/UiCheckbox.js +167 -0
  412. package/vue/chunks/UiCluster.js +33 -0
  413. package/vue/chunks/UiCombobox.js +684 -0
  414. package/vue/chunks/UiContainer.js +33 -0
  415. package/vue/chunks/UiContextMenu.js +153 -0
  416. package/vue/chunks/UiDialog.js +162 -0
  417. package/vue/chunks/UiDisclosure.js +185 -0
  418. package/vue/chunks/UiEditable.js +223 -0
  419. package/vue/chunks/UiEditorInsertTableGrid.js +221 -0
  420. package/vue/chunks/UiEditorMentionMenu.js +245 -0
  421. package/vue/chunks/UiEditorSlashMenu.js +210 -0
  422. package/vue/chunks/UiEditorTableContextMenu.js +201 -0
  423. package/vue/chunks/UiEditorTableOverlay.js +301 -0
  424. package/vue/chunks/UiEditorTableToolbar.js +299 -0
  425. package/vue/chunks/UiEditorToolbar.js +37 -0
  426. package/vue/chunks/UiFloatingActionButton.js +56 -0
  427. package/vue/chunks/UiFormField.js +113 -0
  428. package/vue/chunks/UiGrid.js +33 -0
  429. package/vue/chunks/UiIcon.js +170 -0
  430. package/vue/chunks/UiIconButton.js +141 -0
  431. package/vue/chunks/UiInput.js +136 -0
  432. package/vue/chunks/UiMenu.js +163 -0
  433. package/vue/chunks/UiMenuItem.js +37 -0
  434. package/vue/chunks/UiPopover.js +149 -0
  435. package/vue/chunks/UiRadio.js +164 -0
  436. package/vue/chunks/UiRadioGroup.js +160 -0
  437. package/vue/chunks/UiReel.js +42 -0
  438. package/vue/chunks/UiSearchResultRow.js +63 -0
  439. package/vue/chunks/UiSearchShell.js +152 -0
  440. package/vue/chunks/UiSelect.js +134 -0
  441. package/vue/chunks/UiSeparator.js +24 -0
  442. package/vue/chunks/UiSidebar.js +180 -0
  443. package/vue/chunks/UiStack.js +38 -0
  444. package/vue/chunks/UiSwitch.js +162 -0
  445. package/vue/chunks/UiSwitcher.js +38 -0
  446. package/vue/chunks/UiTabs.js +210 -0
  447. package/vue/chunks/UiTextarea.js +139 -0
  448. package/vue/chunks/UiToastRegion.js +227 -0
  449. package/vue/chunks/UiTooltip.js +163 -0
  450. package/vue/chunks/UiTopBar.js +25 -0
  451. package/vue/chunks/UiTree.js +140 -0
  452. package/vue/chunks/UiTreeItem.js +315 -0
  453. package/vue/chunks/_plugin-vue_export-helper.js +8 -0
  454. package/vue/components.css +4405 -0
  455. package/vue/editor/LoomaEditor.d.ts +171 -0
  456. package/vue/editor/image-delivery.d.ts +61 -0
  457. package/vue/editor/index.d.ts +4 -386
  458. package/vue/editor/index.js +995 -1134
  459. package/vue/editor/primitives.d.ts +23 -0
  460. package/vue/index.d.ts +48 -604
  461. package/vue/index.js +49 -86
  462. package/dist/chunk-MLKGABMK.js +0 -9
  463. package/dist/chunk-RWLYVQY6.js +0 -5719
  464. package/dist/chunk-XDNZIKNI.js +0 -2721
  465. package/dist/declarative-generated.cjs +0 -149
  466. package/dist/declarative-generated.d.cts +0 -16
  467. package/dist/declarative-generated.d.ts +0 -16
  468. package/dist/declarative-generated.js +0 -124
  469. package/dist/declarative.cjs +0 -2750
  470. package/dist/declarative.d.cts +0 -101
  471. package/dist/declarative.d.ts +0 -101
  472. package/dist/declarative.js +0 -15
  473. package/dist/index.cjs +0 -9077
  474. package/dist/index.d.cts +0 -414
  475. package/dist/loader.cjs +0 -8442
  476. package/dist/loader.d.cts +0 -4
  477. package/dist/loader.d.ts +0 -4
  478. package/dist/loader.js +0 -16
  479. package/editor/chunk-EUIH3TBV.js +0 -6826
  480. package/editor/chunk-JK53ENSG.js +0 -29
  481. package/editor/chunk-U36XNFJN.js +0 -2592
  482. package/editor/table-overlay-DZFGHQDt.d.ts +0 -138
  483. package/editor.css +0 -1592
  484. package/layout/index.cjs +0 -356
  485. package/layout/index.d.cts +0 -18
  486. package/layout/index.d.ts +0 -18
  487. package/layout/index.js +0 -341
  488. package/layout.css +0 -191
  489. package/styles.css +0 -940
  490. package/vue/chunk-OX3EACZ7.js +0 -4369
@@ -1,2750 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
-
19
- // src/declarative.ts
20
- var declarative_exports = {};
21
- __export(declarative_exports, {
22
- attachLoomaComponent: () => attachLoomaComponent,
23
- controllerFor: () => controllerFor,
24
- manageComponentLifecycle: () => manageComponentLifecycle2,
25
- registerLoomaPackage: () => registerLoomaPackage,
26
- updateComponentProps: () => updateComponentProps2
27
- });
28
- module.exports = __toCommonJS(declarative_exports);
29
-
30
- // src/declarative/runtime.js
31
- var HtmlRuntime = (() => {
32
- var Me = Object.defineProperty;
33
- var ln = Object.getOwnPropertyDescriptor;
34
- var un = Object.getOwnPropertyNames;
35
- var fn = Object.prototype.hasOwnProperty;
36
- var pn = (e, t) => {
37
- for (var n in t) Me(e, n, { get: t[n], enumerable: true });
38
- }, mn = (e, t, n, r) => {
39
- if (t && typeof t == "object" || typeof t == "function") for (let i of un(t)) !fn.call(e, i) && i !== n && Me(e, i, { get: () => t[i], enumerable: !(r = ln(t, i)) || r.enumerable });
40
- return e;
41
- };
42
- var hn = (e) => mn(Me({}, "__esModule", { value: true }), e);
43
- var Ur = {};
44
- pn(Ur, { attachComponent: () => ot, attachRegisteredComponent: () => _r, getComponentHost: () => at, inspectInstance: () => Pr, installComponentGraph: () => lr, lowerDocument: () => Or, manageComponentLifecycle: () => Vr, observeDocument: () => qr, registerComponentDefinitions: () => zr, serializeRenderedForm: () => Dr, setControllerModule: () => dn, updateComponentProps: () => cn });
45
- var De = class extends Error {
46
- diagnostic;
47
- constructor(t) {
48
- let n = t.source ? `${t.source}: ` : "";
49
- super(`${n}${t.code}: ${t.message}`), this.name = "HtmlDiagnosticError", this.diagnostic = Object.freeze({ ...t });
50
- }
51
- };
52
- function y(e, t, n) {
53
- throw new De(n === void 0 ? { code: e, message: t } : { code: e, message: t, source: n });
54
- }
55
- function Q(e) {
56
- if (typeof e != "object" || e === null || Object.isFrozen(e)) return e;
57
- for (let t of Object.values(e)) Q(t);
58
- return Object.freeze(e);
59
- }
60
- function lt(e) {
61
- let t = "", n = true;
62
- for (let r of e) r === "-" ? n = true : (t += n ? r.toUpperCase() : r, n = false);
63
- return t;
64
- }
65
- function Y(e) {
66
- return e.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
67
- }
68
- var yn = /* @__PURE__ */ new Set(["string", "boolean", "number", "integer", "null", "absent", "trusted-html", "trusted-script", "function", "unknown"]), ye = class extends SyntaxError {
69
- constructor(n, r) {
70
- super(`${n} at character ${r + 1}.`);
71
- this.position = r;
72
- this.name = "TypeSyntaxError";
73
- }
74
- position;
75
- }, je = class {
76
- constructor(t) {
77
- this.source = t;
78
- }
79
- source;
80
- #e = 0;
81
- parse() {
82
- let t = this.#n();
83
- return this.#d(), this.#e !== this.source.length && this.#l("Unexpected type syntax"), t;
84
- }
85
- #n() {
86
- let t = [this.#t()];
87
- for (; this.#s("|"); ) t.push(this.#t());
88
- return t.length === 1 ? t[0] : Le(t);
89
- }
90
- #t() {
91
- let t = this.#i();
92
- for (; this.#s("?"); ) t = Le([t, { kind: "terminal", name: "null" }, { kind: "terminal", name: "absent" }]);
93
- return t;
94
- }
95
- #i() {
96
- if (this.#s("(")) {
97
- let r = this.#n();
98
- return this.#a(")"), r;
99
- }
100
- let t = this.#c();
101
- if (t !== void 0) return { kind: "keyword", value: t };
102
- let n = this.#r();
103
- if (n === void 0 && this.#l("Expected a type, keyword, or group"), n === "list" || n === "record") {
104
- this.#a("(");
105
- let r = this.#n();
106
- return this.#a(")"), n === "list" ? { kind: "list", item: r } : { kind: "record", value: r };
107
- }
108
- return n === "object" ? this.#o() : yn.has(n) ? { kind: "terminal", name: n } : { kind: "keyword", value: n };
109
- }
110
- #o() {
111
- this.#a("("), this.#a("{");
112
- let t = [], n = false;
113
- for (; !this.#s("}"); ) {
114
- if (this.#d(), this.source.startsWith("...", this.#e)) this.#e += 3, n = true;
115
- else {
116
- let r = this.#c() ?? this.#r();
117
- r === void 0 && this.#l("Expected an object field or `...`");
118
- let i = this.#s("?");
119
- this.#a(":");
120
- let o = this.#n();
121
- t.some((a) => a.name === r) && this.#l(`Duplicate object field \`${r}\``), t.push({ name: r, type: o, optional: i });
122
- }
123
- if (this.#s("}")) break;
124
- this.#a(","), n && (this.#d(), this.source.startsWith("}", this.#e) || this.#l("The open marker must be last"));
125
- }
126
- return this.#a(")"), { kind: "object", fields: t, open: n };
127
- }
128
- #r() {
129
- this.#d();
130
- let t = /^[A-Za-z_][A-Za-z0-9_-]*/.exec(this.source.slice(this.#e));
131
- if (t !== null) return this.#e += t[0].length, t[0];
132
- }
133
- #c() {
134
- this.#d();
135
- let t = this.source[this.#e];
136
- if (t !== '"' && t !== "'") return;
137
- this.#e += 1;
138
- let n = "";
139
- for (; this.#e < this.source.length; ) {
140
- let r = this.source[this.#e++];
141
- if (r === t) return n;
142
- if (r !== "\\") {
143
- n += r;
144
- continue;
145
- }
146
- this.#e >= this.source.length && this.#l("Unterminated escape");
147
- let i = this.source[this.#e++];
148
- n += { n: `
149
- `, r: "\r", t: " ", "\\": "\\", '"': '"', "'": "'" }[i] ?? i;
150
- }
151
- this.#l("Unterminated quoted keyword");
152
- }
153
- #s(t) {
154
- return this.#d(), this.source.startsWith(t, this.#e) ? (this.#e += t.length, true) : false;
155
- }
156
- #a(t) {
157
- this.#s(t) || this.#l(`Expected \`${t}\``);
158
- }
159
- #d() {
160
- for (; /\s/.test(this.source[this.#e] ?? ""); ) this.#e += 1;
161
- }
162
- #l(t) {
163
- throw new ye(t, this.#e);
164
- }
165
- };
166
- function Le(e) {
167
- let t = e.flatMap((i) => i.kind === "union" ? i.members : [i]), n = new Map(t.map((i) => [W(i), i])), r = Array.from(n.values());
168
- return r.length === 1 ? r[0] : { kind: "union", members: r };
169
- }
170
- function ge(e) {
171
- if (e.trim() === "") throw new ye("A type expression cannot be empty", 0);
172
- return Q(new je(e).parse());
173
- }
174
- function Oe(e) {
175
- return typeof e == "object" && e !== null && "kind" in e && ["terminal", "keyword", "union", "list", "record", "object"].includes(String(e.kind));
176
- }
177
- function be(e) {
178
- return Oe(e) ? e : typeof e == "string" ? { kind: "terminal", name: e } : Le(e.enum.map((t) => ({ kind: "keyword", value: t })));
179
- }
180
- function W(e) {
181
- let t = Oe(e) ? e : be(e);
182
- switch (t.kind) {
183
- case "terminal":
184
- return t.name;
185
- case "keyword":
186
- return /^[A-Za-z_][A-Za-z0-9_-]*$/.test(t.value) ? t.value : JSON.stringify(t.value);
187
- case "union":
188
- return t.members.map((n) => W(n)).join(" | ");
189
- case "list":
190
- return `list(${W(t.item)})`;
191
- case "record":
192
- return `record(${W(t.value)})`;
193
- case "object":
194
- return `object({ ${[...t.fields.map((n) => `${n.name}${n.optional ? "?" : ""}: ${W(n.type)}`), ...t.open ? ["..."] : []].join(", ")} })`;
195
- }
196
- }
197
- function P(e, t, n) {
198
- return { ok: false, issues: [{ reason: e, message: t, path: n }] };
199
- }
200
- function X(e, t) {
201
- return typeof t == "number" ? `${e}[${t}]` : /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t) ? `${e}.${t}` : `${e}[${JSON.stringify(t)}]`;
202
- }
203
- function ut(e) {
204
- if (typeof e != "object" || e === null || Array.isArray(e)) return false;
205
- let t = Object.getPrototypeOf(e);
206
- return t === Object.prototype || t === null;
207
- }
208
- function Pe(e) {
209
- if (typeof e != "string") return e;
210
- try {
211
- return JSON.parse(e);
212
- } catch {
213
- return /* @__PURE__ */ Symbol.for("html-next.bad-json");
214
- }
215
- }
216
- function gn(e, t) {
217
- if (typeof e != "object" || e === null) return false;
218
- if (e.kind === t && "value" in e) return true;
219
- let n = t === "trusted-html" ? "TrustedHTML" : "TrustedScript";
220
- return e.constructor?.name === n || Object.prototype.toString.call(e) === `[object ${n}]`;
221
- }
222
- function bn(e, t, n) {
223
- switch (t) {
224
- case "string":
225
- return typeof e == "string" ? { ok: true, value: e } : P("typeMismatch", "Must be a string.", n);
226
- case "boolean":
227
- return typeof e == "boolean" ? { ok: true, value: e } : e === "" || e === "true" ? { ok: true, value: true } : e === "false" ? { ok: true, value: false } : P("typeMismatch", "Must be true or false.", n);
228
- case "number":
229
- case "integer": {
230
- let r = typeof e == "number" ? e : typeof e == "string" && e.trim() !== "" ? Number(e) : Number.NaN;
231
- return Number.isFinite(r) ? t === "integer" && !Number.isInteger(r) ? P("typeMismatch", "Must be an integer.", n) : { ok: true, value: r } : P("badInput", `Must be ${t === "integer" ? "an integer" : "a finite number"}.`, n);
232
- }
233
- case "null":
234
- return e === null ? { ok: true, value: null } : P("typeMismatch", "Must be null.", n);
235
- case "absent":
236
- return e === void 0 ? { ok: true, value: void 0 } : P("typeMismatch", "Must be absent.", n);
237
- case "trusted-html":
238
- case "trusted-script":
239
- return gn(e, t) ? { ok: true, value: e } : P("untrustedValue", `Must be a ${t === "trusted-html" ? "TrustedHTML" : "TrustedScript"} value.`, n);
240
- case "function":
241
- return typeof e == "function" ? { ok: true, value: e } : P("typeMismatch", "Must be a function supplied through a property.", n);
242
- case "unknown":
243
- return { ok: true, value: e };
244
- }
245
- }
246
- function ee(e, t, n) {
247
- switch (t.kind) {
248
- case "terminal":
249
- return bn(e, t.name, n);
250
- case "keyword":
251
- return e === t.value ? { ok: true, value: e } : P("typeMismatch", `Must be ${JSON.stringify(t.value)}.`, n);
252
- case "union": {
253
- for (let r of t.members) {
254
- let i = ee(e, r, n);
255
- if (i.ok) return i;
256
- }
257
- return P("typeMismatch", `Must match ${W(t)}.`, n);
258
- }
259
- case "list": {
260
- let r = Pe(e);
261
- if (!Array.isArray(r)) return P("typeMismatch", "Must be a list.", n);
262
- let i = [], o = [];
263
- return r.forEach((a, s) => {
264
- let c = ee(a, t.item, X(n, s));
265
- c.ok ? i.push(c.value) : o.push(...c.issues);
266
- }), o.length === 0 ? { ok: true, value: i } : { ok: false, issues: o };
267
- }
268
- case "record": {
269
- let r = Pe(e);
270
- if (!ut(r)) return P("typeMismatch", "Must be a string-keyed record.", n);
271
- let i = {}, o = [];
272
- for (let [a, s] of Object.entries(r)) {
273
- let c = ee(s, t.value, X(n, a));
274
- c.ok ? i[a] = c.value : o.push(...c.issues);
275
- }
276
- return o.length === 0 ? { ok: true, value: i } : { ok: false, issues: o };
277
- }
278
- case "object": {
279
- let r = Pe(e);
280
- if (!ut(r)) return P("typeMismatch", "Must be an object.", n);
281
- let i = {}, o = [], a = new Map(t.fields.map((s) => [s.name, s]));
282
- for (let s of t.fields) {
283
- if (!(s.name in r)) {
284
- s.optional || o.push({ reason: "typeMismatch", message: "Required field is absent.", path: X(n, s.name) });
285
- continue;
286
- }
287
- let c = ee(r[s.name], s.type, X(n, s.name));
288
- c.ok ? i[s.name] = c.value : o.push(...c.issues);
289
- }
290
- for (let [s, c] of Object.entries(r)) a.has(s) || (t.open ? i[s] = c : o.push({ reason: "typeMismatch", message: "Field is not declared by this closed object type.", path: X(n, s) }));
291
- return o.length === 0 ? { ok: true, value: i } : { ok: false, issues: o };
292
- }
293
- }
294
- }
295
- function B(e, t, n = "$") {
296
- return ee(e, be(t), n);
297
- }
298
- function te(e, t) {
299
- let n = B(e, t);
300
- if (!n.ok) throw new TypeError(n.issues.map((i) => `${i.path}: ${i.message}`).join("; "));
301
- let r = be(t);
302
- if (r.kind === "terminal" && (r.name === "function" || r.name === "unknown")) throw new TypeError(`The ${r.name} type is property-only and cannot be serialized.`);
303
- return r.kind === "list" || r.kind === "record" || r.kind === "object" || r.kind === "union" && typeof n.value == "object" && n.value !== null ? JSON.stringify(n.value) : n.value === null ? "null" : n.value === void 0 ? "" : String(n.value);
304
- }
305
- function F(e) {
306
- let t = be(e);
307
- return t.kind === "terminal" ? !["function", "unknown", "trusted-html", "trusted-script"].includes(t.name) : t.kind === "keyword" ? true : t.kind === "union" ? t.members.every(F) : t.kind === "list" ? F(t.item) : t.kind === "record" ? F(t.value) : t.fields.every((n) => F(n.type));
308
- }
309
- function ft(e) {
310
- let t;
311
- try {
312
- t = ge(e);
313
- } catch (n) {
314
- y("HC013", n instanceof Error ? n.message : "Invalid prop type expression.");
315
- }
316
- return t.kind === "terminal" && (t.name === "string" || t.name === "boolean" || t.name === "number") ? t.name : t.kind === "keyword" ? { enum: [t.value] } : t.kind === "union" && t.members.every((n) => n.kind === "keyword") ? { enum: t.members.map((n) => n.value) } : t;
317
- }
318
- var T = /* @__PURE__ */ Symbol("absent"), re = class extends Error {
319
- constructor(n) {
320
- super(`\`${n}\` is not declared in scope.`);
321
- this.identifier = n;
322
- this.name = "UndeclaredName";
323
- }
324
- identifier;
325
- }, Ie = /\s*(?:(<=|>=|!=|\^=|\$=|\*=)|(\d+(?:\.\d*)?|\.\d+)|("(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*')|([A-Za-z_$][A-Za-z0-9_$]*)|([=<>+*/%(),.:{}[\]-])|$)/y, vn = /\\([\s\S])/g, kn = /%s/g, wn = { or: 1, and: 2, "=": 3, "!=": 3, "^=": 3, "$=": 3, "*=": 3, "<": 4, "<=": 4, ">": 4, ">=": 4, "+": 5, "-": 5, "*": 6, "/": 6, "%": 6 };
326
- function pt(e) {
327
- return wn[e] ?? 0;
328
- }
329
- function xn(e) {
330
- return e === "round" || e === "clamp" || e === "min" || e === "max" || e === "abs" || e === "format";
331
- }
332
- function En(e) {
333
- let t = 0, n = 0, r = "";
334
- function i() {
335
- Ie.lastIndex = t;
336
- let l = Ie.exec(e);
337
- if (l === null) {
338
- let m = e.slice(t).trimStart()[0];
339
- throw m === '"' || m === "'" ? new SyntaxError("Unterminated string literal.") : new SyntaxError(`Unexpected character \`${m}\`.`);
340
- }
341
- t = Ie.lastIndex, l[1] !== void 0 || l[5] !== void 0 ? (n = 4, r = l[1] ?? l[5]) : l[2] !== void 0 ? (n = 1, r = Number(l[2])) : l[3] !== void 0 ? (n = 2, r = l[3].slice(1, -1).replace(vn, "$1")) : l[4] !== void 0 ? (n = 3, r = l[4]) : (n = 0, r = "");
342
- }
343
- function o(l) {
344
- return r !== l ? false : (i(), true);
345
- }
346
- function a(l) {
347
- if (!o(l)) throw new SyntaxError(`Expected \`${l}\`.`);
348
- }
349
- function s(l) {
350
- let m = c(), f = pt(r);
351
- for (; f >= l; ) {
352
- let h = r;
353
- i(), m = { kind: "binary", op: h, left: m, right: s(f + 1) }, f = pt(r);
354
- }
355
- return m;
356
- }
357
- function c() {
358
- if (n === 3 && r === "not") return i(), { kind: "unary", op: "not", operand: c() };
359
- if (o("-")) return { kind: "unary", op: "-", operand: c() };
360
- let l = d();
361
- for (; n === 4; ) if (o(".")) {
362
- if (n !== 3) throw new SyntaxError("Expected a property name after `.`.");
363
- let m = r;
364
- i(), l = { kind: "member", object: l, key: m };
365
- } else if (o("[")) {
366
- let m = s(1);
367
- a("]"), l = { kind: "index", object: l, index: m };
368
- } else break;
369
- return l;
370
- }
371
- function d() {
372
- let l = n, m = r;
373
- if (l === 1 || l === 2) return i(), { kind: "literal", value: m };
374
- if (l === 4 && m === "(") {
375
- i();
376
- let f = s(1);
377
- return a(")"), f;
378
- }
379
- if (l === 4 && m === "{") {
380
- i();
381
- let f = [];
382
- if (!o("}")) {
383
- do {
384
- if (r === "}") break;
385
- if (n !== 3 && n !== 2) throw new SyntaxError("Object keys must be identifiers or strings.");
386
- let h = r;
387
- i(), a(":"), f.push({ key: h, value: s(1) });
388
- } while (o(","));
389
- a("}");
390
- }
391
- return { kind: "object", pairs: f };
392
- }
393
- if (l === 4 && m === "[") {
394
- i();
395
- let f = [];
396
- if (!o("]")) {
397
- do {
398
- if (r === "]") break;
399
- f.push(s(1));
400
- } while (o(","));
401
- a("]");
402
- }
403
- return { kind: "array", items: f };
404
- }
405
- if (l === 3) {
406
- let f = m;
407
- if (i(), f === "true") return { kind: "literal", value: true };
408
- if (f === "false") return { kind: "literal", value: false };
409
- if (f === "null") return { kind: "literal", value: null };
410
- if (r === "(" && xn(f)) {
411
- i();
412
- let h = [];
413
- if (!o(")")) {
414
- do
415
- h.push(s(1));
416
- while (o(","));
417
- a(")");
418
- }
419
- return { kind: "call", fn: f, args: h };
420
- }
421
- return { kind: "id", name: f };
422
- }
423
- throw new SyntaxError("Unexpected end of expression.");
424
- }
425
- i();
426
- let u = s(1);
427
- if (n !== 0) throw new SyntaxError("Unexpected trailing input in expression.");
428
- return u;
429
- }
430
- function ne(e) {
431
- return e === T || e === null;
432
- }
433
- function j(e) {
434
- if (e === T || e === null || e === false) return false;
435
- if (e === true) return true;
436
- if (typeof e == "string") return e.length > 0;
437
- if (typeof e == "number") return e !== 0 && e === e;
438
- if (Array.isArray(e)) return e.length > 0;
439
- for (let t in e) if (Object.hasOwn(e, t)) return true;
440
- return false;
441
- }
442
- function ve(e) {
443
- return typeof e == "number" && e === e ? e : T;
444
- }
445
- function A(e, t) {
446
- switch (e.kind) {
447
- case "literal":
448
- return e.value;
449
- case "id": {
450
- let n = t.get(e.name);
451
- if (n === void 0) throw new re(e.name);
452
- return n;
453
- }
454
- case "member": {
455
- let n = A(e.object, t);
456
- if (ne(n) || typeof n != "object" || Array.isArray(n)) return T;
457
- let r = n[e.key];
458
- return r === void 0 ? T : r;
459
- }
460
- case "index": {
461
- let n = A(e.object, t), r = A(e.index, t);
462
- if (ne(n) || ne(r)) return T;
463
- if (Array.isArray(n) && typeof r == "number") {
464
- let i = n[r];
465
- return i === void 0 ? T : i;
466
- }
467
- if (typeof n == "object" && typeof r == "string") {
468
- let i = n[r];
469
- return i === void 0 ? T : i;
470
- }
471
- return T;
472
- }
473
- case "unary": {
474
- let n = A(e.operand, t);
475
- if (e.op === "not") return !j(n);
476
- let r = ve(n);
477
- return r === T ? T : -r;
478
- }
479
- case "binary":
480
- return Tn(e, t);
481
- case "call":
482
- return Cn(e, t);
483
- case "object": {
484
- let n = {};
485
- for (let r of e.pairs) n[r.key] = A(r.value, t);
486
- return n;
487
- }
488
- case "array": {
489
- let n = [];
490
- for (let r of e.items) n.push(A(r, t));
491
- return n;
492
- }
493
- }
494
- }
495
- function Tn(e, t) {
496
- let { op: n } = e;
497
- if (n === "and") return j(A(e.left, t)) && j(A(e.right, t));
498
- if (n === "or") return j(A(e.left, t)) || j(A(e.right, t));
499
- let r = A(e.left, t), i = A(e.right, t);
500
- if (n === "=") return r === i;
501
- if (n === "!=") return r !== i;
502
- if (n === "^=" || n === "$=" || n === "*=") return typeof r != "string" || typeof i != "string" ? T : n === "^=" ? r.startsWith(i) : n === "$=" ? r.endsWith(i) : r.includes(i);
503
- let o = ve(r), a = ve(i);
504
- if (o === T || a === T) return T;
505
- switch (n) {
506
- case "<":
507
- return o < a;
508
- case "<=":
509
- return o <= a;
510
- case ">":
511
- return o > a;
512
- case ">=":
513
- return o >= a;
514
- case "+":
515
- return o + a;
516
- case "-":
517
- return o - a;
518
- case "*":
519
- return o * a;
520
- case "/":
521
- return o / a;
522
- case "%":
523
- return o % a;
524
- default:
525
- return T;
526
- }
527
- }
528
- function Cn(e, t) {
529
- let { args: n, fn: r } = e, i = [];
530
- for (let a of n) i.push(A(a, t));
531
- if (r === "format") {
532
- let a = i[0];
533
- if (typeof a != "string") return T;
534
- let s = 1;
535
- return a.replace(kn, () => s < i.length ? D(i[s++]) : "%s");
536
- }
537
- for (let a = 0; a < i.length; a += 1) {
538
- let s = ve(i[a]);
539
- if (s === T) return T;
540
- i[a] = s;
541
- }
542
- let o = i;
543
- switch (r) {
544
- case "abs":
545
- return o.length === 1 ? Math.abs(o[0]) : T;
546
- case "round":
547
- return o.length === 1 ? Math.round(o[0]) : T;
548
- case "min":
549
- return o.length > 0 ? Math.min(...o) : T;
550
- case "max":
551
- return o.length > 0 ? Math.max(...o) : T;
552
- case "clamp":
553
- return o.length === 3 ? Math.min(Math.max(o[0], o[1]), o[2]) : T;
554
- default:
555
- return T;
556
- }
557
- }
558
- var mt = /* @__PURE__ */ new Map();
559
- function Ve(e) {
560
- if (e.kind === "id") return e.name;
561
- if (e.kind === "member") {
562
- let t = Ve(e.object);
563
- return t === void 0 ? void 0 : `${t}.${e.key}`;
564
- }
565
- if (e.kind === "index" && e.index.kind === "literal") {
566
- let t = e.index.value;
567
- if (typeof t != "string" && typeof t != "number") return;
568
- let n = Ve(e.object);
569
- return n === void 0 ? void 0 : `${n}.${t}`;
570
- }
571
- }
572
- function I(e, t) {
573
- let n = Ve(e);
574
- if (n !== void 0) {
575
- t.includes(n) || t.push(n);
576
- return;
577
- }
578
- switch (e.kind) {
579
- case "literal":
580
- return;
581
- case "id":
582
- return;
583
- case "member":
584
- I(e.object, t);
585
- return;
586
- case "index":
587
- I(e.object, t), I(e.index, t);
588
- return;
589
- case "unary":
590
- I(e.operand, t);
591
- return;
592
- case "binary":
593
- I(e.left, t), I(e.right, t);
594
- return;
595
- case "call":
596
- for (let r of e.args) I(r, t);
597
- return;
598
- case "object":
599
- for (let r of e.pairs) I(r.value, t);
600
- return;
601
- case "array":
602
- for (let r of e.items) I(r, t);
603
- }
604
- }
605
- function ze(e, t) {
606
- if (e.kind === "id") return t.push(e.name), true;
607
- if (e.kind === "member") return ze(e.object, t) ? (t.push(e.key), true) : false;
608
- if (e.kind !== "index" || !ze(e.object, t)) return false;
609
- let n = e.index, r = n.kind === "literal" ? n.value : void 0;
610
- return t.push(typeof r == "string" || typeof r == "number" ? r : { kind: "index", expression: n }), true;
611
- }
612
- function ke(e) {
613
- let t = mt.get(e);
614
- if (t !== void 0) return t;
615
- let n = En(e), r = [];
616
- return I(n, r), r.sort(), t = { source: e, ast: n, dependencies: r }, mt.set(e, t), t;
617
- }
618
- function _e(e, t) {
619
- let n = [];
620
- if (!(!ze(ke(e).ast, n) || !t.has(n[0]))) return n;
621
- }
622
- function ht(e, t) {
623
- return A(ke(e).ast, t);
624
- }
625
- function V(e, t) {
626
- return A("ast" in e ? e.ast : e, t);
627
- }
628
- function D(e) {
629
- return ne(e) ? "" : Array.isArray(e) ? e.map(D).join(" ") : typeof e == "object" ? "" : String(e);
630
- }
631
- function yt(e) {
632
- return ne(e) || e === false ? null : e === true ? "" : typeof e == "number" || typeof e == "string" ? String(e) : Array.isArray(e) ? e.map(D).join(" ") : null;
633
- }
634
- var Rn = /* @__PURE__ */ new Set(["href", "src", "action", "formaction", "poster", "data", "xlink:href"]), Sn = /* @__PURE__ */ new Set(["base", "embed", "iframe", "link", "meta", "object", "script", "style", "template"]), Nn = /* @__PURE__ */ new Set(["srcdoc", "style"]);
635
- function ie(e) {
636
- let t = e.replace(/[\u0000-\u0020\u007f]+/g, "");
637
- return /^(?:data|javascript|vbscript):/i.test(t);
638
- }
639
- function oe(e) {
640
- return Rn.has(e.toLowerCase());
641
- }
642
- function qe(e, t, n) {
643
- let r = t.createElement("template");
644
- r.innerHTML = e;
645
- for (let i of Array.from(r.content.querySelectorAll("*"))) {
646
- if (n?.(i), Sn.has(i.localName)) {
647
- i.remove();
648
- continue;
649
- }
650
- for (let o of Array.from(i.attributes)) {
651
- let a = o.name.toLowerCase();
652
- (a.startsWith("on") || Nn.has(a) || oe(a) && ie(o.value)) && i.removeAttribute(o.name);
653
- }
654
- }
655
- return r.content;
656
- }
657
- var $n = /^(?:if|else-if|else|for|with|value|state|computed|data)$/, An = /^(?:@|v-|#|on:|use:|transition:|animate:)/, Hn = /^(?:innerhtml|outerhtml|srcdoc)$/, Mn = /^(?:base|embed|link|meta|object|script|style)$/;
658
- function gt(e) {
659
- return $n.test(e);
660
- }
661
- function Ue(e, t) {
662
- return Mn.test(e.toLowerCase()) && y("HT009", `<${e}> is not permitted in rendered component markup.`, t), e;
663
- }
664
- function We(e, t, n = "") {
665
- let r = e.toLowerCase();
666
- return (r.startsWith("on") || An.test(r)) && y("HT010", `Literal attribute \`${e}\` uses target-framework directive syntax that is not supported.`, t), r === "srcdoc" && y("HT007", "Literal `srcdoc` is not permitted in a component definition.", t), oe(r) && ie(n) && y("HT007", `Literal \`${e}\` contains an executable URL.`, t), e;
667
- }
668
- function bt(e, t) {
669
- let n = e.toLowerCase();
670
- return (n.startsWith("on") || Hn.test(n)) && y("HT007", `Dynamic ${e} requires a future trusted-content type.`, t), e;
671
- }
672
- function z(e) {
673
- return "tagName" in e;
674
- }
675
- function se(e) {
676
- return e.nodeName === "#text";
677
- }
678
- function S(e) {
679
- return "localName" in e ? e.localName : e.tagName;
680
- }
681
- function we(e) {
682
- return "attrs" in e ? e.attrs : e.attributes;
683
- }
684
- function _(e) {
685
- return (S(e) === "template" ? e.content : void 0)?.childNodes ?? e.childNodes;
686
- }
687
- function ae(e) {
688
- return "value" in e ? e.value : "nodeValue" in e ? e.nodeValue ?? "" : "";
689
- }
690
- function wt(e) {
691
- let t = [];
692
- for (let n of e) n.nodeName !== "#comment" && (!se(n) || ae(n).trim() !== "") && t.push(n);
693
- return t;
694
- }
695
- function w(e, t) {
696
- return "attrs" in e ? e.attrs.find((n) => n.name === t)?.value : e.getAttribute(t) ?? void 0;
697
- }
698
- function xt(e) {
699
- let t = "";
700
- for (let n of _(e)) se(n) && (t += ae(n));
701
- return t;
702
- }
703
- function Et(e, t) {
704
- let n = [];
705
- for (let r of _(e)) z(r) && S(r) === t && n.push(r);
706
- return n;
707
- }
708
- function Tt(e, t) {
709
- for (let n of _(e)) {
710
- if (!z(n)) continue;
711
- let r = S(n);
712
- r === "link" && y("HL001", "External definition dependencies require the application-owned graph resolver.", t), Ue(r, t);
713
- for (let i of we(n)) /^on(?!:)/i.test(i.name) && We(i.name, t, i.value);
714
- Tt(n, t);
715
- }
716
- }
717
- var Dn = /^\$(?:if|each|where|sort|limit|key|with|match|when|else)$/, vt = /^(?:innerhtml|outerhtml|textcontent|innertext|srcdoc)$/, Pn = /^\s*([A-Za-z_$][\w$]*)\s*(?:,\s*([A-Za-z_$][\w$]*)\s*)?\bof\b\s*(.+)$/, kt = /^\s*(.+?)\s+\bas\b\s+([A-Za-z_$][\w$]*)\s*$/, Fe = /^[a-z][a-z0-9-]*$/, jn = /^(?:prevent|stop|self|once|passive|capture|left|middle|right|ctrl|shift|alt|meta|exact|enter|escape|space|tab|up|down)$/, Ke = /^[A-Za-z_$][A-Za-z0-9_$-]*$/;
718
- function Be(e, ...t) {
719
- let n = new Set(e.roots);
720
- for (let r of t) r !== void 0 && n.add(r);
721
- return { roots: n, writableRoots: e.writableRoots, handlers: e.handlers };
722
- }
723
- function R(e, t, n) {
724
- let r = zn(e, n);
725
- return Ln(r, t, n), r;
726
- }
727
- function Ln(e, t, n) {
728
- for (let r of e.dependencies) {
729
- let i = r.split(".", 1)[0];
730
- t.roots.has(i) || y("HT003", `Expression root \`${i}\` is not declared in this scope.`, n);
731
- }
732
- }
733
- function On(e, t, n) {
734
- let r = /* @__PURE__ */ Object.create(null), i = (a, s) => {
735
- let c = r[a];
736
- c !== void 0 && ("attribute" in c ? !("attribute" in s) || c.attribute !== s.attribute : !("property" in s) || c.property !== s.property) && y("HT004", `Prop \`${a}\` is bound to conflicting targets.`, t), r[a] = s;
737
- }, o = (a) => {
738
- for (let s of we(a)) if (s.name.startsWith(":")) /^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value) && i(s.value, { attribute: s.name.slice(1).toLowerCase() });
739
- else if (s.name.startsWith(".")) {
740
- let c = s.name.slice(1).toLowerCase();
741
- if (/^[A-Za-z][A-Za-z0-9_-]*$/.test(s.value)) {
742
- let d = n.resolveDomProperty(S(a), c) ?? (s.value.toLowerCase() === c ? s.value : c);
743
- i(s.value, { property: d });
744
- }
745
- }
746
- for (let s of _(a)) z(s) && S(s) !== "slot" && o(s);
747
- };
748
- return o(e), r;
749
- }
750
- function In(e, t, n, r = true) {
751
- let i = /* @__PURE__ */ Object.create(null), o = /* @__PURE__ */ Object.create(null);
752
- if (e === void 0) return i;
753
- let a = Et(e, "prop");
754
- a.sort((s, c) => {
755
- let d = w(s, "name") ?? "", u = w(c, "name") ?? "";
756
- return d < u ? -1 : d > u ? 1 : 0;
757
- });
758
- for (let s of a) {
759
- let c = w(s, "name");
760
- (c === void 0 || c === "") && y("HC010", "A <prop> requires a `name` attribute.", n), /^[A-Za-z][A-Za-z0-9_-]*$/.test(c) || y("HC010", `Invalid prop name \`${c}\`.`, n);
761
- let d = w(s, "type");
762
- (d === void 0 || d === "") && y("HC013", `Prop \`${c}\` requires a \`type\` attribute.`, n);
763
- let u = c.toLowerCase(), l = o[u];
764
- l !== void 0 && y("HC011", `Props \`${l}\` and \`${c}\` collide after lowercase normalization.`, n), o[u] = c;
765
- let m = t[c];
766
- m === void 0 && r && y("HC018", `Prop \`${c}\` is declared but never bound in the markup.`, n), m ??= { attribute: c.toLowerCase() };
767
- let f = ft(d), h = w(s, "required") !== void 0, p = xt(s).trim();
768
- p === "" && y("HC003", `\`props.${c}.description\` must be a non-empty string.`, n), F(f) || y("HC017", `Prop \`${c}\` cannot be written as an HTML attribute; function, unknown, and trusted content types have no text form.`, n);
769
- let b = w(s, "default");
770
- h && b !== void 0 && y("HC019", `Required prop \`${c}\` cannot also declare a default.`, n);
771
- let x = { type: f, required: h, target: m, description: p };
772
- if (b !== void 0) {
773
- let E = B(b, f);
774
- E.ok || y("HC015", `Default for prop \`${c}\` does not satisfy its type.`, n), x.default = E.value;
775
- }
776
- i[c] = x;
777
- }
778
- return i;
779
- }
780
- function Vn(e, t, n, r, i, o, a) {
781
- let s = w(e, "component") ?? "";
782
- s.trim() === "" && y("HC003", "`component` must be a non-empty string.", o), /^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(s) || y("HC005", "The `component` tag must be lowercase and contain a hyphen.", o);
783
- let c = w(e, "status") ?? "";
784
- /^(?:early|experimental|stable|deprecated)$/.test(c) || y("HC007", "Component `status` is not recognized.", o);
785
- let d = w(e, "summary") ?? "";
786
- return d.trim() === "" && y("HC003", "`summary` must be a non-empty string.", o), (!/^[a-z][a-z0-9-]*$/.test(n) || r && !/^[a-z][a-z0-9]*(?:-[a-z0-9]+)+$/.test(n)) && y("HC008", "`nativeElement` must be a lowercase HTML element or component tag.", o), { version: 1, name: lt(s), tag: s, status: c, summary: d, nativeElement: n, props: In(t, i, o, a) };
787
- }
788
- function zn(e, t) {
789
- try {
790
- return ke(e);
791
- } catch {
792
- y("HT013", `Malformed expression \`${e}\`.`, t);
793
- }
794
- }
795
- function _n(e, t, n) {
796
- let r = [];
797
- for (let i of wt(_(e))) {
798
- z(i) || y("HC023", "Handler bodies contain declarative step elements only.", n);
799
- let o = w(i, "$if"), a = o === void 0 ? void 0 : R(o, t, n);
800
- if (S(i) === "set") {
801
- let s = w(i, "name") ?? "", c = w(i, ":value"), d = w(i, "value");
802
- (s === "" || c === void 0 == (d === void 0)) && y("HC023", "A <set> requires `name` and exactly one of `value` or `:value`.", n), R(s, t, n);
803
- let u = _e(s, t.writableRoots);
804
- u === void 0 && y("HT005", `Handler write \`${s}\` is not rooted in declared state.`, n);
805
- let l = { kind: "set", path: s, writablePath: u, value: R(c ?? JSON.stringify(d), t, n) };
806
- a !== void 0 && (l.guard = a), r.push(l);
807
- continue;
808
- }
809
- if (S(i) === "dispatch") {
810
- let s = w(i, "event") ?? "";
811
- Fe.test(s) || y("HC023", "A <dispatch> requires a valid `event` name.", n);
812
- let c = w(i, ":value"), d = w(i, "value");
813
- c !== void 0 && d !== void 0 && y("HC023", "A <dispatch> may declare only one of `value` or `:value`.", n);
814
- let u = c === void 0 && d === void 0 ? void 0 : R(c ?? JSON.stringify(d), t, n), l = { kind: "dispatch", event: s };
815
- u !== void 0 && (l.value = u), a !== void 0 && (l.guard = a), r.push(l);
816
- continue;
817
- }
818
- if (S(i) === "validate" || S(i) === "focus") {
819
- let s = w(i, "target") ?? w(i, "ref") ?? w(i, "name") ?? "";
820
- Ke.test(s) || y("HC023", `<${S(i)}> requires a valid target reference.`, n);
821
- let c = { kind: S(i), target: s };
822
- a !== void 0 && (c.guard = a), r.push(c);
823
- continue;
824
- }
825
- y("HC023", `<${S(i)}> is not a recognized handler step.`, n);
826
- }
827
- return r;
828
- }
829
- function qn(e, t, n) {
830
- let r = [], i = new Set(Object.keys(t.props)), o = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set();
831
- if (e === void 0) return { declarations: r, scope: { roots: i, writableRoots: o, handlers: a } };
832
- let s = [], c = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set();
833
- for (let l of _(e)) {
834
- if (!z(l)) continue;
835
- let m = l;
836
- s.push(m);
837
- let f = S(m);
838
- /^(?:prop|state|computed|data|handler|event|method)$/.test(f) || y("HC021", `<${f}> is not a recognized definition declaration.`, n);
839
- let h = w(m, "name") ?? "";
840
- if (h === "" && y("HC010", `A <${f}> requires a \`name\` attribute.`, n), f === "event") {
841
- d.has(h) && y("HC020", `Event \`${h}\` is declared more than once.`, n), d.add(h);
842
- continue;
843
- }
844
- c.has(h) && y("HC020", `Declaration \`${h}\` collides in the flat component scope.`, n), c.add(h), i.add(h), f === "state" ? o.add(h) : f === "handler" && a.add(h);
845
- }
846
- let u = { roots: i, writableRoots: o, handlers: a };
847
- for (let l of s) {
848
- let m = S(l);
849
- if (m === "prop") continue;
850
- let f = w(l, "name");
851
- if (m === "state") {
852
- let h = w(l, ":value"), p = w(l, "value");
853
- h !== void 0 && p !== void 0 && y("HC013", `<state name="${f}"> may declare only one of \`value\` or \`:value\`.`, n);
854
- let b = h === void 0 && p === void 0 ? void 0 : R(h ?? JSON.stringify(p), u, n), x = { kind: m, name: f };
855
- p !== void 0 && (x.value = p), b !== void 0 && (x.expression = b), r.push(x);
856
- continue;
857
- }
858
- if (m === "computed") {
859
- let h = w(l, "from");
860
- (h === void 0 || h === "") && y("HC013", `<computed name="${f}"> requires a \`from\` expression.`, n), r.push({ kind: m, name: f, expression: R(h, u, n) });
861
- continue;
862
- }
863
- if (m === "data") {
864
- let h = w(l, "src"), p = w(l, "type"), b = w(l, "debounce"), x = w(l, "poll"), E = [], v = /* @__PURE__ */ new Set();
865
- for (let k of Et(l, "param")) {
866
- let C = w(k, "name") ?? "", $ = w(k, ":value");
867
- (!Ke.test(C) || $ === void 0) && y("HC024", "A data <param> requires a valid `name` and a `:value` expression.", n), v.has(C) && y("HC024", `Data source \`${f}\` repeats a parameter name.`, n), v.add(C), E.push({ name: C, expression: R($, u, n) });
868
- }
869
- let g = { kind: m, name: f, parameters: E };
870
- h !== void 0 && (g.source = h), p !== void 0 && (g.type = p), b !== void 0 && (g.debounce = b), x !== void 0 && (g.poll = x), r.push(g);
871
- continue;
872
- }
873
- if (m === "event") {
874
- r.push({ kind: m, name: f, type: w(l, "type") ?? "object", bubbles: w(l, "bubbles") !== "false", composed: w(l, "composed") !== "false", cancelable: w(l, "cancelable") === "true" });
875
- continue;
876
- }
877
- if (m === "method") {
878
- r.push({ kind: m, name: f, exportName: w(l, "export") ?? f, returns: w(l, "returns") ?? "undefined" });
879
- continue;
880
- }
881
- r.push({ kind: "handler", name: f, steps: _n(l, u, n) });
882
- }
883
- for (let l of r) if (l.kind === "handler") for (let m of l.steps) m.kind === "dispatch" && !d.has(m.event) && y("HC023", `Handler \`${l.name}\` dispatches undeclared component event \`${m.event}\`.`, n);
884
- return { declarations: r, scope: u };
885
- }
886
- function Un(e, t, n, r, i, o) {
887
- let a = [];
888
- for (let s of e) {
889
- if (s.name.startsWith("bind:")) {
890
- let c = s.name.slice(5).toLowerCase();
891
- (c === "" || vt.test(c)) && y("HT007", `Two-way binding cannot target \`${c || s.name}\`.`, i);
892
- let d = R(s.value, r, i), u = _e(s.value, r.writableRoots);
893
- u === void 0 && y("HT005", `\`${s.value}\` is not a writable state-rooted path.`, i), a.push({ kind: "attribute", name: c, expression: s.value, expressionPlan: d, twoWay: true, writablePath: u });
894
- continue;
895
- }
896
- if (s.name.startsWith("class:") || s.name.startsWith("style:")) {
897
- let c = s.name.startsWith("class:") ? "class" : "style", d = s.name.slice(c.length + 1);
898
- (c === "class" ? d !== "" && !/\s/.test(d) : /^(?:--[a-z0-9_-]+|[a-z][a-z0-9-]*)$/.test(d)) || y("HT020", `\`${s.name}\` does not name a valid ${c} binding target.`, i), a.push({ kind: "attribute", name: d, expression: s.value, expressionPlan: R(s.value, r, i), target: c });
899
- continue;
900
- }
901
- if (s.name.startsWith("$")) {
902
- let c = s.name.slice(1).toLowerCase();
903
- c !== "value" && c !== "html" && y("HT012", `\`$${c}\` is not a known content directive.`, i), a.push({ kind: "directive", name: c, expression: s.value, expressionPlan: R(s.value, r, i) });
904
- continue;
905
- }
906
- if (s.name.startsWith(":")) {
907
- let c = s.name.slice(1).toLowerCase();
908
- vt.test(c) && y("HT007", `\`:${c}\` cannot bind a raw content sink.`, i);
909
- let d = R(s.value, r, i), u = n.props[s.value];
910
- u !== void 0 && (!("attribute" in u.target) || u.target.attribute !== c) && y("HT004", `Binding \`:${c}\` does not match prop \`${s.value}\`'s target.`, i), a.push({ kind: "attribute", name: c, expression: s.value, expressionPlan: d });
911
- continue;
912
- }
913
- if (s.name.startsWith(".")) {
914
- let c = s.name.slice(1).toLowerCase(), d = R(s.value, r, i), u = n.props[s.value];
915
- u !== void 0 && (!("property" in u.target) || u.target.property.toLowerCase() !== c) && y("HT004", `Property binding \`.${c}\` does not match prop \`${s.value}\`'s target.`, i);
916
- let l = o.resolveDomProperty(t, c);
917
- l === void 0 && y("HP001", `\`${c}\` is not a native property of <${t}>.`, i), bt(l, i), a.push({ kind: "property", key: c, name: l, expression: s.value, expressionPlan: d });
918
- continue;
919
- }
920
- We(s.name, i, s.value), a.push({ kind: "literal", name: s.name, value: s.value });
921
- }
922
- return a;
923
- }
924
- function Wn(e, t, n) {
925
- if (e === void 0) return;
926
- let r = [];
927
- for (let i of e) {
928
- let [o = "", ...a] = i.name.slice(3).split(".");
929
- (!Fe.test(o) || a.some((s) => !Fe.test(s))) && y("HT010", `\`${i.name}\` is not a valid declarative event binding.`, n);
930
- for (let s = 0; s < a.length; s += 1) {
931
- let c = a[s];
932
- a.indexOf(c) !== s && y("HT010", `\`${i.name}\` repeats an event modifier.`, n), jn.test(c) || y("HT010", `\`${i.name}\` contains an unsupported event modifier.`, n);
933
- }
934
- a.includes("passive") && a.includes("prevent") && y("HT010", `\`${i.name}\` cannot combine passive and prevent.`, n), t.handlers.has(i.value) || y("HT010", `Event binding \`${i.name}\` names undeclared handler \`${i.value}\`.`, n), r.push({ name: o, handler: i.value, modifiers: a });
935
- }
936
- return r;
937
- }
938
- function Fn(e, t, n) {
939
- if (e !== void 0) return Ke.test(e) || y("HT019", "`$ref` requires a valid non-empty name.", n), t.has(e) && y("HT019", `Reference \`${e}\` is duplicated.`, n), t.add(e), e;
940
- }
941
- function Bn(e, t, n) {
942
- if (e === void 0) return;
943
- let r = [], i = [];
944
- e.$if !== void 0 && r.push("$if"), e.$each !== void 0 && r.push("$each"), e.$with !== void 0 && r.push("$with"), e.$match !== void 0 && r.push("$match"), e.$when !== void 0 && r.push("$when"), e.$else !== void 0 && r.push("$else"), e.$where !== void 0 && i.push("$where"), e.$sort !== void 0 && i.push("$sort"), e.$limit !== void 0 && i.push("$limit"), e.$key !== void 0 && i.push("$key"), r.length > 1 && y("HT014", `An element carries one structural directive; found ${r.join(", ")}.`, n);
945
- let o = e.$each;
946
- o === void 0 && i.length > 0 && y("HT014", `${i.join(", ")} may only modify \`$each\`.`, n);
947
- let a = e.$if;
948
- if (a !== void 0) {
949
- let u = a;
950
- return { kind: "if", test: u, testPlan: R(u, t, n) };
951
- }
952
- let s = e.$with;
953
- if (s !== void 0) {
954
- let u = kt.exec(s);
955
- return u === null && y("HT015", "`$with` must be written `expr as name`.", n), { kind: "with", expr: u[1], expressionPlan: R(u[1], t, n), alias: u[2] };
956
- }
957
- if (o !== void 0) {
958
- let u = Pn.exec(o);
959
- u === null && y("HT016", "`$each` must be written `item of items` (optionally `item, i of items`).", n);
960
- let l = u[1], m = u[2];
961
- (t.roots.has(l) || m !== void 0 && t.roots.has(m)) && y("HC020", "Loop locals may not collide with an existing scope name.", n);
962
- let f = Be(t, l, m, "loop"), h = { kind: "each", item: l, list: u[3], listPlan: R(u[3], t, n) };
963
- m !== void 0 && (h.index = m);
964
- let p = e.$where;
965
- p !== void 0 && (h.where = p, h.wherePlan = R(p, f, n)), e.$sort !== void 0 && (h.sort = e.$sort);
966
- let b = e.$limit;
967
- b !== void 0 && (h.limit = b, h.limitPlan = R(b, f, n));
968
- let x = e.$key;
969
- return x !== void 0 && (h.key = x, h.keyPlan = R(x, f, n)), h;
970
- }
971
- let c = e.$match;
972
- if (c !== void 0) {
973
- let u = c.trim();
974
- if (u === "") return { kind: "match" };
975
- let l = kt.exec(u);
976
- return l === null && y("HT017", "`$match` scope must be written `expr as name`.", n), { kind: "match", expr: l[1], expressionPlan: R(l[1], t, n), alias: l[2] };
977
- }
978
- let d = e.$when;
979
- if (d !== void 0) {
980
- let u = d;
981
- return { kind: "when", test: u, testPlan: R(u, t, n) };
982
- }
983
- if (e.$else !== void 0) return { kind: "else" };
984
- }
985
- function Ze(e, t, n, r, i, o) {
986
- let a = S(e);
987
- gt(a) && y("HT009", `<${a}> is reserved but not supported by this profile.`, r), Ue(a, r);
988
- let s, c = [], d, u;
989
- for (let v of we(e)) Dn.test(v.name) ? (s ??= {})[v.name] = v.value : v.name === "$ref" ? u = v.value : v.name.startsWith("on:") ? (d ??= []).push(v) : v.name !== "as" && c.push(v);
990
- let l = Bn(s, n, r), m = l?.kind === "each" ? Be(n, l.item, l.index, "loop") : l?.kind === "with" || l?.kind === "match" && l.alias !== void 0 ? Be(n, l.alias) : n, f = Un(c, a, t, m, r, o), h = Wn(d, m, r), p = Fn(u, i.refs, r), b = [], x = _(e);
991
- for (let v of x) if (v.nodeName !== "#comment") {
992
- if (se(v)) {
993
- let g = ae(v);
994
- g.trim() !== "" && b.push({ kind: "text", value: g });
995
- continue;
996
- }
997
- if (z(v)) {
998
- if (S(v) === "slot") {
999
- let g = w(v, "name"), k = w(v, ":name");
1000
- g !== void 0 && k !== void 0 && y("HT008", "A slot cannot declare both `name` and `:name`.", r);
1001
- for (let M of we(v)) M.name !== "name" && M.name !== ":name" && y("HT008", "A slot has an unsupported attribute.", r);
1002
- g === void 0 && k === void 0 && (i.defaults += 1, i.defaults > 1 && y("HT008", "A component may declare one default slot.", r)), g !== void 0 && ((g === "" || i.names.has(g)) && y("HT008", `Slot name \`${g}\` is empty or duplicated.`, r), i.names.add(g));
1003
- let C = [];
1004
- for (let M of _(v)) if (M.nodeName !== "#comment") if (se(M)) {
1005
- let he = ae(M);
1006
- he.trim() !== "" && C.push({ kind: "text", value: he });
1007
- } else z(M) && C.push(Ze(M, t, m, r, i, o));
1008
- let O = { dynamic: k !== void 0, required: C.length === 0 };
1009
- if (g !== void 0 && (O.name = g), i.contracts.push(O), g === void 0 && k === void 0 && C.length === 0) b.push({ kind: "slot" });
1010
- else {
1011
- let M = { kind: "slot", fallback: C };
1012
- g !== void 0 && (M.name = g), k !== void 0 && (M.nameExpression = R(k, m, r)), b.push(M);
1013
- }
1014
- continue;
1015
- }
1016
- b.push(Ze(v, t, m, r, i, o));
1017
- }
1018
- }
1019
- if (f.some((v) => v.kind === "directive") && b.length > 0 && y("HT006", "A content directive cannot coexist with children.", r), f.some((v) => v.kind === "property" && v.name === "textContent") && b.length > 0 && y("HT006", "A content-replacing property binding cannot coexist with children.", r), l?.kind === "match") {
1020
- let v = 0;
1021
- for (let k of b) k.kind === "element" && (v += 1);
1022
- let g = false;
1023
- for (let k of b) k.kind === "element" && (v -= 1, k.flow?.kind === "when" ? g && y("HT018", "A `$when` arm may not follow `$else`.", r) : k.flow?.kind === "else" ? (g && y("HT018", "A `$match` has at most one `$else`.", r), g = true, v !== 0 && y("HT018", "`$else` must be the last arm.", r)) : y("HT018", "Every direct child of a `$match` must be a `$when` or `$else` arm.", r));
1024
- }
1025
- let E = { kind: "element", name: a, attributes: f, children: b };
1026
- return l !== void 0 && (E.flow = l), h !== void 0 && (E.events = h), p !== void 0 && (E.ref = p), E;
1027
- }
1028
- function Ct(e, t, n) {
1029
- let r = wt(e);
1030
- (r.length !== 1 || !z(r[0]) || S(r[0]) !== "template" || w(r[0], "component") === void 0) && y("HS001", "A source must contain exactly one top-level <template component>.", t);
1031
- let i = r[0], o, a = false, s, c;
1032
- for (let g of _(i)) {
1033
- if (g.nodeName === "#comment" || se(g) && ae(g).trim() === "") continue;
1034
- z(g) || y("HT001", "A component's markup must be exactly one element root.", t);
1035
- let k = S(g);
1036
- k === "props" || k === "defs" ? (o !== void 0 && y("HS002", "A component has one optional declaration group, one markup root, and one optional <style>.", t), o = g, a = k === "props", Tt(g, t)) : k === "style" ? (s !== void 0 && y("HS002", "A component has one optional declaration group, one markup root, and one optional <style>.", t), s = g) : c === void 0 ? c = g : y("HT001", "A component's markup must be exactly one element root.", t);
1037
- }
1038
- c === void 0 && y("HT001", "A component's markup must be exactly one element root.", t);
1039
- let d = S(c), u = (w(c, "as") ?? d).split("|");
1040
- for (let g = u.length - 1; g >= 0; g -= 1) u[g] = u[g].trim(), u[g] === "" && u.splice(g, 1);
1041
- let l = !n.isNativeElement(d);
1042
- l && w(c, "as") !== void 0 && y("HT021", "A delegated component root cannot also declare native `as` choices.", t), !l && (u.length === 0 || !u.includes(d) || u.some((g, k) => u.indexOf(g) !== k) || u.some((g) => !n.isNativeElement(g))) && y("HT021", "A polymorphic root must list unique native choices including its markup root.", t);
1043
- let m = On(c, t, n), f = Vn(i, o, d, l, m, t, a), { declarations: h, scope: p } = qn(a ? void 0 : o, f, t), b = { defaults: 0, names: /* @__PURE__ */ new Set(), contracts: [], refs: /* @__PURE__ */ new Set() }, x = Ze(c, f, p, t, b, n), E = w(i, "controller");
1044
- E === "" && y("HC022", "A controller specifier cannot be empty.", t);
1045
- let v = { source: { file: t }, contract: f, template: x, css: s === void 0 ? "" : xt(s).trim(), declarations: h, slots: b.contracts, root: l ? { kind: "component", tag: d } : { kind: "native", element: d, choices: u } };
1046
- return E !== void 0 && (v.controller = E), Q(v);
1047
- }
1048
- var Rt = /* @__PURE__ */ new WeakMap();
1049
- function Zn(e) {
1050
- let t = {}, n = {}, r = (i) => {
1051
- if (i.includes("-")) return false;
1052
- if (Object.hasOwn(t, i)) return t[i];
1053
- let o = e.createElement(i), a = e.defaultView?.HTMLUnknownElement, s = a === void 0 ? o.constructor.name !== "HTMLUnknownElement" : !(o instanceof a);
1054
- return t[i] = s, s;
1055
- };
1056
- return { isNativeElement: r, resolveDomProperty(i, o) {
1057
- if (!r(i)) return;
1058
- let a = `${i}:${o}`;
1059
- if (a in n) return n[a] || void 0;
1060
- let s = e.createElement(i), c = o.toLowerCase();
1061
- for (; s !== null; ) {
1062
- for (let d of Object.getOwnPropertyNames(s)) if (d.toLowerCase() === c) return n[a] = d, d;
1063
- s = Object.getPrototypeOf(s);
1064
- }
1065
- n[a] = "";
1066
- } };
1067
- }
1068
- function St(e, t = e.ownerDocument.URL) {
1069
- (e.localName !== "template" || !e.hasAttribute("component")) && y("HS001", "A browser component carrier must be a <template component>.", t);
1070
- let n = e.ownerDocument, r = Rt.get(n);
1071
- return r === void 0 && (r = Zn(n), Rt.set(n, r)), Ct([e], t, r);
1072
- }
1073
- function Kn(e, t, n) {
1074
- let r = /* @__PURE__ */ new Set(), i = e.replace(/\{([A-Za-z_$][A-Za-z0-9_$-]*)\}/g, (a, s) => {
1075
- r.add(s);
1076
- let c = n[s];
1077
- return c == null ? "" : encodeURIComponent(String(c));
1078
- }), o = new URL(i, t);
1079
- for (let [a, s] of Object.entries(n)) if (!(r.has(a) || s == null)) if (Array.isArray(s)) for (let c of s) o.searchParams.append(a, String(c));
1080
- else o.searchParams.set(a, String(s));
1081
- return o.href;
1082
- }
1083
- var xe = class {
1084
- constructor(t) {
1085
- this.options = t;
1086
- this.#e = t.fetch ?? globalThis.fetch.bind(globalThis), this.#n = t.setTimer ?? ((n, r) => setTimeout(n, r)), this.#t = t.clearTimer ?? ((n) => clearTimeout(n));
1087
- }
1088
- options;
1089
- #e;
1090
- #n;
1091
- #t;
1092
- #i = {};
1093
- #o;
1094
- #r;
1095
- #c = 0;
1096
- #s = false;
1097
- update(t) {
1098
- this.#i = { ...t }, this.#s = true, this.#a();
1099
- let n = ++this.#c, r = () => {
1100
- this.#l(n);
1101
- };
1102
- (this.options.debounce ?? 0) > 0 ? this.#r = this.#n(r, this.options.debounce) : r();
1103
- }
1104
- disconnect() {
1105
- this.#s && (this.#s = false, this.#c += 1, this.#a());
1106
- }
1107
- #a() {
1108
- this.#o?.abort(), this.#o = void 0, this.#r !== void 0 && this.#t(this.#r), this.#r = void 0;
1109
- }
1110
- #d(t) {
1111
- return !this.#s || t !== this.#c;
1112
- }
1113
- async #l(t) {
1114
- if (this.#d(t)) return;
1115
- let n = new AbortController();
1116
- this.#o = n;
1117
- let r = this.options;
1118
- r.onState({ pending: true, value: null, error: null, ok: false });
1119
- try {
1120
- let i = await this.#e(Kn(r.source, r.baseURL, this.#i), { signal: n.signal });
1121
- if (!i.ok) throw new TypeError(`Request failed with ${i.status}.`);
1122
- let o = r.type === "text" ? await i.text() : await i.json(), a = r.adapt === void 0 ? o : r.adapt(o);
1123
- if (this.#d(t)) return;
1124
- r.onState({ pending: false, value: a, error: null, ok: true });
1125
- } catch (i) {
1126
- if (n.signal.aborted || this.#d(t)) return;
1127
- r.onState({ pending: false, value: null, error: i, ok: false });
1128
- } finally {
1129
- this.#o === n && (this.#o = void 0), !this.#d(t) && (r.poll ?? 0) > 0 && (this.#r = this.#n(() => {
1130
- this.#l(t);
1131
- }, r.poll));
1132
- }
1133
- }
1134
- };
1135
- var N, Jn = 0, Nt = 100, Je = /* @__PURE__ */ new WeakMap(), Ee = /* @__PURE__ */ new WeakMap();
1136
- function $t(e) {
1137
- let { dependency: t, previousSubscriber: n, nextSubscriber: r } = e;
1138
- n === void 0 ? t.first = r : n.nextSubscriber = r, r === void 0 ? t.last = n : r.previousSubscriber = n;
1139
- }
1140
- function At(e) {
1141
- if (e.length > 8) return [];
1142
- for (; e.length > 0; ) e.pop();
1143
- return e;
1144
- }
1145
- var Ge = class {
1146
- #e = [];
1147
- #n = [];
1148
- #t = false;
1149
- #i = false;
1150
- enqueue(t) {
1151
- t.stopped || t.queued || (t.queued = true, this.#e.push(t), !this.#t && !this.#i && (this.#t = true, queueMicrotask(() => {
1152
- this.#t = false, this.flush();
1153
- })));
1154
- }
1155
- enqueueDependency(t) {
1156
- if (this.#i || this.#e.length > 0) return false;
1157
- for (let n = t.first; n !== void 0; n = n.nextSubscriber) {
1158
- let r = n.effect;
1159
- if (r.scheduler !== this) {
1160
- for (let i of this.#e) i.queued = false;
1161
- return this.#e = [], false;
1162
- }
1163
- r.queued || (r.queued = true, this.#e.push(r));
1164
- }
1165
- return this.#t || (this.#t = true, queueMicrotask(() => {
1166
- this.#t = false, this.flush();
1167
- })), true;
1168
- }
1169
- flush() {
1170
- this.#i || this.#e.length === 0 || this.#o();
1171
- }
1172
- #o() {
1173
- this.#i = true;
1174
- let t = 0, n, r = 0;
1175
- try {
1176
- for (; this.#e.length > 0; ) {
1177
- if (t += 1, t > Nt) {
1178
- for (let i of this.#e) i.queued = false;
1179
- this.#e = [], y("HR006", "A reactive flush exceeded the propagation-depth limit.");
1180
- }
1181
- if (n = this.#e, n.length > 1) {
1182
- let i = 1, o = n[0];
1183
- for (; i < n.length; ) {
1184
- let a = n[i];
1185
- if (o.priority > a.priority || o.priority === a.priority && o.id > a.id) break;
1186
- o = a, i += 1;
1187
- }
1188
- i < n.length && n.sort((a, s) => a.priority - s.priority || a.id - s.id);
1189
- }
1190
- this.#e = this.#n, r = 0;
1191
- do {
1192
- let i = n[r];
1193
- if (i.queued = false, r += 1, i.computed === void 0 ? i.execute() : i.computed.refresh(), this.#e.length === 1 && r === n.length && this.#e[0].computed === void 0) {
1194
- t += 1, t > Nt && (this.#e[0].queued = false, this.#e = [], y("HR006", "A reactive flush exceeded the propagation-depth limit."));
1195
- let o = this.#e;
1196
- this.#e = At(n), n = o, r = 0;
1197
- } else this.#e.length > 0 && this.#r(n, r);
1198
- } while (r < n.length);
1199
- this.#n = At(n), n = void 0;
1200
- }
1201
- } finally {
1202
- if (n !== void 0) {
1203
- for (; r < n.length; ) n[r++].queued = false;
1204
- this.#n = [];
1205
- }
1206
- if (this.#e.length > 0) {
1207
- for (let i of this.#e) i.queued = false;
1208
- this.#e = [];
1209
- }
1210
- this.#i = false;
1211
- }
1212
- }
1213
- #r(t, n) {
1214
- if (this.#e.some((r) => r.computed !== void 0)) for (let r = t.length - 1; r >= n; r -= 1) {
1215
- let i = t[r];
1216
- i.computed === void 0 && (t.splice(r, 1), this.#e.push(i));
1217
- }
1218
- }
1219
- }, Te = class {
1220
- constructor(t, n, r, i) {
1221
- this.scheduler = t;
1222
- this.run = n;
1223
- this.priority = r;
1224
- this.computed = i;
1225
- }
1226
- scheduler;
1227
- run;
1228
- priority;
1229
- computed;
1230
- id = Jn++;
1231
- dependencies = void 0;
1232
- stopped = false;
1233
- paused = false;
1234
- queued = false;
1235
- #e = void 0;
1236
- #n = void 0;
1237
- execute() {
1238
- if (this.stopped || this.paused) return;
1239
- if (this.#n = void 0, this.#e !== void 0) {
1240
- let n = this.#e;
1241
- this.#e = void 0, n();
1242
- }
1243
- let t = N;
1244
- N = this;
1245
- try {
1246
- let n = this.run();
1247
- n !== void 0 && (this.#e = n);
1248
- } finally {
1249
- N = t;
1250
- let n = this.#n, r = n === void 0 ? this.dependencies : n.nextDependency;
1251
- for (n === void 0 ? this.dependencies = void 0 : n.nextDependency = void 0; r !== void 0; ) {
1252
- let i = r.nextDependency;
1253
- $t(r), r = i;
1254
- }
1255
- }
1256
- }
1257
- track(t) {
1258
- let n = this.#n === void 0 ? this.dependencies : this.#n.nextDependency;
1259
- if (n?.dependency === t) {
1260
- this.#n = n;
1261
- return;
1262
- }
1263
- for (let o = this.dependencies; o !== n; o = o?.nextDependency) if (o?.dependency === t) return;
1264
- let r = { dependency: t, effect: this, nextDependency: n, previousSubscriber: void 0, nextSubscriber: void 0 };
1265
- this.#n === void 0 ? this.dependencies = r : this.#n.nextDependency = r, this.#n = r;
1266
- let i = t.first;
1267
- if (this.computed !== void 0 && i !== void 0) r.nextSubscriber = i, i.previousSubscriber = r, t.first = r;
1268
- else {
1269
- let o = t.last;
1270
- r.previousSubscriber = o, o === void 0 ? t.first = r : o.nextSubscriber = r, t.last = r;
1271
- }
1272
- }
1273
- schedule() {
1274
- if (this.computed !== void 0) {
1275
- this.computed.invalidate();
1276
- return;
1277
- }
1278
- this.paused || this.scheduler.enqueue(this);
1279
- }
1280
- pause() {
1281
- this.stopped || this.paused || (this.paused = true, this.#t(), this.#e?.(), this.#e = void 0);
1282
- }
1283
- resume() {
1284
- this.stopped || !this.paused || (this.paused = false, this.execute());
1285
- }
1286
- stop() {
1287
- this.stopped || (this.stopped = true, this.#t(), this.#e?.(), this.#e = void 0);
1288
- }
1289
- #t() {
1290
- let t = this.dependencies;
1291
- for (; t !== void 0; ) {
1292
- let n = t.nextDependency;
1293
- $t(t), t = n;
1294
- }
1295
- this.dependencies = void 0, this.#n = void 0;
1296
- }
1297
- }, Qe = class {
1298
- #e = { first: void 0, last: void 0 };
1299
- #n;
1300
- constructor(t) {
1301
- this.#n = t;
1302
- }
1303
- get() {
1304
- return N !== void 0 && N.track(this.#e), this.#n;
1305
- }
1306
- set(t) {
1307
- Object.is(this.#n, t) || (this.#n = t, K(this.#e));
1308
- }
1309
- update(t) {
1310
- this.set(t(this.#n));
1311
- }
1312
- }, Ce = class {
1313
- #e;
1314
- #n;
1315
- #t;
1316
- #i;
1317
- #o = false;
1318
- #r = true;
1319
- #c = false;
1320
- #s = false;
1321
- constructor(t, n, r = { first: void 0, last: void 0 }) {
1322
- this.#e = r, this.#n = n, this.#t = new Te(t, () => this.#l(), 0, this);
1323
- }
1324
- get() {
1325
- return this.#t.paused || this.#t.stopped ? this.#d() : (this.#a(), N !== void 0 && N.track(this.#e), this.#i);
1326
- }
1327
- invalidate() {
1328
- if (!(this.#t.stopped || this.#r)) {
1329
- this.#r = true;
1330
- for (let t = this.#e.first; t !== void 0; t = t.nextSubscriber) if (t.effect.computed === void 0) {
1331
- this.#t.scheduler.enqueue(this.#t);
1332
- return;
1333
- }
1334
- K(this.#e);
1335
- }
1336
- }
1337
- refresh() {
1338
- this.#a();
1339
- }
1340
- pause() {
1341
- this.#t.stopped || this.#t.paused || (this.#r = true, this.#t.pause());
1342
- }
1343
- resume() {
1344
- this.#t.stopped || !this.#t.paused || (this.#t.paused = false);
1345
- }
1346
- stop() {
1347
- this.#t.stop();
1348
- }
1349
- #a() {
1350
- if (this.#c && y("HR006", "A reactive computed value depends on itself."), !this.#r || this.#t.stopped || this.#t.paused) return;
1351
- let t = this.#o;
1352
- this.#t.execute(), t && this.#s && K(this.#e, N?.computed === void 0 ? void 0 : N);
1353
- }
1354
- #d() {
1355
- this.#c && y("HR006", "A reactive computed value depends on itself.");
1356
- let t = N;
1357
- this.#c = true, N = void 0;
1358
- try {
1359
- return this.#n();
1360
- } finally {
1361
- N = t, this.#c = false;
1362
- }
1363
- }
1364
- #l() {
1365
- this.#c = true, this.#r = false;
1366
- try {
1367
- let t = this.#n();
1368
- this.#s = !this.#o || !Object.is(this.#i, t), this.#i = t, this.#o = true;
1369
- } catch (t) {
1370
- throw this.#r = true, t;
1371
- } finally {
1372
- this.#c = false;
1373
- }
1374
- }
1375
- };
1376
- function K(e, t) {
1377
- let n = e?.first;
1378
- if (n === void 0) return;
1379
- let r = n !== e.last;
1380
- if (!r && n.effect.computed !== void 0) {
1381
- n.effect !== t && n.effect.computed.invalidate();
1382
- return;
1383
- }
1384
- if (n.effect.computed === void 0) {
1385
- if (t === void 0 && r && n.effect.scheduler.enqueueDependency(e)) return;
1386
- for (let i = n; i !== void 0; ) {
1387
- let o = i.nextSubscriber;
1388
- i.effect !== t && i.effect.schedule(), i = o;
1389
- }
1390
- return;
1391
- }
1392
- for (let i = n; i !== void 0; ) {
1393
- let o = i.nextSubscriber;
1394
- i.effect !== t && i.effect.schedule(), i = o;
1395
- }
1396
- }
1397
- function Ht(e) {
1398
- return new Qe(e);
1399
- }
1400
- function Mt(e, t) {
1401
- return new Ce(e, t);
1402
- }
1403
- function ce(e, t, n = 1, r = true) {
1404
- let i = new Te(e, t, n);
1405
- return r ? i.execute() : i.paused = true, i;
1406
- }
1407
- var Re = class e {
1408
- constructor(t = [], n = new Ge(), r) {
1409
- this.scheduler = n;
1410
- this.parent = r;
1411
- for (let [i, o] of t) this.set(i, o);
1412
- }
1413
- scheduler;
1414
- parent;
1415
- #e = /* @__PURE__ */ new Map();
1416
- #n;
1417
- #t;
1418
- has(t) {
1419
- return this.#i(t) !== void 0 || this.parent?.has(t) === true;
1420
- }
1421
- get(t) {
1422
- let n = this.#i(t);
1423
- return n === void 0 ? this.parent?.get(t) : (N !== void 0 && N.track(n), n.value);
1424
- }
1425
- set(t, n) {
1426
- let r = this.#r(n), i = this.#i(t);
1427
- if (i === void 0) {
1428
- i = { value: r, first: void 0, last: void 0 }, this.#e.set(t, i), this.#t = i;
1429
- return;
1430
- }
1431
- Object.is(i.value, r) || (i.value = r, K(i));
1432
- }
1433
- defineComputed(t, n) {
1434
- let r = this.#i(t);
1435
- r === void 0 && (r = { value: null, first: void 0, last: void 0 }, this.#e.set(t, r), this.#t = r);
1436
- let i = new Ce(this.scheduler, () => this.#r(n()), r);
1437
- return r.computed = i, Object.hasOwn(this, "get") || (this.get = this.#o), i;
1438
- }
1439
- fork(t = []) {
1440
- return new e(t, this.scheduler, this);
1441
- }
1442
- #i(t) {
1443
- return t !== this.#n && (this.#n = t, this.#t = this.#e.get(t)), this.#t;
1444
- }
1445
- #o(t) {
1446
- let n = this.#i(t);
1447
- return n === void 0 ? this.parent?.get(t) : n.computed !== void 0 ? n.computed.get() : (N !== void 0 && N.track(n), n.value);
1448
- }
1449
- #r(t) {
1450
- if (t === null || typeof t != "object") return t;
1451
- let n = Je.get(t);
1452
- if (n !== void 0) return n;
1453
- let r = new Proxy(t, { get: (i, o, a) => {
1454
- if (N !== void 0) {
1455
- let s = Ee.get(i);
1456
- s === void 0 && (s = /* @__PURE__ */ new Map(), Ee.set(i, s));
1457
- let c = s.get(o);
1458
- c === void 0 && (c = { first: void 0, last: void 0 }, s.set(o, c)), N.track(c);
1459
- }
1460
- return this.#r(Reflect.get(i, o, a));
1461
- }, set: (i, o, a, s) => {
1462
- let c = Reflect.get(i, o, s), d = this.#r(a), u = Reflect.set(i, o, d, s);
1463
- return Object.is(c, d) || K(Ee.get(i)?.get(o)), u;
1464
- }, deleteProperty: (i, o) => {
1465
- let a = Reflect.has(i, o), s = Reflect.deleteProperty(i, o);
1466
- return a && K(Ee.get(i)?.get(o)), s;
1467
- } });
1468
- return Je.set(t, r), Je.set(r, r), r;
1469
- }
1470
- };
1471
- var Dt = "data-component", G = "data-component-root", J = "data-slotted", Gn = [[":user-invalid", ":is(:user-invalid, [data-user-invalid])"], [":invalid", ":is(:invalid, [data-invalid])"], [":valid", ":is(:valid, [data-valid])"]], Qn = /* @__PURE__ */ new Set(["container", "document", "layer", "media", "scope", "starting-style", "supports"]), Yn = /* @__PURE__ */ new Set(["has", "is", "not", "where"]);
1472
- function Ye(e) {
1473
- return e !== void 0 && /[A-Za-z0-9_-]/.test(e);
1474
- }
1475
- function q(e, t) {
1476
- let n = e[t], r = t + 1;
1477
- for (; r < e.length; ) if (e[r] === "\\") r += 2;
1478
- else {
1479
- if (e[r] === n) return r;
1480
- r += 1;
1481
- }
1482
- return e.length - 1;
1483
- }
1484
- function Pt(e, t) {
1485
- let n = 1, r = 0;
1486
- for (let i = t + 1; i < e.length; i += 1) {
1487
- let o = e[i];
1488
- if (o === '"' || o === "'") {
1489
- i = q(e, i);
1490
- continue;
1491
- }
1492
- if (o === "/" && e[i + 1] === "*") {
1493
- let a = e.indexOf("*/", i + 2);
1494
- if (a === -1) return e.length - 1;
1495
- i = a + 1;
1496
- continue;
1497
- }
1498
- if (o === "[") r += 1;
1499
- else if (o === "]") r = Math.max(0, r - 1);
1500
- else if (r === 0 && o === "(") n += 1;
1501
- else if (r === 0 && o === ")" && --n === 0) return i;
1502
- }
1503
- return e.length - 1;
1504
- }
1505
- function jt(e) {
1506
- let t = [], n = 0, r = 0, i = 0;
1507
- for (let o = 0; o < e.length; o += 1) {
1508
- let a = e[o];
1509
- if (a === '"' || a === "'") o = q(e, o);
1510
- else if (a === "/" && e[o + 1] === "*") {
1511
- let s = e.indexOf("*/", o + 2);
1512
- if (s === -1) break;
1513
- o = s + 1;
1514
- } else a === "[" ? i += 1 : a === "]" ? i = Math.max(0, i - 1) : i === 0 && a === "(" ? r += 1 : i === 0 && a === ")" ? r = Math.max(0, r - 1) : i === 0 && r === 0 && a === "," && (t.push(e.slice(n, o)), n = o + 1);
1515
- }
1516
- return t.push(e.slice(n)), t;
1517
- }
1518
- function Xn(e) {
1519
- let t = 0, n = 0, r = 0;
1520
- for (let i = 0; i < e.length; i += 1) {
1521
- let o = e[i];
1522
- if (o === '"' || o === "'") i = q(e, i);
1523
- else if (o === "/" && e[i + 1] === "*") {
1524
- let a = e.indexOf("*/", i + 2);
1525
- if (a === -1) return t;
1526
- i = a + 1;
1527
- } else if (o === "[") r += 1;
1528
- else if (o === "]") r = Math.max(0, r - 1);
1529
- else if (r === 0 && o === "(") n += 1;
1530
- else if (r === 0 && o === ")") n = Math.max(0, n - 1);
1531
- else if (r === 0 && n === 0) {
1532
- if (o === ">" || o === "+" || o === "~") t = i + 1;
1533
- else if (/\s/.test(o)) {
1534
- let a = i;
1535
- for (; a + 1 < e.length && /\s/.test(e[a + 1]); ) a += 1;
1536
- e[a + 1] !== void 0 && !/[>+~]/.test(e[a + 1]) && (t = a + 1), i = a;
1537
- }
1538
- }
1539
- }
1540
- for (; t < e.length && /\s/.test(e[t]); ) t += 1;
1541
- return t;
1542
- }
1543
- function er(e) {
1544
- let t = 0, n = 0;
1545
- for (let r = 0; r < e.length - 1; r += 1) {
1546
- let i = e[r];
1547
- if (i === '"' || i === "'") r = q(e, r);
1548
- else if (i === "[") n += 1;
1549
- else if (i === "]") n = Math.max(0, n - 1);
1550
- else if (n === 0 && i === "(") t += 1;
1551
- else if (n === 0 && i === ")") t = Math.max(0, t - 1);
1552
- else if (n === 0 && t === 0 && i === ":" && e[r + 1] === ":") return r;
1553
- }
1554
- return e.length;
1555
- }
1556
- function tr(e, t) {
1557
- let n = `:where([${Dt}~="${t}"])`, r = e.search(/\s*$/), i = e.slice(0, r), o = e.slice(r), a = Xn(i), s = i.slice(a);
1558
- if (s.includes(n)) return e;
1559
- let c = er(s);
1560
- return `${i.slice(0, a)}${s.slice(0, c)}${n}${s.slice(c)}${o}`;
1561
- }
1562
- function nr(e, t, n, r, i) {
1563
- let o = "", a = true;
1564
- for (let s = 0; s < e.length; ) {
1565
- let c = e[s];
1566
- if (c === '"' || c === "'") {
1567
- let d = q(e, s) + 1;
1568
- o += e.slice(s, d), s = d;
1569
- continue;
1570
- }
1571
- if (c === "/" && e[s + 1] === "*") {
1572
- let d = e.indexOf("*/", s + 2), u = d === -1 ? e.length : d + 2;
1573
- o += e.slice(s, u), s = u;
1574
- continue;
1575
- }
1576
- if (c === "[") {
1577
- let d = s + 1;
1578
- for (; d < e.length; ) {
1579
- let u = e[d];
1580
- if (u === '"' || u === "'") {
1581
- d = q(e, d) + 1;
1582
- continue;
1583
- }
1584
- if (d += 1, u === "]") break;
1585
- }
1586
- o += e.slice(s, d), s = d, a = false;
1587
- continue;
1588
- }
1589
- if (c === ":") {
1590
- let d = s + 1;
1591
- for (; Ye(e[d]); ) d += 1;
1592
- let u = e.slice(s + 1, d).toLowerCase();
1593
- if (i) {
1594
- let l = false;
1595
- for (let [m, f] of Gn) {
1596
- if (e.startsWith(f, s)) {
1597
- o += f, s += f.length, a = false, l = true;
1598
- break;
1599
- }
1600
- if (e.startsWith(m, s) && !Ye(e[s + m.length])) {
1601
- o += f, s += m.length, a = false, l = true;
1602
- break;
1603
- }
1604
- }
1605
- if (l) continue;
1606
- }
1607
- if (u === "scope" && t !== void 0 && n === "attribute") {
1608
- o += `:is(:where([${G}~="${t}"]), ${t})`, s = d, a = false;
1609
- continue;
1610
- }
1611
- if (e[d] === "(") {
1612
- let l = Pt(e, d), m = e.slice(d + 1, l), f = Yn.has(u) ? Lt(m, t, n, r, u === "has" && t !== void 0, i) : m;
1613
- o += `${e.slice(s, d + 1)}${f})`, s = l + 1;
1614
- } else o += e.slice(s, d), s = d;
1615
- a = false;
1616
- continue;
1617
- }
1618
- if (a && /[A-Za-z]/.test(c)) {
1619
- let d = s + 1;
1620
- for (; Ye(e[d]); ) d += 1;
1621
- let u = e.slice(s, d), l = u.includes("-") ? `:is(:where([${G}~="${u.toLowerCase()}"]), ${u})` : u;
1622
- o += n === "scope" && u.toLowerCase() === r?.toLowerCase() ? `:is(${l}, :where(:scope))` : l, s = d, a = false;
1623
- continue;
1624
- }
1625
- o += c, s += 1, c === "," || c === ">" || c === "+" || c === "~" || /\s/.test(c) ? a = true : c !== "|" && (a = false);
1626
- }
1627
- return o;
1628
- }
1629
- function Lt(e, t, n, r, i, o = false) {
1630
- return jt(e).map((a) => {
1631
- let s = /^\s*/.exec(a)[0], c = /\s*$/.exec(a)[0], d = a.slice(s.length, a.length - c.length);
1632
- if (d === "") return a;
1633
- let u = nr(d, t, n, r, o);
1634
- return `${s}${i && t !== void 0 ? tr(u, t) : u}${c}`;
1635
- }).join(",");
1636
- }
1637
- function Xe(e, t) {
1638
- let n = 1;
1639
- for (let r = t + 1; r < e.length; r += 1) {
1640
- let i = e[r];
1641
- if (i === '"' || i === "'") r = q(e, r);
1642
- else if (i === "/" && e[r + 1] === "*") {
1643
- let o = e.indexOf("*/", r + 2);
1644
- if (o === -1) return e.length - 1;
1645
- r = o + 1;
1646
- } else if (i === "{") n += 1;
1647
- else if (i === "}" && --n === 0) return r;
1648
- }
1649
- return e.length - 1;
1650
- }
1651
- function Ot(e, t, n, r, i = false) {
1652
- let o = "", a = 0, s = 0, c = 0;
1653
- for (let d = 0; d < e.length; d += 1) {
1654
- let u = e[d];
1655
- if (u === '"' || u === "'") d = q(e, d);
1656
- else if (u === "/" && e[d + 1] === "*") {
1657
- let l = e.indexOf("*/", d + 2);
1658
- if (l === -1) break;
1659
- d = l + 1;
1660
- } else if (u === "(") s += 1;
1661
- else if (u === ")") s = Math.max(0, s - 1);
1662
- else if (u === "[") c += 1;
1663
- else if (u === "]") c = Math.max(0, c - 1);
1664
- else if (s === 0 && c === 0 && u === ";") o += e.slice(a, d + 1), a = d + 1;
1665
- else if (s === 0 && c === 0 && u === "{") {
1666
- let l = Xe(e, d), m = e.slice(a, d), f = e.slice(d + 1, l), h = /^\s*@([\w-]+)/.exec(m)?.[1]?.toLowerCase(), p = h === void 0 ? Lt(m, t, n, r, t !== void 0 && n === "attribute", i) : m, b = h === void 0 || Qn.has(h) ? Ot(f, t, n, r, i) : f;
1667
- o += `${p}{${b}}`, d = l, a = l + 1;
1668
- }
1669
- }
1670
- return o + e.slice(a);
1671
- }
1672
- function rr(e) {
1673
- let t = "", n = "", r = 0, i = 0, o = 0;
1674
- for (let a = 0; a < e.length; a += 1) {
1675
- let s = e[a];
1676
- if (s === '"' || s === "'") a = q(e, a);
1677
- else if (s === "/" && e[a + 1] === "*") {
1678
- let c = e.indexOf("*/", a + 2);
1679
- if (c === -1) break;
1680
- a = c + 1;
1681
- } else if (s === "(") i += 1;
1682
- else if (s === ")") i = Math.max(0, i - 1);
1683
- else if (s === "[") o += 1;
1684
- else if (s === "]") o = Math.max(0, o - 1);
1685
- else if (i === 0 && o === 0 && s === ";") t += e.slice(r, a + 1), r = a + 1;
1686
- else if (i === 0 && o === 0 && s === "{") {
1687
- let c = Xe(e, a), d = e.slice(r, a), u = e.slice(r, c + 1);
1688
- !/^\s*@/.test(d) && d.includes(":slotted(") ? n += u : t += u, a = c, r = c + 1;
1689
- }
1690
- }
1691
- return { normal: t + e.slice(r), slotted: n };
1692
- }
1693
- function ir(e, t) {
1694
- let n = e.trim();
1695
- if (n.startsWith(">")) {
1696
- let i = n.slice(1).trim();
1697
- return i === "" || i === "*" ? `${t} [${J}]` : `${t} [${J}]:is(${i})`;
1698
- }
1699
- let r = `:where([${J}], [${J}] *)`;
1700
- return n === "" || n === "*" ? `${t} ${r}` : `${t} ${r}:is(${n})`;
1701
- }
1702
- function or(e, t) {
1703
- let n = `[${G}~="${t}"]`, r = /^\s*:scope((?:\[[^\]]*\]|:{1,2}[\w-]+(?:\([^)]*\))?|[.#][\w-]+)*)\s+(?=:slotted\()/.exec(e), i = r ? `${n}${r[1]}` : n, o = r ? e.slice(r[0].length) : e, a = "", s = 0;
1704
- for (; ; ) {
1705
- let c = o.indexOf(":slotted(", s);
1706
- if (c === -1) return a += o.slice(s), a;
1707
- a += o.slice(s, c);
1708
- let d = c + 8, u = Pt(o, d);
1709
- a += ir(o.slice(d + 1, u), i), s = u + 1;
1710
- }
1711
- }
1712
- function sr(e, t) {
1713
- let n = "", r = 0;
1714
- for (let i = 0; i < e.length; i += 1) if (e[i] === "{") {
1715
- let o = Xe(e, i), a = e.slice(r, i), s = e.slice(i + 1, o), c = jt(a).map((d) => or(d, t)).join(",");
1716
- n += `${c}{${s}}`, i = o, r = o + 1;
1717
- }
1718
- return n + e.slice(r);
1719
- }
1720
- function Se(e, t, n) {
1721
- if (e === "") return "";
1722
- let { normal: r, slotted: i } = rr(e), o = Ot(r, t, "scope", n), a = o.trim() === "" ? "" : `@scope ([${G}~="${t}"]) to (:scope [${G}] > *, [${J}]) {
1723
- ${o}
1724
- }`, s = i.trim() === "" ? "" : sr(i, t);
1725
- return [a, s].filter((c) => c !== "").join(`
1726
- `);
1727
- }
1728
- function It(e, t, n) {
1729
- let r = new Set((e.getAttribute(t) ?? "").split(/\s+/).filter(Boolean));
1730
- r.add(n), e.setAttribute(t, Array.from(r).join(" "));
1731
- }
1732
- function de(e, t) {
1733
- It(e, Dt, t);
1734
- }
1735
- function et(e, t) {
1736
- de(e, t), It(e, G, t);
1737
- }
1738
- function le(e) {
1739
- e.nodeType === 1 && e.setAttribute(J, "");
1740
- }
1741
- var Ne = /* @__PURE__ */ new WeakSet(), nt = /* @__PURE__ */ new WeakMap(), Vt = /* @__PURE__ */ new WeakMap(), ar = /* @__PURE__ */ Symbol.for("@nextwebwg/declarative-components.runtime.v1"), Z = /* @__PURE__ */ Symbol.for("@nextwebwg/declarative-components.lifecycle.v1");
1742
- function pe(e) {
1743
- return e[ar] ??= {};
1744
- }
1745
- function L(e) {
1746
- return nt.get(e);
1747
- }
1748
- function me(e) {
1749
- let t = pe(e), n = t.registry;
1750
- return (n === void 0 || n.root !== e.documentElement) && (n = { root: e.documentElement, definitions: /* @__PURE__ */ new Map(), discoverySelector: void 0 }, t.registry = n), n;
1751
- }
1752
- function He(e, t, n) {
1753
- e.definitions.set(t, n), e.discoverySelector !== void 0 && (e.discoverySelector += `,${t}`);
1754
- }
1755
- function cr(e) {
1756
- return e.discoverySelector ??= ["template[component]", "[data-component-root]", ...Array.from(e.definitions.keys())].join(",");
1757
- }
1758
- function dr(e, t) {
1759
- let n = e.getAttribute("component") ?? "", r = `${e.ownerDocument.URL}#template[component="${n}"][${t + 1}]`;
1760
- e.hasAttribute("src") && y("HL001", "External definitions require the application-owned graph resolver.", r);
1761
- let i = St(e, r), o = Array.from(e.content.children).find((a) => a.localName === "style");
1762
- return { wrapper: e, style: o, definition: i };
1763
- }
1764
- function lr(e, t = document) {
1765
- let n = me(t), r = 0;
1766
- for (let i of e.nodes.values()) {
1767
- if (i.shadowedByCustomElement) continue;
1768
- let o = i.definition.contract.tag;
1769
- n.definitions.has(o) && y("HR001", `More than one definition declares <${o}>.`);
1770
- let a = i.definition.css === "" ? void 0 : t.createElement("style");
1771
- a !== void 0 && (a.textContent = Se(i.definition.css, o, i.definition.template.name), a.dataset.htmlNextComponent = o, t.head.append(a)), He(n, o, { definition: i.definition, style: a }), r += 1;
1772
- }
1773
- return r;
1774
- }
1775
- function rt(e, t, n = false) {
1776
- let r = e.type === "boolean" && n && t === "" ? true : t, i = B(r, e.type);
1777
- if (!i.ok) {
1778
- let o = i.issues.map((a) => `${a.path}: ${a.message}`).join("; ");
1779
- y("HR002", `A prop invocation value does not satisfy its declared type. ${o}`);
1780
- }
1781
- return i.value;
1782
- }
1783
- function Bt(e, t, n) {
1784
- return n !== void 0 ? rt(t, n) : (t.required && y("HC020", `Required prop \`${e}\` was not provided.`), t.default === void 0 ? T : t.default);
1785
- }
1786
- function ur(e, t) {
1787
- let n = Vt.get(e);
1788
- if (n === void 0) {
1789
- let r = /* @__PURE__ */ Object.create(null), i = /* @__PURE__ */ Object.create(null);
1790
- for (let o of Object.keys(e.contract.props)) {
1791
- let a = Y(o);
1792
- r[a] = o, i[`data-${a}`] = o, a !== o.toLowerCase() && (i[`data-${o.toLowerCase()}`] = o);
1793
- }
1794
- n = [r, i], Vt.set(e, n);
1795
- }
1796
- return n[t ? 1 : 0];
1797
- }
1798
- function fr(e, t, n = false) {
1799
- let r = t.contract, i = ur(t, n), o = /* @__PURE__ */ Object.create(null), a = [], s;
1800
- for (let h of Array.from(e.attributes)) {
1801
- if (h.name.toLowerCase() === "as" && t.root?.kind === "native") {
1802
- s = h.value.toLowerCase();
1803
- continue;
1804
- }
1805
- let p = i[h.name.toLowerCase()];
1806
- if (p === void 0) {
1807
- n || a.push(h);
1808
- continue;
1809
- }
1810
- o[p] = rt(r.props[p], h.value, !n);
1811
- }
1812
- let c = t.root?.kind === "native" ? n ? e.localName : s ?? t.root.element : t.template.name;
1813
- t.root?.kind === "native" && !t.root.choices.includes(c) && y(n ? "HR005" : "HR002", `<${r.tag}> cannot use root <${c}>; expected one of ${t.root.choices.join(", ")}.`);
1814
- let d = new Set(Object.keys(o).filter((h) => o[h] !== void 0)), u = new Re();
1815
- for (let [h, p] of Object.entries(r.props)) p.required && o[h] === void 0 && y("HC020", `Required prop \`${h}\` was not provided.`), u.set(h, o[h] !== void 0 ? o[h] : p.default === void 0 ? T : p.default);
1816
- let l = t.declarations ?? [];
1817
- for (let h of l) (h.kind === "state" || h.kind === "computed" || h.kind === "data") && u.set(h.name, null);
1818
- for (let h of l) h.kind === "data" ? u.set(h.name, { pending: true, value: null, error: null, ok: false }) : h.kind === "state" && u.set(h.name, h.expression === void 0 ? null : H(h.expression.source, u));
1819
- let m = [];
1820
- for (let h of l) h.kind !== "computed" || h.expression === void 0 || m.push(u.defineComputed(h.name, () => V(h.expression, u)));
1821
- let f = (() => {
1822
- try {
1823
- return new URL(t.source.file, e.ownerDocument.baseURI).href;
1824
- } catch {
1825
- return e.ownerDocument.baseURI;
1826
- }
1827
- })();
1828
- for (let h of l) {
1829
- if (h.kind !== "data" || h.source === void 0) continue;
1830
- let p = h, b = h.source, x = new xe({ source: b, baseURL: f, ...p.type === void 0 ? {} : { type: p.type }, ...p.debounce === void 0 ? {} : { debounce: Number(p.debounce) }, ...p.poll === void 0 ? {} : { poll: Number(p.poll) }, onState: (E) => u.set(p.name, E) });
1831
- m.push(ce(u.scheduler, () => {
1832
- let E = Object.fromEntries(p.parameters.map((v) => [v.name, V(v.expression, u)]));
1833
- return x.update(E), () => x.disconnect();
1834
- }, 0));
1835
- }
1836
- return { scope: u, passThrough: a, effects: m, rootName: c, explicit: d };
1837
- }
1838
- function tt(e, t) {
1839
- return e.fork(Object.entries(t));
1840
- }
1841
- function H(e, t) {
1842
- try {
1843
- return ht(e, t);
1844
- } catch (n) {
1845
- throw n instanceof re && y("HB001", n.message), n;
1846
- }
1847
- }
1848
- var ue = "http://www.w3.org/2000/svg", zt = /* @__PURE__ */ new Map();
1849
- function pr(e, t) {
1850
- if (e.namespaceURI !== ue) return t;
1851
- let n = zt.get(t);
1852
- if (n === void 0) {
1853
- let r = e.ownerDocument.createElement("template");
1854
- r.innerHTML = `<svg ${t}>`, n = r.content.firstChild.attributes[0]?.name ?? t, zt.set(t, n);
1855
- }
1856
- return n;
1857
- }
1858
- function Zt(e, t, n) {
1859
- return t === "svg" || n.namespace === ue ? e.createElementNS(ue, t) : e.createElement(t);
1860
- }
1861
- function mr(e, t) {
1862
- let n = e.namespaceURI === ue && e.localName !== "foreignObject" ? ue : void 0;
1863
- return n === t.namespace ? t : Object.create(t, { namespace: { value: n, enumerable: true } });
1864
- }
1865
- function U(e, t, n, r = 1) {
1866
- e.effects.push(ce(t.scheduler, n, r));
1867
- }
1868
- function Kt(e, t, n) {
1869
- let [r, ...i] = t;
1870
- if (typeof r != "string") return;
1871
- if (i.length === 0) {
1872
- e.set(r, n);
1873
- return;
1874
- }
1875
- let o = e.get(r);
1876
- for (let c = 0; c < i.length - 1; c += 1) {
1877
- let d = i[c], u = typeof d == "object" ? V(d.expression, e) : d;
1878
- if (typeof u != "string" && typeof u != "number" || o == null) return;
1879
- o = o[u];
1880
- }
1881
- let a = i.at(-1), s = typeof a == "object" ? V(a.expression, e) : a;
1882
- (typeof s == "string" || typeof s == "number") && o != null && (o[s] = n);
1883
- }
1884
- function hr(e) {
1885
- return e instanceof HTMLInputElement ? e.type === "checkbox" || e.type === "radio" ? e.checked : e.type === "number" || e.type === "range" ? Number.isNaN(e.valueAsNumber) ? null : e.valueAsNumber : e.value : e instanceof HTMLSelectElement ? e.multiple ? Array.from(e.selectedOptions, (t) => t.value) : e.value : e instanceof HTMLTextAreaElement ? e.value : e.value ?? e.getAttribute("value");
1886
- }
1887
- function yr(e, t, n) {
1888
- let r = t.toLowerCase();
1889
- if (r === "checked" && e instanceof HTMLInputElement) return e.checked = j(n), true;
1890
- if (r === "value" && e instanceof HTMLSelectElement && e.multiple) {
1891
- let i = new Set(Array.isArray(n) ? n.map(String) : []);
1892
- for (let o of Array.from(e.options)) o.selected = i.has(o.value);
1893
- return true;
1894
- }
1895
- return r === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? (e.value = n == null ? "" : String(n), true) : false;
1896
- }
1897
- function gr(e, t, n, r) {
1898
- for (let i of e.steps) if (!(i.guard !== void 0 && !j(V(i.guard, n)))) if (i.kind === "set") Kt(n, i.writablePath, V(i.value, n));
1899
- else if (i.kind === "dispatch") {
1900
- let o = Jt(r.definition, i.event), a = i.value === void 0 ? void 0 : V(i.value, n);
1901
- o !== void 0 && a !== void 0 && (B(a, ge(o.type)).ok || y("HR002", `Event \`${i.event}\` detail does not satisfy its declared type.`)), Gt(r.root ?? t, i.event, a, o);
1902
- } else {
1903
- let o = r.refs[i.target];
1904
- i.kind === "focus" ? o?.focus() : o?.reportValidity?.();
1905
- }
1906
- }
1907
- function Jt(e, t) {
1908
- return (e.declarations ?? []).find((n) => n.kind === "event" && n.name === t);
1909
- }
1910
- function Gt(e, t, n, r) {
1911
- return e.dispatchEvent(new CustomEvent(t, { detail: n, bubbles: r?.bubbles ?? true, composed: r?.composed ?? true, cancelable: r?.cancelable ?? false }));
1912
- }
1913
- function br(e, t, n) {
1914
- if (n.includes("self") && e.target !== t) return false;
1915
- if (e instanceof MouseEvent) {
1916
- let i = n.filter((a) => ["left", "middle", "right"].includes(a)), o = { left: 0, middle: 1, right: 2 };
1917
- if (i.length > 0 && !i.some((a) => e.button === o[a])) return false;
1918
- }
1919
- let r = ["ctrl", "shift", "alt", "meta"];
1920
- for (let i of r) if (n.includes(i) && !e[`${i}Key`]) return false;
1921
- if (n.includes("exact") && r.some((i) => !n.includes(i) && e[`${i}Key`])) return false;
1922
- if (e instanceof KeyboardEvent) {
1923
- let i = n.filter((a) => ["enter", "escape", "space", "tab", "up", "down", "left", "right"].includes(a)), o = { enter: "Enter", escape: "Escape", space: " ", tab: "Tab", up: "ArrowUp", down: "ArrowDown", left: "ArrowLeft", right: "ArrowRight" };
1924
- if (i.length > 0 && !i.some((a) => e.key === o[a])) return false;
1925
- }
1926
- return true;
1927
- }
1928
- function _t(e, t, n, r) {
1929
- for (let i of t.events ?? []) {
1930
- let o = (r.definition.declarations ?? []).find((s) => s.kind === "handler" && s.name === i.handler), a = (s) => {
1931
- br(s, e, i.modifiers) && (i.modifiers.includes("prevent") && s.preventDefault(), i.modifiers.includes("stop") && s.stopPropagation(), gr(o, e, n, r));
1932
- };
1933
- if (i.name === "connect" || i.name === "disconnect") {
1934
- (i.name === "connect" ? r.connectCallbacks : r.disconnectCallbacks).add(() => a(new Event(i.name)));
1935
- continue;
1936
- }
1937
- U(r, n, () => (e.addEventListener(i.name, a, { capture: i.modifiers.includes("capture"), passive: i.modifiers.includes("passive"), once: i.modifiers.includes("once") }), () => e.removeEventListener(i.name, a, { capture: i.modifiers.includes("capture") })), 2);
1938
- }
1939
- }
1940
- function vr(e, t, n) {
1941
- t = pr(e, t), n === null || oe(t) && ie(n) ? e.removeAttribute(t) : e.setAttribute(t, n);
1942
- }
1943
- function kr(e, t, n, r) {
1944
- let i = H(t.expression, n);
1945
- t.name === "value" ? e.textContent = D(i) : e.replaceChildren(qe(D(i), r, (o) => Ne.add(o)));
1946
- }
1947
- function wr(e, t, n) {
1948
- let r = H(e.expression, t);
1949
- return e.name === "value" ? n.createTextNode(D(r)) : qe(D(r), n, (i) => Ne.add(i));
1950
- }
1951
- function xr(e, t) {
1952
- return typeof e == "number" && typeof t == "number" ? e - t : D(e).localeCompare(D(t));
1953
- }
1954
- function Er(e, t, n) {
1955
- let r = e.slice();
1956
- if (t.where !== void 0) {
1957
- let i = t.where;
1958
- r = r.filter((o) => j(H(i, tt(n, { [t.item]: o }))));
1959
- }
1960
- if (t.sort !== void 0) {
1961
- let i = t.sort.split(",").map((a) => a.trim()).filter((a) => a !== ""), o = (a, s) => a !== null && typeof a == "object" && !Array.isArray(a) ? H(`${t.item}.${s}`, tt(n, { [t.item]: a })) : a;
1962
- r.sort((a, s) => {
1963
- for (let c of i) {
1964
- let d = c.startsWith("-"), u = d ? c.slice(1).trim() : c, l = xr(o(a, u), o(s, u));
1965
- if (l !== 0) return d ? -l : l;
1966
- }
1967
- return 0;
1968
- });
1969
- }
1970
- if (t.limit !== void 0) {
1971
- let i = H(t.limit, n);
1972
- typeof i == "number" && (r = r.slice(0, Math.max(0, Math.trunc(i))));
1973
- }
1974
- return r;
1975
- }
1976
- function Qt(e, t) {
1977
- let n = t.createDocumentFragment();
1978
- return n.append(...e), Array.from(n.childNodes);
1979
- }
1980
- function Tr(e, t) {
1981
- let n = e.nextSibling;
1982
- for (; n !== null && n !== t; ) {
1983
- let r = n.nextSibling;
1984
- n.remove(), n = r;
1985
- }
1986
- }
1987
- function Cr(e, t, n, r, i) {
1988
- if (e.flow?.kind === "each") return $r(e, t, n, r, i);
1989
- let o = n.createComment("html-next:start"), a = n.createComment("html-next:end"), s = n.createDocumentFragment();
1990
- s.append(o, a);
1991
- let c = [];
1992
- return U(i, t, () => {
1993
- for (let l of c) l.stop();
1994
- c = [], Tr(o, a);
1995
- let d = i.effects.length, u = [];
1996
- if (e.flow?.kind === "if") {
1997
- if (j(H(e.flow.test, t))) {
1998
- let { flow: l, ...m } = e;
1999
- u = fe(m, t, n, r, i);
2000
- }
2001
- } else if (e.flow?.kind === "with") {
2002
- let l = t.fork([[e.flow.alias, H(e.flow.expr, t)]]), { flow: m, ...f } = e;
2003
- u = fe(f, l, n, r, i);
2004
- } else e.flow?.kind === "match" && (u = Ar(e, t, n, i));
2005
- c = i.effects.slice(d), a.before(...Qt(u, n));
2006
- }), [s];
2007
- }
2008
- function Rr(e, t) {
2009
- if (e.end.nextSibling === t) return;
2010
- let n = [], r = e.start;
2011
- for (; r !== null && (n.push(r), r !== e.end); ) r = r.nextSibling;
2012
- let i = t.parentNode;
2013
- if (i === null) return;
2014
- let o = i.moveBefore;
2015
- for (let a of n) o === void 0 ? i.insertBefore(a, t) : o.call(i, a, t);
2016
- }
2017
- function Sr(e) {
2018
- for (let n of e.effects) n.stop();
2019
- let t = e.start;
2020
- for (; t !== null; ) {
2021
- let n = t.nextSibling;
2022
- if (t.parentNode?.removeChild(t), t === e.end) break;
2023
- t = n;
2024
- }
2025
- }
2026
- function Nr(e) {
2027
- let t = -1, n = true;
2028
- for (let s of e) s < 0 || (s < t && (n = false), t = s);
2029
- if (n) return;
2030
- let r = [], i = new Int32Array(e.length).fill(-1);
2031
- for (let s = 0; s < e.length; s += 1) {
2032
- let c = e[s];
2033
- if (c < 0) continue;
2034
- let d = 0, u = r.length;
2035
- for (; d < u; ) {
2036
- let l = d + u >>> 1;
2037
- e[r[l]] < c ? d = l + 1 : u = l;
2038
- }
2039
- d > 0 && (i[s] = r[d - 1]), r[d] = s;
2040
- }
2041
- let o = new Uint8Array(e.length), a = r.at(-1) ?? -1;
2042
- for (; a >= 0; ) o[a] = 1, a = i[a];
2043
- return o;
2044
- }
2045
- function $r(e, t, n, r, i) {
2046
- let o = e.flow, a = n.createComment("html-next:each-start"), s = n.createComment("html-next:each-end"), c = n.createDocumentFragment();
2047
- c.append(a, s);
2048
- let d = /* @__PURE__ */ new Map();
2049
- return U(i, t, () => {
2050
- let u = H(o.list, t), l = Array.isArray(u) ? Er(u, o, t) : [], m = /* @__PURE__ */ new Map(), f = o.key !== void 0, h = f ? [] : void 0, p;
2051
- if (f) {
2052
- p = /* @__PURE__ */ new Map();
2053
- let v = 0;
2054
- for (let g of d.keys()) p.set(g, v++);
2055
- }
2056
- let b = f ? [] : void 0, { flow: x, ...E } = e;
2057
- for (let v = 0; v < l.length; v += 1) {
2058
- let g = l[v], k = { [o.item]: g, loop: { index: v, first: v === 0, last: v === l.length - 1, count: l.length } };
2059
- o.index !== void 0 && (k[o.index] = v);
2060
- let C, $ = v;
2061
- o.key !== void 0 && (C = t.fork(Object.entries(k)), $ = H(o.key, C)), m.has($) && y("HR004", `A keyed list produced duplicate key \`${D($)}\`.`);
2062
- let O = d.get($);
2063
- if (O === void 0) {
2064
- C ??= t.fork(Object.entries(k));
2065
- let M = i.effects.length, he = Qt(fe(E, C, n, r, i), n), ct = n.createComment("html-next:item-start"), dt = n.createComment("html-next:item-end");
2066
- s.before(ct, ...he, dt), O = { start: ct, end: dt, scope: C, effects: i.effects.slice(M) };
2067
- } else O.scope.set(o.item, g), o.index !== void 0 && O.scope.set(o.index, v), O.scope.set("loop", k.loop);
2068
- m.set($, O), h?.push(O), b?.push(p?.get($) ?? -1);
2069
- }
2070
- for (let [v, g] of d) m.has(v) || Sr(g);
2071
- if (h !== void 0 && b !== void 0) {
2072
- let v = Nr(b), g = s;
2073
- for (let k = h.length - 1; k >= 0; k -= 1) {
2074
- let C = h[k];
2075
- (b[k] < 0 || v !== void 0 && v[k] !== 1) && Rr(C, g), g = C.start;
2076
- }
2077
- }
2078
- d = m;
2079
- }), [c];
2080
- }
2081
- function Yt(e, t, n, r, i, o) {
2082
- return e.flow?.kind === "if" || e.flow?.kind === "each" || e.flow?.kind === "with" || e.flow?.kind === "match" ? i.committed && i.frameworkOwned && o !== void 0 ? [o] : Cr(e, t, n, r, i) : fe(e, t, n, r, i, o);
2083
- }
2084
- function Ar(e, t, n, r) {
2085
- let i = e.flow, o = i.expr !== void 0 ? tt(t, { [i.alias]: H(i.expr, t) }) : t, a;
2086
- for (let l of e.children) if (l.kind === "element") {
2087
- if (l.flow?.kind === "when" && j(H(l.flow.test, o))) {
2088
- a = l;
2089
- break;
2090
- }
2091
- if (l.flow?.kind === "else") {
2092
- a = l;
2093
- break;
2094
- }
2095
- }
2096
- if (a === void 0) return [];
2097
- let { flow: s, ...c } = a, d = fe(c, o, n, [], r);
2098
- if (e.name === "template") return d;
2099
- let u = Zt(n, e.name, r);
2100
- for (let l of e.attributes) l.kind === "literal" && u.setAttribute(l.name, l.value);
2101
- return u.append(...d), de(u, r.definition.contract.tag), [u];
2102
- }
2103
- function fe(e, t, n, r, i, o) {
2104
- let a = e.attributes.find((p) => p.kind === "directive");
2105
- if (e.name === "template") {
2106
- if (a !== void 0) {
2107
- let p = n.createTextNode("");
2108
- return U(i, t, () => {
2109
- let b = H(a.expression, t);
2110
- a.name === "value" && (p.data = D(b));
2111
- }), a.name === "value" ? [p] : [wr(a, t, n)];
2112
- }
2113
- return Xt(e.children, t, n, i);
2114
- }
2115
- let s = e === i.definition.template ? i.rootName : e.name;
2116
- if (i.frameworkOwned && o instanceof Element && o.localName !== s && (o.getAttribute("data-component-root") ?? "").split(/\s+/).includes(e.name)) return [o];
2117
- if (i.hydrationRanges !== void 0 && !i.frameworkOwned && o instanceof Element && o.localName !== s && (o.getAttribute("data-component-root") ?? "").split(/\s+/).includes(e.name)) {
2118
- let p = it(o, false), b = (g) => g.kind === "element" ? g.attributes.find((k) => k.kind === "literal" && k.name === "slot")?.value ?? "" : "", x = p?.ranges.filter((g) => !g.fallback) ?? [], E = (g, k) => {
2119
- let C = 0;
2120
- for (let $ of g) C += $e($, t, n, i, k[C]).length;
2121
- };
2122
- for (let g of x) E(e.children.filter((k) => b(k) === g.slot), g.content);
2123
- let v = new Set(x.map((g) => g.slot));
2124
- return E(e.children.filter((g) => !v.has(b(g))), p?.carried ?? []), [o];
2125
- }
2126
- let c = o instanceof Element && o.localName === s, d = c ? o : Zt(n, s, i);
2127
- e === i.definition.template && (i.root = d);
2128
- let u = c ? Array.from(d.childNodes) : [], l = c && (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement || d instanceof HTMLSelectElement) ? { value: d.value, focused: d.ownerDocument.activeElement === d, ...d instanceof HTMLInputElement ? { checked: d.checked } : {}, ...d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement ? { selectionStart: d.selectionStart, selectionEnd: d.selectionEnd } : {} } : void 0;
2129
- e.ref !== void 0 && (i.refs[e.ref] = d);
2130
- for (let p of r) d.setAttribute(p.name, p.value);
2131
- for (let p of e.attributes) if (p.kind === "literal") d.setAttribute(p.name, p.value);
2132
- else if (p.kind === "attribute") {
2133
- if (U(i, t, () => {
2134
- let b = H(p.expression, t);
2135
- p.target === "class" ? d.classList.toggle(p.name, j(b)) : p.target === "style" ? d.style.setProperty(p.name, D(b)) : p.twoWay === true && yr(d, p.name, b) || vr(d, p.name, yt(b));
2136
- }), p.twoWay === true && p.writablePath !== void 0) {
2137
- let b = d instanceof HTMLSelectElement || d instanceof HTMLInputElement && ["checkbox", "radio", "file"].includes(d.type) ? "change" : "input", x = () => {
2138
- d instanceof HTMLInputElement && d.type === "radio" && !d.checked || Kt(t, p.writablePath, hr(d));
2139
- };
2140
- U(i, t, () => (d.addEventListener(b, x), () => d.removeEventListener(b, x)), 2);
2141
- }
2142
- } else p.kind === "property" && U(i, t, () => {
2143
- d[p.name] = H(p.expression, t);
2144
- });
2145
- if (de(d, i.definition.contract.tag), a !== void 0) return U(i, t, () => kr(d, a, t, n)), _t(d, e, t, i), [d];
2146
- let m = [], f = 0, h = mr(d, i);
2147
- for (let p of e.children) {
2148
- let b = f;
2149
- if (i.frameworkOwned && p.kind === "element") {
2150
- let E = u.findIndex((v, g) => g < f ? false : v instanceof Element && (v.localName === p.name || (v.getAttribute("data-component-root") ?? "").split(/\s+/).includes(p.name)));
2151
- E < 0 && p.flow !== void 0 && (E = u.findIndex((v, g) => g >= f && v instanceof Comment)), E >= 0 && (b = E);
2152
- }
2153
- let x = $e(p, t, n, h, u[b]);
2154
- m.push(...x), f = b + x.length;
2155
- }
2156
- if (c && !i.frameworkOwned) {
2157
- m = m.flatMap((p) => p.nodeType === 11 ? Array.from(p.childNodes) : [p]);
2158
- for (let p = 0; p < m.length; p += 1) {
2159
- let b = m[p];
2160
- d.childNodes[p] !== b && d.insertBefore(b, d.childNodes[p] ?? null);
2161
- }
2162
- for (; d.childNodes.length > m.length; ) d.lastChild.remove();
2163
- } else c || d.append(...m);
2164
- return l !== void 0 && (d.value = l.value, d instanceof HTMLInputElement && "checked" in l && (d.checked = l.checked), (d instanceof HTMLInputElement || d instanceof HTMLTextAreaElement) && "selectionStart" in l && typeof l.selectionStart == "number" && typeof l.selectionEnd == "number" && (l.focused && d.focus({ preventScroll: true }), d.setSelectionRange(l.selectionStart, l.selectionEnd))), _t(d, e, t, i), [d];
2165
- }
2166
- function Xt(e, t, n, r) {
2167
- let i = [];
2168
- for (let o of e) i.push(...$e(o, t, n, r));
2169
- return i;
2170
- }
2171
- function Hr(e, t) {
2172
- return t.projectedSlotNames.get(e) ?? (e instanceof Element ? e.getAttribute("slot") ?? "" : "");
2173
- }
2174
- function Mr(e, t, n, r) {
2175
- let i = e.nameExpression === void 0 ? e.name ?? "" : D(V(e.nameExpression, t)), o = r.projectedNodes.filter((l) => Hr(l, r) === i), a = r.hydrationRanges?.shift();
2176
- if (a !== void 0) {
2177
- if (a.fallback) {
2178
- let l = [], m = 0;
2179
- for (let f of e.fallback ?? []) {
2180
- let h = $e(f, t, n, r, a.content[m]);
2181
- l.push(...h), m += h.length;
2182
- }
2183
- return [a.markers[0], ...l, ...a.markers.slice(1)];
2184
- }
2185
- for (let l of a.content) le(l);
2186
- return a.markers.length === 1 ? [a.markers[0]] : [a.markers[0], ...a.content, a.markers[1]];
2187
- }
2188
- let s = (l) => `"${l.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;")}"`, c = (l, m) => en(n) ? n.createProcessingInstruction(l, m) : n.createComment(`?${l}${m === "" ? "" : ` ${m}`}?`), d = (l, m) => {
2189
- if (l.length === 0) return [c("marker", `slot=${s(i)}`)];
2190
- let f = `slot=${s(i)}${m ? ' fallback=""' : ""}`;
2191
- return [c("start", f), ...l, c("end", "")];
2192
- };
2193
- if (o.length === 0) return d(Xt(e.fallback ?? [], t, n, r), true);
2194
- if (r.committed) {
2195
- for (let l of o) le(l);
2196
- return d([...o], false);
2197
- }
2198
- let u = n.createComment(`html-next:slot:${i}`);
2199
- return r.slotInsertions.push({ anchor: u, nodes: o }), d([u], false);
2200
- }
2201
- function qt(e) {
2202
- let t = /* @__PURE__ */ new Map(), n = e.trim(), r = { amp: "&", lt: "<", gt: ">", quot: '"', apos: "'" };
2203
- for (; n !== ""; ) {
2204
- let i = /^([A-Za-z_:][-A-Za-z0-9._:]*)\s*=\s*(?:"([^"<]*)"|'([^'<]*)')(?:\s+|$)/.exec(n);
2205
- if (i === null || t.has(i[1])) return /* @__PURE__ */ new Map();
2206
- let o = (i[2] ?? i[3]).replace(/&(#x[0-9a-fA-F]+|#\d+|amp|lt|gt|quot|apos);/g, (a, s) => s.startsWith("#x") ? String.fromCodePoint(parseInt(s.slice(2), 16)) : s.startsWith("#") ? String.fromCodePoint(Number(s.slice(1))) : r[s]);
2207
- t.set(i[1], o), n = n.slice(i[0].length);
2208
- }
2209
- return t;
2210
- }
2211
- var Ut = /* @__PURE__ */ new WeakMap();
2212
- function en(e) {
2213
- let t = Ut.get(e);
2214
- if (t === void 0) {
2215
- let n = e.createElement("div");
2216
- n.innerHTML = '<?probe x="1"?>', t = n.firstChild?.nodeType === 7, Ut.set(e, t);
2217
- }
2218
- return t;
2219
- }
2220
- function Wt(e) {
2221
- if (e.nodeType === 7) {
2222
- let n = e;
2223
- return { target: n.target, attributes: qt(n.data) };
2224
- }
2225
- if (e.nodeType !== 8 || en(e.ownerDocument)) return;
2226
- let t = /^\?([A-Za-z][-A-Za-z0-9]*)(?:\s+([\s\S]*?))?\s*\??$/.exec(e.data);
2227
- return t === null ? void 0 : { target: t[1], attributes: qt(t[2] ?? "") };
2228
- }
2229
- function it(e, t = true) {
2230
- let n = [], r = /* @__PURE__ */ new Set(), i = (s, c) => {
2231
- for (let d = 0; d < s.length; d += 1) {
2232
- let u = s[d], l = Wt(u);
2233
- if (l?.target === "marker" && l.attributes.has("slot")) {
2234
- c.push({ slot: l.attributes.get("slot"), fallback: false, markers: [u], content: [] });
2235
- continue;
2236
- }
2237
- if (l?.target === "start") {
2238
- let m = 1, f = [], h;
2239
- for (d += 1; d < s.length; d += 1) {
2240
- let p = Wt(s[d]);
2241
- if (p?.target === "start") m += 1;
2242
- else if (p?.target === "end" && --m === 0) {
2243
- h = s[d];
2244
- break;
2245
- }
2246
- f.push(s[d]);
2247
- }
2248
- if (l.attributes.has("slot")) {
2249
- c.push({ slot: l.attributes.get("slot"), fallback: l.attributes.has("fallback"), markers: h ? [u, h] : [u], content: f });
2250
- for (let p of f) r.add(p);
2251
- } else i(f, c);
2252
- continue;
2253
- }
2254
- if (u instanceof Element) if (u !== e && u.hasAttribute("data-component-root")) {
2255
- let m = it(u, false);
2256
- for (let f of m?.ranges ?? []) i(f.content, c);
2257
- } else i(Array.from(u.childNodes), c);
2258
- }
2259
- };
2260
- i(Array.from(e.childNodes), n);
2261
- let o = Array.from(e.children).find((s) => s instanceof HTMLTemplateElement && !s.hasAttribute("data-component") && !r.has(s));
2262
- if (n.length === 0 && o === void 0) return;
2263
- let a = [];
2264
- if (o !== void 0 && t) {
2265
- for (let s of Array.from(o.content.childNodes)) a.push(e.ownerDocument.adoptNode(s));
2266
- o.remove();
2267
- } else o !== void 0 && a.push(...Array.from(o.content.childNodes));
2268
- return { ranges: n, carried: a };
2269
- }
2270
- function Dr(e) {
2271
- let t = e.cloneNode(true), n = [e, ...Array.from(e.querySelectorAll("*"))], r = [t, ...Array.from(t.querySelectorAll("*"))];
2272
- return n.forEach((i, o) => {
2273
- let a = L(i)?.projection;
2274
- if (a === void 0) return;
2275
- let s = a.nodes.filter((d) => !i.contains(d));
2276
- if (s.length === 0) return;
2277
- let c = t.ownerDocument.createElement("template");
2278
- for (let d of s) c.content.append(d.cloneNode(true));
2279
- r[o].append(c);
2280
- }), t.innerHTML;
2281
- }
2282
- function Pr(e) {
2283
- let t = L(e);
2284
- if (t === void 0) return;
2285
- let n = {};
2286
- for (let o of Object.keys(t.definition.contract.props)) n[o] = t.scope.get(o);
2287
- let r = {};
2288
- for (let o of t.projection?.nodes ?? []) {
2289
- let a = t.projection.slotNames.get(o) ?? (o instanceof Element ? o.getAttribute("slot") ?? "" : "");
2290
- (r[a] ??= []).push(o instanceof Element ? o.outerHTML.replace(/ data-slotted=""/g, "") : o.textContent ?? "");
2291
- }
2292
- let i = Object.fromEntries(Object.entries(r).sort(([o], [a]) => o.localeCompare(a)));
2293
- return { tag: t.definition.contract.tag, explicit: [...t.explicit].sort(), props: n, slots: i };
2294
- }
2295
- function $e(e, t, n, r, i) {
2296
- if (e.kind === "text") {
2297
- let o = i instanceof Text ? i : n.createTextNode("");
2298
- return o.data = e.value, [o];
2299
- }
2300
- return e.kind === "slot" ? Mr(e, t, n, r) : Yt(e, t, n, [], r, i);
2301
- }
2302
- function jr(e, t) {
2303
- let n = t.definition.contract.props, r = {}, i = {};
2304
- for (let [u, l] of Object.entries(n)) {
2305
- let m = `data-${Y(u)}`;
2306
- r[m] = u;
2307
- let f = t.definition.template.attributes.some((h) => h.kind === "attribute" && h.name === m);
2308
- t.effects.push(ce(t.scope.scheduler, () => {
2309
- let h = t.scope.get(u);
2310
- if (!f && !t.explicit.has(u)) return;
2311
- let p = h === void 0 || h === T || h === null ? null : te(h, l.type);
2312
- i[m] = p, p === null ? e.removeAttribute(m) : e.setAttribute(m, p);
2313
- }, 2));
2314
- }
2315
- let o = e.ownerDocument.defaultView?.MutationObserver, a = Object.keys(r);
2316
- if (o === void 0 || a.length === 0) return;
2317
- let s = new o((u) => {
2318
- for (let l of u) {
2319
- let m = l.attributeName;
2320
- if (m === null) continue;
2321
- let f = r[m];
2322
- if (f === void 0) continue;
2323
- let h = e.getAttribute(m);
2324
- if (m in i && i[m] === h) {
2325
- delete i[m];
2326
- continue;
2327
- }
2328
- delete i[m];
2329
- let p = n[f];
2330
- h === null ? t.explicit.delete(f) : t.explicit.add(f), t.scope.set(f, h === null ? Bt(f, p, void 0) : rt(p, h, true));
2331
- }
2332
- }), c = () => s.observe(e, { attributes: true, attributeFilter: a }), d = () => s.disconnect();
2333
- t.connectCallbacks.add(c), t.disconnectCallbacks.add(d);
2334
- }
2335
- function Lr(e, t) {
2336
- for (let n of t.definition.declarations ?? []) n.kind === "method" && Object.defineProperty(e, n.name, { configurable: true, enumerable: false, value: (...r) => t.controllerModule === void 0 ? Promise.reject(new TypeError(`Controller method \`${n.name}\` is not ready for <${t.definition.contract.tag}>.`)) : t.controllerModule.then((i) => {
2337
- let o = i[n.exportName];
2338
- return typeof o != "function" && y("HJ003", `Controller does not export method \`${n.exportName}\`.`), Reflect.apply(o, void 0, [at(e), ...r]);
2339
- }) });
2340
- }
2341
- function tn(e, t, n, r, i = /* @__PURE__ */ new WeakMap(), o = false) {
2342
- let a = n && e.contains(e.ownerDocument.activeElement) ? e.ownerDocument.activeElement : null, s = a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement ? [a.selectionStart, a.selectionEnd] : void 0, { scope: c, passThrough: d, effects: u, rootName: l, explicit: m } = fr(e, t, n), f = r, h;
2343
- if (n && f === void 0) {
2344
- let g = it(e);
2345
- if (g !== void 0) {
2346
- h = g.ranges;
2347
- let k = [];
2348
- for (let C of g.ranges) if (!C.fallback) for (let $ of C.content) i.set($, C.slot), k.push($);
2349
- k.push(...g.carried), f = k;
2350
- } else ({ projected: f, projectedSlotNames: i } = an(e, t));
2351
- }
2352
- let p = n ? f : Array.from(e.childNodes), b = { definition: t, scope: c, refs: {}, effects: u, connectCallbacks: /* @__PURE__ */ new Set(), disconnectCallbacks: /* @__PURE__ */ new Set(), connected: false, explicit: m, frameworkOwned: o, projection: { nodes: n ? f : Array.from(e.childNodes), slotNames: i } }, x = { definition: t, effects: u, refs: b.refs, connectCallbacks: b.connectCallbacks, disconnectCallbacks: b.disconnectCallbacks, projectedNodes: p, projectedSlotNames: i, slotInsertions: [], rootName: l, frameworkOwned: o, committed: n, hydrationRanges: h }, E = Yt(t.template, c, e.ownerDocument, d, x, n ? e : void 0);
2353
- x.hydrationRanges = void 0;
2354
- let v = E[0];
2355
- return n && v !== e && y("HR005", `Server markup for <${t.contract.tag}> has an incompatible root.`), a instanceof HTMLElement && (a.focus({ preventScroll: true }), s !== void 0 && (a instanceof HTMLInputElement || a instanceof HTMLTextAreaElement) && typeof s[0] == "number" && typeof s[1] == "number" && a.setSelectionRange(s[0], s[1])), et(v, t.contract.tag), b.element = v, { invocation: e, nativeRoot: v, context: x, definition: t, instance: b, replace: !n };
2356
- }
2357
- function nn(e, t) {
2358
- t.sort((n, r) => n.invocation.contains(r.invocation) ? -1 : r.invocation.contains(n.invocation) ? 1 : 0);
2359
- for (let n of t) {
2360
- for (let r of n.context.slotInsertions) {
2361
- for (let i of r.nodes) le(i);
2362
- r.anchor.replaceWith(...r.nodes);
2363
- }
2364
- n.replace && n.invocation.replaceWith(n.nativeRoot), n.context.committed = true, nt.set(n.nativeRoot, n.instance), jr(n.nativeRoot, n.instance), Lr(n.nativeRoot, n.instance), st(n.instance);
2365
- }
2366
- }
2367
- function Ft(e, t, n) {
2368
- e.nodeType === 1 && e.matches(t) && n.add(e);
2369
- for (let r of e.querySelectorAll(t)) n.add(r);
2370
- }
2371
- function rn(e, t) {
2372
- let n = e.nodeType === 1 ? e : void 0;
2373
- if (n?.matches("[data-component-root]") === true && t(n), n?.childElementCount !== 0) for (let r of e.querySelectorAll("[data-component-root]")) t(r);
2374
- }
2375
- function on(e, t, n) {
2376
- let r = me(e), i = /* @__PURE__ */ new Set(), o = cr(r);
2377
- for (let f of t) Ft(f, o, i);
2378
- let a = [];
2379
- for (let f of i) f.localName === "template" && f.hasAttribute("component") && !Ne.has(f) && a.push(dr(f, a.length));
2380
- let s = /* @__PURE__ */ new Map();
2381
- for (let f of a) {
2382
- let h = f.definition.contract.tag;
2383
- (r.definitions.has(h) || s.has(h)) && y("HR001", `More than one definition declares <${h}>.`), s.set(h, f);
2384
- }
2385
- let c = [], d = /* @__PURE__ */ new Set(), u = (f, h, p) => {
2386
- let { definition: b } = f;
2387
- return Ne.has(h) || e.defaultView?.customElements.get(b.contract.tag) !== void 0 || n?.(h, b, p) === false ? false : (c.push(tn(h, b, p)), true);
2388
- }, l = (f, h) => {
2389
- for (let p of h) {
2390
- let b = f.get(p.localName);
2391
- if (b !== void 0 && u(b, p, false), !p.hasAttribute("data-component-root")) continue;
2392
- let x = L(p);
2393
- if (x !== void 0) {
2394
- x.frameworkOwned || d.add(p);
2395
- continue;
2396
- }
2397
- let E = false;
2398
- for (let v of new Set((p.getAttribute("data-component-root") ?? "").split(/\s+/))) {
2399
- let g = f.get(v);
2400
- g !== void 0 && u(g, p, true) && (E = true);
2401
- }
2402
- E && d.add(p);
2403
- }
2404
- };
2405
- if (l(r.definitions, i), s.size > 0) {
2406
- let f = ["[data-component-root]", ...Array.from(s.keys())].join(","), h = /* @__PURE__ */ new Set();
2407
- Ft(e, f, h), l(s, h);
2408
- }
2409
- for (let f of a) He(r, f.definition.contract.tag, f), f.style !== void 0 && (f.style.textContent = Se(f.style.textContent ?? "", f.definition.contract.tag, f.definition.template.name), f.wrapper.ownerDocument.head.append(f.style)), f.wrapper.remove();
2410
- nn(r, c);
2411
- let m = c.map((f) => f.nativeRoot);
2412
- for (let f of m) d.add(f);
2413
- return { lowered: m, roots: Array.from(d) };
2414
- }
2415
- function Or(e = document) {
2416
- return on(e, [e]).lowered.length;
2417
- }
2418
- function sn(e, t) {
2419
- let n = pe(e), r = n.mutationHub;
2420
- if (r === void 0) {
2421
- let o = e.defaultView?.MutationObserver;
2422
- o === void 0 && y("HR003", "Automatic component management requires a browser MutationObserver.");
2423
- let a = /* @__PURE__ */ new Set(), s = new o((c) => {
2424
- for (let d of Array.from(a)) d(c);
2425
- });
2426
- r = { observer: s, subscribers: a }, n.mutationHub = r, s.observe(e, { childList: true, subtree: true });
2427
- }
2428
- r.subscribers.add(t);
2429
- let i = true;
2430
- return () => {
2431
- i && (i = false, r.subscribers.delete(t), r.subscribers.size === 0 && (r.observer.disconnect(), delete n.mutationHub));
2432
- };
2433
- }
2434
- function Ir(e) {
2435
- let t = pe(e), n = t.lifecycle;
2436
- if (n !== void 0) return n;
2437
- let r = 0, i = (s) => {
2438
- let c = s[Z];
2439
- c !== void 0 && (s.isConnected && c.disconnect === void 0 ? c.disconnect = c.connect(s) : !s.isConnected && c.disconnect !== void 0 && (c.disconnect(), c.disconnect = void 0));
2440
- }, o = sn(e, (s) => {
2441
- let c = [], d = (u) => {
2442
- if (u.nodeType !== 1) return;
2443
- let l = u;
2444
- l[Z] !== void 0 && c.push(l), rn(l, (m) => {
2445
- m[Z] !== void 0 && c.push(m);
2446
- });
2447
- };
2448
- for (let u of s) {
2449
- for (let l of u.addedNodes) d(l);
2450
- for (let l of u.removedNodes) d(l);
2451
- }
2452
- for (let u of c) i(u);
2453
- }), a = { add(s, c) {
2454
- let d = s, u = d[Z];
2455
- u !== c && (u?.disconnect?.(), u === void 0 && (r += 1), d[Z] = c, i(s));
2456
- }, remove(s, c) {
2457
- let d = s;
2458
- d[Z] === c && (c.disconnect?.(), delete d[Z], r -= 1, r === 0 && (o(), delete t.lifecycle));
2459
- } };
2460
- return t.lifecycle = a, a;
2461
- }
2462
- function Vr(e, t, n = {}) {
2463
- let r = Ir(e.ownerDocument), i = { connect: (a) => ot(a, t, n), disconnect: void 0 };
2464
- r.add(e, i);
2465
- let o = false;
2466
- return () => {
2467
- o || (o = true, r.remove(e, i));
2468
- };
2469
- }
2470
- function zr(e, t = document) {
2471
- let n = me(t);
2472
- for (let r of e) {
2473
- let i = n.definitions.get(r.contract.tag);
2474
- if (i !== void 0) {
2475
- JSON.stringify(i.definition) !== JSON.stringify(r) && y("HR001", `More than one definition declares <${r.contract.tag}>.`);
2476
- continue;
2477
- }
2478
- if (He(n, r.contract.tag, { definition: r, style: void 0 }), r.css !== "") {
2479
- let o = t.createElement("style");
2480
- o.dataset.htmlNextPackage = r.contract.tag, o.textContent = Se(r.css, r.contract.tag, r.template.name), t.head.append(o);
2481
- }
2482
- }
2483
- }
2484
- function an(e, t) {
2485
- let n = [], r = /* @__PURE__ */ new WeakMap(), i = (o, a) => {
2486
- let s = a.children.filter((p) => p.kind === "slot"), c = s[0], d = c?.name ?? "", u = s.some((p) => (p.name ?? "") === "") ? "" : d, l = a.children.filter((p) => p.kind === "text").map((p) => p.value), m = 0, f = a.children.filter((p) => p.kind === "element"), h = 0;
2487
- for (let p of Array.from(o.childNodes)) {
2488
- if (p instanceof Element) {
2489
- let b = p.getAttribute("data-component")?.split(/\s+/) ?? [], x = (p.getAttribute("data-component-root") ?? "").split(/\s+/);
2490
- for (; h < f.length && f[h].name !== p.localName && !x.includes(f[h].name); ) h += 1;
2491
- let E = f[h], v = E !== void 0 && p.localName !== E.name && x.includes(E.name);
2492
- !b.includes(t.contract.tag) && !v ? (r.set(p, p.getAttribute("slot") ?? d), le(p), n.push(p)) : (h += 1, E !== void 0 && !v && i(p, E));
2493
- continue;
2494
- }
2495
- if (p instanceof Comment && c !== void 0) {
2496
- r.set(p, d), n.push(p);
2497
- continue;
2498
- }
2499
- if (p instanceof Text && p.data.trim() !== "") {
2500
- for (; m < l.length && l[m] !== p.data; ) m += 1;
2501
- m < l.length ? m += 1 : (r.set(p, u), n.push(p));
2502
- }
2503
- }
2504
- };
2505
- return i(e, t.template), { projected: n, projectedSlotNames: r };
2506
- }
2507
- function ot(e, t, n = {}) {
2508
- let r = e.ownerDocument, i = me(r), o = i.definitions.get(t.contract.tag);
2509
- o === void 0 ? He(i, t.contract.tag, { definition: t, style: void 0 }) : JSON.stringify(o.definition) !== JSON.stringify(t) && y("HR001", `More than one definition declares <${t.contract.tag}>.`);
2510
- let a = L(e);
2511
- if (a !== void 0 && !a.frameworkOwned && (pe(r).release?.(e), Ae(a), nt.delete(e)), L(e) === void 0) {
2512
- let { projected: l, projectedSlotNames: m } = an(e, t);
2513
- de(e, t.contract.tag), et(e, t.contract.tag);
2514
- for (let [f, h] of Object.entries(t.contract.props)) {
2515
- let p = n.props?.[f];
2516
- p != null && e.setAttribute(`data-${Y(f)}`, te(p, h.type));
2517
- }
2518
- nn(i, [tn(e, t, true, l, m, true)]);
2519
- }
2520
- let c = L(e);
2521
- c === void 0 && y("HR005", `Could not attach <${t.contract.tag}> to its native root.`), cn(e, n.props ?? {}), st(c);
2522
- let d, u = false;
2523
- if (n.controller !== void 0) {
2524
- let l = Promise.resolve(n.controller);
2525
- dn(e, l), Promise.resolve(n.controller.default(at(e))).then((m) => {
2526
- typeof m == "function" && (u ? m() : d = m);
2527
- });
2528
- }
2529
- return () => {
2530
- u || (u = true, d?.(), Ae(c));
2531
- };
2532
- }
2533
- function cn(e, t) {
2534
- let n = L(e);
2535
- if (n !== void 0) for (let [r, i] of Object.entries(t)) {
2536
- let o = n.definition.contract.props[r];
2537
- if (o === void 0) continue;
2538
- let a = `data-${Y(r)}`, s = Bt(r, o, i);
2539
- i == null ? (n.explicit.delete(r), n.definition.template.attributes.some((d) => d.kind === "attribute" && d.name === a) || e.removeAttribute(a)) : (n.explicit.add(r), e.setAttribute(a, te(i, o.type))), Object.is(n.scope.get(r), s) || n.scope.set(r, s);
2540
- }
2541
- }
2542
- function _r(e, t, n = {}) {
2543
- let r = me(e.ownerDocument).definitions.get(t);
2544
- return r === void 0 && y("HR005", `No registered definition declares <${t}>.`), ot(e, r.definition, n);
2545
- }
2546
- function st(e) {
2547
- if (!e.connected) {
2548
- e.connected = true;
2549
- for (let t of e.effects) t.resume();
2550
- for (let t of e.connectCallbacks) t();
2551
- e.element?.dispatchEvent(new Event("connect"));
2552
- }
2553
- }
2554
- function Ae(e) {
2555
- if (e.connected) {
2556
- e.element?.dispatchEvent(new Event("disconnect"));
2557
- for (let t of e.disconnectCallbacks) t();
2558
- e.connected = false;
2559
- for (let t of e.effects) t.pause();
2560
- }
2561
- }
2562
- function at(e) {
2563
- let t = L(e);
2564
- if (t === void 0) return;
2565
- if (t.host !== void 0) return t.host;
2566
- let n = new Set((t.definition.declarations ?? []).filter((a) => a.kind === "state").map((a) => a.name)), r = new Proxy({}, { get: (a, s) => {
2567
- if (typeof s != "string") return;
2568
- let c = t.scope.get(s);
2569
- return c === T ? void 0 : c;
2570
- }, set: (a, s, c) => {
2571
- if (typeof s != "string" || !n.has(s)) throw new TypeError(`Only declared state roots are writable; \`${String(s)}\` is read-only.`);
2572
- return t.scope.set(s, c), true;
2573
- }, has: (a, s) => typeof s == "string" && t.scope.has(s) }), i = new Proxy({}, { get: (a, s) => typeof s != "string" ? void 0 : (e instanceof HTMLFormElement ? e : e.querySelector("form"))?.elements.namedItem(s) ?? e.querySelector(`[name="${CSS.escape(s)}"]`) ?? void 0 }), o = { element: e, state: r, refs: t.refs, elements: i, signal(a) {
2574
- return Ht(a);
2575
- }, computed(a) {
2576
- let s = Mt(t.scope.scheduler, a);
2577
- return t.connected || s.pause(), t.effects.unshift(s), s;
2578
- }, effect(a) {
2579
- let s = ce(t.scope.scheduler, a, 2, t.connected);
2580
- return t.effects.push(s), () => s.stop();
2581
- }, on(a, s) {
2582
- if (a === "connect") {
2583
- let c = s;
2584
- return t.connectCallbacks.add(c), t.connected && s(), () => t.connectCallbacks.delete(c);
2585
- }
2586
- if (a === "disconnect") {
2587
- let c = s;
2588
- return t.disconnectCallbacks.add(c), () => t.disconnectCallbacks.delete(c);
2589
- }
2590
- return e.addEventListener(a, s), () => e.removeEventListener(a, s);
2591
- }, dispatch(a, s) {
2592
- return Gt(e, a, s, Jt(t.definition, a));
2593
- } };
2594
- return t.host = Object.freeze(o), t.host;
2595
- }
2596
- function dn(e, t) {
2597
- let n = L(e);
2598
- n === void 0 && y("HJ003", "A controller can attach only to a lowered component root."), n.controllerModule = t;
2599
- }
2600
- function qr(e = document, t = {}) {
2601
- let n = pe(e);
2602
- n.observer !== void 0 && y("HR003", "This document is already being observed.");
2603
- let r = /* @__PURE__ */ new Map(), i = t.onError ?? ((l) => console.error(l)), o = false, a = (l) => {
2604
- let m = r.get(l);
2605
- r.delete(l);
2606
- let f = L(l);
2607
- f !== void 0 && Ae(f);
2608
- try {
2609
- m?.();
2610
- } catch (h) {
2611
- i(h);
2612
- }
2613
- }, s = (l) => {
2614
- let m = L(l);
2615
- if (!(m === void 0 || m.frameworkOwned || r.has(l) || !e.contains(l))) {
2616
- r.set(l, void 0);
2617
- try {
2618
- st(m);
2619
- let f = t.onConnect?.(l, m.definition);
2620
- o ? f?.() : r.set(l, f);
2621
- } catch (f) {
2622
- i(f);
2623
- }
2624
- }
2625
- }, c = (l) => {
2626
- if (o) return;
2627
- let m = [];
2628
- if (l === void 0) m.push(e);
2629
- else {
2630
- let f = [];
2631
- for (let h of l) {
2632
- for (let p of h.removedNodes) p.nodeType === 1 && rn(p, (b) => {
2633
- r.has(b) && f.push(b);
2634
- });
2635
- for (let p of h.addedNodes) p.nodeType === 1 && m.push(p);
2636
- }
2637
- for (let h of f) e.contains(h) || a(h);
2638
- }
2639
- if (m.length > 0) try {
2640
- for (let f of on(e, m, t.shouldLower).roots) {
2641
- if (o) break;
2642
- s(f);
2643
- }
2644
- } catch (f) {
2645
- i(f);
2646
- }
2647
- };
2648
- n.release = (l) => {
2649
- r.has(l) && a(l);
2650
- };
2651
- let d = sn(e, c), u = () => {
2652
- if (!o) {
2653
- o = true, d(), delete n.observer, delete n.release;
2654
- for (let l of r.values()) try {
2655
- l?.();
2656
- } catch (m) {
2657
- i(m);
2658
- }
2659
- for (let l of r.keys()) {
2660
- let m = L(l);
2661
- m !== void 0 && Ae(m);
2662
- }
2663
- r.clear();
2664
- }
2665
- };
2666
- return n.observer = u, c(), u;
2667
- }
2668
- return hn(Ur);
2669
- })();
2670
- var { attachComponent, attachRegisteredComponent, getComponentHost, installComponentGraph, lowerDocument, manageComponentLifecycle, observeDocument, registerComponentDefinitions, serializeRenderedForm, setControllerModule, updateComponentProps } = HtmlRuntime;
2671
-
2672
- // src/declarative.ts
2673
- var stateKey = /* @__PURE__ */ Symbol.for("@threadlabs/looma.declarative.v1");
2674
- var stateTarget = globalThis;
2675
- var state = stateTarget[stateKey] ??= {
2676
- runtime: {
2677
- attachRegisteredComponent,
2678
- getComponentHost,
2679
- manageComponentLifecycle,
2680
- observeDocument,
2681
- setControllerModule,
2682
- updateComponentProps
2683
- },
2684
- records: /* @__PURE__ */ new Map(),
2685
- installedPackages: /* @__PURE__ */ new Set(),
2686
- stopObservation: void 0,
2687
- observationScheduled: false
2688
- };
2689
- function connectController(element, tag) {
2690
- const controller = state.records.get(tag)?.controller;
2691
- if (!controller?.default) return;
2692
- state.runtime.setControllerModule(element, Promise.resolve(controller));
2693
- return controller.default(state.runtime.getComponentHost(element));
2694
- }
2695
- function scheduleObservation() {
2696
- if (state.observationScheduled || typeof document === "undefined") return;
2697
- state.observationScheduled = true;
2698
- queueMicrotask(() => {
2699
- state.observationScheduled = false;
2700
- state.stopObservation?.();
2701
- state.stopObservation = state.runtime.observeDocument(document, {
2702
- onConnect(element, definition) {
2703
- return connectController(element, definition.contract.tag);
2704
- }
2705
- });
2706
- });
2707
- }
2708
- function registerLoomaPackage(name, packageRecords, styles) {
2709
- if (typeof document === "undefined" || state.installedPackages.has(name)) return;
2710
- state.stopObservation?.();
2711
- state.stopObservation = void 0;
2712
- state.installedPackages.add(name);
2713
- const definitions = document.createElement("div");
2714
- definitions.hidden = true;
2715
- definitions.dataset.loomaDefinitions = name;
2716
- definitions.innerHTML = packageRecords.map(({ source }) => source).join("\n");
2717
- document.head.append(...Array.from(definitions.children));
2718
- for (const record of packageRecords) state.records.set(record.tag, record);
2719
- if (styles !== "") {
2720
- const style = document.createElement("style");
2721
- style.dataset.loomaStyles = name;
2722
- style.textContent = styles;
2723
- document.head.append(style);
2724
- }
2725
- scheduleObservation();
2726
- }
2727
- function attachLoomaComponent(element, definition, tag, props) {
2728
- if (definition.contract.tag !== tag) {
2729
- throw new TypeError(`Looma definition ${definition.contract.tag} cannot attach as ${tag}.`);
2730
- }
2731
- const controller = state.records.get(tag)?.controller;
2732
- return state.runtime.attachRegisteredComponent(element, tag, { props, controller });
2733
- }
2734
- function updateComponentProps2(element, props) {
2735
- (state.runtime.updateComponentProps ?? updateComponentProps)(element, props);
2736
- }
2737
- function controllerFor(tag) {
2738
- return state.records.get(tag)?.controller;
2739
- }
2740
- function manageComponentLifecycle2(...args) {
2741
- return state.runtime.manageComponentLifecycle(...args);
2742
- }
2743
- // Annotate the CommonJS export names for ESM import in node:
2744
- 0 && (module.exports = {
2745
- attachLoomaComponent,
2746
- controllerFor,
2747
- manageComponentLifecycle,
2748
- registerLoomaPackage,
2749
- updateComponentProps
2750
- });