@rededor/cura 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (218) hide show
  1. package/LICENSE +21 -0
  2. package/dist/assets/icons/iconset-default-list.ts +1 -0
  3. package/dist/assets/icons/iconset-default.svg +1 -0
  4. package/dist/cjs/app-globals-e5cfde65.js +182 -0
  5. package/dist/cjs/cura-icon_2.cjs.entry.js +52 -0
  6. package/dist/cjs/cura.cjs.js +21 -0
  7. package/dist/cjs/dummy-component.cjs.entry.js +19 -0
  8. package/dist/cjs/index-2f9830d5.js +1362 -0
  9. package/dist/cjs/index.cjs.js +2 -0
  10. package/dist/cjs/loader.cjs.js +23 -0
  11. package/dist/collection/api/cura-api.js +17 -0
  12. package/dist/collection/api/cura-api.type.js +6 -0
  13. package/dist/collection/api/modules/cura-theme-module.js +74 -0
  14. package/dist/collection/api/theme-presets/theme-default.js +43 -0
  15. package/dist/collection/api/theme-presets/theme-maternity.js +26 -0
  16. package/dist/collection/api/theme-presets/theme-presets.js +6 -0
  17. package/dist/collection/assets/icons/iconset-default-list.js +1 -0
  18. package/dist/collection/assets/icons/iconset-default.svg +1 -0
  19. package/dist/collection/assets-raw/icons/default/360.svg +8 -0
  20. package/dist/collection/assets-raw/icons/default/accessibility.svg +5 -0
  21. package/dist/collection/assets-raw/icons/default/alertCircle.svg +5 -0
  22. package/dist/collection/assets-raw/icons/default/alertTriangle.svg +5 -0
  23. package/dist/collection/assets-raw/icons/default/arrowDown.svg +3 -0
  24. package/dist/collection/assets-raw/icons/default/arrowDownCircle.svg +4 -0
  25. package/dist/collection/assets-raw/icons/default/arrowLeft.svg +3 -0
  26. package/dist/collection/assets-raw/icons/default/arrowLeftCircle.svg +4 -0
  27. package/dist/collection/assets-raw/icons/default/arrowRight.svg +3 -0
  28. package/dist/collection/assets-raw/icons/default/arrowRightCircle.svg +4 -0
  29. package/dist/collection/assets-raw/icons/default/arrowUp.svg +3 -0
  30. package/dist/collection/assets-raw/icons/default/arrowUpCircle.svg +4 -0
  31. package/dist/collection/assets-raw/icons/default/attach.svg +3 -0
  32. package/dist/collection/assets-raw/icons/default/avatarF.svg +6 -0
  33. package/dist/collection/assets-raw/icons/default/avatarM.svg +5 -0
  34. package/dist/collection/assets-raw/icons/default/biometry.svg +3 -0
  35. package/dist/collection/assets-raw/icons/default/bloodGroup.svg +3 -0
  36. package/dist/collection/assets-raw/icons/default/calendar.svg +8 -0
  37. package/dist/collection/assets-raw/icons/default/cam.svg +4 -0
  38. package/dist/collection/assets-raw/icons/default/camOff.svg +5 -0
  39. package/dist/collection/assets-raw/icons/default/central.svg +7 -0
  40. package/dist/collection/assets-raw/icons/default/chatCircle.svg +6 -0
  41. package/dist/collection/assets-raw/icons/default/check.svg +3 -0
  42. package/dist/collection/assets-raw/icons/default/checkBadge.svg +4 -0
  43. package/dist/collection/assets-raw/icons/default/checkCircle.svg +4 -0
  44. package/dist/collection/assets-raw/icons/default/checkDouble.svg +4 -0
  45. package/dist/collection/assets-raw/icons/default/clock.svg +5 -0
  46. package/dist/collection/assets-raw/icons/default/close.svg +3 -0
  47. package/dist/collection/assets-raw/icons/default/closeCircle.svg +5 -0
  48. package/dist/collection/assets-raw/icons/default/collapse.svg +4 -0
  49. package/dist/collection/assets-raw/icons/default/config.svg +4 -0
  50. package/dist/collection/assets-raw/icons/default/delete.svg +7 -0
  51. package/dist/collection/assets-raw/icons/default/desktop.svg +6 -0
  52. package/dist/collection/assets-raw/icons/default/deslike.svg +6 -0
  53. package/dist/collection/assets-raw/icons/default/download.svg +3 -0
  54. package/dist/collection/assets-raw/icons/default/duplicate.svg +4 -0
  55. package/dist/collection/assets-raw/icons/default/edit.svg +5 -0
  56. package/dist/collection/assets-raw/icons/default/exam.svg +6 -0
  57. package/dist/collection/assets-raw/icons/default/expand.svg +4 -0
  58. package/dist/collection/assets-raw/icons/default/fileBmp.svg +17 -0
  59. package/dist/collection/assets-raw/icons/default/fileJpg.svg +8 -0
  60. package/dist/collection/assets-raw/icons/default/filePdf.svg +10 -0
  61. package/dist/collection/assets-raw/icons/default/filePng.svg +10 -0
  62. package/dist/collection/assets-raw/icons/default/fileUpload.svg +5 -0
  63. package/dist/collection/assets-raw/icons/default/fileXls.svg +8 -0
  64. package/dist/collection/assets-raw/icons/default/filter.svg +11 -0
  65. package/dist/collection/assets-raw/icons/default/fullscreen.svg +6 -0
  66. package/dist/collection/assets-raw/icons/default/gallery.svg +6 -0
  67. package/dist/collection/assets-raw/icons/default/geotag.svg +4 -0
  68. package/dist/collection/assets-raw/icons/default/hate.svg +6 -0
  69. package/dist/collection/assets-raw/icons/default/healthPlan.svg +6 -0
  70. package/dist/collection/assets-raw/icons/default/height.svg +10 -0
  71. package/dist/collection/assets-raw/icons/default/height2.svg +8 -0
  72. package/dist/collection/assets-raw/icons/default/home.svg +6 -0
  73. package/dist/collection/assets-raw/icons/default/horizontalList.svg +4 -0
  74. package/dist/collection/assets-raw/icons/default/imageUp.svg +5 -0
  75. package/dist/collection/assets-raw/icons/default/info2.svg +12 -0
  76. package/dist/collection/assets-raw/icons/default/infoCircle.svg +5 -0
  77. package/dist/collection/assets-raw/icons/default/key.svg +4 -0
  78. package/dist/collection/assets-raw/icons/default/language.svg +9 -0
  79. package/dist/collection/assets-raw/icons/default/language2.svg +4 -0
  80. package/dist/collection/assets-raw/icons/default/languageEN.svg +5 -0
  81. package/dist/collection/assets-raw/icons/default/languagePT.svg +5 -0
  82. package/dist/collection/assets-raw/icons/default/like.svg +6 -0
  83. package/dist/collection/assets-raw/icons/default/link.svg +4 -0
  84. package/dist/collection/assets-raw/icons/default/linkExternal.svg +4 -0
  85. package/dist/collection/assets-raw/icons/default/list.svg +8 -0
  86. package/dist/collection/assets-raw/icons/default/login.svg +4 -0
  87. package/dist/collection/assets-raw/icons/default/logout.svg +3 -0
  88. package/dist/collection/assets-raw/icons/default/love.svg +6 -0
  89. package/dist/collection/assets-raw/icons/default/mail.svg +6 -0
  90. package/dist/collection/assets-raw/icons/default/mail2.svg +6 -0
  91. package/dist/collection/assets-raw/icons/default/medical.svg +9 -0
  92. package/dist/collection/assets-raw/icons/default/menuHamburguer.svg +5 -0
  93. package/dist/collection/assets-raw/icons/default/menuKebab.svg +5 -0
  94. package/dist/collection/assets-raw/icons/default/menuMeatballs.svg +5 -0
  95. package/dist/collection/assets-raw/icons/default/mic.svg +5 -0
  96. package/dist/collection/assets-raw/icons/default/micOff.svg +6 -0
  97. package/dist/collection/assets-raw/icons/default/minus.svg +3 -0
  98. package/dist/collection/assets-raw/icons/default/minusCircle.svg +4 -0
  99. package/dist/collection/assets-raw/icons/default/minusSquare.svg +4 -0
  100. package/dist/collection/assets-raw/icons/default/mobile.svg +4 -0
  101. package/dist/collection/assets-raw/icons/default/neutral.svg +6 -0
  102. package/dist/collection/assets-raw/icons/default/news.svg +8 -0
  103. package/dist/collection/assets-raw/icons/default/notification.svg +6 -0
  104. package/dist/collection/assets-raw/icons/default/order.svg +6 -0
  105. package/dist/collection/assets-raw/icons/default/partner.svg +5 -0
  106. package/dist/collection/assets-raw/icons/default/phone.svg +5 -0
  107. package/dist/collection/assets-raw/icons/default/play.svg +4 -0
  108. package/dist/collection/assets-raw/icons/default/plus.svg +4 -0
  109. package/dist/collection/assets-raw/icons/default/plusCircle.svg +5 -0
  110. package/dist/collection/assets-raw/icons/default/plusSquare.svg +5 -0
  111. package/dist/collection/assets-raw/icons/default/print.svg +7 -0
  112. package/dist/collection/assets-raw/icons/default/profile.svg +4 -0
  113. package/dist/collection/assets-raw/icons/default/profile2.svg +4 -0
  114. package/dist/collection/assets-raw/icons/default/pulldownG.svg +3 -0
  115. package/dist/collection/assets-raw/icons/default/pulldownP.svg +3 -0
  116. package/dist/collection/assets-raw/icons/default/pullupG.svg +3 -0
  117. package/dist/collection/assets-raw/icons/default/pullupP.svg +3 -0
  118. package/dist/collection/assets-raw/icons/default/questionCircle.svg +4 -0
  119. package/dist/collection/assets-raw/icons/default/questionSquare.svg +4 -0
  120. package/dist/collection/assets-raw/icons/default/range.svg +5 -0
  121. package/dist/collection/assets-raw/icons/default/reload.svg +4 -0
  122. package/dist/collection/assets-raw/icons/default/schedule.svg +9 -0
  123. package/dist/collection/assets-raw/icons/default/search.svg +4 -0
  124. package/dist/collection/assets-raw/icons/default/secure.svg +6 -0
  125. package/dist/collection/assets-raw/icons/default/share.svg +7 -0
  126. package/dist/collection/assets-raw/icons/default/share2.svg +5 -0
  127. package/dist/collection/assets-raw/icons/default/sound.svg +5 -0
  128. package/dist/collection/assets-raw/icons/default/soundOff.svg +4 -0
  129. package/dist/collection/assets-raw/icons/default/subItem.svg +4 -0
  130. package/dist/collection/assets-raw/icons/default/target.svg +8 -0
  131. package/dist/collection/assets-raw/icons/default/team.svg +6 -0
  132. package/dist/collection/assets-raw/icons/default/unLink.svg +10 -0
  133. package/dist/collection/assets-raw/icons/default/unSecure.svg +6 -0
  134. package/dist/collection/assets-raw/icons/default/upload.svg +3 -0
  135. package/dist/collection/assets-raw/icons/default/verticalList.svg +4 -0
  136. package/dist/collection/assets-raw/icons/default/viewFalse.svg +5 -0
  137. package/dist/collection/assets-raw/icons/default/viewTrue.svg +4 -0
  138. package/dist/collection/assets-raw/icons/default/weight.svg +5 -0
  139. package/dist/collection/assets-raw/icons/default/wifi.svg +6 -0
  140. package/dist/collection/assets-raw/icons/default/zoomIn.svg +6 -0
  141. package/dist/collection/assets-raw/icons/default/zoomOut.svg +5 -0
  142. package/dist/collection/collection-manifest.json +15 -0
  143. package/dist/collection/components/cura-icon/cura-icon.css +99 -0
  144. package/dist/collection/components/cura-icon/cura-icon.js +126 -0
  145. package/dist/collection/components/dscore-icons-view/dscore-icons-view.css +82 -0
  146. package/dist/collection/components/dscore-icons-view/dscore-icons-view.js +31 -0
  147. package/dist/collection/components/dummy-component/dummy-component.css +3 -0
  148. package/dist/collection/components/dummy-component/dummy-component.js +18 -0
  149. package/dist/collection/index.js +1 -0
  150. package/dist/collection/rededor-cura-start.js +11 -0
  151. package/dist/collection/utils/utils.js +3 -0
  152. package/dist/components/cura-icon.d.ts +11 -0
  153. package/dist/components/cura-icon.js +6 -0
  154. package/dist/components/cura-icon2.js +50 -0
  155. package/dist/components/dscore-icons-view.d.ts +11 -0
  156. package/dist/components/dscore-icons-view.js +49 -0
  157. package/dist/components/dummy-component.d.ts +11 -0
  158. package/dist/components/dummy-component.js +34 -0
  159. package/dist/components/index.d.ts +24 -0
  160. package/dist/components/index.js +184 -0
  161. package/dist/cura/cura.esm.js +1 -0
  162. package/dist/cura/cura.js +131 -0
  163. package/dist/cura/index.esm.js +0 -0
  164. package/dist/cura/p-2525165f.system.entry.js +1 -0
  165. package/dist/cura/p-363e0aa1.system.js +1 -0
  166. package/dist/cura/p-50ea2036.system.js +1 -0
  167. package/dist/cura/p-55523400.js +2 -0
  168. package/dist/cura/p-5d11ae38.system.js +2 -0
  169. package/dist/cura/p-62567192.system.entry.js +1 -0
  170. package/dist/cura/p-632702eb.entry.js +1 -0
  171. package/dist/cura/p-dd552650.system.js +1 -0
  172. package/dist/cura/p-e66c2bf6.entry.js +1 -0
  173. package/dist/cura/p-fb6827d8.js +1 -0
  174. package/dist/esm/app-globals-d6124a10.js +180 -0
  175. package/dist/esm/cura-icon_2.entry.js +47 -0
  176. package/dist/esm/cura.js +19 -0
  177. package/dist/esm/dummy-component.entry.js +15 -0
  178. package/dist/esm/index-9d6a33bc.js +1334 -0
  179. package/dist/esm/index.js +1 -0
  180. package/dist/esm/loader.js +19 -0
  181. package/dist/esm/polyfills/core-js.js +11 -0
  182. package/dist/esm/polyfills/css-shim.js +1 -0
  183. package/dist/esm/polyfills/dom.js +79 -0
  184. package/dist/esm/polyfills/es5-html-element.js +1 -0
  185. package/dist/esm/polyfills/index.js +34 -0
  186. package/dist/esm/polyfills/system.js +6 -0
  187. package/dist/esm-es5/app-globals-d6124a10.js +1 -0
  188. package/dist/esm-es5/cura-icon_2.entry.js +1 -0
  189. package/dist/esm-es5/cura.js +1 -0
  190. package/dist/esm-es5/dummy-component.entry.js +1 -0
  191. package/dist/esm-es5/index-9d6a33bc.js +2 -0
  192. package/dist/esm-es5/index.js +0 -0
  193. package/dist/esm-es5/loader.js +1 -0
  194. package/dist/index.cjs.js +1 -0
  195. package/dist/index.js +1 -0
  196. package/dist/loader/cdn.js +3 -0
  197. package/dist/loader/index.cjs.js +3 -0
  198. package/dist/loader/index.d.ts +12 -0
  199. package/dist/loader/index.es2017.js +3 -0
  200. package/dist/loader/index.js +4 -0
  201. package/dist/loader/package.json +11 -0
  202. package/dist/types/api/cura-api.d.ts +5 -0
  203. package/dist/types/api/cura-api.type.d.ts +50 -0
  204. package/dist/types/api/modules/cura-theme-module.d.ts +24 -0
  205. package/dist/types/api/theme-presets/theme-default.d.ts +40 -0
  206. package/dist/types/api/theme-presets/theme-maternity.d.ts +32 -0
  207. package/dist/types/api/theme-presets/theme-presets.d.ts +71 -0
  208. package/dist/types/assets/icons/iconset-default-list.d.ts +2 -0
  209. package/dist/types/components/cura-icon/cura-icon.d.ts +9 -0
  210. package/dist/types/components/dscore-icons-view/dscore-icons-view.d.ts +6 -0
  211. package/dist/types/components/dummy-component/dummy-component.d.ts +3 -0
  212. package/dist/types/components.d.ts +73 -0
  213. package/dist/types/index.d.ts +1 -0
  214. package/dist/types/rededor-cura-start.d.ts +9 -0
  215. package/dist/types/stencil-public-runtime.d.ts +1576 -0
  216. package/dist/types/utils/utils.d.ts +1 -0
  217. package/package.json +41 -0
  218. package/readme.md +75 -0
