@peculiar/certificates-viewer 3.10.0 → 3.10.1-alpha.12

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 (553) hide show
  1. package/components/arrow_top.js +34 -0
  2. package/components/arrow_top.js.map +1 -0
  3. package/components/attribute-certificate-viewer.js +281 -0
  4. package/components/attribute-certificate-viewer.js.map +1 -0
  5. package/components/button-menu.js +64 -0
  6. package/components/button-menu.js.map +1 -0
  7. package/components/button.js +74 -0
  8. package/components/button.js.map +1 -0
  9. package/components/certificate-viewer.js +300 -0
  10. package/components/certificate-viewer.js.map +1 -0
  11. package/components/circular-progress.js +48 -0
  12. package/components/circular-progress.js.map +1 -0
  13. package/components/crl-viewer.js +263 -0
  14. package/components/crl-viewer.js.map +1 -0
  15. package/components/csr-viewer.js +233 -0
  16. package/components/csr-viewer.js.map +1 -0
  17. package/components/custom-elements.d.ts +2 -0
  18. package/{dist/esm/download-91511aeb.js → components/download.js} +2 -0
  19. package/components/download.js.map +1 -0
  20. package/components/highlight-words.js +60 -0
  21. package/components/highlight-words.js.map +1 -0
  22. package/components/index.d.ts +33 -0
  23. package/components/index.js +7 -0
  24. package/components/index.js.map +1 -0
  25. package/components/index2.js +299 -0
  26. package/components/index2.js.map +1 -0
  27. package/components/issuer_name.js +26 -0
  28. package/components/issuer_name.js.map +1 -0
  29. package/components/miscellaneous.js +13420 -0
  30. package/components/miscellaneous.js.map +1 -0
  31. package/components/package.json +9 -0
  32. package/components/peculiar-attribute-certificate-viewer.d.ts +11 -0
  33. package/components/peculiar-attribute-certificate-viewer.js +11 -0
  34. package/components/peculiar-attribute-certificate-viewer.js.map +1 -0
  35. package/components/peculiar-button-menu.d.ts +11 -0
  36. package/components/peculiar-button-menu.js +11 -0
  37. package/components/peculiar-button-menu.js.map +1 -0
  38. package/components/peculiar-certificate-decoder.d.ts +11 -0
  39. package/components/peculiar-certificate-decoder.js +234 -0
  40. package/components/peculiar-certificate-decoder.js.map +1 -0
  41. package/components/peculiar-certificate-viewer.d.ts +11 -0
  42. package/components/peculiar-certificate-viewer.js +11 -0
  43. package/components/peculiar-certificate-viewer.js.map +1 -0
  44. package/components/peculiar-certificates-viewer.d.ts +11 -0
  45. package/components/peculiar-certificates-viewer.js +382 -0
  46. package/components/peculiar-certificates-viewer.js.map +1 -0
  47. package/components/peculiar-circular-progress.d.ts +11 -0
  48. package/components/peculiar-circular-progress.js +11 -0
  49. package/components/peculiar-circular-progress.js.map +1 -0
  50. package/components/peculiar-crl-viewer.d.ts +11 -0
  51. package/components/peculiar-crl-viewer.js +11 -0
  52. package/components/peculiar-crl-viewer.js.map +1 -0
  53. package/components/peculiar-csr-viewer.d.ts +11 -0
  54. package/components/peculiar-csr-viewer.js +11 -0
  55. package/components/peculiar-csr-viewer.js.map +1 -0
  56. package/components/peculiar-highlight-words.d.ts +11 -0
  57. package/components/peculiar-highlight-words.js +11 -0
  58. package/components/peculiar-highlight-words.js.map +1 -0
  59. package/components/peculiar-text-hider.d.ts +11 -0
  60. package/components/peculiar-text-hider.js +42 -0
  61. package/components/peculiar-text-hider.js.map +1 -0
  62. package/components/subject_name.js +71 -0
  63. package/components/subject_name.js.map +1 -0
  64. package/dist/cjs/arrow_top-834fb7ec.js +37 -0
  65. package/dist/cjs/arrow_top-834fb7ec.js.map +1 -0
  66. package/dist/cjs/button-14e2b73f.js +77 -0
  67. package/dist/cjs/button-14e2b73f.js.map +1 -0
  68. package/dist/cjs/{certification_request-d5c6e32d.js → certification_request-c0cafa72.js} +236 -71
  69. package/dist/cjs/certification_request-c0cafa72.js.map +1 -0
  70. package/dist/cjs/{crl-5bce64c4.js → crl-b4322166.js} +8 -7
  71. package/dist/cjs/crl-b4322166.js.map +1 -0
  72. package/dist/cjs/download-254ddc57.js +23 -0
  73. package/dist/cjs/download-254ddc57.js.map +1 -0
  74. package/dist/cjs/{download-93f7b773.js → download-972dda8a.js} +2 -0
  75. package/dist/cjs/download-972dda8a.js.map +1 -0
  76. package/dist/cjs/index-efd561e9.js +2477 -0
  77. package/dist/cjs/index-efd561e9.js.map +1 -0
  78. package/dist/cjs/index.cjs.js +3 -1
  79. package/dist/cjs/index.cjs.js.map +1 -0
  80. package/dist/cjs/loader.cjs.js +6 -12
  81. package/dist/cjs/loader.cjs.js.map +1 -0
  82. package/dist/cjs/{miscellaneous-cac1cd8b.js → miscellaneous-806a04a5.js} +86 -70
  83. package/dist/cjs/miscellaneous-806a04a5.js.map +1 -0
  84. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js +92 -35
  85. package/dist/cjs/peculiar-attribute-certificate-viewer_3.cjs.entry.js.map +1 -0
  86. package/dist/cjs/peculiar-button-menu_3.cjs.entry.js +110 -0
  87. package/dist/cjs/peculiar-button-menu_3.cjs.entry.js.map +1 -0
  88. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js +30 -19
  89. package/dist/cjs/peculiar-certificate-decoder.cjs.entry.js.map +1 -0
  90. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js +34 -11
  91. package/dist/cjs/peculiar-certificate-viewer.cjs.entry.js.map +1 -0
  92. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js +183 -85
  93. package/dist/cjs/peculiar-certificates-viewer.cjs.entry.js.map +1 -0
  94. package/dist/cjs/peculiar-text-hider.cjs.entry.js +7 -13
  95. package/dist/cjs/peculiar-text-hider.cjs.entry.js.map +1 -0
  96. package/dist/cjs/peculiar.cjs.js +10 -57
  97. package/dist/cjs/peculiar.cjs.js.map +1 -0
  98. package/dist/cjs/{x509_certificate-3760e0a8.js → x509_certificate-989b1435.js} +5 -4
  99. package/dist/cjs/x509_certificate-989b1435.js.map +1 -0
  100. package/dist/collection/collection-manifest.json +12 -16
  101. package/dist/collection/components/attribute-certificate-viewer/attribute-certificate-viewer.js +189 -145
  102. package/dist/collection/components/attribute-certificate-viewer/attribute-certificate-viewer.js.map +1 -0
  103. package/dist/collection/components/button/button.js +14 -126
  104. package/dist/collection/components/button/button.js.map +1 -0
  105. package/dist/collection/components/button/index.js +5 -0
  106. package/dist/collection/components/button/index.js.map +1 -0
  107. package/dist/collection/components/button-menu/button-menu.css +46 -0
  108. package/dist/collection/components/button-menu/button-menu.js +78 -0
  109. package/dist/collection/components/button-menu/button-menu.js.map +1 -0
  110. package/dist/collection/components/certificate-decoder/certificate-decoder.css +456 -44
  111. package/dist/collection/components/certificate-decoder/certificate-decoder.js +109 -101
  112. package/dist/collection/components/certificate-decoder/certificate-decoder.js.map +1 -0
  113. package/dist/collection/components/certificate-details-parts/attributes/activity_description_attribute.js +6 -11
  114. package/dist/collection/components/certificate-details-parts/attributes/activity_description_attribute.js.map +1 -0
  115. package/dist/collection/components/certificate-details-parts/attributes/as_string_attribute.js +5 -5
  116. package/dist/collection/components/certificate-details-parts/attributes/as_string_attribute.js.map +1 -0
  117. package/dist/collection/components/certificate-details-parts/attributes/basic_attribute.js +5 -6
  118. package/dist/collection/components/certificate-details-parts/attributes/basic_attribute.js.map +1 -0
  119. package/dist/collection/components/certificate-details-parts/attributes/challenge_password_attribute.js +5 -5
  120. package/dist/collection/components/certificate-details-parts/attributes/challenge_password_attribute.js.map +1 -0
  121. package/dist/collection/components/certificate-details-parts/attributes/index.js +16 -15
  122. package/dist/collection/components/certificate-details-parts/attributes/index.js.map +1 -0
  123. package/dist/collection/components/certificate-details-parts/attributes/insurance_value_attribute.js +5 -5
  124. package/dist/collection/components/certificate-details-parts/attributes/insurance_value_attribute.js.map +1 -0
  125. package/dist/collection/components/certificate-details-parts/attributes/name_attribute.js +5 -5
  126. package/dist/collection/components/certificate-details-parts/attributes/name_attribute.js.map +1 -0
  127. package/dist/collection/components/certificate-details-parts/attributes/name_part.js +4 -3
  128. package/dist/collection/components/certificate-details-parts/attributes/name_part.js.map +1 -0
  129. package/dist/collection/components/certificate-details-parts/attributes/type_relationship_attribute.js +5 -4
  130. package/dist/collection/components/certificate-details-parts/attributes/type_relationship_attribute.js.map +1 -0
  131. package/dist/collection/components/certificate-details-parts/attributes/unstructured_name_attribute.js +5 -5
  132. package/dist/collection/components/certificate-details-parts/attributes/unstructured_name_attribute.js.map +1 -0
  133. package/dist/collection/components/certificate-details-parts/attributes/valuation_ranking_attribute.js +5 -5
  134. package/dist/collection/components/certificate-details-parts/attributes/valuation_ranking_attribute.js.map +1 -0
  135. package/dist/collection/components/certificate-details-parts/attributes/web_gdpr_attribute.js +6 -13
  136. package/dist/collection/components/certificate-details-parts/attributes/web_gdpr_attribute.js.map +1 -0
  137. package/dist/collection/components/certificate-details-parts/basic_information.js +4 -3
  138. package/dist/collection/components/certificate-details-parts/basic_information.js.map +1 -0
  139. package/dist/collection/components/certificate-details-parts/extensions/archive_rev_info_extension.js +5 -5
  140. package/dist/collection/components/certificate-details-parts/extensions/archive_rev_info_extension.js.map +1 -0
  141. package/dist/collection/components/certificate-details-parts/extensions/as_string_extension.js +5 -5
  142. package/dist/collection/components/certificate-details-parts/extensions/as_string_extension.js.map +1 -0
  143. package/dist/collection/components/certificate-details-parts/extensions/attribute_value.js +2 -1
  144. package/dist/collection/components/certificate-details-parts/extensions/attribute_value.js.map +1 -0
  145. package/dist/collection/components/certificate-details-parts/extensions/authority_key_identifier_extension.js +10 -15
  146. package/dist/collection/components/certificate-details-parts/extensions/authority_key_identifier_extension.js.map +1 -0
  147. package/dist/collection/components/certificate-details-parts/extensions/basic_constraints_extension.js +6 -7
  148. package/dist/collection/components/certificate-details-parts/extensions/basic_constraints_extension.js.map +1 -0
  149. package/dist/collection/components/certificate-details-parts/extensions/basic_extension.js +5 -6
  150. package/dist/collection/components/certificate-details-parts/extensions/basic_extension.js.map +1 -0
  151. package/dist/collection/components/certificate-details-parts/extensions/biometric_syntax_extension.js +8 -12
  152. package/dist/collection/components/certificate-details-parts/extensions/biometric_syntax_extension.js.map +1 -0
  153. package/dist/collection/components/certificate-details-parts/extensions/ca_version_extension.js +5 -6
  154. package/dist/collection/components/certificate-details-parts/extensions/ca_version_extension.js.map +1 -0
  155. package/dist/collection/components/certificate-details-parts/extensions/certificate_policies_extension.js +26 -27
  156. package/dist/collection/components/certificate-details-parts/extensions/certificate_policies_extension.js.map +1 -0
  157. package/dist/collection/components/certificate-details-parts/extensions/certificate_template_extension.js +5 -7
  158. package/dist/collection/components/certificate-details-parts/extensions/certificate_template_extension.js.map +1 -0
  159. package/dist/collection/components/certificate-details-parts/extensions/certificate_transparency_extension.js +8 -13
  160. package/dist/collection/components/certificate-details-parts/extensions/certificate_transparency_extension.js.map +1 -0
  161. package/dist/collection/components/certificate-details-parts/extensions/crl_distribution_points_extension.js +4 -3
  162. package/dist/collection/components/certificate-details-parts/extensions/crl_distribution_points_extension.js.map +1 -0
  163. package/dist/collection/components/certificate-details-parts/extensions/crl_number_extension.js +6 -6
  164. package/dist/collection/components/certificate-details-parts/extensions/crl_number_extension.js.map +1 -0
  165. package/dist/collection/components/certificate-details-parts/extensions/crl_reason_extension.js +5 -5
  166. package/dist/collection/components/certificate-details-parts/extensions/crl_reason_extension.js.map +1 -0
  167. package/dist/collection/components/certificate-details-parts/extensions/enroll_cert_type_extension.js +5 -5
  168. package/dist/collection/components/certificate-details-parts/extensions/enroll_cert_type_extension.js.map +1 -0
  169. package/dist/collection/components/certificate-details-parts/extensions/entrust_version_info_extension.js +5 -6
  170. package/dist/collection/components/certificate-details-parts/extensions/entrust_version_info_extension.js.map +1 -0
  171. package/dist/collection/components/certificate-details-parts/extensions/extended_key_usage_extension.js +7 -7
  172. package/dist/collection/components/certificate-details-parts/extensions/extended_key_usage_extension.js.map +1 -0
  173. package/dist/collection/components/certificate-details-parts/extensions/general_name_part.js +7 -6
  174. package/dist/collection/components/certificate-details-parts/extensions/general_name_part.js.map +1 -0
  175. package/dist/collection/components/certificate-details-parts/extensions/index.js +46 -45
  176. package/dist/collection/components/certificate-details-parts/extensions/index.js.map +1 -0
  177. package/dist/collection/components/certificate-details-parts/extensions/info_access_syntax_extension.js +8 -9
  178. package/dist/collection/components/certificate-details-parts/extensions/info_access_syntax_extension.js.map +1 -0
  179. package/dist/collection/components/certificate-details-parts/extensions/issuing_distribution_point_extension.js +7 -11
  180. package/dist/collection/components/certificate-details-parts/extensions/issuing_distribution_point_extension.js.map +1 -0
  181. package/dist/collection/components/certificate-details-parts/extensions/key_usage_extension.js +5 -5
  182. package/dist/collection/components/certificate-details-parts/extensions/key_usage_extension.js.map +1 -0
  183. package/dist/collection/components/certificate-details-parts/extensions/lei_extension.js +5 -5
  184. package/dist/collection/components/certificate-details-parts/extensions/lei_extension.js.map +1 -0
  185. package/dist/collection/components/certificate-details-parts/extensions/lei_role_extennsion.js +5 -5
  186. package/dist/collection/components/certificate-details-parts/extensions/lei_role_extennsion.js.map +1 -0
  187. package/dist/collection/components/certificate-details-parts/extensions/logotype_extension.js +8 -11
  188. package/dist/collection/components/certificate-details-parts/extensions/logotype_extension.js.map +1 -0
  189. package/dist/collection/components/certificate-details-parts/extensions/name_constraints_extension.js +4 -3
  190. package/dist/collection/components/certificate-details-parts/extensions/name_constraints_extension.js.map +1 -0
  191. package/dist/collection/components/certificate-details-parts/extensions/netscape_cert_type_extension.js +5 -5
  192. package/dist/collection/components/certificate-details-parts/extensions/netscape_cert_type_extension.js.map +1 -0
  193. package/dist/collection/components/certificate-details-parts/extensions/netscape_comment_extension.js +5 -5
  194. package/dist/collection/components/certificate-details-parts/extensions/netscape_comment_extension.js.map +1 -0
  195. package/dist/collection/components/certificate-details-parts/extensions/policy_constraints_extension.js +6 -7
  196. package/dist/collection/components/certificate-details-parts/extensions/policy_constraints_extension.js.map +1 -0
  197. package/dist/collection/components/certificate-details-parts/extensions/policy_mappings_extension.js +5 -4
  198. package/dist/collection/components/certificate-details-parts/extensions/policy_mappings_extension.js.map +1 -0
  199. package/dist/collection/components/certificate-details-parts/extensions/private_key_usage_period_extension.js +6 -7
  200. package/dist/collection/components/certificate-details-parts/extensions/private_key_usage_period_extension.js.map +1 -0
  201. package/dist/collection/components/certificate-details-parts/extensions/qc_statements_extension.js +13 -16
  202. package/dist/collection/components/certificate-details-parts/extensions/qc_statements_extension.js.map +1 -0
  203. package/dist/collection/components/certificate-details-parts/extensions/subject_alternative_name_extension.js +4 -3
  204. package/dist/collection/components/certificate-details-parts/extensions/subject_alternative_name_extension.js.map +1 -0
  205. package/dist/collection/components/certificate-details-parts/extensions/subject_directory_attributes_extension.js +8 -9
  206. package/dist/collection/components/certificate-details-parts/extensions/subject_directory_attributes_extension.js.map +1 -0
  207. package/dist/collection/components/certificate-details-parts/extensions/subject_key_identifier_extension.js +10 -15
  208. package/dist/collection/components/certificate-details-parts/extensions/subject_key_identifier_extension.js.map +1 -0
  209. package/dist/collection/components/certificate-details-parts/extensions/timestamp_extension.js +7 -9
  210. package/dist/collection/components/certificate-details-parts/extensions/timestamp_extension.js.map +1 -0
  211. package/dist/collection/components/certificate-details-parts/extensions/tn_auth_list_extension.js +4 -3
  212. package/dist/collection/components/certificate-details-parts/extensions/tn_auth_list_extension.js.map +1 -0
  213. package/dist/collection/components/certificate-details-parts/holder.js +8 -11
  214. package/dist/collection/components/certificate-details-parts/holder.js.map +1 -0
  215. package/dist/collection/components/certificate-details-parts/index.js +1 -0
  216. package/dist/collection/components/certificate-details-parts/index.js.map +1 -0
  217. package/dist/collection/components/certificate-details-parts/issuer.js +5 -4
  218. package/dist/collection/components/certificate-details-parts/issuer.js.map +1 -0
  219. package/dist/collection/components/certificate-details-parts/issuer_name.js +6 -4
  220. package/dist/collection/components/certificate-details-parts/issuer_name.js.map +1 -0
  221. package/dist/collection/components/certificate-details-parts/miscellaneous.js +8 -13
  222. package/dist/collection/components/certificate-details-parts/miscellaneous.js.map +1 -0
  223. package/dist/collection/components/certificate-details-parts/public_key.js +8 -7
  224. package/dist/collection/components/certificate-details-parts/public_key.js.map +1 -0
  225. package/dist/collection/components/certificate-details-parts/revoked_certificates.js +9 -11
  226. package/dist/collection/components/certificate-details-parts/revoked_certificates.js.map +1 -0
  227. package/dist/collection/components/certificate-details-parts/row.js +13 -18
  228. package/dist/collection/components/certificate-details-parts/row.js.map +1 -0
  229. package/dist/collection/components/certificate-details-parts/signature.js +5 -4
  230. package/dist/collection/components/certificate-details-parts/signature.js.map +1 -0
  231. package/dist/collection/components/certificate-details-parts/subject_name.js +4 -3
  232. package/dist/collection/components/certificate-details-parts/subject_name.js.map +1 -0
  233. package/dist/collection/components/certificate-details-parts/thumbprints.js +4 -3
  234. package/dist/collection/components/certificate-details-parts/thumbprints.js.map +1 -0
  235. package/dist/collection/components/certificate-summary/certificate-summary.js +9 -77
  236. package/dist/collection/components/certificate-summary/certificate-summary.js.map +1 -0
  237. package/dist/collection/components/certificate-summary/index.js +5 -0
  238. package/dist/collection/components/certificate-summary/index.js.map +1 -0
  239. package/dist/collection/components/certificate-viewer/certificate-viewer.css +470 -104
  240. package/dist/collection/components/certificate-viewer/certificate-viewer.js +206 -178
  241. package/dist/collection/components/certificate-viewer/certificate-viewer.js.map +1 -0
  242. package/dist/collection/components/certificates-viewer/certificates-viewer.css +540 -267
  243. package/dist/collection/components/certificates-viewer/certificates-viewer.js +261 -266
  244. package/dist/collection/components/certificates-viewer/certificates-viewer.js.map +1 -0
  245. package/dist/collection/components/circular-progress/circular-progress.css +2 -11
  246. package/dist/collection/components/circular-progress/circular-progress.js +60 -63
  247. package/dist/collection/components/circular-progress/circular-progress.js.map +1 -0
  248. package/dist/collection/components/crl-viewer/crl-viewer.js +166 -139
  249. package/dist/collection/components/crl-viewer/crl-viewer.js.map +1 -0
  250. package/dist/collection/components/csr-viewer/csr-viewer.js +149 -124
  251. package/dist/collection/components/csr-viewer/csr-viewer.js.map +1 -0
  252. package/dist/collection/components/highlight-words/highlight-words.css +1 -9
  253. package/dist/collection/components/highlight-words/highlight-words.js +35 -28
  254. package/dist/collection/components/highlight-words/highlight-words.js.map +1 -0
  255. package/dist/collection/components/icons/actions.js +16 -0
  256. package/dist/collection/components/icons/actions.js.map +1 -0
  257. package/dist/collection/components/icons/arrow_bottom.js +16 -0
  258. package/dist/collection/components/icons/arrow_bottom.js.map +1 -0
  259. package/dist/collection/components/icons/arrow_top.js +16 -0
  260. package/dist/collection/components/icons/arrow_top.js.map +1 -0
  261. package/dist/collection/components/icons/cross.js +16 -0
  262. package/dist/collection/components/icons/cross.js.map +1 -0
  263. package/dist/collection/components/icons/details.js +16 -0
  264. package/dist/collection/components/icons/details.js.map +1 -0
  265. package/dist/collection/components/icons/download.js +16 -0
  266. package/dist/collection/components/icons/download.js.map +1 -0
  267. package/dist/collection/components/icons/index.js +11 -0
  268. package/dist/collection/components/icons/index.js.map +1 -0
  269. package/dist/collection/components/icons/link.js +16 -0
  270. package/dist/collection/components/icons/link.js.map +1 -0
  271. package/dist/collection/components/link/index.js +5 -0
  272. package/dist/collection/components/link/index.js.map +1 -0
  273. package/dist/collection/components/link/link.js +9 -61
  274. package/dist/collection/components/link/link.js.map +1 -0
  275. package/dist/collection/components/text-hider/text-hider.css +9 -36
  276. package/dist/collection/components/text-hider/text-hider.js +21 -68
  277. package/dist/collection/components/text-hider/text-hider.js.map +1 -0
  278. package/dist/collection/components/typography/index.js +5 -0
  279. package/dist/collection/components/typography/index.js.map +1 -0
  280. package/dist/collection/components/typography/typography.js +39 -126
  281. package/dist/collection/components/typography/typography.js.map +1 -0
  282. package/dist/collection/constants/logs.js +1 -0
  283. package/dist/collection/constants/logs.js.map +1 -0
  284. package/dist/collection/constants/oids.js +1 -0
  285. package/dist/collection/constants/oids.js.map +1 -0
  286. package/dist/collection/crypto/asn_data.js +13 -7
  287. package/dist/collection/crypto/asn_data.js.map +1 -0
  288. package/dist/collection/crypto/attribute.js +11 -10
  289. package/dist/collection/crypto/attribute.js.map +1 -0
  290. package/dist/collection/crypto/crl.js +9 -8
  291. package/dist/collection/crypto/crl.js.map +1 -0
  292. package/dist/collection/crypto/csr.js +11 -10
  293. package/dist/collection/crypto/csr.js.map +1 -0
  294. package/dist/collection/crypto/extension.js +16 -15
  295. package/dist/collection/crypto/extension.js.map +1 -0
  296. package/dist/collection/crypto/index.js +1 -0
  297. package/dist/collection/crypto/index.js.map +1 -0
  298. package/dist/collection/crypto/name.js +15 -9
  299. package/dist/collection/crypto/name.js.map +1 -0
  300. package/dist/collection/crypto/provider.js +4 -3
  301. package/dist/collection/crypto/provider.js.map +1 -0
  302. package/dist/collection/crypto/utils.js +4 -3
  303. package/dist/collection/crypto/utils.js.map +1 -0
  304. package/dist/collection/crypto/x509_attribute_certificate.js +9 -8
  305. package/dist/collection/crypto/x509_attribute_certificate.js.map +1 -0
  306. package/dist/collection/crypto/x509_certificate.js +12 -11
  307. package/dist/collection/crypto/x509_certificate.js.map +1 -0
  308. package/dist/collection/index.js +1 -0
  309. package/dist/collection/index.js.map +1 -0
  310. package/dist/collection/locales/en.json +4 -3
  311. package/dist/collection/utils/date_formatter.js +3 -2
  312. package/dist/collection/utils/date_formatter.js.map +1 -0
  313. package/dist/collection/utils/download.js +3 -2
  314. package/dist/collection/utils/download.js.map +1 -0
  315. package/dist/collection/utils/download_from_buffer.js +1 -0
  316. package/dist/collection/utils/download_from_buffer.js.map +1 -0
  317. package/dist/collection/utils/get_string_by_oid.js +2 -1
  318. package/dist/collection/utils/get_string_by_oid.js.map +1 -0
  319. package/dist/collection/utils/index.js +2 -1
  320. package/dist/collection/utils/index.js.map +1 -0
  321. package/dist/collection/utils/is_link.js +1 -0
  322. package/dist/collection/utils/is_link.js.map +1 -0
  323. package/dist/collection/utils/l10n.js +2 -1
  324. package/dist/collection/utils/l10n.js.map +1 -0
  325. package/dist/collection/utils/read_file.js +1 -0
  326. package/dist/collection/utils/read_file.js.map +1 -0
  327. package/dist/collection/utils/third_party_links.js +1 -0
  328. package/dist/collection/utils/third_party_links.js.map +1 -0
  329. package/dist/collection/utils/validator.js +1 -0
  330. package/dist/collection/utils/validator.js.map +1 -0
  331. package/dist/collection/www-copy/index.js +138 -32
  332. package/dist/esm/arrow_top-efd3a56d.js +34 -0
  333. package/dist/esm/arrow_top-efd3a56d.js.map +1 -0
  334. package/dist/esm/button-35146bdd.js +74 -0
  335. package/dist/esm/button-35146bdd.js.map +1 -0
  336. package/dist/esm/{certification_request-23cd5124.js → certification_request-5cadde9f.js} +171 -9
  337. package/dist/esm/certification_request-5cadde9f.js.map +1 -0
  338. package/dist/esm/{crl-7f23c111.js → crl-11670c3e.js} +7 -6
  339. package/dist/esm/crl-11670c3e.js.map +1 -0
  340. package/dist/esm/download-0cc3077a.js +21 -0
  341. package/dist/esm/download-0cc3077a.js.map +1 -0
  342. package/dist/esm/download-57c5bf8f.js +470 -0
  343. package/dist/esm/download-57c5bf8f.js.map +1 -0
  344. package/dist/esm/index-4079bbb5.js +2448 -0
  345. package/dist/esm/index-4079bbb5.js.map +1 -0
  346. package/dist/esm/index.js +3 -1
  347. package/dist/esm/index.js.map +1 -0
  348. package/dist/esm/loader.js +6 -12
  349. package/dist/esm/loader.js.map +1 -0
  350. package/dist/esm/{miscellaneous-c7c0d04a.js → miscellaneous-1d4e8b41.js} +53 -37
  351. package/dist/esm/miscellaneous-1d4e8b41.js.map +1 -0
  352. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js +80 -23
  353. package/dist/esm/peculiar-attribute-certificate-viewer_3.entry.js.map +1 -0
  354. package/dist/esm/peculiar-button-menu_3.entry.js +104 -0
  355. package/dist/esm/peculiar-button-menu_3.entry.js.map +1 -0
  356. package/dist/esm/peculiar-certificate-decoder.entry.js +30 -19
  357. package/dist/esm/peculiar-certificate-decoder.entry.js.map +1 -0
  358. package/dist/esm/peculiar-certificate-viewer.entry.js +34 -11
  359. package/dist/esm/peculiar-certificate-viewer.entry.js.map +1 -0
  360. package/dist/esm/peculiar-certificates-viewer.entry.js +183 -85
  361. package/dist/esm/peculiar-certificates-viewer.entry.js.map +1 -0
  362. package/dist/esm/peculiar-text-hider.entry.js +7 -13
  363. package/dist/esm/peculiar-text-hider.entry.js.map +1 -0
  364. package/dist/esm/peculiar.js +8 -58
  365. package/dist/esm/peculiar.js.map +1 -0
  366. package/dist/esm/{x509_certificate-d8e0af2d.js → x509_certificate-dfae6999.js} +4 -3
  367. package/dist/esm/x509_certificate-dfae6999.js.map +1 -0
  368. package/dist/esm-es5/arrow_top-efd3a56d.js +19 -0
  369. package/dist/esm-es5/arrow_top-efd3a56d.js.map +1 -0
  370. package/dist/esm-es5/button-35146bdd.js +19 -0
  371. package/dist/esm-es5/button-35146bdd.js.map +1 -0
  372. package/dist/esm-es5/certification_request-5cadde9f.js +97 -0
  373. package/dist/esm-es5/certification_request-5cadde9f.js.map +1 -0
  374. package/dist/esm-es5/crl-11670c3e.js +33 -0
  375. package/dist/esm-es5/crl-11670c3e.js.map +1 -0
  376. package/dist/esm-es5/download-0cc3077a.js +12 -0
  377. package/dist/esm-es5/download-0cc3077a.js.map +1 -0
  378. package/dist/esm-es5/download-57c5bf8f.js +19 -0
  379. package/dist/esm-es5/download-57c5bf8f.js.map +1 -0
  380. package/dist/esm-es5/index-4079bbb5.js +6 -0
  381. package/dist/esm-es5/index-4079bbb5.js.map +1 -0
  382. package/dist/esm-es5/index.js +5 -0
  383. package/dist/esm-es5/index.js.map +1 -0
  384. package/dist/esm-es5/loader.js +5 -0
  385. package/dist/esm-es5/loader.js.map +1 -0
  386. package/dist/esm-es5/miscellaneous-1d4e8b41.js +355 -0
  387. package/dist/esm-es5/miscellaneous-1d4e8b41.js.map +1 -0
  388. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js +110 -0
  389. package/dist/esm-es5/peculiar-attribute-certificate-viewer_3.entry.js.map +1 -0
  390. package/dist/esm-es5/peculiar-button-menu_3.entry.js +12 -0
  391. package/dist/esm-es5/peculiar-button-menu_3.entry.js.map +1 -0
  392. package/dist/esm-es5/peculiar-certificate-decoder.entry.js +12 -0
  393. package/dist/esm-es5/peculiar-certificate-decoder.entry.js.map +1 -0
  394. package/dist/esm-es5/peculiar-certificate-viewer.entry.js +5 -0
  395. package/dist/esm-es5/peculiar-certificate-viewer.entry.js.map +1 -0
  396. package/dist/esm-es5/peculiar-certificates-viewer.entry.js +33 -0
  397. package/dist/esm-es5/peculiar-certificates-viewer.entry.js.map +1 -0
  398. package/dist/esm-es5/peculiar-text-hider.entry.js +5 -0
  399. package/dist/esm-es5/peculiar-text-hider.entry.js.map +1 -0
  400. package/dist/esm-es5/peculiar.js +5 -0
  401. package/dist/esm-es5/peculiar.js.map +1 -0
  402. package/dist/esm-es5/x509_certificate-dfae6999.js +12 -0
  403. package/dist/esm-es5/x509_certificate-dfae6999.js.map +1 -0
  404. package/dist/index.js +1 -1
  405. package/dist/peculiar/index.esm.js +2 -1
  406. package/dist/peculiar/index.esm.js.map +1 -0
  407. package/dist/peculiar/locales/en.json +4 -3
  408. package/dist/peculiar/p-0b356bb5.js +6 -0
  409. package/dist/peculiar/p-0b356bb5.js.map +1 -0
  410. package/dist/peculiar/p-0bdcdbf7.system.js +355 -0
  411. package/dist/peculiar/p-0bdcdbf7.system.js.map +1 -0
  412. package/dist/peculiar/p-17e3c47b.js +12 -0
  413. package/dist/peculiar/p-17e3c47b.js.map +1 -0
  414. package/dist/peculiar/p-23555789.system.entry.js +34 -0
  415. package/dist/peculiar/p-23555789.system.entry.js.map +1 -0
  416. package/dist/peculiar/p-2fcad8cb.system.js +20 -0
  417. package/dist/peculiar/p-2fcad8cb.system.js.map +1 -0
  418. package/dist/peculiar/p-31586b23.system.js +13 -0
  419. package/dist/peculiar/p-31586b23.system.js.map +1 -0
  420. package/dist/peculiar/p-43eb3721.js +33 -0
  421. package/dist/peculiar/p-43eb3721.js.map +1 -0
  422. package/dist/peculiar/p-5823e6e8.entry.js +12 -0
  423. package/dist/peculiar/p-5823e6e8.entry.js.map +1 -0
  424. package/dist/peculiar/p-596836a7.entry.js +33 -0
  425. package/dist/peculiar/p-596836a7.entry.js.map +1 -0
  426. package/dist/peculiar/p-5aabeba7.system.js +6 -0
  427. package/dist/peculiar/p-5aabeba7.system.js.map +1 -0
  428. package/dist/peculiar/p-6667fe6e.system.js +34 -0
  429. package/dist/peculiar/p-6667fe6e.system.js.map +1 -0
  430. package/dist/peculiar/p-6e79b9c8.js +12 -0
  431. package/dist/peculiar/p-6e79b9c8.js.map +1 -0
  432. package/dist/peculiar/p-709994c1.js +19 -0
  433. package/dist/peculiar/p-709994c1.js.map +1 -0
  434. package/dist/peculiar/p-74c241e7.js +97 -0
  435. package/dist/peculiar/p-74c241e7.js.map +1 -0
  436. package/dist/peculiar/p-7f9beaa8.js +19 -0
  437. package/dist/peculiar/p-7f9beaa8.js.map +1 -0
  438. package/dist/peculiar/p-80832207.system.js +5 -0
  439. package/dist/peculiar/p-80832207.system.js.map +1 -0
  440. package/dist/peculiar/p-8748391f.system.entry.js +5 -0
  441. package/dist/peculiar/p-8748391f.system.entry.js.map +1 -0
  442. package/dist/peculiar/p-882e1281.entry.js +12 -0
  443. package/dist/peculiar/p-882e1281.entry.js.map +1 -0
  444. package/dist/peculiar/p-90459cec.entry.js +5 -0
  445. package/dist/peculiar/p-90459cec.entry.js.map +1 -0
  446. package/dist/peculiar/p-97688065.js +355 -0
  447. package/dist/peculiar/p-97688065.js.map +1 -0
  448. package/dist/peculiar/p-99e3aa0c.system.entry.js +111 -0
  449. package/dist/peculiar/p-99e3aa0c.system.entry.js.map +1 -0
  450. package/dist/peculiar/p-9b4a8101.system.entry.js +5 -0
  451. package/dist/peculiar/p-9b4a8101.system.entry.js.map +1 -0
  452. package/dist/peculiar/p-a053c132.js +19 -0
  453. package/dist/peculiar/p-a053c132.js.map +1 -0
  454. package/dist/peculiar/p-a41ecd82.entry.js +5 -0
  455. package/dist/peculiar/p-a41ecd82.entry.js.map +1 -0
  456. package/dist/peculiar/p-ae9189f6.system.js +19 -0
  457. package/dist/peculiar/p-ae9189f6.system.js.map +1 -0
  458. package/dist/peculiar/p-bd485115.system.entry.js +13 -0
  459. package/dist/peculiar/p-bd485115.system.entry.js.map +1 -0
  460. package/dist/peculiar/p-c0a298fd.system.js +97 -0
  461. package/dist/peculiar/p-c0a298fd.system.js.map +1 -0
  462. package/dist/peculiar/p-daf23673.system.js +20 -0
  463. package/dist/peculiar/p-daf23673.system.js.map +1 -0
  464. package/dist/peculiar/p-e1960173.system.js +5 -0
  465. package/dist/peculiar/p-e1960173.system.js.map +1 -0
  466. package/dist/peculiar/p-e2cc7410.entry.js +110 -0
  467. package/dist/peculiar/p-e2cc7410.entry.js.map +1 -0
  468. package/dist/peculiar/p-e39de121.system.entry.js +13 -0
  469. package/dist/peculiar/p-e39de121.system.entry.js.map +1 -0
  470. package/dist/peculiar/p-e6a3b4d4.system.js +13 -0
  471. package/dist/peculiar/p-e6a3b4d4.system.js.map +1 -0
  472. package/dist/peculiar/peculiar.css +1 -1
  473. package/dist/peculiar/peculiar.esm.js +2 -1
  474. package/dist/peculiar/peculiar.esm.js.map +1 -0
  475. package/dist/peculiar/peculiar.js +127 -0
  476. package/dist/types/components/attribute-certificate-viewer/attribute-certificate-viewer.d.ts +15 -3
  477. package/dist/types/components/button/button.d.ts +5 -16
  478. package/dist/types/components/button/index.d.ts +2 -0
  479. package/dist/types/components/button-menu/button-menu.d.ts +21 -0
  480. package/dist/types/components/certificate-decoder/certificate-decoder.d.ts +9 -6
  481. package/dist/types/components/certificate-details-parts/miscellaneous.d.ts +1 -1
  482. package/dist/types/components/certificate-summary/certificate-summary.d.ts +4 -3
  483. package/dist/types/components/certificate-summary/index.d.ts +1 -0
  484. package/dist/types/components/certificate-viewer/certificate-viewer.d.ts +13 -5
  485. package/dist/types/components/certificates-viewer/certificates-viewer.d.ts +22 -11
  486. package/dist/types/components/crl-viewer/crl-viewer.d.ts +13 -5
  487. package/dist/types/components/csr-viewer/csr-viewer.d.ts +13 -5
  488. package/dist/types/components/icons/actions.d.ts +12 -0
  489. package/dist/types/components/icons/arrow_bottom.d.ts +12 -0
  490. package/dist/types/components/icons/arrow_top.d.ts +12 -0
  491. package/dist/types/components/icons/cross.d.ts +12 -0
  492. package/dist/types/components/icons/details.d.ts +12 -0
  493. package/dist/types/components/icons/download.d.ts +12 -0
  494. package/dist/types/components/icons/index.d.ts +7 -0
  495. package/dist/types/components/icons/link.d.ts +12 -0
  496. package/dist/types/components/link/index.d.ts +1 -0
  497. package/dist/types/components/link/link.d.ts +6 -6
  498. package/dist/types/components/text-hider/text-hider.d.ts +0 -3
  499. package/dist/types/components/typography/index.d.ts +1 -0
  500. package/dist/types/components/typography/typography.d.ts +10 -20
  501. package/dist/types/components.d.ts +74 -175
  502. package/dist/types/crypto/attribute.d.ts +1 -1
  503. package/dist/types/crypto/extension.d.ts +1 -1
  504. package/dist/types/interface.d.ts +98 -6
  505. package/dist/types/stencil-public-runtime.d.ts +110 -23
  506. package/dist/types/utils/l10n.d.ts +5 -4
  507. package/dist/types/utils/read_file.d.ts +1 -1
  508. package/hydrate/index.d.ts +218 -0
  509. package/hydrate/index.js +22549 -0
  510. package/hydrate/package.json +6 -0
  511. package/loader/index.d.ts +10 -1
  512. package/loader/index.js +1 -1
  513. package/loader/package.json +1 -0
  514. package/package.json +6 -4
  515. package/dist/cjs/dom-f57e260e.js +0 -78
  516. package/dist/cjs/index-064e95c7.js +0 -1441
  517. package/dist/cjs/l10n-ddc7cff9.js +0 -169
  518. package/dist/cjs/peculiar-button-split_4.cjs.entry.js +0 -128
  519. package/dist/cjs/peculiar-button.cjs.entry.js +0 -40
  520. package/dist/cjs/peculiar-link.cjs.entry.js +0 -29
  521. package/dist/cjs/peculiar-typography.cjs.entry.js +0 -38
  522. package/dist/collection/components/button/button.css +0 -81
  523. package/dist/collection/components/button-split/button-split.css +0 -57
  524. package/dist/collection/components/button-split/button-split.js +0 -116
  525. package/dist/collection/components/certificate-summary/certificate-summary.css +0 -49
  526. package/dist/collection/components/link/link.css +0 -59
  527. package/dist/collection/components/typography/typography.css +0 -95
  528. package/dist/esm/dom-f1b08a97.js +0 -76
  529. package/dist/esm/index-bbd484d9.js +0 -1410
  530. package/dist/esm/l10n-d48f35ff.js +0 -165
  531. package/dist/esm/peculiar-button-split_4.entry.js +0 -121
  532. package/dist/esm/peculiar-button.entry.js +0 -36
  533. package/dist/esm/peculiar-link.entry.js +0 -25
  534. package/dist/esm/peculiar-typography.entry.js +0 -34
  535. package/dist/esm/polyfills/css-shim.js +0 -1
  536. package/dist/peculiar/p-01cea5c0.entry.js +0 -11
  537. package/dist/peculiar/p-3bfefa4a.entry.js +0 -18
  538. package/dist/peculiar/p-4e8169cb.entry.js +0 -4
  539. package/dist/peculiar/p-57b89412.entry.js +0 -4
  540. package/dist/peculiar/p-5b4eed12.entry.js +0 -4
  541. package/dist/peculiar/p-610b85e3.entry.js +0 -4
  542. package/dist/peculiar/p-6d37c8b5.entry.js +0 -4
  543. package/dist/peculiar/p-711b4e1e.js +0 -18
  544. package/dist/peculiar/p-81a88a33.js +0 -11
  545. package/dist/peculiar/p-918aeee4.entry.js +0 -4
  546. package/dist/peculiar/p-9f4ee110.js +0 -22
  547. package/dist/peculiar/p-a050e184.js +0 -69
  548. package/dist/peculiar/p-c24c26c2.js +0 -32
  549. package/dist/peculiar/p-df53fbcc.entry.js +0 -4
  550. package/dist/peculiar/p-ec250cc4.js +0 -12
  551. package/dist/peculiar/p-f7683ba5.js +0 -5
  552. package/dist/peculiar/p-fe05f51e.js +0 -79
  553. package/dist/types/components/button-split/button-split.d.ts +0 -21
