@watermarkinsights/ripple 5.32.1 → 5.33.0-alpha.1

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 (255) hide show
  1. package/dist/cjs/app-globals-k3bip5HZ.js +8 -0
  2. package/dist/cjs/{chartFunctions-0d47b1f4.js → chartFunctions-fWIttqIZ.js} +22 -70
  3. package/dist/cjs/functions-Bag4HsFG.js +9318 -0
  4. package/dist/cjs/{index-bb947bd5.js → index-BKdkswfl.js} +1208 -567
  5. package/dist/cjs/{intl-9e9388a7.js → intl-BeSU8JeX.js} +1 -1
  6. package/dist/cjs/loader.cjs.js +3 -5
  7. package/dist/cjs/priv-calendar.cjs.entry.js +11 -15
  8. package/dist/cjs/priv-chart-popover-old.cjs.entry.js +11 -11
  9. package/dist/cjs/priv-chart-popover_2.cjs.entry.js +39 -21
  10. package/dist/cjs/priv-navigator-button.cjs.entry.js +3 -6
  11. package/dist/cjs/priv-navigator-item.cjs.entry.js +3 -6
  12. package/dist/cjs/priv-option-list.cjs.entry.js +11 -17
  13. package/dist/cjs/ripple.cjs.js +7 -7
  14. package/dist/cjs/wm-action-menu_2.cjs.entry.js +43 -29
  15. package/dist/cjs/wm-button.cjs.entry.js +41 -22
  16. package/dist/cjs/wm-chart-bar.cjs.entry.js +13 -18
  17. package/dist/cjs/wm-chart-column.cjs.entry.js +18 -22
  18. package/dist/cjs/wm-chart-slice.cjs.entry.js +1 -8
  19. package/dist/cjs/wm-chart-stack.cjs.entry.js +13 -17
  20. package/dist/cjs/wm-chart.cjs.entry.js +60 -19
  21. package/dist/cjs/wm-date-range.cjs.entry.js +65 -24
  22. package/dist/cjs/wm-datepicker.cjs.entry.js +44 -20
  23. package/dist/cjs/wm-file-list.cjs.entry.js +8 -6
  24. package/dist/cjs/wm-file.cjs.entry.js +16 -16
  25. package/dist/cjs/wm-flyout.cjs.entry.js +28 -19
  26. package/dist/cjs/wm-input.cjs.entry.js +46 -20
  27. package/dist/cjs/wm-line-chart.cjs.entry.js +55 -32
  28. package/dist/cjs/wm-modal-pss_3.cjs.entry.js +14 -18
  29. package/dist/cjs/wm-modal_3.cjs.entry.js +58 -17
  30. package/dist/cjs/wm-navigation_3.cjs.entry.js +20 -22
  31. package/dist/cjs/wm-navigator.cjs.entry.js +28 -17
  32. package/dist/cjs/wm-nested-select.cjs.entry.js +62 -16
  33. package/dist/cjs/wm-optgroup.cjs.entry.js +22 -9
  34. package/dist/cjs/wm-option_2.cjs.entry.js +89 -27
  35. package/dist/cjs/wm-pagination.cjs.entry.js +47 -17
  36. package/dist/cjs/wm-progress-indicator_3.cjs.entry.js +29 -30
  37. package/dist/cjs/wm-search.cjs.entry.js +61 -12
  38. package/dist/cjs/wm-snackbar.cjs.entry.js +19 -12
  39. package/dist/cjs/wm-tab-item_3.cjs.entry.js +39 -22
  40. package/dist/cjs/wm-tag-input.cjs.entry.js +41 -28
  41. package/dist/cjs/wm-tag-option.cjs.entry.js +15 -9
  42. package/dist/cjs/wm-textarea.cjs.entry.js +46 -15
  43. package/dist/cjs/wm-timepicker.cjs.entry.js +41 -18
  44. package/dist/cjs/wm-toggletip.cjs.entry.js +23 -13
  45. package/dist/cjs/wm-uploader.cjs.entry.js +31 -19
  46. package/dist/cjs/wm-wrapper.cjs.entry.js +1 -3
  47. package/dist/collection/collection-manifest.json +3 -2
  48. package/dist/collection/components/charts/priv-chart-popover/priv-chart-popover.js +26 -13
  49. package/dist/collection/components/charts/priv-chart-popover-old/priv-chart-popover-old.js +9 -5
  50. package/dist/collection/components/charts/wm-chart/wm-chart-slice.js +20 -17
  51. package/dist/collection/components/charts/wm-chart/wm-chart.css +3 -1
  52. package/dist/collection/components/charts/wm-chart/wm-chart.js +94 -25
  53. package/dist/collection/components/charts/wm-chart-bar/wm-chart-bar.js +22 -16
  54. package/dist/collection/components/charts/wm-chart-column/wm-chart-column.js +28 -21
  55. package/dist/collection/components/charts/wm-chart-legend/wm-chart-legend.css +6 -4
  56. package/dist/collection/components/charts/wm-chart-legend/wm-chart-legend.js +38 -8
  57. package/dist/collection/components/charts/wm-chart-stack/wm-chart-stack.js +22 -15
  58. package/dist/collection/components/charts/wm-line-chart/wm-line-chart.js +106 -48
  59. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.css +3 -1
  60. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-indicator.js +40 -19
  61. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-monitor.js +12 -9
  62. package/dist/collection/components/charts/wm-progress-monitor/wm-progress-slice.js +20 -17
  63. package/dist/collection/components/datepickers/datepicker.css +13 -9
  64. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.css +2 -2
  65. package/dist/collection/components/datepickers/priv-calendar/priv-calendar.js +25 -16
  66. package/dist/collection/components/datepickers/wm-date-range.js +84 -26
  67. package/dist/collection/components/datepickers/wm-datepicker.js +57 -20
  68. package/dist/collection/components/selects/priv-option-list/priv-option-list.js +30 -19
  69. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.css +9 -7
  70. package/dist/collection/components/selects/wm-nested-select/wm-nested-select.js +98 -23
  71. package/dist/collection/components/selects/wm-optgroup/wm-optgroup.js +28 -6
  72. package/dist/collection/components/selects/wm-option/wm-option.js +32 -7
  73. package/dist/collection/components/selects/wm-select/wm-select.css +9 -7
  74. package/dist/collection/components/selects/wm-select/wm-select.js +94 -27
  75. package/dist/collection/components/wm-action-menu/wm-action-menu.css +6 -6
  76. package/dist/collection/components/wm-action-menu/wm-action-menu.js +63 -36
  77. package/dist/collection/components/wm-button/wm-button.css +6 -6
  78. package/dist/collection/components/wm-button/wm-button.js +85 -37
  79. package/dist/collection/components/wm-file/wm-file.js +46 -25
  80. package/dist/collection/components/wm-file-list/wm-file-list.js +8 -1
  81. package/dist/collection/components/wm-flyout/wm-flyout.js +54 -26
  82. package/dist/collection/components/wm-input/wm-input.css +7 -5
  83. package/dist/collection/components/wm-input/wm-input.js +98 -37
  84. package/dist/collection/components/wm-menuitem/wm-menuitem.js +24 -5
  85. package/dist/collection/components/wm-modal/wm-modal-footer.js +36 -5
  86. package/dist/collection/components/wm-modal/wm-modal-header.js +14 -2
  87. package/dist/collection/components/wm-modal/wm-modal.js +30 -7
  88. package/dist/collection/components/wm-modal-pss/wm-modal-pss-footer.js +15 -5
  89. package/dist/collection/components/wm-modal-pss/wm-modal-pss-header.js +6 -2
  90. package/dist/collection/components/wm-modal-pss/wm-modal-pss.js +15 -8
  91. package/dist/collection/components/wm-navigation/wm-navigation-hamburger.js +6 -5
  92. package/dist/collection/components/wm-navigation/wm-navigation-item.js +12 -11
  93. package/dist/collection/components/wm-navigation/wm-navigation.js +9 -2
  94. package/dist/collection/components/wm-navigator/priv-navigator-button/priv-navigator-button.js +6 -2
  95. package/dist/collection/components/wm-navigator/priv-navigator-item/priv-navigator-item.js +9 -3
  96. package/dist/collection/components/wm-navigator/wm-navigator.js +46 -20
  97. package/dist/collection/components/wm-pagination/wm-pagination.js +54 -13
  98. package/dist/collection/components/wm-search/wm-search.js +74 -10
  99. package/dist/collection/components/wm-snackbar/wm-snackbar.js +14 -4
  100. package/dist/collection/components/wm-tabs/wm-tab-item/wm-tab-item.js +19 -4
  101. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.css +3 -1
  102. package/dist/collection/components/wm-tabs/wm-tab-list/wm-tab-list.js +12 -10
  103. package/dist/collection/components/wm-tabs/wm-tab-panel/wm-tab-panel.js +17 -2
  104. package/dist/collection/components/wm-tag-input/wm-tag-input.css +4 -4
  105. package/dist/collection/components/wm-tag-input/wm-tag-input.js +81 -41
  106. package/dist/collection/components/wm-tag-input/wm-tag-option/wm-tag-option.js +32 -14
  107. package/dist/collection/components/wm-textarea/wm-textarea.css +7 -5
  108. package/dist/collection/components/wm-textarea/wm-textarea.js +72 -20
  109. package/dist/collection/components/wm-timepicker/wm-timepicker.css +9 -7
  110. package/dist/collection/components/wm-timepicker/wm-timepicker.js +55 -19
  111. package/dist/collection/components/wm-toggletip/wm-toggletip.js +38 -14
  112. package/dist/collection/components/wm-uploader/wm-uploader.css +10 -10
  113. package/dist/collection/components/wm-uploader/wm-uploader.js +63 -28
  114. package/dist/collection/global/global.js +5 -3
  115. package/dist/docs/docs.d.ts +45 -0
  116. package/dist/docs/docs.json +1063 -300
  117. package/dist/docs/skill/wm-nested-select.md +3 -0
  118. package/dist/docs/skill/wm-optgroup.md +3 -0
  119. package/dist/docs/skill/wm-progress-monitor.md +3 -0
  120. package/dist/docs/skill/wm-select.md +3 -0
  121. package/dist/esm/app-globals-B_mHcIXc.js +6 -0
  122. package/dist/esm/{chartFunctions-58637dc9.js → chartFunctions-C2cx-qVA.js} +23 -71
  123. package/dist/esm/functions-UejPfcUp.js +9276 -0
  124. package/dist/esm/{index-3425d80d.js → index-BGfrNNVL.js} +1205 -563
  125. package/dist/esm/{intl-d518f362.js → intl-1Kev15g9.js} +1 -1
  126. package/dist/esm/loader.js +4 -4
  127. package/dist/esm/priv-calendar.entry.js +11 -13
  128. package/dist/esm/priv-chart-popover-old.entry.js +11 -9
  129. package/dist/esm/priv-chart-popover_2.entry.js +39 -19
  130. package/dist/esm/priv-navigator-button.entry.js +3 -4
  131. package/dist/esm/priv-navigator-item.entry.js +3 -4
  132. package/dist/esm/priv-option-list.entry.js +11 -15
  133. package/dist/esm/ripple.js +6 -5
  134. package/dist/esm/wm-action-menu_2.entry.js +43 -27
  135. package/dist/esm/wm-button.entry.js +41 -20
  136. package/dist/esm/wm-chart-bar.entry.js +13 -16
  137. package/dist/esm/wm-chart-column.entry.js +18 -20
  138. package/dist/esm/wm-chart-slice.entry.js +1 -6
  139. package/dist/esm/wm-chart-stack.entry.js +13 -15
  140. package/dist/esm/wm-chart.entry.js +60 -17
  141. package/dist/esm/wm-date-range.entry.js +65 -22
  142. package/dist/esm/wm-datepicker.entry.js +44 -18
  143. package/dist/esm/wm-file-list.entry.js +8 -4
  144. package/dist/esm/wm-file.entry.js +16 -14
  145. package/dist/esm/wm-flyout.entry.js +28 -17
  146. package/dist/esm/wm-input.entry.js +46 -18
  147. package/dist/esm/wm-line-chart.entry.js +55 -30
  148. package/dist/esm/wm-modal-pss_3.entry.js +14 -16
  149. package/dist/esm/wm-modal_3.entry.js +58 -15
  150. package/dist/esm/wm-navigation_3.entry.js +20 -20
  151. package/dist/esm/wm-navigator.entry.js +28 -15
  152. package/dist/esm/wm-nested-select.entry.js +62 -14
  153. package/dist/esm/wm-optgroup.entry.js +22 -7
  154. package/dist/esm/wm-option_2.entry.js +89 -25
  155. package/dist/esm/wm-pagination.entry.js +47 -15
  156. package/dist/esm/wm-progress-indicator_3.entry.js +29 -28
  157. package/dist/esm/wm-search.entry.js +61 -10
  158. package/dist/esm/wm-snackbar.entry.js +19 -10
  159. package/dist/esm/wm-tab-item_3.entry.js +39 -20
  160. package/dist/esm/wm-tag-input.entry.js +41 -26
  161. package/dist/esm/wm-tag-option.entry.js +15 -7
  162. package/dist/esm/wm-textarea.entry.js +46 -13
  163. package/dist/esm/wm-timepicker.entry.js +41 -16
  164. package/dist/esm/wm-toggletip.entry.js +23 -11
  165. package/dist/esm/wm-uploader.entry.js +31 -17
  166. package/dist/esm/wm-wrapper.entry.js +1 -1
  167. package/dist/loader/index.d.ts +1 -1
  168. package/dist/ripple/{p-72d135ee.entry.js → p-040297d7.entry.js} +1 -1
  169. package/dist/ripple/p-042fabc0.entry.js +1 -0
  170. package/dist/ripple/p-08cae5a7.entry.js +1 -0
  171. package/dist/ripple/p-0e8b0df5.entry.js +1 -0
  172. package/dist/ripple/{p-680d7606.entry.js → p-119e90f5.entry.js} +1 -1
  173. package/dist/ripple/p-314c60f6.entry.js +1 -0
  174. package/dist/ripple/p-3202e4d3.entry.js +1 -0
  175. package/dist/ripple/p-3864cffe.entry.js +1 -0
  176. package/dist/ripple/{p-59f74ead.entry.js → p-38b62547.entry.js} +1 -1
  177. package/dist/ripple/p-3a457452.entry.js +1 -0
  178. package/dist/ripple/p-405ad89b.entry.js +1 -0
  179. package/dist/ripple/{p-156c4d1d.entry.js → p-4096c755.entry.js} +1 -1
  180. package/dist/ripple/p-40bab7fb.entry.js +1 -0
  181. package/dist/ripple/{p-83cdad78.entry.js → p-4ea49dfc.entry.js} +1 -1
  182. package/dist/ripple/p-52a3dde4.entry.js +1 -0
  183. package/dist/ripple/{p-c9c7df12.entry.js → p-55d81cee.entry.js} +1 -1
  184. package/dist/ripple/p-5e1d3de1.entry.js +1 -0
  185. package/dist/ripple/{p-be3e4e7c.entry.js → p-656c98cb.entry.js} +1 -1
  186. package/dist/ripple/p-658145e6.entry.js +1 -0
  187. package/dist/ripple/p-6c2c87c3.entry.js +1 -0
  188. package/dist/ripple/p-7462e17c.entry.js +1 -0
  189. package/dist/ripple/p-7ec2ceb8.entry.js +1 -0
  190. package/dist/ripple/{p-34bde06a.entry.js → p-8488893b.entry.js} +1 -1
  191. package/dist/ripple/p-8f610e63.entry.js +1 -0
  192. package/dist/ripple/{p-3a19d019.entry.js → p-9fb9bd10.entry.js} +1 -1
  193. package/dist/ripple/p-BGfrNNVL.js +3 -0
  194. package/dist/ripple/p-CEatyzC3.js +1 -0
  195. package/dist/ripple/{p-6e3c2bbc.js → p-DHTrj5UR.js} +1 -1
  196. package/dist/ripple/p-UejPfcUp.js +1 -0
  197. package/dist/ripple/{p-26d8c356.entry.js → p-a470be87.entry.js} +1 -1
  198. package/dist/ripple/p-a7d9313d.entry.js +1 -0
  199. package/dist/ripple/p-a7ea11c3.entry.js +1 -0
  200. package/dist/ripple/{p-38b05894.entry.js → p-a8e2fbb9.entry.js} +1 -1
  201. package/dist/ripple/p-aa316c78.entry.js +1 -0
  202. package/dist/ripple/p-bd2328b0.entry.js +1 -0
  203. package/dist/ripple/p-c07dd034.entry.js +1 -0
  204. package/dist/ripple/p-d51a2cd1.entry.js +1 -0
  205. package/dist/ripple/p-d735a0b3.entry.js +1 -0
  206. package/dist/ripple/p-db2a5d7f.entry.js +1 -0
  207. package/dist/ripple/p-dc2d2704.entry.js +1 -0
  208. package/dist/ripple/p-e17229a4.entry.js +1 -0
  209. package/dist/ripple/p-e90711ae.entry.js +1 -0
  210. package/dist/ripple/p-ef65953a.entry.js +1 -0
  211. package/dist/ripple/{p-683264db.js → p-k9O4HQSf.js} +1 -1
  212. package/dist/ripple/ripple.esm.js +1 -1
  213. package/dist/types/components.d.ts +788 -131
  214. package/dist/types/global/global.d.ts +2 -1
  215. package/dist/types/stencil-public-runtime.d.ts +207 -8
  216. package/package.json +9 -7
  217. package/dist/cjs/app-globals-63acbdaa.js +0 -103
  218. package/dist/cjs/functions-761cb9f2.js +0 -10694
  219. package/dist/esm/app-globals-a4c104e5.js +0 -101
  220. package/dist/esm/functions-65f1594c.js +0 -10652
  221. package/dist/loader/package.json +0 -11
  222. package/dist/ripple/p-0d364411.entry.js +0 -1
  223. package/dist/ripple/p-2b23ce49.entry.js +0 -1
  224. package/dist/ripple/p-2b7cc2c1.entry.js +0 -1
  225. package/dist/ripple/p-35db9386.entry.js +0 -1
  226. package/dist/ripple/p-38a987ac.entry.js +0 -1
  227. package/dist/ripple/p-38dee4ab.entry.js +0 -1
  228. package/dist/ripple/p-507f2cf4.entry.js +0 -1
  229. package/dist/ripple/p-5c2fc42a.entry.js +0 -1
  230. package/dist/ripple/p-5f132a77.entry.js +0 -1
  231. package/dist/ripple/p-6f1cabab.entry.js +0 -1
  232. package/dist/ripple/p-7799953c.entry.js +0 -1
  233. package/dist/ripple/p-83c3db60.js +0 -2
  234. package/dist/ripple/p-87ef0cfa.entry.js +0 -1
  235. package/dist/ripple/p-88e44511.entry.js +0 -1
  236. package/dist/ripple/p-8f8e4eb8.entry.js +0 -1
  237. package/dist/ripple/p-936adffb.entry.js +0 -1
  238. package/dist/ripple/p-9755192c.entry.js +0 -1
  239. package/dist/ripple/p-9c5c591b.js +0 -1
  240. package/dist/ripple/p-9ea38d96.entry.js +0 -1
  241. package/dist/ripple/p-b0d99027.js +0 -1
  242. package/dist/ripple/p-d7a1be0b.entry.js +0 -1
  243. package/dist/ripple/p-dab86523.entry.js +0 -1
  244. package/dist/ripple/p-e4aa6e27.entry.js +0 -1
  245. package/dist/ripple/p-ed053612.entry.js +0 -1
  246. package/dist/ripple/p-f43f621b.entry.js +0 -1
  247. package/dist/ripple/p-f48d30d6.entry.js +0 -1
  248. package/dist/ripple/p-f6aad57c.entry.js +0 -1
  249. package/dist/ripple/p-f6e1beb5.entry.js +0 -1
  250. package/dist/ripple/p-fd997764.entry.js +0 -1
  251. package/dist/ripple/p-fe0345dd.entry.js +0 -1
  252. package/dist/ripple/p-fffb46ad.entry.js +0 -1
  253. /package/dist/cjs/{interfaces-33cd6161.js → interfaces-Cx1dCx1x.js} +0 -0
  254. /package/dist/esm/{interfaces-8778346d.js → interfaces-D9qMfha9.js} +0 -0
  255. /package/dist/ripple/{p-ebe9f38c.js → p-D9qMfha9.js} +0 -0