@@ -0,0 +1,1362 @@
1
+ 'use strict';
2
+
3
+ function _interopNamespace(e) {
4
+ if (e && e.__esModule) return e;
5
+ var n = Object.create(null);
6
+ if (e) {
7
+ Object.keys(e).forEach(function (k) {
8
+ if (k !== 'default') {
9
+ var d = Object.getOwnPropertyDescriptor(e, k);
10
+ Object.defineProperty(n, k, d.get ? d : {
11
+ enumerable: true,
12
+ get: function () {
13
+ return e[k];
14
+ }
15
+ });
16
+ }
17
+ });
18
+ }
19
+ n['default'] = e;
20
+ return Object.freeze(n);
21
+ }
22
+
23
+ const NAMESPACE = 'cura';
24
+
25
+ /**
26
+ * Virtual DOM patching algorithm based on Snabbdom by
27
+ * Simon Friis Vindum (@paldepind)
28
+ * Licensed under the MIT License
29
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
30
+ *
31
+ * Modified for Stencil's renderer and slot projection
32
+ */
33
+ let scopeId;
34
+ let hostTagName;
35
+ let isSvgMode = false;
36
+ let queuePending = false;
37
+ const getAssetPath = (path) => {
38
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
39
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
40
+ };
41
+ const setAssetPath = (path) => (plt.$resourcesUrl$ = path);
42
+ const createTime = (fnName, tagName = '') => {
43
+ {
44
+ return () => {
45
+ return;
46
+ };
47
+ }
48
+ };
49
+ const uniqueTime = (key, measureText) => {
50
+ {
51
+ return () => {
52
+ return;
53
+ };
54
+ }
55
+ };
56
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
57
+ const XLINK_NS = 'http://www.w3.org/1999/xlink';
58
+ /**
59
+ * Default style mode id
60
+ */
61
+ /**
62
+ * Reusable empty obj/array
63
+ * Don't add values to these!!
64
+ */
65
+ const EMPTY_OBJ = {};
66
+ /**
67
+ * Namespaces
68
+ */
69
+ const SVG_NS = 'http://www.w3.org/2000/svg';
70
+ const HTML_NS = 'http://www.w3.org/1999/xhtml';
71
+ const isDef = (v) => v != null;
72
+ const isComplexType = (o) => {
73
+ // https://jsperf.com/typeof-fn-object/5
74
+ o = typeof o;
75
+ return o === 'object' || o === 'function';
76
+ };
77
+ /**
78
+ * Production h() function based on Preact by
79
+ * Jason Miller (@developit)
80
+ * Licensed under the MIT License
81
+ * https://github.com/developit/preact/blob/master/LICENSE
82
+ *
83
+ * Modified for Stencil's compiler and vdom
84
+ */
85
+ // const stack: any[] = [];
86
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
87
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
88
+ const h = (nodeName, vnodeData, ...children) => {
89
+ let child = null;
90
+ let simple = false;
91
+ let lastSimple = false;
92
+ const vNodeChildren = [];
93
+ const walk = (c) => {
94
+ for (let i = 0; i < c.length; i++) {
95
+ child = c[i];
96
+ if (Array.isArray(child)) {
97
+ walk(child);
98
+ }
99
+ else if (child != null && typeof child !== 'boolean') {
100
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
101
+ child = String(child);
102
+ }
103
+ if (simple && lastSimple) {
104
+ // If the previous child was simple (string), we merge both
105
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
106
+ }
107
+ else {
108
+ // Append a new vNode, if it's text, we create a text vNode
109
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
110
+ }
111
+ lastSimple = simple;
112
+ }
113
+ }
114
+ };
115
+ walk(children);
116
+ if (vnodeData) {
117
+ {
118
+ const classData = vnodeData.className || vnodeData.class;
119
+ if (classData) {
120
+ vnodeData.class =
121
+ typeof classData !== 'object'
122
+ ? classData
123
+ : Object.keys(classData)
124
+ .filter((k) => classData[k])
125
+ .join(' ');
126
+ }
127
+ }
128
+ }
129
+ const vnode = newVNode(nodeName, null);
130
+ vnode.$attrs$ = vnodeData;
131
+ if (vNodeChildren.length > 0) {
132
+ vnode.$children$ = vNodeChildren;
133
+ }
134
+ return vnode;
135
+ };
136
+ const newVNode = (tag, text) => {
137
+ const vnode = {
138
+ $flags$: 0,
139
+ $tag$: tag,
140
+ $text$: text,
141
+ $elm$: null,
142
+ $children$: null,
143
+ };
144
+ {
145
+ vnode.$attrs$ = null;
146
+ }
147
+ return vnode;
148
+ };
149
+ const Host = {};
150
+ const isHost = (node) => node && node.$tag$ === Host;
151
+ /**
152
+ * Parse a new property value for a given property type.
153
+ *
154
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
155
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
156
+ * 1. `any`, the type given to `propValue` in the function signature
157
+ * 2. the type stored from `propType`.
158
+ *
159
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
160
+ *
161
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
162
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
163
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
164
+ * ```tsx
165
+ * <my-cmp prop-val={0}></my-cmp>
166
+ * ```
167
+ *
168
+ * HTML prop values on the other hand, will always a string
169
+ *
170
+ * @param propValue the new value to coerce to some type
171
+ * @param propType the type of the prop, expressed as a binary number
172
+ * @returns the parsed/coerced value
173
+ */
174
+ const parsePropertyValue = (propValue, propType) => {
175
+ // ensure this value is of the correct prop type
176
+ if (propValue != null && !isComplexType(propValue)) {
177
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
178
+ // per the HTML spec, any string value means it is a boolean true value
179
+ // but we'll cheat here and say that the string "false" is the boolean false
180
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
181
+ }
182
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
183
+ // could have been passed as a number or boolean
184
+ // but we still want it as a string
185
+ return String(propValue);
186
+ }
187
+ // redundant return here for better minification
188
+ return propValue;
189
+ }
190
+ // not sure exactly what type we want
191
+ // so no need to change to a different type
192
+ return propValue;
193
+ };
194
+ /**
195
+ * Helper function to create & dispatch a custom Event on a provided target
196
+ * @param elm the target of the Event
197
+ * @param name the name to give the custom Event
198
+ * @param opts options for configuring a custom Event
199
+ * @returns the custom Event
200
+ */
201
+ const emitEvent = (elm, name, opts) => {
202
+ const ev = plt.ce(name, opts);
203
+ elm.dispatchEvent(ev);
204
+ return ev;
205
+ };
206
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
207
+ const registerStyle = (scopeId, cssText, allowCS) => {
208
+ let style = styles.get(scopeId);
209
+ if (supportsConstructableStylesheets && allowCS) {
210
+ style = (style || new CSSStyleSheet());
211
+ if (typeof style === 'string') {
212
+ style = cssText;
213
+ }
214
+ else {
215
+ style.replaceSync(cssText);
216
+ }
217
+ }
218
+ else {
219
+ style = cssText;
220
+ }
221
+ styles.set(scopeId, style);
222
+ };
223
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
224
+ let scopeId = getScopeId(cmpMeta);
225
+ const style = styles.get(scopeId);
226
+ // if an element is NOT connected then getRootNode() will return the wrong root node
227
+ // so the fallback is to always use the document for the root node in those cases
228
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
229
+ if (style) {
230
+ if (typeof style === 'string') {
231
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
232
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
233
+ let styleElm;
234
+ if (!appliedStyles) {
235
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
236
+ }
237
+ if (!appliedStyles.has(scopeId)) {
238
+ {
239
+ {
240
+ styleElm = doc.createElement('style');
241
+ styleElm.innerHTML = style;
242
+ }
243
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
244
+ }
245
+ if (appliedStyles) {
246
+ appliedStyles.add(scopeId);
247
+ }
248
+ }
249
+ }
250
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
251
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
252
+ }
253
+ }
254
+ return scopeId;
255
+ };
256
+ const attachStyles = (hostRef) => {
257
+ const cmpMeta = hostRef.$cmpMeta$;
258
+ const elm = hostRef.$hostElement$;
259
+ const flags = cmpMeta.$flags$;
260
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
261
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
262
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
263
+ // only required when we're NOT using native shadow dom (slot)
264
+ // or this browser doesn't support native shadow dom
265
+ // and this host element was NOT created with SSR
266
+ // let's pick out the inner content for slot projection
267
+ // create a node to represent where the original
268
+ // content was first placed, which is useful later on
269
+ // DOM WRITE!!
270
+ elm['s-sc'] = scopeId;
271
+ elm.classList.add(scopeId + '-h');
272
+ }
273
+ endAttachStyles();
274
+ };
275
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
276
+ /**
277
+ * Production setAccessor() function based on Preact by
278
+ * Jason Miller (@developit)
279
+ * Licensed under the MIT License
280
+ * https://github.com/developit/preact/blob/master/LICENSE
281
+ *
282
+ * Modified for Stencil's compiler and vdom
283
+ */
284
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
285
+ if (oldValue !== newValue) {
286
+ let isProp = isMemberInElement(elm, memberName);
287
+ let ln = memberName.toLowerCase();
288
+ if (memberName === 'class') {
289
+ const classList = elm.classList;
290
+ const oldClasses = parseClassList(oldValue);
291
+ const newClasses = parseClassList(newValue);
292
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
293
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
294
+ }
295
+ else if ((!isProp ) &&
296
+ memberName[0] === 'o' &&
297
+ memberName[1] === 'n') {
298
+ // Event Handlers
299
+ // so if the member name starts with "on" and the 3rd characters is
300
+ // a capital letter, and it's not already a member on the element,
301
+ // then we're assuming it's an event listener
302
+ if (memberName[2] === '-') {
303
+ // on- prefixed events
304
+ // allows to be explicit about the dom event to listen without any magic
305
+ // under the hood:
306
+ // <my-cmp on-click> // listens for "click"
307
+ // <my-cmp on-Click> // listens for "Click"
308
+ // <my-cmp on-ionChange> // listens for "ionChange"
309
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
310
+ memberName = memberName.slice(3);
311
+ }
312
+ else if (isMemberInElement(win, ln)) {
313
+ // standard event
314
+ // the JSX attribute could have been "onMouseOver" and the
315
+ // member name "onmouseover" is on the window's prototype
316
+ // so let's add the listener "mouseover", which is all lowercased
317
+ memberName = ln.slice(2);
318
+ }
319
+ else {
320
+ // custom event
321
+ // the JSX attribute could have been "onMyCustomEvent"
322
+ // so let's trim off the "on" prefix and lowercase the first character
323
+ // and add the listener "myCustomEvent"
324
+ // except for the first character, we keep the event name case
325
+ memberName = ln[2] + memberName.slice(3);
326
+ }
327
+ if (oldValue) {
328
+ plt.rel(elm, memberName, oldValue, false);
329
+ }
330
+ if (newValue) {
331
+ plt.ael(elm, memberName, newValue, false);
332
+ }
333
+ }
334
+ else {
335
+ // Set property if it exists and it's not a SVG
336
+ const isComplex = isComplexType(newValue);
337
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
338
+ try {
339
+ if (!elm.tagName.includes('-')) {
340
+ const n = newValue == null ? '' : newValue;
341
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
342
+ if (memberName === 'list') {
343
+ isProp = false;
344
+ }
345
+ else if (oldValue == null || elm[memberName] != n) {
346
+ elm[memberName] = n;
347
+ }
348
+ }
349
+ else {
350
+ elm[memberName] = newValue;
351
+ }
352
+ }
353
+ catch (e) { }
354
+ }
355
+ /**
356
+ * Need to manually update attribute if:
357
+ * - memberName is not an attribute
358
+ * - if we are rendering the host element in order to reflect attribute
359
+ * - if it's a SVG, since properties might not work in <svg>
360
+ * - if the newValue is null/undefined or 'false'.
361
+ */
362
+ let xlink = false;
363
+ {
364
+ if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
365
+ memberName = ln;
366
+ xlink = true;
367
+ }
368
+ }
369
+ if (newValue == null || newValue === false) {
370
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
371
+ if (xlink) {
372
+ elm.removeAttributeNS(XLINK_NS, memberName);
373
+ }
374
+ else {
375
+ elm.removeAttribute(memberName);
376
+ }
377
+ }
378
+ }
379
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
380
+ newValue = newValue === true ? '' : newValue;
381
+ if (xlink) {
382
+ elm.setAttributeNS(XLINK_NS, memberName, newValue);
383
+ }
384
+ else {
385
+ elm.setAttribute(memberName, newValue);
386
+ }
387
+ }
388
+ }
389
+ }
390
+ };
391
+ const parseClassListRegex = /\s/;
392
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
393
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
394
+ // if the element passed in is a shadow root, which is a document fragment
395
+ // then we want to be adding attrs/props to the shadow root's "host" element
396
+ // if it's not a shadow root, then we add attrs/props to the same element
397
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
398
+ ? newVnode.$elm$.host
399
+ : newVnode.$elm$;
400
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
401
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
402
+ {
403
+ // remove attributes no longer present on the vnode by setting them to undefined
404
+ for (memberName in oldVnodeAttrs) {
405
+ if (!(memberName in newVnodeAttrs)) {
406
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
407
+ }
408
+ }
409
+ }
410
+ // add new & update changed attributes
411
+ for (memberName in newVnodeAttrs) {
412
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
413
+ }
414
+ };
415
+ /**
416
+ * Create a DOM Node corresponding to one of the children of a given VNode.
417
+ *
418
+ * @param oldParentVNode the parent VNode from the previous render
419
+ * @param newParentVNode the parent VNode from the current render
420
+ * @param childIndex the index of the VNode, in the _new_ parent node's
421
+ * children, for which we will create a new DOM node
422
+ * @param parentElm the parent DOM node which our new node will be a child of
423
+ * @returns the newly created node
424
+ */
425
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
426
+ // tslint:disable-next-line: prefer-const
427
+ const newVNode = newParentVNode.$children$[childIndex];
428
+ let i = 0;
429
+ let elm;
430
+ let childNode;
431
+ if (newVNode.$text$ !== null) {
432
+ // create text node
433
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
434
+ }
435
+ else {
436
+ if (!isSvgMode) {
437
+ isSvgMode = newVNode.$tag$ === 'svg';
438
+ }
439
+ // create element
440
+ elm = newVNode.$elm$ = (doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, newVNode.$tag$)
441
+ );
442
+ if (isSvgMode && newVNode.$tag$ === 'foreignObject') {
443
+ isSvgMode = false;
444
+ }
445
+ // add css classes, attrs, props, listeners, etc.
446
+ {
447
+ updateElement(null, newVNode, isSvgMode);
448
+ }
449
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
450
+ // if there is a scopeId and this is the initial render
451
+ // then let's add the scopeId as a css class
452
+ elm.classList.add((elm['s-si'] = scopeId));
453
+ }
454
+ if (newVNode.$children$) {
455
+ for (i = 0; i < newVNode.$children$.length; ++i) {
456
+ // create the node
457
+ childNode = createElm(oldParentVNode, newVNode, i);
458
+ // return node could have been null
459
+ if (childNode) {
460
+ // append our new node
461
+ elm.appendChild(childNode);
462
+ }
463
+ }
464
+ }
465
+ {
466
+ if (newVNode.$tag$ === 'svg') {
467
+ // Only reset the SVG context when we're exiting <svg> element
468
+ isSvgMode = false;
469
+ }
470
+ else if (elm.tagName === 'foreignObject') {
471
+ // Reenter SVG context when we're exiting <foreignObject> element
472
+ isSvgMode = true;
473
+ }
474
+ }
475
+ }
476
+ return elm;
477
+ };
478
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
479
+ let containerElm = (parentElm);
480
+ let childNode;
481
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
482
+ containerElm = containerElm.shadowRoot;
483
+ }
484
+ for (; startIdx <= endIdx; ++startIdx) {
485
+ if (vnodes[startIdx]) {
486
+ childNode = createElm(null, parentVNode, startIdx);
487
+ if (childNode) {
488
+ vnodes[startIdx].$elm$ = childNode;
489
+ containerElm.insertBefore(childNode, before);
490
+ }
491
+ }
492
+ }
493
+ };
494
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
495
+ for (; startIdx <= endIdx; ++startIdx) {
496
+ if ((vnode = vnodes[startIdx])) {
497
+ elm = vnode.$elm$;
498
+ // remove the vnode's element from the dom
499
+ elm.remove();
500
+ }
501
+ }
502
+ };
503
+ /**
504
+ * Reconcile the children of a new VNode with the children of an old VNode by
505
+ * traversing the two collections of children, identifying nodes that are
506
+ * conserved or changed, calling out to `patch` to make any necessary
507
+ * updates to the DOM, and rearranging DOM nodes as needed.
508
+ *
509
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
510
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
511
+ * 'windows' by storing start and end indices and references to the
512
+ * corresponding array entries. Initially the two 'windows' are basically equal
513
+ * to the entire array, but we progressively narrow the windows until there are
514
+ * no children left to update by doing the following:
515
+ *
516
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
517
+ * that if we have an initial array like the following we'll end up dealing
518
+ * only with a window bounded by the highlighted elements:
519
+ *
520
+ * [null, null, VNode1 , ... , VNode2, null, null]
521
+ * ^^^^^^ ^^^^^^
522
+ *
523
+ * 2. Check to see if the elements at the head and tail positions are equal
524
+ * across the windows. This will basically detect elements which haven't
525
+ * been added, removed, or changed position, i.e. if you had the following
526
+ * VNode elements (represented as HTML):
527
+ *
528
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
529
+ * newVNode: `<div><p><span>THERE</span></p></div>`
530
+ *
531
+ * Then when comparing the children of the `<div>` tag we check the equality
532
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
533
+ * same tag in the same position, we'd be able to avoid completely
534
+ * re-rendering the subtree under them with a new DOM element and would just
535
+ * call out to `patch` to handle reconciling their children and so on.
536
+ *
537
+ * 3. Check, for both windows, to see if the element at the beginning of the
538
+ * window corresponds to the element at the end of the other window. This is
539
+ * a heuristic which will let us identify _some_ situations in which
540
+ * elements have changed position, for instance it _should_ detect that the
541
+ * children nodes themselves have not changed but merely moved in the
542
+ * following example:
543
+ *
544
+ * oldVNode: `<div><element-one /><element-two /></div>`
545
+ * newVNode: `<div><element-two /><element-one /></div>`
546
+ *
547
+ * If we find cases like this then we also need to move the concrete DOM
548
+ * elements corresponding to the moved children to write the re-order to the
549
+ * DOM.
550
+ *
551
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
552
+ * nodes in the old children which have the same key as the first element in
553
+ * our window on the new children. If we find such a node we handle calling
554
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
555
+ * what we find.
556
+ *
557
+ * Finally, once we've narrowed our 'windows' to the point that either of them
558
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
559
+ * insertion or deletion that needs to happen to get a DOM state that correctly
560
+ * reflects the new child VNodes. If, for instance, after our window on the old
561
+ * children has collapsed we still have more nodes on the new children that
562
+ * we haven't dealt with yet then we need to add them, or if the new children
563
+ * collapse but we still have unhandled _old_ children then we need to make
564
+ * sure the corresponding DOM nodes are removed.
565
+ *
566
+ * @param parentElm the node into which the parent VNode is rendered
567
+ * @param oldCh the old children of the parent node
568
+ * @param newVNode the new VNode which will replace the parent
569
+ * @param newCh the new children of the parent node
570
+ */
571
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
572
+ let oldStartIdx = 0;
573
+ let newStartIdx = 0;
574
+ let oldEndIdx = oldCh.length - 1;
575
+ let oldStartVnode = oldCh[0];
576
+ let oldEndVnode = oldCh[oldEndIdx];
577
+ let newEndIdx = newCh.length - 1;
578
+ let newStartVnode = newCh[0];
579
+ let newEndVnode = newCh[newEndIdx];
580
+ let node;
581
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
582
+ if (oldStartVnode == null) {
583
+ // VNode might have been moved left
584
+ oldStartVnode = oldCh[++oldStartIdx];
585
+ }
586
+ else if (oldEndVnode == null) {
587
+ oldEndVnode = oldCh[--oldEndIdx];
588
+ }
589
+ else if (newStartVnode == null) {
590
+ newStartVnode = newCh[++newStartIdx];
591
+ }
592
+ else if (newEndVnode == null) {
593
+ newEndVnode = newCh[--newEndIdx];
594
+ }
595
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
596
+ // if the start nodes are the same then we should patch the new VNode
597
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
598
+ // indices to reflect that. We don't need to move any DOM Nodes around
599
+ // since things are matched up in order.
600
+ patch(oldStartVnode, newStartVnode);
601
+ oldStartVnode = oldCh[++oldStartIdx];
602
+ newStartVnode = newCh[++newStartIdx];
603
+ }
604
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
605
+ // likewise, if the end nodes are the same we patch new onto old and
606
+ // decrement our end indices, and also likewise in this case we don't
607
+ // need to move any DOM Nodes.
608
+ patch(oldEndVnode, newEndVnode);
609
+ oldEndVnode = oldCh[--oldEndIdx];
610
+ newEndVnode = newCh[--newEndIdx];
611
+ }
612
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
613
+ patch(oldStartVnode, newEndVnode);
614
+ // We need to move the element for `oldStartVnode` into a position which
615
+ // will be appropriate for `newEndVnode`. For this we can use
616
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
617
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
618
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
619
+ //
620
+ // <old-start-node />
621
+ // <some-intervening-node />
622
+ // <old-end-node />
623
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
624
+ // <next-sibling />
625
+ //
626
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
627
+ // the node for `oldStartVnode` at the end of the children of
628
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
629
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
630
+ // append it to the children of the parent element.
631
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
632
+ oldStartVnode = oldCh[++oldStartIdx];
633
+ newEndVnode = newCh[--newEndIdx];
634
+ }
635
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
636
+ patch(oldEndVnode, newStartVnode);
637
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
638
+ // the same node, so since we're here we know that they are not. Thus we
639
+ // can move the element for `oldEndVnode` _before_ the element for
640
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
641
+ // future.
642
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
643
+ oldEndVnode = oldCh[--oldEndIdx];
644
+ newStartVnode = newCh[++newStartIdx];
645
+ }
646
+ else {
647
+ {
648
+ // We either didn't find an element in the old children that matches
649
+ // the key of the first new child OR the build is not using `key`
650
+ // attributes at all. In either case we need to create a new element
651
+ // for the new node.
652
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
653
+ newStartVnode = newCh[++newStartIdx];
654
+ }
655
+ if (node) {
656
+ // if we created a new node then handle inserting it to the DOM
657
+ {
658
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
659
+ }
660
+ }
661
+ }
662
+ }
663
+ if (oldStartIdx > oldEndIdx) {
664
+ // we have some more new nodes to add which don't match up with old nodes
665
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
666
+ }
667
+ else if (newStartIdx > newEndIdx) {
668
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
669
+ // in the new array, so lets remove them (which entails cleaning up the
670
+ // relevant DOM nodes)
671
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
672
+ }
673
+ };
674
+ /**
675
+ * Compare two VNodes to determine if they are the same
676
+ *
677
+ * **NB**: This function is an equality _heuristic_ based on the available
678
+ * information set on the two VNodes and can be misleading under certain
679
+ * circumstances. In particular, if the two nodes do not have `key` attrs
680
+ * (available under `$key$` on VNodes) then the function falls back on merely
681
+ * checking that they have the same tag.
682
+ *
683
+ * So, in other words, if `key` attrs are not set on VNodes which may be
684
+ * changing order within a `children` array or something along those lines then
685
+ * we could obtain a false positive and then have to do needless re-rendering.
686
+ *
687
+ * @param leftVNode the first VNode to check
688
+ * @param rightVNode the second VNode to check
689
+ * @returns whether they're equal or not
690
+ */
691
+ const isSameVnode = (leftVNode, rightVNode) => {
692
+ // compare if two vnode to see if they're "technically" the same
693
+ // need to have the same element tag, and same key to be the same
694
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
695
+ return true;
696
+ }
697
+ return false;
698
+ };
699
+ /**
700
+ * Handle reconciling an outdated VNode with a new one which corresponds to
701
+ * it. This function handles flushing updates to the DOM and reconciling the
702
+ * children of the two nodes (if any).
703
+ *
704
+ * @param oldVNode an old VNode whose DOM element and children we want to update
705
+ * @param newVNode a new VNode representing an updated version of the old one
706
+ */
707
+ const patch = (oldVNode, newVNode) => {
708
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
709
+ const oldChildren = oldVNode.$children$;
710
+ const newChildren = newVNode.$children$;
711
+ const tag = newVNode.$tag$;
712
+ const text = newVNode.$text$;
713
+ if (text === null) {
714
+ {
715
+ // test if we're rendering an svg element, or still rendering nodes inside of one
716
+ // only add this to the when the compiler sees we're using an svg somewhere
717
+ isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
718
+ }
719
+ {
720
+ if (tag === 'slot')
721
+ ;
722
+ else {
723
+ // either this is the first render of an element OR it's an update
724
+ // AND we already know it's possible it could have changed
725
+ // this updates the element's css classes, attrs, props, listeners, etc.
726
+ updateElement(oldVNode, newVNode, isSvgMode);
727
+ }
728
+ }
729
+ if (oldChildren !== null && newChildren !== null) {
730
+ // looks like there's child vnodes for both the old and new vnodes
731
+ // so we need to call `updateChildren` to reconcile them
732
+ updateChildren(elm, oldChildren, newVNode, newChildren);
733
+ }
734
+ else if (newChildren !== null) {
735
+ // no old child vnodes, but there are new child vnodes to add
736
+ if (oldVNode.$text$ !== null) {
737
+ // the old vnode was text, so be sure to clear it out
738
+ elm.textContent = '';
739
+ }
740
+ // add the new vnode children
741
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
742
+ }
743
+ else if (oldChildren !== null) {
744
+ // no new child vnodes, but there are old child vnodes to remove
745
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
746
+ }
747
+ if (isSvgMode && tag === 'svg') {
748
+ isSvgMode = false;
749
+ }
750
+ }
751
+ else if (oldVNode.$text$ !== text) {
752
+ // update the text content for the text only vnode
753
+ // and also only if the text is different than before
754
+ elm.data = text;
755
+ }
756
+ };
757
+ const renderVdom = (hostRef, renderFnResults) => {
758
+ const hostElm = hostRef.$hostElement$;
759
+ const cmpMeta = hostRef.$cmpMeta$;
760
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
761
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
762
+ hostTagName = hostElm.tagName;
763
+ if (cmpMeta.$attrsToReflect$) {
764
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
765
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
766
+ }
767
+ rootVnode.$tag$ = null;
768
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
769
+ hostRef.$vnode$ = rootVnode;
770
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
771
+ {
772
+ scopeId = hostElm['s-sc'];
773
+ }
774
+ // synchronous patch
775
+ patch(oldVNode, rootVnode);
776
+ };
777
+ const attachToAncestor = (hostRef, ancestorComponent) => {
778
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
779
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
780
+ }
781
+ };
782
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
783
+ {
784
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
785
+ }
786
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
787
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
788
+ return;
789
+ }
790
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
791
+ // there is no ancestor component or the ancestor component
792
+ // has already fired off its lifecycle update then
793
+ // fire off the initial update
794
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
795
+ return writeTask(dispatch) ;
796
+ };
797
+ const dispatchHooks = (hostRef, isInitialLoad) => {
798
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
799
+ const instance = hostRef.$lazyInstance$ ;
800
+ let promise;
801
+ endSchedule();
802
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
803
+ };
804
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
805
+ // updateComponent
806
+ const elm = hostRef.$hostElement$;
807
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
808
+ const rc = elm['s-rc'];
809
+ if (isInitialLoad) {
810
+ // DOM WRITE!
811
+ attachStyles(hostRef);
812
+ }
813
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
814
+ {
815
+ callRender(hostRef, instance);
816
+ }
817
+ if (rc) {
818
+ // ok, so turns out there are some child host elements
819
+ // waiting on this parent element to load
820
+ // let's fire off all update callbacks waiting
821
+ rc.map((cb) => cb());
822
+ elm['s-rc'] = undefined;
823
+ }
824
+ endRender();
825
+ endUpdate();
826
+ {
827
+ const childrenPromises = elm['s-p'];
828
+ const postUpdate = () => postUpdateComponent(hostRef);
829
+ if (childrenPromises.length === 0) {
830
+ postUpdate();
831
+ }
832
+ else {
833
+ Promise.all(childrenPromises).then(postUpdate);
834
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
835
+ childrenPromises.length = 0;
836
+ }
837
+ }
838
+ };
839
+ const callRender = (hostRef, instance, elm) => {
840
+ try {
841
+ instance = instance.render() ;
842
+ {
843
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
844
+ }
845
+ {
846
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
847
+ }
848
+ {
849
+ {
850
+ // looks like we've got child nodes to render into this host element
851
+ // or we need to update the css class/attrs on the host element
852
+ // DOM WRITE!
853
+ {
854
+ renderVdom(hostRef, instance);
855
+ }
856
+ }
857
+ }
858
+ }
859
+ catch (e) {
860
+ consoleError(e, hostRef.$hostElement$);
861
+ }
862
+ return null;
863
+ };
864
+ const postUpdateComponent = (hostRef) => {
865
+ const tagName = hostRef.$cmpMeta$.$tagName$;
866
+ const elm = hostRef.$hostElement$;
867
+ const endPostUpdate = createTime('postUpdate', tagName);
868
+ const ancestorComponent = hostRef.$ancestorComponent$;
869
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
870
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
871
+ {
872
+ // DOM WRITE!
873
+ addHydratedFlag(elm);
874
+ }
875
+ endPostUpdate();
876
+ {
877
+ hostRef.$onReadyResolve$(elm);
878
+ if (!ancestorComponent) {
879
+ appDidLoad();
880
+ }
881
+ }
882
+ }
883
+ else {
884
+ endPostUpdate();
885
+ }
886
+ // load events fire from bottom to top
887
+ // the deepest elements load first then bubbles up
888
+ {
889
+ if (hostRef.$onRenderResolve$) {
890
+ hostRef.$onRenderResolve$();
891
+ hostRef.$onRenderResolve$ = undefined;
892
+ }
893
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
894
+ nextTick(() => scheduleUpdate(hostRef, false));
895
+ }
896
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
897
+ }
898
+ // ( •_•)
899
+ // ( •_•)>⌐■-■
900
+ // (⌐■_■)
901
+ };
902
+ const appDidLoad = (who) => {
903
+ // on appload
904
+ // we have finish the first big initial render
905
+ {
906
+ addHydratedFlag(doc.documentElement);
907
+ }
908
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
909
+ };
910
+ const then = (promise, thenFn) => {
911
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
912
+ };
913
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
914
+ ;
915
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
916
+ const setValue = (ref, propName, newVal, cmpMeta) => {
917
+ // check our new property value against our internal value
918
+ const hostRef = getHostRef(ref);
919
+ const oldVal = hostRef.$instanceValues$.get(propName);
920
+ const flags = hostRef.$flags$;
921
+ const instance = hostRef.$lazyInstance$ ;
922
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
923
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
924
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
925
+ const didValueChange = newVal !== oldVal && !areBothNaN;
926
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
927
+ // gadzooks! the property's value has changed!!
928
+ // set our new value!
929
+ hostRef.$instanceValues$.set(propName, newVal);
930
+ if (instance) {
931
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
932
+ // looks like this value actually changed, so we've got work to do!
933
+ // but only if we've already rendered, otherwise just chill out
934
+ // queue that we need to do an update, but don't worry about queuing
935
+ // up millions cuz this function ensures it only runs once
936
+ scheduleUpdate(hostRef, false);
937
+ }
938
+ }
939
+ }
940
+ };
941
+ /**
942
+ * Attach a series of runtime constructs to a compiled Stencil component
943
+ * constructor, including getters and setters for the `@Prop` and `@State`
944
+ * decorators, callbacks for when attributes change, and so on.
945
+ *
946
+ * @param Cstr the constructor for a component that we need to process
947
+ * @param cmpMeta metadata collected previously about the component
948
+ * @param flags a number used to store a series of bit flags
949
+ * @returns a reference to the same constructor passed in (but now mutated)
950
+ */
951
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
952
+ if (cmpMeta.$members$) {
953
+ // It's better to have a const than two Object.entries()
954
+ const members = Object.entries(cmpMeta.$members$);
955
+ const prototype = Cstr.prototype;
956
+ members.map(([memberName, [memberFlags]]) => {
957
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
958
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
959
+ // proxyComponent - prop
960
+ Object.defineProperty(prototype, memberName, {
961
+ get() {
962
+ // proxyComponent, get value
963
+ return getValue(this, memberName);
964
+ },
965
+ set(newValue) {
966
+ // proxyComponent, set value
967
+ setValue(this, memberName, newValue, cmpMeta);
968
+ },
969
+ configurable: true,
970
+ enumerable: true,
971
+ });
972
+ }
973
+ });
974
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
975
+ const attrNameToPropName = new Map();
976
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
977
+ plt.jmp(() => {
978
+ const propName = attrNameToPropName.get(attrName);
979
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
980
+ // in the case where an attribute was set inline.
981
+ // ```html
982
+ // <my-component some-attribute="some-value"></my-component>
983
+ // ```
984
+ //
985
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
986
+ // programmatically changes it before it has been upgraded as shown below:
987
+ //
988
+ // ```html
989
+ // <!-- this component has _not_ been upgraded yet -->
990
+ // <my-component id="test" some-attribute="some-value"></my-component>
991
+ // <script>
992
+ // // grab non-upgraded component
993
+ // el = document.querySelector("#test");
994
+ // el.someAttribute = "another-value";
995
+ // // upgrade component
996
+ // customElements.define('my-component', MyComponent);
997
+ // </script>
998
+ // ```
999
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1000
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1001
+ // to the value that was set inline i.e. "some-value" from above example. When
1002
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1003
+ //
1004
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1005
+ // by connectedCallback as this attributeChangedCallback will not fire.
1006
+ //
1007
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1008
+ //
1009
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1010
+ // properties here given that this goes against best practices outlined here
1011
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1012
+ if (this.hasOwnProperty(propName)) {
1013
+ newValue = this[propName];
1014
+ delete this[propName];
1015
+ }
1016
+ else if (prototype.hasOwnProperty(propName) &&
1017
+ typeof this[propName] === 'number' &&
1018
+ this[propName] == newValue) {
1019
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1020
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1021
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1022
+ return;
1023
+ }
1024
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1025
+ });
1026
+ };
1027
+ // create an array of attributes to observe
1028
+ // and also create a map of html attribute name to js property name
1029
+ Cstr.observedAttributes = members
1030
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */) // filter to only keep props that should match attributes
1031
+ .map(([propName, m]) => {
1032
+ const attrName = m[1] || propName;
1033
+ attrNameToPropName.set(attrName, propName);
1034
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1035
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1036
+ }
1037
+ return attrName;
1038
+ });
1039
+ }
1040
+ }
1041
+ return Cstr;
1042
+ };
1043
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1044
+ // initializeComponent
1045
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1046
+ {
1047
+ // we haven't initialized this element yet
1048
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1049
+ // lazy loaded components
1050
+ // request the component's implementation to be
1051
+ // wired up with the host element
1052
+ Cstr = loadModule(cmpMeta);
1053
+ if (Cstr.then) {
1054
+ // Await creates a micro-task avoid if possible
1055
+ const endLoad = uniqueTime();
1056
+ Cstr = await Cstr;
1057
+ endLoad();
1058
+ }
1059
+ if (!Cstr.isProxied) {
1060
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1061
+ Cstr.isProxied = true;
1062
+ }
1063
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1064
+ // ok, time to construct the instance
1065
+ // but let's keep track of when we start and stop
1066
+ // so that the getters/setters don't incorrectly step on data
1067
+ {
1068
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1069
+ }
1070
+ // construct the lazy-loaded component implementation
1071
+ // passing the hostRef is very important during
1072
+ // construction in order to directly wire together the
1073
+ // host element and the lazy-loaded instance
1074
+ try {
1075
+ new Cstr(hostRef);
1076
+ }
1077
+ catch (e) {
1078
+ consoleError(e);
1079
+ }
1080
+ {
1081
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1082
+ }
1083
+ endNewInstance();
1084
+ }
1085
+ if (Cstr.style) {
1086
+ // this component has styles but we haven't registered them yet
1087
+ let style = Cstr.style;
1088
+ const scopeId = getScopeId(cmpMeta);
1089
+ if (!styles.has(scopeId)) {
1090
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1091
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1092
+ endRegisterStyles();
1093
+ }
1094
+ }
1095
+ }
1096
+ // we've successfully created a lazy instance
1097
+ const ancestorComponent = hostRef.$ancestorComponent$;
1098
+ const schedule = () => scheduleUpdate(hostRef, true);
1099
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1100
+ // this is the initial load and this component it has an ancestor component
1101
+ // but the ancestor component has NOT fired its will update lifecycle yet
1102
+ // so let's just cool our jets and wait for the ancestor to continue first
1103
+ // this will get fired off when the ancestor component
1104
+ // finally gets around to rendering its lazy self
1105
+ // fire off the initial update
1106
+ ancestorComponent['s-rc'].push(schedule);
1107
+ }
1108
+ else {
1109
+ schedule();
1110
+ }
1111
+ };
1112
+ const connectedCallback = (elm) => {
1113
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1114
+ const hostRef = getHostRef(elm);
1115
+ const cmpMeta = hostRef.$cmpMeta$;
1116
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1117
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1118
+ // first time this component has connected
1119
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1120
+ {
1121
+ // find the first ancestor component (if there is one) and register
1122
+ // this component as one of the actively loading child components for its ancestor
1123
+ let ancestorComponent = elm;
1124
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1125
+ // climb up the ancestors looking for the first
1126
+ // component that hasn't finished its lifecycle update yet
1127
+ if (ancestorComponent['s-p']) {
1128
+ // we found this components first ancestor component
1129
+ // keep a reference to this component's ancestor component
1130
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1131
+ break;
1132
+ }
1133
+ }
1134
+ }
1135
+ // Lazy properties
1136
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1137
+ if (cmpMeta.$members$) {
1138
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1139
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1140
+ const value = elm[memberName];
1141
+ delete elm[memberName];
1142
+ elm[memberName] = value;
1143
+ }
1144
+ });
1145
+ }
1146
+ {
1147
+ initializeComponent(elm, hostRef, cmpMeta);
1148
+ }
1149
+ }
1150
+ endConnected();
1151
+ }
1152
+ };
1153
+ const disconnectedCallback = (elm) => {
1154
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1155
+ getHostRef(elm);
1156
+ }
1157
+ };
1158
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1159
+ const endBootstrap = createTime();
1160
+ const cmpTags = [];
1161
+ const exclude = options.exclude || [];
1162
+ const customElements = win.customElements;
1163
+ const head = doc.head;
1164
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1165
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1166
+ const deferredConnectedCallbacks = [];
1167
+ let appLoadFallback;
1168
+ let isBootstrapping = true;
1169
+ Object.assign(plt, options);
1170
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1171
+ lazyBundles.map((lazyBundle) => {
1172
+ lazyBundle[1].map((compactMeta) => {
1173
+ const cmpMeta = {
1174
+ $flags$: compactMeta[0],
1175
+ $tagName$: compactMeta[1],
1176
+ $members$: compactMeta[2],
1177
+ $listeners$: compactMeta[3],
1178
+ };
1179
+ {
1180
+ cmpMeta.$members$ = compactMeta[2];
1181
+ }
1182
+ {
1183
+ cmpMeta.$attrsToReflect$ = [];
1184
+ }
1185
+ const tagName = cmpMeta.$tagName$;
1186
+ const HostElement = class extends HTMLElement {
1187
+ // StencilLazyHost
1188
+ constructor(self) {
1189
+ // @ts-ignore
1190
+ super(self);
1191
+ self = this;
1192
+ registerHost(self, cmpMeta);
1193
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1194
+ // this component is using shadow dom
1195
+ // and this browser supports shadow dom
1196
+ // add the read-only property "shadowRoot" to the host element
1197
+ // adding the shadow root build conditionals to minimize runtime
1198
+ {
1199
+ {
1200
+ self.attachShadow({ mode: 'open' });
1201
+ }
1202
+ }
1203
+ }
1204
+ }
1205
+ connectedCallback() {
1206
+ if (appLoadFallback) {
1207
+ clearTimeout(appLoadFallback);
1208
+ appLoadFallback = null;
1209
+ }
1210
+ if (isBootstrapping) {
1211
+ // connectedCallback will be processed once all components have been registered
1212
+ deferredConnectedCallbacks.push(this);
1213
+ }
1214
+ else {
1215
+ plt.jmp(() => connectedCallback(this));
1216
+ }
1217
+ }
1218
+ disconnectedCallback() {
1219
+ plt.jmp(() => disconnectedCallback(this));
1220
+ }
1221
+ componentOnReady() {
1222
+ return getHostRef(this).$onReadyPromise$;
1223
+ }
1224
+ };
1225
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1226
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1227
+ cmpTags.push(tagName);
1228
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1229
+ }
1230
+ });
1231
+ });
1232
+ {
1233
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1234
+ visibilityStyle.setAttribute('data-styles', '');
1235
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1236
+ }
1237
+ // Process deferred connectedCallbacks now all components have been registered
1238
+ isBootstrapping = false;
1239
+ if (deferredConnectedCallbacks.length) {
1240
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1241
+ }
1242
+ else {
1243
+ {
1244
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1245
+ }
1246
+ }
1247
+ // Fallback appLoad event
1248
+ endBootstrap();
1249
+ };
1250
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1251
+ const getHostRef = (ref) => hostRefs.get(ref);
1252
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1253
+ const registerHost = (elm, cmpMeta) => {
1254
+ const hostRef = {
1255
+ $flags$: 0,
1256
+ $hostElement$: elm,
1257
+ $cmpMeta$: cmpMeta,
1258
+ $instanceValues$: new Map(),
1259
+ };
1260
+ {
1261
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1262
+ elm['s-p'] = [];
1263
+ elm['s-rc'] = [];
1264
+ }
1265
+ return hostRefs.set(elm, hostRef);
1266
+ };
1267
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1268
+ const consoleError = (e, el) => (0, console.error)(e, el);
1269
+ const cmpModules = /*@__PURE__*/ new Map();
1270
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1271
+ // loadModuleImport
1272
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1273
+ const bundleId = cmpMeta.$lazyBundleId$;
1274
+ const module = cmpModules.get(bundleId) ;
1275
+ if (module) {
1276
+ return module[exportName];
1277
+ }
1278
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/
1279
+ return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(
1280
+ /* @vite-ignore */
1281
+ /* webpackInclude: /\.entry\.js$/ */
1282
+ /* webpackExclude: /\.system\.entry\.js$/ */
1283
+ /* webpackMode: "lazy" */
1284
+ `./${bundleId}.entry.js${''}`)); }).then((importedModule) => {
1285
+ {
1286
+ cmpModules.set(bundleId, importedModule);
1287
+ }
1288
+ return importedModule[exportName];
1289
+ }, consoleError);
1290
+ };
1291
+ const styles = /*@__PURE__*/ new Map();
1292
+ const win = typeof window !== 'undefined' ? window : {};
1293
+ const doc = win.document || { head: {} };
1294
+ const plt = {
1295
+ $flags$: 0,
1296
+ $resourcesUrl$: '',
1297
+ jmp: (h) => h(),
1298
+ raf: (h) => requestAnimationFrame(h),
1299
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1300
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1301
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1302
+ };
1303
+ const promiseResolve = (v) => Promise.resolve(v);
1304
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1305
+ try {
1306
+ new CSSStyleSheet();
1307
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1308
+ }
1309
+ catch (e) { }
1310
+ return false;
1311
+ })()
1312
+ ;
1313
+ const queueDomReads = [];
1314
+ const queueDomWrites = [];
1315
+ const queueTask = (queue, write) => (cb) => {
1316
+ queue.push(cb);
1317
+ if (!queuePending) {
1318
+ queuePending = true;
1319
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1320
+ nextTick(flush);
1321
+ }
1322
+ else {
1323
+ plt.raf(flush);
1324
+ }
1325
+ }
1326
+ };
1327
+ const consume = (queue) => {
1328
+ for (let i = 0; i < queue.length; i++) {
1329
+ try {
1330
+ queue[i](performance.now());
1331
+ }
1332
+ catch (e) {
1333
+ consoleError(e);
1334
+ }
1335
+ }
1336
+ queue.length = 0;
1337
+ };
1338
+ const flush = () => {
1339
+ // always force a bunch of medium callbacks to run, but still have
1340
+ // a throttle on how many can run in a certain time
1341
+ // DOM READS!!!
1342
+ consume(queueDomReads);
1343
+ // DOM WRITES!!!
1344
+ {
1345
+ consume(queueDomWrites);
1346
+ if ((queuePending = queueDomReads.length > 0)) {
1347
+ // still more to do yet, but we've run out of time
1348
+ // let's let this thing cool off and try again in the next tick
1349
+ plt.raf(flush);
1350
+ }
1351
+ }
1352
+ };
1353
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1354
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1355
+
1356
+ exports.Host = Host;
1357
+ exports.bootstrapLazy = bootstrapLazy;
1358
+ exports.getAssetPath = getAssetPath;
1359
+ exports.h = h;
1360
+ exports.promiseResolve = promiseResolve;
1361
+ exports.registerInstance = registerInstance;
1362
+ exports.setAssetPath = setAssetPath;