@everymatrix/player-kyc-verification 1.16.1

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