@ukho/admiralty-core 0.0.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 (637) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/dist/admiralty/admiralty.esm.js +2 -0
  4. package/dist/admiralty/admiralty.esm.js.map +1 -0
  5. package/dist/admiralty/index.esm.js +2 -0
  6. package/dist/admiralty/index.esm.js.map +1 -0
  7. package/dist/admiralty/p-01cb7adb.entry.js +2 -0
  8. package/dist/admiralty/p-01cb7adb.entry.js.map +1 -0
  9. package/dist/admiralty/p-05415353.entry.js +2 -0
  10. package/dist/admiralty/p-05415353.entry.js.map +1 -0
  11. package/dist/admiralty/p-08baadfe.entry.js +2 -0
  12. package/dist/admiralty/p-08baadfe.entry.js.map +1 -0
  13. package/dist/admiralty/p-1156fb5a.entry.js +2 -0
  14. package/dist/admiralty/p-1156fb5a.entry.js.map +1 -0
  15. package/dist/admiralty/p-1597c067.entry.js +2 -0
  16. package/dist/admiralty/p-1597c067.entry.js.map +1 -0
  17. package/dist/admiralty/p-18cff2de.js +2 -0
  18. package/dist/admiralty/p-18cff2de.js.map +1 -0
  19. package/dist/admiralty/p-1e0fcbb0.entry.js +2 -0
  20. package/dist/admiralty/p-1e0fcbb0.entry.js.map +1 -0
  21. package/dist/admiralty/p-281fb779.entry.js +2 -0
  22. package/dist/admiralty/p-281fb779.entry.js.map +1 -0
  23. package/dist/admiralty/p-31b52c40.entry.js +2 -0
  24. package/dist/admiralty/p-31b52c40.entry.js.map +1 -0
  25. package/dist/admiralty/p-33b7244b.entry.js +2 -0
  26. package/dist/admiralty/p-33b7244b.entry.js.map +1 -0
  27. package/dist/admiralty/p-34cbc7a1.entry.js +2 -0
  28. package/dist/admiralty/p-34cbc7a1.entry.js.map +1 -0
  29. package/dist/admiralty/p-3c9dee38.entry.js +2 -0
  30. package/dist/admiralty/p-3c9dee38.entry.js.map +1 -0
  31. package/dist/admiralty/p-3dfc9fc0.entry.js +2 -0
  32. package/dist/admiralty/p-3dfc9fc0.entry.js.map +1 -0
  33. package/dist/admiralty/p-52cb5c3d.entry.js +2 -0
  34. package/dist/admiralty/p-52cb5c3d.entry.js.map +1 -0
  35. package/dist/admiralty/p-573407ef.entry.js +2 -0
  36. package/dist/admiralty/p-573407ef.entry.js.map +1 -0
  37. package/dist/admiralty/p-61a86783.entry.js +2 -0
  38. package/dist/admiralty/p-61a86783.entry.js.map +1 -0
  39. package/dist/admiralty/p-6293fffb.entry.js +2 -0
  40. package/dist/admiralty/p-6293fffb.entry.js.map +1 -0
  41. package/dist/admiralty/p-69e7a596.entry.js +2 -0
  42. package/dist/admiralty/p-69e7a596.entry.js.map +1 -0
  43. package/dist/admiralty/p-6b102dd7.entry.js +2 -0
  44. package/dist/admiralty/p-6b102dd7.entry.js.map +1 -0
  45. package/dist/admiralty/p-80c03397.entry.js +2 -0
  46. package/dist/admiralty/p-80c03397.entry.js.map +1 -0
  47. package/dist/admiralty/p-914567f9.entry.js +2 -0
  48. package/dist/admiralty/p-914567f9.entry.js.map +1 -0
  49. package/dist/admiralty/p-96a33adb.entry.js +2 -0
  50. package/dist/admiralty/p-96a33adb.entry.js.map +1 -0
  51. package/dist/admiralty/p-aa03be54.entry.js +2 -0
  52. package/dist/admiralty/p-aa03be54.entry.js.map +1 -0
  53. package/dist/admiralty/p-bbe4dd68.entry.js +2 -0
  54. package/dist/admiralty/p-bbe4dd68.entry.js.map +1 -0
  55. package/dist/admiralty/p-c63b9703.entry.js +2 -0
  56. package/dist/admiralty/p-c63b9703.entry.js.map +1 -0
  57. package/dist/admiralty/p-c7dd53e5.js +2 -0
  58. package/dist/admiralty/p-c7dd53e5.js.map +1 -0
  59. package/dist/admiralty/p-c9625a50.entry.js +2 -0
  60. package/dist/admiralty/p-c9625a50.entry.js.map +1 -0
  61. package/dist/admiralty/p-d23537cc.entry.js +2 -0
  62. package/dist/admiralty/p-d23537cc.entry.js.map +1 -0
  63. package/dist/admiralty/p-d5680d2f.entry.js +2 -0
  64. package/dist/admiralty/p-d5680d2f.entry.js.map +1 -0
  65. package/dist/admiralty/p-da4c6170.entry.js +2 -0
  66. package/dist/admiralty/p-da4c6170.entry.js.map +1 -0
  67. package/dist/admiralty/p-dae5bfda.entry.js +2 -0
  68. package/dist/admiralty/p-dae5bfda.entry.js.map +1 -0
  69. package/dist/admiralty/p-de48be42.entry.js +2 -0
  70. package/dist/admiralty/p-de48be42.entry.js.map +1 -0
  71. package/dist/admiralty/p-e1457fd2.entry.js +2 -0
  72. package/dist/admiralty/p-e1457fd2.entry.js.map +1 -0
  73. package/dist/admiralty/p-e1680782.js +3 -0
  74. package/dist/admiralty/p-e1680782.js.map +1 -0
  75. package/dist/admiralty/p-e5f9308a.entry.js +2 -0
  76. package/dist/admiralty/p-e5f9308a.entry.js.map +1 -0
  77. package/dist/admiralty/p-e7bb0eca.entry.js +2 -0
  78. package/dist/admiralty/p-e7bb0eca.entry.js.map +1 -0
  79. package/dist/admiralty/p-eba5b551.entry.js +2 -0
  80. package/dist/admiralty/p-eba5b551.entry.js.map +1 -0
  81. package/dist/admiralty/p-eefe699d.entry.js +2 -0
  82. package/dist/admiralty/p-eefe699d.entry.js.map +1 -0
  83. package/dist/admiralty/p-f049a682.entry.js +2 -0
  84. package/dist/admiralty/p-f049a682.entry.js.map +1 -0
  85. package/dist/admiralty/p-f268e1dd.entry.js +2 -0
  86. package/dist/admiralty/p-f268e1dd.entry.js.map +1 -0
  87. package/dist/admiralty/p-f9815502.entry.js +2 -0
  88. package/dist/admiralty/p-f9815502.entry.js.map +1 -0
  89. package/dist/admiralty/p-ffb0dae5.entry.js +2 -0
  90. package/dist/admiralty/p-ffb0dae5.entry.js.map +1 -0
  91. package/dist/admiralty/p-ffe3ca07.entry.js +2 -0
  92. package/dist/admiralty/p-ffe3ca07.entry.js.map +1 -0
  93. package/dist/cjs/admiralty-breadcrumb.cjs.entry.js +25 -0
  94. package/dist/cjs/admiralty-breadcrumb.cjs.entry.js.map +1 -0
  95. package/dist/cjs/admiralty-breadcrumbs.cjs.entry.js +48 -0
  96. package/dist/cjs/admiralty-breadcrumbs.cjs.entry.js.map +1 -0
  97. package/dist/cjs/admiralty-button.cjs.entry.js +26 -0
  98. package/dist/cjs/admiralty-button.cjs.entry.js.map +1 -0
  99. package/dist/cjs/admiralty-card.cjs.entry.js +22 -0
  100. package/dist/cjs/admiralty-card.cjs.entry.js.map +1 -0
  101. package/dist/cjs/admiralty-checkbox.cjs.entry.js +54 -0
  102. package/dist/cjs/admiralty-checkbox.cjs.entry.js.map +1 -0
  103. package/dist/cjs/admiralty-colour-block.cjs.entry.js +37 -0
  104. package/dist/cjs/admiralty-colour-block.cjs.entry.js.map +1 -0
  105. package/dist/cjs/admiralty-dialogue.cjs.entry.js +39 -0
  106. package/dist/cjs/admiralty-dialogue.cjs.entry.js.map +1 -0
  107. package/dist/cjs/admiralty-expansion.cjs.entry.js +42 -0
  108. package/dist/cjs/admiralty-expansion.cjs.entry.js.map +1 -0
  109. package/dist/cjs/admiralty-file-input.cjs.entry.js +89 -0
  110. package/dist/cjs/admiralty-file-input.cjs.entry.js.map +1 -0
  111. package/dist/cjs/admiralty-filter-group.cjs.entry.js +22 -0
  112. package/dist/cjs/admiralty-filter-group.cjs.entry.js.map +1 -0
  113. package/dist/cjs/admiralty-filter.cjs.entry.js +32 -0
  114. package/dist/cjs/admiralty-filter.cjs.entry.js.map +1 -0
  115. package/dist/cjs/admiralty-footer.cjs.entry.js +25 -0
  116. package/dist/cjs/admiralty-footer.cjs.entry.js.map +1 -0
  117. package/dist/cjs/admiralty-header-menu-item.cjs.entry.js +63 -0
  118. package/dist/cjs/admiralty-header-menu-item.cjs.entry.js.map +1 -0
  119. package/dist/cjs/admiralty-header-profile.cjs.entry.js +44 -0
  120. package/dist/cjs/admiralty-header-profile.cjs.entry.js.map +1 -0
  121. package/dist/cjs/admiralty-header-sub-menu-item.cjs.entry.js +28 -0
  122. package/dist/cjs/admiralty-header-sub-menu-item.cjs.entry.js.map +1 -0
  123. package/dist/cjs/admiralty-header.cjs.entry.js +32 -0
  124. package/dist/cjs/admiralty-header.cjs.entry.js.map +1 -0
  125. package/dist/cjs/admiralty-hint_3.cjs.entry.js +51 -0
  126. package/dist/cjs/admiralty-hint_3.cjs.entry.js.map +1 -0
  127. package/dist/cjs/admiralty-hr.cjs.entry.js +21 -0
  128. package/dist/cjs/admiralty-hr.cjs.entry.js.map +1 -0
  129. package/dist/cjs/admiralty-icon.cjs.entry.js +7045 -0
  130. package/dist/cjs/admiralty-icon.cjs.entry.js.map +1 -0
  131. package/dist/cjs/admiralty-input.cjs.entry.js +62 -0
  132. package/dist/cjs/admiralty-input.cjs.entry.js.map +1 -0
  133. package/dist/cjs/admiralty-link.cjs.entry.js +20 -0
  134. package/dist/cjs/admiralty-link.cjs.entry.js.map +1 -0
  135. package/dist/cjs/admiralty-paginator-wrapper.cjs.entry.js +32 -0
  136. package/dist/cjs/admiralty-paginator-wrapper.cjs.entry.js.map +1 -0
  137. package/dist/cjs/admiralty-paginator.cjs.entry.js +46 -0
  138. package/dist/cjs/admiralty-paginator.cjs.entry.js.map +1 -0
  139. package/dist/cjs/admiralty-phase-banner.cjs.entry.js +23 -0
  140. package/dist/cjs/admiralty-phase-banner.cjs.entry.js.map +1 -0
  141. package/dist/cjs/admiralty-progress-bar.cjs.entry.js +28 -0
  142. package/dist/cjs/admiralty-progress-bar.cjs.entry.js.map +1 -0
  143. package/dist/cjs/admiralty-radio-group.cjs.entry.js +71 -0
  144. package/dist/cjs/admiralty-radio-group.cjs.entry.js.map +1 -0
  145. package/dist/cjs/admiralty-radio.cjs.entry.js +64 -0
  146. package/dist/cjs/admiralty-radio.cjs.entry.js.map +1 -0
  147. package/dist/cjs/admiralty-select.cjs.entry.js +61 -0
  148. package/dist/cjs/admiralty-select.cjs.entry.js.map +1 -0
  149. package/dist/cjs/admiralty-side-nav-item.cjs.entry.js +39 -0
  150. package/dist/cjs/admiralty-side-nav-item.cjs.entry.js.map +1 -0
  151. package/dist/cjs/admiralty-side-nav-wrapper.cjs.entry.js +27 -0
  152. package/dist/cjs/admiralty-side-nav-wrapper.cjs.entry.js.map +1 -0
  153. package/dist/cjs/admiralty-side-nav.cjs.entry.js +22 -0
  154. package/dist/cjs/admiralty-side-nav.cjs.entry.js.map +1 -0
  155. package/dist/cjs/admiralty-table-body.cjs.entry.js +21 -0
  156. package/dist/cjs/admiralty-table-body.cjs.entry.js.map +1 -0
  157. package/dist/cjs/admiralty-table-cell.cjs.entry.js +21 -0
  158. package/dist/cjs/admiralty-table-cell.cjs.entry.js.map +1 -0
  159. package/dist/cjs/admiralty-table-header-cell.cjs.entry.js +21 -0
  160. package/dist/cjs/admiralty-table-header-cell.cjs.entry.js.map +1 -0
  161. package/dist/cjs/admiralty-table-header.cjs.entry.js +21 -0
  162. package/dist/cjs/admiralty-table-header.cjs.entry.js.map +1 -0
  163. package/dist/cjs/admiralty-table-row.cjs.entry.js +21 -0
  164. package/dist/cjs/admiralty-table-row.cjs.entry.js.map +1 -0
  165. package/dist/cjs/admiralty-table.cjs.entry.js +22 -0
  166. package/dist/cjs/admiralty-table.cjs.entry.js.map +1 -0
  167. package/dist/cjs/admiralty-textarea.cjs.entry.js +38 -0
  168. package/dist/cjs/admiralty-textarea.cjs.entry.js.map +1 -0
  169. package/dist/cjs/admiralty-type-ahead-item.cjs.entry.js +22 -0
  170. package/dist/cjs/admiralty-type-ahead-item.cjs.entry.js.map +1 -0
  171. package/dist/cjs/admiralty-type-ahead.cjs.entry.js +185 -0
  172. package/dist/cjs/admiralty-type-ahead.cjs.entry.js.map +1 -0
  173. package/dist/cjs/admiralty.cjs.js +28 -0
  174. package/dist/cjs/admiralty.cjs.js.map +1 -0
  175. package/dist/cjs/button.types-0549d311.js +12 -0
  176. package/dist/cjs/button.types-0549d311.js.map +1 -0
  177. package/dist/cjs/index-18b58c3d.js +9484 -0
  178. package/dist/cjs/index-18b58c3d.js.map +1 -0
  179. package/dist/cjs/index-9db1e550.js +1971 -0
  180. package/dist/cjs/index-9db1e550.js.map +1 -0
  181. package/dist/cjs/index.cjs.js +4 -0
  182. package/dist/cjs/index.cjs.js.map +1 -0
  183. package/dist/cjs/loader.cjs.js +24 -0
  184. package/dist/cjs/loader.cjs.js.map +1 -0
  185. package/dist/collection/assets/svg/Admiralty linear logo.svg +373 -0
  186. package/dist/collection/assets/svg/Admiralty stacked logo.svg +1275 -0
  187. package/dist/collection/assets/svg/AdmiraltyUKHO linear logo.svg +3350 -0
  188. package/dist/collection/assets/svg/UKHO linear logo.svg +3526 -0
  189. package/dist/collection/assets/svg/UKHO stacked logo.svg +2985 -0
  190. package/dist/collection/collection-manifest.json +53 -0
  191. package/dist/collection/components/breadcrumb/breadcrumb.css +89 -0
  192. package/dist/collection/components/breadcrumb/breadcrumb.js +84 -0
  193. package/dist/collection/components/breadcrumb/breadcrumb.js.map +1 -0
  194. package/dist/collection/components/breadcrumbs/breadcrumbs.css +25 -0
  195. package/dist/collection/components/breadcrumbs/breadcrumbs.js +48 -0
  196. package/dist/collection/components/breadcrumbs/breadcrumbs.js.map +1 -0
  197. package/dist/collection/components/button/button.css +384 -0
  198. package/dist/collection/components/button/button.js +109 -0
  199. package/dist/collection/components/button/button.js.map +1 -0
  200. package/dist/collection/components/button/button.types.js +9 -0
  201. package/dist/collection/components/button/button.types.js.map +1 -0
  202. package/dist/collection/components/card/card.css +101 -0
  203. package/dist/collection/components/card/card.js +42 -0
  204. package/dist/collection/components/card/card.js.map +1 -0
  205. package/dist/collection/components/checkbox/checkbox.css +72 -0
  206. package/dist/collection/components/checkbox/checkbox.js +222 -0
  207. package/dist/collection/components/checkbox/checkbox.js.map +1 -0
  208. package/dist/collection/components/colour-block/colour-block.css +53 -0
  209. package/dist/collection/components/colour-block/colour-block.js +141 -0
  210. package/dist/collection/components/colour-block/colour-block.js.map +1 -0
  211. package/dist/collection/components/dialogue/dialogue.css +105 -0
  212. package/dist/collection/components/dialogue/dialogue.js +78 -0
  213. package/dist/collection/components/dialogue/dialogue.js.map +1 -0
  214. package/dist/collection/components/expansion/expansion.css +75 -0
  215. package/dist/collection/components/expansion/expansion.js +133 -0
  216. package/dist/collection/components/expansion/expansion.js.map +1 -0
  217. package/dist/collection/components/file-input/file-input.css +78 -0
  218. package/dist/collection/components/file-input/file-input.js +155 -0
  219. package/dist/collection/components/file-input/file-input.js.map +1 -0
  220. package/dist/collection/components/filter/filter.css +277 -0
  221. package/dist/collection/components/filter/filter.js +88 -0
  222. package/dist/collection/components/filter/filter.js.map +1 -0
  223. package/dist/collection/components/filter-group/filter-group.css +0 -0
  224. package/dist/collection/components/filter-group/filter-group.js +46 -0
  225. package/dist/collection/components/filter-group/filter-group.js.map +1 -0
  226. package/dist/collection/components/footer/footer.css +61 -0
  227. package/dist/collection/components/footer/footer.js +104 -0
  228. package/dist/collection/components/footer/footer.js.map +1 -0
  229. package/dist/collection/components/header/header.css +113 -0
  230. package/dist/collection/components/header/header.js +145 -0
  231. package/dist/collection/components/header/header.js.map +1 -0
  232. package/dist/collection/components/header/header.stories.data.js +146 -0
  233. package/dist/collection/components/header/header.stories.data.js.map +1 -0
  234. package/dist/collection/components/header/header.types.js +2 -0
  235. package/dist/collection/components/header/header.types.js.map +1 -0
  236. package/dist/collection/components/header-menu-item/header-menu-item.css +53 -0
  237. package/dist/collection/components/header-menu-item/header-menu-item.js +122 -0
  238. package/dist/collection/components/header-menu-item/header-menu-item.js.map +1 -0
  239. package/dist/collection/components/header-profile/header-profile.css +81 -0
  240. package/dist/collection/components/header-profile/header-profile.js +148 -0
  241. package/dist/collection/components/header-profile/header-profile.js.map +1 -0
  242. package/dist/collection/components/header-sub-menu-item/header-sub-menu-item.css +35 -0
  243. package/dist/collection/components/header-sub-menu-item/header-sub-menu-item.js +66 -0
  244. package/dist/collection/components/header-sub-menu-item/header-sub-menu-item.js.map +1 -0
  245. package/dist/collection/components/hint/hint.css +26 -0
  246. package/dist/collection/components/hint/hint.js +47 -0
  247. package/dist/collection/components/hint/hint.js.map +1 -0
  248. package/dist/collection/components/horizontal-rule/horizontal-rule.css +23 -0
  249. package/dist/collection/components/horizontal-rule/horizontal-rule.js +18 -0
  250. package/dist/collection/components/horizontal-rule/horizontal-rule.js.map +1 -0
  251. package/dist/collection/components/icon/icon.css +15 -0
  252. package/dist/collection/components/icon/icon.js +79 -0
  253. package/dist/collection/components/icon/icon.js.map +1 -0
  254. package/dist/collection/components/input/input.css +58 -0
  255. package/dist/collection/components/input/input.interface.js +2 -0
  256. package/dist/collection/components/input/input.interface.js.map +1 -0
  257. package/dist/collection/components/input/input.js +308 -0
  258. package/dist/collection/components/input/input.js.map +1 -0
  259. package/dist/collection/components/input-error/input-error.css +30 -0
  260. package/dist/collection/components/input-error/input-error.js +24 -0
  261. package/dist/collection/components/input-error/input-error.js.map +1 -0
  262. package/dist/collection/components/label/label.css +25 -0
  263. package/dist/collection/components/label/label.js +65 -0
  264. package/dist/collection/components/label/label.js.map +1 -0
  265. package/dist/collection/components/link/link.js +51 -0
  266. package/dist/collection/components/link/link.js.map +1 -0
  267. package/dist/collection/components/paginator/paginator.css +29 -0
  268. package/dist/collection/components/paginator/paginator.js +120 -0
  269. package/dist/collection/components/paginator/paginator.js.map +1 -0
  270. package/dist/collection/components/paginator/paginator.stories.data.js +36 -0
  271. package/dist/collection/components/paginator/paginator.stories.data.js.map +1 -0
  272. package/dist/collection/components/phase-banner/phase-banner.css +84 -0
  273. package/dist/collection/components/phase-banner/phase-banner.js +61 -0
  274. package/dist/collection/components/phase-banner/phase-banner.js.map +1 -0
  275. package/dist/collection/components/progress-bar/progress-bar.css +35 -0
  276. package/dist/collection/components/progress-bar/progress-bar.js +90 -0
  277. package/dist/collection/components/progress-bar/progress-bar.js.map +1 -0
  278. package/dist/collection/components/radio/radio.css +49 -0
  279. package/dist/collection/components/radio/radio.js +206 -0
  280. package/dist/collection/components/radio/radio.js.map +1 -0
  281. package/dist/collection/components/radio-group/radio-group.css +14 -0
  282. package/dist/collection/components/radio-group/radio-group.js +148 -0
  283. package/dist/collection/components/radio-group/radio-group.js.map +1 -0
  284. package/dist/collection/components/select/select.css +59 -0
  285. package/dist/collection/components/select/select.js +207 -0
  286. package/dist/collection/components/select/select.js.map +1 -0
  287. package/dist/collection/components/select/select.types.js +3 -0
  288. package/dist/collection/components/select/select.types.js.map +1 -0
  289. package/dist/collection/components/side-nav/side-nav.css +68 -0
  290. package/dist/collection/components/side-nav/side-nav.js +43 -0
  291. package/dist/collection/components/side-nav/side-nav.js.map +1 -0
  292. package/dist/collection/components/side-nav/side-nav.stories.data.js +31 -0
  293. package/dist/collection/components/side-nav/side-nav.stories.data.js.map +1 -0
  294. package/dist/collection/components/side-nav-item/side-nav-item.css +90 -0
  295. package/dist/collection/components/side-nav-item/side-nav-item.js +112 -0
  296. package/dist/collection/components/side-nav-item/side-nav-item.js.map +1 -0
  297. package/dist/collection/components/table/table.css +29 -0
  298. package/dist/collection/components/table/table.js +47 -0
  299. package/dist/collection/components/table/table.js.map +1 -0
  300. package/dist/collection/components/table-body/table-body.css +28 -0
  301. package/dist/collection/components/table-body/table-body.js +23 -0
  302. package/dist/collection/components/table-body/table-body.js.map +1 -0
  303. package/dist/collection/components/table-cell/table-cell.css +28 -0
  304. package/dist/collection/components/table-cell/table-cell.js +23 -0
  305. package/dist/collection/components/table-cell/table-cell.js.map +1 -0
  306. package/dist/collection/components/table-header/table-header.css +20 -0
  307. package/dist/collection/components/table-header/table-header.js +23 -0
  308. package/dist/collection/components/table-header/table-header.js.map +1 -0
  309. package/dist/collection/components/table-header-cell/table-header-cell.css +27 -0
  310. package/dist/collection/components/table-header-cell/table-header-cell.js +23 -0
  311. package/dist/collection/components/table-header-cell/table-header-cell.js.map +1 -0
  312. package/dist/collection/components/table-row/table-row.css +20 -0
  313. package/dist/collection/components/table-row/table-row.js +23 -0
  314. package/dist/collection/components/table-row/table-row.js.map +1 -0
  315. package/dist/collection/components/textarea/textarea.css +269 -0
  316. package/dist/collection/components/textarea/textarea.js +202 -0
  317. package/dist/collection/components/textarea/textarea.js.map +1 -0
  318. package/dist/collection/components/type-ahead/type-ahead.css +73 -0
  319. package/dist/collection/components/type-ahead/type-ahead.js +294 -0
  320. package/dist/collection/components/type-ahead/type-ahead.js.map +1 -0
  321. package/dist/collection/components/type-ahead-item/type-ahead-item.css +3 -0
  322. package/dist/collection/components/type-ahead-item/type-ahead-item.js +43 -0
  323. package/dist/collection/components/type-ahead-item/type-ahead-item.js.map +1 -0
  324. package/dist/collection/index.js +2 -0
  325. package/dist/collection/index.js.map +1 -0
  326. package/dist/components/admiralty-breadcrumb.d.ts +11 -0
  327. package/dist/components/admiralty-breadcrumb.js +48 -0
  328. package/dist/components/admiralty-breadcrumb.js.map +1 -0
  329. package/dist/components/admiralty-breadcrumbs.d.ts +11 -0
  330. package/dist/components/admiralty-breadcrumbs.js +62 -0
  331. package/dist/components/admiralty-breadcrumbs.js.map +1 -0
  332. package/dist/components/admiralty-button.d.ts +11 -0
  333. package/dist/components/admiralty-button.js +8 -0
  334. package/dist/components/admiralty-button.js.map +1 -0
  335. package/dist/components/admiralty-card.d.ts +11 -0
  336. package/dist/components/admiralty-card.js +37 -0
  337. package/dist/components/admiralty-card.js.map +1 -0
  338. package/dist/components/admiralty-checkbox.d.ts +11 -0
  339. package/dist/components/admiralty-checkbox.js +75 -0
  340. package/dist/components/admiralty-checkbox.js.map +1 -0
  341. package/dist/components/admiralty-colour-block.d.ts +11 -0
  342. package/dist/components/admiralty-colour-block.js +68 -0
  343. package/dist/components/admiralty-colour-block.js.map +1 -0
  344. package/dist/components/admiralty-dialogue.d.ts +11 -0
  345. package/dist/components/admiralty-dialogue.js +61 -0
  346. package/dist/components/admiralty-dialogue.js.map +1 -0
  347. package/dist/components/admiralty-expansion.d.ts +11 -0
  348. package/dist/components/admiralty-expansion.js +8 -0
  349. package/dist/components/admiralty-expansion.js.map +1 -0
  350. package/dist/components/admiralty-file-input.d.ts +11 -0
  351. package/dist/components/admiralty-file-input.js +113 -0
  352. package/dist/components/admiralty-file-input.js.map +1 -0
  353. package/dist/components/admiralty-filter-group.d.ts +11 -0
  354. package/dist/components/admiralty-filter-group.js +49 -0
  355. package/dist/components/admiralty-filter-group.js.map +1 -0
  356. package/dist/components/admiralty-filter.d.ts +11 -0
  357. package/dist/components/admiralty-filter.js +59 -0
  358. package/dist/components/admiralty-filter.js.map +1 -0
  359. package/dist/components/admiralty-footer.d.ts +11 -0
  360. package/dist/components/admiralty-footer.js +43 -0
  361. package/dist/components/admiralty-footer.js.map +1 -0
  362. package/dist/components/admiralty-header-menu-item.d.ts +11 -0
  363. package/dist/components/admiralty-header-menu-item.js +80 -0
  364. package/dist/components/admiralty-header-menu-item.js.map +1 -0
  365. package/dist/components/admiralty-header-profile.d.ts +11 -0
  366. package/dist/components/admiralty-header-profile.js +62 -0
  367. package/dist/components/admiralty-header-profile.js.map +1 -0
  368. package/dist/components/admiralty-header-sub-menu-item.d.ts +11 -0
  369. package/dist/components/admiralty-header-sub-menu-item.js +44 -0
  370. package/dist/components/admiralty-header-sub-menu-item.js.map +1 -0
  371. package/dist/components/admiralty-header.d.ts +11 -0
  372. package/dist/components/admiralty-header.js +51 -0
  373. package/dist/components/admiralty-header.js.map +1 -0
  374. package/dist/components/admiralty-hint.d.ts +11 -0
  375. package/dist/components/admiralty-hint.js +8 -0
  376. package/dist/components/admiralty-hint.js.map +1 -0
  377. package/dist/components/admiralty-hr.d.ts +11 -0
  378. package/dist/components/admiralty-hr.js +34 -0
  379. package/dist/components/admiralty-hr.js.map +1 -0
  380. package/dist/components/admiralty-icon.d.ts +11 -0
  381. package/dist/components/admiralty-icon.js +8 -0
  382. package/dist/components/admiralty-icon.js.map +1 -0
  383. package/dist/components/admiralty-input-error.d.ts +11 -0
  384. package/dist/components/admiralty-input-error.js +8 -0
  385. package/dist/components/admiralty-input-error.js.map +1 -0
  386. package/dist/components/admiralty-input.d.ts +11 -0
  387. package/dist/components/admiralty-input.js +8 -0
  388. package/dist/components/admiralty-input.js.map +1 -0
  389. package/dist/components/admiralty-label.d.ts +11 -0
  390. package/dist/components/admiralty-label.js +8 -0
  391. package/dist/components/admiralty-label.js.map +1 -0
  392. package/dist/components/admiralty-link.d.ts +11 -0
  393. package/dist/components/admiralty-link.js +36 -0
  394. package/dist/components/admiralty-link.js.map +1 -0
  395. package/dist/components/admiralty-paginator-wrapper.d.ts +11 -0
  396. package/dist/components/admiralty-paginator-wrapper.js +45 -0
  397. package/dist/components/admiralty-paginator-wrapper.js.map +1 -0
  398. package/dist/components/admiralty-paginator.d.ts +11 -0
  399. package/dist/components/admiralty-paginator.js +73 -0
  400. package/dist/components/admiralty-paginator.js.map +1 -0
  401. package/dist/components/admiralty-phase-banner.d.ts +11 -0
  402. package/dist/components/admiralty-phase-banner.js +39 -0
  403. package/dist/components/admiralty-phase-banner.js.map +1 -0
  404. package/dist/components/admiralty-progress-bar.d.ts +11 -0
  405. package/dist/components/admiralty-progress-bar.js +52 -0
  406. package/dist/components/admiralty-progress-bar.js.map +1 -0
  407. package/dist/components/admiralty-radio-group.d.ts +11 -0
  408. package/dist/components/admiralty-radio-group.js +88 -0
  409. package/dist/components/admiralty-radio-group.js.map +1 -0
  410. package/dist/components/admiralty-radio.d.ts +11 -0
  411. package/dist/components/admiralty-radio.js +84 -0
  412. package/dist/components/admiralty-radio.js.map +1 -0
  413. package/dist/components/admiralty-select.d.ts +11 -0
  414. package/dist/components/admiralty-select.js +106 -0
  415. package/dist/components/admiralty-select.js.map +1 -0
  416. package/dist/components/admiralty-side-nav-item.d.ts +11 -0
  417. package/dist/components/admiralty-side-nav-item.js +56 -0
  418. package/dist/components/admiralty-side-nav-item.js.map +1 -0
  419. package/dist/components/admiralty-side-nav-wrapper.d.ts +11 -0
  420. package/dist/components/admiralty-side-nav-wrapper.js +40 -0
  421. package/dist/components/admiralty-side-nav-wrapper.js.map +1 -0
  422. package/dist/components/admiralty-side-nav.d.ts +11 -0
  423. package/dist/components/admiralty-side-nav.js +37 -0
  424. package/dist/components/admiralty-side-nav.js.map +1 -0
  425. package/dist/components/admiralty-table-body.d.ts +11 -0
  426. package/dist/components/admiralty-table-body.js +34 -0
  427. package/dist/components/admiralty-table-body.js.map +1 -0
  428. package/dist/components/admiralty-table-cell.d.ts +11 -0
  429. package/dist/components/admiralty-table-cell.js +34 -0
  430. package/dist/components/admiralty-table-cell.js.map +1 -0
  431. package/dist/components/admiralty-table-header-cell.d.ts +11 -0
  432. package/dist/components/admiralty-table-header-cell.js +34 -0
  433. package/dist/components/admiralty-table-header-cell.js.map +1 -0
  434. package/dist/components/admiralty-table-header.d.ts +11 -0
  435. package/dist/components/admiralty-table-header.js +34 -0
  436. package/dist/components/admiralty-table-header.js.map +1 -0
  437. package/dist/components/admiralty-table-row.d.ts +11 -0
  438. package/dist/components/admiralty-table-row.js +34 -0
  439. package/dist/components/admiralty-table-row.js.map +1 -0
  440. package/dist/components/admiralty-table.d.ts +11 -0
  441. package/dist/components/admiralty-table.js +37 -0
  442. package/dist/components/admiralty-table.js.map +1 -0
  443. package/dist/components/admiralty-textarea.d.ts +11 -0
  444. package/dist/components/admiralty-textarea.js +84 -0
  445. package/dist/components/admiralty-textarea.js.map +1 -0
  446. package/dist/components/admiralty-type-ahead-item.d.ts +11 -0
  447. package/dist/components/admiralty-type-ahead-item.js +37 -0
  448. package/dist/components/admiralty-type-ahead-item.js.map +1 -0
  449. package/dist/components/admiralty-type-ahead.d.ts +11 -0
  450. package/dist/components/admiralty-type-ahead.js +235 -0
  451. package/dist/components/admiralty-type-ahead.js.map +1 -0
  452. package/dist/components/button.js +55 -0
  453. package/dist/components/button.js.map +1 -0
  454. package/dist/components/expansion.js +62 -0
  455. package/dist/components/expansion.js.map +1 -0
  456. package/dist/components/hint.js +35 -0
  457. package/dist/components/hint.js.map +1 -0
  458. package/dist/components/icon.js +16529 -0
  459. package/dist/components/icon.js.map +1 -0
  460. package/dist/components/index.d.ts +27 -0
  461. package/dist/components/index.js +3 -0
  462. package/dist/components/index.js.map +1 -0
  463. package/dist/components/input-error.js +38 -0
  464. package/dist/components/input-error.js.map +1 -0
  465. package/dist/components/input.js +109 -0
  466. package/dist/components/input.js.map +1 -0
  467. package/dist/components/label.js +37 -0
  468. package/dist/components/label.js.map +1 -0
  469. package/dist/esm/admiralty-breadcrumb.entry.js +21 -0
  470. package/dist/esm/admiralty-breadcrumb.entry.js.map +1 -0
  471. package/dist/esm/admiralty-breadcrumbs.entry.js +44 -0
  472. package/dist/esm/admiralty-breadcrumbs.entry.js.map +1 -0
  473. package/dist/esm/admiralty-button.entry.js +22 -0
  474. package/dist/esm/admiralty-button.entry.js.map +1 -0
  475. package/dist/esm/admiralty-card.entry.js +18 -0
  476. package/dist/esm/admiralty-card.entry.js.map +1 -0
  477. package/dist/esm/admiralty-checkbox.entry.js +50 -0
  478. package/dist/esm/admiralty-checkbox.entry.js.map +1 -0
  479. package/dist/esm/admiralty-colour-block.entry.js +33 -0
  480. package/dist/esm/admiralty-colour-block.entry.js.map +1 -0
  481. package/dist/esm/admiralty-dialogue.entry.js +35 -0
  482. package/dist/esm/admiralty-dialogue.entry.js.map +1 -0
  483. package/dist/esm/admiralty-expansion.entry.js +38 -0
  484. package/dist/esm/admiralty-expansion.entry.js.map +1 -0
  485. package/dist/esm/admiralty-file-input.entry.js +85 -0
  486. package/dist/esm/admiralty-file-input.entry.js.map +1 -0
  487. package/dist/esm/admiralty-filter-group.entry.js +18 -0
  488. package/dist/esm/admiralty-filter-group.entry.js.map +1 -0
  489. package/dist/esm/admiralty-filter.entry.js +28 -0
  490. package/dist/esm/admiralty-filter.entry.js.map +1 -0
  491. package/dist/esm/admiralty-footer.entry.js +21 -0
  492. package/dist/esm/admiralty-footer.entry.js.map +1 -0
  493. package/dist/esm/admiralty-header-menu-item.entry.js +59 -0
  494. package/dist/esm/admiralty-header-menu-item.entry.js.map +1 -0
  495. package/dist/esm/admiralty-header-profile.entry.js +40 -0
  496. package/dist/esm/admiralty-header-profile.entry.js.map +1 -0
  497. package/dist/esm/admiralty-header-sub-menu-item.entry.js +24 -0
  498. package/dist/esm/admiralty-header-sub-menu-item.entry.js.map +1 -0
  499. package/dist/esm/admiralty-header.entry.js +28 -0
  500. package/dist/esm/admiralty-header.entry.js.map +1 -0
  501. package/dist/esm/admiralty-hint_3.entry.js +45 -0
  502. package/dist/esm/admiralty-hint_3.entry.js.map +1 -0
  503. package/dist/esm/admiralty-hr.entry.js +17 -0
  504. package/dist/esm/admiralty-hr.entry.js.map +1 -0
  505. package/dist/esm/admiralty-icon.entry.js +7041 -0
  506. package/dist/esm/admiralty-icon.entry.js.map +1 -0
  507. package/dist/esm/admiralty-input.entry.js +58 -0
  508. package/dist/esm/admiralty-input.entry.js.map +1 -0
  509. package/dist/esm/admiralty-link.entry.js +16 -0
  510. package/dist/esm/admiralty-link.entry.js.map +1 -0
  511. package/dist/esm/admiralty-paginator-wrapper.entry.js +28 -0
  512. package/dist/esm/admiralty-paginator-wrapper.entry.js.map +1 -0
  513. package/dist/esm/admiralty-paginator.entry.js +42 -0
  514. package/dist/esm/admiralty-paginator.entry.js.map +1 -0
  515. package/dist/esm/admiralty-phase-banner.entry.js +19 -0
  516. package/dist/esm/admiralty-phase-banner.entry.js.map +1 -0
  517. package/dist/esm/admiralty-progress-bar.entry.js +24 -0
  518. package/dist/esm/admiralty-progress-bar.entry.js.map +1 -0
  519. package/dist/esm/admiralty-radio-group.entry.js +67 -0
  520. package/dist/esm/admiralty-radio-group.entry.js.map +1 -0
  521. package/dist/esm/admiralty-radio.entry.js +60 -0
  522. package/dist/esm/admiralty-radio.entry.js.map +1 -0
  523. package/dist/esm/admiralty-select.entry.js +57 -0
  524. package/dist/esm/admiralty-select.entry.js.map +1 -0
  525. package/dist/esm/admiralty-side-nav-item.entry.js +35 -0
  526. package/dist/esm/admiralty-side-nav-item.entry.js.map +1 -0
  527. package/dist/esm/admiralty-side-nav-wrapper.entry.js +23 -0
  528. package/dist/esm/admiralty-side-nav-wrapper.entry.js.map +1 -0
  529. package/dist/esm/admiralty-side-nav.entry.js +18 -0
  530. package/dist/esm/admiralty-side-nav.entry.js.map +1 -0
  531. package/dist/esm/admiralty-table-body.entry.js +17 -0
  532. package/dist/esm/admiralty-table-body.entry.js.map +1 -0
  533. package/dist/esm/admiralty-table-cell.entry.js +17 -0
  534. package/dist/esm/admiralty-table-cell.entry.js.map +1 -0
  535. package/dist/esm/admiralty-table-header-cell.entry.js +17 -0
  536. package/dist/esm/admiralty-table-header-cell.entry.js.map +1 -0
  537. package/dist/esm/admiralty-table-header.entry.js +17 -0
  538. package/dist/esm/admiralty-table-header.entry.js.map +1 -0
  539. package/dist/esm/admiralty-table-row.entry.js +17 -0
  540. package/dist/esm/admiralty-table-row.entry.js.map +1 -0
  541. package/dist/esm/admiralty-table.entry.js +18 -0
  542. package/dist/esm/admiralty-table.entry.js.map +1 -0
  543. package/dist/esm/admiralty-textarea.entry.js +34 -0
  544. package/dist/esm/admiralty-textarea.entry.js.map +1 -0
  545. package/dist/esm/admiralty-type-ahead-item.entry.js +18 -0
  546. package/dist/esm/admiralty-type-ahead-item.entry.js.map +1 -0
  547. package/dist/esm/admiralty-type-ahead.entry.js +181 -0
  548. package/dist/esm/admiralty-type-ahead.entry.js.map +1 -0
  549. package/dist/esm/admiralty.js +23 -0
  550. package/dist/esm/admiralty.js.map +1 -0
  551. package/dist/esm/button.types-2655b2cf.js +12 -0
  552. package/dist/esm/button.types-2655b2cf.js.map +1 -0
  553. package/dist/esm/index-a64d8966.js +1942 -0
  554. package/dist/esm/index-a64d8966.js.map +1 -0
  555. package/dist/esm/index-e73d97b7.js +9474 -0
  556. package/dist/esm/index-e73d97b7.js.map +1 -0
  557. package/dist/esm/index.js +3 -0
  558. package/dist/esm/index.js.map +1 -0
  559. package/dist/esm/loader.js +20 -0
  560. package/dist/esm/loader.js.map +1 -0
  561. package/dist/esm/polyfills/core-js.js +11 -0
  562. package/dist/esm/polyfills/css-shim.js +1 -0
  563. package/dist/esm/polyfills/dom.js +79 -0
  564. package/dist/esm/polyfills/es5-html-element.js +1 -0
  565. package/dist/esm/polyfills/index.js +34 -0
  566. package/dist/esm/polyfills/system.js +6 -0
  567. package/dist/index.cjs.js +1 -0
  568. package/dist/index.js +1 -0
  569. package/dist/types/components/breadcrumb/breadcrumb.d.ts +18 -0
  570. package/dist/types/components/breadcrumbs/breadcrumbs.d.ts +8 -0
  571. package/dist/types/components/button/button.d.ts +23 -0
  572. package/dist/types/components/button/button.types.d.ts +7 -0
  573. package/dist/types/components/card/card.d.ts +7 -0
  574. package/dist/types/components/checkbox/checkbox.d.ts +52 -0
  575. package/dist/types/components/colour-block/colour-block.d.ts +27 -0
  576. package/dist/types/components/dialogue/dialogue.d.ts +13 -0
  577. package/dist/types/components/expansion/expansion.d.ts +30 -0
  578. package/dist/types/components/file-input/file-input.d.ts +53 -0
  579. package/dist/types/components/filter/filter.d.ts +21 -0
  580. package/dist/types/components/filter-group/filter-group.d.ts +10 -0
  581. package/dist/types/components/footer/footer.d.ts +25 -0
  582. package/dist/types/components/header/header.d.ts +33 -0
  583. package/dist/types/components/header/header.stories.data.d.ts +6 -0
  584. package/dist/types/components/header/header.types.d.ts +10 -0
  585. package/dist/types/components/header-menu-item/header-menu-item.d.ts +34 -0
  586. package/dist/types/components/header-profile/header-profile.d.ts +38 -0
  587. package/dist/types/components/header-sub-menu-item/header-sub-menu-item.d.ts +13 -0
  588. package/dist/types/components/hint/hint.d.ts +11 -0
  589. package/dist/types/components/horizontal-rule/horizontal-rule.d.ts +3 -0
  590. package/dist/types/components/icon/icon.d.ts +17 -0
  591. package/dist/types/components/input/input.d.ts +71 -0
  592. package/dist/types/components/input/input.interface.d.ts +3 -0
  593. package/dist/types/components/input-error/input-error.d.ts +7 -0
  594. package/dist/types/components/label/label.d.ts +15 -0
  595. package/dist/types/components/link/link.d.ts +11 -0
  596. package/dist/types/components/paginator/paginator.d.ts +26 -0
  597. package/dist/types/components/paginator/paginator.stories.data.d.ts +10 -0
  598. package/dist/types/components/phase-banner/phase-banner.d.ts +11 -0
  599. package/dist/types/components/progress-bar/progress-bar.d.ts +19 -0
  600. package/dist/types/components/radio/radio.d.ts +44 -0
  601. package/dist/types/components/radio-group/radio-group.d.ts +27 -0
  602. package/dist/types/components/select/select.d.ts +48 -0
  603. package/dist/types/components/select/select.types.d.ts +4 -0
  604. package/dist/types/components/side-nav/side-nav.d.ts +8 -0
  605. package/dist/types/components/side-nav/side-nav.stories.data.d.ts +10 -0
  606. package/dist/types/components/side-nav-item/side-nav-item.d.ts +26 -0
  607. package/dist/types/components/table/table.d.ts +8 -0
  608. package/dist/types/components/table-body/table-body.d.ts +7 -0
  609. package/dist/types/components/table-cell/table-cell.d.ts +7 -0
  610. package/dist/types/components/table-header/table-header.d.ts +7 -0
  611. package/dist/types/components/table-header-cell/table-header-cell.d.ts +7 -0
  612. package/dist/types/components/table-row/table-row.d.ts +7 -0
  613. package/dist/types/components/textarea/textarea.d.ts +45 -0
  614. package/dist/types/components/type-ahead/type-ahead.d.ts +66 -0
  615. package/dist/types/components/type-ahead-item/type-ahead-item.d.ts +4 -0
  616. package/dist/types/components.d.ts +1637 -0
  617. package/dist/types/index.d.ts +0 -0
  618. package/dist/types/stencil-public-runtime.d.ts +1637 -0
  619. package/loader/cdn.js +3 -0
  620. package/loader/index.cjs.js +3 -0
  621. package/loader/index.d.ts +21 -0
  622. package/loader/index.es2017.js +3 -0
  623. package/loader/index.js +4 -0
  624. package/loader/package.json +11 -0
  625. package/package.json +69 -0
  626. package/styles/core.css +1 -0
  627. package/styles/core.css.map +1 -0
  628. package/styles/webfonts/JohnstonITC/bold/JohnstonITCStd-Bold.woff +0 -0
  629. package/styles/webfonts/JohnstonITC/bold/JohnstonITCStd-Bold.woff2 +0 -0
  630. package/styles/webfonts/JohnstonITC/italic/JohnstonITCStd-MediumIta.woff +0 -0
  631. package/styles/webfonts/JohnstonITC/italic/JohnstonITCStd-MediumIta.woff2 +0 -0
  632. package/styles/webfonts/JohnstonITC/light/JohnstonITCStd-Light.woff +0 -0
  633. package/styles/webfonts/JohnstonITC/light/JohnstonITCStd-Light.woff2 +0 -0
  634. package/styles/webfonts/JohnstonITC/light-italic/JohnstonITCStd-LightIta.woff +0 -0
  635. package/styles/webfonts/JohnstonITC/light-italic/JohnstonITCStd-LightIta.woff2 +0 -0
  636. package/styles/webfonts/JohnstonITC/medium/JohnstonITCStd-Medium.woff +0 -0
  637. package/styles/webfonts/JohnstonITC/medium/JohnstonITCStd-Medium.woff2 +0 -0