@@ -9,37 +9,189 @@ function _interopNamespace(e) {
9
9
  var d = Object.getOwnPropertyDescriptor(e, k);
10
10
  Object.defineProperty(n, k, d.get ? d : {
11
11
  enumerable: true,
12
- get: function () {
13
- return e[k];
14
- }
12
+ get: function () { return e[k]; }
15
13
  });
16
14
  }
17
15
  });
18
16
  }
19
- n['default'] = e;
17
+ n.default = e;
20
18
  return Object.freeze(n);
21
19
  }
22
20
 
23
21
  const NAMESPACE = 'ripple';
24
- const BUILD = /* ripple */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: true, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: true, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: true, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: true, shadowDom: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true };
22
+ const BUILD = /* ripple */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
23
+
24
+ const version = "5.33.0-alpha.1";
25
+
26
+ // PRINT RIPPLE VERSION IN CONSOLE
27
+ // test envs return 0 for plugin.length
28
+ // do not print version number there as it causes issues
29
+ if (window.navigator.plugins.length > 0) {
30
+ console.log("%cRipple component library %c%s", "color: #575195; font-weight: bold", "font-weight: bold", version);
31
+ }
32
+ // Dispatching events to track whether user is navigating with keyboard or mouse
33
+ // no longer necessary for keyboard focus indicators (thanks to :focus-visible)
34
+ // but still used in several components for other things (search for isTabbing)
35
+ function wmComponentKeys(ev) {
36
+ if (ev.key == "Tab") {
37
+ var event = new Event("wmUserIsTabbing");
38
+ window.dispatchEvent(event);
39
+ document.querySelector("body").classList.add("wmcl-user-is-tabbing");
40
+ }
41
+ if (ev.key == "ArrowLeft" || ev.key == "ArrowUp" || ev.key == "ArrowRight" || ev.key == "ArrowDown") {
42
+ var event = new Event("wmUserIsKeying");
43
+ window.dispatchEvent(event);
44
+ document.querySelector("body").classList.add("wmcl-user-is-keying");
45
+ }
46
+ }
47
+ function wmComponentMouseDownOnce() {
48
+ var event = new Event("wmUserIsNotTabbing");
49
+ window.dispatchEvent(event);
50
+ document.querySelector("body").classList.remove("wmcl-user-is-tabbing");
51
+ document.querySelector("body").classList.remove("wmcl-user-is-keying");
52
+ }
53
+ window.addEventListener("keydown", wmComponentKeys);
54
+ window.addEventListener("mousedown", wmComponentMouseDownOnce);
55
+ // MODES (FOR PRODUCT-SPECIFIC STYLING)
56
+ //Checks for mode attribute explicitly set on the document. If "mode" is set on component, it will override the global mode. Falls back to default (Planning styles)
57
+ var global = () => {
58
+ };
59
+ // TOOLTIP
60
+ // Add a tooltip element
61
+ // This allows tooltips to be always at the highest stacking context (always on top)
62
+ // Element is added withing a container to avoid performance impact
63
+ const tooltipContainer = document.createElement("div");
64
+ tooltipContainer.id = "wm-tooltip-container";
65
+ const tooltipEl = document.createElement("div");
66
+ tooltipEl.id = "wm-tooltip";
67
+ tooltipEl.classList.add("wm-tooltip");
68
+ tooltipEl.setAttribute("popover", "manual");
69
+ tooltipEl.setAttribute("aria-hidden", "true");
70
+ const tooltipStyles = document.createElement("style");
71
+ tooltipStyles.textContent = `
72
+ .wm-tooltip {
73
+ position: fixed;
74
+ overflow: hidden;
75
+ pointer-events: none;
76
+ line-height: normal;
77
+ font-family: inherit;
78
+ font-size: 0.875rem;
79
+ text-transform: none;
80
+ font-weight: normal;
81
+ background: var(--wmcolor-tooltip-background);
82
+ color: var(--wmcolor-tooltip-text);
83
+ z-index: 999999;
84
+ max-width: var(--wmTooltipMaxWidth, 13.75rem);
85
+ margin-right: 1.5rem;
86
+ padding: 0.375rem;
87
+ transition-property: opacity;
88
+ transition-delay: 0s;
89
+ opacity: 0;
90
+ inset: unset;
91
+ top: 0;
92
+ left: 0;
93
+ transform: translateZ(0);
94
+ will-change: transform;
95
+ transform: translate(var(--wmTooltipLeft), var(--wmTooltipTop));
96
+ border: none;
97
+ }
98
+
99
+ .wm-tooltip:popover-open {
100
+ opacity: 0;
101
+ }
102
+
103
+ .wm-tooltip.show {
104
+ transition-delay: 500ms;
105
+ opacity: 1;
106
+ }
107
+ `;
108
+ const body = document.querySelector("body");
109
+ if (body) {
110
+ document.head.appendChild(tooltipStyles);
111
+ tooltipContainer.appendChild(tooltipEl);
112
+ body.appendChild(tooltipContainer);
113
+ }
114
+ else {
115
+ document.addEventListener("DOMContentLoaded", () => {
116
+ const body = document.querySelector("body");
117
+ document.head.appendChild(tooltipStyles);
118
+ tooltipContainer.appendChild(tooltipEl);
119
+ body.appendChild(tooltipContainer);
120
+ });
121
+ }
25
122
 
26
123
  /*
27
- Stencil Client Platform v4.21.0 | MIT Licensed | https://stenciljs.com
124
+ Stencil Client Platform v4.44.2 | MIT Licensed | https://stenciljs.com
28
125
  */
29
- var __defProp = Object.defineProperty;
30
- var __export = (target, all) => {
31
- for (var name in all)
32
- __defProp(target, name, { get: all[name], enumerable: true });
33
- };
34
- var hostRefs = /* @__PURE__ */ new WeakMap();
35
- var getHostRef = (ref) => hostRefs.get(ref);
36
- var registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
126
+
127
+
128
+ // src/utils/constants.ts
129
+ var SVG_NS = "http://www.w3.org/2000/svg";
130
+ var HTML_NS = "http://www.w3.org/1999/xhtml";
131
+
132
+ // src/utils/get-prop-descriptor.ts
133
+ function getPropertyDescriptor(obj, memberName, getOnly) {
134
+ const stopAt = typeof HTMLElement !== "undefined" ? HTMLElement.prototype : null;
135
+ while (obj && obj !== stopAt) {
136
+ const desc = Object.getOwnPropertyDescriptor(obj, memberName);
137
+ if (desc && (!getOnly || desc.get)) return desc;
138
+ obj = Object.getPrototypeOf(obj);
139
+ }
140
+ return void 0;
141
+ }
142
+
143
+ // src/utils/es2022-rewire-class-members.ts
144
+ var reWireGetterSetter = (instance, hostRef) => {
145
+ var _a;
146
+ const cmpMeta = hostRef.$cmpMeta$;
147
+ const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
148
+ members.map(([memberName, [memberFlags]]) => {
149
+ if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
150
+ const ogValue = instance[memberName];
151
+ const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName, true) || Object.getOwnPropertyDescriptor(instance, memberName);
152
+ if (ogDescriptor) {
153
+ Object.defineProperty(instance, memberName, {
154
+ get() {
155
+ return ogDescriptor.get.call(this);
156
+ },
157
+ set(newValue) {
158
+ ogDescriptor.set.call(this, newValue);
159
+ },
160
+ configurable: true,
161
+ enumerable: true
162
+ });
163
+ }
164
+ if (hostRef.$instanceValues$.has(memberName)) {
165
+ instance[memberName] = hostRef.$instanceValues$.get(memberName);
166
+ } else if (ogValue !== void 0) {
167
+ instance[memberName] = ogValue;
168
+ }
169
+ }
170
+ });
171
+ };
172
+
173
+ // src/client/client-host-ref.ts
174
+ var getHostRef = (ref) => {
175
+ if (ref.__stencil__getHostRef) {
176
+ return ref.__stencil__getHostRef();
177
+ }
178
+ return void 0;
179
+ };
180
+ var registerInstance = (lazyInstance, hostRef) => {
181
+ if (!hostRef) return;
182
+ lazyInstance.__stencil__getHostRef = () => hostRef;
183
+ hostRef.$lazyInstance$ = lazyInstance;
184
+ if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
185
+ reWireGetterSetter(lazyInstance, hostRef);
186
+ }
187
+ };
37
188
  var registerHost = (hostElement, cmpMeta) => {
38
189
  const hostRef = {
39
190
  $flags$: 0,
40
191
  $hostElement$: hostElement,
41
192
  $cmpMeta$: cmpMeta,
42
- $instanceValues$: /* @__PURE__ */ new Map()
193
+ $instanceValues$: /* @__PURE__ */ new Map(),
194
+ $serializerValues$: /* @__PURE__ */ new Map()
43
195
  };
44
196
  {
45
197
  hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
@@ -49,14 +201,21 @@ var registerHost = (hostElement, cmpMeta) => {
49
201
  hostElement["s-p"] = [];
50
202
  hostElement["s-rc"] = [];
51
203
  }
52
- return hostRefs.set(hostElement, hostRef);
204
+ {
205
+ hostRef.$fetchedCbList$ = [];
206
+ }
207
+ const ref = hostRef;
208
+ hostElement.__stencil__getHostRef = () => ref;
209
+ return ref;
53
210
  };
54
211
  var isMemberInElement = (elm, memberName) => memberName in elm;
55
212
  var consoleError = (e, el) => (0, console.error)(e, el);
56
213
 
57
214
  // src/client/client-load-module.ts
58
215
  var cmpModules = /* @__PURE__ */ new Map();
216
+ var failedLoadAttempts = /* @__PURE__ */ new Map();
59
217
  var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
218
+ var _a;
60
219
  const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
61
220
  const bundleId = cmpMeta.$lazyBundleId$;
62
221
  if (!bundleId) {
@@ -66,6 +225,11 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
66
225
  if (module) {
67
226
  return module[exportName];
68
227
  }
228
+ const retryCount = (_a = failedLoadAttempts.get(bundleId)) != null ? _a : 0;
229
+ const cacheBustParams = [
230
+ retryCount > 0 ? `s-retry=${retryCount}` : "",
231
+ ""
232
+ ].filter(Boolean).join("&");
69
233
 
70
234
  if (!hmrVersionId || !BUILD.hotModuleReplacement) {
71
235
  const processMod = importedModule => {
@@ -74,6 +238,18 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
74
238
  }
75
239
  switch(bundleId) {
76
240
 
241
+ case 'wm-tag-option.cjs':
242
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
243
+ /* webpackMode: "lazy" */
244
+ './wm-tag-option.cjs.entry.js')); }).then(processMod, consoleError);
245
+ case 'wm-wrapper.cjs':
246
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
247
+ /* webpackMode: "lazy" */
248
+ './wm-wrapper.cjs.entry.js')); }).then(processMod, consoleError);
249
+ case 'wm-chart-slice.cjs':
250
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
251
+ /* webpackMode: "lazy" */
252
+ './wm-chart-slice.cjs.entry.js')); }).then(processMod, consoleError);
77
253
  case 'wm-button.cjs':
78
254
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
79
255
  /* webpackMode: "lazy" */
@@ -106,10 +282,6 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
106
282
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
107
283
  /* webpackMode: "lazy" */
