@postnord/web-components
Version:
PostNord Web Components
1,395 lines (1,363 loc) • 1.4 MB
JavaScript
/*!
* Built with Stencil
* By PostNord.
*/
import { Readable } from '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);
// Tag transform functions are provided from the outer scope
// This ensures the factory uses the same instance as the runner
var setTagTransformer = $stencilTagTransform.setTagTransformer;
var transformTag = $stencilTagTransform.transformTag;
var CharacterData = $stencilWindow.CharacterData;
var CSS = $stencilWindow.CSS;
var CustomEvent = $stencilWindow.CustomEvent;
var CSSStyleSheet = $stencilWindow.CSSStyleSheet;
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 = 'postnord-web-components';
const BUILD = /* postnord-web-components */ { hotModuleReplacement: false, hydratedSelectorName: "hydrated", shadowDom: false, slotRelocation: true, state: true, updatable: true};
/*
Stencil Hydrate Platform v4.41.3 | MIT Licensed | https://stenciljs.com
*/
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __typeError = (msg) => {
throw TypeError(msg);
};
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
__defProp(target, "default", { value: mod, enumerable: true }) ,
mod
));
var __publicField = (obj, key, value) => __defNormalProp(obj, key + "" , value);
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
// node_modules/balanced-match/index.js
var require_balanced_match = __commonJS({
"node_modules/balanced-match/index.js"(exports, module) {
module.exports = balanced;
function balanced(a, b, str) {
if (a instanceof RegExp) a = maybeMatch(a, str);
if (b instanceof RegExp) b = maybeMatch(b, str);
var r = range(a, b, str);
return r && {
start: r[0],
end: r[1],
pre: str.slice(0, r[0]),
body: str.slice(r[0] + a.length, r[1]),
post: str.slice(r[1] + b.length)
};
}
function maybeMatch(reg, str) {
var m = str.match(reg);
return m ? m[0] : null;
}
balanced.range = range;
function range(a, b, str) {
var begs, beg, left, right, result;
var ai = str.indexOf(a);
var bi = str.indexOf(b, ai + 1);
var i2 = ai;
if (ai >= 0 && bi > 0) {
if (a === b) {
return [ai, bi];
}
begs = [];
left = str.length;
while (i2 >= 0 && !result) {
if (i2 == ai) {
begs.push(i2);
ai = str.indexOf(a, i2 + 1);
} else if (begs.length == 1) {
result = [begs.pop(), bi];
} else {
beg = begs.pop();
if (beg < left) {
left = beg;
right = bi;
}
bi = str.indexOf(b, i2 + 1);
}
i2 = ai < bi && ai >= 0 ? ai : bi;
}
if (begs.length) {
result = [left, right];
}
}
return result;
}
}
});
// node_modules/brace-expansion/index.js
var require_brace_expansion = __commonJS({
"node_modules/brace-expansion/index.js"(exports, module) {
var balanced = require_balanced_match();
module.exports = expandTop;
var escSlash = "\0SLASH" + Math.random() + "\0";
var escOpen = "\0OPEN" + Math.random() + "\0";
var escClose = "\0CLOSE" + Math.random() + "\0";
var escComma = "\0COMMA" + Math.random() + "\0";
var escPeriod = "\0PERIOD" + Math.random() + "\0";
function numeric(str) {
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
}
function escapeBraces(str) {
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
}
function unescapeBraces(str) {
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
}
function parseCommaParts(str) {
if (!str)
return [""];
var parts = [];
var m = balanced("{", "}", str);
if (!m)
return str.split(",");
var pre = m.pre;
var body = m.body;
var post = m.post;
var p = pre.split(",");
p[p.length - 1] += "{" + body + "}";
var postParts = parseCommaParts(post);
if (post.length) {
p[p.length - 1] += postParts.shift();
p.push.apply(p, postParts);
}
parts.push.apply(parts, p);
return parts;
}
function expandTop(str) {
if (!str)
return [];
if (str.substr(0, 2) === "{}") {
str = "\\{\\}" + str.substr(2);
}
return expand2(escapeBraces(str), true).map(unescapeBraces);
}
function embrace(str) {
return "{" + str + "}";
}
function isPadded(el) {
return /^-?0\d/.test(el);
}
function lte(i2, y) {
return i2 <= y;
}
function gte(i2, y) {
return i2 >= y;
}
function expand2(str, isTop) {
var expansions = [];
var m = balanced("{", "}", str);
if (!m) return [str];
var pre = m.pre;
var post = m.post.length ? expand2(m.post, false) : [""];
if (/\$$/.test(m.pre)) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + "{" + m.body + "}" + post[k];
expansions.push(expansion);
}
} else {
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
var isSequence = isNumericSequence || isAlphaSequence;
var isOptions = m.body.indexOf(",") >= 0;
if (!isSequence && !isOptions) {
if (m.post.match(/,(?!,).*\}/)) {
str = m.pre + "{" + m.body + escClose + m.post;
return expand2(str);
}
return [str];
}
var n;
if (isSequence) {
n = m.body.split(/\.\./);
} else {
n = parseCommaParts(m.body);
if (n.length === 1) {
n = expand2(n[0], false).map(embrace);
if (n.length === 1) {
return post.map(function(p) {
return m.pre + n[0] + p;
});
}
}
}
var N;
if (isSequence) {
var x = numeric(n[0]);
var y = numeric(n[1]);
var width = Math.max(n[0].length, n[1].length);
var incr = n.length == 3 ? Math.abs(numeric(n[2])) : 1;
var test = lte;
var reverse = y < x;
if (reverse) {
incr *= -1;
test = gte;
}
var pad = n.some(isPadded);
N = [];
for (var i2 = x; test(i2, y); i2 += incr) {
var c;
if (isAlphaSequence) {
c = String.fromCharCode(i2);
if (c === "\\")
c = "";
} else {
c = String(i2);
if (pad) {
var need = width - c.length;
if (need > 0) {
var z = new Array(need + 1).join("0");
if (i2 < 0)
c = "-" + z + c.slice(1);
else
c = z + c;
}
}
}
N.push(c);
}
} else {
N = [];
for (var j = 0; j < n.length; j++) {
N.push.apply(N, expand2(n[j], false));
}
}
for (var j = 0; j < N.length; j++) {
for (var k = 0; k < post.length; k++) {
var expansion = pre + N[j] + post[k];
if (!isTop || isSequence || expansion)
expansions.push(expansion);
}
}
}
return expansions;
}
}
});
// src/utils/constants.ts
var SVG_NS = "http://www.w3.org/2000/svg";
var HTML_NS = "http://www.w3.org/1999/xhtml";
var PrimitiveType = /* @__PURE__ */ ((PrimitiveType2) => {
PrimitiveType2["Undefined"] = "undefined";
PrimitiveType2["Null"] = "null";
PrimitiveType2["String"] = "string";
PrimitiveType2["Number"] = "number";
PrimitiveType2["SpecialNumber"] = "number";
PrimitiveType2["Boolean"] = "boolean";
PrimitiveType2["BigInt"] = "bigint";
return PrimitiveType2;
})(PrimitiveType || {});
var NonPrimitiveType = /* @__PURE__ */ ((NonPrimitiveType2) => {
NonPrimitiveType2["Array"] = "array";
NonPrimitiveType2["Date"] = "date";
NonPrimitiveType2["Map"] = "map";
NonPrimitiveType2["Object"] = "object";
NonPrimitiveType2["RegularExpression"] = "regexp";
NonPrimitiveType2["Set"] = "set";
NonPrimitiveType2["Channel"] = "channel";
NonPrimitiveType2["Symbol"] = "symbol";
return NonPrimitiveType2;
})(NonPrimitiveType || {});
var TYPE_CONSTANT = "type";
var VALUE_CONSTANT = "value";
var SERIALIZED_PREFIX = "serialized:";
// src/utils/es2022-rewire-class-members.ts
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/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";
// src/utils/style.ts
function createStyleSheetIfNeededAndSupported(styles2) {
return void 0;
}
// src/utils/shadow-root.ts
var globalStyleSheet;
function createShadowRoot(cmpMeta) {
var _a;
const opts = { mode: "open" };
const shadowRoot = this.attachShadow(opts);
if (globalStyleSheet === void 0) globalStyleSheet = (_a = createStyleSheetIfNeededAndSupported()) != null ? _a : null;
if (globalStyleSheet) {
{
shadowRoot.adoptedStyleSheets = [...shadowRoot.adoptedStyleSheets, globalStyleSheet];
}
}
}
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 addSlotRelocateNode = (newChild, slotNode, prepend, position) => {
if (newChild["s-ol"] && newChild["s-ol"].isConnected) {
return;
}
const slottedNodeLocation = document.createTextNode("");
slottedNodeLocation["s-nr"] = newChild;
if (!slotNode["s-cr"] || !slotNode["s-cr"].parentNode) return;
const parent = slotNode["s-cr"].parentNode;
const appendMethod = internalCall(parent, "appendChild");
if (typeof position !== "undefined") {
slottedNodeLocation["s-oo"] = position;
const childNodes = internalCall(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"] || 0)) 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 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);
{
style = cssText;
}
styles.set(scopeId2, style);
};
var addStyle = (styleContainerNode, cmpMeta, mode) => {
var _a;
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());
}
const existingStyleElm = styleContainerNode.querySelector(`[${HYDRATED_STYLE_ID}="${scopeId2}"]`);
if (existingStyleElm) {
existingStyleElm.textContent = style;
} else 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$ & 2 /* scopedCssEncapsulation */ || cmpMeta.$flags$ & 128 /* shadowNeedsScopedCss */ || cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
}
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) {
{
const existingStyleContainer = styleContainerNode.querySelector("style");
if (existingStyleContainer) {
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);
}
}
}
}
return scopeId2;
};
var attachStyles = (hostRef) => {
const cmpMeta = hostRef.$cmpMeta$;
const elm = hostRef.$hostElement$;
const endAttachStyles = createTime("attachStyles", cmpMeta.$tagName$);
addStyle(
elm.getRootNode(),
cmpMeta);
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/client-hydrate.ts
var initializeClientHydrate = (hostElm, tagName, hostId, hostRef) => {
var _a, _b, _c, _d;
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 (win.document && (!plt.$orgLocNodes$ || !plt.$orgLocNodes$.size)) {
initializeDocumentHydrate(win.document.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"] = transformTag(tagName).toUpperCase();
if (childRenderNode.$tag$ === "slot") {
node["s-cr"] = hostElm["s-cr"];
}
} else if (((_a = childRenderNode.$tag$) == null ? void 0 : _a.toString().includes("-")) && childRenderNode.$tag$ !== "slot-fb" && !childRenderNode.$elm$.shadowRoot) {
const cmpMeta = getHostRef(childRenderNode.$elm$);
if (cmpMeta) {
const scopeId3 = getScopeId(
cmpMeta.$cmpMeta$);
const styleSheet = win.document.querySelector(`style[sty-id="${scopeId3}"]`);
if (styleSheet) {
shadowRootNodes.unshift(styleSheet.cloneNode(true));
}
}
}
if (childRenderNode.$tag$ === "slot") {
childRenderNode.$name$ = childRenderNode.$elm$["s-sn"] || childRenderNode.$elm$["name"] || null;
if (childRenderNode.$children$) {
childRenderNode.$flags$ |= 2 /* isSlotFallback */;
if (!childRenderNode.$elm$.childNodes.length) {
childRenderNode.$children$.forEach((c) => {
childRenderNode.$elm$.appendChild(c.$elm$);
});
}
} else {
childRenderNode.$flags$ |= 1 /* isSlotReference */;
}
}
if (orgLocationNode && orgLocationNode.isConnected) {
if (orgLocationNode.parentElement.shadowRoot && orgLocationNode["s-en"] === "") {
orgLocationNode.parentNode.insertBefore(node, orgLocationNode.nextSibling);
}
orgLocationNode.parentNode.removeChild(orgLocationNode);
if (!shadowRoot) {
node["s-oo"] = parseInt(childRenderNode.$nodeId$);
}
}
if (orgLocationNode && !orgLocationNode["s-id"]) {
plt.$orgLocNodes$.delete(orgLocationId);
}
}
const hosts = [];
const snLen = slottedNodes.length;
let snIndex = 0;
let slotGroup;
let snGroupIdx;
let snGroupLen;
let slottedItem;
let currentPos = 0;
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 && slottedItem.node.parentElement !== hostEle) {
hostEle.insertBefore(slottedItem.node, (_c = (_b = slotGroup[snGroupIdx - 1]) == null ? void 0 : _b.node) == null ? void 0 : _c.nextSibling);
}
if (!hostEle.shadowRoot || !shadowRoot) {
if (!slottedItem.slot["s-cr"]) {
slottedItem.slot["s-cr"] = hostEle["s-cr"];
if (!slottedItem.slot["s-cr"] && hostEle.shadowRoot) {
slottedItem.slot["s-cr"] = hostEle;
} else {
slottedItem.slot["s-cr"] = (hostEle.__childNodes || hostEle.childNodes)[0];
}
}
addSlotRelocateNode(slottedItem.node, slottedItem.slot, false, slottedItem.node["s-oo"] || currentPos);
if (((_d = slottedItem.node.parentElement) == null ? void 0 : _d.shadowRoot) && slottedItem.node["getAttribute"] && slottedItem.node.getAttribute("slot")) {
slottedItem.node.removeAttribute("slot");
}
}
currentPos = (slottedItem.node["s-oo"] || currentPos) + 1;
}
}
hostRef.$hostElement$ = hostElm;
endHydrate();
};
var clientHydrate = (parentVNode, childRenderNodes, slotNodes, shadowRootNodes, hostElm, node, hostId, slottedNodes = []) => {
let childNodeType;
let childIdSplt;
let childVNode;
let i2;
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` patch
// won't try to reconcile them. Classes set on the node will be blown away.
$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;
}
parentVNode = childVNode;
}
}
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$ = findCorrespondingNode(node, 3 /* TextNode */);
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;
}
}
} else if (childNodeType === COMMENT_NODE_ID) {
childVNode.$elm$ = findCorrespondingNode(node, 8 /* CommentNode */);
if (childVNode.$elm$ && childVNode.$elm$.nodeType === 8 /* CommentNode */) {
childRenderNodes.push(childVNode);
node.remove();
}
} else if (childVNode.$hostId$ === hostId) {
if (childNodeType === SLOT_NODE_ID) {
const slotName = node["s-sn"] = 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;
childVNode.$name$ = slotName || null;
childVNode.$tag$ = "slot";
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$);
patchSlotNode(node);
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) => {
var _a, _b;
let slottedNode = slotNode.nextSibling;
slottedNodes[slotNodeId] = slottedNodes[slotNodeId] || [];
if (!slottedNode || ((_a = slottedNode.nodeValue) == null ? void 0 : _a.startsWith(SLOT_NODE_ID + "."))) return;
do {
if (slottedNode && ((slottedNode["getAttribute"] && slottedNode.getAttribute("slot") || slottedNode["s-sn"]) === slotName || slotName === "" && !slottedNode["s-sn"] && (!slottedNode["getAttribute"] || !slottedNode.getAttribute("slot")) && (slottedNode.nodeType === 8 /* CommentNode */ || slottedNode.nodeType === 3 /* TextNode */))) {
slottedNode["s-sn"] = slotName;
slottedNodes[slotNodeId].push({ slot: slotNode, node: slottedNode, hostId });
}
slottedNode = slottedNode == null ? void 0 : slottedNode.nextSibling;
} while (slottedNode && !((_b = slottedNode.nodeValue) == null ? void 0 : _b.startsWith(SLOT_NODE_ID + ".")));
};
var findCorrespondingNode = (node, type) => {
let sibling = node;
do {
sibling = sibling.nextSibling;
} while (sibling && (sibling.nodeType !== type || !sibling.nodeValue));
return sibling;
};
// src/utils/remote-value.ts
var RemoteValue = class _RemoteValue {
/**
* Deserializes a LocalValue serialized object back to its original JavaScript representation
*
* @param serialized The serialized LocalValue object
* @returns The original JavaScript value/object
*/
static fromLocalValue(serialized) {
const type = serialized[TYPE_CONSTANT];
const value = VALUE_CONSTANT in serialized ? serialized[VALUE_CONSTANT] : void 0;
switch (type) {
case "string" /* String */:
return value;
case "boolean" /* Boolean */:
return value;
case "bigint" /* BigInt */:
return BigInt(value);
case "undefined" /* Undefined */:
return void 0;
case "null" /* Null */:
return null;
case "number" /* Number */:
if (value === "NaN") return NaN;
if (value === "-0") return -0;
if (value === "Infinity") return Infinity;
if (value === "-Infinity") return -Infinity;
return value;
case "array" /* Array */:
return value.map((item) => _RemoteValue.fromLocalValue(item));
case "date" /* Date */:
return new Date(value);
case "map" /* Map */:
const map2 = /* @__PURE__ */ new Map();
for (const [key, val] of value) {
const deserializedKey = typeof key === "object" && key !== null ? _RemoteValue.fromLocalValue(key) : key;
const deserializedValue = _RemoteValue.fromLocalValue(val);
map2.set(deserializedKey, deserializedValue);
}
return map2;
case "object" /* Object */:
const obj = {};
for (const [key, val] of value) {
obj[key] = _RemoteValue.fromLocalValue(val);
}
return obj;
case "regexp" /* RegularExpression */:
const { pattern, flags } = value;
return new RegExp(pattern, flags);
case "set" /* Set */:
const set = /* @__PURE__ */ new Set();
for (const item of value) {
set.add(_RemoteValue.fromLocalValue(item));
}
return set;
case "symbol" /* Symbol */:
return Symbol(value);
default:
throw new Error(`Unsupported type: ${type}`);
}
}
/**
* Utility method to deserialize multiple LocalValues at once
*
* @param serializedValues Array of serialized LocalValue objects
* @returns Array of deserialized JavaScript values
*/
static fromLocalValueArray(serializedValues) {
return serializedValues.map((value) => _RemoteValue.fromLocalValue(value));
}
/**
* Verifies if the given object matches the structure of a serialized LocalValue
*
* @param obj Object to verify
* @returns boolean indicating if the object has LocalValue structure
*/
static isLocalValueObject(obj) {
if (typeof obj !== "object" || obj === null) {
return false;
}
if (!obj.hasOwnProperty(TYPE_CONSTANT)) {
return false;
}
const type = obj[TYPE_CONSTANT];
const hasTypeProperty = Object.values({ ...PrimitiveType, ...NonPrimitiveType }).includes(type);
if (!hasTypeProperty) {
return false;
}
if (type !== "null" /* Null */ && type !== "undefined" /* Undefined */) {
return obj.hasOwnProperty(VALUE_CONSTANT);
}
return true;
}
};
// src/utils/serialize.ts
function deserializeProperty(value) {
if (typeof value !== "string" || !value.startsWith(SERIALIZED_PREFIX)) {
return value;
}
return RemoteValue.fromLocalValue(JSON.parse(atob(value.slice(SERIALIZED_PREFIX.length))));
}
// src/runtime/parse-property-value.ts
var parsePropertyValue = (propValue, propType, isFormAssociated) => {
if (typeof propValue === "string" && propValue.startsWith(SERIALIZED_PREFIX)) {
propValue = deserializeProperty(propValue);
return propValue;
}
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);
if ((elm["s-si"] || elm["s-sc"]) && initialRender) {
const scopeId2 = elm["s-sc"] || elm["s-si"];
newClasses.push(scopeId2);
oldClasses.forEach((c) => {
if (c.startsWith(scopeId2)) newClasses.push(c);
});
newClasses = [...new Set(newClasses)].filter((c) => c);
classList.add(...newClasses);
} else {
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 (memberNa