@everymatrix/player-elevate-card 1.31.2

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 (115) hide show
  1. package/dist/cjs/general-styling-wrapper_5.cjs.entry.js +3162 -0
  2. package/dist/cjs/index-234565f1.js +1645 -0
  3. package/dist/cjs/index.cjs.js +2 -0
  4. package/dist/cjs/loader.cjs.js +21 -0
  5. package/dist/cjs/player-elevate-card.cjs.js +19 -0
  6. package/dist/collection/collection-manifest.json +22 -0
  7. package/dist/collection/components/player-elevate-card/player-elevate-card-items.js +43 -0
  8. package/dist/collection/components/player-elevate-card/player-elevate-card.css +65 -0
  9. package/dist/collection/components/player-elevate-card/player-elevate-card.js +282 -0
  10. package/dist/collection/components/player-elevate-card-data/player-elevate-card-data.css +189 -0
  11. package/dist/collection/components/player-elevate-card-data/player-elevate-card-data.js +208 -0
  12. package/dist/collection/components/player-elevate-loyaltycard/player-elevate-loyaltycard.css +68 -0
  13. package/dist/collection/components/player-elevate-loyaltycard/player-elevate-loyaltycard.js +287 -0
  14. package/dist/collection/components/player-elevate-pointcard/player-elevate-pointcard.css +70 -0
  15. package/dist/collection/components/player-elevate-pointcard/player-elevate-pointcard.js +323 -0
  16. package/dist/collection/components/static/button-default.svg +42 -0
  17. package/dist/collection/components/static/button-disabled.svg +4 -0
  18. package/dist/collection/components/static/button-hover.svg +4 -0
  19. package/dist/collection/components/static/button-level.svg +27 -0
  20. package/dist/collection/components/static/button-pressed.svg +18 -0
  21. package/dist/collection/components/static/button-redeem.svg +36 -0
  22. package/dist/collection/components/static/card-ground-over.png +0 -0
  23. package/dist/collection/components/static/card-ground-over.svg +903 -0
  24. package/dist/collection/components/static/card-ground.png +0 -0
  25. package/dist/collection/components/static/card-ground.svg +34 -0
  26. package/dist/collection/components/static/info.svg +4 -0
  27. package/dist/collection/components/static/level-badge.png +0 -0
  28. package/dist/collection/components/static/level-percent.svg +80 -0
  29. package/dist/collection/components/static/tips-info.svg +21 -0
  30. package/dist/collection/components/static/user.svg +3 -0
  31. package/dist/collection/index.js +1 -0
  32. package/dist/collection/models/player-elevate.js +1 -0
  33. package/dist/collection/utils/locale.utils.js +144 -0
  34. package/dist/collection/utils/utils.js +47 -0
  35. package/dist/components/general-styling-wrapper.js +6 -0
  36. package/dist/components/general-styling-wrapper2.js +103 -0
  37. package/dist/components/index.d.ts +26 -0
  38. package/dist/components/index.js +1 -0
  39. package/dist/components/player-elevate-card-data.d.ts +11 -0
  40. package/dist/components/player-elevate-card-data.js +6 -0
  41. package/dist/components/player-elevate-card-data2.js +624 -0
  42. package/dist/components/player-elevate-card-items.js +2250 -0
  43. package/dist/components/player-elevate-card.d.ts +11 -0
  44. package/dist/components/player-elevate-card.js +118 -0
  45. package/dist/components/player-elevate-loyaltycard.d.ts +11 -0
  46. package/dist/components/player-elevate-loyaltycard.js +124 -0
  47. package/dist/components/player-elevate-pointcard.d.ts +11 -0
  48. package/dist/components/player-elevate-pointcard.js +127 -0
  49. package/dist/components/static/button-default.svg +42 -0
  50. package/dist/components/static/button-disabled.svg +4 -0
  51. package/dist/components/static/button-hover.svg +4 -0
  52. package/dist/components/static/button-level.svg +27 -0
  53. package/dist/components/static/button-pressed.svg +18 -0
  54. package/dist/components/static/button-redeem.svg +36 -0
  55. package/dist/components/static/card-ground-over.png +0 -0
  56. package/dist/components/static/card-ground-over.svg +903 -0
  57. package/dist/components/static/card-ground.png +0 -0
  58. package/dist/components/static/card-ground.svg +34 -0
  59. package/dist/components/static/info.svg +4 -0
  60. package/dist/components/static/level-badge.png +0 -0
  61. package/dist/components/static/level-percent.svg +80 -0
  62. package/dist/components/static/tips-info.svg +21 -0
  63. package/dist/components/static/user.svg +3 -0
  64. package/dist/esm/general-styling-wrapper_5.entry.js +3154 -0
  65. package/dist/esm/index-747197fd.js +1616 -0
  66. package/dist/esm/index.js +1 -0
  67. package/dist/esm/loader.js +17 -0
  68. package/dist/esm/player-elevate-card.js +17 -0
  69. package/dist/esm/polyfills/core-js.js +11 -0
  70. package/dist/esm/polyfills/css-shim.js +1 -0
  71. package/dist/esm/polyfills/dom.js +79 -0
  72. package/dist/esm/polyfills/es5-html-element.js +1 -0
  73. package/dist/esm/polyfills/index.js +34 -0
  74. package/dist/esm/polyfills/system.js +6 -0
  75. package/dist/index.cjs.js +1 -0
  76. package/dist/index.js +1 -0
  77. package/dist/player-elevate-card/index.esm.js +0 -0
  78. package/dist/player-elevate-card/p-56620f7c.entry.js +1 -0
  79. package/dist/player-elevate-card/p-afe7b72e.js +1 -0
  80. package/dist/player-elevate-card/player-elevate-card.esm.js +1 -0
  81. package/dist/static/button-default.svg +42 -0
  82. package/dist/static/button-disabled.svg +4 -0
  83. package/dist/static/button-hover.svg +4 -0
  84. package/dist/static/button-level.svg +27 -0
  85. package/dist/static/button-pressed.svg +18 -0
  86. package/dist/static/button-redeem.svg +36 -0
  87. package/dist/static/card-ground-over.png +0 -0
  88. package/dist/static/card-ground-over.svg +903 -0
  89. package/dist/static/card-ground.png +0 -0
  90. package/dist/static/card-ground.svg +34 -0
  91. package/dist/static/info.svg +4 -0
  92. package/dist/static/level-badge.png +0 -0
  93. package/dist/static/level-percent.svg +80 -0
  94. package/dist/static/tips-info.svg +21 -0
  95. package/dist/static/user.svg +3 -0
  96. package/dist/stencil.config.js +32 -0
  97. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/player-elevate-card/.stencil/packages/player-elevate-card/stencil.config.d.ts +2 -0
  98. package/dist/types/components/player-elevate-card/player-elevate-card-items.d.ts +19 -0
  99. package/dist/types/components/player-elevate-card/player-elevate-card.d.ts +53 -0
  100. package/dist/types/components/player-elevate-card-data/player-elevate-card-data.d.ts +22 -0
  101. package/dist/types/components/player-elevate-loyaltycard/player-elevate-loyaltycard.d.ts +53 -0
  102. package/dist/types/components/player-elevate-pointcard/player-elevate-pointcard.d.ts +66 -0
  103. package/dist/types/components.d.ts +335 -0
  104. package/dist/types/index.d.ts +1 -0
  105. package/dist/types/models/player-elevate.d.ts +40 -0
  106. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  107. package/dist/types/utils/locale.utils.d.ts +15 -0
  108. package/dist/types/utils/utils.d.ts +1 -0
  109. package/loader/cdn.js +3 -0
  110. package/loader/index.cjs.js +3 -0
  111. package/loader/index.d.ts +12 -0
  112. package/loader/index.es2017.js +3 -0
  113. package/loader/index.js +4 -0
  114. package/loader/package.json +10 -0
  115. package/package.json +24 -0
