@limetech/lime-elements
Version:
1,241 lines (1,226 loc) • 84 kB
JavaScript
const NAMESPACE = 'lime-elements';
const BUILD = /* lime-elements */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", lazyLoad: true, propChangeCallback: true, slotRelocation: true, state: true, updatable: true};
const globalScripts = () => {};
const globalStyles = "@charset \"UTF-8\";.limel-portal--container{font-family:var(--limel-portal-font-family, inherit);opacity:0;display:none}.limel-portal--container.is-visible{opacity:1;display:inline-block}.limel-portal--container.is-visible>*{will-change:opacity, transform}@keyframes fade-in{from{opacity:0;transform:scale(0.94)}to{opacity:1;transform:scale(1) translate3d(0, 0, 0)}}@keyframes fade-out{from{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(0.94) translate3d(0, 0, 0)}}.limel-portal--container>*{animation:fade-in 0.18s cubic-bezier(0.11, 0.59, 0.18, 1.26) forwards}.limel-portal--container.is-hiding>*{animation:fade-out 0.22s ease forwards}.limel-portal--container[data-popper-placement=left-start]>*{transform-origin:right top}.limel-portal--container[data-popper-placement=left]>*{transform-origin:right center}.limel-portal--container[data-popper-placement=left-end]>*{transform-origin:right bottom}.limel-portal--container[data-popper-placement=top-start]>*{transform-origin:left bottom}.limel-portal--container[data-popper-placement=top]>*{transform-origin:center bottom}.limel-portal--container[data-popper-placement=top-end]>*{transform-origin:right bottom}.limel-portal--container[data-popper-placement=right-start]>*{transform-origin:left top}.limel-portal--container[data-popper-placement=right]>*{transform-origin:left center}.limel-portal--container[data-popper-placement=right-end]>*{transform-origin:left bottom}.limel-portal--container[data-popper-placement=bottom-start]>*{transform-origin:left top}.limel-portal--container[data-popper-placement=bottom]>*{transform-origin:center top}.limel-portal--container[data-popper-placement=bottom-end]>*{transform-origin:right top}:root{--lime-deep-red:rgb(var(--lime-brand-color-deep-red));--lime-red:rgb(var(--lime-brand-color-sellable-orange));--lime-orange:rgb(var(--lime-brand-color-orange));--lime-yellow:rgb(var(--lime-brand-color-yellow));--lime-green:rgb(var(--lime-brand-color-lime-green));--lime-turquoise:rgb(var(--lime-brand-color-flexible-turquoise));--lime-blue:rgb(var(--lime-brand-color-simple-blue));--lime-dark-blue:rgb(var(--lime-brand-color-dark-blue));--lime-magenta:rgb(var(--lime-brand-color-loving-magenta));--lime-light-grey:rgb(var(--lime-brand-color-light-grey));--lime-dark-grey:rgb(var(--lime-brand-color-grey));--color-percent--0:rgb(var(--color-gray-default));--color-percent--0to10:rgb(var(--color-red-dark));--color-percent--10to20:rgb(var(--color-red-default));--color-percent--20to30:rgb(var(--color-coral-default));--color-percent--30to40:rgb(var(--color-orange-default));--color-percent--40to50:rgb(var(--color-amber-default));--color-percent--50to60:rgb(var(--color-yellow-default));--color-percent--60to70:rgb(var(--color-grass-default));--color-percent--70to80:rgb(var(--color-lime-default));--color-percent--80to90:rgb(var(--color-teal-default));--color-percent--90to100:rgb(var(--color-teal-dark))}:root{--shadow-brighten-edges-inside:0 -1px 0.26rem rgb(var(--color-white), 0.06) inset,\n 0 0 0 1px rgb(var(--color-white), 0.06) inset;--shadow-brighten-edges-outside:0 0.125rem 0.26rem rgb(var(--color-white), 0.06),\n 0 0 0 1px rgb(var(--color-white), 0.06);--shadow-focused-state:0 0 0 0.125rem\n var(--lime-primary-color, var(--limel-theme-primary-color));--shadow-error-state:0 0 0 0.125rem rgb(var(--color-red-default));--button-shadow-normal:0 0.09375rem 0.225rem 0 rgb(var(--color-black), 0.232),\n 0 0.01875rem 0.05625rem 0 rgb(var(--color-black), 0.208),\n var(--shadow-brighten-edges-inside);--button-shadow-hovered:0 0.125rem 0.375rem rgb(var(--color-black), 0.25),\n 0 0.4rem 0.475rem -0.3rem rgb(var(--color-black), 0.1),\n var(--shadow-brighten-edges-inside);--button-shadow-pressed:0 0.0625rem 0.1875rem 0 rgb(var(--color-black), 0.132),\n 0 0.01875rem 0.05625rem 0 rgb(var(--color-black), 0.108),\n var(--shadow-brighten-edges-inside);--button-shadow-inset:0 0.03125rem 0.21875rem 0 rgb(var(--color-black), 0.132) inset,\n 0 0.01875rem 0.05625rem 0 rgb(var(--color-black), 0.108) inset,\n var(--shadow-brighten-edges-outside),\n 0 0 0.25rem rgb(var(--color-white), 0.9);--button-shadow-inset-pressed:0 0.03125rem 0.34375rem 0 rgb(var(--color-black), 0.132) inset,\n 0 0.01875rem 0.11875rem 0 rgb(var(--color-black), 0.12) inset,\n 0 -1px 0.3rem rgb(var(--color-white), 0.9),\n var(--shadow-brighten-edges-outside);--shadow-depth-8:0 0.2rem 0.45rem 0 rgb(var(--color-black), 0.132),\n 0 0.0375rem 0.1125rem 0 rgb(var(--color-black), 0.108);--shadow-depth-8-focused:var(--shadow-depth-8), var(--shadow-focused-state);--shadow-depth-8-error:var(--shadow-depth-8), var(--shadow-error-state);--shadow-depth-8-reversed:0 -0.2rem 0.45rem 0 rgb(var(--color-black), 0.132),\n 0 -0.0375rem 0.1125rem 0 rgb(var(--color-black), 0.108);--shadow-depth-16:0 0.4rem 0.9rem 0 rgb(var(--color-black), 0.132),\n 0 0.075rem 0.225rem 0 rgb(var(--color-black), 0.108);--shadow-depth-16-focused:var(--shadow-depth-16), var(--shadow-focused-state);--shadow-depth-64:0 1.6rem 3.6rem 0 rgb(var(--color-black), 0.22),\n 0 0.3rem 0.9rem 0 rgb(var(--color-black), 0.18);--shadow-depth-64-focused:var(--shadow-depth-64), var(--shadow-focused-state);--shadow-inflated-8:-0.125rem -0.125rem 0.375rem rgb(var(--color-black), 0.01),\n -0.25rem -0.25rem 0.625rem rgb(var(--color-white), 0.6),\n 0.25rem 0.25rem 0.625rem rgb(var(--color-black), 0.05),\n 0.0625rem 0.0625rem 0.625rem rgb(var(--color-white), 0.7),\n -1px -1px 0 1px rgb(var(--color-black), 0.07) inset,\n 0 0 1px 1px rgb(var(--color-white), 0.98) inset;--shadow-inflated-16:-0.1875rem -0.1875rem 0.375rem rgb(var(--color-black), 0.01),\n -0.375rem -0.375rem 1rem rgb(var(--color-white), 0.8),\n 0.375rem 0.375rem 1rem rgb(var(--color-black), 0.05),\n 0.125rem 0.125rem 0.625rem rgb(var(--color-white), 0.7),\n -1px -1px 0 1px rgb(var(--color-black), 0.07) inset,\n 0 0 1px 1px rgb(var(--color-white), 0.98) inset;--shadow-inflated-64:-0.1875rem -0.1875rem 0.375rem rgb(var(--color-black), 0.01),\n -0.625rem -0.625rem 1.875rem rgb(var(--color-white), 1),\n 0.625rem 0.625rem 2.25rem rgb(var(--color-black), 0.06),\n 0.125rem 0.125rem 0.625rem rgb(var(--color-white), 0.7),\n -1px -1px 0 1px rgb(var(--color-black), 0.07) inset,\n 0 0 1px 1px rgb(var(--color-white), 0.98) inset}.CodeMirror-lint-tooltip.cm-s-lime{position:fixed;z-index:var(--tooltip-z-index, var(--dropdown-z-index, 130));transition:opacity 0.4s ease 0s;opacity:0;color:var(--limel-theme-text-primary-on-background-color);background-color:var(--lime-on-primary-color, var(--limel-theme-on-primary-color));font-family:monospace;font-size:var(--limel-theme-default-font-size);white-space:pre-wrap;padding:0.25rem 0.5rem;border-radius:0.5rem;max-width:40rem;box-shadow:var(--shadow-depth-64)}:root{--mdc-theme-primary:var(\n --lime-primary-color,\n var(--limel-theme-primary-color)\n );--mdc-theme-on-primary:var(\n --lime-on-primary-color,\n var(--limel-theme-on-primary-color)\n );--mdc-theme-text-disabled-on-background:var(\n --limel-theme-text-disabled-on-background-color\n );--mdc-theme-text-primary-on-background:var(\n --limel-theme-text-primary-on-background-color\n );--mdc-theme-text-secondary-on-background:var(\n --limel-theme-text-secondary-on-background-color\n );--mdc-theme-surface:var(--limel-theme-surface-background-color);--mdc-theme-on-surface:var(--limel-theme-on-surface-color);--limel-theme-primary-color:rgb(var(--color-teal-default));--limel-theme-on-primary-color:rgb(var(--contrast-100));--limel-theme-text-disabled-on-background-color:rgb(\n var(--contrast-1700),\n 0.38\n );--limel-theme-text-primary-on-background-color:rgb(\n var(--contrast-1700),\n 0.87\n );--limel-theme-text-secondary-on-background-color:rgb(\n var(--contrast-1700),\n 0.54\n );--limel-theme-error-color:rgb(var(--color-red-dark));--limel-theme-error-text-color:rgb(var(--color-red-darker));--limel-theme-surface-background-color:rgb(var(--contrast-100));--limel-theme-on-surface-color:rgb(var(--contrast-1500));--limel-theme-text-disabled-color:rgb(var(--contrast-900));--lime-elevated-surface-background-color:rgb(var(--contrast-100));--limel-theme-default-font-size:0.875rem;--limel-theme-default-small-font-size:0.8125rem}";
/*
Stencil Client Platform v4.43.1 | MIT Licensed | https://stenciljs.com
*/
// src/utils/constants.ts
var SVG_NS = "http://www.w3.org/2000/svg";
var HTML_NS = "http://www.w3.org/1999/xhtml";
var reWireGetterSetter = (instance, hostRef) => {
var _a;
const cmpMeta = hostRef.$cmpMeta$;
const members = Object.entries((_a = cmpMeta.$members$) != null ? _a : {});
members.map(([memberName, [memberFlags]]) => {
if ((memberFlags & 31 /* Prop */ || memberFlags & 32 /* State */)) {
const ogValue = instance[memberName];
const ogDescriptor = getPropertyDescriptor(Object.getPrototypeOf(instance), memberName) || Object.getOwnPropertyDescriptor(instance, memberName);
if (ogDescriptor) {
Object.defineProperty(instance, memberName, {
get() {
return ogDescriptor.get.call(this);
},
set(newValue) {
ogDescriptor.set.call(this, newValue);
},
configurable: true,
enumerable: true
});
}
instance[memberName] = hostRef.$instanceValues$.has(memberName) ? hostRef.$instanceValues$.get(memberName) : ogValue;
}
});
};
function getPropertyDescriptor(obj, memberName) {
while (obj) {
const desc = Object.getOwnPropertyDescriptor(obj, memberName);
if (desc == null ? void 0 : desc.get) return desc;
obj = Object.getPrototypeOf(obj);
}
return void 0;
}
// src/client/client-host-ref.ts
var getHostRef = (ref) => {
if (ref.__stencil__getHostRef) {
return ref.__stencil__getHostRef();
}
return void 0;
};
var registerInstance = (lazyInstance, hostRef) => {
if (!hostRef) return;
lazyInstance.__stencil__getHostRef = () => hostRef;
hostRef.$lazyInstance$ = lazyInstance;
if (hostRef.$cmpMeta$.$flags$ & 512 /* hasModernPropertyDecls */ && (BUILD.state)) {
reWireGetterSetter(lazyInstance, hostRef);
}
};
var registerHost = (hostElement, cmpMeta) => {
const hostRef = {
$flags$: 0,
$hostElement$: hostElement,
$cmpMeta$: cmpMeta,
$instanceValues$: /* @__PURE__ */ new Map(),
$serializerValues$: /* @__PURE__ */ new Map()
};
{
hostRef.$onInstancePromise$ = new Promise((r) => hostRef.$onInstanceResolve$ = r);
}
{
hostRef.$onReadyPromise$ = new Promise((r) => hostRef.$onReadyResolve$ = r);
hostElement["s-p"] = [];
hostElement["s-rc"] = [];
}
{
hostRef.$fetchedCbList$ = [];
}
const ref = hostRef;
hostElement.__stencil__getHostRef = () => ref;
return ref;
};
var isMemberInElement = (elm, memberName) => memberName in elm;
var consoleError = (e, el) => (0, console.error)(e, el);
// src/client/client-load-module.ts
var cmpModules = /* @__PURE__ */ new Map();
var loadModule = (cmpMeta, hostRef, hmrVersionId) => {
const exportName = cmpMeta.$tagName$.replace(/-/g, "_");
const bundleId = cmpMeta.$lazyBundleId$;
if (!bundleId) {
return void 0;
}
const module = cmpModules.get(bundleId) ;
if (module) {
return module[exportName];
}
/*!__STENCIL_STATIC_IMPORT_SWITCH__*/
return import(
/* @vite-ignore */
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${""}`
).then(
(importedModule) => {
{
cmpModules.set(bundleId, importedModule);
}
return importedModule[exportName];
},
(e) => {
consoleError(e, hostRef.$hostElement$);
}
);
};
// src/client/client-style.ts
var styles = /* @__PURE__ */ new Map();
var HYDRATED_CSS = "{visibility:hidden}.hydrated{visibility:inherit}";
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
var XLINK_NS = "http://www.w3.org/1999/xlink";
var win = typeof window !== "undefined" ? window : {};
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 supportsListenerOptions = /* @__PURE__ */ (() => {
var _a;
let supportsListenerOptions2 = false;
try {
(_a = win.document) == null ? void 0 : _a.addEventListener(
"e",
null,
Object.defineProperty({}, "passive", {
get() {
supportsListenerOptions2 = true;
}
})
);
} catch (e) {
}
return supportsListenerOptions2;
})();
var promiseResolve = (v) => Promise.resolve(v);
var supportsConstructableStylesheets = /* @__PURE__ */ (() => {
try {
if (!win.document.adoptedStyleSheets) {
return false;
}
new CSSStyleSheet();
return typeof new CSSStyleSheet().replaceSync === "function";
} catch (e) {
}
return false;
})() ;
var supportsMutableAdoptedStyleSheets = supportsConstructableStylesheets ? /* @__PURE__ */ (() => !!win.document && Object.getOwnPropertyDescriptor(win.document.adoptedStyleSheets, "length").writable)() : false;
var queuePending = false;
var queueDomReads = [];
var queueDomWrites = [];
var queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
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 flush = () => {
consume(queueDomReads);
{
consume(queueDomWrites);
if (queuePending = queueDomReads.length > 0) {
plt.raf(flush);
}
}
};
var nextTick = (cb) => promiseResolve().then(cb);
var writeTask = /* @__PURE__ */ queueTask(queueDomWrites, true);
// src/utils/style.ts
function createStyleSheetIfNeededAndSupported(styles2) {
if (!supportsConstructableStylesheets) return void 0;
const sheet = new CSSStyleSheet();
sheet.replaceSync(styles2);
return sheet;
}
// src/utils/shadow-root.ts
var globalStyleSheet;
function createShadowRoot(cmpMeta) {
var _a;
const opts = { mode: "open" };
{
opts.delegatesFocus = !!(cmpMeta.$flags$ & 16 /* shadowDelegatesFocus */);
}
const shadowRoot = this.attachShadow(opts);
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported(globalStyles)) != null ? _a : null;
if (globalStyleSheet) {
if (supportsMutableAdoptedStyleSheets) {
shadowRoot.adoptedStyleSheets.push(globalStyleSheet);
} else {
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
}
} else if (!supportsConstructableStylesheets) {
const styleElm = document.createElement("style");
styleElm.innerHTML = globalStyles;
shadowRoot.prepend(styleElm);
}
}
var updateFallbackSlotVisibility = (elm) => {
const childNodes = internalCall(elm, "childNodes");
if (elm.tagName && elm.tagName.includes("-") && elm["s-cr"] && elm.tagName !== "SLOT-FB") {
getHostSlotNodes(childNodes, elm.tagName).forEach((slotNode) => {
if (slotNode.nodeType === 1 /* ElementNode */ && slotNode.tagName === "SLOT-FB") {
if (getSlotChildSiblings(slotNode, getSlotName(slotNode), false).length) {
slotNode.hidden = true;
} else {
slotNode.hidden = false;
}
}
});
}
let i2 = 0;
for (i2 = 0; i2 < childNodes.length; i2++) {
const childNode = childNodes[i2];
if (childNode.nodeType === 1 /* ElementNode */ && internalCall(childNode, "childNodes").length) {
updateFallbackSlotVisibility(childNode);
}
}
};
var getSlottedChildNodes = (childNodes) => {
const result = [];
for (let i2 = 0; i2 < childNodes.length; i2++) {
const slottedNode = childNodes[i2]["s-nr"] || void 0;
if (slottedNode && slottedNode.isConnected) {
result.push(slottedNode);
}
}
return result;
};
function getHostSlotNodes(childNodes, hostName, slotName) {
let i2 = 0;
let slottedNodes = [];
let childNode;
for (; i2 < childNodes.length; i2++) {
childNode = childNodes[i2];
if (childNode["s-sr"] && (!hostName || childNode["s-hn"] === hostName) && (slotName === void 0 || getSlotName(childNode) === slotName)) {
slottedNodes.push(childNode);
if (typeof slotName !== "undefined") return slottedNodes;
}
slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode.childNodes, hostName, slotName)];
}
return slottedNodes;
}
var getSlotChildSiblings = (slot, slotName, includeSlot = true) => {
const childNodes = [];
if (includeSlot && slot["s-sr"] || !slot["s-sr"]) childNodes.push(slot);
let node = slot;
while (node = node.nextSibling) {
if (getSlotName(node) === slotName && (includeSlot || !node["s-sr"])) childNodes.push(node);
}
return childNodes;
};
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 getSlotName = (node) => typeof node["s-sn"] === "string" ? node["s-sn"] : node.nodeType === 1 && node.getAttribute("slot") || void 0;
function patchSlotNode(node) {
if (node.assignedElements || node.assignedNodes || !node["s-sr"]) return;
const assignedFactory = (elementsOnly) => (function(opts) {
const toReturn = [];
const slotName = this["s-sn"];
if (opts == null ? void 0 : opts.flatten) {
console.error(`
Flattening is not supported for Stencil non-shadow slots.
You can use \`.childNodes\` to nested slot fallback content.
If you have a particular use case, please open an issue on the Stencil repo.
`);
}
const parent = this["s-cr"].parentElement;
const slottedNodes = parent.__childNodes ? parent.childNodes : getSlottedChildNodes(parent.childNodes);
slottedNodes.forEach((n) => {
if (slotName === getSlotName(n)) {
toReturn.push(n);
}
});
if (elementsOnly) {
return toReturn.filter((n) => n.nodeType === 1 /* ElementNode */);
}
return toReturn;
}).bind(node);
node.assignedElements = assignedFactory(true);
node.assignedNodes = assignedFactory(false);
}
function dispatchSlotChangeEvent(elm) {
elm.dispatchEvent(new CustomEvent("slotchange", { bubbles: false, cancelable: false, composed: false }));
}
function findSlotFromSlottedNode(slottedNode, parentHost) {
var _a;
parentHost = parentHost || ((_a = slottedNode["s-ol"]) == null ? void 0 : _a.parentElement);
if (!parentHost) return { slotNode: null, slotName: "" };
const slotName = slottedNode["s-sn"] = getSlotName(slottedNode) || "";
const childNodes = internalCall(parentHost, "childNodes");
const slotNode = getHostSlotNodes(childNodes, parentHost.tagName, slotName)[0];
return { slotNode, slotName };
}
function internalCall(node, method) {
if ("__" + method in node) {
const toReturn = node["__" + method];
if (typeof toReturn !== "function") return toReturn;
return toReturn.bind(node);
} else {
if (typeof node[method] !== "function") return node[method];
return node[method].bind(node);
}
}
var createTime = (fnName, tagName = "") => {
{
return () => {
return;
};
}
};
var uniqueTime = (key, measureText) => {
{
return () => {
return;
};
}
};
// src/utils/query-nonce-meta-tag-content.ts
function queryNonceMetaTagContent(doc) {
var _a, _b, _c;
return (_c = (_b = (_a = doc.head) == null ? void 0 : _a.querySelector('meta[name="csp-nonce"]')) == null ? void 0 : _b.getAttribute("content")) != null ? _c : void 0;
}
// src/runtime/styles.ts
var rootAppliedStyles = /* @__PURE__ */ new WeakMap();
var registerStyle = (scopeId2, cssText, allowCS) => {
let style = styles.get(scopeId2);
if (supportsConstructableStylesheets && allowCS) {
style = style || new CSSStyleSheet();
if (typeof style === "string") {
style = cssText;
} else {
style.replaceSync(cssText);
}
} else {
style = cssText;
}
styles.set(scopeId2, style);
};
var addStyle = (styleContainerNode, cmpMeta, mode) => {
var _a, _b, _c;
const scopeId2 = getScopeId(cmpMeta);
const style = styles.get(scopeId2);
if (!win.document) {
return scopeId2;
}
styleContainerNode = styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : win.document;
if (style) {
if (typeof style === "string") {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
}
if (!appliedStyles.has(scopeId2)) {
styleElm = win.document.createElement("style");
styleElm.textContent = style;
const nonce = (_a = plt.$nonce$) != null ? _a : queryNonceMetaTagContent(win.document);
if (nonce != null) {
styleElm.setAttribute("nonce", nonce);
}
if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
if (styleContainerNode.nodeName === "HEAD") {
const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
styleContainerNode.insertBefore(
styleElm,
(referenceNode2 == null ? void 0 : referenceNode2.parentNode) === styleContainerNode ? referenceNode2 : null
);
} else if ("host" in styleContainerNode) {
if (supportsConstructableStylesheets) {
const currentWindow = (_b = styleContainerNode.defaultView) != null ? _b : styleContainerNode.ownerDocument.defaultView;
const stylesheet = new currentWindow.CSSStyleSheet();
stylesheet.replaceSync(style);
if (supportsMutableAdoptedStyleSheets) {
styleContainerNode.adoptedStyleSheets.unshift(stylesheet);
} else {
styleContainerNode.adoptedStyleSheets = [stylesheet, ...styleContainerNode.adoptedStyleSheets];
}
} else {
const existingStyleContainer = styleContainerNode.querySelector("style");
if (existingStyleContainer && true) {
existingStyleContainer.textContent = style + existingStyleContainer.textContent;
} else {
styleContainerNode.prepend(styleElm);
}
}
} else {
styleContainerNode.append(styleElm);
}
}
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
styleContainerNode.insertBefore(styleElm, null);
}
if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
styleElm.textContent += SLOT_FB_CSS;
}
if (appliedStyles) {
appliedStyles.add(scopeId2);
}
}
} else {
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = /* @__PURE__ */ new Set());
}
if (!appliedStyles.has(scopeId2)) {
const currentWindow = (_c = styleContainerNode.defaultView) != null ? _c : styleContainerNode.ownerDocument.defaultView;
let stylesheet;
if (style.constructor === currentWindow.CSSStyleSheet) {
stylesheet = style;
} else {
stylesheet = new currentWindow.CSSStyleSheet();
for (let i2 = 0; i2 < style.cssRules.length; i2++) {
stylesheet.insertRule(style.cssRules[i2].cssText, i2);
}
}
if (supportsMutableAdoptedStyleSheets) {
styleContainerNode.adoptedStyleSheets.push(stylesheet);
} else {
styleContainerNode.adoptedStyleSheets = [...styleContainerNode.adoptedStyleSheets, stylesheet];
}
appliedStyles.add(scopeId2);
}
}
}
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(
elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(),
cmpMeta);
if (flags & 10 /* needsScopedEncapsulation */) {
elm["s-sc"] = scopeId2;
elm.classList.add(scopeId2 + "-h");
}
endAttachStyles();
};
var getScopeId = (cmp, mode) => "sc-" + (cmp.$tagName$);
var isComplexType = (o) => {
o = typeof o;
return o === "object" || o === "function";
};
// src/runtime/vdom/h.ts
var h = (nodeName, vnodeData, ...children) => {
if (typeof nodeName === "string") {
nodeName = transformTag(nodeName);
}
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,
// Normalize undefined to null to prevent rendering "undefined" as text
$text$: text != null ? text : null,
$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;
};
// src/runtime/parse-property-value.ts
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
if (propValue != null && !isComplexType(propValue)) {
if (propType & 4 /* Boolean */) {
{
return propValue === "false" ? false : propValue === "" || !!propValue;
}
}
if (propType & 2 /* Number */) {
return typeof propValue === "string" ? parseFloat(propValue) : typeof propValue === "number" ? propValue : NaN;
}
if (propType & 1 /* String */) {
return String(propValue);
}
return propValue;
}
return propValue;
};
var getElement = (ref) => {
var _a;
return (_a = getHostRef(ref)) == null ? void 0 : _a.$hostElement$ ;
};
// src/runtime/event-emitter.ts
var createEvent = (ref, name, flags) => {
const elm = getElement(ref);
return {
emit: (detail) => {
return emitEvent(elm, name, {
bubbles: true,
composed: true,
cancelable: true,
detail
});
}
};
};
var emitEvent = (elm, name, opts) => {
const ev = plt.ce(name, opts);
elm.dispatchEvent(ev);
return ev;
};
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
if (oldValue === newValue) {
return;
}
let isProp = isMemberInElement(elm, memberName);
let ln = memberName.toLowerCase();
if (memberName === "class") {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
let newClasses = parseClassList(newValue);
{
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) {
if (prop.includes("-")) {
elm.style.removeProperty(prop);
} else {
elm.style[prop] = "";
}
}
}
}
for (const prop in newValue) {
if (!oldValue || newValue[prop] !== oldValue[prop]) {
if (prop.includes("-")) {
elm.style.setProperty(prop, newValue[prop]);
} else {
elm.style[prop] = newValue[prop];
}
}
}
} else if (memberName === "key") ; else if (memberName === "ref") {
if (newValue) {
queueRefAttachment(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 if (memberName[0] === "a" && memberName.startsWith("attr:")) {
const propName = memberName.slice(5);
let attrName;
{
const hostRef = getHostRef(elm);
if (hostRef && hostRef.$cmpMeta$ && hostRef.$cmpMeta$.$members$) {
const memberMeta = hostRef.$cmpMeta$.$members$[propName];
if (memberMeta && memberMeta[1]) {
attrName = memberMeta[1];
}
}
}
if (!attrName) {
attrName = propName.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
}
if (newValue == null || newValue === false) {
if (newValue !== false || elm.getAttribute(attrName) === "") {
elm.removeAttribute(attrName);
}
} else {
elm.setAttribute(attrName, newValue === true ? "" : newValue);
}
return;
} else if (memberName[0] === "p" && memberName.startsWith("prop:")) {
const propName = memberName.slice(5);
try {
elm[propName] = newValue;
} catch (e) {
}
return;
} 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 if (elm[memberName] !== newValue) {
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 && elm.nodeType === 1 /* ElementNode */) {
newValue = newValue === true ? "" : newValue;
if (xlink) {
elm.setAttributeNS(XLINK_NS, memberName, newValue);
} else {
elm.setAttribute(memberName, newValue);
}
}
}
};
var parseClassListRegex = /\s/;
var parseClassList = (value) => {
if (typeof value === "object" && value && "baseVal" in value) {
value = value.baseVal;
}
if (!value || typeof value !== "string") {
return [];
}
return 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, isInitialRender) => {
const elm = newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host ? newVnode.$elm$.host : newVnode.$elm$;
const oldVnodeAttrs = oldVnode && oldVnode.$attrs$ || {};
const newVnodeAttrs = newVnode.$attrs$ || {};
{
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
);
}
var contentRef;
var hostTagName;
var useNativeShadowDom = false;
var checkSlotFallbackVisibility = false;
var checkSlotRelocate = false;
var isSvgMode = false;
var refCallbacksToRemove = [];
var refCallbacksToAttach = [];
var createElm = (oldParentVNode, newParentVNode, childIndex) => {
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$ = win.document.createTextNode(newVNode2.$text$);
} else if (newVNode2.$flags$ & 1 /* isSlotReference */) {
elm = newVNode2.$elm$ = win.document.createTextNode("");
{
updateElement(null, newVNode2, isSvgMode);
}
} else {
if (!isSvgMode) {
isSvgMode = newVNode2.$tag$ === "svg";
}
if (!win.document) {
throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM.");
}
elm = newVNode2.$elm$ = win.document.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);
}
if (newVNode2.$children$) {
const appendTarget = newVNode2.$tag$ === "template" ? elm.content : elm;
for (i2 = 0; i2 < newVNode2.$children$.length; ++i2) {
childNode = createElm(oldParentVNode, newVNode2, i2);
if (childNode) {
appendTarget.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;
patchSlotNode(elm);
oldVNode = oldParentVNode && oldParentVNode.$children$ && oldParentVNode.$children$[childIndex];
if (oldVNode && oldVNode.$tag$ === newVNode2.$tag$ && oldParentVNode.$elm$) {
relocateToHostRoot(oldParentVNode.$elm$);
}
}
}
return elm;
};
var relocateToHostRoot = (parentElm) => {
plt.$flags$ |= 1 /* isTmpDisconnected */;
const host = parentElm.closest(hostTagName.toLowerCase());
if (host != null) {
const contentRefNode = Array.from(host.__childNodes || host.childNodes).find(
(ref) => ref["s-cr"]
);
const childNodeArray = Array.from(
parentElm.__childNodes || parentElm.childNodes
);
for (const childNode of contentRefNode ? childNodeArray.reverse() : childNodeArray) {
if (childNode["s-sh"] != null) {
insertBefore(host, childNode, contentRefNode != null ? contentRefNode : null);
childNode["s-sh"] = void 0;
checkSlotRelocate = true;
}
}
}
plt.$flags$ &= -2 /* isTmpDisconnected */;
};
var putBackInOriginalLocation = (parentElm, recursive) => {
plt.$flags$ |= 1 /* isTmpDisconnected */;
const oldSlotChildNodes = Array.from(parentElm.__childNodes || parentElm.childNodes);
if (parentElm["s-sr"]) {
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(referenceNode(childNode).parentNode, 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$ &= -2 /* isTmpDisconnected */;
};
var addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = parentElm["s-cr"] && parentElm["s-cr"].parentNode || parentElm;
let childNode;
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
if (parentVNode.$tag$ === "template") {
containerElm = containerElm.content;
}
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;
const containerElm = newVNode2.$tag$ === "template" ? parentElm.content : parentElm;
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(containerElm, 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(containerElm, 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(
referenceNode(oldStartVnode.$elm$).parentNode,
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") {
return leftVNode.$name$ === rightVNode.$name$;
}
if (!isInitialRender) {
return leftVNode.$key$ === rightVNode.$key$;
}
if (isInitialRender && !leftVNode.$key$ && rightVNode.$key$) {
leftVNode.$key$ = rightVNode.$key$;
}
return true;
}
return false;
};
var referenceNode = (node) => node && node["s-ol"] || node;
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) {
if (oldVNode.$name$ !== newVNode2.$name$) {
newVNode2.$elm$["s-sn"] = newVNode2.$name$ || "";
relocateToHostRoot(newVNode2.$elm$.parentElement);
}
}
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);
} else ;
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 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"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
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 nullifyVNodeRefs = (vNode) => {
{
if (vNode.$attrs$ && vNode.$attrs$.ref) {
refCallbacksToRemove.push(() => vNode.$attrs$.ref(null));
}
vNode.$children$ && vNode.$children$.map(nullifyVNodeRefs);
}
};
var queueRefAttachment = (refCallback, elm) => {
{
refCallbacksToAttach.push(() => refCallback(elm));
}
};
var flushQueuedRefCallbacks = () => {
{
refCallbacksToRemove.forEach((cb) => cb());
refCallbacksToRemove.length = 0;
refCallbacksToAttach.forEach((cb) => cb());
refCallbacksToAttach.length = 0;
}
};
var insertBefore = (parent, newNode, reference, isInitialLoad) => {
{
if (typeof newNode["s-sn"] === "string") {
parent.insertBefore(newNode, reference);
const { slotNode } = findSlotFromSlottedNode(newNode);
if (slotNode && !isInitialLoad) dispatchSlotChangeEvent(slotNode