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