@maggioli-design-system/mds-input-tip 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (190) hide show
  1. package/dist/cjs/index-fe2df682.js +1571 -0
  2. package/dist/cjs/index.cjs.js +2 -0
  3. package/dist/cjs/loader.cjs.js +13 -0
  4. package/dist/cjs/mds-input-tip.cjs.entry.js +21 -0
  5. package/dist/cjs/mds-input-tip.cjs.js +23 -0
  6. package/dist/collection/collection-manifest.json +12 -0
  7. package/dist/collection/common/aria.js +29 -0
  8. package/dist/collection/common/file.js +48 -0
  9. package/dist/collection/common/icon.js +15 -0
  10. package/dist/collection/common/keyboard-manager.js +45 -0
  11. package/dist/collection/common/locale.js +20 -0
  12. package/dist/collection/common/unit.js +22 -0
  13. package/dist/collection/common/yugop/core.js +16 -0
  14. package/dist/collection/common/yugop/index.js +3 -0
  15. package/dist/collection/common/yugop/random-text.js +59 -0
  16. package/dist/collection/common/yugop/utils/math.js +11 -0
  17. package/dist/collection/common/yugop/utils/noop.js +1 -0
  18. package/dist/collection/common/yugop/utils/prng.js +21 -0
  19. package/dist/collection/common/yugop/utils/string.js +2 -0
  20. package/dist/collection/components/mds-input-tip/mds-input-tip.css +280 -0
  21. package/dist/collection/components/mds-input-tip/mds-input-tip.js +68 -0
  22. package/dist/collection/components/mds-input-tip/meta/types.js +1 -0
  23. package/dist/collection/components/mds-input-tip/test/mds-input-tip.e2e.js +9 -0
  24. package/dist/collection/dictionary/autocomplete.js +59 -0
  25. package/dist/collection/dictionary/button.js +30 -0
  26. package/dist/collection/dictionary/color.js +19 -0
  27. package/dist/collection/dictionary/file-extensions.js +64 -0
  28. package/dist/collection/dictionary/floating-ui.js +19 -0
  29. package/dist/collection/dictionary/icon.js +10 -0
  30. package/dist/collection/dictionary/input.js +37 -0
  31. package/dist/collection/dictionary/loading.js +5 -0
  32. package/dist/collection/dictionary/text.js +6 -0
  33. package/dist/collection/dictionary/typography.js +67 -0
  34. package/dist/collection/dictionary/variant.js +90 -0
  35. package/dist/collection/fixtures/cities.js +110 -0
  36. package/dist/collection/fixtures/filenames.js +57 -0
  37. package/dist/collection/interface/input-value.js +1 -0
  38. package/dist/collection/type/autocomplete.js +1 -0
  39. package/dist/collection/type/button.js +1 -0
  40. package/dist/collection/type/file-types.js +1 -0
  41. package/dist/collection/type/floating-ui.js +1 -0
  42. package/dist/collection/type/form-rel.js +1 -0
  43. package/dist/collection/type/input.js +1 -0
  44. package/dist/collection/type/loading.js +1 -0
  45. package/dist/collection/type/text.js +1 -0
  46. package/dist/collection/type/typography.js +1 -0
  47. package/dist/collection/type/variant-file-format.js +120 -0
  48. package/dist/collection/type/variant.js +1 -0
  49. package/dist/components/index.d.ts +33 -0
  50. package/dist/components/index.js +1 -0
  51. package/dist/components/mds-input-tip.d.ts +11 -0
  52. package/dist/components/mds-input-tip.js +38 -0
  53. package/dist/documentation.d.ts +401 -0
  54. package/dist/documentation.json +97 -0
  55. package/dist/esm/index-351c5c8a.js +1544 -0
  56. package/dist/esm/index.js +1 -0
  57. package/dist/esm/loader.js +9 -0
  58. package/dist/esm/mds-input-tip.entry.js +17 -0
  59. package/dist/esm/mds-input-tip.js +18 -0
  60. package/dist/esm/polyfills/core-js.js +11 -0
  61. package/dist/esm/polyfills/dom.js +79 -0
  62. package/dist/esm/polyfills/es5-html-element.js +1 -0
  63. package/dist/esm/polyfills/index.js +34 -0
  64. package/dist/esm/polyfills/system.js +6 -0
  65. package/dist/esm-es5/index-351c5c8a.js +1 -0
  66. package/dist/esm-es5/index.js +0 -0
  67. package/dist/esm-es5/loader.js +1 -0
  68. package/dist/esm-es5/mds-input-tip.entry.js +1 -0
  69. package/dist/esm-es5/mds-input-tip.js +1 -0
  70. package/dist/index.cjs.js +1 -0
  71. package/dist/index.js +1 -0
  72. package/dist/mds-input-tip/index.esm.js +0 -0
  73. package/dist/mds-input-tip/mds-input-tip.esm.js +1 -0
  74. package/dist/mds-input-tip/mds-input-tip.js +127 -0
  75. package/dist/mds-input-tip/p-22b86e20.js +2 -0
  76. package/dist/mds-input-tip/p-3428f886.system.js +2 -0
  77. package/dist/mds-input-tip/p-50ea2036.system.js +1 -0
  78. package/dist/mds-input-tip/p-630886b5.entry.js +1 -0
  79. package/dist/mds-input-tip/p-89e037f5.system.entry.js +1 -0
  80. package/dist/mds-input-tip/p-e5fe0b68.system.js +1 -0
  81. package/dist/stats.json +500 -0
  82. package/dist/types/common/aria.d.ts +5 -0
  83. package/dist/types/common/file.d.ts +12 -0
  84. package/dist/types/common/icon.d.ts +5 -0
  85. package/dist/types/common/keyboard-manager.d.ts +12 -0
  86. package/dist/types/common/locale.d.ts +14 -0
  87. package/dist/types/common/unit.d.ts +3 -0
  88. package/dist/types/common/yugop/core.d.ts +10 -0
  89. package/dist/types/common/yugop/index.d.ts +1 -0
  90. package/dist/types/common/yugop/random-text.d.ts +31 -0
  91. package/dist/types/common/yugop/utils/math.d.ts +3 -0
  92. package/dist/types/common/yugop/utils/noop.d.ts +1 -0
  93. package/dist/types/common/yugop/utils/prng.d.ts +8 -0
  94. package/dist/types/common/yugop/utils/string.d.ts +1 -0
  95. package/dist/types/components/mds-input-tip/mds-input-tip.d.ts +12 -0
  96. package/dist/types/components/mds-input-tip/meta/types.d.ts +1 -0
  97. package/dist/types/components.d.ts +55 -0
  98. package/dist/types/dictionary/autocomplete.d.ts +2 -0
  99. package/dist/types/dictionary/button.d.ts +6 -0
  100. package/dist/types/dictionary/color.d.ts +3 -0
  101. package/dist/types/dictionary/file-extensions.d.ts +11 -0
  102. package/dist/types/dictionary/floating-ui.d.ts +3 -0
  103. package/dist/types/dictionary/icon.d.ts +4 -0
  104. package/dist/types/dictionary/input.d.ts +5 -0
  105. package/dist/types/dictionary/loading.d.ts +2 -0
  106. package/dist/types/dictionary/text.d.ts +2 -0
  107. package/dist/types/dictionary/typography.d.ts +11 -0
  108. package/dist/types/dictionary/variant.d.ts +11 -0
  109. package/dist/types/fixtures/cities.d.ts +2 -0
  110. package/dist/types/fixtures/filenames.d.ts +2 -0
  111. package/dist/types/interface/input-value.d.ts +4 -0
  112. package/dist/types/stencil-public-runtime.d.ts +1681 -0
  113. package/dist/types/type/autocomplete.d.ts +2 -0
  114. package/dist/types/type/button.d.ts +5 -0
  115. package/dist/types/type/file-types.d.ts +1 -0
  116. package/dist/types/type/floating-ui.d.ts +2 -0
  117. package/dist/types/type/form-rel.d.ts +1 -0
  118. package/dist/types/type/input.d.ts +4 -0
  119. package/dist/types/type/loading.d.ts +1 -0
  120. package/dist/types/type/text.d.ts +1 -0
  121. package/dist/types/type/typography.d.ts +10 -0
  122. package/dist/types/type/variant-file-format.d.ts +11 -0
  123. package/dist/types/type/variant.d.ts +12 -0
  124. package/documentation.json +568 -0
  125. package/loader/cdn.js +3 -0
  126. package/loader/index.cjs.js +3 -0
  127. package/loader/index.d.ts +21 -0
  128. package/loader/index.es2017.js +3 -0
  129. package/loader/index.js +4 -0
  130. package/loader/package.json +11 -0
  131. package/package.json +59 -0
  132. package/readme.md +33 -0
  133. package/src/common/aria.ts +39 -0
  134. package/src/common/file.ts +63 -0
  135. package/src/common/icon.ts +25 -0
  136. package/src/common/keyboard-manager.ts +50 -0
  137. package/src/common/locale.ts +31 -0
  138. package/src/common/unit.ts +33 -0
  139. package/src/common/yugop/core.ts +47 -0
  140. package/src/common/yugop/index.ts +4 -0
  141. package/src/common/yugop/random-text.ts +95 -0
  142. package/src/common/yugop/utils/math.ts +21 -0
  143. package/src/common/yugop/utils/noop.ts +1 -0
  144. package/src/common/yugop/utils/prng.ts +35 -0
  145. package/src/common/yugop/utils/string.ts +4 -0
  146. package/src/components/mds-input-tip/.gitlab-ci.yml +25 -0
  147. package/src/components/mds-input-tip/mds-input-tip.css +52 -0
  148. package/src/components/mds-input-tip/mds-input-tip.tsx +28 -0
  149. package/src/components/mds-input-tip/meta/types.ts +3 -0
  150. package/src/components/mds-input-tip/readme.md +18 -0
  151. package/src/components/mds-input-tip/test/mds-input-tip.e2e.ts +11 -0
  152. package/src/components.d.ts +55 -0
  153. package/src/dictionary/autocomplete.ts +62 -0
  154. package/src/dictionary/button.ts +41 -0
  155. package/src/dictionary/color.ts +24 -0
  156. package/src/dictionary/file-extensions.ts +81 -0
  157. package/src/dictionary/floating-ui.ts +25 -0
  158. package/src/dictionary/icon.ts +15 -0
  159. package/src/dictionary/input.ts +48 -0
  160. package/src/dictionary/loading.ts +9 -0
  161. package/src/dictionary/text.ts +9 -0
  162. package/src/dictionary/typography.ts +88 -0
  163. package/src/dictionary/variant.ts +111 -0
  164. package/src/fixtures/cities.ts +116 -0
  165. package/src/fixtures/filenames.ts +60 -0
  166. package/src/fixtures/icons.json +344 -0
  167. package/src/fixtures/iconsauce.json +257 -0
  168. package/src/interface/input-value.ts +5 -0
  169. package/src/tailwind/components.css +15 -0
  170. package/src/type/autocomplete.ts +69 -0
  171. package/src/type/button.ts +28 -0
  172. package/src/type/file-types.ts +55 -0
  173. package/src/type/floating-ui.ts +17 -0
  174. package/src/type/form-rel.ts +11 -0
  175. package/src/type/input.ts +25 -0
  176. package/src/type/loading.ts +3 -0
  177. package/src/type/text.ts +4 -0
  178. package/src/type/typography.ts +65 -0
  179. package/src/type/variant-file-format.ts +137 -0
  180. package/src/type/variant.ts +99 -0
  181. package/www/build/index.esm.js +0 -0
  182. package/www/build/mds-input-tip.esm.js +1 -0
  183. package/www/build/mds-input-tip.js +127 -0
  184. package/www/build/p-22b86e20.js +2 -0
  185. package/www/build/p-3428f886.system.js +2 -0
  186. package/www/build/p-50ea2036.system.js +1 -0
  187. package/www/build/p-630886b5.entry.js +1 -0
  188. package/www/build/p-89e037f5.system.entry.js +1 -0
  189. package/www/build/p-e5fe0b68.system.js +1 -0
  190. package/www/host.config.json +15 -0