108
284
  './wm-input.cjs.entry.js')); }).then(processMod, consoleError);
109
- case 'wm-navigator.cjs':
110
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
111
- /* webpackMode: "lazy" */
112
- './wm-navigator.cjs.entry.js')); }).then(processMod, consoleError);
113
285
  case 'wm-pagination.cjs':
114
286
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
115
287
  /* webpackMode: "lazy" */
@@ -134,10 +306,6 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
134
306
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
135
307
  /* webpackMode: "lazy" */
136
308
  './wm-tag-input.cjs.entry.js')); }).then(processMod, consoleError);
137
- case 'wm-tag-option.cjs':
138
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
139
- /* webpackMode: "lazy" */
140
- './wm-tag-option.cjs.entry.js')); }).then(processMod, consoleError);
141
309
  case 'wm-textarea.cjs':
142
310
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
143
311
  /* webpackMode: "lazy" */
@@ -146,38 +314,6 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
146
314
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
147
315
  /* webpackMode: "lazy" */
148
316
  './wm-uploader.cjs.entry.js')); }).then(processMod, consoleError);
149
- case 'wm-wrapper.cjs':
150
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
151
- /* webpackMode: "lazy" */
152
- './wm-wrapper.cjs.entry.js')); }).then(processMod, consoleError);
153
- case 'wm-action-menu_2.cjs':
154
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
155
- /* webpackMode: "lazy" */
156
- './wm-action-menu_2.cjs.entry.js')); }).then(processMod, consoleError);
157
- case 'wm-option_2.cjs':
158
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
159
- /* webpackMode: "lazy" */
160
- './wm-option_2.cjs.entry.js')); }).then(processMod, consoleError);
161
- case 'wm-modal_3.cjs':
162
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
163
- /* webpackMode: "lazy" */
164
- './wm-modal_3.cjs.entry.js')); }).then(processMod, consoleError);
165
- case 'wm-modal-pss_3.cjs':
166
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
167
- /* webpackMode: "lazy" */
168
- './wm-modal-pss_3.cjs.entry.js')); }).then(processMod, consoleError);
169
- case 'wm-navigation_3.cjs':
170
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
171
- /* webpackMode: "lazy" */
172
- './wm-navigation_3.cjs.entry.js')); }).then(processMod, consoleError);
173
- case 'wm-progress-indicator_3.cjs':
174
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
175
- /* webpackMode: "lazy" */
176
- './wm-progress-indicator_3.cjs.entry.js')); }).then(processMod, consoleError);
177
- case 'wm-tab-item_3.cjs':
178
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
179
- /* webpackMode: "lazy" */
180
- './wm-tab-item_3.cjs.entry.js')); }).then(processMod, consoleError);
181
317
  case 'wm-chart-bar.cjs':
182
318
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
183
319
  /* webpackMode: "lazy" */
@@ -186,10 +322,6 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
186
322
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
187
323
  /* webpackMode: "lazy" */
188
324
  './wm-chart-column.cjs.entry.js')); }).then(processMod, consoleError);
189
- case 'wm-chart-slice.cjs':
190
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
191
- /* webpackMode: "lazy" */
192
- './wm-chart-slice.cjs.entry.js')); }).then(processMod, consoleError);
193
325
  case 'wm-date-range.cjs':
194
326
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
195
327
  /* webpackMode: "lazy" */
@@ -226,24 +358,63 @@ var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
226
358
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
227
359
  /* webpackMode: "lazy" */
228
360
  './priv-option-list.cjs.entry.js')); }).then(processMod, consoleError);
361
+ case 'wm-navigator.cjs':
362
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
363
+ /* webpackMode: "lazy" */
364
+ './wm-navigator.cjs.entry.js')); }).then(processMod, consoleError);
365
+ case 'wm-action-menu_2.cjs':
366
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
367
+ /* webpackMode: "lazy" */
368
+ './wm-action-menu_2.cjs.entry.js')); }).then(processMod, consoleError);
369
+ case 'wm-option_2.cjs':
370
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
371
+ /* webpackMode: "lazy" */
372
+ './wm-option_2.cjs.entry.js')); }).then(processMod, consoleError);
229
373
  case 'priv-chart-popover_2.cjs':
230
374
  return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
231
375
  /* webpackMode: "lazy" */
232
376
  './priv-chart-popover_2.cjs.entry.js')); }).then(processMod, consoleError);
377
+ case 'wm-progress-indicator_3.cjs':
378
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
379
+ /* webpackMode: "lazy" */
380
+ './wm-progress-indicator_3.cjs.entry.js')); }).then(processMod, consoleError);
381
+ case 'wm-modal_3.cjs':
382
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
383
+ /* webpackMode: "lazy" */
384
+ './wm-modal_3.cjs.entry.js')); }).then(processMod, consoleError);
385
+ case 'wm-modal-pss_3.cjs':
386
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
387
+ /* webpackMode: "lazy" */
388
+ './wm-modal-pss_3.cjs.entry.js')); }).then(processMod, consoleError);
389
+ case 'wm-navigation_3.cjs':
390
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
391
+ /* webpackMode: "lazy" */
392
+ './wm-navigation_3.cjs.entry.js')); }).then(processMod, consoleError);
393
+ case 'wm-tab-item_3.cjs':
394
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
395
+ /* webpackMode: "lazy" */
396
+ './wm-tab-item_3.cjs.entry.js')); }).then(processMod, consoleError);
233
397
  }
234
398
  }
235
- return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
399
+ return (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(
236
400
  /* @vite-ignore */
237
401
  /* webpackInclude: /\.entry\.js$/ */
238
402
  /* webpackExclude: /\.system\.entry\.js$/ */
239
403
  /* webpackMode: "lazy" */
240
- `./${bundleId}.entry.js${""}`
241
- )); }).then((importedModule) => {
242
- {
243
- cmpModules.set(bundleId, importedModule);
404
+ `./${bundleId}.entry.js${cacheBustParams ? "?" + cacheBustParams : ""}`
405
+ ).then(
406
+ (importedModule) => {
407
+ {
408
+ failedLoadAttempts.delete(bundleId);
409
+ cmpModules.set(bundleId, importedModule);
410
+ }
411
+ return importedModule[exportName];
412
+ },
413
+ (e) => {
414
+ failedLoadAttempts.set(bundleId, retryCount + 1);
415
+ consoleError(e, hostRef.$hostElement$);
244
416
  }
245
- return importedModule[exportName];
246
- }, consoleError);
417
+ );
247
418
  };
248
419
 
249
420
  // src/client/client-style.ts
@@ -251,8 +422,9 @@ var styles = /* @__PURE__ */ new Map();
251
422
  var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
252
423
  var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
253
424
  var XLINK_NS = "http://www.w3.org/1999/xlink";
425
+ var MAX_LAZY_LOAD_RETRIES = 3;
426
+ var LAZY_LOAD_RETRY_INTERVAL_MS = 1e3;
254
427
  var win = typeof window !== "undefined" ? window : {};
