@ekyc_qoobiss/qbs-ect-cmp 1.5.11

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