@@ -0,0 +1,1942 @@
1
+ const NAMESPACE = 'admiralty';
2
+
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
11
+ let scopeId;
12
+ let contentRef;
13
+ let hostTagName;
14
+ let useNativeShadowDom = false;
15
+ let checkSlotFallbackVisibility = false;
16
+ let checkSlotRelocate = false;
17
+ let isSvgMode = false;
18
+ let queuePending = false;
19
+ const createTime = (fnName, tagName = '') => {
20
+ {
21
+ return () => {
22
+ return;
23
+ };
24
+ }
25
+ };
26
+ const uniqueTime = (key, measureText) => {
27
+ {
28
+ return () => {
29
+ return;
30
+ };
31
+ }
32
+ };
33
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
34
+ /**
35
+ * Default style mode id
36
+ */
37
+ /**
38
+ * Reusable empty obj/array
39
+ * Don't add values to these!!
40
+ */
41
+ const EMPTY_OBJ = {};
42
+ const isDef = (v) => v != null;
43
+ /**
44
+ * Check whether a value is a 'complex type', defined here as an object or a
45
+ * function.
46
+ *
47
+ * @param o the value to check
48
+ * @returns whether it's a complex type or not
49
+ */
50
+ const isComplexType = (o) => {
51
+ // https://jsperf.com/typeof-fn-object/5
52
+ o = typeof o;
53
+ return o === 'object' || o === 'function';
54
+ };
55
+ /**
56
+ * Helper method for querying a `meta` tag that contains a nonce value
57
+ * out of a DOM's head.
58
+ *
59
+ * @param doc The DOM containing the `head` to query against
60
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
61
+ * exists or the tag has no content.
62
+ */
63
+ function queryNonceMetaTagContent(doc) {
64
+ var _a, _b, _c;
65
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
66
+ }
67
+ /**
68
+ * Production h() function based on Preact by
69
+ * Jason Miller (@developit)
70
+ * Licensed under the MIT License
71
+ * https://github.com/developit/preact/blob/master/LICENSE
72
+ *
73
+ * Modified for Stencil's compiler and vdom
74
+ */
75
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
76
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
77
+ const h = (nodeName, vnodeData, ...children) => {
78
+ let child = null;
79
+ let slotName = null;
80
+ let simple = false;
81
+ let lastSimple = false;
82
+ const vNodeChildren = [];
83
+ const walk = (c) => {
84
+ for (let i = 0; i < c.length; i++) {
85
+ child = c[i];
86
+ if (Array.isArray(child)) {
87
+ walk(child);
88
+ }
89
+ else if (child != null && typeof child !== 'boolean') {
90
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
91
+ child = String(child);
92
+ }
93
+ if (simple && lastSimple) {
94
+ // If the previous child was simple (string), we merge both
95
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
96
+ }
97
+ else {
98
+ // Append a new vNode, if it's text, we create a text vNode
99
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
100
+ }
101
+ lastSimple = simple;
102
+ }
103
+ }
104
+ };
105
+ walk(children);
106
+ if (vnodeData) {
107
+ if (vnodeData.name) {
108
+ slotName = vnodeData.name;
109
+ }
110
+ {
111
+ const classData = vnodeData.className || vnodeData.class;
112
+ if (classData) {
113
+ vnodeData.class =
114
+ typeof classData !== 'object'
115
+ ? classData
116
+ : Object.keys(classData)
117
+ .filter((k) => classData[k])
118
+ .join(' ');
119
+ }
120
+ }
121
+ }
122
+ const vnode = newVNode(nodeName, null);
123
+ vnode.$attrs$ = vnodeData;
124
+ if (vNodeChildren.length > 0) {
125
+ vnode.$children$ = vNodeChildren;
126
+ }
127
+ {
128
+ vnode.$name$ = slotName;
129
+ }
130
+ return vnode;
131
+ };
132
+ /**
133
+ * A utility function for creating a virtual DOM node from a tag and some
134
+ * possible text content.
135
+ *
136
+ * @param tag the tag for this element
137
+ * @param text possible text content for the node
138
+ * @returns a newly-minted virtual DOM node
139
+ */
140
+ const newVNode = (tag, text) => {
141
+ const vnode = {
142
+ $flags$: 0,
143
+ $tag$: tag,
144
+ $text$: text,
145
+ $elm$: null,
146
+ $children$: null,
147
+ };
148
+ {
149
+ vnode.$attrs$ = null;
150
+ }
151
+ {
152
+ vnode.$name$ = null;
153
+ }
154
+ return vnode;
155
+ };
156
+ const Host = {};
157
+ /**
158
+ * Check whether a given node is a Host node or not
159
+ *
160
+ * @param node the virtual DOM node to check
161
+ * @returns whether it's a Host node or not
162
+ */
163
+ const isHost = (node) => node && node.$tag$ === Host;
164
+ /**
165
+ * Parse a new property value for a given property type.
166
+ *
167
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
168
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
169
+ * 1. `any`, the type given to `propValue` in the function signature
170
+ * 2. the type stored from `propType`.
171
+ *
172
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
173
+ *
174
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
175
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
176
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
177
+ * ```tsx
178
+ * <my-cmp prop-val={0}></my-cmp>
179
+ * ```
180
+ *
181
+ * HTML prop values on the other hand, will always a string
182
+ *
183
+ * @param propValue the new value to coerce to some type
184
+ * @param propType the type of the prop, expressed as a binary number
185
+ * @returns the parsed/coerced value
186
+ */
187
+ const parsePropertyValue = (propValue, propType) => {
188
+ // ensure this value is of the correct prop type
189
+ if (propValue != null && !isComplexType(propValue)) {
190
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
191
+ // per the HTML spec, any string value means it is a boolean true value
192
+ // but we'll cheat here and say that the string "false" is the boolean false
193
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
194
+ }
195
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
196
+ // force it to be a number
197
+ return parseFloat(propValue);
198
+ }
199
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
200
+ // could have been passed as a number or boolean
201
+ // but we still want it as a string
202
+ return String(propValue);
203
+ }
204
+ // redundant return here for better minification
205
+ return propValue;
206
+ }
207
+ // not sure exactly what type we want
208
+ // so no need to change to a different type
209
+ return propValue;
210
+ };
211
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
212
+ const createEvent = (ref, name, flags) => {
213
+ const elm = getElement(ref);
214
+ return {
215
+ emit: (detail) => {
216
+ return emitEvent(elm, name, {
217
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
218
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
219
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
220
+ detail,
221
+ });
222
+ },
223
+ };
224
+ };
225
+ /**
226
+ * Helper function to create & dispatch a custom Event on a provided target
227
+ * @param elm the target of the Event
228
+ * @param name the name to give the custom Event
229
+ * @param opts options for configuring a custom Event
230
+ * @returns the custom Event
231
+ */
232
+ const emitEvent = (elm, name, opts) => {
233
+ const ev = plt.ce(name, opts);
234
+ elm.dispatchEvent(ev);
235
+ return ev;
236
+ };
237
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
238
+ const registerStyle = (scopeId, cssText, allowCS) => {
239
+ let style = styles.get(scopeId);
240
+ if (supportsConstructableStylesheets && allowCS) {
241
+ style = (style || new CSSStyleSheet());
242
+ if (typeof style === 'string') {
243
+ style = cssText;
244
+ }
245
+ else {
246
+ style.replaceSync(cssText);
247
+ }
248
+ }
249
+ else {
250
+ style = cssText;
251
+ }
252
+ styles.set(scopeId, style);
253
+ };
254
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
255
+ var _a;
256
+ let scopeId = getScopeId(cmpMeta);
257
+ const style = styles.get(scopeId);
258
+ // if an element is NOT connected then getRootNode() will return the wrong root node
259
+ // so the fallback is to always use the document for the root node in those cases
260
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
261
+ if (style) {
262
+ if (typeof style === 'string') {
263
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
264
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
265
+ let styleElm;
266
+ if (!appliedStyles) {
267
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
268
+ }
269
+ if (!appliedStyles.has(scopeId)) {
270
+ {
271
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
272
+ {
273
+ styleElm = doc.createElement('style');
274
+ styleElm.innerHTML = style;
275
+ }
276
+ // Apply CSP nonce to the style tag if it exists
277
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
278
+ if (nonce != null) {
279
+ styleElm.setAttribute('nonce', nonce);
280
+ }
281
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
282
+ }
283
+ if (appliedStyles) {
284
+ appliedStyles.add(scopeId);
285
+ }
286
+ }
287
+ }
288
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
289
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
290
+ }
291
+ }
292
+ return scopeId;
293
+ };
294
+ const attachStyles = (hostRef) => {
295
+ const cmpMeta = hostRef.$cmpMeta$;
296
+ const elm = hostRef.$hostElement$;
297
+ const flags = cmpMeta.$flags$;
298
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
299
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
300
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
301
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
302
+ // only required when we're NOT using native shadow dom (slot)
303
+ // or this browser doesn't support native shadow dom
304
+ // and this host element was NOT created with SSR
305
+ // let's pick out the inner content for slot projection
306
+ // create a node to represent where the original
307
+ // content was first placed, which is useful later on
308
+ // DOM WRITE!!
309
+ elm['s-sc'] = scopeId;
310
+ elm.classList.add(scopeId + '-h');
311
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
312
+ elm.classList.add(scopeId + '-s');
313
+ }
314
+ }
315
+ endAttachStyles();
316
+ };
317
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
318
+ /**
319
+ * Production setAccessor() function based on Preact by
320
+ * Jason Miller (@developit)
321
+ * Licensed under the MIT License
322
+ * https://github.com/developit/preact/blob/master/LICENSE
323
+ *
324
+ * Modified for Stencil's compiler and vdom
325
+ */
326
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
327
+ if (oldValue !== newValue) {
328
+ let isProp = isMemberInElement(elm, memberName);
329
+ let ln = memberName.toLowerCase();
330
+ if (memberName === 'class') {
331
+ const classList = elm.classList;
332
+ const oldClasses = parseClassList(oldValue);
333
+ const newClasses = parseClassList(newValue);
334
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
335
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
336
+ }
337
+ else if (memberName === 'style') {
338
+ // update style attribute, css properties and values
339
+ {
340
+ for (const prop in oldValue) {
341
+ if (!newValue || newValue[prop] == null) {
342
+ if (prop.includes('-')) {
343
+ elm.style.removeProperty(prop);
344
+ }
345
+ else {
346
+ elm.style[prop] = '';
347
+ }
348
+ }
349
+ }
350
+ }
351
+ for (const prop in newValue) {
352
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
353
+ if (prop.includes('-')) {
354
+ elm.style.setProperty(prop, newValue[prop]);
355
+ }
356
+ else {
357
+ elm.style[prop] = newValue[prop];
358
+ }
359
+ }
360
+ }
361
+ }
362
+ else if (memberName === 'ref') {
363
+ // minifier will clean this up
364
+ if (newValue) {
365
+ newValue(elm);
366
+ }
367
+ }
368
+ else if ((!isProp ) &&
369
+ memberName[0] === 'o' &&
370
+ memberName[1] === 'n') {
371
+ // Event Handlers
372
+ // so if the member name starts with "on" and the 3rd characters is
373
+ // a capital letter, and it's not already a member on the element,
374
+ // then we're assuming it's an event listener
375
+ if (memberName[2] === '-') {
376
+ // on- prefixed events
377
+ // allows to be explicit about the dom event to listen without any magic
378
+ // under the hood:
379
+ // <my-cmp on-click> // listens for "click"
380
+ // <my-cmp on-Click> // listens for "Click"
381
+ // <my-cmp on-ionChange> // listens for "ionChange"
382
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
383
+ memberName = memberName.slice(3);
384
+ }
385
+ else if (isMemberInElement(win, ln)) {
386
+ // standard event
387
+ // the JSX attribute could have been "onMouseOver" and the
388
+ // member name "onmouseover" is on the window's prototype
389
+ // so let's add the listener "mouseover", which is all lowercased
390
+ memberName = ln.slice(2);
391
+ }
392
+ else {
393
+ // custom event
394
+ // the JSX attribute could have been "onMyCustomEvent"
395
+ // so let's trim off the "on" prefix and lowercase the first character
396
+ // and add the listener "myCustomEvent"
397
+ // except for the first character, we keep the event name case
398
+ memberName = ln[2] + memberName.slice(3);
399
+ }
400
+ if (oldValue) {
401
+ plt.rel(elm, memberName, oldValue, false);
402
+ }
403
+ if (newValue) {
404
+ plt.ael(elm, memberName, newValue, false);
405
+ }
406
+ }
407
+ else {
408
+ // Set property if it exists and it's not a SVG
409
+ const isComplex = isComplexType(newValue);
410
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
411
+ try {
412
+ if (!elm.tagName.includes('-')) {
413
+ const n = newValue == null ? '' : newValue;
414
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
415
+ if (memberName === 'list') {
416
+ isProp = false;
417
+ }
418
+ else if (oldValue == null || elm[memberName] != n) {
419
+ elm[memberName] = n;
420
+ }
421
+ }
422
+ else {
423
+ elm[memberName] = newValue;
424
+ }
425
+ }
426
+ catch (e) { }
427
+ }
428
+ if (newValue == null || newValue === false) {
429
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
430
+ {
431
+ elm.removeAttribute(memberName);
432
+ }
433
+ }
434
+ }
435
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
436
+ newValue = newValue === true ? '' : newValue;
437
+ {
438
+ elm.setAttribute(memberName, newValue);
439
+ }
440
+ }
441
+ }
442
+ }
443
+ };
444
+ const parseClassListRegex = /\s/;
445
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
446
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
447
+ // if the element passed in is a shadow root, which is a document fragment
448
+ // then we want to be adding attrs/props to the shadow root's "host" element
449
+ // if it's not a shadow root, then we add attrs/props to the same element
450
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
451
+ ? newVnode.$elm$.host
452
+ : newVnode.$elm$;
453
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
454
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
455
+ {
456
+ // remove attributes no longer present on the vnode by setting them to undefined
457
+ for (memberName in oldVnodeAttrs) {
458
+ if (!(memberName in newVnodeAttrs)) {
459
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
460
+ }
461
+ }
462
+ }
463
+ // add new & update changed attributes
464
+ for (memberName in newVnodeAttrs) {
465
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
466
+ }
467
+ };
468
+ /**
469
+ * Create a DOM Node corresponding to one of the children of a given VNode.
470
+ *
471
+ * @param oldParentVNode the parent VNode from the previous render
472
+ * @param newParentVNode the parent VNode from the current render
473
+ * @param childIndex the index of the VNode, in the _new_ parent node's
474
+ * children, for which we will create a new DOM node
475
+ * @param parentElm the parent DOM node which our new node will be a child of
476
+ * @returns the newly created node
477
+ */
478
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
479
+ // tslint:disable-next-line: prefer-const
480
+ const newVNode = newParentVNode.$children$[childIndex];
481
+ let i = 0;
482
+ let elm;
483
+ let childNode;
484
+ let oldVNode;
485
+ if (!useNativeShadowDom) {
486
+ // remember for later we need to check to relocate nodes
487
+ checkSlotRelocate = true;
488
+ if (newVNode.$tag$ === 'slot') {
489
+ if (scopeId) {
490
+ // scoped css needs to add its scoped id to the parent element
491
+ parentElm.classList.add(scopeId + '-s');
492
+ }
493
+ newVNode.$flags$ |= newVNode.$children$
494
+ ? // slot element has fallback content
495
+ 2 /* VNODE_FLAGS.isSlotFallback */
496
+ : // slot element does not have fallback content
497
+ 1 /* VNODE_FLAGS.isSlotReference */;
498
+ }
499
+ }
500
+ if (newVNode.$text$ !== null) {
501
+ // create text node
502
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
503
+ }
504
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
505
+ // create a slot reference node
506
+ elm = newVNode.$elm$ =
507
+ doc.createTextNode('');
508
+ }
509
+ else {
510
+ // create element
511
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
512
+ ? 'slot-fb'
513
+ : newVNode.$tag$));
514
+ // add css classes, attrs, props, listeners, etc.
515
+ {
516
+ updateElement(null, newVNode, isSvgMode);
517
+ }
518
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
519
+ // if there is a scopeId and this is the initial render
520
+ // then let's add the scopeId as a css class
521
+ elm.classList.add((elm['s-si'] = scopeId));
522
+ }
523
+ if (newVNode.$children$) {
524
+ for (i = 0; i < newVNode.$children$.length; ++i) {
525
+ // create the node
526
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
527
+ // return node could have been null
528
+ if (childNode) {
529
+ // append our new node
530
+ elm.appendChild(childNode);
531
+ }
532
+ }
533
+ }
534
+ }
535
+ {
536
+ elm['s-hn'] = hostTagName;
537
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
538
+ // remember the content reference comment
539
+ elm['s-sr'] = true;
540
+ // remember the content reference comment
541
+ elm['s-cr'] = contentRef;
542
+ // remember the slot name, or empty string for default slot
543
+ elm['s-sn'] = newVNode.$name$ || '';
544
+ // check if we've got an old vnode for this slot
545
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
546
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
547
+ // we've got an old slot vnode and the wrapper is being replaced
548
+ // so let's move the old slot content back to it's original location
549
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
550
+ }
551
+ }
552
+ }
553
+ return elm;
554
+ };
555
+ const putBackInOriginalLocation = (parentElm, recursive) => {
556
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
557
+ const oldSlotChildNodes = parentElm.childNodes;
558
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
559
+ const childNode = oldSlotChildNodes[i];
560
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
561
+ // // this child node in the old element is from another component
562
+ // // remove this node from the old slot's parent
563
+ // childNode.remove();
564
+ // and relocate it back to it's original location
565
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
566
+ // remove the old original location comment entirely
567
+ // later on the patch function will know what to do
568
+ // and move this to the correct spot in need be
569
+ childNode['s-ol'].remove();
570
+ childNode['s-ol'] = undefined;
571
+ checkSlotRelocate = true;
572
+ }
573
+ if (recursive) {
574
+ putBackInOriginalLocation(childNode, recursive);
575
+ }
576
+ }
577
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
578
+ };
579
+ /**
580
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
581
+ * add them to the DOM in the appropriate place.
582
+ *
583
+ * @param parentElm the DOM node which should be used as a parent for the new
584
+ * DOM nodes
585
+ * @param before a child of the `parentElm` which the new children should be
586
+ * inserted before (optional)
587
+ * @param parentVNode the parent virtual DOM node
588
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
589
+ * @param startIdx the index in the child virtual DOM nodes at which to start
590
+ * creating DOM nodes (inclusive)
591
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
592
+ * creating DOM nodes (inclusive)
593
+ */
594
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
595
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
596
+ let childNode;
597
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
598
+ containerElm = containerElm.shadowRoot;
599
+ }
600
+ for (; startIdx <= endIdx; ++startIdx) {
601
+ if (vnodes[startIdx]) {
602
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
603
+ if (childNode) {
604
+ vnodes[startIdx].$elm$ = childNode;
605
+ containerElm.insertBefore(childNode, referenceNode(before) );
606
+ }
607
+ }
608
+ }
609
+ };
610
+ /**
611
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
612
+ * This can be used to, for instance, clean up after a list of children which
613
+ * should no longer be shown.
614
+ *
615
+ * This function also handles some of Stencil's slot relocation logic.
616
+ *
617
+ * @param vnodes a list of virtual DOM nodes to remove
618
+ * @param startIdx the index at which to start removing nodes (inclusive)
619
+ * @param endIdx the index at which to stop removing nodes (inclusive)
620
+ * @param vnode a VNode
621
+ * @param elm an element
622
+ */
623
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
624
+ for (; startIdx <= endIdx; ++startIdx) {
625
+ if ((vnode = vnodes[startIdx])) {
626
+ elm = vnode.$elm$;
627
+ callNodeRefs(vnode);
628
+ {
629
+ // we're removing this element
630
+ // so it's possible we need to show slot fallback content now
631
+ checkSlotFallbackVisibility = true;
632
+ if (elm['s-ol']) {
633
+ // remove the original location comment
634
+ elm['s-ol'].remove();
635
+ }
636
+ else {
637
+ // it's possible that child nodes of the node
638
+ // that's being removed are slot nodes
639
+ putBackInOriginalLocation(elm, true);
640
+ }
641
+ }
642
+ // remove the vnode's element from the dom
643
+ elm.remove();
644
+ }
645
+ }
646
+ };
647
+ /**
648
+ * Reconcile the children of a new VNode with the children of an old VNode by
649
+ * traversing the two collections of children, identifying nodes that are
650
+ * conserved or changed, calling out to `patch` to make any necessary
651
+ * updates to the DOM, and rearranging DOM nodes as needed.
652
+ *
653
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
654
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
655
+ * 'windows' by storing start and end indices and references to the
656
+ * corresponding array entries. Initially the two 'windows' are basically equal
657
+ * to the entire array, but we progressively narrow the windows until there are
658
+ * no children left to update by doing the following:
659
+ *
660
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
661
+ * that if we have an initial array like the following we'll end up dealing
662
+ * only with a window bounded by the highlighted elements:
663
+ *
664
+ * [null, null, VNode1 , ... , VNode2, null, null]
665
+ * ^^^^^^ ^^^^^^
666
+ *
667
+ * 2. Check to see if the elements at the head and tail positions are equal
668
+ * across the windows. This will basically detect elements which haven't
669
+ * been added, removed, or changed position, i.e. if you had the following
670
+ * VNode elements (represented as HTML):
671
+ *
672
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
673
+ * newVNode: `<div><p><span>THERE</span></p></div>`
674
+ *
675
+ * Then when comparing the children of the `<div>` tag we check the equality
676
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
677
+ * same tag in the same position, we'd be able to avoid completely
678
+ * re-rendering the subtree under them with a new DOM element and would just
679
+ * call out to `patch` to handle reconciling their children and so on.
680
+ *
681
+ * 3. Check, for both windows, to see if the element at the beginning of the
682
+ * window corresponds to the element at the end of the other window. This is
683
+ * a heuristic which will let us identify _some_ situations in which
684
+ * elements have changed position, for instance it _should_ detect that the
685
+ * children nodes themselves have not changed but merely moved in the
686
+ * following example:
687
+ *
688
+ * oldVNode: `<div><element-one /><element-two /></div>`
689
+ * newVNode: `<div><element-two /><element-one /></div>`
690
+ *
691
+ * If we find cases like this then we also need to move the concrete DOM
692
+ * elements corresponding to the moved children to write the re-order to the
693
+ * DOM.
694
+ *
695
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
696
+ * nodes in the old children which have the same key as the first element in
697
+ * our window on the new children. If we find such a node we handle calling
698
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
699
+ * what we find.
700
+ *
701
+ * Finally, once we've narrowed our 'windows' to the point that either of them
702
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
703
+ * insertion or deletion that needs to happen to get a DOM state that correctly
704
+ * reflects the new child VNodes. If, for instance, after our window on the old
705
+ * children has collapsed we still have more nodes on the new children that
706
+ * we haven't dealt with yet then we need to add them, or if the new children
707
+ * collapse but we still have unhandled _old_ children then we need to make
708
+ * sure the corresponding DOM nodes are removed.
709
+ *
710
+ * @param parentElm the node into which the parent VNode is rendered
711
+ * @param oldCh the old children of the parent node
712
+ * @param newVNode the new VNode which will replace the parent
713
+ * @param newCh the new children of the parent node
714
+ */
715
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
716
+ let oldStartIdx = 0;
717
+ let newStartIdx = 0;
718
+ let oldEndIdx = oldCh.length - 1;
719
+ let oldStartVnode = oldCh[0];
720
+ let oldEndVnode = oldCh[oldEndIdx];
721
+ let newEndIdx = newCh.length - 1;
722
+ let newStartVnode = newCh[0];
723
+ let newEndVnode = newCh[newEndIdx];
724
+ let node;
725
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
726
+ if (oldStartVnode == null) {
727
+ // VNode might have been moved left
728
+ oldStartVnode = oldCh[++oldStartIdx];
729
+ }
730
+ else if (oldEndVnode == null) {
731
+ oldEndVnode = oldCh[--oldEndIdx];
732
+ }
733
+ else if (newStartVnode == null) {
734
+ newStartVnode = newCh[++newStartIdx];
735
+ }
736
+ else if (newEndVnode == null) {
737
+ newEndVnode = newCh[--newEndIdx];
738
+ }
739
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
740
+ // if the start nodes are the same then we should patch the new VNode
741
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
742
+ // indices to reflect that. We don't need to move any DOM Nodes around
743
+ // since things are matched up in order.
744
+ patch(oldStartVnode, newStartVnode);
745
+ oldStartVnode = oldCh[++oldStartIdx];
746
+ newStartVnode = newCh[++newStartIdx];
747
+ }
748
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
749
+ // likewise, if the end nodes are the same we patch new onto old and
750
+ // decrement our end indices, and also likewise in this case we don't
751
+ // need to move any DOM Nodes.
752
+ patch(oldEndVnode, newEndVnode);
753
+ oldEndVnode = oldCh[--oldEndIdx];
754
+ newEndVnode = newCh[--newEndIdx];
755
+ }
756
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
757
+ // case: "Vnode moved right"
758
+ //
759
+ // We've found that the last node in our window on the new children is
760
+ // the same VNode as the _first_ node in our window on the old children
761
+ // we're dealing with now. Visually, this is the layout of these two
762
+ // nodes:
763
+ //
764
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
765
+ // ^^^^^^^^^^^
766
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
767
+ // ^^^^^^^^^^^^^
768
+ //
769
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
770
+ // and move the DOM element for `oldStartVnode`.
771
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
772
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
773
+ }
774
+ patch(oldStartVnode, newEndVnode);
775
+ // We need to move the element for `oldStartVnode` into a position which
776
+ // will be appropriate for `newEndVnode`. For this we can use
777
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
778
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
779
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
780
+ //
781
+ // <old-start-node />
782
+ // <some-intervening-node />
783
+ // <old-end-node />
784
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
785
+ // <next-sibling />
786
+ //
787
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
788
+ // the node for `oldStartVnode` at the end of the children of
789
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
790
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
791
+ // append it to the children of the parent element.
792
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
793
+ oldStartVnode = oldCh[++oldStartIdx];
794
+ newEndVnode = newCh[--newEndIdx];
795
+ }
796
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
797
+ // case: "Vnode moved left"
798
+ //
799
+ // We've found that the first node in our window on the new children is
800
+ // the same VNode as the _last_ node in our window on the old children.
801
+ // Visually, this is the layout of these two nodes:
802
+ //
803
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
804
+ // ^^^^^^^^^^^^^
805
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
806
+ // ^^^^^^^^^^^
807
+ //
808
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
809
+ // (which will handle updating any changed attributes, reconciling their
810
+ // children etc) but we also need to move the DOM node to which
811
+ // `oldEndVnode` corresponds.
812
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
813
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
814
+ }
815
+ patch(oldEndVnode, newStartVnode);
816
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
817
+ // the same node, so since we're here we know that they are not. Thus we
818
+ // can move the element for `oldEndVnode` _before_ the element for
819
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
820
+ // future.
821
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
822
+ oldEndVnode = oldCh[--oldEndIdx];
823
+ newStartVnode = newCh[++newStartIdx];
824
+ }
825
+ else {
826
+ {
827
+ // We either didn't find an element in the old children that matches
828
+ // the key of the first new child OR the build is not using `key`
829
+ // attributes at all. In either case we need to create a new element
830
+ // for the new node.
831
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
832
+ newStartVnode = newCh[++newStartIdx];
833
+ }
834
+ if (node) {
835
+ // if we created a new node then handle inserting it to the DOM
836
+ {
837
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
838
+ }
839
+ }
840
+ }
841
+ }
842
+ if (oldStartIdx > oldEndIdx) {
843
+ // we have some more new nodes to add which don't match up with old nodes
844
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
845
+ }
846
+ else if (newStartIdx > newEndIdx) {
847
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
848
+ // in the new array, so lets remove them (which entails cleaning up the
849
+ // relevant DOM nodes)
850
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
851
+ }
852
+ };
853
+ /**
854
+ * Compare two VNodes to determine if they are the same
855
+ *
856
+ * **NB**: This function is an equality _heuristic_ based on the available
857
+ * information set on the two VNodes and can be misleading under certain
858
+ * circumstances. In particular, if the two nodes do not have `key` attrs
859
+ * (available under `$key$` on VNodes) then the function falls back on merely
860
+ * checking that they have the same tag.
861
+ *
862
+ * So, in other words, if `key` attrs are not set on VNodes which may be
863
+ * changing order within a `children` array or something along those lines then
864
+ * we could obtain a false negative and then have to do needless re-rendering
865
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
866
+ *
867
+ * @param leftVNode the first VNode to check
868
+ * @param rightVNode the second VNode to check
869
+ * @returns whether they're equal or not
870
+ */
871
+ const isSameVnode = (leftVNode, rightVNode) => {
872
+ // compare if two vnode to see if they're "technically" the same
873
+ // need to have the same element tag, and same key to be the same
874
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
875
+ if (leftVNode.$tag$ === 'slot') {
876
+ return leftVNode.$name$ === rightVNode.$name$;
877
+ }
878
+ return true;
879
+ }
880
+ return false;
881
+ };
882
+ const referenceNode = (node) => {
883
+ // this node was relocated to a new location in the dom
884
+ // because of some other component's slot
885
+ // but we still have an html comment in place of where
886
+ // it's original location was according to it's original vdom
887
+ return (node && node['s-ol']) || node;
888
+ };
889
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
890
+ /**
891
+ * Handle reconciling an outdated VNode with a new one which corresponds to
892
+ * it. This function handles flushing updates to the DOM and reconciling the
893
+ * children of the two nodes (if any).
894
+ *
895
+ * @param oldVNode an old VNode whose DOM element and children we want to update
896
+ * @param newVNode a new VNode representing an updated version of the old one
897
+ */
898
+ const patch = (oldVNode, newVNode) => {
899
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
900
+ const oldChildren = oldVNode.$children$;
901
+ const newChildren = newVNode.$children$;
902
+ const tag = newVNode.$tag$;
903
+ const text = newVNode.$text$;
904
+ let defaultHolder;
905
+ if (text === null) {
906
+ {
907
+ if (tag === 'slot')
908
+ ;
909
+ else {
910
+ // either this is the first render of an element OR it's an update
911
+ // AND we already know it's possible it could have changed
912
+ // this updates the element's css classes, attrs, props, listeners, etc.
913
+ updateElement(oldVNode, newVNode, isSvgMode);
914
+ }
915
+ }
916
+ if (oldChildren !== null && newChildren !== null) {
917
+ // looks like there's child vnodes for both the old and new vnodes
918
+ // so we need to call `updateChildren` to reconcile them
919
+ updateChildren(elm, oldChildren, newVNode, newChildren);
920
+ }
921
+ else if (newChildren !== null) {
922
+ // no old child vnodes, but there are new child vnodes to add
923
+ if (oldVNode.$text$ !== null) {
924
+ // the old vnode was text, so be sure to clear it out
925
+ elm.textContent = '';
926
+ }
927
+ // add the new vnode children
928
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
929
+ }
930
+ else if (oldChildren !== null) {
931
+ // no new child vnodes, but there are old child vnodes to remove
932
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
933
+ }
934
+ }
935
+ else if ((defaultHolder = elm['s-cr'])) {
936
+ // this element has slotted content
937
+ defaultHolder.parentNode.textContent = text;
938
+ }
939
+ else if (oldVNode.$text$ !== text) {
940
+ // update the text content for the text only vnode
941
+ // and also only if the text is different than before
942
+ elm.data = text;
943
+ }
944
+ };
945
+ const updateFallbackSlotVisibility = (elm) => {
946
+ // tslint:disable-next-line: prefer-const
947
+ const childNodes = elm.childNodes;
948
+ let childNode;
949
+ let i;
950
+ let ilen;
951
+ let j;
952
+ let slotNameAttr;
953
+ let nodeType;
954
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
955
+ childNode = childNodes[i];
956
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
957
+ if (childNode['s-sr']) {
958
+ // this is a slot fallback node
959
+ // get the slot name for this slot reference node
960
+ slotNameAttr = childNode['s-sn'];
961
+ // by default always show a fallback slot node
962
+ // then hide it if there are other slots in the light dom
963
+ childNode.hidden = false;
964
+ for (j = 0; j < ilen; j++) {
965
+ nodeType = childNodes[j].nodeType;
966
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
967
+ // this sibling node is from a different component OR is a named fallback slot node
968
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
969
+ childNode.hidden = true;
970
+ break;
971
+ }
972
+ }
973
+ else {
974
+ // this is a default fallback slot node
975
+ // any element or text node (with content)
976
+ // should hide the default fallback slot node
977
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
978
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
979
+ childNode.hidden = true;
980
+ break;
981
+ }
982
+ }
983
+ }
984
+ }
985
+ // keep drilling down
986
+ updateFallbackSlotVisibility(childNode);
987
+ }
988
+ }
989
+ };
990
+ const relocateNodes = [];
991
+ const relocateSlotContent = (elm) => {
992
+ // tslint:disable-next-line: prefer-const
993
+ let childNode;
994
+ let node;
995
+ let hostContentNodes;
996
+ let slotNameAttr;
997
+ let relocateNodeData;
998
+ let j;
999
+ let i = 0;
1000
+ const childNodes = elm.childNodes;
1001
+ const ilen = childNodes.length;
1002
+ for (; i < ilen; i++) {
1003
+ childNode = childNodes[i];
1004
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1005
+ // first got the content reference comment node
1006
+ // then we got it's parent, which is where all the host content is in now
1007
+ hostContentNodes = node.parentNode.childNodes;
1008
+ slotNameAttr = childNode['s-sn'];
1009
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1010
+ node = hostContentNodes[j];
1011
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1012
+ // let's do some relocating to its new home
1013
+ // but never relocate a content reference node
1014
+ // that is suppose to always represent the original content location
1015
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1016
+ // it's possible we've already decided to relocate this node
1017
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1018
+ // made some changes to slots
1019
+ // let's make sure we also double check
1020
+ // fallbacks are correctly hidden or shown
1021
+ checkSlotFallbackVisibility = true;
1022
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1023
+ if (relocateNodeData) {
1024
+ // previously we never found a slot home for this node
1025
+ // but turns out we did, so let's remember it now
1026
+ relocateNodeData.$slotRefNode$ = childNode;
1027
+ }
1028
+ else {
1029
+ // add to our list of nodes to relocate
1030
+ relocateNodes.push({
1031
+ $slotRefNode$: childNode,
1032
+ $nodeToRelocate$: node,
1033
+ });
1034
+ }
1035
+ if (node['s-sr']) {
1036
+ relocateNodes.map((relocateNode) => {
1037
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1038
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1039
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1040
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1041
+ }
1042
+ }
1043
+ });
1044
+ }
1045
+ }
1046
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1047
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1048
+ // if we never find a home for this element then we'll need to hide it
1049
+ relocateNodes.push({
1050
+ $nodeToRelocate$: node,
1051
+ });
1052
+ }
1053
+ }
1054
+ }
1055
+ }
1056
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1057
+ relocateSlotContent(childNode);
1058
+ }
1059
+ }
1060
+ };
1061
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1062
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1063
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1064
+ return true;
1065
+ }
1066
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1067
+ return true;
1068
+ }
1069
+ return false;
1070
+ }
1071
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1072
+ return true;
1073
+ }
1074
+ return slotNameAttr === '';
1075
+ };
1076
+ const callNodeRefs = (vNode) => {
1077
+ {
1078
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1079
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
1080
+ }
1081
+ };
1082
+ /**
1083
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1084
+ *
1085
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1086
+ * function will handle creating a virtual DOM tree with a single root, patching
1087
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1088
+ * relocation, and reflecting attributes.
1089
+ *
1090
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1091
+ * the DOM node into which it should be rendered.
1092
+ * @param renderFnResults the virtual DOM nodes to be rendered
1093
+ */
1094
+ const renderVdom = (hostRef, renderFnResults) => {
1095
+ const hostElm = hostRef.$hostElement$;
1096
+ const cmpMeta = hostRef.$cmpMeta$;
1097
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1098
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1099
+ hostTagName = hostElm.tagName;
1100
+ if (cmpMeta.$attrsToReflect$) {
1101
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1102
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1103
+ }
1104
+ rootVnode.$tag$ = null;
1105
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1106
+ hostRef.$vnode$ = rootVnode;
1107
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1108
+ {
1109
+ scopeId = hostElm['s-sc'];
1110
+ }
1111
+ {
1112
+ contentRef = hostElm['s-cr'];
1113
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1114
+ // always reset
1115
+ checkSlotFallbackVisibility = false;
1116
+ }
1117
+ // synchronous patch
1118
+ patch(oldVNode, rootVnode);
1119
+ {
1120
+ // while we're moving nodes around existing nodes, temporarily disable
1121
+ // the disconnectCallback from working
1122
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1123
+ if (checkSlotRelocate) {
1124
+ relocateSlotContent(rootVnode.$elm$);
1125
+ let relocateData;
1126
+ let nodeToRelocate;
1127
+ let orgLocationNode;
1128
+ let parentNodeRef;
1129
+ let insertBeforeNode;
1130
+ let refNode;
1131
+ let i = 0;
1132
+ for (; i < relocateNodes.length; i++) {
1133
+ relocateData = relocateNodes[i];
1134
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1135
+ if (!nodeToRelocate['s-ol']) {
1136
+ // add a reference node marking this node's original location
1137
+ // keep a reference to this node for later lookups
1138
+ orgLocationNode =
1139
+ doc.createTextNode('');
1140
+ orgLocationNode['s-nr'] = nodeToRelocate;
1141
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1142
+ }
1143
+ }
1144
+ for (i = 0; i < relocateNodes.length; i++) {
1145
+ relocateData = relocateNodes[i];
1146
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1147
+ if (relocateData.$slotRefNode$) {
1148
+ // by default we're just going to insert it directly
1149
+ // after the slot reference node
1150
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1151
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1152
+ orgLocationNode = nodeToRelocate['s-ol'];
1153
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1154
+ refNode = orgLocationNode['s-nr'];
1155
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1156
+ refNode = refNode.nextSibling;
1157
+ if (!refNode || !refNode['s-nr']) {
1158
+ insertBeforeNode = refNode;
1159
+ break;
1160
+ }
1161
+ }
1162
+ }
1163
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1164
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1165
+ // we've checked that it's worth while to relocate
1166
+ // since that the node to relocate
1167
+ // has a different next sibling or parent relocated
1168
+ if (nodeToRelocate !== insertBeforeNode) {
1169
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1170
+ // probably a component in the index.html that doesn't have it's hostname set
1171
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1172
+ }
1173
+ // add it back to the dom but in its new home
1174
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1175
+ }
1176
+ }
1177
+ }
1178
+ else {
1179
+ // this node doesn't have a slot home to go to, so let's hide it
1180
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1181
+ nodeToRelocate.hidden = true;
1182
+ }
1183
+ }
1184
+ }
1185
+ }
1186
+ if (checkSlotFallbackVisibility) {
1187
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1188
+ }
1189
+ // done moving nodes around
1190
+ // allow the disconnect callback to work again
1191
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1192
+ // always reset
1193
+ relocateNodes.length = 0;
1194
+ }
1195
+ };
1196
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1197
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1198
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1199
+ }
1200
+ };
1201
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1202
+ {
1203
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1204
+ }
1205
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1206
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1207
+ return;
1208
+ }
1209
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1210
+ // there is no ancestor component or the ancestor component
1211
+ // has already fired off its lifecycle update then
1212
+ // fire off the initial update
1213
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1214
+ return writeTask(dispatch) ;
1215
+ };
1216
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1217
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1218
+ const instance = hostRef.$lazyInstance$ ;
1219
+ let promise;
1220
+ if (isInitialLoad) {
1221
+ {
1222
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
1223
+ if (hostRef.$queuedListeners$) {
1224
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1225
+ hostRef.$queuedListeners$ = null;
1226
+ }
1227
+ }
1228
+ {
1229
+ promise = safeCall(instance, 'componentWillLoad');
1230
+ }
1231
+ }
1232
+ {
1233
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1234
+ }
1235
+ endSchedule();
1236
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1237
+ };
1238
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1239
+ // updateComponent
1240
+ const elm = hostRef.$hostElement$;
1241
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1242
+ const rc = elm['s-rc'];
1243
+ if (isInitialLoad) {
1244
+ // DOM WRITE!
1245
+ attachStyles(hostRef);
1246
+ }
1247
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1248
+ {
1249
+ callRender(hostRef, instance);
1250
+ }
1251
+ if (rc) {
1252
+ // ok, so turns out there are some child host elements
1253
+ // waiting on this parent element to load
1254
+ // let's fire off all update callbacks waiting
1255
+ rc.map((cb) => cb());
1256
+ elm['s-rc'] = undefined;
1257
+ }
1258
+ endRender();
1259
+ endUpdate();
1260
+ {
1261
+ const childrenPromises = elm['s-p'];
1262
+ const postUpdate = () => postUpdateComponent(hostRef);
1263
+ if (childrenPromises.length === 0) {
1264
+ postUpdate();
1265
+ }
1266
+ else {
1267
+ Promise.all(childrenPromises).then(postUpdate);
1268
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1269
+ childrenPromises.length = 0;
1270
+ }
1271
+ }
1272
+ };
1273
+ const callRender = (hostRef, instance, elm) => {
1274
+ try {
1275
+ instance = instance.render() ;
1276
+ {
1277
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1278
+ }
1279
+ {
1280
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1281
+ }
1282
+ {
1283
+ {
1284
+ // looks like we've got child nodes to render into this host element
1285
+ // or we need to update the css class/attrs on the host element
1286
+ // DOM WRITE!
1287
+ {
1288
+ renderVdom(hostRef, instance);
1289
+ }
1290
+ }
1291
+ }
1292
+ }
1293
+ catch (e) {
1294
+ consoleError(e, hostRef.$hostElement$);
1295
+ }
1296
+ return null;
1297
+ };
1298
+ const postUpdateComponent = (hostRef) => {
1299
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1300
+ const elm = hostRef.$hostElement$;
1301
+ const endPostUpdate = createTime('postUpdate', tagName);
1302
+ const instance = hostRef.$lazyInstance$ ;
1303
+ const ancestorComponent = hostRef.$ancestorComponent$;
1304
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1305
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1306
+ {
1307
+ // DOM WRITE!
1308
+ addHydratedFlag(elm);
1309
+ }
1310
+ {
1311
+ safeCall(instance, 'componentDidLoad');
1312
+ }
1313
+ endPostUpdate();
1314
+ {
1315
+ hostRef.$onReadyResolve$(elm);
1316
+ if (!ancestorComponent) {
1317
+ appDidLoad();
1318
+ }
1319
+ }
1320
+ }
1321
+ else {
1322
+ endPostUpdate();
1323
+ }
1324
+ {
1325
+ hostRef.$onInstanceResolve$(elm);
1326
+ }
1327
+ // load events fire from bottom to top
1328
+ // the deepest elements load first then bubbles up
1329
+ {
1330
+ if (hostRef.$onRenderResolve$) {
1331
+ hostRef.$onRenderResolve$();
1332
+ hostRef.$onRenderResolve$ = undefined;
1333
+ }
1334
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1335
+ nextTick(() => scheduleUpdate(hostRef, false));
1336
+ }
1337
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1338
+ }
1339
+ // ( •_•)
1340
+ // ( •_•)>⌐■-■
1341
+ // (⌐■_■)
1342
+ };
1343
+ const appDidLoad = (who) => {
1344
+ // on appload
1345
+ // we have finish the first big initial render
1346
+ {
1347
+ addHydratedFlag(doc.documentElement);
1348
+ }
1349
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1350
+ };
1351
+ const safeCall = (instance, method, arg) => {
1352
+ if (instance && instance[method]) {
1353
+ try {
1354
+ return instance[method](arg);
1355
+ }
1356
+ catch (e) {
1357
+ consoleError(e);
1358
+ }
1359
+ }
1360
+ return undefined;
1361
+ };
1362
+ const then = (promise, thenFn) => {
1363
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1364
+ };
1365
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1366
+ ;
1367
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1368
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1369
+ // check our new property value against our internal value
1370
+ const hostRef = getHostRef(ref);
1371
+ const elm = hostRef.$hostElement$ ;
1372
+ const oldVal = hostRef.$instanceValues$.get(propName);
1373
+ const flags = hostRef.$flags$;
1374
+ const instance = hostRef.$lazyInstance$ ;
1375
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1376
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1377
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1378
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1379
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1380
+ // gadzooks! the property's value has changed!!
1381
+ // set our new value!
1382
+ hostRef.$instanceValues$.set(propName, newVal);
1383
+ if (instance) {
1384
+ // get an array of method names of watch functions to call
1385
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1386
+ const watchMethods = cmpMeta.$watchers$[propName];
1387
+ if (watchMethods) {
1388
+ // this instance is watching for when this property changed
1389
+ watchMethods.map((watchMethodName) => {
1390
+ try {
1391
+ // fire off each of the watch methods that are watching this property
1392
+ instance[watchMethodName](newVal, oldVal, propName);
1393
+ }
1394
+ catch (e) {
1395
+ consoleError(e, elm);
1396
+ }
1397
+ });
1398
+ }
1399
+ }
1400
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1401
+ // looks like this value actually changed, so we've got work to do!
1402
+ // but only if we've already rendered, otherwise just chill out
1403
+ // queue that we need to do an update, but don't worry about queuing
1404
+ // up millions cuz this function ensures it only runs once
1405
+ scheduleUpdate(hostRef, false);
1406
+ }
1407
+ }
1408
+ }
1409
+ };
1410
+ /**
1411
+ * Attach a series of runtime constructs to a compiled Stencil component
1412
+ * constructor, including getters and setters for the `@Prop` and `@State`
1413
+ * decorators, callbacks for when attributes change, and so on.
1414
+ *
1415
+ * @param Cstr the constructor for a component that we need to process
1416
+ * @param cmpMeta metadata collected previously about the component
1417
+ * @param flags a number used to store a series of bit flags
1418
+ * @returns a reference to the same constructor passed in (but now mutated)
1419
+ */
1420
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1421
+ if (cmpMeta.$members$) {
1422
+ if (Cstr.watchers) {
1423
+ cmpMeta.$watchers$ = Cstr.watchers;
1424
+ }
1425
+ // It's better to have a const than two Object.entries()
1426
+ const members = Object.entries(cmpMeta.$members$);
1427
+ const prototype = Cstr.prototype;
1428
+ members.map(([memberName, [memberFlags]]) => {
1429
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1430
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1431
+ // proxyComponent - prop
1432
+ Object.defineProperty(prototype, memberName, {
1433
+ get() {
1434
+ // proxyComponent, get value
1435
+ return getValue(this, memberName);
1436
+ },
1437
+ set(newValue) {
1438
+ // proxyComponent, set value
1439
+ setValue(this, memberName, newValue, cmpMeta);
1440
+ },
1441
+ configurable: true,
1442
+ enumerable: true,
1443
+ });
1444
+ }
1445
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1446
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1447
+ // proxyComponent - method
1448
+ Object.defineProperty(prototype, memberName, {
1449
+ value(...args) {
1450
+ const ref = getHostRef(this);
1451
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1452
+ },
1453
+ });
1454
+ }
1455
+ });
1456
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1457
+ const attrNameToPropName = new Map();
1458
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1459
+ plt.jmp(() => {
1460
+ const propName = attrNameToPropName.get(attrName);
1461
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1462
+ // in the case where an attribute was set inline.
1463
+ // ```html
1464
+ // <my-component some-attribute="some-value"></my-component>
1465
+ // ```
1466
+ //
1467
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1468
+ // programmatically changes it before it has been upgraded as shown below:
1469
+ //
1470
+ // ```html
1471
+ // <!-- this component has _not_ been upgraded yet -->
1472
+ // <my-component id="test" some-attribute="some-value"></my-component>
1473
+ // <script>
1474
+ // // grab non-upgraded component
1475
+ // el = document.querySelector("#test");
1476
+ // el.someAttribute = "another-value";
1477
+ // // upgrade component
1478
+ // customElements.define('my-component', MyComponent);
1479
+ // </script>
1480
+ // ```
1481
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1482
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1483
+ // to the value that was set inline i.e. "some-value" from above example. When
1484
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1485
+ //
1486
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1487
+ // by connectedCallback as this attributeChangedCallback will not fire.
1488
+ //
1489
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1490
+ //
1491
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1492
+ // properties here given that this goes against best practices outlined here
1493
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1494
+ if (this.hasOwnProperty(propName)) {
1495
+ newValue = this[propName];
1496
+ delete this[propName];
1497
+ }
1498
+ else if (prototype.hasOwnProperty(propName) &&
1499
+ typeof this[propName] === 'number' &&
1500
+ this[propName] == newValue) {
1501
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1502
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1503
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1504
+ return;
1505
+ }
1506
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1507
+ });
1508
+ };
1509
+ // create an array of attributes to observe
1510
+ // and also create a map of html attribute name to js property name
1511
+ Cstr.observedAttributes = members
1512
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1513
+ .map(([propName, m]) => {
1514
+ const attrName = m[1] || propName;
1515
+ attrNameToPropName.set(attrName, propName);
1516
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1517
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1518
+ }
1519
+ return attrName;
1520
+ });
1521
+ }
1522
+ }
1523
+ return Cstr;
1524
+ };
1525
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1526
+ // initializeComponent
1527
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1528
+ {
1529
+ // we haven't initialized this element yet
1530
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1531
+ // lazy loaded components
1532
+ // request the component's implementation to be
1533
+ // wired up with the host element
1534
+ Cstr = loadModule(cmpMeta);
1535
+ if (Cstr.then) {
1536
+ // Await creates a micro-task avoid if possible
1537
+ const endLoad = uniqueTime();
1538
+ Cstr = await Cstr;
1539
+ endLoad();
1540
+ }
1541
+ if (!Cstr.isProxied) {
1542
+ // we've never proxied this Constructor before
1543
+ // let's add the getters/setters to its prototype before
1544
+ // the first time we create an instance of the implementation
1545
+ {
1546
+ cmpMeta.$watchers$ = Cstr.watchers;
1547
+ }
1548
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1549
+ Cstr.isProxied = true;
1550
+ }
1551
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1552
+ // ok, time to construct the instance
1553
+ // but let's keep track of when we start and stop
1554
+ // so that the getters/setters don't incorrectly step on data
1555
+ {
1556
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1557
+ }
1558
+ // construct the lazy-loaded component implementation
1559
+ // passing the hostRef is very important during
1560
+ // construction in order to directly wire together the
1561
+ // host element and the lazy-loaded instance
1562
+ try {
1563
+ new Cstr(hostRef);
1564
+ }
1565
+ catch (e) {
1566
+ consoleError(e);
1567
+ }
1568
+ {
1569
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1570
+ }
1571
+ {
1572
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1573
+ }
1574
+ endNewInstance();
1575
+ fireConnectedCallback(hostRef.$lazyInstance$);
1576
+ }
1577
+ if (Cstr.style) {
1578
+ // this component has styles but we haven't registered them yet
1579
+ let style = Cstr.style;
1580
+ const scopeId = getScopeId(cmpMeta);
1581
+ if (!styles.has(scopeId)) {
1582
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1583
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1584
+ endRegisterStyles();
1585
+ }
1586
+ }
1587
+ }
1588
+ // we've successfully created a lazy instance
1589
+ const ancestorComponent = hostRef.$ancestorComponent$;
1590
+ const schedule = () => scheduleUpdate(hostRef, true);
1591
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1592
+ // this is the initial load and this component it has an ancestor component
1593
+ // but the ancestor component has NOT fired its will update lifecycle yet
1594
+ // so let's just cool our jets and wait for the ancestor to continue first
1595
+ // this will get fired off when the ancestor component
1596
+ // finally gets around to rendering its lazy self
1597
+ // fire off the initial update
1598
+ ancestorComponent['s-rc'].push(schedule);
1599
+ }
1600
+ else {
1601
+ schedule();
1602
+ }
1603
+ };
1604
+ const fireConnectedCallback = (instance) => {
1605
+ {
1606
+ safeCall(instance, 'connectedCallback');
1607
+ }
1608
+ };
1609
+ const connectedCallback = (elm) => {
1610
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1611
+ const hostRef = getHostRef(elm);
1612
+ const cmpMeta = hostRef.$cmpMeta$;
1613
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1614
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1615
+ // first time this component has connected
1616
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1617
+ {
1618
+ // initUpdate
1619
+ // if the slot polyfill is required we'll need to put some nodes
1620
+ // in here to act as original content anchors as we move nodes around
1621
+ // host element has been connected to the DOM
1622
+ if ((// TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
1623
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
1624
+ setContentReference(elm);
1625
+ }
1626
+ }
1627
+ {
1628
+ // find the first ancestor component (if there is one) and register
1629
+ // this component as one of the actively loading child components for its ancestor
1630
+ let ancestorComponent = elm;
1631
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1632
+ // climb up the ancestors looking for the first
1633
+ // component that hasn't finished its lifecycle update yet
1634
+ if (ancestorComponent['s-p']) {
1635
+ // we found this components first ancestor component
1636
+ // keep a reference to this component's ancestor component
1637
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1638
+ break;
1639
+ }
1640
+ }
1641
+ }
1642
+ // Lazy properties
1643
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1644
+ if (cmpMeta.$members$) {
1645
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1646
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1647
+ const value = elm[memberName];
1648
+ delete elm[memberName];
1649
+ elm[memberName] = value;
1650
+ }
1651
+ });
1652
+ }
1653
+ {
1654
+ initializeComponent(elm, hostRef, cmpMeta);
1655
+ }
1656
+ }
1657
+ else {
1658
+ // not the first time this has connected
1659
+ // reattach any event listeners to the host
1660
+ // since they would have been removed when disconnected
1661
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1662
+ // fire off connectedCallback() on component instance
1663
+ fireConnectedCallback(hostRef.$lazyInstance$);
1664
+ }
1665
+ endConnected();
1666
+ }
1667
+ };
1668
+ const setContentReference = (elm) => {
1669
+ // only required when we're NOT using native shadow dom (slot)
1670
+ // or this browser doesn't support native shadow dom
1671
+ // and this host element was NOT created with SSR
1672
+ // let's pick out the inner content for slot projection
1673
+ // create a node to represent where the original
1674
+ // content was first placed, which is useful later on
1675
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1676
+ contentRefElm['s-cn'] = true;
1677
+ elm.insertBefore(contentRefElm, elm.firstChild);
1678
+ };
1679
+ const disconnectedCallback = (elm) => {
1680
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1681
+ const hostRef = getHostRef(elm);
1682
+ {
1683
+ if (hostRef.$rmListeners$) {
1684
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1685
+ hostRef.$rmListeners$ = undefined;
1686
+ }
1687
+ }
1688
+ }
1689
+ };
1690
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1691
+ var _a;
1692
+ const endBootstrap = createTime();
1693
+ const cmpTags = [];
1694
+ const exclude = options.exclude || [];
1695
+ const customElements = win.customElements;
1696
+ const head = doc.head;
1697
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1698
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1699
+ const deferredConnectedCallbacks = [];
1700
+ let appLoadFallback;
1701
+ let isBootstrapping = true;
1702
+ Object.assign(plt, options);
1703
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1704
+ lazyBundles.map((lazyBundle) => {
1705
+ lazyBundle[1].map((compactMeta) => {
1706
+ const cmpMeta = {
1707
+ $flags$: compactMeta[0],
1708
+ $tagName$: compactMeta[1],
1709
+ $members$: compactMeta[2],
1710
+ $listeners$: compactMeta[3],
1711
+ };
1712
+ {
1713
+ cmpMeta.$members$ = compactMeta[2];
1714
+ }
1715
+ {
1716
+ cmpMeta.$listeners$ = compactMeta[3];
1717
+ }
1718
+ {
1719
+ cmpMeta.$attrsToReflect$ = [];
1720
+ }
1721
+ {
1722
+ cmpMeta.$watchers$ = {};
1723
+ }
1724
+ const tagName = cmpMeta.$tagName$;
1725
+ const HostElement = class extends HTMLElement {
1726
+ // StencilLazyHost
1727
+ constructor(self) {
1728
+ // @ts-ignore
1729
+ super(self);
1730
+ self = this;
1731
+ registerHost(self, cmpMeta);
1732
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1733
+ // this component is using shadow dom
1734
+ // and this browser supports shadow dom
1735
+ // add the read-only property "shadowRoot" to the host element
1736
+ // adding the shadow root build conditionals to minimize runtime
1737
+ {
1738
+ {
1739
+ self.attachShadow({ mode: 'open' });
1740
+ }
1741
+ }
1742
+ }
1743
+ }
1744
+ connectedCallback() {
1745
+ if (appLoadFallback) {
1746
+ clearTimeout(appLoadFallback);
1747
+ appLoadFallback = null;
1748
+ }
1749
+ if (isBootstrapping) {
1750
+ // connectedCallback will be processed once all components have been registered
1751
+ deferredConnectedCallbacks.push(this);
1752
+ }
1753
+ else {
1754
+ plt.jmp(() => connectedCallback(this));
1755
+ }
1756
+ }
1757
+ disconnectedCallback() {
1758
+ plt.jmp(() => disconnectedCallback(this));
1759
+ }
1760
+ componentOnReady() {
1761
+ return getHostRef(this).$onReadyPromise$;
1762
+ }
1763
+ };
1764
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1765
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1766
+ cmpTags.push(tagName);
1767
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1768
+ }
1769
+ });
1770
+ });
1771
+ {
1772
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1773
+ visibilityStyle.setAttribute('data-styles', '');
1774
+ // Apply CSP nonce to the style tag if it exists
1775
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1776
+ if (nonce != null) {
1777
+ visibilityStyle.setAttribute('nonce', nonce);
1778
+ }
1779
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1780
+ }
1781
+ // Process deferred connectedCallbacks now all components have been registered
1782
+ isBootstrapping = false;
1783
+ if (deferredConnectedCallbacks.length) {
1784
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1785
+ }
1786
+ else {
1787
+ {
1788
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1789
+ }
1790
+ }
1791
+ // Fallback appLoad event
1792
+ endBootstrap();
1793
+ };
1794
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1795
+ if (listeners) {
1796
+ listeners.map(([flags, name, method]) => {
1797
+ const target = elm;
1798
+ const handler = hostListenerProxy(hostRef, method);
1799
+ const opts = hostListenerOpts(flags);
1800
+ plt.ael(target, name, handler, opts);
1801
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1802
+ });
1803
+ }
1804
+ };
1805
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1806
+ try {
1807
+ {
1808
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1809
+ // instance is ready, let's call it's member method for this event
1810
+ hostRef.$lazyInstance$[methodName](ev);
1811
+ }
1812
+ else {
1813
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1814
+ }
1815
+ }
1816
+ }
1817
+ catch (e) {
1818
+ consoleError(e);
1819
+ }
1820
+ };
1821
+ // prettier-ignore
1822
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1823
+ /**
1824
+ * Assigns the given value to the nonce property on the runtime platform object.
1825
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1826
+ * @param nonce The value to be assigned to the platform nonce property.
1827
+ * @returns void
1828
+ */
1829
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1830
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1831
+ const getHostRef = (ref) => hostRefs.get(ref);
1832
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1833
+ const registerHost = (elm, cmpMeta) => {
1834
+ const hostRef = {
1835
+ $flags$: 0,
1836
+ $hostElement$: elm,
1837
+ $cmpMeta$: cmpMeta,
1838
+ $instanceValues$: new Map(),
1839
+ };
1840
+ {
1841
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1842
+ }
1843
+ {
1844
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1845
+ elm['s-p'] = [];
1846
+ elm['s-rc'] = [];
1847
+ }
1848
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1849
+ return hostRefs.set(elm, hostRef);
1850
+ };
1851
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1852
+ const consoleError = (e, el) => (0, console.error)(e, el);
1853
+ const cmpModules = /*@__PURE__*/ new Map();
1854
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1855
+ // loadModuleImport
1856
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1857
+ const bundleId = cmpMeta.$lazyBundleId$;
1858
+ const module = cmpModules.get(bundleId) ;
1859
+ if (module) {
1860
+ return module[exportName];
1861
+ }
1862
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1863
+ return import(
1864
+ /* @vite-ignore */
1865
+ /* webpackInclude: /\.entry\.js$/ */
1866
+ /* webpackExclude: /\.system\.entry\.js$/ */
1867
+ /* webpackMode: "lazy" */
1868
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1869
+ {
1870
+ cmpModules.set(bundleId, importedModule);
1871
+ }
1872
+ return importedModule[exportName];
1873
+ }, consoleError);
1874
+ };
1875
+ const styles = /*@__PURE__*/ new Map();
1876
+ const win = typeof window !== 'undefined' ? window : {};
1877
+ const doc = win.document || { head: {} };
1878
+ const plt = {
1879
+ $flags$: 0,
1880
+ $resourcesUrl$: '',
1881
+ jmp: (h) => h(),
1882
+ raf: (h) => requestAnimationFrame(h),
1883
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1884
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1885
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1886
+ };
1887
+ const promiseResolve = (v) => Promise.resolve(v);
1888
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1889
+ try {
1890
+ new CSSStyleSheet();
1891
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1892
+ }
1893
+ catch (e) { }
1894
+ return false;
1895
+ })()
1896
+ ;
1897
+ const queueDomReads = [];
1898
+ const queueDomWrites = [];
1899
+ const queueTask = (queue, write) => (cb) => {
1900
+ queue.push(cb);
1901
+ if (!queuePending) {
1902
+ queuePending = true;
1903
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1904
+ nextTick(flush);
1905
+ }
1906
+ else {
1907
+ plt.raf(flush);
1908
+ }
1909
+ }
1910
+ };
1911
+ const consume = (queue) => {
1912
+ for (let i = 0; i < queue.length; i++) {
1913
+ try {
1914
+ queue[i](performance.now());
1915
+ }
1916
+ catch (e) {
1917
+ consoleError(e);
1918
+ }
1919
+ }
1920
+ queue.length = 0;
1921
+ };
1922
+ const flush = () => {
1923
+ // always force a bunch of medium callbacks to run, but still have
1924
+ // a throttle on how many can run in a certain time
1925
+ // DOM READS!!!
1926
+ consume(queueDomReads);
1927
+ // DOM WRITES!!!
1928
+ {
1929
+ consume(queueDomWrites);
1930
+ if ((queuePending = queueDomReads.length > 0)) {
1931
+ // still more to do yet, but we've run out of time
1932
+ // let's let this thing cool off and try again in the next tick
1933
+ plt.raf(flush);
1934
+ }
1935
+ }
1936
+ };
1937
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1938
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1939
+
1940
+ export { Host as H, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1941
+
1942
+ //# sourceMappingURL=index-a64d8966.js.map