UNPKG

121 kBJavaScriptView Raw
1const NAMESPACE = 'bulmil';
2const BUILD = /* bulmil */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: false, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, cssVarShim: true, devTools: false, disconnectedCallback: false, dynamicImportShim: true, element: false, event: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, initializeNextTick: true, isDebug: false, isDev: true, isTesting: true, lazyLoad: true, lifecycle: false, lifecycleDOMEvents: true, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, safari10: true, scoped: false, scriptDataOpts: true, shadowDelegatesFocus: false, shadowDom: false, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: false, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: false, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: false, vdomText: true, vdomXlink: false, watchCallback: false };
3
4let scopeId;
5let contentRef;
6let hostTagName;
7let i = 0;
8let useNativeShadowDom = false;
9let checkSlotFallbackVisibility = false;
10let checkSlotRelocate = false;
11let isSvgMode = false;
12let renderingRef = null;
13let queueCongestion = 0;
14let queuePending = false;
15const win = typeof window !== 'undefined' ? window : {};
16const CSS = BUILD.cssVarShim ? win.CSS : null;
17const doc = win.document || { head: {} };
18const H = (win.HTMLElement || class {
19});
20const plt = {
21 $flags$: 0,
22 $resourcesUrl$: '',
23 jmp: h => h(),
24 raf: h => requestAnimationFrame(h),
25 ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
26 rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
27};
28const supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom ? /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() : true;
29const supportsListenerOptions = /*@__PURE__*/ (() => {
30 let supportsListenerOptions = false;
31 try {
32 doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
33 get() {
34 supportsListenerOptions = true;
35 },
36 }));
37 }
38 catch (e) { }
39 return supportsListenerOptions;
40})();
41const promiseResolve = (v) => Promise.resolve(v);
42const supportsConstructibleStylesheets = BUILD.constructableCSS
43 ? /*@__PURE__*/ (() => {
44 try {
45 new CSSStyleSheet();
46 return true;
47 }
48 catch (e) { }
49 return false;
50 })()
51 : false;
52const Context = {};
53const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
54 if (BUILD.hostListener && listeners) {
55 // this is called immediately within the element's constructor
56 // initialize our event listeners on the host element
57 // we do this now so that we can listen to events that may
58 // have fired even before the instance is ready
59 if (BUILD.hostListenerTargetParent) {
60 // this component may have event listeners that should be attached to the parent
61 if (attachParentListeners) {
62 // this is being ran from within the connectedCallback
63 // which is important so that we know the host element actually has a parent element
64 // filter out the listeners to only have the ones that ARE being attached to the parent
65 listeners = listeners.filter(([flags]) => flags & 16 /* TargetParent */);
66 }
67 else {
68 // this is being ran from within the component constructor
69 // everything BUT the parent element listeners should be attached at this time
70 // filter out the listeners that are NOT being attached to the parent
71 listeners = listeners.filter(([flags]) => !(flags & 16 /* TargetParent */));
72 }
73 }
74 listeners.map(([flags, name, method]) => {
75 const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
76 const handler = hostListenerProxy(hostRef, method);
77 const opts = hostListenerOpts(flags);
78 plt.ael(target, name, handler, opts);
79 (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
80 });
81 }
82};
83const hostListenerProxy = (hostRef, methodName) => (ev) => {
84 if (BUILD.lazyLoad) {
85 if (hostRef.$flags$ & 256 /* isListenReady */) {
86 // instance is ready, let's call it's member method for this event
87 hostRef.$lazyInstance$[methodName](ev);
88 }
89 else {
90 (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
91 }
92 }
93 else {
94 hostRef.$hostElement$[methodName](ev);
95 }
96};
97const getHostListenerTarget = (elm, flags) => {
98 if (BUILD.hostListenerTargetDocument && flags & 4 /* TargetDocument */)
99 return doc;
100 if (BUILD.hostListenerTargetWindow && flags & 8 /* TargetWindow */)
101 return win;
102 if (BUILD.hostListenerTargetBody && flags & 32 /* TargetBody */)
103 return doc.body;
104 if (BUILD.hostListenerTargetParent && flags & 16 /* TargetParent */)
105 return elm.parentElement;
106 return elm;
107};
108// prettier-ignore
109const hostListenerOpts = (flags) => supportsListenerOptions
110 ? ({
111 passive: (flags & 1 /* Passive */) !== 0,
112 capture: (flags & 2 /* Capture */) !== 0,
113 })
114 : (flags & 2 /* Capture */) !== 0;
115const CONTENT_REF_ID = 'r';
116const ORG_LOCATION_ID = 'o';
117const SLOT_NODE_ID = 's';
118const TEXT_NODE_ID = 't';
119const HYDRATE_ID = 's-id';
120const HYDRATED_STYLE_ID = 'sty-id';
121const HYDRATE_CHILD_ID = 'c-id';
122const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}';
123const XLINK_NS = 'http://www.w3.org/1999/xlink';
124const createTime = (fnName, tagName = '') => {
125 if (BUILD.profile && performance.mark) {
126 const key = `st:${fnName}:${tagName}:${i++}`;
127 // Start
128 performance.mark(key);
129 // End
130 return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
131 }
132 else {
133 return () => {
134 return;
135 };
136 }
137};
138const uniqueTime = (key, measureText) => {
139 if (BUILD.profile && performance.mark) {
140 if (performance.getEntriesByName(key).length === 0) {
141 performance.mark(key);
142 }
143 return () => {
144 if (performance.getEntriesByName(measureText).length === 0) {
145 performance.measure(measureText, key);
146 }
147 };
148 }
149 else {
150 return () => {
151 return;
152 };
153 }
154};
155const inspect = (ref) => {
156 const hostRef = getHostRef(ref);
157 if (!hostRef) {
158 return undefined;
159 }
160 const flags = hostRef.$flags$;
161 const hostElement = hostRef.$hostElement$;
162 return {
163 renderCount: hostRef.$renderCount$,
164 flags: {
165 hasRendered: !!(flags & 2 /* hasRendered */),
166 hasConnected: !!(flags & 1 /* hasConnected */),
167 isWaitingForChildren: !!(flags & 4 /* isWaitingForChildren */),
168 isConstructingInstance: !!(flags & 8 /* isConstructingInstance */),
169 isQueuedForUpdate: !!(flags & 16 /* isQueuedForUpdate */),
170 hasInitializedComponent: !!(flags & 32 /* hasInitializedComponent */),
171 hasLoadedComponent: !!(flags & 64 /* hasLoadedComponent */),
172 isWatchReady: !!(flags & 128 /* isWatchReady */),
173 isListenReady: !!(flags & 256 /* isListenReady */),
174 needsRerender: !!(flags & 512 /* needsRerender */),
175 },
176 instanceValues: hostRef.$instanceValues$,
177 ancestorComponent: hostRef.$ancestorComponent$,
178 hostElement,
179 lazyInstance: hostRef.$lazyInstance$,
180 vnode: hostRef.$vnode$,
181 modeName: hostRef.$modeName$,
182 onReadyPromise: hostRef.$onReadyPromise$,
183 onReadyResolve: hostRef.$onReadyResolve$,
184 onInstancePromise: hostRef.$onInstancePromise$,
185 onInstanceResolve: hostRef.$onInstanceResolve$,
186 onRenderResolve: hostRef.$onRenderResolve$,
187 queuedListeners: hostRef.$queuedListeners$,
188 rmListeners: hostRef.$rmListeners$,
189 ['s-id']: hostElement['s-id'],
190 ['s-cr']: hostElement['s-cr'],
191 ['s-lr']: hostElement['s-lr'],
192 ['s-p']: hostElement['s-p'],
193 ['s-rc']: hostElement['s-rc'],
194 ['s-sc']: hostElement['s-sc'],
195 };
196};
197const installDevTools = () => {
198 if (BUILD.devTools) {
199 const stencil = (win.stencil = win.stencil || {});
200 const originalInspect = stencil.inspect;
201 stencil.inspect = (ref) => {
202 let result = inspect(ref);
203 if (!result && typeof originalInspect === 'function') {
204 result = originalInspect(ref);
205 }
206 return result;
207 };
208 }
209};
210const rootAppliedStyles = new WeakMap();
211const registerStyle = (scopeId, cssText, allowCS) => {
212 let style = styles.get(scopeId);
213 if (supportsConstructibleStylesheets && allowCS) {
214 style = (style || new CSSStyleSheet());
215 style.replace(cssText);
216 }
217 else {
218 style = cssText;
219 }
220 styles.set(scopeId, style);
221};
222const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
223 let scopeId = getScopeId(cmpMeta, mode);
224 let style = styles.get(scopeId);
225 if (!BUILD.attachStyles) {
226 return scopeId;
227 }
228 // if an element is NOT connected then getRootNode() will return the wrong root node
229 // so the fallback is to always use the document for the root node in those cases
230 styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc;
231 if (style) {
232 if (typeof style === 'string') {
233 styleContainerNode = styleContainerNode.head || styleContainerNode;
234 let appliedStyles = rootAppliedStyles.get(styleContainerNode);
235 let styleElm;
236 if (!appliedStyles) {
237 rootAppliedStyles.set(styleContainerNode, (appliedStyles = new Set()));
238 }
239 if (!appliedStyles.has(scopeId)) {
240 if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId}"]`))) {
241 // This is only happening on native shadow-dom, do not needs CSS var shim
242 styleElm.innerHTML = style;
243 }
244 else {
245 if (BUILD.cssVarShim && plt.$cssShim$) {
246 styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
247 const newScopeId = styleElm['s-sc'];
248 if (newScopeId) {
249 scopeId = newScopeId;
250 // we don't want to add this styleID to the appliedStyles Set
251 // since the cssVarShim might need to apply several different
252 // stylesheets for the same component
253 appliedStyles = null;
254 }
255 }
256 else {
257 styleElm = doc.createElement('style');
258 styleElm.innerHTML = style;
259 }
260 if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
261 styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId);
262 }
263 styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
264 }
265 if (appliedStyles) {
266 appliedStyles.add(scopeId);
267 }
268 }
269 }
270 else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
271 styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
272 }
273 }
274 return scopeId;
275};
276const attachStyles = (hostRef) => {
277 const cmpMeta = hostRef.$cmpMeta$;
278 const elm = hostRef.$hostElement$;
279 const flags = cmpMeta.$flags$;
280 const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
281 const scopeId = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
282 if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10 /* needsScopedEncapsulation */) {
283 // only required when we're NOT using native shadow dom (slot)
284 // or this browser doesn't support native shadow dom
285 // and this host element was NOT created with SSR
286 // let's pick out the inner content for slot projection
287 // create a node to represent where the original
288 // content was first placed, which is useful later on
289 // DOM WRITE!!
290 elm['s-sc'] = scopeId;
291 elm.classList.add(scopeId + '-h');
292 if (BUILD.scoped && flags & 2 /* scopedCssEncapsulation */) {
293 elm.classList.add(scopeId + '-s');
294 }
295 }
296 endAttachStyles();
297};
298const getScopeId = (cmp, mode) => 'sc-' + (BUILD.mode && mode && cmp.$flags$ & 32 /* hasMode */ ? cmp.$tagName$ + '-' + mode : cmp.$tagName$);
299const convertScopedToShadow = (css) => css.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g, '$1{');
300// Private
301const computeMode = (elm) => modeResolutionChain.map(h => h(elm)).find(m => !!m);
302// Public
303const setMode = (handler) => modeResolutionChain.push(handler);
304const getMode = (ref) => getHostRef(ref).$modeName$;
305/**
306 * Default style mode id
307 */
308/**
309 * Reusable empty obj/array
310 * Don't add values to these!!
311 */
312const EMPTY_OBJ = {};
313/**
314 * Namespaces
315 */
316const SVG_NS = 'http://www.w3.org/2000/svg';
317const HTML_NS = 'http://www.w3.org/1999/xhtml';
318const isDef = (v) => v != null;
319const noop = () => {
320 /* noop*/
321};
322const isComplexType = (o) => {
323 // https://jsperf.com/typeof-fn-object/5
324 o = typeof o;
325 return o === 'object' || o === 'function';
326};
327const IS_DENO_ENV = typeof Deno !== 'undefined';
328const IS_NODE_ENV = !IS_DENO_ENV &&
329 typeof global !== 'undefined' &&
330 typeof require === 'function' &&
331 !!global.process &&
332 typeof __filename === 'string' &&
333 (!global.origin || typeof global.origin !== 'string');
334const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows';
335const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/';
336const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop;
337/**
338 * Production h() function based on Preact by
339 * Jason Miller (@developit)
340 * Licensed under the MIT License
341 * https://github.com/developit/preact/blob/master/LICENSE
342 *
343 * Modified for Stencil's compiler and vdom
344 */
345// const stack: any[] = [];
346// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
347// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
348const h = (nodeName, vnodeData, ...children) => {
349 let child = null;
350 let key = null;
351 let slotName = null;
352 let simple = false;
353 let lastSimple = false;
354 let vNodeChildren = [];
355 const walk = (c) => {
356 for (let i = 0; i < c.length; i++) {
357 child = c[i];
358 if (Array.isArray(child)) {
359 walk(child);
360 }
361 else if (child != null && typeof child !== 'boolean') {
362 if ((simple = typeof nodeName !== 'function' && !isComplexType(child))) {
363 child = String(child);
364 }
365 else if (BUILD.isDev && typeof nodeName !== 'function' && child.$flags$ === undefined) {
366 consoleDevError(`vNode passed as children has unexpected type.
367Make sure it's using the correct h() function.
368Empty objects can also be the cause, look for JSX comments that became objects.`);
369 }
370 if (simple && lastSimple) {
371 // If the previous child was simple (string), we merge both
372 vNodeChildren[vNodeChildren.length - 1].$text$ += child;
373 }
374 else {
375 // Append a new vNode, if it's text, we create a text vNode
376 vNodeChildren.push(simple ? newVNode(null, child) : child);
377 }
378 lastSimple = simple;
379 }
380 }
381 };
382 walk(children);
383 if (vnodeData) {
384 if (BUILD.isDev && nodeName === 'input') {
385 validateInputProperties(vnodeData);
386 }
387 // normalize class / classname attributes
388 if (BUILD.vdomKey && vnodeData.key) {
389 key = vnodeData.key;
390 }
391 if (BUILD.slotRelocation && vnodeData.name) {
392 slotName = vnodeData.name;
393 }
394 if (BUILD.vdomClass) {
395 const classData = vnodeData.className || vnodeData.class;
396 if (classData) {
397 vnodeData.class =
398 typeof classData !== 'object'
399 ? classData
400 : Object.keys(classData)
401 .filter(k => classData[k])
402 .join(' ');
403 }
404 }
405 }
406 if (BUILD.isDev && vNodeChildren.some(isHost)) {
407 consoleDevError(`The <Host> must be the single root component. Make sure:
408- You are NOT using hostData() and <Host> in the same component.
409- <Host> is used once, and it's the single root component of the render() function.`);
410 }
411 if (BUILD.vdomFunctional && typeof nodeName === 'function') {
412 // nodeName is a functional component
413 return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
414 }
415 const vnode = newVNode(nodeName, null);
416 vnode.$attrs$ = vnodeData;
417 if (vNodeChildren.length > 0) {
418 vnode.$children$ = vNodeChildren;
419 }
420 if (BUILD.vdomKey) {
421 vnode.$key$ = key;
422 }
423 if (BUILD.slotRelocation) {
424 vnode.$name$ = slotName;
425 }
426 return vnode;
427};
428const newVNode = (tag, text) => {
429 const vnode = {
430 $flags$: 0,
431 $tag$: tag,
432 $text$: text,
433 $elm$: null,
434 $children$: null,
435 };
436 if (BUILD.vdomAttribute) {
437 vnode.$attrs$ = null;
438 }
439 if (BUILD.vdomKey) {
440 vnode.$key$ = null;
441 }
442 if (BUILD.slotRelocation) {
443 vnode.$name$ = null;
444 }
445 return vnode;
446};
447const Host = {};
448const isHost = (node) => node && node.$tag$ === Host;
449const vdomFnUtils = {
450 forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
451 map: (children, cb) => children
452 .map(convertToPublic)
453 .map(cb)
454 .map(convertToPrivate),
455};
456const convertToPublic = (node) => ({
457 vattrs: node.$attrs$,
458 vchildren: node.$children$,
459 vkey: node.$key$,
460 vname: node.$name$,
461 vtag: node.$tag$,
462 vtext: node.$text$,
463});
464const convertToPrivate = (node) => {
465 const vnode = newVNode(node.vtag, node.vtext);
466 vnode.$attrs$ = node.vattrs;
467 vnode.$children$ = node.vchildren;
468 vnode.$key$ = node.vkey;
469 vnode.$name$ = node.vname;
470 return vnode;
471};
472const validateInputProperties = (vnodeData) => {
473 const props = Object.keys(vnodeData);
474 const typeIndex = props.indexOf('type');
475 const minIndex = props.indexOf('min');
476 const maxIndex = props.indexOf('max');
477 const stepIndex = props.indexOf('min');
478 const value = props.indexOf('value');
479 if (value === -1) {
480 return;
481 }
482 if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
483 consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
484 }
485};
486/**
487 * Production setAccessor() function based on Preact by
488 * Jason Miller (@developit)
489 * Licensed under the MIT License
490 * https://github.com/developit/preact/blob/master/LICENSE
491 *
492 * Modified for Stencil's compiler and vdom
493 */
494const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
495 if (oldValue !== newValue) {
496 let isProp = isMemberInElement(elm, memberName);
497 let ln = memberName.toLowerCase();
498 if (BUILD.vdomClass && memberName === 'class') {
499 const classList = elm.classList;
500 const oldClasses = parseClassList(oldValue);
501 const newClasses = parseClassList(newValue);
502 classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
503 classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
504 }
505 else if (BUILD.vdomStyle && memberName === 'style') {
506 // update style attribute, css properties and values
507 if (BUILD.updatable) {
508 for (const prop in oldValue) {
509 if (!newValue || newValue[prop] == null) {
510 if (!BUILD.hydrateServerSide && prop.includes('-')) {
511 elm.style.removeProperty(prop);
512 }
513 else {
514 elm.style[prop] = '';
515 }
516 }
517 }
518 }
519 for (const prop in newValue) {
520 if (!oldValue || newValue[prop] !== oldValue[prop]) {
521 if (!BUILD.hydrateServerSide && prop.includes('-')) {
522 elm.style.setProperty(prop, newValue[prop]);
523 }
524 else {
525 elm.style[prop] = newValue[prop];
526 }
527 }
528 }
529 }
530 else if (BUILD.vdomKey && memberName === 'key')
531 ;
532 else if (BUILD.vdomRef && memberName === 'ref') {
533 // minifier will clean this up
534 if (newValue) {
535 newValue(elm);
536 }
537 }
538 else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === 'o' && memberName[1] === 'n') {
539 // Event Handlers
540 // so if the member name starts with "on" and the 3rd characters is
541 // a capital letter, and it's not already a member on the element,
542 // then we're assuming it's an event listener
543 if (memberName[2] === '-') {
544 // on- prefixed events
545 // allows to be explicit about the dom event to listen without any magic
546 // under the hood:
547 // <my-cmp on-click> // listens for "click"
548 // <my-cmp on-Click> // listens for "Click"
549 // <my-cmp on-ionChange> // listens for "ionChange"
550 // <my-cmp on-EVENTS> // listens for "EVENTS"
551 memberName = memberName.slice(3);
552 }
553 else if (isMemberInElement(win, ln)) {
554 // standard event
555 // the JSX attribute could have been "onMouseOver" and the
556 // member name "onmouseover" is on the window's prototype
557 // so let's add the listener "mouseover", which is all lowercased
558 memberName = ln.slice(2);
559 }
560 else {
561 // custom event
562 // the JSX attribute could have been "onMyCustomEvent"
563 // so let's trim off the "on" prefix and lowercase the first character
564 // and add the listener "myCustomEvent"
565 // except for the first character, we keep the event name case
566 memberName = ln[2] + memberName.slice(3);
567 }
568 if (oldValue) {
569 plt.rel(elm, memberName, oldValue, false);
570 }
571 if (newValue) {
572 plt.ael(elm, memberName, newValue, false);
573 }
574 }
575 else if (BUILD.vdomPropOrAttr) {
576 // Set property if it exists and it's not a SVG
577 const isComplex = isComplexType(newValue);
578 if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
579 try {
580 if (!elm.tagName.includes('-')) {
581 let n = newValue == null ? '' : newValue;
582 // Workaround for Safari, moving the <input> caret when re-assigning the same valued
583 if (memberName === 'list') {
584 isProp = false;
585 // tslint:disable-next-line: triple-equals
586 }
587 else if (oldValue == null || elm[memberName] != n) {
588 elm[memberName] = n;
589 }
590 }
591 else {
592 elm[memberName] = newValue;
593 }
594 }
595 catch (e) { }
596 }
597 /**
598 * Need to manually update attribute if:
599 * - memberName is not an attribute
600 * - if we are rendering the host element in order to reflect attribute
601 * - if it's a SVG, since properties might not work in <svg>
602 * - if the newValue is null/undefined or 'false'.
603 */
604 let xlink = false;
605 if (BUILD.vdomXlink) {
606 if (ln !== (ln = ln.replace(/^xlink\:?/, ''))) {
607 memberName = ln;
608 xlink = true;
609 }
610 }
611 if (newValue == null || newValue === false) {
612 if (newValue !== false || elm.getAttribute(memberName) === '') {
613 if (BUILD.vdomXlink && xlink) {
614 elm.removeAttributeNS(XLINK_NS, memberName);
615 }
616 else {
617 elm.removeAttribute(memberName);
618 }
619 }
620 }
621 else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) {
622 newValue = newValue === true ? '' : newValue;
623 if (BUILD.vdomXlink && xlink) {
624 elm.setAttributeNS(XLINK_NS, memberName, newValue);
625 }
626 else {
627 elm.setAttribute(memberName, newValue);
628 }
629 }
630 }
631 }
632};
633const parseClassListRegex = /\s/;
634const parseClassList = (value) => (!value ? [] : value.split(parseClassListRegex));
635const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
636 // if the element passed in is a shadow root, which is a document fragment
637 // then we want to be adding attrs/props to the shadow root's "host" element
638 // if it's not a shadow root, then we add attrs/props to the same element
639 const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
640 const oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
641 const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
642 if (BUILD.updatable) {
643 // remove attributes no longer present on the vnode by setting them to undefined
644 for (memberName in oldVnodeAttrs) {
645 if (!(memberName in newVnodeAttrs)) {
646 setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
647 }
648 }
649 }
650 // add new & update changed attributes
651 for (memberName in newVnodeAttrs) {
652 setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
653 }
654};
655const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
656 // tslint:disable-next-line: prefer-const
657 let newVNode = newParentVNode.$children$[childIndex];
658 let i = 0;
659 let elm;
660 let childNode;
661 let oldVNode;
662 if (BUILD.slotRelocation && !useNativeShadowDom) {
663 // remember for later we need to check to relocate nodes
664 checkSlotRelocate = true;
665 if (newVNode.$tag$ === 'slot') {
666 if (scopeId) {
667 // scoped css needs to add its scoped id to the parent element
668 parentElm.classList.add(scopeId + '-s');
669 }
670 newVNode.$flags$ |= newVNode.$children$
671 ? // slot element has fallback content
672 2 /* isSlotFallback */
673 : // slot element does not have fallback content
674 1 /* isSlotReference */;
675 }
676 }
677 if (BUILD.isDev && newVNode.$elm$) {
678 consoleError(`The JSX ${newVNode.$text$ !== null ? `"${newVNode.$text$}" text` : `"${newVNode.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`);
679 }
680 if (BUILD.vdomText && newVNode.$text$ !== null) {
681 // create text node
682 elm = newVNode.$elm$ = doc.createTextNode(newVNode.$text$);
683 }
684 else if (BUILD.slotRelocation && newVNode.$flags$ & 1 /* isSlotReference */) {
685 // create a slot reference node
686 elm = newVNode.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode) : doc.createTextNode('');
687 }
688 else {
689 if (BUILD.svg && !isSvgMode) {
690 isSvgMode = newVNode.$tag$ === 'svg';
691 }
692 // create element
693 elm = newVNode.$elm$ = (BUILD.svg
694 ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$)
695 : doc.createElement(BUILD.slotRelocation && newVNode.$flags$ & 2 /* isSlotFallback */ ? 'slot-fb' : newVNode.$tag$));
696 if (BUILD.svg && isSvgMode && newVNode.$tag$ === 'foreignObject') {
697 isSvgMode = false;
698 }
699 // add css classes, attrs, props, listeners, etc.
700 if (BUILD.vdomAttribute) {
701 updateElement(null, newVNode, isSvgMode);
702 }
703 if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm['s-si'] !== scopeId) {
704 // if there is a scopeId and this is the initial render
705 // then let's add the scopeId as a css class
706 elm.classList.add((elm['s-si'] = scopeId));
707 }
708 if (newVNode.$children$) {
709 for (i = 0; i < newVNode.$children$.length; ++i) {
710 // create the node
711 childNode = createElm(oldParentVNode, newVNode, i, elm);
712 // return node could have been null
713 if (childNode) {
714 // append our new node
715 elm.appendChild(childNode);
716 }
717 }
718 }
719 if (BUILD.svg) {
720 if (newVNode.$tag$ === 'svg') {
721 // Only reset the SVG context when we're exiting <svg> element
722 isSvgMode = false;
723 }
724 else if (elm.tagName === 'foreignObject') {
725 // Reenter SVG context when we're exiting <foreignObject> element
726 isSvgMode = true;
727 }
728 }
729 }
730 if (BUILD.slotRelocation) {
731 elm['s-hn'] = hostTagName;
732 if (newVNode.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) {
733 // remember the content reference comment
734 elm['s-sr'] = true;
735 // remember the content reference comment
736 elm['s-cr'] = contentRef;
737 // remember the slot name, or empty string for default slot
738 elm['s-sn'] = newVNode.$name$ || '';
739 // check if we've got an old vnode for this slot
740 oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
741 if (oldVNode && oldVNode.$tag$ === newVNode.$tag$ && oldParentVNode.$elm$) {
742 // we've got an old slot vnode and the wrapper is being replaced
743 // so let's move the old slot content back to it's original location
744 putBackInOriginalLocation(oldParentVNode.$elm$, false);
745 }
746 }
747 }
748 return elm;
749};
750const putBackInOriginalLocation = (parentElm, recursive) => {
751 plt.$flags$ |= 1 /* isTmpDisconnected */;
752 const oldSlotChildNodes = parentElm.childNodes;
753 for (let i = oldSlotChildNodes.length - 1; i >= 0; i--) {
754 const childNode = oldSlotChildNodes[i];
755 if (childNode['s-hn'] !== hostTagName && childNode['s-ol']) {
756 // // this child node in the old element is from another component
757 // // remove this node from the old slot's parent
758 // childNode.remove();
759 // and relocate it back to it's original location
760 parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
761 // remove the old original location comment entirely
762 // later on the patch function will know what to do
763 // and move this to the correct spot in need be
764 childNode['s-ol'].remove();
765 childNode['s-ol'] = undefined;
766 checkSlotRelocate = true;
767 }
768 if (recursive) {
769 putBackInOriginalLocation(childNode, recursive);
770 }
771 }
772 plt.$flags$ &= ~1 /* isTmpDisconnected */;
773};
774const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
775 let containerElm = ((BUILD.slotRelocation && parentElm['s-cr'] && parentElm['s-cr'].parentNode) || parentElm);
776 let childNode;
777 if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
778 containerElm = containerElm.shadowRoot;
779 }
780 for (; startIdx <= endIdx; ++startIdx) {
781 if (vnodes[startIdx]) {
782 childNode = createElm(null, parentVNode, startIdx, parentElm);
783 if (childNode) {
784 vnodes[startIdx].$elm$ = childNode;
785 containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
786 }
787 }
788 }
789};
790const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
791 for (; startIdx <= endIdx; ++startIdx) {
792 if ((vnode = vnodes[startIdx])) {
793 elm = vnode.$elm$;
794 callNodeRefs(vnode);
795 if (BUILD.slotRelocation) {
796 // we're removing this element
797 // so it's possible we need to show slot fallback content now
798 checkSlotFallbackVisibility = true;
799 if (elm['s-ol']) {
800 // remove the original location comment
801 elm['s-ol'].remove();
802 }
803 else {
804 // it's possible that child nodes of the node
805 // that's being removed are slot nodes
806 putBackInOriginalLocation(elm, true);
807 }
808 }
809 // remove the vnode's element from the dom
810 elm.remove();
811 }
812 }
813};
814const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
815 let oldStartIdx = 0;
816 let newStartIdx = 0;
817 let idxInOld = 0;
818 let i = 0;
819 let oldEndIdx = oldCh.length - 1;
820 let oldStartVnode = oldCh[0];
821 let oldEndVnode = oldCh[oldEndIdx];
822 let newEndIdx = newCh.length - 1;
823 let newStartVnode = newCh[0];
824 let newEndVnode = newCh[newEndIdx];
825 let node;
826 let elmToMove;
827 while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
828 if (oldStartVnode == null) {
829 // Vnode might have been moved left
830 oldStartVnode = oldCh[++oldStartIdx];
831 }
832 else if (oldEndVnode == null) {
833 oldEndVnode = oldCh[--oldEndIdx];
834 }
835 else if (newStartVnode == null) {
836 newStartVnode = newCh[++newStartIdx];
837 }
838 else if (newEndVnode == null) {
839 newEndVnode = newCh[--newEndIdx];
840 }
841 else if (isSameVnode(oldStartVnode, newStartVnode)) {
842 patch(oldStartVnode, newStartVnode);
843 oldStartVnode = oldCh[++oldStartIdx];
844 newStartVnode = newCh[++newStartIdx];
845 }
846 else if (isSameVnode(oldEndVnode, newEndVnode)) {
847 patch(oldEndVnode, newEndVnode);
848 oldEndVnode = oldCh[--oldEndIdx];
849 newEndVnode = newCh[--newEndIdx];
850 }
851 else if (isSameVnode(oldStartVnode, newEndVnode)) {
852 // Vnode moved right
853 if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
854 putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
855 }
856 patch(oldStartVnode, newEndVnode);
857 parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
858 oldStartVnode = oldCh[++oldStartIdx];
859 newEndVnode = newCh[--newEndIdx];
860 }
861 else if (isSameVnode(oldEndVnode, newStartVnode)) {
862 // Vnode moved left
863 if (BUILD.slotRelocation && (oldStartVnode.$tag$ === 'slot' || newEndVnode.$tag$ === 'slot')) {
864 putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
865 }
866 patch(oldEndVnode, newStartVnode);
867 parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
868 oldEndVnode = oldCh[--oldEndIdx];
869 newStartVnode = newCh[++newStartIdx];
870 }
871 else {
872 // createKeyToOldIdx
873 idxInOld = -1;
874 if (BUILD.vdomKey) {
875 for (i = oldStartIdx; i <= oldEndIdx; ++i) {
876 if (oldCh[i] && oldCh[i].$key$ !== null && oldCh[i].$key$ === newStartVnode.$key$) {
877 idxInOld = i;
878 break;
879 }
880 }
881 }
882 if (BUILD.vdomKey && idxInOld >= 0) {
883 elmToMove = oldCh[idxInOld];
884 if (elmToMove.$tag$ !== newStartVnode.$tag$) {
885 node = createElm(oldCh && oldCh[newStartIdx], newVNode, idxInOld, parentElm);
886 }
887 else {
888 patch(elmToMove, newStartVnode);
889 oldCh[idxInOld] = undefined;
890 node = elmToMove.$elm$;
891 }
892 newStartVnode = newCh[++newStartIdx];
893 }
894 else {
895 // new element
896 node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx, parentElm);
897 newStartVnode = newCh[++newStartIdx];
898 }
899 if (node) {
900 if (BUILD.slotRelocation) {
901 parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
902 }
903 else {
904 oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
905 }
906 }
907 }
908 }
909 if (oldStartIdx > oldEndIdx) {
910 addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode, newCh, newStartIdx, newEndIdx);
911 }
912 else if (BUILD.updatable && newStartIdx > newEndIdx) {
913 removeVnodes(oldCh, oldStartIdx, oldEndIdx);
914 }
915};
916const isSameVnode = (vnode1, vnode2) => {
917 // compare if two vnode to see if they're "technically" the same
918 // need to have the same element tag, and same key to be the same
919 if (vnode1.$tag$ === vnode2.$tag$) {
920 if (BUILD.slotRelocation && vnode1.$tag$ === 'slot') {
921 return vnode1.$name$ === vnode2.$name$;
922 }
923 if (BUILD.vdomKey) {
924 return vnode1.$key$ === vnode2.$key$;
925 }
926 return true;
927 }
928 return false;
929};
930const referenceNode = (node) => {
931 // this node was relocated to a new location in the dom
932 // because of some other component's slot
933 // but we still have an html comment in place of where
934 // it's original location was according to it's original vdom
935 return (node && node['s-ol']) || node;
936};
937const parentReferenceNode = (node) => (node['s-ol'] ? node['s-ol'] : node).parentNode;
938const patch = (oldVNode, newVNode) => {
939 const elm = (newVNode.$elm$ = oldVNode.$elm$);
940 const oldChildren = oldVNode.$children$;
941 const newChildren = newVNode.$children$;
942 const tag = newVNode.$tag$;
943 const text = newVNode.$text$;
944 let defaultHolder;
945 if (!BUILD.vdomText || text === null) {
946 if (BUILD.svg) {
947 // test if we're rendering an svg element, or still rendering nodes inside of one
948 // only add this to the when the compiler sees we're using an svg somewhere
949 isSvgMode = tag === 'svg' ? true : tag === 'foreignObject' ? false : isSvgMode;
950 }
951 // element node
952 if (BUILD.vdomAttribute || BUILD.reflect) {
953 if (BUILD.slot && tag === 'slot')
954 ;
955 else {
956 // either this is the first render of an element OR it's an update
957 // AND we already know it's possible it could have changed
958 // this updates the element's css classes, attrs, props, listeners, etc.
959 updateElement(oldVNode, newVNode, isSvgMode);
960 }
961 }
962 if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
963 // looks like there's child vnodes for both the old and new vnodes
964 updateChildren(elm, oldChildren, newVNode, newChildren);
965 }
966 else if (newChildren !== null) {
967 // no old child vnodes, but there are new child vnodes to add
968 if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
969 // the old vnode was text, so be sure to clear it out
970 elm.textContent = '';
971 }
972 // add the new vnode children
973 addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
974 }
975 else if (BUILD.updatable && oldChildren !== null) {
976 // no new child vnodes, but there are old child vnodes to remove
977 removeVnodes(oldChildren, 0, oldChildren.length - 1);
978 }
979 if (BUILD.svg && isSvgMode && tag === 'svg') {
980 isSvgMode = false;
981 }
982 }
983 else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm['s-cr'])) {
984 // this element has slotted content
985 defaultHolder.parentNode.textContent = text;
986 }
987 else if (BUILD.vdomText && oldVNode.$text$ !== text) {
988 // update the text content for the text only vnode
989 // and also only if the text is different than before
990 elm.data = text;
991 }
992};
993const updateFallbackSlotVisibility = (elm) => {
994 // tslint:disable-next-line: prefer-const
995 let childNodes = elm.childNodes;
996 let childNode;
997 let i;
998 let ilen;
999 let j;
1000 let slotNameAttr;
1001 let nodeType;
1002 for (i = 0, ilen = childNodes.length; i < ilen; i++) {
1003 childNode = childNodes[i];
1004 if (childNode.nodeType === 1 /* ElementNode */) {
1005 if (childNode['s-sr']) {
1006 // this is a slot fallback node
1007 // get the slot name for this slot reference node
1008 slotNameAttr = childNode['s-sn'];
1009 // by default always show a fallback slot node
1010 // then hide it if there are other slots in the light dom
1011 childNode.hidden = false;
1012 for (j = 0; j < ilen; j++) {
1013 if (childNodes[j]['s-hn'] !== childNode['s-hn']) {
1014 // this sibling node is from a different component
1015 nodeType = childNodes[j].nodeType;
1016 if (slotNameAttr !== '') {
1017 // this is a named fallback slot node
1018 if (nodeType === 1 /* ElementNode */ && slotNameAttr === childNodes[j].getAttribute('slot')) {
1019 childNode.hidden = true;
1020 break;
1021 }
1022 }
1023 else {
1024 // this is a default fallback slot node
1025 // any element or text node (with content)
1026 // should hide the default fallback slot node
1027 if (nodeType === 1 /* ElementNode */ || (nodeType === 3 /* TextNode */ && childNodes[j].textContent.trim() !== '')) {
1028 childNode.hidden = true;
1029 break;
1030 }
1031 }
1032 }
1033 }
1034 }
1035 // keep drilling down
1036 updateFallbackSlotVisibility(childNode);
1037 }
1038 }
1039};
1040const relocateNodes = [];
1041const relocateSlotContent = (elm) => {
1042 // tslint:disable-next-line: prefer-const
1043 let childNode;
1044 let node;
1045 let hostContentNodes;
1046 let slotNameAttr;
1047 let relocateNodeData;
1048 let j;
1049 let i = 0;
1050 let childNodes = elm.childNodes;
1051 let ilen = childNodes.length;
1052 for (; i < ilen; i++) {
1053 childNode = childNodes[i];
1054 if (childNode['s-sr'] && (node = childNode['s-cr'])) {
1055 // first got the content reference comment node
1056 // then we got it's parent, which is where all the host content is in now
1057 hostContentNodes = node.parentNode.childNodes;
1058 slotNameAttr = childNode['s-sn'];
1059 for (j = hostContentNodes.length - 1; j >= 0; j--) {
1060 node = hostContentNodes[j];
1061 if (!node['s-cn'] && !node['s-nr'] && node['s-hn'] !== childNode['s-hn']) {
1062 // let's do some relocating to its new home
1063 // but never relocate a content reference node
1064 // that is suppose to always represent the original content location
1065 if (isNodeLocatedInSlot(node, slotNameAttr)) {
1066 // it's possible we've already decided to relocate this node
1067 relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
1068 // made some changes to slots
1069 // let's make sure we also double check
1070 // fallbacks are correctly hidden or shown
1071 checkSlotFallbackVisibility = true;
1072 node['s-sn'] = node['s-sn'] || slotNameAttr;
1073 if (relocateNodeData) {
1074 // previously we never found a slot home for this node
1075 // but turns out we did, so let's remember it now
1076 relocateNodeData.$slotRefNode$ = childNode;
1077 }
1078 else {
1079 // add to our list of nodes to relocate
1080 relocateNodes.push({
1081 $slotRefNode$: childNode,
1082 $nodeToRelocate$: node,
1083 });
1084 }
1085 if (node['s-sr']) {
1086 relocateNodes.map(relocateNode => {
1087 if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node['s-sn'])) {
1088 relocateNodeData = relocateNodes.find(r => r.$nodeToRelocate$ === node);
1089 if (relocateNodeData && !relocateNode.$slotRefNode$) {
1090 relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
1091 }
1092 }
1093 });
1094 }
1095 }
1096 else if (!relocateNodes.some(r => r.$nodeToRelocate$ === node)) {
1097 // so far this element does not have a slot home, not setting slotRefNode on purpose
1098 // if we never find a home for this element then we'll need to hide it
1099 relocateNodes.push({
1100 $nodeToRelocate$: node,
1101 });
1102 }
1103 }
1104 }
1105 }
1106 if (childNode.nodeType === 1 /* ElementNode */) {
1107 relocateSlotContent(childNode);
1108 }
1109 }
1110};
1111const isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
1112 if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1113 if (nodeToRelocate.getAttribute('slot') === null && slotNameAttr === '') {
1114 return true;
1115 }
1116 if (nodeToRelocate.getAttribute('slot') === slotNameAttr) {
1117 return true;
1118 }
1119 return false;
1120 }
1121 if (nodeToRelocate['s-sn'] === slotNameAttr) {
1122 return true;
1123 }
1124 return slotNameAttr === '';
1125};
1126const callNodeRefs = (vNode) => {
1127 if (BUILD.vdomRef) {
1128 vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
1129 vNode.$children$ && vNode.$children$.map(callNodeRefs);
1130 }
1131};
1132const renderVdom = (hostRef, renderFnResults) => {
1133 const hostElm = hostRef.$hostElement$;
1134 const cmpMeta = hostRef.$cmpMeta$;
1135 const oldVNode = hostRef.$vnode$ || newVNode(null, null);
1136 const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
1137 hostTagName = hostElm.tagName;
1138 // <Host> runtime check
1139 if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
1140 throw new Error(`The <Host> must be the single root component.
1141Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
1142
1143The render() function should look like this instead:
1144
1145render() {
1146 // Do not return an array
1147 return (
1148 <Host>{content}</Host>
1149 );
1150}
1151 `);
1152 }
1153 if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
1154 rootVnode.$attrs$ = rootVnode.$attrs$ || {};
1155 cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
1156 }
1157 rootVnode.$tag$ = null;
1158 rootVnode.$flags$ |= 4 /* isHost */;
1159 hostRef.$vnode$ = rootVnode;
1160 rootVnode.$elm$ = oldVNode.$elm$ = (BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm);
1161 if (BUILD.scoped || BUILD.shadowDom) {
1162 scopeId = hostElm['s-sc'];
1163 }
1164 if (BUILD.slotRelocation) {
1165 contentRef = hostElm['s-cr'];
1166 useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) !== 0;
1167 // always reset
1168 checkSlotFallbackVisibility = false;
1169 }
1170 // synchronous patch
1171 patch(oldVNode, rootVnode);
1172 if (BUILD.slotRelocation) {
1173 // while we're moving nodes around existing nodes, temporarily disable
1174 // the disconnectCallback from working
1175 plt.$flags$ |= 1 /* isTmpDisconnected */;
1176 if (checkSlotRelocate) {
1177 relocateSlotContent(rootVnode.$elm$);
1178 let relocateData;
1179 let nodeToRelocate;
1180 let orgLocationNode;
1181 let parentNodeRef;
1182 let insertBeforeNode;
1183 let refNode;
1184 let i = 0;
1185 for (; i < relocateNodes.length; i++) {
1186 relocateData = relocateNodes[i];
1187 nodeToRelocate = relocateData.$nodeToRelocate$;
1188 if (!nodeToRelocate['s-ol']) {
1189 // add a reference node marking this node's original location
1190 // keep a reference to this node for later lookups
1191 orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode('');
1192 orgLocationNode['s-nr'] = nodeToRelocate;
1193 nodeToRelocate.parentNode.insertBefore((nodeToRelocate['s-ol'] = orgLocationNode), nodeToRelocate);
1194 }
1195 }
1196 for (i = 0; i < relocateNodes.length; i++) {
1197 relocateData = relocateNodes[i];
1198 nodeToRelocate = relocateData.$nodeToRelocate$;
1199 if (relocateData.$slotRefNode$) {
1200 // by default we're just going to insert it directly
1201 // after the slot reference node
1202 parentNodeRef = relocateData.$slotRefNode$.parentNode;
1203 insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
1204 orgLocationNode = nodeToRelocate['s-ol'];
1205 while ((orgLocationNode = orgLocationNode.previousSibling)) {
1206 refNode = orgLocationNode['s-nr'];
1207 if (refNode && refNode['s-sn'] === nodeToRelocate['s-sn'] && parentNodeRef === refNode.parentNode) {
1208 refNode = refNode.nextSibling;
1209 if (!refNode || !refNode['s-nr']) {
1210 insertBeforeNode = refNode;
1211 break;
1212 }
1213 }
1214 }
1215 if ((!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode) || nodeToRelocate.nextSibling !== insertBeforeNode) {
1216 // we've checked that it's worth while to relocate
1217 // since that the node to relocate
1218 // has a different next sibling or parent relocated
1219 if (nodeToRelocate !== insertBeforeNode) {
1220 if (!nodeToRelocate['s-hn'] && nodeToRelocate['s-ol']) {
1221 // probably a component in the index.html that doesn't have it's hostname set
1222 nodeToRelocate['s-hn'] = nodeToRelocate['s-ol'].parentNode.nodeName;
1223 }
1224 // add it back to the dom but in its new home
1225 parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
1226 }
1227 }
1228 }
1229 else {
1230 // this node doesn't have a slot home to go to, so let's hide it
1231 if (nodeToRelocate.nodeType === 1 /* ElementNode */) {
1232 nodeToRelocate.hidden = true;
1233 }
1234 }
1235 }
1236 }
1237 if (checkSlotFallbackVisibility) {
1238 updateFallbackSlotVisibility(rootVnode.$elm$);
1239 }
1240 // done moving nodes around
1241 // allow the disconnect callback to work again
1242 plt.$flags$ &= ~1 /* isTmpDisconnected */;
1243 // always reset
1244 relocateNodes.length = 0;
1245 }
1246};
1247// slot comment debug nodes only created with the `--debug` flag
1248// otherwise these nodes are text nodes w/out content
1249const slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ''}> (host=${hostTagName.toLowerCase()})`);
1250const originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate['s-hn']})` : `[${nodeToRelocate.textContent}]`));
1251const getElement = (ref) => (BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref);
1252const createEvent = (ref, name, flags) => {
1253 const elm = getElement(ref);
1254 return {
1255 emit: (detail) => {
1256 if (BUILD.isDev && !elm.isConnected) {
1257 consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
1258 }
1259 return emitEvent(elm, name, {
1260 bubbles: !!(flags & 4 /* Bubbles */),
1261 composed: !!(flags & 2 /* Composed */),
1262 cancelable: !!(flags & 1 /* Cancellable */),
1263 detail,
1264 });
1265 },
1266 };
1267};
1268const emitEvent = (elm, name, opts) => {
1269 const ev = new (BUILD.hydrateServerSide ? win.CustomEvent : CustomEvent)(name, opts);
1270 elm.dispatchEvent(ev);
1271 return ev;
1272};
1273const attachToAncestor = (hostRef, ancestorComponent) => {
1274 if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) {
1275 ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r)));
1276 }
1277};
1278const scheduleUpdate = (hostRef, isInitialLoad) => {
1279 if (BUILD.taskQueue && BUILD.updatable) {
1280 hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
1281 }
1282 if (BUILD.asyncLoading && hostRef.$flags$ & 4 /* isWaitingForChildren */) {
1283 hostRef.$flags$ |= 512 /* needsRerender */;
1284 return;
1285 }
1286 attachToAncestor(hostRef, hostRef.$ancestorComponent$);
1287 // there is no ancestorc omponent or the ancestor component
1288 // has already fired off its lifecycle update then
1289 // fire off the initial update
1290 const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
1291 return BUILD.taskQueue ? writeTask(dispatch) : dispatch;
1292};
1293const dispatchHooks = (hostRef, isInitialLoad) => {
1294 const elm = hostRef.$hostElement$;
1295 const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$);
1296 const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1297 let promise;
1298 if (isInitialLoad) {
1299 if (BUILD.lazyLoad && BUILD.hostListener) {
1300 hostRef.$flags$ |= 256 /* isListenReady */;
1301 if (hostRef.$queuedListeners$) {
1302 hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
1303 hostRef.$queuedListeners$ = null;
1304 }
1305 }
1306 emitLifecycleEvent(elm, 'componentWillLoad');
1307 if (BUILD.cmpWillLoad) {
1308 promise = safeCall(instance, 'componentWillLoad');
1309 }
1310 }
1311 else {
1312 emitLifecycleEvent(elm, 'componentWillUpdate');
1313 if (BUILD.cmpWillUpdate) {
1314 promise = safeCall(instance, 'componentWillUpdate');
1315 }
1316 }
1317 emitLifecycleEvent(elm, 'componentWillRender');
1318 if (BUILD.cmpWillRender) {
1319 promise = then(promise, () => safeCall(instance, 'componentWillRender'));
1320 }
1321 endSchedule();
1322 return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
1323};
1324const updateComponent = (hostRef, instance, isInitialLoad) => {
1325 // updateComponent
1326 const elm = hostRef.$hostElement$;
1327 const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$);
1328 const rc = elm['s-rc'];
1329 if (BUILD.style && isInitialLoad) {
1330 // DOM WRITE!
1331 attachStyles(hostRef);
1332 }
1333 const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$);
1334 if (BUILD.isDev) {
1335 hostRef.$flags$ |= 1024 /* devOnRender */;
1336 }
1337 if (BUILD.hasRenderFn || BUILD.reflect) {
1338 if (BUILD.vdomRender || BUILD.reflect) {
1339 // looks like we've got child nodes to render into this host element
1340 // or we need to update the css class/attrs on the host element
1341 // DOM WRITE!
1342 renderVdom(hostRef, callRender(hostRef, instance));
1343 }
1344 else {
1345 elm.textContent = callRender(hostRef, instance);
1346 }
1347 }
1348 if (BUILD.cssVarShim && plt.$cssShim$) {
1349 plt.$cssShim$.updateHost(elm);
1350 }
1351 if (BUILD.isDev) {
1352 hostRef.$renderCount$++;
1353 hostRef.$flags$ &= ~1024 /* devOnRender */;
1354 }
1355 if (BUILD.hydrateServerSide) {
1356 try {
1357 // manually connected child components during server-side hydrate
1358 serverSideConnected(elm);
1359 if (isInitialLoad) {
1360 // using only during server-side hydrate
1361 if (hostRef.$cmpMeta$.$flags$ & 1 /* shadowDomEncapsulation */) {
1362 elm['s-en'] = '';
1363 }
1364 else if (hostRef.$cmpMeta$.$flags$ & 2 /* scopedCssEncapsulation */) {
1365 elm['s-en'] = 'c';
1366 }
1367 }
1368 }
1369 catch (e) {
1370 consoleError(e);
1371 }
1372 }
1373 if (BUILD.asyncLoading && rc) {
1374 // ok, so turns out there are some child host elements
1375 // waiting on this parent element to load
1376 // let's fire off all update callbacks waiting
1377 rc.map(cb => cb());
1378 elm['s-rc'] = undefined;
1379 }
1380 endRender();
1381 endUpdate();
1382 if (BUILD.asyncLoading) {
1383 const childrenPromises = elm['s-p'];
1384 const postUpdate = () => postUpdateComponent(hostRef);
1385 if (childrenPromises.length === 0) {
1386 postUpdate();
1387 }
1388 else {
1389 Promise.all(childrenPromises).then(postUpdate);
1390 hostRef.$flags$ |= 4 /* isWaitingForChildren */;
1391 childrenPromises.length = 0;
1392 }
1393 }
1394 else {
1395 postUpdateComponent(hostRef);
1396 }
1397};
1398const callRender = (hostRef, instance) => {
1399 // in order for bundlers to correctly treeshake the BUILD object
1400 // we need to ensure BUILD is not deoptimized within a try/catch
1401 // https://rollupjs.org/guide/en/#treeshake tryCatchDeoptimization
1402 const allRenderFn = BUILD.allRenderFn ? true : false;
1403 const lazyLoad = BUILD.lazyLoad ? true : false;
1404 const taskQueue = BUILD.taskQueue ? true : false;
1405 const updatable = BUILD.updatable ? true : false;
1406 try {
1407 renderingRef = instance;
1408 instance = allRenderFn ? instance.render() : instance.render && instance.render();
1409 if (updatable && taskQueue) {
1410 hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
1411 }
1412 if (updatable || lazyLoad) {
1413 hostRef.$flags$ |= 2 /* hasRendered */;
1414 }
1415 }
1416 catch (e) {
1417 consoleError(e);
1418 }
1419 renderingRef = null;
1420 return instance;
1421};
1422const getRenderingRef = () => renderingRef;
1423const postUpdateComponent = (hostRef) => {
1424 const tagName = hostRef.$cmpMeta$.$tagName$;
1425 const elm = hostRef.$hostElement$;
1426 const endPostUpdate = createTime('postUpdate', tagName);
1427 const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1428 const ancestorComponent = hostRef.$ancestorComponent$;
1429 if (BUILD.cmpDidRender) {
1430 if (BUILD.isDev) {
1431 hostRef.$flags$ |= 1024 /* devOnRender */;
1432 }
1433 safeCall(instance, 'componentDidRender');
1434 if (BUILD.isDev) {
1435 hostRef.$flags$ &= ~1024 /* devOnRender */;
1436 }
1437 }
1438 emitLifecycleEvent(elm, 'componentDidRender');
1439 if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
1440 hostRef.$flags$ |= 64 /* hasLoadedComponent */;
1441 if (BUILD.asyncLoading && BUILD.cssAnnotations) {
1442 // DOM WRITE!
1443 addHydratedFlag(elm);
1444 }
1445 if (BUILD.cmpDidLoad) {
1446 if (BUILD.isDev) {
1447 hostRef.$flags$ |= 2048 /* devOnDidLoad */;
1448 }
1449 safeCall(instance, 'componentDidLoad');
1450 if (BUILD.isDev) {
1451 hostRef.$flags$ &= ~2048 /* devOnDidLoad */;
1452 }
1453 }
1454 emitLifecycleEvent(elm, 'componentDidLoad');
1455 endPostUpdate();
1456 if (BUILD.asyncLoading) {
1457 hostRef.$onReadyResolve$(elm);
1458 if (!ancestorComponent) {
1459 appDidLoad(tagName);
1460 }
1461 }
1462 }
1463 else {
1464 if (BUILD.cmpDidUpdate) {
1465 // we've already loaded this component
1466 // fire off the user's componentDidUpdate method (if one was provided)
1467 // componentDidUpdate runs AFTER render() has been called
1468 // and all child components have finished updating
1469 if (BUILD.isDev) {
1470 hostRef.$flags$ |= 1024 /* devOnRender */;
1471 }
1472 safeCall(instance, 'componentDidUpdate');
1473 if (BUILD.isDev) {
1474 hostRef.$flags$ &= ~1024 /* devOnRender */;
1475 }
1476 }
1477 emitLifecycleEvent(elm, 'componentDidUpdate');
1478 endPostUpdate();
1479 }
1480 if (BUILD.hotModuleReplacement) {
1481 elm['s-hmr-load'] && elm['s-hmr-load']();
1482 }
1483 if (BUILD.method && BUILD.lazyLoad) {
1484 hostRef.$onInstanceResolve$(elm);
1485 }
1486 // load events fire from bottom to top
1487 // the deepest elements load first then bubbles up
1488 if (BUILD.asyncLoading) {
1489 if (hostRef.$onRenderResolve$) {
1490 hostRef.$onRenderResolve$();
1491 hostRef.$onRenderResolve$ = undefined;
1492 }
1493 if (hostRef.$flags$ & 512 /* needsRerender */) {
1494 nextTick(() => scheduleUpdate(hostRef, false));
1495 }
1496 hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
1497 }
1498 // ( •_•)
1499 // ( •_•)>⌐■-■
1500 // (⌐■_■)
1501};
1502const forceUpdate = (ref) => {
1503 if (BUILD.updatable) {
1504 const hostRef = getHostRef(ref);
1505 const isConnected = hostRef.$hostElement$.isConnected;
1506 if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1507 scheduleUpdate(hostRef, false);
1508 }
1509 // Returns "true" when the forced update was successfully scheduled
1510 return isConnected;
1511 }
1512 return false;
1513};
1514const appDidLoad = (who) => {
1515 // on appload
1516 // we have finish the first big initial render
1517 if (BUILD.cssAnnotations) {
1518 addHydratedFlag(doc.documentElement);
1519 }
1520 if (BUILD.asyncQueue) {
1521 plt.$flags$ |= 2 /* appLoaded */;
1522 }
1523 nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }));
1524 if (BUILD.profile && performance.measure) {
1525 performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, 'st:app:start');
1526 }
1527};
1528const safeCall = (instance, method, arg) => {
1529 if (instance && instance[method]) {
1530 try {
1531 return instance[method](arg);
1532 }
1533 catch (e) {
1534 consoleError(e);
1535 }
1536 }
1537 return undefined;
1538};
1539const then = (promise, thenFn) => {
1540 return promise && promise.then ? promise.then(thenFn) : thenFn();
1541};
1542const emitLifecycleEvent = (elm, lifecycleName) => {
1543 if (BUILD.lifecycleDOMEvents) {
1544 emitEvent(elm, 'stencil_' + lifecycleName, {
1545 bubbles: true,
1546 composed: true,
1547 detail: {
1548 namespace: NAMESPACE,
1549 },
1550 });
1551 }
1552};
1553const addHydratedFlag = (elm) => (BUILD.hydratedClass ? elm.classList.add('hydrated') : BUILD.hydratedAttribute ? elm.setAttribute('hydrated', '') : undefined);
1554const serverSideConnected = (elm) => {
1555 const children = elm.children;
1556 if (children != null) {
1557 for (let i = 0, ii = children.length; i < ii; i++) {
1558 const childElm = children[i];
1559 if (typeof childElm.connectedCallback === 'function') {
1560 childElm.connectedCallback();
1561 }
1562 serverSideConnected(childElm);
1563 }
1564 }
1565};
1566const initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
1567 const endHydrate = createTime('hydrateClient', tagName);
1568 const shadowRoot = hostElm.shadowRoot;
1569 const childRenderNodes = [];
1570 const slotNodes = [];
1571 const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
1572 const vnode = (hostRef.$vnode$ = newVNode(tagName, null));
1573 if (!plt.$orgLocNodes$) {
1574 initializeDocumentHydrate(doc.body, (plt.$orgLocNodes$ = new Map()));
1575 }
1576 hostElm[HYDRATE_ID] = hostId;
1577 hostElm.removeAttribute(HYDRATE_ID);
1578 clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
1579 childRenderNodes.map(c => {
1580 const orgLocationId = c.$hostId$ + '.' + c.$nodeId$;
1581 const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
1582 const node = c.$elm$;
1583 if (orgLocationNode && supportsShadow && orgLocationNode['s-en'] === '') {
1584 orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
1585 }
1586 if (!shadowRoot) {
1587 node['s-hn'] = tagName;
1588 if (orgLocationNode) {
1589 node['s-ol'] = orgLocationNode;
1590 node['s-ol']['s-nr'] = node;
1591 }
1592 }
1593 plt.$orgLocNodes$.delete(orgLocationId);
1594 });
1595 if (BUILD.shadowDom && shadowRoot) {
1596 shadowRootNodes.map(shadowRootNode => {
1597 if (shadowRootNode) {
1598 shadowRoot.appendChild(shadowRootNode);
1599 }
1600 });
1601 }
1602 endHydrate();
1603};
1604const clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
1605 let childNodeType;
1606 let childIdSplt;
1607 let childVNode;
1608 let i;
1609 if (node.nodeType === 1 /* ElementNode */) {
1610 childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
1611 if (childNodeType) {
1612 // got the node data from the element's attribute
1613 // `${hostId}.${nodeId}.${depth}.${index}`
1614 childIdSplt = childNodeType.split('.');
1615 if (childIdSplt[0] === hostId || childIdSplt[0] === '0') {
1616 childVNode = {
1617 $flags$: 0,
1618 $hostId$: childIdSplt[0],
1619 $nodeId$: childIdSplt[1],
1620 $depth$: childIdSplt[2],
1621 $index$: childIdSplt[3],
1622 $tag$: node.tagName.toLowerCase(),
1623 $elm$: node,
1624 $attrs$: null,
1625 $children$: null,
1626 $key$: null,
1627 $name$: null,
1628 $text$: null,
1629 };
1630 childRenderNodes.push(childVNode);
1631 node.removeAttribute(HYDRATE_CHILD_ID);
1632 // this is a new child vnode
1633 // so ensure its parent vnode has the vchildren array
1634 if (!parentVNode.$children$) {
1635 parentVNode.$children$ = [];
1636 }
1637 // add our child vnode to a specific index of the vnode's children
1638 parentVNode.$children$[childVNode.$index$] = childVNode;
1639 // this is now the new parent vnode for all the next child checks
1640 parentVNode = childVNode;
1641 if (shadowRootNodes && childVNode.$depth$ === '0') {
1642 shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1643 }
1644 }
1645 }
1646 // recursively drill down, end to start so we can remove nodes
1647 for (i = node.childNodes.length - 1; i >= 0; i--) {
1648 clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i], hostId);
1649 }
1650 if (node.shadowRoot) {
1651 // keep drilling down through the shadow root nodes
1652 for (i = node.shadowRoot.childNodes.length - 1; i >= 0; i--) {
1653 clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i], hostId);
1654 }
1655 }
1656 }
1657 else if (node.nodeType === 8 /* CommentNode */) {
1658 // `${COMMENT_TYPE}.${hostId}.${nodeId}.${depth}.${index}`
1659 childIdSplt = node.nodeValue.split('.');
1660 if (childIdSplt[1] === hostId || childIdSplt[1] === '0') {
1661 // comment node for either the host id or a 0 host id
1662 childNodeType = childIdSplt[0];
1663 childVNode = {
1664 $flags$: 0,
1665 $hostId$: childIdSplt[1],
1666 $nodeId$: childIdSplt[2],
1667 $depth$: childIdSplt[3],
1668 $index$: childIdSplt[4],
1669 $elm$: node,
1670 $attrs$: null,
1671 $children$: null,
1672 $key$: null,
1673 $name$: null,
1674 $tag$: null,
1675 $text$: null,
1676 };
1677 if (childNodeType === TEXT_NODE_ID) {
1678 childVNode.$elm$ = node.nextSibling;
1679 if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3 /* TextNode */) {
1680 childVNode.$text$ = childVNode.$elm$.textContent;
1681 childRenderNodes.push(childVNode);
1682 // remove the text comment since it's no longer needed
1683 node.remove();
1684 if (!parentVNode.$children$) {
1685 parentVNode.$children$ = [];
1686 }
1687 parentVNode.$children$[childVNode.$index$] = childVNode;
1688 if (shadowRootNodes && childVNode.$depth$ === '0') {
1689 shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1690 }
1691 }
1692 }
1693 else if (childVNode.$hostId$ === hostId) {
1694 // this comment node is specifcally for this host id
1695 if (childNodeType === SLOT_NODE_ID) {
1696 // `${SLOT_NODE_ID}.${hostId}.${nodeId}.${depth}.${index}.${slotName}`;
1697 childVNode.$tag$ = 'slot';
1698 if (childIdSplt[5]) {
1699 node['s-sn'] = childVNode.$name$ = childIdSplt[5];
1700 }
1701 else {
1702 node['s-sn'] = '';
1703 }
1704 node['s-sr'] = true;
1705 if (BUILD.shadowDom && shadowRootNodes) {
1706 // browser support shadowRoot and this is a shadow dom component
1707 // create an actual slot element
1708 childVNode.$elm$ = doc.createElement(childVNode.$tag$);
1709 if (childVNode.$name$) {
1710 // add the slot name attribute
1711 childVNode.$elm$.setAttribute('name', childVNode.$name$);
1712 }
1713 // insert the new slot element before the slot comment
1714 node.parentNode.insertBefore(childVNode.$elm$, node);
1715 // remove the slot comment since it's not needed for shadow
1716 node.remove();
1717 if (childVNode.$depth$ === '0') {
1718 shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
1719 }
1720 }
1721 slotNodes.push(childVNode);
1722 if (!parentVNode.$children$) {
1723 parentVNode.$children$ = [];
1724 }
1725 parentVNode.$children$[childVNode.$index$] = childVNode;
1726 }
1727 else if (childNodeType === CONTENT_REF_ID) {
1728 // `${CONTENT_REF_ID}.${hostId}`;
1729 if (BUILD.shadowDom && shadowRootNodes) {
1730 // remove the content ref comment since it's not needed for shadow
1731 node.remove();
1732 }
1733 else if (BUILD.slotRelocation) {
1734 hostElm['s-cr'] = node;
1735 node['s-cn'] = true;
1736 }
1737 }
1738 }
1739 }
1740 }
1741 else if (parentVNode && parentVNode.$tag$ === 'style') {
1742 const vnode = newVNode(null, node.textContent);
1743 vnode.$elm$ = node;
1744 vnode.$index$ = '0';
1745 parentVNode.$children$ = [vnode];
1746 }
1747};
1748const initializeDocumentHydrate = (node, orgLocNodes) => {
1749 if (node.nodeType === 1 /* ElementNode */) {
1750 let i = 0;
1751 for (; i < node.childNodes.length; i++) {
1752 initializeDocumentHydrate(node.childNodes[i], orgLocNodes);
1753 }
1754 if (node.shadowRoot) {
1755 for (i = 0; i < node.shadowRoot.childNodes.length; i++) {
1756 initializeDocumentHydrate(node.shadowRoot.childNodes[i], orgLocNodes);
1757 }
1758 }
1759 }
1760 else if (node.nodeType === 8 /* CommentNode */) {
1761 const childIdSplt = node.nodeValue.split('.');
1762 if (childIdSplt[0] === ORG_LOCATION_ID) {
1763 orgLocNodes.set(childIdSplt[1] + '.' + childIdSplt[2], node);
1764 node.nodeValue = '';
1765 // useful to know if the original location is
1766 // the root light-dom of a shadow dom component
1767 node['s-en'] = childIdSplt[3];
1768 }
1769 }
1770};
1771const parsePropertyValue = (propValue, propType) => {
1772 // ensure this value is of the correct prop type
1773 if (propValue != null && !isComplexType(propValue)) {
1774 if (BUILD.propBoolean && propType & 4 /* Boolean */) {
1775 // per the HTML spec, any string value means it is a boolean true value
1776 // but we'll cheat here and say that the string "false" is the boolean false
1777 return propValue === 'false' ? false : propValue === '' || !!propValue;
1778 }
1779 if (BUILD.propNumber && propType & 2 /* Number */) {
1780 // force it to be a number
1781 return parseFloat(propValue);
1782 }
1783 if (BUILD.propString && propType & 1 /* String */) {
1784 // could have been passed as a number or boolean
1785 // but we still want it as a string
1786 return String(propValue);
1787 }
1788 // redundant return here for better minification
1789 return propValue;
1790 }
1791 // not sure exactly what type we want
1792 // so no need to change to a different type
1793 return propValue;
1794};
1795const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
1796const setValue = (ref, propName, newVal, cmpMeta) => {
1797 // check our new property value against our internal value
1798 const hostRef = getHostRef(ref);
1799 const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
1800 const oldVal = hostRef.$instanceValues$.get(propName);
1801 const flags = hostRef.$flags$;
1802 const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
1803 newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
1804 if ((!BUILD.lazyLoad || !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) {
1805 // gadzooks! the property's value has changed!!
1806 // set our new value!
1807 hostRef.$instanceValues$.set(propName, newVal);
1808 if (BUILD.isDev) {
1809 if (hostRef.$flags$ & 1024 /* devOnRender */) {
1810 consoleDevWarn(`The state/prop "${propName}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
1811 }
1812 else if (hostRef.$flags$ & 2048 /* devOnDidLoad */) {
1813 consoleDevWarn(`The state/prop "${propName}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`, '\nElement', elm, '\nNew value', newVal, '\nOld value', oldVal);
1814 }
1815 }
1816 if (!BUILD.lazyLoad || instance) {
1817 // get an array of method names of watch functions to call
1818 if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128 /* isWatchReady */) {
1819 const watchMethods = cmpMeta.$watchers$[propName];
1820 if (watchMethods) {
1821 // this instance is watching for when this property changed
1822 watchMethods.map(watchMethodName => {
1823 try {
1824 // fire off each of the watch methods that are watching this property
1825 instance[watchMethodName](newVal, oldVal, propName);
1826 }
1827 catch (e) {
1828 consoleError(e);
1829 }
1830 });
1831 }
1832 }
1833 if (BUILD.updatable && (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
1834 if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
1835 if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
1836 return;
1837 }
1838 }
1839 // looks like this value actually changed, so we've got work to do!
1840 // but only if we've already rendered, otherwise just chill out
1841 // queue that we need to do an update, but don't worry about queuing
1842 // up millions cuz this function ensures it only runs once
1843 scheduleUpdate(hostRef, false);
1844 }
1845 }
1846 }
1847};
1848const proxyComponent = (Cstr, cmpMeta, flags) => {
1849 if (BUILD.member && cmpMeta.$members$) {
1850 if (BUILD.watchCallback && Cstr.watchers) {
1851 cmpMeta.$watchers$ = Cstr.watchers;
1852 }
1853 // It's better to have a const than two Object.entries()
1854 const members = Object.entries(cmpMeta.$members$);
1855 const prototype = Cstr.prototype;
1856 members.map(([memberName, [memberFlags]]) => {
1857 if ((BUILD.prop || BUILD.state) && (memberFlags & 31 /* Prop */ || ((!BUILD.lazyLoad || flags & 2 /* proxyState */) && memberFlags & 32 /* State */))) {
1858 // proxyComponent - prop
1859 Object.defineProperty(prototype, memberName, {
1860 get() {
1861 // proxyComponent, get value
1862 return getValue(this, memberName);
1863 },
1864 set(newValue) {
1865 if (
1866 // only during dev time
1867 BUILD.isDev &&
1868 // we are proxing the instance (not element)
1869 (flags & 1 /* isElementConstructor */) === 0 &&
1870 // the member is a non-mutable prop
1871 (memberFlags & (31 /* Prop */ | 1024 /* Mutable */)) === 31 /* Prop */) {
1872 consoleDevWarn(`@Prop() "${memberName}" on "${cmpMeta.$tagName$}" cannot be modified.\nFurther information: https://stenciljs.com/docs/properties#prop-mutability`);
1873 }
1874 // proxyComponent, set value
1875 setValue(this, memberName, newValue, cmpMeta);
1876 },
1877 configurable: true,
1878 enumerable: true,
1879 });
1880 }
1881 else if (BUILD.lazyLoad && BUILD.method && flags & 1 /* isElementConstructor */ && memberFlags & 64 /* Method */) {
1882 // proxyComponent - method
1883 Object.defineProperty(prototype, memberName, {
1884 value(...args) {
1885 const ref = getHostRef(this);
1886 return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
1887 },
1888 });
1889 }
1890 });
1891 if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1 /* isElementConstructor */)) {
1892 const attrNameToPropName = new Map();
1893 prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
1894 plt.jmp(() => {
1895 const propName = attrNameToPropName.get(attrName);
1896 this[propName] = newValue === null && typeof this[propName] === 'boolean' ? false : newValue;
1897 });
1898 };
1899 // create an array of attributes to observe
1900 // and also create a map of html attribute name to js property name
1901 Cstr.observedAttributes = members
1902 .filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
1903 .map(([propName, m]) => {
1904 const attrName = m[1] || propName;
1905 attrNameToPropName.set(attrName, propName);
1906 if (BUILD.reflect && m[0] & 512 /* ReflectAttr */) {
1907 cmpMeta.$attrsToReflect$.push([propName, attrName]);
1908 }
1909 return attrName;
1910 });
1911 }
1912 }
1913 return Cstr;
1914};
1915const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
1916 // initializeComponent
1917 if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) && (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
1918 if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
1919 // we haven't initialized this element yet
1920 hostRef.$flags$ |= 32 /* hasInitializedComponent */;
1921 // lazy loaded components
1922 // request the component's implementation to be
1923 // wired up with the host element
1924 Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
1925 if (Cstr.then) {
1926 // Await creates a micro-task avoid if possible
1927 const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
1928 Cstr = await Cstr;
1929 endLoad();
1930 }
1931 if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
1932 throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
1933 }
1934 if (BUILD.member && !Cstr.isProxied) {
1935 // we'eve never proxied this Constructor before
1936 // let's add the getters/setters to its prototype before
1937 // the first time we create an instance of the implementation
1938 if (BUILD.watchCallback) {
1939 cmpMeta.$watchers$ = Cstr.watchers;
1940 }
1941 proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
1942 Cstr.isProxied = true;
1943 }
1944 const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
1945 // ok, time to construct the instance
1946 // but let's keep track of when we start and stop
1947 // so that the getters/setters don't incorrectly step on data
1948 if (BUILD.member) {
1949 hostRef.$flags$ |= 8 /* isConstructingInstance */;
1950 }
1951 // construct the lazy-loaded component implementation
1952 // passing the hostRef is very important during
1953 // construction in order to directly wire together the
1954 // host element and the lazy-loaded instance
1955 try {
1956 new Cstr(hostRef);
1957 }
1958 catch (e) {
1959 consoleError(e);
1960 }
1961 if (BUILD.member) {
1962 hostRef.$flags$ &= ~8 /* isConstructingInstance */;
1963 }
1964 if (BUILD.watchCallback) {
1965 hostRef.$flags$ |= 128 /* isWatchReady */;
1966 }
1967 endNewInstance();
1968 fireConnectedCallback(hostRef.$lazyInstance$);
1969 }
1970 else {
1971 // sync constructor component
1972 Cstr = elm.constructor;
1973 hostRef.$flags$ |= 128 /* isWatchReady */ | 32 /* hasInitializedComponent */;
1974 }
1975 if (BUILD.style && Cstr.style) {
1976 // this component has styles but we haven't registered them yet
1977 let style = Cstr.style;
1978 if (BUILD.mode && typeof style !== 'string') {
1979 style = style[(hostRef.$modeName$ = computeMode(elm))];
1980 if (BUILD.hydrateServerSide && hostRef.$modeName$) {
1981 elm.setAttribute('s-mode', hostRef.$modeName$);
1982 }
1983 }
1984 const scopeId = getScopeId(cmpMeta, hostRef.$modeName$);
1985 if (!styles.has(scopeId)) {
1986 const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
1987 if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
1988 style = await import('./shadow-css-656edb73.js').then(m => m.scopeCss(style, scopeId, false));
1989 }
1990 registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
1991 endRegisterStyles();
1992 }
1993 }
1994 }
1995 // we've successfully created a lazy instance
1996 const ancestorComponent = hostRef.$ancestorComponent$;
1997 const schedule = () => scheduleUpdate(hostRef, true);
1998 if (BUILD.asyncLoading && ancestorComponent && ancestorComponent['s-rc']) {
1999 // this is the intial load and this component it has an ancestor component
2000 // but the ancestor component has NOT fired its will update lifecycle yet
2001 // so let's just cool our jets and wait for the ancestor to continue first
2002 // this will get fired off when the ancestor component
2003 // finally gets around to rendering its lazy self
2004 // fire off the initial update
2005 ancestorComponent['s-rc'].push(schedule);
2006 }
2007 else {
2008 schedule();
2009 }
2010};
2011const fireConnectedCallback = (instance) => {
2012 if (BUILD.lazyLoad && BUILD.connectedCallback) {
2013 safeCall(instance, 'connectedCallback');
2014 }
2015};
2016const connectedCallback = (elm) => {
2017 if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2018 const hostRef = getHostRef(elm);
2019 const cmpMeta = hostRef.$cmpMeta$;
2020 const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
2021 if (BUILD.hostListenerTargetParent) {
2022 // only run if we have listeners being attached to a parent
2023 addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
2024 }
2025 if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
2026 // first time this component has connected
2027 hostRef.$flags$ |= 1 /* hasConnected */;
2028 let hostId;
2029 if (BUILD.hydrateClientSide) {
2030 hostId = elm.getAttribute(HYDRATE_ID);
2031 if (hostId) {
2032 if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2033 const scopeId = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute('s-mode')) : addStyle(elm.shadowRoot, cmpMeta);
2034 elm.classList.remove(scopeId + '-h', scopeId + '-s');
2035 }
2036 initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
2037 }
2038 }
2039 if (BUILD.slotRelocation && !hostId) {
2040 // initUpdate
2041 // if the slot polyfill is required we'll need to put some nodes
2042 // in here to act as original content anchors as we move nodes around
2043 // host element has been connected to the DOM
2044 if (BUILD.hydrateServerSide || ((BUILD.slot || BUILD.shadowDom) && cmpMeta.$flags$ & (4 /* hasSlotRelocation */ | 8 /* needsShadowDomShim */))) {
2045 setContentReference(elm);
2046 }
2047 }
2048 if (BUILD.asyncLoading) {
2049 // find the first ancestor component (if there is one) and register
2050 // this component as one of the actively loading child components for its ancestor
2051 let ancestorComponent = elm;
2052 while ((ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host)) {
2053 // climb up the ancestors looking for the first
2054 // component that hasn't finished its lifecycle update yet
2055 if ((BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 /* ElementNode */ && ancestorComponent.hasAttribute('s-id') && ancestorComponent['s-p']) ||
2056 ancestorComponent['s-p']) {
2057 // we found this components first ancestor component
2058 // keep a reference to this component's ancestor component
2059 attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
2060 break;
2061 }
2062 }
2063 }
2064 // Lazy properties
2065 // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
2066 if (BUILD.prop && BUILD.lazyLoad && !BUILD.hydrateServerSide && cmpMeta.$members$) {
2067 Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
2068 if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
2069 const value = elm[memberName];
2070 delete elm[memberName];
2071 elm[memberName] = value;
2072 }
2073 });
2074 }
2075 if (BUILD.initializeNextTick) {
2076 // connectedCallback, taskQueue, initialLoad
2077 // angular sets attribute AFTER connectCallback
2078 // https://github.com/angular/angular/issues/18909
2079 // https://github.com/angular/angular/issues/19940
2080 nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
2081 }
2082 else {
2083 initializeComponent(elm, hostRef, cmpMeta);
2084 }
2085 }
2086 else {
2087 // not the first time this has connected
2088 // reattach any event listeners to the host
2089 // since they would have been removed when disconnected
2090 addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2091 // fire off connectedCallback() on component instance
2092 fireConnectedCallback(hostRef.$lazyInstance$);
2093 }
2094 endConnected();
2095 }
2096};
2097const setContentReference = (elm) => {
2098 // only required when we're NOT using native shadow dom (slot)
2099 // or this browser doesn't support native shadow dom
2100 // and this host element was NOT created with SSR
2101 // let's pick out the inner content for slot projection
2102 // create a node to represent where the original
2103 // content was first placed, which is useful later on
2104 const contentRefElm = (elm['s-cr'] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : ''));
2105 contentRefElm['s-cn'] = true;
2106 elm.insertBefore(contentRefElm, elm.firstChild);
2107};
2108const disconnectedCallback = (elm) => {
2109 if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
2110 const hostRef = getHostRef(elm);
2111 const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
2112 if (BUILD.hostListener) {
2113 if (hostRef.$rmListeners$) {
2114 hostRef.$rmListeners$.map(rmListener => rmListener());
2115 hostRef.$rmListeners$ = undefined;
2116 }
2117 }
2118 // clear CSS var-shim tracking
2119 if (BUILD.cssVarShim && plt.$cssShim$) {
2120 plt.$cssShim$.removeHost(elm);
2121 }
2122 if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
2123 safeCall(instance, 'disconnectedCallback');
2124 }
2125 if (BUILD.cmpDidUnload) {
2126 safeCall(instance, 'componentDidUnload');
2127 }
2128 }
2129};
2130const defineCustomElement = (Cstr, compactMeta) => {
2131 customElements.define(compactMeta[1], proxyCustomElement(Cstr, compactMeta));
2132};
2133const proxyCustomElement = (Cstr, compactMeta) => {
2134 const cmpMeta = {
2135 $flags$: compactMeta[0],
2136 $tagName$: compactMeta[1],
2137 };
2138 if (BUILD.member) {
2139 cmpMeta.$members$ = compactMeta[2];
2140 }
2141 if (BUILD.hostListener) {
2142 cmpMeta.$listeners$ = compactMeta[3];
2143 }
2144 if (BUILD.watchCallback) {
2145 cmpMeta.$watchers$ = Cstr.$watchers$;
2146 }
2147 if (BUILD.reflect) {
2148 cmpMeta.$attrsToReflect$ = [];
2149 }
2150 if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2151 cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2152 }
2153 const originalConnectedCallback = Cstr.prototype.connectedCallback;
2154 const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
2155 Object.assign(Cstr.prototype, {
2156 __registerHost() {
2157 registerHost(this, cmpMeta);
2158 },
2159 connectedCallback() {
2160 connectedCallback(this);
2161 if (BUILD.connectedCallback && originalConnectedCallback) {
2162 originalConnectedCallback.call(this);
2163 }
2164 },
2165 disconnectedCallback() {
2166 disconnectedCallback(this);
2167 if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
2168 originalDisconnectedCallback.call(this);
2169 }
2170 },
2171 });
2172 Cstr.is = cmpMeta.$tagName$;
2173 return proxyComponent(Cstr, cmpMeta, 1 /* isElementConstructor */ | 2 /* proxyState */);
2174};
2175const forceModeUpdate = (elm) => {
2176 if (BUILD.style && BUILD.mode && !BUILD.lazyLoad) {
2177 const mode = computeMode(elm);
2178 const hostRef = getHostRef(elm);
2179 if (hostRef.$modeName$ !== mode) {
2180 const cmpMeta = hostRef.$cmpMeta$;
2181 const oldScopeId = elm['s-sc'];
2182 const scopeId = getScopeId(cmpMeta, mode);
2183 const style = elm.constructor.style[mode];
2184 const flags = cmpMeta.$flags$;
2185 if (style) {
2186 if (!styles.has(scopeId)) {
2187 registerStyle(scopeId, style, !!(flags & 1 /* shadowDomEncapsulation */));
2188 }
2189 hostRef.$modeName$ = mode;
2190 elm.classList.remove(oldScopeId + '-h', oldScopeId + '-s');
2191 attachStyles(hostRef);
2192 forceUpdate(elm);
2193 }
2194 }
2195 }
2196};
2197const attachShadow = (el) => {
2198 if (supportsShadow) {
2199 el.attachShadow({ mode: 'open' });
2200 }
2201 else {
2202 el.shadowRoot = el;
2203 }
2204};
2205const hmrStart = (elm, cmpMeta, hmrVersionId) => {
2206 // ¯\_(ツ)_/¯
2207 const hostRef = getHostRef(elm);
2208 // reset state flags to only have been connected
2209 hostRef.$flags$ = 1 /* hasConnected */;
2210 // TODO
2211 // detatch any event listeners that may have been added
2212 // because we're not passing an exact event name it'll
2213 // remove all of this element's event, which is good
2214 // create a callback for when this component finishes hmr
2215 elm['s-hmr-load'] = () => {
2216 // finished hmr for this element
2217 delete elm['s-hmr-load'];
2218 };
2219 // re-initialize the component
2220 initializeComponent(elm, hostRef, cmpMeta, hmrVersionId);
2221};
2222const patchCloneNode = (HostElementPrototype) => {
2223 const orgCloneNode = HostElementPrototype.cloneNode;
2224 HostElementPrototype.cloneNode = function (deep) {
2225 const srcNode = this;
2226 const isShadowDom = BUILD.shadowDom ? srcNode.shadowRoot && supportsShadow : false;
2227 const clonedNode = orgCloneNode.call(srcNode, isShadowDom ? deep : false);
2228 if (BUILD.slot && !isShadowDom && deep) {
2229 let i = 0;
2230 let slotted;
2231 for (; i < srcNode.childNodes.length; i++) {
2232 slotted = srcNode.childNodes[i]['s-nr'];
2233 if (slotted) {
2234 if (BUILD.appendChildSlotFix && clonedNode.__appendChild) {
2235 clonedNode.__appendChild(slotted.cloneNode(true));
2236 }
2237 else {
2238 clonedNode.appendChild(slotted.cloneNode(true));
2239 }
2240 }
2241 }
2242 }
2243 return clonedNode;
2244 };
2245};
2246const patchSlotAppendChild = (HostElementPrototype) => {
2247 HostElementPrototype.__appendChild = HostElementPrototype.appendChild;
2248 HostElementPrototype.appendChild = function (newChild) {
2249 const slotName = (newChild['s-sn'] = getSlotName(newChild));
2250 const slotNode = getHostSlotNode(this.childNodes, slotName);
2251 if (slotNode) {
2252 const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2253 const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2254 return appendAfter.parentNode.insertBefore(newChild, appendAfter.nextSibling);
2255 }
2256 return this.__appendChild(newChild);
2257 };
2258};
2259const patchChildSlotNodes = (elm, cmpMeta) => {
2260 class FakeNodeList extends Array {
2261 item(n) {
2262 return this[n];
2263 }
2264 }
2265 if (cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
2266 const childNodesFn = elm.__lookupGetter__('childNodes');
2267 Object.defineProperty(elm, 'children', {
2268 get() {
2269 return this.childNodes.map((n) => n.nodeType === 1);
2270 },
2271 });
2272 Object.defineProperty(elm, 'childElementCount', {
2273 get() {
2274 return elm.children.length;
2275 },
2276 });
2277 Object.defineProperty(elm, 'childNodes', {
2278 get() {
2279 const childNodes = childNodesFn.call(this);
2280 if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0 && getHostRef(this).$flags$ & 2 /* hasRendered */) {
2281 const result = new FakeNodeList();
2282 for (let i = 0; i < childNodes.length; i++) {
2283 const slot = childNodes[i]['s-nr'];
2284 if (slot) {
2285 result.push(slot);
2286 }
2287 }
2288 return result;
2289 }
2290 return FakeNodeList.from(childNodes);
2291 },
2292 });
2293 }
2294};
2295const getSlotName = (node) => node['s-sn'] || (node.nodeType === 1 && node.getAttribute('slot')) || '';
2296const getHostSlotNode = (childNodes, slotName) => {
2297 let i = 0;
2298 let childNode;
2299 for (; i < childNodes.length; i++) {
2300 childNode = childNodes[i];
2301 if (childNode['s-sr'] && childNode['s-sn'] === slotName) {
2302 return childNode;
2303 }
2304 childNode = getHostSlotNode(childNode.childNodes, slotName);
2305 if (childNode) {
2306 return childNode;
2307 }
2308 }
2309 return null;
2310};
2311const getHostSlotChildNodes = (n, slotName) => {
2312 const childNodes = [n];
2313 while ((n = n.nextSibling) && n['s-sn'] === slotName) {
2314 childNodes.push(n);
2315 }
2316 return childNodes;
2317};
2318const bootstrapLazy = (lazyBundles, options = {}) => {
2319 if (BUILD.profile && performance.mark) {
2320 performance.mark('st:app:start');
2321 }
2322 installDevTools();
2323 const endBootstrap = createTime('bootstrapLazy');
2324 const cmpTags = [];
2325 const exclude = options.exclude || [];
2326 const customElements = win.customElements;
2327 const head = doc.head;
2328 const metaCharset = /*@__PURE__*/ head.querySelector('meta[charset]');
2329 const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
2330 const deferredConnectedCallbacks = [];
2331 const styles = /*@__PURE__*/ doc.querySelectorAll(`[${HYDRATED_STYLE_ID}]`);
2332 let appLoadFallback;
2333 let isBootstrapping = true;
2334 let i = 0;
2335 Object.assign(plt, options);
2336 plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
2337 if (BUILD.asyncQueue) {
2338 if (options.syncQueue) {
2339 plt.$flags$ |= 4 /* queueSync */;
2340 }
2341 }
2342 if (BUILD.hydrateClientSide) {
2343 // If the app is already hydrated there is not point to disable the
2344 // async queue. This will improve the first input delay
2345 plt.$flags$ |= 2 /* appLoaded */;
2346 }
2347 if (BUILD.hydrateClientSide && BUILD.shadowDom) {
2348 for (; i < styles.length; i++) {
2349 registerStyle(styles[i].getAttribute(HYDRATED_STYLE_ID), convertScopedToShadow(styles[i].innerHTML), true);
2350 }
2351 }
2352 lazyBundles.map(lazyBundle => lazyBundle[1].map(compactMeta => {
2353 const cmpMeta = {
2354 $flags$: compactMeta[0],
2355 $tagName$: compactMeta[1],
2356 $members$: compactMeta[2],
2357 $listeners$: compactMeta[3],
2358 };
2359 if (BUILD.member) {
2360 cmpMeta.$members$ = compactMeta[2];
2361 }
2362 if (BUILD.hostListener) {
2363 cmpMeta.$listeners$ = compactMeta[3];
2364 }
2365 if (BUILD.reflect) {
2366 cmpMeta.$attrsToReflect$ = [];
2367 }
2368 if (BUILD.watchCallback) {
2369 cmpMeta.$watchers$ = {};
2370 }
2371 if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2372 cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
2373 }
2374 const tagName = BUILD.transformTagName && options.transformTagName ? options.transformTagName(cmpMeta.$tagName$) : cmpMeta.$tagName$;
2375 const HostElement = class extends HTMLElement {
2376 // StencilLazyHost
2377 constructor(self) {
2378 // @ts-ignore
2379 super(self);
2380 self = this;
2381 registerHost(self, cmpMeta);
2382 if (BUILD.shadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
2383 // this component is using shadow dom
2384 // and this browser supports shadow dom
2385 // add the read-only property "shadowRoot" to the host element
2386 // adding the shadow root build conditionals to minimize runtime
2387 if (supportsShadow) {
2388 if (BUILD.shadowDelegatesFocus) {
2389 self.attachShadow({
2390 mode: 'open',
2391 delegatesFocus: !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */),
2392 });
2393 }
2394 else {
2395 self.attachShadow({ mode: 'open' });
2396 }
2397 }
2398 else if (!BUILD.hydrateServerSide && !('shadowRoot' in self)) {
2399 self.shadowRoot = self;
2400 }
2401 }
2402 if (BUILD.slotChildNodesFix) {
2403 patchChildSlotNodes(self, cmpMeta);
2404 }
2405 }
2406 connectedCallback() {
2407 if (appLoadFallback) {
2408 clearTimeout(appLoadFallback);
2409 appLoadFallback = null;
2410 }
2411 if (isBootstrapping) {
2412 // connectedCallback will be processed once all components have been registered
2413 deferredConnectedCallbacks.push(this);
2414 }
2415 else {
2416 plt.jmp(() => connectedCallback(this));
2417 }
2418 }
2419 disconnectedCallback() {
2420 plt.jmp(() => disconnectedCallback(this));
2421 }
2422 forceUpdate() {
2423 if (BUILD.isDev) {
2424 consoleDevWarn(`element.forceUpdate() is deprecated, use the "forceUpdate" function from "@stencil/core" instead:
2425
2426 import { forceUpdate } from ‘@stencil/core’;
2427
2428 forceUpdate(this);
2429 forceUpdate(element);`);
2430 }
2431 forceUpdate(this);
2432 }
2433 componentOnReady() {
2434 return getHostRef(this).$onReadyPromise$;
2435 }
2436 };
2437 if (BUILD.cloneNodeFix) {
2438 patchCloneNode(HostElement.prototype);
2439 }
2440 if (BUILD.appendChildSlotFix) {
2441 patchSlotAppendChild(HostElement.prototype);
2442 }
2443 if (BUILD.hotModuleReplacement) {
2444 HostElement.prototype['s-hmr'] = function (hmrVersionId) {
2445 hmrStart(this, cmpMeta, hmrVersionId);
2446 };
2447 }
2448 cmpMeta.$lazyBundleId$ = lazyBundle[0];
2449 if (!exclude.includes(tagName) && !customElements.get(tagName)) {
2450 cmpTags.push(tagName);
2451 customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
2452 }
2453 }));
2454 if (BUILD.hydratedClass || BUILD.hydratedAttribute) {
2455 visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS;
2456 visibilityStyle.setAttribute('data-styles', '');
2457 head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild);
2458 }
2459 // Process deferred connectedCallbacks now all components have been registered
2460 isBootstrapping = false;
2461 if (deferredConnectedCallbacks.length) {
2462 deferredConnectedCallbacks.map(host => host.connectedCallback());
2463 }
2464 else {
2465 if (BUILD.profile) {
2466 plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30, 'timeout')));
2467 }
2468 else {
2469 plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30)));
2470 }
2471 }
2472 // Fallback appLoad event
2473 endBootstrap();
2474};
2475const getAssetPath = (path) => {
2476 const assetUrl = new URL(path, plt.$resourcesUrl$);
2477 return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
2478};
2479const getConnect = (_ref, tagName) => {
2480 const componentOnReady = () => {
2481 let elm = doc.querySelector(tagName);
2482 if (!elm) {
2483 elm = doc.createElement(tagName);
2484 doc.body.appendChild(elm);
2485 }
2486 return typeof elm.componentOnReady === 'function' ? elm.componentOnReady() : Promise.resolve(elm);
2487 };
2488 const create = (...args) => {
2489 return componentOnReady().then(el => el.create(...args));
2490 };
2491 return {
2492 create,
2493 componentOnReady,
2494 };
2495};
2496const getContext = (_elm, context) => {
2497 if (context in Context) {
2498 return Context[context];
2499 }
2500 else if (context === 'window') {
2501 return win;
2502 }
2503 else if (context === 'document') {
2504 return doc;
2505 }
2506 else if (context === 'isServer' || context === 'isPrerender') {
2507 return BUILD.hydrateServerSide ? true : false;
2508 }
2509 else if (context === 'isClient') {
2510 return BUILD.hydrateServerSide ? false : true;
2511 }
2512 else if (context === 'resourcesUrl' || context === 'publicPath') {
2513 return getAssetPath('.');
2514 }
2515 else if (context === 'queue') {
2516 return {
2517 write: writeTask,
2518 read: readTask,
2519 tick: {
2520 then(cb) {
2521 return nextTick(cb);
2522 },
2523 },
2524 };
2525 }
2526 return undefined;
2527};
2528const insertVdomAnnotations = (doc, staticComponents) => {
2529 if (doc != null) {
2530 const docData = {
2531 hostIds: 0,
2532 rootLevelIds: 0,
2533 staticComponents: new Set(staticComponents),
2534 };
2535 const orgLocationNodes = [];
2536 parseVNodeAnnotations(doc, doc.body, docData, orgLocationNodes);
2537 orgLocationNodes.forEach(orgLocationNode => {
2538 if (orgLocationNode != null) {
2539 const nodeRef = orgLocationNode['s-nr'];
2540 let hostId = nodeRef['s-host-id'];
2541 let nodeId = nodeRef['s-node-id'];
2542 let childId = `${hostId}.${nodeId}`;
2543 if (hostId == null) {
2544 hostId = 0;
2545 docData.rootLevelIds++;
2546 nodeId = docData.rootLevelIds;
2547 childId = `${hostId}.${nodeId}`;
2548 if (nodeRef.nodeType === 1 /* ElementNode */) {
2549 nodeRef.setAttribute(HYDRATE_CHILD_ID, childId);
2550 }
2551 else if (nodeRef.nodeType === 3 /* TextNode */) {
2552 if (hostId === 0) {
2553 const textContent = nodeRef.nodeValue.trim();
2554 if (textContent === '') {
2555 // useless whitespace node at the document root
2556 orgLocationNode.remove();
2557 return;
2558 }
2559 }
2560 const commentBeforeTextNode = doc.createComment(childId);
2561 commentBeforeTextNode.nodeValue = `${TEXT_NODE_ID}.${childId}`;
2562 nodeRef.parentNode.insertBefore(commentBeforeTextNode, nodeRef);
2563 }
2564 }
2565 let orgLocationNodeId = `${ORG_LOCATION_ID}.${childId}`;
2566 const orgLocationParentNode = orgLocationNode.parentElement;
2567 if (orgLocationParentNode) {
2568 if (orgLocationParentNode['s-en'] === '') {
2569 // ending with a "." means that the parent element
2570 // of this node's original location is a SHADOW dom element
2571 // and this node is apart of the root level light dom
2572 orgLocationNodeId += `.`;
2573 }
2574 else if (orgLocationParentNode['s-en'] === 'c') {
2575 // ending with a ".c" means that the parent element
2576 // of this node's original location is a SCOPED element
2577 // and this node is apart of the root level light dom
2578 orgLocationNodeId += `.c`;
2579 }
2580 }
2581 orgLocationNode.nodeValue = orgLocationNodeId;
2582 }
2583 });
2584 }
2585};
2586const parseVNodeAnnotations = (doc, node, docData, orgLocationNodes) => {
2587 if (node == null) {
2588 return;
2589 }
2590 if (node['s-nr'] != null) {
2591 orgLocationNodes.push(node);
2592 }
2593 if (node.nodeType === 1 /* ElementNode */) {
2594 node.childNodes.forEach(childNode => {
2595 const hostRef = getHostRef(childNode);
2596 if (hostRef != null && !docData.staticComponents.has(childNode.nodeName.toLowerCase())) {
2597 const cmpData = {
2598 nodeIds: 0,
2599 };
2600 insertVNodeAnnotations(doc, childNode, hostRef.$vnode$, docData, cmpData);
2601 }
2602 parseVNodeAnnotations(doc, childNode, docData, orgLocationNodes);
2603 });
2604 }
2605};
2606const insertVNodeAnnotations = (doc, hostElm, vnode, docData, cmpData) => {
2607 if (vnode != null) {
2608 const hostId = ++docData.hostIds;
2609 hostElm.setAttribute(HYDRATE_ID, hostId);
2610 if (hostElm['s-cr'] != null) {
2611 hostElm['s-cr'].nodeValue = `${CONTENT_REF_ID}.${hostId}`;
2612 }
2613 if (vnode.$children$ != null) {
2614 const depth = 0;
2615 vnode.$children$.forEach((vnodeChild, index) => {
2616 insertChildVNodeAnnotations(doc, vnodeChild, cmpData, hostId, depth, index);
2617 });
2618 }
2619 if (hostElm && vnode && vnode.$elm$ && !hostElm.hasAttribute('c-id')) {
2620 const parent = hostElm.parentElement;
2621 if (parent && parent.childNodes) {
2622 const parentChildNodes = Array.from(parent.childNodes);
2623 const comment = parentChildNodes.find(node => node.nodeType === 8 /* CommentNode */ && node['s-sr']);
2624 if (comment) {
2625 const index = parentChildNodes.indexOf(hostElm) - 1;
2626 vnode.$elm$.setAttribute(HYDRATE_CHILD_ID, `${comment['s-host-id']}.${comment['s-node-id']}.0.${index}`);
2627 }
2628 }
2629 }
2630 }
2631};
2632const insertChildVNodeAnnotations = (doc, vnodeChild, cmpData, hostId, depth, index) => {
2633 const childElm = vnodeChild.$elm$;
2634 if (childElm == null) {
2635 return;
2636 }
2637 const nodeId = cmpData.nodeIds++;
2638 const childId = `${hostId}.${nodeId}.${depth}.${index}`;
2639 childElm['s-host-id'] = hostId;
2640 childElm['s-node-id'] = nodeId;
2641 if (childElm.nodeType === 1 /* ElementNode */) {
2642 childElm.setAttribute(HYDRATE_CHILD_ID, childId);
2643 }
2644 else if (childElm.nodeType === 3 /* TextNode */) {
2645 const parentNode = childElm.parentNode;
2646 if (parentNode.nodeName !== 'STYLE') {
2647 const textNodeId = `${TEXT_NODE_ID}.${childId}`;
2648 const commentBeforeTextNode = doc.createComment(textNodeId);
2649 parentNode.insertBefore(commentBeforeTextNode, childElm);
2650 }
2651 }
2652 else if (childElm.nodeType === 8 /* CommentNode */) {
2653 if (childElm['s-sr']) {
2654 const slotName = childElm['s-sn'] || '';
2655 const slotNodeId = `${SLOT_NODE_ID}.${childId}.${slotName}`;
2656 childElm.nodeValue = slotNodeId;
2657 }
2658 }
2659 if (vnodeChild.$children$ != null) {
2660 const childDepth = depth + 1;
2661 vnodeChild.$children$.forEach((vnode, index) => {
2662 insertChildVNodeAnnotations(doc, vnode, cmpData, hostId, childDepth, index);
2663 });
2664 }
2665};
2666const hostRefs = new WeakMap();
2667const getHostRef = (ref) => hostRefs.get(ref);
2668const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef);
2669const registerHost = (elm, cmpMeta) => {
2670 const hostRef = {
2671 $flags$: 0,
2672 $hostElement$: elm,
2673 $cmpMeta$: cmpMeta,
2674 $instanceValues$: new Map(),
2675 };
2676 if (BUILD.isDev) {
2677 hostRef.$renderCount$ = 0;
2678 }
2679 if (BUILD.method && BUILD.lazyLoad) {
2680 hostRef.$onInstancePromise$ = new Promise(r => (hostRef.$onInstanceResolve$ = r));
2681 }
2682 if (BUILD.asyncLoading) {
2683 hostRef.$onReadyPromise$ = new Promise(r => (hostRef.$onReadyResolve$ = r));
2684 elm['s-p'] = [];
2685 elm['s-rc'] = [];
2686 }
2687 addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
2688 return hostRefs.set(elm, hostRef);
2689};
2690const isMemberInElement = (elm, memberName) => memberName in elm;
2691const STENCIL_DEV_MODE = BUILD.isTesting
2692 ? ['STENCIL:'] // E2E testing
2693 : ['%cstencil', 'color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px'];
2694const consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
2695const consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
2696const consoleDevInfo = (...m) => console.info(...STENCIL_DEV_MODE, ...m);
2697const consoleError = (e) => console.error(e);
2698const cmpModules = /*@__PURE__*/ new Map();
2699const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
2700 // loadModuleImport
2701 const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
2702 const bundleId = cmpMeta.$lazyBundleId$;
2703 if (BUILD.isDev && typeof bundleId !== 'string') {
2704 consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
2705 return undefined;
2706 }
2707 const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
2708 if (module) {
2709 return module[exportName];
2710 }
2711 return import(
2712 /* webpackInclude: /\.entry\.js$/ */
2713 /* webpackExclude: /\.system\.entry\.js$/ */
2714 /* webpackMode: "lazy" */
2715 `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? '?s-hmr=' + hmrVersionId : ''}`).then(importedModule => {
2716 if (!BUILD.hotModuleReplacement) {
2717 cmpModules.set(bundleId, importedModule);
2718 }
2719 return importedModule[exportName];
2720 }, consoleError);
2721};
2722const styles = new Map();
2723const modeResolutionChain = [];
2724const queueDomReads = [];
2725const queueDomWrites = [];
2726const queueDomWritesLow = [];
2727const queueTask = (queue, write) => (cb) => {
2728 queue.push(cb);
2729 if (!queuePending) {
2730 queuePending = true;
2731 if (write && plt.$flags$ & 4 /* queueSync */) {
2732 nextTick(flush);
2733 }
2734 else {
2735 plt.raf(flush);
2736 }
2737 }
2738};
2739const consume = (queue) => {
2740 for (let i = 0; i < queue.length; i++) {
2741 try {
2742 queue[i](performance.now());
2743 }
2744 catch (e) {
2745 consoleError(e);
2746 }
2747 }
2748 queue.length = 0;
2749};
2750const consumeTimeout = (queue, timeout) => {
2751 let i = 0;
2752 let ts = 0;
2753 while (i < queue.length && (ts = performance.now()) < timeout) {
2754 try {
2755 queue[i++](ts);
2756 }
2757 catch (e) {
2758 consoleError(e);
2759 }
2760 }
2761 if (i === queue.length) {
2762 queue.length = 0;
2763 }
2764 else if (i !== 0) {
2765 queue.splice(0, i);
2766 }
2767};
2768const flush = () => {
2769 if (BUILD.asyncQueue) {
2770 queueCongestion++;
2771 }
2772 // always force a bunch of medium callbacks to run, but still have
2773 // a throttle on how many can run in a certain time
2774 // DOM READS!!!
2775 consume(queueDomReads);
2776 // DOM WRITES!!!
2777 if (BUILD.asyncQueue) {
2778 const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0)) : Infinity;
2779 consumeTimeout(queueDomWrites, timeout);
2780 consumeTimeout(queueDomWritesLow, timeout);
2781 if (queueDomWrites.length > 0) {
2782 queueDomWritesLow.push(...queueDomWrites);
2783 queueDomWrites.length = 0;
2784 }
2785 if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) {
2786 // still more to do yet, but we've run out of time
2787 // let's let this thing cool off and try again in the next tick
2788 plt.raf(flush);
2789 }
2790 else {
2791 queueCongestion = 0;
2792 }
2793 }
2794 else {
2795 consume(queueDomWrites);
2796 if ((queuePending = queueDomReads.length > 0)) {
2797 // still more to do yet, but we've run out of time
2798 // let's let this thing cool off and try again in the next tick
2799 plt.raf(flush);
2800 }
2801 }
2802};
2803const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb);
2804const readTask = /*@__PURE__*/ queueTask(queueDomReads, false);
2805const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
2806const Build = {
2807 isDev: BUILD.isDev ? true : false,
2808 isBrowser: true,
2809 isServer: false,
2810 isTesting: BUILD.isTesting ? true : false,
2811};
2812
2813export { BUILD as B, CSS as C, H, NAMESPACE as N, promiseResolve as a, bootstrapLazy as b, consoleDevInfo as c, doc as d, Host as e, h, plt as p, registerInstance as r, win as w };