@swisspost/internet-header 1.5.0-beta.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 (508) hide show
  1. package/LICENSE +202 -0
  2. package/dist/cjs/_commonjsHelpers-537d719a.js +22 -0
  3. package/dist/cjs/_commonjsHelpers-537d719a.js.map +1 -0
  4. package/dist/cjs/bodyScrollLock.esm-59f17217.js +285 -0
  5. package/dist/cjs/bodyScrollLock.esm-59f17217.js.map +1 -0
  6. package/dist/cjs/if.component-313f59b8.js +12 -0
  7. package/dist/cjs/if.component-313f59b8.js.map +1 -0
  8. package/dist/cjs/index-5751975e.js +1735 -0
  9. package/dist/cjs/index-5751975e.js.map +1 -0
  10. package/dist/cjs/index-e7245d60.js +144 -0
  11. package/dist/cjs/index-e7245d60.js.map +1 -0
  12. package/dist/cjs/index.cjs.js +4 -0
  13. package/dist/cjs/index.cjs.js.map +1 -0
  14. package/dist/cjs/klp-widget.controller-675b23db.js +15862 -0
  15. package/dist/cjs/klp-widget.controller-675b23db.js.map +1 -0
  16. package/dist/cjs/language.service-a80ae01d.js +152 -0
  17. package/dist/cjs/language.service-a80ae01d.js.map +1 -0
  18. package/dist/cjs/loader.cjs.js +24 -0
  19. package/dist/cjs/loader.cjs.js.map +1 -0
  20. package/dist/cjs/post-klp-login-widget.cjs.entry.js +46 -0
  21. package/dist/cjs/post-klp-login-widget.cjs.entry.js.map +1 -0
  22. package/dist/cjs/post-language-switch.cjs.entry.js +103 -0
  23. package/dist/cjs/post-language-switch.cjs.entry.js.map +1 -0
  24. package/dist/cjs/post-logo.cjs.entry.js +67 -0
  25. package/dist/cjs/post-logo.cjs.entry.js.map +1 -0
  26. package/dist/cjs/post-main-navigation.cjs.entry.js +243 -0
  27. package/dist/cjs/post-main-navigation.cjs.entry.js.map +1 -0
  28. package/dist/cjs/post-meta-navigation.cjs.entry.js +28 -0
  29. package/dist/cjs/post-meta-navigation.cjs.entry.js.map +1 -0
  30. package/dist/cjs/post-search.cjs.entry.js +2739 -0
  31. package/dist/cjs/post-search.cjs.entry.js.map +1 -0
  32. package/dist/cjs/post-skiplinks.cjs.entry.js +54 -0
  33. package/dist/cjs/post-skiplinks.cjs.entry.js.map +1 -0
  34. package/dist/cjs/store-47e14589.js +202 -0
  35. package/dist/cjs/store-47e14589.js.map +1 -0
  36. package/dist/cjs/svg-icon.component-10fbda11.js +10 -0
  37. package/dist/cjs/svg-icon.component-10fbda11.js.map +1 -0
  38. package/dist/cjs/svg-sprite.component-c3b454b3.js +48 -0
  39. package/dist/cjs/svg-sprite.component-c3b454b3.js.map +1 -0
  40. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js +3488 -0
  41. package/dist/cjs/swisspost-internet-breadcrumbs.cjs.entry.js.map +1 -0
  42. package/dist/cjs/swisspost-internet-footer.cjs.entry.js +148 -0
  43. package/dist/cjs/swisspost-internet-footer.cjs.entry.js.map +1 -0
  44. package/dist/cjs/swisspost-internet-header.cjs.entry.js +704 -0
  45. package/dist/cjs/swisspost-internet-header.cjs.entry.js.map +1 -0
  46. package/dist/cjs/swisspost-internet-header.cjs.js +28 -0
  47. package/dist/cjs/swisspost-internet-header.cjs.js.map +1 -0
  48. package/dist/cjs/ui.service-db4a8252.js +35 -0
  49. package/dist/cjs/ui.service-db4a8252.js.map +1 -0
  50. package/dist/cjs/utils-b6014257.js +22 -0
  51. package/dist/cjs/utils-b6014257.js.map +1 -0
  52. package/dist/collection/assets/config/test-configuration.json +4067 -0
  53. package/dist/collection/assets/i18n/translations.js +38 -0
  54. package/dist/collection/assets/i18n/translations.js.map +1 -0
  55. package/dist/collection/assets/js/klp-login-widget.js +1716 -0
  56. package/dist/collection/assets/js/sockjs-client.js +5134 -0
  57. package/dist/collection/collection-manifest.json +27 -0
  58. package/dist/collection/components/post-internet-breadcrumbs/components/breadcrumb-list.component.js +11 -0
  59. package/dist/collection/components/post-internet-breadcrumbs/components/breadcrumb-list.component.js.map +1 -0
  60. package/dist/collection/components/post-internet-breadcrumbs/components/focus-trap.component.js +42 -0
  61. package/dist/collection/components/post-internet-breadcrumbs/components/focus-trap.component.js.map +1 -0
  62. package/dist/collection/components/post-internet-breadcrumbs/components/middle-dropdown.component.js +8 -0
  63. package/dist/collection/components/post-internet-breadcrumbs/components/middle-dropdown.component.js.map +1 -0
  64. package/dist/collection/components/post-internet-breadcrumbs/components/middle-links.component.js +6 -0
  65. package/dist/collection/components/post-internet-breadcrumbs/components/middle-links.component.js.map +1 -0
  66. package/dist/collection/components/post-internet-breadcrumbs/components/overlay.component.js +12 -0
  67. package/dist/collection/components/post-internet-breadcrumbs/components/overlay.component.js.map +1 -0
  68. package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.css +2724 -0
  69. package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.js +253 -0
  70. package/dist/collection/components/post-internet-breadcrumbs/post-internet-breadcrumbs.js.map +1 -0
  71. package/dist/collection/components/post-internet-footer/components/post-footer-block-address.component.js +12 -0
  72. package/dist/collection/components/post-internet-footer/components/post-footer-block-address.component.js.map +1 -0
  73. package/dist/collection/components/post-internet-footer/components/post-footer-block-contact.component.js +24 -0
  74. package/dist/collection/components/post-internet-footer/components/post-footer-block-contact.component.js.map +1 -0
  75. package/dist/collection/components/post-internet-footer/components/post-footer-block-custom.component.js +6 -0
  76. package/dist/collection/components/post-internet-footer/components/post-footer-block-custom.component.js.map +1 -0
  77. package/dist/collection/components/post-internet-footer/components/post-footer-block-list.component.js +6 -0
  78. package/dist/collection/components/post-internet-footer/components/post-footer-block-list.component.js.map +1 -0
  79. package/dist/collection/components/post-internet-footer/components/post-footer-block-socials.component.js +5 -0
  80. package/dist/collection/components/post-internet-footer/components/post-footer-block-socials.component.js.map +1 -0
  81. package/dist/collection/components/post-internet-footer/post-internet-footer.css +2501 -0
  82. package/dist/collection/components/post-internet-footer/post-internet-footer.js +86 -0
  83. package/dist/collection/components/post-internet-footer/post-internet-footer.js.map +1 -0
  84. package/dist/collection/components/post-internet-header/post-internet-header.css +340 -0
  85. package/dist/collection/components/post-internet-header/post-internet-header.js +676 -0
  86. package/dist/collection/components/post-internet-header/post-internet-header.js.map +1 -0
  87. package/dist/collection/components/post-klp-login-widget/klp-widget.controller.js +14 -0
  88. package/dist/collection/components/post-klp-login-widget/klp-widget.controller.js.map +1 -0
  89. package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.css +1341 -0
  90. package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.js +67 -0
  91. package/dist/collection/components/post-klp-login-widget/post-klp-login-widget.js.map +1 -0
  92. package/dist/collection/components/post-language-switch/components/post-language-switch-list.js +9 -0
  93. package/dist/collection/components/post-language-switch/components/post-language-switch-list.js.map +1 -0
  94. package/dist/collection/components/post-language-switch/post-language-switch.css +321 -0
  95. package/dist/collection/components/post-language-switch/post-language-switch.js +186 -0
  96. package/dist/collection/components/post-language-switch/post-language-switch.js.map +1 -0
  97. package/dist/collection/components/post-logo/logo-sprite.component.js +4 -0
  98. package/dist/collection/components/post-logo/logo-sprite.component.js.map +1 -0
  99. package/dist/collection/components/post-logo/post-logo.css +239 -0
  100. package/dist/collection/components/post-logo/post-logo.js +60 -0
  101. package/dist/collection/components/post-logo/post-logo.js.map +1 -0
  102. package/dist/collection/components/post-main-navigation/components/level-one-action.component.js +13 -0
  103. package/dist/collection/components/post-main-navigation/components/level-one-action.component.js.map +1 -0
  104. package/dist/collection/components/post-main-navigation/post-main-navigation.css +592 -0
  105. package/dist/collection/components/post-main-navigation/post-main-navigation.js +347 -0
  106. package/dist/collection/components/post-main-navigation/post-main-navigation.js.map +1 -0
  107. package/dist/collection/components/post-meta-navigation/post-meta-navigation.css +290 -0
  108. package/dist/collection/components/post-meta-navigation/post-meta-navigation.js +67 -0
  109. package/dist/collection/components/post-meta-navigation/post-meta-navigation.js.map +1 -0
  110. package/dist/collection/components/post-search/post-search.css +3028 -0
  111. package/dist/collection/components/post-search/post-search.js +362 -0
  112. package/dist/collection/components/post-search/post-search.js.map +1 -0
  113. package/dist/collection/components/post-skiplinks/post-skiplinks.css +20 -0
  114. package/dist/collection/components/post-skiplinks/post-skiplinks.js +51 -0
  115. package/dist/collection/components/post-skiplinks/post-skiplinks.js.map +1 -0
  116. package/dist/collection/data/store.js +11 -0
  117. package/dist/collection/data/store.js.map +1 -0
  118. package/dist/collection/index.js +2 -0
  119. package/dist/collection/index.js.map +1 -0
  120. package/dist/collection/models/breadcrumbs.model.js +2 -0
  121. package/dist/collection/models/breadcrumbs.model.js.map +1 -0
  122. package/dist/collection/models/coveo.model.js +2 -0
  123. package/dist/collection/models/coveo.model.js.map +1 -0
  124. package/dist/collection/models/footer.model.js +2 -0
  125. package/dist/collection/models/footer.model.js.map +1 -0
  126. package/dist/collection/models/general.model.js +2 -0
  127. package/dist/collection/models/general.model.js.map +1 -0
  128. package/dist/collection/models/geocode.model.js +10 -0
  129. package/dist/collection/models/geocode.model.js.map +1 -0
  130. package/dist/collection/models/header.model.js +2 -0
  131. package/dist/collection/models/header.model.js.map +1 -0
  132. package/dist/collection/models/implementor.model.js +2 -0
  133. package/dist/collection/models/implementor.model.js.map +1 -0
  134. package/dist/collection/models/language.model.js +2 -0
  135. package/dist/collection/models/language.model.js.map +1 -0
  136. package/dist/collection/models/track-and-trace.model.js +2 -0
  137. package/dist/collection/models/track-and-trace.model.js.map +1 -0
  138. package/dist/collection/services/config.service.js +170 -0
  139. package/dist/collection/services/config.service.js.map +1 -0
  140. package/dist/collection/services/language.service.js +107 -0
  141. package/dist/collection/services/language.service.js.map +1 -0
  142. package/dist/collection/services/route.service.js +163 -0
  143. package/dist/collection/services/route.service.js.map +1 -0
  144. package/dist/collection/services/search/coveo.service.js +34 -0
  145. package/dist/collection/services/search/coveo.service.js.map +1 -0
  146. package/dist/collection/services/search/coveo.settings.js +19 -0
  147. package/dist/collection/services/search/coveo.settings.js.map +1 -0
  148. package/dist/collection/services/search/parcel.service.js +54 -0
  149. package/dist/collection/services/search/parcel.service.js.map +1 -0
  150. package/dist/collection/services/search/places.service.js +95 -0
  151. package/dist/collection/services/search/places.service.js.map +1 -0
  152. package/dist/collection/services/search/places.settings.js +16 -0
  153. package/dist/collection/services/search/places.settings.js.map +1 -0
  154. package/dist/collection/services/search/search-utilities.js +26 -0
  155. package/dist/collection/services/search/search-utilities.js.map +1 -0
  156. package/dist/collection/services/search/search.service.js +42 -0
  157. package/dist/collection/services/search/search.service.js.map +1 -0
  158. package/dist/collection/services/ui.service.js +30 -0
  159. package/dist/collection/services/ui.service.js.map +1 -0
  160. package/dist/collection/tests/setup-tests.js +14 -0
  161. package/dist/collection/tests/setup-tests.js.map +1 -0
  162. package/dist/collection/utils/highlighted.component.js +11 -0
  163. package/dist/collection/utils/highlighted.component.js.map +1 -0
  164. package/dist/collection/utils/if.component.js +7 -0
  165. package/dist/collection/utils/if.component.js.map +1 -0
  166. package/dist/collection/utils/svg-icon.component.js +3 -0
  167. package/dist/collection/utils/svg-icon.component.js.map +1 -0
  168. package/dist/collection/utils/svg-sprite.component.js +3 -0
  169. package/dist/collection/utils/svg-sprite.component.js.map +1 -0
  170. package/dist/collection/utils/utils.js +16 -0
  171. package/dist/collection/utils/utils.js.map +1 -0
  172. package/dist/components/_commonjsHelpers.js +19 -0
  173. package/dist/components/_commonjsHelpers.js.map +1 -0
  174. package/dist/components/bodyScrollLock.esm.js +281 -0
  175. package/dist/components/bodyScrollLock.esm.js.map +1 -0
  176. package/dist/components/index.d.ts +39 -0
  177. package/dist/components/index.js +36 -0
  178. package/dist/components/index.js.map +1 -0
  179. package/dist/components/index2.js +141 -0
  180. package/dist/components/index2.js.map +1 -0
  181. package/dist/components/klp-widget.controller.js +15860 -0
  182. package/dist/components/klp-widget.controller.js.map +1 -0
  183. package/dist/components/language.service.js +148 -0
  184. package/dist/components/language.service.js.map +1 -0
  185. package/dist/components/post-klp-login-widget.d.ts +11 -0
  186. package/dist/components/post-klp-login-widget.js +8 -0
  187. package/dist/components/post-klp-login-widget.js.map +1 -0
  188. package/dist/components/post-klp-login-widget2.js +59 -0
  189. package/dist/components/post-klp-login-widget2.js.map +1 -0
  190. package/dist/components/post-language-switch.d.ts +11 -0
  191. package/dist/components/post-language-switch.js +8 -0
  192. package/dist/components/post-language-switch.js.map +1 -0
  193. package/dist/components/post-language-switch2.js +118 -0
  194. package/dist/components/post-language-switch2.js.map +1 -0
  195. package/dist/components/post-logo.d.ts +11 -0
  196. package/dist/components/post-logo.js +8 -0
  197. package/dist/components/post-logo.js.map +1 -0
  198. package/dist/components/post-logo2.js +80 -0
  199. package/dist/components/post-logo2.js.map +1 -0
  200. package/dist/components/post-main-navigation.d.ts +11 -0
  201. package/dist/components/post-main-navigation.js +8 -0
  202. package/dist/components/post-main-navigation.js.map +1 -0
  203. package/dist/components/post-main-navigation2.js +260 -0
  204. package/dist/components/post-main-navigation2.js.map +1 -0
  205. package/dist/components/post-meta-navigation.d.ts +11 -0
  206. package/dist/components/post-meta-navigation.js +8 -0
  207. package/dist/components/post-meta-navigation.js.map +1 -0
  208. package/dist/components/post-meta-navigation2.js +42 -0
  209. package/dist/components/post-meta-navigation2.js.map +1 -0
  210. package/dist/components/post-search.d.ts +11 -0
  211. package/dist/components/post-search.js +8 -0
  212. package/dist/components/post-search.js.map +1 -0
  213. package/dist/components/post-search2.js +2763 -0
  214. package/dist/components/post-search2.js.map +1 -0
  215. package/dist/components/post-skiplinks.d.ts +11 -0
  216. package/dist/components/post-skiplinks.js +8 -0
  217. package/dist/components/post-skiplinks.js.map +1 -0
  218. package/dist/components/post-skiplinks2.js +64 -0
  219. package/dist/components/post-skiplinks2.js.map +1 -0
  220. package/dist/components/store.js +199 -0
  221. package/dist/components/store.js.map +1 -0
  222. package/dist/components/svg-icon.component.js +8 -0
  223. package/dist/components/svg-icon.component.js.map +1 -0
  224. package/dist/components/svg-sprite.component.js +46 -0
  225. package/dist/components/svg-sprite.component.js.map +1 -0
  226. package/dist/components/swisspost-internet-breadcrumbs.d.ts +11 -0
  227. package/dist/components/swisspost-internet-breadcrumbs.js +3509 -0
  228. package/dist/components/swisspost-internet-breadcrumbs.js.map +1 -0
  229. package/dist/components/swisspost-internet-footer.d.ts +11 -0
  230. package/dist/components/swisspost-internet-footer.js +164 -0
  231. package/dist/components/swisspost-internet-footer.js.map +1 -0
  232. package/dist/components/swisspost-internet-header.d.ts +11 -0
  233. package/dist/components/swisspost-internet-header.js +779 -0
  234. package/dist/components/swisspost-internet-header.js.map +1 -0
  235. package/dist/components/ui.service.js +32 -0
  236. package/dist/components/ui.service.js.map +1 -0
  237. package/dist/components/utils.js +19 -0
  238. package/dist/components/utils.js.map +1 -0
  239. package/dist/esm/_commonjsHelpers-9943807e.js +19 -0
  240. package/dist/esm/_commonjsHelpers-9943807e.js.map +1 -0
  241. package/dist/esm/bodyScrollLock.esm-afcc00e3.js +281 -0
  242. package/dist/esm/bodyScrollLock.esm-afcc00e3.js.map +1 -0
  243. package/dist/esm/if.component-542fb8c3.js +10 -0
  244. package/dist/esm/if.component-542fb8c3.js.map +1 -0
  245. package/dist/esm/index-066666f4.js +1704 -0
  246. package/dist/esm/index-066666f4.js.map +1 -0
  247. package/dist/esm/index-a75df186.js +141 -0
  248. package/dist/esm/index-a75df186.js.map +1 -0
  249. package/dist/esm/index.js +3 -0
  250. package/dist/esm/index.js.map +1 -0
  251. package/dist/esm/klp-widget.controller-be1eeb16.js +15860 -0
  252. package/dist/esm/klp-widget.controller-be1eeb16.js.map +1 -0
  253. package/dist/esm/language.service-e49858e0.js +148 -0
  254. package/dist/esm/language.service-e49858e0.js.map +1 -0
  255. package/dist/esm/loader.js +20 -0
  256. package/dist/esm/loader.js.map +1 -0
  257. package/dist/esm/polyfills/core-js.js +11 -0
  258. package/dist/esm/polyfills/css-shim.js +1 -0
  259. package/dist/esm/polyfills/dom.js +79 -0
  260. package/dist/esm/polyfills/es5-html-element.js +1 -0
  261. package/dist/esm/polyfills/index.js +34 -0
  262. package/dist/esm/polyfills/system.js +6 -0
  263. package/dist/esm/post-klp-login-widget.entry.js +42 -0
  264. package/dist/esm/post-klp-login-widget.entry.js.map +1 -0
  265. package/dist/esm/post-language-switch.entry.js +99 -0
  266. package/dist/esm/post-language-switch.entry.js.map +1 -0
  267. package/dist/esm/post-logo.entry.js +63 -0
  268. package/dist/esm/post-logo.entry.js.map +1 -0
  269. package/dist/esm/post-main-navigation.entry.js +239 -0
  270. package/dist/esm/post-main-navigation.entry.js.map +1 -0
  271. package/dist/esm/post-meta-navigation.entry.js +24 -0
  272. package/dist/esm/post-meta-navigation.entry.js.map +1 -0
  273. package/dist/esm/post-search.entry.js +2735 -0
  274. package/dist/esm/post-search.entry.js.map +1 -0
  275. package/dist/esm/post-skiplinks.entry.js +50 -0
  276. package/dist/esm/post-skiplinks.entry.js.map +1 -0
  277. package/dist/esm/store-d495dc07.js +199 -0
  278. package/dist/esm/store-d495dc07.js.map +1 -0
  279. package/dist/esm/svg-icon.component-1b1b27a2.js +8 -0
  280. package/dist/esm/svg-icon.component-1b1b27a2.js.map +1 -0
  281. package/dist/esm/svg-sprite.component-ec0ac38c.js +46 -0
  282. package/dist/esm/svg-sprite.component-ec0ac38c.js.map +1 -0
  283. package/dist/esm/swisspost-internet-breadcrumbs.entry.js +3484 -0
  284. package/dist/esm/swisspost-internet-breadcrumbs.entry.js.map +1 -0
  285. package/dist/esm/swisspost-internet-footer.entry.js +144 -0
  286. package/dist/esm/swisspost-internet-footer.entry.js.map +1 -0
  287. package/dist/esm/swisspost-internet-header.entry.js +700 -0
  288. package/dist/esm/swisspost-internet-header.entry.js.map +1 -0
  289. package/dist/esm/swisspost-internet-header.js +23 -0
  290. package/dist/esm/swisspost-internet-header.js.map +1 -0
  291. package/dist/esm/ui.service-1d9b0f51.js +32 -0
  292. package/dist/esm/ui.service-1d9b0f51.js.map +1 -0
  293. package/dist/esm/utils-5bf107ff.js +19 -0
  294. package/dist/esm/utils-5bf107ff.js.map +1 -0
  295. package/dist/esm-es5/_commonjsHelpers-9943807e.js +2 -0
  296. package/dist/esm-es5/_commonjsHelpers-9943807e.js.map +1 -0
  297. package/dist/esm-es5/bodyScrollLock.esm-afcc00e3.js +2 -0
  298. package/dist/esm-es5/bodyScrollLock.esm-afcc00e3.js.map +1 -0
  299. package/dist/esm-es5/if.component-542fb8c3.js +2 -0
  300. package/dist/esm-es5/if.component-542fb8c3.js.map +1 -0
  301. package/dist/esm-es5/index-066666f4.js +3 -0
  302. package/dist/esm-es5/index-066666f4.js.map +1 -0
  303. package/dist/esm-es5/index-a75df186.js +2 -0
  304. package/dist/esm-es5/index-a75df186.js.map +1 -0
  305. package/dist/esm-es5/index.js +2 -0
  306. package/dist/esm-es5/index.js.map +1 -0
  307. package/dist/esm-es5/klp-widget.controller-be1eeb16.js +27 -0
  308. package/dist/esm-es5/klp-widget.controller-be1eeb16.js.map +1 -0
  309. package/dist/esm-es5/language.service-e49858e0.js +2 -0
  310. package/dist/esm-es5/language.service-e49858e0.js.map +1 -0
  311. package/dist/esm-es5/loader.js +2 -0
  312. package/dist/esm-es5/loader.js.map +1 -0
  313. package/dist/esm-es5/post-klp-login-widget.entry.js +2 -0
  314. package/dist/esm-es5/post-klp-login-widget.entry.js.map +1 -0
  315. package/dist/esm-es5/post-language-switch.entry.js +2 -0
  316. package/dist/esm-es5/post-language-switch.entry.js.map +1 -0
  317. package/dist/esm-es5/post-logo.entry.js +2 -0
  318. package/dist/esm-es5/post-logo.entry.js.map +1 -0
  319. package/dist/esm-es5/post-main-navigation.entry.js +2 -0
  320. package/dist/esm-es5/post-main-navigation.entry.js.map +1 -0
  321. package/dist/esm-es5/post-meta-navigation.entry.js +2 -0
  322. package/dist/esm-es5/post-meta-navigation.entry.js.map +1 -0
  323. package/dist/esm-es5/post-search.entry.js +2 -0
  324. package/dist/esm-es5/post-search.entry.js.map +1 -0
  325. package/dist/esm-es5/post-skiplinks.entry.js +2 -0
  326. package/dist/esm-es5/post-skiplinks.entry.js.map +1 -0
  327. package/dist/esm-es5/store-d495dc07.js +2 -0
  328. package/dist/esm-es5/store-d495dc07.js.map +1 -0
  329. package/dist/esm-es5/svg-icon.component-1b1b27a2.js +2 -0
  330. package/dist/esm-es5/svg-icon.component-1b1b27a2.js.map +1 -0
  331. package/dist/esm-es5/svg-sprite.component-ec0ac38c.js +2 -0
  332. package/dist/esm-es5/svg-sprite.component-ec0ac38c.js.map +1 -0
  333. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js +6 -0
  334. package/dist/esm-es5/swisspost-internet-breadcrumbs.entry.js.map +1 -0
  335. package/dist/esm-es5/swisspost-internet-footer.entry.js +2 -0
  336. package/dist/esm-es5/swisspost-internet-footer.entry.js.map +1 -0
  337. package/dist/esm-es5/swisspost-internet-header.entry.js +2 -0
  338. package/dist/esm-es5/swisspost-internet-header.entry.js.map +1 -0
  339. package/dist/esm-es5/swisspost-internet-header.js +2 -0
  340. package/dist/esm-es5/swisspost-internet-header.js.map +1 -0
  341. package/dist/esm-es5/ui.service-1d9b0f51.js +2 -0
  342. package/dist/esm-es5/ui.service-1d9b0f51.js.map +1 -0
  343. package/dist/esm-es5/utils-5bf107ff.js +2 -0
  344. package/dist/esm-es5/utils-5bf107ff.js.map +1 -0
  345. package/dist/index.cjs.js +1 -0
  346. package/dist/index.js +1 -0
  347. package/dist/swisspost-internet-header/assets/config/test-configuration.json +4067 -0
  348. package/dist/swisspost-internet-header/index.esm.js +2 -0
  349. package/dist/swisspost-internet-header/index.esm.js.map +1 -0
  350. package/dist/swisspost-internet-header/p-00fd320e.entry.js +2 -0
  351. package/dist/swisspost-internet-header/p-00fd320e.entry.js.map +1 -0
  352. package/dist/swisspost-internet-header/p-0e2ec555.js +2 -0
  353. package/dist/swisspost-internet-header/p-0e2ec555.js.map +1 -0
  354. package/dist/swisspost-internet-header/p-112455b1.js +2 -0
  355. package/dist/swisspost-internet-header/p-112455b1.js.map +1 -0
  356. package/dist/swisspost-internet-header/p-17a47667.system.js +2 -0
  357. package/dist/swisspost-internet-header/p-17a47667.system.js.map +1 -0
  358. package/dist/swisspost-internet-header/p-1b8f9bc8.system.js +3 -0
  359. package/dist/swisspost-internet-header/p-1b8f9bc8.system.js.map +1 -0
  360. package/dist/swisspost-internet-header/p-2eb04045.entry.js +2 -0
  361. package/dist/swisspost-internet-header/p-2eb04045.entry.js.map +1 -0
  362. package/dist/swisspost-internet-header/p-3ba40afe.js +2 -0
  363. package/dist/swisspost-internet-header/p-3ba40afe.js.map +1 -0
  364. package/dist/swisspost-internet-header/p-3eb881c3.js +2 -0
  365. package/dist/swisspost-internet-header/p-3eb881c3.js.map +1 -0
  366. package/dist/swisspost-internet-header/p-43cbbf42.entry.js +2 -0
  367. package/dist/swisspost-internet-header/p-43cbbf42.entry.js.map +1 -0
  368. package/dist/swisspost-internet-header/p-4654b2af.system.js +2 -0
  369. package/dist/swisspost-internet-header/p-4654b2af.system.js.map +1 -0
  370. package/dist/swisspost-internet-header/p-4c9ec2d8.system.js +27 -0
  371. package/dist/swisspost-internet-header/p-4c9ec2d8.system.js.map +1 -0
  372. package/dist/swisspost-internet-header/p-5032057e.js +3 -0
  373. package/dist/swisspost-internet-header/p-5032057e.js.map +1 -0
  374. package/dist/swisspost-internet-header/p-50ea2036.system.js +2 -0
  375. package/dist/swisspost-internet-header/p-50ea2036.system.js.map +1 -0
  376. package/dist/swisspost-internet-header/p-549b62ba.system.js +2 -0
  377. package/dist/swisspost-internet-header/p-549b62ba.system.js.map +1 -0
  378. package/dist/swisspost-internet-header/p-5e43c5e0.js +2 -0
  379. package/dist/swisspost-internet-header/p-5e43c5e0.js.map +1 -0
  380. package/dist/swisspost-internet-header/p-69c64c29.js +2 -0
  381. package/dist/swisspost-internet-header/p-69c64c29.js.map +1 -0
  382. package/dist/swisspost-internet-header/p-6a09e0b4.system.entry.js +2 -0
  383. package/dist/swisspost-internet-header/p-6a09e0b4.system.entry.js.map +1 -0
  384. package/dist/swisspost-internet-header/p-74932c29.entry.js +6 -0
  385. package/dist/swisspost-internet-header/p-74932c29.entry.js.map +1 -0
  386. package/dist/swisspost-internet-header/p-76ce4acc.system.entry.js +2 -0
  387. package/dist/swisspost-internet-header/p-76ce4acc.system.entry.js.map +1 -0
  388. package/dist/swisspost-internet-header/p-78f653be.system.entry.js +2 -0
  389. package/dist/swisspost-internet-header/p-78f653be.system.entry.js.map +1 -0
  390. package/dist/swisspost-internet-header/p-7e653a26.js +27 -0
  391. package/dist/swisspost-internet-header/p-7e653a26.js.map +1 -0
  392. package/dist/swisspost-internet-header/p-7f16a46b.entry.js +2 -0
  393. package/dist/swisspost-internet-header/p-7f16a46b.entry.js.map +1 -0
  394. package/dist/swisspost-internet-header/p-8717445f.entry.js +2 -0
  395. package/dist/swisspost-internet-header/p-8717445f.entry.js.map +1 -0
  396. package/dist/swisspost-internet-header/p-883f9547.system.entry.js +2 -0
  397. package/dist/swisspost-internet-header/p-883f9547.system.entry.js.map +1 -0
  398. package/dist/swisspost-internet-header/p-9509f6c7.system.js +2 -0
  399. package/dist/swisspost-internet-header/p-9509f6c7.system.js.map +1 -0
  400. package/dist/swisspost-internet-header/p-9d0a7039.entry.js +2 -0
  401. package/dist/swisspost-internet-header/p-9d0a7039.entry.js.map +1 -0
  402. package/dist/swisspost-internet-header/p-a119b38d.js +2 -0
  403. package/dist/swisspost-internet-header/p-a119b38d.js.map +1 -0
  404. package/dist/swisspost-internet-header/p-a4160d23.entry.js +2 -0
  405. package/dist/swisspost-internet-header/p-a4160d23.entry.js.map +1 -0
  406. package/dist/swisspost-internet-header/p-a51ad207.system.entry.js +2 -0
  407. package/dist/swisspost-internet-header/p-a51ad207.system.entry.js.map +1 -0
  408. package/dist/swisspost-internet-header/p-a9c4b2d0.system.entry.js +2 -0
  409. package/dist/swisspost-internet-header/p-a9c4b2d0.system.entry.js.map +1 -0
  410. package/dist/swisspost-internet-header/p-b3014611.system.js +2 -0
  411. package/dist/swisspost-internet-header/p-b3014611.system.js.map +1 -0
  412. package/dist/swisspost-internet-header/p-bdabd6ac.js +2 -0
  413. package/dist/swisspost-internet-header/p-bdabd6ac.js.map +1 -0
  414. package/dist/swisspost-internet-header/p-bdfd2460.entry.js +2 -0
  415. package/dist/swisspost-internet-header/p-bdfd2460.entry.js.map +1 -0
  416. package/dist/swisspost-internet-header/p-c29ec122.system.js +2 -0
  417. package/dist/swisspost-internet-header/p-c29ec122.system.js.map +1 -0
  418. package/dist/swisspost-internet-header/p-c69923cd.system.js +2 -0
  419. package/dist/swisspost-internet-header/p-c69923cd.system.js.map +1 -0
  420. package/dist/swisspost-internet-header/p-c8296f63.system.js +2 -0
  421. package/dist/swisspost-internet-header/p-c8296f63.system.js.map +1 -0
  422. package/dist/swisspost-internet-header/p-c946c5b8.system.entry.js +2 -0
  423. package/dist/swisspost-internet-header/p-c946c5b8.system.entry.js.map +1 -0
  424. package/dist/swisspost-internet-header/p-cb06a633.system.entry.js +2 -0
  425. package/dist/swisspost-internet-header/p-cb06a633.system.entry.js.map +1 -0
  426. package/dist/swisspost-internet-header/p-cb3de015.system.entry.js +2 -0
  427. package/dist/swisspost-internet-header/p-cb3de015.system.entry.js.map +1 -0
  428. package/dist/swisspost-internet-header/p-d713a3b3.system.entry.js +7 -0
  429. package/dist/swisspost-internet-header/p-d713a3b3.system.entry.js.map +1 -0
  430. package/dist/swisspost-internet-header/p-ddcb8258.entry.js +2 -0
  431. package/dist/swisspost-internet-header/p-ddcb8258.entry.js.map +1 -0
  432. package/dist/swisspost-internet-header/p-ec80c8fc.js +2 -0
  433. package/dist/swisspost-internet-header/p-ec80c8fc.js.map +1 -0
  434. package/dist/swisspost-internet-header/p-ee915bbe.system.js +2 -0
  435. package/dist/swisspost-internet-header/p-ee915bbe.system.js.map +1 -0
  436. package/dist/swisspost-internet-header/p-eeff8b03.js +2 -0
  437. package/dist/swisspost-internet-header/p-eeff8b03.js.map +1 -0
  438. package/dist/swisspost-internet-header/p-f4ff1e9e.system.js +2 -0
  439. package/dist/swisspost-internet-header/p-f4ff1e9e.system.js.map +1 -0
  440. package/dist/swisspost-internet-header/p-f887c8bb.system.js +2 -0
  441. package/dist/swisspost-internet-header/p-f887c8bb.system.js.map +1 -0
  442. package/dist/swisspost-internet-header/swisspost-internet-header.css +29 -0
  443. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js +2 -0
  444. package/dist/swisspost-internet-header/swisspost-internet-header.esm.js.map +1 -0
  445. package/dist/swisspost-internet-header/swisspost-internet-header.js +131 -0
  446. package/dist/types/assets/i18n/translations.d.ts +37 -0
  447. package/dist/types/components/post-internet-breadcrumbs/components/breadcrumb-list.component.d.ts +9 -0
  448. package/dist/types/components/post-internet-breadcrumbs/components/focus-trap.component.d.ts +12 -0
  449. package/dist/types/components/post-internet-breadcrumbs/components/middle-dropdown.component.d.ts +7 -0
  450. package/dist/types/components/post-internet-breadcrumbs/components/middle-links.component.d.ts +6 -0
  451. package/dist/types/components/post-internet-breadcrumbs/components/overlay.component.d.ts +16 -0
  452. package/dist/types/components/post-internet-breadcrumbs/post-internet-breadcrumbs.d.ts +45 -0
  453. package/dist/types/components/post-internet-footer/components/post-footer-block-address.component.d.ts +5 -0
  454. package/dist/types/components/post-internet-footer/components/post-footer-block-contact.component.d.ts +6 -0
  455. package/dist/types/components/post-internet-footer/components/post-footer-block-custom.component.d.ts +4 -0
  456. package/dist/types/components/post-internet-footer/components/post-footer-block-list.component.d.ts +5 -0
  457. package/dist/types/components/post-internet-footer/components/post-footer-block-socials.component.d.ts +5 -0
  458. package/dist/types/components/post-internet-footer/post-internet-footer.d.ts +10 -0
  459. package/dist/types/components/post-internet-header/post-internet-header.d.ts +124 -0
  460. package/dist/types/components/post-klp-login-widget/klp-widget.controller.d.ts +3 -0
  461. package/dist/types/components/post-klp-login-widget/post-klp-login-widget.d.ts +10 -0
  462. package/dist/types/components/post-language-switch/components/post-language-switch-list.d.ts +6 -0
  463. package/dist/types/components/post-language-switch/post-language-switch.d.ts +27 -0
  464. package/dist/types/components/post-logo/logo-sprite.component.d.ts +4 -0
  465. package/dist/types/components/post-logo/post-logo.d.ts +11 -0
  466. package/dist/types/components/post-main-navigation/components/level-one-action.component.d.ts +8 -0
  467. package/dist/types/components/post-main-navigation/post-main-navigation.d.ts +48 -0
  468. package/dist/types/components/post-meta-navigation/post-meta-navigation.d.ts +5 -0
  469. package/dist/types/components/post-search/post-search.d.ts +61 -0
  470. package/dist/types/components/post-skiplinks/post-skiplinks.d.ts +9 -0
  471. package/dist/types/components.d.ts +365 -0
  472. package/dist/types/data/store.d.ts +16 -0
  473. package/dist/types/index.d.ts +1 -0
  474. package/dist/types/models/breadcrumbs.model.d.ts +36 -0
  475. package/dist/types/models/coveo.model.d.ts +22 -0
  476. package/dist/types/models/footer.model.d.ts +48 -0
  477. package/dist/types/models/general.model.d.ts +46 -0
  478. package/dist/types/models/geocode.model.d.ts +52 -0
  479. package/dist/types/models/header.model.d.ts +163 -0
  480. package/dist/types/models/implementor.model.d.ts +22 -0
  481. package/dist/types/models/language.model.d.ts +6 -0
  482. package/dist/types/models/track-and-trace.model.d.ts +25 -0
  483. package/dist/types/services/config.service.d.ts +56 -0
  484. package/dist/types/services/language.service.d.ts +65 -0
  485. package/dist/types/services/route.service.d.ts +39 -0
  486. package/dist/types/services/search/coveo.service.d.ts +9 -0
  487. package/dist/types/services/search/coveo.settings.d.ts +2 -0
  488. package/dist/types/services/search/parcel.service.d.ts +28 -0
  489. package/dist/types/services/search/places.service.d.ts +24 -0
  490. package/dist/types/services/search/places.settings.d.ts +3 -0
  491. package/dist/types/services/search/search-utilities.d.ts +15 -0
  492. package/dist/types/services/search/search.service.d.ts +24 -0
  493. package/dist/types/services/ui.service.d.ts +23 -0
  494. package/dist/types/stencil-public-runtime.d.ts +1637 -0
  495. package/dist/types/tests/setup-tests.d.ts +0 -0
  496. package/dist/types/utils/highlighted.component.d.ts +4 -0
  497. package/dist/types/utils/if.component.d.ts +4 -0
  498. package/dist/types/utils/svg-icon.component.d.ts +4 -0
  499. package/dist/types/utils/svg-sprite.component.d.ts +1 -0
  500. package/dist/types/utils/utils.d.ts +8 -0
  501. package/loader/cdn.js +3 -0
  502. package/loader/index.cjs.js +3 -0
  503. package/loader/index.d.ts +21 -0
  504. package/loader/index.es2017.js +3 -0
  505. package/loader/index.js +4 -0
  506. package/loader/package.json +11 -0
  507. package/package.json +71 -0
  508. package/readme.md +15 -0
