@everymatrix/general-registration 1.10.0

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