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