255
- var doc = win.document || { head: {} };
256
428
  var plt = {
257
429
  $flags$: 0,
258
430
  $resourcesUrl$: "",
@@ -263,9 +435,10 @@ var plt = {
263
435
  ce: (eventName, opts) => new CustomEvent(eventName, opts)
264
436
  };
265
437
  var supportsListenerOptions = /* @__PURE__ */ (() => {
438
+ var _a;
266
439
  let supportsListenerOptions2 = false;
267
440
  try {
268
- doc.addEventListener(
441
+ (_a = win.document) == null ? void 0 : _a.addEventListener(
269
442
  "e",
270
443
  null,
271
444
  Object.defineProperty({}, "passive", {
@@ -281,15 +454,23 @@ var supportsListenerOptions = /* @__PURE__ */ (() => {
281
454
  var promiseResolve = (v) => Promise.resolve(v);
282
455
  var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
283
456
  try {
457
+ if (!win.document.adoptedStyleSheets) {
458
+ return false;
459
+ }
284
460
  new CSSStyleSheet();
285
461
  return typeof new CSSStyleSheet().replaceSync === "function";
286
462
  } catch (e) {
287
463
  }
288
464
  return false;
289
465
  })() ;
466
+ var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
290
467
  var queuePending = false;
291
468
  var queueDomReads = [];
292
469
  var queueDomWrites = [];
470
+ var scheduleFlush = () => {
471
+ var _a;
472
+ return ((_a = win.document) == null ? void 0 : _a.hidden) ? nextTick(flush) : plt.raf(flush);
473
+ };
293
474
  var queueTask = (queue, write) => (cb) => {
294
475
  queue.push(cb);
295
476
  if (!queuePending) {
@@ -297,7 +478,7 @@ var queueTask = (queue, write) => (cb) => {
297
478
  if (write && plt.$flags$ & 4 /* queueSync */) {
298
479
  nextTick(flush);
299
480
  } else {
300
- plt.raf(flush);
481
+ scheduleFlush();
301
482
  }
302
483
  }
303
484
  };
@@ -316,79 +497,155 @@ var flush = () => {
316
497
  {
317
498
  consume(queueDomWrites);
318
499
  if (queuePending = queueDomReads.length > 0) {
319
- plt.raf(flush);
500
+ scheduleFlush();
320
501
  }
321
502
  }
322
503
  };
323
504
  var nextTick = (cb) => promiseResolve().then(cb);
324
505
  var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
325
506
 
326
- // src/utils/constants.ts
327
- var EMPTY_OBJ = {};
328
- var SVG_NS = "http://www.w3.org/2000/svg";
329
- var HTML_NS = "http://www.w3.org/1999/xhtml";
330
-
331
- // src/utils/helpers.ts
332
- var isDef = (v) => v != null;
333
- var isComplexType = (o) => {
334
- o = typeof o;
335
- return o === "object" || o === "function";
336
- };
337
-
338
- // src/utils/query-nonce-meta-tag-content.ts
339
- function queryNonceMetaTagContent(doc2) {
340
- var _a, _b, _c;
341
- return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
507
+ // src/utils/style.ts
508
+ function createStyleSheetIfNeededAndSupported(styles2) {
509
+ return void 0;
342
510
  }
343
511
 
344
- // src/utils/result.ts
345
- var result_exports = {};
346
- __export(result_exports, {
347
- err: () => err,
348
- map: () => map,
349
- ok: () => ok,
350
- unwrap: () => unwrap,
351
- unwrapErr: () => unwrapErr
352
- });
353
- var ok = (value) => ({
354
- isOk: true,
355
- isErr: false,
356
- value
357
- });
358
- var err = (value) => ({
359
- isOk: false,
360
- isErr: true,
361
- value
362
- });
363
- function map(result, fn) {
364
- if (result.isOk) {
365
- const val = fn(result.value);
366
- if (val instanceof Promise) {
367
- return val.then((newVal) => ok(newVal));
512
+ // src/utils/shadow-root.ts
513
+ var globalStyleSheet;
514
+ function createShadowRoot(cmpMeta) {
515
+ var _a;
516
+ const opts = { mode: "open" };
517
+ {
518
+ opts.delegatesFocus = !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */);
519
+ }
520
+ const shadowRoot = this.attachShadow(opts);
521
+ if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
522
+ if (globalStyleSheet) {
523
+ if (supportsMutableAdoptedStyleSheets) {
524
+ shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
368
525
  } else {
369
- return ok(val);
526
+ shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
370
527
  }
371
528
  }
372
- if (result.isErr) {
373
- const value = result.value;
374
- return err(value);
529
+ }
530
+ var updateFallbackSlotVisibility = (elm) => {
531
+ const childNodes = internalCall(elm, "childNodes");
532
+ if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
533
+ getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
534
+ if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
535
+ if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
536
+ slotNode.hidden = true;
537
+ } else {
538
+ slotNode.hidden = false;
539
+ }
540
+ }
541
+ });
375
542
  }
376
- throw "should never get here";
543
+ let i2 = 0;
544
+ for (i2 = 0; i2 < childNodes.length; i2++) {
545
+ const childNode = childNodes[i2];
546
+ if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
547
+ updateFallbackSlotVisibility(childNode);
548
+ }
549
+ }
550
+ };
551
+ var getSlottedChildNodes = (childNodes) => {
552
+ const result = [];
553
+ for (let i2 = 0; i2 < childNodes.length; i2++) {
554
+ const slottedNode = childNodes[i2]["s-nr"] || void 0;
555
+ if (slottedNode && slottedNode.isConnected) {
556
+ result.push(slottedNode);
557
+ }
558
+ }
559
+ return result;
560
+ };
561
+ function getHostSlotNodes(childNodes, hostName, slotName) {
562
+ let i2 = 0;
563
+ let slottedNodes = [];
564
+ let childNode;
565
+ for (; i2 < childNodes.length; i2++) {
566
+ childNode = childNodes[i2];
567
+ if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
568
+ slottedNodes.push(childNode);
569
+ if (typeof slotName !== "undefined") return slottedNodes;
570
+ }
571
+ slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
572
+ }
573
+ return slottedNodes;
377
574
  }
378
- var unwrap = (result) => {
379
- if (result.isOk) {
380
- return result.value;
381
- } else {
382
- throw result.value;
575
+ var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
576
+ const childNodes = [];
577
+ if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
578
+ let node = slot;
579
+ while (node = node.nextSibling) {
580
+ if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
581
+ }
582
+ return childNodes;
583
+ };
584
+ var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
585
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
586
+ if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
587
+ return true;
588
+ }
589
+ if (nodeToRelocate.getAttribute("slot") === slotName) {
590
+ return true;
591
+ }
592
+ return false;
383
593
  }
594
+ if (nodeToRelocate["s-sn"] === slotName) {
595
+ return true;
596
+ }
597
+ return slotName === "";
384
598
  };
385
- var unwrapErr = (result) => {
386
- if (result.isErr) {
387
- return result.value;
599
+ var getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
600
+ function patchSlotNode(node) {
601
+ if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
602
+ const assignedFactory = (elementsOnly) => (function(opts) {
603
+ const toReturn = [];
604
+ const slotName = this["s-sn"];
605
+ if (opts == null ? void 0 : opts.flatten) {
606
+ console.error(`
607
+ Flattening is not supported for Stencil non-shadow slots.
608
+ You can use \`.childNodes\` to nested slot fallback content.
609
+ If you have a particular use case, please open an issue on the Stencil repo.
610
+ `);
611
+ }
612
+ const parent = this["s-cr"].parentElement;
613
+ const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
614
+ slottedNodes.forEach((n) => {
615
+ if (slotName === getSlotName(n)) {
616
+ toReturn.push(n);
617
+ }
618
+ });
619
+ if (elementsOnly) {
620
+ return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
621
+ }
622
+ return toReturn;
623
+ }).bind(node);
624
+ node.assignedElements = assignedFactory(true);
625
+ node.assignedNodes = assignedFactory(false);
626
+ }
627
+ function dispatchSlotChangeEvent(elm) {
628
+ elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
629
+ }
630
+ function findSlotFromSlottedNode(slottedNode, parentHost) {
631
+ var _a;
632
+ parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
633
+ if (!parentHost) return { slotNode: null, slotName: "" };
634
+ const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
635
+ const childNodes = internalCall(parentHost, "childNodes");
636
+ const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
637
+ return { slotNode, slotName };
638
+ }
639
+ function internalCall(node, method) {
640
+ if ("__" + method in node) {
641
+ const toReturn = node["__" + method];
642
+ if (typeof toReturn !== "function") return toReturn;
643
+ return toReturn.bind(node);
388
644
  } else {
389
- throw result.value;
645
+ if (typeof node[method] !== "function") return node[method];
646
+ return node[method].bind(node);
390
647
  }
391
- };
648
+ }
392
649
  var createTime = (fnName, tagName = "") => {
393
650
  {
394
651
  return () => {
@@ -403,7 +660,144 @@ var uniqueTime = (key, measureText) => {
403
660
  };
404
661
  }
405
662
  };
663
+
664
+ // src/utils/query-nonce-meta-tag-content.ts
665
+ function queryNonceMetaTagContent(doc) {
666
+ var _a, _b, _c;
667
+ return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
668
+ }
669
+
670
+ // src/runtime/styles.ts
671
+ var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
672
+ var registerStyle = (scopeId2, cssText, allowCS) => {
673
+ let style = styles.get(scopeId2);
674
+ if (supportsConstructableStylesheets && allowCS) {
675
+ style = style || new CSSStyleSheet();
676
+ if (typeof style === "string") {
677
+ style = cssText;
678
+ } else {
679
+ style.replaceSync(cssText);
680
+ }
681
+ } else {
682
+ style = cssText;
683
+ }
684
+ styles.set(scopeId2, style);
685
+ };
686
+ var addStyle = (styleContainerNode, cmpMeta, mode) => {
687
+ var _a, _b, _c;
688
+ const scopeId2 = getScopeId(cmpMeta);
689
+ const style = styles.get(scopeId2);
690
+ if (!win.document) {
691
+ return scopeId2;
692
+ }
693
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
694
+ if (style) {
695
+ if (typeof style === "string") {
696
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
697
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
698
+ let styleElm;
699
+ if (!appliedStyles) {
700
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
701
+ }
702
+ if (!appliedStyles.has(scopeId2)) {
703
+ styleElm = win.document.createElement("style");
704
+ styleElm.textContent = style;
705
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
706
+ if (nonce != null) {
707
+ styleElm.setAttribute("nonce", nonce);
708
+ }
709
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
710
+ if (styleContainerNode.nodeName === "HEAD") {
711
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
712
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
713
+ styleContainerNode.insertBefore(
714
+ styleElm,
715
+ (referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
716
+ );
717
+ } else if ("host" in styleContainerNode) {
718
+ if (supportsConstructableStylesheets) {
719
+ const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
720
+ const stylesheet = new currentWindow.CSSStyleSheet();
721
+ stylesheet.replaceSync(style);
722
+ if (supportsMutableAdoptedStyleSheets) {
723
+ styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
724
+ } else {
725
+ styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
726
+ }
727
+ } else {
728
+ const existingStyleContainer = styleContainerNode.querySelector("style");
729
+ if (existingStyleContainer && true) {
730
+ existingStyleContainer.textContent = style + existingStyleContainer.textContent;
731
+ } else {
732
+ styleContainerNode.prepend(styleElm);
733
+ }
734
+ }
735
+ } else {
736
+ styleContainerNode.append(styleElm);
737
+ }
738
+ }
739
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
740
+ styleContainerNode.insertBefore(styleElm, null);
741
+ }
742
+ if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
743
+ styleElm.textContent += SLOT_FB_CSS;
744
+ }
745
+ if (appliedStyles) {
746
+ appliedStyles.add(scopeId2);
747
+ }
748
+ }
749
+ } else {
750
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
751
+ if (!appliedStyles) {
752
+ rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
753
+ }
754
+ if (!appliedStyles.has(scopeId2)) {
755
+ const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
756
+ let stylesheet;
757
+ if (style.constructor === currentWindow.CSSStyleSheet) {
758
+ stylesheet = style;
759
+ } else {
760
+ stylesheet = new currentWindow.CSSStyleSheet();
761
+ for (let i2 = 0; i2 < style.cssRules.length; i2++) {
762
+ stylesheet.insertRule(style.cssRules[i2].cssText, i2);
763
+ }
764
+ }
765
+ if (supportsMutableAdoptedStyleSheets) {
766
+ styleContainerNode.adoptedStyleSheets.push(stylesheet);
767
+ } else {
768
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
769
+ }
770
+ appliedStyles.add(scopeId2);
771
+ }
772
+ }
773
+ }
774
+ return scopeId2;
775
+ };
776
+ var attachStyles = (hostRef) => {
777
+ const cmpMeta = hostRef.$cmpMeta$;
778
+ const elm = hostRef.$hostElement$;
779
+ const flags = cmpMeta.$flags$;
780
+ const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
781
+ const scopeId2 = addStyle(
782
+ elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
783
+ cmpMeta);
784
+ if (flags & 10 /* needsScopedEncapsulation */) {
785
+ elm["s-sc"] = scopeId2;
786
+ elm.classList.add(scopeId2 + "-h");
787
+ }
788
+ endAttachStyles();
789
+ };
790
+ var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
791
+ var isComplexType = (o) => {
792
+ o = typeof o;
793
+ return o === "object" || o === "function";
794
+ };
795
+
796
+ // src/runtime/vdom/h.ts
406
797
  var h = (nodeName, vnodeData, ...children) => {
798
+ if (typeof nodeName === "string") {
799
+ nodeName = transformTag(nodeName);
800
+ }
407
801
  let child = null;
408
802
  let key = null;
409
803
  let slotName = null;
@@ -418,6 +812,11 @@ var h = (nodeName, vnodeData, ...children) => {
418
812
  } else if (child != null && typeof child !== "boolean") {
419
813
  if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
420
814
  child = String(child);
815
+ } else if (typeof nodeName !== "function" && child.$flags$ === void 0) {
816
+ {
817
+ consoleError("Invalid vNode child");
818
+ }
819
+ continue;
421
820
  }
422
821
  if (simple && lastSimple) {
423
822
  vNodeChildren[vNodeChildren.length - 1].$text$ += child;
@@ -460,7 +859,8 @@ var newVNode = (tag, text) => {
460
859
  const vnode = {
461
860
  $flags$: 0,
462
861
  $tag$: tag,
463
- $text$: text,
862
+ // Normalize undefined to null to prevent rendering "undefined" as text
863
+ $text$: text != null ? text : null,
464
864
  $elm$: null,
465
865
  $children$: null
466
866
  };
@@ -477,13 +877,42 @@ var newVNode = (tag, text) => {
477
877
  };
478
878
  var Host = {};
479
879
  var isHost = (node) => node && node.$tag$ === Host;
480
- var parsePropertyValue = (propValue, propType) => {
880
+
881
+ // src/runtime/normalize-watchers.ts
882
+ var normalizeWatchers = (raw) => {
883
+ if (!raw) return void 0;
884
+ const keys = Object.keys(raw);
885
+ if (keys.length === 0) return void 0;
886
+ let hasLegacy = false;
887
+ for (const propName of keys) {
888
+ if (hasLegacy) break;
889
+ for (const h2 of raw[propName]) {
890
+ if (typeof h2 === "string") {
891
+ hasLegacy = true;
892
+ break;
893
+ }
894
+ }
895
+ }
896
+ if (!hasLegacy) return raw;
897
+ const out = {};
898
+ for (const propName of keys) {
899
+ out[propName] = raw[propName].map(
900
+ (h2) => typeof h2 === "string" ? { [h2]: 0 } : h2
901
+ );
902
+ }
903
+ return out;
904
+ };
905
+
906
+ // src/runtime/parse-property-value.ts
907
+ var parsePropertyValue = (propValue, propType, isFormAssociated) => {
481
908
  if (propValue != null && !isComplexType(propValue)) {
482
909
  if (propType & 4 /* Boolean */) {
483
- return propValue === "false" ? false : propValue === "" || !!propValue;
910
+ {
911
+ return propValue === "false" ? false : propValue === "" || !!propValue;
912
+ }
484
913
  }
485
914
  if (propType & 2 /* Number */) {
486
- return parseFloat(propValue);
915
+ return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
487
916
  }
488
917
  if (propType & 1 /* String */) {
489
918
  return String(propValue);
@@ -492,7 +921,10 @@ var parsePropertyValue = (propValue, propType) => {
492
921
  }
493
922
  return propValue;
494
923
  };
495
- var getElement = (ref) => getHostRef(ref).$hostElement$ ;
924
+ var getElement = (ref) => {
925
+ var _a;
926
+ return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
927
+ };
496
928
 
497
929
  // src/runtime/event-emitter.ts
498
930
  var createEvent = (ref, name, flags) => {
@@ -513,204 +945,180 @@ var emitEvent = (elm, name, opts) => {
513
945
  elm.dispatchEvent(ev);
514
946
  return ev;
515
947
  };
516
- var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
517
- var registerStyle = (scopeId2, cssText, allowCS) => {
518
- let style = styles.get(scopeId2);
519
- if (supportsConstructableStylesheets && allowCS) {
520
- style = style || new CSSStyleSheet();
521
- if (typeof style === "string") {
522
- style = cssText;
523
- } else {
524
- style.replaceSync(cssText);
525
- }
526
- } else {
527
- style = cssText;
528
- }
529
- styles.set(scopeId2, style);
530
- };
531
- var addStyle = (styleContainerNode, cmpMeta, mode) => {
532
- var _a;
533
- const scopeId2 = getScopeId(cmpMeta);
534
- const style = styles.get(scopeId2);
535
- styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
536
- if (style) {
537
- if (typeof style === "string") {
538
- styleContainerNode = styleContainerNode.head || styleContainerNode;
539
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
540
- let styleElm;
541
- if (!appliedStyles) {
542
- rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
543
- }
544
- if (!appliedStyles.has(scopeId2)) {
545
- {
546
- styleElm = doc.createElement("style");
547
- styleElm.innerHTML = style;
548
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
549
- if (nonce != null) {
550
- styleElm.setAttribute("nonce", nonce);
551
- }
552
- if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
553
- if (styleContainerNode.nodeName === "HEAD") {
554
- const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
555
- const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : document.querySelector("style");
556
- styleContainerNode.insertBefore(styleElm, referenceNode2);
557
- } else if ("host" in styleContainerNode) {
558
- styleContainerNode.prepend(styleElm);
559
- } else {
560
- styleContainerNode.append(styleElm);
561
- }
562
- }
563
- if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
564
- styleContainerNode.insertBefore(styleElm, null);
565
- }
566
- }
567
- if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
568
- styleElm.innerHTML += SLOT_FB_CSS;
569
- }
570
- if (appliedStyles) {
571
- appliedStyles.add(scopeId2);
572
- }
573
- }
574
- } else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
575
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
576
- }
577
- }
578
- return scopeId2;
579
- };
580
- var attachStyles = (hostRef) => {
581
- const cmpMeta = hostRef.$cmpMeta$;
582
- const elm = hostRef.$hostElement$;
583
- const flags = cmpMeta.$flags$;
584
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
585
- const scopeId2 = addStyle(
586
- elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
587
- cmpMeta);
588
- if (flags & 10 /* needsScopedEncapsulation */ && flags & 2 /* scopedCssEncapsulation */) {
589
- elm["s-sc"] = scopeId2;
590
- elm.classList.add(scopeId2 + "-h");
948
+ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
949
+ if (oldValue === newValue) {
950
+ return;
591
951
  }
592
- endAttachStyles();
593
- };
594
- var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
595
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
596
- if (oldValue !== newValue) {
597
- let isProp = isMemberInElement(elm, memberName);
598
- let ln = memberName.toLowerCase();
599
- if (memberName === "class") {
600
- const classList = elm.classList;
601
- const oldClasses = parseClassList(oldValue);
602
- const newClasses = parseClassList(newValue);
952
+ let isProp = isMemberInElement(elm, memberName);
953
+ let ln = memberName.toLowerCase();
954
+ if (memberName === "class") {
955
+ const classList = elm.classList;
956
+ const oldClasses = parseClassList(oldValue);
957
+ let newClasses = parseClassList(newValue);
958
+ {
603
959
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
604
960
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
605
- } else if (memberName === "style") {
606
- {
607
- for (const prop in oldValue) {
608
- if (!newValue || newValue[prop] == null) {
609
- if (prop.includes("-")) {
610
- elm.style.removeProperty(prop);
611
- } else {
612
- elm.style[prop] = "";
613
- }
614
- }
615
- }
616
- }
617
- for (const prop in newValue) {
618
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
961
+ }
962
+ } else if (memberName === "style") {
963
+ {
964
+ for (const prop in oldValue) {
965
+ if (!newValue || newValue[prop] == null) {
619
966
  if (prop.includes("-")) {
620
- elm.style.setProperty(prop, newValue[prop]);
967
+ elm.style.removeProperty(prop);
621
968
  } else {
622
- elm.style[prop] = newValue[prop];
969
+ elm.style[prop] = "";
623
970
  }
624
971
  }
625
972
  }
626
- } else if (memberName === "key") ; else if (memberName === "ref") {
627
- if (newValue) {
628
- newValue(elm);
973
+ }
974
+ for (const prop in newValue) {
975
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
976
+ if (prop.includes("-")) {
977
+ elm.style.setProperty(prop, newValue[prop]);
978
+ } else {
979
+ elm.style[prop] = newValue[prop];
980
+ }
629
981
  }
630
- } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
631
- if (memberName[2] === "-") {
632
- memberName = memberName.slice(3);
633
- } else if (isMemberInElement(win, ln)) {
634
- memberName = ln.slice(2);
635
- } else {
636
- memberName = ln[2] + memberName.slice(3);
982
+ }
983
+ } else if (memberName === "key") ; else if (memberName === "ref") {
984
+ if (newValue) {
985
+ queueRefAttachment(newValue, elm);
986
+ }
987
+ } else if ((!isProp ) && memberName[0] === "o" && memberName[1] === "n") {
988
+ if (memberName[2] === "-") {
989
+ memberName = memberName.slice(3);
990
+ } else if (isMemberInElement(win, ln)) {
991
+ memberName = ln.slice(2);
992
+ } else {
993
+ memberName = ln[2] + memberName.slice(3);
994
+ }
995
+ if (oldValue || newValue) {
996
+ const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
997
+ memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
998
+ if (oldValue) {
999
+ plt.rel(elm, memberName, oldValue, capture);
637
1000
  }
638
- if (oldValue || newValue) {
639
- const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX);
640
- memberName = memberName.replace(CAPTURE_EVENT_REGEX, "");
641
- if (oldValue) {
642
- plt.rel(elm, memberName, oldValue, capture);
643
- }
644
- if (newValue) {
645
- plt.ael(elm, memberName, newValue, capture);
1001
+ if (newValue) {
1002
+ plt.ael(elm, memberName, newValue, capture);
1003
+ }
1004
+ }
1005
+ } else if (memberName[0] === "a" && memberName.startsWith("attr:")) {
1006
+ const propName = memberName.slice(5);
1007
+ let attrName;
1008
+ {
1009
+ const hostRef = getHostRef(elm);
1010
+ if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
1011
+ const memberMeta = hostRef.$cmpMeta$.$members$[propName];
1012
+ if (memberMeta && memberMeta[1]) {
1013
+ attrName = memberMeta[1];
646
1014
  }
647
1015
  }
1016
+ }
1017
+ if (!attrName) {
1018
+ attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1019
+ }
1020
+ if (newValue == null || newValue === false) {
1021
+ if (newValue !== false || elm.getAttribute(attrName) === "") {
1022
+ elm.removeAttribute(attrName);
1023
+ }
648
1024
  } else {
649
- const isComplex = isComplexType(newValue);
650
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
651
- try {
652
- if (!elm.tagName.includes("-")) {
653
- const n = newValue == null ? "" : newValue;
654
- if (memberName === "list") {
655
- isProp = false;
656
- } else if (oldValue == null || elm[memberName] != n) {
657
- if (typeof elm.__lookupSetter__(memberName) === "function") {
658
- elm[memberName] = n;
659
- } else {
660
- elm.setAttribute(memberName, n);
661
- }
1025
+ elm.setAttribute(attrName, newValue === true ? "" : newValue);
1026
+ }
1027
+ return;
1028
+ } else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
1029
+ const propName = memberName.slice(5);
1030
+ try {
1031
+ elm[propName] = newValue;
1032
+ } catch (e) {
1033
+ }
1034
+ return;
1035
+ } else {
1036
+ const isComplex = isComplexType(newValue);
1037
+ if ((isProp || isComplex && newValue !== null) && !isSvg) {
1038
+ try {
1039
+ if (!elm.tagName.includes("-")) {
1040
+ const n = newValue == null ? "" : newValue;
1041
+ if (memberName === "list") {
1042
+ isProp = false;
1043
+ } else if (oldValue == null || elm[memberName] !== n) {
1044
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
1045
+ elm[memberName] = n;
1046
+ } else {
1047
+ elm.setAttribute(memberName, n);
662
1048
  }
663
- } else {
664
- elm[memberName] = newValue;
665
1049
  }
666
- } catch (e) {
1050
+ } else if (elm[memberName] !== newValue) {
1051
+ elm[memberName] = newValue;
667
1052
  }
1053
+ } catch (e) {
668
1054
  }
669
- let xlink = false;
670
- {
671
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
672
- memberName = ln;
673
- xlink = true;
674
- }
1055
+ }
1056
+ let xlink = false;
1057
+ {
1058
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
1059
+ memberName = ln;
1060
+ xlink = true;
675
1061
  }
676
- if (newValue == null || newValue === false) {
677
- if (newValue !== false || elm.getAttribute(memberName) === "") {
678
- if (xlink) {
679
- elm.removeAttributeNS(XLINK_NS, memberName);
680
- } else {
681
- elm.removeAttribute(memberName);
682
- }
683
- }
684
- } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
685
- newValue = newValue === true ? "" : newValue;
1062
+ }
1063
+ if (newValue == null || newValue === false) {
1064
+ if (newValue !== false || elm.getAttribute(memberName) === "" || flags & 4 /* isHost */ && !isEnumeratedAttribute(memberName)) {
686
1065
  if (xlink) {
687
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
1066
+ elm.removeAttributeNS(XLINK_NS, memberName);
688
1067
  } else {
689
- elm.setAttribute(memberName, newValue);
1068
+ elm.removeAttribute(memberName);
690
1069
  }
691
1070
  }
1071
+ } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex && elm.nodeType === 1 /* ElementNode */) {
1072
+ newValue = newValue === true ? "" : newValue;
1073
+ if (xlink) {
1074
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
1075
+ } else {
1076
+ elm.setAttribute(memberName, newValue);
1077
+ }
692
1078
  }
693
1079
  }
694
1080
  };
1081
+ var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set(["draggable", "contenteditable", "spellcheck"]);
1082
+ var isEnumeratedAttribute = (attrName) => ENUMERATED_ATTRIBUTES.has(attrName) || attrName.startsWith("aria-");
695
1083
  var parseClassListRegex = /\s/;
696
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
1084
+ var parseClassList = (value) => {
1085
+ if (typeof value === "object" && value && "baseVal" in value) {
1086
+ value = value.baseVal;
1087
+ }
1088
+ if (!value || typeof value !== "string") {
1089
+ return [];
1090
+ }
1091
+ return value.split(parseClassListRegex);
1092
+ };
697
1093
  var CAPTURE_EVENT_SUFFIX = "Capture";
698
1094
  var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$");
699
1095
 
700
1096
  // src/runtime/vdom/update-element.ts
701
- var updateElement = (oldVnode, newVnode, isSvgMode2) => {
1097
+ var updateElement = (oldVnode, newVnode, isSvgMode2, isInitialRender) => {
702
1098
  const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
703
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
704
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
1099
+ const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
1100
+ const newVnodeAttrs = newVnode.$attrs$ || {};
705
1101
  {
706
1102
  for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) {
707
1103
  if (!(memberName in newVnodeAttrs)) {
708
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
1104
+ setAccessor(
1105
+ elm,
1106
+ memberName,
1107
+ oldVnodeAttrs[memberName],
1108
+ void 0,
1109
+ isSvgMode2,
1110
+ newVnode.$flags$);
709
1111
  }
710
1112
  }
711
1113
  }
712
1114
  for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) {
713
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
1115
+ setAccessor(
1116
+ elm,
1117
+ memberName,
1118
+ oldVnodeAttrs[memberName],
1119
+ newVnodeAttrs[memberName],
1120
+ isSvgMode2,
1121
+ newVnode.$flags$);
714
1122
  }
715
1123
  };
716
1124
  function sortedAttrNames(attrNames) {
@@ -722,16 +1130,15 @@ function sortedAttrNames(attrNames) {
722
1130
  attrNames
723
1131
  );
724
1132
  }
725
-
726
- // src/runtime/vdom/vdom-render.ts
727
- var scopeId;
728
1133
  var contentRef;
729
1134
  var hostTagName;
730
1135
  var useNativeShadowDom = false;
731
1136
  var checkSlotFallbackVisibility = false;
732
1137
  var checkSlotRelocate = false;
733
1138
  var isSvgMode = false;
734
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
1139
+ var refCallbacksToRemove = [];
1140
+ var refCallbacksToAttach = [];
1141
+ var createElm = (oldParentVNode, newParentVNode, childIndex) => {
735
1142
  var _a;
736
1143
  const newVNode2 = newParentVNode.$children$[childIndex];
737
1144
  let i2 = 0;
@@ -741,9 +1148,6 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
741
1148
  if (!useNativeShadowDom) {
742
1149
  checkSlotRelocate = true;
743
1150
  if (newVNode2.$tag$ === "slot") {
744
- if (scopeId) {
745
- parentElm.classList.add(scopeId + "-s");
746
- }
747
1151
  newVNode2.$flags$ |= newVNode2.$children$ ? (
748
1152
  // slot element has fallback content
749
1153
  // still create an element that "mocks" the slot element
@@ -756,15 +1160,21 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
756
1160
  );
757
1161
  }
758
1162
  }
759
- if (newVNode2.$text$ !== null) {
760
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
1163
+ if (newVNode2.$text$ != null) {
1164
+ elm = newVNode2.$elm$ = win.document.createTextNode(newVNode2.$text$);
761
1165
  } else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
762
- elm = newVNode2.$elm$ = doc.createTextNode("");
1166
+ elm = newVNode2.$elm$ = win.document.createTextNode("");
1167
+ {
1168
+ updateElement(null, newVNode2, isSvgMode);
1169
+ }
763
1170
  } else {
764
1171
  if (!isSvgMode) {
765
1172
  isSvgMode = newVNode2.$tag$ === "svg";
766
1173
  }
767
- elm = newVNode2.$elm$ = doc.createElementNS(
1174
+ if (!win.document) {
1175
+ throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
1176
+ }
1177
+ elm = newVNode2.$elm$ = win.document.createElementNS(
768
1178
  isSvgMode ? SVG_NS : HTML_NS,
769
1179
  !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$
770
1180
  ) ;
@@ -774,16 +1184,12 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
774
1184
  {
775
1185
  updateElement(null, newVNode2, isSvgMode);
776
1186
  }
777
- const rootNode = elm.getRootNode();
778
- const isElementWithinShadowRoot = !rootNode.querySelector("body");
779
- if (!isElementWithinShadowRoot && BUILD.scoped && isDef(scopeId) && elm["s-si"] !== scopeId) {
780
- elm.classList.add(elm["s-si"] = scopeId);
781
- }
782
1187
  if (newVNode2.$children$) {
1188
+ const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
783
1189
  for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
784
- childNode = createElm(oldParentVNode, newVNode2, i2, elm);
1190
+ childNode = createElm(oldParentVNode, newVNode2, i2);
785
1191
  if (childNode) {
786
- elm.appendChild(childNode);
1192
+ appendTarget.appendChild(childNode);
787
1193
  }
788
1194
  }
789
1195
  }
@@ -802,20 +1208,39 @@ var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
802
1208
  elm["s-cr"] = contentRef;
803
1209
  elm["s-sn"] = newVNode2.$name$ || "";
804
1210
  elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref;
1211
+ patchSlotNode(elm);
805
1212
  oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
806
1213
  if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
807
- {
808
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
809
- }
1214
+ relocateToHostRoot(oldParentVNode.$elm$);
810
1215
  }
811
1216
  }
812
1217
  }
813
1218
  return elm;
814
1219
  };
1220
+ var relocateToHostRoot = (parentElm) => {
1221
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
1222
+ const host = parentElm.closest(hostTagName.toLowerCase());
1223
+ if (host != null) {
1224
+ const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
1225
+ (ref) => ref["s-cr"]
1226
+ );
1227
+ const childNodeArray = Array.from(
1228
+ parentElm.__childNodes || parentElm.childNodes
1229
+ );
1230
+ for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
1231
+ if (childNode["s-sh"] != null) {
1232
+ insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
1233
+ childNode["s-sh"] = void 0;
1234
+ checkSlotRelocate = true;
1235
+ }
1236
+ }
1237
+ }
1238
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
1239
+ };
815
1240
  var putBackInOriginalLocation = (parentElm, recursive) => {
816
1241
  plt.$flags$ |= 1 /* isTmpDisconnected */;
817
- const oldSlotChildNodes = Array.from(parentElm.childNodes);
818
- if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) {
1242
+ const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
1243
+ if (parentElm["s-sr"]) {
819
1244
  let node = parentElm;
820
1245
  while (node = node.nextSibling) {
821
1246
  if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) {
@@ -826,7 +1251,7 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
826
1251
  for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
827
1252
  const childNode = oldSlotChildNodes[i2];
828
1253
  if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
829
- insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode));
1254
+ insertBefore(referenceNode(childNode).parentNode, childNode, referenceNode(childNode));
830
1255
  childNode["s-ol"].remove();
831
1256
  childNode["s-ol"] = void 0;
832
1257
  childNode["s-sh"] = void 0;
@@ -836,7 +1261,7 @@ var putBackInOriginalLocation = (parentElm, recursive) => {
836
1261
  putBackInOriginalLocation(childNode, recursive);
837
1262
  }
838
1263
  }
839
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1264
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
840
1265
  };
841
1266
  var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
842
1267
  let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
@@ -844,9 +1269,12 @@ var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
844
1269
  if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
845
1270
  containerElm = containerElm.shadowRoot;
846
1271
  }
1272
+ if (parentVNode.$tag$ === "template") {
1273
+ containerElm = containerElm.content;
1274
+ }
847
1275
  for (; startIdx <= endIdx; ++startIdx) {
848
1276
  if (vnodes[startIdx]) {
849
- childNode = createElm(null, parentVNode, startIdx, parentElm);
1277
+ childNode = createElm(null, parentVNode, startIdx);
850
1278
  if (childNode) {
851
1279
  vnodes[startIdx].$elm$ = childNode;
852
1280
  insertBefore(containerElm, childNode, referenceNode(before) );
@@ -887,6 +1315,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
887
1315
  let newEndVnode = newCh[newEndIdx];
888
1316
  let node;
889
1317
  let elmToMove;
1318
+ const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
890
1319
  while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
891
1320
  if (oldStartVnode == null) {
892
1321
  oldStartVnode = oldCh[++oldStartIdx];
@@ -909,7 +1338,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
909
1338
  putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
910
1339
  }
911
1340
  patch(oldStartVnode, newEndVnode, isInitialRender);
912
- insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
1341
+ insertBefore(containerElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
913
1342
  oldStartVnode = oldCh[++oldStartIdx];
914
1343
  newEndVnode = newCh[--newEndIdx];
915
1344
  } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
@@ -917,7 +1346,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
917
1346
  putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
918
1347
  }
919
1348
  patch(oldEndVnode, newStartVnode, isInitialRender);
920
- insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
1349
+ insertBefore(containerElm, oldEndVnode.$elm$, oldStartVnode.$elm$);
921
1350
  oldEndVnode = oldCh[--oldEndIdx];
922
1351
  newStartVnode = newCh[++newStartIdx];
923
1352
  } else {
@@ -933,7 +1362,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
933
1362
  if (idxInOld >= 0) {
934
1363
  elmToMove = oldCh[idxInOld];
935
1364
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
936
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
1365
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
937
1366
  } else {
938
1367
  patch(elmToMove, newStartVnode, isInitialRender);
939
1368
  oldCh[idxInOld] = void 0;
@@ -941,12 +1370,16 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
941
1370
  }
942
1371
  newStartVnode = newCh[++newStartIdx];
943
1372
  } else {
944
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx, parentElm);
1373
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
945
1374
  newStartVnode = newCh[++newStartIdx];
946
1375
  }
947
1376
  if (node) {
948
1377
  {
949
- insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$));
1378
+ insertBefore(
1379
+ referenceNode(oldStartVnode.$elm$).parentNode,
1380
+ node,
1381
+ referenceNode(oldStartVnode.$elm$)
1382
+ );
950
1383
  }
951
1384
  }
