UNPKG

@revolist/revogrid

Version:

Virtual reactive data grid spreadsheet component - RevoGrid.

1,398 lines (1,367 loc) 1.23 MB
/*! * Built by Revolist OU ❤️ */ 'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var stream = require('stream'); const modeResolutionChain = []; function hydrateFactory($stencilWindow, $stencilHydrateOpts, $stencilHydrateResults, $stencilAfterHydrate, $stencilHydrateResolve) { var globalThis = $stencilWindow; var self = $stencilWindow; var top = $stencilWindow; var parent = $stencilWindow; var addEventListener = $stencilWindow.addEventListener.bind($stencilWindow); var alert = $stencilWindow.alert.bind($stencilWindow); var blur = $stencilWindow.blur.bind($stencilWindow); var cancelAnimationFrame = $stencilWindow.cancelAnimationFrame.bind($stencilWindow); var cancelIdleCallback = $stencilWindow.cancelIdleCallback.bind($stencilWindow); var clearInterval = $stencilWindow.clearInterval.bind($stencilWindow); var clearTimeout = $stencilWindow.clearTimeout.bind($stencilWindow); var close = () => {}; var confirm = $stencilWindow.confirm.bind($stencilWindow); var dispatchEvent = $stencilWindow.dispatchEvent.bind($stencilWindow); var focus = $stencilWindow.focus.bind($stencilWindow); var getComputedStyle = $stencilWindow.getComputedStyle.bind($stencilWindow); var matchMedia = $stencilWindow.matchMedia.bind($stencilWindow); var open = $stencilWindow.open.bind($stencilWindow); var prompt = $stencilWindow.prompt.bind($stencilWindow); var removeEventListener = $stencilWindow.removeEventListener.bind($stencilWindow); var requestAnimationFrame = $stencilWindow.requestAnimationFrame.bind($stencilWindow); var requestIdleCallback = $stencilWindow.requestIdleCallback.bind($stencilWindow); var setInterval = $stencilWindow.setInterval.bind($stencilWindow); var setTimeout = $stencilWindow.setTimeout.bind($stencilWindow); var CharacterData = $stencilWindow.CharacterData; var CSS = $stencilWindow.CSS; var CustomEvent = $stencilWindow.CustomEvent; var Document = $stencilWindow.Document; var ShadowRoot = $stencilWindow.ShadowRoot; var DocumentFragment = $stencilWindow.DocumentFragment; var DocumentType = $stencilWindow.DocumentType; var DOMTokenList = $stencilWindow.DOMTokenList; var Element = $stencilWindow.Element; var Event = $stencilWindow.Event; var HTMLAnchorElement = $stencilWindow.HTMLAnchorElement; var HTMLBaseElement = $stencilWindow.HTMLBaseElement; var HTMLButtonElement = $stencilWindow.HTMLButtonElement; var HTMLCanvasElement = $stencilWindow.HTMLCanvasElement; var HTMLElement = $stencilWindow.HTMLElement; var HTMLFormElement = $stencilWindow.HTMLFormElement; var HTMLImageElement = $stencilWindow.HTMLImageElement; var HTMLInputElement = $stencilWindow.HTMLInputElement; var HTMLLinkElement = $stencilWindow.HTMLLinkElement; var HTMLMetaElement = $stencilWindow.HTMLMetaElement; var HTMLScriptElement = $stencilWindow.HTMLScriptElement; var HTMLStyleElement = $stencilWindow.HTMLStyleElement; var HTMLTemplateElement = $stencilWindow.HTMLTemplateElement; var HTMLTitleElement = $stencilWindow.HTMLTitleElement; var IntersectionObserver = $stencilWindow.IntersectionObserver; var ResizeObserver = $stencilWindow.ResizeObserver; var KeyboardEvent = $stencilWindow.KeyboardEvent; var MouseEvent = $stencilWindow.MouseEvent; var Node = $stencilWindow.Node; var NodeList = $stencilWindow.NodeList; var URL = $stencilWindow.URL; var console = $stencilWindow.console; var customElements = $stencilWindow.customElements; var history = $stencilWindow.history; var localStorage = $stencilWindow.localStorage; var location = $stencilWindow.location; var navigator = $stencilWindow.navigator; var performance = $stencilWindow.performance; var sessionStorage = $stencilWindow.sessionStorage; var devicePixelRatio = $stencilWindow.devicePixelRatio; var innerHeight = $stencilWindow.innerHeight; var innerWidth = $stencilWindow.innerWidth; var origin = $stencilWindow.origin; var pageXOffset = $stencilWindow.pageXOffset; var pageYOffset = $stencilWindow.pageYOffset; var screen = $stencilWindow.screen; var screenLeft = $stencilWindow.screenLeft; var screenTop = $stencilWindow.screenTop; var screenX = $stencilWindow.screenX; var screenY = $stencilWindow.screenY; var scrollX = $stencilWindow.scrollX; var scrollY = $stencilWindow.scrollY; var exports = {}; var fetch, FetchError, Headers, Request, Response; if (typeof $stencilWindow.fetch === 'function') { fetch = $stencilWindow.fetch; } else { fetch = $stencilWindow.fetch = function() { throw new Error('fetch() is not implemented'); }; } if (typeof $stencilWindow.FetchError === 'function') { FetchError = $stencilWindow.FetchError; } else { FetchError = $stencilWindow.FetchError = class FetchError { constructor() { throw new Error('FetchError is not implemented'); } }; } if (typeof $stencilWindow.Headers === 'function') { Headers = $stencilWindow.Headers; } else { Headers = $stencilWindow.Headers = class Headers { constructor() { throw new Error('Headers is not implemented'); } }; } if (typeof $stencilWindow.Request === 'function') { Request = $stencilWindow.Request; } else { Request = $stencilWindow.Request = class Request { constructor() { throw new Error('Request is not implemented'); } }; } if (typeof $stencilWindow.Response === 'function') { Response = $stencilWindow.Response; } else { Response = $stencilWindow.Response = class Response { constructor() { throw new Error('Response is not implemented'); } }; } function hydrateAppClosure($stencilWindow) { const window = $stencilWindow; const document = $stencilWindow.document; /*hydrateAppClosure start*/ const NAMESPACE = 'revo-grid'; const BUILD = /* revo-grid */ { allRenderFn: false, appendChildSlotFix: false, asyncLoading: true, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: true, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: true, cmpWillUpdate: false, connectedCallback: true, constructableCSS: false, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: true, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: true, hostListenerTarget: true, hostListenerTargetBody: false, hostListenerTargetDocument: true, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: true, hydrateServerSide: true, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", invisiblePrehydration: false, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: true, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: true, propNumber: true, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: false, shadowDomShim: true, slot: true, slotChildNodesFix: false, slotRelocation: true, state: true, style: true, svg: true, taskQueue: true, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: true, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: true, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: true, watchCallback: true }; class ThemeCompact { constructor() { this.defaultRowSize = 32; } } class ThemeDefault { constructor() { this.defaultRowSize = 27; } } class ThemeMaterial { constructor() { this.defaultRowSize = 42; } } const DEFAULT_THEME = 'default'; const allowedThemes = [ DEFAULT_THEME, 'material', 'compact', 'darkMaterial', 'darkCompact', ]; class ThemeService { get theme() { return this.currentTheme; } get rowSize() { return this.customRowSize || this.currentTheme.defaultRowSize; } set rowSize(size) { this.customRowSize = size; } constructor(cfg) { this.customRowSize = 0; this.customRowSize = cfg.rowSize; this.register('default'); } register(theme) { const parsedTheme = getTheme(theme); switch (parsedTheme) { case 'material': case 'darkMaterial': this.currentTheme = new ThemeMaterial(); break; case 'compact': case 'darkCompact': this.currentTheme = new ThemeCompact(); break; default: this.currentTheme = new ThemeDefault(); break; } } } function getTheme(theme) { if (theme && allowedThemes.indexOf(theme) > -1) { return theme; } return DEFAULT_THEME; } setMode(elm => { let theme = elm.theme || elm.getAttribute('theme'); if (typeof theme === 'string') { theme = theme.trim(); } const parsedTheme = getTheme(theme); if (parsedTheme !== theme) { elm.setAttribute('theme', parsedTheme); } return parsedTheme; }); /* Stencil Hydrate Platform v4.23.0 | MIT Licensed | https://stenciljs.com */ var __defProp = Object.defineProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; // src/utils/constants.ts var EMPTY_OBJ = {}; var SVG_NS = "http://www.w3.org/2000/svg"; var HTML_NS = "http://www.w3.org/1999/xhtml"; // src/utils/helpers.ts var isDef = (v) => v != null; var isComplexType = (o) => { o = typeof o; return o === "object" || o === "function"; }; // src/utils/query-nonce-meta-tag-content.ts function queryNonceMetaTagContent(doc2) { var _a, _b, _c; return (_c = (_b = (_a = doc2.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0; } // src/utils/result.ts var result_exports = {}; __export(result_exports, { err: () => err, map: () => map, ok: () => ok, unwrap: () => unwrap$1, unwrapErr: () => unwrapErr }); var ok = (value) => ({ isOk: true, isErr: false, value }); var err = (value) => ({ isOk: false, isErr: true, value }); function map(result, fn) { if (result.isOk) { const val = fn(result.value); if (val instanceof Promise) { return val.then((newVal) => ok(newVal)); } else { return ok(val); } } if (result.isErr) { const value = result.value; return err(value); } throw "should never get here"; } var unwrap$1 = (result) => { if (result.isOk) { return result.value; } else { throw result.value; } }; var unwrapErr = (result) => { if (result.isErr) { return result.value; } else { throw result.value; } }; // src/runtime/runtime-constants.ts var CONTENT_REF_ID = "r"; var ORG_LOCATION_ID = "o"; var SLOT_NODE_ID = "s"; var TEXT_NODE_ID = "t"; var COMMENT_NODE_ID = "c"; var HYDRATE_ID = "s-id"; var HYDRATED_STYLE_ID = "sty-id"; var HYDRATE_CHILD_ID = "c-id"; var STENCIL_DOC_DATA = "_stencilDocData"; var DEFAULT_DOC_DATA = { hostIds: 0, rootLevelIds: 0, staticComponents: /* @__PURE__ */ new Set() }; var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}"; var XLINK_NS = "http://www.w3.org/1999/xlink"; var h = (nodeName, vnodeData, ...children) => { let child = null; let key = null; let slotName = null; let simple = false; let lastSimple = false; const 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); } if (simple && lastSimple) { vNodeChildren[vNodeChildren.length - 1].$text$ += child; } else { vNodeChildren.push(simple ? newVNode(null, child) : child); } lastSimple = simple; } } }; walk(children); if (vnodeData) { if (vnodeData.key) { key = vnodeData.key; } if (vnodeData.name) { slotName = vnodeData.name; } { const classData = vnodeData.className || vnodeData.class; if (classData) { vnodeData.class = typeof classData !== "object" ? classData : Object.keys(classData).filter((k) => classData[k]).join(" "); } } } if (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; } { vnode.$key$ = key; } { vnode.$name$ = slotName; } return vnode; }; var newVNode = (tag, text) => { const vnode = { $flags$: 0, $tag$: tag, $text$: text, $elm$: null, $children$: null }; { vnode.$attrs$ = null; } { vnode.$key$ = null; } { 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 = { ...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 setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => { if (oldValue !== newValue) { let isProp = isMemberInElement(elm, memberName); let ln = memberName.toLowerCase(); if (memberName === "class") { const classList = elm.classList; const oldClasses = parseClassList(oldValue); const newClasses = parseClassList(newValue); if (elm["s-si"] && newClasses.indexOf(elm["s-si"]) < 0) { newClasses.push(elm["s-si"]); } classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c))); classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c))); } else if (memberName === "style") { { for (const prop in oldValue) { if (!newValue || newValue[prop] == null) { { elm.style[prop] = ""; } } } } for (const prop in newValue) { if (!oldValue || newValue[prop] !== oldValue[prop]) { { elm.style[prop] = newValue[prop]; } } } } else if (memberName === "key") ; else if (memberName === "ref") { if (newValue) { newValue(elm); } } else if ((!isProp ) && 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 || newValue) { const capture = memberName.endsWith(CAPTURE_EVENT_SUFFIX); memberName = memberName.replace(CAPTURE_EVENT_REGEX, ""); if (oldValue) { plt.rel(elm, memberName, oldValue, capture); } if (newValue) { plt.ael(elm, memberName, newValue, capture); } } } else { const isComplex = isComplexType(newValue); if ((isProp || isComplex && newValue !== null) && !isSvg) { try { if (!elm.tagName.includes("-")) { const n = newValue == null ? "" : newValue; if (memberName === "list") { isProp = false; } else if (oldValue == null || elm[memberName] != n) { if (typeof elm.__lookupSetter__(memberName) === "function") { elm[memberName] = n; } else { elm.setAttribute(memberName, n); } } } else { elm[memberName] = newValue; } } catch (e) { } } let xlink = false; { if (ln !== (ln = ln.replace(/^xlink\:?/, ""))) { memberName = ln; xlink = true; } } if (newValue == null || newValue === false) { if (newValue !== false || elm.getAttribute(memberName) === "") { if (xlink) { elm.removeAttributeNS(XLINK_NS, memberName); } else { elm.removeAttribute(memberName); } } } else if ((!isProp || flags & 4 /* isHost */ || isSvg) && !isComplex) { newValue = newValue === true ? "" : newValue; if (xlink) { elm.setAttributeNS(XLINK_NS, memberName, newValue); } else { elm.setAttribute(memberName, newValue); } } } } }; var parseClassListRegex = /\s/; var parseClassList = (value) => !value ? [] : value.split(parseClassListRegex); var CAPTURE_EVENT_SUFFIX = "Capture"; var CAPTURE_EVENT_REGEX = new RegExp(CAPTURE_EVENT_SUFFIX + "$"); // src/runtime/vdom/update-element.ts var updateElement = (oldVnode, newVnode, isSvgMode2) => { const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$; const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || EMPTY_OBJ; const newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ; { for (const memberName of sortedAttrNames(Object.keys(oldVnodeAttrs))) { if (!(memberName in newVnodeAttrs)) { setAccessor(elm, memberName, oldVnodeAttrs[memberName], void 0, isSvgMode2, newVnode.$flags$); } } } for (const memberName of sortedAttrNames(Object.keys(newVnodeAttrs))) { setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode2, newVnode.$flags$); } }; function sortedAttrNames(attrNames) { return attrNames.includes("ref") ? ( // we need to sort these to ensure that `'ref'` is the last attr [...attrNames.filter((attr) => attr !== "ref"), "ref"] ) : ( // no need to sort, return the original array attrNames ); } // src/runtime/vdom/vdom-render.ts var scopeId; var contentRef; var hostTagName; var useNativeShadowDom = false; var checkSlotFallbackVisibility = false; var checkSlotRelocate = false; var isSvgMode = false; var createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => { var _a; const newVNode2 = newParentVNode.$children$[childIndex]; let i2 = 0; let elm; let childNode; let oldVNode; if (!useNativeShadowDom) { checkSlotRelocate = true; if (newVNode2.$tag$ === "slot") { newVNode2.$flags$ |= newVNode2.$children$ ? ( // slot element has fallback content // still create an element that "mocks" the slot element 2 /* isSlotFallback */ ) : ( // slot element does not have fallback content // create an html comment we'll use to always reference // where actual slot content should sit next to 1 /* isSlotReference */ ); } } if (newVNode2.$text$ !== null) { elm = newVNode2.$elm$ = doc.createTextNode(newVNode2.$text$); } else if (newVNode2.$flags$ & 1 /* isSlotReference */) { elm = newVNode2.$elm$ = slotReferenceDebugNode(newVNode2) ; } else { if (!isSvgMode) { isSvgMode = newVNode2.$tag$ === "svg"; } elm = newVNode2.$elm$ = doc.createElementNS( isSvgMode ? SVG_NS : HTML_NS, !useNativeShadowDom && BUILD.slotRelocation && newVNode2.$flags$ & 2 /* isSlotFallback */ ? "slot-fb" : newVNode2.$tag$ ) ; if (isSvgMode && newVNode2.$tag$ === "foreignObject") { isSvgMode = false; } { updateElement(null, newVNode2, isSvgMode); } const rootNode = elm.getRootNode(); const isElementWithinShadowRoot = !rootNode.querySelector("body"); if (!isElementWithinShadowRoot && 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); if (childNode) { elm.appendChild(childNode); } } } { if (newVNode2.$tag$ === "svg") { isSvgMode = false; } else if (elm.tagName === "foreignObject") { isSvgMode = true; } } } elm["s-hn"] = hostTagName; { if (newVNode2.$flags$ & (2 /* isSlotFallback */ | 1 /* isSlotReference */)) { elm["s-sr"] = true; elm["s-cr"] = contentRef; elm["s-sn"] = newVNode2.$name$ || ""; elm["s-rf"] = (_a = newVNode2.$attrs$) == null ? void 0 : _a.ref; 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 /* isTmpDisconnected */; const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes); if (parentElm["s-sr"] && BUILD.experimentalSlotFixes) { let node = parentElm; while (node = node.nextSibling) { if (node && node["s-sn"] === parentElm["s-sn"] && node["s-sh"] === hostTagName) { oldSlotChildNodes.push(node); } } } for (let i2 = oldSlotChildNodes.length - 1; i2 >= 0; i2--) { const childNode = oldSlotChildNodes[i2]; if (childNode["s-hn"] !== hostTagName && childNode["s-ol"]) { insertBefore(parentReferenceNode(childNode), childNode, referenceNode(childNode)); childNode["s-ol"].remove(); childNode["s-ol"] = void 0; childNode["s-sh"] = void 0; checkSlotRelocate = true; } if (recursive) { putBackInOriginalLocation(childNode, recursive); } } plt.$flags$ &= ~1 /* isTmpDisconnected */; }; var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => { let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm; let childNode; for (; startIdx <= endIdx; ++startIdx) { if (vnodes[startIdx]) { childNode = createElm(null, parentVNode, startIdx); if (childNode) { vnodes[startIdx].$elm$ = childNode; insertBefore(containerElm, childNode, referenceNode(before) ); } } } }; var removeVnodes = (vnodes, startIdx, endIdx) => { for (let index = startIdx; index <= endIdx; ++index) { const vnode = vnodes[index]; if (vnode) { const elm = vnode.$elm$; nullifyVNodeRefs(vnode); if (elm) { { checkSlotFallbackVisibility = true; if (elm["s-ol"]) { elm["s-ol"].remove(); } else { putBackInOriginalLocation(elm, true); } } elm.remove(); } } } }; var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = false) => { 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, isInitialRender)) { patch(oldStartVnode, newStartVnode, isInitialRender); oldStartVnode = oldCh[++oldStartIdx]; newStartVnode = newCh[++newStartIdx]; } else if (isSameVnode(oldEndVnode, newEndVnode, isInitialRender)) { patch(oldEndVnode, newEndVnode, isInitialRender); oldEndVnode = oldCh[--oldEndIdx]; newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldStartVnode, newEndVnode, isInitialRender)) { if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) { putBackInOriginalLocation(oldStartVnode.$elm$.parentNode, false); } patch(oldStartVnode, newEndVnode, isInitialRender); insertBefore(parentElm, oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling); oldStartVnode = oldCh[++oldStartIdx]; newEndVnode = newCh[--newEndIdx]; } else if (isSameVnode(oldEndVnode, newStartVnode, isInitialRender)) { if ((oldStartVnode.$tag$ === "slot" || newEndVnode.$tag$ === "slot")) { putBackInOriginalLocation(oldEndVnode.$elm$.parentNode, false); } patch(oldEndVnode, newStartVnode, isInitialRender); insertBefore(parentElm, oldEndVnode.$elm$, oldStartVnode.$elm$); oldEndVnode = oldCh[--oldEndIdx]; newStartVnode = newCh[++newStartIdx]; } else { idxInOld = -1; { for (i2 = oldStartIdx; i2 <= oldEndIdx; ++i2) { if (oldCh[i2] && oldCh[i2].$key$ !== null && oldCh[i2].$key$ === newStartVnode.$key$) { idxInOld = i2; break; } } } if (idxInOld >= 0) { elmToMove = oldCh[idxInOld]; if (elmToMove.$tag$ !== newStartVnode.$tag$) { node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld); } else { patch(elmToMove, newStartVnode, isInitialRender); oldCh[idxInOld] = void 0; node = elmToMove.$elm$; } newStartVnode = newCh[++newStartIdx]; } else { node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx); newStartVnode = newCh[++newStartIdx]; } if (node) { { insertBefore(parentReferenceNode(oldStartVnode.$elm$), node, referenceNode(oldStartVnode.$elm$)); } } } } if (oldStartIdx > oldEndIdx) { addVnodes( parentElm, newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$, newVNode2, newCh, newStartIdx, newEndIdx ); } else if (newStartIdx > newEndIdx) { removeVnodes(oldCh, oldStartIdx, oldEndIdx); } }; var isSameVnode = (leftVNode, rightVNode, isInitialRender = false) => { if (leftVNode.$tag$ === rightVNode.$tag$) { if (leftVNode.$tag$ === "slot") { if ( // The component gets hydrated and no VDOM has been initialized. // Here the comparison can't happen as $name$ property is not set for `leftNode`. "$nodeId$" in leftVNode && isInitialRender && // `leftNode` is not from type HTMLComment which would cause many // hydration comments to be removed leftVNode.$elm$.nodeType !== 8 ) { return false; } return leftVNode.$name$ === rightVNode.$name$; } if (!isInitialRender) { return leftVNode.$key$ === rightVNode.$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, isInitialRender = false) => { 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 (text === null) { { isSvgMode = tag === "svg" ? true : tag === "foreignObject" ? false : isSvgMode; } { if (tag === "slot" && !useNativeShadowDom) ; else { updateElement(oldVNode, newVNode2, isSvgMode); } } if (oldChildren !== null && newChildren !== null) { updateChildren(elm, oldChildren, newVNode2, newChildren, isInitialRender); } else if (newChildren !== null) { if (oldVNode.$text$ !== null) { elm.textContent = ""; } addVnodes(elm, null, newVNode2, newChildren, 0, newChildren.length - 1); } else if ( // don't do this on initial render as it can cause non-hydrated content to be removed !isInitialRender && BUILD.updatable && oldChildren !== null ) { removeVnodes(oldChildren, 0, oldChildren.length - 1); } if (isSvgMode && tag === "svg") { isSvgMode = false; } } else if ((defaultHolder = elm["s-cr"])) { defaultHolder.parentNode.textContent = text; } else if (oldVNode.$text$ !== text) { elm.data = text; } }; var updateFallbackSlotVisibility = (elm) => { const childNodes = elm.__childNodes || elm.childNodes; for (const childNode of childNodes) { if (childNode.nodeType === 1 /* ElementNode */) { if (childNode["s-sr"]) { const slotName = childNode["s-sn"]; childNode.hidden = false; for (const siblingNode of childNodes) { if (siblingNode !== childNode) { if (siblingNode["s-hn"] !== childNode["s-hn"] || slotName !== "") { if (siblingNode.nodeType === 1 /* ElementNode */ && (slotName === siblingNode.getAttribute("slot") || slotName === siblingNode["s-sn"]) || siblingNode.nodeType === 3 /* TextNode */ && slotName === siblingNode["s-sn"]) { childNode.hidden = true; break; } } else if (slotName === siblingNode["s-sn"]) { if (siblingNode.nodeType === 1 /* ElementNode */ || siblingNode.nodeType === 3 /* TextNode */ && siblingNode.textContent.trim() !== "") { childNode.hidden = true; break; } } } } } updateFallbackSlotVisibility(childNode); } } }; var relocateNodes = []; var markSlotContentForRelocation = (elm) => { let node; let hostContentNodes; let j; const children = elm.__childNodes || elm.childNodes; for (const childNode of children) { if (childNode["s-sr"] && (node = childNode["s-cr"]) && node.parentNode) { hostContentNodes = node.parentNode.__childNodes || node.parentNode.childNodes; const slotName = 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"] && (!BUILD.experimentalSlotFixes )) { if (isNodeLocatedInSlot(node, slotName)) { let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node); checkSlotFallbackVisibility = true; node["s-sn"] = node["s-sn"] || slotName; if (relocateNodeData) { relocateNodeData.$nodeToRelocate$["s-sh"] = childNode["s-hn"]; relocateNodeData.$slotRefNode$ = childNode; } else { node["s-sh"] = childNode["s-hn"]; 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 /* ElementNode */) { markSlotContentForRelocation(childNode); } } }; var isNodeLocatedInSlot = (nodeToRelocate, slotName) => { if (nodeToRelocate.nodeType === 1 /* ElementNode */) { if (nodeToRelocate.getAttribute("slot") === null && slotName === "") { return true; } if (nodeToRelocate.getAttribute("slot") === slotName) { return true; } return false; } if (nodeToRelocate["s-sn"] === slotName) { return true; } return slotName === ""; }; var nullifyVNodeRefs = (vNode) => { { vNode.$attrs$ && vNode.$attrs$.ref && vNode.$attrs$.ref(null); vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs); } }; var insertBefore = (parent, newNode, reference) => { const inserted = parent == null ? void 0 : parent.insertBefore(newNode, reference); return inserted; }; var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => { var _a, _b, _c, _d; 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 (cmpMeta.$attrsToReflect$) { rootVnode.$attrs$ = rootVnode.$attrs$ || {}; cmpMeta.$attrsToReflect$.map( ([propName, attribute]) => rootVnode.$attrs$[attribute] = hostElm[propName] ); } if (isInitialLoad && rootVnode.$attrs$) { for (const key of Object.keys(rootVnode.$attrs$)) { if (hostElm.hasAttribute(key) && !["key", "ref", "style", "class"].includes(key)) { rootVnode.$attrs$[key] = hostElm[key]; } } } rootVnode.$tag$ = null; rootVnode.$flags$ |= 4 /* isHost */; hostRef.$vnode$ = rootVnode; rootVnode.$elm$ = oldVNode.$elm$ = hostElm; useNativeShadowDom = supportsShadow ; { contentRef = hostElm["s-cr"]; checkSlotFallbackVisibility = false; } patch(oldVNode, rootVnode, isInitialLoad); { plt.$flags$ |= 1 /* isTmpDisconnected */; if (checkSlotRelocate) { markSlotContentForRelocation(rootVnode.$elm$); for (const relocateData of relocateNodes) { const nodeToRelocate = relocateData.$nodeToRelocate$; if (!nodeToRelocate["s-ol"]) { const orgLocationNode = originalLocationDebugNode(nodeToRelocate) ; orgLocationNode["s-nr"] = nodeToRelocate; insertBefore(nodeToRelocate.parentNode, nodeToRelocate["s-ol"] = orgLocationNode, nodeToRelocate); } } for (const relocateData of relocateNodes) { const nodeToRelocate = relocateData.$nodeToRelocate$; const slotRefNode = relocateData.$slotRefNode$; if (slotRefNode) { const parentNodeRef = slotRefNode.parentNode; let insertBeforeNode = slotRefNode.nextSibling; { let orgLocationNode = (_a = nodeToRelocate["s-ol"]) == null ? void 0 : _a.previousSibling; while (orgLocationNode) { let refNode = (_b = orgLocationNode["s-nr"]) != null ? _b : null; if (refNode && refNode["s-sn"] === nodeToRelocate["s-sn"] && parentNodeRef === refNode.parentNode) { refNode = refNode.nextSibling; while (refNode === nodeToRelocate || (refNode == null ? void 0 : refNode["s-sr"])) { refNode = refNode == null ? void 0 : refNode.nextSibling; } if (!refNode || !refNode["s-nr"]) { insertBeforeNode = refNode; break; } } orgLocationNode = orgLocationNode.previousSibling; } } 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; } insertBefore(parentNodeRef, nodeToRelocate, insertBeforeNode); if (nodeToRelocate.nodeType === 1 /* ElementNode */) { nodeToRelocate.hidden = (_c = nodeToRelocate["s-ih"]) != null ? _c : false; } } } nodeToRelocate && typeof slotRefNode["s-rf"] === "function" && slotRefNode["s-rf"](nodeToRelocate); } else { if (nodeToRelocate.nodeType === 1 /* ElementNode */) { if (isInitialLoad) { nodeToRelocate["s-ih"] = (_d = nodeToRelocate.hidden) != null ? _d : false; } nodeToRelocate.hidden = true; } } } } if (checkSlotFallbackVisibility) { updateFallbackSlotVisibility(rootVnode.$elm$); } plt.$flags$ &= ~1 /* isTmpDisconnected */; relocateNodes.length = 0; } contentRef = void 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 addSlotRelocateNode = (newChild, slotNode, prepend, position) => { let slottedNodeLocation; if (newChild["s-ol"] && newChild["s-ol"].isConnected) { slottedNodeLocation = newChild["s-ol"]; } else { slottedNodeLocation = document.createTextNode(""); slottedNodeLocation["s-nr"] = newChild; } if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return; const parent = slotNode["s-cr"].parentNode; const appendMethod = prepend ? parent.__prepend || parent.prepend : parent.__appendChild || parent.appendChild; if (typeof position !== "undefined") { { slottedNodeLocation["s-oo"] = position; const childNodes = parent.__childNodes || parent.childNodes; const slotRelocateNodes = [slottedNodeLocation]; childNodes.forEach((n) => { if (n["s-nr"]) slotRelocateNodes.push(n); }); slotRelocateNodes.sort((a, b) => { if (!a["s-oo"] || a["s-oo"] < b["s-oo"]) return -1; else if (!b["s-oo"] || b["s-oo"] < a["s-oo"]) return 1; return 0; }); slotRelocateNodes.forEach((n) => appendMethod.call(parent, n)); } } else { appendMethod.call(parent, slottedNodeLocation); } newChild["s-ol"] = slottedNodeLocation; newChild["s-sh"] = slotNode["s-hn"]; }; var createTime = (fnName, tagName = "") => { { return () => { return; }; } }; var uniqueTime = (key, measureText) => { { return () => { return; }; } }; // src/runtime/client-hydrate.ts var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => { const endHydrate = createTime("hydrateClient", tagName); const shadowRoot = hostElm.shadowRoot; const childRenderNodes = []; const slotNodes = []; const slottedNodes = []; const shadowRootNodes = null; const vnode = newVNode(tagName, null); vnode.$elm$ = hostElm; if (!plt.$orgLocNodes$) { initializeDocumentHydrate(doc.body, plt.$orgLocNodes$ = /* @__PURE__ */ new Map()); } hostElm[HYDRATE_ID] = hostId; hostElm.removeAttribute(HYDRATE_ID); hostRef.$vnode$ = clientHydrate( vnode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, hostElm, hostId, slottedNodes ); let crIndex = 0; const crLength = childRenderNodes.length; let childRenderNode; for (crIndex; crIndex < crLength; crIndex++) { childRenderNode = childRenderNodes[crIndex]; const orgLocationId = childRenderNode.$hostId$ + "." + childRenderNode.$nodeId$; const orgLocationNode = plt.$orgLocNodes$.get(orgLocationId); const node = childRenderNode.$elm$; if (!shadowRoot) { node["s-hn"] = tagName.toUpperCase(); if (childRenderNode.$tag$ === "slot") { node["s-cr"] = hostElm["s-cr"]; } } if (orgLocationNode && orgLocationNode.isConnected) { if (shadowRoot && orgLocationNode["s-en"] === "") { orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling); } orgLocationNode.parentNode.removeChild(orgLocationNode); if (!shadowRoot) { node["s-oo"] = parseInt(childRenderNode.$nodeId$); } } plt.$orgLocNodes$.delete(orgLocationId); } const hosts = []; let snIndex = 0; const snLen = slottedNodes.length; let slotGroup; let snGroupIdx; let snGroupLen; let slottedItem; for (snIndex; snIndex < snLen; snIndex++) { slotGroup = slottedNodes[snIndex]; if (!slotGroup || !slotGroup.length) continue; snGroupLen = slotGroup.length; snGroupIdx = 0; for (snGroupIdx; snGroupIdx < snGroupLen; snGroupIdx++) { slottedItem = slotGroup[snGroupIdx]; if (!hosts[slottedItem.hostId]) { hosts[slottedItem.hostId] = plt.$orgLocNodes$.get(slottedItem.hostId); } if (!hosts[slottedItem.hostId]) continue; const hostEle = hosts[slottedItem.hostId]; if (!hostEle.shadowRoot || !shadowRoot) { slottedItem.slot["s-cr"] = hostEle["s-cr"]; if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) { slottedItem.slot["s-cr"] = hostEle; } else { const hostChildren = hostEle.__childNodes || hostEle.childNodes; slottedItem.slot["s-cr"] = hostChildren[0]; } addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"]); } if (hostEle.shadowRoot && slottedItem.node.parentElement !== hostEle) { hostEle.appendChild(slottedItem.node); } } } hostRef.$hostElement$ = hostElm; endHydrate(); }; var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => { let childNodeType; let childIdSplt; let childVNode; let i2; const scopeId2 = hostElm["s-sc"]; if (node.nodeType === 1 /* ElementNode */) { childNodeType = node.getAttribute(HYDRATE_CHILD_ID); if (childNodeType) { childIdSplt = childNodeType.split("."); if (childIdSplt[0] === hostId || childIdSplt[0] === "0") { childVNode = createSimpleVNode({ $flags$: 0, $hostId$: childIdSplt[0], $nodeId$: childIdSplt[1], $depth$: childIdSplt[2], $index$: childIdSplt[3], $tag$: node.tagName.toLowerCase(), $elm$: node, // If we don't add the initial classes to the VNode, the first `vdom-render.ts` reconciliation will fail: // client side changes before componentDidLoad will be ignored, `set-accessor.ts` will just take the element's initial classes $attrs$: { class: node.className } }); childRenderNodes.push(childVNode); node.removeAttribute(HYDRATE_CHILD_ID); if (!parentVNode.$children$) { parentVNode.$children$ = []; } const slotName = childVNode.$elm$.getAttribute("s-sn"); if (typeof slotName === "string") { if (childVNode.$tag$ === "slot-fb") { addSlot( slotName, childIdSplt[2], childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes ); } childVNode.$elm$["s-sn"] = slotName; childVNode.$elm$.removeAttribute("s-sn"); } if (childVNode.$index$ !== void 0) { parentVNode.$children$[childVNode.$index$] = childVNode; } if (scopeId2) node["s-si"] = scopeId2; parentVNode = childVNode; if (shadowRootNodes && childVNode.$depth$ === "0") { shadowRootNodes[childVNode.$index$] = childVNode.$elm$; } } } if (node.shadowRoot) { for (i2 = node.shadowRoot.childNodes.length - 1; i2 >= 0; i2--) { clientHydrate( parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node.shadowRoot.childNodes[i2], hostId, slottedNodes ); } } const nonShadowNodes = node.__childNodes || node.childNodes; for (i2 = nonShadowNodes.length - 1; i2 >= 0; i2--) { clientHydrate( parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, nonShadowNodes[i2], hostId, slottedNodes ); } } else if (node.nodeType === 8 /* CommentNode */) { childIdSplt = node.nodeValue.split("."); if (childIdSplt[1] === hostId || childIdSplt[1] === "0") { childNodeType = childIdSplt[0]; childVNode = createSimpleVNode({ $hostId$: childIdSplt[1], $nodeId$: childIdSplt[2], $depth$: childIdSplt[3], $index$: childIdSplt[4] || "0", $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 /* TextNode */) { childVNode.$text$ = childVNode.$elm$.textContent; childRenderNodes.push(childVNode); node.remove(); if (hostId === childVNode.$hostId$) { if (!parentVNode.$children$) { parentVNode.$children$ = []; } parentVNode.$children$[childVNode.$index$] = childVNode; } if (shadowRootNodes && childVNode.$depth$ === "0") { shadowRootNodes[childVNode.$index$] = childVNode.$elm$; } } } else if (childNodeType === COMMENT_NODE_ID) { childVNode.$elm$ = node.nextSibling; if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) { childRenderNodes.push(childVNode); node.remove(); } } else if (childVNode.$hostId$ === hostId) { if (childNodeType === SLOT_NODE_ID) { childVNode.$tag$ = "slot"; const slotName = node["s-sn"] = childVNode.$name$ = childIdSplt[5] || ""; addSlot( slotName, childIdSplt[2], childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes ); } else if (childNodeType === CONTENT_REF_ID) { { 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]; } return parentVNode; }; var initializeDocumentHydrate = (node, orgLocNodes) => { if (node.nodeType === 1 /* ElementNode */) { const componentId = node[HYDRATE_ID] || node.getAttribute(HYDRATE_ID); if (componentId) { orgLocNodes.set(componentId, node); } let i2 = 0; if (node.shadowRoot) { for (; i2 < node.shadowRoot.childNodes.length; i2++) { initializeDocumentHydrate(node.shadowRoot.childNodes[i2], orgLocNodes); } } const nonShadowNodes = node.__childNodes || node.childNodes; for (i2 = 0; i2 < nonShadowNodes.length; i2++) { initializeDocumentHydrate(nonShadowNodes[i2], orgLocNodes); } } else if (node.nodeType === 8 /* CommentNode */) { 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 createSimpleVNode = (vnode) => { const defaultVNode = { $flags$: 0, $hostId$: null, $nodeId$: null, $depth$: null, $index$: "0", $elm$: null, $attrs$: null, $children$: null, $key$: null, $name$: null, $tag$: null, $text$: null }; return { ...defaultVNode, ...vnode }; }; function addSlot(slotName, slotId, childVNode, node, parentVNode, childRenderNodes, slotNodes, shadowRootNodes, slottedNodes) { node["s-sr"] = true; const parentNodeId = (parentVNode == null ? void 0 : parentVNode.$elm$) ? parentVNode.$elm$["s-id"] || parentVNode.$elm$.getAttribute("s-id") : ""; { const slot = childVNode.$elm$; const shouldMove = parentNodeId && parentNodeId !== childVNode.$hostId$ && parentVNode.$elm$.shadowRoot; addSlottedNodes(slottedNodes, slotId, slotName, node, shouldMove ? parentNodeId : childVNode.$hostId$); if (shouldMove) { parentVNode.$elm$.insertBefore(slot, parentVNode.$elm$.children[0]); } childRenderNodes.push(childVNode); } slotNodes.push(childVNode); if (!parentVNode.$children$) { parentVNode.$children$ = []; } parentVNode.$children$[childVNode.$index$] = childVNode; } var addSlottedNodes = (slottedNodes, slotNodeId, slotName, slotNode, hostId) => { let slottedNode = slotNode.nextSibling; slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || []; while (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (slottedNode.nodeType === 8 /* CommentNode