🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

msf-editor

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

msf-editor - npm Package Compare versions

Comparing version
0.3.3
to
0.4.0
+1247
dist/cjs/core-f2d12a35.js
'use strict';
function _interopNamespace(e) {
if (e && e.__esModule) { return e; } else {
var n = {};
if (e) {
Object.keys(e).forEach(function (k) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
});
});
}
n['default'] = e;
return n;
}
}
const NAMESPACE = 'msf-editor';
let queueCongestion = 0;
let queuePending = false;
let scopeId;
let hostTagName;
let isSvgMode = false;
const win = typeof window !== 'undefined' ? window : {};
const doc = win.document || { head: {} };
const plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: (h) => h(),
raf: (h) => requestAnimationFrame(h),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
};
const supportsShadowDom = /*@__PURE__*/ (() => (doc.head.attachShadow + '').includes('[native'))() ;
const supportsListenerOptions = /*@__PURE__*/ (() => {
let supportsListenerOptions = false;
try {
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
get() { supportsListenerOptions = true; }
}));
}
catch (e) { }
return supportsListenerOptions;
})();
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
try {
new CSSStyleSheet();
return true;
}
catch (e) { }
return false;
})() ;
const hostRefs = new WeakMap();
const getHostRef = (ref) => hostRefs.get(ref);
const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
const registerHost = (elm) => {
const hostRef = {
$flags$: 0,
$hostElement$: elm,
$instanceValues$: new Map()
};
{
hostRef.$onInstancePromise$ = new Promise(r => hostRef.$onInstanceResolve$ = r);
}
{
hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
elm['s-p'] = [];
elm['s-rc'] = [];
}
return hostRefs.set(elm, hostRef);
};
const isMemberInElement = (elm, memberName) => memberName in elm;
const consoleError = (e) => console.error(e);
const moduleCache = /*@__PURE__*/ new Map();
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
// loadModuleImport
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
const bundleId = ( cmpMeta.$lazyBundleIds$);
const module = moduleCache.get(bundleId) ;
if (module) {
return module[exportName];
}
return new Promise(function (resolve) { resolve(_interopNamespace(require(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${ ''}`))); }).then(importedModule => {
{
moduleCache.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
const styles = new Map();
const queueDomReads = [];
const queueDomWrites = [];
const queueDomWritesLow = [];
const queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
};
const consume = (queue) => {
for (let i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
const consumeTimeout = (queue, timeout) => {
let i = 0;
let ts = 0;
while (i < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i++](ts);
}
catch (e) {
consoleError(e);
}
}
if (i === queue.length) {
queue.length = 0;
}
else if (i !== 0) {
queue.splice(0, i);
}
};
const flush = () => {
queueCongestion++;
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
: Infinity;
// DOM WRITES!!!
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push(...queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
else {
queueCongestion = 0;
}
};
const nextTick = /*@__PURE__*/ (cb) => Promise.resolve().then(cb);
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
const EMPTY_OBJ = {};
const isDef = (v) => v != null;
const isComplexType = (o) => {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
const getDynamicImportFunction = (namespace) => {
return `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
};
const patchEsm = () => {
// @ts-ignore
if ( !(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
// @ts-ignore
return new Promise(function (resolve) { resolve(require('./css-shim-6aaf713d-bfe06088.js')); }).then(() => {
plt.$cssShim$ = win.__stencil_cssshim;
if (plt.$cssShim$) {
return plt.$cssShim$.initShim();
}
});
}
return Promise.resolve();
};
const patchBrowser = () => {
{
// shim css vars
plt.$cssShim$ = win.__stencil_cssshim;
}
// @ts-ignore
const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => (new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
s.getAttribute('data-stencil-namespace') === NAMESPACE));
const opts = scriptElm['data-opts'] || {};
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('core-f2d12a35.js', document.baseURI).href));
if ('onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
// Safari < v11 support: This IF is true if it's Safari below v11.
// This fn cannot use async/await since Safari didn't support it until v11,
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
// so both the ESM file and nomodule file would get downloaded. Only Safari
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
return { then() { } };
}
if (importMeta !== '') {
opts.resourcesUrl = new URL('.', importMeta).href;
}
else {
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
patchDynamicImport(opts.resourcesUrl, scriptElm);
if (!window.customElements) {
// module support, but no custom elements support (Old Edge)
// @ts-ignore
return new Promise(function (resolve) { resolve(require('./dom-76cc7c7d-769a0dda.js')); }).then(() => opts);
}
}
return Promise.resolve(opts);
};
const patchDynamicImport = (base, orgScriptElm) => {
const importFunctionName = getDynamicImportFunction(NAMESPACE);
try {
// test if this browser supports dynamic imports
// There is a caching issue in V8, that breaks using import() in Function
// By generating a random string, we can workaround it
// Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
}
catch (e) {
// this shim is specifically for browsers that do support "esm" imports
// however, they do NOT support "dynamic" imports
// basically this code is for old Edge, v18 and below
const moduleMap = new Map();
win[importFunctionName] = (src) => {
const url = new URL(src, base).href;
let mod = moduleMap.get(url);
if (!mod) {
const script = doc.createElement('script');
script.type = 'module';
script.crossOrigin = orgScriptElm.crossOrigin;
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
mod = new Promise(resolve => {
script.onload = () => {
resolve(win[importFunctionName].m);
script.remove();
};
});
moduleMap.set(url, mod);
doc.head.appendChild(script);
}
return mod;
};
}
};
const parsePropertyValue = (propValue, propType) => {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if ( propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
const HYDRATED_CLASS = 'hydrated';
const createTime = (fnName, tagName = '') => {
{
return () => { return; };
}
};
const uniqueTime = (key, measureText) => {
{
return () => { return; };
}
};
const rootAppliedStyles = new WeakMap();
const registerStyle = (scopeId, cssText, allowCS) => {
let style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
let scopeId = getScopeId(cmpMeta.$tagName$);
let style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
}
if (!appliedStyles.has(scopeId)) {
{
if ( plt.$cssShim$) {
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
const newScopeId = styleElm['s-sc'];
if (newScopeId) {
scopeId = newScopeId;
// we don't want to add this styleID to the appliedStyles Set
// since the cssVarShim might need to apply several different
// stylesheets for the same component
appliedStyles = null;
}
}
else {
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = [
...styleContainerNode.adoptedStyleSheets,
style
];
}
}
return scopeId;
};
const attachStyles = (elm, cmpMeta, mode) => {
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(( supportsShadowDom && elm.shadowRoot)
? elm.shadowRoot
: elm.getRootNode(), cmpMeta, mode, elm);
if ( cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
const getScopeId = (tagName, mode) => 'sc-' + ( tagName);
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
const h = (nodeName, vnodeData, ...children) => {
let child = null;
let simple = false;
let lastSimple = false;
let vNodeChildren = [];
const walk = (c) => {
for (let i = 0; i < c.length; i++) {
child = c[i];
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) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class = typeof classData !== 'object'
? classData
: Object.keys(classData)
.filter(k => classData[k])
.join(' ');
}
}
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
const newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
return vnode;
};
const Host = {};
const isHost = (node) => node && node.$tag$ === Host;
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
if (oldValue === newValue) {
return;
}
let isProp = isMemberInElement(elm, memberName);
let ln = memberName.toLowerCase();
if ( memberName === 'class') {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
const newClasses = parseClassList(newValue);
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
}
else {
// Set property if it exists and it's not a SVG
const isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
let n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
// tslint:disable-next-line: triple-equals
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
{
elm.removeAttribute(memberName);
}
}
else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
};
const parseClassListRegex = /\s/;
const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
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;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
// tslint:disable-next-line: prefer-const
let newVNode = newParentVNode.$children$[childIndex];
let i = 0;
let elm;
let childNode;
{
// create element
elm = newVNode.$elm$ = ( doc.createElement( newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if ( isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = ( parentElm);
let childNode;
if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
for (; startIdx <= endIdx; ++startIdx) {
if (vnode = vnodes[startIdx]) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
let oldStartIdx = 0;
let newStartIdx = 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;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
}
else if ( newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
const isSameVnode = (vnode1, vnode2) => {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
const patch = (oldVNode, newVNode) => {
const elm = newVNode.$elm$ = oldVNode.$elm$;
const oldChildren = oldVNode.$children$;
const newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if ( oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if ( oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
hostTagName = hostElm.tagName;
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
const rootVnode = isHost(renderFnResults)
? renderFnResults
: h(null, null, renderFnResults);
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm );
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
const attachToAncestor = (hostRef, ancestorComponent) => {
if ( ancestorComponent && !hostRef.$onRenderResolve$) {
ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
}
};
const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
const instance = hostRef.$lazyInstance$ ;
const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
attachToAncestor(hostRef, ancestorComponent);
let promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
}
endSchedule();
// there is no ancestorc omponent or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
return then(promise, () => writeTask(update)
);
};
const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
// updateComponent
const endUpdate = createTime('update', cmpMeta.$tagName$);
const rc = elm['s-rc'];
if ( isInitialLoad) {
// DOM WRITE!
attachStyles(elm, cmpMeta, hostRef.$modeName$);
}
const endRender = createTime('render', cmpMeta.$tagName$);
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
renderVdom(elm, hostRef, cmpMeta, callRender(instance));
}
}
if ( plt.$cssShim$) {
plt.$cssShim$.updateHost(elm);
}
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
if ( rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.forEach(cb => cb());
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
const childrenPromises = elm['s-p'];
const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
const callRender = (instance, elm) => {
try {
instance = instance.render() ;
}
catch (e) {
consoleError(e);
}
return instance;
};
const postUpdateComponent = (elm, hostRef, cmpMeta) => {
const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
// add the css class that this element has officially hydrated
elm.classList.add(HYDRATED_CLASS);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
const forceUpdate = (elm, cmpMeta) => {
{
const hostRef = getHostRef(elm);
const isConnected = hostRef.$hostElement$.isConnected;
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
// Returns "true" when the forced update was successfully scheduled
return isConnected;
}
};
const appDidLoad = (who) => {
// on appload
// we have finish the first big initial render
{
doc.documentElement.classList.add(HYDRATED_CLASS);
}
{
plt.$flags$ |= 2 /* appLoaded */;
}
};
const safeCall = (instance, method, arg) => {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
const then = (promise, thenFn) => {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
const setValue = (ref, propName, newVal, cmpMeta) => {
// check our new property value against our internal value
const hostRef = getHostRef(ref);
const elm = hostRef.$hostElement$ ;
const oldVal = hostRef.$instanceValues$.get(propName);
const flags = hostRef.$flags$;
const instance = hostRef.$lazyInstance$ ;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
if (newVal !== oldVal && ( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if ( instance) {
if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
}
}
};
const proxyComponent = (Cstr, cmpMeta, flags) => {
if ( cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
const members = Object.entries(cmpMeta.$members$);
const prototype = Cstr.prototype;
members.forEach(([memberName, [memberFlags]]) => {
if ( ((memberFlags & 31 /* Prop */) ||
(( flags & 2 /* proxyState */) &&
(memberFlags & 32 /* State */)))) {
// proxyComponent - prop
Object.defineProperty(prototype, memberName, {
get() {
// proxyComponent, get value
return getValue(this, memberName);
},
set(newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true
});
}
else if ( (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
// proxyComponent - method
Object.defineProperty(prototype, memberName, {
value(...args) {
const ref = getHostRef(this);
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
}
});
}
});
if ( ( flags & 1 /* isElementConstructor */)) {
const attrNameToPropName = new Map();
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
plt.jmp(() => {
const propName = attrNameToPropName.get(attrName);
this[propName] = newValue === null && typeof this[propName] === 'boolean'
? false
: newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
.map(([propName, m]) => {
const attrName = m[1] || propName;
attrNameToPropName.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
const addEventListeners = (elm, hostRef, listeners) => {
hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
const removeFns = listeners.map(([flags, name, method]) => {
const target = ( getHostListenerTarget(elm, flags) );
const handler = hostListenerProxy(hostRef, method);
const opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
return () => plt.rel(target, name, handler, opts);
});
return () => removeFns.forEach(fn => fn());
};
const hostListenerProxy = (hostRef, methodName) => {
return (ev) => {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
hostRef.$queuedListeners$.push([methodName, ev]);
}
}
};
};
const getHostListenerTarget = (elm, flags) => {
if ( flags & 8 /* TargetWindow */)
return win;
return elm;
};
const hostListenerOpts = (flags) => supportsListenerOptions ?
{
'passive': (flags & 1 /* Passive */) !== 0,
'capture': (flags & 2 /* Capture */) !== 0,
}
: (flags & 2 /* Capture */) !== 0;
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
{
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime();
Cstr = await Cstr;
endLoad();
}
if ( !Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
}
const scopeId = getScopeId(cmpMeta.$tagName$);
if ( !styles.has(scopeId) && Cstr.style) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
// this component has styles but we haven't registered them yet
let style = Cstr.style;
if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
style = await new Promise(function (resolve) { resolve(require('./shadow-css-4889ae62-03827a39.js')); }).then(m => m.scopeCss(style, scopeId, false));
}
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
if ( ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};
const connectedCallback = (elm, cmpMeta) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
// connectedCallback
const hostRef = getHostRef(elm);
if ( cmpMeta.$listeners$) {
// initialize our event listeners on the host element
// we do this now so that we can listening to events that may
// have fired even before the instance is ready
hostRef.$rmListeners$ = addEventListeners(elm, hostRef, cmpMeta.$listeners$);
}
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
let ancestorComponent = elm;
while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if (
(ancestorComponent['s-p'])) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if ( cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
const value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
// connectedCallback, taskQueue, initialLoad
// angular sets attribute AFTER connectCallback
// https://github.com/angular/angular/issues/18909
// https://github.com/angular/angular/issues/19940
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
}
}
endConnected();
}
};
const disconnectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$();
hostRef.$rmListeners$ = undefined;
}
}
// clear CSS var-shim tracking
if ( plt.$cssShim$) {
plt.$cssShim$.removeHost(elm);
}
}
};
const bootstrapLazy = (lazyBundles, options = {}) => {
const endBootstrap = createTime();
const cmpTags = [];
const exclude = options.exclude || [];
const head = doc.head;
const customElements = win.customElements;
const y = /*@__PURE__*/ head.querySelector('meta[charset]');
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
const deferredConnectedCallbacks = [];
let appLoadFallback;
let isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
if (options.syncQueue) {
plt.$flags$ |= 4 /* queueSync */;
}
lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
const cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
if ( !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
}
const tagName = cmpMeta.$tagName$;
const HostElement = class extends HTMLElement {
// StencilLazyHost
constructor(self) {
// @ts-ignore
super(self);
self = this;
registerHost(self);
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
if (supportsShadowDom) {
{
self.attachShadow({ mode: 'open' });
}
}
else if ( !('shadowRoot' in self)) {
self.shadowRoot = self;
}
}
}
connectedCallback() {
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(() => connectedCallback(this, cmpMeta));
}
}
disconnectedCallback() {
plt.jmp(() => disconnectedCallback(this));
}
forceUpdate() {
forceUpdate(this, cmpMeta);
}
componentOnReady() {
return getHostRef(this).$onReadyPromise$;
}
};
cmpMeta.$lazyBundleIds$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
}));
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length > 0) {
deferredConnectedCallbacks.forEach(host => host.connectedCallback());
}
else {
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
}
// Fallback appLoad event
endBootstrap();
};
const createEvent = (ref, name, flags) => {
const elm = getElement(ref);
return {
emit: (detail) => {
const ev = new ( CustomEvent)(name, {
bubbles: !!(flags & 4 /* Bubbles */),
composed: !!(flags & 2 /* Composed */),
cancelable: !!(flags & 1 /* Cancellable */),
detail
});
elm.dispatchEvent(ev);
return ev;
}
};
};
const getElement = (ref) => getHostRef(ref).$hostElement$ ;
exports.bootstrapLazy = bootstrapLazy;
exports.createEvent = createEvent;
exports.getElement = getElement;
exports.h = h;
exports.patchBrowser = patchBrowser;
exports.patchEsm = patchEsm;
exports.registerInstance = registerInstance;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var NAMESPACE = 'msf-editor';
var queueCongestion = 0;
var queuePending = false;
var scopeId;
var hostTagName;
var isSvgMode = false;
var win = typeof window !== 'undefined' ? window : {};
var doc = win.document || { head: {} };
var plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: function (h) { return h(); },
raf: function (h) { return requestAnimationFrame(h); },
ael: function (el, eventName, listener, opts) { return el.addEventListener(eventName, listener, opts); },
rel: function (el, eventName, listener, opts) { return el.removeEventListener(eventName, listener, opts); },
};
var supportsShadowDom = /*@__PURE__*/ (function () { return (doc.head.attachShadow + '').includes('[native'); })();
var supportsListenerOptions = /*@__PURE__*/ (function () {
var supportsListenerOptions = false;
try {
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
get: function () { supportsListenerOptions = true; }
}));
}
catch (e) { }
return supportsListenerOptions;
})();
var supportsConstructibleStylesheets = /*@__PURE__*/ (function () {
try {
new CSSStyleSheet();
return true;
}
catch (e) { }
return false;
})();
var hostRefs = new WeakMap();
var getHostRef = function (ref) { return hostRefs.get(ref); };
var registerInstance = function (lazyInstance, hostRef) { return hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef); };
var registerHost = function (elm) {
var hostRef = {
$flags$: 0,
$hostElement$: elm,
$instanceValues$: new Map()
};
{
hostRef.$onInstancePromise$ = new Promise(function (r) { return hostRef.$onInstanceResolve$ = r; });
}
{
hostRef.$onReadyPromise$ = new Promise(function (r) { return hostRef.$onReadyResolve$ = r; });
elm['s-p'] = [];
elm['s-rc'] = [];
}
return hostRefs.set(elm, hostRef);
};
var isMemberInElement = function (elm, memberName) { return memberName in elm; };
var consoleError = function (e) { return console.error(e); };
var moduleCache = /*@__PURE__*/ new Map();
var loadModule = function (cmpMeta, hostRef, hmrVersionId) {
// loadModuleImport
var exportName = cmpMeta.$tagName$.replace(/-/g, '_');
var bundleId = (cmpMeta.$lazyBundleIds$);
var module = moduleCache.get(bundleId);
if (module) {
return module[exportName];
}
return import(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
"./" + bundleId + ".entry.js" + '').then(function (importedModule) {
{
moduleCache.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
var styles = new Map();
var queueDomReads = [];
var queueDomWrites = [];
var queueDomWritesLow = [];
var queueTask = function (queue, write) { return function (cb) {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
}; };
var consume = function (queue) {
for (var i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
var consumeTimeout = function (queue, timeout) {
var i = 0;
var ts = 0;
while (i < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i++](ts);
}
catch (e) {
consoleError(e);
}
}
if (i === queue.length) {
queue.length = 0;
}
else if (i !== 0) {
queue.splice(0, i);
}
};
var flush = function () {
queueCongestion++;
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
var timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
: Infinity;
// DOM WRITES!!!
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push.apply(queueDomWritesLow, queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
else {
queueCongestion = 0;
}
};
var nextTick = /*@__PURE__*/ function (cb) { return Promise.resolve().then(cb); };
var writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
var EMPTY_OBJ = {};
var isDef = function (v) { return v != null; };
var isComplexType = function (o) {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
var getDynamicImportFunction = function (namespace) {
return "__sc_import_" + namespace.replace(/\s|-/g, '_');
};
var patchEsm = function () {
// @ts-ignore
if (!(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
// @ts-ignore
return import('./css-shim-6aaf713d-9b13816a.js').then(function () {
plt.$cssShim$ = win.__stencil_cssshim;
if (plt.$cssShim$) {
return plt.$cssShim$.initShim();
}
});
}
return Promise.resolve();
};
var patchBrowser = function () {
{
// shim css vars
plt.$cssShim$ = win.__stencil_cssshim;
}
// @ts-ignore
var scriptElm = Array.from(doc.querySelectorAll('script')).find(function (s) { return (new RegExp("/" + NAMESPACE + "(\\.esm)?\\.js($|\\?|#)").test(s.src) ||
s.getAttribute('data-stencil-namespace') === NAMESPACE); });
var opts = scriptElm['data-opts'] || {};
var importMeta = "";
if ('onbeforeload' in scriptElm && !history.scrollRestoration && false /* IS_SYSTEM_JS_BUILD */) {
// Safari < v11 support: This IF is true if it's Safari below v11.
// This fn cannot use async/await since Safari didn't support it until v11,
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
// so both the ESM file and nomodule file would get downloaded. Only Safari
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
return { then: function () { } };
}
if (importMeta !== '') {
opts.resourcesUrl = new URL('.', importMeta).href;
}
else {
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
patchDynamicImport(opts.resourcesUrl, scriptElm);
if (!window.customElements) {
// module support, but no custom elements support (Old Edge)
// @ts-ignore
return import('./dom-76cc7c7d-0a082895.js').then(function () { return opts; });
}
}
return Promise.resolve(opts);
};
var patchDynamicImport = function (base, orgScriptElm) {
var importFunctionName = getDynamicImportFunction(NAMESPACE);
try {
// test if this browser supports dynamic imports
// There is a caching issue in V8, that breaks using import() in Function
// By generating a random string, we can workaround it
// Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
win[importFunctionName] = new Function('w', "return import(w);//" + Math.random());
}
catch (e) {
// this shim is specifically for browsers that do support "esm" imports
// however, they do NOT support "dynamic" imports
// basically this code is for old Edge, v18 and below
var moduleMap_1 = new Map();
win[importFunctionName] = function (src) {
var url = new URL(src, base).href;
var mod = moduleMap_1.get(url);
if (!mod) {
var script_1 = doc.createElement('script');
script_1.type = 'module';
script_1.crossOrigin = orgScriptElm.crossOrigin;
script_1.src = URL.createObjectURL(new Blob(["import * as m from '" + url + "'; window." + importFunctionName + ".m = m;"], { type: 'application/javascript' }));
mod = new Promise(function (resolve) {
script_1.onload = function () {
resolve(win[importFunctionName].m);
script_1.remove();
};
});
moduleMap_1.set(url, mod);
doc.head.appendChild(script_1);
}
return mod;
};
}
};
var parsePropertyValue = function (propValue, propType) {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if (propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
var HYDRATED_CLASS = 'hydrated';
var createTime = function (fnName, tagName) {
if (tagName === void 0) { tagName = ''; }
{
return function () { return; };
}
};
var uniqueTime = function (key, measureText) {
{
return function () { return; };
}
};
var rootAppliedStyles = new WeakMap();
var registerStyle = function (scopeId, cssText, allowCS) {
var style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
var addStyle = function (styleContainerNode, cmpMeta, mode, hostElm) {
var scopeId = getScopeId(cmpMeta.$tagName$);
var style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
var appliedStyles = rootAppliedStyles.get(styleContainerNode);
var styleElm = void 0;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
}
if (!appliedStyles.has(scopeId)) {
{
if (plt.$cssShim$) {
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
var newScopeId = styleElm['s-sc'];
if (newScopeId) {
scopeId = newScopeId;
// we don't want to add this styleID to the appliedStyles Set
// since the cssVarShim might need to apply several different
// stylesheets for the same component
appliedStyles = null;
}
}
else {
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = __spreadArrays(styleContainerNode.adoptedStyleSheets, [
style
]);
}
}
return scopeId;
};
var attachStyles = function (elm, cmpMeta, mode) {
var endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
var scopeId = addStyle((supportsShadowDom && elm.shadowRoot)
? elm.shadowRoot
: elm.getRootNode(), cmpMeta, mode, elm);
if (cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
var getScopeId = function (tagName, mode) { return 'sc-' + (tagName); };
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
var h = function (nodeName, vnodeData) {
var children = [];
for (var _i = 2; _i < arguments.length; _i++) {
children[_i - 2] = arguments[_i];
}
var child = null;
var simple = false;
var lastSimple = false;
var vNodeChildren = [];
var walk = function (c) {
for (var i = 0; i < c.length; i++) {
child = c[i];
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) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
var classData_1 = vnodeData.className || vnodeData.class;
if (classData_1) {
vnodeData.class = typeof classData_1 !== 'object'
? classData_1
: Object.keys(classData_1)
.filter(function (k) { return classData_1[k]; })
.join(' ');
}
}
}
var vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
var newVNode = function (tag, text) {
var vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
return vnode;
};
var Host = {};
var isHost = function (node) { return node && node.$tag$ === Host; };
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
var setAccessor = function (elm, memberName, oldValue, newValue, isSvg, flags) {
if (oldValue === newValue) {
return;
}
var isProp = isMemberInElement(elm, memberName);
var ln = memberName.toLowerCase();
if (memberName === 'class') {
var classList = elm.classList;
var oldClasses_1 = parseClassList(oldValue);
var newClasses_1 = parseClassList(newValue);
classList.remove.apply(classList, oldClasses_1.filter(function (c) { return c && !newClasses_1.includes(c); }));
classList.add.apply(classList, newClasses_1.filter(function (c) { return c && !oldClasses_1.includes(c); }));
}
else {
// Set property if it exists and it's not a SVG
var isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
var n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
// tslint:disable-next-line: triple-equals
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
{
elm.removeAttribute(memberName);
}
}
else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
};
var parseClassListRegex = /\s/;
var parseClassList = function (value) { return (!value) ? [] : value.split(parseClassListRegex); };
var updateElement = function (oldVnode, newVnode, isSvgMode, memberName) {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
var elm = (newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host) ? newVnode.$elm$.host : newVnode.$elm$;
var oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
var newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
var createElm = function (oldParentVNode, newParentVNode, childIndex, parentElm) {
// tslint:disable-next-line: prefer-const
var newVNode = newParentVNode.$children$[childIndex];
var i = 0;
var elm;
var childNode;
{
// create element
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
var addVnodes = function (parentElm, before, parentVNode, vnodes, startIdx, endIdx) {
var containerElm = (parentElm);
var childNode;
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
var removeVnodes = function (vnodes, startIdx, endIdx, vnode, elm) {
for (; startIdx <= endIdx; ++startIdx) {
if (vnode = vnodes[startIdx]) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
var updateChildren = function (parentElm, oldCh, newVNode, newCh) {
var oldStartIdx = 0;
var newStartIdx = 0;
var oldEndIdx = oldCh.length - 1;
var oldStartVnode = oldCh[0];
var oldEndVnode = oldCh[oldEndIdx];
var newEndIdx = newCh.length - 1;
var newStartVnode = newCh[0];
var newEndVnode = newCh[newEndIdx];
var node;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
}
else if (newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
var isSameVnode = function (vnode1, vnode2) {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
var patch = function (oldVNode, newVNode) {
var elm = newVNode.$elm$ = oldVNode.$elm$;
var oldChildren = oldVNode.$children$;
var newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if (oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if (oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
var renderVdom = function (hostElm, hostRef, cmpMeta, renderFnResults) {
hostTagName = hostElm.tagName;
var oldVNode = hostRef.$vnode$ || newVNode(null, null);
var rootVnode = isHost(renderFnResults)
? renderFnResults
: h(null, null, renderFnResults);
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm);
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
var attachToAncestor = function (hostRef, ancestorComponent) {
if (ancestorComponent && !hostRef.$onRenderResolve$) {
ancestorComponent['s-p'].push(new Promise(function (r) { return hostRef.$onRenderResolve$ = r; }));
}
};
var scheduleUpdate = function (elm, hostRef, cmpMeta, isInitialLoad) {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
var endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
var ancestorComponent = hostRef.$ancestorComponent$;
var instance = hostRef.$lazyInstance$;
var update = function () { return updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad); };
attachToAncestor(hostRef, ancestorComponent);
var promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.forEach(function (_a) {
var methodName = _a[0], event = _a[1];
return safeCall(instance, methodName, event);
});
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, function () { return safeCall(instance, 'componentWillRender'); });
}
endSchedule();
// there is no ancestorc omponent or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
return then(promise, function () { return writeTask(update); });
};
var updateComponent = function (elm, hostRef, cmpMeta, instance, isInitialLoad) {
// updateComponent
var endUpdate = createTime('update', cmpMeta.$tagName$);
var rc = elm['s-rc'];
if (isInitialLoad) {
// DOM WRITE!
attachStyles(elm, cmpMeta, hostRef.$modeName$);
}
var endRender = createTime('render', cmpMeta.$tagName$);
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
renderVdom(elm, hostRef, cmpMeta, callRender(instance));
}
}
if (plt.$cssShim$) {
plt.$cssShim$.updateHost(elm);
}
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
if (rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.forEach(function (cb) { return cb(); });
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
var childrenPromises = elm['s-p'];
var postUpdate = function () { return postUpdateComponent(elm, hostRef, cmpMeta); };
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
var callRender = function (instance, elm) {
try {
instance = instance.render();
}
catch (e) {
consoleError(e);
}
return instance;
};
var postUpdateComponent = function (elm, hostRef, cmpMeta) {
var endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
var ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
// add the css class that this element has officially hydrated
elm.classList.add(HYDRATED_CLASS);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(function () { return scheduleUpdate(elm, hostRef, cmpMeta, false); });
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
var forceUpdate = function (elm, cmpMeta) {
{
var hostRef = getHostRef(elm);
var isConnected = hostRef.$hostElement$.isConnected;
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
// Returns "true" when the forced update was successfully scheduled
return isConnected;
}
};
var appDidLoad = function (who) {
// on appload
// we have finish the first big initial render
{
doc.documentElement.classList.add(HYDRATED_CLASS);
}
{
plt.$flags$ |= 2 /* appLoaded */;
}
};
var safeCall = function (instance, method, arg) {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
var then = function (promise, thenFn) {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
var getValue = function (ref, propName) { return getHostRef(ref).$instanceValues$.get(propName); };
var setValue = function (ref, propName, newVal, cmpMeta) {
// check our new property value against our internal value
var hostRef = getHostRef(ref);
var elm = hostRef.$hostElement$;
var oldVal = hostRef.$instanceValues$.get(propName);
var flags = hostRef.$flags$;
var instance = hostRef.$lazyInstance$;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
if (newVal !== oldVal && (!(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if (instance) {
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
}
}
};
var proxyComponent = function (Cstr, cmpMeta, flags) {
if (cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
var members = Object.entries(cmpMeta.$members$);
var prototype_1 = Cstr.prototype;
members.forEach(function (_a) {
var memberName = _a[0], memberFlags = _a[1][0];
if (((memberFlags & 31 /* Prop */) ||
((flags & 2 /* proxyState */) &&
(memberFlags & 32 /* State */)))) {
// proxyComponent - prop
Object.defineProperty(prototype_1, memberName, {
get: function () {
// proxyComponent, get value
return getValue(this, memberName);
},
set: function (newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true
});
}
else if ((flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
// proxyComponent - method
Object.defineProperty(prototype_1, memberName, {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var ref = getHostRef(this);
return ref.$onInstancePromise$.then(function () {
var _a;
return (_a = ref.$lazyInstance$)[memberName].apply(_a, args);
});
}
});
}
});
if ((flags & 1 /* isElementConstructor */)) {
var attrNameToPropName_1 = new Map();
prototype_1.attributeChangedCallback = function (attrName, _oldValue, newValue) {
var _this = this;
plt.jmp(function () {
var propName = attrNameToPropName_1.get(attrName);
_this[propName] = newValue === null && typeof _this[propName] === 'boolean'
? false
: newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(function (_a) {
var _ = _a[0], m = _a[1];
return m[0] & 15;
} /* HasAttribute */) // filter to only keep props that should match attributes
.map(function (_a) {
var propName = _a[0], m = _a[1];
var attrName = m[1] || propName;
attrNameToPropName_1.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
var addEventListeners = function (elm, hostRef, listeners) {
hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
var removeFns = listeners.map(function (_a) {
var flags = _a[0], name = _a[1], method = _a[2];
var target = (getHostListenerTarget(elm, flags));
var handler = hostListenerProxy(hostRef, method);
var opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
return function () { return plt.rel(target, name, handler, opts); };
});
return function () { return removeFns.forEach(function (fn) { return fn(); }); };
};
var hostListenerProxy = function (hostRef, methodName) {
return function (ev) {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
hostRef.$queuedListeners$.push([methodName, ev]);
}
}
};
};
var getHostListenerTarget = function (elm, flags) {
if (flags & 8 /* TargetWindow */)
return win;
return elm;
};
var hostListenerOpts = function (flags) { return supportsListenerOptions ?
{
'passive': (flags & 1 /* Passive */) !== 0,
'capture': (flags & 2 /* Capture */) !== 0,
}
: (flags & 2 /* Capture */) !== 0; };
var initializeComponent = function (elm, hostRef, cmpMeta, hmrVersionId, Cstr) { return __awaiter(void 0, void 0, void 0, function () {
var endLoad, endNewInstance, scopeId_1, endRegisterStyles, style_1, ancestorComponent, schedule;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0)) return [3 /*break*/, 5];
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (!Cstr.then) return [3 /*break*/, 2];
endLoad = uniqueTime();
return [4 /*yield*/, Cstr];
case 1:
Cstr = _a.sent();
endLoad();
_a.label = 2;
case 2:
if (!Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
scopeId_1 = getScopeId(cmpMeta.$tagName$);
if (!(!styles.has(scopeId_1) && Cstr.style)) return [3 /*break*/, 5];
endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
style_1 = Cstr.style;
if (!(cmpMeta.$flags$ & 8) /* needsShadowDomShim */) return [3 /*break*/, 4]; /* needsShadowDomShim */
return [4 /*yield*/, import('./shadow-css-4889ae62-23996f3f.js').then(function (m) { return m.scopeCss(style_1, scopeId_1, false); })];
case 3:
style_1 = _a.sent();
_a.label = 4;
case 4:
registerStyle(scopeId_1, style_1, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
_a.label = 5;
case 5:
ancestorComponent = hostRef.$ancestorComponent$;
schedule = function () { return scheduleUpdate(elm, hostRef, cmpMeta, true); };
if (ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
return [2 /*return*/];
}
});
}); };
var connectedCallback = function (elm, cmpMeta) {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
var endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
// connectedCallback
var hostRef_1 = getHostRef(elm);
if (cmpMeta.$listeners$) {
// initialize our event listeners on the host element
// we do this now so that we can listening to events that may
// have fired even before the instance is ready
hostRef_1.$rmListeners$ = addEventListeners(elm, hostRef_1, cmpMeta.$listeners$);
}
if (!(hostRef_1.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef_1.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
var ancestorComponent = elm;
while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if ((ancestorComponent['s-p'])) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef_1, (hostRef_1.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if (cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).forEach(function (_a) {
var memberName = _a[0], memberFlags = _a[1][0];
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
var value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
// connectedCallback, taskQueue, initialLoad
// angular sets attribute AFTER connectCallback
// https://github.com/angular/angular/issues/18909
// https://github.com/angular/angular/issues/19940
nextTick(function () { return initializeComponent(elm, hostRef_1, cmpMeta); });
}
}
endConnected();
}
};
var disconnectedCallback = function (elm) {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
var hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$();
hostRef.$rmListeners$ = undefined;
}
}
// clear CSS var-shim tracking
if (plt.$cssShim$) {
plt.$cssShim$.removeHost(elm);
}
}
};
var bootstrapLazy = function (lazyBundles, options) {
if (options === void 0) { options = {}; }
var endBootstrap = createTime();
var cmpTags = [];
var exclude = options.exclude || [];
var head = doc.head;
var customElements = win.customElements;
var y = /*@__PURE__*/ head.querySelector('meta[charset]');
var visibilityStyle = /*@__PURE__*/ doc.createElement('style');
var deferredConnectedCallbacks = [];
var appLoadFallback;
var isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
if (options.syncQueue) {
plt.$flags$ |= 4 /* queueSync */;
}
lazyBundles.forEach(function (lazyBundle) { return lazyBundle[1].forEach(function (compactMeta) {
var cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
if (!supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
}
var tagName = cmpMeta.$tagName$;
var HostElement = /** @class */ (function (_super) {
__extends(HostElement, _super);
// StencilLazyHost
function HostElement(self) {
var _this =
// @ts-ignore
_super.call(this, self) || this;
self = _this;
registerHost(self);
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
if (supportsShadowDom) {
{
self.attachShadow({ mode: 'open' });
}
}
else if (!('shadowRoot' in self)) {
self.shadowRoot = self;
}
}
return _this;
}
HostElement.prototype.connectedCallback = function () {
var _this = this;
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(function () { return connectedCallback(_this, cmpMeta); });
}
};
HostElement.prototype.disconnectedCallback = function () {
var _this = this;
plt.jmp(function () { return disconnectedCallback(_this); });
};
HostElement.prototype.forceUpdate = function () {
forceUpdate(this, cmpMeta);
};
HostElement.prototype.componentOnReady = function () {
return getHostRef(this).$onReadyPromise$;
};
return HostElement;
}(HTMLElement));
cmpMeta.$lazyBundleIds$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
}); });
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length > 0) {
deferredConnectedCallbacks.forEach(function (host) { return host.connectedCallback(); });
}
else {
plt.jmp(function () { return appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'); });
}
// Fallback appLoad event
endBootstrap();
};
var createEvent = function (ref, name, flags) {
var elm = getElement(ref);
return {
emit: function (detail) {
var ev = new (CustomEvent)(name, {
bubbles: !!(flags & 4 /* Bubbles */),
composed: !!(flags & 2 /* Composed */),
cancelable: !!(flags & 1 /* Cancellable */),
detail: detail
});
elm.dispatchEvent(ev);
return ev;
}
};
};
var getElement = function (ref) { return getHostRef(ref).$hostElement$; };
export { patchEsm as a, bootstrapLazy as b, createEvent as c, getElement as g, h, patchBrowser as p, registerInstance as r };
const NAMESPACE = 'msf-editor';
let queueCongestion = 0;
let queuePending = false;
let scopeId;
let hostTagName;
let isSvgMode = false;
const win = typeof window !== 'undefined' ? window : {};
const doc = win.document || { head: {} };
const plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: (h) => h(),
raf: (h) => requestAnimationFrame(h),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
};
const supportsShadowDom = /*@__PURE__*/ (() => (doc.head.attachShadow + '').includes('[native'))() ;
const supportsListenerOptions = /*@__PURE__*/ (() => {
let supportsListenerOptions = false;
try {
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
get() { supportsListenerOptions = true; }
}));
}
catch (e) { }
return supportsListenerOptions;
})();
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
try {
new CSSStyleSheet();
return true;
}
catch (e) { }
return false;
})() ;
const hostRefs = new WeakMap();
const getHostRef = (ref) => hostRefs.get(ref);
const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
const registerHost = (elm) => {
const hostRef = {
$flags$: 0,
$hostElement$: elm,
$instanceValues$: new Map()
};
{
hostRef.$onInstancePromise$ = new Promise(r => hostRef.$onInstanceResolve$ = r);
}
{
hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
elm['s-p'] = [];
elm['s-rc'] = [];
}
return hostRefs.set(elm, hostRef);
};
const isMemberInElement = (elm, memberName) => memberName in elm;
const consoleError = (e) => console.error(e);
const moduleCache = /*@__PURE__*/ new Map();
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
// loadModuleImport
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
const bundleId = ( cmpMeta.$lazyBundleIds$);
const module = moduleCache.get(bundleId) ;
if (module) {
return module[exportName];
}
return import(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${ ''}`).then(importedModule => {
{
moduleCache.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
const styles = new Map();
const queueDomReads = [];
const queueDomWrites = [];
const queueDomWritesLow = [];
const queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
};
const consume = (queue) => {
for (let i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
const consumeTimeout = (queue, timeout) => {
let i = 0;
let ts = 0;
while (i < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i++](ts);
}
catch (e) {
consoleError(e);
}
}
if (i === queue.length) {
queue.length = 0;
}
else if (i !== 0) {
queue.splice(0, i);
}
};
const flush = () => {
queueCongestion++;
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
: Infinity;
// DOM WRITES!!!
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push(...queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
else {
queueCongestion = 0;
}
};
const nextTick = /*@__PURE__*/ (cb) => Promise.resolve().then(cb);
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
const EMPTY_OBJ = {};
const isDef = (v) => v != null;
const isComplexType = (o) => {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
const getDynamicImportFunction = (namespace) => {
return `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
};
const patchEsm = () => {
// @ts-ignore
if ( !(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
// @ts-ignore
return import('./css-shim-6aaf713d-9b13816a.js').then(() => {
plt.$cssShim$ = win.__stencil_cssshim;
if (plt.$cssShim$) {
return plt.$cssShim$.initShim();
}
});
}
return Promise.resolve();
};
const patchBrowser = () => {
{
// shim css vars
plt.$cssShim$ = win.__stencil_cssshim;
}
// @ts-ignore
const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => (new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
s.getAttribute('data-stencil-namespace') === NAMESPACE));
const opts = scriptElm['data-opts'] || {};
const importMeta = "";
if ('onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
// Safari < v11 support: This IF is true if it's Safari below v11.
// This fn cannot use async/await since Safari didn't support it until v11,
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
// so both the ESM file and nomodule file would get downloaded. Only Safari
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
return { then() { } };
}
if (importMeta !== '') {
opts.resourcesUrl = new URL('.', importMeta).href;
}
else {
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
patchDynamicImport(opts.resourcesUrl, scriptElm);
if (!window.customElements) {
// module support, but no custom elements support (Old Edge)
// @ts-ignore
return import('./dom-76cc7c7d-0a082895.js').then(() => opts);
}
}
return Promise.resolve(opts);
};
const patchDynamicImport = (base, orgScriptElm) => {
const importFunctionName = getDynamicImportFunction(NAMESPACE);
try {
// test if this browser supports dynamic imports
// There is a caching issue in V8, that breaks using import() in Function
// By generating a random string, we can workaround it
// Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
}
catch (e) {
// this shim is specifically for browsers that do support "esm" imports
// however, they do NOT support "dynamic" imports
// basically this code is for old Edge, v18 and below
const moduleMap = new Map();
win[importFunctionName] = (src) => {
const url = new URL(src, base).href;
let mod = moduleMap.get(url);
if (!mod) {
const script = doc.createElement('script');
script.type = 'module';
script.crossOrigin = orgScriptElm.crossOrigin;
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
mod = new Promise(resolve => {
script.onload = () => {
resolve(win[importFunctionName].m);
script.remove();
};
});
moduleMap.set(url, mod);
doc.head.appendChild(script);
}
return mod;
};
}
};
const parsePropertyValue = (propValue, propType) => {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if ( propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
const HYDRATED_CLASS = 'hydrated';
const createTime = (fnName, tagName = '') => {
{
return () => { return; };
}
};
const uniqueTime = (key, measureText) => {
{
return () => { return; };
}
};
const rootAppliedStyles = new WeakMap();
const registerStyle = (scopeId, cssText, allowCS) => {
let style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
let scopeId = getScopeId(cmpMeta.$tagName$);
let style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
}
if (!appliedStyles.has(scopeId)) {
{
if ( plt.$cssShim$) {
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
const newScopeId = styleElm['s-sc'];
if (newScopeId) {
scopeId = newScopeId;
// we don't want to add this styleID to the appliedStyles Set
// since the cssVarShim might need to apply several different
// stylesheets for the same component
appliedStyles = null;
}
}
else {
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = [
...styleContainerNode.adoptedStyleSheets,
style
];
}
}
return scopeId;
};
const attachStyles = (elm, cmpMeta, mode) => {
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(( supportsShadowDom && elm.shadowRoot)
? elm.shadowRoot
: elm.getRootNode(), cmpMeta, mode, elm);
if ( cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
const getScopeId = (tagName, mode) => 'sc-' + ( tagName);
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
const h = (nodeName, vnodeData, ...children) => {
let child = null;
let simple = false;
let lastSimple = false;
let vNodeChildren = [];
const walk = (c) => {
for (let i = 0; i < c.length; i++) {
child = c[i];
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) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class = typeof classData !== 'object'
? classData
: Object.keys(classData)
.filter(k => classData[k])
.join(' ');
}
}
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
const newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
return vnode;
};
const Host = {};
const isHost = (node) => node && node.$tag$ === Host;
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
if (oldValue === newValue) {
return;
}
let isProp = isMemberInElement(elm, memberName);
let ln = memberName.toLowerCase();
if ( memberName === 'class') {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
const newClasses = parseClassList(newValue);
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
}
else {
// Set property if it exists and it's not a SVG
const isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
let n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
// tslint:disable-next-line: triple-equals
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
{
elm.removeAttribute(memberName);
}
}
else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
};
const parseClassListRegex = /\s/;
const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
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;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
// tslint:disable-next-line: prefer-const
let newVNode = newParentVNode.$children$[childIndex];
let i = 0;
let elm;
let childNode;
{
// create element
elm = newVNode.$elm$ = ( doc.createElement( newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if ( isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = ( parentElm);
let childNode;
if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
for (; startIdx <= endIdx; ++startIdx) {
if (vnode = vnodes[startIdx]) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
let oldStartIdx = 0;
let newStartIdx = 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;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
}
else if ( newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
const isSameVnode = (vnode1, vnode2) => {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
const patch = (oldVNode, newVNode) => {
const elm = newVNode.$elm$ = oldVNode.$elm$;
const oldChildren = oldVNode.$children$;
const newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if ( oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if ( oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
hostTagName = hostElm.tagName;
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
const rootVnode = isHost(renderFnResults)
? renderFnResults
: h(null, null, renderFnResults);
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm );
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
const attachToAncestor = (hostRef, ancestorComponent) => {
if ( ancestorComponent && !hostRef.$onRenderResolve$) {
ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
}
};
const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
const instance = hostRef.$lazyInstance$ ;
const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
attachToAncestor(hostRef, ancestorComponent);
let promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
}
endSchedule();
// there is no ancestorc omponent or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
return then(promise, () => writeTask(update)
);
};
const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
// updateComponent
const endUpdate = createTime('update', cmpMeta.$tagName$);
const rc = elm['s-rc'];
if ( isInitialLoad) {
// DOM WRITE!
attachStyles(elm, cmpMeta, hostRef.$modeName$);
}
const endRender = createTime('render', cmpMeta.$tagName$);
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
renderVdom(elm, hostRef, cmpMeta, callRender(instance));
}
}
if ( plt.$cssShim$) {
plt.$cssShim$.updateHost(elm);
}
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
if ( rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.forEach(cb => cb());
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
const childrenPromises = elm['s-p'];
const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
const callRender = (instance, elm) => {
try {
instance = instance.render() ;
}
catch (e) {
consoleError(e);
}
return instance;
};
const postUpdateComponent = (elm, hostRef, cmpMeta) => {
const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
// add the css class that this element has officially hydrated
elm.classList.add(HYDRATED_CLASS);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
const forceUpdate = (elm, cmpMeta) => {
{
const hostRef = getHostRef(elm);
const isConnected = hostRef.$hostElement$.isConnected;
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
// Returns "true" when the forced update was successfully scheduled
return isConnected;
}
};
const appDidLoad = (who) => {
// on appload
// we have finish the first big initial render
{
doc.documentElement.classList.add(HYDRATED_CLASS);
}
{
plt.$flags$ |= 2 /* appLoaded */;
}
};
const safeCall = (instance, method, arg) => {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
const then = (promise, thenFn) => {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
const setValue = (ref, propName, newVal, cmpMeta) => {
// check our new property value against our internal value
const hostRef = getHostRef(ref);
const elm = hostRef.$hostElement$ ;
const oldVal = hostRef.$instanceValues$.get(propName);
const flags = hostRef.$flags$;
const instance = hostRef.$lazyInstance$ ;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
if (newVal !== oldVal && ( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if ( instance) {
if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
}
}
};
const proxyComponent = (Cstr, cmpMeta, flags) => {
if ( cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
const members = Object.entries(cmpMeta.$members$);
const prototype = Cstr.prototype;
members.forEach(([memberName, [memberFlags]]) => {
if ( ((memberFlags & 31 /* Prop */) ||
(( flags & 2 /* proxyState */) &&
(memberFlags & 32 /* State */)))) {
// proxyComponent - prop
Object.defineProperty(prototype, memberName, {
get() {
// proxyComponent, get value
return getValue(this, memberName);
},
set(newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true
});
}
else if ( (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
// proxyComponent - method
Object.defineProperty(prototype, memberName, {
value(...args) {
const ref = getHostRef(this);
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
}
});
}
});
if ( ( flags & 1 /* isElementConstructor */)) {
const attrNameToPropName = new Map();
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
plt.jmp(() => {
const propName = attrNameToPropName.get(attrName);
this[propName] = newValue === null && typeof this[propName] === 'boolean'
? false
: newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
.map(([propName, m]) => {
const attrName = m[1] || propName;
attrNameToPropName.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
const addEventListeners = (elm, hostRef, listeners) => {
hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
const removeFns = listeners.map(([flags, name, method]) => {
const target = ( getHostListenerTarget(elm, flags) );
const handler = hostListenerProxy(hostRef, method);
const opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
return () => plt.rel(target, name, handler, opts);
});
return () => removeFns.forEach(fn => fn());
};
const hostListenerProxy = (hostRef, methodName) => {
return (ev) => {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
hostRef.$queuedListeners$.push([methodName, ev]);
}
}
};
};
const getHostListenerTarget = (elm, flags) => {
if ( flags & 8 /* TargetWindow */)
return win;
return elm;
};
const hostListenerOpts = (flags) => supportsListenerOptions ?
{
'passive': (flags & 1 /* Passive */) !== 0,
'capture': (flags & 2 /* Capture */) !== 0,
}
: (flags & 2 /* Capture */) !== 0;
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
{
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime();
Cstr = await Cstr;
endLoad();
}
if ( !Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
}
const scopeId = getScopeId(cmpMeta.$tagName$);
if ( !styles.has(scopeId) && Cstr.style) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
// this component has styles but we haven't registered them yet
let style = Cstr.style;
if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
style = await import('./shadow-css-4889ae62-23996f3f.js').then(m => m.scopeCss(style, scopeId, false));
}
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
if ( ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};
const connectedCallback = (elm, cmpMeta) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
// connectedCallback
const hostRef = getHostRef(elm);
if ( cmpMeta.$listeners$) {
// initialize our event listeners on the host element
// we do this now so that we can listening to events that may
// have fired even before the instance is ready
hostRef.$rmListeners$ = addEventListeners(elm, hostRef, cmpMeta.$listeners$);
}
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
let ancestorComponent = elm;
while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if (
(ancestorComponent['s-p'])) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if ( cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
const value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
// connectedCallback, taskQueue, initialLoad
// angular sets attribute AFTER connectCallback
// https://github.com/angular/angular/issues/18909
// https://github.com/angular/angular/issues/19940
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
}
}
endConnected();
}
};
const disconnectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$();
hostRef.$rmListeners$ = undefined;
}
}
// clear CSS var-shim tracking
if ( plt.$cssShim$) {
plt.$cssShim$.removeHost(elm);
}
}
};
const bootstrapLazy = (lazyBundles, options = {}) => {
const endBootstrap = createTime();
const cmpTags = [];
const exclude = options.exclude || [];
const head = doc.head;
const customElements = win.customElements;
const y = /*@__PURE__*/ head.querySelector('meta[charset]');
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
const deferredConnectedCallbacks = [];
let appLoadFallback;
let isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
if (options.syncQueue) {
plt.$flags$ |= 4 /* queueSync */;
}
lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
const cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
if ( !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
}
const tagName = cmpMeta.$tagName$;
const HostElement = class extends HTMLElement {
// StencilLazyHost
constructor(self) {
// @ts-ignore
super(self);
self = this;
registerHost(self);
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
if (supportsShadowDom) {
{
self.attachShadow({ mode: 'open' });
}
}
else if ( !('shadowRoot' in self)) {
self.shadowRoot = self;
}
}
}
connectedCallback() {
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(() => connectedCallback(this, cmpMeta));
}
}
disconnectedCallback() {
plt.jmp(() => disconnectedCallback(this));
}
forceUpdate() {
forceUpdate(this, cmpMeta);
}
componentOnReady() {
return getHostRef(this).$onReadyPromise$;
}
};
cmpMeta.$lazyBundleIds$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
}));
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length > 0) {
deferredConnectedCallbacks.forEach(host => host.connectedCallback());
}
else {
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
}
// Fallback appLoad event
endBootstrap();
};
const createEvent = (ref, name, flags) => {
const elm = getElement(ref);
return {
emit: (detail) => {
const ev = new ( CustomEvent)(name, {
bubbles: !!(flags & 4 /* Bubbles */),
composed: !!(flags & 2 /* Composed */),
cancelable: !!(flags & 1 /* Cancellable */),
detail
});
elm.dispatchEvent(ev);
return ev;
}
};
};
const getElement = (ref) => getHostRef(ref).$hostElement$ ;
export { patchEsm as a, bootstrapLazy as b, createEvent as c, getElement as g, h, patchBrowser as p, registerInstance as r };
var __extends=this&&this.__extends||function(){var e=function(r,n){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)if(r.hasOwnProperty(n))e[n]=r[n]};return e(r,n)};return function(r,n){e(r,n);function t(){this.constructor=r}r.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}}();var __awaiter=this&&this.__awaiter||function(e,r,n,t){function a(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{u(t.next(e))}catch(r){i(r)}}function o(e){try{u(t["throw"](e))}catch(r){i(r)}}function u(e){e.done?n(e.value):a(e.value).then(s,o)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,a,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(n)try{if(t=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;a=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(o){s=[6,o];a=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,r=0,n=arguments.length;r<n;r++)e+=arguments[r].length;for(var t=Array(e),a=0,r=0;r<n;r++)for(var i=arguments[r],s=0,o=i.length;s<o;s++,a++)t[a]=i[s];return t};System.register([],(function(e,r){"use strict";return{execute:function(){var n=this;var t="msf-editor";var a=0;var i=false;var s;var o;var u=false;var l=typeof window!=="undefined"?window:{};var f=l.document||{head:{}};var c={$flags$:0,$resourcesUrl$:"",jmp:function(e){return e()},raf:function(e){return requestAnimationFrame(e)},ael:function(e,r,n,t){return e.addEventListener(r,n,t)},rel:function(e,r,n,t){return e.removeEventListener(r,n,t)}};var $=function(){return(f.head.attachShadow+"").includes("[native")}();var v=function(){var e=false;try{f.addEventListener("e",null,Object.defineProperty({},"passive",{get:function(){e=true}}))}catch(r){}return e}();var h=function(){try{new CSSStyleSheet;return true}catch(e){}return false}();var d=new WeakMap;var m=function(e){return d.get(e)};var p=e("r",(function(e,r){return d.set(r.$lazyInstance$=e,r)}));var g=function(e){var r={$flags$:0,$hostElement$:e,$instanceValues$:new Map};{r.$onInstancePromise$=new Promise((function(e){return r.$onInstanceResolve$=e}))}{r.$onReadyPromise$=new Promise((function(e){return r.$onReadyResolve$=e}));e["s-p"]=[];e["s-rc"]=[]}return d.set(e,r)};var y=function(e,r){return r in e};var b=function(e){return console.error(e)};var w=new Map;var S=function(e,n,t){var a=e.$tagName$.replace(/-/g,"_");var i=e.$lazyBundleIds$;var s=w.get(i);if(s){return s[a]}return r.import("./"+i+".entry.js"+"").then((function(e){{w.set(i,e)}return e[a]}),b)};var _=new Map;var R=[];var L=[];var E=[];var j=function(e,r){return function(n){e.push(n);if(!i){i=true;if(r&&c.$flags$&4){x(P)}else{c.raf(P)}}}};var C=function(e){for(var r=0;r<e.length;r++){try{e[r](performance.now())}catch(n){b(n)}}e.length=0};var N=function(e,r){var n=0;var t=0;while(n<e.length&&(t=performance.now())<r){try{e[n++](t)}catch(a){b(a)}}if(n===e.length){e.length=0}else if(n!==0){e.splice(0,n)}};var P=function(){a++;C(R);var e=(c.$flags$&6)===2?performance.now()+10*Math.ceil(a*(1/22)):Infinity;N(L,e);N(E,e);if(L.length>0){E.push.apply(E,L);L.length=0}if(i=R.length+L.length+E.length>0){c.raf(P)}else{a=0}};var x=function(e){return Promise.resolve().then(e)};var U=j(L,true);var A={};var O=function(e){return e!=null};var k=function(e){e=typeof e;return e==="object"||e==="function"};var I=function(e){return"__sc_import_"+e.replace(/\s|-/g,"_")};var M=e("a",(function(){if(!(l.CSS&&l.CSS.supports&&l.CSS.supports("color","var(--c)"))){return r.import("./p-447ccb56.system.js").then((function(){c.$cssShim$=l.__stencil_cssshim;if(c.$cssShim$){return c.$cssShim$.initShim()}}))}return Promise.resolve()}));var q=e("p",(function(){{c.$cssShim$=l.__stencil_cssshim}var e=Array.from(f.querySelectorAll("script")).find((function(e){return new RegExp("/"+t+"(\\.esm)?\\.js($|\\?|#)").test(e.src)||e.getAttribute("data-stencil-namespace")===t}));var n=e["data-opts"]||{};var a=r.meta.url;if("onbeforeload"in e&&!history.scrollRestoration&&false){return{then:function(){}}}if(a!==""){n.resourcesUrl=new URL(".",a).href}else{n.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,l.location.href)).href;B(n.resourcesUrl,e);if(!window.customElements){return r.import("./p-7f10eb01.system.js").then((function(){return n}))}}return Promise.resolve(n)}));var B=function(e,r){var n=I(t);try{l[n]=new Function("w","return import(w);//"+Math.random())}catch(i){var a=new Map;l[n]=function(t){var i=new URL(t,e).href;var s=a.get(i);if(!s){var o=f.createElement("script");o.type="module";o.crossOrigin=r.crossOrigin;o.src=URL.createObjectURL(new Blob(["import * as m from '"+i+"'; window."+n+".m = m;"],{type:"application/javascript"}));s=new Promise((function(e){o.onload=function(){e(l[n].m);o.remove()}}));a.set(i,s);f.head.appendChild(o)}return s}}};var T=function(e,r){if(e!=null&&!k(e)){if(r&1){return String(e)}return e}return e};var z="hydrated";var H=function(e,r){if(r===void 0){r=""}{return function(){return}}};var V=function(e,r){{return function(){return}}};var W=new WeakMap;var F=function(e,r,n){var t=_.get(e);if(h&&n){t=t||new CSSStyleSheet;t.replace(r)}else{t=r}_.set(e,t)};var G=function(e,r,n,t){var a=D(r.$tagName$);var i=_.get(a);e=e.nodeType===11?e:f;if(i){if(typeof i==="string"){e=e.head||e;var s=W.get(e);var o=void 0;if(!s){W.set(e,s=new Set)}if(!s.has(a)){{if(c.$cssShim$){o=c.$cssShim$.createHostStyle(t,a,i,!!(r.$flags$&10));var u=o["s-sc"];if(u){a=u;s=null}}else{o=f.createElement("style");o.innerHTML=i}e.insertBefore(o,e.querySelector("link"))}if(s){s.add(a)}}}else if(!e.adoptedStyleSheets.includes(i)){e.adoptedStyleSheets=__spreadArrays(e.adoptedStyleSheets,[i])}}return a};var Q=function(e,r,n){var t=H("attachStyles",r.$tagName$);var a=G($&&e.shadowRoot?e.shadowRoot:e.getRootNode(),r,n,e);if(r.$flags$&10){e["s-sc"]=a;e.classList.add(a+"-h")}t()};var D=function(e,r){return"sc-"+e};var J=e("h",(function(e,r){var n=[];for(var t=2;t<arguments.length;t++){n[t-2]=arguments[t]}var a=null;var i=false;var s=false;var o=[];var u=function(r){for(var n=0;n<r.length;n++){a=r[n];if(Array.isArray(a)){u(a)}else if(a!=null&&typeof a!=="boolean"){if(i=typeof e!=="function"&&!k(a)){a=String(a)}if(i&&s){o[o.length-1].$text$+=a}else{o.push(i?K(null,a):a)}s=i}}};u(n);if(r){{var l=r.className||r.class;if(l){r.class=typeof l!=="object"?l:Object.keys(l).filter((function(e){return l[e]})).join(" ")}}}var f=K(e,null);f.$attrs$=r;if(o.length>0){f.$children$=o}return f}));var K=function(e,r){var n={$flags$:0,$tag$:e,$text$:r,$elm$:null,$children$:null};{n.$attrs$=null}return n};var X={};var Y=function(e){return e&&e.$tag$===X};var Z=function(e,r,n,t,a,i){if(n===t){return}var s=y(e,r);var o=r.toLowerCase();if(r==="class"){var u=e.classList;var l=re(n);var f=re(t);u.remove.apply(u,l.filter((function(e){return e&&!f.includes(e)})));u.add.apply(u,f.filter((function(e){return e&&!l.includes(e)})))}else{var c=k(t);if((s||c&&t!==null)&&!a){try{if(!e.tagName.includes("-")){var $=t==null?"":t;if(r==="list"){s=false}else if(n==null||e[r]!=$){e[r]=$}}else{e[r]=t}}catch(v){}}if(t==null||t===false){{e.removeAttribute(r)}}else if((!s||i&4||a)&&!c){t=t===true?"":t;{e.setAttribute(r,t)}}}};var ee=/\s/;var re=function(e){return!e?[]:e.split(ee)};var ne=function(e,r,n,t){var a=r.$elm$.nodeType===11&&r.$elm$.host?r.$elm$.host:r.$elm$;var i=e&&e.$attrs$||A;var s=r.$attrs$||A;{for(t in i){if(!(t in s)){Z(a,t,i[t],undefined,n,r.$flags$)}}}for(t in s){Z(a,t,i[t],s[t],n,r.$flags$)}};var te=function(e,r,n,t){var a=r.$children$[n];var i=0;var o;var l;{o=a.$elm$=f.createElement(a.$tag$);{ne(null,a,u)}if(O(s)&&o["s-si"]!==s){o.classList.add(o["s-si"]=s)}if(a.$children$){for(i=0;i<a.$children$.length;++i){l=te(e,a,i);if(l){o.appendChild(l)}}}}return o};var ae=function(e,r,n,t,a,i){var s=e;var u;if(s.shadowRoot&&s.tagName===o){s=s.shadowRoot}for(;a<=i;++a){if(t[a]){u=te(null,n,a);if(u){t[a].$elm$=u;s.insertBefore(u,r)}}}};var ie=function(e,r,n,t,a){for(;r<=n;++r){if(t=e[r]){a=t.$elm$;a.remove()}}};var se=function(e,r,n,t){var a=0;var i=0;var s=r.length-1;var o=r[0];var u=r[s];var l=t.length-1;var f=t[0];var c=t[l];var $;while(a<=s&&i<=l){if(o==null){o=r[++a]}else if(u==null){u=r[--s]}else if(f==null){f=t[++i]}else if(c==null){c=t[--l]}else if(oe(o,f)){ue(o,f);o=r[++a];f=t[++i]}else if(oe(u,c)){ue(u,c);u=r[--s];c=t[--l]}else if(oe(o,c)){ue(o,c);e.insertBefore(o.$elm$,u.$elm$.nextSibling);o=r[++a];c=t[--l]}else if(oe(u,f)){ue(u,f);e.insertBefore(u.$elm$,o.$elm$);u=r[--s];f=t[++i]}else{{$=te(r&&r[i],n,i);f=t[++i]}if($){{o.$elm$.parentNode.insertBefore($,o.$elm$)}}}}if(a>s){ae(e,t[l+1]==null?null:t[l+1].$elm$,n,t,i,l)}else if(i>l){ie(r,a,s)}};var oe=function(e,r){if(e.$tag$===r.$tag$){return true}return false};var ue=function(e,r){var n=r.$elm$=e.$elm$;var t=e.$children$;var a=r.$children$;{{{ne(e,r,u)}}if(t!==null&&a!==null){se(n,t,r,a)}else if(a!==null){ae(n,null,r,a,0,a.length-1)}else if(t!==null){ie(t,0,t.length-1)}}};var le=function(e,r,n,t){o=e.tagName;var a=r.$vnode$||K(null,null);var i=Y(t)?t:J(null,null,t);i.$tag$=null;i.$flags$|=4;r.$vnode$=i;i.$elm$=a.$elm$=e.shadowRoot||e;{s=e["s-sc"]}ue(a,i)};var fe=function(e,r){if(r&&!e.$onRenderResolve$){r["s-p"].push(new Promise((function(r){return e.$onRenderResolve$=r})))}};var ce=function(e,r,n,t){{r.$flags$|=16}if(r.$flags$&4){r.$flags$|=512;return}var a=H("scheduleUpdate",n.$tagName$);var i=r.$ancestorComponent$;var s=r.$lazyInstance$;var o=function(){return $e(e,r,n,s,t)};fe(r,i);var u;if(t){{r.$flags$|=256;if(r.$queuedListeners$){r.$queuedListeners$.forEach((function(e){var r=e[0],n=e[1];return pe(s,r,n)}));r.$queuedListeners$=null}}{u=pe(s,"componentWillLoad")}}{u=ge(u,(function(){return pe(s,"componentWillRender")}))}a();return ge(u,(function(){return U(o)}))};var $e=function(e,r,n,t,a){var i=H("update",n.$tagName$);var s=e["s-rc"];if(a){Q(e,n,r.$modeName$)}var o=H("render",n.$tagName$);{{le(e,r,n,ve(t))}}if(c.$cssShim$){c.$cssShim$.updateHost(e)}{r.$flags$&=~16}{r.$flags$|=2}if(s){s.forEach((function(e){return e()}));e["s-rc"]=undefined}o();i();{var u=e["s-p"];var l=function(){return he(e,r,n)};if(u.length===0){l()}else{Promise.all(u).then(l);r.$flags$|=4;u.length=0}}};var ve=function(e,r){try{e=e.render()}catch(n){b(n)}return e};var he=function(e,r,n){var t=H("postUpdate",n.$tagName$);var a=r.$ancestorComponent$;if(!(r.$flags$&64)){r.$flags$|=64;{e.classList.add(z)}t();{r.$onReadyResolve$(e);if(!a){me()}}}else{t()}{r.$onInstanceResolve$(e)}{if(r.$onRenderResolve$){r.$onRenderResolve$();r.$onRenderResolve$=undefined}if(r.$flags$&512){x((function(){return ce(e,r,n,false)}))}r.$flags$&=~(4|512)}};var de=function(e,r){{var n=m(e);var t=n.$hostElement$.isConnected;if(t&&(n.$flags$&(2|16))===2){ce(e,n,r,false)}return t}};var me=function(e){{f.documentElement.classList.add(z)}{c.$flags$|=2}};var pe=function(e,r,n){if(e&&e[r]){try{return e[r](n)}catch(t){b(t)}}return undefined};var ge=function(e,r){return e&&e.then?e.then(r):r()};var ye=function(e,r){return m(e).$instanceValues$.get(r)};var be=function(e,r,n,t){var a=m(e);var i=a.$hostElement$;var s=a.$instanceValues$.get(r);var o=a.$flags$;var u=a.$lazyInstance$;n=T(n,t.$members$[r][0]);if(n!==s&&(!(o&8)||s===undefined)){a.$instanceValues$.set(r,n);if(u){if((o&(2|16))===2){ce(i,a,t,false)}}}};var we=function(e,r,n){if(r.$members$){var t=Object.entries(r.$members$);var a=e.prototype;t.forEach((function(e){var t=e[0],i=e[1][0];if(i&31||n&2&&i&32){Object.defineProperty(a,t,{get:function(){return ye(this,t)},set:function(e){be(this,t,e,r)},configurable:true,enumerable:true})}else if(n&1&&i&64){Object.defineProperty(a,t,{value:function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}var n=m(this);return n.$onInstancePromise$.then((function(){var r;return(r=n.$lazyInstance$)[t].apply(r,e)}))}})}}));if(n&1){var i=new Map;a.attributeChangedCallback=function(e,r,n){var t=this;c.jmp((function(){var r=i.get(e);t[r]=n===null&&typeof t[r]==="boolean"?false:n}))};e.observedAttributes=t.filter((function(e){var r=e[0],n=e[1];return n[0]&15})).map((function(e){var r=e[0],n=e[1];var t=n[1]||r;i.set(t,r);return t}))}}return e};var Se=function(e,r,n){r.$queuedListeners$=r.$queuedListeners$||[];var t=n.map((function(n){var t=n[0],a=n[1],i=n[2];var s=Re(e,t);var o=_e(r,i);var u=Le(t);c.ael(s,a,o,u);return function(){return c.rel(s,a,o,u)}}));return function(){return t.forEach((function(e){return e()}))}};var _e=function(e,r){return function(n){{if(e.$flags$&256){e.$lazyInstance$[r](n)}else{e.$queuedListeners$.push([r,n])}}}};var Re=function(e,r){if(r&8)return l;return e};var Le=function(e){return v?{passive:(e&1)!==0,capture:(e&2)!==0}:(e&2)!==0};var Ee=function(e,t,a,i,s){return __awaiter(n,void 0,void 0,(function(){var n,i,o,u,l,f,c;return __generator(this,(function($){switch($.label){case 0:if(!((t.$flags$&32)===0))return[3,5];t.$flags$|=32;s=S(a);if(!s.then)return[3,2];n=V();return[4,s];case 1:s=$.sent();n();$.label=2;case 2:if(!s.isProxied){we(s,a,2);s.isProxied=true}i=H("createInstance",a.$tagName$);{t.$flags$|=8}try{new s(t)}catch(v){b(v)}{t.$flags$&=~8}i();o=D(a.$tagName$);if(!(!_.has(o)&&s.style))return[3,5];u=H("registerStyles",a.$tagName$);l=s.style;if(!(a.$flags$&8))return[3,4];return[4,r.import("./p-ed968002.system.js").then((function(e){return e.scopeCss(l,o,false)}))];case 3:l=$.sent();$.label=4;case 4:F(o,l,!!(a.$flags$&1));u();$.label=5;case 5:f=t.$ancestorComponent$;c=function(){return ce(e,t,a,true)};if(f&&f["s-rc"]){f["s-rc"].push(c)}else{c()}return[2]}}))}))};var je=function(e,r){if((c.$flags$&1)===0){var n=H("connectedCallback",r.$tagName$);var t=m(e);if(r.$listeners$){t.$rmListeners$=Se(e,t,r.$listeners$)}if(!(t.$flags$&1)){t.$flags$|=1;{var a=e;while(a=a.parentNode||a.host){if(a["s-p"]){fe(t,t.$ancestorComponent$=a);break}}}if(r.$members$){Object.entries(r.$members$).forEach((function(r){var n=r[0],t=r[1][0];if(t&31&&e.hasOwnProperty(n)){var a=e[n];delete e[n];e[n]=a}}))}{x((function(){return Ee(e,t,r)}))}}n()}};var Ce=function(e){if((c.$flags$&1)===0){var r=m(e);{if(r.$rmListeners$){r.$rmListeners$();r.$rmListeners$=undefined}}if(c.$cssShim$){c.$cssShim$.removeHost(e)}}};var Ne=e("b",(function(e,r){if(r===void 0){r={}}var n=H();var t=[];var a=r.exclude||[];var i=f.head;var s=l.customElements;var o=i.querySelector("meta[charset]");var u=f.createElement("style");var v=[];var h;var d=true;Object.assign(c,r);c.$resourcesUrl$=new URL(r.resourcesUrl||"./",f.baseURI).href;if(r.syncQueue){c.$flags$|=4}e.forEach((function(e){return e[1].forEach((function(r){var n={$flags$:r[0],$tagName$:r[1],$members$:r[2],$listeners$:r[3]};{n.$members$=r[2]}{n.$listeners$=r[3]}if(!$&&n.$flags$&1){n.$flags$|=8}var i=n.$tagName$;var o=function(e){__extends(r,e);function r(r){var t=e.call(this,r)||this;r=t;g(r);if(n.$flags$&1){if($){{r.attachShadow({mode:"open"})}}else if(!("shadowRoot"in r)){r.shadowRoot=r}}return t}r.prototype.connectedCallback=function(){var e=this;if(h){clearTimeout(h);h=null}if(d){v.push(this)}else{c.jmp((function(){return je(e,n)}))}};r.prototype.disconnectedCallback=function(){var e=this;c.jmp((function(){return Ce(e)}))};r.prototype.forceUpdate=function(){de(this,n)};r.prototype.componentOnReady=function(){return m(this).$onReadyPromise$};return r}(HTMLElement);n.$lazyBundleIds$=e[0];if(!a.includes(i)&&!s.get(i)){t.push(i);s.define(i,we(o,n,1))}}))}));u.innerHTML=t+"{visibility:hidden}.hydrated{visibility:inherit}";u.setAttribute("data-styles","");i.insertBefore(u,o?o.nextSibling:i.firstChild);d=false;if(v.length>0){v.forEach((function(e){return e.connectedCallback()}))}else{c.jmp((function(){return h=setTimeout(me,30,"timeout")}))}n()}));var Pe=e("c",(function(e,r,n){var t=xe(e);return{emit:function(e){var a=new CustomEvent(r,{bubbles:!!(n&4),composed:!!(n&2),cancelable:!!(n&1),detail:e});t.dispatchEvent(a);return a}}}));var xe=e("g",(function(e){return m(e).$hostElement$}))}}}));
System.register(["./p-20b31ffb.system.js"],(function(){"use strict";var e,t;return{setters:[function(n){e=n.p;t=n.b}],execute:function(){e().then((function(e){return t([["p-khopkxsk.system",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e)}))}}}));
let t,e,n=0,o=!1;const s="undefined"!=typeof window?window:{},l=s.document||{head:{}},r={t:0,o:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o)},c=(()=>(l.head.attachShadow+"").includes("[native"))(),i=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),a=new WeakMap,u=t=>a.get(t),f=(t,e)=>a.set(e.s=t,e),m=t=>console.error(t),d=new Map,p=new Map,h=[],w=[],$=[],y=(t,e)=>n=>{t.push(n),o||(o=!0,e&&4&r.t?g(_):r.raf(_))},b=(t,e)=>{let n=0,o=0;for(;n<t.length&&(o=performance.now())<e;)try{t[n++](o)}catch(s){m(s)}n===t.length?t.length=0:0!==n&&t.splice(0,n)},_=()=>{n++,(t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(e){m(e)}t.length=0})(h);const t=2==(6&r.t)?performance.now()+10*Math.ceil(n*(1/22)):1/0;b(w,t),b($,t),w.length>0&&($.push(...w),w.length=0),(o=h.length+w.length+$.length>0)?r.raf(_):n=0},g=t=>Promise.resolve().then(t),j=y(w,!0),v={},S=t=>"object"==(t=typeof t)||"function"===t,M=()=>s.CSS&&s.CSS.supports&&s.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_msf_editor("./p-73bc5e11.js").then(()=>{r.l=s.__stencil_cssshim}),R=()=>{r.l=s.__stencil_cssshim;const t=Array.from(l.querySelectorAll("script")).find(t=>new RegExp("/msf-editor(\\.esm)?\\.js($|\\?|#)").test(t.src)||"msf-editor"===t.getAttribute("data-stencil-namespace")),e=t["data-opts"]||{};return"onbeforeload"in t&&!history.scrollRestoration?{then(){}}:(e.resourcesUrl=new URL(".",new URL(t.getAttribute("data-resources-url")||t.src,s.location.href)).href,P(e.resourcesUrl,t),window.customElements?Promise.resolve(e):__sc_import_msf_editor("./p-3b66a627.js").then(()=>e))},P=(t,e)=>{const n=(()=>`__sc_import_${"msf-editor".replace(/\s|-/g,"_")}`)();try{s[n]=new Function("w",`return import(w);//${Math.random()}`)}catch(o){const r=new Map;s[n]=o=>{const c=new URL(o,t).href;let i=r.get(c);if(!i){const t=l.createElement("script");t.type="module",t.crossOrigin=e.crossOrigin,t.src=URL.createObjectURL(new Blob([`import * as m from '${c}'; window.${n}.m = m;`],{type:"application/javascript"})),i=new Promise(e=>{t.onload=()=>{e(s[n].m),t.remove()}}),r.set(c,i),l.head.appendChild(t)}return i}}},L=new WeakMap,O=t=>"sc-"+t,U=(t,e,...n)=>{let o=null,s=!1,l=!1,r=[];const c=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?c(o):null!=o&&"boolean"!=typeof o&&((s="function"!=typeof t&&!S(o))&&(o=String(o)),s&&l?r[r.length-1].i+=o:r.push(s?k(null,o):o),l=s)};if(c(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter(e=>t[e]).join(" "))}const i=k(t,null);return i.u=e,r.length>0&&(i.p=r),i},k=(t,e)=>({t:0,h:t,i:e,$:null,p:null,u:null}),C={},x=(t,e,n,o,s,l)=>{if(n===o)return;let r=((t,e)=>e in t)(t,e);if(e.toLowerCase(),"class"===e){const e=t.classList,s=W(n),l=W(o);e.remove(...s.filter(t=>t&&!l.includes(t))),e.add(...l.filter(t=>t&&!s.includes(t)))}else{const i=S(o);if((r||i&&null!==o)&&!s)try{if(t.tagName.includes("-"))t[e]=o;else{let s=null==o?"":o;"list"===e?r=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(c){}null==o||!1===o?t.removeAttribute(e):(!r||4&l||s)&&!i&&t.setAttribute(e,o=!0===o?"":o)}},E=/\s/,W=t=>t?t.split(E):[],A=(t,e,n,o)=>{const s=11===e.$.nodeType&&e.$.host?e.$.host:e.$,l=t&&t.u||v,r=e.u||v;for(o in l)o in r||x(s,o,l[o],void 0,n,e.t);for(o in r)x(s,o,l[o],r[o],n,e.t)},T=(e,n,o)=>{let s,r,c=n.p[o],i=0;if(s=c.$=l.createElement(c.h),A(null,c,!1),(t=>null!=t)(t)&&s["s-si"]!==t&&s.classList.add(s["s-si"]=t),c.p)for(i=0;i<c.p.length;++i)(r=T(e,c,i))&&s.appendChild(r);return s},F=(t,n,o,s,l,r)=>{let c,i=t;for(i.shadowRoot&&i.tagName===e&&(i=i.shadowRoot);l<=r;++l)s[l]&&(c=T(null,o,l))&&(s[l].$=c,i.insertBefore(c,n))},q=(t,e,n,o)=>{for(;e<=n;++e)(o=t[e])&&o.$.remove()},B=(t,e)=>t.h===e.h,H=(t,e)=>{const n=e.$=t.$,o=t.p,s=e.p;A(t,e,!1),null!==o&&null!==s?((t,e,n,o)=>{let s,l=0,r=0,c=e.length-1,i=e[0],a=e[c],u=o.length-1,f=o[0],m=o[u];for(;l<=c&&r<=u;)null==i?i=e[++l]:null==a?a=e[--c]:null==f?f=o[++r]:null==m?m=o[--u]:B(i,f)?(H(i,f),i=e[++l],f=o[++r]):B(a,m)?(H(a,m),a=e[--c],m=o[--u]):B(i,m)?(H(i,m),t.insertBefore(i.$,a.$.nextSibling),i=e[++l],m=o[--u]):B(a,f)?(H(a,f),t.insertBefore(a.$,i.$),a=e[--c],f=o[++r]):(s=T(e&&e[r],n,r),f=o[++r],s&&i.$.parentNode.insertBefore(s,i.$));l>c?F(t,null==o[u+1]?null:o[u+1].$,n,o,r,u):r>u&&q(e,l,c)})(n,o,e,s):null!==s?F(n,null,e,s,0,s.length-1):null!==o&&q(o,0,o.length-1)},N=(t,e)=>{e&&!t._&&e["s-p"].push(new Promise(e=>t._=e))},V=(t,e,n,o)=>{if(e.t|=16,4&e.t)return void(e.t|=512);const s=e.s,l=()=>z(t,e,n,s,o);let r;return N(e,e.g),o&&(e.t|=256,e.j&&(e.j.forEach(([t,e])=>J(s,t,e)),e.j=null),r=J(s,"componentWillLoad")),r=K(r,()=>J(s,"componentWillRender")),K(r,()=>j(l))},z=(n,o,s,r,i)=>{const a=n["s-rc"];i&&((t,e)=>{const n=((t,e)=>{let n=O(e.v),o=p.get(n);if(t=11===t.nodeType?t:l,o)if("string"==typeof o){let e,s=L.get(t=t.head||t);s||L.set(t,s=new Set),s.has(n)||((e=l.createElement("style")).innerHTML=o,t.insertBefore(e,t.querySelector("link")),s&&s.add(n))}else t.adoptedStyleSheets.includes(o)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,o]);return n})(c&&t.shadowRoot?t.shadowRoot:t.getRootNode(),e);10&e.t&&(t["s-sc"]=n,t.classList.add(n+"-h"))})(n,s),((n,o,s,l)=>{e=n.tagName;const r=o.S||k(null,null),c=(t=>t&&t.h===C)(l)?l:U(null,null,l);c.h=null,c.t|=4,o.S=c,c.$=r.$=n.shadowRoot||n,t=n["s-sc"],H(r,c)})(n,o,0,D(r)),o.t&=-17,o.t|=2,a&&(a.forEach(t=>t()),n["s-rc"]=void 0);{const t=n["s-p"],e=()=>G(n,o,s);0===t.length?e():(Promise.all(t).then(e),o.t|=4,t.length=0)}},D=t=>{try{t=t.render()}catch(e){m(e)}return t},G=(t,e,n)=>{const o=e.g;64&e.t||(e.t|=64,t.classList.add("hydrated"),e.M(t),o||I()),e.R(t),e._&&(e._(),e._=void 0),512&e.t&&g(()=>V(t,e,n,!1)),e.t&=-517},I=()=>{l.documentElement.classList.add("hydrated"),r.t|=2},J=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(o){m(o)}},K=(t,e)=>t&&t.then?t.then(e):e(),Q=(t,e,n)=>{if(e.P){const o=Object.entries(e.P),s=t.prototype;if(o.forEach(([t,[o]])=>{31&o||2&n&&32&o?Object.defineProperty(s,t,{get(){return((t,e)=>u(t).L.get(e))(this,t)},set(n){((t,e,n,o)=>{const s=u(this),l=s.O,r=s.L.get(e),c=s.t,i=s.s;(n=((t,e)=>null==t||S(t)?t:1&e?String(t):t)(n,o.P[e][0]))===r||8&c&&void 0!==r||(s.L.set(e,n),i&&2==(18&c)&&V(l,s,o,!1))})(0,t,n,e)},configurable:!0,enumerable:!0}):1&n&&64&o&&Object.defineProperty(s,t,{value(...e){const n=u(this);return n.U.then(()=>n.s[t](...e))}})}),1&n){const e=new Map;s.attributeChangedCallback=function(t,n,o){r.jmp(()=>{const n=e.get(t);this[n]=(null!==o||"boolean"!=typeof this[n])&&o})},t.observedAttributes=o.filter(([t,e])=>15&e[0]).map(([t,n])=>{const o=n[1]||t;return e.set(o,t),o})}}return t},X=(t,e={})=>{const n=[],o=e.exclude||[],f=l.head,h=s.customElements,w=f.querySelector("meta[charset]"),$=l.createElement("style"),y=[];let b,_=!0;Object.assign(r,e),r.o=new URL(e.resourcesUrl||"./",l.baseURI).href,e.syncQueue&&(r.t|=4),t.forEach(t=>t[1].forEach(e=>{const l={t:e[0],v:e[1],P:e[2],k:e[3]};l.P=e[2],l.k=e[3],!c&&1&l.t&&(l.t|=8);const f=l.v,w=class extends HTMLElement{constructor(t){super(t),(t=>{const e={t:0,O:t,L:new Map};e.U=new Promise(t=>e.R=t),e.C=new Promise(t=>e.M=t),t["s-p"]=[],t["s-rc"]=[],a.set(t,e)})(t=this),1&l.t&&(c?t.attachShadow({mode:"open"}):"shadowRoot"in t||(t.shadowRoot=t))}connectedCallback(){b&&(clearTimeout(b),b=null),_?y.push(this):r.jmp(()=>((t,e)=>{if(0==(1&r.t)){const n=()=>{},o=u(t);if(e.k&&(o.W=((t,e,n)=>{e.j=e.j||[];const o=n.map(([n,o,l])=>{const c=((t,e)=>8&e?s:t)(t,n),i=((t,e)=>n=>{256&t.t?t.s[e](n):t.j.push([e,n])})(e,l),a=(t=>({passive:0!=(1&t),capture:0!=(2&t)}))(n);return r.ael(c,o,i,a),()=>r.rel(c,o,i,a)});return()=>o.forEach(t=>t())})(t,o,e.k)),!(1&o.t)){o.t|=1;{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){N(o,o.g=e);break}}e.P&&Object.entries(e.P).forEach(([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}}),g(()=>(async(t,e,n,o,s)=>{if(0==(32&e.t)){e.t|=32;{if((s=(t=>{const e=t.v.replace(/-/g,"_"),n=t.A,o=d.get(n);return o?o[e]:__sc_import_msf_editor(`./${n}.entry.js`).then(t=>(d.set(n,t),t[e]),m)})(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(Q(s,n,2),s.isProxied=!0);const t=()=>{};e.t|=8;try{new s(e)}catch(c){m(c)}e.t&=-9,t()}const t=O(n.v);if(!p.has(t)&&s.style){const e=()=>{};let o=s.style;8&n.t&&(o=await __sc_import_msf_editor("./p-affe7c09.js").then(e=>e.scopeCss(o,t,!1))),((t,e,n)=>{let o=p.get(t);i&&n?(o=o||new CSSStyleSheet).replace(e):o=e,p.set(t,o)})(t,o,!!(1&n.t)),e()}}const l=e.g,r=()=>V(t,e,n,!0);l&&l["s-rc"]?l["s-rc"].push(r):r()})(t,o,e))}n()}})(this,l))}disconnectedCallback(){r.jmp(()=>(()=>{if(0==(1&r.t)){const t=u(this);t.W&&(t.W(),t.W=void 0)}})())}forceUpdate(){((t,e)=>{{const n=u(t);n.O.isConnected&&2==(18&n.t)&&V(t,n,e,!1)}})(this,l)}componentOnReady(){return u(this).C}};l.A=t[0],o.includes(f)||h.get(f)||(n.push(f),h.define(f,Q(w,l,1)))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),f.insertBefore($,w?w.nextSibling:f.firstChild),_=!1,y.length>0?y.forEach(t=>t.connectedCallback()):r.jmp(()=>b=setTimeout(I,30,"timeout"))},Y=(t,e,n)=>{const o=Z(t);return{emit:t=>{const s=new CustomEvent(e,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:t});return o.dispatchEvent(s),s}}},Z=t=>u(t).O;export{M as a,X as b,Y as c,Z as g,U as h,R as p,f as r};
import{r as s,c as t,h as i,g as e}from"./p-acbc4922.js";const o=class{constructor(i){s(this,i),this.content="",this.modalOpen=!1,this.editorEvent=t(this,"editorEvent",7)}sendMessage(s,t){this.editorFrame.contentWindow.postMessage({action:s,data:t},"*")}async save(s={}){this.sendMessage("save",s)}async test(){console.log("Only a test")}async spinner(s){["hide","show"].includes(s)||(s="hide"),this.sendMessage("showSpinner",{behavior:s})}async start(s){this.sendMessage("load",s)}async sendTest(s){this.sendMessage("sendTest",s)}async load(s){this.sendMessage("load",s)}async preview(s){this.sendMessage("preview",s)}async initConfig(){this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise&&(this.config.rteToolbars.toolbar_0=await this.config.rteToolbars.toolbar_0),this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise&&(this.config.lang.custom=await this.config.lang.custom),this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise&&(this.config.rteToolbars.toolbar_1=await this.config.rteToolbars.toolbar_1);const s=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=s?"http://localhost:4200":this.editorUrl}async componentWillRender(){await this.initConfig(),console.info("MailStyler Plugin: load assets")}render(){return i("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})}editorDidOpen(){this.load(this.content||"").then(()=>console.log("MailStyler Plugin: Template is loaded succesfully"))}listenMessage(s){if(s.data&&s.data.action){const{action:t,data:i}=s.data;if("appOk"===t)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===t){let s=Object.assign({},this.config);Object.keys(s).filter(t=>"function"==typeof s[t]).forEach(t=>delete s[t]),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:s})}else if("appSave"===t){const s=new RegExp('bgcolor="none"',"g");i.html=i.html.replace(s,""),i.raw_html=i.raw_html.replace(s,""),"function"==typeof this.config.onSave?this.config.onSave(i.html,i.raw_html,i.json,i.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appSaveBlock"===t){const s=new RegExp('bgcolor="none"',"g");i.html=i.html.replace(s,""),i.raw_html=i.raw_html.replace(s,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(i.html,i.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===t&&(this.modalOpen="open"===i.env);this.editorEvent.emit({action:t,data:i})}}componentWillLoad(s){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),s&&this.listenMessage(s)}get element(){return e(this)}static get style(){return":host{display:block;height:100vh}:host,iframe{width:100%;border:0}iframe{height:100%;min-width:1024px;z-index:9999;top:0}iframe.open{position:fixed}"}};export{o as ms_editor};
var __awaiter=this&&this.__awaiter||function(t,e,n,o){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,i){function s(t){try{l(o.next(t))}catch(e){i(e)}}function a(t){try{l(o["throw"](t))}catch(e){i(e)}}function l(t){t.done?n(t.value):r(t.value).then(s,a)}l((o=o.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return l([t,e])}}function l(s){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=e.call(t,n)}catch(a){s=[6,a];r=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-20b31ffb.system.js"],(function(t){"use strict";var e,n,o,r;return{setters:[function(t){e=t.r;n=t.c;o=t.h;r=t.g}],execute:function(){var i=t("ms_editor",function(){function t(t){e(this,t);this.content="";this.modalOpen=false;this.editorEvent=n(this,"editorEvent",7)}t.prototype.sendMessage=function(t,e){this.editorFrame.contentWindow.postMessage({action:t,data:e},"*")};t.prototype.save=function(t){if(t===void 0){t={}}return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("save",t);return[2]}))}))};t.prototype.test=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){console.log("Only a test");return[2]}))}))};t.prototype.spinner=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!["hide","show"].includes(t)){t="hide"}this.sendMessage("showSpinner",{behavior:t});return[2]}))}))};t.prototype.start=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("load",t);return[2]}))}))};t.prototype.sendTest=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("sendTest",t);return[2]}))}))};t.prototype.load=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("load",t);return[2]}))}))};t.prototype.preview=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("preview",t);return[2]}))}))};t.prototype.initConfig=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,o;return __generator(this,(function(r){switch(r.label){case 0:if(!(this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise))return[3,2];t=this.config.rteToolbars;return[4,this.config.rteToolbars.toolbar_0];case 1:t.toolbar_0=r.sent();r.label=2;case 2:if(!(this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise))return[3,4];e=this.config.lang;return[4,this.config.lang.custom];case 3:e.custom=r.sent();r.label=4;case 4:if(!(this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise))return[3,6];n=this.config.rteToolbars;return[4,this.config.rteToolbars.toolbar_1];case 5:n.toolbar_1=r.sent();r.label=6;case 6:o=typeof this.config.debug!=="undefined"&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com";this.mscFrameworkUrl=o?"http://localhost:4200":this.editorUrl;return[2]}}))}))};t.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.initConfig()];case 1:t.sent();console.info("MailStyler Plugin: load assets");return[2]}}))}))};t.prototype.render=function(){return o("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})};t.prototype.editorDidOpen=function(){var t=this.content||"";this.load(t).then((function(t){return console.log("MailStyler Plugin: Template is loaded succesfully")}))};t.prototype.listenMessage=function(t){if(t.data&&t.data.action){var e=t.data,n=e.action,o=e.data;if(n==="appOk"){console.info("MailStyler Plugin: Editor is ready!");this.editorDidOpen()}else if(n==="appReady"){var r=Object.assign({},this.config);Object.keys(r).filter((function(t){return typeof r[t]==="function"})).forEach((function(t){return delete r[t]}));this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:r})}else if(n==="appSave"){var i=new RegExp('bgcolor="none"',"g");o.html=o.html.replace(i,"");o.raw_html=o.raw_html.replace(i,"");if("function"==typeof this.config.onSave){this.config.onSave(o.html,o.raw_html,o.json,o.opts)}else{console.error("MailStyler Plugin: You should provide a valid onSave callback")}}else if(n==="appSaveBlock"){var i=new RegExp('bgcolor="none"',"g");o.html=o.html.replace(i,"");o.raw_html=o.raw_html.replace(i,"");if("function"==typeof this.config.onSaveBlock){this.config.onSaveBlock(o.html,o.raw_html)}else{console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}}else if(n==="appModal"){this.modalOpen=o.env==="open"}this.editorEvent.emit({action:n,data:o})}};t.prototype.componentWillLoad=function(t){this.editorFrame=this.element.shadowRoot.querySelector("iframe");if(t){this.listenMessage(t)}};Object.defineProperty(t.prototype,"element",{get:function(){return r(this)},enumerable:true,configurable:true});Object.defineProperty(t,"style",{get:function(){return":host{display:block;height:100vh}:host,iframe{width:100%;border:0}iframe{height:100%;min-width:1024px;z-index:9999;top:0}iframe.open{position:fixed}"},enumerable:true,configurable:true});return t}())}}}));
+1
-1

@@ -5,3 +5,3 @@ 'use strict';

const core = require('./core-64b48042.js');
const core = require('./core-f2d12a35.js');

@@ -8,0 +8,0 @@ const defineCustomElements = (win, options) => {

@@ -5,3 +5,3 @@ 'use strict';

const core = require('./core-64b48042.js');
const core = require('./core-f2d12a35.js');

@@ -13,2 +13,3 @@ const Editor = class {

this.modalOpen = false;
this.editorEvent = core.createEvent(this, "editorEvent", 7);
}

@@ -121,2 +122,3 @@ sendMessage(action, data) {

}
this.editorEvent.emit({ action, data });
}

@@ -123,0 +125,0 @@ }

'use strict';
const core = require('./core-64b48042.js');
const core = require('./core-f2d12a35.js');

@@ -5,0 +5,0 @@ core.patchBrowser().then(options => {

@@ -113,2 +113,3 @@ import { h } from "@stencil/core";

}
this.editorEvent.emit({ action, data });
}

@@ -189,2 +190,18 @@ }

}; }
static get events() { return [{
"method": "editorEvent",
"name": "editorEvent",
"bubbles": true,
"cancelable": true,
"composed": true,
"docs": {
"tags": [],
"text": ""
},
"complexType": {
"original": "{ data: any, action: string }",
"resolved": "{ data: any; action: string; }",
"references": {}
}
}]; }
static get methods() { return {

@@ -191,0 +208,0 @@ "save": {

@@ -1,2 +0,2 @@

import { a as patchEsm, b as bootstrapLazy } from './core-00c73696.js';
import { a as patchEsm, b as bootstrapLazy } from './core-a07e1759.js';
var defineCustomElements = function (win, options) {

@@ -3,0 +3,0 @@ return patchEsm().then(function () {

@@ -37,3 +37,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

};
import { r as registerInstance, h, g as getElement } from './core-00c73696.js';
import { r as registerInstance, c as createEvent, h, g as getElement } from './core-a07e1759.js';
var Editor = /** @class */ (function () {

@@ -44,2 +44,3 @@ function class_1(hostRef) {

this.modalOpen = false;
this.editorEvent = createEvent(this, "editorEvent", 7);
}

@@ -218,2 +219,3 @@ class_1.prototype.sendMessage = function (action, data) {

}
this.editorEvent.emit({ action: action, data: data });
}

@@ -220,0 +222,0 @@ };

@@ -1,4 +0,4 @@

import { p as patchBrowser, b as bootstrapLazy } from './core-00c73696.js';
import { p as patchBrowser, b as bootstrapLazy } from './core-a07e1759.js';
patchBrowser().then(function (options) {
return bootstrapLazy([["ms-editor", [[1, "ms-editor", { "token": [1], "config": [8], "content": [1], "modalOpen": [32], "save": [64], "test": [64], "spinner": [64], "start": [64], "sendTest": [64], "load": [64], "preview": [64] }, [[8, "message", "componentWillLoad"]]]]]], options);
});

@@ -1,2 +0,2 @@

import { a as patchEsm, b as bootstrapLazy } from './core-00c73696.js';
import { a as patchEsm, b as bootstrapLazy } from './core-a07e1759.js';

@@ -3,0 +3,0 @@ const defineCustomElements = (win, options) => {

@@ -1,2 +0,2 @@

import { r as registerInstance, h, g as getElement } from './core-00c73696.js';
import { r as registerInstance, c as createEvent, h, g as getElement } from './core-a07e1759.js';

@@ -8,2 +8,3 @@ const Editor = class {

this.modalOpen = false;
this.editorEvent = createEvent(this, "editorEvent", 7);
}

@@ -116,2 +117,3 @@ sendMessage(action, data) {

}
this.editorEvent.emit({ action, data });
}

@@ -118,0 +120,0 @@ }

@@ -1,2 +0,2 @@

import { p as patchBrowser, b as bootstrapLazy } from './core-00c73696.js';
import { p as patchBrowser, b as bootstrapLazy } from './core-a07e1759.js';

@@ -3,0 +3,0 @@ patchBrowser().then(options => {

@@ -1,1 +0,1 @@

import{p as e,b as s}from"./p-59462e17.js";e().then(e=>s([["p-egbxsv99",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e));
import{p as e,b as s}from"./p-acbc4922.js";e().then(e=>s([["p-dm1kahht",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e));

@@ -44,2 +44,3 @@ /* eslint-disable */

'content'?: string;
'onEditorEvent'?: (event: CustomEvent<{ data: any, action: string }>) => void;
'token'?: string;

@@ -46,0 +47,0 @@ }

@@ -0,1 +1,2 @@

import { EventEmitter } from '../../stencil.core';
export declare class Editor {

@@ -10,2 +11,6 @@ token: string;

private modalOpen;
editorEvent: EventEmitter<{
data: any;
action: string;
}>;
sendMessage(action: any, data: any): void;

@@ -12,0 +17,0 @@ save(opts?: any): Promise<void>;

{
"name": "msf-editor",
"version": "0.3.3",
"version": "0.4.0",
"description": "Stencil Component Starter",

@@ -22,3 +22,4 @@ "main": "dist/index.js",

"test.watch": "stencil test --spec --e2e --watchAll",
"generate": "stencil generate"
"generate": "stencil generate",
"publish": "npm run build && npm publish"
},

@@ -25,0 +26,0 @@ "devDependencies": {

'use strict';
function _interopNamespace(e) {
if (e && e.__esModule) { return e; } else {
var n = {};
if (e) {
Object.keys(e).forEach(function (k) {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () {
return e[k];
}
});
});
}
n['default'] = e;
return n;
}
}
const NAMESPACE = 'msf-editor';
let queueCongestion = 0;
let queuePending = false;
let scopeId;
let hostTagName;
let isSvgMode = false;
const win = typeof window !== 'undefined' ? window : {};
const doc = win.document || { head: {} };
const plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: (h) => h(),
raf: (h) => requestAnimationFrame(h),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
};
const supportsShadowDom = /*@__PURE__*/ (() => (doc.head.attachShadow + '').includes('[native'))() ;
const supportsListenerOptions = /*@__PURE__*/ (() => {
let supportsListenerOptions = false;
try {
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
get() { supportsListenerOptions = true; }
}));
}
catch (e) { }
return supportsListenerOptions;
})();
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
try {
new CSSStyleSheet();
return true;
}
catch (e) { }
return false;
})() ;
const hostRefs = new WeakMap();
const getHostRef = (ref) => hostRefs.get(ref);
const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
const registerHost = (elm) => {
const hostRef = {
$flags$: 0,
$hostElement$: elm,
$instanceValues$: new Map()
};
{
hostRef.$onInstancePromise$ = new Promise(r => hostRef.$onInstanceResolve$ = r);
}
{
hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
elm['s-p'] = [];
elm['s-rc'] = [];
}
return hostRefs.set(elm, hostRef);
};
const isMemberInElement = (elm, memberName) => memberName in elm;
const consoleError = (e) => console.error(e);
const moduleCache = /*@__PURE__*/ new Map();
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
// loadModuleImport
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
const bundleId = ( cmpMeta.$lazyBundleIds$);
const module = moduleCache.get(bundleId) ;
if (module) {
return module[exportName];
}
return new Promise(function (resolve) { resolve(_interopNamespace(require(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${ ''}`))); }).then(importedModule => {
{
moduleCache.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
const styles = new Map();
const queueDomReads = [];
const queueDomWrites = [];
const queueDomWritesLow = [];
const queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
};
const consume = (queue) => {
for (let i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
const consumeTimeout = (queue, timeout) => {
let i = 0;
let ts = 0;
while (i < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i++](ts);
}
catch (e) {
consoleError(e);
}
}
if (i === queue.length) {
queue.length = 0;
}
else if (i !== 0) {
queue.splice(0, i);
}
};
const flush = () => {
queueCongestion++;
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
: Infinity;
// DOM WRITES!!!
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push(...queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
else {
queueCongestion = 0;
}
};
const nextTick = /*@__PURE__*/ (cb) => Promise.resolve().then(cb);
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
const EMPTY_OBJ = {};
const isDef = (v) => v != null;
const isComplexType = (o) => {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
const getDynamicImportFunction = (namespace) => {
return `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
};
const patchEsm = () => {
// @ts-ignore
if ( !(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
// @ts-ignore
return new Promise(function (resolve) { resolve(require('./css-shim-6aaf713d-bfe06088.js')); }).then(() => {
plt.$cssShim$ = win.__stencil_cssshim;
if (plt.$cssShim$) {
return plt.$cssShim$.initShim();
}
});
}
return Promise.resolve();
};
const patchBrowser = () => {
{
// shim css vars
plt.$cssShim$ = win.__stencil_cssshim;
}
// @ts-ignore
const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => (new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
s.getAttribute('data-stencil-namespace') === NAMESPACE));
const opts = scriptElm['data-opts'] || {};
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('core-64b48042.js', document.baseURI).href));
if ('onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
// Safari < v11 support: This IF is true if it's Safari below v11.
// This fn cannot use async/await since Safari didn't support it until v11,
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
// so both the ESM file and nomodule file would get downloaded. Only Safari
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
return { then() { } };
}
if (importMeta !== '') {
opts.resourcesUrl = new URL('.', importMeta).href;
}
else {
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
patchDynamicImport(opts.resourcesUrl, scriptElm);
if (!window.customElements) {
// module support, but no custom elements support (Old Edge)
// @ts-ignore
return new Promise(function (resolve) { resolve(require('./dom-76cc7c7d-769a0dda.js')); }).then(() => opts);
}
}
return Promise.resolve(opts);
};
const patchDynamicImport = (base, orgScriptElm) => {
const importFunctionName = getDynamicImportFunction(NAMESPACE);
try {
// test if this browser supports dynamic imports
// There is a caching issue in V8, that breaks using import() in Function
// By generating a random string, we can workaround it
// Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
}
catch (e) {
// this shim is specifically for browsers that do support "esm" imports
// however, they do NOT support "dynamic" imports
// basically this code is for old Edge, v18 and below
const moduleMap = new Map();
win[importFunctionName] = (src) => {
const url = new URL(src, base).href;
let mod = moduleMap.get(url);
if (!mod) {
const script = doc.createElement('script');
script.type = 'module';
script.crossOrigin = orgScriptElm.crossOrigin;
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
mod = new Promise(resolve => {
script.onload = () => {
resolve(win[importFunctionName].m);
script.remove();
};
});
moduleMap.set(url, mod);
doc.head.appendChild(script);
}
return mod;
};
}
};
const parsePropertyValue = (propValue, propType) => {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if ( propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
const HYDRATED_CLASS = 'hydrated';
const createTime = (fnName, tagName = '') => {
{
return () => { return; };
}
};
const uniqueTime = (key, measureText) => {
{
return () => { return; };
}
};
const rootAppliedStyles = new WeakMap();
const registerStyle = (scopeId, cssText, allowCS) => {
let style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
let scopeId = getScopeId(cmpMeta.$tagName$);
let style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
}
if (!appliedStyles.has(scopeId)) {
{
if ( plt.$cssShim$) {
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
const newScopeId = styleElm['s-sc'];
if (newScopeId) {
scopeId = newScopeId;
// we don't want to add this styleID to the appliedStyles Set
// since the cssVarShim might need to apply several different
// stylesheets for the same component
appliedStyles = null;
}
}
else {
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = [
...styleContainerNode.adoptedStyleSheets,
style
];
}
}
return scopeId;
};
const attachStyles = (elm, cmpMeta, mode) => {
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(( supportsShadowDom && elm.shadowRoot)
? elm.shadowRoot
: elm.getRootNode(), cmpMeta, mode, elm);
if ( cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
const getScopeId = (tagName, mode) => 'sc-' + ( tagName);
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
const h = (nodeName, vnodeData, ...children) => {
let child = null;
let simple = false;
let lastSimple = false;
let vNodeChildren = [];
const walk = (c) => {
for (let i = 0; i < c.length; i++) {
child = c[i];
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) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class = typeof classData !== 'object'
? classData
: Object.keys(classData)
.filter(k => classData[k])
.join(' ');
}
}
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
const newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
return vnode;
};
const Host = {};
const isHost = (node) => node && node.$tag$ === Host;
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
if (oldValue === newValue) {
return;
}
let isProp = isMemberInElement(elm, memberName);
let ln = memberName.toLowerCase();
if ( memberName === 'class') {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
const newClasses = parseClassList(newValue);
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
}
else {
// Set property if it exists and it's not a SVG
const isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
let n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
// tslint:disable-next-line: triple-equals
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
{
elm.removeAttribute(memberName);
}
}
else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
};
const parseClassListRegex = /\s/;
const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
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;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
// tslint:disable-next-line: prefer-const
let newVNode = newParentVNode.$children$[childIndex];
let i = 0;
let elm;
let childNode;
{
// create element
elm = newVNode.$elm$ = ( doc.createElement( newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if ( isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = ( parentElm);
let childNode;
if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
for (; startIdx <= endIdx; ++startIdx) {
if (vnode = vnodes[startIdx]) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
let oldStartIdx = 0;
let newStartIdx = 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;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
}
else if ( newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
const isSameVnode = (vnode1, vnode2) => {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
const patch = (oldVNode, newVNode) => {
const elm = newVNode.$elm$ = oldVNode.$elm$;
const oldChildren = oldVNode.$children$;
const newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if ( oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if ( oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
hostTagName = hostElm.tagName;
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
const rootVnode = isHost(renderFnResults)
? renderFnResults
: h(null, null, renderFnResults);
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm );
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
const attachToAncestor = (hostRef, ancestorComponent) => {
if ( ancestorComponent && !hostRef.$onRenderResolve$) {
ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
}
};
const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
const instance = hostRef.$lazyInstance$ ;
const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
attachToAncestor(hostRef, ancestorComponent);
let promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
}
endSchedule();
// there is no ancestorc omponent or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
return then(promise, () => writeTask(update)
);
};
const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
// updateComponent
const endUpdate = createTime('update', cmpMeta.$tagName$);
const rc = elm['s-rc'];
if ( isInitialLoad) {
// DOM WRITE!
attachStyles(elm, cmpMeta, hostRef.$modeName$);
}
const endRender = createTime('render', cmpMeta.$tagName$);
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
renderVdom(elm, hostRef, cmpMeta, callRender(instance));
}
}
if ( plt.$cssShim$) {
plt.$cssShim$.updateHost(elm);
}
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
if ( rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.forEach(cb => cb());
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
const childrenPromises = elm['s-p'];
const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
const callRender = (instance, elm) => {
try {
instance = instance.render() ;
}
catch (e) {
consoleError(e);
}
return instance;
};
const postUpdateComponent = (elm, hostRef, cmpMeta) => {
const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
// add the css class that this element has officially hydrated
elm.classList.add(HYDRATED_CLASS);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
const forceUpdate = (elm, cmpMeta) => {
{
const hostRef = getHostRef(elm);
const isConnected = hostRef.$hostElement$.isConnected;
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
// Returns "true" when the forced update was successfully scheduled
return isConnected;
}
};
const appDidLoad = (who) => {
// on appload
// we have finish the first big initial render
{
doc.documentElement.classList.add(HYDRATED_CLASS);
}
{
plt.$flags$ |= 2 /* appLoaded */;
}
};
const safeCall = (instance, method, arg) => {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
const then = (promise, thenFn) => {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
const setValue = (ref, propName, newVal, cmpMeta) => {
// check our new property value against our internal value
const hostRef = getHostRef(ref);
const elm = hostRef.$hostElement$ ;
const oldVal = hostRef.$instanceValues$.get(propName);
const flags = hostRef.$flags$;
const instance = hostRef.$lazyInstance$ ;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
if (newVal !== oldVal && ( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if ( instance) {
if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
}
}
};
const proxyComponent = (Cstr, cmpMeta, flags) => {
if ( cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
const members = Object.entries(cmpMeta.$members$);
const prototype = Cstr.prototype;
members.forEach(([memberName, [memberFlags]]) => {
if ( ((memberFlags & 31 /* Prop */) ||
(( flags & 2 /* proxyState */) &&
(memberFlags & 32 /* State */)))) {
// proxyComponent - prop
Object.defineProperty(prototype, memberName, {
get() {
// proxyComponent, get value
return getValue(this, memberName);
},
set(newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true
});
}
else if ( (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
// proxyComponent - method
Object.defineProperty(prototype, memberName, {
value(...args) {
const ref = getHostRef(this);
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
}
});
}
});
if ( ( flags & 1 /* isElementConstructor */)) {
const attrNameToPropName = new Map();
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
plt.jmp(() => {
const propName = attrNameToPropName.get(attrName);
this[propName] = newValue === null && typeof this[propName] === 'boolean'
? false
: newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
.map(([propName, m]) => {
const attrName = m[1] || propName;
attrNameToPropName.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
const addEventListeners = (elm, hostRef, listeners) => {
hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
const removeFns = listeners.map(([flags, name, method]) => {
const target = ( getHostListenerTarget(elm, flags) );
const handler = hostListenerProxy(hostRef, method);
const opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
return () => plt.rel(target, name, handler, opts);
});
return () => removeFns.forEach(fn => fn());
};
const hostListenerProxy = (hostRef, methodName) => {
return (ev) => {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
hostRef.$queuedListeners$.push([methodName, ev]);
}
}
};
};
const getHostListenerTarget = (elm, flags) => {
if ( flags & 8 /* TargetWindow */)
return win;
return elm;
};
const hostListenerOpts = (flags) => supportsListenerOptions ?
{
'passive': (flags & 1 /* Passive */) !== 0,
'capture': (flags & 2 /* Capture */) !== 0,
}
: (flags & 2 /* Capture */) !== 0;
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
{
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime();
Cstr = await Cstr;
endLoad();
}
if ( !Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
}
const scopeId = getScopeId(cmpMeta.$tagName$);
if ( !styles.has(scopeId) && Cstr.style) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
// this component has styles but we haven't registered them yet
let style = Cstr.style;
if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
style = await new Promise(function (resolve) { resolve(require('./shadow-css-4889ae62-03827a39.js')); }).then(m => m.scopeCss(style, scopeId, false));
}
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
if ( ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};
const connectedCallback = (elm, cmpMeta) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
// connectedCallback
const hostRef = getHostRef(elm);
if ( cmpMeta.$listeners$) {
// initialize our event listeners on the host element
// we do this now so that we can listening to events that may
// have fired even before the instance is ready
hostRef.$rmListeners$ = addEventListeners(elm, hostRef, cmpMeta.$listeners$);
}
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
let ancestorComponent = elm;
while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if (
(ancestorComponent['s-p'])) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if ( cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
const value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
// connectedCallback, taskQueue, initialLoad
// angular sets attribute AFTER connectCallback
// https://github.com/angular/angular/issues/18909
// https://github.com/angular/angular/issues/19940
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
}
}
endConnected();
}
};
const disconnectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$();
hostRef.$rmListeners$ = undefined;
}
}
// clear CSS var-shim tracking
if ( plt.$cssShim$) {
plt.$cssShim$.removeHost(elm);
}
}
};
const bootstrapLazy = (lazyBundles, options = {}) => {
const endBootstrap = createTime();
const cmpTags = [];
const exclude = options.exclude || [];
const head = doc.head;
const customElements = win.customElements;
const y = /*@__PURE__*/ head.querySelector('meta[charset]');
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
const deferredConnectedCallbacks = [];
let appLoadFallback;
let isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
if (options.syncQueue) {
plt.$flags$ |= 4 /* queueSync */;
}
lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
const cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
if ( !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
}
const tagName = cmpMeta.$tagName$;
const HostElement = class extends HTMLElement {
// StencilLazyHost
constructor(self) {
// @ts-ignore
super(self);
self = this;
registerHost(self);
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
if (supportsShadowDom) {
{
self.attachShadow({ mode: 'open' });
}
}
else if ( !('shadowRoot' in self)) {
self.shadowRoot = self;
}
}
}
connectedCallback() {
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(() => connectedCallback(this, cmpMeta));
}
}
disconnectedCallback() {
plt.jmp(() => disconnectedCallback(this));
}
forceUpdate() {
forceUpdate(this, cmpMeta);
}
componentOnReady() {
return getHostRef(this).$onReadyPromise$;
}
};
cmpMeta.$lazyBundleIds$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
}));
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length > 0) {
deferredConnectedCallbacks.forEach(host => host.connectedCallback());
}
else {
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
}
// Fallback appLoad event
endBootstrap();
};
const getElement = (ref) => getHostRef(ref).$hostElement$ ;
exports.bootstrapLazy = bootstrapLazy;
exports.getElement = getElement;
exports.h = h;
exports.patchBrowser = patchBrowser;
exports.patchEsm = patchEsm;
exports.registerInstance = registerInstance;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __spreadArrays = (this && this.__spreadArrays) || function () {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
};
var NAMESPACE = 'msf-editor';
var queueCongestion = 0;
var queuePending = false;
var scopeId;
var hostTagName;
var isSvgMode = false;
var win = typeof window !== 'undefined' ? window : {};
var doc = win.document || { head: {} };
var plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: function (h) { return h(); },
raf: function (h) { return requestAnimationFrame(h); },
ael: function (el, eventName, listener, opts) { return el.addEventListener(eventName, listener, opts); },
rel: function (el, eventName, listener, opts) { return el.removeEventListener(eventName, listener, opts); },
};
var supportsShadowDom = /*@__PURE__*/ (function () { return (doc.head.attachShadow + '').includes('[native'); })();
var supportsListenerOptions = /*@__PURE__*/ (function () {
var supportsListenerOptions = false;
try {
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
get: function () { supportsListenerOptions = true; }
}));
}
catch (e) { }
return supportsListenerOptions;
})();
var supportsConstructibleStylesheets = /*@__PURE__*/ (function () {
try {
new CSSStyleSheet();
return true;
}
catch (e) { }
return false;
})();
var hostRefs = new WeakMap();
var getHostRef = function (ref) { return hostRefs.get(ref); };
var registerInstance = function (lazyInstance, hostRef) { return hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef); };
var registerHost = function (elm) {
var hostRef = {
$flags$: 0,
$hostElement$: elm,
$instanceValues$: new Map()
};
{
hostRef.$onInstancePromise$ = new Promise(function (r) { return hostRef.$onInstanceResolve$ = r; });
}
{
hostRef.$onReadyPromise$ = new Promise(function (r) { return hostRef.$onReadyResolve$ = r; });
elm['s-p'] = [];
elm['s-rc'] = [];
}
return hostRefs.set(elm, hostRef);
};
var isMemberInElement = function (elm, memberName) { return memberName in elm; };
var consoleError = function (e) { return console.error(e); };
var moduleCache = /*@__PURE__*/ new Map();
var loadModule = function (cmpMeta, hostRef, hmrVersionId) {
// loadModuleImport
var exportName = cmpMeta.$tagName$.replace(/-/g, '_');
var bundleId = (cmpMeta.$lazyBundleIds$);
var module = moduleCache.get(bundleId);
if (module) {
return module[exportName];
}
return import(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
"./" + bundleId + ".entry.js" + '').then(function (importedModule) {
{
moduleCache.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
var styles = new Map();
var queueDomReads = [];
var queueDomWrites = [];
var queueDomWritesLow = [];
var queueTask = function (queue, write) { return function (cb) {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
}; };
var consume = function (queue) {
for (var i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
var consumeTimeout = function (queue, timeout) {
var i = 0;
var ts = 0;
while (i < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i++](ts);
}
catch (e) {
consoleError(e);
}
}
if (i === queue.length) {
queue.length = 0;
}
else if (i !== 0) {
queue.splice(0, i);
}
};
var flush = function () {
queueCongestion++;
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
var timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
: Infinity;
// DOM WRITES!!!
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push.apply(queueDomWritesLow, queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
else {
queueCongestion = 0;
}
};
var nextTick = /*@__PURE__*/ function (cb) { return Promise.resolve().then(cb); };
var writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
var EMPTY_OBJ = {};
var isDef = function (v) { return v != null; };
var isComplexType = function (o) {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
var getDynamicImportFunction = function (namespace) {
return "__sc_import_" + namespace.replace(/\s|-/g, '_');
};
var patchEsm = function () {
// @ts-ignore
if (!(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
// @ts-ignore
return import('./css-shim-6aaf713d-9b13816a.js').then(function () {
plt.$cssShim$ = win.__stencil_cssshim;
if (plt.$cssShim$) {
return plt.$cssShim$.initShim();
}
});
}
return Promise.resolve();
};
var patchBrowser = function () {
{
// shim css vars
plt.$cssShim$ = win.__stencil_cssshim;
}
// @ts-ignore
var scriptElm = Array.from(doc.querySelectorAll('script')).find(function (s) { return (new RegExp("/" + NAMESPACE + "(\\.esm)?\\.js($|\\?|#)").test(s.src) ||
s.getAttribute('data-stencil-namespace') === NAMESPACE); });
var opts = scriptElm['data-opts'] || {};
var importMeta = "";
if ('onbeforeload' in scriptElm && !history.scrollRestoration && false /* IS_SYSTEM_JS_BUILD */) {
// Safari < v11 support: This IF is true if it's Safari below v11.
// This fn cannot use async/await since Safari didn't support it until v11,
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
// so both the ESM file and nomodule file would get downloaded. Only Safari
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
return { then: function () { } };
}
if (importMeta !== '') {
opts.resourcesUrl = new URL('.', importMeta).href;
}
else {
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
patchDynamicImport(opts.resourcesUrl, scriptElm);
if (!window.customElements) {
// module support, but no custom elements support (Old Edge)
// @ts-ignore
return import('./dom-76cc7c7d-0a082895.js').then(function () { return opts; });
}
}
return Promise.resolve(opts);
};
var patchDynamicImport = function (base, orgScriptElm) {
var importFunctionName = getDynamicImportFunction(NAMESPACE);
try {
// test if this browser supports dynamic imports
// There is a caching issue in V8, that breaks using import() in Function
// By generating a random string, we can workaround it
// Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
win[importFunctionName] = new Function('w', "return import(w);//" + Math.random());
}
catch (e) {
// this shim is specifically for browsers that do support "esm" imports
// however, they do NOT support "dynamic" imports
// basically this code is for old Edge, v18 and below
var moduleMap_1 = new Map();
win[importFunctionName] = function (src) {
var url = new URL(src, base).href;
var mod = moduleMap_1.get(url);
if (!mod) {
var script_1 = doc.createElement('script');
script_1.type = 'module';
script_1.crossOrigin = orgScriptElm.crossOrigin;
script_1.src = URL.createObjectURL(new Blob(["import * as m from '" + url + "'; window." + importFunctionName + ".m = m;"], { type: 'application/javascript' }));
mod = new Promise(function (resolve) {
script_1.onload = function () {
resolve(win[importFunctionName].m);
script_1.remove();
};
});
moduleMap_1.set(url, mod);
doc.head.appendChild(script_1);
}
return mod;
};
}
};
var parsePropertyValue = function (propValue, propType) {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if (propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
var HYDRATED_CLASS = 'hydrated';
var createTime = function (fnName, tagName) {
if (tagName === void 0) { tagName = ''; }
{
return function () { return; };
}
};
var uniqueTime = function (key, measureText) {
{
return function () { return; };
}
};
var rootAppliedStyles = new WeakMap();
var registerStyle = function (scopeId, cssText, allowCS) {
var style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
var addStyle = function (styleContainerNode, cmpMeta, mode, hostElm) {
var scopeId = getScopeId(cmpMeta.$tagName$);
var style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
var appliedStyles = rootAppliedStyles.get(styleContainerNode);
var styleElm = void 0;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
}
if (!appliedStyles.has(scopeId)) {
{
if (plt.$cssShim$) {
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
var newScopeId = styleElm['s-sc'];
if (newScopeId) {
scopeId = newScopeId;
// we don't want to add this styleID to the appliedStyles Set
// since the cssVarShim might need to apply several different
// stylesheets for the same component
appliedStyles = null;
}
}
else {
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if (!styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = __spreadArrays(styleContainerNode.adoptedStyleSheets, [
style
]);
}
}
return scopeId;
};
var attachStyles = function (elm, cmpMeta, mode) {
var endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
var scopeId = addStyle((supportsShadowDom && elm.shadowRoot)
? elm.shadowRoot
: elm.getRootNode(), cmpMeta, mode, elm);
if (cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
var getScopeId = function (tagName, mode) { return 'sc-' + (tagName); };
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
var h = function (nodeName, vnodeData) {
var children = [];
for (var _i = 2; _i < arguments.length; _i++) {
children[_i - 2] = arguments[_i];
}
var child = null;
var simple = false;
var lastSimple = false;
var vNodeChildren = [];
var walk = function (c) {
for (var i = 0; i < c.length; i++) {
child = c[i];
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) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
var classData_1 = vnodeData.className || vnodeData.class;
if (classData_1) {
vnodeData.class = typeof classData_1 !== 'object'
? classData_1
: Object.keys(classData_1)
.filter(function (k) { return classData_1[k]; })
.join(' ');
}
}
}
var vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
var newVNode = function (tag, text) {
var vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
return vnode;
};
var Host = {};
var isHost = function (node) { return node && node.$tag$ === Host; };
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
var setAccessor = function (elm, memberName, oldValue, newValue, isSvg, flags) {
if (oldValue === newValue) {
return;
}
var isProp = isMemberInElement(elm, memberName);
var ln = memberName.toLowerCase();
if (memberName === 'class') {
var classList = elm.classList;
var oldClasses_1 = parseClassList(oldValue);
var newClasses_1 = parseClassList(newValue);
classList.remove.apply(classList, oldClasses_1.filter(function (c) { return c && !newClasses_1.includes(c); }));
classList.add.apply(classList, newClasses_1.filter(function (c) { return c && !oldClasses_1.includes(c); }));
}
else {
// Set property if it exists and it's not a SVG
var isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
var n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
// tslint:disable-next-line: triple-equals
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
{
elm.removeAttribute(memberName);
}
}
else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
};
var parseClassListRegex = /\s/;
var parseClassList = function (value) { return (!value) ? [] : value.split(parseClassListRegex); };
var updateElement = function (oldVnode, newVnode, isSvgMode, memberName) {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
var elm = (newVnode.$elm$.nodeType === 11 /* DocumentFragment */ && newVnode.$elm$.host) ? newVnode.$elm$.host : newVnode.$elm$;
var oldVnodeAttrs = (oldVnode && oldVnode.$attrs$) || EMPTY_OBJ;
var newVnodeAttrs = newVnode.$attrs$ || EMPTY_OBJ;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
var createElm = function (oldParentVNode, newParentVNode, childIndex, parentElm) {
// tslint:disable-next-line: prefer-const
var newVNode = newParentVNode.$children$[childIndex];
var i = 0;
var elm;
var childNode;
{
// create element
elm = newVNode.$elm$ = (doc.createElement(newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if (isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
var addVnodes = function (parentElm, before, parentVNode, vnodes, startIdx, endIdx) {
var containerElm = (parentElm);
var childNode;
if (containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
var removeVnodes = function (vnodes, startIdx, endIdx, vnode, elm) {
for (; startIdx <= endIdx; ++startIdx) {
if (vnode = vnodes[startIdx]) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
var updateChildren = function (parentElm, oldCh, newVNode, newCh) {
var oldStartIdx = 0;
var newStartIdx = 0;
var oldEndIdx = oldCh.length - 1;
var oldStartVnode = oldCh[0];
var oldEndVnode = oldCh[oldEndIdx];
var newEndIdx = newCh.length - 1;
var newStartVnode = newCh[0];
var newEndVnode = newCh[newEndIdx];
var node;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
}
else if (newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
var isSameVnode = function (vnode1, vnode2) {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
var patch = function (oldVNode, newVNode) {
var elm = newVNode.$elm$ = oldVNode.$elm$;
var oldChildren = oldVNode.$children$;
var newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if (oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if (oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
var renderVdom = function (hostElm, hostRef, cmpMeta, renderFnResults) {
hostTagName = hostElm.tagName;
var oldVNode = hostRef.$vnode$ || newVNode(null, null);
var rootVnode = isHost(renderFnResults)
? renderFnResults
: h(null, null, renderFnResults);
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = (hostElm.shadowRoot || hostElm);
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
var attachToAncestor = function (hostRef, ancestorComponent) {
if (ancestorComponent && !hostRef.$onRenderResolve$) {
ancestorComponent['s-p'].push(new Promise(function (r) { return hostRef.$onRenderResolve$ = r; }));
}
};
var scheduleUpdate = function (elm, hostRef, cmpMeta, isInitialLoad) {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if (hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
var endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
var ancestorComponent = hostRef.$ancestorComponent$;
var instance = hostRef.$lazyInstance$;
var update = function () { return updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad); };
attachToAncestor(hostRef, ancestorComponent);
var promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.forEach(function (_a) {
var methodName = _a[0], event = _a[1];
return safeCall(instance, methodName, event);
});
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, function () { return safeCall(instance, 'componentWillRender'); });
}
endSchedule();
// there is no ancestorc omponent or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
return then(promise, function () { return writeTask(update); });
};
var updateComponent = function (elm, hostRef, cmpMeta, instance, isInitialLoad) {
// updateComponent
var endUpdate = createTime('update', cmpMeta.$tagName$);
var rc = elm['s-rc'];
if (isInitialLoad) {
// DOM WRITE!
attachStyles(elm, cmpMeta, hostRef.$modeName$);
}
var endRender = createTime('render', cmpMeta.$tagName$);
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
renderVdom(elm, hostRef, cmpMeta, callRender(instance));
}
}
if (plt.$cssShim$) {
plt.$cssShim$.updateHost(elm);
}
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
if (rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.forEach(function (cb) { return cb(); });
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
var childrenPromises = elm['s-p'];
var postUpdate = function () { return postUpdateComponent(elm, hostRef, cmpMeta); };
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
var callRender = function (instance, elm) {
try {
instance = instance.render();
}
catch (e) {
consoleError(e);
}
return instance;
};
var postUpdateComponent = function (elm, hostRef, cmpMeta) {
var endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
var ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
// add the css class that this element has officially hydrated
elm.classList.add(HYDRATED_CLASS);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(function () { return scheduleUpdate(elm, hostRef, cmpMeta, false); });
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
var forceUpdate = function (elm, cmpMeta) {
{
var hostRef = getHostRef(elm);
var isConnected = hostRef.$hostElement$.isConnected;
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
// Returns "true" when the forced update was successfully scheduled
return isConnected;
}
};
var appDidLoad = function (who) {
// on appload
// we have finish the first big initial render
{
doc.documentElement.classList.add(HYDRATED_CLASS);
}
{
plt.$flags$ |= 2 /* appLoaded */;
}
};
var safeCall = function (instance, method, arg) {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
var then = function (promise, thenFn) {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
var getValue = function (ref, propName) { return getHostRef(ref).$instanceValues$.get(propName); };
var setValue = function (ref, propName, newVal, cmpMeta) {
// check our new property value against our internal value
var hostRef = getHostRef(ref);
var elm = hostRef.$hostElement$;
var oldVal = hostRef.$instanceValues$.get(propName);
var flags = hostRef.$flags$;
var instance = hostRef.$lazyInstance$;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
if (newVal !== oldVal && (!(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if (instance) {
if ((flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
}
}
};
var proxyComponent = function (Cstr, cmpMeta, flags) {
if (cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
var members = Object.entries(cmpMeta.$members$);
var prototype_1 = Cstr.prototype;
members.forEach(function (_a) {
var memberName = _a[0], memberFlags = _a[1][0];
if (((memberFlags & 31 /* Prop */) ||
((flags & 2 /* proxyState */) &&
(memberFlags & 32 /* State */)))) {
// proxyComponent - prop
Object.defineProperty(prototype_1, memberName, {
get: function () {
// proxyComponent, get value
return getValue(this, memberName);
},
set: function (newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true
});
}
else if ((flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
// proxyComponent - method
Object.defineProperty(prototype_1, memberName, {
value: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var ref = getHostRef(this);
return ref.$onInstancePromise$.then(function () {
var _a;
return (_a = ref.$lazyInstance$)[memberName].apply(_a, args);
});
}
});
}
});
if ((flags & 1 /* isElementConstructor */)) {
var attrNameToPropName_1 = new Map();
prototype_1.attributeChangedCallback = function (attrName, _oldValue, newValue) {
var _this = this;
plt.jmp(function () {
var propName = attrNameToPropName_1.get(attrName);
_this[propName] = newValue === null && typeof _this[propName] === 'boolean'
? false
: newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(function (_a) {
var _ = _a[0], m = _a[1];
return m[0] & 15;
} /* HasAttribute */) // filter to only keep props that should match attributes
.map(function (_a) {
var propName = _a[0], m = _a[1];
var attrName = m[1] || propName;
attrNameToPropName_1.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
var addEventListeners = function (elm, hostRef, listeners) {
hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
var removeFns = listeners.map(function (_a) {
var flags = _a[0], name = _a[1], method = _a[2];
var target = (getHostListenerTarget(elm, flags));
var handler = hostListenerProxy(hostRef, method);
var opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
return function () { return plt.rel(target, name, handler, opts); };
});
return function () { return removeFns.forEach(function (fn) { return fn(); }); };
};
var hostListenerProxy = function (hostRef, methodName) {
return function (ev) {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
hostRef.$queuedListeners$.push([methodName, ev]);
}
}
};
};
var getHostListenerTarget = function (elm, flags) {
if (flags & 8 /* TargetWindow */)
return win;
return elm;
};
var hostListenerOpts = function (flags) { return supportsListenerOptions ?
{
'passive': (flags & 1 /* Passive */) !== 0,
'capture': (flags & 2 /* Capture */) !== 0,
}
: (flags & 2 /* Capture */) !== 0; };
var initializeComponent = function (elm, hostRef, cmpMeta, hmrVersionId, Cstr) { return __awaiter(void 0, void 0, void 0, function () {
var endLoad, endNewInstance, scopeId_1, endRegisterStyles, style_1, ancestorComponent, schedule;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!((hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0)) return [3 /*break*/, 5];
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (!Cstr.then) return [3 /*break*/, 2];
endLoad = uniqueTime();
return [4 /*yield*/, Cstr];
case 1:
Cstr = _a.sent();
endLoad();
_a.label = 2;
case 2:
if (!Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
scopeId_1 = getScopeId(cmpMeta.$tagName$);
if (!(!styles.has(scopeId_1) && Cstr.style)) return [3 /*break*/, 5];
endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
style_1 = Cstr.style;
if (!(cmpMeta.$flags$ & 8) /* needsShadowDomShim */) return [3 /*break*/, 4]; /* needsShadowDomShim */
return [4 /*yield*/, import('./shadow-css-4889ae62-23996f3f.js').then(function (m) { return m.scopeCss(style_1, scopeId_1, false); })];
case 3:
style_1 = _a.sent();
_a.label = 4;
case 4:
registerStyle(scopeId_1, style_1, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
_a.label = 5;
case 5:
ancestorComponent = hostRef.$ancestorComponent$;
schedule = function () { return scheduleUpdate(elm, hostRef, cmpMeta, true); };
if (ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
return [2 /*return*/];
}
});
}); };
var connectedCallback = function (elm, cmpMeta) {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
var endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
// connectedCallback
var hostRef_1 = getHostRef(elm);
if (cmpMeta.$listeners$) {
// initialize our event listeners on the host element
// we do this now so that we can listening to events that may
// have fired even before the instance is ready
hostRef_1.$rmListeners$ = addEventListeners(elm, hostRef_1, cmpMeta.$listeners$);
}
if (!(hostRef_1.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef_1.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
var ancestorComponent = elm;
while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if ((ancestorComponent['s-p'])) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef_1, (hostRef_1.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if (cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).forEach(function (_a) {
var memberName = _a[0], memberFlags = _a[1][0];
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
var value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
// connectedCallback, taskQueue, initialLoad
// angular sets attribute AFTER connectCallback
// https://github.com/angular/angular/issues/18909
// https://github.com/angular/angular/issues/19940
nextTick(function () { return initializeComponent(elm, hostRef_1, cmpMeta); });
}
}
endConnected();
}
};
var disconnectedCallback = function (elm) {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
var hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$();
hostRef.$rmListeners$ = undefined;
}
}
// clear CSS var-shim tracking
if (plt.$cssShim$) {
plt.$cssShim$.removeHost(elm);
}
}
};
var bootstrapLazy = function (lazyBundles, options) {
if (options === void 0) { options = {}; }
var endBootstrap = createTime();
var cmpTags = [];
var exclude = options.exclude || [];
var head = doc.head;
var customElements = win.customElements;
var y = /*@__PURE__*/ head.querySelector('meta[charset]');
var visibilityStyle = /*@__PURE__*/ doc.createElement('style');
var deferredConnectedCallbacks = [];
var appLoadFallback;
var isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
if (options.syncQueue) {
plt.$flags$ |= 4 /* queueSync */;
}
lazyBundles.forEach(function (lazyBundle) { return lazyBundle[1].forEach(function (compactMeta) {
var cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
if (!supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
}
var tagName = cmpMeta.$tagName$;
var HostElement = /** @class */ (function (_super) {
__extends(HostElement, _super);
// StencilLazyHost
function HostElement(self) {
var _this =
// @ts-ignore
_super.call(this, self) || this;
self = _this;
registerHost(self);
if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
if (supportsShadowDom) {
{
self.attachShadow({ mode: 'open' });
}
}
else if (!('shadowRoot' in self)) {
self.shadowRoot = self;
}
}
return _this;
}
HostElement.prototype.connectedCallback = function () {
var _this = this;
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(function () { return connectedCallback(_this, cmpMeta); });
}
};
HostElement.prototype.disconnectedCallback = function () {
var _this = this;
plt.jmp(function () { return disconnectedCallback(_this); });
};
HostElement.prototype.forceUpdate = function () {
forceUpdate(this, cmpMeta);
};
HostElement.prototype.componentOnReady = function () {
return getHostRef(this).$onReadyPromise$;
};
return HostElement;
}(HTMLElement));
cmpMeta.$lazyBundleIds$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
}); });
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length > 0) {
deferredConnectedCallbacks.forEach(function (host) { return host.connectedCallback(); });
}
else {
plt.jmp(function () { return appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'); });
}
// Fallback appLoad event
endBootstrap();
};
var getElement = function (ref) { return getHostRef(ref).$hostElement$; };
export { patchEsm as a, bootstrapLazy as b, getElement as g, h, patchBrowser as p, registerInstance as r };
const NAMESPACE = 'msf-editor';
let queueCongestion = 0;
let queuePending = false;
let scopeId;
let hostTagName;
let isSvgMode = false;
const win = typeof window !== 'undefined' ? window : {};
const doc = win.document || { head: {} };
const plt = {
$flags$: 0,
$resourcesUrl$: '',
jmp: (h) => h(),
raf: (h) => requestAnimationFrame(h),
ael: (el, eventName, listener, opts) => el.addEventListener(eventName, listener, opts),
rel: (el, eventName, listener, opts) => el.removeEventListener(eventName, listener, opts),
};
const supportsShadowDom = /*@__PURE__*/ (() => (doc.head.attachShadow + '').includes('[native'))() ;
const supportsListenerOptions = /*@__PURE__*/ (() => {
let supportsListenerOptions = false;
try {
doc.addEventListener('e', null, Object.defineProperty({}, 'passive', {
get() { supportsListenerOptions = true; }
}));
}
catch (e) { }
return supportsListenerOptions;
})();
const supportsConstructibleStylesheets = /*@__PURE__*/ (() => {
try {
new CSSStyleSheet();
return true;
}
catch (e) { }
return false;
})() ;
const hostRefs = new WeakMap();
const getHostRef = (ref) => hostRefs.get(ref);
const registerInstance = (lazyInstance, hostRef) => hostRefs.set(hostRef.$lazyInstance$ = lazyInstance, hostRef);
const registerHost = (elm) => {
const hostRef = {
$flags$: 0,
$hostElement$: elm,
$instanceValues$: new Map()
};
{
hostRef.$onInstancePromise$ = new Promise(r => hostRef.$onInstanceResolve$ = r);
}
{
hostRef.$onReadyPromise$ = new Promise(r => hostRef.$onReadyResolve$ = r);
elm['s-p'] = [];
elm['s-rc'] = [];
}
return hostRefs.set(elm, hostRef);
};
const isMemberInElement = (elm, memberName) => memberName in elm;
const consoleError = (e) => console.error(e);
const moduleCache = /*@__PURE__*/ new Map();
const loadModule = (cmpMeta, hostRef, hmrVersionId) => {
// loadModuleImport
const exportName = cmpMeta.$tagName$.replace(/-/g, '_');
const bundleId = ( cmpMeta.$lazyBundleIds$);
const module = moduleCache.get(bundleId) ;
if (module) {
return module[exportName];
}
return import(
/* webpackInclude: /\.entry\.js$/ */
/* webpackExclude: /\.system\.entry\.js$/ */
/* webpackMode: "lazy" */
`./${bundleId}.entry.js${ ''}`).then(importedModule => {
{
moduleCache.set(bundleId, importedModule);
}
return importedModule[exportName];
}, consoleError);
};
const styles = new Map();
const queueDomReads = [];
const queueDomWrites = [];
const queueDomWritesLow = [];
const queueTask = (queue, write) => (cb) => {
queue.push(cb);
if (!queuePending) {
queuePending = true;
if (write && plt.$flags$ & 4 /* queueSync */) {
nextTick(flush);
}
else {
plt.raf(flush);
}
}
};
const consume = (queue) => {
for (let i = 0; i < queue.length; i++) {
try {
queue[i](performance.now());
}
catch (e) {
consoleError(e);
}
}
queue.length = 0;
};
const consumeTimeout = (queue, timeout) => {
let i = 0;
let ts = 0;
while (i < queue.length && (ts = performance.now()) < timeout) {
try {
queue[i++](ts);
}
catch (e) {
consoleError(e);
}
}
if (i === queue.length) {
queue.length = 0;
}
else if (i !== 0) {
queue.splice(0, i);
}
};
const flush = () => {
queueCongestion++;
// always force a bunch of medium callbacks to run, but still have
// a throttle on how many can run in a certain time
// DOM READS!!!
consume(queueDomReads);
const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */
? performance.now() + (10 * Math.ceil(queueCongestion * (1.0 / 22.0)))
: Infinity;
// DOM WRITES!!!
consumeTimeout(queueDomWrites, timeout);
consumeTimeout(queueDomWritesLow, timeout);
if (queueDomWrites.length > 0) {
queueDomWritesLow.push(...queueDomWrites);
queueDomWrites.length = 0;
}
if (queuePending = ((queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length) > 0)) {
// still more to do yet, but we've run out of time
// let's let this thing cool off and try again in the next tick
plt.raf(flush);
}
else {
queueCongestion = 0;
}
};
const nextTick = /*@__PURE__*/ (cb) => Promise.resolve().then(cb);
const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true);
/**
* Default style mode id
*/
/**
* Reusable empty obj/array
* Don't add values to these!!
*/
const EMPTY_OBJ = {};
const isDef = (v) => v != null;
const isComplexType = (o) => {
// https://jsperf.com/typeof-fn-object/5
o = typeof o;
return o === 'object' || o === 'function';
};
const getDynamicImportFunction = (namespace) => {
return `__sc_import_${namespace.replace(/\s|-/g, '_')}`;
};
const patchEsm = () => {
// @ts-ignore
if ( !(win.CSS && win.CSS.supports && win.CSS.supports('color', 'var(--c)'))) {
// @ts-ignore
return import('./css-shim-6aaf713d-9b13816a.js').then(() => {
plt.$cssShim$ = win.__stencil_cssshim;
if (plt.$cssShim$) {
return plt.$cssShim$.initShim();
}
});
}
return Promise.resolve();
};
const patchBrowser = () => {
{
// shim css vars
plt.$cssShim$ = win.__stencil_cssshim;
}
// @ts-ignore
const scriptElm = Array.from(doc.querySelectorAll('script')).find(s => (new RegExp(`\/${NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) ||
s.getAttribute('data-stencil-namespace') === NAMESPACE));
const opts = scriptElm['data-opts'] || {};
const importMeta = "";
if ('onbeforeload' in scriptElm && !history.scrollRestoration /* IS_ESM_BUILD */) {
// Safari < v11 support: This IF is true if it's Safari below v11.
// This fn cannot use async/await since Safari didn't support it until v11,
// however, Safari 10 did support modules. Safari 10 also didn't support "nomodule",
// so both the ESM file and nomodule file would get downloaded. Only Safari
// has 'onbeforeload' in the script, and "history.scrollRestoration" was added
// to Safari in v11. Return a noop then() so the async/await ESM code doesn't continue.
// IS_ESM_BUILD is replaced at build time so this check doesn't happen in systemjs builds.
return { then() { } };
}
if (importMeta !== '') {
opts.resourcesUrl = new URL('.', importMeta).href;
}
else {
opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href;
patchDynamicImport(opts.resourcesUrl, scriptElm);
if (!window.customElements) {
// module support, but no custom elements support (Old Edge)
// @ts-ignore
return import('./dom-76cc7c7d-0a082895.js').then(() => opts);
}
}
return Promise.resolve(opts);
};
const patchDynamicImport = (base, orgScriptElm) => {
const importFunctionName = getDynamicImportFunction(NAMESPACE);
try {
// test if this browser supports dynamic imports
// There is a caching issue in V8, that breaks using import() in Function
// By generating a random string, we can workaround it
// Check https://bugs.chromium.org/p/v8/issues/detail?id=9558 for more info
win[importFunctionName] = new Function('w', `return import(w);//${Math.random()}`);
}
catch (e) {
// this shim is specifically for browsers that do support "esm" imports
// however, they do NOT support "dynamic" imports
// basically this code is for old Edge, v18 and below
const moduleMap = new Map();
win[importFunctionName] = (src) => {
const url = new URL(src, base).href;
let mod = moduleMap.get(url);
if (!mod) {
const script = doc.createElement('script');
script.type = 'module';
script.crossOrigin = orgScriptElm.crossOrigin;
script.src = URL.createObjectURL(new Blob([`import * as m from '${url}'; window.${importFunctionName}.m = m;`], { type: 'application/javascript' }));
mod = new Promise(resolve => {
script.onload = () => {
resolve(win[importFunctionName].m);
script.remove();
};
});
moduleMap.set(url, mod);
doc.head.appendChild(script);
}
return mod;
};
}
};
const parsePropertyValue = (propValue, propType) => {
// ensure this value is of the correct prop type
if (propValue != null && !isComplexType(propValue)) {
if ( propType & 1 /* String */) {
// could have been passed as a number or boolean
// but we still want it as a string
return String(propValue);
}
// redundant return here for better minification
return propValue;
}
// not sure exactly what type we want
// so no need to change to a different type
return propValue;
};
const HYDRATED_CLASS = 'hydrated';
const createTime = (fnName, tagName = '') => {
{
return () => { return; };
}
};
const uniqueTime = (key, measureText) => {
{
return () => { return; };
}
};
const rootAppliedStyles = new WeakMap();
const registerStyle = (scopeId, cssText, allowCS) => {
let style = styles.get(scopeId);
if (supportsConstructibleStylesheets && allowCS) {
style = (style || new CSSStyleSheet());
style.replace(cssText);
}
else {
style = cssText;
}
styles.set(scopeId, style);
};
const addStyle = (styleContainerNode, cmpMeta, mode, hostElm) => {
let scopeId = getScopeId(cmpMeta.$tagName$);
let style = styles.get(scopeId);
// if an element is NOT connected then getRootNode() will return the wrong root node
// so the fallback is to always use the document for the root node in those cases
styleContainerNode = (styleContainerNode.nodeType === 11 /* DocumentFragment */ ? styleContainerNode : doc);
if (style) {
if (typeof style === 'string') {
styleContainerNode = styleContainerNode.head || styleContainerNode;
let appliedStyles = rootAppliedStyles.get(styleContainerNode);
let styleElm;
if (!appliedStyles) {
rootAppliedStyles.set(styleContainerNode, appliedStyles = new Set());
}
if (!appliedStyles.has(scopeId)) {
{
if ( plt.$cssShim$) {
styleElm = plt.$cssShim$.createHostStyle(hostElm, scopeId, style, !!(cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */));
const newScopeId = styleElm['s-sc'];
if (newScopeId) {
scopeId = newScopeId;
// we don't want to add this styleID to the appliedStyles Set
// since the cssVarShim might need to apply several different
// stylesheets for the same component
appliedStyles = null;
}
}
else {
styleElm = doc.createElement('style');
styleElm.innerHTML = style;
}
styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector('link'));
}
if (appliedStyles) {
appliedStyles.add(scopeId);
}
}
}
else if ( !styleContainerNode.adoptedStyleSheets.includes(style)) {
styleContainerNode.adoptedStyleSheets = [
...styleContainerNode.adoptedStyleSheets,
style
];
}
}
return scopeId;
};
const attachStyles = (elm, cmpMeta, mode) => {
const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$);
const scopeId = addStyle(( supportsShadowDom && elm.shadowRoot)
? elm.shadowRoot
: elm.getRootNode(), cmpMeta, mode, elm);
if ( cmpMeta.$flags$ & 10 /* needsScopedEncapsulation */) {
// only required when we're NOT using native shadow dom (slot)
// or this browser doesn't support native shadow dom
// and this host element was NOT created with SSR
// let's pick out the inner content for slot projection
// create a node to represent where the original
// content was first placed, which is useful later on
// DOM WRITE!!
elm['s-sc'] = scopeId;
elm.classList.add(scopeId + '-h');
}
endAttachStyles();
};
const getScopeId = (tagName, mode) => 'sc-' + ( tagName);
/**
* Production h() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
// const stack: any[] = [];
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, child?: d.ChildType): d.VNode;
// export function h(nodeName: string | d.FunctionalComponent, vnodeData: d.PropsType, ...children: d.ChildType[]): d.VNode;
const h = (nodeName, vnodeData, ...children) => {
let child = null;
let simple = false;
let lastSimple = false;
let vNodeChildren = [];
const walk = (c) => {
for (let i = 0; i < c.length; i++) {
child = c[i];
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) {
// If the previous child was simple (string), we merge both
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
}
else {
// Append a new vNode, if it's text, we create a text vNode
vNodeChildren.push(simple ? newVNode(null, child) : child);
}
lastSimple = simple;
}
}
};
walk(children);
if (vnodeData) {
{
const classData = vnodeData.className || vnodeData.class;
if (classData) {
vnodeData.class = typeof classData !== 'object'
? classData
: Object.keys(classData)
.filter(k => classData[k])
.join(' ');
}
}
}
const vnode = newVNode(nodeName, null);
vnode.$attrs$ = vnodeData;
if (vNodeChildren.length > 0) {
vnode.$children$ = vNodeChildren;
}
return vnode;
};
const newVNode = (tag, text) => {
const vnode = {
$flags$: 0,
$tag$: tag,
$text$: text,
$elm$: null,
$children$: null
};
{
vnode.$attrs$ = null;
}
return vnode;
};
const Host = {};
const isHost = (node) => node && node.$tag$ === Host;
/**
* Production setAccessor() function based on Preact by
* Jason Miller (@developit)
* Licensed under the MIT License
* https://github.com/developit/preact/blob/master/LICENSE
*
* Modified for Stencil's compiler and vdom
*/
const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
if (oldValue === newValue) {
return;
}
let isProp = isMemberInElement(elm, memberName);
let ln = memberName.toLowerCase();
if ( memberName === 'class') {
const classList = elm.classList;
const oldClasses = parseClassList(oldValue);
const newClasses = parseClassList(newValue);
classList.remove(...oldClasses.filter(c => c && !newClasses.includes(c)));
classList.add(...newClasses.filter(c => c && !oldClasses.includes(c)));
}
else {
// Set property if it exists and it's not a SVG
const isComplex = isComplexType(newValue);
if ((isProp || (isComplex && newValue !== null)) && !isSvg) {
try {
if (!elm.tagName.includes('-')) {
let n = newValue == null ? '' : newValue;
// Workaround for Safari, moving the <input> caret when re-assigning the same valued
if (memberName === 'list') {
isProp = false;
// tslint:disable-next-line: triple-equals
}
else if (oldValue == null || elm[memberName] != n) {
elm[memberName] = n;
}
}
else {
elm[memberName] = newValue;
}
}
catch (e) { }
}
if (newValue == null || newValue === false) {
{
elm.removeAttribute(memberName);
}
}
else if ((!isProp || (flags & 4 /* isHost */) || isSvg) && !isComplex) {
newValue = newValue === true ? '' : newValue;
{
elm.setAttribute(memberName, newValue);
}
}
}
};
const parseClassListRegex = /\s/;
const parseClassList = (value) => (!value) ? [] : value.split(parseClassListRegex);
const updateElement = (oldVnode, newVnode, isSvgMode, memberName) => {
// if the element passed in is a shadow root, which is a document fragment
// then we want to be adding attrs/props to the shadow root's "host" element
// if it's not a shadow root, then we add attrs/props to the same element
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;
{
// remove attributes no longer present on the vnode by setting them to undefined
for (memberName in oldVnodeAttrs) {
if (!(memberName in newVnodeAttrs)) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], undefined, isSvgMode, newVnode.$flags$);
}
}
}
// add new & update changed attributes
for (memberName in newVnodeAttrs) {
setAccessor(elm, memberName, oldVnodeAttrs[memberName], newVnodeAttrs[memberName], isSvgMode, newVnode.$flags$);
}
};
const createElm = (oldParentVNode, newParentVNode, childIndex, parentElm) => {
// tslint:disable-next-line: prefer-const
let newVNode = newParentVNode.$children$[childIndex];
let i = 0;
let elm;
let childNode;
{
// create element
elm = newVNode.$elm$ = ( doc.createElement( newVNode.$tag$));
// add css classes, attrs, props, listeners, etc.
{
updateElement(null, newVNode, isSvgMode);
}
if ( isDef(scopeId) && elm['s-si'] !== scopeId) {
// if there is a scopeId and this is the initial render
// then let's add the scopeId as a css class
elm.classList.add((elm['s-si'] = scopeId));
}
if (newVNode.$children$) {
for (i = 0; i < newVNode.$children$.length; ++i) {
// create the node
childNode = createElm(oldParentVNode, newVNode, i);
// return node could have been null
if (childNode) {
// append our new node
elm.appendChild(childNode);
}
}
}
}
return elm;
};
const addVnodes = (parentElm, before, parentVNode, vnodes, startIdx, endIdx) => {
let containerElm = ( parentElm);
let childNode;
if ( containerElm.shadowRoot && containerElm.tagName === hostTagName) {
containerElm = containerElm.shadowRoot;
}
for (; startIdx <= endIdx; ++startIdx) {
if (vnodes[startIdx]) {
childNode = createElm(null, parentVNode, startIdx);
if (childNode) {
vnodes[startIdx].$elm$ = childNode;
containerElm.insertBefore(childNode, before);
}
}
}
};
const removeVnodes = (vnodes, startIdx, endIdx, vnode, elm) => {
for (; startIdx <= endIdx; ++startIdx) {
if (vnode = vnodes[startIdx]) {
elm = vnode.$elm$;
// remove the vnode's element from the dom
elm.remove();
}
}
};
const updateChildren = (parentElm, oldCh, newVNode, newCh) => {
let oldStartIdx = 0;
let newStartIdx = 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;
while (oldStartIdx <= oldEndIdx && newStartIdx <= newEndIdx) {
if (oldStartVnode == null) {
// Vnode might have been moved left
oldStartVnode = oldCh[++oldStartIdx];
}
else if (oldEndVnode == null) {
oldEndVnode = oldCh[--oldEndIdx];
}
else if (newStartVnode == null) {
newStartVnode = newCh[++newStartIdx];
}
else if (newEndVnode == null) {
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newStartVnode)) {
patch(oldStartVnode, newStartVnode);
oldStartVnode = oldCh[++oldStartIdx];
newStartVnode = newCh[++newStartIdx];
}
else if (isSameVnode(oldEndVnode, newEndVnode)) {
patch(oldEndVnode, newEndVnode);
oldEndVnode = oldCh[--oldEndIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldStartVnode, newEndVnode)) {
patch(oldStartVnode, newEndVnode);
parentElm.insertBefore(oldStartVnode.$elm$, oldEndVnode.$elm$.nextSibling);
oldStartVnode = oldCh[++oldStartIdx];
newEndVnode = newCh[--newEndIdx];
}
else if (isSameVnode(oldEndVnode, newStartVnode)) {
patch(oldEndVnode, newStartVnode);
parentElm.insertBefore(oldEndVnode.$elm$, oldStartVnode.$elm$);
oldEndVnode = oldCh[--oldEndIdx];
newStartVnode = newCh[++newStartIdx];
}
else {
{
// new element
node = createElm(oldCh && oldCh[newStartIdx], newVNode, newStartIdx);
newStartVnode = newCh[++newStartIdx];
}
if (node) {
{
oldStartVnode.$elm$.parentNode.insertBefore(node, oldStartVnode.$elm$);
}
}
}
}
if (oldStartIdx > oldEndIdx) {
addVnodes(parentElm, (newCh[newEndIdx + 1] == null ? null : newCh[newEndIdx + 1].$elm$), newVNode, newCh, newStartIdx, newEndIdx);
}
else if ( newStartIdx > newEndIdx) {
removeVnodes(oldCh, oldStartIdx, oldEndIdx);
}
};
const isSameVnode = (vnode1, vnode2) => {
// compare if two vnode to see if they're "technically" the same
// need to have the same element tag, and same key to be the same
if (vnode1.$tag$ === vnode2.$tag$) {
return true;
}
return false;
};
const patch = (oldVNode, newVNode) => {
const elm = newVNode.$elm$ = oldVNode.$elm$;
const oldChildren = oldVNode.$children$;
const newChildren = newVNode.$children$;
{
// element node
{
{
// either this is the first render of an element OR it's an update
// AND we already know it's possible it could have changed
// this updates the element's css classes, attrs, props, listeners, etc.
updateElement(oldVNode, newVNode, isSvgMode);
}
}
if ( oldChildren !== null && newChildren !== null) {
// looks like there's child vnodes for both the old and new vnodes
updateChildren(elm, oldChildren, newVNode, newChildren);
}
else if (newChildren !== null) {
// add the new vnode children
addVnodes(elm, null, newVNode, newChildren, 0, newChildren.length - 1);
}
else if ( oldChildren !== null) {
// no new child vnodes, but there are old child vnodes to remove
removeVnodes(oldChildren, 0, oldChildren.length - 1);
}
}
};
const renderVdom = (hostElm, hostRef, cmpMeta, renderFnResults) => {
hostTagName = hostElm.tagName;
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
const rootVnode = isHost(renderFnResults)
? renderFnResults
: h(null, null, renderFnResults);
rootVnode.$tag$ = null;
rootVnode.$flags$ |= 4 /* isHost */;
hostRef.$vnode$ = rootVnode;
rootVnode.$elm$ = oldVNode.$elm$ = ( hostElm.shadowRoot || hostElm );
{
scopeId = hostElm['s-sc'];
}
// synchronous patch
patch(oldVNode, rootVnode);
};
const attachToAncestor = (hostRef, ancestorComponent) => {
if ( ancestorComponent && !hostRef.$onRenderResolve$) {
ancestorComponent['s-p'].push(new Promise(r => hostRef.$onRenderResolve$ = r));
}
};
const scheduleUpdate = (elm, hostRef, cmpMeta, isInitialLoad) => {
{
hostRef.$flags$ |= 16 /* isQueuedForUpdate */;
}
if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) {
hostRef.$flags$ |= 512 /* needsRerender */;
return;
}
const endSchedule = createTime('scheduleUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
const instance = hostRef.$lazyInstance$ ;
const update = () => updateComponent(elm, hostRef, cmpMeta, instance, isInitialLoad);
attachToAncestor(hostRef, ancestorComponent);
let promise;
if (isInitialLoad) {
{
hostRef.$flags$ |= 256 /* isListenReady */;
if (hostRef.$queuedListeners$) {
hostRef.$queuedListeners$.forEach(([methodName, event]) => safeCall(instance, methodName, event));
hostRef.$queuedListeners$ = null;
}
}
{
promise = safeCall(instance, 'componentWillLoad');
}
}
{
promise = then(promise, () => safeCall(instance, 'componentWillRender'));
}
endSchedule();
// there is no ancestorc omponent or the ancestor component
// has already fired off its lifecycle update then
// fire off the initial update
return then(promise, () => writeTask(update)
);
};
const updateComponent = (elm, hostRef, cmpMeta, instance, isInitialLoad) => {
// updateComponent
const endUpdate = createTime('update', cmpMeta.$tagName$);
const rc = elm['s-rc'];
if ( isInitialLoad) {
// DOM WRITE!
attachStyles(elm, cmpMeta, hostRef.$modeName$);
}
const endRender = createTime('render', cmpMeta.$tagName$);
{
{
// looks like we've got child nodes to render into this host element
// or we need to update the css class/attrs on the host element
// DOM WRITE!
renderVdom(elm, hostRef, cmpMeta, callRender(instance));
}
}
if ( plt.$cssShim$) {
plt.$cssShim$.updateHost(elm);
}
{
hostRef.$flags$ &= ~16 /* isQueuedForUpdate */;
}
{
hostRef.$flags$ |= 2 /* hasRendered */;
}
if ( rc) {
// ok, so turns out there are some child host elements
// waiting on this parent element to load
// let's fire off all update callbacks waiting
rc.forEach(cb => cb());
elm['s-rc'] = undefined;
}
endRender();
endUpdate();
{
const childrenPromises = elm['s-p'];
const postUpdate = () => postUpdateComponent(elm, hostRef, cmpMeta);
if (childrenPromises.length === 0) {
postUpdate();
}
else {
Promise.all(childrenPromises).then(postUpdate);
hostRef.$flags$ |= 4 /* isWaitingForChildren */;
childrenPromises.length = 0;
}
}
};
const callRender = (instance, elm) => {
try {
instance = instance.render() ;
}
catch (e) {
consoleError(e);
}
return instance;
};
const postUpdateComponent = (elm, hostRef, cmpMeta) => {
const endPostUpdate = createTime('postUpdate', cmpMeta.$tagName$);
const ancestorComponent = hostRef.$ancestorComponent$;
if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) {
hostRef.$flags$ |= 64 /* hasLoadedComponent */;
{
// DOM WRITE!
// add the css class that this element has officially hydrated
elm.classList.add(HYDRATED_CLASS);
}
endPostUpdate();
{
hostRef.$onReadyResolve$(elm);
if (!ancestorComponent) {
appDidLoad();
}
}
}
else {
endPostUpdate();
}
{
hostRef.$onInstanceResolve$(elm);
}
// load events fire from bottom to top
// the deepest elements load first then bubbles up
{
if (hostRef.$onRenderResolve$) {
hostRef.$onRenderResolve$();
hostRef.$onRenderResolve$ = undefined;
}
if (hostRef.$flags$ & 512 /* needsRerender */) {
nextTick(() => scheduleUpdate(elm, hostRef, cmpMeta, false));
}
hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */);
}
// ( •_•)
// ( •_•)>⌐■-■
// (⌐■_■)
};
const forceUpdate = (elm, cmpMeta) => {
{
const hostRef = getHostRef(elm);
const isConnected = hostRef.$hostElement$.isConnected;
if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
// Returns "true" when the forced update was successfully scheduled
return isConnected;
}
};
const appDidLoad = (who) => {
// on appload
// we have finish the first big initial render
{
doc.documentElement.classList.add(HYDRATED_CLASS);
}
{
plt.$flags$ |= 2 /* appLoaded */;
}
};
const safeCall = (instance, method, arg) => {
if (instance && instance[method]) {
try {
return instance[method](arg);
}
catch (e) {
consoleError(e);
}
}
return undefined;
};
const then = (promise, thenFn) => {
return promise && promise.then ? promise.then(thenFn) : thenFn();
};
const getValue = (ref, propName) => getHostRef(ref).$instanceValues$.get(propName);
const setValue = (ref, propName, newVal, cmpMeta) => {
// check our new property value against our internal value
const hostRef = getHostRef(ref);
const elm = hostRef.$hostElement$ ;
const oldVal = hostRef.$instanceValues$.get(propName);
const flags = hostRef.$flags$;
const instance = hostRef.$lazyInstance$ ;
newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]);
if (newVal !== oldVal && ( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined)) {
// gadzooks! the property's value has changed!!
// set our new value!
hostRef.$instanceValues$.set(propName, newVal);
if ( instance) {
if ( (flags & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) {
// looks like this value actually changed, so we've got work to do!
// but only if we've already rendered, otherwise just chill out
// queue that we need to do an update, but don't worry about queuing
// up millions cuz this function ensures it only runs once
scheduleUpdate(elm, hostRef, cmpMeta, false);
}
}
}
};
const proxyComponent = (Cstr, cmpMeta, flags) => {
if ( cmpMeta.$members$) {
// It's better to have a const than two Object.entries()
const members = Object.entries(cmpMeta.$members$);
const prototype = Cstr.prototype;
members.forEach(([memberName, [memberFlags]]) => {
if ( ((memberFlags & 31 /* Prop */) ||
(( flags & 2 /* proxyState */) &&
(memberFlags & 32 /* State */)))) {
// proxyComponent - prop
Object.defineProperty(prototype, memberName, {
get() {
// proxyComponent, get value
return getValue(this, memberName);
},
set(newValue) {
// proxyComponent, set value
setValue(this, memberName, newValue, cmpMeta);
},
configurable: true,
enumerable: true
});
}
else if ( (flags & 1 /* isElementConstructor */) && (memberFlags & 64 /* Method */)) {
// proxyComponent - method
Object.defineProperty(prototype, memberName, {
value(...args) {
const ref = getHostRef(this);
return ref.$onInstancePromise$.then(() => ref.$lazyInstance$[memberName](...args));
}
});
}
});
if ( ( flags & 1 /* isElementConstructor */)) {
const attrNameToPropName = new Map();
prototype.attributeChangedCallback = function (attrName, _oldValue, newValue) {
plt.jmp(() => {
const propName = attrNameToPropName.get(attrName);
this[propName] = newValue === null && typeof this[propName] === 'boolean'
? false
: newValue;
});
};
// create an array of attributes to observe
// and also create a map of html attribute name to js property name
Cstr.observedAttributes = members
.filter(([_, m]) => m[0] & 15 /* HasAttribute */) // filter to only keep props that should match attributes
.map(([propName, m]) => {
const attrName = m[1] || propName;
attrNameToPropName.set(attrName, propName);
return attrName;
});
}
}
return Cstr;
};
const addEventListeners = (elm, hostRef, listeners) => {
hostRef.$queuedListeners$ = hostRef.$queuedListeners$ || [];
const removeFns = listeners.map(([flags, name, method]) => {
const target = ( getHostListenerTarget(elm, flags) );
const handler = hostListenerProxy(hostRef, method);
const opts = hostListenerOpts(flags);
plt.ael(target, name, handler, opts);
return () => plt.rel(target, name, handler, opts);
});
return () => removeFns.forEach(fn => fn());
};
const hostListenerProxy = (hostRef, methodName) => {
return (ev) => {
{
if (hostRef.$flags$ & 256 /* isListenReady */) {
// instance is ready, let's call it's member method for this event
hostRef.$lazyInstance$[methodName](ev);
}
else {
hostRef.$queuedListeners$.push([methodName, ev]);
}
}
};
};
const getHostListenerTarget = (elm, flags) => {
if ( flags & 8 /* TargetWindow */)
return win;
return elm;
};
const hostListenerOpts = (flags) => supportsListenerOptions ?
{
'passive': (flags & 1 /* Passive */) !== 0,
'capture': (flags & 2 /* Capture */) !== 0,
}
: (flags & 2 /* Capture */) !== 0;
const initializeComponent = async (elm, hostRef, cmpMeta, hmrVersionId, Cstr) => {
// initializeComponent
if ( (hostRef.$flags$ & 32 /* hasInitializedComponent */) === 0) {
// we haven't initialized this element yet
hostRef.$flags$ |= 32 /* hasInitializedComponent */;
{
// lazy loaded components
// request the component's implementation to be
// wired up with the host element
Cstr = loadModule(cmpMeta);
if (Cstr.then) {
// Await creates a micro-task avoid if possible
const endLoad = uniqueTime();
Cstr = await Cstr;
endLoad();
}
if ( !Cstr.isProxied) {
proxyComponent(Cstr, cmpMeta, 2 /* proxyState */);
Cstr.isProxied = true;
}
const endNewInstance = createTime('createInstance', cmpMeta.$tagName$);
// ok, time to construct the instance
// but let's keep track of when we start and stop
// so that the getters/setters don't incorrectly step on data
{
hostRef.$flags$ |= 8 /* isConstructingInstance */;
}
// construct the lazy-loaded component implementation
// passing the hostRef is very important during
// construction in order to directly wire together the
// host element and the lazy-loaded instance
try {
new Cstr(hostRef);
}
catch (e) {
consoleError(e);
}
{
hostRef.$flags$ &= ~8 /* isConstructingInstance */;
}
endNewInstance();
}
const scopeId = getScopeId(cmpMeta.$tagName$);
if ( !styles.has(scopeId) && Cstr.style) {
const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$);
// this component has styles but we haven't registered them yet
let style = Cstr.style;
if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) {
style = await import('./shadow-css-4889ae62-23996f3f.js').then(m => m.scopeCss(style, scopeId, false));
}
registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */));
endRegisterStyles();
}
}
// we've successfully created a lazy instance
const ancestorComponent = hostRef.$ancestorComponent$;
const schedule = () => scheduleUpdate(elm, hostRef, cmpMeta, true);
if ( ancestorComponent && ancestorComponent['s-rc']) {
// this is the intial load and this component it has an ancestor component
// but the ancestor component has NOT fired its will update lifecycle yet
// so let's just cool our jets and wait for the ancestor to continue first
// this will get fired off when the ancestor component
// finally gets around to rendering its lazy self
// fire off the initial update
ancestorComponent['s-rc'].push(schedule);
}
else {
schedule();
}
};
const connectedCallback = (elm, cmpMeta) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const endConnected = createTime('connectedCallback', cmpMeta.$tagName$);
// connectedCallback
const hostRef = getHostRef(elm);
if ( cmpMeta.$listeners$) {
// initialize our event listeners on the host element
// we do this now so that we can listening to events that may
// have fired even before the instance is ready
hostRef.$rmListeners$ = addEventListeners(elm, hostRef, cmpMeta.$listeners$);
}
if (!(hostRef.$flags$ & 1 /* hasConnected */)) {
// first time this component has connected
hostRef.$flags$ |= 1 /* hasConnected */;
{
// find the first ancestor component (if there is one) and register
// this component as one of the actively loading child components for its ancestor
let ancestorComponent = elm;
while ((ancestorComponent = (ancestorComponent.parentNode || ancestorComponent.host))) {
// climb up the ancestors looking for the first
// component that hasn't finished its lifecycle update yet
if (
(ancestorComponent['s-p'])) {
// we found this components first ancestor component
// keep a reference to this component's ancestor component
attachToAncestor(hostRef, (hostRef.$ancestorComponent$ = ancestorComponent));
break;
}
}
}
// Lazy properties
// https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties
if ( cmpMeta.$members$) {
Object.entries(cmpMeta.$members$).forEach(([memberName, [memberFlags]]) => {
if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) {
const value = elm[memberName];
delete elm[memberName];
elm[memberName] = value;
}
});
}
{
// connectedCallback, taskQueue, initialLoad
// angular sets attribute AFTER connectCallback
// https://github.com/angular/angular/issues/18909
// https://github.com/angular/angular/issues/19940
nextTick(() => initializeComponent(elm, hostRef, cmpMeta));
}
}
endConnected();
}
};
const disconnectedCallback = (elm) => {
if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) {
const hostRef = getHostRef(elm);
{
if (hostRef.$rmListeners$) {
hostRef.$rmListeners$();
hostRef.$rmListeners$ = undefined;
}
}
// clear CSS var-shim tracking
if ( plt.$cssShim$) {
plt.$cssShim$.removeHost(elm);
}
}
};
const bootstrapLazy = (lazyBundles, options = {}) => {
const endBootstrap = createTime();
const cmpTags = [];
const exclude = options.exclude || [];
const head = doc.head;
const customElements = win.customElements;
const y = /*@__PURE__*/ head.querySelector('meta[charset]');
const visibilityStyle = /*@__PURE__*/ doc.createElement('style');
const deferredConnectedCallbacks = [];
let appLoadFallback;
let isBootstrapping = true;
Object.assign(plt, options);
plt.$resourcesUrl$ = new URL(options.resourcesUrl || './', doc.baseURI).href;
if (options.syncQueue) {
plt.$flags$ |= 4 /* queueSync */;
}
lazyBundles.forEach(lazyBundle => lazyBundle[1].forEach(compactMeta => {
const cmpMeta = {
$flags$: compactMeta[0],
$tagName$: compactMeta[1],
$members$: compactMeta[2],
$listeners$: compactMeta[3],
};
{
cmpMeta.$members$ = compactMeta[2];
}
{
cmpMeta.$listeners$ = compactMeta[3];
}
if ( !supportsShadowDom && cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
cmpMeta.$flags$ |= 8 /* needsShadowDomShim */;
}
const tagName = cmpMeta.$tagName$;
const HostElement = class extends HTMLElement {
// StencilLazyHost
constructor(self) {
// @ts-ignore
super(self);
self = this;
registerHost(self);
if ( cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) {
// this component is using shadow dom
// and this browser supports shadow dom
// add the read-only property "shadowRoot" to the host element
// adding the shadow root build conditionals to minimize runtime
if (supportsShadowDom) {
{
self.attachShadow({ mode: 'open' });
}
}
else if ( !('shadowRoot' in self)) {
self.shadowRoot = self;
}
}
}
connectedCallback() {
if (appLoadFallback) {
clearTimeout(appLoadFallback);
appLoadFallback = null;
}
if (isBootstrapping) {
// connectedCallback will be processed once all components have been registered
deferredConnectedCallbacks.push(this);
}
else {
plt.jmp(() => connectedCallback(this, cmpMeta));
}
}
disconnectedCallback() {
plt.jmp(() => disconnectedCallback(this));
}
forceUpdate() {
forceUpdate(this, cmpMeta);
}
componentOnReady() {
return getHostRef(this).$onReadyPromise$;
}
};
cmpMeta.$lazyBundleIds$ = lazyBundle[0];
if (!exclude.includes(tagName) && !customElements.get(tagName)) {
cmpTags.push(tagName);
customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */));
}
}));
// visibilityStyle.innerHTML = cmpTags.map(t => `${t}:not(.hydrated)`) + '{display:none}';
visibilityStyle.innerHTML = cmpTags + '{visibility:hidden}.hydrated{visibility:inherit}';
visibilityStyle.setAttribute('data-styles', '');
head.insertBefore(visibilityStyle, y ? y.nextSibling : head.firstChild);
// Process deferred connectedCallbacks now all components have been registered
isBootstrapping = false;
if (deferredConnectedCallbacks.length > 0) {
deferredConnectedCallbacks.forEach(host => host.connectedCallback());
}
else {
plt.jmp(() => appLoadFallback = setTimeout(appDidLoad, 30, 'timeout'));
}
// Fallback appLoad event
endBootstrap();
};
const getElement = (ref) => getHostRef(ref).$hostElement$ ;
export { patchEsm as a, bootstrapLazy as b, getElement as g, h, patchBrowser as p, registerInstance as r };
System.register(["./p-352415f5.system.js"],(function(){"use strict";var e,t;return{setters:[function(n){e=n.p;t=n.b}],execute:function(){e().then((function(e){return t([["p-mqwdj988.system",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e)}))}}}));
var __extends=this&&this.__extends||function(){var e=function(r,n){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,r){e.__proto__=r}||function(e,r){for(var n in r)if(r.hasOwnProperty(n))e[n]=r[n]};return e(r,n)};return function(r,n){e(r,n);function t(){this.constructor=r}r.prototype=n===null?Object.create(n):(t.prototype=n.prototype,new t)}}();var __awaiter=this&&this.__awaiter||function(e,r,n,t){function a(e){return e instanceof n?e:new n((function(r){r(e)}))}return new(n||(n=Promise))((function(n,i){function s(e){try{u(t.next(e))}catch(r){i(r)}}function o(e){try{u(t["throw"](e))}catch(r){i(r)}}function u(e){e.done?n(e.value):a(e.value).then(s,o)}u((t=t.apply(e,r||[])).next())}))};var __generator=this&&this.__generator||function(e,r){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,a,i,s;return s={next:o(0),throw:o(1),return:o(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function o(e){return function(r){return u([e,r])}}function u(s){if(t)throw new TypeError("Generator is already executing.");while(n)try{if(t=1,a&&(i=s[0]&2?a["return"]:s[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,s[1])).done)return i;if(a=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;a=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=r.call(e,n)}catch(o){s=[6,o];a=0}finally{t=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,r=0,n=arguments.length;r<n;r++)e+=arguments[r].length;for(var t=Array(e),a=0,r=0;r<n;r++)for(var i=arguments[r],s=0,o=i.length;s<o;s++,a++)t[a]=i[s];return t};System.register([],(function(e,r){"use strict";return{execute:function(){var n=this;var t="msf-editor";var a=0;var i=false;var s;var o;var u=false;var l=typeof window!=="undefined"?window:{};var f=l.document||{head:{}};var c={$flags$:0,$resourcesUrl$:"",jmp:function(e){return e()},raf:function(e){return requestAnimationFrame(e)},ael:function(e,r,n,t){return e.addEventListener(r,n,t)},rel:function(e,r,n,t){return e.removeEventListener(r,n,t)}};var $=function(){return(f.head.attachShadow+"").includes("[native")}();var v=function(){var e=false;try{f.addEventListener("e",null,Object.defineProperty({},"passive",{get:function(){e=true}}))}catch(r){}return e}();var h=function(){try{new CSSStyleSheet;return true}catch(e){}return false}();var d=new WeakMap;var m=function(e){return d.get(e)};var p=e("r",(function(e,r){return d.set(r.$lazyInstance$=e,r)}));var g=function(e){var r={$flags$:0,$hostElement$:e,$instanceValues$:new Map};{r.$onInstancePromise$=new Promise((function(e){return r.$onInstanceResolve$=e}))}{r.$onReadyPromise$=new Promise((function(e){return r.$onReadyResolve$=e}));e["s-p"]=[];e["s-rc"]=[]}return d.set(e,r)};var y=function(e,r){return r in e};var w=function(e){return console.error(e)};var b=new Map;var S=function(e,n,t){var a=e.$tagName$.replace(/-/g,"_");var i=e.$lazyBundleIds$;var s=b.get(i);if(s){return s[a]}return r.import("./"+i+".entry.js"+"").then((function(e){{b.set(i,e)}return e[a]}),w)};var _=new Map;var R=[];var L=[];var E=[];var j=function(e,r){return function(n){e.push(n);if(!i){i=true;if(r&&c.$flags$&4){x(P)}else{c.raf(P)}}}};var C=function(e){for(var r=0;r<e.length;r++){try{e[r](performance.now())}catch(n){w(n)}}e.length=0};var N=function(e,r){var n=0;var t=0;while(n<e.length&&(t=performance.now())<r){try{e[n++](t)}catch(a){w(a)}}if(n===e.length){e.length=0}else if(n!==0){e.splice(0,n)}};var P=function(){a++;C(R);var e=(c.$flags$&6)===2?performance.now()+10*Math.ceil(a*(1/22)):Infinity;N(L,e);N(E,e);if(L.length>0){E.push.apply(E,L);L.length=0}if(i=R.length+L.length+E.length>0){c.raf(P)}else{a=0}};var x=function(e){return Promise.resolve().then(e)};var U=j(L,true);var A={};var O=function(e){return e!=null};var k=function(e){e=typeof e;return e==="object"||e==="function"};var I=function(e){return"__sc_import_"+e.replace(/\s|-/g,"_")};var M=e("a",(function(){if(!(l.CSS&&l.CSS.supports&&l.CSS.supports("color","var(--c)"))){return r.import("./p-447ccb56.system.js").then((function(){c.$cssShim$=l.__stencil_cssshim;if(c.$cssShim$){return c.$cssShim$.initShim()}}))}return Promise.resolve()}));var q=e("p",(function(){{c.$cssShim$=l.__stencil_cssshim}var e=Array.from(f.querySelectorAll("script")).find((function(e){return new RegExp("/"+t+"(\\.esm)?\\.js($|\\?|#)").test(e.src)||e.getAttribute("data-stencil-namespace")===t}));var n=e["data-opts"]||{};var a=r.meta.url;if("onbeforeload"in e&&!history.scrollRestoration&&false){return{then:function(){}}}if(a!==""){n.resourcesUrl=new URL(".",a).href}else{n.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,l.location.href)).href;B(n.resourcesUrl,e);if(!window.customElements){return r.import("./p-7f10eb01.system.js").then((function(){return n}))}}return Promise.resolve(n)}));var B=function(e,r){var n=I(t);try{l[n]=new Function("w","return import(w);//"+Math.random())}catch(i){var a=new Map;l[n]=function(t){var i=new URL(t,e).href;var s=a.get(i);if(!s){var o=f.createElement("script");o.type="module";o.crossOrigin=r.crossOrigin;o.src=URL.createObjectURL(new Blob(["import * as m from '"+i+"'; window."+n+".m = m;"],{type:"application/javascript"}));s=new Promise((function(e){o.onload=function(){e(l[n].m);o.remove()}}));a.set(i,s);f.head.appendChild(o)}return s}}};var T=function(e,r){if(e!=null&&!k(e)){if(r&1){return String(e)}return e}return e};var z="hydrated";var H=function(e,r){if(r===void 0){r=""}{return function(){return}}};var V=function(e,r){{return function(){return}}};var W=new WeakMap;var F=function(e,r,n){var t=_.get(e);if(h&&n){t=t||new CSSStyleSheet;t.replace(r)}else{t=r}_.set(e,t)};var G=function(e,r,n,t){var a=D(r.$tagName$);var i=_.get(a);e=e.nodeType===11?e:f;if(i){if(typeof i==="string"){e=e.head||e;var s=W.get(e);var o=void 0;if(!s){W.set(e,s=new Set)}if(!s.has(a)){{if(c.$cssShim$){o=c.$cssShim$.createHostStyle(t,a,i,!!(r.$flags$&10));var u=o["s-sc"];if(u){a=u;s=null}}else{o=f.createElement("style");o.innerHTML=i}e.insertBefore(o,e.querySelector("link"))}if(s){s.add(a)}}}else if(!e.adoptedStyleSheets.includes(i)){e.adoptedStyleSheets=__spreadArrays(e.adoptedStyleSheets,[i])}}return a};var Q=function(e,r,n){var t=H("attachStyles",r.$tagName$);var a=G($&&e.shadowRoot?e.shadowRoot:e.getRootNode(),r,n,e);if(r.$flags$&10){e["s-sc"]=a;e.classList.add(a+"-h")}t()};var D=function(e,r){return"sc-"+e};var J=e("h",(function(e,r){var n=[];for(var t=2;t<arguments.length;t++){n[t-2]=arguments[t]}var a=null;var i=false;var s=false;var o=[];var u=function(r){for(var n=0;n<r.length;n++){a=r[n];if(Array.isArray(a)){u(a)}else if(a!=null&&typeof a!=="boolean"){if(i=typeof e!=="function"&&!k(a)){a=String(a)}if(i&&s){o[o.length-1].$text$+=a}else{o.push(i?K(null,a):a)}s=i}}};u(n);if(r){{var l=r.className||r.class;if(l){r.class=typeof l!=="object"?l:Object.keys(l).filter((function(e){return l[e]})).join(" ")}}}var f=K(e,null);f.$attrs$=r;if(o.length>0){f.$children$=o}return f}));var K=function(e,r){var n={$flags$:0,$tag$:e,$text$:r,$elm$:null,$children$:null};{n.$attrs$=null}return n};var X={};var Y=function(e){return e&&e.$tag$===X};var Z=function(e,r,n,t,a,i){if(n===t){return}var s=y(e,r);var o=r.toLowerCase();if(r==="class"){var u=e.classList;var l=re(n);var f=re(t);u.remove.apply(u,l.filter((function(e){return e&&!f.includes(e)})));u.add.apply(u,f.filter((function(e){return e&&!l.includes(e)})))}else{var c=k(t);if((s||c&&t!==null)&&!a){try{if(!e.tagName.includes("-")){var $=t==null?"":t;if(r==="list"){s=false}else if(n==null||e[r]!=$){e[r]=$}}else{e[r]=t}}catch(v){}}if(t==null||t===false){{e.removeAttribute(r)}}else if((!s||i&4||a)&&!c){t=t===true?"":t;{e.setAttribute(r,t)}}}};var ee=/\s/;var re=function(e){return!e?[]:e.split(ee)};var ne=function(e,r,n,t){var a=r.$elm$.nodeType===11&&r.$elm$.host?r.$elm$.host:r.$elm$;var i=e&&e.$attrs$||A;var s=r.$attrs$||A;{for(t in i){if(!(t in s)){Z(a,t,i[t],undefined,n,r.$flags$)}}}for(t in s){Z(a,t,i[t],s[t],n,r.$flags$)}};var te=function(e,r,n,t){var a=r.$children$[n];var i=0;var o;var l;{o=a.$elm$=f.createElement(a.$tag$);{ne(null,a,u)}if(O(s)&&o["s-si"]!==s){o.classList.add(o["s-si"]=s)}if(a.$children$){for(i=0;i<a.$children$.length;++i){l=te(e,a,i);if(l){o.appendChild(l)}}}}return o};var ae=function(e,r,n,t,a,i){var s=e;var u;if(s.shadowRoot&&s.tagName===o){s=s.shadowRoot}for(;a<=i;++a){if(t[a]){u=te(null,n,a);if(u){t[a].$elm$=u;s.insertBefore(u,r)}}}};var ie=function(e,r,n,t,a){for(;r<=n;++r){if(t=e[r]){a=t.$elm$;a.remove()}}};var se=function(e,r,n,t){var a=0;var i=0;var s=r.length-1;var o=r[0];var u=r[s];var l=t.length-1;var f=t[0];var c=t[l];var $;while(a<=s&&i<=l){if(o==null){o=r[++a]}else if(u==null){u=r[--s]}else if(f==null){f=t[++i]}else if(c==null){c=t[--l]}else if(oe(o,f)){ue(o,f);o=r[++a];f=t[++i]}else if(oe(u,c)){ue(u,c);u=r[--s];c=t[--l]}else if(oe(o,c)){ue(o,c);e.insertBefore(o.$elm$,u.$elm$.nextSibling);o=r[++a];c=t[--l]}else if(oe(u,f)){ue(u,f);e.insertBefore(u.$elm$,o.$elm$);u=r[--s];f=t[++i]}else{{$=te(r&&r[i],n,i);f=t[++i]}if($){{o.$elm$.parentNode.insertBefore($,o.$elm$)}}}}if(a>s){ae(e,t[l+1]==null?null:t[l+1].$elm$,n,t,i,l)}else if(i>l){ie(r,a,s)}};var oe=function(e,r){if(e.$tag$===r.$tag$){return true}return false};var ue=function(e,r){var n=r.$elm$=e.$elm$;var t=e.$children$;var a=r.$children$;{{{ne(e,r,u)}}if(t!==null&&a!==null){se(n,t,r,a)}else if(a!==null){ae(n,null,r,a,0,a.length-1)}else if(t!==null){ie(t,0,t.length-1)}}};var le=function(e,r,n,t){o=e.tagName;var a=r.$vnode$||K(null,null);var i=Y(t)?t:J(null,null,t);i.$tag$=null;i.$flags$|=4;r.$vnode$=i;i.$elm$=a.$elm$=e.shadowRoot||e;{s=e["s-sc"]}ue(a,i)};var fe=function(e,r){if(r&&!e.$onRenderResolve$){r["s-p"].push(new Promise((function(r){return e.$onRenderResolve$=r})))}};var ce=function(e,r,n,t){{r.$flags$|=16}if(r.$flags$&4){r.$flags$|=512;return}var a=H("scheduleUpdate",n.$tagName$);var i=r.$ancestorComponent$;var s=r.$lazyInstance$;var o=function(){return $e(e,r,n,s,t)};fe(r,i);var u;if(t){{r.$flags$|=256;if(r.$queuedListeners$){r.$queuedListeners$.forEach((function(e){var r=e[0],n=e[1];return pe(s,r,n)}));r.$queuedListeners$=null}}{u=pe(s,"componentWillLoad")}}{u=ge(u,(function(){return pe(s,"componentWillRender")}))}a();return ge(u,(function(){return U(o)}))};var $e=function(e,r,n,t,a){var i=H("update",n.$tagName$);var s=e["s-rc"];if(a){Q(e,n,r.$modeName$)}var o=H("render",n.$tagName$);{{le(e,r,n,ve(t))}}if(c.$cssShim$){c.$cssShim$.updateHost(e)}{r.$flags$&=~16}{r.$flags$|=2}if(s){s.forEach((function(e){return e()}));e["s-rc"]=undefined}o();i();{var u=e["s-p"];var l=function(){return he(e,r,n)};if(u.length===0){l()}else{Promise.all(u).then(l);r.$flags$|=4;u.length=0}}};var ve=function(e,r){try{e=e.render()}catch(n){w(n)}return e};var he=function(e,r,n){var t=H("postUpdate",n.$tagName$);var a=r.$ancestorComponent$;if(!(r.$flags$&64)){r.$flags$|=64;{e.classList.add(z)}t();{r.$onReadyResolve$(e);if(!a){me()}}}else{t()}{r.$onInstanceResolve$(e)}{if(r.$onRenderResolve$){r.$onRenderResolve$();r.$onRenderResolve$=undefined}if(r.$flags$&512){x((function(){return ce(e,r,n,false)}))}r.$flags$&=~(4|512)}};var de=function(e,r){{var n=m(e);var t=n.$hostElement$.isConnected;if(t&&(n.$flags$&(2|16))===2){ce(e,n,r,false)}return t}};var me=function(e){{f.documentElement.classList.add(z)}{c.$flags$|=2}};var pe=function(e,r,n){if(e&&e[r]){try{return e[r](n)}catch(t){w(t)}}return undefined};var ge=function(e,r){return e&&e.then?e.then(r):r()};var ye=function(e,r){return m(e).$instanceValues$.get(r)};var we=function(e,r,n,t){var a=m(e);var i=a.$hostElement$;var s=a.$instanceValues$.get(r);var o=a.$flags$;var u=a.$lazyInstance$;n=T(n,t.$members$[r][0]);if(n!==s&&(!(o&8)||s===undefined)){a.$instanceValues$.set(r,n);if(u){if((o&(2|16))===2){ce(i,a,t,false)}}}};var be=function(e,r,n){if(r.$members$){var t=Object.entries(r.$members$);var a=e.prototype;t.forEach((function(e){var t=e[0],i=e[1][0];if(i&31||n&2&&i&32){Object.defineProperty(a,t,{get:function(){return ye(this,t)},set:function(e){we(this,t,e,r)},configurable:true,enumerable:true})}else if(n&1&&i&64){Object.defineProperty(a,t,{value:function(){var e=[];for(var r=0;r<arguments.length;r++){e[r]=arguments[r]}var n=m(this);return n.$onInstancePromise$.then((function(){var r;return(r=n.$lazyInstance$)[t].apply(r,e)}))}})}}));if(n&1){var i=new Map;a.attributeChangedCallback=function(e,r,n){var t=this;c.jmp((function(){var r=i.get(e);t[r]=n===null&&typeof t[r]==="boolean"?false:n}))};e.observedAttributes=t.filter((function(e){var r=e[0],n=e[1];return n[0]&15})).map((function(e){var r=e[0],n=e[1];var t=n[1]||r;i.set(t,r);return t}))}}return e};var Se=function(e,r,n){r.$queuedListeners$=r.$queuedListeners$||[];var t=n.map((function(n){var t=n[0],a=n[1],i=n[2];var s=Re(e,t);var o=_e(r,i);var u=Le(t);c.ael(s,a,o,u);return function(){return c.rel(s,a,o,u)}}));return function(){return t.forEach((function(e){return e()}))}};var _e=function(e,r){return function(n){{if(e.$flags$&256){e.$lazyInstance$[r](n)}else{e.$queuedListeners$.push([r,n])}}}};var Re=function(e,r){if(r&8)return l;return e};var Le=function(e){return v?{passive:(e&1)!==0,capture:(e&2)!==0}:(e&2)!==0};var Ee=function(e,t,a,i,s){return __awaiter(n,void 0,void 0,(function(){var n,i,o,u,l,f,c;return __generator(this,(function($){switch($.label){case 0:if(!((t.$flags$&32)===0))return[3,5];t.$flags$|=32;s=S(a);if(!s.then)return[3,2];n=V();return[4,s];case 1:s=$.sent();n();$.label=2;case 2:if(!s.isProxied){be(s,a,2);s.isProxied=true}i=H("createInstance",a.$tagName$);{t.$flags$|=8}try{new s(t)}catch(v){w(v)}{t.$flags$&=~8}i();o=D(a.$tagName$);if(!(!_.has(o)&&s.style))return[3,5];u=H("registerStyles",a.$tagName$);l=s.style;if(!(a.$flags$&8))return[3,4];return[4,r.import("./p-ed968002.system.js").then((function(e){return e.scopeCss(l,o,false)}))];case 3:l=$.sent();$.label=4;case 4:F(o,l,!!(a.$flags$&1));u();$.label=5;case 5:f=t.$ancestorComponent$;c=function(){return ce(e,t,a,true)};if(f&&f["s-rc"]){f["s-rc"].push(c)}else{c()}return[2]}}))}))};var je=function(e,r){if((c.$flags$&1)===0){var n=H("connectedCallback",r.$tagName$);var t=m(e);if(r.$listeners$){t.$rmListeners$=Se(e,t,r.$listeners$)}if(!(t.$flags$&1)){t.$flags$|=1;{var a=e;while(a=a.parentNode||a.host){if(a["s-p"]){fe(t,t.$ancestorComponent$=a);break}}}if(r.$members$){Object.entries(r.$members$).forEach((function(r){var n=r[0],t=r[1][0];if(t&31&&e.hasOwnProperty(n)){var a=e[n];delete e[n];e[n]=a}}))}{x((function(){return Ee(e,t,r)}))}}n()}};var Ce=function(e){if((c.$flags$&1)===0){var r=m(e);{if(r.$rmListeners$){r.$rmListeners$();r.$rmListeners$=undefined}}if(c.$cssShim$){c.$cssShim$.removeHost(e)}}};var Ne=e("b",(function(e,r){if(r===void 0){r={}}var n=H();var t=[];var a=r.exclude||[];var i=f.head;var s=l.customElements;var o=i.querySelector("meta[charset]");var u=f.createElement("style");var v=[];var h;var d=true;Object.assign(c,r);c.$resourcesUrl$=new URL(r.resourcesUrl||"./",f.baseURI).href;if(r.syncQueue){c.$flags$|=4}e.forEach((function(e){return e[1].forEach((function(r){var n={$flags$:r[0],$tagName$:r[1],$members$:r[2],$listeners$:r[3]};{n.$members$=r[2]}{n.$listeners$=r[3]}if(!$&&n.$flags$&1){n.$flags$|=8}var i=n.$tagName$;var o=function(e){__extends(r,e);function r(r){var t=e.call(this,r)||this;r=t;g(r);if(n.$flags$&1){if($){{r.attachShadow({mode:"open"})}}else if(!("shadowRoot"in r)){r.shadowRoot=r}}return t}r.prototype.connectedCallback=function(){var e=this;if(h){clearTimeout(h);h=null}if(d){v.push(this)}else{c.jmp((function(){return je(e,n)}))}};r.prototype.disconnectedCallback=function(){var e=this;c.jmp((function(){return Ce(e)}))};r.prototype.forceUpdate=function(){de(this,n)};r.prototype.componentOnReady=function(){return m(this).$onReadyPromise$};return r}(HTMLElement);n.$lazyBundleIds$=e[0];if(!a.includes(i)&&!s.get(i)){t.push(i);s.define(i,be(o,n,1))}}))}));u.innerHTML=t+"{visibility:hidden}.hydrated{visibility:inherit}";u.setAttribute("data-styles","");i.insertBefore(u,o?o.nextSibling:i.firstChild);d=false;if(v.length>0){v.forEach((function(e){return e.connectedCallback()}))}else{c.jmp((function(){return h=setTimeout(me,30,"timeout")}))}n()}));var Pe=e("g",(function(e){return m(e).$hostElement$}))}}}));
let t,e,n=0,o=!1;const s="undefined"!=typeof window?window:{},l=s.document||{head:{}},r={t:0,o:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,o)=>t.addEventListener(e,n,o),rel:(t,e,n,o)=>t.removeEventListener(e,n,o)},i=(()=>(l.head.attachShadow+"").includes("[native"))(),c=(()=>{try{return new CSSStyleSheet,!0}catch(t){}return!1})(),a=new WeakMap,u=t=>a.get(t),f=(t,e)=>a.set(e.s=t,e),m=t=>console.error(t),p=new Map,d=new Map,h=[],$=[],w=[],y=(t,e)=>n=>{t.push(n),o||(o=!0,e&&4&r.t?g(b):r.raf(b))},_=(t,e)=>{let n=0,o=0;for(;n<t.length&&(o=performance.now())<e;)try{t[n++](o)}catch(s){m(s)}n===t.length?t.length=0:0!==n&&t.splice(0,n)},b=()=>{n++,(t=>{for(let n=0;n<t.length;n++)try{t[n](performance.now())}catch(e){m(e)}t.length=0})(h);const t=2==(6&r.t)?performance.now()+10*Math.ceil(n*(1/22)):1/0;_($,t),_(w,t),$.length>0&&(w.push(...$),$.length=0),(o=h.length+$.length+w.length>0)?r.raf(b):n=0},g=t=>Promise.resolve().then(t),j=y($,!0),v={},S=t=>"object"==(t=typeof t)||"function"===t,M=()=>s.CSS&&s.CSS.supports&&s.CSS.supports("color","var(--c)")?Promise.resolve():__sc_import_msf_editor("./p-73bc5e11.js").then(()=>{r.l=s.__stencil_cssshim}),R=()=>{r.l=s.__stencil_cssshim;const t=Array.from(l.querySelectorAll("script")).find(t=>new RegExp("/msf-editor(\\.esm)?\\.js($|\\?|#)").test(t.src)||"msf-editor"===t.getAttribute("data-stencil-namespace")),e=t["data-opts"]||{};return"onbeforeload"in t&&!history.scrollRestoration?{then(){}}:(e.resourcesUrl=new URL(".",new URL(t.getAttribute("data-resources-url")||t.src,s.location.href)).href,P(e.resourcesUrl,t),window.customElements?Promise.resolve(e):__sc_import_msf_editor("./p-3b66a627.js").then(()=>e))},P=(t,e)=>{const n=(()=>`__sc_import_${"msf-editor".replace(/\s|-/g,"_")}`)();try{s[n]=new Function("w",`return import(w);//${Math.random()}`)}catch(o){const r=new Map;s[n]=o=>{const i=new URL(o,t).href;let c=r.get(i);if(!c){const t=l.createElement("script");t.type="module",t.crossOrigin=e.crossOrigin,t.src=URL.createObjectURL(new Blob([`import * as m from '${i}'; window.${n}.m = m;`],{type:"application/javascript"})),c=new Promise(e=>{t.onload=()=>{e(s[n].m),t.remove()}}),r.set(i,c),l.head.appendChild(t)}return c}}},L=new WeakMap,O=t=>"sc-"+t,U=(t,e,...n)=>{let o=null,s=!1,l=!1,r=[];const i=e=>{for(let n=0;n<e.length;n++)o=e[n],Array.isArray(o)?i(o):null!=o&&"boolean"!=typeof o&&((s="function"!=typeof t&&!S(o))&&(o=String(o)),s&&l?r[r.length-1].i+=o:r.push(s?k(null,o):o),l=s)};if(i(n),e){const t=e.className||e.class;t&&(e.class="object"!=typeof t?t:Object.keys(t).filter(e=>t[e]).join(" "))}const c=k(t,null);return c.u=e,r.length>0&&(c.p=r),c},k=(t,e)=>({t:0,h:t,i:e,$:null,p:null,u:null}),x={},C=(t,e,n,o,s,l)=>{if(n===o)return;let r=((t,e)=>e in t)(t,e);if(e.toLowerCase(),"class"===e){const e=t.classList,s=A(n),l=A(o);e.remove(...s.filter(t=>t&&!l.includes(t))),e.add(...l.filter(t=>t&&!s.includes(t)))}else{const c=S(o);if((r||c&&null!==o)&&!s)try{if(t.tagName.includes("-"))t[e]=o;else{let s=null==o?"":o;"list"===e?r=!1:null!=n&&t[e]==s||(t[e]=s)}}catch(i){}null==o||!1===o?t.removeAttribute(e):(!r||4&l||s)&&!c&&t.setAttribute(e,o=!0===o?"":o)}},W=/\s/,A=t=>t?t.split(W):[],E=(t,e,n,o)=>{const s=11===e.$.nodeType&&e.$.host?e.$.host:e.$,l=t&&t.u||v,r=e.u||v;for(o in l)o in r||C(s,o,l[o],void 0,n,e.t);for(o in r)C(s,o,l[o],r[o],n,e.t)},T=(e,n,o)=>{let s,r,i=n.p[o],c=0;if(s=i.$=l.createElement(i.h),E(null,i,!1),(t=>null!=t)(t)&&s["s-si"]!==t&&s.classList.add(s["s-si"]=t),i.p)for(c=0;c<i.p.length;++c)(r=T(e,i,c))&&s.appendChild(r);return s},F=(t,n,o,s,l,r)=>{let i,c=t;for(c.shadowRoot&&c.tagName===e&&(c=c.shadowRoot);l<=r;++l)s[l]&&(i=T(null,o,l))&&(s[l].$=i,c.insertBefore(i,n))},q=(t,e,n,o)=>{for(;e<=n;++e)(o=t[e])&&o.$.remove()},B=(t,e)=>t.h===e.h,H=(t,e)=>{const n=e.$=t.$,o=t.p,s=e.p;E(t,e,!1),null!==o&&null!==s?((t,e,n,o)=>{let s,l=0,r=0,i=e.length-1,c=e[0],a=e[i],u=o.length-1,f=o[0],m=o[u];for(;l<=i&&r<=u;)null==c?c=e[++l]:null==a?a=e[--i]:null==f?f=o[++r]:null==m?m=o[--u]:B(c,f)?(H(c,f),c=e[++l],f=o[++r]):B(a,m)?(H(a,m),a=e[--i],m=o[--u]):B(c,m)?(H(c,m),t.insertBefore(c.$,a.$.nextSibling),c=e[++l],m=o[--u]):B(a,f)?(H(a,f),t.insertBefore(a.$,c.$),a=e[--i],f=o[++r]):(s=T(e&&e[r],n,r),f=o[++r],s&&c.$.parentNode.insertBefore(s,c.$));l>i?F(t,null==o[u+1]?null:o[u+1].$,n,o,r,u):r>u&&q(e,l,i)})(n,o,e,s):null!==s?F(n,null,e,s,0,s.length-1):null!==o&&q(o,0,o.length-1)},N=(t,e)=>{e&&!t._&&e["s-p"].push(new Promise(e=>t._=e))},V=(t,e,n,o)=>{if(e.t|=16,4&e.t)return void(e.t|=512);const s=e.s,l=()=>z(t,e,n,s,o);let r;return N(e,e.g),o&&(e.t|=256,e.j&&(e.j.forEach(([t,e])=>J(s,t,e)),e.j=null),r=J(s,"componentWillLoad")),r=K(r,()=>J(s,"componentWillRender")),K(r,()=>j(l))},z=(n,o,s,r,c)=>{const a=n["s-rc"];c&&((t,e)=>{const n=((t,e)=>{let n=O(e.v),o=d.get(n);if(t=11===t.nodeType?t:l,o)if("string"==typeof o){let e,s=L.get(t=t.head||t);s||L.set(t,s=new Set),s.has(n)||((e=l.createElement("style")).innerHTML=o,t.insertBefore(e,t.querySelector("link")),s&&s.add(n))}else t.adoptedStyleSheets.includes(o)||(t.adoptedStyleSheets=[...t.adoptedStyleSheets,o]);return n})(i&&t.shadowRoot?t.shadowRoot:t.getRootNode(),e);10&e.t&&(t["s-sc"]=n,t.classList.add(n+"-h"))})(n,s),((n,o,s,l)=>{e=n.tagName;const r=o.S||k(null,null),i=(t=>t&&t.h===x)(l)?l:U(null,null,l);i.h=null,i.t|=4,o.S=i,i.$=r.$=n.shadowRoot||n,t=n["s-sc"],H(r,i)})(n,o,0,D(r)),o.t&=-17,o.t|=2,a&&(a.forEach(t=>t()),n["s-rc"]=void 0);{const t=n["s-p"],e=()=>G(n,o,s);0===t.length?e():(Promise.all(t).then(e),o.t|=4,t.length=0)}},D=t=>{try{t=t.render()}catch(e){m(e)}return t},G=(t,e,n)=>{const o=e.g;64&e.t||(e.t|=64,t.classList.add("hydrated"),e.M(t),o||I()),e.R(t),e._&&(e._(),e._=void 0),512&e.t&&g(()=>V(t,e,n,!1)),e.t&=-517},I=()=>{l.documentElement.classList.add("hydrated"),r.t|=2},J=(t,e,n)=>{if(t&&t[e])try{return t[e](n)}catch(o){m(o)}},K=(t,e)=>t&&t.then?t.then(e):e(),Q=(t,e,n)=>{if(e.P){const o=Object.entries(e.P),s=t.prototype;if(o.forEach(([t,[o]])=>{31&o||2&n&&32&o?Object.defineProperty(s,t,{get(){return((t,e)=>u(t).L.get(e))(this,t)},set(n){((t,e,n,o)=>{const s=u(this),l=s.O,r=s.L.get(e),i=s.t,c=s.s;(n=((t,e)=>null==t||S(t)?t:1&e?String(t):t)(n,o.P[e][0]))===r||8&i&&void 0!==r||(s.L.set(e,n),c&&2==(18&i)&&V(l,s,o,!1))})(0,t,n,e)},configurable:!0,enumerable:!0}):1&n&&64&o&&Object.defineProperty(s,t,{value(...e){const n=u(this);return n.U.then(()=>n.s[t](...e))}})}),1&n){const e=new Map;s.attributeChangedCallback=function(t,n,o){r.jmp(()=>{const n=e.get(t);this[n]=(null!==o||"boolean"!=typeof this[n])&&o})},t.observedAttributes=o.filter(([t,e])=>15&e[0]).map(([t,n])=>{const o=n[1]||t;return e.set(o,t),o})}}return t},X=(t,e={})=>{const n=[],o=e.exclude||[],f=l.head,h=s.customElements,$=f.querySelector("meta[charset]"),w=l.createElement("style"),y=[];let _,b=!0;Object.assign(r,e),r.o=new URL(e.resourcesUrl||"./",l.baseURI).href,e.syncQueue&&(r.t|=4),t.forEach(t=>t[1].forEach(e=>{const l={t:e[0],v:e[1],P:e[2],k:e[3]};l.P=e[2],l.k=e[3],!i&&1&l.t&&(l.t|=8);const f=l.v,$=class extends HTMLElement{constructor(t){super(t),(t=>{const e={t:0,O:t,L:new Map};e.U=new Promise(t=>e.R=t),e.C=new Promise(t=>e.M=t),t["s-p"]=[],t["s-rc"]=[],a.set(t,e)})(t=this),1&l.t&&(i?t.attachShadow({mode:"open"}):"shadowRoot"in t||(t.shadowRoot=t))}connectedCallback(){_&&(clearTimeout(_),_=null),b?y.push(this):r.jmp(()=>((t,e)=>{if(0==(1&r.t)){const n=()=>{},o=u(t);if(e.k&&(o.W=((t,e,n)=>{e.j=e.j||[];const o=n.map(([n,o,l])=>{const i=((t,e)=>8&e?s:t)(t,n),c=((t,e)=>n=>{256&t.t?t.s[e](n):t.j.push([e,n])})(e,l),a=(t=>({passive:0!=(1&t),capture:0!=(2&t)}))(n);return r.ael(i,o,c,a),()=>r.rel(i,o,c,a)});return()=>o.forEach(t=>t())})(t,o,e.k)),!(1&o.t)){o.t|=1;{let e=t;for(;e=e.parentNode||e.host;)if(e["s-p"]){N(o,o.g=e);break}}e.P&&Object.entries(e.P).forEach(([e,[n]])=>{if(31&n&&t.hasOwnProperty(e)){const n=t[e];delete t[e],t[e]=n}}),g(()=>(async(t,e,n,o,s)=>{if(0==(32&e.t)){e.t|=32;{if((s=(t=>{const e=t.v.replace(/-/g,"_"),n=t.A,o=p.get(n);return o?o[e]:__sc_import_msf_editor(`./${n}.entry.js`).then(t=>(p.set(n,t),t[e]),m)})(n)).then){const t=()=>{};s=await s,t()}s.isProxied||(Q(s,n,2),s.isProxied=!0);const t=()=>{};e.t|=8;try{new s(e)}catch(i){m(i)}e.t&=-9,t()}const t=O(n.v);if(!d.has(t)&&s.style){const e=()=>{};let o=s.style;8&n.t&&(o=await __sc_import_msf_editor("./p-affe7c09.js").then(e=>e.scopeCss(o,t,!1))),((t,e,n)=>{let o=d.get(t);c&&n?(o=o||new CSSStyleSheet).replace(e):o=e,d.set(t,o)})(t,o,!!(1&n.t)),e()}}const l=e.g,r=()=>V(t,e,n,!0);l&&l["s-rc"]?l["s-rc"].push(r):r()})(t,o,e))}n()}})(this,l))}disconnectedCallback(){r.jmp(()=>(()=>{if(0==(1&r.t)){const t=u(this);t.W&&(t.W(),t.W=void 0)}})())}forceUpdate(){((t,e)=>{{const n=u(t);n.O.isConnected&&2==(18&n.t)&&V(t,n,e,!1)}})(this,l)}componentOnReady(){return u(this).C}};l.A=t[0],o.includes(f)||h.get(f)||(n.push(f),h.define(f,Q($,l,1)))})),w.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",w.setAttribute("data-styles",""),f.insertBefore(w,$?$.nextSibling:f.firstChild),b=!1,y.length>0?y.forEach(t=>t.connectedCallback()):r.jmp(()=>_=setTimeout(I,30,"timeout"))},Y=t=>u(t).O;export{M as a,X as b,Y as g,U as h,R as p,f as r};
import{r as s,h as t,g as i}from"./p-59462e17.js";const e=class{constructor(t){s(this,t),this.content="",this.modalOpen=!1}sendMessage(s,t){this.editorFrame.contentWindow.postMessage({action:s,data:t},"*")}async save(s={}){this.sendMessage("save",s)}async test(){console.log("Only a test")}async spinner(s){["hide","show"].includes(s)||(s="hide"),this.sendMessage("showSpinner",{behavior:s})}async start(s){this.sendMessage("load",s)}async sendTest(s){this.sendMessage("sendTest",s)}async load(s){this.sendMessage("load",s)}async preview(s){this.sendMessage("preview",s)}async initConfig(){this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise&&(this.config.rteToolbars.toolbar_0=await this.config.rteToolbars.toolbar_0),this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise&&(this.config.lang.custom=await this.config.lang.custom),this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise&&(this.config.rteToolbars.toolbar_1=await this.config.rteToolbars.toolbar_1);const s=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=s?"http://localhost:4200":this.editorUrl}async componentWillRender(){await this.initConfig(),console.info("MailStyler Plugin: load assets")}render(){return t("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})}editorDidOpen(){this.load(this.content||"").then(()=>console.log("MailStyler Plugin: Template is loaded succesfully"))}listenMessage(s){if(s.data&&s.data.action){const{action:t,data:i}=s.data;if("appOk"===t)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===t){let s=Object.assign({},this.config);Object.keys(s).filter(t=>"function"==typeof s[t]).forEach(t=>delete s[t]),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:s})}else if("appSave"===t){const s=new RegExp('bgcolor="none"',"g");i.html=i.html.replace(s,""),i.raw_html=i.raw_html.replace(s,""),"function"==typeof this.config.onSave?this.config.onSave(i.html,i.raw_html,i.json,i.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appSaveBlock"===t){const s=new RegExp('bgcolor="none"',"g");i.html=i.html.replace(s,""),i.raw_html=i.raw_html.replace(s,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(i.html,i.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===t&&(this.modalOpen="open"===i.env)}}componentWillLoad(s){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),s&&this.listenMessage(s)}get element(){return i(this)}static get style(){return":host{display:block;height:100vh}:host,iframe{width:100%;border:0}iframe{height:100%;min-width:1024px;z-index:9999;top:0}iframe.open{position:fixed}"}};export{e as ms_editor};
var __awaiter=this&&this.__awaiter||function(t,e,n,o){function r(t){return t instanceof n?t:new n((function(e){e(t)}))}return new(n||(n=Promise))((function(n,i){function s(t){try{l(o.next(t))}catch(e){i(e)}}function a(t){try{l(o["throw"](t))}catch(e){i(e)}}function l(t){t.done?n(t.value):r(t.value).then(s,a)}l((o=o.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},o,r,i,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(t){return function(e){return l([t,e])}}function l(s){if(o)throw new TypeError("Generator is already executing.");while(n)try{if(o=1,r&&(i=s[0]&2?r["return"]:s[0]?r["throw"]||((i=r["return"])&&i.call(r),0):r.next)&&!(i=i.call(r,s[1])).done)return i;if(r=0,i)s=[s[0]&2,i.value];switch(s[0]){case 0:case 1:i=s;break;case 4:n.label++;return{value:s[1],done:false};case 5:n.label++;r=s[1];s=[0];continue;case 7:s=n.ops.pop();n.trys.pop();continue;default:if(!(i=n.trys,i=i.length>0&&i[i.length-1])&&(s[0]===6||s[0]===2)){n=0;continue}if(s[0]===3&&(!i||s[1]>i[0]&&s[1]<i[3])){n.label=s[1];break}if(s[0]===6&&n.label<i[1]){n.label=i[1];i=s;break}if(i&&n.label<i[2]){n.label=i[2];n.ops.push(s);break}if(i[2])n.ops.pop();n.trys.pop();continue}s=e.call(t,n)}catch(a){s=[6,a];r=0}finally{o=i=0}if(s[0]&5)throw s[1];return{value:s[0]?s[1]:void 0,done:true}}};System.register(["./p-352415f5.system.js"],(function(t){"use strict";var e,n,o;return{setters:[function(t){e=t.r;n=t.h;o=t.g}],execute:function(){var r=t("ms_editor",function(){function t(t){e(this,t);this.content="";this.modalOpen=false}t.prototype.sendMessage=function(t,e){this.editorFrame.contentWindow.postMessage({action:t,data:e},"*")};t.prototype.save=function(t){if(t===void 0){t={}}return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("save",t);return[2]}))}))};t.prototype.test=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){console.log("Only a test");return[2]}))}))};t.prototype.spinner=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){if(!["hide","show"].includes(t)){t="hide"}this.sendMessage("showSpinner",{behavior:t});return[2]}))}))};t.prototype.start=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("load",t);return[2]}))}))};t.prototype.sendTest=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("sendTest",t);return[2]}))}))};t.prototype.load=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("load",t);return[2]}))}))};t.prototype.preview=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("preview",t);return[2]}))}))};t.prototype.initConfig=function(){return __awaiter(this,void 0,void 0,(function(){var t,e,n,o;return __generator(this,(function(r){switch(r.label){case 0:if(!(this.config.rteToolbars&&this.config.rteToolbars.toolbar_0&&this.config.rteToolbars.toolbar_0 instanceof Promise))return[3,2];t=this.config.rteToolbars;return[4,this.config.rteToolbars.toolbar_0];case 1:t.toolbar_0=r.sent();r.label=2;case 2:if(!(this.config.lang&&this.config.lang.custom&&this.config.lang.custom instanceof Promise))return[3,4];e=this.config.lang;return[4,this.config.lang.custom];case 3:e.custom=r.sent();r.label=4;case 4:if(!(this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise))return[3,6];n=this.config.rteToolbars;return[4,this.config.rteToolbars.toolbar_1];case 5:n.toolbar_1=r.sent();r.label=6;case 6:o=typeof this.config.debug!=="undefined"&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com";this.mscFrameworkUrl=o?"http://localhost:4200":this.editorUrl;return[2]}}))}))};t.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return[4,this.initConfig()];case 1:t.sent();console.info("MailStyler Plugin: load assets");return[2]}}))}))};t.prototype.render=function(){return n("iframe",{class:{open:this.modalOpen},src:this.mscFrameworkUrl})};t.prototype.editorDidOpen=function(){var t=this.content||"";this.load(t).then((function(t){return console.log("MailStyler Plugin: Template is loaded succesfully")}))};t.prototype.listenMessage=function(t){if(t.data&&t.data.action){var e=t.data,n=e.action,o=e.data;if(n==="appOk"){console.info("MailStyler Plugin: Editor is ready!");this.editorDidOpen()}else if(n==="appReady"){var r=Object.assign({},this.config);Object.keys(r).filter((function(t){return typeof r[t]==="function"})).forEach((function(t){return delete r[t]}));this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:r})}else if(n==="appSave"){var i=new RegExp('bgcolor="none"',"g");o.html=o.html.replace(i,"");o.raw_html=o.raw_html.replace(i,"");if("function"==typeof this.config.onSave){this.config.onSave(o.html,o.raw_html,o.json,o.opts)}else{console.error("MailStyler Plugin: You should provide a valid onSave callback")}}else if(n==="appSaveBlock"){var i=new RegExp('bgcolor="none"',"g");o.html=o.html.replace(i,"");o.raw_html=o.raw_html.replace(i,"");if("function"==typeof this.config.onSaveBlock){this.config.onSaveBlock(o.html,o.raw_html)}else{console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}}else if(n==="appModal"){this.modalOpen=o.env==="open"}}};t.prototype.componentWillLoad=function(t){this.editorFrame=this.element.shadowRoot.querySelector("iframe");if(t){this.listenMessage(t)}};Object.defineProperty(t.prototype,"element",{get:function(){return o(this)},enumerable:true,configurable:true});Object.defineProperty(t,"style",{get:function(){return":host{display:block;height:100vh}:host,iframe{width:100%;border:0}iframe{height:100%;min-width:1024px;z-index:9999;top:0}iframe.open{position:fixed}"},enumerable:true,configurable:true});return t}())}}}));

Sorry, the diff of this file is too big to display