952
1385
  }
@@ -967,28 +1400,19 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
967
1400
  var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
968
1401
  if (leftVNode.$tag$ === rightVNode.$tag$) {
969
1402
  if (leftVNode.$tag$ === "slot") {
970
- if (
971
- // The component gets hydrated and no VDOM has been initialized.
972
- // Here the comparison can't happen as $name$ property is not set for `leftNode`.
973
- "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many
974
- // hydration comments to be removed
975
- leftVNode.$elm$.nodeType !== 8
976
- ) {
977
- return false;
978
- }
979
1403
  return leftVNode.$name$ === rightVNode.$name$;
980
1404
  }
981
1405
  if (!isInitialRender) {
982
1406
  return leftVNode.$key$ === rightVNode.$key$;
983
1407
  }
1408
+ if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
1409
+ leftVNode.$key$ = rightVNode.$key$;
1410
+ }
984
1411
  return true;
985
1412
  }
986
1413
  return false;
987
1414
  };
988
- var referenceNode = (node) => {
989
- return node && node["s-ol"] || node;
990
- };
991
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
1415
+ var referenceNode = (node) => node && node["s-ol"] || node;
992
1416
  var patch = (oldVNode, newVNode2, isInitialRender = false) => {
993
1417
  const elm = newVNode2.$elm$ = oldVNode.$elm$;
994
1418
  const oldChildren = oldVNode.$children$;
@@ -996,14 +1420,18 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
996
1420
  const tag = newVNode2.$tag$;
997
1421
  const text = newVNode2.$text$;
998
1422
  let defaultHolder;
999
- if (text === null) {
1423
+ if (text == null) {
1000
1424
  {
1001
1425
  isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
1002
1426
  }
1003
1427
  {
1004
- if (tag === "slot" && !useNativeShadowDom) ; else {
1005
- updateElement(oldVNode, newVNode2, isSvgMode);
1428
+ if (tag === "slot" && !useNativeShadowDom) {
1429
+ if (oldVNode.$name$ !== newVNode2.$name$) {
1430
+ newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
1431
+ relocateToHostRoot(newVNode2.$elm$.parentElement);
1432
+ }
1006
1433
  }
1434
+ updateElement(oldVNode, newVNode2, isSvgMode);
1007
1435
  }
1008
1436
  if (oldChildren !== null && newChildren !== null) {
1009
1437
  updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender);
@@ -1017,7 +1445,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1017
1445
  !isInitialRender && BUILD.updatable && oldChildren !== null
1018
1446
  ) {
1019
1447
  removeVnodes(oldChildren, 0, oldChildren.length - 1);
1020
- }
1448
+ } else ;
1021
1449
  if (isSvgMode && tag === "svg") {
1022
1450
  isSvgMode = false;
1023
1451
  }
@@ -1027,45 +1455,22 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
1027
1455
  elm.data = text;
1028
1456
  }
1029
1457
  };
1030
- var updateFallbackSlotVisibility = (elm) => {
1031
- const childNodes = elm.childNodes;
1032
- for (const childNode of childNodes) {
1033
- if (childNode.nodeType === 1 /* ElementNode */) {
1034
- if (childNode["s-sr"]) {
1035
- const slotName = childNode["s-sn"];
1036
- childNode.hidden = false;
1037
- for (const siblingNode of childNodes) {
1038
- if (siblingNode !== childNode) {
1039
- if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") {
1040
- if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) {
1041
- childNode.hidden = true;
1042
- break;
1043
- }
1044
- } else {
1045
- if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") {
1046
- childNode.hidden = true;
1047
- break;
1048
- }
1049
- }
1050
- }
1051
- }
1052
- }
1053
- updateFallbackSlotVisibility(childNode);
1054
- }
1055
- }
1056
- };
1057
1458
  var relocateNodes = [];
