UNPKG

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