@@ -0,0 +1,1704 @@
1
+ const NAMESPACE = 'swisspost-internet-header';
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 hostTagName;
13
+ let isSvgMode = false;
14
+ let renderingRef = null;
15
+ let queuePending = false;
16
+ const createTime = (fnName, tagName = '') => {
17
+ {
18
+ return () => {
19
+ return;
20
+ };
21
+ }
22
+ };
23
+ const uniqueTime = (key, measureText) => {
24
+ {
25
+ return () => {
26
+ return;
27
+ };
28
+ }
29
+ };
30
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
31
+ /**
32
+ * Default style mode id
33
+ */
34
+ /**
35
+ * Reusable empty obj/array
36
+ * Don't add values to these!!
37
+ */
38
+ const EMPTY_OBJ = {};
39
+ /**
40
+ * Namespaces
41
+ */
42
+ const SVG_NS = 'http://www.w3.org/2000/svg';
43
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
44
+ const isDef = (v) => v != null;
45
+ const isComplexType = (o) => {
46
+ // https://jsperf.com/typeof-fn-object/5
47
+ o = typeof o;
48
+ return o === 'object' || o === 'function';
49
+ };
50
+ /**
51
+ * Helper method for querying a `meta` tag that contains a nonce value
52
+ * out of a DOM's head.
53
+ *
54
+ * @param doc The DOM containing the `head` to query against
55
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
56
+ * exists or the tag has no content.
57
+ */
58
+ function queryNonceMetaTagContent(doc) {
59
+ var _a, _b, _c;
60
+ 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;
61
+ }
62
+ /**
63
+ * Production h() function based on Preact by
64
+ * Jason Miller (@developit)
65
+ * Licensed under the MIT License
66
+ * https://github.com/developit/preact/blob/master/LICENSE
67
+ *
68
+ * Modified for Stencil's compiler and vdom
69
+ */
70
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
71
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
72
+ const h = (nodeName, vnodeData, ...children) => {
73
+ let child = null;
74
+ let key = null;
75
+ let simple = false;
76
+ let lastSimple = false;
77
+ const vNodeChildren = [];
78
+ const walk = (c) => {
79
+ for (let i = 0; i < c.length; i++) {
80
+ child = c[i];
81
+ if (Array.isArray(child)) {
82
+ walk(child);
83
+ }
84
+ else if (child != null && typeof child !== 'boolean') {
85
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
86
+ child = String(child);
87
+ }
88
+ if (simple && lastSimple) {
89
+ // If the previous child was simple (string), we merge both
90
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
91
+ }
92
+ else {
93
+ // Append a new vNode, if it's text, we create a text vNode
94
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
95
+ }
96
+ lastSimple = simple;
97
+ }
98
+ }
99
+ };
100
+ walk(children);
101
+ if (vnodeData) {
102
+ // normalize class / classname attributes
103
+ if (vnodeData.key) {
104
+ key = vnodeData.key;
105
+ }
106
+ {
107
+ const classData = vnodeData.className || vnodeData.class;
108
+ if (classData) {
109
+ vnodeData.class =
110
+ typeof classData !== 'object'
111
+ ? classData
112
+ : Object.keys(classData)
113
+ .filter((k) => classData[k])
114
+ .join(' ');
115
+ }
116
+ }
117
+ }
118
+ if (typeof nodeName === 'function') {
119
+ // nodeName is a functional component
120
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
121
+ }
122
+ const vnode = newVNode(nodeName, null);
123
+ vnode.$attrs$ = vnodeData;
124
+ if (vNodeChildren.length > 0) {
125
+ vnode.$children$ = vNodeChildren;
126
+ }
127
+ {
128
+ vnode.$key$ = key;
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.$key$ = 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
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
166
+ *
167
+ * Note that these functions convert from {@link d.VNode} to
168
+ * {@link d.ChildNode} to give functional component developers a friendly
169
+ * interface.
170
+ */
171
+ const vdomFnUtils = {
172
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
173
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
174
+ };
175
+ /**
176
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
177
+ * friendlier public interface (hence, 'convertToPublic').
178
+ *
179
+ * @param node the virtual DOM node to convert
180
+ * @returns a converted child node
181
+ */
182
+ const convertToPublic = (node) => ({
183
+ vattrs: node.$attrs$,
184
+ vchildren: node.$children$,
185
+ vkey: node.$key$,
186
+ vname: node.$name$,
187
+ vtag: node.$tag$,
188
+ vtext: node.$text$,
189
+ });
190
+ /**
191
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
192
+ * order to use the resulting object in the virtual DOM. The initial object was
193
+ * likely created as part of presenting a public API, so converting it back
194
+ * involved making it 'private' again (hence, `convertToPrivate`).
195
+ *
196
+ * @param node the child node to convert
197
+ * @returns a converted virtual DOM node
198
+ */
199
+ const convertToPrivate = (node) => {
200
+ if (typeof node.vtag === 'function') {
201
+ const vnodeData = Object.assign({}, node.vattrs);
202
+ if (node.vkey) {
203
+ vnodeData.key = node.vkey;
204
+ }
205
+ if (node.vname) {
206
+ vnodeData.name = node.vname;
207
+ }
208
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
209
+ }
210
+ const vnode = newVNode(node.vtag, node.vtext);
211
+ vnode.$attrs$ = node.vattrs;
212
+ vnode.$children$ = node.vchildren;
213
+ vnode.$key$ = node.vkey;
214
+ vnode.$name$ = node.vname;
215
+ return vnode;
216
+ };
217
+ /**
218
+ * Parse a new property value for a given property type.
219
+ *
220
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
221
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
222
+ * 1. `any`, the type given to `propValue` in the function signature
223
+ * 2. the type stored from `propType`.
224
+ *
225
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
226
+ *
227
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
228
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
229
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
230
+ * ```tsx
231
+ * <my-cmp prop-val={0}></my-cmp>
232
+ * ```
233
+ *
234
+ * HTML prop values on the other hand, will always a string
235
+ *
236
+ * @param propValue the new value to coerce to some type
237
+ * @param propType the type of the prop, expressed as a binary number
238
+ * @returns the parsed/coerced value
239
+ */
240
+ const parsePropertyValue = (propValue, propType) => {
241
+ // ensure this value is of the correct prop type
242
+ if (propValue != null && !isComplexType(propValue)) {
243
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
244
+ // per the HTML spec, any string value means it is a boolean true value
245
+ // but we'll cheat here and say that the string "false" is the boolean false
246
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
247
+ }
248
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
249
+ // could have been passed as a number or boolean
250
+ // but we still want it as a string
251
+ return String(propValue);
252
+ }
253
+ // redundant return here for better minification
254
+ return propValue;
255
+ }
256
+ // not sure exactly what type we want
257
+ // so no need to change to a different type
258
+ return propValue;
259
+ };
260
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
261
+ const createEvent = (ref, name, flags) => {
262
+ const elm = getElement(ref);
263
+ return {
264
+ emit: (detail) => {
265
+ return emitEvent(elm, name, {
266
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
267
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
268
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
269
+ detail,
270
+ });
271
+ },
272
+ };
273
+ };
274
+ /**
275
+ * Helper function to create & dispatch a custom Event on a provided target
276
+ * @param elm the target of the Event
277
+ * @param name the name to give the custom Event
278
+ * @param opts options for configuring a custom Event
279
+ * @returns the custom Event
280
+ */
281
+ const emitEvent = (elm, name, opts) => {
282
+ const ev = plt.ce(name, opts);
283
+ elm.dispatchEvent(ev);
284
+ return ev;
285
+ };
286
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
287
+ const registerStyle = (scopeId, cssText, allowCS) => {
288
+ let style = styles.get(scopeId);
289
+ if (supportsConstructableStylesheets && allowCS) {
290
+ style = (style || new CSSStyleSheet());
291
+ if (typeof style === 'string') {
292
+ style = cssText;
293
+ }
294
+ else {
295
+ style.replaceSync(cssText);
296
+ }
297
+ }
298
+ else {
299
+ style = cssText;
300
+ }
301
+ styles.set(scopeId, style);
302
+ };
303
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
304
+ var _a;
305
+ let scopeId = getScopeId(cmpMeta);
306
+ const style = styles.get(scopeId);
307
+ // if an element is NOT connected then getRootNode() will return the wrong root node
308
+ // so the fallback is to always use the document for the root node in those cases
309
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
310
+ if (style) {
311
+ if (typeof style === 'string') {
312
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
313
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
314
+ let styleElm;
315
+ if (!appliedStyles) {
316
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
317
+ }
318
+ if (!appliedStyles.has(scopeId)) {
319
+ {
320
+ // TODO(STENCIL-659): Remove code implementing the CSS variable shim
321
+ {
322
+ styleElm = doc.createElement('style');
323
+ styleElm.innerHTML = style;
324
+ }
325
+ // Apply CSP nonce to the style tag if it exists
326
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
327
+ if (nonce != null) {
328
+ styleElm.setAttribute('nonce', nonce);
329
+ }
330
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
331
+ }
332
+ if (appliedStyles) {
333
+ appliedStyles.add(scopeId);
334
+ }
335
+ }
336
+ }
337
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
338
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
339
+ }
340
+ }
341
+ return scopeId;
342
+ };
343
+ const attachStyles = (hostRef) => {
344
+ const cmpMeta = hostRef.$cmpMeta$;
345
+ const elm = hostRef.$hostElement$;
346
+ const flags = cmpMeta.$flags$;
347
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
348
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
349
+ // TODO(STENCIL-662): Remove code related to deprecated shadowDomShim field
350
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
351
+ // only required when we're NOT using native shadow dom (slot)
352
+ // or this browser doesn't support native shadow dom
353
+ // and this host element was NOT created with SSR
354
+ // let's pick out the inner content for slot projection
355
+ // create a node to represent where the original
356
+ // content was first placed, which is useful later on
357
+ // DOM WRITE!!
358
+ elm['s-sc'] = scopeId;
359
+ elm.classList.add(scopeId + '-h');
360
+ }
361
+ endAttachStyles();
362
+ };
363
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
364
+ /**
365
+ * Production setAccessor() function based on Preact by
366
+ * Jason Miller (@developit)
367
+ * Licensed under the MIT License
368
+ * https://github.com/developit/preact/blob/master/LICENSE
369
+ *
370
+ * Modified for Stencil's compiler and vdom
371
+ */
372
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
373
+ if (oldValue !== newValue) {
374
+ let isProp = isMemberInElement(elm, memberName);
375
+ let ln = memberName.toLowerCase();
376
+ if (memberName === 'class') {
377
+ const classList = elm.classList;
378
+ const oldClasses = parseClassList(oldValue);
379
+ const newClasses = parseClassList(newValue);
380
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
381
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
382
+ }
383
+ else if (memberName === 'style') {
384
+ // update style attribute, css properties and values
385
+ {
386
+ for (const prop in oldValue) {
387
+ if (!newValue || newValue[prop] == null) {
388
+ if (prop.includes('-')) {
389
+ elm.style.removeProperty(prop);
390
+ }
391
+ else {
392
+ elm.style[prop] = '';
393
+ }
394
+ }
395
+ }
396
+ }
397
+ for (const prop in newValue) {
398
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
399
+ if (prop.includes('-')) {
400
+ elm.style.setProperty(prop, newValue[prop]);
401
+ }
402
+ else {
403
+ elm.style[prop] = newValue[prop];
404
+ }
405
+ }
406
+ }
407
+ }
408
+ else if (memberName === 'key')
409
+ ;
410
+ else if (memberName === 'ref') {
411
+ // minifier will clean this up
412
+ if (newValue) {
413
+ newValue(elm);
414
+ }
415
+ }
416
+ else if ((!isProp ) &&
417
+ memberName[0] === 'o' &&
418
+ memberName[1] === 'n') {
419
+ // Event Handlers
420
+ // so if the member name starts with "on" and the 3rd characters is
421
+ // a capital letter, and it's not already a member on the element,
422
+ // then we're assuming it's an event listener
423
+ if (memberName[2] === '-') {
424
+ // on- prefixed events
425
+ // allows to be explicit about the dom event to listen without any magic
426
+ // under the hood:
427
+ // <my-cmp on-click> // listens for "click"
428
+ // <my-cmp on-Click> // listens for "Click"
429
+ // <my-cmp on-ionChange> // listens for "ionChange"
430
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
431
+ memberName = memberName.slice(3);
432
+ }
433
+ else if (isMemberInElement(win, ln)) {
434
+ // standard event
435
+ // the JSX attribute could have been "onMouseOver" and the
436
+ // member name "onmouseover" is on the window's prototype
437
+ // so let's add the listener "mouseover", which is all lowercased
438
+ memberName = ln.slice(2);
439
+ }
440
+ else {
441
+ // custom event
442
+ // the JSX attribute could have been "onMyCustomEvent"
443
+ // so let's trim off the "on" prefix and lowercase the first character
444
+ // and add the listener "myCustomEvent"
445
+ // except for the first character, we keep the event name case
446
+ memberName = ln[2] + memberName.slice(3);
447
+ }
448
+ if (oldValue) {
449
+ plt.rel(elm, memberName, oldValue, false);
450
+ }
451
+ if (newValue) {
452
+ plt.ael(elm, memberName, newValue, false);
453
+ }
454
+ }
455
+ else {
456
+ // Set property if it exists and it's not a SVG
457
+ const isComplex = isComplexType(newValue);
458
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
459
+ try {
460
+ if (!elm.tagName.includes('-')) {
461
+ const n = newValue == null ? '' : newValue;
462
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
463
+ if (memberName === 'list') {
464
+ isProp = false;
465
+ }
466
+ else if (oldValue == null || elm[memberName] != n) {
467
+ elm[memberName] = n;
468
+ }
469
+ }
470
+ else {
471
+ elm[memberName] = newValue;
472
+ }
473
+ }
474
+ catch (e) { }
475
+ }
476
+ if (newValue == null || newValue === false) {
477
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
478
+ {
479
+ elm.removeAttribute(memberName);
480
+ }
481
+ }
482
+ }
483
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
484
+ newValue = newValue === true ? '' : newValue;
485
+ {
486
+ elm.setAttribute(memberName, newValue);
487
+ }
488
+ }
489
+ }
490
+ }
491
+ };
492
+ const parseClassListRegex = /\s/;
493
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
494
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
495
+ // if the element passed in is a shadow root, which is a document fragment
496
+ // then we want to be adding attrs/props to the shadow root's "host" element
497
+ // if it's not a shadow root, then we add attrs/props to the same element
498
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
499
+ ? newVnode.$elm$.host
500
+ : newVnode.$elm$;
501
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
502
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
503
+ {
504
+ // remove attributes no longer present on the vnode by setting them to undefined
505
+ for (memberName in oldVnodeAttrs) {
506
+ if (!(memberName in newVnodeAttrs)) {
507
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
508
+ }
509
+ }
510
+ }
511
+ // add new & update changed attributes
512
+ for (memberName in newVnodeAttrs) {
513
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
514
+ }
515
+ };
516
+ /**
517
+ * Create a DOM Node corresponding to one of the children of a given VNode.
518
+ *
519
+ * @param oldParentVNode the parent VNode from the previous render
520
+ * @param newParentVNode the parent VNode from the current render
521
+ * @param childIndex the index of the VNode, in the _new_ parent node's
522
+ * children, for which we will create a new DOM node
523
+ * @param parentElm the parent DOM node which our new node will be a child of
524
+ * @returns the newly created node
525
+ */
526
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
527
+ // tslint:disable-next-line: prefer-const
528
+ const newVNode = newParentVNode.$children$[childIndex];
529
+ let i = 0;
530
+ let elm;
531
+ let childNode;
532
+ if (newVNode.$text$ !== null) {
533
+ // create text node
534
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
535
+ }
536
+ else {
537
+ if (!isSvgMode) {
538
+ isSvgMode = newVNode.$tag$ === 'svg';
539
+ }
540
+ // create element
541
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
542
+ );
543
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
544
+ isSvgMode = false;
545
+ }
546
+ // add css classes, attrs, props, listeners, etc.
547
+ {
548
+ updateElement(null, newVNode, isSvgMode);
549
+ }
550
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
551
+ // if there is a scopeId and this is the initial render
552
+ // then let's add the scopeId as a css class
553
+ elm.classList.add((elm['s-si'] = scopeId));
554
+ }
555
+ if (newVNode.$children$) {
556
+ for (i = 0; i < newVNode.$children$.length; ++i) {
557
+ // create the node
558
+ childNode = createElm(oldParentVNode, newVNode, i);
559
+ // return node could have been null
560
+ if (childNode) {
561
+ // append our new node
562
+ elm.appendChild(childNode);
563
+ }
564
+ }
565
+ }
566
+ {
567
+ if (newVNode.$tag$ === 'svg') {
568
+ // Only reset the SVG context when we're exiting <svg> element
569
+ isSvgMode = false;
570
+ }
571
+ else if (elm.tagName === 'foreignObject') {
572
+ // Reenter SVG context when we're exiting <foreignObject> element
573
+ isSvgMode = true;
574
+ }
575
+ }
576
+ }
577
+ return elm;
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);
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);
603
+ if (childNode) {
604
+ vnodes[startIdx].$elm$ = childNode;
605
+ containerElm.insertBefore(childNode, 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
+ // remove the vnode's element from the dom
629
+ elm.remove();
630
+ }
631
+ }
632
+ };
633
+ /**
634
+ * Reconcile the children of a new VNode with the children of an old VNode by
635
+ * traversing the two collections of children, identifying nodes that are
636
+ * conserved or changed, calling out to `patch` to make any necessary
637
+ * updates to the DOM, and rearranging DOM nodes as needed.
638
+ *
639
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
640
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
641
+ * 'windows' by storing start and end indices and references to the
642
+ * corresponding array entries. Initially the two 'windows' are basically equal
643
+ * to the entire array, but we progressively narrow the windows until there are
644
+ * no children left to update by doing the following:
645
+ *
646
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
647
+ * that if we have an initial array like the following we'll end up dealing
648
+ * only with a window bounded by the highlighted elements:
649
+ *
650
+ * [null, null, VNode1 , ... , VNode2, null, null]
651
+ * ^^^^^^ ^^^^^^
652
+ *
653
+ * 2. Check to see if the elements at the head and tail positions are equal
654
+ * across the windows. This will basically detect elements which haven't
655
+ * been added, removed, or changed position, i.e. if you had the following
656
+ * VNode elements (represented as HTML):
657
+ *
658
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
659
+ * newVNode: `<div><p><span>THERE</span></p></div>`
660
+ *
661
+ * Then when comparing the children of the `<div>` tag we check the equality
662
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
663
+ * same tag in the same position, we'd be able to avoid completely
664
+ * re-rendering the subtree under them with a new DOM element and would just
665
+ * call out to `patch` to handle reconciling their children and so on.
666
+ *
667
+ * 3. Check, for both windows, to see if the element at the beginning of the
668
+ * window corresponds to the element at the end of the other window. This is
669
+ * a heuristic which will let us identify _some_ situations in which
670
+ * elements have changed position, for instance it _should_ detect that the
671
+ * children nodes themselves have not changed but merely moved in the
672
+ * following example:
673
+ *
674
+ * oldVNode: `<div><element-one /><element-two /></div>`
675
+ * newVNode: `<div><element-two /><element-one /></div>`
676
+ *
677
+ * If we find cases like this then we also need to move the concrete DOM
678
+ * elements corresponding to the moved children to write the re-order to the
679
+ * DOM.
680
+ *
681
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
682
+ * nodes in the old children which have the same key as the first element in
683
+ * our window on the new children. If we find such a node we handle calling
684
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
685
+ * what we find.
686
+ *
687
+ * Finally, once we've narrowed our 'windows' to the point that either of them
688
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
689
+ * insertion or deletion that needs to happen to get a DOM state that correctly
690
+ * reflects the new child VNodes. If, for instance, after our window on the old
691
+ * children has collapsed we still have more nodes on the new children that
692
+ * we haven't dealt with yet then we need to add them, or if the new children
693
+ * collapse but we still have unhandled _old_ children then we need to make
694
+ * sure the corresponding DOM nodes are removed.
695
+ *
696
+ * @param parentElm the node into which the parent VNode is rendered
697
+ * @param oldCh the old children of the parent node
698
+ * @param newVNode the new VNode which will replace the parent
699
+ * @param newCh the new children of the parent node
700
+ */
701
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
702
+ let oldStartIdx = 0;
703
+ let newStartIdx = 0;
704
+ let idxInOld = 0;
705
+ let i = 0;
706
+ let oldEndIdx = oldCh.length - 1;
707
+ let oldStartVnode = oldCh[0];
708
+ let oldEndVnode = oldCh[oldEndIdx];
709
+ let newEndIdx = newCh.length - 1;
710
+ let newStartVnode = newCh[0];
711
+ let newEndVnode = newCh[newEndIdx];
712
+ let node;
713
+ let elmToMove;
714
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
715
+ if (oldStartVnode == null) {
716
+ // VNode might have been moved left
717
+ oldStartVnode = oldCh[++oldStartIdx];
718
+ }
719
+ else if (oldEndVnode == null) {
720
+ oldEndVnode = oldCh[--oldEndIdx];
721
+ }
722
+ else if (newStartVnode == null) {
723
+ newStartVnode = newCh[++newStartIdx];
724
+ }
725
+ else if (newEndVnode == null) {
726
+ newEndVnode = newCh[--newEndIdx];
727
+ }
728
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
729
+ // if the start nodes are the same then we should patch the new VNode
730
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
731
+ // indices to reflect that. We don't need to move any DOM Nodes around
732
+ // since things are matched up in order.
733
+ patch(oldStartVnode, newStartVnode);
734
+ oldStartVnode = oldCh[++oldStartIdx];
735
+ newStartVnode = newCh[++newStartIdx];
736
+ }
737
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
738
+ // likewise, if the end nodes are the same we patch new onto old and
739
+ // decrement our end indices, and also likewise in this case we don't
740
+ // need to move any DOM Nodes.
741
+ patch(oldEndVnode, newEndVnode);
742
+ oldEndVnode = oldCh[--oldEndIdx];
743
+ newEndVnode = newCh[--newEndIdx];
744
+ }
745
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
746
+ patch(oldStartVnode, newEndVnode);
747
+ // We need to move the element for `oldStartVnode` into a position which
748
+ // will be appropriate for `newEndVnode`. For this we can use
749
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
750
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
751
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
752
+ //
753
+ // <old-start-node />
754
+ // <some-intervening-node />
755
+ // <old-end-node />
756
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
757
+ // <next-sibling />
758
+ //
759
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
760
+ // the node for `oldStartVnode` at the end of the children of
761
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
762
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
763
+ // append it to the children of the parent element.
764
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
765
+ oldStartVnode = oldCh[++oldStartIdx];
766
+ newEndVnode = newCh[--newEndIdx];
767
+ }
768
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
769
+ patch(oldEndVnode, newStartVnode);
770
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
771
+ // the same node, so since we're here we know that they are not. Thus we
772
+ // can move the element for `oldEndVnode` _before_ the element for
773
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
774
+ // future.
775
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
776
+ oldEndVnode = oldCh[--oldEndIdx];
777
+ newStartVnode = newCh[++newStartIdx];
778
+ }
779
+ else {
780
+ // Here we do some checks to match up old and new nodes based on the
781
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
782
+ // in the JSX for a DOM element in the implementation of a Stencil
783
+ // component.
784
+ //
785
+ // First we check to see if there are any nodes in the array of old
786
+ // children which have the same key as the first node in the new
787
+ // children.
788
+ idxInOld = -1;
789
+ {
790
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
791
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
792
+ idxInOld = i;
793
+ break;
794
+ }
795
+ }
796
+ }
797
+ if (idxInOld >= 0) {
798
+ // We found a node in the old children which matches up with the first
799
+ // node in the new children! So let's deal with that
800
+ elmToMove = oldCh[idxInOld];
801
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
802
+ // the tag doesn't match so we'll need a new DOM element
803
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld);
804
+ }
805
+ else {
806
+ patch(elmToMove, newStartVnode);
807
+ // invalidate the matching old node so that we won't try to update it
808
+ // again later on
809
+ oldCh[idxInOld] = undefined;
810
+ node = elmToMove.$elm$;
811
+ }
812
+ newStartVnode = newCh[++newStartIdx];
813
+ }
814
+ else {
815
+ // We either didn't find an element in the old children that matches
816
+ // the key of the first new child OR the build is not using `key`
817
+ // attributes at all. In either case we need to create a new element
818
+ // for the new node.
819
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
820
+ newStartVnode = newCh[++newStartIdx];
821
+ }
822
+ if (node) {
823
+ // if we created a new node then handle inserting it to the DOM
824
+ {
825
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
826
+ }
827
+ }
828
+ }
829
+ }
830
+ if (oldStartIdx > oldEndIdx) {
831
+ // we have some more new nodes to add which don't match up with old nodes
832
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
833
+ }
834
+ else if (newStartIdx > newEndIdx) {
835
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
836
+ // in the new array, so lets remove them (which entails cleaning up the
837
+ // relevant DOM nodes)
838
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
839
+ }
840
+ };
841
+ /**
842
+ * Compare two VNodes to determine if they are the same
843
+ *
844
+ * **NB**: This function is an equality _heuristic_ based on the available
845
+ * information set on the two VNodes and can be misleading under certain
846
+ * circumstances. In particular, if the two nodes do not have `key` attrs
847
+ * (available under `$key$` on VNodes) then the function falls back on merely
848
+ * checking that they have the same tag.
849
+ *
850
+ * So, in other words, if `key` attrs are not set on VNodes which may be
851
+ * changing order within a `children` array or something along those lines then
852
+ * we could obtain a false negative and then have to do needless re-rendering
853
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
854
+ *
855
+ * @param leftVNode the first VNode to check
856
+ * @param rightVNode the second VNode to check
857
+ * @returns whether they're equal or not
858
+ */
859
+ const isSameVnode = (leftVNode, rightVNode) => {
860
+ // compare if two vnode to see if they're "technically" the same
861
+ // need to have the same element tag, and same key to be the same
862
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
863
+ // this will be set if components in the build have `key` attrs set on them
864
+ {
865
+ return leftVNode.$key$ === rightVNode.$key$;
866
+ }
867
+ }
868
+ return false;
869
+ };
870
+ /**
871
+ * Handle reconciling an outdated VNode with a new one which corresponds to
872
+ * it. This function handles flushing updates to the DOM and reconciling the
873
+ * children of the two nodes (if any).
874
+ *
875
+ * @param oldVNode an old VNode whose DOM element and children we want to update
876
+ * @param newVNode a new VNode representing an updated version of the old one
877
+ */
878
+ const patch = (oldVNode, newVNode) => {
879
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
880
+ const oldChildren = oldVNode.$children$;
881
+ const newChildren = newVNode.$children$;
882
+ const tag = newVNode.$tag$;
883
+ const text = newVNode.$text$;
884
+ if (text === null) {
885
+ {
886
+ // test if we're rendering an svg element, or still rendering nodes inside of one
887
+ // only add this to the when the compiler sees we're using an svg somewhere
888
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
889
+ }
890
+ {
891
+ if (tag === 'slot')
892
+ ;
893
+ else {
894
+ // either this is the first render of an element OR it's an update
895
+ // AND we already know it's possible it could have changed
896
+ // this updates the element's css classes, attrs, props, listeners, etc.
897
+ updateElement(oldVNode, newVNode, isSvgMode);
898
+ }
899
+ }
900
+ if (oldChildren !== null && newChildren !== null) {
901
+ // looks like there's child vnodes for both the old and new vnodes
902
+ // so we need to call `updateChildren` to reconcile them
903
+ updateChildren(elm, oldChildren, newVNode, newChildren);
904
+ }
905
+ else if (newChildren !== null) {
906
+ // no old child vnodes, but there are new child vnodes to add
907
+ if (oldVNode.$text$ !== null) {
908
+ // the old vnode was text, so be sure to clear it out
909
+ elm.textContent = '';
910
+ }
911
+ // add the new vnode children
912
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
913
+ }
914
+ else if (oldChildren !== null) {
915
+ // no new child vnodes, but there are old child vnodes to remove
916
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
917
+ }
918
+ if (isSvgMode && tag === 'svg') {
919
+ isSvgMode = false;
920
+ }
921
+ }
922
+ else if (oldVNode.$text$ !== text) {
923
+ // update the text content for the text only vnode
924
+ // and also only if the text is different than before
925
+ elm.data = text;
926
+ }
927
+ };
928
+ const callNodeRefs = (vNode) => {
929
+ {
930
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
931
+ vNode.$children$ && vNode.$children$.map(callNodeRefs);
932
+ }
933
+ };
934
+ /**
935
+ * The main entry point for Stencil's virtual DOM-based rendering engine
936
+ *
937
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
938
+ * function will handle creating a virtual DOM tree with a single root, patching
939
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
940
+ * relocation, and reflecting attributes.
941
+ *
942
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
943
+ * the DOM node into which it should be rendered.
944
+ * @param renderFnResults the virtual DOM nodes to be rendered
945
+ */
946
+ const renderVdom = (hostRef, renderFnResults) => {
947
+ const hostElm = hostRef.$hostElement$;
948
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
949
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
950
+ hostTagName = hostElm.tagName;
951
+ rootVnode.$tag$ = null;
952
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
953
+ hostRef.$vnode$ = rootVnode;
954
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
955
+ {
956
+ scopeId = hostElm['s-sc'];
957
+ }
958
+ // synchronous patch
959
+ patch(oldVNode, rootVnode);
960
+ };
961
+ const attachToAncestor = (hostRef, ancestorComponent) => {
962
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
963
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
964
+ }
965
+ };
966
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
967
+ {
968
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
969
+ }
970
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
971
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
972
+ return;
973
+ }
974
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
975
+ // there is no ancestor component or the ancestor component
976
+ // has already fired off its lifecycle update then
977
+ // fire off the initial update
978
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
979
+ return writeTask(dispatch) ;
980
+ };
981
+ const dispatchHooks = (hostRef, isInitialLoad) => {
982
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
983
+ const instance = hostRef.$lazyInstance$ ;
984
+ let promise;
985
+ if (isInitialLoad) {
986
+ {
987
+ hostRef.$flags$ |= 256 /* HOST_FLAGS.isListenReady */;
988
+ if (hostRef.$queuedListeners$) {
989
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
990
+ hostRef.$queuedListeners$ = null;
991
+ }
992
+ }
993
+ {
994
+ promise = safeCall(instance, 'componentWillLoad');
995
+ }
996
+ }
997
+ else {
998
+ {
999
+ promise = safeCall(instance, 'componentWillUpdate');
1000
+ }
1001
+ }
1002
+ endSchedule();
1003
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1004
+ };
1005
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1006
+ // updateComponent
1007
+ const elm = hostRef.$hostElement$;
1008
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1009
+ const rc = elm['s-rc'];
1010
+ if (isInitialLoad) {
1011
+ // DOM WRITE!
1012
+ attachStyles(hostRef);
1013
+ }
1014
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1015
+ {
1016
+ callRender(hostRef, instance);
1017
+ }
1018
+ if (rc) {
1019
+ // ok, so turns out there are some child host elements
1020
+ // waiting on this parent element to load
1021
+ // let's fire off all update callbacks waiting
1022
+ rc.map((cb) => cb());
1023
+ elm['s-rc'] = undefined;
1024
+ }
1025
+ endRender();
1026
+ endUpdate();
1027
+ {
1028
+ const childrenPromises = elm['s-p'];
1029
+ const postUpdate = () => postUpdateComponent(hostRef);
1030
+ if (childrenPromises.length === 0) {
1031
+ postUpdate();
1032
+ }
1033
+ else {
1034
+ Promise.all(childrenPromises).then(postUpdate);
1035
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1036
+ childrenPromises.length = 0;
1037
+ }
1038
+ }
1039
+ };
1040
+ const callRender = (hostRef, instance, elm) => {
1041
+ try {
1042
+ renderingRef = instance;
1043
+ instance = instance.render() ;
1044
+ {
1045
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1046
+ }
1047
+ {
1048
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1049
+ }
1050
+ {
1051
+ {
1052
+ // looks like we've got child nodes to render into this host element
1053
+ // or we need to update the css class/attrs on the host element
1054
+ // DOM WRITE!
1055
+ {
1056
+ renderVdom(hostRef, instance);
1057
+ }
1058
+ }
1059
+ }
1060
+ }
1061
+ catch (e) {
1062
+ consoleError(e, hostRef.$hostElement$);
1063
+ }
1064
+ renderingRef = null;
1065
+ return null;
1066
+ };
1067
+ const getRenderingRef = () => renderingRef;
1068
+ const postUpdateComponent = (hostRef) => {
1069
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1070
+ const elm = hostRef.$hostElement$;
1071
+ const endPostUpdate = createTime('postUpdate', tagName);
1072
+ const instance = hostRef.$lazyInstance$ ;
1073
+ const ancestorComponent = hostRef.$ancestorComponent$;
1074
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1075
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1076
+ {
1077
+ // DOM WRITE!
1078
+ addHydratedFlag(elm);
1079
+ }
1080
+ {
1081
+ safeCall(instance, 'componentDidLoad');
1082
+ }
1083
+ endPostUpdate();
1084
+ {
1085
+ hostRef.$onReadyResolve$(elm);
1086
+ if (!ancestorComponent) {
1087
+ appDidLoad();
1088
+ }
1089
+ }
1090
+ }
1091
+ else {
1092
+ {
1093
+ safeCall(instance, 'componentDidUpdate');
1094
+ }
1095
+ endPostUpdate();
1096
+ }
1097
+ {
1098
+ hostRef.$onInstanceResolve$(elm);
1099
+ }
1100
+ // load events fire from bottom to top
1101
+ // the deepest elements load first then bubbles up
1102
+ {
1103
+ if (hostRef.$onRenderResolve$) {
1104
+ hostRef.$onRenderResolve$();
1105
+ hostRef.$onRenderResolve$ = undefined;
1106
+ }
1107
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1108
+ nextTick(() => scheduleUpdate(hostRef, false));
1109
+ }
1110
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1111
+ }
1112
+ // ( •_•)
1113
+ // ( •_•)>⌐■-■
1114
+ // (⌐■_■)
1115
+ };
1116
+ const forceUpdate = (ref) => {
1117
+ {
1118
+ const hostRef = getHostRef(ref);
1119
+ const isConnected = hostRef.$hostElement$.isConnected;
1120
+ if (isConnected &&
1121
+ (hostRef.$flags$ & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1122
+ scheduleUpdate(hostRef, false);
1123
+ }
1124
+ // Returns "true" when the forced update was successfully scheduled
1125
+ return isConnected;
1126
+ }
1127
+ };
1128
+ const appDidLoad = (who) => {
1129
+ // on appload
1130
+ // we have finish the first big initial render
1131
+ {
1132
+ addHydratedFlag(doc.documentElement);
1133
+ }
1134
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1135
+ };
1136
+ const safeCall = (instance, method, arg) => {
1137
+ if (instance && instance[method]) {
1138
+ try {
1139
+ return instance[method](arg);
1140
+ }
1141
+ catch (e) {
1142
+ consoleError(e);
1143
+ }
1144
+ }
1145
+ return undefined;
1146
+ };
1147
+ const then = (promise, thenFn) => {
1148
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1149
+ };
1150
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1151
+ ;
1152
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1153
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1154
+ // check our new property value against our internal value
1155
+ const hostRef = getHostRef(ref);
1156
+ const elm = hostRef.$hostElement$ ;
1157
+ const oldVal = hostRef.$instanceValues$.get(propName);
1158
+ const flags = hostRef.$flags$;
1159
+ const instance = hostRef.$lazyInstance$ ;
1160
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1161
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1162
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1163
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1164
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1165
+ // gadzooks! the property's value has changed!!
1166
+ // set our new value!
1167
+ hostRef.$instanceValues$.set(propName, newVal);
1168
+ if (instance) {
1169
+ // get an array of method names of watch functions to call
1170
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1171
+ const watchMethods = cmpMeta.$watchers$[propName];
1172
+ if (watchMethods) {
1173
+ // this instance is watching for when this property changed
1174
+ watchMethods.map((watchMethodName) => {
1175
+ try {
1176
+ // fire off each of the watch methods that are watching this property
1177
+ instance[watchMethodName](newVal, oldVal, propName);
1178
+ }
1179
+ catch (e) {
1180
+ consoleError(e, elm);
1181
+ }
1182
+ });
1183
+ }
1184
+ }
1185
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1186
+ // looks like this value actually changed, so we've got work to do!
1187
+ // but only if we've already rendered, otherwise just chill out
1188
+ // queue that we need to do an update, but don't worry about queuing
1189
+ // up millions cuz this function ensures it only runs once
1190
+ scheduleUpdate(hostRef, false);
1191
+ }
1192
+ }
1193
+ }
1194
+ };
1195
+ /**
1196
+ * Attach a series of runtime constructs to a compiled Stencil component
1197
+ * constructor, including getters and setters for the `@Prop` and `@State`
1198
+ * decorators, callbacks for when attributes change, and so on.
1199
+ *
1200
+ * @param Cstr the constructor for a component that we need to process
1201
+ * @param cmpMeta metadata collected previously about the component
1202
+ * @param flags a number used to store a series of bit flags
1203
+ * @returns a reference to the same constructor passed in (but now mutated)
1204
+ */
1205
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1206
+ if (cmpMeta.$members$) {
1207
+ if (Cstr.watchers) {
1208
+ cmpMeta.$watchers$ = Cstr.watchers;
1209
+ }
1210
+ // It's better to have a const than two Object.entries()
1211
+ const members = Object.entries(cmpMeta.$members$);
1212
+ const prototype = Cstr.prototype;
1213
+ members.map(([memberName, [memberFlags]]) => {
1214
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1215
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1216
+ // proxyComponent - prop
1217
+ Object.defineProperty(prototype, memberName, {
1218
+ get() {
1219
+ // proxyComponent, get value
1220
+ return getValue(this, memberName);
1221
+ },
1222
+ set(newValue) {
1223
+ // proxyComponent, set value
1224
+ setValue(this, memberName, newValue, cmpMeta);
1225
+ },
1226
+ configurable: true,
1227
+ enumerable: true,
1228
+ });
1229
+ }
1230
+ else if (flags & 1 /* PROXY_FLAGS.isElementConstructor */ &&
1231
+ memberFlags & 64 /* MEMBER_FLAGS.Method */) {
1232
+ // proxyComponent - method
1233
+ Object.defineProperty(prototype, memberName, {
1234
+ value(...args) {
1235
+ const ref = getHostRef(this);
1236
+ return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1237
+ },
1238
+ });
1239
+ }
1240
+ });
1241
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1242
+ const attrNameToPropName = new Map();
1243
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1244
+ plt.jmp(() => {
1245
+ const propName = attrNameToPropName.get(attrName);
1246
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1247
+ // in the case where an attribute was set inline.
1248
+ // ```html
1249
+ // <my-component some-attribute="some-value"></my-component>
1250
+ // ```
1251
+ //
1252
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1253
+ // programmatically changes it before it has been upgraded as shown below:
1254
+ //
1255
+ // ```html
1256
+ // <!-- this component has _not_ been upgraded yet -->
1257
+ // <my-component id="test" some-attribute="some-value"></my-component>
1258
+ // <script>
1259
+ // // grab non-upgraded component
1260
+ // el = document.querySelector("#test");
1261
+ // el.someAttribute = "another-value";
1262
+ // // upgrade component
1263
+ // customElements.define('my-component', MyComponent);
1264
+ // </script>
1265
+ // ```
1266
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1267
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1268
+ // to the value that was set inline i.e. "some-value" from above example. When
1269
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1270
+ //
1271
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1272
+ // by connectedCallback as this attributeChangedCallback will not fire.
1273
+ //
1274
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1275
+ //
1276
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1277
+ // properties here given that this goes against best practices outlined here
1278
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1279
+ if (this.hasOwnProperty(propName)) {
1280
+ newValue = this[propName];
1281
+ delete this[propName];
1282
+ }
1283
+ else if (prototype.hasOwnProperty(propName) &&
1284
+ typeof this[propName] === 'number' &&
1285
+ this[propName] == newValue) {
1286
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1287
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1288
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1289
+ return;
1290
+ }
1291
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1292
+ });
1293
+ };
1294
+ // create an array of attributes to observe
1295
+ // and also create a map of html attribute name to js property name
1296
+ Cstr.observedAttributes = members
1297
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1298
+ .map(([propName, m]) => {
1299
+ const attrName = m[1] || propName;
1300
+ attrNameToPropName.set(attrName, propName);
1301
+ return attrName;
1302
+ });
1303
+ }
1304
+ }
1305
+ return Cstr;
1306
+ };
1307
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1308
+ // initializeComponent
1309
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1310
+ {
1311
+ // we haven't initialized this element yet
1312
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1313
+ // lazy loaded components
1314
+ // request the component's implementation to be
1315
+ // wired up with the host element
1316
+ Cstr = loadModule(cmpMeta);
1317
+ if (Cstr.then) {
1318
+ // Await creates a micro-task avoid if possible
1319
+ const endLoad = uniqueTime();
1320
+ Cstr = await Cstr;
1321
+ endLoad();
1322
+ }
1323
+ if (!Cstr.isProxied) {
1324
+ // we've never proxied this Constructor before
1325
+ // let's add the getters/setters to its prototype before
1326
+ // the first time we create an instance of the implementation
1327
+ {
1328
+ cmpMeta.$watchers$ = Cstr.watchers;
1329
+ }
1330
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1331
+ Cstr.isProxied = true;
1332
+ }
1333
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1334
+ // ok, time to construct the instance
1335
+ // but let's keep track of when we start and stop
1336
+ // so that the getters/setters don't incorrectly step on data
1337
+ {
1338
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1339
+ }
1340
+ // construct the lazy-loaded component implementation
1341
+ // passing the hostRef is very important during
1342
+ // construction in order to directly wire together the
1343
+ // host element and the lazy-loaded instance
1344
+ try {
1345
+ new Cstr(hostRef);
1346
+ }
1347
+ catch (e) {
1348
+ consoleError(e);
1349
+ }
1350
+ {
1351
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1352
+ }
1353
+ {
1354
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
1355
+ }
1356
+ endNewInstance();
1357
+ fireConnectedCallback(hostRef.$lazyInstance$);
1358
+ }
1359
+ if (Cstr.style) {
1360
+ // this component has styles but we haven't registered them yet
1361
+ let style = Cstr.style;
1362
+ const scopeId = getScopeId(cmpMeta);
1363
+ if (!styles.has(scopeId)) {
1364
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1365
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1366
+ endRegisterStyles();
1367
+ }
1368
+ }
1369
+ }
1370
+ // we've successfully created a lazy instance
1371
+ const ancestorComponent = hostRef.$ancestorComponent$;
1372
+ const schedule = () => scheduleUpdate(hostRef, true);
1373
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1374
+ // this is the initial load and this component it has an ancestor component
1375
+ // but the ancestor component has NOT fired its will update lifecycle yet
1376
+ // so let's just cool our jets and wait for the ancestor to continue first
1377
+ // this will get fired off when the ancestor component
1378
+ // finally gets around to rendering its lazy self
1379
+ // fire off the initial update
1380
+ ancestorComponent['s-rc'].push(schedule);
1381
+ }
1382
+ else {
1383
+ schedule();
1384
+ }
1385
+ };
1386
+ const fireConnectedCallback = (instance) => {
1387
+ {
1388
+ safeCall(instance, 'connectedCallback');
1389
+ }
1390
+ };
1391
+ const connectedCallback = (elm) => {
1392
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1393
+ const hostRef = getHostRef(elm);
1394
+ const cmpMeta = hostRef.$cmpMeta$;
1395
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1396
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1397
+ // first time this component has connected
1398
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1399
+ {
1400
+ // find the first ancestor component (if there is one) and register
1401
+ // this component as one of the actively loading child components for its ancestor
1402
+ let ancestorComponent = elm;
1403
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1404
+ // climb up the ancestors looking for the first
1405
+ // component that hasn't finished its lifecycle update yet
1406
+ if (ancestorComponent['s-p']) {
1407
+ // we found this components first ancestor component
1408
+ // keep a reference to this component's ancestor component
1409
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1410
+ break;
1411
+ }
1412
+ }
1413
+ }
1414
+ // Lazy properties
1415
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1416
+ if (cmpMeta.$members$) {
1417
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1418
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1419
+ const value = elm[memberName];
1420
+ delete elm[memberName];
1421
+ elm[memberName] = value;
1422
+ }
1423
+ });
1424
+ }
1425
+ {
1426
+ initializeComponent(elm, hostRef, cmpMeta);
1427
+ }
1428
+ }
1429
+ else {
1430
+ // not the first time this has connected
1431
+ // reattach any event listeners to the host
1432
+ // since they would have been removed when disconnected
1433
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1434
+ // fire off connectedCallback() on component instance
1435
+ fireConnectedCallback(hostRef.$lazyInstance$);
1436
+ }
1437
+ endConnected();
1438
+ }
1439
+ };
1440
+ const disconnectedCallback = (elm) => {
1441
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1442
+ const hostRef = getHostRef(elm);
1443
+ const instance = hostRef.$lazyInstance$ ;
1444
+ {
1445
+ if (hostRef.$rmListeners$) {
1446
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1447
+ hostRef.$rmListeners$ = undefined;
1448
+ }
1449
+ }
1450
+ {
1451
+ safeCall(instance, 'disconnectedCallback');
1452
+ }
1453
+ }
1454
+ };
1455
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1456
+ var _a;
1457
+ const endBootstrap = createTime();
1458
+ const cmpTags = [];
1459
+ const exclude = options.exclude || [];
1460
+ const customElements = win.customElements;
1461
+ const head = doc.head;
1462
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1463
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1464
+ const deferredConnectedCallbacks = [];
1465
+ let appLoadFallback;
1466
+ let isBootstrapping = true;
1467
+ Object.assign(plt, options);
1468
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1469
+ lazyBundles.map((lazyBundle) => {
1470
+ lazyBundle[1].map((compactMeta) => {
1471
+ const cmpMeta = {
1472
+ $flags$: compactMeta[0],
1473
+ $tagName$: compactMeta[1],
1474
+ $members$: compactMeta[2],
1475
+ $listeners$: compactMeta[3],
1476
+ };
1477
+ {
1478
+ cmpMeta.$members$ = compactMeta[2];
1479
+ }
1480
+ {
1481
+ cmpMeta.$listeners$ = compactMeta[3];
1482
+ }
1483
+ {
1484
+ cmpMeta.$watchers$ = {};
1485
+ }
1486
+ const tagName = cmpMeta.$tagName$;
1487
+ const HostElement = class extends HTMLElement {
1488
+ // StencilLazyHost
1489
+ constructor(self) {
1490
+ // @ts-ignore
1491
+ super(self);
1492
+ self = this;
1493
+ registerHost(self, cmpMeta);
1494
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1495
+ // this component is using shadow dom
1496
+ // and this browser supports shadow dom
1497
+ // add the read-only property "shadowRoot" to the host element
1498
+ // adding the shadow root build conditionals to minimize runtime
1499
+ {
1500
+ {
1501
+ self.attachShadow({ mode: 'open' });
1502
+ }
1503
+ }
1504
+ }
1505
+ }
1506
+ connectedCallback() {
1507
+ if (appLoadFallback) {
1508
+ clearTimeout(appLoadFallback);
1509
+ appLoadFallback = null;
1510
+ }
1511
+ if (isBootstrapping) {
1512
+ // connectedCallback will be processed once all components have been registered
1513
+ deferredConnectedCallbacks.push(this);
1514
+ }
1515
+ else {
1516
+ plt.jmp(() => connectedCallback(this));
1517
+ }
1518
+ }
1519
+ disconnectedCallback() {
1520
+ plt.jmp(() => disconnectedCallback(this));
1521
+ }
1522
+ componentOnReady() {
1523
+ return getHostRef(this).$onReadyPromise$;
1524
+ }
1525
+ };
1526
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1527
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1528
+ cmpTags.push(tagName);
1529
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1530
+ }
1531
+ });
1532
+ });
1533
+ {
1534
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1535
+ visibilityStyle.setAttribute('data-styles', '');
1536
+ // Apply CSP nonce to the style tag if it exists
1537
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1538
+ if (nonce != null) {
1539
+ visibilityStyle.setAttribute('nonce', nonce);
1540
+ }
1541
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1542
+ }
1543
+ // Process deferred connectedCallbacks now all components have been registered
1544
+ isBootstrapping = false;
1545
+ if (deferredConnectedCallbacks.length) {
1546
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1547
+ }
1548
+ else {
1549
+ {
1550
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1551
+ }
1552
+ }
1553
+ // Fallback appLoad event
1554
+ endBootstrap();
1555
+ };
1556
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1557
+ if (listeners) {
1558
+ listeners.map(([flags, name, method]) => {
1559
+ const target = elm;
1560
+ const handler = hostListenerProxy(hostRef, method);
1561
+ const opts = hostListenerOpts(flags);
1562
+ plt.ael(target, name, handler, opts);
1563
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
1564
+ });
1565
+ }
1566
+ };
1567
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
1568
+ try {
1569
+ {
1570
+ if (hostRef.$flags$ & 256 /* HOST_FLAGS.isListenReady */) {
1571
+ // instance is ready, let's call it's member method for this event
1572
+ hostRef.$lazyInstance$[methodName](ev);
1573
+ }
1574
+ else {
1575
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
1576
+ }
1577
+ }
1578
+ }
1579
+ catch (e) {
1580
+ consoleError(e);
1581
+ }
1582
+ };
1583
+ // prettier-ignore
1584
+ const hostListenerOpts = (flags) => (flags & 2 /* LISTENER_FLAGS.Capture */) !== 0;
1585
+ /**
1586
+ * Assigns the given value to the nonce property on the runtime platform object.
1587
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1588
+ * @param nonce The value to be assigned to the platform nonce property.
1589
+ * @returns void
1590
+ */
1591
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1592
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1593
+ const getHostRef = (ref) => hostRefs.get(ref);
1594
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1595
+ const registerHost = (elm, cmpMeta) => {
1596
+ const hostRef = {
1597
+ $flags$: 0,
1598
+ $hostElement$: elm,
1599
+ $cmpMeta$: cmpMeta,
1600
+ $instanceValues$: new Map(),
1601
+ };
1602
+ {
1603
+ hostRef.$onInstancePromise$ = new Promise((r) => (hostRef.$onInstanceResolve$ = r));
1604
+ }
1605
+ {
1606
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1607
+ elm['s-p'] = [];
1608
+ elm['s-rc'] = [];
1609
+ }
1610
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1611
+ return hostRefs.set(elm, hostRef);
1612
+ };
1613
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1614
+ const consoleError = (e, el) => (0, console.error)(e, el);
1615
+ const cmpModules = /*@__PURE__*/ new Map();
1616
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1617
+ // loadModuleImport
1618
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1619
+ const bundleId = cmpMeta.$lazyBundleId$;
1620
+ const module = cmpModules.get(bundleId) ;
1621
+ if (module) {
1622
+ return module[exportName];
1623
+ }
1624
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1625
+ return import(
1626
+ /* @vite-ignore */
1627
+ /* webpackInclude: /\.entry\.js$/ */
1628
+ /* webpackExclude: /\.system\.entry\.js$/ */
1629
+ /* webpackMode: "lazy" */
1630
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1631
+ {
1632
+ cmpModules.set(bundleId, importedModule);
1633
+ }
1634
+ return importedModule[exportName];
1635
+ }, consoleError);
1636
+ };
1637
+ const styles = /*@__PURE__*/ new Map();
1638
+ const win = typeof window !== 'undefined' ? window : {};
1639
+ const doc = win.document || { head: {} };
1640
+ const plt = {
1641
+ $flags$: 0,
1642
+ $resourcesUrl$: '',
1643
+ jmp: (h) => h(),
1644
+ raf: (h) => requestAnimationFrame(h),
1645
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1646
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1647
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1648
+ };
1649
+ const promiseResolve = (v) => Promise.resolve(v);
1650
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1651
+ try {
1652
+ new CSSStyleSheet();
1653
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1654
+ }
1655
+ catch (e) { }
1656
+ return false;
1657
+ })()
1658
+ ;
1659
+ const queueDomReads = [];
1660
+ const queueDomWrites = [];
1661
+ const queueTask = (queue, write) => (cb) => {
1662
+ queue.push(cb);
1663
+ if (!queuePending) {
1664
+ queuePending = true;
1665
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1666
+ nextTick(flush);
1667
+ }
1668
+ else {
1669
+ plt.raf(flush);
1670
+ }
1671
+ }
1672
+ };
1673
+ const consume = (queue) => {
1674
+ for (let i = 0; i < queue.length; i++) {
1675
+ try {
1676
+ queue[i](performance.now());
1677
+ }
1678
+ catch (e) {
1679
+ consoleError(e);
1680
+ }
1681
+ }
1682
+ queue.length = 0;
1683
+ };
1684
+ const flush = () => {
1685
+ // always force a bunch of medium callbacks to run, but still have
1686
+ // a throttle on how many can run in a certain time
1687
+ // DOM READS!!!
1688
+ consume(queueDomReads);
1689
+ // DOM WRITES!!!
1690
+ {
1691
+ consume(queueDomWrites);
1692
+ if ((queuePending = queueDomReads.length > 0)) {
1693
+ // still more to do yet, but we've run out of time
1694
+ // let's let this thing cool off and try again in the next tick
1695
+ plt.raf(flush);
1696
+ }
1697
+ }
1698
+ };
1699
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1700
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1701
+
1702
+ export { Host as H, getRenderingRef as a, bootstrapLazy as b, createEvent as c, forceUpdate as f, getElement as g, h, promiseResolve as p, registerInstance as r, setNonce as s };
1703
+
1704
+ //# sourceMappingURL=index-066666f4.js.map