@@ -0,0 +1,2477 @@
1
+ /*!
2
+ * © Peculiar Ventures https://peculiarventures.com/ - MIT License
3
+ */
4
+ 'use strict';
5
+
6
+ function _interopNamespace(e) {
7
+ if (e && e.__esModule) return e;
8
+ var n = Object.create(null);
9
+ if (e) {
10
+ Object.keys(e).forEach(function (k) {
11
+ if (k !== 'default') {
12
+ var d = Object.getOwnPropertyDescriptor(e, k);
13
+ Object.defineProperty(n, k, d.get ? d : {
14
+ enumerable: true,
15
+ get: function () {
16
+ return e[k];
17
+ }
18
+ });
19
+ }
20
+ });
21
+ }
22
+ n['default'] = e;
23
+ return Object.freeze(n);
24
+ }
25
+
26
+ const NAMESPACE = 'peculiar';
27
+
28
+ /**
29
+ * Virtual DOM patching algorithm based on Snabbdom by
30
+ * Simon Friis Vindum (@paldepind)
31
+ * Licensed under the MIT License
32
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
33
+ *
34
+ * Modified for Stencil's renderer and slot projection
35
+ */
36
+ let scopeId;
37
+ let contentRef;
38
+ let hostTagName;
39
+ let useNativeShadowDom = false;
40
+ let checkSlotFallbackVisibility = false;
41
+ let checkSlotRelocate = false;
42
+ let isSvgMode = false;
43
+ let queuePending = false;
44
+ const createTime = (fnName, tagName = '') => {
45
+ {
46
+ return () => {
47
+ return;
48
+ };
49
+ }
50
+ };
51
+ const uniqueTime = (key, measureText) => {
52
+ {
53
+ return () => {
54
+ return;
55
+ };
56
+ }
57
+ };
58
+ const CONTENT_REF_ID = 'r';
59
+ const ORG_LOCATION_ID = 'o';
60
+ const SLOT_NODE_ID = 's';
61
+ const TEXT_NODE_ID = 't';
62
+ const HYDRATE_ID = 's-id';
63
+ const HYDRATED_STYLE_ID = 'sty-id';
64
+ const HYDRATE_CHILD_ID = 'c-id';
65
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
66
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
67
+ /**
68
+ * Default style mode id
69
+ */
70
+ /**
71
+ * Reusable empty obj/array
72
+ * Don't add values to these!!
73
+ */
74
+ const EMPTY_OBJ = {};
75
+ /**
76
+ * Namespaces
77
+ */
78
+ const SVG_NS = 'http://www.w3.org/2000/svg';
79
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
80
+ const isDef = (v) => v != null;
81
+ /**
82
+ * Check whether a value is a 'complex type', defined here as an object or a
83
+ * function.
84
+ *
85
+ * @param o the value to check
86
+ * @returns whether it's a complex type or not
87
+ */
88
+ const isComplexType = (o) => {
89
+ // https://jsperf.com/typeof-fn-object/5
90
+ o = typeof o;
91
+ return o === 'object' || o === 'function';
92
+ };
93
+ /**
94
+ * Helper method for querying a `meta` tag that contains a nonce value
95
+ * out of a DOM's head.
96
+ *
97
+ * @param doc The DOM containing the `head` to query against
98
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
99
+ * exists or the tag has no content.
100
+ */
101
+ function queryNonceMetaTagContent(doc) {
102
+ var _a, _b, _c;
103
+ 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;
104
+ }
105
+ /**
106
+ * Production h() function based on Preact by
107
+ * Jason Miller (@developit)
108
+ * Licensed under the MIT License
109
+ * https://github.com/developit/preact/blob/master/LICENSE
110
+ *
111
+ * Modified for Stencil's compiler and vdom
112
+ */
113
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
114
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
115
+ const h = (nodeName, vnodeData, ...children) => {
116
+ let child = null;
117
+ let key = null;
118
+ let slotName = null;
119
+ let simple = false;
120
+ let lastSimple = false;
121
+ const vNodeChildren = [];
122
+ const walk = (c) => {
123
+ for (let i = 0; i < c.length; i++) {
124
+ child = c[i];
125
+ if (Array.isArray(child)) {
126
+ walk(child);
127
+ }
128
+ else if (child != null && typeof child !== 'boolean') {
129
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
130
+ child = String(child);
131
+ }
132
+ if (simple && lastSimple) {
133
+ // If the previous child was simple (string), we merge both
134
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
135
+ }
136
+ else {
137
+ // Append a new vNode, if it's text, we create a text vNode
138
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
139
+ }
140
+ lastSimple = simple;
141
+ }
142
+ }
143
+ };
144
+ walk(children);
145
+ if (vnodeData) {
146
+ if (vnodeData.key) {
147
+ key = vnodeData.key;
148
+ }
149
+ if (vnodeData.name) {
150
+ slotName = vnodeData.name;
151
+ }
152
+ // normalize class / className attributes
153
+ {
154
+ const classData = vnodeData.className || vnodeData.class;
155
+ if (classData) {
156
+ vnodeData.class =
157
+ typeof classData !== 'object'
158
+ ? classData
159
+ : Object.keys(classData)
160
+ .filter((k) => classData[k])
161
+ .join(' ');
162
+ }
163
+ }
164
+ }
165
+ if (typeof nodeName === 'function') {
166
+ // nodeName is a functional component
167
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
168
+ }
169
+ const vnode = newVNode(nodeName, null);
170
+ vnode.$attrs$ = vnodeData;
171
+ if (vNodeChildren.length > 0) {
172
+ vnode.$children$ = vNodeChildren;
173
+ }
174
+ {
175
+ vnode.$key$ = key;
176
+ }
177
+ {
178
+ vnode.$name$ = slotName;
179
+ }
180
+ return vnode;
181
+ };
182
+ /**
183
+ * A utility function for creating a virtual DOM node from a tag and some
184
+ * possible text content.
185
+ *
186
+ * @param tag the tag for this element
187
+ * @param text possible text content for the node
188
+ * @returns a newly-minted virtual DOM node
189
+ */
190
+ const newVNode = (tag, text) => {
191
+ const vnode = {
192
+ $flags$: 0,
193
+ $tag$: tag,
194
+ $text$: text,
195
+ $elm$: null,
196
+ $children$: null,
197
+ };
198
+ {
199
+ vnode.$attrs$ = null;
200
+ }
201
+ {
202
+ vnode.$key$ = null;
203
+ }
204
+ {
205
+ vnode.$name$ = null;
206
+ }
207
+ return vnode;
208
+ };
209
+ const Host = {};
210
+ /**
211
+ * Check whether a given node is a Host node or not
212
+ *
213
+ * @param node the virtual DOM node to check
214
+ * @returns whether it's a Host node or not
215
+ */
216
+ const isHost = (node) => node && node.$tag$ === Host;
217
+ /**
218
+ * Implementation of {@link d.FunctionalUtilities} for Stencil's VDom.
219
+ *
220
+ * Note that these functions convert from {@link d.VNode} to
221
+ * {@link d.ChildNode} to give functional component developers a friendly
222
+ * interface.
223
+ */
224
+ const vdomFnUtils = {
225
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
226
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
227
+ };
228
+ /**
229
+ * Convert a {@link d.VNode} to a {@link d.ChildNode} in order to present a
230
+ * friendlier public interface (hence, 'convertToPublic').
231
+ *
232
+ * @param node the virtual DOM node to convert
233
+ * @returns a converted child node
234
+ */
235
+ const convertToPublic = (node) => ({
236
+ vattrs: node.$attrs$,
237
+ vchildren: node.$children$,
238
+ vkey: node.$key$,
239
+ vname: node.$name$,
240
+ vtag: node.$tag$,
241
+ vtext: node.$text$,
242
+ });
243
+ /**
244
+ * Convert a {@link d.ChildNode} back to an equivalent {@link d.VNode} in
245
+ * order to use the resulting object in the virtual DOM. The initial object was
246
+ * likely created as part of presenting a public API, so converting it back
247
+ * involved making it 'private' again (hence, `convertToPrivate`).
248
+ *
249
+ * @param node the child node to convert
250
+ * @returns a converted virtual DOM node
251
+ */
252
+ const convertToPrivate = (node) => {
253
+ if (typeof node.vtag === 'function') {
254
+ const vnodeData = Object.assign({}, node.vattrs);
255
+ if (node.vkey) {
256
+ vnodeData.key = node.vkey;
257
+ }
258
+ if (node.vname) {
259
+ vnodeData.name = node.vname;
260
+ }
261
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
262
+ }
263
+ const vnode = newVNode(node.vtag, node.vtext);
264
+ vnode.$attrs$ = node.vattrs;
265
+ vnode.$children$ = node.vchildren;
266
+ vnode.$key$ = node.vkey;
267
+ vnode.$name$ = node.vname;
268
+ return vnode;
269
+ };
270
+ const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
271
+ const endHydrate = createTime('hydrateClient', tagName);
272
+ const shadowRoot = hostElm.shadowRoot;
273
+ const childRenderNodes = [];
274
+ const slotNodes = [];
275
+ const shadowRootNodes = shadowRoot ? [] : null;
276
+ const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
277
+ if (!plt.$orgLocNodes$) {
278
+ initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
279
+ }
280
+ hostElm[HYDRATE_ID] = hostId;
281
+ hostElm.removeAttribute(HYDRATE_ID);
282
+ clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
283
+ childRenderNodes.map((c) => {
284
+ const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
285
+ const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
286
+ const node = c.$elm$;
287
+ if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
288
+ orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
289
+ }
290
+ if (!shadowRoot) {
291
+ node['s-hn'] = tagName;
292
+ if (orgLocationNode) {
293
+ node['s-ol'] = orgLocationNode;
294
+ node['s-ol']['s-nr'] = node;
295
+ }
296
+ }
297
+ plt.$orgLocNodes$.delete(orgLocationId);
298
+ });
299
+ if (shadowRoot) {
300
+ shadowRootNodes.map((shadowRootNode) => {
301
+ if (shadowRootNode) {
302
+ shadowRoot.appendChild(shadowRootNode);
303
+ }
304
+ });
305
+ }
306
+ endHydrate();
307
+ };
308
+ const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
309
+ let childNodeType;
310
+ let childIdSplt;
311
+ let childVNode;
312
+ let i;
313
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
314
+ childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
315
+ if (childNodeType) {
316
+ // got the node data from the element's attribute
317
+ // `${hostId}.${nodeId}.${depth}.${index}`
318
+ childIdSplt = childNodeType.split('.');
319
+ if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
320
+ childVNode = {
321
+ $flags$: 0,
322
+ $hostId$: childIdSplt[0],
323
+ $nodeId$: childIdSplt[1],
324
+ $depth$: childIdSplt[2],
325
+ $index$: childIdSplt[3],
326
+ $tag$: node.tagName.toLowerCase(),
327
+ $elm$: node,
328
+ $attrs$: null,
329
+ $children$: null,
330
+ $key$: null,
331
+ $name$: null,
332
+ $text$: null,
333
+ };
334
+ childRenderNodes.push(childVNode);
335
+ node.removeAttribute(HYDRATE_CHILD_ID);
336
+ // this is a new child vnode
337
+ // so ensure its parent vnode has the vchildren array
338
+ if (!parentVNode.$children$) {
339
+ parentVNode.$children$ = [];
340
+ }
341
+ // add our child vnode to a specific index of the vnode's children
342
+ parentVNode.$children$[childVNode.$index$] = childVNode;
343
+ // this is now the new parent vnode for all the next child checks
344
+ parentVNode = childVNode;
345
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
346
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
347
+ }
348
+ }
349
+ }
350
+ // recursively drill down, end to start so we can remove nodes
351
+ for (i = node.childNodes.length - 1; i >= 0; i--) {
352
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
353
+ }
354
+ if (node.shadowRoot) {
355
+ // keep drilling down through the shadow root nodes
356
+ for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
357
+ clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
358
+ }
359
+ }
360
+ }
361
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
362
+ // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
363
+ childIdSplt = node.nodeValue.split('.');
364
+ if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
365
+ // comment node for either the host id or a 0 host id
366
+ childNodeType = childIdSplt[0];
367
+ childVNode = {
368
+ $flags$: 0,
369
+ $hostId$: childIdSplt[1],
370
+ $nodeId$: childIdSplt[2],
371
+ $depth$: childIdSplt[3],
372
+ $index$: childIdSplt[4],
373
+ $elm$: node,
374
+ $attrs$: null,
375
+ $children$: null,
376
+ $key$: null,
377
+ $name$: null,
378
+ $tag$: null,
379
+ $text$: null,
380
+ };
381
+ if (childNodeType === TEXT_NODE_ID) {
382
+ childVNode.$elm$ = node.nextSibling;
383
+ if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* NODE_TYPE.TextNode */) {
384
+ childVNode.$text$ = childVNode.$elm$.textContent;
385
+ childRenderNodes.push(childVNode);
386
+ // remove the text comment since it's no longer needed
387
+ node.remove();
388
+ if (!parentVNode.$children$) {
389
+ parentVNode.$children$ = [];
390
+ }
391
+ parentVNode.$children$[childVNode.$index$] = childVNode;
392
+ if (shadowRootNodes && childVNode.$depth$ === '0') {
393
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
394
+ }
395
+ }
396
+ }
397
+ else if (childVNode.$hostId$ === hostId) {
398
+ // this comment node is specifically for this host id
399
+ if (childNodeType === SLOT_NODE_ID) {
400
+ // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
401
+ childVNode.$tag$ = 'slot';
402
+ if (childIdSplt[5]) {
403
+ node['s-sn'] = childVNode.$name$ = childIdSplt[5];
404
+ }
405
+ else {
406
+ node['s-sn'] = '';
407
+ }
408
+ node['s-sr'] = true;
409
+ if (shadowRootNodes) {
410
+ // browser support shadowRoot and this is a shadow dom component
411
+ // create an actual slot element
412
+ childVNode.$elm$ = doc.createElement(childVNode.$tag$);
413
+ if (childVNode.$name$) {
414
+ // add the slot name attribute
415
+ childVNode.$elm$.setAttribute('name', childVNode.$name$);
416
+ }
417
+ // insert the new slot element before the slot comment
418
+ node.parentNode.insertBefore(childVNode.$elm$, node);
419
+ // remove the slot comment since it's not needed for shadow
420
+ node.remove();
421
+ if (childVNode.$depth$ === '0') {
422
+ shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
423
+ }
424
+ }
425
+ slotNodes.push(childVNode);
426
+ if (!parentVNode.$children$) {
427
+ parentVNode.$children$ = [];
428
+ }
429
+ parentVNode.$children$[childVNode.$index$] = childVNode;
430
+ }
431
+ else if (childNodeType === CONTENT_REF_ID) {
432
+ // `${CONTENT_REF_ID}.${hostId}`;
433
+ if (shadowRootNodes) {
434
+ // remove the content ref comment since it's not needed for shadow
435
+ node.remove();
436
+ }
437
+ else {
438
+ hostElm['s-cr'] = node;
439
+ node['s-cn'] = true;
440
+ }
441
+ }
442
+ }
443
+ }
444
+ }
445
+ else if (parentVNode && parentVNode.$tag$ === 'style') {
446
+ const vnode = newVNode(null, node.textContent);
447
+ vnode.$elm$ = node;
448
+ vnode.$index$ = '0';
449
+ parentVNode.$children$ = [vnode];
450
+ }
451
+ };
452
+ const initializeDocumentHydrate = (node, orgLocNodes) => {
453
+ if (node.nodeType === 1 /* NODE_TYPE.ElementNode */) {
454
+ let i = 0;
455
+ for (; i < node.childNodes.length; i++) {
456
+ initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
457
+ }
458
+ if (node.shadowRoot) {
459
+ for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
460
+ initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
461
+ }
462
+ }
463
+ }
464
+ else if (node.nodeType === 8 /* NODE_TYPE.CommentNode */) {
465
+ const childIdSplt = node.nodeValue.split('.');
466
+ if (childIdSplt[0] === ORG_LOCATION_ID) {
467
+ orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
468
+ node.nodeValue = '';
469
+ // useful to know if the original location is
470
+ // the root light-dom of a shadow dom component
471
+ node['s-en'] = childIdSplt[3];
472
+ }
473
+ }
474
+ };
475
+ /**
476
+ * Parse a new property value for a given property type.
477
+ *
478
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
479
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
480
+ * 1. `any`, the type given to `propValue` in the function signature
481
+ * 2. the type stored from `propType`.
482
+ *
483
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
484
+ *
485
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
486
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
487
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
488
+ * ```tsx
489
+ * <my-cmp prop-val={0}></my-cmp>
490
+ * ```
491
+ *
492
+ * HTML prop values on the other hand, will always a string
493
+ *
494
+ * @param propValue the new value to coerce to some type
495
+ * @param propType the type of the prop, expressed as a binary number
496
+ * @returns the parsed/coerced value
497
+ */
498
+ const parsePropertyValue = (propValue, propType) => {
499
+ // ensure this value is of the correct prop type
500
+ if (propValue != null && !isComplexType(propValue)) {
501
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
502
+ // per the HTML spec, any string value means it is a boolean true value
503
+ // but we'll cheat here and say that the string "false" is the boolean false
504
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
505
+ }
506
+ if (propType & 2 /* MEMBER_FLAGS.Number */) {
507
+ // force it to be a number
508
+ return parseFloat(propValue);
509
+ }
510
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
511
+ // could have been passed as a number or boolean
512
+ // but we still want it as a string
513
+ return String(propValue);
514
+ }
515
+ // redundant return here for better minification
516
+ return propValue;
517
+ }
518
+ // not sure exactly what type we want
519
+ // so no need to change to a different type
520
+ return propValue;
521
+ };
522
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
523
+ const createEvent = (ref, name, flags) => {
524
+ const elm = getElement(ref);
525
+ return {
526
+ emit: (detail) => {
527
+ return emitEvent(elm, name, {
528
+ bubbles: !!(flags & 4 /* EVENT_FLAGS.Bubbles */),
529
+ composed: !!(flags & 2 /* EVENT_FLAGS.Composed */),
530
+ cancelable: !!(flags & 1 /* EVENT_FLAGS.Cancellable */),
531
+ detail,
532
+ });
533
+ },
534
+ };
535
+ };
536
+ /**
537
+ * Helper function to create & dispatch a custom Event on a provided target
538
+ * @param elm the target of the Event
539
+ * @param name the name to give the custom Event
540
+ * @param opts options for configuring a custom Event
541
+ * @returns the custom Event
542
+ */
543
+ const emitEvent = (elm, name, opts) => {
544
+ const ev = plt.ce(name, opts);
545
+ elm.dispatchEvent(ev);
546
+ return ev;
547
+ };
548
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
549
+ const registerStyle = (scopeId, cssText, allowCS) => {
550
+ let style = styles.get(scopeId);
551
+ if (supportsConstructableStylesheets && allowCS) {
552
+ style = (style || new CSSStyleSheet());
553
+ if (typeof style === 'string') {
554
+ style = cssText;
555
+ }
556
+ else {
557
+ style.replaceSync(cssText);
558
+ }
559
+ }
560
+ else {
561
+ style = cssText;
562
+ }
563
+ styles.set(scopeId, style);
564
+ };
565
+ const addStyle = (styleContainerNode, cmpMeta, mode) => {
566
+ var _a;
567
+ const scopeId = getScopeId(cmpMeta);
568
+ const style = styles.get(scopeId);
569
+ // if an element is NOT connected then getRootNode() will return the wrong root node
570
+ // so the fallback is to always use the document for the root node in those cases
571
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
572
+ if (style) {
573
+ if (typeof style === 'string') {
574
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
575
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
576
+ let styleElm;
577
+ if (!appliedStyles) {
578
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
579
+ }
580
+ if (!appliedStyles.has(scopeId)) {
581
+ if (styleContainerNode.host &&
582
+ (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
583
+ // This is only happening on native shadow-dom, do not needs CSS var shim
584
+ styleElm.innerHTML = style;
585
+ }
586
+ else {
587
+ styleElm = doc.createElement('style');
588
+ styleElm.innerHTML = style;
589
+ // Apply CSP nonce to the style tag if it exists
590
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
591
+ if (nonce != null) {
592
+ styleElm.setAttribute('nonce', nonce);
593
+ }
594
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
595
+ }
596
+ if (appliedStyles) {
597
+ appliedStyles.add(scopeId);
598
+ }
599
+ }
600
+ }
601
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
602
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
603
+ }
604
+ }
605
+ return scopeId;
606
+ };
607
+ const attachStyles = (hostRef) => {
608
+ const cmpMeta = hostRef.$cmpMeta$;
609
+ const elm = hostRef.$hostElement$;
610
+ const flags = cmpMeta.$flags$;
611
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
612
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
613
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
614
+ // only required when we're NOT using native shadow dom (slot)
615
+ // or this browser doesn't support native shadow dom
616
+ // and this host element was NOT created with SSR
617
+ // let's pick out the inner content for slot projection
618
+ // create a node to represent where the original
619
+ // content was first placed, which is useful later on
620
+ // DOM WRITE!!
621
+ elm['s-sc'] = scopeId;
622
+ elm.classList.add(scopeId + '-h');
623
+ if (flags & 2 /* CMP_FLAGS.scopedCssEncapsulation */) {
624
+ elm.classList.add(scopeId + '-s');
625
+ }
626
+ }
627
+ endAttachStyles();
628
+ };
629
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
630
+ const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
631
+ /**
632
+ * Production setAccessor() function based on Preact by
633
+ * Jason Miller (@developit)
634
+ * Licensed under the MIT License
635
+ * https://github.com/developit/preact/blob/master/LICENSE
636
+ *
637
+ * Modified for Stencil's compiler and vdom
638
+ */
639
+ /**
640
+ * When running a VDom render set properties present on a VDom node onto the
641
+ * corresponding HTML element.
642
+ *
643
+ * Note that this function has special functionality for the `class`,
644
+ * `style`, `key`, and `ref` attributes, as well as event handlers (like
645
+ * `onClick`, etc). All others are just passed through as-is.
646
+ *
647
+ * @param elm the HTMLElement onto which attributes should be set
648
+ * @param memberName the name of the attribute to set
649
+ * @param oldValue the old value for the attribute
650
+ * @param newValue the new value for the attribute
651
+ * @param isSvg whether we're in an svg context or not
652
+ * @param flags bitflags for Vdom variables
653
+ */
654
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
655
+ if (oldValue !== newValue) {
656
+ let isProp = isMemberInElement(elm, memberName);
657
+ let ln = memberName.toLowerCase();
658
+ if (memberName === 'class') {
659
+ const classList = elm.classList;
660
+ const oldClasses = parseClassList(oldValue);
661
+ const newClasses = parseClassList(newValue);
662
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
663
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
664
+ }
665
+ else if (memberName === 'style') {
666
+ // update style attribute, css properties and values
667
+ {
668
+ for (const prop in oldValue) {
669
+ if (!newValue || newValue[prop] == null) {
670
+ if (prop.includes('-')) {
671
+ elm.style.removeProperty(prop);
672
+ }
673
+ else {
674
+ elm.style[prop] = '';
675
+ }
676
+ }
677
+ }
678
+ }
679
+ for (const prop in newValue) {
680
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
681
+ if (prop.includes('-')) {
682
+ elm.style.setProperty(prop, newValue[prop]);
683
+ }
684
+ else {
685
+ elm.style[prop] = newValue[prop];
686
+ }
687
+ }
688
+ }
689
+ }
690
+ else if (memberName === 'key')
691
+ ;
692
+ else if (memberName === 'ref') {
693
+ // minifier will clean this up
694
+ if (newValue) {
695
+ newValue(elm);
696
+ }
697
+ }
698
+ else if ((!isProp ) &&
699
+ memberName[0] === 'o' &&
700
+ memberName[1] === 'n') {
701
+ // Event Handlers
702
+ // so if the member name starts with "on" and the 3rd characters is
703
+ // a capital letter, and it's not already a member on the element,
704
+ // then we're assuming it's an event listener
705
+ if (memberName[2] === '-') {
706
+ // on- prefixed events
707
+ // allows to be explicit about the dom event to listen without any magic
708
+ // under the hood:
709
+ // <my-cmp on-click> // listens for "click"
710
+ // <my-cmp on-Click> // listens for "Click"
711
+ // <my-cmp on-ionChange> // listens for "ionChange"
712
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
713
+ memberName = memberName.slice(3);
714
+ }
715
+ else if (isMemberInElement(win, ln)) {
716
+ // standard event
717
+ // the JSX attribute could have been "onMouseOver" and the
718
+ // member name "onmouseover" is on the window's prototype
719
+ // so let's add the listener "mouseover", which is all lowercased
720
+ memberName = ln.slice(2);
721
+ }
722
+ else {
723
+ // custom event
724
+ // the JSX attribute could have been "onMyCustomEvent"
725
+ // so let's trim off the "on" prefix and lowercase the first character
726
+ // and add the listener "myCustomEvent"
727
+ // except for the first character, we keep the event name case
728
+ memberName = ln[2] + memberName.slice(3);
729
+ }
730
+ if (oldValue) {
731
+ plt.rel(elm, memberName, oldValue, false);
732
+ }
733
+ if (newValue) {
734
+ plt.ael(elm, memberName, newValue, false);
735
+ }
736
+ }
737
+ else {
738
+ // Set property if it exists and it's not a SVG
739
+ const isComplex = isComplexType(newValue);
740
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
741
+ try {
742
+ if (!elm.tagName.includes('-')) {
743
+ const n = newValue == null ? '' : newValue;
744
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
745
+ if (memberName === 'list') {
746
+ isProp = false;
747
+ }
748
+ else if (oldValue == null || elm[memberName] != n) {
749
+ elm[memberName] = n;
750
+ }
751
+ }
752
+ else {
753
+ elm[memberName] = newValue;
754
+ }
755
+ }
756
+ catch (e) { }
757
+ }
758
+ /**
759
+ * Need to manually update attribute if:
760
+ * - memberName is not an attribute
761
+ * - if we are rendering the host element in order to reflect attribute
762
+ * - if it's a SVG, since properties might not work in <svg>
763
+ * - if the newValue is null/undefined or 'false'.
764
+ */
765
+ let xlink = false;
766
+ {
767
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
768
+ memberName = ln;
769
+ xlink = true;
770
+ }
771
+ }
772
+ if (newValue == null || newValue === false) {
773
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
774
+ if (xlink) {
775
+ elm.removeAttributeNS(XLINK_NS, memberName);
776
+ }
777
+ else {
778
+ elm.removeAttribute(memberName);
779
+ }
780
+ }
781
+ }
782
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
783
+ newValue = newValue === true ? '' : newValue;
784
+ if (xlink) {
785
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
786
+ }
787
+ else {
788
+ elm.setAttribute(memberName, newValue);
789
+ }
790
+ }
791
+ }
792
+ }
793
+ };
794
+ const parseClassListRegex = /\s/;
795
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
796
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
797
+ // if the element passed in is a shadow root, which is a document fragment
798
+ // then we want to be adding attrs/props to the shadow root's "host" element
799
+ // if it's not a shadow root, then we add attrs/props to the same element
800
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
801
+ ? newVnode.$elm$.host
802
+ : newVnode.$elm$;
803
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
804
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
805
+ {
806
+ // remove attributes no longer present on the vnode by setting them to undefined
807
+ for (memberName in oldVnodeAttrs) {
808
+ if (!(memberName in newVnodeAttrs)) {
809
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
810
+ }
811
+ }
812
+ }
813
+ // add new & update changed attributes
814
+ for (memberName in newVnodeAttrs) {
815
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
816
+ }
817
+ };
818
+ /**
819
+ * Create a DOM Node corresponding to one of the children of a given VNode.
820
+ *
821
+ * @param oldParentVNode the parent VNode from the previous render
822
+ * @param newParentVNode the parent VNode from the current render
823
+ * @param childIndex the index of the VNode, in the _new_ parent node's
824
+ * children, for which we will create a new DOM node
825
+ * @param parentElm the parent DOM node which our new node will be a child of
826
+ * @returns the newly created node
827
+ */
828
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
829
+ // tslint:disable-next-line: prefer-const
830
+ const newVNode = newParentVNode.$children$[childIndex];
831
+ let i = 0;
832
+ let elm;
833
+ let childNode;
834
+ let oldVNode;
835
+ if (!useNativeShadowDom) {
836
+ // remember for later we need to check to relocate nodes
837
+ checkSlotRelocate = true;
838
+ if (newVNode.$tag$ === 'slot') {
839
+ if (scopeId) {
840
+ // scoped css needs to add its scoped id to the parent element
841
+ parentElm.classList.add(scopeId + '-s');
842
+ }
843
+ newVNode.$flags$ |= newVNode.$children$
844
+ ? // slot element has fallback content
845
+ 2 /* VNODE_FLAGS.isSlotFallback */
846
+ : // slot element does not have fallback content
847
+ 1 /* VNODE_FLAGS.isSlotReference */;
848
+ }
849
+ }
850
+ if (newVNode.$text$ !== null) {
851
+ // create text node
852
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
853
+ }
854
+ else if (newVNode.$flags$ & 1 /* VNODE_FLAGS.isSlotReference */) {
855
+ // create a slot reference node
856
+ elm = newVNode.$elm$ =
857
+ doc.createTextNode('');
858
+ }
859
+ else {
860
+ if (!isSvgMode) {
861
+ isSvgMode = newVNode.$tag$ === 'svg';
862
+ }
863
+ // create element
864
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$flags$ & 2 /* VNODE_FLAGS.isSlotFallback */
865
+ ? 'slot-fb'
866
+ : newVNode.$tag$)
867
+ );
868
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
869
+ isSvgMode = false;
870
+ }
871
+ // add css classes, attrs, props, listeners, etc.
872
+ {
873
+ updateElement(null, newVNode, isSvgMode);
874
+ }
875
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
876
+ // if there is a scopeId and this is the initial render
877
+ // then let's add the scopeId as a css class
878
+ elm.classList.add((elm['s-si'] = scopeId));
879
+ }
880
+ if (newVNode.$children$) {
881
+ for (i = 0; i < newVNode.$children$.length; ++i) {
882
+ // create the node
883
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
884
+ // return node could have been null
885
+ if (childNode) {
886
+ // append our new node
887
+ elm.appendChild(childNode);
888
+ }
889
+ }
890
+ }
891
+ {
892
+ if (newVNode.$tag$ === 'svg') {
893
+ // Only reset the SVG context when we're exiting <svg> element
894
+ isSvgMode = false;
895
+ }
896
+ else if (elm.tagName === 'foreignObject') {
897
+ // Reenter SVG context when we're exiting <foreignObject> element
898
+ isSvgMode = true;
899
+ }
900
+ }
901
+ }
902
+ {
903
+ elm['s-hn'] = hostTagName;
904
+ if (newVNode.$flags$ & (2 /* VNODE_FLAGS.isSlotFallback */ | 1 /* VNODE_FLAGS.isSlotReference */)) {
905
+ // remember the content reference comment
906
+ elm['s-sr'] = true;
907
+ // remember the content reference comment
908
+ elm['s-cr'] = contentRef;
909
+ // remember the slot name, or empty string for default slot
910
+ elm['s-sn'] = newVNode.$name$ || '';
911
+ // check if we've got an old vnode for this slot
912
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
913
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
914
+ // we've got an old slot vnode and the wrapper is being replaced
915
+ // so let's move the old slot content back to it's original location
916
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
917
+ }
918
+ }
919
+ }
920
+ return elm;
921
+ };
922
+ const putBackInOriginalLocation = (parentElm, recursive) => {
923
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
924
+ const oldSlotChildNodes = parentElm.childNodes;
925
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
926
+ const childNode = oldSlotChildNodes[i];
927
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
928
+ // // this child node in the old element is from another component
929
+ // // remove this node from the old slot's parent
930
+ // childNode.remove();
931
+ // and relocate it back to it's original location
932
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
933
+ // remove the old original location comment entirely
934
+ // later on the patch function will know what to do
935
+ // and move this to the correct spot in need be
936
+ childNode['s-ol'].remove();
937
+ childNode['s-ol'] = undefined;
938
+ checkSlotRelocate = true;
939
+ }
940
+ if (recursive) {
941
+ putBackInOriginalLocation(childNode, recursive);
942
+ }
943
+ }
944
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
945
+ };
946
+ /**
947
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
948
+ * add them to the DOM in the appropriate place.
949
+ *
950
+ * @param parentElm the DOM node which should be used as a parent for the new
951
+ * DOM nodes
952
+ * @param before a child of the `parentElm` which the new children should be
953
+ * inserted before (optional)
954
+ * @param parentVNode the parent virtual DOM node
955
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
956
+ * @param startIdx the index in the child virtual DOM nodes at which to start
957
+ * creating DOM nodes (inclusive)
958
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
959
+ * creating DOM nodes (inclusive)
960
+ */
961
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
962
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
963
+ let childNode;
964
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
965
+ containerElm = containerElm.shadowRoot;
966
+ }
967
+ for (; startIdx <= endIdx; ++startIdx) {
968
+ if (vnodes[startIdx]) {
969
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
970
+ if (childNode) {
971
+ vnodes[startIdx].$elm$ = childNode;
972
+ containerElm.insertBefore(childNode, referenceNode(before) );
973
+ }
974
+ }
975
+ }
976
+ };
977
+ /**
978
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
979
+ * This can be used to, for instance, clean up after a list of children which
980
+ * should no longer be shown.
981
+ *
982
+ * This function also handles some of Stencil's slot relocation logic.
983
+ *
984
+ * @param vnodes a list of virtual DOM nodes to remove
985
+ * @param startIdx the index at which to start removing nodes (inclusive)
986
+ * @param endIdx the index at which to stop removing nodes (inclusive)
987
+ */
988
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
989
+ for (let index = startIdx; index <= endIdx; ++index) {
990
+ const vnode = vnodes[index];
991
+ if (vnode) {
992
+ const elm = vnode.$elm$;
993
+ nullifyVNodeRefs(vnode);
994
+ if (elm) {
995
+ {
996
+ // we're removing this element
997
+ // so it's possible we need to show slot fallback content now
998
+ checkSlotFallbackVisibility = true;
999
+ if (elm['s-ol']) {
1000
+ // remove the original location comment
1001
+ elm['s-ol'].remove();
1002
+ }
1003
+ else {
1004
+ // it's possible that child nodes of the node
1005
+ // that's being removed are slot nodes
1006
+ putBackInOriginalLocation(elm, true);
1007
+ }
1008
+ }
1009
+ // remove the vnode's element from the dom
1010
+ elm.remove();
1011
+ }
1012
+ }
1013
+ }
1014
+ };
1015
+ /**
1016
+ * Reconcile the children of a new VNode with the children of an old VNode by
1017
+ * traversing the two collections of children, identifying nodes that are
1018
+ * conserved or changed, calling out to `patch` to make any necessary
1019
+ * updates to the DOM, and rearranging DOM nodes as needed.
1020
+ *
1021
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
1022
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
1023
+ * 'windows' by storing start and end indices and references to the
1024
+ * corresponding array entries. Initially the two 'windows' are basically equal
1025
+ * to the entire array, but we progressively narrow the windows until there are
1026
+ * no children left to update by doing the following:
1027
+ *
1028
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
1029
+ * that if we have an initial array like the following we'll end up dealing
1030
+ * only with a window bounded by the highlighted elements:
1031
+ *
1032
+ * [null, null, VNode1 , ... , VNode2, null, null]
1033
+ * ^^^^^^ ^^^^^^
1034
+ *
1035
+ * 2. Check to see if the elements at the head and tail positions are equal
1036
+ * across the windows. This will basically detect elements which haven't
1037
+ * been added, removed, or changed position, i.e. if you had the following
1038
+ * VNode elements (represented as HTML):
1039
+ *
1040
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
1041
+ * newVNode: `<div><p><span>THERE</span></p></div>`
1042
+ *
1043
+ * Then when comparing the children of the `<div>` tag we check the equality
1044
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
1045
+ * same tag in the same position, we'd be able to avoid completely
1046
+ * re-rendering the subtree under them with a new DOM element and would just
1047
+ * call out to `patch` to handle reconciling their children and so on.
1048
+ *
1049
+ * 3. Check, for both windows, to see if the element at the beginning of the
1050
+ * window corresponds to the element at the end of the other window. This is
1051
+ * a heuristic which will let us identify _some_ situations in which
1052
+ * elements have changed position, for instance it _should_ detect that the
1053
+ * children nodes themselves have not changed but merely moved in the
1054
+ * following example:
1055
+ *
1056
+ * oldVNode: `<div><element-one /><element-two /></div>`
1057
+ * newVNode: `<div><element-two /><element-one /></div>`
1058
+ *
1059
+ * If we find cases like this then we also need to move the concrete DOM
1060
+ * elements corresponding to the moved children to write the re-order to the
1061
+ * DOM.
1062
+ *
1063
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
1064
+ * nodes in the old children which have the same key as the first element in
1065
+ * our window on the new children. If we find such a node we handle calling
1066
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
1067
+ * what we find.
1068
+ *
1069
+ * Finally, once we've narrowed our 'windows' to the point that either of them
1070
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
1071
+ * insertion or deletion that needs to happen to get a DOM state that correctly
1072
+ * reflects the new child VNodes. If, for instance, after our window on the old
1073
+ * children has collapsed we still have more nodes on the new children that
1074
+ * we haven't dealt with yet then we need to add them, or if the new children
1075
+ * collapse but we still have unhandled _old_ children then we need to make
1076
+ * sure the corresponding DOM nodes are removed.
1077
+ *
1078
+ * @param parentElm the node into which the parent VNode is rendered
1079
+ * @param oldCh the old children of the parent node
1080
+ * @param newVNode the new VNode which will replace the parent
1081
+ * @param newCh the new children of the parent node
1082
+ */
1083
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
1084
+ let oldStartIdx = 0;
1085
+ let newStartIdx = 0;
1086
+ let idxInOld = 0;
1087
+ let i = 0;
1088
+ let oldEndIdx = oldCh.length - 1;
1089
+ let oldStartVnode = oldCh[0];
1090
+ let oldEndVnode = oldCh[oldEndIdx];
1091
+ let newEndIdx = newCh.length - 1;
1092
+ let newStartVnode = newCh[0];
1093
+ let newEndVnode = newCh[newEndIdx];
1094
+ let node;
1095
+ let elmToMove;
1096
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
1097
+ if (oldStartVnode == null) {
1098
+ // VNode might have been moved left
1099
+ oldStartVnode = oldCh[++oldStartIdx];
1100
+ }
1101
+ else if (oldEndVnode == null) {
1102
+ oldEndVnode = oldCh[--oldEndIdx];
1103
+ }
1104
+ else if (newStartVnode == null) {
1105
+ newStartVnode = newCh[++newStartIdx];
1106
+ }
1107
+ else if (newEndVnode == null) {
1108
+ newEndVnode = newCh[--newEndIdx];
1109
+ }
1110
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
1111
+ // if the start nodes are the same then we should patch the new VNode
1112
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
1113
+ // indices to reflect that. We don't need to move any DOM Nodes around
1114
+ // since things are matched up in order.
1115
+ patch(oldStartVnode, newStartVnode);
1116
+ oldStartVnode = oldCh[++oldStartIdx];
1117
+ newStartVnode = newCh[++newStartIdx];
1118
+ }
1119
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
1120
+ // likewise, if the end nodes are the same we patch new onto old and
1121
+ // decrement our end indices, and also likewise in this case we don't
1122
+ // need to move any DOM Nodes.
1123
+ patch(oldEndVnode, newEndVnode);
1124
+ oldEndVnode = oldCh[--oldEndIdx];
1125
+ newEndVnode = newCh[--newEndIdx];
1126
+ }
1127
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
1128
+ // case: "Vnode moved right"
1129
+ //
1130
+ // We've found that the last node in our window on the new children is
1131
+ // the same VNode as the _first_ node in our window on the old children
1132
+ // we're dealing with now. Visually, this is the layout of these two
1133
+ // nodes:
1134
+ //
1135
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1136
+ // ^^^^^^^^^^^
1137
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1138
+ // ^^^^^^^^^^^^^
1139
+ //
1140
+ // In this situation we need to patch `newEndVnode` onto `oldStartVnode`
1141
+ // and move the DOM element for `oldStartVnode`.
1142
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1143
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
1144
+ }
1145
+ patch(oldStartVnode, newEndVnode);
1146
+ // We need to move the element for `oldStartVnode` into a position which
1147
+ // will be appropriate for `newEndVnode`. For this we can use
1148
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
1149
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
1150
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
1151
+ //
1152
+ // <old-start-node />
1153
+ // <some-intervening-node />
1154
+ // <old-end-node />
1155
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
1156
+ // <next-sibling />
1157
+ //
1158
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
1159
+ // the node for `oldStartVnode` at the end of the children of
1160
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
1161
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
1162
+ // append it to the children of the parent element.
1163
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1164
+ oldStartVnode = oldCh[++oldStartIdx];
1165
+ newEndVnode = newCh[--newEndIdx];
1166
+ }
1167
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
1168
+ // case: "Vnode moved left"
1169
+ //
1170
+ // We've found that the first node in our window on the new children is
1171
+ // the same VNode as the _last_ node in our window on the old children.
1172
+ // Visually, this is the layout of these two nodes:
1173
+ //
1174
+ // newCh: [..., newStartVnode , ... , newEndVnode , ...]
1175
+ // ^^^^^^^^^^^^^
1176
+ // oldCh: [..., oldStartVnode , ... , oldEndVnode , ...]
1177
+ // ^^^^^^^^^^^
1178
+ //
1179
+ // In this situation we need to patch `newStartVnode` onto `oldEndVnode`
1180
+ // (which will handle updating any changed attributes, reconciling their
1181
+ // children etc) but we also need to move the DOM node to which
1182
+ // `oldEndVnode` corresponds.
1183
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
1184
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
1185
+ }
1186
+ patch(oldEndVnode, newStartVnode);
1187
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
1188
+ // the same node, so since we're here we know that they are not. Thus we
1189
+ // can move the element for `oldEndVnode` _before_ the element for
1190
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
1191
+ // future.
1192
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
1193
+ oldEndVnode = oldCh[--oldEndIdx];
1194
+ newStartVnode = newCh[++newStartIdx];
1195
+ }
1196
+ else {
1197
+ // Here we do some checks to match up old and new nodes based on the
1198
+ // `$key$` attribute, which is set by putting a `key="my-key"` attribute
1199
+ // in the JSX for a DOM element in the implementation of a Stencil
1200
+ // component.
1201
+ //
1202
+ // First we check to see if there are any nodes in the array of old
1203
+ // children which have the same key as the first node in the new
1204
+ // children.
1205
+ idxInOld = -1;
1206
+ {
1207
+ for (i = oldStartIdx; i <= oldEndIdx; ++i) {
1208
+ if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
1209
+ idxInOld = i;
1210
+ break;
1211
+ }
1212
+ }
1213
+ }
1214
+ if (idxInOld >= 0) {
1215
+ // We found a node in the old children which matches up with the first
1216
+ // node in the new children! So let's deal with that
1217
+ elmToMove = oldCh[idxInOld];
1218
+ if (elmToMove.$tag$ !== newStartVnode.$tag$) {
1219
+ // the tag doesn't match so we'll need a new DOM element
1220
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
1221
+ }
1222
+ else {
1223
+ patch(elmToMove, newStartVnode);
1224
+ // invalidate the matching old node so that we won't try to update it
1225
+ // again later on
1226
+ oldCh[idxInOld] = undefined;
1227
+ node = elmToMove.$elm$;
1228
+ }
1229
+ newStartVnode = newCh[++newStartIdx];
1230
+ }
1231
+ else {
1232
+ // We either didn't find an element in the old children that matches
1233
+ // the key of the first new child OR the build is not using `key`
1234
+ // attributes at all. In either case we need to create a new element
1235
+ // for the new node.
1236
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
1237
+ newStartVnode = newCh[++newStartIdx];
1238
+ }
1239
+ if (node) {
1240
+ // if we created a new node then handle inserting it to the DOM
1241
+ {
1242
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
1243
+ }
1244
+ }
1245
+ }
1246
+ }
1247
+ if (oldStartIdx > oldEndIdx) {
1248
+ // we have some more new nodes to add which don't match up with old nodes
1249
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
1250
+ }
1251
+ else if (newStartIdx > newEndIdx) {
1252
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
1253
+ // in the new array, so lets remove them (which entails cleaning up the
1254
+ // relevant DOM nodes)
1255
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
1256
+ }
1257
+ };
1258
+ /**
1259
+ * Compare two VNodes to determine if they are the same
1260
+ *
1261
+ * **NB**: This function is an equality _heuristic_ based on the available
1262
+ * information set on the two VNodes and can be misleading under certain
1263
+ * circumstances. In particular, if the two nodes do not have `key` attrs
1264
+ * (available under `$key$` on VNodes) then the function falls back on merely
1265
+ * checking that they have the same tag.
1266
+ *
1267
+ * So, in other words, if `key` attrs are not set on VNodes which may be
1268
+ * changing order within a `children` array or something along those lines then
1269
+ * we could obtain a false negative and then have to do needless re-rendering
1270
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
1271
+ *
1272
+ * @param leftVNode the first VNode to check
1273
+ * @param rightVNode the second VNode to check
1274
+ * @returns whether they're equal or not
1275
+ */
1276
+ const isSameVnode = (leftVNode, rightVNode) => {
1277
+ // compare if two vnode to see if they're "technically" the same
1278
+ // need to have the same element tag, and same key to be the same
1279
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
1280
+ if (leftVNode.$tag$ === 'slot') {
1281
+ return leftVNode.$name$ === rightVNode.$name$;
1282
+ }
1283
+ // this will be set if components in the build have `key` attrs set on them
1284
+ {
1285
+ return leftVNode.$key$ === rightVNode.$key$;
1286
+ }
1287
+ }
1288
+ return false;
1289
+ };
1290
+ const referenceNode = (node) => {
1291
+ // this node was relocated to a new location in the dom
1292
+ // because of some other component's slot
1293
+ // but we still have an html comment in place of where
1294
+ // it's original location was according to it's original vdom
1295
+ return (node && node['s-ol']) || node;
1296
+ };
1297
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
1298
+ /**
1299
+ * Handle reconciling an outdated VNode with a new one which corresponds to
1300
+ * it. This function handles flushing updates to the DOM and reconciling the
1301
+ * children of the two nodes (if any).
1302
+ *
1303
+ * @param oldVNode an old VNode whose DOM element and children we want to update
1304
+ * @param newVNode a new VNode representing an updated version of the old one
1305
+ */
1306
+ const patch = (oldVNode, newVNode) => {
1307
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
1308
+ const oldChildren = oldVNode.$children$;
1309
+ const newChildren = newVNode.$children$;
1310
+ const tag = newVNode.$tag$;
1311
+ const text = newVNode.$text$;
1312
+ let defaultHolder;
1313
+ if (text === null) {
1314
+ {
1315
+ // test if we're rendering an svg element, or still rendering nodes inside of one
1316
+ // only add this to the when the compiler sees we're using an svg somewhere
1317
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
1318
+ }
1319
+ {
1320
+ if (tag === 'slot')
1321
+ ;
1322
+ else {
1323
+ // either this is the first render of an element OR it's an update
1324
+ // AND we already know it's possible it could have changed
1325
+ // this updates the element's css classes, attrs, props, listeners, etc.
1326
+ updateElement(oldVNode, newVNode, isSvgMode);
1327
+ }
1328
+ }
1329
+ if (oldChildren !== null && newChildren !== null) {
1330
+ // looks like there's child vnodes for both the old and new vnodes
1331
+ // so we need to call `updateChildren` to reconcile them
1332
+ updateChildren(elm, oldChildren, newVNode, newChildren);
1333
+ }
1334
+ else if (newChildren !== null) {
1335
+ // no old child vnodes, but there are new child vnodes to add
1336
+ if (oldVNode.$text$ !== null) {
1337
+ // the old vnode was text, so be sure to clear it out
1338
+ elm.textContent = '';
1339
+ }
1340
+ // add the new vnode children
1341
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
1342
+ }
1343
+ else if (oldChildren !== null) {
1344
+ // no new child vnodes, but there are old child vnodes to remove
1345
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
1346
+ }
1347
+ if (isSvgMode && tag === 'svg') {
1348
+ isSvgMode = false;
1349
+ }
1350
+ }
1351
+ else if ((defaultHolder = elm['s-cr'])) {
1352
+ // this element has slotted content
1353
+ defaultHolder.parentNode.textContent = text;
1354
+ }
1355
+ else if (oldVNode.$text$ !== text) {
1356
+ // update the text content for the text only vnode
1357
+ // and also only if the text is different than before
1358
+ elm.data = text;
1359
+ }
1360
+ };
1361
+ const updateFallbackSlotVisibility = (elm) => {
1362
+ // tslint:disable-next-line: prefer-const
1363
+ const childNodes = elm.childNodes;
1364
+ let childNode;
1365
+ let i;
1366
+ let ilen;
1367
+ let j;
1368
+ let slotNameAttr;
1369
+ let nodeType;
1370
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1371
+ childNode = childNodes[i];
1372
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1373
+ if (childNode['s-sr']) {
1374
+ // this is a slot fallback node
1375
+ // get the slot name for this slot reference node
1376
+ slotNameAttr = childNode['s-sn'];
1377
+ // by default always show a fallback slot node
1378
+ // then hide it if there are other slots in the light dom
1379
+ childNode.hidden = false;
1380
+ for (j = 0; j < ilen; j++) {
1381
+ nodeType = childNodes[j].nodeType;
1382
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
1383
+ // this sibling node is from a different component OR is a named fallback slot node
1384
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1385
+ childNode.hidden = true;
1386
+ break;
1387
+ }
1388
+ }
1389
+ else {
1390
+ // this is a default fallback slot node
1391
+ // any element or text node (with content)
1392
+ // should hide the default fallback slot node
1393
+ if (nodeType === 1 /* NODE_TYPE.ElementNode */ ||
1394
+ (nodeType === 3 /* NODE_TYPE.TextNode */ && childNodes[j].textContent.trim() !== '')) {
1395
+ childNode.hidden = true;
1396
+ break;
1397
+ }
1398
+ }
1399
+ }
1400
+ }
1401
+ // keep drilling down
1402
+ updateFallbackSlotVisibility(childNode);
1403
+ }
1404
+ }
1405
+ };
1406
+ const relocateNodes = [];
1407
+ const relocateSlotContent = (elm) => {
1408
+ // tslint:disable-next-line: prefer-const
1409
+ let childNode;
1410
+ let node;
1411
+ let hostContentNodes;
1412
+ let slotNameAttr;
1413
+ let relocateNodeData;
1414
+ let j;
1415
+ let i = 0;
1416
+ const childNodes = elm.childNodes;
1417
+ const ilen = childNodes.length;
1418
+ for (; i < ilen; i++) {
1419
+ childNode = childNodes[i];
1420
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
1421
+ // first got the content reference comment node
1422
+ // then we got it's parent, which is where all the host content is in now
1423
+ hostContentNodes = node.parentNode.childNodes;
1424
+ slotNameAttr = childNode['s-sn'];
1425
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
1426
+ node = hostContentNodes[j];
1427
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1428
+ // let's do some relocating to its new home
1429
+ // but never relocate a content reference node
1430
+ // that is suppose to always represent the original content location
1431
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
1432
+ // it's possible we've already decided to relocate this node
1433
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1434
+ // made some changes to slots
1435
+ // let's make sure we also double check
1436
+ // fallbacks are correctly hidden or shown
1437
+ checkSlotFallbackVisibility = true;
1438
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
1439
+ if (relocateNodeData) {
1440
+ // previously we never found a slot home for this node
1441
+ // but turns out we did, so let's remember it now
1442
+ relocateNodeData.$slotRefNode$ = childNode;
1443
+ }
1444
+ else {
1445
+ // add to our list of nodes to relocate
1446
+ relocateNodes.push({
1447
+ $slotRefNode$: childNode,
1448
+ $nodeToRelocate$: node,
1449
+ });
1450
+ }
1451
+ if (node['s-sr']) {
1452
+ relocateNodes.map((relocateNode) => {
1453
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1454
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1455
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
1456
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1457
+ }
1458
+ }
1459
+ });
1460
+ }
1461
+ }
1462
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
1463
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
1464
+ // if we never find a home for this element then we'll need to hide it
1465
+ relocateNodes.push({
1466
+ $nodeToRelocate$: node,
1467
+ });
1468
+ }
1469
+ }
1470
+ }
1471
+ }
1472
+ if (childNode.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1473
+ relocateSlotContent(childNode);
1474
+ }
1475
+ }
1476
+ };
1477
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1478
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1479
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1480
+ return true;
1481
+ }
1482
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1483
+ return true;
1484
+ }
1485
+ return false;
1486
+ }
1487
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
1488
+ return true;
1489
+ }
1490
+ return slotNameAttr === '';
1491
+ };
1492
+ /**
1493
+ * 'Nullify' any VDom `ref` callbacks on a VDom node or its children by
1494
+ * calling them with `null`. This signals that the DOM element corresponding to
1495
+ * the VDom node has been removed from the DOM.
1496
+ *
1497
+ * @param vNode a virtual DOM node
1498
+ */
1499
+ const nullifyVNodeRefs = (vNode) => {
1500
+ {
1501
+ vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1502
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1503
+ }
1504
+ };
1505
+ /**
1506
+ * The main entry point for Stencil's virtual DOM-based rendering engine
1507
+ *
1508
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
1509
+ * function will handle creating a virtual DOM tree with a single root, patching
1510
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
1511
+ * relocation, and reflecting attributes.
1512
+ *
1513
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
1514
+ * the DOM node into which it should be rendered.
1515
+ * @param renderFnResults the virtual DOM nodes to be rendered
1516
+ * @param isInitialLoad whether or not this is the first call after page load
1517
+ */
1518
+ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1519
+ const hostElm = hostRef.$hostElement$;
1520
+ const cmpMeta = hostRef.$cmpMeta$;
1521
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1522
+ // if `renderFnResults` is a Host node then we can use it directly. If not,
1523
+ // we need to call `h` again to wrap the children of our component in a
1524
+ // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
1525
+ // implicitly that the top-level vdom node is 1) an only child and 2)
1526
+ // contains attrs that need to be set on the host element.
1527
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1528
+ hostTagName = hostElm.tagName;
1529
+ if (cmpMeta.$attrsToReflect$) {
1530
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1531
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1532
+ }
1533
+ // On the first render and *only* on the first render we want to check for
1534
+ // any attributes set on the host element which are also set on the vdom
1535
+ // node. If we find them, we override the value on the VDom node attrs with
1536
+ // the value from the host element, which allows developers building apps
1537
+ // with Stencil components to override e.g. the `role` attribute on a
1538
+ // component even if it's already set on the `Host`.
1539
+ if (isInitialLoad && rootVnode.$attrs$) {
1540
+ for (const key of Object.keys(rootVnode.$attrs$)) {
1541
+ // We have a special implementation in `setAccessor` for `style` and
1542
+ // `class` which reconciles values coming from the VDom with values
1543
+ // already present on the DOM element, so we don't want to override those
1544
+ // attributes on the VDom tree with values from the host element if they
1545
+ // are present.
1546
+ //
1547
+ // Likewise, `ref` and `key` are special internal values for the Stencil
1548
+ // runtime and we don't want to override those either.
1549
+ if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
1550
+ rootVnode.$attrs$[key] = hostElm[key];
1551
+ }
1552
+ }
1553
+ }
1554
+ rootVnode.$tag$ = null;
1555
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
1556
+ hostRef.$vnode$ = rootVnode;
1557
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
1558
+ {
1559
+ scopeId = hostElm['s-sc'];
1560
+ }
1561
+ {
1562
+ contentRef = hostElm['s-cr'];
1563
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) !== 0;
1564
+ // always reset
1565
+ checkSlotFallbackVisibility = false;
1566
+ }
1567
+ // synchronous patch
1568
+ patch(oldVNode, rootVnode);
1569
+ {
1570
+ // while we're moving nodes around existing nodes, temporarily disable
1571
+ // the disconnectCallback from working
1572
+ plt.$flags$ |= 1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1573
+ if (checkSlotRelocate) {
1574
+ relocateSlotContent(rootVnode.$elm$);
1575
+ let relocateData;
1576
+ let nodeToRelocate;
1577
+ let orgLocationNode;
1578
+ let parentNodeRef;
1579
+ let insertBeforeNode;
1580
+ let refNode;
1581
+ let i = 0;
1582
+ for (; i < relocateNodes.length; i++) {
1583
+ relocateData = relocateNodes[i];
1584
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1585
+ if (!nodeToRelocate['s-ol']) {
1586
+ // add a reference node marking this node's original location
1587
+ // keep a reference to this node for later lookups
1588
+ orgLocationNode =
1589
+ doc.createTextNode('');
1590
+ orgLocationNode['s-nr'] = nodeToRelocate;
1591
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1592
+ }
1593
+ }
1594
+ for (i = 0; i < relocateNodes.length; i++) {
1595
+ relocateData = relocateNodes[i];
1596
+ nodeToRelocate = relocateData.$nodeToRelocate$;
1597
+ if (relocateData.$slotRefNode$) {
1598
+ // by default we're just going to insert it directly
1599
+ // after the slot reference node
1600
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
1601
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1602
+ orgLocationNode = nodeToRelocate['s-ol'];
1603
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
1604
+ refNode = orgLocationNode['s-nr'];
1605
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1606
+ refNode = refNode.nextSibling;
1607
+ if (!refNode || !refNode['s-nr']) {
1608
+ insertBeforeNode = refNode;
1609
+ break;
1610
+ }
1611
+ }
1612
+ }
1613
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
1614
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
1615
+ // we've checked that it's worth while to relocate
1616
+ // since that the node to relocate
1617
+ // has a different next sibling or parent relocated
1618
+ if (nodeToRelocate !== insertBeforeNode) {
1619
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1620
+ // probably a component in the index.html that doesn't have its hostname set
1621
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1622
+ }
1623
+ // add it back to the dom but in its new home
1624
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1625
+ }
1626
+ }
1627
+ }
1628
+ else {
1629
+ // this node doesn't have a slot home to go to, so let's hide it
1630
+ if (nodeToRelocate.nodeType === 1 /* NODE_TYPE.ElementNode */) {
1631
+ nodeToRelocate.hidden = true;
1632
+ }
1633
+ }
1634
+ }
1635
+ }
1636
+ if (checkSlotFallbackVisibility) {
1637
+ updateFallbackSlotVisibility(rootVnode.$elm$);
1638
+ }
1639
+ // done moving nodes around
1640
+ // allow the disconnect callback to work again
1641
+ plt.$flags$ &= ~1 /* PLATFORM_FLAGS.isTmpDisconnected */;
1642
+ // always reset
1643
+ relocateNodes.length = 0;
1644
+ }
1645
+ };
1646
+ const attachToAncestor = (hostRef, ancestorComponent) => {
1647
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1648
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
1649
+ }
1650
+ };
1651
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
1652
+ {
1653
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
1654
+ }
1655
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
1656
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
1657
+ return;
1658
+ }
1659
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1660
+ // there is no ancestor component or the ancestor component
1661
+ // has already fired off its lifecycle update then
1662
+ // fire off the initial update
1663
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1664
+ return writeTask(dispatch) ;
1665
+ };
1666
+ /**
1667
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
1668
+ * component lifecycle methods like `componentWillLoad` as well as
1669
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
1670
+ *
1671
+ * @param hostRef a reference to a host DOM node
1672
+ * @param isInitialLoad whether we're on the initial load or not
1673
+ * @returns an empty Promise which is used to enqueue a series of operations for
1674
+ * the component
1675
+ */
1676
+ const dispatchHooks = (hostRef, isInitialLoad) => {
1677
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1678
+ const instance = hostRef.$lazyInstance$ ;
1679
+ // We're going to use this variable together with `enqueue` to implement a
1680
+ // little promise-based queue. We start out with it `undefined`. When we add
1681
+ // the first function to the queue we'll set this variable to be that
1682
+ // function's return value. When we attempt to add subsequent values to the
1683
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
1684
+ // the new function off of that `Promise` using `.then()`. This will give our
1685
+ // queue two nice properties:
1686
+ //
1687
+ // 1. If all functions added to the queue are synchronous they'll be called
1688
+ // synchronously right away.
1689
+ // 2. If all functions added to the queue are asynchronous they'll all be
1690
+ // called in order after `dispatchHooks` exits.
1691
+ let maybePromise;
1692
+ if (isInitialLoad) {
1693
+ {
1694
+ // If `componentWillLoad` returns a `Promise` then we want to wait on
1695
+ // whatever's going on in that `Promise` before we launch into
1696
+ // rendering the component, doing other lifecycle stuff, etc. So
1697
+ // in that case we assign the returned promise to the variable we
1698
+ // declared above to hold a possible 'queueing' Promise
1699
+ maybePromise = safeCall(instance, 'componentWillLoad');
1700
+ }
1701
+ }
1702
+ endSchedule();
1703
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1704
+ };
1705
+ /**
1706
+ * This function uses a Promise to implement a simple first-in, first-out queue
1707
+ * of functions to be called.
1708
+ *
1709
+ * The queue is ordered on the basis of the first argument. If it's
1710
+ * `undefined`, then nothing is on the queue yet, so the provided function can
1711
+ * be called synchronously (although note that this function may return a
1712
+ * `Promise`). The idea is that then the return value of that enqueueing
1713
+ * operation is kept around, so that if it was a `Promise` then subsequent
1714
+ * functions can be enqueued by calling this function again with that `Promise`
1715
+ * as the first argument.
1716
+ *
1717
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
1718
+ * @param fn a function to enqueue
1719
+ * @returns either a `Promise` or the return value of the provided function
1720
+ */
1721
+ const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
1722
+ /**
1723
+ * Check that a value is a `Promise`. To check, we first see if the value is an
1724
+ * instance of the `Promise` global. In a few circumstances, in particular if
1725
+ * the global has been overwritten, this is could be misleading, so we also do
1726
+ * a little 'duck typing' check to see if the `.then` property of the value is
1727
+ * defined and a function.
1728
+ *
1729
+ * @param maybePromise it might be a promise!
1730
+ * @returns whether it is or not
1731
+ */
1732
+ const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
1733
+ (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
1734
+ /**
1735
+ * Update a component given reference to its host elements and so on.
1736
+ *
1737
+ * @param hostRef an object containing references to the element's host node,
1738
+ * VDom nodes, and other metadata
1739
+ * @param instance a reference to the underlying host element where it will be
1740
+ * rendered
1741
+ * @param isInitialLoad whether or not this function is being called as part of
1742
+ * the first render cycle
1743
+ */
1744
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1745
+ var _a;
1746
+ const elm = hostRef.$hostElement$;
1747
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1748
+ const rc = elm['s-rc'];
1749
+ if (isInitialLoad) {
1750
+ // DOM WRITE!
1751
+ attachStyles(hostRef);
1752
+ }
1753
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1754
+ {
1755
+ callRender(hostRef, instance, elm, isInitialLoad);
1756
+ }
1757
+ if (rc) {
1758
+ // ok, so turns out there are some child host elements
1759
+ // waiting on this parent element to load
1760
+ // let's fire off all update callbacks waiting
1761
+ rc.map((cb) => cb());
1762
+ elm['s-rc'] = undefined;
1763
+ }
1764
+ endRender();
1765
+ endUpdate();
1766
+ {
1767
+ const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
1768
+ const postUpdate = () => postUpdateComponent(hostRef);
1769
+ if (childrenPromises.length === 0) {
1770
+ postUpdate();
1771
+ }
1772
+ else {
1773
+ Promise.all(childrenPromises).then(postUpdate);
1774
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
1775
+ childrenPromises.length = 0;
1776
+ }
1777
+ }
1778
+ };
1779
+ /**
1780
+ * Handle making the call to the VDom renderer with the proper context given
1781
+ * various build variables
1782
+ *
1783
+ * @param hostRef an object containing references to the element's host node,
1784
+ * VDom nodes, and other metadata
1785
+ * @param instance a reference to the underlying host element where it will be
1786
+ * rendered
1787
+ * @param elm the Host element for the component
1788
+ * @param isInitialLoad whether or not this function is being called as part of
1789
+ * @returns an empty promise
1790
+ */
1791
+ const callRender = (hostRef, instance, elm, isInitialLoad) => {
1792
+ try {
1793
+ instance = instance.render() ;
1794
+ {
1795
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
1796
+ }
1797
+ {
1798
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
1799
+ }
1800
+ {
1801
+ {
1802
+ // looks like we've got child nodes to render into this host element
1803
+ // or we need to update the css class/attrs on the host element
1804
+ // DOM WRITE!
1805
+ {
1806
+ renderVdom(hostRef, instance, isInitialLoad);
1807
+ }
1808
+ }
1809
+ }
1810
+ }
1811
+ catch (e) {
1812
+ consoleError(e, hostRef.$hostElement$);
1813
+ }
1814
+ return null;
1815
+ };
1816
+ const postUpdateComponent = (hostRef) => {
1817
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1818
+ const elm = hostRef.$hostElement$;
1819
+ const endPostUpdate = createTime('postUpdate', tagName);
1820
+ const instance = hostRef.$lazyInstance$ ;
1821
+ const ancestorComponent = hostRef.$ancestorComponent$;
1822
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
1823
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
1824
+ {
1825
+ // DOM WRITE!
1826
+ addHydratedFlag(elm);
1827
+ }
1828
+ {
1829
+ safeCall(instance, 'componentDidLoad');
1830
+ }
1831
+ endPostUpdate();
1832
+ {
1833
+ hostRef.$onReadyResolve$(elm);
1834
+ if (!ancestorComponent) {
1835
+ appDidLoad();
1836
+ }
1837
+ }
1838
+ }
1839
+ else {
1840
+ {
1841
+ safeCall(instance, 'componentDidUpdate');
1842
+ }
1843
+ endPostUpdate();
1844
+ }
1845
+ // load events fire from bottom to top
1846
+ // the deepest elements load first then bubbles up
1847
+ {
1848
+ if (hostRef.$onRenderResolve$) {
1849
+ hostRef.$onRenderResolve$();
1850
+ hostRef.$onRenderResolve$ = undefined;
1851
+ }
1852
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
1853
+ nextTick(() => scheduleUpdate(hostRef, false));
1854
+ }
1855
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
1856
+ }
1857
+ // ( •_•)
1858
+ // ( •_•)>⌐■-■
1859
+ // (⌐■_■)
1860
+ };
1861
+ const appDidLoad = (who) => {
1862
+ // on appload
1863
+ // we have finish the first big initial render
1864
+ {
1865
+ addHydratedFlag(doc.documentElement);
1866
+ }
1867
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1868
+ };
1869
+ const safeCall = (instance, method, arg) => {
1870
+ if (instance && instance[method]) {
1871
+ try {
1872
+ return instance[method](arg);
1873
+ }
1874
+ catch (e) {
1875
+ consoleError(e);
1876
+ }
1877
+ }
1878
+ return undefined;
1879
+ };
1880
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1881
+ ;
1882
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1883
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1884
+ // check our new property value against our internal value
1885
+ const hostRef = getHostRef(ref);
1886
+ const elm = hostRef.$hostElement$ ;
1887
+ const oldVal = hostRef.$instanceValues$.get(propName);
1888
+ const flags = hostRef.$flags$;
1889
+ const instance = hostRef.$lazyInstance$ ;
1890
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1891
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1892
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1893
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1894
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1895
+ // gadzooks! the property's value has changed!!
1896
+ // set our new value!
1897
+ hostRef.$instanceValues$.set(propName, newVal);
1898
+ if (instance) {
1899
+ // get an array of method names of watch functions to call
1900
+ if (cmpMeta.$watchers$ && flags & 128 /* HOST_FLAGS.isWatchReady */) {
1901
+ const watchMethods = cmpMeta.$watchers$[propName];
1902
+ if (watchMethods) {
1903
+ // this instance is watching for when this property changed
1904
+ watchMethods.map((watchMethodName) => {
1905
+ try {
1906
+ // fire off each of the watch methods that are watching this property
1907
+ instance[watchMethodName](newVal, oldVal, propName);
1908
+ }
1909
+ catch (e) {
1910
+ consoleError(e, elm);
1911
+ }
1912
+ });
1913
+ }
1914
+ }
1915
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
1916
+ // looks like this value actually changed, so we've got work to do!
1917
+ // but only if we've already rendered, otherwise just chill out
1918
+ // queue that we need to do an update, but don't worry about queuing
1919
+ // up millions cuz this function ensures it only runs once
1920
+ scheduleUpdate(hostRef, false);
1921
+ }
1922
+ }
1923
+ }
1924
+ };
1925
+ /**
1926
+ * Attach a series of runtime constructs to a compiled Stencil component
1927
+ * constructor, including getters and setters for the `@Prop` and `@State`
1928
+ * decorators, callbacks for when attributes change, and so on.
1929
+ *
1930
+ * @param Cstr the constructor for a component that we need to process
1931
+ * @param cmpMeta metadata collected previously about the component
1932
+ * @param flags a number used to store a series of bit flags
1933
+ * @returns a reference to the same constructor passed in (but now mutated)
1934
+ */
1935
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1936
+ var _a;
1937
+ if (cmpMeta.$members$) {
1938
+ if (Cstr.watchers) {
1939
+ cmpMeta.$watchers$ = Cstr.watchers;
1940
+ }
1941
+ // It's better to have a const than two Object.entries()
1942
+ const members = Object.entries(cmpMeta.$members$);
1943
+ const prototype = Cstr.prototype;
1944
+ members.map(([memberName, [memberFlags]]) => {
1945
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1946
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1947
+ // proxyComponent - prop
1948
+ Object.defineProperty(prototype, memberName, {
1949
+ get() {
1950
+ // proxyComponent, get value
1951
+ return getValue(this, memberName);
1952
+ },
1953
+ set(newValue) {
1954
+ // proxyComponent, set value
1955
+ setValue(this, memberName, newValue, cmpMeta);
1956
+ },
1957
+ configurable: true,
1958
+ enumerable: true,
1959
+ });
1960
+ }
1961
+ });
1962
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1963
+ const attrNameToPropName = new Map();
1964
+ prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1965
+ plt.jmp(() => {
1966
+ const propName = attrNameToPropName.get(attrName);
1967
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1968
+ // in the case where an attribute was set inline.
1969
+ // ```html
1970
+ // <my-component some-attribute="some-value"></my-component>
1971
+ // ```
1972
+ //
1973
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1974
+ // programmatically changes it before it has been upgraded as shown below:
1975
+ //
1976
+ // ```html
1977
+ // <!-- this component has _not_ been upgraded yet -->
1978
+ // <my-component id="test" some-attribute="some-value"></my-component>
1979
+ // <script>
1980
+ // // grab non-upgraded component
1981
+ // el = document.querySelector("#test");
1982
+ // el.someAttribute = "another-value";
1983
+ // // upgrade component
1984
+ // customElements.define('my-component', MyComponent);
1985
+ // </script>
1986
+ // ```
1987
+ // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1988
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1989
+ // to the value that was set inline i.e. "some-value" from above example. When
1990
+ // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1991
+ //
1992
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1993
+ // by connectedCallback as this attributeChangedCallback will not fire.
1994
+ //
1995
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1996
+ //
1997
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1998
+ // properties here given that this goes against best practices outlined here
1999
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
2000
+ if (this.hasOwnProperty(propName)) {
2001
+ newValue = this[propName];
2002
+ delete this[propName];
2003
+ }
2004
+ else if (prototype.hasOwnProperty(propName) &&
2005
+ typeof this[propName] === 'number' &&
2006
+ this[propName] == newValue) {
2007
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
2008
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
2009
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
2010
+ return;
2011
+ }
2012
+ else if (propName == null) {
2013
+ // At this point we should know this is not a "member", so we can treat it like watching an attribute
2014
+ // on a vanilla web component
2015
+ const hostRef = getHostRef(this);
2016
+ const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
2017
+ // We only want to trigger the callback(s) if:
2018
+ // 1. The instance is ready
2019
+ // 2. The watchers are ready
2020
+ // 3. The value has changed
2021
+ if (!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
2022
+ flags & 128 /* HOST_FLAGS.isWatchReady */ &&
2023
+ newValue !== oldValue) {
2024
+ const instance = hostRef.$lazyInstance$ ;
2025
+ const entry = cmpMeta.$watchers$[attrName];
2026
+ entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
2027
+ if (instance[callbackName] != null) {
2028
+ instance[callbackName].call(instance, newValue, oldValue, attrName);
2029
+ }
2030
+ });
2031
+ }
2032
+ return;
2033
+ }
2034
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
2035
+ });
2036
+ };
2037
+ // Create an array of attributes to observe
2038
+ // This list in comprised of all strings used within a `@Watch()` decorator
2039
+ // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
2040
+ // As such, there is no way to guarantee type-safety here that a user hasn't entered
2041
+ // an invalid attribute.
2042
+ Cstr.observedAttributes = Array.from(new Set([
2043
+ ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
2044
+ ...members
2045
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
2046
+ .map(([propName, m]) => {
2047
+ const attrName = m[1] || propName;
2048
+ attrNameToPropName.set(attrName, propName);
2049
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
2050
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
2051
+ }
2052
+ return attrName;
2053
+ }),
2054
+ ]));
2055
+ }
2056
+ }
2057
+ return Cstr;
2058
+ };
2059
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
2060
+ // initializeComponent
2061
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
2062
+ // Let the runtime know that the component has been initialized
2063
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
2064
+ {
2065
+ // lazy loaded components
2066
+ // request the component's implementation to be
2067
+ // wired up with the host element
2068
+ Cstr = loadModule(cmpMeta);
2069
+ if (Cstr.then) {
2070
+ // Await creates a micro-task avoid if possible
2071
+ const endLoad = uniqueTime();
2072
+ Cstr = await Cstr;
2073
+ endLoad();
2074
+ }
2075
+ if (!Cstr.isProxied) {
2076
+ // we've never proxied this Constructor before
2077
+ // let's add the getters/setters to its prototype before
2078
+ // the first time we create an instance of the implementation
2079
+ {
2080
+ cmpMeta.$watchers$ = Cstr.watchers;
2081
+ }
2082
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
2083
+ Cstr.isProxied = true;
2084
+ }
2085
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
2086
+ // ok, time to construct the instance
2087
+ // but let's keep track of when we start and stop
2088
+ // so that the getters/setters don't incorrectly step on data
2089
+ {
2090
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
2091
+ }
2092
+ // construct the lazy-loaded component implementation
2093
+ // passing the hostRef is very important during
2094
+ // construction in order to directly wire together the
2095
+ // host element and the lazy-loaded instance
2096
+ try {
2097
+ new Cstr(hostRef);
2098
+ }
2099
+ catch (e) {
2100
+ consoleError(e);
2101
+ }
2102
+ {
2103
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
2104
+ }
2105
+ {
2106
+ hostRef.$flags$ |= 128 /* HOST_FLAGS.isWatchReady */;
2107
+ }
2108
+ endNewInstance();
2109
+ }
2110
+ if (Cstr.style) {
2111
+ // this component has styles but we haven't registered them yet
2112
+ let style = Cstr.style;
2113
+ const scopeId = getScopeId(cmpMeta);
2114
+ if (!styles.has(scopeId)) {
2115
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
2116
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
2117
+ endRegisterStyles();
2118
+ }
2119
+ }
2120
+ }
2121
+ // we've successfully created a lazy instance
2122
+ const ancestorComponent = hostRef.$ancestorComponent$;
2123
+ const schedule = () => scheduleUpdate(hostRef, true);
2124
+ if (ancestorComponent && ancestorComponent['s-rc']) {
2125
+ // this is the initial load and this component it has an ancestor component
2126
+ // but the ancestor component has NOT fired its will update lifecycle yet
2127
+ // so let's just cool our jets and wait for the ancestor to continue first
2128
+ // this will get fired off when the ancestor component
2129
+ // finally gets around to rendering its lazy self
2130
+ // fire off the initial update
2131
+ ancestorComponent['s-rc'].push(schedule);
2132
+ }
2133
+ else {
2134
+ schedule();
2135
+ }
2136
+ };
2137
+ const fireConnectedCallback = (instance) => {
2138
+ };
2139
+ const connectedCallback = (elm) => {
2140
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2141
+ const hostRef = getHostRef(elm);
2142
+ const cmpMeta = hostRef.$cmpMeta$;
2143
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2144
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
2145
+ // first time this component has connected
2146
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
2147
+ let hostId;
2148
+ {
2149
+ hostId = elm.getAttribute(HYDRATE_ID);
2150
+ if (hostId) {
2151
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2152
+ const scopeId = addStyle(elm.shadowRoot, cmpMeta);
2153
+ elm.classList.remove(scopeId + '-h', scopeId + '-s');
2154
+ }
2155
+ initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2156
+ }
2157
+ }
2158
+ if (!hostId) {
2159
+ // initUpdate
2160
+ // if the slot polyfill is required we'll need to put some nodes
2161
+ // in here to act as original content anchors as we move nodes around
2162
+ // host element has been connected to the DOM
2163
+ if ((// TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2164
+ cmpMeta.$flags$ & (4 /* CMP_FLAGS.hasSlotRelocation */ | 8 /* CMP_FLAGS.needsShadowDomShim */))) {
2165
+ setContentReference(elm);
2166
+ }
2167
+ }
2168
+ {
2169
+ // find the first ancestor component (if there is one) and register
2170
+ // this component as one of the actively loading child components for its ancestor
2171
+ let ancestorComponent = elm;
2172
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2173
+ // climb up the ancestors looking for the first
2174
+ // component that hasn't finished its lifecycle update yet
2175
+ if ((ancestorComponent.nodeType === 1 /* NODE_TYPE.ElementNode */ &&
2176
+ ancestorComponent.hasAttribute('s-id') &&
2177
+ ancestorComponent['s-p']) ||
2178
+ ancestorComponent['s-p']) {
2179
+ // we found this components first ancestor component
2180
+ // keep a reference to this component's ancestor component
2181
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2182
+ break;
2183
+ }
2184
+ }
2185
+ }
2186
+ // Lazy properties
2187
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2188
+ if (cmpMeta.$members$) {
2189
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2190
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
2191
+ const value = elm[memberName];
2192
+ delete elm[memberName];
2193
+ elm[memberName] = value;
2194
+ }
2195
+ });
2196
+ }
2197
+ {
2198
+ initializeComponent(elm, hostRef, cmpMeta);
2199
+ }
2200
+ }
2201
+ else {
2202
+ // fire off connectedCallback() on component instance
2203
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
2204
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2205
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
2206
+ }
2207
+ }
2208
+ endConnected();
2209
+ }
2210
+ };
2211
+ const setContentReference = (elm) => {
2212
+ // only required when we're NOT using native shadow dom (slot)
2213
+ // or this browser doesn't support native shadow dom
2214
+ // and this host element was NOT created with SSR
2215
+ // let's pick out the inner content for slot projection
2216
+ // create a node to represent where the original
2217
+ // content was first placed, which is useful later on
2218
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
2219
+ contentRefElm['s-cn'] = true;
2220
+ elm.insertBefore(contentRefElm, elm.firstChild);
2221
+ };
2222
+ const disconnectInstance = (instance) => {
2223
+ {
2224
+ safeCall(instance, 'disconnectedCallback');
2225
+ }
2226
+ };
2227
+ const disconnectedCallback = async (elm) => {
2228
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
2229
+ const hostRef = getHostRef(elm);
2230
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) {
2231
+ disconnectInstance(hostRef.$lazyInstance$);
2232
+ }
2233
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
2234
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2235
+ }
2236
+ }
2237
+ };
2238
+ const bootstrapLazy = (lazyBundles, options = {}) => {
2239
+ var _a;
2240
+ const endBootstrap = createTime();
2241
+ const cmpTags = [];
2242
+ const exclude = options.exclude || [];
2243
+ const customElements = win.customElements;
2244
+ const head = doc.head;
2245
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2246
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2247
+ const deferredConnectedCallbacks = [];
2248
+ const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2249
+ let appLoadFallback;
2250
+ let isBootstrapping = true;
2251
+ let i = 0;
2252
+ Object.assign(plt, options);
2253
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2254
+ {
2255
+ // If the app is already hydrated there is not point to disable the
2256
+ // async queue. This will improve the first input delay
2257
+ plt.$flags$ |= 2 /* PLATFORM_FLAGS.appLoaded */;
2258
+ }
2259
+ {
2260
+ for (; i < styles.length; i++) {
2261
+ registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2262
+ }
2263
+ }
2264
+ lazyBundles.map((lazyBundle) => {
2265
+ lazyBundle[1].map((compactMeta) => {
2266
+ var _a;
2267
+ const cmpMeta = {
2268
+ $flags$: compactMeta[0],
2269
+ $tagName$: compactMeta[1],
2270
+ $members$: compactMeta[2],
2271
+ $listeners$: compactMeta[3],
2272
+ };
2273
+ {
2274
+ cmpMeta.$members$ = compactMeta[2];
2275
+ }
2276
+ {
2277
+ cmpMeta.$attrsToReflect$ = [];
2278
+ }
2279
+ {
2280
+ cmpMeta.$watchers$ = (_a = compactMeta[4]) !== null && _a !== void 0 ? _a : {};
2281
+ }
2282
+ const tagName = cmpMeta.$tagName$;
2283
+ const HostElement = class extends HTMLElement {
2284
+ // StencilLazyHost
2285
+ constructor(self) {
2286
+ // @ts-ignore
2287
+ super(self);
2288
+ self = this;
2289
+ registerHost(self, cmpMeta);
2290
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
2291
+ // this component is using shadow dom
2292
+ // and this browser supports shadow dom
2293
+ // add the read-only property "shadowRoot" to the host element
2294
+ // adding the shadow root build conditionals to minimize runtime
2295
+ {
2296
+ {
2297
+ self.attachShadow({ mode: 'open' });
2298
+ }
2299
+ }
2300
+ }
2301
+ }
2302
+ connectedCallback() {
2303
+ if (appLoadFallback) {
2304
+ clearTimeout(appLoadFallback);
2305
+ appLoadFallback = null;
2306
+ }
2307
+ if (isBootstrapping) {
2308
+ // connectedCallback will be processed once all components have been registered
2309
+ deferredConnectedCallbacks.push(this);
2310
+ }
2311
+ else {
2312
+ plt.jmp(() => connectedCallback(this));
2313
+ }
2314
+ }
2315
+ disconnectedCallback() {
2316
+ plt.jmp(() => disconnectedCallback(this));
2317
+ }
2318
+ componentOnReady() {
2319
+ return getHostRef(this).$onReadyPromise$;
2320
+ }
2321
+ };
2322
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
2323
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2324
+ cmpTags.push(tagName);
2325
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
2326
+ }
2327
+ });
2328
+ });
2329
+ {
2330
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2331
+ visibilityStyle.setAttribute('data-styles', '');
2332
+ // Apply CSP nonce to the style tag if it exists
2333
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
2334
+ if (nonce != null) {
2335
+ visibilityStyle.setAttribute('nonce', nonce);
2336
+ }
2337
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2338
+ }
2339
+ // Process deferred connectedCallbacks now all components have been registered
2340
+ isBootstrapping = false;
2341
+ if (deferredConnectedCallbacks.length) {
2342
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
2343
+ }
2344
+ else {
2345
+ {
2346
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2347
+ }
2348
+ }
2349
+ // Fallback appLoad event
2350
+ endBootstrap();
2351
+ };
2352
+ /**
2353
+ * Assigns the given value to the nonce property on the runtime platform object.
2354
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
2355
+ * @param nonce The value to be assigned to the platform nonce property.
2356
+ * @returns void
2357
+ */
2358
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
2359
+ const hostRefs = /*@__PURE__*/ new WeakMap();
2360
+ const getHostRef = (ref) => hostRefs.get(ref);
2361
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2362
+ const registerHost = (elm, cmpMeta) => {
2363
+ const hostRef = {
2364
+ $flags$: 0,
2365
+ $hostElement$: elm,
2366
+ $cmpMeta$: cmpMeta,
2367
+ $instanceValues$: new Map(),
2368
+ };
2369
+ {
2370
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
2371
+ elm['s-p'] = [];
2372
+ elm['s-rc'] = [];
2373
+ }
2374
+ return hostRefs.set(elm, hostRef);
2375
+ };
2376
+ const isMemberInElement = (elm, memberName) => memberName in elm;
2377
+ const consoleError = (e, el) => (0, console.error)(e, el);
2378
+ const cmpModules = /*@__PURE__*/ new Map();
2379
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2380
+ // loadModuleImport
2381
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2382
+ const bundleId = cmpMeta.$lazyBundleId$;
2383
+ const module = cmpModules.get(bundleId) ;
2384
+ if (module) {
2385
+ return module[exportName];
2386
+ }
2387
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
2388
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
2389
+ /* @vite-ignore */
2390
+ /* webpackInclude: /\.entry\.js$/ */
2391
+ /* webpackExclude: /\.system\.entry\.js$/ */
2392
+ /* webpackMode: "lazy" */
2393
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
2394
+ {
2395
+ cmpModules.set(bundleId, importedModule);
2396
+ }
2397
+ return importedModule[exportName];
2398
+ }, consoleError);
2399
+ };
2400
+ const styles = /*@__PURE__*/ new Map();
2401
+ const win = typeof window !== 'undefined' ? window : {};
2402
+ const doc = win.document || { head: {} };
2403
+ const plt = {
2404
+ $flags$: 0,
2405
+ $resourcesUrl$: '',
2406
+ jmp: (h) => h(),
2407
+ raf: (h) => requestAnimationFrame(h),
2408
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
2409
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
2410
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
2411
+ };
2412
+ const supportsShadow =
2413
+ // TODO(STENCIL-854): Remove code related to legacy shadowDomShim field
2414
+ true;
2415
+ const promiseResolve = (v) => Promise.resolve(v);
2416
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
2417
+ try {
2418
+ new CSSStyleSheet();
2419
+ return typeof new CSSStyleSheet().replaceSync === 'function';
2420
+ }
2421
+ catch (e) { }
2422
+ return false;
2423
+ })()
2424
+ ;
2425
+ const queueDomReads = [];
2426
+ const queueDomWrites = [];
2427
+ const queueTask = (queue, write) => (cb) => {
2428
+ queue.push(cb);
2429
+ if (!queuePending) {
2430
+ queuePending = true;
2431
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
2432
+ nextTick(flush);
2433
+ }
2434
+ else {
2435
+ plt.raf(flush);
2436
+ }
2437
+ }
2438
+ };
2439
+ const consume = (queue) => {
2440
+ for (let i = 0; i < queue.length; i++) {
2441
+ try {
2442
+ queue[i](performance.now());
2443
+ }
2444
+ catch (e) {
2445
+ consoleError(e);
2446
+ }
2447
+ }
2448
+ queue.length = 0;
2449
+ };
2450
+ const flush = () => {
2451
+ // always force a bunch of medium callbacks to run, but still have
2452
+ // a throttle on how many can run in a certain time
2453
+ // DOM READS!!!
2454
+ consume(queueDomReads);
2455
+ // DOM WRITES!!!
2456
+ {
2457
+ consume(queueDomWrites);
2458
+ if ((queuePending = queueDomReads.length > 0)) {
2459
+ // still more to do yet, but we've run out of time
2460
+ // let's let this thing cool off and try again in the next tick
2461
+ plt.raf(flush);
2462
+ }
2463
+ }
2464
+ };
2465
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2466
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2467
+
2468
+ exports.Host = Host;
2469
+ exports.bootstrapLazy = bootstrapLazy;
2470
+ exports.createEvent = createEvent;
2471
+ exports.getElement = getElement;
2472
+ exports.h = h;
2473
+ exports.promiseResolve = promiseResolve;
2474
+ exports.registerInstance = registerInstance;
2475
+ exports.setNonce = setNonce;
2476
+
2477
+ //# sourceMappingURL=index-efd561e9.js.map