1058
1459
  var markSlotContentForRelocation = (elm) => {
1059
1460
  let node;
1060
1461
  let hostContentNodes;
1061
1462
  let j;
1062
- for (const childNode of elm.childNodes) {
1463
+ const children = elm.__childNodes || elm.childNodes;
1464
+ for (const childNode of children) {
1063
1465
  if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
1064
- hostContentNodes = node.parentNode.childNodes;
1466
+ hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes;
1065
1467
  const slotName = childNode["s-sn"];
1066
1468
  for (j = hostContentNodes.length - 1; j >= 0; j--) {
1067
1469
  node = hostContentNodes[j];
1068
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!BUILD.experimentalSlotFixes )) {
1470
+ if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && // let an exact named-slot match override a stale default-slot claim. Skip this for
1471
+ // `slotName === ''` itself - a matched default node's cached `s-sn` is `''` too, which
1472
+ // would trivially "match" on every re-render and force pointless re-insertion.
1473
+ (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"] || slotName !== "" && getSlotName(node) === slotName)) {
1069
1474
  if (isNodeLocatedInSlot(node, slotName)) {
1070
1475
  let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
1071
1476
  checkSlotFallbackVisibility = true;
@@ -1103,43 +1508,57 @@ var markSlotContentForRelocation = (elm) => {
1103
1508
  }
1104
1509
  }
1105
1510
  };
1106
- var isNodeLocatedInSlot = (nodeToRelocate, slotName) => {
1107
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1108
- if (nodeToRelocate.getAttribute("slot") === null && slotName === "") {
1109
- return true;
1110
- }
1111
- if (nodeToRelocate.getAttribute("slot") === slotName) {
1112
- return true;
1511
+ var nullifyVNodeRefs = (vNode) => {
1512
+ {
1513
+ if (vNode.$attrs$ && vNode.$attrs$.ref) {
1514
+ refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
1113
1515
  }
1114
- return false;
1516
+ vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1115
1517
  }
1116
- if (nodeToRelocate["s-sn"] === slotName) {
1117
- return true;
1518
+ };
1519
+ var queueRefAttachment = (refCallback, elm) => {
1520
+ {
1521
+ refCallbacksToAttach.push(() => refCallback(elm));
1118
1522
  }
1119
- return slotName === "";
1120
1523
  };
1121
- var nullifyVNodeRefs = (vNode) => {
1524
+ var flushQueuedRefCallbacks = () => {
1122
1525
  {
1123
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1124
- vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
1526
+ refCallbacksToRemove.forEach((cb) => cb());
1527
+ refCallbacksToRemove.length = 0;
1528
+ refCallbacksToAttach.forEach((cb) => cb());
1529
+ refCallbacksToAttach.length = 0;
1125
1530
  }
1126
1531
  };
1127
- var insertBefore = (parent, newNode, reference) => {
1128
- const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference);
1129
- return inserted;
1532
+ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
1533
+ {
1534
+ if (typeof newNode["s-sn"] === "string") {
1535
+ parent.insertBefore(newNode, reference);
1536
+ const { slotNode } = findSlotFromSlottedNode(newNode);
1537
+ if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode);
1538
+ return newNode;
1539
+ }
1540
+ }
1541
+ if ((parent == null ? void 0 : parent.__insertBefore)) {
1542
+ return parent.__insertBefore(newNode, reference);
1543
+ } else {
1544
+ return parent == null ? void 0 : parent.insertBefore(newNode, reference);
1545
+ }
1130
1546
  };
1131
1547
  var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1132
- var _a, _b, _c, _d;
1548
+ var _a, _b, _c, _d, _e;
1133
1549
  const hostElm = hostRef.$hostElement$;
1134
1550
  const cmpMeta = hostRef.$cmpMeta$;
1135
1551
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1136
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1552
+ const isHostElement = isHost(renderFnResults);
1553
+ const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
1137
1554
  hostTagName = hostElm.tagName;
1138
1555
  if (cmpMeta.$attrsToReflect$) {
1139
1556
  rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1140
- cmpMeta.$attrsToReflect$.map(
1141
- ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]
1142
- );
1557
+ cmpMeta.$attrsToReflect$.forEach(([propName, attribute]) => {
1558
+ {
1559
+ rootVnode.$attrs$[attribute] = hostElm[propName];
1560
+ }
1561
+ });
1143
1562
  }
1144
1563
  if (isInitialLoad && rootVnode.$attrs$) {
1145
1564
  for (const key of Object.keys(rootVnode.$attrs$)) {
@@ -1152,10 +1571,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1152
1571
  rootVnode.$flags$ |= 4 /* isHost */;
1153
1572
  hostRef.$vnode$ = rootVnode;
1154
1573
  rootVnode.$elm$ = oldVNode.$elm$ = hostElm.shadowRoot || hostElm ;
1155
- {
1156
- scopeId = hostElm["s-sc"];
1157
- }
1158
- useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1574
+ useNativeShadowDom = !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && !(cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */);
1159
1575
  {
1160
1576
  contentRef = hostElm["s-cr"];
1161
1577
  checkSlotFallbackVisibility = false;
@@ -1167,23 +1583,31 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1167
1583
  markSlotContentForRelocation(rootVnode.$elm$);
1168
1584
  for (const relocateData of relocateNodes) {
1169
1585
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1170
- if (!nodeToRelocate["s-ol"]) {
1171
- const orgLocationNode = doc.createTextNode("");
1586
+ if (!nodeToRelocate["s-ol"] && win.document) {
1587
+ const orgLocationNode = win.document.createTextNode("");
1172
1588
  orgLocationNode["s-nr"] = nodeToRelocate;
1173
- insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
1589
+ insertBefore(
1590
+ nodeToRelocate.parentNode,
1591
+ nodeToRelocate["s-ol"] = orgLocationNode,
1592
+ nodeToRelocate,
1593
+ isInitialLoad
1594
+ );
1174
1595
  }
1175
1596
  }
1176
1597
  for (const relocateData of relocateNodes) {
1177
1598
  const nodeToRelocate = relocateData.$nodeToRelocate$;
1178
1599
  const slotRefNode = relocateData.$slotRefNode$;
1600
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && isInitialLoad) {
1601
+ nodeToRelocate["s-ih"] = (_a = nodeToRelocate.hidden) != null ? _a : false;
1602
+ }
1179
1603
  if (slotRefNode) {
1180
1604
  const parentNodeRef = slotRefNode.parentNode;
1181
1605
  let insertBeforeNode = slotRefNode.nextSibling;
1182
- {
1183
- let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling;
1606
+ if (insertBeforeNode && insertBeforeNode.nodeType === 1 /* ElementNode */) {
1607
+ let orgLocationNode = (_b = nodeToRelocate["s-ol"]) == null ? void 0 : _b.previousSibling;
1184
1608
  while (orgLocationNode) {
1185
- let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null;
1186
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
1609
+ let refNode = (_c = orgLocationNode["s-nr"]) != null ? _c : null;
1610
+ if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === (refNode.__parentNode || refNode.parentNode)) {
1187
1611
  refNode = refNode.nextSibling;
1188
1612
  while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) {
1189
1613
  refNode = refNode == null ? void 0 : refNode.nextSibling;
@@ -1196,41 +1620,72 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
1196
1620
  orgLocationNode = orgLocationNode.previousSibling;
1197
1621
  }
1198
1622
  }
1199
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
1623
+ const parent = nodeToRelocate.__parentNode || nodeToRelocate.parentNode;
1624
+ const nextSibling = nodeToRelocate.__nextSibling || nodeToRelocate.nextSibling;
1625
+ if (!insertBeforeNode && parentNodeRef !== parent || nextSibling !== insertBeforeNode) {
1200
1626
  if (nodeToRelocate !== insertBeforeNode) {
1201
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
1202
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
1627
+ insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode, isInitialLoad);
1628
+ if (nodeToRelocate.nodeType === 8 /* CommentNode */ && nodeToRelocate.nodeValue.startsWith("s-nt-")) {
1629
+ const textNode = win.document.createTextNode(nodeToRelocate.nodeValue.replace(/^s-nt-/, ""));
1630
+ textNode["s-hn"] = nodeToRelocate["s-hn"];
1631
+ textNode["s-sn"] = nodeToRelocate["s-sn"];
1632
+ textNode["s-sh"] = nodeToRelocate["s-sh"];
1633
+ textNode["s-sr"] = nodeToRelocate["s-sr"];
1634
+ textNode["s-ol"] = nodeToRelocate["s-ol"];
1635
+ textNode["s-ol"]["s-nr"] = textNode;
1636
+ insertBefore(nodeToRelocate.parentNode, textNode, nodeToRelocate, isInitialLoad);
1637
+ nodeToRelocate.parentNode.removeChild(nodeToRelocate);
1203
1638
  }
1204
- insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode);
1205
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1206
- nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false;
1639
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */ && nodeToRelocate.tagName !== "SLOT-FB") {
1640
+ nodeToRelocate.hidden = (_d = nodeToRelocate["s-ih"]) != null ? _d : false;
1207
1641
  }
1208
1642
  }
1209
1643
  }
1210
- nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate);
1211
- } else {
1212
- if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1213
- if (isInitialLoad) {
1214
- nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false;
1215
- }
1216
- nodeToRelocate.hidden = true;
1217
- }
1644
+ nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](slotRefNode);
1645
+ } else if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1646
+ nodeToRelocate.hidden = true;
1218
1647
  }
1219
1648
  }
1220
1649
  }
1221
1650
  if (checkSlotFallbackVisibility) {
1222
1651
  updateFallbackSlotVisibility(rootVnode.$elm$);
1223
1652
  }
1224
- plt.$flags$ &= ~1 /* isTmpDisconnected */;
1653
+ plt.$flags$ &= -2 /* isTmpDisconnected */;
1225
1654
  relocateNodes.length = 0;
1226
1655
  }
1656
+ if (!useNativeShadowDom && !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) && hostElm["s-cr"]) {
1657
+ const children = rootVnode.$elm$.__childNodes || rootVnode.$elm$.childNodes;
1658
+ for (const childNode of children) {
1659
+ if (childNode["s-hn"] !== hostTagName && !childNode["s-sh"]) {
1660
+ if (isInitialLoad && childNode["s-ih"] == null) {
1661
+ childNode["s-ih"] = (_e = childNode.hidden) != null ? _e : false;
1662
+ }
1663
+ if (childNode.nodeType === 1 /* ElementNode */) {
1664
+ childNode.hidden = true;
1665
+ } else if (childNode.nodeType === 3 /* TextNode */ && !!childNode.nodeValue.trim()) {
1666
+ const textCommentNode = win.document.createComment("s-nt-" + childNode.nodeValue);
1667
+ textCommentNode["s-sn"] = childNode["s-sn"];
1668
+ insertBefore(childNode.parentNode, textCommentNode, childNode, isInitialLoad);
1669
+ childNode.parentNode.removeChild(childNode);
1670
+ }
1671
+ }
1672
+ }
1673
+ }
1227
1674
  contentRef = void 0;
1675
+ flushQueuedRefCallbacks();
1228
1676
  };
1229
1677
 
1230
1678
  // src/runtime/update-component.ts
1231
1679
  var attachToAncestor = (hostRef, ancestorComponent) => {
1232
1680
  if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
1233
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
1681
+ const index = ancestorComponent["s-p"].push(
1682
+ new Promise(
1683
+ (r) => hostRef.$onRenderResolve$ = () => {
1684
+ ancestorComponent["s-p"].splice(index - 1, 1);
1685
+ r();
1686
+ }
1687
+ )
1688
+ );
1234
1689
  }
1235
1690
  };
1236
1691
  var scheduleUpdate = (hostRef, isInitialLoad) => {
@@ -1243,6 +1698,12 @@ var scheduleUpdate = (hostRef, isInitialLoad) => {
1243
1698
  }
1244
1699
  attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1245
1700
  const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1701
+ if (isInitialLoad) {
1702
+ queueMicrotask(() => {
1703
+ dispatch();
1704
+ });
1705
+ return;
1706
+ }
1246
1707
  return writeTask(dispatch) ;
1247
1708
  };
1248
1709
  var dispatchHooks = (hostRef, isInitialLoad) => {
@@ -1257,25 +1718,31 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
1257
1718
  let maybePromise;
1258
1719
  if (isInitialLoad) {
1259
1720
  {
1260
- hostRef.$flags$ |= 256 /* isListenReady */;
1261
- if (hostRef.$queuedListeners$) {
1262
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1263
- hostRef.$queuedListeners$ = void 0;
1721
+ if (hostRef.$deferredConnectedCallback$) {
1722
+ hostRef.$deferredConnectedCallback$ = false;
1723
+ safeCall(instance, "connectedCallback", void 0, elm);
1724
+ }
1725
+ {
1726
+ hostRef.$flags$ |= 256 /* isListenReady */;
1727
+ if (hostRef.$queuedListeners$) {
1728
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event, elm));
1729
+ hostRef.$queuedListeners$ = void 0;
1730
+ }
1731
+ }
1732
+ if (hostRef.$fetchedCbList$.length) {
1733
+ hostRef.$fetchedCbList$.forEach((cb) => cb(elm));
1264
1734
  }
1265
1735
  }
1266
- {
1267
- maybePromise = safeCall(instance, "componentWillLoad");
1268
- }
1736
+ maybePromise = safeCall(instance, "componentWillLoad", void 0, elm);
1269
1737
  } else {
1270
- {
1271
- maybePromise = safeCall(instance, "componentWillUpdate");
1272
- }
1738
+ maybePromise = safeCall(instance, "componentWillUpdate", void 0, elm);
1273
1739
  }
1740
+ maybePromise = enqueue(maybePromise, () => safeCall(instance, "componentWillRender", void 0, elm));
1274
1741
  endSchedule();
1275
1742
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
1276
1743
  };
1277
- var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err2) => {
1278
- console.error(err2);
1744
+ var enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn).catch((err) => {
1745
+ console.error(err);
1279
1746
  fn();
1280
1747
  }) : fn();
1281
1748
  var isPromisey = (maybePromise) => maybePromise instanceof Promise || maybePromise && maybePromise.then && typeof maybePromise.then === "function";