@@ -0,0 +1,1616 @@
1
+ const NAMESPACE = 'player-elevate-card';
2
+
3
+ let scopeId;
4
+ let contentRef;
5
+ let hostTagName;
6
+ let useNativeShadowDom = false;
7
+ let checkSlotFallbackVisibility = false;
8
+ let checkSlotRelocate = false;
9
+ let isSvgMode = false;
10
+ let queuePending = false;
11
+ const win = typeof window !== 'undefined' ? window : {};
12
+ const doc = win.document || { head: {} };
13
+ const plt = {
14
+ $flags$: 0,
15
+ $resourcesUrl$: '',
16
+ jmp: (h) => h(),
17
+ raf: (h) => requestAnimationFrame(h),
18
+ ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
19
+ rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
20
+ ce: (eventName, opts) => new CustomEvent(eventName, opts),
21
+ };
22
+ const promiseResolve = (v) => Promise.resolve(v);
23
+ const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
24
+ try {
25
+ new CSSStyleSheet();
26
+ return typeof new CSSStyleSheet().replace === 'function';
27
+ }
28
+ catch (e) { }
29
+ return false;
30
+ })()
31
+ ;
32
+ const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
33
+ if (listeners) {
34
+ listeners.map(([flags, name, method]) => {
35
+ const target = getHostListenerTarget(elm, flags) ;
36
+ const handler = hostListenerProxy(hostRef, method);
37
+ const opts = hostListenerOpts(flags);
38
+ plt.ael(target, name, handler, opts);
39
+ (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
40
+ });
41
+ }
42
+ };
43
+ const hostListenerProxy = (hostRef, methodName) => (ev) => {
44
+ try {
45
+ {
46
+ if (hostRef.$flags$ & 256 /* isListenReady */) {
47
+ // instance is ready, let's call it's member method for this event
48
+ hostRef.$lazyInstance$[methodName](ev);
49
+ }
50
+ else {
51
+ (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
52
+ }
53
+ }
54
+ }
55
+ catch (e) {
56
+ consoleError(e);
57
+ }
58
+ };
59
+ const getHostListenerTarget = (elm, flags) => {
60
+ if (flags & 8 /* TargetWindow */)
61
+ return win;
62
+ return elm;
63
+ };
64
+ // prettier-ignore
65
+ const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0;
66
+ const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
67
+ const createTime = (fnName, tagName = '') => {
68
+ {
69
+ return () => {
70
+ return;
71
+ };
72
+ }
73
+ };
74
+ const uniqueTime = (key, measureText) => {
75
+ {
76
+ return () => {
77
+ return;
78
+ };
79
+ }
80
+ };
81
+ const rootAppliedStyles = new WeakMap();
82
+ const registerStyle = (scopeId, cssText, allowCS) => {
83
+ let style = styles.get(scopeId);
84
+ if (supportsConstructibleStylesheets && allowCS) {
85
+ style = (style || new CSSStyleSheet());
86
+ style.replace(cssText);
87
+ }
88
+ else {
89
+ style = cssText;
90
+ }
91
+ styles.set(scopeId, style);
92
+ };
93
+ const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
94
+ let scopeId = getScopeId(cmpMeta);
95
+ let style = styles.get(scopeId);
96
+ // if an element is NOT connected then getRootNode() will return the wrong root node
97
+ // so the fallback is to always use the document for the root node in those cases
98
+ styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
99
+ if (style) {
100
+ if (typeof style === 'string') {
101
+ styleContainerNode = styleContainerNode.head || styleContainerNode;
102
+ let appliedStyles = rootAppliedStyles.get(styleContainerNode);
103
+ let styleElm;
104
+ if (!appliedStyles) {
105
+ rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
106
+ }
107
+ if (!appliedStyles.has(scopeId)) {
108
+ {
109
+ {
110
+ styleElm = doc.createElement('style');
111
+ styleElm.innerHTML = style;
112
+ }
113
+ styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
114
+ }
115
+ if (appliedStyles) {
116
+ appliedStyles.add(scopeId);
117
+ }
118
+ }
119
+ }
120
+ else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
121
+ styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
122
+ }
123
+ }
124
+ return scopeId;
125
+ };
126
+ const attachStyles = (hostRef) => {
127
+ const cmpMeta = hostRef.$cmpMeta$;
128
+ const elm = hostRef.$hostElement$;
129
+ const flags = cmpMeta.$flags$;
130
+ const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
131
+ const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta);
132
+ if (flags & 10 /* needsScopedEncapsulation */) {
133
+ // only required when we're NOT using native shadow dom (slot)
134
+ // or this browser doesn't support native shadow dom
135
+ // and this host element was NOT created with SSR
136
+ // let's pick out the inner content for slot projection
137
+ // create a node to represent where the original
138
+ // content was first placed, which is useful later on
139
+ // DOM WRITE!!
140
+ elm['s-sc'] = scopeId;
141
+ elm.classList.add(scopeId + '-h');
142
+ }
143
+ endAttachStyles();
144
+ };
145
+ const getScopeId = (cmp, mode) => 'sc-' + (cmp.$tagName$);
146
+ /**
147
+ * Default style mode id
148
+ */
149
+ /**
150
+ * Reusable empty obj/array
151
+ * Don't add values to these!!
152
+ */
153
+ const EMPTY_OBJ = {};
154
+ const isDef = (v) => v != null;
155
+ const isComplexType = (o) => {
156
+ // https://jsperf.com/typeof-fn-object/5
157
+ o = typeof o;
158
+ return o === 'object' || o === 'function';
159
+ };
160
+ /**
161
+ * Production h() function based on Preact by
162
+ * Jason Miller (@developit)
163
+ * Licensed under the MIT License
164
+ * https://github.com/developit/preact/blob/master/LICENSE
165
+ *
166
+ * Modified for Stencil's compiler and vdom
167
+ */
168
+ // const stack: any[] = [];
169
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
170
+ // export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
171
+ const h = (nodeName, vnodeData, ...children) => {
172
+ let child = null;
173
+ let slotName = null;
174
+ let simple = false;
175
+ let lastSimple = false;
176
+ let vNodeChildren = [];
177
+ const walk = (c) => {
178
+ for (let i = 0; i < c.length; i++) {
179
+ child = c[i];
180
+ if (Array.isArray(child)) {
181
+ walk(child);
182
+ }
183
+ else if (child != null && typeof child !== 'boolean') {
184
+ if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
185
+ child = String(child);
186
+ }
187
+ if (simple && lastSimple) {
188
+ // If the previous child was simple (string), we merge both
189
+ vNodeChildren[vNodeChildren.length - 1].$text$ += child;
190
+ }
191
+ else {
192
+ // Append a new vNode, if it's text, we create a text vNode
193
+ vNodeChildren.push(simple ? newVNode(null, child) : child);
194
+ }
195
+ lastSimple = simple;
196
+ }
197
+ }
198
+ };
199
+ walk(children);
200
+ if (vnodeData) {
201
+ if (vnodeData.name) {
202
+ slotName = vnodeData.name;
203
+ }
204
+ {
205
+ const classData = vnodeData.className || vnodeData.class;
206
+ if (classData) {
207
+ vnodeData.class =
208
+ typeof classData !== 'object'
209
+ ? classData
210
+ : Object.keys(classData)
211
+ .filter((k) => classData[k])
212
+ .join(' ');
213
+ }
214
+ }
215
+ }
216
+ if (typeof nodeName === 'function') {
217
+ // nodeName is a functional component
218
+ return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
219
+ }
220
+ const vnode = newVNode(nodeName, null);
221
+ vnode.$attrs$ = vnodeData;
222
+ if (vNodeChildren.length > 0) {
223
+ vnode.$children$ = vNodeChildren;
224
+ }
225
+ {
226
+ vnode.$name$ = slotName;
227
+ }
228
+ return vnode;
229
+ };
230
+ const newVNode = (tag, text) => {
231
+ const vnode = {
232
+ $flags$: 0,
233
+ $tag$: tag,
234
+ $text$: text,
235
+ $elm$: null,
236
+ $children$: null,
237
+ };
238
+ {
239
+ vnode.$attrs$ = null;
240
+ }
241
+ {
242
+ vnode.$name$ = null;
243
+ }
244
+ return vnode;
245
+ };
246
+ const Host = {};
247
+ const isHost = (node) => node && node.$tag$ === Host;
248
+ const vdomFnUtils = {
249
+ forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
250
+ map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate),
251
+ };
252
+ const convertToPublic = (node) => ({
253
+ vattrs: node.$attrs$,
254
+ vchildren: node.$children$,
255
+ vkey: node.$key$,
256
+ vname: node.$name$,
257
+ vtag: node.$tag$,
258
+ vtext: node.$text$,
259
+ });
260
+ const convertToPrivate = (node) => {
261
+ if (typeof node.vtag === 'function') {
262
+ const vnodeData = Object.assign({}, node.vattrs);
263
+ if (node.vkey) {
264
+ vnodeData.key = node.vkey;
265
+ }
266
+ if (node.vname) {
267
+ vnodeData.name = node.vname;
268
+ }
269
+ return h(node.vtag, vnodeData, ...(node.vchildren || []));
270
+ }
271
+ const vnode = newVNode(node.vtag, node.vtext);
272
+ vnode.$attrs$ = node.vattrs;
273
+ vnode.$children$ = node.vchildren;
274
+ vnode.$key$ = node.vkey;
275
+ vnode.$name$ = node.vname;
276
+ return vnode;
277
+ };
278
+ /**
279
+ * Production setAccessor() function based on Preact by
280
+ * Jason Miller (@developit)
281
+ * Licensed under the MIT License
282
+ * https://github.com/developit/preact/blob/master/LICENSE
283
+ *
284
+ * Modified for Stencil's compiler and vdom
285
+ */
286
+ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
287
+ if (oldValue !== newValue) {
288
+ let isProp = isMemberInElement(elm, memberName);
289
+ let ln = memberName.toLowerCase();
290
+ if (memberName === 'class') {
291
+ const classList = elm.classList;
292
+ const oldClasses = parseClassList(oldValue);
293
+ const newClasses = parseClassList(newValue);
294
+ classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
295
+ classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
296
+ }
297
+ else if (memberName === 'style') {
298
+ // update style attribute, css properties and values
299
+ {
300
+ for (const prop in oldValue) {
301
+ if (!newValue || newValue[prop] == null) {
302
+ if (prop.includes('-')) {
303
+ elm.style.removeProperty(prop);
304
+ }
305
+ else {
306
+ elm.style[prop] = '';
307
+ }
308
+ }
309
+ }
310
+ }
311
+ for (const prop in newValue) {
312
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
313
+ if (prop.includes('-')) {
314
+ elm.style.setProperty(prop, newValue[prop]);
315
+ }
316
+ else {
317
+ elm.style[prop] = newValue[prop];
318
+ }
319
+ }
320
+ }
321
+ }
322
+ else if ((!isProp ) &&
323
+ memberName[0] === 'o' &&
324
+ memberName[1] === 'n') {
325
+ // Event Handlers
326
+ // so if the member name starts with "on" and the 3rd characters is
327
+ // a capital letter, and it's not already a member on the element,
328
+ // then we're assuming it's an event listener
329
+ if (memberName[2] === '-') {
330
+ // on- prefixed events
331
+ // allows to be explicit about the dom event to listen without any magic
332
+ // under the hood:
333
+ // <my-cmp on-click> // listens for "click"
334
+ // <my-cmp on-Click> // listens for "Click"
335
+ // <my-cmp on-ionChange> // listens for "ionChange"
336
+ // <my-cmp on-EVENTS> // listens for "EVENTS"
337
+ memberName = memberName.slice(3);
338
+ }
339
+ else if (isMemberInElement(win, ln)) {
340
+ // standard event
341
+ // the JSX attribute could have been "onMouseOver" and the
342
+ // member name "onmouseover" is on the window's prototype
343
+ // so let's add the listener "mouseover", which is all lowercased
344
+ memberName = ln.slice(2);
345
+ }
346
+ else {
347
+ // custom event
348
+ // the JSX attribute could have been "onMyCustomEvent"
349
+ // so let's trim off the "on" prefix and lowercase the first character
350
+ // and add the listener "myCustomEvent"
351
+ // except for the first character, we keep the event name case
352
+ memberName = ln[2] + memberName.slice(3);
353
+ }
354
+ if (oldValue) {
355
+ plt.rel(elm, memberName, oldValue, false);
356
+ }
357
+ if (newValue) {
358
+ plt.ael(elm, memberName, newValue, false);
359
+ }
360
+ }
361
+ else {
362
+ // Set property if it exists and it's not a SVG
363
+ const isComplex = isComplexType(newValue);
364
+ if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
365
+ try {
366
+ if (!elm.tagName.includes('-')) {
367
+ let n = newValue == null ? '' : newValue;
368
+ // Workaround for Safari, moving the <input> caret when re-assigning the same valued
369
+ if (memberName === 'list') {
370
+ isProp = false;
371
+ }
372
+ else if (oldValue == null || elm[memberName] != n) {
373
+ elm[memberName] = n;
374
+ }
375
+ }
376
+ else {
377
+ elm[memberName] = newValue;
378
+ }
379
+ }
380
+ catch (e) { }
381
+ }
382
+ if (newValue == null || newValue === false) {
383
+ if (newValue !== false || elm.getAttribute(memberName) === '') {
384
+ {
385
+ elm.removeAttribute(memberName);
386
+ }
387
+ }
388
+ }
389
+ else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
390
+ newValue = newValue === true ? '' : newValue;
391
+ {
392
+ elm.setAttribute(memberName, newValue);
393
+ }
394
+ }
395
+ }
396
+ }
397
+ };
398
+ const parseClassListRegex = /\s/;
399
+ const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
400
+ const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
401
+ // if the element passed in is a shadow root, which is a document fragment
402
+ // then we want to be adding attrs/props to the shadow root's "host" element
403
+ // if it's not a shadow root, then we add attrs/props to the same element
404
+ const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host
405
+ ? newVnode.$elm$.host
406
+ : newVnode.$elm$;
407
+ const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
408
+ const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
409
+ {
410
+ // remove attributes no longer present on the vnode by setting them to undefined
411
+ for (memberName in oldVnodeAttrs) {
412
+ if (!(memberName in newVnodeAttrs)) {
413
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
414
+ }
415
+ }
416
+ }
417
+ // add new & update changed attributes
418
+ for (memberName in newVnodeAttrs) {
419
+ setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
420
+ }
421
+ };
422
+ const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
423
+ // tslint:disable-next-line: prefer-const
424
+ let newVNode = newParentVNode.$children$[childIndex];
425
+ let i = 0;
426
+ let elm;
427
+ let childNode;
428
+ let oldVNode;
429
+ if (!useNativeShadowDom) {
430
+ // remember for later we need to check to relocate nodes
431
+ checkSlotRelocate = true;
432
+ if (newVNode.$tag$ === 'slot') {
433
+ if (scopeId) {
434
+ // scoped css needs to add its scoped id to the parent element
435
+ parentElm.classList.add(scopeId + '-s');
436
+ }
437
+ newVNode.$flags$ |= newVNode.$children$
438
+ ? // slot element has fallback content
439
+ 2 /* isSlotFallback */
440
+ : // slot element does not have fallback content
441
+ 1 /* isSlotReference */;
442
+ }
443
+ }
444
+ if (newVNode.$text$ !== null) {
445
+ // create text node
446
+ elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
447
+ }
448
+ else if (newVNode.$flags$ & 1 /* isSlotReference */) {
449
+ // create a slot reference node
450
+ elm = newVNode.$elm$ =
451
+ doc.createTextNode('');
452
+ }
453
+ else {
454
+ // create element
455
+ elm = newVNode.$elm$ = (doc.createElement(newVNode.$flags$ & 2 /* isSlotFallback */
456
+ ? 'slot-fb'
457
+ : newVNode.$tag$));
458
+ // add css classes, attrs, props, listeners, etc.
459
+ {
460
+ updateElement(null, newVNode, isSvgMode);
461
+ }
462
+ if (isDef(scopeId) && elm['s-si'] !== scopeId) {
463
+ // if there is a scopeId and this is the initial render
464
+ // then let's add the scopeId as a css class
465
+ elm.classList.add((elm['s-si'] = scopeId));
466
+ }
467
+ if (newVNode.$children$) {
468
+ for (i = 0; i < newVNode.$children$.length; ++i) {
469
+ // create the node
470
+ childNode = createElm(oldParentVNode, newVNode, i, elm);
471
+ // return node could have been null
472
+ if (childNode) {
473
+ // append our new node
474
+ elm.appendChild(childNode);
475
+ }
476
+ }
477
+ }
478
+ }
479
+ {
480
+ elm['s-hn'] = hostTagName;
481
+ if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
482
+ // remember the content reference comment
483
+ elm['s-sr'] = true;
484
+ // remember the content reference comment
485
+ elm['s-cr'] = contentRef;
486
+ // remember the slot name, or empty string for default slot
487
+ elm['s-sn'] = newVNode.$name$ || '';
488
+ // check if we've got an old vnode for this slot
489
+ oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
490
+ if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
491
+ // we've got an old slot vnode and the wrapper is being replaced
492
+ // so let's move the old slot content back to it's original location
493
+ putBackInOriginalLocation(oldParentVNode.$elm$, false);
494
+ }
495
+ }
496
+ }
497
+ return elm;
498
+ };
499
+ const putBackInOriginalLocation = (parentElm, recursive) => {
500
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
501
+ const oldSlotChildNodes = parentElm.childNodes;
502
+ for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
503
+ const childNode = oldSlotChildNodes[i];
504
+ if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
505
+ // // this child node in the old element is from another component
506
+ // // remove this node from the old slot's parent
507
+ // childNode.remove();
508
+ // and relocate it back to it's original location
509
+ parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
510
+ // remove the old original location comment entirely
511
+ // later on the patch function will know what to do
512
+ // and move this to the correct spot in need be
513
+ childNode['s-ol'].remove();
514
+ childNode['s-ol'] = undefined;
515
+ checkSlotRelocate = true;
516
+ }
517
+ if (recursive) {
518
+ putBackInOriginalLocation(childNode, recursive);
519
+ }
520
+ }
521
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
522
+ };
523
+ const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
524
+ let containerElm = ((parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
525
+ let childNode;
526
+ if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
527
+ containerElm = containerElm.shadowRoot;
528
+ }
529
+ for (; startIdx <= endIdx; ++startIdx) {
530
+ if (vnodes[startIdx]) {
531
+ childNode = createElm(null, parentVNode, startIdx, parentElm);
532
+ if (childNode) {
533
+ vnodes[startIdx].$elm$ = childNode;
534
+ containerElm.insertBefore(childNode, referenceNode(before) );
535
+ }
536
+ }
537
+ }
538
+ };
539
+ const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
540
+ for (; startIdx <= endIdx; ++startIdx) {
541
+ if ((vnode = vnodes[startIdx])) {
542
+ elm = vnode.$elm$;
543
+ {
544
+ // we're removing this element
545
+ // so it's possible we need to show slot fallback content now
546
+ checkSlotFallbackVisibility = true;
547
+ if (elm['s-ol']) {
548
+ // remove the original location comment
549
+ elm['s-ol'].remove();
550
+ }
551
+ else {
552
+ // it's possible that child nodes of the node
553
+ // that's being removed are slot nodes
554
+ putBackInOriginalLocation(elm, true);
555
+ }
556
+ }
557
+ // remove the vnode's element from the dom
558
+ elm.remove();
559
+ }
560
+ }
561
+ };
562
+ const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
563
+ let oldStartIdx = 0;
564
+ let newStartIdx = 0;
565
+ let oldEndIdx = oldCh.length - 1;
566
+ let oldStartVnode = oldCh[0];
567
+ let oldEndVnode = oldCh[oldEndIdx];
568
+ let newEndIdx = newCh.length - 1;
569
+ let newStartVnode = newCh[0];
570
+ let newEndVnode = newCh[newEndIdx];
571
+ let node;
572
+ while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
573
+ if (oldStartVnode == null) {
574
+ // Vnode might have been moved left
575
+ oldStartVnode = oldCh[++oldStartIdx];
576
+ }
577
+ else if (oldEndVnode == null) {
578
+ oldEndVnode = oldCh[--oldEndIdx];
579
+ }
580
+ else if (newStartVnode == null) {
581
+ newStartVnode = newCh[++newStartIdx];
582
+ }
583
+ else if (newEndVnode == null) {
584
+ newEndVnode = newCh[--newEndIdx];
585
+ }
586
+ else if (isSameVnode(oldStartVnode, newStartVnode)) {
587
+ patch(oldStartVnode, newStartVnode);
588
+ oldStartVnode = oldCh[++oldStartIdx];
589
+ newStartVnode = newCh[++newStartIdx];
590
+ }
591
+ else if (isSameVnode(oldEndVnode, newEndVnode)) {
592
+ patch(oldEndVnode, newEndVnode);
593
+ oldEndVnode = oldCh[--oldEndIdx];
594
+ newEndVnode = newCh[--newEndIdx];
595
+ }
596
+ else if (isSameVnode(oldStartVnode, newEndVnode)) {
597
+ // Vnode moved right
598
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
599
+ putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
600
+ }
601
+ patch(oldStartVnode, newEndVnode);
602
+ parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
603
+ oldStartVnode = oldCh[++oldStartIdx];
604
+ newEndVnode = newCh[--newEndIdx];
605
+ }
606
+ else if (isSameVnode(oldEndVnode, newStartVnode)) {
607
+ // Vnode moved left
608
+ if ((oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
609
+ putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
610
+ }
611
+ patch(oldEndVnode, newStartVnode);
612
+ parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
613
+ oldEndVnode = oldCh[--oldEndIdx];
614
+ newStartVnode = newCh[++newStartIdx];
615
+ }
616
+ else {
617
+ {
618
+ // new element
619
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
620
+ newStartVnode = newCh[++newStartIdx];
621
+ }
622
+ if (node) {
623
+ {
624
+ parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
625
+ }
626
+ }
627
+ }
628
+ }
629
+ if (oldStartIdx > oldEndIdx) {
630
+ addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
631
+ }
632
+ else if (newStartIdx > newEndIdx) {
633
+ removeVnodes(oldCh, oldStartIdx, oldEndIdx);
634
+ }
635
+ };
636
+ const isSameVnode = (vnode1, vnode2) => {
637
+ // compare if two vnode to see if they're "technically" the same
638
+ // need to have the same element tag, and same key to be the same
639
+ if (vnode1.$tag$ === vnode2.$tag$) {
640
+ if (vnode1.$tag$ === 'slot') {
641
+ return vnode1.$name$ === vnode2.$name$;
642
+ }
643
+ return true;
644
+ }
645
+ return false;
646
+ };
647
+ const referenceNode = (node) => {
648
+ // this node was relocated to a new location in the dom
649
+ // because of some other component's slot
650
+ // but we still have an html comment in place of where
651
+ // it's original location was according to it's original vdom
652
+ return (node && node['s-ol']) || node;
653
+ };
654
+ const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
655
+ const patch = (oldVNode, newVNode) => {
656
+ const elm = (newVNode.$elm$ = oldVNode.$elm$);
657
+ const oldChildren = oldVNode.$children$;
658
+ const newChildren = newVNode.$children$;
659
+ const tag = newVNode.$tag$;
660
+ const text = newVNode.$text$;
661
+ let defaultHolder;
662
+ if (text === null) {
663
+ // element node
664
+ {
665
+ if (tag === 'slot')
666
+ ;
667
+ else {
668
+ // either this is the first render of an element OR it's an update
669
+ // AND we already know it's possible it could have changed
670
+ // this updates the element's css classes, attrs, props, listeners, etc.
671
+ updateElement(oldVNode, newVNode, isSvgMode);
672
+ }
673
+ }
674
+ if (oldChildren !== null && newChildren !== null) {
675
+ // looks like there's child vnodes for both the old and new vnodes
676
+ updateChildren(elm, oldChildren, newVNode, newChildren);
677
+ }
678
+ else if (newChildren !== null) {
679
+ // no old child vnodes, but there are new child vnodes to add
680
+ if (oldVNode.$text$ !== null) {
681
+ // the old vnode was text, so be sure to clear it out
682
+ elm.textContent = '';
683
+ }
684
+ // add the new vnode children
685
+ addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
686
+ }
687
+ else if (oldChildren !== null) {
688
+ // no new child vnodes, but there are old child vnodes to remove
689
+ removeVnodes(oldChildren, 0, oldChildren.length - 1);
690
+ }
691
+ }
692
+ else if ((defaultHolder = elm['s-cr'])) {
693
+ // this element has slotted content
694
+ defaultHolder.parentNode.textContent = text;
695
+ }
696
+ else if (oldVNode.$text$ !== text) {
697
+ // update the text content for the text only vnode
698
+ // and also only if the text is different than before
699
+ elm.data = text;
700
+ }
701
+ };
702
+ const updateFallbackSlotVisibility = (elm) => {
703
+ // tslint:disable-next-line: prefer-const
704
+ let childNodes = elm.childNodes;
705
+ let childNode;
706
+ let i;
707
+ let ilen;
708
+ let j;
709
+ let slotNameAttr;
710
+ let nodeType;
711
+ for (i = 0, ilen = childNodes.length; i < ilen; i++) {
712
+ childNode = childNodes[i];
713
+ if (childNode.nodeType === 1 /* ElementNode */) {
714
+ if (childNode['s-sr']) {
715
+ // this is a slot fallback node
716
+ // get the slot name for this slot reference node
717
+ slotNameAttr = childNode['s-sn'];
718
+ // by default always show a fallback slot node
719
+ // then hide it if there are other slots in the light dom
720
+ childNode.hidden = false;
721
+ for (j = 0; j < ilen; j++) {
722
+ nodeType = childNodes[j].nodeType;
723
+ if (childNodes[j]['s-hn'] !== childNode['s-hn'] || slotNameAttr !== '') {
724
+ // this sibling node is from a different component OR is a named fallback slot node
725
+ if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
726
+ childNode.hidden = true;
727
+ break;
728
+ }
729
+ }
730
+ else {
731
+ // this is a default fallback slot node
732
+ // any element or text node (with content)
733
+ // should hide the default fallback slot node
734
+ if (nodeType === 1 /* ElementNode */ ||
735
+ (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
736
+ childNode.hidden = true;
737
+ break;
738
+ }
739
+ }
740
+ }
741
+ }
742
+ // keep drilling down
743
+ updateFallbackSlotVisibility(childNode);
744
+ }
745
+ }
746
+ };
747
+ const relocateNodes = [];
748
+ const relocateSlotContent = (elm) => {
749
+ // tslint:disable-next-line: prefer-const
750
+ let childNode;
751
+ let node;
752
+ let hostContentNodes;
753
+ let slotNameAttr;
754
+ let relocateNodeData;
755
+ let j;
756
+ let i = 0;
757
+ let childNodes = elm.childNodes;
758
+ let ilen = childNodes.length;
759
+ for (; i < ilen; i++) {
760
+ childNode = childNodes[i];
761
+ if (childNode['s-sr'] && (node = childNode['s-cr']) && node.parentNode) {
762
+ // first got the content reference comment node
763
+ // then we got it's parent, which is where all the host content is in now
764
+ hostContentNodes = node.parentNode.childNodes;
765
+ slotNameAttr = childNode['s-sn'];
766
+ for (j = hostContentNodes.length - 1; j >= 0; j--) {
767
+ node = hostContentNodes[j];
768
+ if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
769
+ // let's do some relocating to its new home
770
+ // but never relocate a content reference node
771
+ // that is suppose to always represent the original content location
772
+ if (isNodeLocatedInSlot(node, slotNameAttr)) {
773
+ // it's possible we've already decided to relocate this node
774
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
775
+ // made some changes to slots
776
+ // let's make sure we also double check
777
+ // fallbacks are correctly hidden or shown
778
+ checkSlotFallbackVisibility = true;
779
+ node['s-sn'] = node['s-sn'] || slotNameAttr;
780
+ if (relocateNodeData) {
781
+ // previously we never found a slot home for this node
782
+ // but turns out we did, so let's remember it now
783
+ relocateNodeData.$slotRefNode$ = childNode;
784
+ }
785
+ else {
786
+ // add to our list of nodes to relocate
787
+ relocateNodes.push({
788
+ $slotRefNode$: childNode,
789
+ $nodeToRelocate$: node,
790
+ });
791
+ }
792
+ if (node['s-sr']) {
793
+ relocateNodes.map((relocateNode) => {
794
+ if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
795
+ relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
796
+ if (relocateNodeData && !relocateNode.$slotRefNode$) {
797
+ relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
798
+ }
799
+ }
800
+ });
801
+ }
802
+ }
803
+ else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
804
+ // so far this element does not have a slot home, not setting slotRefNode on purpose
805
+ // if we never find a home for this element then we'll need to hide it
806
+ relocateNodes.push({
807
+ $nodeToRelocate$: node,
808
+ });
809
+ }
810
+ }
811
+ }
812
+ }
813
+ if (childNode.nodeType === 1 /* ElementNode */) {
814
+ relocateSlotContent(childNode);
815
+ }
816
+ }
817
+ };
818
+ const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
819
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
820
+ if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
821
+ return true;
822
+ }
823
+ if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
824
+ return true;
825
+ }
826
+ return false;
827
+ }
828
+ if (nodeToRelocate['s-sn'] === slotNameAttr) {
829
+ return true;
830
+ }
831
+ return slotNameAttr === '';
832
+ };
833
+ const renderVdom = (hostRef, renderFnResults) => {
834
+ const hostElm = hostRef.$hostElement$;
835
+ const cmpMeta = hostRef.$cmpMeta$;
836
+ const oldVNode = hostRef.$vnode$ || newVNode(null, null);
837
+ const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
838
+ hostTagName = hostElm.tagName;
839
+ if (cmpMeta.$attrsToReflect$) {
840
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
841
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
842
+ }
843
+ rootVnode.$tag$ = null;
844
+ rootVnode.$flags$ |= 4 /* isHost */;
845
+ hostRef.$vnode$ = rootVnode;
846
+ rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm );
847
+ {
848
+ scopeId = hostElm['s-sc'];
849
+ }
850
+ {
851
+ contentRef = hostElm['s-cr'];
852
+ useNativeShadowDom = (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
853
+ // always reset
854
+ checkSlotFallbackVisibility = false;
855
+ }
856
+ // synchronous patch
857
+ patch(oldVNode, rootVnode);
858
+ {
859
+ // while we're moving nodes around existing nodes, temporarily disable
860
+ // the disconnectCallback from working
861
+ plt.$flags$ |= 1 /* isTmpDisconnected */;
862
+ if (checkSlotRelocate) {
863
+ relocateSlotContent(rootVnode.$elm$);
864
+ let relocateData;
865
+ let nodeToRelocate;
866
+ let orgLocationNode;
867
+ let parentNodeRef;
868
+ let insertBeforeNode;
869
+ let refNode;
870
+ let i = 0;
871
+ for (; i < relocateNodes.length; i++) {
872
+ relocateData = relocateNodes[i];
873
+ nodeToRelocate = relocateData.$nodeToRelocate$;
874
+ if (!nodeToRelocate['s-ol']) {
875
+ // add a reference node marking this node's original location
876
+ // keep a reference to this node for later lookups
877
+ orgLocationNode =
878
+ doc.createTextNode('');
879
+ orgLocationNode['s-nr'] = nodeToRelocate;
880
+ nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
881
+ }
882
+ }
883
+ for (i = 0; i < relocateNodes.length; i++) {
884
+ relocateData = relocateNodes[i];
885
+ nodeToRelocate = relocateData.$nodeToRelocate$;
886
+ if (relocateData.$slotRefNode$) {
887
+ // by default we're just going to insert it directly
888
+ // after the slot reference node
889
+ parentNodeRef = relocateData.$slotRefNode$.parentNode;
890
+ insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
891
+ orgLocationNode = nodeToRelocate['s-ol'];
892
+ while ((orgLocationNode = orgLocationNode.previousSibling)) {
893
+ refNode = orgLocationNode['s-nr'];
894
+ if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
895
+ refNode = refNode.nextSibling;
896
+ if (!refNode || !refNode['s-nr']) {
897
+ insertBeforeNode = refNode;
898
+ break;
899
+ }
900
+ }
901
+ }
902
+ if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) ||
903
+ nodeToRelocate.nextSibling !== insertBeforeNode) {
904
+ // we've checked that it's worth while to relocate
905
+ // since that the node to relocate
906
+ // has a different next sibling or parent relocated
907
+ if (nodeToRelocate !== insertBeforeNode) {
908
+ if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
909
+ // probably a component in the index.html that doesn't have it's hostname set
910
+ nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
911
+ }
912
+ // add it back to the dom but in its new home
913
+ parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
914
+ }
915
+ }
916
+ }
917
+ else {
918
+ // this node doesn't have a slot home to go to, so let's hide it
919
+ if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
920
+ nodeToRelocate.hidden = true;
921
+ }
922
+ }
923
+ }
924
+ }
925
+ if (checkSlotFallbackVisibility) {
926
+ updateFallbackSlotVisibility(rootVnode.$elm$);
927
+ }
928
+ // done moving nodes around
929
+ // allow the disconnect callback to work again
930
+ plt.$flags$ &= ~1 /* isTmpDisconnected */;
931
+ // always reset
932
+ relocateNodes.length = 0;
933
+ }
934
+ };
935
+ const getElement = (ref) => (getHostRef(ref).$hostElement$ );
936
+ const createEvent = (ref, name, flags) => {
937
+ const elm = getElement(ref);
938
+ return {
939
+ emit: (detail) => {
940
+ return emitEvent(elm, name, {
941
+ bubbles: !!(flags & 4 /* Bubbles */),
942
+ composed: !!(flags & 2 /* Composed */),
943
+ cancelable: !!(flags & 1 /* Cancellable */),
944
+ detail,
945
+ });
946
+ },
947
+ };
948
+ };
949
+ /**
950
+ * Helper function to create & dispatch a custom Event on a provided target
951
+ * @param elm the target of the Event
952
+ * @param name the name to give the custom Event
953
+ * @param opts options for configuring a custom Event
954
+ * @returns the custom Event
955
+ */
956
+ const emitEvent = (elm, name, opts) => {
957
+ const ev = plt.ce(name, opts);
958
+ elm.dispatchEvent(ev);
959
+ return ev;
960
+ };
961
+ const attachToAncestor = (hostRef, ancestorComponent) => {
962
+ if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
963
+ ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r)));
964
+ }
965
+ };
966
+ const scheduleUpdate = (hostRef, isInitialLoad) => {
967
+ {
968
+ hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
969
+ }
970
+ if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
971
+ hostRef.$flags$ |= 512 /* needsRerender */;
972
+ return;
973
+ }
974
+ attachToAncestor(hostRef, hostRef.$ancestorComponent$);
975
+ // there is no ancestor component or the ancestor component
976
+ // has already fired off its lifecycle update then
977
+ // fire off the initial update
978
+ const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
979
+ return writeTask(dispatch) ;
980
+ };
981
+ const dispatchHooks = (hostRef, isInitialLoad) => {
982
+ const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
983
+ const instance = hostRef.$lazyInstance$ ;
984
+ let promise;
985
+ if (isInitialLoad) {
986
+ {
987
+ hostRef.$flags$ |= 256 /* isListenReady */;
988
+ if (hostRef.$queuedListeners$) {
989
+ hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
990
+ hostRef.$queuedListeners$ = null;
991
+ }
992
+ }
993
+ {
994
+ promise = safeCall(instance, 'componentWillLoad');
995
+ }
996
+ }
997
+ {
998
+ promise = then(promise, () => safeCall(instance, 'componentWillRender'));
999
+ }
1000
+ endSchedule();
1001
+ return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1002
+ };
1003
+ const updateComponent = async (hostRef, instance, isInitialLoad) => {
1004
+ // updateComponent
1005
+ const elm = hostRef.$hostElement$;
1006
+ const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1007
+ const rc = elm['s-rc'];
1008
+ if (isInitialLoad) {
1009
+ // DOM WRITE!
1010
+ attachStyles(hostRef);
1011
+ }
1012
+ const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1013
+ {
1014
+ callRender(hostRef, instance);
1015
+ }
1016
+ if (rc) {
1017
+ // ok, so turns out there are some child host elements
1018
+ // waiting on this parent element to load
1019
+ // let's fire off all update callbacks waiting
1020
+ rc.map((cb) => cb());
1021
+ elm['s-rc'] = undefined;
1022
+ }
1023
+ endRender();
1024
+ endUpdate();
1025
+ {
1026
+ const childrenPromises = elm['s-p'];
1027
+ const postUpdate = () => postUpdateComponent(hostRef);
1028
+ if (childrenPromises.length === 0) {
1029
+ postUpdate();
1030
+ }
1031
+ else {
1032
+ Promise.all(childrenPromises).then(postUpdate);
1033
+ hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1034
+ childrenPromises.length = 0;
1035
+ }
1036
+ }
1037
+ };
1038
+ const callRender = (hostRef, instance, elm) => {
1039
+ try {
1040
+ instance = instance.render && instance.render();
1041
+ {
1042
+ hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1043
+ }
1044
+ {
1045
+ hostRef.$flags$ |= 2 /* hasRendered */;
1046
+ }
1047
+ {
1048
+ {
1049
+ // looks like we've got child nodes to render into this host element
1050
+ // or we need to update the css class/attrs on the host element
1051
+ // DOM WRITE!
1052
+ {
1053
+ renderVdom(hostRef, instance);
1054
+ }
1055
+ }
1056
+ }
1057
+ }
1058
+ catch (e) {
1059
+ consoleError(e, hostRef.$hostElement$);
1060
+ }
1061
+ return null;
1062
+ };
1063
+ const postUpdateComponent = (hostRef) => {
1064
+ const tagName = hostRef.$cmpMeta$.$tagName$;
1065
+ const elm = hostRef.$hostElement$;
1066
+ const endPostUpdate = createTime('postUpdate', tagName);
1067
+ const instance = hostRef.$lazyInstance$ ;
1068
+ const ancestorComponent = hostRef.$ancestorComponent$;
1069
+ {
1070
+ safeCall(instance, 'componentDidRender');
1071
+ }
1072
+ if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1073
+ hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1074
+ {
1075
+ // DOM WRITE!
1076
+ addHydratedFlag(elm);
1077
+ }
1078
+ endPostUpdate();
1079
+ {
1080
+ hostRef.$onReadyResolve$(elm);
1081
+ if (!ancestorComponent) {
1082
+ appDidLoad();
1083
+ }
1084
+ }
1085
+ }
1086
+ else {
1087
+ endPostUpdate();
1088
+ }
1089
+ // load events fire from bottom to top
1090
+ // the deepest elements load first then bubbles up
1091
+ {
1092
+ if (hostRef.$onRenderResolve$) {
1093
+ hostRef.$onRenderResolve$();
1094
+ hostRef.$onRenderResolve$ = undefined;
1095
+ }
1096
+ if (hostRef.$flags$ & 512 /* needsRerender */) {
1097
+ nextTick(() => scheduleUpdate(hostRef, false));
1098
+ }
1099
+ hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1100
+ }
1101
+ // ( •_•)
1102
+ // ( •_•)>⌐■-■
1103
+ // (⌐■_■)
1104
+ };
1105
+ const appDidLoad = (who) => {
1106
+ // on appload
1107
+ // we have finish the first big initial render
1108
+ {
1109
+ addHydratedFlag(doc.documentElement);
1110
+ }
1111
+ nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1112
+ };
1113
+ const safeCall = (instance, method, arg) => {
1114
+ if (instance && instance[method]) {
1115
+ try {
1116
+ return instance[method](arg);
1117
+ }
1118
+ catch (e) {
1119
+ consoleError(e);
1120
+ }
1121
+ }
1122
+ return undefined;
1123
+ };
1124
+ const then = (promise, thenFn) => {
1125
+ return promise && promise.then ? promise.then(thenFn) : thenFn();
1126
+ };
1127
+ const addHydratedFlag = (elm) => elm.classList.add('hydrated')
1128
+ ;
1129
+ /**
1130
+ * Parse a new property value for a given property type.
1131
+ *
1132
+ * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned,
1133
+ * it is not safe to assume that the string returned by evaluating `typeof propValue` matches:
1134
+ * 1. `any`, the type given to `propValue` in the function signature
1135
+ * 2. the type stored from `propType`.
1136
+ *
1137
+ * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type.
1138
+ *
1139
+ * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to
1140
+ * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is
1141
+ * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`.
1142
+ * ```tsx
1143
+ * <my-cmp prop-val={0}></my-cmp>
1144
+ * ```
1145
+ *
1146
+ * HTML prop values on the other hand, will always a string
1147
+ *
1148
+ * @param propValue the new value to coerce to some type
1149
+ * @param propType the type of the prop, expressed as a binary number
1150
+ * @returns the parsed/coerced value
1151
+ */
1152
+ const parsePropertyValue = (propValue, propType) => {
1153
+ // ensure this value is of the correct prop type
1154
+ if (propValue != null && !isComplexType(propValue)) {
1155
+ if (propType & 1 /* String */) {
1156
+ // could have been passed as a number or boolean
1157
+ // but we still want it as a string
1158
+ return String(propValue);
1159
+ }
1160
+ // redundant return here for better minification
1161
+ return propValue;
1162
+ }
1163
+ // not sure exactly what type we want
1164
+ // so no need to change to a different type
1165
+ return propValue;
1166
+ };
1167
+ const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1168
+ const setValue = (ref, propName, newVal, cmpMeta) => {
1169
+ // check our new property value against our internal value
1170
+ const hostRef = getHostRef(ref);
1171
+ const oldVal = hostRef.$instanceValues$.get(propName);
1172
+ const flags = hostRef.$flags$;
1173
+ const instance = hostRef.$lazyInstance$ ;
1174
+ newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1175
+ // explicitly check for NaN on both sides, as `NaN === NaN` is always false
1176
+ const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
1177
+ const didValueChange = newVal !== oldVal && !areBothNaN;
1178
+ if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) {
1179
+ // gadzooks! the property's value has changed!!
1180
+ // set our new value!
1181
+ hostRef.$instanceValues$.set(propName, newVal);
1182
+ if (instance) {
1183
+ if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1184
+ // looks like this value actually changed, so we've got work to do!
1185
+ // but only if we've already rendered, otherwise just chill out
1186
+ // queue that we need to do an update, but don't worry about queuing
1187
+ // up millions cuz this function ensures it only runs once
1188
+ scheduleUpdate(hostRef, false);
1189
+ }
1190
+ }
1191
+ }
1192
+ };
1193
+ const proxyComponent = (Cstr, cmpMeta, flags) => {
1194
+ if (cmpMeta.$members$) {
1195
+ // It's better to have a const than two Object.entries()
1196
+ const members = Object.entries(cmpMeta.$members$);
1197
+ const prototype = Cstr.prototype;
1198
+ members.map(([memberName, [memberFlags]]) => {
1199
+ if ((memberFlags & 31 /* Prop */ ||
1200
+ ((flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1201
+ // proxyComponent - prop
1202
+ Object.defineProperty(prototype, memberName, {
1203
+ get() {
1204
+ // proxyComponent, get value
1205
+ return getValue(this, memberName);
1206
+ },
1207
+ set(newValue) {
1208
+ // proxyComponent, set value
1209
+ setValue(this, memberName, newValue, cmpMeta);
1210
+ },
1211
+ configurable: true,
1212
+ enumerable: true,
1213
+ });
1214
+ }
1215
+ });
1216
+ if ((flags & 1 /* isElementConstructor */)) {
1217
+ const attrNameToPropName = new Map();
1218
+ prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1219
+ plt.jmp(() => {
1220
+ const propName = attrNameToPropName.get(attrName);
1221
+ // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback
1222
+ // in the case where an attribute was set inline.
1223
+ // ```html
1224
+ // <my-component some-attribute="some-value"></my-component>
1225
+ // ```
1226
+ //
1227
+ // There is an edge case where a developer sets the attribute inline on a custom element and then
1228
+ // programmatically changes it before it has been upgraded as shown below:
1229
+ //
1230
+ // ```html
1231
+ // <!-- this component has _not_ been upgraded yet -->
1232
+ // <my-component id="test" some-attribute="some-value"></my-component>
1233
+ // <script>
1234
+ // // grab non-upgraded component
1235
+ // el = document.querySelector("#test");
1236
+ // el.someAttribute = "another-value";
1237
+ // // upgrade component
1238
+ // customElements.define('my-component', MyComponent);
1239
+ // </script>
1240
+ // ```
1241
+ // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback
1242
+ // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value")
1243
+ // to the value that was set inline i.e. "some-value" from above example. When
1244
+ // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value"
1245
+ //
1246
+ // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed
1247
+ // by connectedCallback as this attributeChangedCallback will not fire.
1248
+ //
1249
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1250
+ //
1251
+ // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to
1252
+ // properties here given that this goes against best practices outlined here
1253
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy
1254
+ if (this.hasOwnProperty(propName)) {
1255
+ newValue = this[propName];
1256
+ delete this[propName];
1257
+ }
1258
+ else if (prototype.hasOwnProperty(propName) &&
1259
+ typeof this[propName] === 'number' &&
1260
+ this[propName] == newValue) {
1261
+ // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native
1262
+ // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in
1263
+ // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props.
1264
+ return;
1265
+ }
1266
+ this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1267
+ });
1268
+ };
1269
+ // create an array of attributes to observe
1270
+ // and also create a map of html attribute name to js property name
1271
+ Cstr.observedAttributes = members
1272
+ .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1273
+ .map(([propName, m]) => {
1274
+ const attrName = m[1] || propName;
1275
+ attrNameToPropName.set(attrName, propName);
1276
+ if (m[0] & 512 /* ReflectAttr */) {
1277
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
1278
+ }
1279
+ return attrName;
1280
+ });
1281
+ }
1282
+ }
1283
+ return Cstr;
1284
+ };
1285
+ const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1286
+ // initializeComponent
1287
+ if ((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1288
+ {
1289
+ // we haven't initialized this element yet
1290
+ hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1291
+ // lazy loaded components
1292
+ // request the component's implementation to be
1293
+ // wired up with the host element
1294
+ Cstr = loadModule(cmpMeta);
1295
+ if (Cstr.then) {
1296
+ // Await creates a micro-task avoid if possible
1297
+ const endLoad = uniqueTime();
1298
+ Cstr = await Cstr;
1299
+ endLoad();
1300
+ }
1301
+ if (!Cstr.isProxied) {
1302
+ proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1303
+ Cstr.isProxied = true;
1304
+ }
1305
+ const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1306
+ // ok, time to construct the instance
1307
+ // but let's keep track of when we start and stop
1308
+ // so that the getters/setters don't incorrectly step on data
1309
+ {
1310
+ hostRef.$flags$ |= 8 /* isConstructingInstance */;
1311
+ }
1312
+ // construct the lazy-loaded component implementation
1313
+ // passing the hostRef is very important during
1314
+ // construction in order to directly wire together the
1315
+ // host element and the lazy-loaded instance
1316
+ try {
1317
+ new Cstr(hostRef);
1318
+ }
1319
+ catch (e) {
1320
+ consoleError(e);
1321
+ }
1322
+ {
1323
+ hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1324
+ }
1325
+ endNewInstance();
1326
+ }
1327
+ if (Cstr.style) {
1328
+ // this component has styles but we haven't registered them yet
1329
+ let style = Cstr.style;
1330
+ const scopeId = getScopeId(cmpMeta);
1331
+ if (!styles.has(scopeId)) {
1332
+ const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1333
+ registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1334
+ endRegisterStyles();
1335
+ }
1336
+ }
1337
+ }
1338
+ // we've successfully created a lazy instance
1339
+ const ancestorComponent = hostRef.$ancestorComponent$;
1340
+ const schedule = () => scheduleUpdate(hostRef, true);
1341
+ if (ancestorComponent && ancestorComponent['s-rc']) {
1342
+ // this is the initial load and this component it has an ancestor component
1343
+ // but the ancestor component has NOT fired its will update lifecycle yet
1344
+ // so let's just cool our jets and wait for the ancestor to continue first
1345
+ // this will get fired off when the ancestor component
1346
+ // finally gets around to rendering its lazy self
1347
+ // fire off the initial update
1348
+ ancestorComponent['s-rc'].push(schedule);
1349
+ }
1350
+ else {
1351
+ schedule();
1352
+ }
1353
+ };
1354
+ const connectedCallback = (elm) => {
1355
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1356
+ const hostRef = getHostRef(elm);
1357
+ const cmpMeta = hostRef.$cmpMeta$;
1358
+ const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
1359
+ if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
1360
+ // first time this component has connected
1361
+ hostRef.$flags$ |= 1 /* hasConnected */;
1362
+ {
1363
+ // initUpdate
1364
+ // if the slot polyfill is required we'll need to put some nodes
1365
+ // in here to act as original content anchors as we move nodes around
1366
+ // host element has been connected to the DOM
1367
+ if ((cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
1368
+ setContentReference(elm);
1369
+ }
1370
+ }
1371
+ {
1372
+ // find the first ancestor component (if there is one) and register
1373
+ // this component as one of the actively loading child components for its ancestor
1374
+ let ancestorComponent = elm;
1375
+ while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
1376
+ // climb up the ancestors looking for the first
1377
+ // component that hasn't finished its lifecycle update yet
1378
+ if (ancestorComponent['s-p']) {
1379
+ // we found this components first ancestor component
1380
+ // keep a reference to this component's ancestor component
1381
+ attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
1382
+ break;
1383
+ }
1384
+ }
1385
+ }
1386
+ // Lazy properties
1387
+ // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
1388
+ if (cmpMeta.$members$) {
1389
+ Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
1390
+ if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
1391
+ const value = elm[memberName];
1392
+ delete elm[memberName];
1393
+ elm[memberName] = value;
1394
+ }
1395
+ });
1396
+ }
1397
+ {
1398
+ initializeComponent(elm, hostRef, cmpMeta);
1399
+ }
1400
+ }
1401
+ else {
1402
+ // not the first time this has connected
1403
+ // reattach any event listeners to the host
1404
+ // since they would have been removed when disconnected
1405
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1406
+ }
1407
+ endConnected();
1408
+ }
1409
+ };
1410
+ const setContentReference = (elm) => {
1411
+ // only required when we're NOT using native shadow dom (slot)
1412
+ // or this browser doesn't support native shadow dom
1413
+ // and this host element was NOT created with SSR
1414
+ // let's pick out the inner content for slot projection
1415
+ // create a node to represent where the original
1416
+ // content was first placed, which is useful later on
1417
+ const contentRefElm = (elm['s-cr'] = doc.createComment(''));
1418
+ contentRefElm['s-cn'] = true;
1419
+ elm.insertBefore(contentRefElm, elm.firstChild);
1420
+ };
1421
+ const disconnectedCallback = (elm) => {
1422
+ if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
1423
+ const hostRef = getHostRef(elm);
1424
+ {
1425
+ if (hostRef.$rmListeners$) {
1426
+ hostRef.$rmListeners$.map((rmListener) => rmListener());
1427
+ hostRef.$rmListeners$ = undefined;
1428
+ }
1429
+ }
1430
+ }
1431
+ };
1432
+ const bootstrapLazy = (lazyBundles, options = {}) => {
1433
+ const endBootstrap = createTime();
1434
+ const cmpTags = [];
1435
+ const exclude = options.exclude || [];
1436
+ const customElements = win.customElements;
1437
+ const head = doc.head;
1438
+ const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
1439
+ const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
1440
+ const deferredConnectedCallbacks = [];
1441
+ let appLoadFallback;
1442
+ let isBootstrapping = true;
1443
+ Object.assign(plt, options);
1444
+ plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
1445
+ lazyBundles.map((lazyBundle) => {
1446
+ lazyBundle[1].map((compactMeta) => {
1447
+ const cmpMeta = {
1448
+ $flags$: compactMeta[0],
1449
+ $tagName$: compactMeta[1],
1450
+ $members$: compactMeta[2],
1451
+ $listeners$: compactMeta[3],
1452
+ };
1453
+ {
1454
+ cmpMeta.$members$ = compactMeta[2];
1455
+ }
1456
+ {
1457
+ cmpMeta.$listeners$ = compactMeta[3];
1458
+ }
1459
+ {
1460
+ cmpMeta.$attrsToReflect$ = [];
1461
+ }
1462
+ const tagName = cmpMeta.$tagName$;
1463
+ const HostElement = class extends HTMLElement {
1464
+ // StencilLazyHost
1465
+ constructor(self) {
1466
+ // @ts-ignore
1467
+ super(self);
1468
+ self = this;
1469
+ registerHost(self, cmpMeta);
1470
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
1471
+ // this component is using shadow dom
1472
+ // and this browser supports shadow dom
1473
+ // add the read-only property "shadowRoot" to the host element
1474
+ // adding the shadow root build conditionals to minimize runtime
1475
+ {
1476
+ {
1477
+ self.attachShadow({ mode: 'open' });
1478
+ }
1479
+ }
1480
+ }
1481
+ }
1482
+ connectedCallback() {
1483
+ if (appLoadFallback) {
1484
+ clearTimeout(appLoadFallback);
1485
+ appLoadFallback = null;
1486
+ }
1487
+ if (isBootstrapping) {
1488
+ // connectedCallback will be processed once all components have been registered
1489
+ deferredConnectedCallbacks.push(this);
1490
+ }
1491
+ else {
1492
+ plt.jmp(() => connectedCallback(this));
1493
+ }
1494
+ }
1495
+ disconnectedCallback() {
1496
+ plt.jmp(() => disconnectedCallback(this));
1497
+ }
1498
+ componentOnReady() {
1499
+ return getHostRef(this).$onReadyPromise$;
1500
+ }
1501
+ };
1502
+ cmpMeta.$lazyBundleId$ = lazyBundle[0];
1503
+ if (!exclude.includes(tagName) && !customElements.get(tagName)) {
1504
+ cmpTags.push(tagName);
1505
+ customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
1506
+ }
1507
+ });
1508
+ });
1509
+ {
1510
+ visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
1511
+ visibilityStyle.setAttribute('data-styles', '');
1512
+ head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
1513
+ }
1514
+ // Process deferred connectedCallbacks now all components have been registered
1515
+ isBootstrapping = false;
1516
+ if (deferredConnectedCallbacks.length) {
1517
+ deferredConnectedCallbacks.map((host) => host.connectedCallback());
1518
+ }
1519
+ else {
1520
+ {
1521
+ plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
1522
+ }
1523
+ }
1524
+ // Fallback appLoad event
1525
+ endBootstrap();
1526
+ };
1527
+ const getAssetPath = (path) => {
1528
+ const assetUrl = new URL(path, plt.$resourcesUrl$);
1529
+ return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
1530
+ };
1531
+ const Fragment = (_, children) => children;
1532
+ const hostRefs = new WeakMap();
1533
+ const getHostRef = (ref) => hostRefs.get(ref);
1534
+ const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
1535
+ const registerHost = (elm, cmpMeta) => {
1536
+ const hostRef = {
1537
+ $flags$: 0,
1538
+ $hostElement$: elm,
1539
+ $cmpMeta$: cmpMeta,
1540
+ $instanceValues$: new Map(),
1541
+ };
1542
+ {
1543
+ hostRef.$onReadyPromise$ = new Promise((r) => (hostRef.$onReadyResolve$ = r));
1544
+ elm['s-p'] = [];
1545
+ elm['s-rc'] = [];
1546
+ }
1547
+ addHostEventListeners(elm, hostRef, cmpMeta.$listeners$);
1548
+ return hostRefs.set(elm, hostRef);
1549
+ };
1550
+ const isMemberInElement = (elm, memberName) => memberName in elm;
1551
+ const consoleError = (e, el) => (0, console.error)(e, el);
1552
+ const cmpModules = /*@__PURE__*/ new Map();
1553
+ const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
1554
+ // loadModuleImport
1555
+ const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
1556
+ const bundleId = cmpMeta.$lazyBundleId$;
1557
+ const module = cmpModules.get(bundleId) ;
1558
+ if (module) {
1559
+ return module[exportName];
1560
+ }
1561
+ return import(
1562
+ /* webpackInclude: /\.entry\.js$/ */
1563
+ /* webpackExclude: /\.system\.entry\.js$/ */
1564
+ /* webpackMode: "lazy" */
1565
+ `./${bundleId}.entry.js${''}`).then((importedModule) => {
1566
+ {
1567
+ cmpModules.set(bundleId, importedModule);
1568
+ }
1569
+ return importedModule[exportName];
1570
+ }, consoleError);
1571
+ };
1572
+ const styles = new Map();
1573
+ const queueDomReads = [];
1574
+ const queueDomWrites = [];
1575
+ const queueTask = (queue, write) => (cb) => {
1576
+ queue.push(cb);
1577
+ if (!queuePending) {
1578
+ queuePending = true;
1579
+ if (write && plt.$flags$ & 4 /* queueSync */) {
1580
+ nextTick(flush);
1581
+ }
1582
+ else {
1583
+ plt.raf(flush);
1584
+ }
1585
+ }
1586
+ };
1587
+ const consume = (queue) => {
1588
+ for (let i = 0; i < queue.length; i++) {
1589
+ try {
1590
+ queue[i](performance.now());
1591
+ }
1592
+ catch (e) {
1593
+ consoleError(e);
1594
+ }
1595
+ }
1596
+ queue.length = 0;
1597
+ };
1598
+ const flush = () => {
1599
+ // always force a bunch of medium callbacks to run, but still have
1600
+ // a throttle on how many can run in a certain time
1601
+ // DOM READS!!!
1602
+ consume(queueDomReads);
1603
+ // DOM WRITES!!!
1604
+ {
1605
+ consume(queueDomWrites);
1606
+ if ((queuePending = queueDomReads.length > 0)) {
1607
+ // still more to do yet, but we've run out of time
1608
+ // let's let this thing cool off and try again in the next tick
1609
+ plt.raf(flush);
1610
+ }
1611
+ }
1612
+ };
1613
+ const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
1614
+ const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
1615
+
1616
+ export { Fragment as F, getAssetPath as a, bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r };