1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945 |
- // node_modules/@stencil/core/internal/app-data/index.js
- var BUILD = {
- allRenderFn: false,
- cmpDidLoad: true,
- cmpDidUnload: false,
- cmpDidUpdate: true,
- cmpDidRender: true,
- cmpWillLoad: true,
- cmpWillUpdate: true,
- cmpWillRender: true,
- connectedCallback: true,
- disconnectedCallback: true,
- element: true,
- event: true,
- hasRenderFn: true,
- lifecycle: true,
- hostListener: true,
- hostListenerTargetWindow: true,
- hostListenerTargetDocument: true,
- hostListenerTargetBody: true,
- hostListenerTargetParent: false,
- hostListenerTarget: true,
- member: true,
- method: true,
- mode: true,
- observeAttribute: true,
- prop: true,
- propMutable: true,
- reflect: true,
- scoped: true,
- shadowDom: true,
- slot: true,
- cssAnnotations: true,
- state: true,
- style: true,
- svg: true,
- updatable: true,
- vdomAttribute: true,
- vdomXlink: true,
- vdomClass: true,
- vdomFunctional: true,
- vdomKey: true,
- vdomListener: true,
- vdomRef: true,
- vdomPropOrAttr: true,
- vdomRender: true,
- vdomStyle: true,
- vdomText: true,
- watchCallback: true,
- taskQueue: true,
- hotModuleReplacement: false,
- isDebug: false,
- isDev: false,
- isTesting: false,
- hydrateServerSide: false,
- hydrateClientSide: false,
- lifecycleDOMEvents: false,
- lazyLoad: false,
- profile: false,
- slotRelocation: true,
- appendChildSlotFix: false,
- cloneNodeFix: false,
- hydratedAttribute: false,
- hydratedClass: true,
- safari10: false,
- scriptDataOpts: false,
- scopedSlotTextContentFix: false,
- shadowDomShim: false,
- slotChildNodesFix: false,
- invisiblePrehydration: true,
- propBoolean: true,
- propNumber: true,
- propString: true,
- cssVarShim: false,
- constructableCSS: true,
- cmpShouldUpdate: true,
- devTools: false,
- dynamicImportShim: false,
- shadowDelegatesFocus: true,
- initializeNextTick: false,
- asyncLoading: false,
- asyncQueue: false,
- transformTagName: false,
- attachStyles: true
- };
- var NAMESPACE = "app";
- // node_modules/@stencil/core/internal/client/index.js
- var scopeId;
- var contentRef;
- var hostTagName;
- var customError;
- var i = 0;
- var useNativeShadowDom = false;
- var checkSlotFallbackVisibility = false;
- var checkSlotRelocate = false;
- var isSvgMode = false;
- var renderingRef = null;
- var queueCongestion = 0;
- var queuePending = false;
- var win = typeof window !== "undefined" ? window : {};
- var CSS = BUILD.cssVarShim ? win.CSS : null;
- var doc = win.document || { head: {} };
- var H = win.HTMLElement || class {
- };
- var plt = {
- $flags$: 0,
- $resourcesUrl$: "",
- jmp: (h2) => h2(),
- raf: (h2) => requestAnimationFrame(h2),
- ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
- rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
- ce: (eventName, opts) => new CustomEvent(eventName, opts)
- };
- var supportsShadow = BUILD.shadowDomShim && BUILD.shadowDom ? (() => (doc.head.attachShadow + "").indexOf("[native") > -1)() : true;
- var supportsListenerOptions = (() => {
- let supportsListenerOptions2 = false;
- try {
- doc.addEventListener("e", null, Object.defineProperty({}, "passive", {
- get() {
- supportsListenerOptions2 = true;
- }
- }));
- } catch (e) {
- }
- return supportsListenerOptions2;
- })();
- var promiseResolve = (v) => Promise.resolve(v);
- var supportsConstructibleStylesheets = BUILD.constructableCSS ? (() => {
- try {
- new CSSStyleSheet();
- return typeof new CSSStyleSheet().replace === "function";
- } catch (e) {
- }
- return false;
- })() : false;
- var addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => {
- if (BUILD.hostListener && listeners) {
- if (BUILD.hostListenerTargetParent) {
- if (attachParentListeners) {
- listeners = listeners.filter(([flags]) => flags & 32);
- } else {
- listeners = listeners.filter(([flags]) => !(flags & 32));
- }
- }
- listeners.map(([flags, name, method]) => {
- const target = BUILD.hostListenerTarget ? getHostListenerTarget(elm, flags) : elm;
- const handler = hostListenerProxy(hostRef, method);
- const opts = hostListenerOpts(flags);
- plt.ael(target, name, handler, opts);
- (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts));
- });
- }
- };
- var hostListenerProxy = (hostRef, methodName) => (ev) => {
- try {
- if (BUILD.lazyLoad) {
- if (hostRef.$flags$ & 256) {
- hostRef.$lazyInstance$[methodName](ev);
- } else {
- (hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || []).push([methodName, ev]);
- }
- } else {
- hostRef.$hostElement$[methodName](ev);
- }
- } catch (e) {
- consoleError(e);
- }
- };
- var getHostListenerTarget = (elm, flags) => {
- if (BUILD.hostListenerTargetDocument && flags & 4)
- return doc;
- if (BUILD.hostListenerTargetWindow && flags & 8)
- return win;
- if (BUILD.hostListenerTargetBody && flags & 16)
- return doc.body;
- if (BUILD.hostListenerTargetParent && flags & 32)
- return elm.parentElement;
- return elm;
- };
- var hostListenerOpts = (flags) => supportsListenerOptions ? {
- passive: (flags & 1) !== 0,
- capture: (flags & 2) !== 0
- } : (flags & 2) !== 0;
- var CONTENT_REF_ID = "r";
- var ORG_LOCATION_ID = "o";
- var SLOT_NODE_ID = "s";
- var TEXT_NODE_ID = "t";
- var HYDRATE_ID = "s-id";
- var HYDRATED_STYLE_ID = "sty-id";
- var HYDRATE_CHILD_ID = "c-id";
- var XLINK_NS = "http://www.w3.org/1999/xlink";
- var createTime = (fnName, tagName = "") => {
- if (BUILD.profile && performance.mark) {
- const key = `st:${fnName}:${tagName}:${i++}`;
- performance.mark(key);
- return () => performance.measure(`[Stencil] ${fnName}() <${tagName}>`, key);
- } else {
- return () => {
- return;
- };
- }
- };
- var uniqueTime = (key, measureText) => {
- if (BUILD.profile && performance.mark) {
- if (performance.getEntriesByName(key).length === 0) {
- performance.mark(key);
- }
- return () => {
- if (performance.getEntriesByName(measureText).length === 0) {
- performance.measure(measureText, key);
- }
- };
- } else {
- return () => {
- return;
- };
- }
- };
- var rootAppliedStyles = new WeakMap();
- var registerStyle = (scopeId2, cssText, allowCS) => {
- let style = styles.get(scopeId2);
- if (supportsConstructibleStylesheets && allowCS) {
- style = style || new CSSStyleSheet();
- style.replace(cssText);
- } else {
- style = cssText;
- }
- styles.set(scopeId2, style);
- };
- var addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
- let scopeId2 = getScopeId(cmpMeta, mode);
- let style = styles.get(scopeId2);
- if (!BUILD.attachStyles) {
- return scopeId2;
- }
- styleContainerNode = styleContainerNode.nodeType === 11 ? styleContainerNode : doc;
- if (style) {
- if (typeof style === "string") {
- styleContainerNode = styleContainerNode.head || styleContainerNode;
- let appliedStyles = rootAppliedStyles.get(styleContainerNode);
- let styleElm;
- if (!appliedStyles) {
- rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
- }
- if (!appliedStyles.has(scopeId2)) {
- if (BUILD.hydrateClientSide && styleContainerNode.host && (styleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`))) {
- styleElm.innerHTML = style;
- } else {
- if (BUILD.cssVarShim && plt.$cssShim$) {
- styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId2, style, !!(cmpMeta.$flags$ & 10));
- const newScopeId = styleElm["s-sc"];
- if (newScopeId) {
- scopeId2 = newScopeId;
- appliedStyles = null;
- }
- } else {
- styleElm = doc.createElement("style");
- styleElm.innerHTML = style;
- }
- if (BUILD.hydrateServerSide || BUILD.hotModuleReplacement) {
- styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
- }
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
- }
- if (appliedStyles) {
- appliedStyles.add(scopeId2);
- }
- }
- } else if (BUILD.constructableCSS && !styleContainerNode.adoptedStyleSheets.includes(style)) {
- styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, style];
- }
- }
- return scopeId2;
- };
- var attachStyles = (hostRef) => {
- const cmpMeta = hostRef.$cmpMeta$;
- const elm = hostRef.$hostElement$;
- const flags = cmpMeta.$flags$;
- const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
- const scopeId2 = addStyle(BUILD.shadowDom && supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm);
- if ((BUILD.shadowDom || BUILD.scoped) && BUILD.cssAnnotations && flags & 10) {
- elm["s-sc"] = scopeId2;
- elm.classList.add(scopeId2 + "-h");
- if (BUILD.scoped && flags & 2) {
- elm.classList.add(scopeId2 + "-s");
- }
- }
- endAttachStyles();
- };
- var getScopeId = (cmp, mode) => "sc-" + (BUILD.mode && mode && cmp.$flags$ & 32 ? cmp.$tagName$ + "-" + mode : cmp.$tagName$);
- var computeMode = (elm) => modeResolutionChain.map((h2) => h2(elm)).find((m) => !!m);
- var EMPTY_OBJ = {};
- var SVG_NS = "http://www.w3.org/2000/svg";
- var HTML_NS = "http://www.w3.org/1999/xhtml";
- var isDef = (v) => v != null;
- var isComplexType = (o) => {
- o = typeof o;
- return o === "object" || o === "function";
- };
- var h = (nodeName, vnodeData, ...children) => {
- let child = null;
- let key = null;
- let slotName = null;
- let simple = false;
- let lastSimple = false;
- let vNodeChildren = [];
- const walk = (c) => {
- for (let i2 = 0; i2 < c.length; i2++) {
- child = c[i2];
- if (Array.isArray(child)) {
- walk(child);
- } else if (child != null && typeof child !== "boolean") {
- if (simple = typeof nodeName !== "function" && !isComplexType(child)) {
- child = String(child);
- } else if (BUILD.isDev && typeof nodeName !== "function" && child.$flags$ === void 0) {
- consoleDevError(`vNode passed as children has unexpected type.
- Make sure it's using the correct h() function.
- Empty objects can also be the cause, look for JSX comments that became objects.`);
- }
- if (simple && lastSimple) {
- vNodeChildren[vNodeChildren.length - 1].$text$ += child;
- } else {
- vNodeChildren.push(simple ? newVNode(null, child) : child);
- }
- lastSimple = simple;
- }
- }
- };
- walk(children);
- if (vnodeData) {
- if (BUILD.isDev && nodeName === "input") {
- validateInputProperties(vnodeData);
- }
- if (BUILD.vdomKey && vnodeData.key) {
- key = vnodeData.key;
- }
- if (BUILD.slotRelocation && vnodeData.name) {
- slotName = vnodeData.name;
- }
- if (BUILD.vdomClass) {
- const classData = vnodeData.className || vnodeData.class;
- if (classData) {
- vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" ");
- }
- }
- }
- if (BUILD.isDev && vNodeChildren.some(isHost)) {
- consoleDevError(`The <Host> must be the single root component. Make sure:
- - You are NOT using hostData() and <Host> in the same component.
- - <Host> is used once, and it's the single root component of the render() function.`);
- }
- if (BUILD.vdomFunctional && typeof nodeName === "function") {
- return nodeName(vnodeData === null ? {} : vnodeData, vNodeChildren, vdomFnUtils);
- }
- const vnode = newVNode(nodeName, null);
- vnode.$attrs$ = vnodeData;
- if (vNodeChildren.length > 0) {
- vnode.$children$ = vNodeChildren;
- }
- if (BUILD.vdomKey) {
- vnode.$key$ = key;
- }
- if (BUILD.slotRelocation) {
- vnode.$name$ = slotName;
- }
- return vnode;
- };
- var newVNode = (tag, text) => {
- const vnode = {
- $flags$: 0,
- $tag$: tag,
- $text$: text,
- $elm$: null,
- $children$: null
- };
- if (BUILD.vdomAttribute) {
- vnode.$attrs$ = null;
- }
- if (BUILD.vdomKey) {
- vnode.$key$ = null;
- }
- if (BUILD.slotRelocation) {
- vnode.$name$ = null;
- }
- return vnode;
- };
- var Host = {};
- var isHost = (node) => node && node.$tag$ === Host;
- var vdomFnUtils = {
- forEach: (children, cb) => children.map(convertToPublic).forEach(cb),
- map: (children, cb) => children.map(convertToPublic).map(cb).map(convertToPrivate)
- };
- var convertToPublic = (node) => ({
- vattrs: node.$attrs$,
- vchildren: node.$children$,
- vkey: node.$key$,
- vname: node.$name$,
- vtag: node.$tag$,
- vtext: node.$text$
- });
- var convertToPrivate = (node) => {
- if (typeof node.vtag === "function") {
- const vnodeData = Object.assign({}, node.vattrs);
- if (node.vkey) {
- vnodeData.key = node.vkey;
- }
- if (node.vname) {
- vnodeData.name = node.vname;
- }
- return h(node.vtag, vnodeData, ...node.vchildren || []);
- }
- const vnode = newVNode(node.vtag, node.vtext);
- vnode.$attrs$ = node.vattrs;
- vnode.$children$ = node.vchildren;
- vnode.$key$ = node.vkey;
- vnode.$name$ = node.vname;
- return vnode;
- };
- var validateInputProperties = (inputElm) => {
- const props = Object.keys(inputElm);
- const value = props.indexOf("value");
- if (value === -1) {
- return;
- }
- const typeIndex = props.indexOf("type");
- const minIndex = props.indexOf("min");
- const maxIndex = props.indexOf("max");
- const stepIndex = props.indexOf("step");
- if (value < typeIndex || value < minIndex || value < maxIndex || value < stepIndex) {
- consoleDevWarn(`The "value" prop of <input> should be set after "min", "max", "type" and "step"`);
- }
- };
- var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
- if (oldValue !== newValue) {
- let isProp = isMemberInElement(elm, memberName);
- let ln = memberName.toLowerCase();
- if (BUILD.vdomClass && memberName === "class") {
- const classList = elm.classList;
- const oldClasses = parseClassList(oldValue);
- const newClasses = parseClassList(newValue);
- classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
- classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
- } else if (BUILD.vdomStyle && memberName === "style") {
- if (BUILD.updatable) {
- for (const prop in oldValue) {
- if (!newValue || newValue[prop] == null) {
- if (!BUILD.hydrateServerSide && prop.includes("-")) {
- elm.style.removeProperty(prop);
- } else {
- elm.style[prop] = "";
- }
- }
- }
- }
- for (const prop in newValue) {
- if (!oldValue || newValue[prop] !== oldValue[prop]) {
- if (!BUILD.hydrateServerSide && prop.includes("-")) {
- elm.style.setProperty(prop, newValue[prop]);
- } else {
- elm.style[prop] = newValue[prop];
- }
- }
- }
- } else if (BUILD.vdomKey && memberName === "key")
- ;
- else if (BUILD.vdomRef && memberName === "ref") {
- if (newValue) {
- newValue(elm);
- }
- } else if (BUILD.vdomListener && (BUILD.lazyLoad ? !isProp : !elm.__lookupSetter__(memberName)) && memberName[0] === "o" && memberName[1] === "n") {
- if (memberName[2] === "-") {
- memberName = memberName.slice(3);
- } else if (isMemberInElement(win, ln)) {
- memberName = ln.slice(2);
- } else {
- memberName = ln[2] + memberName.slice(3);
- }
- if (oldValue) {
- plt.rel(elm, memberName, oldValue, false);
- }
- if (newValue) {
- plt.ael(elm, memberName, newValue, false);
- }
- } else if (BUILD.vdomPropOrAttr) {
- const isComplex = isComplexType(newValue);
- if ((isProp || isComplex && newValue !== null) && !isSvg) {
- try {
- if (!elm.tagName.includes("-")) {
- let n = newValue == null ? "" : newValue;
- if (memberName === "list") {
- isProp = false;
- } else if (oldValue == null || elm[memberName] != n) {
- elm[memberName] = n;
- }
- } else {
- elm[memberName] = newValue;
- }
- } catch (e) {
- }
- }
- let xlink = false;
- if (BUILD.vdomXlink) {
- if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) {
- memberName = ln;
- xlink = true;
- }
- }
- if (newValue == null || newValue === false) {
- if (newValue !== false || elm.getAttribute(memberName) === "") {
- if (BUILD.vdomXlink && xlink) {
- elm.removeAttributeNS(XLINK_NS, memberName);
- } else {
- elm.removeAttribute(memberName);
- }
- }
- } else if ((!isProp || flags & 4 || isSvg) && !isComplex) {
- newValue = newValue === true ? "" : newValue;
- if (BUILD.vdomXlink && xlink) {
- elm.setAttributeNS(XLINK_NS, memberName, newValue);
- } else {
- elm.setAttribute(memberName, newValue);
- }
- }
- }
- }
- };
- var parseClassListRegex = /\s/;
- var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex);
- var updateElement = (oldVnode, newVnode, isSvgMode2, memberName) => {
- const elm = newVnode.$elm$.nodeType === 11 && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
- const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ;
- const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
- if (BUILD.updatable) {
- for (memberName in oldVnodeAttrs) {
- if (!(memberName in newVnodeAttrs)) {
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$);
- }
- }
- }
- for (memberName in newVnodeAttrs) {
- setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$);
- }
- };
- var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
- let newVNode2 = newParentVNode.$children$[childIndex];
- let i2 = 0;
- let elm;
- let childNode;
- let oldVNode;
- if (BUILD.slotRelocation && !useNativeShadowDom) {
- checkSlotRelocate = true;
- if (newVNode2.$tag$ === "slot") {
- if (scopeId) {
- parentElm.classList.add(scopeId + "-s");
- }
- newVNode2.$flags$ |= newVNode2.$children$ ? 2 : 1;
- }
- }
- if (BUILD.isDev && newVNode2.$elm$) {
- consoleDevError(`The JSX ${newVNode2.$text$ !== null ? `"${newVNode2.$text$}" text` : `"${newVNode2.$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`);
- }
- if (BUILD.vdomText && newVNode2.$text$ !== null) {
- elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$);
- } else if (BUILD.slotRelocation && newVNode2.$flags$ & 1) {
- elm = newVNode2.$elm$ = BUILD.isDebug || BUILD.hydrateServerSide ? slotReferenceDebugNode(newVNode2) : doc.createTextNode("");
- } else {
- if (BUILD.svg && !isSvgMode) {
- isSvgMode = newVNode2.$tag$ === "svg";
- }
- elm = newVNode2.$elm$ = BUILD.svg ? doc.createElementNS(isSvgMode ? SVG_NS : HTML_NS, BUILD.slotRelocation && newVNode2.$flags$ & 2 ? "slot-fb" : newVNode2.$tag$) : doc.createElement(BUILD.slotRelocation && newVNode2.$flags$ & 2 ? "slot-fb" : newVNode2.$tag$);
- if (BUILD.svg && isSvgMode && newVNode2.$tag$ === "foreignObject") {
- isSvgMode = false;
- }
- if (BUILD.vdomAttribute) {
- updateElement(null, newVNode2, isSvgMode);
- }
- if ((BUILD.shadowDom || BUILD.scoped) && isDef(scopeId) && elm["s-si"] !== scopeId) {
- elm.classList.add(elm["s-si"] = scopeId);
- }
- if (newVNode2.$children$) {
- for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
- childNode = createElm(oldParentVNode, newVNode2, i2, elm);
- if (childNode) {
- elm.appendChild(childNode);
- }
- }
- }
- if (BUILD.svg) {
- if (newVNode2.$tag$ === "svg") {
- isSvgMode = false;
- } else if (elm.tagName === "foreignObject") {
- isSvgMode = true;
- }
- }
- }
- if (BUILD.slotRelocation) {
- elm["s-hn"] = hostTagName;
- if (newVNode2.$flags$ & (2 | 1)) {
- elm["s-sr"] = true;
- elm["s-cr"] = contentRef;
- elm["s-sn"] = newVNode2.$name$ || "";
- oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
- if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
- putBackInOriginalLocation(oldParentVNode.$elm$, false);
- }
- }
- }
- return elm;
- };
- var putBackInOriginalLocation = (parentElm, recursive) => {
- plt.$flags$ |= 1;
- const oldSlotChildNodes = parentElm.childNodes;
- for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) {
- const childNode = oldSlotChildNodes[i2];
- if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) {
- parentReferenceNode(childNode).insertBefore(childNode, referenceNode(childNode));
- childNode["s-ol"].remove();
- childNode["s-ol"] = void 0;
- checkSlotRelocate = true;
- }
- if (recursive) {
- putBackInOriginalLocation(childNode, recursive);
- }
- }
- plt.$flags$ &= ~1;
- };
- var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
- let containerElm = BUILD.slotRelocation && parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
- let childNode;
- if (BUILD.shadowDom && containerElm.shadowRoot && containerElm.tagName === hostTagName) {
- containerElm = containerElm.shadowRoot;
- }
- for (; startIdx <= endIdx; ++startIdx) {
- if (vnodes[startIdx]) {
- childNode = createElm(null, parentVNode, startIdx, parentElm);
- if (childNode) {
- vnodes[startIdx].$elm$ = childNode;
- containerElm.insertBefore(childNode, BUILD.slotRelocation ? referenceNode(before) : before);
- }
- }
- }
- };
- var removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
- for (; startIdx <= endIdx; ++startIdx) {
- if (vnode = vnodes[startIdx]) {
- elm = vnode.$elm$;
- callNodeRefs(vnode);
- if (BUILD.slotRelocation) {
- checkSlotFallbackVisibility = true;
- if (elm["s-ol"]) {
- elm["s-ol"].remove();
- } else {
- putBackInOriginalLocation(elm, true);
- }
- }
- elm.remove();
- }
- }
- };
- var updateChildren = (parentElm, oldCh, newVNode2, newCh) => {
- let oldStartIdx = 0;
- let newStartIdx = 0;
- let idxInOld = 0;
- let i2 = 0;
- let oldEndIdx = oldCh.length - 1;
- let oldStartVnode = oldCh[0];
- let oldEndVnode = oldCh[oldEndIdx];
- let newEndIdx = newCh.length - 1;
- let newStartVnode = newCh[0];
- let newEndVnode = newCh[newEndIdx];
- let node;
- let elmToMove;
- while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
- if (oldStartVnode == null) {
- oldStartVnode = oldCh[++oldStartIdx];
- } else if (oldEndVnode == null) {
- oldEndVnode = oldCh[--oldEndIdx];
- } else if (newStartVnode == null) {
- newStartVnode = newCh[++newStartIdx];
- } else if (newEndVnode == null) {
- newEndVnode = newCh[--newEndIdx];
- } else if (isSameVnode(oldStartVnode, newStartVnode)) {
- patch(oldStartVnode, newStartVnode);
- oldStartVnode = oldCh[++oldStartIdx];
- newStartVnode = newCh[++newStartIdx];
- } else if (isSameVnode(oldEndVnode, newEndVnode)) {
- patch(oldEndVnode, newEndVnode);
- oldEndVnode = oldCh[--oldEndIdx];
- newEndVnode = newCh[--newEndIdx];
- } else if (isSameVnode(oldStartVnode, newEndVnode)) {
- if (BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
- putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false);
- }
- patch(oldStartVnode, newEndVnode);
- parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
- oldStartVnode = oldCh[++oldStartIdx];
- newEndVnode = newCh[--newEndIdx];
- } else if (isSameVnode(oldEndVnode, newStartVnode)) {
- if (BUILD.slotRelocation && (oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) {
- putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false);
- }
- patch(oldEndVnode, newStartVnode);
- parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
- oldEndVnode = oldCh[--oldEndIdx];
- newStartVnode = newCh[++newStartIdx];
- } else {
- idxInOld = -1;
- if (BUILD.vdomKey) {
- for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) {
- if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) {
- idxInOld = i2;
- break;
- }
- }
- }
- if (BUILD.vdomKey && idxInOld >= 0) {
- elmToMove = oldCh[idxInOld];
- if (elmToMove.$tag$ !== newStartVnode.$tag$) {
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld, parentElm);
- } else {
- patch(elmToMove, newStartVnode);
- oldCh[idxInOld] = void 0;
- node = elmToMove.$elm$;
- }
- newStartVnode = newCh[++newStartIdx];
- } else {
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx, parentElm);
- newStartVnode = newCh[++newStartIdx];
- }
- if (node) {
- if (BUILD.slotRelocation) {
- parentReferenceNode(oldStartVnode.$elm$).insertBefore(node, referenceNode(oldStartVnode.$elm$));
- } else {
- oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
- }
- }
- }
- }
- if (oldStartIdx > oldEndIdx) {
- addVnodes(parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode2, newCh, newStartIdx, newEndIdx);
- } else if (BUILD.updatable && newStartIdx > newEndIdx) {
- removeVnodes(oldCh, oldStartIdx, oldEndIdx);
- }
- };
- var isSameVnode = (vnode1, vnode2) => {
- if (vnode1.$tag$ === vnode2.$tag$) {
- if (BUILD.slotRelocation && vnode1.$tag$ === "slot") {
- return vnode1.$name$ === vnode2.$name$;
- }
- if (BUILD.vdomKey) {
- return vnode1.$key$ === vnode2.$key$;
- }
- return true;
- }
- return false;
- };
- var referenceNode = (node) => {
- return node && node["s-ol"] || node;
- };
- var parentReferenceNode = (node) => (node["s-ol"] ? node["s-ol"] : node).parentNode;
- var patch = (oldVNode, newVNode2) => {
- const elm = newVNode2.$elm$ = oldVNode.$elm$;
- const oldChildren = oldVNode.$children$;
- const newChildren = newVNode2.$children$;
- const tag = newVNode2.$tag$;
- const text = newVNode2.$text$;
- let defaultHolder;
- if (!BUILD.vdomText || text === null) {
- if (BUILD.svg) {
- isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode;
- }
- if (BUILD.vdomAttribute || BUILD.reflect) {
- if (BUILD.slot && tag === "slot")
- ;
- else {
- updateElement(oldVNode, newVNode2, isSvgMode);
- }
- }
- if (BUILD.updatable && oldChildren !== null && newChildren !== null) {
- updateChildren(elm, oldChildren, newVNode2, newChildren);
- } else if (newChildren !== null) {
- if (BUILD.updatable && BUILD.vdomText && oldVNode.$text$ !== null) {
- elm.textContent = "";
- }
- addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1);
- } else if (BUILD.updatable && oldChildren !== null) {
- removeVnodes(oldChildren, 0, oldChildren.length - 1);
- }
- if (BUILD.svg && isSvgMode && tag === "svg") {
- isSvgMode = false;
- }
- } else if (BUILD.vdomText && BUILD.slotRelocation && (defaultHolder = elm["s-cr"])) {
- defaultHolder.parentNode.textContent = text;
- } else if (BUILD.vdomText && oldVNode.$text$ !== text) {
- elm.data = text;
- }
- };
- var updateFallbackSlotVisibility = (elm) => {
- let childNodes = elm.childNodes;
- let childNode;
- let i2;
- let ilen;
- let j;
- let slotNameAttr;
- let nodeType;
- for (i2 = 0, ilen = childNodes.length; i2 < ilen; i2++) {
- childNode = childNodes[i2];
- if (childNode.nodeType === 1) {
- if (childNode["s-sr"]) {
- slotNameAttr = childNode["s-sn"];
- childNode.hidden = false;
- for (j = 0; j < ilen; j++) {
- nodeType = childNodes[j].nodeType;
- if (childNodes[j]["s-hn"] !== childNode["s-hn"] || slotNameAttr !== "") {
- if (nodeType === 1 && slotNameAttr === childNodes[j].getAttribute("slot")) {
- childNode.hidden = true;
- break;
- }
- } else {
- if (nodeType === 1 || nodeType === 3 && childNodes[j].textContent.trim() !== "") {
- childNode.hidden = true;
- break;
- }
- }
- }
- }
- updateFallbackSlotVisibility(childNode);
- }
- }
- };
- var relocateNodes = [];
- var relocateSlotContent = (elm) => {
- let childNode;
- let node;
- let hostContentNodes;
- let slotNameAttr;
- let relocateNodeData;
- let j;
- let i2 = 0;
- let childNodes = elm.childNodes;
- let ilen = childNodes.length;
- for (; i2 < ilen; i2++) {
- childNode = childNodes[i2];
- if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) {
- hostContentNodes = node.parentNode.childNodes;
- slotNameAttr = childNode["s-sn"];
- for (j = hostContentNodes.length - 1; j >= 0; j--) {
- node = hostContentNodes[j];
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"]) {
- if (isNodeLocatedInSlot(node, slotNameAttr)) {
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
- checkSlotFallbackVisibility = true;
- node["s-sn"] = node["s-sn"] || slotNameAttr;
- if (relocateNodeData) {
- relocateNodeData.$slotRefNode$ = childNode;
- } else {
- relocateNodes.push({
- $slotRefNode$: childNode,
- $nodeToRelocate$: node
- });
- }
- if (node["s-sr"]) {
- relocateNodes.map((relocateNode) => {
- if (isNodeLocatedInSlot(relocateNode.$nodeToRelocate$, node["s-sn"])) {
- relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
- if (relocateNodeData && !relocateNode.$slotRefNode$) {
- relocateNode.$slotRefNode$ = relocateNodeData.$slotRefNode$;
- }
- }
- });
- }
- } else if (!relocateNodes.some((r) => r.$nodeToRelocate$ === node)) {
- relocateNodes.push({
- $nodeToRelocate$: node
- });
- }
- }
- }
- }
- if (childNode.nodeType === 1) {
- relocateSlotContent(childNode);
- }
- }
- };
- var isNodeLocatedInSlot = (nodeToRelocate, slotNameAttr) => {
- if (nodeToRelocate.nodeType === 1) {
- if (nodeToRelocate.getAttribute("slot") === null && slotNameAttr === "") {
- return true;
- }
- if (nodeToRelocate.getAttribute("slot") === slotNameAttr) {
- return true;
- }
- return false;
- }
- if (nodeToRelocate["s-sn"] === slotNameAttr) {
- return true;
- }
- return slotNameAttr === "";
- };
- var callNodeRefs = (vNode) => {
- if (BUILD.vdomRef) {
- vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null);
- vNode.$children$ && vNode.$children$.map(callNodeRefs);
- }
- };
- var renderVdom = (hostRef, renderFnResults) => {
- const hostElm = hostRef.$hostElement$;
- const cmpMeta = hostRef.$cmpMeta$;
- const oldVNode = hostRef.$vnode$ || newVNode(null, null);
- const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
- hostTagName = hostElm.tagName;
- if (BUILD.isDev && Array.isArray(renderFnResults) && renderFnResults.some(isHost)) {
- throw new Error(`The <Host> must be the single root component.
- Looks like the render() function of "${hostTagName.toLowerCase()}" is returning an array that contains the <Host>.
- The render() function should look like this instead:
- render() {
- // Do not return an array
- return (
- <Host>{content}</Host>
- );
- }
- `);
- }
- if (BUILD.reflect && cmpMeta.$attrsToReflect$) {
- rootVnode.$attrs$ = rootVnode.$attrs$ || {};
- cmpMeta.$attrsToReflect$.map(([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName]);
- }
- rootVnode.$tag$ = null;
- rootVnode.$flags$ |= 4;
- hostRef.$vnode$ = rootVnode;
- rootVnode.$elm$ = oldVNode.$elm$ = BUILD.shadowDom ? hostElm.shadowRoot || hostElm : hostElm;
- if (BUILD.scoped || BUILD.shadowDom) {
- scopeId = hostElm["s-sc"];
- }
- if (BUILD.slotRelocation) {
- contentRef = hostElm["s-cr"];
- useNativeShadowDom = supportsShadow && (cmpMeta.$flags$ & 1) !== 0;
- checkSlotFallbackVisibility = false;
- }
- patch(oldVNode, rootVnode);
- if (BUILD.slotRelocation) {
- plt.$flags$ |= 1;
- if (checkSlotRelocate) {
- relocateSlotContent(rootVnode.$elm$);
- let relocateData;
- let nodeToRelocate;
- let orgLocationNode;
- let parentNodeRef;
- let insertBeforeNode;
- let refNode;
- let i2 = 0;
- for (; i2 < relocateNodes.length; i2++) {
- relocateData = relocateNodes[i2];
- nodeToRelocate = relocateData.$nodeToRelocate$;
- if (!nodeToRelocate["s-ol"]) {
- orgLocationNode = BUILD.isDebug || BUILD.hydrateServerSide ? originalLocationDebugNode(nodeToRelocate) : doc.createTextNode("");
- orgLocationNode["s-nr"] = nodeToRelocate;
- nodeToRelocate.parentNode.insertBefore(nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate);
- }
- }
- for (i2 = 0; i2 < relocateNodes.length; i2++) {
- relocateData = relocateNodes[i2];
- nodeToRelocate = relocateData.$nodeToRelocate$;
- if (relocateData.$slotRefNode$) {
- parentNodeRef = relocateData.$slotRefNode$.parentNode;
- insertBeforeNode = relocateData.$slotRefNode$.nextSibling;
- orgLocationNode = nodeToRelocate["s-ol"];
- while (orgLocationNode = orgLocationNode.previousSibling) {
- refNode = orgLocationNode["s-nr"];
- if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) {
- refNode = refNode.nextSibling;
- if (!refNode || !refNode["s-nr"]) {
- insertBeforeNode = refNode;
- break;
- }
- }
- }
- if (!insertBeforeNode && parentNodeRef !== nodeToRelocate.parentNode || nodeToRelocate.nextSibling !== insertBeforeNode) {
- if (nodeToRelocate !== insertBeforeNode) {
- if (!nodeToRelocate["s-hn"] && nodeToRelocate["s-ol"]) {
- nodeToRelocate["s-hn"] = nodeToRelocate["s-ol"].parentNode.nodeName;
- }
- parentNodeRef.insertBefore(nodeToRelocate, insertBeforeNode);
- }
- }
- } else {
- if (nodeToRelocate.nodeType === 1) {
- nodeToRelocate.hidden = true;
- }
- }
- }
- }
- if (checkSlotFallbackVisibility) {
- updateFallbackSlotVisibility(rootVnode.$elm$);
- }
- plt.$flags$ &= ~1;
- relocateNodes.length = 0;
- }
- };
- var slotReferenceDebugNode = (slotVNode) => doc.createComment(`<slot${slotVNode.$name$ ? ' name="' + slotVNode.$name$ + '"' : ""}> (host=${hostTagName.toLowerCase()})`);
- var originalLocationDebugNode = (nodeToRelocate) => doc.createComment(`org-location for ` + (nodeToRelocate.localName ? `<${nodeToRelocate.localName}> (host=${nodeToRelocate["s-hn"]})` : `[${nodeToRelocate.textContent}]`));
- var getElement = (ref) => BUILD.lazyLoad ? getHostRef(ref).$hostElement$ : ref;
- var createEvent = (ref, name, flags) => {
- const elm = getElement(ref);
- return {
- emit: (detail) => {
- if (BUILD.isDev && !elm.isConnected) {
- consoleDevWarn(`The "${name}" event was emitted, but the dispatcher node is no longer connected to the dom.`);
- }
- return emitEvent(elm, name, {
- bubbles: !!(flags & 4),
- composed: !!(flags & 2),
- cancelable: !!(flags & 1),
- detail
- });
- }
- };
- };
- var emitEvent = (elm, name, opts) => {
- const ev = plt.ce(name, opts);
- elm.dispatchEvent(ev);
- return ev;
- };
- var attachToAncestor = (hostRef, ancestorComponent) => {
- if (BUILD.asyncLoading && ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent["s-p"]) {
- ancestorComponent["s-p"].push(new Promise((r) => hostRef.$onRenderResolve$ = r));
- }
- };
- var scheduleUpdate = (hostRef, isInitialLoad) => {
- if (BUILD.taskQueue && BUILD.updatable) {
- hostRef.$flags$ |= 16;
- }
- if (BUILD.asyncLoading && hostRef.$flags$ & 4) {
- hostRef.$flags$ |= 512;
- return;
- }
- attachToAncestor(hostRef, hostRef.$ancestorComponent$);
- const dispatch = () => dispatchHooks(hostRef, isInitialLoad);
- return BUILD.taskQueue ? writeTask(dispatch) : dispatch();
- };
- var dispatchHooks = (hostRef, isInitialLoad) => {
- const elm = hostRef.$hostElement$;
- const endSchedule = createTime("scheduleUpdate", hostRef.$cmpMeta$.$tagName$);
- const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
- let promise;
- if (isInitialLoad) {
- if (BUILD.lazyLoad && BUILD.hostListener) {
- hostRef.$flags$ |= 256;
- if (hostRef.$queuedListeners$) {
- hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event));
- hostRef.$queuedListeners$ = null;
- }
- }
- emitLifecycleEvent(elm, "componentWillLoad");
- if (BUILD.cmpWillLoad) {
- promise = safeCall(instance, "componentWillLoad");
- }
- } else {
- emitLifecycleEvent(elm, "componentWillUpdate");
- if (BUILD.cmpWillUpdate) {
- promise = safeCall(instance, "componentWillUpdate");
- }
- }
- emitLifecycleEvent(elm, "componentWillRender");
- if (BUILD.cmpWillRender) {
- promise = then(promise, () => safeCall(instance, "componentWillRender"));
- }
- endSchedule();
- return then(promise, () => updateComponent(hostRef, instance, isInitialLoad));
- };
- var updateComponent = async (hostRef, instance, isInitialLoad) => {
- const elm = hostRef.$hostElement$;
- const endUpdate = createTime("update", hostRef.$cmpMeta$.$tagName$);
- const rc = elm["s-rc"];
- if (BUILD.style && isInitialLoad) {
- attachStyles(hostRef);
- }
- const endRender = createTime("render", hostRef.$cmpMeta$.$tagName$);
- if (BUILD.isDev) {
- hostRef.$flags$ |= 1024;
- }
- if (BUILD.hydrateServerSide) {
- await callRender(hostRef, instance, elm);
- } else {
- callRender(hostRef, instance, elm);
- }
- if (BUILD.cssVarShim && plt.$cssShim$) {
- plt.$cssShim$.updateHost(elm);
- }
- if (BUILD.isDev) {
- hostRef.$renderCount$++;
- hostRef.$flags$ &= ~1024;
- }
- if (BUILD.hydrateServerSide) {
- try {
- serverSideConnected(elm);
- if (isInitialLoad) {
- if (hostRef.$cmpMeta$.$flags$ & 1) {
- elm["s-en"] = "";
- } else if (hostRef.$cmpMeta$.$flags$ & 2) {
- elm["s-en"] = "c";
- }
- }
- } catch (e) {
- consoleError(e, elm);
- }
- }
- if (BUILD.asyncLoading && rc) {
- rc.map((cb) => cb());
- elm["s-rc"] = void 0;
- }
- endRender();
- endUpdate();
- if (BUILD.asyncLoading) {
- const childrenPromises = elm["s-p"];
- const postUpdate = () => postUpdateComponent(hostRef);
- if (childrenPromises.length === 0) {
- postUpdate();
- } else {
- Promise.all(childrenPromises).then(postUpdate);
- hostRef.$flags$ |= 4;
- childrenPromises.length = 0;
- }
- } else {
- postUpdateComponent(hostRef);
- }
- };
- var callRender = (hostRef, instance, elm) => {
- const allRenderFn = BUILD.allRenderFn ? true : false;
- const lazyLoad = BUILD.lazyLoad ? true : false;
- const taskQueue = BUILD.taskQueue ? true : false;
- const updatable = BUILD.updatable ? true : false;
- try {
- renderingRef = instance;
- instance = allRenderFn ? instance.render() : instance.render && instance.render();
- if (updatable && taskQueue) {
- hostRef.$flags$ &= ~16;
- }
- if (updatable || lazyLoad) {
- hostRef.$flags$ |= 2;
- }
- if (BUILD.hasRenderFn || BUILD.reflect) {
- if (BUILD.vdomRender || BUILD.reflect) {
- if (BUILD.hydrateServerSide) {
- return Promise.resolve(instance).then((value) => renderVdom(hostRef, value));
- } else {
- renderVdom(hostRef, instance);
- }
- } else {
- elm.textContent = instance;
- }
- }
- } catch (e) {
- consoleError(e, hostRef.$hostElement$);
- }
- renderingRef = null;
- return null;
- };
- var postUpdateComponent = (hostRef) => {
- const tagName = hostRef.$cmpMeta$.$tagName$;
- const elm = hostRef.$hostElement$;
- const endPostUpdate = createTime("postUpdate", tagName);
- const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
- const ancestorComponent = hostRef.$ancestorComponent$;
- if (BUILD.cmpDidRender) {
- if (BUILD.isDev) {
- hostRef.$flags$ |= 1024;
- }
- safeCall(instance, "componentDidRender");
- if (BUILD.isDev) {
- hostRef.$flags$ &= ~1024;
- }
- }
- emitLifecycleEvent(elm, "componentDidRender");
- if (!(hostRef.$flags$ & 64)) {
- hostRef.$flags$ |= 64;
- if (BUILD.asyncLoading && BUILD.cssAnnotations) {
- addHydratedFlag(elm);
- }
- if (BUILD.cmpDidLoad) {
- if (BUILD.isDev) {
- hostRef.$flags$ |= 2048;
- }
- safeCall(instance, "componentDidLoad");
- if (BUILD.isDev) {
- hostRef.$flags$ &= ~2048;
- }
- }
- emitLifecycleEvent(elm, "componentDidLoad");
- endPostUpdate();
- if (BUILD.asyncLoading) {
- hostRef.$onReadyResolve$(elm);
- if (!ancestorComponent) {
- appDidLoad(tagName);
- }
- }
- } else {
- if (BUILD.cmpDidUpdate) {
- if (BUILD.isDev) {
- hostRef.$flags$ |= 1024;
- }
- safeCall(instance, "componentDidUpdate");
- if (BUILD.isDev) {
- hostRef.$flags$ &= ~1024;
- }
- }
- emitLifecycleEvent(elm, "componentDidUpdate");
- endPostUpdate();
- }
- if (BUILD.hotModuleReplacement) {
- elm["s-hmr-load"] && elm["s-hmr-load"]();
- }
- if (BUILD.method && BUILD.lazyLoad) {
- hostRef.$onInstanceResolve$(elm);
- }
- if (BUILD.asyncLoading) {
- if (hostRef.$onRenderResolve$) {
- hostRef.$onRenderResolve$();
- hostRef.$onRenderResolve$ = void 0;
- }
- if (hostRef.$flags$ & 512) {
- nextTick(() => scheduleUpdate(hostRef, false));
- }
- hostRef.$flags$ &= ~(4 | 512);
- }
- };
- var forceUpdate = (ref) => {
- if (BUILD.updatable) {
- const hostRef = getHostRef(ref);
- const isConnected = hostRef.$hostElement$.isConnected;
- if (isConnected && (hostRef.$flags$ & (2 | 16)) === 2) {
- scheduleUpdate(hostRef, false);
- }
- return isConnected;
- }
- return false;
- };
- var appDidLoad = (who) => {
- if (BUILD.cssAnnotations) {
- addHydratedFlag(doc.documentElement);
- }
- if (BUILD.asyncQueue) {
- plt.$flags$ |= 2;
- }
- nextTick(() => emitEvent(win, "appload", { detail: { namespace: NAMESPACE } }));
- if (BUILD.profile && performance.measure) {
- performance.measure(`[Stencil] ${NAMESPACE} initial load (by ${who})`, "st:app:start");
- }
- };
- var safeCall = (instance, method, arg) => {
- if (instance && instance[method]) {
- try {
- return instance[method](arg);
- } catch (e) {
- consoleError(e);
- }
- }
- return void 0;
- };
- var then = (promise, thenFn) => {
- return promise && promise.then ? promise.then(thenFn) : thenFn();
- };
- var emitLifecycleEvent = (elm, lifecycleName) => {
- if (BUILD.lifecycleDOMEvents) {
- emitEvent(elm, "stencil_" + lifecycleName, {
- bubbles: true,
- composed: true,
- detail: {
- namespace: NAMESPACE
- }
- });
- }
- };
- var addHydratedFlag = (elm) => BUILD.hydratedClass ? elm.classList.add("hydrated") : BUILD.hydratedAttribute ? elm.setAttribute("hydrated", "") : void 0;
- var serverSideConnected = (elm) => {
- const children = elm.children;
- if (children != null) {
- for (let i2 = 0, ii = children.length; i2 < ii; i2++) {
- const childElm = children[i2];
- if (typeof childElm.connectedCallback === "function") {
- childElm.connectedCallback();
- }
- serverSideConnected(childElm);
- }
- }
- };
- var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
- const endHydrate = createTime("hydrateClient", tagName);
- const shadowRoot = hostElm.shadowRoot;
- const childRenderNodes = [];
- const slotNodes = [];
- const shadowRootNodes = BUILD.shadowDom && shadowRoot ? [] : null;
- const vnode = hostRef.$vnode$ = newVNode(tagName, null);
- if (!plt.$orgLocNodes$) {
- initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = new Map());
- }
- hostElm[HYDRATE_ID] = hostId;
- hostElm.removeAttribute(HYDRATE_ID);
- clientHydrate(vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId);
- childRenderNodes.map((c) => {
- const orgLocationId = c.$hostId$ + "." + c.$nodeId$;
- const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId);
- const node = c.$elm$;
- if (orgLocationNode && supportsShadow && orgLocationNode["s-en"] === "") {
- orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
- }
- if (!shadowRoot) {
- node["s-hn"] = tagName;
- if (orgLocationNode) {
- node["s-ol"] = orgLocationNode;
- node["s-ol"]["s-nr"] = node;
- }
- }
- plt.$orgLocNodes$.delete(orgLocationId);
- });
- if (BUILD.shadowDom && shadowRoot) {
- shadowRootNodes.map((shadowRootNode) => {
- if (shadowRootNode) {
- shadowRoot.appendChild(shadowRootNode);
- }
- });
- }
- endHydrate();
- };
- var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId) => {
- let childNodeType;
- let childIdSplt;
- let childVNode;
- let i2;
- if (node.nodeType === 1) {
- childNodeType = node.getAttribute(HYDRATE_CHILD_ID);
- if (childNodeType) {
- childIdSplt = childNodeType.split(".");
- if (childIdSplt[0] === hostId || childIdSplt[0] === "0") {
- childVNode = {
- $flags$: 0,
- $hostId$: childIdSplt[0],
- $nodeId$: childIdSplt[1],
- $depth$: childIdSplt[2],
- $index$: childIdSplt[3],
- $tag$: node.tagName.toLowerCase(),
- $elm$: node,
- $attrs$: null,
- $children$: null,
- $key$: null,
- $name$: null,
- $text$: null
- };
- childRenderNodes.push(childVNode);
- node.removeAttribute(HYDRATE_CHILD_ID);
- if (!parentVNode.$children$) {
- parentVNode.$children$ = [];
- }
- parentVNode.$children$[childVNode.$index$] = childVNode;
- parentVNode = childVNode;
- if (shadowRootNodes && childVNode.$depth$ === "0") {
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
- }
- }
- }
- for (i2 = node.childNodes.length - 1; i2 >= 0; i2--) {
- clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.childNodes[i2], hostId);
- }
- if (node.shadowRoot) {
- for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) {
- clientHydrate(parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i2], hostId);
- }
- }
- } else if (node.nodeType === 8) {
- childIdSplt = node.nodeValue.split(".");
- if (childIdSplt[1] === hostId || childIdSplt[1] === "0") {
- childNodeType = childIdSplt[0];
- childVNode = {
- $flags$: 0,
- $hostId$: childIdSplt[1],
- $nodeId$: childIdSplt[2],
- $depth$: childIdSplt[3],
- $index$: childIdSplt[4],
- $elm$: node,
- $attrs$: null,
- $children$: null,
- $key$: null,
- $name$: null,
- $tag$: null,
- $text$: null
- };
- if (childNodeType === TEXT_NODE_ID) {
- childVNode.$elm$ = node.nextSibling;
- if (childVNode.$elm$ && childVNode.$elm$.nodeType === 3) {
- childVNode.$text$ = childVNode.$elm$.textContent;
- childRenderNodes.push(childVNode);
- node.remove();
- if (!parentVNode.$children$) {
- parentVNode.$children$ = [];
- }
- parentVNode.$children$[childVNode.$index$] = childVNode;
- if (shadowRootNodes && childVNode.$depth$ === "0") {
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
- }
- }
- } else if (childVNode.$hostId$ === hostId) {
- if (childNodeType === SLOT_NODE_ID) {
- childVNode.$tag$ = "slot";
- if (childIdSplt[5]) {
- node["s-sn"] = childVNode.$name$ = childIdSplt[5];
- } else {
- node["s-sn"] = "";
- }
- node["s-sr"] = true;
- if (BUILD.shadowDom && shadowRootNodes) {
- childVNode.$elm$ = doc.createElement(childVNode.$tag$);
- if (childVNode.$name$) {
- childVNode.$elm$.setAttribute("name", childVNode.$name$);
- }
- node.parentNode.insertBefore(childVNode.$elm$, node);
- node.remove();
- if (childVNode.$depth$ === "0") {
- shadowRootNodes[childVNode.$index$] = childVNode.$elm$;
- }
- }
- slotNodes.push(childVNode);
- if (!parentVNode.$children$) {
- parentVNode.$children$ = [];
- }
- parentVNode.$children$[childVNode.$index$] = childVNode;
- } else if (childNodeType === CONTENT_REF_ID) {
- if (BUILD.shadowDom && shadowRootNodes) {
- node.remove();
- } else if (BUILD.slotRelocation) {
- hostElm["s-cr"] = node;
- node["s-cn"] = true;
- }
- }
- }
- }
- } else if (parentVNode && parentVNode.$tag$ === "style") {
- const vnode = newVNode(null, node.textContent);
- vnode.$elm$ = node;
- vnode.$index$ = "0";
- parentVNode.$children$ = [vnode];
- }
- };
- var initializeDocumentHydrate = (node, orgLocNodes) => {
- if (node.nodeType === 1) {
- let i2 = 0;
- for (; i2 < node.childNodes.length; i2++) {
- initializeDocumentHydrate(node.childNodes[i2], orgLocNodes);
- }
- if (node.shadowRoot) {
- for (i2 = 0; i2 < node.shadowRoot.childNodes.length; i2++) {
- initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes);
- }
- }
- } else if (node.nodeType === 8) {
- const childIdSplt = node.nodeValue.split(".");
- if (childIdSplt[0] === ORG_LOCATION_ID) {
- orgLocNodes.set(childIdSplt[1] + "." + childIdSplt[2], node);
- node.nodeValue = "";
- node["s-en"] = childIdSplt[3];
- }
- }
- };
- var parsePropertyValue = (propValue, propType) => {
- if (propValue != null && !isComplexType(propValue)) {
- if (BUILD.propBoolean && propType & 4) {
- return propValue === "false" ? false : propValue === "" || !!propValue;
- }
- if (BUILD.propNumber && propType & 2) {
- return parseFloat(propValue);
- }
- if (BUILD.propString && propType & 1) {
- return String(propValue);
- }
- return propValue;
- }
- return propValue;
- };
- var getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
- var setValue = (ref, propName, newVal, cmpMeta) => {
- const hostRef = getHostRef(ref);
- const elm = BUILD.lazyLoad ? hostRef.$hostElement$ : ref;
- const oldVal = hostRef.$instanceValues$.get(propName);
- const flags = hostRef.$flags$;
- const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
- newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
- const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal);
- const didValueChange = newVal !== oldVal && !areBothNaN;
- if ((!BUILD.lazyLoad || !(flags & 8) || oldVal === void 0) && didValueChange) {
- hostRef.$instanceValues$.set(propName, newVal);
- if (BUILD.isDev) {
- if (hostRef.$flags$ & 1024) {
- 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);
- } else if (hostRef.$flags$ & 2048) {
- 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);
- }
- }
- if (!BUILD.lazyLoad || instance) {
- if (BUILD.watchCallback && cmpMeta.$watchers$ && flags & 128) {
- const watchMethods = cmpMeta.$watchers$[propName];
- if (watchMethods) {
- watchMethods.map((watchMethodName) => {
- try {
- instance[watchMethodName](newVal, oldVal, propName);
- } catch (e) {
- consoleError(e, elm);
- }
- });
- }
- }
- if (BUILD.updatable && (flags & (2 | 16)) === 2) {
- if (BUILD.cmpShouldUpdate && instance.componentShouldUpdate) {
- if (instance.componentShouldUpdate(newVal, oldVal, propName) === false) {
- return;
- }
- }
- scheduleUpdate(hostRef, false);
- }
- }
- }
- };
- var proxyComponent = (Cstr, cmpMeta, flags) => {
- if (BUILD.member && cmpMeta.$members$) {
- if (BUILD.watchCallback && Cstr.watchers) {
- cmpMeta.$watchers$ = Cstr.watchers;
- }
- const members = Object.entries(cmpMeta.$members$);
- const prototype = Cstr.prototype;
- members.map(([memberName, [memberFlags]]) => {
- if ((BUILD.prop || BUILD.state) && (memberFlags & 31 || (!BUILD.lazyLoad || flags & 2) && memberFlags & 32)) {
- Object.defineProperty(prototype, memberName, {
- get() {
- return getValue(this, memberName);
- },
- set(newValue) {
- if (BUILD.isDev) {
- const ref = getHostRef(this);
- if ((flags & 1) === 0 && (ref.$flags$ & 8) === 0 && (memberFlags & 31) !== 0 && (memberFlags & 1024) === 0) {
- consoleDevWarn(`@Prop() "${memberName}" on <${cmpMeta.$tagName$}> is immutable but was modified from within the component.
- More information: https://stenciljs.com/docs/properties#prop-mutability`);
- }
- }
- setValue(this, memberName, newValue, cmpMeta);
- },
- configurable: true,
- enumerable: true
- });
- } else if (BUILD.lazyLoad && BUILD.method && flags & 1 && memberFlags & 64) {
- Object.defineProperty(prototype, memberName, {
- value(...args) {
- const ref = getHostRef(this);
- return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
- }
- });
- }
- });
- if (BUILD.observeAttribute && (!BUILD.lazyLoad || flags & 1)) {
- const attrNameToPropName = new Map();
- prototype.attributeChangedCallback = function(attrName, _oldValue, newValue) {
- plt.jmp(() => {
- const propName = attrNameToPropName.get(attrName);
- if (this.hasOwnProperty(propName)) {
- newValue = this[propName];
- delete this[propName];
- } else if (prototype.hasOwnProperty(propName) && typeof this[propName] === "number" && this[propName] == newValue) {
- return;
- }
- this[propName] = newValue === null && typeof this[propName] === "boolean" ? false : newValue;
- });
- };
- Cstr.observedAttributes = members.filter(([_, m]) => m[0] & 15).map(([propName, m]) => {
- const attrName = m[1] || propName;
- attrNameToPropName.set(attrName, propName);
- if (BUILD.reflect && m[0] & 512) {
- cmpMeta.$attrsToReflect$.push([propName, attrName]);
- }
- return attrName;
- });
- }
- }
- return Cstr;
- };
- var initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
- if ((BUILD.lazyLoad || BUILD.hydrateServerSide || BUILD.style) && (hostRef.$flags$ & 32) === 0) {
- if (BUILD.lazyLoad || BUILD.hydrateClientSide) {
- hostRef.$flags$ |= 32;
- Cstr = loadModule(cmpMeta, hostRef, hmrVersionId);
- if (Cstr.then) {
- const endLoad = uniqueTime(`st:load:${cmpMeta.$tagName$}:${hostRef.$modeName$}`, `[Stencil] Load module for <${cmpMeta.$tagName$}>`);
- Cstr = await Cstr;
- endLoad();
- }
- if ((BUILD.isDev || BUILD.isDebug) && !Cstr) {
- throw new Error(`Constructor for "${cmpMeta.$tagName$}#${hostRef.$modeName$}" was not found`);
- }
- if (BUILD.member && !Cstr.isProxied) {
- if (BUILD.watchCallback) {
- cmpMeta.$watchers$ = Cstr.watchers;
- }
- proxyComponent(Cstr, cmpMeta, 2);
- Cstr.isProxied = true;
- }
- const endNewInstance = createTime("createInstance", cmpMeta.$tagName$);
- if (BUILD.member) {
- hostRef.$flags$ |= 8;
- }
- try {
- new Cstr(hostRef);
- } catch (e) {
- consoleError(e);
- }
- if (BUILD.member) {
- hostRef.$flags$ &= ~8;
- }
- if (BUILD.watchCallback) {
- hostRef.$flags$ |= 128;
- }
- endNewInstance();
- fireConnectedCallback(hostRef.$lazyInstance$);
- } else {
- Cstr = elm.constructor;
- hostRef.$flags$ |= 32;
- customElements.whenDefined(cmpMeta.$tagName$).then(() => hostRef.$flags$ |= 128);
- }
- if (BUILD.style && Cstr.style) {
- let style = Cstr.style;
- if (BUILD.mode && typeof style !== "string") {
- style = style[hostRef.$modeName$ = computeMode(elm)];
- if (BUILD.hydrateServerSide && hostRef.$modeName$) {
- elm.setAttribute("s-mode", hostRef.$modeName$);
- }
- }
- const scopeId2 = getScopeId(cmpMeta, hostRef.$modeName$);
- if (!styles.has(scopeId2)) {
- const endRegisterStyles = createTime("registerStyles", cmpMeta.$tagName$);
- if (!BUILD.hydrateServerSide && BUILD.shadowDom && BUILD.shadowDomShim && cmpMeta.$flags$ & 8) {
- style = await import("./shadow-css-SEB4SDQE.js").then((m) => m.scopeCss(style, scopeId2, false));
- }
- registerStyle(scopeId2, style, !!(cmpMeta.$flags$ & 1));
- endRegisterStyles();
- }
- }
- }
- const ancestorComponent = hostRef.$ancestorComponent$;
- const schedule = () => scheduleUpdate(hostRef, true);
- if (BUILD.asyncLoading && ancestorComponent && ancestorComponent["s-rc"]) {
- ancestorComponent["s-rc"].push(schedule);
- } else {
- schedule();
- }
- };
- var fireConnectedCallback = (instance) => {
- if (BUILD.lazyLoad && BUILD.connectedCallback) {
- safeCall(instance, "connectedCallback");
- }
- };
- var connectedCallback = (elm) => {
- if ((plt.$flags$ & 1) === 0) {
- const hostRef = getHostRef(elm);
- const cmpMeta = hostRef.$cmpMeta$;
- const endConnected = createTime("connectedCallback", cmpMeta.$tagName$);
- if (BUILD.hostListenerTargetParent) {
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, true);
- }
- if (!(hostRef.$flags$ & 1)) {
- hostRef.$flags$ |= 1;
- let hostId;
- if (BUILD.hydrateClientSide) {
- hostId = elm.getAttribute(HYDRATE_ID);
- if (hostId) {
- if (BUILD.shadowDom && supportsShadow && cmpMeta.$flags$ & 1) {
- const scopeId2 = BUILD.mode ? addStyle(elm.shadowRoot, cmpMeta, elm.getAttribute("s-mode")) : addStyle(elm.shadowRoot, cmpMeta);
- elm.classList.remove(scopeId2 + "-h", scopeId2 + "-s");
- }
- initializeClientHydrate(elm, cmpMeta.$tagName$, hostId, hostRef);
- }
- }
- if (BUILD.slotRelocation && !hostId) {
- if (BUILD.hydrateServerSide || (BUILD.slot || BUILD.shadowDom) && cmpMeta.$flags$ & (4 | 8)) {
- setContentReference(elm);
- }
- }
- if (BUILD.asyncLoading) {
- let ancestorComponent = elm;
- while (ancestorComponent = ancestorComponent.parentNode || ancestorComponent.host) {
- if (BUILD.hydrateClientSide && ancestorComponent.nodeType === 1 && ancestorComponent.hasAttribute("s-id") && ancestorComponent["s-p"] || ancestorComponent["s-p"]) {
- attachToAncestor(hostRef, hostRef.$ancestorComponent$ = ancestorComponent);
- break;
- }
- }
- }
- if (BUILD.prop && !BUILD.hydrateServerSide && cmpMeta.$members$) {
- Object.entries(cmpMeta.$members$).map(([memberName, [memberFlags]]) => {
- if (memberFlags & 31 && elm.hasOwnProperty(memberName)) {
- const value = elm[memberName];
- delete elm[memberName];
- elm[memberName] = value;
- }
- });
- }
- if (BUILD.initializeNextTick) {
- nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
- } else {
- initializeComponent(elm, hostRef, cmpMeta);
- }
- } else {
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
- fireConnectedCallback(hostRef.$lazyInstance$);
- }
- endConnected();
- }
- };
- var setContentReference = (elm) => {
- const contentRefElm = elm["s-cr"] = doc.createComment(BUILD.isDebug ? `content-ref (host=${elm.localName})` : "");
- contentRefElm["s-cn"] = true;
- elm.insertBefore(contentRefElm, elm.firstChild);
- };
- var disconnectedCallback = (elm) => {
- if ((plt.$flags$ & 1) === 0) {
- const hostRef = getHostRef(elm);
- const instance = BUILD.lazyLoad ? hostRef.$lazyInstance$ : elm;
- if (BUILD.hostListener) {
- if (hostRef.$rmListeners$) {
- hostRef.$rmListeners$.map((rmListener) => rmListener());
- hostRef.$rmListeners$ = void 0;
- }
- }
- if (BUILD.cssVarShim && plt.$cssShim$) {
- plt.$cssShim$.removeHost(elm);
- }
- if (BUILD.lazyLoad && BUILD.disconnectedCallback) {
- safeCall(instance, "disconnectedCallback");
- }
- if (BUILD.cmpDidUnload) {
- safeCall(instance, "componentDidUnload");
- }
- }
- };
- var proxyCustomElement = (Cstr, compactMeta) => {
- const cmpMeta = {
- $flags$: compactMeta[0],
- $tagName$: compactMeta[1]
- };
- if (BUILD.member) {
- cmpMeta.$members$ = compactMeta[2];
- }
- if (BUILD.hostListener) {
- cmpMeta.$listeners$ = compactMeta[3];
- }
- if (BUILD.watchCallback) {
- cmpMeta.$watchers$ = Cstr.$watchers$;
- }
- if (BUILD.reflect) {
- cmpMeta.$attrsToReflect$ = [];
- }
- if (BUILD.shadowDom && !supportsShadow && cmpMeta.$flags$ & 1) {
- cmpMeta.$flags$ |= 8;
- }
- const originalConnectedCallback = Cstr.prototype.connectedCallback;
- const originalDisconnectedCallback = Cstr.prototype.disconnectedCallback;
- Object.assign(Cstr.prototype, {
- __registerHost() {
- registerHost(this, cmpMeta);
- },
- connectedCallback() {
- connectedCallback(this);
- if (BUILD.connectedCallback && originalConnectedCallback) {
- originalConnectedCallback.call(this);
- }
- },
- disconnectedCallback() {
- disconnectedCallback(this);
- if (BUILD.disconnectedCallback && originalDisconnectedCallback) {
- originalDisconnectedCallback.call(this);
- }
- },
- __attachShadow() {
- if (supportsShadow) {
- if (BUILD.shadowDelegatesFocus) {
- this.attachShadow({
- mode: "open",
- delegatesFocus: !!(cmpMeta.$flags$ & 16)
- });
- } else {
- this.attachShadow({ mode: "open" });
- }
- } else {
- this.shadowRoot = this;
- }
- }
- });
- Cstr.is = cmpMeta.$tagName$;
- return proxyComponent(Cstr, cmpMeta, 1 | 2);
- };
- var getAssetPath = (path) => {
- const assetUrl = new URL(path, plt.$resourcesUrl$);
- return assetUrl.origin !== win.location.origin ? assetUrl.href : assetUrl.pathname;
- };
- var setAssetPath = (path) => plt.$resourcesUrl$ = path;
- var hostRefs = new WeakMap();
- var getHostRef = (ref) => hostRefs.get(ref);
- var registerHost = (elm, cmpMeta) => {
- const hostRef = {
- $flags$: 0,
- $hostElement$: elm,
- $cmpMeta$: cmpMeta,
- $instanceValues$: new Map()
- };
- if (BUILD.isDev) {
- hostRef.$renderCount$ = 0;
- }
- if (BUILD.method && BUILD.lazyLoad) {
- hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
- }
- if (BUILD.asyncLoading) {
- hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
- elm["s-p"] = [];
- elm["s-rc"] = [];
- }
- addHostEventListeners(elm, hostRef, cmpMeta.$listeners$, false);
- return hostRefs.set(elm, hostRef);
- };
- var isMemberInElement = (elm, memberName) => memberName in elm;
- var consoleError = (e, el) => (customError || console.error)(e, el);
- var STENCIL_DEV_MODE = BUILD.isTesting ? ["STENCIL:"] : [
- "%cstencil",
- "color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"
- ];
- var consoleDevError = (...m) => console.error(...STENCIL_DEV_MODE, ...m);
- var consoleDevWarn = (...m) => console.warn(...STENCIL_DEV_MODE, ...m);
- var cmpModules = new Map();
- var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
- const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
- const bundleId = cmpMeta.$lazyBundleId$;
- if (BUILD.isDev && typeof bundleId !== "string") {
- consoleDevError(`Trying to lazily load component <${cmpMeta.$tagName$}> with style mode "${hostRef.$modeName$}", but it does not exist.`);
- return void 0;
- }
- const module = !BUILD.hotModuleReplacement ? cmpModules.get(bundleId) : false;
- if (module) {
- return module[exportName];
- }
- return import(
- /* webpackInclude: /\.entry\.js$/ */
- /* webpackExclude: /\.system\.entry\.js$/ */
- /* webpackMode: "lazy" */
- `./${bundleId}.entry.js${BUILD.hotModuleReplacement && hmrVersionId ? "?s-hmr=" + hmrVersionId : ""}`
- ).then((importedModule) => {
- if (!BUILD.hotModuleReplacement) {
- cmpModules.set(bundleId, importedModule);
- }
- return importedModule[exportName];
- }, consoleError);
- };
- var styles = new Map();
- var modeResolutionChain = [];
- var queueDomReads = [];
- var queueDomWrites = [];
- var queueDomWritesLow = [];
- var queueTask = (queue, write) => (cb) => {
- queue.push(cb);
- if (!queuePending) {
- queuePending = true;
- if (write && plt.$flags$ & 4) {
- nextTick(flush);
- } else {
- plt.raf(flush);
- }
- }
- };
- var consume = (queue) => {
- for (let i2 = 0; i2 < queue.length; i2++) {
- try {
- queue[i2](performance.now());
- } catch (e) {
- consoleError(e);
- }
- }
- queue.length = 0;
- };
- var consumeTimeout = (queue, timeout) => {
- let i2 = 0;
- let ts = 0;
- while (i2 < queue.length && (ts = performance.now()) < timeout) {
- try {
- queue[i2++](ts);
- } catch (e) {
- consoleError(e);
- }
- }
- if (i2 === queue.length) {
- queue.length = 0;
- } else if (i2 !== 0) {
- queue.splice(0, i2);
- }
- };
- var flush = () => {
- if (BUILD.asyncQueue) {
- queueCongestion++;
- }
- consume(queueDomReads);
- if (BUILD.asyncQueue) {
- const timeout = (plt.$flags$ & 6) === 2 ? performance.now() + 14 * Math.ceil(queueCongestion * (1 / 10)) : Infinity;
- consumeTimeout(queueDomWrites, timeout);
- consumeTimeout(queueDomWritesLow, timeout);
- if (queueDomWrites.length > 0) {
- queueDomWritesLow.push(...queueDomWrites);
- queueDomWrites.length = 0;
- }
- if (queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0) {
- plt.raf(flush);
- } else {
- queueCongestion = 0;
- }
- } else {
- consume(queueDomWrites);
- if (queuePending = queueDomReads.length > 0) {
- plt.raf(flush);
- }
- }
- };
- var nextTick = (cb) => promiseResolve().then(cb);
- var readTask = queueTask(queueDomReads, false);
- var writeTask = queueTask(queueDomWrites, true);
- var Build = {
- isDev: BUILD.isDev ? true : false,
- isBrowser: true,
- isServer: false,
- isTesting: BUILD.isTesting ? true : false
- };
- export {
- H,
- h,
- Host,
- createEvent,
- forceUpdate,
- proxyCustomElement,
- getAssetPath,
- setAssetPath,
- Build
- };
- //# sourceMappingURL=chunk-P6MX663D.js.map
|