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