@@ -1303,7 +1770,7 @@ var updateComponent = async (hostRef, instance, isInitialLoad) => {
1303
1770
  if (childrenPromises.length === 0) {
1304
1771
  postUpdate();
1305
1772
  } else {
1306
- Promise.all(childrenPromises).then(postUpdate);
1773
+ Promise.all(childrenPromises).then(postUpdate).catch(postUpdate);
1307
1774
  hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1308
1775
  childrenPromises.length = 0;
1309
1776
  }
@@ -1313,7 +1780,7 @@ var callRender = (hostRef, instance, elm, isInitialLoad) => {
1313
1780
  try {
1314
1781
  instance = instance.render && instance.render();
1315
1782
  {
1316
- hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1783
+ hostRef.$flags$ &= -17 /* isQueuedForUpdate */;
1317
1784
  }
1318
1785
  {
1319
1786
  hostRef.$flags$ |= 2 /* hasRendered */;
@@ -1336,17 +1803,13 @@ var postUpdateComponent = (hostRef) => {
1336
1803
  const endPostUpdate = createTime("postUpdate", tagName);
1337
1804
  const instance = hostRef.$lazyInstance$ ;
1338
1805
  const ancestorComponent = hostRef.$ancestorComponent$;
1339
- {
1340
- safeCall(instance, "componentDidRender");
1341
- }
1806
+ safeCall(instance, "componentDidRender", void 0, elm);
1342
1807
  if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1343
1808
  hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1344
1809
  {
1345
1810
  addHydratedFlag(elm);
1346
1811
  }
1347
- {
1348
- safeCall(instance, "componentDidLoad");
1349
- }
1812
+ safeCall(instance, "componentDidLoad", void 0, elm);
1350
1813
  endPostUpdate();
1351
1814
  {
1352
1815
  hostRef.$onReadyResolve$(elm);
@@ -1355,9 +1818,7 @@ var postUpdateComponent = (hostRef) => {
1355
1818
  }
1356
1819
  }
1357
1820
  } else {
1358
- {
1359
- safeCall(instance, "componentDidUpdate");
1360
- }
1821
+ safeCall(instance, "componentDidUpdate", void 0, elm);
1361
1822
  endPostUpdate();
1362
1823
  }
1363
1824
  {
@@ -1371,13 +1832,14 @@ var postUpdateComponent = (hostRef) => {
1371
1832
  if (hostRef.$flags$ & 512 /* needsRerender */) {
1372
1833
  nextTick(() => scheduleUpdate(hostRef, false));
1373
1834
  }
1374
- hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1835
+ hostRef.$flags$ &= -517;
1375
1836
  }
1376
1837
  };
1377
1838
  var forceUpdate = (ref) => {
1839
+ var _a;
1378
1840
  {
1379
1841
  const hostRef = getHostRef(ref);
1380
- const isConnected = hostRef.$hostElement$.isConnected;
1842
+ const isConnected = (_a = hostRef == null ? void 0 : hostRef.$hostElement$) == null ? void 0 : _a.isConnected;
1381
1843
  if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1382
1844
  scheduleUpdate(hostRef, false);
1383
1845
  }
@@ -1385,17 +1847,14 @@ var forceUpdate = (ref) => {
1385
1847
  }
1386
1848
  };
1387
1849
  var appDidLoad = (who) => {
1388
- {
1389
- addHydratedFlag(doc.documentElement);
1390
- }
1391
1850
  nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
1392
1851
  };
1393
- var safeCall = (instance, method, arg) => {
1852
+ var safeCall = (instance, method, arg, elm) => {
1394
1853
  if (instance && instance[method]) {
1395
1854
  try {
1396
1855
  return instance[method](arg);
1397
1856
  } catch (e) {
1398
- consoleError(e);
1857
+ consoleError(e, elm);
1399
1858
  }
1400
1859
  }
1401
1860
  return void 0;
@@ -1409,34 +1868,54 @@ var addHydratedFlag = (elm) => {
1409
1868
  var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1410
1869
  var setValue = (ref, propName, newVal, cmpMeta) => {
1411
1870
  const hostRef = getHostRef(ref);
1871
+ if (!hostRef) {
1872
+ return;
1873
+ }
1412
1874
  if (!hostRef) {
1413
1875
  throw new Error(
1414
- `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`
1876
+ `Couldn't find host element for "${cmpMeta.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`
1415
1877
  );
1416
1878
  }
1417
1879
  const elm = hostRef.$hostElement$ ;
1418
1880
  const oldVal = hostRef.$instanceValues$.get(propName);
1419
1881
  const flags = hostRef.$flags$;
1420
1882
  const instance = hostRef.$lazyInstance$ ;
1421
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1883
+ newVal = parsePropertyValue(
1884
+ newVal,
1885
+ cmpMeta.$members$[propName][0]);
1422
1886
  const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1423
1887
  const didValueChange = newVal !== oldVal && !areBothNaN;
1424
1888
  if ((!(flags & 8 /* isConstructingInstance */) || oldVal === void 0) && didValueChange) {
1425
1889
  hostRef.$instanceValues$.set(propName, newVal);
1426
- if (instance) {
1427
- if (cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1428
- const watchMethods = cmpMeta.$watchers$[propName];
1429
- if (watchMethods) {
1430
- watchMethods.map((watchMethodName) => {
1431
- try {
1432
- instance[watchMethodName](newVal, oldVal, propName);
1433
- } catch (e) {
1434
- consoleError(e, elm);
1890
+ if (cmpMeta.$watchers$) {
1891
+ const watchMethods = cmpMeta.$watchers$[propName];
1892
+ if (watchMethods) {
1893
+ watchMethods.map((watcher) => {
1894
+ try {
1895
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
1896
+ if (flags & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */) {
1897
+ if (!instance) {
1898
+ hostRef.$fetchedCbList$.push(() => {
1899
+ hostRef.$lazyInstance$[watchMethodName](newVal, oldVal, propName);
1900
+ });
1901
+ } else {
1902
+ instance[watchMethodName](newVal, oldVal, propName);
1903
+ }
1435
1904
  }
1436
- });
1905
+ } catch (e) {
1906
+ consoleError(e, elm);
1907
+ }
1908
+ });
1909
+ }
1910
+ }
1911
+ if (flags & 2 /* hasRendered */) {
1912
+ if (instance.componentShouldUpdate) {
1913
+ const shouldUpdate = instance.componentShouldUpdate(newVal, oldVal, propName);
1914
+ if (shouldUpdate === false && !(flags & 16 /* isQueuedForUpdate */)) {
1915
+ return;
1437
1916
  }
1438
1917
  }
1439
- if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1918
+ if (!(flags & 16 /* isQueuedForUpdate */)) {
1440
1919
  scheduleUpdate(hostRef, false);
1441
1920
  }
1442
1921
  }
@@ -1444,25 +1923,96 @@ var setValue = (ref, propName, newVal, cmpMeta) => {
1444
1923
  };
1445
1924
 
1446
1925
  // src/runtime/proxy-component.ts
1926
+ var reflectedAttrValue = (propValue) => propValue == null || propValue === false ? null : propValue === true ? "" : String(propValue);
1447
1927
  var proxyComponent = (Cstr, cmpMeta, flags) => {
1448
1928
  var _a, _b;
1449
1929
  const prototype = Cstr.prototype;
1450
- if (cmpMeta.$members$ || (cmpMeta.$watchers$ || Cstr.watchers)) {
1451
- if (Cstr.watchers && !cmpMeta.$watchers$) {
1452
- cmpMeta.$watchers$ = Cstr.watchers;
1930
+ if (cmpMeta.$members$ || BUILD.propChangeCallback) {
1931
+ {
1932
+ if (Cstr.watchers && !cmpMeta.$watchers$) {
1933
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
1934
+ }
1935
+ if (Cstr.deserializers && !cmpMeta.$deserializers$) {
1936
+ cmpMeta.$deserializers$ = Cstr.deserializers;
1937
+ }
1938
+ if (Cstr.serializers && !cmpMeta.$serializers$) {
1939
+ cmpMeta.$serializers$ = Cstr.serializers;
1940
+ }
1453
1941
  }
1454
1942
  const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
1455
1943
  members.map(([memberName, [memberFlags]]) => {
1456
1944
  if ((memberFlags & 31 /* Prop */ || (flags & 2 /* proxyState */) && memberFlags & 32 /* State */)) {
1945
+ const { get: origGetter, set: origSetter } = getPropertyDescriptor(prototype, memberName) || {};
1946
+ if (origGetter) cmpMeta.$members$[memberName][0] |= 2048 /* Getter */;
1947
+ if (origSetter) cmpMeta.$members$[memberName][0] |= 4096 /* Setter */;
1948
+ if (flags & 1 /* isElementConstructor */ || !origGetter) {
1949
+ Object.defineProperty(prototype, memberName, {
1950
+ get() {
1951
+ {
1952
+ if ((cmpMeta.$members$[memberName][0] & 2048 /* Getter */) === 0) {
1953
+ return getValue(this, memberName);
1954
+ }
1955
+ const ref = getHostRef(this);
1956
+ const instance = ref ? ref.$lazyInstance$ : prototype;
1957
+ if (!instance) return;
1958
+ return instance[memberName];
1959
+ }
1960
+ },
1961
+ configurable: true,
1962
+ enumerable: true
1963
+ });
1964
+ }
1457
1965
  Object.defineProperty(prototype, memberName, {
1458
- get() {
1459
- return getValue(this, memberName);
1460
- },
1461
1966
  set(newValue) {
1462
- setValue(this, memberName, newValue, cmpMeta);
1463
- },
1464
- configurable: true,
1465
- enumerable: true
1967
+ const ref = getHostRef(this);
1968
+ if (!ref) {
1969
+ return;
1970
+ }
1971
+ if (origSetter) {
1972
+ const currentValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1973
+ if (typeof currentValue === "undefined" && ref.$instanceValues$.get(memberName)) {
1974
+ newValue = ref.$instanceValues$.get(memberName);
1975
+ }
1976
+ origSetter.apply(this, [
1977
+ parsePropertyValue(
1978
+ newValue,
1979
+ memberFlags)
1980
+ ]);
1981
+ newValue = memberFlags & 32 /* State */ ? this[memberName] : ref.$hostElement$[memberName];
1982
+ setValue(this, memberName, newValue, cmpMeta);
1983
+ return;
1984
+ }
1985
+ {
1986
+ if ((flags & 1 /* isElementConstructor */) === 0 || (cmpMeta.$members$[memberName][0] & 4096 /* Setter */) === 0) {
1987
+ setValue(this, memberName, newValue, cmpMeta);
1988
+ if (flags & 1 /* isElementConstructor */ && !ref.$lazyInstance$) {
1989
+ ref.$fetchedCbList$.push(() => {
1990
+ if (cmpMeta.$members$[memberName][0] & 4096 /* Setter */ && ref.$lazyInstance$[memberName] !== ref.$instanceValues$.get(memberName)) {
1991
+ ref.$lazyInstance$[memberName] = newValue;
1992
+ }
1993
+ });
1994
+ }
1995
+ return;
1996
+ }
1997
+ const setterSetVal = () => {
1998
+ const currentValue = ref.$lazyInstance$[memberName];
1999
+ if (!ref.$instanceValues$.get(memberName) && currentValue) {
2000
+ ref.$instanceValues$.set(memberName, currentValue);
2001
+ }
2002
+ ref.$lazyInstance$[memberName] = parsePropertyValue(
2003
+ newValue,
2004
+ memberFlags);
2005
+ setValue(this, memberName, ref.$lazyInstance$[memberName], cmpMeta);
2006
+ };
2007
+ if (ref.$lazyInstance$) {
2008
+ setterSetVal();
2009
+ } else {
2010
+ ref.$fetchedCbList$.push(() => {
2011
+ setterSetVal();
2012
+ });
2013
+ }
2014
+ }
2015
+ }
1466
2016
  });
1467
2017
  } else if (flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1468
2018
  Object.defineProperty(prototype, memberName, {
@@ -1483,33 +2033,50 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1483
2033
  plt.jmp(() => {
1484
2034
  var _a2;
1485
2035
  const propName = attrNameToPropName.get(attrName);
1486
- if (this.hasOwnProperty(propName)) {
2036
+ const hostRef = getHostRef(this);
2037
+ if (this.hasOwnProperty(propName) && BUILD.lazyLoad) {
1487
2038
  newValue = this[propName];
1488
2039
  delete this[propName];
1489
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
2040
+ }
2041
+ if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && // cast type to number to avoid TS compiler issues
1490
2042
  this[propName] == newValue) {
1491
2043
  return;
1492
2044
  } else if (propName == null) {
1493
- const hostRef = getHostRef(this);
1494
2045
  const flags2 = hostRef == null ? void 0 : hostRef.$flags$;
1495
- if (flags2 && !(flags2 & 8 /* isConstructingInstance */) && flags2 & 128 /* isWatchReady */ && newValue !== oldValue) {
2046
+ if (hostRef && flags2 && !(flags2 & 8 /* isConstructingInstance */) && newValue !== oldValue) {
1496
2047
  const instance = hostRef.$lazyInstance$ ;
1497
2048
  const entry = (_a2 = cmpMeta.$watchers$) == null ? void 0 : _a2[attrName];
1498
- entry == null ? void 0 : entry.forEach((callbackName) => {
1499
- if (instance[callbackName] != null) {
1500
- instance[callbackName].call(instance, newValue, oldValue, attrName);
2049
+ entry == null ? void 0 : entry.forEach((watcher) => {
2050
+ const [[watchMethodName, watcherFlags]] = Object.entries(watcher);
2051
+ if (instance[watchMethodName] != null && (flags2 & 128 /* isWatchReady */ || watcherFlags & 1 /* Immediate */)) {
2052
+ instance[watchMethodName].call(instance, newValue, oldValue, attrName);
1501
2053
  }
1502
2054
  });
1503
2055
  }
1504
2056
  return;
1505
2057
  }
1506
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
2058
+ const propFlags = members.find(([m]) => m === propName);
2059
+ const propMemberFlags = propFlags ? propFlags[1][0] : 0;
2060
+ const isBooleanTarget = propMemberFlags & 4 /* Boolean */;
2061
+ if (propMemberFlags & 512 /* ReflectAttr */ && propMemberFlags & 8 /* Any */ && // a complex value is never written to an attribute, so a change while the prop holds
2062
+ // one is always external
2063
+ !isComplexType(this[propName]) && reflectedAttrValue(this[propName]) === newValue) {
2064
+ return;
2065
+ }
2066
+ const isSpuriousBooleanRemoval = isBooleanTarget && newValue === null && this[propName] === void 0;
2067
+ if (isBooleanTarget) {
2068
+ newValue = newValue === null || newValue === "false" ? false : true;
2069
+ }
2070
+ const propDesc = Object.getOwnPropertyDescriptor(prototype, propName);
2071
+ if (!isSpuriousBooleanRemoval && newValue != this[propName] && (!propDesc.get || !!propDesc.set)) {
2072
+ this[propName] = newValue;
2073
+ }
1507
2074
  });
1508
2075
  };
1509
2076
  Cstr.observedAttributes = Array.from(
1510
2077
  /* @__PURE__ */ new Set([
1511
2078
  ...Object.keys((_b = cmpMeta.$watchers$) != null ? _b : {}),
1512
- ...members.filter(([_, m]) => m[0] & 15 /* HasAttribute */).map(([propName, m]) => {
2079
+ ...members.filter(([_, m]) => m[0] & 31 /* HasAttribute */).map(([propName, m]) => {
1513
2080
  var _a2;
1514
2081
  const attrName = m[1] || propName;
1515
2082
  attrNameToPropName.set(attrName, propName);
@@ -1527,78 +2094,110 @@ var proxyComponent = (Cstr, cmpMeta, flags) => {
1527
2094
 
1528
2095
  // src/runtime/initialize-component.ts
1529
2096
  var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
2097
+ var _a;
1530
2098
  let Cstr;
1531
- if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1532
- hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1533
- const bundleId = cmpMeta.$lazyBundleId$;
1534
- if (bundleId) {
1535
- const CstrImport = loadModule(cmpMeta);
1536
- if (CstrImport && "then" in CstrImport) {
1537
- const endLoad = uniqueTime();
1538
- Cstr = await CstrImport;
1539
- endLoad();
1540
- } else {
1541
- Cstr = CstrImport;
1542
- }
1543
- if (!Cstr) {
1544
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1545
- }
1546
- if (!Cstr.isProxied) {
2099
+ try {
2100
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
2101
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
2102
+ hostRef.$flags$ &= -1025 /* hasFailedLoad */;
2103
+ const bundleId = cmpMeta.$lazyBundleId$;
2104
+ if (bundleId) {
2105
+ const CstrImport = loadModule(cmpMeta, hostRef);
2106
+ if (CstrImport && "then" in CstrImport) {
2107
+ const endLoad = uniqueTime();
2108
+ Cstr = await CstrImport;
2109
+ endLoad();
2110
+ } else {
2111
+ Cstr = CstrImport;
2112
+ }
2113
+ if (!Cstr) {
2114
+ hostRef.$flags$ &= -33 /* hasInitializedComponent */;
2115
+ hostRef.$loadRetryCount$ = ((_a = hostRef.$loadRetryCount$) != null ? _a : 0) + 1;
2116
+ if (hostRef.$loadRetryCount$ < MAX_LAZY_LOAD_RETRIES) {
2117
+ hostRef.$flags$ |= 1024 /* hasFailedLoad */;
2118
+ }
2119
+ throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
2120
+ }
2121
+ if (!Cstr.isProxied) {
2122
+ {
2123
+ cmpMeta.$watchers$ = normalizeWatchers(Cstr.watchers);
2124
+ cmpMeta.$serializers$ = Cstr.serializers;
2125
+ cmpMeta.$deserializers$ = Cstr.deserializers;
2126
+ }
2127
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
2128
+ Cstr.isProxied = true;
2129
+ }
2130
+ const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
1547
2131
  {
1548
- cmpMeta.$watchers$ = Cstr.watchers;
2132
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
2133
+ }
2134
+ try {
2135
+ new Cstr(hostRef);
2136
+ } catch (e) {
2137
+ consoleError(e, elm);
2138
+ }
2139
+ {
2140
+ hostRef.$flags$ &= -9 /* isConstructingInstance */;
2141
+ }
2142
+ {
2143
+ hostRef.$flags$ |= 128 /* isWatchReady */;
2144
+ }
2145
+ endNewInstance();
2146
+ const needsDeferredCallback = cmpMeta.$flags$ & 4 /* hasSlotRelocation */;
2147
+ if (!needsDeferredCallback) {
2148
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
2149
+ } else {
2150
+ hostRef.$deferredConnectedCallback$ = true;
2151
+ }
2152
+ } else {
2153
+ Cstr = elm.constructor;
2154
+ const cmpTag = elm.localName;
2155
+ customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
2156
+ }
2157
+ if (Cstr && Cstr.style) {
2158
+ let style;
2159
+ if (typeof Cstr.style === "string") {
2160
+ style = Cstr.style;
2161
+ }
2162
+ const scopeId2 = getScopeId(cmpMeta);
2163
+ if (!styles.has(scopeId2) || BUILD.hotModuleReplacement) {
2164
+ const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
2165
+ registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
2166
+ endRegisterStyles();
1549
2167
  }
1550
- proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1551
- Cstr.isProxied = true;
1552
- }
1553
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
1554
- {
1555
- hostRef.$flags$ |= 8 /* isConstructingInstance */;
1556
- }
1557
- try {
1558
- new Cstr(hostRef);
1559
- } catch (e) {
1560
- consoleError(e);
1561
- }
1562
- {
1563
- hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1564
- }
1565
- {
1566
- hostRef.$flags$ |= 128 /* isWatchReady */;
1567
2168
  }
1568
- endNewInstance();
2169
+ }
2170
+ const ancestorComponent = hostRef.$ancestorComponent$;
2171
+ const schedule = () => scheduleUpdate(hostRef, true);
2172
+ if (ancestorComponent && ancestorComponent["s-rc"]) {
2173
+ ancestorComponent["s-rc"].push(schedule);
1569
2174
  } else {
1570
- Cstr = elm.constructor;
1571
- const cmpTag = elm.localName;
1572
- customElements.whenDefined(cmpTag).then(() => hostRef.$flags$ |= 128 /* isWatchReady */);
2175
+ schedule();
1573
2176
  }
1574
- if (Cstr && Cstr.style) {
1575
- let style;
1576
- if (typeof Cstr.style === "string") {
1577
- style = Cstr.style;
1578
- }
1579
- const scopeId2 = getScopeId(cmpMeta);
1580
- if (!styles.has(scopeId2)) {
1581
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
1582
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1583
- endRegisterStyles();
1584
- }
2177
+ } catch (e) {
2178
+ consoleError(e, elm);
2179
+ if (hostRef.$onRenderResolve$) {
2180
+ hostRef.$onRenderResolve$();
2181
+ hostRef.$onRenderResolve$ = void 0;
2182
+ }
2183
+ if (hostRef.$onReadyResolve$ && !(hostRef.$flags$ & 1024 /* hasFailedLoad */)) {
2184
+ hostRef.$onReadyResolve$(elm);
1585
2185
  }
1586
- }
1587
- const ancestorComponent = hostRef.$ancestorComponent$;
1588
- const schedule = () => scheduleUpdate(hostRef, true);
1589
- if (ancestorComponent && ancestorComponent["s-rc"]) {
1590
- ancestorComponent["s-rc"].push(schedule);
1591
- } else {
1592
- schedule();
1593
2186
  }
1594
2187
  };
1595
- var fireConnectedCallback = (instance) => {
2188
+ var fireConnectedCallback = (instance, elm) => {
2189
+ {
2190
+ safeCall(instance, "connectedCallback", void 0, elm);
2191
+ }
1596
2192
  };
1597
2193
 
1598
2194
  // src/runtime/connected-callback.ts
1599
2195
  var connectedCallback = (elm) => {
1600
2196
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1601
2197
  const hostRef = getHostRef(elm);
2198
+ if (!hostRef) {
2199
+ return;
2200
+ }
1602
2201
  const cmpMeta = hostRef.$cmpMeta$;
1603
2202
  const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
1604
2203
  if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
@@ -1620,7 +2219,7 @@ var connectedCallback = (elm) => {
1620
2219
  }
1621
2220
  if (cmpMeta.$members$) {
1622
2221
  Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1623
- if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2222
+ if (memberFlags & 31 /* Prop */ && Object.prototype.hasOwnProperty.call(elm, memberName)) {
1624
2223
  const value = elm[memberName];
1625
2224
  delete elm[memberName];
1626
2225
  elm[memberName] = value;
@@ -1632,61 +2231,78 @@ var connectedCallback = (elm) => {
1632
2231
  }
1633
2232
  } else {
1634
2233
  addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1635
- if (hostRef == null ? void 0 : hostRef.$lazyInstance$) ; else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1636
- hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
2234
+ if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
2235
+ fireConnectedCallback(hostRef.$lazyInstance$, elm);
2236
+ } else if (hostRef.$flags$ & 1024 /* hasFailedLoad */) {
2237
+ setTimeout(() => initializeComponent(elm, hostRef, cmpMeta), LAZY_LOAD_RETRY_INTERVAL_MS);
2238
+ } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
2239
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback(hostRef.$lazyInstance$, elm));
1637
2240
  }
1638
2241
  }
1639
2242
  endConnected();
1640
2243
  }
1641
2244
  };
1642
2245
  var setContentReference = (elm) => {
1643
- const contentRefElm = elm["s-cr"] = doc.createComment(
2246
+ if (!win.document) {
2247
+ return;
2248
+ }
2249
+ const contentRefElm = elm["s-cr"] = win.document.createComment(
1644
2250
  ""
1645
2251
  );
1646
2252
  contentRefElm["s-cn"] = true;
1647
2253
  insertBefore(elm, contentRefElm, elm.firstChild);
1648
2254
  };
1649
- var disconnectInstance = (instance) => {
2255
+ var disconnectInstance = (instance, elm) => {
1650
2256
  {
1651
- safeCall(instance, "disconnectedCallback");
2257
+ safeCall(instance, "disconnectedCallback", void 0, elm || instance);
1652
2258
  }
1653
2259
  };
1654
2260
  var disconnectedCallback = async (elm) => {
1655
2261
  if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1656
2262
  const hostRef = getHostRef(elm);
1657
2263
  {
1658
- if (hostRef.$rmListeners$) {
2264
+ if (hostRef == null ? void 0 : hostRef.$rmListeners$) {
1659
2265
  hostRef.$rmListeners$.map((rmListener) => rmListener());
1660
2266
  hostRef.$rmListeners$ = void 0;
1661
2267
  }
1662
2268
  }
1663
2269
  if (hostRef == null ? void 0 : hostRef.$lazyInstance$) {
1664
- disconnectInstance(hostRef.$lazyInstance$);
2270
+ disconnectInstance(hostRef.$lazyInstance$, elm);
1665
2271
  } else if (hostRef == null ? void 0 : hostRef.$onReadyPromise$) {
1666
- hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$));
2272
+ hostRef.$onReadyPromise$.then(() => disconnectInstance(hostRef.$lazyInstance$, elm));
1667
2273
  }
1668
2274
  }
2275
+ if (rootAppliedStyles.has(elm)) {
2276
+ rootAppliedStyles.delete(elm);
2277
+ }
2278
+ if (elm.shadowRoot && rootAppliedStyles.has(elm.shadowRoot)) {
2279
+ rootAppliedStyles.delete(elm.shadowRoot);
2280
+ }
1669
2281
  };
1670
2282
 
1671
2283
  // src/runtime/bootstrap-lazy.ts
1672
2284
  var bootstrapLazy = (lazyBundles, options = {}) => {
1673
2285
  var _a;
2286
+ if (!win.document) {
2287
+ console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");
2288
+ return;
2289
+ }
1674
2290
  const endBootstrap = createTime();
1675
2291
  const cmpTags = [];
1676
2292
  const exclude = options.exclude || [];
1677
2293
  const customElements2 = win.customElements;
1678
- const head = doc.head;
2294
+ const head = win.document.head;
1679
2295
  const metaCharset = /* @__PURE__ */ head.querySelector("meta[charset]");
1680
- const dataStyles = /* @__PURE__ */ doc.createElement("style");
2296
+ const dataStyles = /* @__PURE__ */ win.document.createElement("style");
1681
2297
  const deferredConnectedCallbacks = [];
1682
2298
  let appLoadFallback;
1683
2299
  let isBootstrapping = true;
1684
2300
  Object.assign(plt, options);
1685
- plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", doc.baseURI).href;
2301
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || "./", win.document.baseURI).href;
1686
2302
  let hasSlotRelocation = false;
1687
2303
  lazyBundles.map((lazyBundle) => {
1688
2304
  lazyBundle[1].map((compactMeta) => {
1689
- var _a2;
2305
+ var _a2, _b;
1690
2306
  const cmpMeta = {
1691
2307
  $flags$: compactMeta[0],
1692
2308
  $tagName$: compactMeta[1],
@@ -1706,25 +2322,24 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1706
2322
  cmpMeta.$attrsToReflect$ = [];
1707
2323
  }
1708
2324
  {
1709
- cmpMeta.$watchers$ = (_a2 = compactMeta[4]) != null ? _a2 : {};
2325
+ cmpMeta.$watchers$ = normalizeWatchers(compactMeta[4]);
2326
+ cmpMeta.$serializers$ = (_a2 = compactMeta[5]) != null ? _a2 : {};
2327
+ cmpMeta.$deserializers$ = (_b = compactMeta[6]) != null ? _b : {};
1710
2328
  }
1711
- const tagName = cmpMeta.$tagName$;
2329
+ const tagName = transformTag(cmpMeta.$tagName$);
1712
2330
  const HostElement = class extends HTMLElement {
2331
+ ["s-p"];
2332
+ ["s-rc"];
2333
+ hasRegisteredEventListeners = false;
1713
2334
  // StencilLazyHost
1714
2335
  constructor(self) {
1715
2336
  super(self);
1716
- this.hasRegisteredEventListeners = false;
1717
2337
  self = this;
1718
2338
  registerHost(self, cmpMeta);
1719
2339
  if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1720
2340
  {
1721
2341
  if (!self.shadowRoot) {
1722
- {
1723
- self.attachShadow({
1724
- mode: "open",
1725
- delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */)
1726
- });
1727
- }
2342
+ createShadowRoot.call(self, cmpMeta);
1728
2343
  } else {
1729
2344
  if (self.shadowRoot.mode !== "open") {
1730
2345
  throw new Error(
@@ -1737,6 +2352,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1737
2352
  }
1738
2353
  connectedCallback() {
1739
2354
  const hostRef = getHostRef(this);
2355
+ if (!hostRef) {
2356
+ return;
2357
+ }
1740
2358
  if (!this.hasRegisteredEventListeners) {
1741
2359
  this.hasRegisteredEventListeners = true;
1742
2360
  addHostEventListeners(this, hostRef, cmpMeta.$listeners$);
@@ -1753,9 +2371,24 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1753
2371
  }
1754
2372
  disconnectedCallback() {
1755
2373
  plt.jmp(() => disconnectedCallback(this));
2374
+ nextTick(() => {
2375
+ var _a3;
2376
+ const hostRef = getHostRef(this);
2377
+ if (!hostRef) {
2378
+ return;
2379
+ }
2380
+ const i2 = deferredConnectedCallbacks.findIndex((host) => host === this);
2381
+ if (i2 > -1) {
2382
+ deferredConnectedCallbacks.splice(i2, 1);
2383
+ }
2384
+ if (((_a3 = hostRef == null ? void 0 : hostRef.$vnode$) == null ? void 0 : _a3.$elm$) instanceof Node && !hostRef.$vnode$.$elm$.isConnected) {
2385
+ delete hostRef.$vnode$.$elm$;
2386
+ }
2387
+ });
1756
2388
  }
1757
2389
  componentOnReady() {
1758
- return getHostRef(this).$onReadyPromise$;
2390
+ var _a3;
2391
+ return (_a3 = getHostRef(this)) == null ? void 0 : _a3.$onReadyPromise$;
1759
2392
  }
1760
2393
  };
1761
2394
  cmpMeta.$lazyBundleId$ = lazyBundle[0];
@@ -1777,7 +2410,7 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1777
2410
  }
1778
2411
  if (dataStyles.innerHTML.length) {
1779
2412
  dataStyles.setAttribute("data-styles", "");
1780
- const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(doc);
2413
+ const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
1781
2414
  if (nonce != null) {
1782
2415
  dataStyles.setAttribute("nonce", nonce);
1783
2416
  }
@@ -1795,9 +2428,9 @@ var bootstrapLazy = (lazyBundles, options = {}) => {
1795
2428
  endBootstrap();
1796
2429
  };
1797
2430
  var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
1798
- if (listeners) {
2431
+ if (listeners && win.document) {
1799
2432
  listeners.map(([flags, name, method]) => {
1800
- const target = getHostListenerTarget(elm, flags) ;
2433
+ const target = getHostListenerTarget(win.document, elm, flags) ;
1801
2434
  const handler = hostListenerProxy(hostRef, method);
1802
2435
  const opts = hostListenerOpts(flags);
1803
2436
  plt.ael(target, name, handler, opts);
@@ -1816,12 +2449,16 @@ var hostListenerProxy = (hostRef, methodName) => (ev) => {
1816
2449
  }
1817
2450
  }
1818
2451
  } catch (e) {
1819
- consoleError(e);
2452
+ consoleError(e, hostRef.$hostElement$);
1820
2453
  }
1821
2454
  };
1822
- var getHostListenerTarget = (elm, flags) => {
1823
- if (flags & 4 /* TargetDocument */) return doc;
1824
- if (flags & 8 /* TargetWindow */) return win;
2455
+ var getHostListenerTarget = (doc, elm, flags) => {
2456
+ if (flags & 4 /* TargetDocument */) {
2457
+ return doc;
2458
+ }
2459
+ if (flags & 8 /* TargetWindow */) {
2460
+ return win;
2461
+ }
1825
2462
  return elm;
1826
2463
  };
1827
2464
  var hostListenerOpts = (flags) => supportsListenerOptions ? {
@@ -1831,12 +2468,16 @@ var hostListenerOpts = (flags) => supportsListenerOptions ? {
1831
2468
 
1832
2469
  // src/runtime/nonce.ts
1833
2470
  var setNonce = (nonce) => plt.$nonce$ = nonce;
2471
+ function transformTag(tag) {
2472
+ return tag;
2473
+ }
1834
2474
 
1835
2475
  exports.Host = Host;
1836
2476
  exports.bootstrapLazy = bootstrapLazy;
1837
2477
  exports.createEvent = createEvent;
1838
2478
  exports.forceUpdate = forceUpdate;
1839
2479
  exports.getElement = getElement;
2480
+ exports.global = global;
1840
2481
  exports.h = h;
1841
2482
  exports.promiseResolve = promiseResolve;
1842
2483
  exports.registerInstance = registerInstance;