@@ -0,0 +1,1544 @@
1
+ const NAMESPACE = 'mds-input-tip';
2
+
3
+ /**
4
+ * Virtual DOM patching algorithm based on Snabbdom by
5
+ * Simon Friis Vindum (@paldepind)
6
+ * Licensed under the MIT License
7
+ * https://github.com/snabbdom/snabbdom/blob/master/LICENSE
8
+ *
9
+ * Modified for Stencil's renderer and slot projection
10
+ */
11
+ let scopeId;
12
+ let hostTagName;
13
+ let isSvgMode = false;
14
+ let queuePending = false;
15
+ const createTime = (fnName, tagName = '') => {
16
+ {
17
+ return () => {
18
+ return;
19
+ };
20
+ }
21
+ };
22
+ const uniqueTime = (key, measureText) => {
23
+ {
24
+ return () => {
25
+ return;
26
+ };
27
+ }
28
+ };
29
+ const HYDRATED_CSS = '{visibility:hidden}[hydrated]{visibility:inherit}';
30
+ /**
31
+ * Constant for styles to be globally applied to `slot-fb` elements for pseudo-slot behavior.
32
+ *
33
+ * Two cascading rules must be used instead of a `:not()` selector due to Stencil browser
34
+ * support as of Stencil v4.
35
+ */
36
+ const SLOT_FB_CSS = 'slot-fb{display:contents}slot-fb[hidden]{display:none}';
37
+ /**
38
+ * Default style mode id
39
+ */
40
+ /**
41
+ * Reusable empty obj/array
42
+ * Don't add values to these!!
43
+ */
44
+ const EMPTY_OBJ = {};
45
+ const isDef = (v) => v != null;
46
+ /**
47
+ * Check whether a value is a 'complex type', defined here as an object or a
48
+ * function.
49
+ *
50
+ * @param o the value to check
51
+ * @returns whether it's a complex type or not
52
+ */
53
+ const isComplexType = (o) => {
54
+ // https://jsperf.com/typeof-fn-object/5
55
+ o = typeof o;
56
+ return o === 'object' || o === 'function';
57
+ };
58
+ /**
59
+ * Helper method for querying a `meta` tag that contains a nonce value
60
+ * out of a DOM's head.
61
+ *
62
+ * @param doc The DOM containing the `head` to query against
63
+ * @returns The content of the meta tag representing the nonce value, or `undefined` if no tag
64
+ * exists or the tag has no content.
65
+ */
66
+ function queryNonceMetaTagContent(doc) {
67
+ var _a, _b, _c;
68
+ return (_c = (_b = (_a = doc.head) === null || _a === void 0 ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) === null || _b === void 0 ? void 0 : _b.getAttribute('content')) !== null && _c !== void 0 ? _c : undefined;
69
+ }
70
+ /**
71
+ * Production h() function based on Preact by
72
+ * Jason Miller (@developit)
73
+ * Licensed under the MIT License
74
+ * https://github.com/developit/preact/blob/master/LICENSE
75
+ *
76
+ * Modified for Stencil's compiler and vdom
77
+ */
78
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
79
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
80
+ const h = (nodeName, vnodeData, ...children) => {
81
+ let child = null;
82
+ let simple = false;
83
+ let lastSimple = false;
84
+ const vNodeChildren = [];
85
+ const walk = (c) => {
86
+ for (let i = 0; i < c.length; i++) {
87
+ child = c[i];
88
+ if (Array.isArray(child)) {
89
+ walk(child);
90
+ }
91
+ else if (child != null && typeof child !== 'boolean') {
92
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
93
+ child = String(child);
94
+ }
95
+ if (simple && lastSimple) {
96
+ // If the previous child was simple (string), we merge both
97
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
98
+ }
99
+ else {
100
+ // Append a new vNode, if it's text, we create a text vNode
101
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
102
+ }
103
+ lastSimple = simple;
104
+ }
105
+ }
106
+ };
107
+ walk(children);
108
+ const vnode = newVNode(nodeName, null);
109
+ vnode.$attrs$ = vnodeData;
110
+ if (vNodeChildren.length > 0) {
111
+ vnode.$children$ = vNodeChildren;
112
+ }
113
+ return vnode;
114
+ };
115
+ /**
116
+ * A utility function for creating a virtual DOM node from a tag and some
117
+ * possible text content.
118
+ *
119
+ * @param tag the tag for this element
120
+ * @param text possible text content for the node
121
+ * @returns a newly-minted virtual DOM node
122
+ */
123
+ const newVNode = (tag, text) => {
124
+ const vnode = {
125
+ $flags$: 0,
126
+ $tag$: tag,
127
+ $text$: text,
128
+ $elm$: null,
129
+ $children$: null,
130
+ };
131
+ {
132
+ vnode.$attrs$ = null;
133
+ }
134
+ return vnode;
135
+ };
136
+ const Host = {};
137
+ /**
138
+ * Check whether a given node is a Host node or not
139
+ *
140
+ * @param node the virtual DOM node to check
141
+ * @returns whether it's a Host node or not
142
+ */
143
+ const isHost = (node) => node && node.$tag$ === Host;
144
+ /**
145
+ * Parse a new property value for a given property type.
146
+ *
147
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
148
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
149
+ * 1. `any`, the type given to `propValue` in the function signature
150
+ * 2. the type stored from `propType`.
151
+ *
152
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
153
+ *
154
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
155
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
156
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
157
+ * ```tsx
158
+ * <my-cmp prop-val={0}></my-cmp>
159
+ * ```
160
+ *
161
+ * HTML prop values on the other hand, will always a string
162
+ *
163
+ * @param propValue the new value to coerce to some type
164
+ * @param propType the type of the prop, expressed as a binary number
165
+ * @returns the parsed/coerced value
166
+ */
167
+ const parsePropertyValue = (propValue, propType) => {
168
+ // ensure this value is of the correct prop type
169
+ if (propValue != null && !isComplexType(propValue)) {
170
+ if (propType & 4 /* MEMBER_FLAGS.Boolean */) {
171
+ // per the HTML spec, any string value means it is a boolean true value
172
+ // but we'll cheat here and say that the string "false" is the boolean false
173
+ return propValue === 'false' ? false : propValue === '' || !!propValue;
174
+ }
175
+ if (propType & 1 /* MEMBER_FLAGS.String */) {
176
+ // could have been passed as a number or boolean
177
+ // but we still want it as a string
178
+ return String(propValue);
179
+ }
180
+ // redundant return here for better minification
181
+ return propValue;
182
+ }
183
+ // not sure exactly what type we want
184
+ // so no need to change to a different type
185
+ return propValue;
186
+ };
187
+ /**
188
+ * Helper function to create & dispatch a custom Event on a provided target
189
+ * @param elm the target of the Event
190
+ * @param name the name to give the custom Event
191
+ * @param opts options for configuring a custom Event
192
+ * @returns the custom Event
193
+ */
194
+ const emitEvent = (elm, name, opts) => {
195
+ const ev = plt.ce(name, opts);
196
+ elm.dispatchEvent(ev);
197
+ return ev;
198
+ };
199
+ const rootAppliedStyles = /*@__PURE__*/ new WeakMap();
200
+ const registerStyle = (scopeId, cssText, allowCS) => {
201
+ let style = styles.get(scopeId);
202
+ if (supportsConstructableStylesheets && allowCS) {
203
+ style = (style || new CSSStyleSheet());
204
+ if (typeof style === 'string') {
205
+ style = cssText;
206
+ }
207
+ else {
208
+ style.replaceSync(cssText);
209
+ }
210
+ }
211
+ else {
212
+ style = cssText;
213
+ }
214
+ styles.set(scopeId, style);
215
+ };
216
+ const addStyle = (styleContainerNode, cmpMeta, mode) => {
217
+ var _a;
218
+ const scopeId = getScopeId(cmpMeta);
219
+ const style = styles.get(scopeId);
220
+ // if an element is NOT connected then getRootNode() will return the wrong root node
221
+ // so the fallback is to always use the document for the root node in those cases
222
+ styleContainerNode = styleContainerNode.nodeType === 11 /* NODE_TYPE.DocumentFragment */ ? styleContainerNode : doc;
223
+ if (style) {
224
+ if (typeof style === 'string') {
225
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
226
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
227
+ let styleElm;
228
+ if (!appliedStyles) {
229
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
230
+ }
231
+ if (!appliedStyles.has(scopeId)) {
232
+ {
233
+ styleElm = doc.createElement('style');
234
+ styleElm.innerHTML = style;
235
+ // Apply CSP nonce to the style tag if it exists
236
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
237
+ if (nonce != null) {
238
+ styleElm.setAttribute('nonce', nonce);
239
+ }
240
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
241
+ }
242
+ // Add styles for `slot-fb` elements if we're using slots outside the Shadow DOM
243
+ if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
244
+ styleElm.innerHTML += SLOT_FB_CSS;
245
+ }
246
+ if (appliedStyles) {
247
+ appliedStyles.add(scopeId);
248
+ }
249
+ }
250
+ }
251
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
252
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
253
+ }
254
+ }
255
+ return scopeId;
256
+ };
257
+ const attachStyles = (hostRef) => {
258
+ const cmpMeta = hostRef.$cmpMeta$;
259
+ const elm = hostRef.$hostElement$;
260
+ const flags = cmpMeta.$flags$;
261
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
262
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
263
+ if (flags & 10 /* CMP_FLAGS.needsScopedEncapsulation */) {
264
+ // only required when we're NOT using native shadow dom (slot)
265
+ // or this browser doesn't support native shadow dom
266
+ // and this host element was NOT created with SSR
267
+ // let's pick out the inner content for slot projection
268
+ // create a node to represent where the original
269
+ // content was first placed, which is useful later on
270
+ // DOM WRITE!!
271
+ elm['s-sc'] = scopeId;
272
+ elm.classList.add(scopeId + '-h');
273
+ }
274
+ endAttachStyles();
275
+ };
276
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
277
+ /**
278
+ * Production setAccessor() function based on Preact by
279
+ * Jason Miller (@developit)
280
+ * Licensed under the MIT License
281
+ * https://github.com/developit/preact/blob/master/LICENSE
282
+ *
283
+ * Modified for Stencil's compiler and vdom
284
+ */
285
+ /**
286
+ * When running a VDom render set properties present on a VDom node onto the
287
+ * corresponding HTML element.
288
+ *
289
+ * Note that this function has special functionality for the `class`,
290
+ * `style`, `key`, and `ref` attributes, as well as event handlers (like
291
+ * `onClick`, etc). All others are just passed through as-is.
292
+ *
293
+ * @param elm the HTMLElement onto which attributes should be set
294
+ * @param memberName the name of the attribute to set
295
+ * @param oldValue the old value for the attribute
296
+ * @param newValue the new value for the attribute
297
+ * @param isSvg whether we're in an svg context or not
298
+ * @param flags bitflags for Vdom variables
299
+ */
300
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
301
+ if (oldValue !== newValue) {
302
+ let isProp = isMemberInElement(elm, memberName);
303
+ memberName.toLowerCase();
304
+ {
305
+ // Set property if it exists and it's not a SVG
306
+ const isComplex = isComplexType(newValue);
307
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
308
+ try {
309
+ if (!elm.tagName.includes('-')) {
310
+ const n = newValue == null ? '' : newValue;
311
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
312
+ if (memberName === 'list') {
313
+ isProp = false;
314
+ }
315
+ else if (oldValue == null || elm[memberName] != n) {
316
+ elm[memberName] = n;
317
+ }
318
+ }
319
+ else {
320
+ elm[memberName] = newValue;
321
+ }
322
+ }
323
+ catch (e) {
324
+ /**
325
+ * in case someone tries to set a read-only property, e.g. "namespaceURI", we just ignore it
326
+ */
327
+ }
328
+ }
329
+ if (newValue == null || newValue === false) {
330
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
331
+ {
332
+ elm.removeAttribute(memberName);
333
+ }
334
+ }
335
+ }
336
+ else if ((!isProp || flags & 4 /* VNODE_FLAGS.isHost */ || isSvg) && !isComplex) {
337
+ newValue = newValue === true ? '' : newValue;
338
+ {
339
+ elm.setAttribute(memberName, newValue);
340
+ }
341
+ }
342
+ }
343
+ }
344
+ };
345
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
346
+ // if the element passed in is a shadow root, which is a document fragment
347
+ // then we want to be adding attrs/props to the shadow root's "host" element
348
+ // if it's not a shadow root, then we add attrs/props to the same element
349
+ const elm = newVnode.$elm$.nodeType === 11 /* NODE_TYPE.DocumentFragment */ && newVnode.$elm$.host
350
+ ? newVnode.$elm$.host
351
+ : newVnode.$elm$;
352
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
353
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
354
+ {
355
+ // remove attributes no longer present on the vnode by setting them to undefined
356
+ for (memberName in oldVnodeAttrs) {
357
+ if (!(memberName in newVnodeAttrs)) {
358
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
359
+ }
360
+ }
361
+ }
362
+ // add new & update changed attributes
363
+ for (memberName in newVnodeAttrs) {
364
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
365
+ }
366
+ };
367
+ /**
368
+ * Create a DOM Node corresponding to one of the children of a given VNode.
369
+ *
370
+ * @param oldParentVNode the parent VNode from the previous render
371
+ * @param newParentVNode the parent VNode from the current render
372
+ * @param childIndex the index of the VNode, in the _new_ parent node's
373
+ * children, for which we will create a new DOM node
374
+ * @param parentElm the parent DOM node which our new node will be a child of
375
+ * @returns the newly created node
376
+ */
377
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
378
+ // tslint:disable-next-line: prefer-const
379
+ const newVNode = newParentVNode.$children$[childIndex];
380
+ let i = 0;
381
+ let elm;
382
+ let childNode;
383
+ {
384
+ // create element
385
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
386
+ // add css classes, attrs, props, listeners, etc.
387
+ {
388
+ updateElement(null, newVNode, isSvgMode);
389
+ }
390
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
391
+ // if there is a scopeId and this is the initial render
392
+ // then let's add the scopeId as a css class
393
+ elm.classList.add((elm['s-si'] = scopeId));
394
+ }
395
+ if (newVNode.$children$) {
396
+ for (i = 0; i < newVNode.$children$.length; ++i) {
397
+ // create the node
398
+ childNode = createElm(oldParentVNode, newVNode, i);
399
+ // return node could have been null
400
+ if (childNode) {
401
+ // append our new node
402
+ elm.appendChild(childNode);
403
+ }
404
+ }
405
+ }
406
+ }
407
+ // This needs to always happen so we can hide nodes that are projected
408
+ // to another component but don't end up in a slot
409
+ elm['s-hn'] = hostTagName;
410
+ return elm;
411
+ };
412
+ /**
413
+ * Create DOM nodes corresponding to a list of {@link d.Vnode} objects and
414
+ * add them to the DOM in the appropriate place.
415
+ *
416
+ * @param parentElm the DOM node which should be used as a parent for the new
417
+ * DOM nodes
418
+ * @param before a child of the `parentElm` which the new children should be
419
+ * inserted before (optional)
420
+ * @param parentVNode the parent virtual DOM node
421
+ * @param vnodes the new child virtual DOM nodes to produce DOM nodes for
422
+ * @param startIdx the index in the child virtual DOM nodes at which to start
423
+ * creating DOM nodes (inclusive)
424
+ * @param endIdx the index in the child virtual DOM nodes at which to stop
425
+ * creating DOM nodes (inclusive)
426
+ */
427
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
428
+ let containerElm = (parentElm);
429
+ let childNode;
430
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
431
+ containerElm = containerElm.shadowRoot;
432
+ }
433
+ for (; startIdx <= endIdx; ++startIdx) {
434
+ if (vnodes[startIdx]) {
435
+ childNode = createElm(null, parentVNode, startIdx);
436
+ if (childNode) {
437
+ vnodes[startIdx].$elm$ = childNode;
438
+ containerElm.insertBefore(childNode, before);
439
+ }
440
+ }
441
+ }
442
+ };
443
+ /**
444
+ * Remove the DOM elements corresponding to a list of {@link d.VNode} objects.
445
+ * This can be used to, for instance, clean up after a list of children which
446
+ * should no longer be shown.
447
+ *
448
+ * This function also handles some of Stencil's slot relocation logic.
449
+ *
450
+ * @param vnodes a list of virtual DOM nodes to remove
451
+ * @param startIdx the index at which to start removing nodes (inclusive)
452
+ * @param endIdx the index at which to stop removing nodes (inclusive)
453
+ */
454
+ const removeVnodes = (vnodes, startIdx, endIdx) => {
455
+ for (let index = startIdx; index <= endIdx; ++index) {
456
+ const vnode = vnodes[index];
457
+ if (vnode) {
458
+ const elm = vnode.$elm$;
459
+ if (elm) {
460
+ // remove the vnode's element from the dom
461
+ elm.remove();
462
+ }
463
+ }
464
+ }
465
+ };
466
+ /**
467
+ * Reconcile the children of a new VNode with the children of an old VNode by
468
+ * traversing the two collections of children, identifying nodes that are
469
+ * conserved or changed, calling out to `patch` to make any necessary
470
+ * updates to the DOM, and rearranging DOM nodes as needed.
471
+ *
472
+ * The algorithm for reconciling children works by analyzing two 'windows' onto
473
+ * the two arrays of children (`oldCh` and `newCh`). We keep track of the
474
+ * 'windows' by storing start and end indices and references to the
475
+ * corresponding array entries. Initially the two 'windows' are basically equal
476
+ * to the entire array, but we progressively narrow the windows until there are
477
+ * no children left to update by doing the following:
478
+ *
479
+ * 1. Skip any `null` entries at the beginning or end of the two arrays, so
480
+ * that if we have an initial array like the following we'll end up dealing
481
+ * only with a window bounded by the highlighted elements:
482
+ *
483
+ * [null, null, VNode1 , ... , VNode2, null, null]
484
+ * ^^^^^^ ^^^^^^
485
+ *
486
+ * 2. Check to see if the elements at the head and tail positions are equal
487
+ * across the windows. This will basically detect elements which haven't
488
+ * been added, removed, or changed position, i.e. if you had the following
489
+ * VNode elements (represented as HTML):
490
+ *
491
+ * oldVNode: `<div><p><span>HEY</span></p></div>`
492
+ * newVNode: `<div><p><span>THERE</span></p></div>`
493
+ *
494
+ * Then when comparing the children of the `<div>` tag we check the equality
495
+ * of the VNodes corresponding to the `<p>` tags and, since they are the
496
+ * same tag in the same position, we'd be able to avoid completely
497
+ * re-rendering the subtree under them with a new DOM element and would just
498
+ * call out to `patch` to handle reconciling their children and so on.
499
+ *
500
+ * 3. Check, for both windows, to see if the element at the beginning of the
501
+ * window corresponds to the element at the end of the other window. This is
502
+ * a heuristic which will let us identify _some_ situations in which
503
+ * elements have changed position, for instance it _should_ detect that the
504
+ * children nodes themselves have not changed but merely moved in the
505
+ * following example:
506
+ *
507
+ * oldVNode: `<div><element-one /><element-two /></div>`
508
+ * newVNode: `<div><element-two /><element-one /></div>`
509
+ *
510
+ * If we find cases like this then we also need to move the concrete DOM
511
+ * elements corresponding to the moved children to write the re-order to the
512
+ * DOM.
513
+ *
514
+ * 4. Finally, if VNodes have the `key` attribute set on them we check for any
515
+ * nodes in the old children which have the same key as the first element in
516
+ * our window on the new children. If we find such a node we handle calling
517
+ * out to `patch`, moving relevant DOM nodes, and so on, in accordance with
518
+ * what we find.
519
+ *
520
+ * Finally, once we've narrowed our 'windows' to the point that either of them
521
+ * collapse (i.e. they have length 0) we then handle any remaining VNode
522
+ * insertion or deletion that needs to happen to get a DOM state that correctly
523
+ * reflects the new child VNodes. If, for instance, after our window on the old
524
+ * children has collapsed we still have more nodes on the new children that
525
+ * we haven't dealt with yet then we need to add them, or if the new children
526
+ * collapse but we still have unhandled _old_ children then we need to make
527
+ * sure the corresponding DOM nodes are removed.
528
+ *
529
+ * @param parentElm the node into which the parent VNode is rendered
530
+ * @param oldCh the old children of the parent node
531
+ * @param newVNode the new VNode which will replace the parent
532
+ * @param newCh the new children of the parent node
533
+ * @param isInitialRender whether or not this is the first render of the vdom
534
+ */
535
+ const updateChildren = (parentElm, oldCh, newVNode, newCh, isInitialRender = false) => {
536
+ let oldStartIdx = 0;
537
+ let newStartIdx = 0;
538
+ let oldEndIdx = oldCh.length - 1;
539
+ let oldStartVnode = oldCh[0];
540
+ let oldEndVnode = oldCh[oldEndIdx];
541
+ let newEndIdx = newCh.length - 1;
542
+ let newStartVnode = newCh[0];
543
+ let newEndVnode = newCh[newEndIdx];
544
+ let node;
545
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
546
+ if (oldStartVnode == null) {
547
+ // VNode might have been moved left
548
+ oldStartVnode = oldCh[++oldStartIdx];
549
+ }
550
+ else if (oldEndVnode == null) {
551
+ oldEndVnode = oldCh[--oldEndIdx];
552
+ }
553
+ else if (newStartVnode == null) {
554
+ newStartVnode = newCh[++newStartIdx];
555
+ }
556
+ else if (newEndVnode == null) {
557
+ newEndVnode = newCh[--newEndIdx];
558
+ }
559
+ else if (isSameVnode(oldStartVnode, newStartVnode, isInitialRender)) {
560
+ // if the start nodes are the same then we should patch the new VNode
561
+ // onto the old one, and increment our `newStartIdx` and `oldStartIdx`
562
+ // indices to reflect that. We don't need to move any DOM Nodes around
563
+ // since things are matched up in order.
564
+ patch(oldStartVnode, newStartVnode, isInitialRender);
565
+ oldStartVnode = oldCh[++oldStartIdx];
566
+ newStartVnode = newCh[++newStartIdx];
567
+ }
568
+ else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) {
569
+ // likewise, if the end nodes are the same we patch new onto old and
570
+ // decrement our end indices, and also likewise in this case we don't
571
+ // need to move any DOM Nodes.
572
+ patch(oldEndVnode, newEndVnode, isInitialRender);
573
+ oldEndVnode = oldCh[--oldEndIdx];
574
+ newEndVnode = newCh[--newEndIdx];
575
+ }
576
+ else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) {
577
+ patch(oldStartVnode, newEndVnode, isInitialRender);
578
+ // We need to move the element for `oldStartVnode` into a position which
579
+ // will be appropriate for `newEndVnode`. For this we can use
580
+ // `.insertBefore` and `oldEndVnode.$elm$.nextSibling`. If there is a
581
+ // sibling for `oldEndVnode.$elm$` then we want to move the DOM node for
582
+ // `oldStartVnode` between `oldEndVnode` and it's sibling, like so:
583
+ //
584
+ // <old-start-node />
585
+ // <some-intervening-node />
586
+ // <old-end-node />
587
+ // <!-- -> <-- `oldStartVnode.$elm$` should be inserted here
588
+ // <next-sibling />
589
+ //
590
+ // If instead `oldEndVnode.$elm$` has no sibling then we just want to put
591
+ // the node for `oldStartVnode` at the end of the children of
592
+ // `parentElm`. Luckily, `Node.nextSibling` will return `null` if there
593
+ // aren't any siblings, and passing `null` to `Node.insertBefore` will
594
+ // append it to the children of the parent element.
595
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
596
+ oldStartVnode = oldCh[++oldStartIdx];
597
+ newEndVnode = newCh[--newEndIdx];
598
+ }
599
+ else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) {
600
+ patch(oldEndVnode, newStartVnode, isInitialRender);
601
+ // We've already checked above if `oldStartVnode` and `newStartVnode` are
602
+ // the same node, so since we're here we know that they are not. Thus we
603
+ // can move the element for `oldEndVnode` _before_ the element for
604
+ // `oldStartVnode`, leaving `oldStartVnode` to be reconciled in the
605
+ // future.
606
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
607
+ oldEndVnode = oldCh[--oldEndIdx];
608
+ newStartVnode = newCh[++newStartIdx];
609
+ }
610
+ else {
611
+ {
612
+ // We either didn't find an element in the old children that matches
613
+ // the key of the first new child OR the build is not using `key`
614
+ // attributes at all. In either case we need to create a new element
615
+ // for the new node.
616
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
617
+ newStartVnode = newCh[++newStartIdx];
618
+ }
619
+ if (node) {
620
+ // if we created a new node then handle inserting it to the DOM
621
+ {
622
+ oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
623
+ }
624
+ }
625
+ }
626
+ }
627
+ if (oldStartIdx > oldEndIdx) {
628
+ // we have some more new nodes to add which don't match up with old nodes
629
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
630
+ }
631
+ else if (newStartIdx > newEndIdx) {
632
+ // there are nodes in the `oldCh` array which no longer correspond to nodes
633
+ // in the new array, so lets remove them (which entails cleaning up the
634
+ // relevant DOM nodes)
635
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
636
+ }
637
+ };
638
+ /**
639
+ * Compare two VNodes to determine if they are the same
640
+ *
641
+ * **NB**: This function is an equality _heuristic_ based on the available
642
+ * information set on the two VNodes and can be misleading under certain
643
+ * circumstances. In particular, if the two nodes do not have `key` attrs
644
+ * (available under `$key$` on VNodes) then the function falls back on merely
645
+ * checking that they have the same tag.
646
+ *
647
+ * So, in other words, if `key` attrs are not set on VNodes which may be
648
+ * changing order within a `children` array or something along those lines then
649
+ * we could obtain a false negative and then have to do needless re-rendering
650
+ * (i.e. we'd say two VNodes aren't equal when in fact they should be).
651
+ *
652
+ * @param leftVNode the first VNode to check
653
+ * @param rightVNode the second VNode to check
654
+ * @param isInitialRender whether or not this is the first render of the vdom
655
+ * @returns whether they're equal or not
656
+ */
657
+ const isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => {
658
+ // compare if two vnode to see if they're "technically" the same
659
+ // need to have the same element tag, and same key to be the same
660
+ if (leftVNode.$tag$ === rightVNode.$tag$) {
661
+ return true;
662
+ }
663
+ return false;
664
+ };
665
+ /**
666
+ * Handle reconciling an outdated VNode with a new one which corresponds to
667
+ * it. This function handles flushing updates to the DOM and reconciling the
668
+ * children of the two nodes (if any).
669
+ *
670
+ * @param oldVNode an old VNode whose DOM element and children we want to update
671
+ * @param newVNode a new VNode representing an updated version of the old one
672
+ * @param isInitialRender whether or not this is the first render of the vdom
673
+ */
674
+ const patch = (oldVNode, newVNode, isInitialRender = false) => {
675
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
676
+ const oldChildren = oldVNode.$children$;
677
+ const newChildren = newVNode.$children$;
678
+ const tag = newVNode.$tag$;
679
+ {
680
+ {
681
+ if (tag === 'slot')
682
+ ;
683
+ else {
684
+ // either this is the first render of an element OR it's an update
685
+ // AND we already know it's possible it could have changed
686
+ // this updates the element's css classes, attrs, props, listeners, etc.
687
+ updateElement(oldVNode, newVNode, isSvgMode);
688
+ }
689
+ }
690
+ if (oldChildren !== null && newChildren !== null) {
691
+ // looks like there's child vnodes for both the old and new vnodes
692
+ // so we need to call `updateChildren` to reconcile them
693
+ updateChildren(elm, oldChildren, newVNode, newChildren, isInitialRender);
694
+ }
695
+ else if (newChildren !== null) {
696
+ // add the new vnode children
697
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
698
+ }
699
+ else if (oldChildren !== null) {
700
+ // no new child vnodes, but there are old child vnodes to remove
701
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
702
+ }
703
+ }
704
+ };
705
+ /**
706
+ * The main entry point for Stencil's virtual DOM-based rendering engine
707
+ *
708
+ * Given a {@link d.HostRef} container and some virtual DOM nodes, this
709
+ * function will handle creating a virtual DOM tree with a single root, patching
710
+ * the current virtual DOM tree onto an old one (if any), dealing with slot
711
+ * relocation, and reflecting attributes.
712
+ *
713
+ * @param hostRef data needed to root and render the virtual DOM tree, such as
714
+ * the DOM node into which it should be rendered.
715
+ * @param renderFnResults the virtual DOM nodes to be rendered
716
+ * @param isInitialLoad whether or not this is the first call after page load
717
+ */
718
+ const renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
719
+ const hostElm = hostRef.$hostElement$;
720
+ const cmpMeta = hostRef.$cmpMeta$;
721
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
722
+ // if `renderFnResults` is a Host node then we can use it directly. If not,
723
+ // we need to call `h` again to wrap the children of our component in a
724
+ // 'dummy' Host node (well, an empty vnode) since `renderVdom` assumes
725
+ // implicitly that the top-level vdom node is 1) an only child and 2)
726
+ // contains attrs that need to be set on the host element.
727
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
728
+ hostTagName = hostElm.tagName;
729
+ if (cmpMeta.$attrsToReflect$) {
730
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
731
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
732
+ }
733
+ // On the first render and *only* on the first render we want to check for
734
+ // any attributes set on the host element which are also set on the vdom
735
+ // node. If we find them, we override the value on the VDom node attrs with
736
+ // the value from the host element, which allows developers building apps
737
+ // with Stencil components to override e.g. the `role` attribute on a
738
+ // component even if it's already set on the `Host`.
739
+ if (isInitialLoad && rootVnode.$attrs$) {
740
+ for (const key of Object.keys(rootVnode.$attrs$)) {
741
+ // We have a special implementation in `setAccessor` for `style` and
742
+ // `class` which reconciles values coming from the VDom with values
743
+ // already present on the DOM element, so we don't want to override those
744
+ // attributes on the VDom tree with values from the host element if they
745
+ // are present.
746
+ //
747
+ // Likewise, `ref` and `key` are special internal values for the Stencil
748
+ // runtime and we don't want to override those either.
749
+ if (hostElm.hasAttribute(key) && !['key', 'ref', 'style', 'class'].includes(key)) {
750
+ rootVnode.$attrs$[key] = hostElm[key];
751
+ }
752
+ }
753
+ }
754
+ rootVnode.$tag$ = null;
755
+ rootVnode.$flags$ |= 4 /* VNODE_FLAGS.isHost */;
756
+ hostRef.$vnode$ = rootVnode;
757
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
758
+ {
759
+ scopeId = hostElm['s-sc'];
760
+ }
761
+ // synchronous patch
762
+ patch(oldVNode, rootVnode, isInitialLoad);
763
+ };
764
+ const attachToAncestor = (hostRef, ancestorComponent) => {
765
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
766
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
767
+ }
768
+ };
769
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
770
+ {
771
+ hostRef.$flags$ |= 16 /* HOST_FLAGS.isQueuedForUpdate */;
772
+ }
773
+ if (hostRef.$flags$ & 4 /* HOST_FLAGS.isWaitingForChildren */) {
774
+ hostRef.$flags$ |= 512 /* HOST_FLAGS.needsRerender */;
775
+ return;
776
+ }
777
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
778
+ // there is no ancestor component or the ancestor component
779
+ // has already fired off its lifecycle update then
780
+ // fire off the initial update
781
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
782
+ return writeTask(dispatch) ;
783
+ };
784
+ /**
785
+ * Dispatch initial-render and update lifecycle hooks, enqueuing calls to
786
+ * component lifecycle methods like `componentWillLoad` as well as
787
+ * {@link updateComponent}, which will kick off the virtual DOM re-render.
788
+ *
789
+ * @param hostRef a reference to a host DOM node
790
+ * @param isInitialLoad whether we're on the initial load or not
791
+ * @returns an empty Promise which is used to enqueue a series of operations for
792
+ * the component
793
+ */
794
+ const dispatchHooks = (hostRef, isInitialLoad) => {
795
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
796
+ const instance = hostRef.$lazyInstance$ ;
797
+ // We're going to use this variable together with `enqueue` to implement a
798
+ // little promise-based queue. We start out with it `undefined`. When we add
799
+ // the first function to the queue we'll set this variable to be that
800
+ // function's return value. When we attempt to add subsequent values to the
801
+ // queue we'll check that value and, if it was a `Promise`, we'll then chain
802
+ // the new function off of that `Promise` using `.then()`. This will give our
803
+ // queue two nice properties:
804
+ //
805
+ // 1. If all functions added to the queue are synchronous they'll be called
806
+ // synchronously right away.
807
+ // 2. If all functions added to the queue are asynchronous they'll all be
808
+ // called in order after `dispatchHooks` exits.
809
+ let maybePromise;
810
+ endSchedule();
811
+ return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
812
+ };
813
+ /**
814
+ * This function uses a Promise to implement a simple first-in, first-out queue
815
+ * of functions to be called.
816
+ *
817
+ * The queue is ordered on the basis of the first argument. If it's
818
+ * `undefined`, then nothing is on the queue yet, so the provided function can
819
+ * be called synchronously (although note that this function may return a
820
+ * `Promise`). The idea is that then the return value of that enqueueing
821
+ * operation is kept around, so that if it was a `Promise` then subsequent
822
+ * functions can be enqueued by calling this function again with that `Promise`
823
+ * as the first argument.
824
+ *
825
+ * @param maybePromise either a `Promise` which should resolve before the next function is called or an 'empty' sentinel
826
+ * @param fn a function to enqueue
827
+ * @returns either a `Promise` or the return value of the provided function
828
+ */
829
+ const enqueue = (maybePromise, fn) => isPromisey(maybePromise) ? maybePromise.then(fn) : fn();
830
+ /**
831
+ * Check that a value is a `Promise`. To check, we first see if the value is an
832
+ * instance of the `Promise` global. In a few circumstances, in particular if
833
+ * the global has been overwritten, this is could be misleading, so we also do
834
+ * a little 'duck typing' check to see if the `.then` property of the value is
835
+ * defined and a function.
836
+ *
837
+ * @param maybePromise it might be a promise!
838
+ * @returns whether it is or not
839
+ */
840
+ const isPromisey = (maybePromise) => maybePromise instanceof Promise ||
841
+ (maybePromise && maybePromise.then && typeof maybePromise.then === 'function');
842
+ /**
843
+ * Update a component given reference to its host elements and so on.
844
+ *
845
+ * @param hostRef an object containing references to the element's host node,
846
+ * VDom nodes, and other metadata
847
+ * @param instance a reference to the underlying host element where it will be
848
+ * rendered
849
+ * @param isInitialLoad whether or not this function is being called as part of
850
+ * the first render cycle
851
+ */
852
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
853
+ var _a;
854
+ const elm = hostRef.$hostElement$;
855
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
856
+ const rc = elm['s-rc'];
857
+ if (isInitialLoad) {
858
+ // DOM WRITE!
859
+ attachStyles(hostRef);
860
+ }
861
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
862
+ {
863
+ callRender(hostRef, instance, elm, isInitialLoad);
864
+ }
865
+ if (rc) {
866
+ // ok, so turns out there are some child host elements
867
+ // waiting on this parent element to load
868
+ // let's fire off all update callbacks waiting
869
+ rc.map((cb) => cb());
870
+ elm['s-rc'] = undefined;
871
+ }
872
+ endRender();
873
+ endUpdate();
874
+ {
875
+ const childrenPromises = (_a = elm['s-p']) !== null && _a !== void 0 ? _a : [];
876
+ const postUpdate = () => postUpdateComponent(hostRef);
877
+ if (childrenPromises.length === 0) {
878
+ postUpdate();
879
+ }
880
+ else {
881
+ Promise.all(childrenPromises).then(postUpdate);
882
+ hostRef.$flags$ |= 4 /* HOST_FLAGS.isWaitingForChildren */;
883
+ childrenPromises.length = 0;
884
+ }
885
+ }
886
+ };
887
+ /**
888
+ * Handle making the call to the VDom renderer with the proper context given
889
+ * various build variables
890
+ *
891
+ * @param hostRef an object containing references to the element's host node,
892
+ * VDom nodes, and other metadata
893
+ * @param instance a reference to the underlying host element where it will be
894
+ * rendered
895
+ * @param elm the Host element for the component
896
+ * @param isInitialLoad whether or not this function is being called as part of
897
+ * @returns an empty promise
898
+ */
899
+ const callRender = (hostRef, instance, elm, isInitialLoad) => {
900
+ try {
901
+ /**
902
+ * minification optimization: `allRenderFn` is `true` if all components have a `render`
903
+ * method, so we can call the method immediately. If not, check before calling it.
904
+ */
905
+ instance = instance.render() ;
906
+ {
907
+ hostRef.$flags$ &= ~16 /* HOST_FLAGS.isQueuedForUpdate */;
908
+ }
909
+ {
910
+ hostRef.$flags$ |= 2 /* HOST_FLAGS.hasRendered */;
911
+ }
912
+ {
913
+ {
914
+ // looks like we've got child nodes to render into this host element
915
+ // or we need to update the css class/attrs on the host element
916
+ // DOM WRITE!
917
+ {
918
+ renderVdom(hostRef, instance, isInitialLoad);
919
+ }
920
+ }
921
+ }
922
+ }
923
+ catch (e) {
924
+ consoleError(e, hostRef.$hostElement$);
925
+ }
926
+ return null;
927
+ };
928
+ const postUpdateComponent = (hostRef) => {
929
+ const tagName = hostRef.$cmpMeta$.$tagName$;
930
+ const elm = hostRef.$hostElement$;
931
+ const endPostUpdate = createTime('postUpdate', tagName);
932
+ const ancestorComponent = hostRef.$ancestorComponent$;
933
+ if (!(hostRef.$flags$ & 64 /* HOST_FLAGS.hasLoadedComponent */)) {
934
+ hostRef.$flags$ |= 64 /* HOST_FLAGS.hasLoadedComponent */;
935
+ {
936
+ // DOM WRITE!
937
+ addHydratedFlag(elm);
938
+ }
939
+ endPostUpdate();
940
+ {
941
+ hostRef.$onReadyResolve$(elm);
942
+ if (!ancestorComponent) {
943
+ appDidLoad();
944
+ }
945
+ }
946
+ }
947
+ else {
948
+ endPostUpdate();
949
+ }
950
+ // load events fire from bottom to top
951
+ // the deepest elements load first then bubbles up
952
+ {
953
+ if (hostRef.$onRenderResolve$) {
954
+ hostRef.$onRenderResolve$();
955
+ hostRef.$onRenderResolve$ = undefined;
956
+ }
957
+ if (hostRef.$flags$ & 512 /* HOST_FLAGS.needsRerender */) {
958
+ nextTick(() => scheduleUpdate(hostRef, false));
959
+ }
960
+ hostRef.$flags$ &= ~(4 /* HOST_FLAGS.isWaitingForChildren */ | 512 /* HOST_FLAGS.needsRerender */);
961
+ }
962
+ // ( •_•)
963
+ // ( •_•)>⌐■-■
964
+ // (⌐■_■)
965
+ };
966
+ const appDidLoad = (who) => {
967
+ // on appload
968
+ // we have finish the first big initial render
969
+ {
970
+ addHydratedFlag(doc.documentElement);
971
+ }
972
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
973
+ };
974
+ const addHydratedFlag = (elm) => elm.setAttribute('hydrated', '')
975
+ ;
976
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
977
+ const setValue = (ref, propName, newVal, cmpMeta) => {
978
+ // check our new property value against our internal value
979
+ const hostRef = getHostRef(ref);
980
+ const oldVal = hostRef.$instanceValues$.get(propName);
981
+ const flags = hostRef.$flags$;
982
+ const instance = hostRef.$lazyInstance$ ;
983
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
984
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
985
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
986
+ const didValueChange = newVal !== oldVal && !areBothNaN;
987
+ if ((!(flags & 8 /* HOST_FLAGS.isConstructingInstance */) || oldVal === undefined) && didValueChange) {
988
+ // gadzooks! the property's value has changed!!
989
+ // set our new value!
990
+ hostRef.$instanceValues$.set(propName, newVal);
991
+ if (instance) {
992
+ if ((flags & (2 /* HOST_FLAGS.hasRendered */ | 16 /* HOST_FLAGS.isQueuedForUpdate */)) === 2 /* HOST_FLAGS.hasRendered */) {
993
+ // looks like this value actually changed, so we've got work to do!
994
+ // but only if we've already rendered, otherwise just chill out
995
+ // queue that we need to do an update, but don't worry about queuing
996
+ // up millions cuz this function ensures it only runs once
997
+ scheduleUpdate(hostRef, false);
998
+ }
999
+ }
1000
+ }
1001
+ };
1002
+ /**
1003
+ * Attach a series of runtime constructs to a compiled Stencil component
1004
+ * constructor, including getters and setters for the `@Prop` and `@State`
1005
+ * decorators, callbacks for when attributes change, and so on.
1006
+ *
1007
+ * @param Cstr the constructor for a component that we need to process
1008
+ * @param cmpMeta metadata collected previously about the component
1009
+ * @param flags a number used to store a series of bit flags
1010
+ * @returns a reference to the same constructor passed in (but now mutated)
1011
+ */
1012
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1013
+ var _a;
1014
+ const prototype = Cstr.prototype;
1015
+ if (cmpMeta.$members$) {
1016
+ // It's better to have a const than two Object.entries()
1017
+ const members = Object.entries(cmpMeta.$members$);
1018
+ members.map(([memberName, [memberFlags]]) => {
1019
+ if ((memberFlags & 31 /* MEMBER_FLAGS.Prop */ ||
1020
+ ((flags & 2 /* PROXY_FLAGS.proxyState */) && memberFlags & 32 /* MEMBER_FLAGS.State */))) {
1021
+ // proxyComponent - prop
1022
+ Object.defineProperty(prototype, memberName, {
1023
+ get() {
1024
+ // proxyComponent, get value
1025
+ return getValue(this, memberName);
1026
+ },
1027
+ set(newValue) {
1028
+ // proxyComponent, set value
1029
+ setValue(this, memberName, newValue, cmpMeta);
1030
+ },
1031
+ configurable: true,
1032
+ enumerable: true,
1033
+ });
1034
+ }
1035
+ });
1036
+ if ((flags & 1 /* PROXY_FLAGS.isElementConstructor */)) {
1037
+ const attrNameToPropName = new Map();
1038
+ prototype.attributeChangedCallback = function (attrName, oldValue, newValue) {
1039
+ plt.jmp(() => {
1040
+ var _a;
1041
+ const propName = attrNameToPropName.get(attrName);
1042
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1043
+ // in the case where an attribute was set inline.
1044
+ // ```html
1045
+ // <my-component some-attribute="some-value"></my-component>
1046
+ // ```
1047
+ //
1048
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1049
+ // programmatically changes it before it has been upgraded as shown below:
1050
+ //
1051
+ // ```html
1052
+ // <!-- this component has _not_ been upgraded yet -->
1053
+ // <my-component id="test" some-attribute="some-value"></my-component>
1054
+ // <script>
1055
+ // // grab non-upgraded component
1056
+ // el = document.querySelector("#test");
1057
+ // el.someAttribute = "another-value";
1058
+ // // upgrade component
1059
+ // customElements.define('my-component', MyComponent);
1060
+ // </script>
1061
+ // ```
1062
+ // In this case if we do not un-shadow here and use the value of the shadowing property, attributeChangedCallback
1063
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1064
+ // to the value that was set inline i.e. "some-value" from above example. When
1065
+ // the connectedCallback attempts to un-shadow it will use "some-value" as the initial value rather than "another-value"
1066
+ //
1067
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/un-shadowed
1068
+ // by connectedCallback as this attributeChangedCallback will not fire.
1069
+ //
1070
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1071
+ //
1072
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1073
+ // properties here given that this goes against best practices outlined here
1074
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1075
+ if (this.hasOwnProperty(propName)) {
1076
+ newValue = this[propName];
1077
+ delete this[propName];
1078
+ }
1079
+ else if (prototype.hasOwnProperty(propName) &&
1080
+ typeof this[propName] === 'number' &&
1081
+ this[propName] == newValue) {
1082
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1083
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1084
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1085
+ return;
1086
+ }
1087
+ else if (propName == null) {
1088
+ // At this point we should know this is not a "member", so we can treat it like watching an attribute
1089
+ // on a vanilla web component
1090
+ const hostRef = getHostRef(this);
1091
+ const flags = hostRef === null || hostRef === void 0 ? void 0 : hostRef.$flags$;
1092
+ // We only want to trigger the callback(s) if:
1093
+ // 1. The instance is ready
1094
+ // 2. The watchers are ready
1095
+ // 3. The value has changed
1096
+ if (flags &&
1097
+ !(flags & 8 /* HOST_FLAGS.isConstructingInstance */) &&
1098
+ flags & 128 /* HOST_FLAGS.isWatchReady */ &&
1099
+ newValue !== oldValue) {
1100
+ const instance = hostRef.$lazyInstance$ ;
1101
+ const entry = (_a = cmpMeta.$watchers$) === null || _a === void 0 ? void 0 : _a[attrName];
1102
+ entry === null || entry === void 0 ? void 0 : entry.forEach((callbackName) => {
1103
+ if (instance[callbackName] != null) {
1104
+ instance[callbackName].call(instance, newValue, oldValue, attrName);
1105
+ }
1106
+ });
1107
+ }
1108
+ return;
1109
+ }
1110
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1111
+ });
1112
+ };
1113
+ // Create an array of attributes to observe
1114
+ // This list in comprised of all strings used within a `@Watch()` decorator
1115
+ // on a component as well as any Stencil-specific "members" (`@Prop()`s and `@State()`s).
1116
+ // As such, there is no way to guarantee type-safety here that a user hasn't entered
1117
+ // an invalid attribute.
1118
+ Cstr.observedAttributes = Array.from(new Set([
1119
+ ...Object.keys((_a = cmpMeta.$watchers$) !== null && _a !== void 0 ? _a : {}),
1120
+ ...members
1121
+ .filter(([_, m]) => m[0] & 15 /* MEMBER_FLAGS.HasAttribute */)
1122
+ .map(([propName, m]) => {
1123
+ var _a;
1124
+ const attrName = m[1] || propName;
1125
+ attrNameToPropName.set(attrName, propName);
1126
+ if (m[0] & 512 /* MEMBER_FLAGS.ReflectAttr */) {
1127
+ (_a = cmpMeta.$attrsToReflect$) === null || _a === void 0 ? void 0 : _a.push([propName, attrName]);
1128
+ }
1129
+ return attrName;
1130
+ }),
1131
+ ]));
1132
+ }
1133
+ }
1134
+ return Cstr;
1135
+ };
1136
+ /**
1137
+ * Initialize a Stencil component given a reference to its host element, its
1138
+ * runtime bookkeeping data structure, runtime metadata about the component,
1139
+ * and (optionally) an HMR version ID.
1140
+ *
1141
+ * @param elm a host element
1142
+ * @param hostRef the element's runtime bookkeeping object
1143
+ * @param cmpMeta runtime metadata for the Stencil component
1144
+ * @param hmrVersionId an (optional) HMR version ID
1145
+ */
1146
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId) => {
1147
+ let Cstr;
1148
+ // initializeComponent
1149
+ if ((hostRef.$flags$ & 32 /* HOST_FLAGS.hasInitializedComponent */) === 0) {
1150
+ // Let the runtime know that the component has been initialized
1151
+ hostRef.$flags$ |= 32 /* HOST_FLAGS.hasInitializedComponent */;
1152
+ {
1153
+ // lazy loaded components
1154
+ // request the component's implementation to be
1155
+ // wired up with the host element
1156
+ Cstr = loadModule(cmpMeta);
1157
+ if (Cstr.then) {
1158
+ // Await creates a micro-task avoid if possible
1159
+ const endLoad = uniqueTime();
1160
+ Cstr = await Cstr;
1161
+ endLoad();
1162
+ }
1163
+ if (!Cstr.isProxied) {
1164
+ proxyComponent(Cstr, cmpMeta, 2 /* PROXY_FLAGS.proxyState */);
1165
+ Cstr.isProxied = true;
1166
+ }
1167
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1168
+ // ok, time to construct the instance
1169
+ // but let's keep track of when we start and stop
1170
+ // so that the getters/setters don't incorrectly step on data
1171
+ {
1172
+ hostRef.$flags$ |= 8 /* HOST_FLAGS.isConstructingInstance */;
1173
+ }
1174
+ // construct the lazy-loaded component implementation
1175
+ // passing the hostRef is very important during
1176
+ // construction in order to directly wire together the
1177
+ // host element and the lazy-loaded instance
1178
+ try {
1179
+ new Cstr(hostRef);
1180
+ }
1181
+ catch (e) {
1182
+ consoleError(e);
1183
+ }
1184
+ {
1185
+ hostRef.$flags$ &= ~8 /* HOST_FLAGS.isConstructingInstance */;
1186
+ }
1187
+ endNewInstance();
1188
+ }
1189
+ if (Cstr.style) {
1190
+ // this component has styles but we haven't registered them yet
1191
+ let style = Cstr.style;
1192
+ const scopeId = getScopeId(cmpMeta);
1193
+ if (!styles.has(scopeId)) {
1194
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1195
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */));
1196
+ endRegisterStyles();
1197
+ }
1198
+ }
1199
+ }
1200
+ // we've successfully created a lazy instance
1201
+ const ancestorComponent = hostRef.$ancestorComponent$;
1202
+ const schedule = () => scheduleUpdate(hostRef, true);
1203
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1204
+ // this is the initial load and this component it has an ancestor component
1205
+ // but the ancestor component has NOT fired its will update lifecycle yet
1206
+ // so let's just cool our jets and wait for the ancestor to continue first
1207
+ // this will get fired off when the ancestor component
1208
+ // finally gets around to rendering its lazy self
1209
+ // fire off the initial update
1210
+ ancestorComponent['s-rc'].push(schedule);
1211
+ }
1212
+ else {
1213
+ schedule();
1214
+ }
1215
+ };
1216
+ const fireConnectedCallback = (instance) => {
1217
+ };
1218
+ const connectedCallback = (elm) => {
1219
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1220
+ const hostRef = getHostRef(elm);
1221
+ const cmpMeta = hostRef.$cmpMeta$;
1222
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1223
+ if (!(hostRef.$flags$ & 1 /* HOST_FLAGS.hasConnected */)) {
1224
+ // first time this component has connected
1225
+ hostRef.$flags$ |= 1 /* HOST_FLAGS.hasConnected */;
1226
+ {
1227
+ // find the first ancestor component (if there is one) and register
1228
+ // this component as one of the actively loading child components for its ancestor
1229
+ let ancestorComponent = elm;
1230
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1231
+ // climb up the ancestors looking for the first
1232
+ // component that hasn't finished its lifecycle update yet
1233
+ if (ancestorComponent['s-p']) {
1234
+ // we found this components first ancestor component
1235
+ // keep a reference to this component's ancestor component
1236
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1237
+ break;
1238
+ }
1239
+ }
1240
+ }
1241
+ // Lazy properties
1242
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1243
+ if (cmpMeta.$members$) {
1244
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1245
+ if (memberFlags & 31 /* MEMBER_FLAGS.Prop */ && elm.hasOwnProperty(memberName)) {
1246
+ const value = elm[memberName];
1247
+ delete elm[memberName];
1248
+ elm[memberName] = value;
1249
+ }
1250
+ });
1251
+ }
1252
+ {
1253
+ initializeComponent(elm, hostRef, cmpMeta);
1254
+ }
1255
+ }
1256
+ else {
1257
+ // fire off connectedCallback() on component instance
1258
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1259
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1260
+ hostRef.$onReadyPromise$.then(() => fireConnectedCallback());
1261
+ }
1262
+ }
1263
+ endConnected();
1264
+ }
1265
+ };
1266
+ const disconnectInstance = (instance) => {
1267
+ };
1268
+ const disconnectedCallback = async (elm) => {
1269
+ if ((plt.$flags$ & 1 /* PLATFORM_FLAGS.isTmpDisconnected */) === 0) {
1270
+ const hostRef = getHostRef(elm);
1271
+ if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$lazyInstance$) ;
1272
+ else if (hostRef === null || hostRef === void 0 ? void 0 : hostRef.$onReadyPromise$) {
1273
+ hostRef.$onReadyPromise$.then(() => disconnectInstance());
1274
+ }
1275
+ }
1276
+ };
1277
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1278
+ var _a;
1279
+ const endBootstrap = createTime();
1280
+ const cmpTags = [];
1281
+ const exclude = options.exclude || [];
1282
+ const customElements = win.customElements;
1283
+ const head = doc.head;
1284
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1285
+ const dataStyles = /*@__PURE__*/ doc.createElement('style');
1286
+ const deferredConnectedCallbacks = [];
1287
+ let appLoadFallback;
1288
+ let isBootstrapping = true;
1289
+ Object.assign(plt, options);
1290
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1291
+ let hasSlotRelocation = false;
1292
+ lazyBundles.map((lazyBundle) => {
1293
+ lazyBundle[1].map((compactMeta) => {
1294
+ const cmpMeta = {
1295
+ $flags$: compactMeta[0],
1296
+ $tagName$: compactMeta[1],
1297
+ $members$: compactMeta[2],
1298
+ $listeners$: compactMeta[3],
1299
+ };
1300
+ // Check if we are using slots outside the shadow DOM in this component.
1301
+ // We'll use this information later to add styles for `slot-fb` elements
1302
+ if (cmpMeta.$flags$ & 4 /* CMP_FLAGS.hasSlotRelocation */) {
1303
+ hasSlotRelocation = true;
1304
+ }
1305
+ {
1306
+ cmpMeta.$members$ = compactMeta[2];
1307
+ }
1308
+ {
1309
+ cmpMeta.$attrsToReflect$ = [];
1310
+ }
1311
+ const tagName = cmpMeta.$tagName$;
1312
+ const HostElement = class extends HTMLElement {
1313
+ // StencilLazyHost
1314
+ constructor(self) {
1315
+ // @ts-ignore
1316
+ super(self);
1317
+ self = this;
1318
+ registerHost(self, cmpMeta);
1319
+ if (cmpMeta.$flags$ & 1 /* CMP_FLAGS.shadowDomEncapsulation */) {
1320
+ // this component is using shadow dom
1321
+ // and this browser supports shadow dom
1322
+ // add the read-only property "shadowRoot" to the host element
1323
+ // adding the shadow root build conditionals to minimize runtime
1324
+ {
1325
+ {
1326
+ self.attachShadow({ mode: 'open' });
1327
+ }
1328
+ }
1329
+ }
1330
+ }
1331
+ connectedCallback() {
1332
+ if (appLoadFallback) {
1333
+ clearTimeout(appLoadFallback);
1334
+ appLoadFallback = null;
1335
+ }
1336
+ if (isBootstrapping) {
1337
+ // connectedCallback will be processed once all components have been registered
1338
+ deferredConnectedCallbacks.push(this);
1339
+ }
1340
+ else {
1341
+ plt.jmp(() => connectedCallback(this));
1342
+ }
1343
+ }
1344
+ disconnectedCallback() {
1345
+ plt.jmp(() => disconnectedCallback(this));
1346
+ }
1347
+ componentOnReady() {
1348
+ return getHostRef(this).$onReadyPromise$;
1349
+ }
1350
+ };
1351
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1352
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1353
+ cmpTags.push(tagName);
1354
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* PROXY_FLAGS.isElementConstructor */));
1355
+ }
1356
+ });
1357
+ });
1358
+ // Add styles for `slot-fb` elements if any of our components are using slots outside the Shadow DOM
1359
+ if (hasSlotRelocation) {
1360
+ dataStyles.innerHTML += SLOT_FB_CSS;
1361
+ }
1362
+ // Add hydration styles
1363
+ {
1364
+ dataStyles.innerHTML += cmpTags + HYDRATED_CSS;
1365
+ }
1366
+ // If we have styles, add them to the DOM
1367
+ if (dataStyles.innerHTML.length) {
1368
+ dataStyles.setAttribute('data-styles', '');
1369
+ // Apply CSP nonce to the style tag if it exists
1370
+ const nonce = (_a = plt.$nonce$) !== null && _a !== void 0 ? _a : queryNonceMetaTagContent(doc);
1371
+ if (nonce != null) {
1372
+ dataStyles.setAttribute('nonce', nonce);
1373
+ }
1374
+ // Insert the styles into the document head
1375
+ // NOTE: this _needs_ to happen last so we can ensure the nonce (and other attributes) are applied
1376
+ head.insertBefore(dataStyles, metaCharset ? metaCharset.nextSibling : head.firstChild);
1377
+ }
1378
+ // Process deferred connectedCallbacks now all components have been registered
1379
+ isBootstrapping = false;
1380
+ if (deferredConnectedCallbacks.length) {
1381
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1382
+ }
1383
+ else {
1384
+ {
1385
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1386
+ }
1387
+ }
1388
+ // Fallback appLoad event
1389
+ endBootstrap();
1390
+ };
1391
+ /**
1392
+ * Assigns the given value to the nonce property on the runtime platform object.
1393
+ * During runtime, this value is used to set the nonce attribute on all dynamically created script and style tags.
1394
+ * @param nonce The value to be assigned to the platform nonce property.
1395
+ * @returns void
1396
+ */
1397
+ const setNonce = (nonce) => (plt.$nonce$ = nonce);
1398
+ /**
1399
+ * A WeakMap mapping runtime component references to their corresponding host reference
1400
+ * instances.
1401
+ */
1402
+ const hostRefs = /*@__PURE__*/ new WeakMap();
1403
+ /**
1404
+ * Given a {@link d.RuntimeRef} retrieve the corresponding {@link d.HostRef}
1405
+ *
1406
+ * @param ref the runtime ref of interest
1407
+ * @returns the Host reference (if found) or undefined
1408
+ */
1409
+ const getHostRef = (ref) => hostRefs.get(ref);
1410
+ /**
1411
+ * Register a lazy instance with the {@link hostRefs} object so it's
1412
+ * corresponding {@link d.HostRef} can be retrieved later.
1413
+ *
1414
+ * @param lazyInstance the lazy instance of interest
1415
+ * @param hostRef that instances `HostRef` object
1416
+ * @returns a reference to the host ref WeakMap
1417
+ */
1418
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1419
+ /**
1420
+ * Register a host element for a Stencil component, setting up various metadata
1421
+ * and callbacks based on {@link BUILD} flags as well as the component's runtime
1422
+ * metadata.
1423
+ *
1424
+ * @param hostElement the host element to register
1425
+ * @param cmpMeta runtime metadata for that component
1426
+ * @returns a reference to the host ref WeakMap
1427
+ */
1428
+ const registerHost = (hostElement, cmpMeta) => {
1429
+ const hostRef = {
1430
+ $flags$: 0,
1431
+ $hostElement$: hostElement,
1432
+ $cmpMeta$: cmpMeta,
1433
+ $instanceValues$: new Map(),
1434
+ };
1435
+ {
1436
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1437
+ hostElement['s-p'] = [];
1438
+ hostElement['s-rc'] = [];
1439
+ }
1440
+ return hostRefs.set(hostElement, hostRef);
1441
+ };
1442
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1443
+ const consoleError = (e, el) => (0, console.error)(e, el);
1444
+ const cmpModules = /*@__PURE__*/ new Map();
1445
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1446
+ // loadModuleImport
1447
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1448
+ const bundleId = cmpMeta.$lazyBundleId$;
1449
+ const module = cmpModules.get(bundleId) ;
1450
+ if (module) {
1451
+ return module[exportName];
1452
+ }
1453
+
1454
+ if (!hmrVersionId || !BUILD.hotModuleReplacement) {
1455
+ const processMod = importedModule => {
1456
+ cmpModules.set(bundleId, importedModule);
1457
+ return importedModule[exportName];
1458
+ }
1459
+ switch(bundleId) {
1460
+
1461
+ case 'mds-input-tip':
1462
+ return import(
1463
+ /* webpackMode: "lazy" */
1464
+ './mds-input-tip.entry.js').then(processMod, consoleError);
1465
+ }
1466
+ }
1467
+ return import(
1468
+ /* @vite-ignore */
1469
+ /* webpackInclude: /\.entry\.js$/ */
1470
+ /* webpackExclude: /\.system\.entry\.js$/ */
1471
+ /* webpackMode: "lazy" */
1472
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1473
+ {
1474
+ cmpModules.set(bundleId, importedModule);
1475
+ }
1476
+ return importedModule[exportName];
1477
+ }, consoleError);
1478
+ };
1479
+ const styles = /*@__PURE__*/ new Map();
1480
+ const win = typeof window !== 'undefined' ? window : {};
1481
+ const doc = win.document || { head: {} };
1482
+ const plt = {
1483
+ $flags$: 0,
1484
+ $resourcesUrl$: '',
1485
+ jmp: (h) => h(),
1486
+ raf: (h) => requestAnimationFrame(h),
1487
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
1488
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
1489
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
1490
+ };
1491
+ const promiseResolve = (v) => Promise.resolve(v);
1492
+ const supportsConstructableStylesheets = /*@__PURE__*/ (() => {
1493
+ try {
1494
+ new CSSStyleSheet();
1495
+ return typeof new CSSStyleSheet().replaceSync === 'function';
1496
+ }
1497
+ catch (e) { }
1498
+ return false;
1499
+ })()
1500
+ ;
1501
+ const queueDomReads = [];
1502
+ const queueDomWrites = [];
1503
+ const queueTask = (queue, write) => (cb) => {
1504
+ queue.push(cb);
1505
+ if (!queuePending) {
1506
+ queuePending = true;
1507
+ if (write && plt.$flags$ & 4 /* PLATFORM_FLAGS.queueSync */) {
1508
+ nextTick(flush);
1509
+ }
1510
+ else {
1511
+ plt.raf(flush);
1512
+ }
1513
+ }
1514
+ };
1515
+ const consume = (queue) => {
1516
+ for (let i = 0; i < queue.length; i++) {
1517
+ try {
1518
+ queue[i](performance.now());
1519
+ }
1520
+ catch (e) {
1521
+ consoleError(e);
1522
+ }
1523
+ }
1524
+ queue.length = 0;
1525
+ };
1526
+ const flush = () => {
1527
+ // always force a bunch of medium callbacks to run, but still have
1528
+ // a throttle on how many can run in a certain time
1529
+ // DOM READS!!!
1530
+ consume(queueDomReads);
1531
+ // DOM WRITES!!!
1532
+ {
1533
+ consume(queueDomWrites);
1534
+ if ((queuePending = queueDomReads.length > 0)) {
1535
+ // still more to do yet, but we've run out of time
1536
+ // let's let this thing cool off and try again in the next tick
1537
+ plt.raf(flush);
1538
+ }
1539
+ }
1540
+ };
1541
+ const nextTick = (cb) => promiseResolve().then(cb);
1542
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1543
+
1544
+ export { Host as H, bootstrapLazy as b, h, promiseResolve as p, registerInstance as r, setNonce as s };