msf-editor
Advanced tools
| 'use strict'; | ||
| function _interopNamespace(e) { | ||
| if (e && e.__esModule) return e; | ||
| var n = Object.create(null); | ||
| if (e) { | ||
| Object.keys(e).forEach(function (k) { | ||
| if (k !== 'default') { | ||
| var d = Object.getOwnPropertyDescriptor(e, k); | ||
| Object.defineProperty(n, k, d.get ? d : { | ||
| enumerable: true, | ||
| get: function () { | ||
| return e[k]; | ||
| } | ||
| }); | ||
| } | ||
| }); | ||
| } | ||
| n['default'] = e; | ||
| return Object.freeze(n); | ||
| } | ||
| const NAMESPACE = 'msf-editor'; | ||
| let scopeId; | ||
| let hostTagName; | ||
| let isSvgMode = false; | ||
| let queuePending = 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), | ||
| ce: (eventName, opts) => new CustomEvent(eventName, opts), | ||
| }; | ||
| const promiseResolve = (v) => Promise.resolve(v); | ||
| const supportsConstructibleStylesheets = /*@__PURE__*/ (() => { | ||
| try { | ||
| new CSSStyleSheet(); | ||
| return typeof new CSSStyleSheet().replace === 'function'; | ||
| } | ||
| catch (e) { } | ||
| return false; | ||
| })() | ||
| ; | ||
| const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => { | ||
| if (listeners) { | ||
| 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); | ||
| (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts)); | ||
| }); | ||
| } | ||
| }; | ||
| const hostListenerProxy = (hostRef, methodName) => (ev) => { | ||
| try { | ||
| { | ||
| 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$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); | ||
| } | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e); | ||
| } | ||
| }; | ||
| const getHostListenerTarget = (elm, flags) => { | ||
| if (flags & 8 /* TargetWindow */) | ||
| return win; | ||
| return elm; | ||
| }; | ||
| // prettier-ignore | ||
| const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0; | ||
| const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; | ||
| 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); | ||
| 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)) { | ||
| { | ||
| { | ||
| 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 = (hostRef) => { | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const elm = hostRef.$hostElement$; | ||
| const flags = cmpMeta.$flags$; | ||
| const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); | ||
| const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta); | ||
| if (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 = (cmp, mode) => 'sc-' + (cmp.$tagName$); | ||
| /** | ||
| * 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'; | ||
| }; | ||
| /** | ||
| * 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) { | ||
| let isProp = isMemberInElement(elm, memberName); | ||
| 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; | ||
| } | ||
| else if (oldValue == null || elm[memberName] != n) { | ||
| elm[memberName] = n; | ||
| } | ||
| } | ||
| else { | ||
| elm[memberName] = newValue; | ||
| } | ||
| } | ||
| catch (e) { } | ||
| } | ||
| if (newValue == null || newValue === false) { | ||
| if (newValue !== false || elm.getAttribute(memberName) === '') { | ||
| { | ||
| 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 = (hostRef, renderFnResults) => { | ||
| const hostElm = hostRef.$hostElement$; | ||
| const oldVNode = hostRef.$vnode$ || newVNode(null, null); | ||
| const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); | ||
| hostTagName = hostElm.tagName; | ||
| 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 getElement = (ref) => (getHostRef(ref).$hostElement$ ); | ||
| const createEvent = (ref, name, flags) => { | ||
| const elm = getElement(ref); | ||
| return { | ||
| emit: (detail) => { | ||
| return emitEvent(elm, name, { | ||
| bubbles: !!(flags & 4 /* Bubbles */), | ||
| composed: !!(flags & 2 /* Composed */), | ||
| cancelable: !!(flags & 1 /* Cancellable */), | ||
| detail, | ||
| }); | ||
| }, | ||
| }; | ||
| }; | ||
| /** | ||
| * Helper function to create & dispatch a custom Event on a provided target | ||
| * @param elm the target of the Event | ||
| * @param name the name to give the custom Event | ||
| * @param opts options for configuring a custom Event | ||
| * @returns the custom Event | ||
| */ | ||
| const emitEvent = (elm, name, opts) => { | ||
| const ev = plt.ce(name, opts); | ||
| elm.dispatchEvent(ev); | ||
| return ev; | ||
| }; | ||
| const attachToAncestor = (hostRef, ancestorComponent) => { | ||
| if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { | ||
| ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r))); | ||
| } | ||
| }; | ||
| const scheduleUpdate = (hostRef, isInitialLoad) => { | ||
| { | ||
| hostRef.$flags$ |= 16 /* isQueuedForUpdate */; | ||
| } | ||
| if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { | ||
| hostRef.$flags$ |= 512 /* needsRerender */; | ||
| return; | ||
| } | ||
| attachToAncestor(hostRef, hostRef.$ancestorComponent$); | ||
| // there is no ancestor component or the ancestor component | ||
| // has already fired off its lifecycle update then | ||
| // fire off the initial update | ||
| const dispatch = () => dispatchHooks(hostRef, isInitialLoad); | ||
| return writeTask(dispatch) ; | ||
| }; | ||
| const dispatchHooks = (hostRef, isInitialLoad) => { | ||
| const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| let promise; | ||
| if (isInitialLoad) { | ||
| { | ||
| hostRef.$flags$ |= 256 /* isListenReady */; | ||
| if (hostRef.$queuedListeners$) { | ||
| hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event)); | ||
| hostRef.$queuedListeners$ = null; | ||
| } | ||
| } | ||
| { | ||
| promise = safeCall(instance, 'componentWillLoad'); | ||
| } | ||
| } | ||
| { | ||
| promise = then(promise, () => safeCall(instance, 'componentWillRender')); | ||
| } | ||
| endSchedule(); | ||
| return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); | ||
| }; | ||
| const updateComponent = async (hostRef, instance, isInitialLoad) => { | ||
| // updateComponent | ||
| const elm = hostRef.$hostElement$; | ||
| const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); | ||
| const rc = elm['s-rc']; | ||
| if (isInitialLoad) { | ||
| // DOM WRITE! | ||
| attachStyles(hostRef); | ||
| } | ||
| const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$); | ||
| { | ||
| callRender(hostRef, instance); | ||
| } | ||
| 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.map((cb) => cb()); | ||
| elm['s-rc'] = undefined; | ||
| } | ||
| endRender(); | ||
| endUpdate(); | ||
| { | ||
| const childrenPromises = elm['s-p']; | ||
| const postUpdate = () => postUpdateComponent(hostRef); | ||
| if (childrenPromises.length === 0) { | ||
| postUpdate(); | ||
| } | ||
| else { | ||
| Promise.all(childrenPromises).then(postUpdate); | ||
| hostRef.$flags$ |= 4 /* isWaitingForChildren */; | ||
| childrenPromises.length = 0; | ||
| } | ||
| } | ||
| }; | ||
| const callRender = (hostRef, instance, elm) => { | ||
| try { | ||
| instance = instance.render() ; | ||
| { | ||
| hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; | ||
| } | ||
| { | ||
| hostRef.$flags$ |= 2 /* hasRendered */; | ||
| } | ||
| { | ||
| { | ||
| // 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(hostRef, instance); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e, hostRef.$hostElement$); | ||
| } | ||
| return null; | ||
| }; | ||
| const postUpdateComponent = (hostRef) => { | ||
| const tagName = hostRef.$cmpMeta$.$tagName$; | ||
| const elm = hostRef.$hostElement$; | ||
| const endPostUpdate = createTime('postUpdate', tagName); | ||
| const ancestorComponent = hostRef.$ancestorComponent$; | ||
| if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { | ||
| hostRef.$flags$ |= 64 /* hasLoadedComponent */; | ||
| { | ||
| // DOM WRITE! | ||
| addHydratedFlag(elm); | ||
| } | ||
| 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(hostRef, false)); | ||
| } | ||
| hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); | ||
| } | ||
| // ( •_•) | ||
| // ( •_•)>⌐■-■ | ||
| // (⌐■_■) | ||
| }; | ||
| const appDidLoad = (who) => { | ||
| // on appload | ||
| // we have finish the first big initial render | ||
| { | ||
| addHydratedFlag(doc.documentElement); | ||
| } | ||
| nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); | ||
| }; | ||
| 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 addHydratedFlag = (elm) => elm.classList.add('hydrated') | ||
| ; | ||
| /** | ||
| * Parse a new property value for a given property type. | ||
| * | ||
| * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned, | ||
| * it is not safe to assume that the string returned by evaluating `typeof propValue` matches: | ||
| * 1. `any`, the type given to `propValue` in the function signature | ||
| * 2. the type stored from `propType`. | ||
| * | ||
| * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type. | ||
| * | ||
| * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to | ||
| * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is | ||
| * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`. | ||
| * ```tsx | ||
| * <my-cmp prop-val={0}></my-cmp> | ||
| * ``` | ||
| * | ||
| * HTML prop values on the other hand, will always a string | ||
| * | ||
| * @param propValue the new value to coerce to some type | ||
| * @param propType the type of the prop, expressed as a binary number | ||
| * @returns the parsed/coerced value | ||
| */ | ||
| 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 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 oldVal = hostRef.$instanceValues$.get(propName); | ||
| const flags = hostRef.$flags$; | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); | ||
| // explicitly check for NaN on both sides, as `NaN === NaN` is always false | ||
| const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal); | ||
| const didValueChange = newVal !== oldVal && !areBothNaN; | ||
| if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) { | ||
| // 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(hostRef, 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.map(([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); | ||
| // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback | ||
| // in the case where an attribute was set inline. | ||
| // ```html | ||
| // <my-component some-attribute="some-value"></my-component> | ||
| // ``` | ||
| // | ||
| // There is an edge case where a developer sets the attribute inline on a custom element and then | ||
| // programmatically changes it before it has been upgraded as shown below: | ||
| // | ||
| // ```html | ||
| // <!-- this component has _not_ been upgraded yet --> | ||
| // <my-component id="test" some-attribute="some-value"></my-component> | ||
| // <script> | ||
| // // grab non-upgraded component | ||
| // el = document.querySelector("#test"); | ||
| // el.someAttribute = "another-value"; | ||
| // // upgrade component | ||
| // customElements.define('my-component', MyComponent); | ||
| // </script> | ||
| // ``` | ||
| // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback | ||
| // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value") | ||
| // to the value that was set inline i.e. "some-value" from above example. When | ||
| // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value" | ||
| // | ||
| // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed | ||
| // by connectedCallback as this attributeChangedCallback will not fire. | ||
| // | ||
| // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties | ||
| // | ||
| // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to | ||
| // properties here given that this goes against best practices outlined here | ||
| // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy | ||
| if (this.hasOwnProperty(propName)) { | ||
| newValue = this[propName]; | ||
| delete this[propName]; | ||
| } | ||
| else if (prototype.hasOwnProperty(propName) && | ||
| typeof this[propName] === 'number' && | ||
| this[propName] == newValue) { | ||
| // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native | ||
| // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in | ||
| // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props. | ||
| return; | ||
| } | ||
| 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 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(); | ||
| } | ||
| if (Cstr.style) { | ||
| // this component has styles but we haven't registered them yet | ||
| let style = Cstr.style; | ||
| const scopeId = getScopeId(cmpMeta); | ||
| if (!styles.has(scopeId)) { | ||
| const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); | ||
| registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)); | ||
| endRegisterStyles(); | ||
| } | ||
| } | ||
| } | ||
| // we've successfully created a lazy instance | ||
| const ancestorComponent = hostRef.$ancestorComponent$; | ||
| const schedule = () => scheduleUpdate(hostRef, true); | ||
| if (ancestorComponent && ancestorComponent['s-rc']) { | ||
| // this is the initial 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) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); | ||
| 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$).map(([memberName, [memberFlags]]) => { | ||
| if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) { | ||
| const value = elm[memberName]; | ||
| delete elm[memberName]; | ||
| elm[memberName] = value; | ||
| } | ||
| }); | ||
| } | ||
| { | ||
| initializeComponent(elm, hostRef, cmpMeta); | ||
| } | ||
| } | ||
| else { | ||
| // not the first time this has connected | ||
| // reattach any event listeners to the host | ||
| // since they would have been removed when disconnected | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| } | ||
| endConnected(); | ||
| } | ||
| }; | ||
| const disconnectedCallback = (elm) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| { | ||
| if (hostRef.$rmListeners$) { | ||
| hostRef.$rmListeners$.map((rmListener) => rmListener()); | ||
| hostRef.$rmListeners$ = undefined; | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| const bootstrapLazy = (lazyBundles, options = {}) => { | ||
| const endBootstrap = createTime(); | ||
| const cmpTags = []; | ||
| const exclude = options.exclude || []; | ||
| const customElements = win.customElements; | ||
| const head = doc.head; | ||
| const metaCharset = /*@__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; | ||
| lazyBundles.map((lazyBundle) => { | ||
| lazyBundle[1].map((compactMeta) => { | ||
| const cmpMeta = { | ||
| $flags$: compactMeta[0], | ||
| $tagName$: compactMeta[1], | ||
| $members$: compactMeta[2], | ||
| $listeners$: compactMeta[3], | ||
| }; | ||
| { | ||
| cmpMeta.$members$ = compactMeta[2]; | ||
| } | ||
| { | ||
| cmpMeta.$listeners$ = compactMeta[3]; | ||
| } | ||
| const tagName = cmpMeta.$tagName$; | ||
| const HostElement = class extends HTMLElement { | ||
| // StencilLazyHost | ||
| constructor(self) { | ||
| // @ts-ignore | ||
| super(self); | ||
| self = this; | ||
| registerHost(self, cmpMeta); | ||
| 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 | ||
| { | ||
| { | ||
| self.attachShadow({ mode: 'open' }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| 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)); | ||
| } | ||
| } | ||
| disconnectedCallback() { | ||
| plt.jmp(() => disconnectedCallback(this)); | ||
| } | ||
| componentOnReady() { | ||
| return getHostRef(this).$onReadyPromise$; | ||
| } | ||
| }; | ||
| cmpMeta.$lazyBundleId$ = lazyBundle[0]; | ||
| if (!exclude.includes(tagName) && !customElements.get(tagName)) { | ||
| cmpTags.push(tagName); | ||
| customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); | ||
| } | ||
| }); | ||
| }); | ||
| { | ||
| visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; | ||
| visibilityStyle.setAttribute('data-styles', ''); | ||
| head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); | ||
| } | ||
| // Process deferred connectedCallbacks now all components have been registered | ||
| isBootstrapping = false; | ||
| if (deferredConnectedCallbacks.length) { | ||
| deferredConnectedCallbacks.map((host) => host.connectedCallback()); | ||
| } | ||
| else { | ||
| { | ||
| plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); | ||
| } | ||
| } | ||
| // Fallback appLoad event | ||
| endBootstrap(); | ||
| }; | ||
| const hostRefs = new WeakMap(); | ||
| const getHostRef = (ref) => hostRefs.get(ref); | ||
| const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); | ||
| const registerHost = (elm, cmpMeta) => { | ||
| const hostRef = { | ||
| $flags$: 0, | ||
| $hostElement$: elm, | ||
| $cmpMeta$: cmpMeta, | ||
| $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'] = []; | ||
| } | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| return hostRefs.set(elm, hostRef); | ||
| }; | ||
| const isMemberInElement = (elm, memberName) => memberName in elm; | ||
| const consoleError = (e, el) => (0, console.error)(e, el); | ||
| const cmpModules = /*@__PURE__*/ new Map(); | ||
| const loadModule = (cmpMeta, hostRef, hmrVersionId) => { | ||
| // loadModuleImport | ||
| const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); | ||
| const bundleId = cmpMeta.$lazyBundleId$; | ||
| const module = cmpModules.get(bundleId) ; | ||
| if (module) { | ||
| return module[exportName]; | ||
| } | ||
| return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require( | ||
| /* webpackInclude: /\.entry\.js$/ */ | ||
| /* webpackExclude: /\.system\.entry\.js$/ */ | ||
| /* webpackMode: "lazy" */ | ||
| `./${bundleId}.entry.js${''}`)); }).then((importedModule) => { | ||
| { | ||
| cmpModules.set(bundleId, importedModule); | ||
| } | ||
| return importedModule[exportName]; | ||
| }, consoleError); | ||
| }; | ||
| const styles = new Map(); | ||
| const queueDomReads = []; | ||
| const queueDomWrites = []; | ||
| 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 flush = () => { | ||
| // 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); | ||
| // DOM WRITES!!! | ||
| { | ||
| consume(queueDomWrites); | ||
| if ((queuePending = queueDomReads.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); | ||
| } | ||
| } | ||
| }; | ||
| const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb); | ||
| const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); | ||
| exports.bootstrapLazy = bootstrapLazy; | ||
| exports.createEvent = createEvent; | ||
| exports.getElement = getElement; | ||
| exports.h = h; | ||
| exports.promiseResolve = promiseResolve; | ||
| exports.registerInstance = registerInstance; |
| const NAMESPACE = 'msf-editor'; | ||
| let scopeId; | ||
| let hostTagName; | ||
| let isSvgMode = false; | ||
| let queuePending = 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), | ||
| ce: (eventName, opts) => new CustomEvent(eventName, opts), | ||
| }; | ||
| const promiseResolve = (v) => Promise.resolve(v); | ||
| const supportsConstructibleStylesheets = /*@__PURE__*/ (() => { | ||
| try { | ||
| new CSSStyleSheet(); | ||
| return typeof new CSSStyleSheet().replace === 'function'; | ||
| } | ||
| catch (e) { } | ||
| return false; | ||
| })() | ||
| ; | ||
| const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => { | ||
| if (listeners) { | ||
| 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); | ||
| (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts)); | ||
| }); | ||
| } | ||
| }; | ||
| const hostListenerProxy = (hostRef, methodName) => (ev) => { | ||
| try { | ||
| { | ||
| 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$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); | ||
| } | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e); | ||
| } | ||
| }; | ||
| const getHostListenerTarget = (elm, flags) => { | ||
| if (flags & 8 /* TargetWindow */) | ||
| return win; | ||
| return elm; | ||
| }; | ||
| // prettier-ignore | ||
| const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0; | ||
| const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; | ||
| 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); | ||
| 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)) { | ||
| { | ||
| { | ||
| 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 = (hostRef) => { | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const elm = hostRef.$hostElement$; | ||
| const flags = cmpMeta.$flags$; | ||
| const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); | ||
| const scopeId = addStyle(elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta); | ||
| if (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 = (cmp, mode) => 'sc-' + (cmp.$tagName$); | ||
| /** | ||
| * 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'; | ||
| }; | ||
| /** | ||
| * 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) { | ||
| let isProp = isMemberInElement(elm, memberName); | ||
| 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; | ||
| } | ||
| else if (oldValue == null || elm[memberName] != n) { | ||
| elm[memberName] = n; | ||
| } | ||
| } | ||
| else { | ||
| elm[memberName] = newValue; | ||
| } | ||
| } | ||
| catch (e) { } | ||
| } | ||
| if (newValue == null || newValue === false) { | ||
| if (newValue !== false || elm.getAttribute(memberName) === '') { | ||
| { | ||
| 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 = (hostRef, renderFnResults) => { | ||
| const hostElm = hostRef.$hostElement$; | ||
| const oldVNode = hostRef.$vnode$ || newVNode(null, null); | ||
| const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); | ||
| hostTagName = hostElm.tagName; | ||
| 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 getElement = (ref) => (getHostRef(ref).$hostElement$ ); | ||
| const createEvent = (ref, name, flags) => { | ||
| const elm = getElement(ref); | ||
| return { | ||
| emit: (detail) => { | ||
| return emitEvent(elm, name, { | ||
| bubbles: !!(flags & 4 /* Bubbles */), | ||
| composed: !!(flags & 2 /* Composed */), | ||
| cancelable: !!(flags & 1 /* Cancellable */), | ||
| detail, | ||
| }); | ||
| }, | ||
| }; | ||
| }; | ||
| /** | ||
| * Helper function to create & dispatch a custom Event on a provided target | ||
| * @param elm the target of the Event | ||
| * @param name the name to give the custom Event | ||
| * @param opts options for configuring a custom Event | ||
| * @returns the custom Event | ||
| */ | ||
| const emitEvent = (elm, name, opts) => { | ||
| const ev = plt.ce(name, opts); | ||
| elm.dispatchEvent(ev); | ||
| return ev; | ||
| }; | ||
| const attachToAncestor = (hostRef, ancestorComponent) => { | ||
| if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { | ||
| ancestorComponent['s-p'].push(new Promise((r) => (hostRef.$onRenderResolve$ = r))); | ||
| } | ||
| }; | ||
| const scheduleUpdate = (hostRef, isInitialLoad) => { | ||
| { | ||
| hostRef.$flags$ |= 16 /* isQueuedForUpdate */; | ||
| } | ||
| if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { | ||
| hostRef.$flags$ |= 512 /* needsRerender */; | ||
| return; | ||
| } | ||
| attachToAncestor(hostRef, hostRef.$ancestorComponent$); | ||
| // there is no ancestor component or the ancestor component | ||
| // has already fired off its lifecycle update then | ||
| // fire off the initial update | ||
| const dispatch = () => dispatchHooks(hostRef, isInitialLoad); | ||
| return writeTask(dispatch) ; | ||
| }; | ||
| const dispatchHooks = (hostRef, isInitialLoad) => { | ||
| const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| let promise; | ||
| if (isInitialLoad) { | ||
| { | ||
| hostRef.$flags$ |= 256 /* isListenReady */; | ||
| if (hostRef.$queuedListeners$) { | ||
| hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event)); | ||
| hostRef.$queuedListeners$ = null; | ||
| } | ||
| } | ||
| { | ||
| promise = safeCall(instance, 'componentWillLoad'); | ||
| } | ||
| } | ||
| { | ||
| promise = then(promise, () => safeCall(instance, 'componentWillRender')); | ||
| } | ||
| endSchedule(); | ||
| return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); | ||
| }; | ||
| const updateComponent = async (hostRef, instance, isInitialLoad) => { | ||
| // updateComponent | ||
| const elm = hostRef.$hostElement$; | ||
| const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); | ||
| const rc = elm['s-rc']; | ||
| if (isInitialLoad) { | ||
| // DOM WRITE! | ||
| attachStyles(hostRef); | ||
| } | ||
| const endRender = createTime('render', hostRef.$cmpMeta$.$tagName$); | ||
| { | ||
| callRender(hostRef, instance); | ||
| } | ||
| 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.map((cb) => cb()); | ||
| elm['s-rc'] = undefined; | ||
| } | ||
| endRender(); | ||
| endUpdate(); | ||
| { | ||
| const childrenPromises = elm['s-p']; | ||
| const postUpdate = () => postUpdateComponent(hostRef); | ||
| if (childrenPromises.length === 0) { | ||
| postUpdate(); | ||
| } | ||
| else { | ||
| Promise.all(childrenPromises).then(postUpdate); | ||
| hostRef.$flags$ |= 4 /* isWaitingForChildren */; | ||
| childrenPromises.length = 0; | ||
| } | ||
| } | ||
| }; | ||
| const callRender = (hostRef, instance, elm) => { | ||
| try { | ||
| instance = instance.render() ; | ||
| { | ||
| hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; | ||
| } | ||
| { | ||
| hostRef.$flags$ |= 2 /* hasRendered */; | ||
| } | ||
| { | ||
| { | ||
| // 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(hostRef, instance); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e, hostRef.$hostElement$); | ||
| } | ||
| return null; | ||
| }; | ||
| const postUpdateComponent = (hostRef) => { | ||
| const tagName = hostRef.$cmpMeta$.$tagName$; | ||
| const elm = hostRef.$hostElement$; | ||
| const endPostUpdate = createTime('postUpdate', tagName); | ||
| const ancestorComponent = hostRef.$ancestorComponent$; | ||
| if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { | ||
| hostRef.$flags$ |= 64 /* hasLoadedComponent */; | ||
| { | ||
| // DOM WRITE! | ||
| addHydratedFlag(elm); | ||
| } | ||
| 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(hostRef, false)); | ||
| } | ||
| hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); | ||
| } | ||
| // ( •_•) | ||
| // ( •_•)>⌐■-■ | ||
| // (⌐■_■) | ||
| }; | ||
| const appDidLoad = (who) => { | ||
| // on appload | ||
| // we have finish the first big initial render | ||
| { | ||
| addHydratedFlag(doc.documentElement); | ||
| } | ||
| nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); | ||
| }; | ||
| 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 addHydratedFlag = (elm) => elm.classList.add('hydrated') | ||
| ; | ||
| /** | ||
| * Parse a new property value for a given property type. | ||
| * | ||
| * While the prop value can reasonably be expected to be of `any` type as far as TypeScript's type checker is concerned, | ||
| * it is not safe to assume that the string returned by evaluating `typeof propValue` matches: | ||
| * 1. `any`, the type given to `propValue` in the function signature | ||
| * 2. the type stored from `propType`. | ||
| * | ||
| * This function provides the capability to parse/coerce a property's value to potentially any other JavaScript type. | ||
| * | ||
| * Property values represented in TSX preserve their type information. In the example below, the number 0 is passed to | ||
| * a component. This `propValue` will preserve its type information (`typeof propValue === 'number'`). Note that is | ||
| * based on the type of the value being passed in, not the type declared of the class member decorated with `@Prop`. | ||
| * ```tsx | ||
| * <my-cmp prop-val={0}></my-cmp> | ||
| * ``` | ||
| * | ||
| * HTML prop values on the other hand, will always a string | ||
| * | ||
| * @param propValue the new value to coerce to some type | ||
| * @param propType the type of the prop, expressed as a binary number | ||
| * @returns the parsed/coerced value | ||
| */ | ||
| 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 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 oldVal = hostRef.$instanceValues$.get(propName); | ||
| const flags = hostRef.$flags$; | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); | ||
| // explicitly check for NaN on both sides, as `NaN === NaN` is always false | ||
| const areBothNaN = Number.isNaN(oldVal) && Number.isNaN(newVal); | ||
| const didValueChange = newVal !== oldVal && !areBothNaN; | ||
| if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && didValueChange) { | ||
| // 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(hostRef, 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.map(([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); | ||
| // In a web component lifecycle the attributeChangedCallback runs prior to connectedCallback | ||
| // in the case where an attribute was set inline. | ||
| // ```html | ||
| // <my-component some-attribute="some-value"></my-component> | ||
| // ``` | ||
| // | ||
| // There is an edge case where a developer sets the attribute inline on a custom element and then | ||
| // programmatically changes it before it has been upgraded as shown below: | ||
| // | ||
| // ```html | ||
| // <!-- this component has _not_ been upgraded yet --> | ||
| // <my-component id="test" some-attribute="some-value"></my-component> | ||
| // <script> | ||
| // // grab non-upgraded component | ||
| // el = document.querySelector("#test"); | ||
| // el.someAttribute = "another-value"; | ||
| // // upgrade component | ||
| // customElements.define('my-component', MyComponent); | ||
| // </script> | ||
| // ``` | ||
| // In this case if we do not unshadow here and use the value of the shadowing property, attributeChangedCallback | ||
| // will be called with `newValue = "some-value"` and will set the shadowed property (this.someAttribute = "another-value") | ||
| // to the value that was set inline i.e. "some-value" from above example. When | ||
| // the connectedCallback attempts to unshadow it will use "some-value" as the initial value rather than "another-value" | ||
| // | ||
| // The case where the attribute was NOT set inline but was not set programmatically shall be handled/unshadowed | ||
| // by connectedCallback as this attributeChangedCallback will not fire. | ||
| // | ||
| // https://developers.google.com/web/fundamentals/web-components/best-practices#lazy-properties | ||
| // | ||
| // TODO(STENCIL-16) we should think about whether or not we actually want to be reflecting the attributes to | ||
| // properties here given that this goes against best practices outlined here | ||
| // https://developers.google.com/web/fundamentals/web-components/best-practices#avoid-reentrancy | ||
| if (this.hasOwnProperty(propName)) { | ||
| newValue = this[propName]; | ||
| delete this[propName]; | ||
| } | ||
| else if (prototype.hasOwnProperty(propName) && | ||
| typeof this[propName] === 'number' && | ||
| this[propName] == newValue) { | ||
| // if the propName exists on the prototype of `Cstr`, this update may be a result of Stencil using native | ||
| // APIs to reflect props as attributes. Calls to `setAttribute(someElement, propName)` will result in | ||
| // `propName` to be converted to a `DOMString`, which may not be what we want for other primitive props. | ||
| return; | ||
| } | ||
| 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 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(); | ||
| } | ||
| if (Cstr.style) { | ||
| // this component has styles but we haven't registered them yet | ||
| let style = Cstr.style; | ||
| const scopeId = getScopeId(cmpMeta); | ||
| if (!styles.has(scopeId)) { | ||
| const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); | ||
| registerStyle(scopeId, style, !!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)); | ||
| endRegisterStyles(); | ||
| } | ||
| } | ||
| } | ||
| // we've successfully created a lazy instance | ||
| const ancestorComponent = hostRef.$ancestorComponent$; | ||
| const schedule = () => scheduleUpdate(hostRef, true); | ||
| if (ancestorComponent && ancestorComponent['s-rc']) { | ||
| // this is the initial 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) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); | ||
| 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$).map(([memberName, [memberFlags]]) => { | ||
| if (memberFlags & 31 /* Prop */ && elm.hasOwnProperty(memberName)) { | ||
| const value = elm[memberName]; | ||
| delete elm[memberName]; | ||
| elm[memberName] = value; | ||
| } | ||
| }); | ||
| } | ||
| { | ||
| initializeComponent(elm, hostRef, cmpMeta); | ||
| } | ||
| } | ||
| else { | ||
| // not the first time this has connected | ||
| // reattach any event listeners to the host | ||
| // since they would have been removed when disconnected | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| } | ||
| endConnected(); | ||
| } | ||
| }; | ||
| const disconnectedCallback = (elm) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| { | ||
| if (hostRef.$rmListeners$) { | ||
| hostRef.$rmListeners$.map((rmListener) => rmListener()); | ||
| hostRef.$rmListeners$ = undefined; | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| const bootstrapLazy = (lazyBundles, options = {}) => { | ||
| const endBootstrap = createTime(); | ||
| const cmpTags = []; | ||
| const exclude = options.exclude || []; | ||
| const customElements = win.customElements; | ||
| const head = doc.head; | ||
| const metaCharset = /*@__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; | ||
| lazyBundles.map((lazyBundle) => { | ||
| lazyBundle[1].map((compactMeta) => { | ||
| const cmpMeta = { | ||
| $flags$: compactMeta[0], | ||
| $tagName$: compactMeta[1], | ||
| $members$: compactMeta[2], | ||
| $listeners$: compactMeta[3], | ||
| }; | ||
| { | ||
| cmpMeta.$members$ = compactMeta[2]; | ||
| } | ||
| { | ||
| cmpMeta.$listeners$ = compactMeta[3]; | ||
| } | ||
| const tagName = cmpMeta.$tagName$; | ||
| const HostElement = class extends HTMLElement { | ||
| // StencilLazyHost | ||
| constructor(self) { | ||
| // @ts-ignore | ||
| super(self); | ||
| self = this; | ||
| registerHost(self, cmpMeta); | ||
| 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 | ||
| { | ||
| { | ||
| self.attachShadow({ mode: 'open' }); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| 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)); | ||
| } | ||
| } | ||
| disconnectedCallback() { | ||
| plt.jmp(() => disconnectedCallback(this)); | ||
| } | ||
| componentOnReady() { | ||
| return getHostRef(this).$onReadyPromise$; | ||
| } | ||
| }; | ||
| cmpMeta.$lazyBundleId$ = lazyBundle[0]; | ||
| if (!exclude.includes(tagName) && !customElements.get(tagName)) { | ||
| cmpTags.push(tagName); | ||
| customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); | ||
| } | ||
| }); | ||
| }); | ||
| { | ||
| visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; | ||
| visibilityStyle.setAttribute('data-styles', ''); | ||
| head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); | ||
| } | ||
| // Process deferred connectedCallbacks now all components have been registered | ||
| isBootstrapping = false; | ||
| if (deferredConnectedCallbacks.length) { | ||
| deferredConnectedCallbacks.map((host) => host.connectedCallback()); | ||
| } | ||
| else { | ||
| { | ||
| plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); | ||
| } | ||
| } | ||
| // Fallback appLoad event | ||
| endBootstrap(); | ||
| }; | ||
| const hostRefs = new WeakMap(); | ||
| const getHostRef = (ref) => hostRefs.get(ref); | ||
| const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); | ||
| const registerHost = (elm, cmpMeta) => { | ||
| const hostRef = { | ||
| $flags$: 0, | ||
| $hostElement$: elm, | ||
| $cmpMeta$: cmpMeta, | ||
| $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'] = []; | ||
| } | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| return hostRefs.set(elm, hostRef); | ||
| }; | ||
| const isMemberInElement = (elm, memberName) => memberName in elm; | ||
| const consoleError = (e, el) => (0, console.error)(e, el); | ||
| const cmpModules = /*@__PURE__*/ new Map(); | ||
| const loadModule = (cmpMeta, hostRef, hmrVersionId) => { | ||
| // loadModuleImport | ||
| const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); | ||
| const bundleId = cmpMeta.$lazyBundleId$; | ||
| const module = cmpModules.get(bundleId) ; | ||
| if (module) { | ||
| return module[exportName]; | ||
| } | ||
| return import( | ||
| /* webpackInclude: /\.entry\.js$/ */ | ||
| /* webpackExclude: /\.system\.entry\.js$/ */ | ||
| /* webpackMode: "lazy" */ | ||
| `./${bundleId}.entry.js${''}`).then((importedModule) => { | ||
| { | ||
| cmpModules.set(bundleId, importedModule); | ||
| } | ||
| return importedModule[exportName]; | ||
| }, consoleError); | ||
| }; | ||
| const styles = new Map(); | ||
| const queueDomReads = []; | ||
| const queueDomWrites = []; | ||
| 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 flush = () => { | ||
| // 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); | ||
| // DOM WRITES!!! | ||
| { | ||
| consume(queueDomWrites); | ||
| if ((queuePending = queueDomReads.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); | ||
| } | ||
| } | ||
| }; | ||
| const nextTick = /*@__PURE__*/ (cb) => promiseResolve().then(cb); | ||
| const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); | ||
| export { bootstrapLazy as b, createEvent as c, getElement as g, h, promiseResolve as p, registerInstance as r }; |
| import { p as promiseResolve, b as bootstrapLazy } from './index-19dcbd9f.js'; | ||
| /* | ||
| Stencil Client Patch Esm v2.14.2 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| const patchEsm = () => { | ||
| return promiseResolve(); | ||
| }; | ||
| const defineCustomElements = (win, options) => { | ||
| if (typeof window === 'undefined') return Promise.resolve(); | ||
| return patchEsm().then(() => { | ||
| 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],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); | ||
| }; | ||
| export { defineCustomElements }; |
| import { p as promiseResolve, b as bootstrapLazy } from './index-19dcbd9f.js'; | ||
| /* | ||
| Stencil Client Patch Browser v2.14.2 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| const patchBrowser = () => { | ||
| const importMeta = import.meta.url; | ||
| const opts = {}; | ||
| if (importMeta !== '') { | ||
| opts.resourcesUrl = new URL('.', importMeta).href; | ||
| } | ||
| return promiseResolve(opts); | ||
| }; | ||
| patchBrowser().then(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],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); |
| module.exports = require('./cjs/index.cjs.js'); |
| let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const r=a(e,n),c=u(t,s),i=f(n);o.ael(r,l,c,i),(t.o=t.o||[]).push((()=>o.rel(r,l,c,i)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){J(e)}},a=(e,t)=>8&t?l:e,f=e=>0!=(2&e),h=new WeakMap,d=e=>"sc-"+e.h,m={},$=e=>"object"==(e=typeof e)||"function"===e,y=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!$(l))&&(l+=""),s&&o?r[r.length-1].m+=l:r.push(s?p(null,l):l),o=s)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=p(e,null);return i.$=t,r.length>0&&(i.p=r),i},p=(e,t)=>({t:0,S:e,m:t,g:null,p:null,$:null}),b={},w=(e,t,n,l,s,o)=>{if(n!==l){let r=I(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,s=g(n),o=g(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else{const c=$(l);if((r||c&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&o||s)&&!c&&e.setAttribute(t,l=!0===l?"":l)}}},S=/\s/,g=e=>e?e.split(S):[],j=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.$||m,r=t.$||m;for(l in o)l in r||w(s,l,o[l],void 0,n,t.t);for(l in r)w(s,l,o[l],r[l],n,t.t)},v=(t,n,l)=>{let o,r,c=n.p[l],i=0;if(o=c.g=s.createElement(c.S),j(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.p)for(i=0;i<c.p.length;++i)r=v(t,c,i),r&&o.appendChild(r);return o},M=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=v(null,l,o),c&&(s[o].g=c,i.insertBefore(c,n)))},O=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.g.remove()},k=(e,t)=>e.S===t.S,C=(e,t)=>{const n=t.g=e.g,l=e.p,s=t.p;j(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],h=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==h?h=l[--a]:k(i,f)?(C(i,f),i=t[++o],f=l[++r]):k(u,h)?(C(u,h),u=t[--c],h=l[--a]):k(i,h)?(C(i,h),e.insertBefore(i.g,u.g.nextSibling),i=t[++o],h=l[--a]):k(u,f)?(C(u,f),e.insertBefore(u.g,i.g),u=t[--c],f=l[++r]):(s=v(t&&t[r],n,r),f=l[++r],s&&i.g.parentNode.insertBefore(s,i.g));o>c?M(e,null==l[a+1]?null:l[a+1].g,n,l,r,a):r>a&&O(t,o,c)})(n,l,t,s):null!==s?M(n,null,t,s,0,s.length-1):null!==l&&O(l,0,l.length-1)},P=e=>B(e).j,W=(e,t,n)=>{const l=P(e);return{emit:e=>x(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},x=(e,t,n)=>{const l=o.ce(t,n);return e.dispatchEvent(l),l},E=(e,t)=>{t&&!e.v&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.v=t)))},L=(e,t)=>{if(e.t|=16,!(4&e.t))return E(e,e.M),se((()=>N(e,t)));e.t|=512},N=(e,t)=>{const n=e.i;let l;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>q(n,e,t))),e.u=null),l=q(n,"componentWillLoad")),l=F(l,(()=>q(n,"componentWillRender"))),F(l,(()=>R(e,n,t)))},R=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.O,n=e.j,l=t.t,o=((e,t)=>{let n=d(t),l=X.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=h.get(e=e.head||e);o||h.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);T(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>A(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},T=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.k||p(null,null),r=(e=>e&&e.S===b)(l)?l:y(null,null,l);t=s.tagName,r.S=null,r.t|=4,n.k=r,r.g=o.g=s.shadowRoot||s,e=s["s-sc"],C(o,r)})(n,l)}catch(e){J(e,n.j)}return null},A=e=>{const t=e.j,n=e.M;64&e.t||(e.t|=64,H(t),e.C(t),n||U()),e.P(t),e.v&&(e.v(),e.v=void 0),512&e.t&&le((()=>L(e,!1))),e.t&=-517},U=()=>{H(s.documentElement),le((()=>x(l,"appload",{detail:{namespace:"msf-editor"}})))},q=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){J(e)}},F=(e,t)=>e&&e.then?e.then(t):t(),H=e=>e.classList.add("hydrated"),V=(e,t,n)=>{if(t.W){const l=Object.entries(t.W),s=e.prototype;if(l.map((([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(s,e,{get(){return((e,t)=>B(this).L.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=B(e),o=s.L.get(t),r=s.t,c=s.i;n=((e,t)=>null==e||$(e)?e:1&t?e+"":e)(n,l.W[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.L.set(t,n),c&&2==(18&r)&&L(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(s,e,{value(...t){const n=B(this);return n.N.then((()=>n.i[e](...t)))}})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},_=(e,t={})=>{const n=[],r=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),h=s.createElement("style"),m=[];let $,y=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],h:t[1],W:t[2],R:t[3]};l.W=t[2],l.R=t[3];const s=l.h,a=class extends HTMLElement{constructor(e){super(e),G(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){$&&(clearTimeout($),$=null),y?m.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=B(e),n=t.O,l=()=>{};if(1&t.t)i(e,t,n.R);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){E(t,t.M=n);break}}n.W&&Object.entries(n.W).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=Q(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(V(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){J(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=d(n);if(!X.has(t)){const l=()=>{};((e,t,n)=>{let l=X.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,X.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.M,r=()=>L(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=B(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return B(this).T}};l.A=e[0],r.includes(s)||u.get(s)||(n.push(s),u.define(s,V(a,l,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),a.insertBefore(h,f?f.nextSibling:a.firstChild),y=!1,m.length?m.map((e=>e.connectedCallback())):o.jmp((()=>$=setTimeout(U,30)))},z=new WeakMap,B=e=>z.get(e),D=(e,t)=>z.set(t.i=e,t),G=(e,t)=>{const n={t:0,j:e,O:t,L:new Map};return n.N=new Promise((e=>n.P=e)),n.T=new Promise((e=>n.C=e)),e["s-p"]=[],e["s-rc"]=[],i(e,n,t.R),z.set(e,n)},I=(e,t)=>t in e,J=(e,t)=>(0,console.error)(e,t),K=new Map,Q=e=>{const t=e.h.replace(/-/g,"_"),n=e.A,l=K.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(K.set(n,e),e[t])),J)},X=new Map,Y=[],Z=[],ee=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?le(ne):o.raf(ne))},te=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){J(e)}e.length=0},ne=()=>{te(Y),te(Z),(n=Y.length>0)&&o.raf(ne)},le=e=>r().then(e),se=ee(Z,!0);export{_ as b,W as c,P as g,y as h,r as p,D as r} |
| import{r as i,c as s,h as t,g as e}from"./p-046f3240.js";const o=class{constructor(t){i(this,t),this.editorEvent=s(this,"editorEvent",7),this.content="",this.assetsLoaded=!1,this.modalOpen=!1}sendMessage(i,s){this.editorFrame.contentWindow.postMessage({action:i,data:s},"*")}async save(i={}){this.sendMessage("save",i)}async test(){console.log("Only a test")}async spinner(i){["hide","show"].includes(i)||(i="hide"),this.sendMessage("showSpinner",{behavior:i})}async start(i){this.sendMessage("load",i)}async sendTest(i){this.sendMessage("sendTest",i)}async beforeUnload(i){this.sendMessage("beforeUnload",i)}async load(i){this.sendMessage("load",i)}async preview(i){this.sendMessage("preview",i)}async initConfig(){console.info("MailStyler Plugin: loading assets .."),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 i=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=i?"http://localhost:4200":this.editorUrl,this.assetsLoaded=!0,console.info("MailStyler Plugin: assets loaded!")}async componentWillRender(){!this.assetsLoaded&&this.config&&await this.initConfig()}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(i){if(i.data&&i.data.action){const{action:s,data:t}=i.data;if("appOk"===s)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===s){let i=Object.assign({},this.config);Object.keys(i).filter((s=>"function"==typeof i[s])).forEach((s=>delete i[s])),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:i})}else if("appSave"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onSave?this.config.onSave(t.html,t.raw_html,t.json,t.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appAutoSave"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onAutoSave?this.config.onAutoSave(t.html,t.raw_html,t.json,t.opts):console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}else if("appSaveBlock"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(t.html,t.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===s&&(this.modalOpen="open"===t.env);this.editorEvent.emit({action:s,data:t})}}componentWillLoad(i){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),i&&this.listenMessage(i)}get element(){return e(this)}};o.style=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";export{o as ms_editor} |
| export * from '../dist/esm/polyfills/index.js'; | ||
| export * from '../dist/esm/loader.js'; |
| (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})(); | ||
| export * from '../dist/esm/polyfills/index.js'; | ||
| export * from '../dist/esm/loader.js'; |
@@ -5,8 +5,14 @@ 'use strict'; | ||
| const index = require('./index-199e597b.js'); | ||
| const patch = require('./patch-309befef.js'); | ||
| const index = require('./index-e2c5be8b.js'); | ||
| /* | ||
| Stencil Client Patch Esm v2.14.2 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| const patchEsm = () => { | ||
| return index.promiseResolve(); | ||
| }; | ||
| const defineCustomElements = (win, options) => { | ||
| if (typeof window === 'undefined') return Promise.resolve(); | ||
| return patch.patchEsm().then(() => { | ||
| return patchEsm().then(() => { | ||
| return index.bootstrapLazy([["ms-editor.cjs",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
@@ -13,0 +19,0 @@ }); |
+131
-131
@@ -5,3 +5,3 @@ 'use strict'; | ||
| const index = require('./index-199e597b.js'); | ||
| const index = require('./index-e2c5be8b.js'); | ||
@@ -11,143 +11,143 @@ const editorCss = ":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}"; | ||
| const Editor = class { | ||
| constructor(hostRef) { | ||
| index.registerInstance(this, hostRef); | ||
| this.editorEvent = index.createEvent(this, "editorEvent", 7); | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| constructor(hostRef) { | ||
| index.registerInstance(this, hostRef); | ||
| this.editorEvent = index.createEvent(this, "editorEvent", 7); | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| } | ||
| sendMessage(action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action, | ||
| data | ||
| }, "*"); | ||
| } | ||
| async save(opts = {}) { | ||
| this.sendMessage("save", opts); | ||
| } | ||
| async test() { | ||
| console.log("Only a test"); | ||
| } | ||
| async spinner(behavior) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| sendMessage(action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action, | ||
| data | ||
| }, "*"); | ||
| this.sendMessage("showSpinner", { | ||
| behavior | ||
| }); | ||
| } | ||
| async start(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async sendTest(data) { | ||
| this.sendMessage("sendTest", data); | ||
| } | ||
| async beforeUnload(evt) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| } | ||
| async load(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async preview(device) { | ||
| this.sendMessage("preview", device); | ||
| } | ||
| async initConfig() { | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (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; | ||
| } | ||
| async save(opts = {}) { | ||
| this.sendMessage("save", opts); | ||
| if (this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise) { | ||
| this.config.lang.custom = await this.config.lang.custom; | ||
| } | ||
| async test() { | ||
| console.log("Only a test"); | ||
| if (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; | ||
| } | ||
| async spinner(behavior) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| this.sendMessage("showSpinner", { | ||
| behavior | ||
| const isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || `//editor.mailstyler.com`; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| } | ||
| async componentWillRender() { | ||
| !this.assetsLoaded && this.config && await this.initConfig(); | ||
| } | ||
| render() { | ||
| return (index.h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| } | ||
| editorDidOpen() { | ||
| const template = this.content || ''; | ||
| this.load(template).then(_ => console.log("MailStyler Plugin: Template is loaded succesfully")); | ||
| } | ||
| listenMessage(e) { | ||
| if (e.data && e.data.action) { | ||
| const { action, data } = e.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| let editorConfig = Object.assign({}, this.config); | ||
| Object.keys(editorConfig) | ||
| .filter(key => typeof editorConfig[key] === 'function') | ||
| .forEach(key => delete editorConfig[key]); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig | ||
| }); | ||
| } | ||
| async start(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async sendTest(data) { | ||
| this.sendMessage("sendTest", data); | ||
| } | ||
| async beforeUnload(evt) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| } | ||
| async load(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async preview(device) { | ||
| this.sendMessage("preview", device); | ||
| } | ||
| async initConfig() { | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (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; | ||
| } | ||
| else if (action === "appSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| if (this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise) { | ||
| this.config.lang.custom = await this.config.lang.custom; | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| if (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; | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| const isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || `//editor.mailstyler.com`; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| } | ||
| async componentWillRender() { | ||
| !this.assetsLoaded && this.config && await this.initConfig(); | ||
| } | ||
| render() { | ||
| return (index.h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| } | ||
| editorDidOpen() { | ||
| const template = this.content || ''; | ||
| this.load(template).then(_ => console.log("MailStyler Plugin: Template is loaded succesfully")); | ||
| } | ||
| listenMessage(e) { | ||
| if (e.data && e.data.action) { | ||
| const { action, data } = e.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| let editorConfig = Object.assign({}, this.config); | ||
| Object.keys(editorConfig) | ||
| .filter(key => typeof editorConfig[key] === 'function') | ||
| .forEach(key => delete editorConfig[key]); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig | ||
| }); | ||
| } | ||
| else if (action === "appSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action, data }); | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| componentWillLoad(ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action, data }); | ||
| } | ||
| get element() { return index.getElement(this); } | ||
| } | ||
| componentWillLoad(ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| } | ||
| get element() { return index.getElement(this); } | ||
| }; | ||
@@ -154,0 +154,0 @@ Editor.style = editorCss; |
| 'use strict'; | ||
| const index = require('./index-199e597b.js'); | ||
| const patch = require('./patch-309befef.js'); | ||
| const index = require('./index-e2c5be8b.js'); | ||
| patch.patchBrowser().then(options => { | ||
| /* | ||
| Stencil Client Patch Browser v2.14.2 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| const patchBrowser = () => { | ||
| const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('msf-editor.cjs.js', document.baseURI).href)); | ||
| const opts = {}; | ||
| if (importMeta !== '') { | ||
| opts.resourcesUrl = new URL('.', importMeta).href; | ||
| } | ||
| return index.promiseResolve(opts); | ||
| }; | ||
| patchBrowser().then(options => { | ||
| return index.bootstrapLazy([["ms-editor.cjs",[[1,"ms-editor",{"token":[1],"config":[8],"content":[1],"modalOpen":[32],"save":[64],"test":[64],"spinner":[64],"start":[64],"sendTest":[64],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); |
@@ -7,4 +7,4 @@ { | ||
| "name": "@stencil/core", | ||
| "version": "1.17.4", | ||
| "typescriptVersion": "3.9.7" | ||
| "version": "2.14.2", | ||
| "typescriptVersion": "4.5.4" | ||
| }, | ||
@@ -11,0 +11,0 @@ "collections": [], |
| import { Component, Element, Event, h, Listen, Method, Prop, State } from '@stencil/core'; | ||
| export class Editor { | ||
| constructor() { | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| constructor() { | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| } | ||
| sendMessage(action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action, | ||
| data | ||
| }, "*"); | ||
| } | ||
| async save(opts = {}) { | ||
| this.sendMessage("save", opts); | ||
| } | ||
| async test() { | ||
| console.log("Only a test"); | ||
| } | ||
| async spinner(behavior) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| sendMessage(action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action, | ||
| data | ||
| }, "*"); | ||
| this.sendMessage("showSpinner", { | ||
| behavior | ||
| }); | ||
| } | ||
| async start(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async sendTest(data) { | ||
| this.sendMessage("sendTest", data); | ||
| } | ||
| async beforeUnload(evt) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| } | ||
| async load(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async preview(device) { | ||
| this.sendMessage("preview", device); | ||
| } | ||
| async initConfig() { | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (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; | ||
| } | ||
| async save(opts = {}) { | ||
| this.sendMessage("save", opts); | ||
| if (this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise) { | ||
| this.config.lang.custom = await this.config.lang.custom; | ||
| } | ||
| async test() { | ||
| console.log("Only a test"); | ||
| if (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; | ||
| } | ||
| async spinner(behavior) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| this.sendMessage("showSpinner", { | ||
| behavior | ||
| const isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || `//editor.mailstyler.com`; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| } | ||
| async componentWillRender() { | ||
| !this.assetsLoaded && this.config && await this.initConfig(); | ||
| } | ||
| render() { | ||
| return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| } | ||
| editorDidOpen() { | ||
| const template = this.content || ''; | ||
| this.load(template).then(_ => console.log("MailStyler Plugin: Template is loaded succesfully")); | ||
| } | ||
| listenMessage(e) { | ||
| if (e.data && e.data.action) { | ||
| const { action, data } = e.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| let editorConfig = Object.assign({}, this.config); | ||
| Object.keys(editorConfig) | ||
| .filter(key => typeof editorConfig[key] === 'function') | ||
| .forEach(key => delete editorConfig[key]); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig | ||
| }); | ||
| } | ||
| async start(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async sendTest(data) { | ||
| this.sendMessage("sendTest", data); | ||
| } | ||
| async beforeUnload(evt) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| } | ||
| async load(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async preview(device) { | ||
| this.sendMessage("preview", device); | ||
| } | ||
| async initConfig() { | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (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; | ||
| } | ||
| else if (action === "appSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| if (this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise) { | ||
| this.config.lang.custom = await this.config.lang.custom; | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| if (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; | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| const isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || `//editor.mailstyler.com`; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action, data }); | ||
| } | ||
| async componentWillRender() { | ||
| !this.assetsLoaded && this.config && await this.initConfig(); | ||
| } | ||
| componentWillLoad(ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| render() { | ||
| return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| } | ||
| static get is() { return "ms-editor"; } | ||
| static get encapsulation() { return "shadow"; } | ||
| static get originalStyleUrls() { return { | ||
| "$": ["editor.css"] | ||
| }; } | ||
| static get styleUrls() { return { | ||
| "$": ["editor.css"] | ||
| }; } | ||
| static get properties() { return { | ||
| "token": { | ||
| "type": "string", | ||
| "mutable": false, | ||
| "complexType": { | ||
| "original": "string", | ||
| "resolved": "string", | ||
| "references": {} | ||
| }, | ||
| "required": false, | ||
| "optional": false, | ||
| "docs": { | ||
| "tags": [], | ||
| "text": "" | ||
| }, | ||
| "attribute": "token", | ||
| "reflect": false | ||
| }, | ||
| "config": { | ||
| "type": "any", | ||
| "mutable": false, | ||
| "complexType": { | ||
| "original": "any", | ||
| "resolved": "any", | ||
| "references": {} | ||
| }, | ||
| "required": false, | ||
| "optional": false, | ||
| "docs": { | ||
| "tags": [], | ||
| "text": "" | ||
| }, | ||
| "attribute": "config", | ||
| "reflect": false | ||
| }, | ||
| "content": { | ||
| "type": "string", | ||
| "mutable": false, | ||
| "complexType": { | ||
| "original": "string", | ||
| "resolved": "string", | ||
| "references": {} | ||
| }, | ||
| "required": false, | ||
| "optional": false, | ||
| "docs": { | ||
| "tags": [], | ||
| "text": "" | ||
| }, | ||
| "attribute": "content", | ||
| "reflect": false, | ||
| "defaultValue": "''" | ||
| } | ||
| editorDidOpen() { | ||
| const template = this.content || ''; | ||
| this.load(template).then(_ => console.log("MailStyler Plugin: Template is loaded succesfully")); | ||
| } | ||
| listenMessage(e) { | ||
| if (e.data && e.data.action) { | ||
| const { action, data } = e.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| let editorConfig = Object.assign({}, this.config); | ||
| Object.keys(editorConfig) | ||
| .filter(key => typeof editorConfig[key] === 'function') | ||
| .forEach(key => delete editorConfig[key]); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig | ||
| }); | ||
| } | ||
| else if (action === "appSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action, data }); | ||
| } | ||
| } | ||
| componentWillLoad(ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| } | ||
| static get is() { return "ms-editor"; } | ||
| static get encapsulation() { return "shadow"; } | ||
| static get originalStyleUrls() { return { | ||
| "$": ["editor.css"] | ||
| }; } | ||
| static get styleUrls() { return { | ||
| "$": ["editor.css"] | ||
| }; } | ||
| static get properties() { return { | ||
| "token": { | ||
| "type": "string", | ||
| "mutable": false, | ||
| "complexType": { | ||
| "original": "string", | ||
| "resolved": "string", | ||
| "references": {} | ||
| }, | ||
| "required": false, | ||
| "optional": false, | ||
| "docs": { | ||
| "tags": [], | ||
| "text": "" | ||
| }, | ||
| "attribute": "token", | ||
| "reflect": false | ||
| }; } | ||
| static get states() { return { | ||
| "modalOpen": {} | ||
| }; } | ||
| 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 { | ||
| "save": { | ||
| "complexType": { | ||
| "signature": "(opts?: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "config": { | ||
| "type": "any", | ||
| "mutable": false, | ||
| "complexType": { | ||
| "original": "any", | ||
| "resolved": "any", | ||
| "references": {} | ||
| }, | ||
| "required": false, | ||
| "optional": false, | ||
| "docs": { | ||
| "tags": [], | ||
| "text": "" | ||
| }, | ||
| "attribute": "config", | ||
| "reflect": false | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "test": { | ||
| "complexType": { | ||
| "signature": "() => Promise<void>", | ||
| "parameters": [], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "content": { | ||
| "type": "string", | ||
| "mutable": false, | ||
| "complexType": { | ||
| "original": "string", | ||
| "resolved": "string", | ||
| "references": {} | ||
| }, | ||
| "required": false, | ||
| "optional": false, | ||
| "docs": { | ||
| "tags": [], | ||
| "text": "" | ||
| }, | ||
| "attribute": "content", | ||
| "reflect": false, | ||
| "defaultValue": "''" | ||
| } | ||
| }; } | ||
| static get states() { return { | ||
| "modalOpen": {} | ||
| }; } | ||
| 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 { | ||
| "save": { | ||
| "complexType": { | ||
| "signature": "(opts?: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "spinner": { | ||
| "complexType": { | ||
| "signature": "(behavior: 'hide' | 'show') => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "test": { | ||
| "complexType": { | ||
| "signature": "() => Promise<void>", | ||
| "parameters": [], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "start": { | ||
| "complexType": { | ||
| "signature": "(data: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "spinner": { | ||
| "complexType": { | ||
| "signature": "(behavior: 'hide' | 'show') => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "sendTest": { | ||
| "complexType": { | ||
| "signature": "(data: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "start": { | ||
| "complexType": { | ||
| "signature": "(data: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "beforeUnload": { | ||
| "complexType": { | ||
| "signature": "(evt: BeforeUnloadEvent) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| }, | ||
| "BeforeUnloadEvent": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "sendTest": { | ||
| "complexType": { | ||
| "signature": "(data: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "load": { | ||
| "complexType": { | ||
| "signature": "(data: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "beforeUnload": { | ||
| "complexType": { | ||
| "signature": "(evt: BeforeUnloadEvent) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| }, | ||
| "BeforeUnloadEvent": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "preview": { | ||
| "complexType": { | ||
| "signature": "(device: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "load": { | ||
| "complexType": { | ||
| "signature": "(data: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| }, | ||
| "preview": { | ||
| "complexType": { | ||
| "signature": "(device: any) => Promise<void>", | ||
| "parameters": [{ | ||
| "tags": [], | ||
| "text": "" | ||
| }], | ||
| "references": { | ||
| "Promise": { | ||
| "location": "global" | ||
| } | ||
| }, | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| } | ||
| }; } | ||
| static get elementRef() { return "element"; } | ||
| static get listeners() { return [{ | ||
| "name": "message", | ||
| "method": "componentWillLoad", | ||
| "target": "window", | ||
| "capture": false, | ||
| "passive": false | ||
| }]; } | ||
| "return": "Promise<void>" | ||
| }, | ||
| "docs": { | ||
| "text": "", | ||
| "tags": [] | ||
| } | ||
| } | ||
| }; } | ||
| static get elementRef() { return "element"; } | ||
| static get listeners() { return [{ | ||
| "name": "message", | ||
| "method": "componentWillLoad", | ||
| "target": "window", | ||
| "capture": false, | ||
| "passive": false | ||
| }]; } | ||
| } |
| export function format(first, middle, last) { | ||
| return ((first || '') + | ||
| (middle ? ` ${middle}` : '') + | ||
| (last ? ` ${last}` : '')); | ||
| return ((first || '') + | ||
| (middle ? ` ${middle}` : '') + | ||
| (last ? ` ${last}` : '')); | ||
| } |
+131
-131
@@ -1,2 +0,2 @@ | ||
| import { r as registerInstance, c as createEvent, h, g as getElement } from './index-537c62c6.js'; | ||
| import { r as registerInstance, c as createEvent, h, g as getElement } from './index-19dcbd9f.js'; | ||
@@ -6,143 +6,143 @@ const editorCss = ":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}"; | ||
| const Editor = class { | ||
| constructor(hostRef) { | ||
| registerInstance(this, hostRef); | ||
| this.editorEvent = createEvent(this, "editorEvent", 7); | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| constructor(hostRef) { | ||
| registerInstance(this, hostRef); | ||
| this.editorEvent = createEvent(this, "editorEvent", 7); | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| } | ||
| sendMessage(action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action, | ||
| data | ||
| }, "*"); | ||
| } | ||
| async save(opts = {}) { | ||
| this.sendMessage("save", opts); | ||
| } | ||
| async test() { | ||
| console.log("Only a test"); | ||
| } | ||
| async spinner(behavior) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| sendMessage(action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action, | ||
| data | ||
| }, "*"); | ||
| this.sendMessage("showSpinner", { | ||
| behavior | ||
| }); | ||
| } | ||
| async start(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async sendTest(data) { | ||
| this.sendMessage("sendTest", data); | ||
| } | ||
| async beforeUnload(evt) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| } | ||
| async load(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async preview(device) { | ||
| this.sendMessage("preview", device); | ||
| } | ||
| async initConfig() { | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (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; | ||
| } | ||
| async save(opts = {}) { | ||
| this.sendMessage("save", opts); | ||
| if (this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise) { | ||
| this.config.lang.custom = await this.config.lang.custom; | ||
| } | ||
| async test() { | ||
| console.log("Only a test"); | ||
| if (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; | ||
| } | ||
| async spinner(behavior) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| this.sendMessage("showSpinner", { | ||
| behavior | ||
| const isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || `//editor.mailstyler.com`; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| } | ||
| async componentWillRender() { | ||
| !this.assetsLoaded && this.config && await this.initConfig(); | ||
| } | ||
| render() { | ||
| return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| } | ||
| editorDidOpen() { | ||
| const template = this.content || ''; | ||
| this.load(template).then(_ => console.log("MailStyler Plugin: Template is loaded succesfully")); | ||
| } | ||
| listenMessage(e) { | ||
| if (e.data && e.data.action) { | ||
| const { action, data } = e.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| let editorConfig = Object.assign({}, this.config); | ||
| Object.keys(editorConfig) | ||
| .filter(key => typeof editorConfig[key] === 'function') | ||
| .forEach(key => delete editorConfig[key]); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig | ||
| }); | ||
| } | ||
| async start(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async sendTest(data) { | ||
| this.sendMessage("sendTest", data); | ||
| } | ||
| async beforeUnload(evt) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| } | ||
| async load(data) { | ||
| this.sendMessage("load", data); | ||
| } | ||
| async preview(device) { | ||
| this.sendMessage("preview", device); | ||
| } | ||
| async initConfig() { | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (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; | ||
| } | ||
| else if (action === "appSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| if (this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise) { | ||
| this.config.lang.custom = await this.config.lang.custom; | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| if (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; | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| const isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || `//editor.mailstyler.com`; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| } | ||
| async componentWillRender() { | ||
| !this.assetsLoaded && this.config && await this.initConfig(); | ||
| } | ||
| render() { | ||
| return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| } | ||
| editorDidOpen() { | ||
| const template = this.content || ''; | ||
| this.load(template).then(_ => console.log("MailStyler Plugin: Template is loaded succesfully")); | ||
| } | ||
| listenMessage(e) { | ||
| if (e.data && e.data.action) { | ||
| const { action, data } = e.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| let editorConfig = Object.assign({}, this.config); | ||
| Object.keys(editorConfig) | ||
| .filter(key => typeof editorConfig[key] === 'function') | ||
| .forEach(key => delete editorConfig[key]); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig | ||
| }); | ||
| } | ||
| else if (action === "appSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action, data }); | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| componentWillLoad(ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| const regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action, data }); | ||
| } | ||
| get element() { return getElement(this); } | ||
| } | ||
| componentWillLoad(ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| } | ||
| get element() { return getElement(this); } | ||
| }; | ||
@@ -149,0 +149,0 @@ Editor.style = editorCss; |
@@ -1,1 +0,1 @@ | ||
| var StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return Object.assign(Object.assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return Object.assign(Object.assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\."+t,"."+r)}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t=s.scopeId+"-"+this.count,o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window); | ||
| var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r)}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return"\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return{start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t)}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else{if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s)}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value}))}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0)})),!t)return"break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return[];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t})})),t++})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o})}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors)})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return{original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return!1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t))}))}function reScope(e,t){var r=e.template.map((function(r){return"string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return __assign(__assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return __assign(__assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\.".concat(t),".".concat(r))}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t)}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t)})).observe(document.head,{childList:!0})}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove()}})).catch((function(e){console.error(e)}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}))}))})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal()}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal()},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t="".concat(s.scopeId,"-").concat(this.count),o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e)},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n)}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes)},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document))}("undefined"!=typeof window&&window); |
@@ -11,3 +11,3 @@ export function applyPolyfills() { | ||
| function checkIfURLIsSupported() { | ||
| var checkIfURLIsSupported = function() { | ||
| try { | ||
@@ -20,3 +20,3 @@ var u = new URL('b', 'http://a'); | ||
| } | ||
| } | ||
| }; | ||
@@ -23,0 +23,0 @@ if ( |
+1
-1
@@ -1,1 +0,1 @@ | ||
| module.exports = require('./cjs/index.cjs.js'); | ||
| export * from './esm/index.js'; |
@@ -1,1 +0,1 @@ | ||
| import{b as e}from"./p-44776af7.js";import{p as o}from"./p-96069a23.js";o().then(o=>e([["p-02a62b59",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],o)); | ||
| import{p as e,b as o}from"./p-046f3240.js";(()=>{const o=import.meta.url,n={};return""!==o&&(n.resourcesUrl=new URL(".",o).href),e(n)})().then((e=>o([["p-42632ca2",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],e))); |
| import { EventEmitter } from '../../stencil-public-runtime'; | ||
| export declare class Editor { | ||
| token: string; | ||
| config: any; | ||
| content: string; | ||
| private element; | ||
| private editorUrl; | ||
| private mscFrameworkUrl; | ||
| private editorFrame; | ||
| private assetsLoaded; | ||
| private modalOpen; | ||
| editorEvent: EventEmitter<{ | ||
| data: any; | ||
| action: string; | ||
| }>; | ||
| sendMessage(action: any, data: any): void; | ||
| save(opts?: any): Promise<void>; | ||
| test(): Promise<void>; | ||
| spinner(behavior: 'hide' | 'show'): Promise<void>; | ||
| start(data: any): Promise<void>; | ||
| sendTest(data: any): Promise<void>; | ||
| beforeUnload(evt: BeforeUnloadEvent): Promise<void>; | ||
| load(data: any): Promise<void>; | ||
| preview(device: any): Promise<void>; | ||
| initConfig(): Promise<void>; | ||
| componentWillRender(): Promise<void>; | ||
| render(): any; | ||
| editorDidOpen(): void; | ||
| listenMessage(e: MessageEvent): void; | ||
| componentWillLoad(ev: MessageEvent): void; | ||
| token: string; | ||
| config: any; | ||
| content: string; | ||
| private element; | ||
| private editorUrl; | ||
| private mscFrameworkUrl; | ||
| private editorFrame; | ||
| private assetsLoaded; | ||
| private modalOpen; | ||
| editorEvent: EventEmitter<{ | ||
| data: any; | ||
| action: string; | ||
| }>; | ||
| sendMessage(action: any, data: any): void; | ||
| save(opts?: any): Promise<void>; | ||
| test(): Promise<void>; | ||
| spinner(behavior: 'hide' | 'show'): Promise<void>; | ||
| start(data: any): Promise<void>; | ||
| sendTest(data: any): Promise<void>; | ||
| beforeUnload(evt: BeforeUnloadEvent): Promise<void>; | ||
| load(data: any): Promise<void>; | ||
| preview(device: any): Promise<void>; | ||
| initConfig(): Promise<void>; | ||
| componentWillRender(): Promise<void>; | ||
| render(): any; | ||
| editorDidOpen(): void; | ||
| listenMessage(e: MessageEvent): void; | ||
| componentWillLoad(ev: MessageEvent): void; | ||
| } |
@@ -46,6 +46,2 @@ declare type CustomMethodDecorator<T> = (target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void; | ||
| assetsDirs?: string[]; | ||
| /** | ||
| * @deprecated Use `assetsDirs` instead | ||
| */ | ||
| assetsDir?: string; | ||
| } | ||
@@ -85,10 +81,2 @@ export interface ShadowRootOptions { | ||
| reflect?: boolean; | ||
| /** @deprecated: "attr" has been deprecated, please use "attribute" instead. */ | ||
| attr?: string; | ||
| /** @deprecated "context" has been deprecated. */ | ||
| context?: string; | ||
| /** @deprecated "connect" has been deprecated, please use ES modules and/or dynamic imports instead. */ | ||
| connect?: string; | ||
| /** @deprecated "reflectToAttr" has been deprecated, please use "reflect" instead. */ | ||
| reflectToAttr?: boolean; | ||
| } | ||
@@ -150,3 +138,3 @@ export interface MethodDecorator { | ||
| } | ||
| export declare type ListenTargetOptions = 'parent' | 'body' | 'document' | 'window'; | ||
| export declare type ListenTargetOptions = 'body' | 'document' | 'window'; | ||
| export interface StateDecorator { | ||
@@ -170,2 +158,8 @@ (): PropertyDecorator; | ||
| /** | ||
| * The `Env` object provides access to the "env" object declared in the project's `stencil.config.ts`. | ||
| */ | ||
| export declare const Env: { | ||
| [prop: string]: string | undefined; | ||
| }; | ||
| /** | ||
| * The `@Component()` decorator is used to provide metadata about the component class. | ||
@@ -228,2 +222,3 @@ * https://stenciljs.com/docs/component | ||
| export declare type ResolutionHandler = (elm: HTMLElement) => string | undefined | null; | ||
| export declare type ErrorHandler = (err: any, element?: HTMLElement) => void; | ||
| /** | ||
@@ -237,2 +232,9 @@ * `setMode()` is used for libraries which provide multiple "modes" for styles. | ||
| export declare function getMode<T = string | undefined>(ref: any): T; | ||
| export declare function setPlatformHelpers(helpers: { | ||
| jmp?: (c: any) => any; | ||
| raf?: (c: any) => number; | ||
| ael?: (el: any, eventName: string, listener: any, options: any) => void; | ||
| rel?: (el: any, eventName: string, listener: any, options: any) => void; | ||
| ce?: (eventName: string, opts?: any) => any; | ||
| }): void; | ||
| /** | ||
@@ -273,4 +275,2 @@ * Get the base path to where the assets can be found. Use `setAssetPath(path)` | ||
| componentOnReady(): Promise<this>; | ||
| /** @deprecated */ | ||
| forceUpdate(): void; | ||
| } | ||
@@ -292,2 +292,7 @@ /** | ||
| /** | ||
| * `setErrorHandler()` can be used to inject a custom global error handler. | ||
| * Unhandled exception raised while rendering, during event handling, or lifecycles will trigger the custom event handler. | ||
| */ | ||
| export declare const setErrorHandler: (handler: ErrorHandler) => void; | ||
| /** | ||
| * This file gets copied to all distributions of stencil component collections. | ||
@@ -342,9 +347,2 @@ * - no imports | ||
| } | ||
| export interface ComponentDidUnload { | ||
| /** | ||
| * The component did unload and the element | ||
| * will be destroyed. | ||
| */ | ||
| componentDidUnload(): void; | ||
| } | ||
| export interface ComponentInterface { | ||
@@ -454,2 +452,6 @@ connectedCallback?(): void; | ||
| /** | ||
| * Fragment | ||
| */ | ||
| export declare const Fragment: FunctionalComponent<{}>; | ||
| /** | ||
| * The "h" namespace is used to import JSX types for elements and attributes. | ||
@@ -460,9 +462,9 @@ * It is imported in order to avoid conflicting global JSX issues. | ||
| function h(sel: any): VNode; | ||
| function h(sel: Node, data: VNodeData): VNode; | ||
| function h(sel: any, data: VNodeData): VNode; | ||
| function h(sel: Node, data: VNodeData | null): VNode; | ||
| function h(sel: any, data: VNodeData | null): VNode; | ||
| function h(sel: any, text: string): VNode; | ||
| function h(sel: any, children: Array<VNode | undefined | null>): VNode; | ||
| function h(sel: any, data: VNodeData, text: string): VNode; | ||
| function h(sel: any, data: VNodeData, children: Array<VNode | undefined | null>): VNode; | ||
| function h(sel: any, data: VNodeData, children: VNode): VNode; | ||
| function h(sel: any, data: VNodeData | null, text: string): VNode; | ||
| function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode; | ||
| function h(sel: any, data: VNodeData | null, children: VNode): VNode; | ||
| namespace JSX { | ||
@@ -474,2 +476,10 @@ interface IntrinsicElements extends LocalJSX.IntrinsicElements, JSXBase.IntrinsicElements { | ||
| } | ||
| export declare function h(sel: any): VNode; | ||
| export declare function h(sel: Node, data: VNodeData | null): VNode; | ||
| export declare function h(sel: any, data: VNodeData | null): VNode; | ||
| export declare function h(sel: any, text: string): VNode; | ||
| export declare function h(sel: any, children: Array<VNode | undefined | null>): VNode; | ||
| export declare function h(sel: any, data: VNodeData | null, text: string): VNode; | ||
| export declare function h(sel: any, data: VNodeData | null, children: Array<VNode | undefined | null>): VNode; | ||
| export declare function h(sel: any, data: VNodeData | null, children: VNode): VNode; | ||
| export interface VNode { | ||
@@ -671,3 +681,3 @@ $flags$: number; | ||
| } | ||
| interface SlotAttributes { | ||
| interface SlotAttributes extends JSXAttributes { | ||
| name?: string; | ||
@@ -685,2 +695,3 @@ slot?: string; | ||
| target?: string; | ||
| referrerPolicy?: ReferrerPolicy; | ||
| } | ||
@@ -1173,47 +1184,47 @@ interface AudioHTMLAttributes<T> extends MediaHTMLAttributes<T> { | ||
| interface SVGAttributes<T = SVGElement> extends DOMAttributes<T> { | ||
| 'class'?: string | { | ||
| class?: string | { | ||
| [className: string]: boolean; | ||
| }; | ||
| 'color'?: string; | ||
| 'height'?: number | string; | ||
| 'id'?: string; | ||
| 'lang'?: string; | ||
| 'max'?: number | string; | ||
| 'media'?: string; | ||
| 'method'?: string; | ||
| 'min'?: number | string; | ||
| 'name'?: string; | ||
| 'style'?: { | ||
| color?: string; | ||
| height?: number | string; | ||
| id?: string; | ||
| lang?: string; | ||
| max?: number | string; | ||
| media?: string; | ||
| method?: string; | ||
| min?: number | string; | ||
| name?: string; | ||
| style?: { | ||
| [key: string]: string | undefined; | ||
| }; | ||
| 'target'?: string; | ||
| 'type'?: string; | ||
| 'width'?: number | string; | ||
| 'role'?: string; | ||
| 'tabindex'?: number; | ||
| target?: string; | ||
| type?: string; | ||
| width?: number | string; | ||
| role?: string; | ||
| tabindex?: number; | ||
| 'accent-height'?: number | string; | ||
| 'accumulate'?: 'none' | 'sum'; | ||
| 'additive'?: 'replace' | 'sum'; | ||
| accumulate?: 'none' | 'sum'; | ||
| additive?: 'replace' | 'sum'; | ||
| 'alignment-baseline'?: 'auto' | 'baseline' | 'before-edge' | 'text-before-edge' | 'middle' | 'central' | 'after-edge' | 'text-after-edge' | 'ideographic' | 'alphabetic' | 'hanging' | 'mathematical' | 'inherit'; | ||
| 'allowReorder'?: 'no' | 'yes'; | ||
| 'alphabetic'?: number | string; | ||
| 'amplitude'?: number | string; | ||
| allowReorder?: 'no' | 'yes'; | ||
| alphabetic?: number | string; | ||
| amplitude?: number | string; | ||
| 'arabic-form'?: 'initial' | 'medial' | 'terminal' | 'isolated'; | ||
| 'ascent'?: number | string; | ||
| 'attributeName'?: string; | ||
| 'attributeType'?: string; | ||
| 'autoReverse'?: number | string; | ||
| 'azimuth'?: number | string; | ||
| 'baseFrequency'?: number | string; | ||
| ascent?: number | string; | ||
| attributeName?: string; | ||
| attributeType?: string; | ||
| autoReverse?: number | string; | ||
| azimuth?: number | string; | ||
| baseFrequency?: number | string; | ||
| 'baseline-shift'?: number | string; | ||
| 'baseProfile'?: number | string; | ||
| 'bbox'?: number | string; | ||
| 'begin'?: number | string; | ||
| 'bias'?: number | string; | ||
| 'by'?: number | string; | ||
| 'calcMode'?: number | string; | ||
| baseProfile?: number | string; | ||
| bbox?: number | string; | ||
| begin?: number | string; | ||
| bias?: number | string; | ||
| by?: number | string; | ||
| calcMode?: number | string; | ||
| 'cap-height'?: number | string; | ||
| 'clip'?: number | string; | ||
| clip?: number | string; | ||
| 'clip-path'?: string; | ||
| 'clipPathUnits'?: number | string; | ||
| clipPathUnits?: number | string; | ||
| 'clip-rule'?: number | string; | ||
@@ -1224,33 +1235,33 @@ 'color-interpolation'?: number | string; | ||
| 'color-rendering'?: number | string; | ||
| 'contentScriptType'?: number | string; | ||
| 'contentStyleType'?: number | string; | ||
| 'cursor'?: number | string; | ||
| 'cx'?: number | string; | ||
| 'cy'?: number | string; | ||
| 'd'?: string; | ||
| 'decelerate'?: number | string; | ||
| 'descent'?: number | string; | ||
| 'diffuseConstant'?: number | string; | ||
| 'direction'?: number | string; | ||
| 'display'?: number | string; | ||
| 'divisor'?: number | string; | ||
| contentScriptType?: number | string; | ||
| contentStyleType?: number | string; | ||
| cursor?: number | string; | ||
| cx?: number | string; | ||
| cy?: number | string; | ||
| d?: string; | ||
| decelerate?: number | string; | ||
| descent?: number | string; | ||
| diffuseConstant?: number | string; | ||
| direction?: number | string; | ||
| display?: number | string; | ||
| divisor?: number | string; | ||
| 'dominant-baseline'?: number | string; | ||
| 'dur'?: number | string; | ||
| 'dx'?: number | string; | ||
| 'dy'?: number | string; | ||
| dur?: number | string; | ||
| dx?: number | string; | ||
| dy?: number | string; | ||
| 'edge-mode'?: number | string; | ||
| 'elevation'?: number | string; | ||
| elevation?: number | string; | ||
| 'enable-background'?: number | string; | ||
| 'end'?: number | string; | ||
| 'exponent'?: number | string; | ||
| 'externalResourcesRequired'?: number | string; | ||
| 'fill'?: string; | ||
| end?: number | string; | ||
| exponent?: number | string; | ||
| externalResourcesRequired?: number | string; | ||
| fill?: string; | ||
| 'fill-opacity'?: number | string; | ||
| 'fill-rule'?: 'nonzero' | 'evenodd' | 'inherit'; | ||
| 'filter'?: string; | ||
| 'filterRes'?: number | string; | ||
| 'filterUnits'?: number | string; | ||
| filter?: string; | ||
| filterRes?: number | string; | ||
| filterUnits?: number | string; | ||
| 'flood-color'?: number | string; | ||
| 'flood-opacity'?: number | string; | ||
| 'focusable'?: number | string; | ||
| focusable?: number | string; | ||
| 'font-family'?: string; | ||
@@ -1263,103 +1274,103 @@ 'font-size'?: number | string; | ||
| 'font-weight'?: number | string; | ||
| 'format'?: number | string; | ||
| 'from'?: number | string; | ||
| 'fx'?: number | string; | ||
| 'fy'?: number | string; | ||
| 'g1'?: number | string; | ||
| 'g2'?: number | string; | ||
| format?: number | string; | ||
| from?: number | string; | ||
| fx?: number | string; | ||
| fy?: number | string; | ||
| g1?: number | string; | ||
| g2?: number | string; | ||
| 'glyph-name'?: number | string; | ||
| 'glyph-orientation-horizontal'?: number | string; | ||
| 'glyph-orientation-vertical'?: number | string; | ||
| 'glyphRef'?: number | string; | ||
| 'gradientTransform'?: string; | ||
| 'gradientUnits'?: string; | ||
| 'hanging'?: number | string; | ||
| glyphRef?: number | string; | ||
| gradientTransform?: string; | ||
| gradientUnits?: string; | ||
| hanging?: number | string; | ||
| 'horiz-adv-x'?: number | string; | ||
| 'horiz-origin-x'?: number | string; | ||
| 'href'?: string; | ||
| 'ideographic'?: number | string; | ||
| href?: string; | ||
| ideographic?: number | string; | ||
| 'image-rendering'?: number | string; | ||
| 'in2'?: number | string; | ||
| 'in'?: string; | ||
| 'intercept'?: number | string; | ||
| 'k1'?: number | string; | ||
| 'k2'?: number | string; | ||
| 'k3'?: number | string; | ||
| 'k4'?: number | string; | ||
| 'k'?: number | string; | ||
| 'kernelMatrix'?: number | string; | ||
| 'kernelUnitLength'?: number | string; | ||
| 'kerning'?: number | string; | ||
| 'keyPoints'?: number | string; | ||
| 'keySplines'?: number | string; | ||
| 'keyTimes'?: number | string; | ||
| 'lengthAdjust'?: number | string; | ||
| in2?: number | string; | ||
| in?: string; | ||
| intercept?: number | string; | ||
| k1?: number | string; | ||
| k2?: number | string; | ||
| k3?: number | string; | ||
| k4?: number | string; | ||
| k?: number | string; | ||
| kernelMatrix?: number | string; | ||
| kernelUnitLength?: number | string; | ||
| kerning?: number | string; | ||
| keyPoints?: number | string; | ||
| keySplines?: number | string; | ||
| keyTimes?: number | string; | ||
| lengthAdjust?: number | string; | ||
| 'letter-spacing'?: number | string; | ||
| 'lighting-color'?: number | string; | ||
| 'limitingConeAngle'?: number | string; | ||
| 'local'?: number | string; | ||
| limitingConeAngle?: number | string; | ||
| local?: number | string; | ||
| 'marker-end'?: string; | ||
| 'markerHeight'?: number | string; | ||
| markerHeight?: number | string; | ||
| 'marker-mid'?: string; | ||
| 'marker-start'?: string; | ||
| 'markerUnits'?: number | string; | ||
| 'markerWidth'?: number | string; | ||
| 'mask'?: string; | ||
| 'maskContentUnits'?: number | string; | ||
| 'maskUnits'?: number | string; | ||
| 'mathematical'?: number | string; | ||
| 'mode'?: number | string; | ||
| 'numOctaves'?: number | string; | ||
| 'offset'?: number | string; | ||
| 'opacity'?: number | string; | ||
| 'operator'?: number | string; | ||
| 'order'?: number | string; | ||
| 'orient'?: number | string; | ||
| 'orientation'?: number | string; | ||
| 'origin'?: number | string; | ||
| 'overflow'?: number | string; | ||
| markerUnits?: number | string; | ||
| markerWidth?: number | string; | ||
| mask?: string; | ||
| maskContentUnits?: number | string; | ||
| maskUnits?: number | string; | ||
| mathematical?: number | string; | ||
| mode?: number | string; | ||
| numOctaves?: number | string; | ||
| offset?: number | string; | ||
| opacity?: number | string; | ||
| operator?: number | string; | ||
| order?: number | string; | ||
| orient?: number | string; | ||
| orientation?: number | string; | ||
| origin?: number | string; | ||
| overflow?: number | string; | ||
| 'overline-position'?: number | string; | ||
| 'overline-thickness'?: number | string; | ||
| 'paint-order'?: number | string; | ||
| 'panose1'?: number | string; | ||
| 'pathLength'?: number | string; | ||
| 'patternContentUnits'?: string; | ||
| 'patternTransform'?: number | string; | ||
| 'patternUnits'?: string; | ||
| panose1?: number | string; | ||
| pathLength?: number | string; | ||
| patternContentUnits?: string; | ||
| patternTransform?: number | string; | ||
| patternUnits?: string; | ||
| 'pointer-events'?: number | string; | ||
| 'points'?: string; | ||
| 'pointsAtX'?: number | string; | ||
| 'pointsAtY'?: number | string; | ||
| 'pointsAtZ'?: number | string; | ||
| 'preserveAlpha'?: number | string; | ||
| 'preserveAspectRatio'?: string; | ||
| 'primitiveUnits'?: number | string; | ||
| 'r'?: number | string; | ||
| 'radius'?: number | string; | ||
| 'refX'?: number | string; | ||
| 'refY'?: number | string; | ||
| points?: string; | ||
| pointsAtX?: number | string; | ||
| pointsAtY?: number | string; | ||
| pointsAtZ?: number | string; | ||
| preserveAlpha?: number | string; | ||
| preserveAspectRatio?: string; | ||
| primitiveUnits?: number | string; | ||
| r?: number | string; | ||
| radius?: number | string; | ||
| refX?: number | string; | ||
| refY?: number | string; | ||
| 'rendering-intent'?: number | string; | ||
| 'repeatCount'?: number | string; | ||
| 'repeatDur'?: number | string; | ||
| 'requiredextensions'?: number | string; | ||
| 'requiredFeatures'?: number | string; | ||
| 'restart'?: number | string; | ||
| 'result'?: string; | ||
| 'rotate'?: number | string; | ||
| 'rx'?: number | string; | ||
| 'ry'?: number | string; | ||
| 'scale'?: number | string; | ||
| 'seed'?: number | string; | ||
| repeatCount?: number | string; | ||
| repeatDur?: number | string; | ||
| requiredextensions?: number | string; | ||
| requiredFeatures?: number | string; | ||
| restart?: number | string; | ||
| result?: string; | ||
| rotate?: number | string; | ||
| rx?: number | string; | ||
| ry?: number | string; | ||
| scale?: number | string; | ||
| seed?: number | string; | ||
| 'shape-rendering'?: number | string; | ||
| 'slope'?: number | string; | ||
| 'spacing'?: number | string; | ||
| 'specularConstant'?: number | string; | ||
| 'specularExponent'?: number | string; | ||
| 'speed'?: number | string; | ||
| 'spreadMethod'?: string; | ||
| 'startOffset'?: number | string; | ||
| 'stdDeviation'?: number | string; | ||
| 'stemh'?: number | string; | ||
| 'stemv'?: number | string; | ||
| 'stitchTiles'?: number | string; | ||
| slope?: number | string; | ||
| spacing?: number | string; | ||
| specularConstant?: number | string; | ||
| specularExponent?: number | string; | ||
| speed?: number | string; | ||
| spreadMethod?: string; | ||
| startOffset?: number | string; | ||
| stdDeviation?: number | string; | ||
| stemh?: number | string; | ||
| stemv?: number | string; | ||
| stitchTiles?: number | string; | ||
| 'stop-color'?: string; | ||
@@ -1369,4 +1380,4 @@ 'stop-opacity'?: number | string; | ||
| 'strikethrough-thickness'?: number | string; | ||
| 'string'?: number | string; | ||
| 'stroke'?: string; | ||
| string?: number | string; | ||
| stroke?: string; | ||
| 'stroke-dasharray'?: string | number; | ||
@@ -1379,18 +1390,18 @@ 'stroke-dashoffset'?: string | number; | ||
| 'stroke-width'?: number | string; | ||
| 'surfaceScale'?: number | string; | ||
| 'systemLanguage'?: number | string; | ||
| 'tableValues'?: number | string; | ||
| 'targetX'?: number | string; | ||
| 'targetY'?: number | string; | ||
| surfaceScale?: number | string; | ||
| systemLanguage?: number | string; | ||
| tableValues?: number | string; | ||
| targetX?: number | string; | ||
| targetY?: number | string; | ||
| 'text-anchor'?: string; | ||
| 'text-decoration'?: number | string; | ||
| 'textLength'?: number | string; | ||
| textLength?: number | string; | ||
| 'text-rendering'?: number | string; | ||
| 'to'?: number | string; | ||
| 'transform'?: string; | ||
| 'u1'?: number | string; | ||
| 'u2'?: number | string; | ||
| to?: number | string; | ||
| transform?: string; | ||
| u1?: number | string; | ||
| u2?: number | string; | ||
| 'underline-position'?: number | string; | ||
| 'underline-thickness'?: number | string; | ||
| 'unicode'?: number | string; | ||
| unicode?: number | string; | ||
| 'unicode-bidi'?: number | string; | ||
@@ -1400,5 +1411,5 @@ 'unicode-range'?: number | string; | ||
| 'v-alphabetic'?: number | string; | ||
| 'values'?: string; | ||
| values?: string; | ||
| 'vector-effect'?: number | string; | ||
| 'version'?: string; | ||
| version?: string; | ||
| 'vert-adv-y'?: number | string; | ||
@@ -1409,35 +1420,33 @@ 'vert-origin-x'?: number | string; | ||
| 'v-ideographic'?: number | string; | ||
| 'viewBox'?: string; | ||
| 'viewTarget'?: number | string; | ||
| 'visibility'?: number | string; | ||
| viewBox?: string; | ||
| viewTarget?: number | string; | ||
| visibility?: number | string; | ||
| 'v-mathematical'?: number | string; | ||
| 'widths'?: number | string; | ||
| widths?: number | string; | ||
| 'word-spacing'?: number | string; | ||
| 'writing-mode'?: number | string; | ||
| 'x1'?: number | string; | ||
| 'x2'?: number | string; | ||
| 'x'?: number | string; | ||
| x1?: number | string; | ||
| x2?: number | string; | ||
| x?: number | string; | ||
| 'x-channel-selector'?: string; | ||
| 'x-height'?: number | string; | ||
| 'xlinkActuate'?: string; | ||
| 'xlinkArcrole'?: string; | ||
| 'xlinkHref'?: string; | ||
| 'xlinkRole'?: string; | ||
| 'xlinkShow'?: string; | ||
| 'xlinkTitle'?: string; | ||
| 'xlinkType'?: string; | ||
| 'xmlBase'?: string; | ||
| 'xmlLang'?: string; | ||
| 'xmlns'?: string; | ||
| 'xmlSpace'?: string; | ||
| 'y1'?: number | string; | ||
| 'y2'?: number | string; | ||
| 'y'?: number | string; | ||
| 'yChannelSelector'?: string; | ||
| 'z'?: number | string; | ||
| 'zoomAndPan'?: string; | ||
| xlinkActuate?: string; | ||
| xlinkArcrole?: string; | ||
| xlinkHref?: string; | ||
| xlinkRole?: string; | ||
| xlinkShow?: string; | ||
| xlinkTitle?: string; | ||
| xlinkType?: string; | ||
| xmlBase?: string; | ||
| xmlLang?: string; | ||
| xmlns?: string; | ||
| xmlSpace?: string; | ||
| y1?: number | string; | ||
| y2?: number | string; | ||
| y?: number | string; | ||
| yChannelSelector?: string; | ||
| z?: number | string; | ||
| zoomAndPan?: string; | ||
| } | ||
| interface DOMAttributes<T = Element> { | ||
| key?: string | number; | ||
| ref?: (elm?: T) => void; | ||
| interface DOMAttributes<T> extends JSXAttributes<T> { | ||
| slot?: string; | ||
@@ -1460,6 +1469,6 @@ part?: string; | ||
| onFocusCapture?: (event: FocusEvent) => void; | ||
| onFocusIn?: (event: FocusEvent) => void; | ||
| onFocusInCapture?: (event: FocusEvent) => void; | ||
| onFocusOut?: (event: FocusEvent) => void; | ||
| onFocusOutCapture?: (event: FocusEvent) => void; | ||
| onFocusin?: (event: FocusEvent) => void; | ||
| onFocusinCapture?: (event: FocusEvent) => void; | ||
| onFocusout?: (event: FocusEvent) => void; | ||
| onFocusoutCapture?: (event: FocusEvent) => void; | ||
| onBlur?: (event: FocusEvent) => void; | ||
@@ -1564,2 +1573,6 @@ onBlurCapture?: (event: FocusEvent) => void; | ||
| } | ||
| export interface JSXAttributes<T = Element> { | ||
| key?: string | number; | ||
| ref?: (elm?: T) => void; | ||
| } | ||
| export interface CustomElementsDefineOptions { | ||
@@ -1566,0 +1579,0 @@ exclude?: string[]; |
@@ -1,2 +0,1 @@ | ||
| export * from '../dist/types/components'; | ||
@@ -3,0 +2,0 @@ export interface CustomElementsDefineOptions { |
| { | ||
| "name": "msf-editor-loader", | ||
| "typings": "./index.d.ts", | ||
| "module": "./index.mjs", | ||
| "module": "./index.js", | ||
| "main": "./index.cjs.js", | ||
| "node:main": "./node-main.js", | ||
| "jsnext:main": "./index.es2017.mjs", | ||
| "es2015": "./index.es2017.mjs", | ||
| "es2017": "./index.es2017.mjs", | ||
| "jsnext:main": "./index.es2017.js", | ||
| "es2015": "./index.es2017.js", | ||
| "es2017": "./index.es2017.js", | ||
| "unpkg": "./cdn.js" | ||
| } |
+4
-4
| { | ||
| "name": "msf-editor", | ||
| "version": "0.7.0", | ||
| "version": "0.8.0", | ||
| "description": "Stencil Component Starter", | ||
| "main": "dist/index.js", | ||
| "module": "dist/index.mjs", | ||
| "main": "dist/index.cjs.js", | ||
| "module": "dist/index.js", | ||
| "es2015": "dist/esm/index.mjs", | ||
@@ -26,5 +26,5 @@ "es2017": "dist/esm/index.mjs", | ||
| "devDependencies": { | ||
| "@stencil/core": "^1.17.4" | ||
| "@stencil/core": "^2.14.2" | ||
| }, | ||
| "license": "MIT" | ||
| } |
| 'use strict'; | ||
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| var StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector="";};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r);}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE;}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return "\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return {start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return {start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t);}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else {if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s);}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value;}));}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0);})),!t)return "break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return [];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t});})),t++;})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o});}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement;}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors);})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return ":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return {original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return !1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t));}));}function reScope(e,t){var r=e.template.map((function(r){return "string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return Object.assign(Object.assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return Object.assign(Object.assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\."+t,"."+r)}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t);}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t);})).observe(document.head,{childList:!0});}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove();}})).catch((function(e){console.error(e);}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1;}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}));}));})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal();}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal();},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t=s.scopeId+"-"+this.count,o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e);},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n);}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes);},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document));}("undefined"!=typeof window&&window); |
| 'use strict'; | ||
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| (function(){ | ||
| var aa=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function g(a){var b=aa.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return !b&&a}function l(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return !(!a||!(a.__CE_isImportDocument||a instanceof Document))} | ||
| function n(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null} | ||
| function p(a,b,d){d=void 0===d?new Set:d;for(var c=a;c;){if(c.nodeType===Node.ELEMENT_NODE){var e=c;b(e);var f=e.localName;if("link"===f&&"import"===e.getAttribute("rel")){c=e.import;if(c instanceof Node&&!d.has(c))for(d.add(c),c=c.firstChild;c;c=c.nextSibling)p(c,b,d);c=n(a,e);continue}else if("template"===f){c=n(a,e);continue}if(e=e.__CE_shadowRoot)for(e=e.firstChild;e;e=e.nextSibling)p(e,b,d);}c=c.firstChild?c.firstChild:n(a,c);}}function r(a,b,d){a[b]=d;}function u(){this.a=new Map;this.g=new Map;this.c=[];this.f=[];this.b=!1;}function ba(a,b,d){a.a.set(b,d);a.g.set(d.constructorFunction,d);}function ca(a,b){a.b=!0;a.c.push(b);}function da(a,b){a.b=!0;a.f.push(b);}function v(a,b){a.b&&p(b,function(b){return w(a,b)});}function w(a,b){if(a.b&&!b.__CE_patched){b.__CE_patched=!0;for(var d=0;d<a.c.length;d++)a.c[d](b);for(d=0;d<a.f.length;d++)a.f[d](b);}} | ||
| function x(a,b){var d=[];p(b,function(b){return d.push(b)});for(b=0;b<d.length;b++){var c=d[b];1===c.__CE_state?a.connectedCallback(c):y(a,c);}}function z(a,b){var d=[];p(b,function(b){return d.push(b)});for(b=0;b<d.length;b++){var c=d[b];1===c.__CE_state&&a.disconnectedCallback(c);}} | ||
| function A(a,b,d){d=void 0===d?{}:d;var c=d.u||new Set,e=d.i||function(b){return y(a,b)},f=[];p(b,function(b){if("link"===b.localName&&"import"===b.getAttribute("rel")){var d=b.import;d instanceof Node&&(d.__CE_isImportDocument=!0,d.__CE_hasRegistry=!0);d&&"complete"===d.readyState?d.__CE_documentLoadHandled=!0:b.addEventListener("load",function(){var d=b.import;if(!d.__CE_documentLoadHandled){d.__CE_documentLoadHandled=!0;var f=new Set(c);f.delete(d);A(a,d,{u:f,i:e});}});}else f.push(b);},c);if(a.b)for(b= | ||
| 0;b<f.length;b++)w(a,f[b]);for(b=0;b<f.length;b++)e(f[b]);} | ||
| function y(a,b){if(void 0===b.__CE_state){var d=b.ownerDocument;if(d.defaultView||d.__CE_isImportDocument&&d.__CE_hasRegistry)if(d=a.a.get(b.localName)){d.constructionStack.push(b);var c=d.constructorFunction;try{try{if(new c!==b)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{d.constructionStack.pop();}}catch(t){throw b.__CE_state=2,t;}b.__CE_state=1;b.__CE_definition=d;if(d.attributeChangedCallback)for(d=d.observedAttributes,c=0;c<d.length;c++){var e= | ||
| d[c],f=b.getAttribute(e);null!==f&&a.attributeChangedCallback(b,e,null,f,null);}l(b)&&a.connectedCallback(b);}}}u.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a);};u.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a);}; | ||
| u.prototype.attributeChangedCallback=function(a,b,d,c,e){var f=a.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(b)&&f.attributeChangedCallback.call(a,b,d,c,e);};function B(a){var b=document;this.c=a;this.a=b;this.b=void 0;A(this.c,this.a);"loading"===this.a.readyState&&(this.b=new MutationObserver(this.f.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}));}function C(a){a.b&&a.b.disconnect();}B.prototype.f=function(a){var b=this.a.readyState;"interactive"!==b&&"complete"!==b||C(this);for(b=0;b<a.length;b++)for(var d=a[b].addedNodes,c=0;c<d.length;c++)A(this.c,d[c]);};function ea(){var a=this;this.b=this.a=void 0;this.c=new Promise(function(b){a.b=b;a.a&&b(a.a);});}function D(a){if(a.a)throw Error("Already resolved.");a.a=void 0;a.b&&a.b(void 0);}function E(a){this.c=!1;this.a=a;this.j=new Map;this.f=function(b){return b()};this.b=!1;this.g=[];this.o=new B(a);} | ||
| E.prototype.l=function(a,b){var d=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!g(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this.a.a.get(a))throw Error("A custom element with name '"+a+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var c=function(b){var a=e[b];if(void 0!==a&&!(a instanceof Function))throw Error("The '"+b+"' callback must be a function."); | ||
| return a},e=b.prototype;if(!(e instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var f=c("connectedCallback");var t=c("disconnectedCallback");var k=c("adoptedCallback");var h=c("attributeChangedCallback");var m=b.observedAttributes||[];}catch(q){return}finally{this.c=!1;}b={localName:a,constructorFunction:b,connectedCallback:f,disconnectedCallback:t,adoptedCallback:k,attributeChangedCallback:h,observedAttributes:m,constructionStack:[]};ba(this.a, | ||
| a,b);this.g.push(b);this.b||(this.b=!0,this.f(function(){return fa(d)}));};E.prototype.i=function(a){A(this.a,a);}; | ||
| function fa(a){if(!1!==a.b){a.b=!1;for(var b=a.g,d=[],c=new Map,e=0;e<b.length;e++)c.set(b[e].localName,[]);A(a.a,document,{i:function(b){if(void 0===b.__CE_state){var e=b.localName,f=c.get(e);f?f.push(b):a.a.a.get(e)&&d.push(b);}}});for(e=0;e<d.length;e++)y(a.a,d[e]);for(;0<b.length;){var f=b.shift();e=f.localName;f=c.get(f.localName);for(var t=0;t<f.length;t++)y(a.a,f[t]);(e=a.j.get(e))&&D(e);}}}E.prototype.get=function(a){if(a=this.a.a.get(a))return a.constructorFunction}; | ||
| E.prototype.m=function(a){if(!g(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this.j.get(a);if(b)return b.c;b=new ea;this.j.set(a,b);this.a.a.get(a)&&!this.g.some(function(b){return b.localName===a})&&D(b);return b.c};E.prototype.s=function(a){C(this.o);var b=this.f;this.f=function(d){return a(function(){return b(d)})};};window.CustomElementRegistry=E;E.prototype.define=E.prototype.l;E.prototype.upgrade=E.prototype.i;E.prototype.get=E.prototype.get; | ||
| E.prototype.whenDefined=E.prototype.m;E.prototype.polyfillWrapFlushCallback=E.prototype.s;var F=window.Document.prototype.createElement,G=window.Document.prototype.createElementNS,ha=window.Document.prototype.importNode,ia=window.Document.prototype.prepend,ja=window.Document.prototype.append,ka=window.DocumentFragment.prototype.prepend,la=window.DocumentFragment.prototype.append,H=window.Node.prototype.cloneNode,I=window.Node.prototype.appendChild,J=window.Node.prototype.insertBefore,K=window.Node.prototype.removeChild,L=window.Node.prototype.replaceChild,M=Object.getOwnPropertyDescriptor(window.Node.prototype, | ||
| "textContent"),N=window.Element.prototype.attachShadow,O=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),P=window.Element.prototype.getAttribute,Q=window.Element.prototype.setAttribute,R=window.Element.prototype.removeAttribute,S=window.Element.prototype.getAttributeNS,T=window.Element.prototype.setAttributeNS,U=window.Element.prototype.removeAttributeNS,ma=window.Element.prototype.insertAdjacentElement,na=window.Element.prototype.insertAdjacentHTML,oa=window.Element.prototype.prepend, | ||
| pa=window.Element.prototype.append,V=window.Element.prototype.before,qa=window.Element.prototype.after,ra=window.Element.prototype.replaceWith,sa=window.Element.prototype.remove,ta=window.HTMLElement,W=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ua=window.HTMLElement.prototype.insertAdjacentElement,va=window.HTMLElement.prototype.insertAdjacentHTML;var wa=new function(){};function xa(){var a=X;window.HTMLElement=function(){function b(){var b=this.constructor,c=a.g.get(b);if(!c)throw Error("The custom element being constructed was not registered with `customElements`.");var e=c.constructionStack;if(0===e.length)return e=F.call(document,c.localName),Object.setPrototypeOf(e,b.prototype),e.__CE_state=1,e.__CE_definition=c,w(a,e),e;c=e.length-1;var f=e[c];if(f===wa)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times."); | ||
| e[c]=wa;Object.setPrototypeOf(f,b.prototype);w(a,f);return f}b.prototype=ta.prototype;Object.defineProperty(b.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:b});return b}();}function Y(a,b,d){function c(b){return function(d){for(var e=[],c=0;c<arguments.length;++c)e[c]=arguments[c];c=[];for(var f=[],m=0;m<e.length;m++){var q=e[m];q instanceof Element&&l(q)&&f.push(q);if(q instanceof DocumentFragment)for(q=q.firstChild;q;q=q.nextSibling)c.push(q);else c.push(q);}b.apply(this,e);for(e=0;e<f.length;e++)z(a,f[e]);if(l(this))for(e=0;e<c.length;e++)f=c[e],f instanceof Element&&x(a,f);}}void 0!==d.h&&(b.prepend=c(d.h));void 0!==d.append&&(b.append=c(d.append));}function ya(){var a=X;r(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var d=a.a.get(b);if(d)return new d.constructorFunction}b=F.call(this,b);w(a,b);return b});r(Document.prototype,"importNode",function(b,d){b=ha.call(this,b,!!d);this.__CE_hasRegistry?A(a,b):v(a,b);return b});r(Document.prototype,"createElementNS",function(b,d){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var c=a.a.get(d);if(c)return new c.constructorFunction}b=G.call(this,b, | ||
| d);w(a,b);return b});Y(a,Document.prototype,{h:ia,append:ja});}function za(){function a(a,c){Object.defineProperty(a,"textContent",{enumerable:c.enumerable,configurable:!0,get:c.get,set:function(a){if(this.nodeType===Node.TEXT_NODE)c.set.call(this,a);else {var d=void 0;if(this.firstChild){var e=this.childNodes,k=e.length;if(0<k&&l(this)){d=Array(k);for(var h=0;h<k;h++)d[h]=e[h];}}c.set.call(this,a);if(d)for(a=0;a<d.length;a++)z(b,d[a]);}}});}var b=X;r(Node.prototype,"insertBefore",function(a,c){if(a instanceof DocumentFragment){var e=Array.prototype.slice.apply(a.childNodes); | ||
| a=J.call(this,a,c);if(l(this))for(c=0;c<e.length;c++)x(b,e[c]);return a}e=l(a);c=J.call(this,a,c);e&&z(b,a);l(this)&&x(b,a);return c});r(Node.prototype,"appendChild",function(a){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=I.call(this,a);if(l(this))for(var e=0;e<c.length;e++)x(b,c[e]);return a}c=l(a);e=I.call(this,a);c&&z(b,a);l(this)&&x(b,a);return e});r(Node.prototype,"cloneNode",function(a){a=H.call(this,!!a);this.ownerDocument.__CE_hasRegistry?A(b,a):v(b, | ||
| a);return a});r(Node.prototype,"removeChild",function(a){var c=l(a),e=K.call(this,a);c&&z(b,a);return e});r(Node.prototype,"replaceChild",function(a,c){if(a instanceof DocumentFragment){var e=Array.prototype.slice.apply(a.childNodes);a=L.call(this,a,c);if(l(this))for(z(b,c),c=0;c<e.length;c++)x(b,e[c]);return a}e=l(a);var f=L.call(this,a,c),d=l(this);d&&z(b,c);e&&z(b,a);d&&x(b,a);return f});M&&M.get?a(Node.prototype,M):ca(b,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){for(var a=[], | ||
| b=0;b<this.childNodes.length;b++){var f=this.childNodes[b];f.nodeType!==Node.COMMENT_NODE&&a.push(f.textContent);}return a.join("")},set:function(a){for(;this.firstChild;)K.call(this,this.firstChild);null!=a&&""!==a&&I.call(this,document.createTextNode(a));}});});}function Aa(a){function b(b){return function(e){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];d=[];for(var k=[],h=0;h<c.length;h++){var m=c[h];m instanceof Element&&l(m)&&k.push(m);if(m instanceof DocumentFragment)for(m=m.firstChild;m;m=m.nextSibling)d.push(m);else d.push(m);}b.apply(this,c);for(c=0;c<k.length;c++)z(a,k[c]);if(l(this))for(c=0;c<d.length;c++)k=d[c],k instanceof Element&&x(a,k);}}var d=Element.prototype;void 0!==V&&(d.before=b(V));void 0!==V&&(d.after=b(qa));void 0!==ra&& | ||
| r(d,"replaceWith",function(b){for(var e=[],c=0;c<arguments.length;++c)e[c]=arguments[c];c=[];for(var d=[],k=0;k<e.length;k++){var h=e[k];h instanceof Element&&l(h)&&d.push(h);if(h instanceof DocumentFragment)for(h=h.firstChild;h;h=h.nextSibling)c.push(h);else c.push(h);}k=l(this);ra.apply(this,e);for(e=0;e<d.length;e++)z(a,d[e]);if(k)for(z(a,this),e=0;e<c.length;e++)d=c[e],d instanceof Element&&x(a,d);});void 0!==sa&&r(d,"remove",function(){var b=l(this);sa.call(this);b&&z(a,this);});}function Ba(){function a(a,b){Object.defineProperty(a,"innerHTML",{enumerable:b.enumerable,configurable:!0,get:b.get,set:function(a){var e=this,d=void 0;l(this)&&(d=[],p(this,function(a){a!==e&&d.push(a);}));b.set.call(this,a);if(d)for(var f=0;f<d.length;f++){var t=d[f];1===t.__CE_state&&c.disconnectedCallback(t);}this.ownerDocument.__CE_hasRegistry?A(c,this):v(c,this);return a}});}function b(a,b){r(a,"insertAdjacentElement",function(a,e){var d=l(e);a=b.call(this,a,e);d&&z(c,e);l(a)&&x(c,e);return a});} | ||
| function d(a,b){function e(a,b){for(var e=[];a!==b;a=a.nextSibling)e.push(a);for(b=0;b<e.length;b++)A(c,e[b]);}r(a,"insertAdjacentHTML",function(a,c){a=a.toLowerCase();if("beforebegin"===a){var d=this.previousSibling;b.call(this,a,c);e(d||this.parentNode.firstChild,this);}else if("afterbegin"===a)d=this.firstChild,b.call(this,a,c),e(this.firstChild,d);else if("beforeend"===a)d=this.lastChild,b.call(this,a,c),e(d||this.firstChild,null);else if("afterend"===a)d=this.nextSibling,b.call(this,a,c),e(this.nextSibling, | ||
| d);else throw new SyntaxError("The value provided ("+String(a)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");});}var c=X;N&&r(Element.prototype,"attachShadow",function(a){a=N.call(this,a);var b=c;if(b.b&&!a.__CE_patched){a.__CE_patched=!0;for(var e=0;e<b.c.length;e++)b.c[e](a);}return this.__CE_shadowRoot=a});O&&O.get?a(Element.prototype,O):W&&W.get?a(HTMLElement.prototype,W):da(c,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){return H.call(this,!0).innerHTML}, | ||
| set:function(a){var b="template"===this.localName,c=b?this.content:this,e=G.call(document,this.namespaceURI,this.localName);for(e.innerHTML=a;0<c.childNodes.length;)K.call(c,c.childNodes[0]);for(a=b?e.content:e;0<a.childNodes.length;)I.call(c,a.childNodes[0]);}});});r(Element.prototype,"setAttribute",function(a,b){if(1!==this.__CE_state)return Q.call(this,a,b);var e=P.call(this,a);Q.call(this,a,b);b=P.call(this,a);c.attributeChangedCallback(this,a,e,b,null);});r(Element.prototype,"setAttributeNS",function(a, | ||
| b,d){if(1!==this.__CE_state)return T.call(this,a,b,d);var e=S.call(this,a,b);T.call(this,a,b,d);d=S.call(this,a,b);c.attributeChangedCallback(this,b,e,d,a);});r(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return R.call(this,a);var b=P.call(this,a);R.call(this,a);null!==b&&c.attributeChangedCallback(this,a,b,null,null);});r(Element.prototype,"removeAttributeNS",function(a,b){if(1!==this.__CE_state)return U.call(this,a,b);var d=S.call(this,a,b);U.call(this,a,b);var e=S.call(this, | ||
| a,b);d!==e&&c.attributeChangedCallback(this,b,d,e,a);});ua?b(HTMLElement.prototype,ua):ma?b(Element.prototype,ma):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");va?d(HTMLElement.prototype,va):na?d(Element.prototype,na):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched.");Y(c,Element.prototype,{h:oa,append:pa});Aa(c);}var Z=window.customElements;if(!Z||Z.forcePolyfill||"function"!=typeof Z.define||"function"!=typeof Z.get){var X=new u;xa();ya();Y(X,DocumentFragment.prototype,{h:ka,append:la});za();Ba();document.__CE_hasRegistry=!0;var customElements=new E(X);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements});}}).call(self); | ||
| // Polyfill document.baseURI | ||
| "string"!==typeof document.baseURI&&Object.defineProperty(Document.prototype,"baseURI",{enumerable:!0,configurable:!0,get:function(){var a=document.querySelector("base");return a&&a.href?a.href:document.URL}}); | ||
| // Polyfill CustomEvent | ||
| "function"!==typeof window.CustomEvent&&(window.CustomEvent=function(c,a){a=a||{bubbles:!1,cancelable:!1,detail:void 0};var b=document.createEvent("CustomEvent");b.initCustomEvent(c,a.bubbles,a.cancelable,a.detail);return b},window.CustomEvent.prototype=window.Event.prototype); | ||
| // Event.composedPath | ||
| (function(b,c,d){b.composedPath||(b.composedPath=function(){if(this.path)return this.path;var a=this.target;for(this.path=[];null!==a.parentNode;)this.path.push(a),a=a.parentNode;this.path.push(c,d);return this.path});})(Event.prototype,document,window); | ||
| /*! | ||
| Element.closest and Element.matches | ||
| https://github.com/jonathantneal/closest | ||
| Creative Commons Zero v1.0 Universal | ||
| */ | ||
| (function(a){"function"!==typeof a.matches&&(a.matches=a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||function(a){a=(this.document||this.ownerDocument).querySelectorAll(a);for(var b=0;a[b]&&a[b]!==this;)++b;return !!a[b]});"function"!==typeof a.closest&&(a.closest=function(a){for(var b=this;b&&1===b.nodeType;){if(b.matches(a))return b;b=b.parentNode;}return null});})(window.Element.prototype); | ||
| /*! | ||
| Element.getRootNode() | ||
| */ | ||
| (function(c){function d(a){a=b(a);return a&&11===a.nodeType?d(a.host):a}function b(a){return a&&a.parentNode?b(a.parentNode):a}"function"!==typeof c.getRootNode&&(c.getRootNode=function(a){return a&&a.composed?d(this):b(this)});})(Element.prototype); | ||
| /*! | ||
| Element.isConnected() | ||
| */ | ||
| (function(a){"isConnected"in a||Object.defineProperty(a,"isConnected",{configurable:!0,enumerable:!0,get:function(){var a=this.getRootNode({composed:!0});return a&&9===a.nodeType}});})(Element.prototype); | ||
| /*! | ||
| Element.remove() | ||
| */ | ||
| (function(b){b.forEach(function(a){a.hasOwnProperty("remove")||Object.defineProperty(a,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this);}});});})([Element.prototype,CharacterData.prototype,DocumentType.prototype]); | ||
| /*! | ||
| Element.classList | ||
| */ | ||
| !function(e){'classList'in e||Object.defineProperty(e,"classList",{get:function(){var e=this,t=(e.getAttribute("class")||"").replace(/^\s+|\s$/g,"").split(/\s+/g);function n(){t.length>0?e.setAttribute("class",t.join(" ")):e.removeAttribute("class");}return ""===t[0]&&t.splice(0,1),t.toggle=function(e,i){void 0!==i?i?t.add(e):t.remove(e):-1!==t.indexOf(e)?t.splice(t.indexOf(e),1):t.push(e),n();},t.add=function(){for(var e=[].slice.call(arguments),i=0,s=e.length;i<s;i++)-1===t.indexOf(e[i])&&t.push(e[i]);n();},t.remove=function(){for(var e=[].slice.call(arguments),i=0,s=e.length;i<s;i++)-1!==t.indexOf(e[i])&&t.splice(t.indexOf(e[i]),1);n();},t.item=function(e){return t[e]},t.contains=function(e){return -1!==t.indexOf(e)},t.replace=function(e,i){-1!==t.indexOf(e)&&t.splice(t.indexOf(e),1,i),n();},t.value=e.getAttribute("class")||"",t}});}(Element.prototype); | ||
| /*! | ||
| DOMTokenList | ||
| */ | ||
| (function(b){try{document.body.classList.add();}catch(e){var c=b.add,d=b.remove;b.add=function(){for(var a=0;a<arguments.length;a++)c.call(this,arguments[a]);};b.remove=function(){for(var a=0;a<arguments.length;a++)d.call(this,arguments[a]);};}})(DOMTokenList.prototype); |
| '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 scopeId; | ||
| let hostTagName; | ||
| let isSvgMode = false; | ||
| let queueCongestion = 0; | ||
| let queuePending = false; | ||
| const win = typeof window !== 'undefined' ? window : {}; | ||
| const CSS = win.CSS ; | ||
| 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), | ||
| ce: (eventName, opts) => new CustomEvent(eventName, opts), | ||
| }; | ||
| const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() ; | ||
| const promiseResolve = (v) => Promise.resolve(v); | ||
| const supportsConstructibleStylesheets = /*@__PURE__*/ (() => { | ||
| try { | ||
| new CSSStyleSheet(); | ||
| return true; | ||
| } | ||
| catch (e) { } | ||
| return false; | ||
| })() | ||
| ; | ||
| const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => { | ||
| if ( listeners) { | ||
| 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); | ||
| (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts)); | ||
| }); | ||
| } | ||
| }; | ||
| const hostListenerProxy = (hostRef, methodName) => (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$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); | ||
| } | ||
| } | ||
| }; | ||
| const getHostListenerTarget = (elm, flags) => { | ||
| if ( flags & 8 /* TargetWindow */) | ||
| return win; | ||
| return elm; | ||
| }; | ||
| // prettier-ignore | ||
| const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0; | ||
| const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; | ||
| 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); | ||
| 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 = (hostRef) => { | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const elm = hostRef.$hostElement$; | ||
| const flags = cmpMeta.$flags$; | ||
| const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); | ||
| const scopeId = addStyle( supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm); | ||
| if ( 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 = (cmp, mode) => 'sc-' + ( cmp.$tagName$); | ||
| /** | ||
| * Default style mode id | ||
| */ | ||
| /** | ||
| * Reusable empty obj/array | ||
| * Don't add values to these!! | ||
| */ | ||
| const EMPTY_OBJ = {}; | ||
| const isDef = (v) => v != null; | ||
| const noop = () => { | ||
| /* noop*/ | ||
| }; | ||
| const isComplexType = (o) => { | ||
| // https://jsperf.com/typeof-fn-object/5 | ||
| o = typeof o; | ||
| return o === 'object' || o === 'function'; | ||
| }; | ||
| const IS_DENO_ENV = typeof Deno !== 'undefined'; | ||
| const IS_NODE_ENV = !IS_DENO_ENV && | ||
| typeof global !== 'undefined' && | ||
| typeof require === 'function' && | ||
| !!global.process && | ||
| typeof __filename === 'string' && | ||
| (!global.origin || typeof global.origin !== 'string'); | ||
| const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; | ||
| const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/'; | ||
| const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop; | ||
| /** | ||
| * 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) { | ||
| 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) { | ||
| if (newValue !== false || elm.getAttribute(memberName) === '') { | ||
| { | ||
| 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 = (hostRef, renderFnResults) => { | ||
| const hostElm = hostRef.$hostElement$; | ||
| const oldVNode = hostRef.$vnode$ || newVNode(null, null); | ||
| const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); | ||
| hostTagName = hostElm.tagName; | ||
| 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 getElement = (ref) => ( getHostRef(ref).$hostElement$ ); | ||
| const createEvent = (ref, name, flags) => { | ||
| const elm = getElement(ref); | ||
| return { | ||
| emit: (detail) => { | ||
| return emitEvent(elm, name, { | ||
| bubbles: !!(flags & 4 /* Bubbles */), | ||
| composed: !!(flags & 2 /* Composed */), | ||
| cancelable: !!(flags & 1 /* Cancellable */), | ||
| detail, | ||
| }); | ||
| }, | ||
| }; | ||
| }; | ||
| const emitEvent = (elm, name, opts) => { | ||
| const ev = plt.ce(name, opts); | ||
| elm.dispatchEvent(ev); | ||
| return ev; | ||
| }; | ||
| const attachToAncestor = (hostRef, ancestorComponent) => { | ||
| if ( ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { | ||
| ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r))); | ||
| } | ||
| }; | ||
| const scheduleUpdate = (hostRef, isInitialLoad) => { | ||
| { | ||
| hostRef.$flags$ |= 16 /* isQueuedForUpdate */; | ||
| } | ||
| if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) { | ||
| hostRef.$flags$ |= 512 /* needsRerender */; | ||
| return; | ||
| } | ||
| attachToAncestor(hostRef, hostRef.$ancestorComponent$); | ||
| // there is no ancestorc omponent or the ancestor component | ||
| // has already fired off its lifecycle update then | ||
| // fire off the initial update | ||
| const dispatch = () => dispatchHooks(hostRef, isInitialLoad); | ||
| return writeTask(dispatch) ; | ||
| }; | ||
| const dispatchHooks = (hostRef, isInitialLoad) => { | ||
| const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| let promise; | ||
| if (isInitialLoad) { | ||
| { | ||
| hostRef.$flags$ |= 256 /* isListenReady */; | ||
| if (hostRef.$queuedListeners$) { | ||
| hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event)); | ||
| hostRef.$queuedListeners$ = null; | ||
| } | ||
| } | ||
| { | ||
| promise = safeCall(instance, 'componentWillLoad'); | ||
| } | ||
| } | ||
| { | ||
| promise = then(promise, () => safeCall(instance, 'componentWillRender')); | ||
| } | ||
| endSchedule(); | ||
| return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); | ||
| }; | ||
| const updateComponent = (hostRef, instance, isInitialLoad) => { | ||
| // updateComponent | ||
| const elm = hostRef.$hostElement$; | ||
| const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); | ||
| const rc = elm['s-rc']; | ||
| if ( isInitialLoad) { | ||
| // DOM WRITE! | ||
| attachStyles(hostRef); | ||
| } | ||
| const endRender = createTime('render', hostRef.$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(hostRef, callRender(hostRef, instance)); | ||
| } | ||
| } | ||
| if ( plt.$cssShim$) { | ||
| plt.$cssShim$.updateHost(elm); | ||
| } | ||
| 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.map(cb => cb()); | ||
| elm['s-rc'] = undefined; | ||
| } | ||
| endRender(); | ||
| endUpdate(); | ||
| { | ||
| const childrenPromises = elm['s-p']; | ||
| const postUpdate = () => postUpdateComponent(hostRef); | ||
| if (childrenPromises.length === 0) { | ||
| postUpdate(); | ||
| } | ||
| else { | ||
| Promise.all(childrenPromises).then(postUpdate); | ||
| hostRef.$flags$ |= 4 /* isWaitingForChildren */; | ||
| childrenPromises.length = 0; | ||
| } | ||
| } | ||
| }; | ||
| const callRender = (hostRef, instance) => { | ||
| try { | ||
| instance = instance.render() ; | ||
| { | ||
| hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; | ||
| } | ||
| { | ||
| hostRef.$flags$ |= 2 /* hasRendered */; | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e); | ||
| } | ||
| return instance; | ||
| }; | ||
| const postUpdateComponent = (hostRef) => { | ||
| const tagName = hostRef.$cmpMeta$.$tagName$; | ||
| const elm = hostRef.$hostElement$; | ||
| const endPostUpdate = createTime('postUpdate', tagName); | ||
| const ancestorComponent = hostRef.$ancestorComponent$; | ||
| if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { | ||
| hostRef.$flags$ |= 64 /* hasLoadedComponent */; | ||
| { | ||
| // DOM WRITE! | ||
| addHydratedFlag(elm); | ||
| } | ||
| 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(hostRef, false)); | ||
| } | ||
| hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); | ||
| } | ||
| // ( •_•) | ||
| // ( •_•)>⌐■-■ | ||
| // (⌐■_■) | ||
| }; | ||
| const forceUpdate = (ref) => { | ||
| { | ||
| const hostRef = getHostRef(ref); | ||
| const isConnected = hostRef.$hostElement$.isConnected; | ||
| if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { | ||
| scheduleUpdate(hostRef, 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 | ||
| { | ||
| addHydratedFlag(doc.documentElement); | ||
| } | ||
| { | ||
| plt.$flags$ |= 2 /* appLoaded */; | ||
| } | ||
| nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); | ||
| }; | ||
| 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 addHydratedFlag = (elm) => ( elm.classList.add('hydrated') ); | ||
| 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 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 oldVal = hostRef.$instanceValues$.get(propName); | ||
| const flags = hostRef.$flags$; | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); | ||
| if (( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) { | ||
| // 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(hostRef, 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.map(([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 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(); | ||
| } | ||
| if ( Cstr.style) { | ||
| // this component has styles but we haven't registered them yet | ||
| let style = Cstr.style; | ||
| const scopeId = getScopeId(cmpMeta); | ||
| if (!styles.has(scopeId)) { | ||
| const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); | ||
| if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) { | ||
| style = await Promise.resolve().then(function () { return require('./shadow-css-fd34e37c.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(hostRef, 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) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); | ||
| 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$).map(([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)); | ||
| } | ||
| } | ||
| else { | ||
| // not the first time this has connected | ||
| // reattach any event listeners to the host | ||
| // since they would have been removed when disconnected | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| } | ||
| endConnected(); | ||
| } | ||
| }; | ||
| const disconnectedCallback = (elm) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| { | ||
| if (hostRef.$rmListeners$) { | ||
| hostRef.$rmListeners$.map(rmListener => rmListener()); | ||
| 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 customElements = win.customElements; | ||
| const head = doc.head; | ||
| const metaCharset = /*@__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.map(lazyBundle => lazyBundle[1].map(compactMeta => { | ||
| const cmpMeta = { | ||
| $flags$: compactMeta[0], | ||
| $tagName$: compactMeta[1], | ||
| $members$: compactMeta[2], | ||
| $listeners$: compactMeta[3], | ||
| }; | ||
| { | ||
| cmpMeta.$members$ = compactMeta[2]; | ||
| } | ||
| { | ||
| cmpMeta.$listeners$ = compactMeta[3]; | ||
| } | ||
| if ( !supportsShadow && 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, cmpMeta); | ||
| 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 (supportsShadow) { | ||
| { | ||
| 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)); | ||
| } | ||
| } | ||
| disconnectedCallback() { | ||
| plt.jmp(() => disconnectedCallback(this)); | ||
| } | ||
| forceUpdate() { | ||
| forceUpdate(this); | ||
| } | ||
| componentOnReady() { | ||
| return getHostRef(this).$onReadyPromise$; | ||
| } | ||
| }; | ||
| cmpMeta.$lazyBundleId$ = lazyBundle[0]; | ||
| if (!exclude.includes(tagName) && !customElements.get(tagName)) { | ||
| cmpTags.push(tagName); | ||
| customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); | ||
| } | ||
| })); | ||
| { | ||
| visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; | ||
| visibilityStyle.setAttribute('data-styles', ''); | ||
| head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); | ||
| } | ||
| // Process deferred connectedCallbacks now all components have been registered | ||
| isBootstrapping = false; | ||
| if (deferredConnectedCallbacks.length) { | ||
| deferredConnectedCallbacks.map(host => host.connectedCallback()); | ||
| } | ||
| else { | ||
| { | ||
| plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); | ||
| } | ||
| } | ||
| // Fallback appLoad event | ||
| endBootstrap(); | ||
| }; | ||
| const hostRefs = new WeakMap(); | ||
| const getHostRef = (ref) => hostRefs.get(ref); | ||
| const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); | ||
| const registerHost = (elm, cmpMeta) => { | ||
| const hostRef = { | ||
| $flags$: 0, | ||
| $hostElement$: elm, | ||
| $cmpMeta$: cmpMeta, | ||
| $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'] = []; | ||
| } | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| return hostRefs.set(elm, hostRef); | ||
| }; | ||
| const isMemberInElement = (elm, memberName) => memberName in elm; | ||
| const consoleError = (e) => console.error(e); | ||
| const cmpModules = /*@__PURE__*/ new Map(); | ||
| const loadModule = (cmpMeta, hostRef, hmrVersionId) => { | ||
| // loadModuleImport | ||
| const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); | ||
| const bundleId = cmpMeta.$lazyBundleId$; | ||
| const module = cmpModules.get(bundleId) ; | ||
| if (module) { | ||
| return module[exportName]; | ||
| } | ||
| return Promise.resolve().then(function () { return _interopNamespace(require( | ||
| /* webpackInclude: /\.entry\.js$/ */ | ||
| /* webpackExclude: /\.system\.entry\.js$/ */ | ||
| /* webpackMode: "lazy" */ | ||
| `./${bundleId}.entry.js${ ''}`)); }).then(importedModule => { | ||
| { | ||
| cmpModules.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); | ||
| // DOM WRITES!!! | ||
| { | ||
| const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0)) : Infinity; | ||
| consumeTimeout(queueDomWrites, timeout); | ||
| consumeTimeout(queueDomWritesLow, timeout); | ||
| if (queueDomWrites.length > 0) { | ||
| queueDomWritesLow.push(...queueDomWrites); | ||
| queueDomWrites.length = 0; | ||
| } | ||
| if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) { | ||
| // 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) => promiseResolve().then(cb); | ||
| const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); | ||
| exports.CSS = CSS; | ||
| exports.NAMESPACE = NAMESPACE; | ||
| exports.bootstrapLazy = bootstrapLazy; | ||
| exports.createEvent = createEvent; | ||
| exports.doc = doc; | ||
| exports.getElement = getElement; | ||
| exports.h = h; | ||
| exports.plt = plt; | ||
| exports.promiseResolve = promiseResolve; | ||
| exports.registerInstance = registerInstance; | ||
| exports.win = win; |
| 'use strict'; | ||
| const index = require('./index-199e597b.js'); | ||
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| const noop = () => { | ||
| /* noop*/ | ||
| }; | ||
| const IS_DENO_ENV = typeof Deno !== 'undefined'; | ||
| const IS_NODE_ENV = !IS_DENO_ENV && | ||
| typeof global !== 'undefined' && | ||
| typeof require === 'function' && | ||
| !!global.process && | ||
| typeof __filename === 'string' && | ||
| (!global.origin || typeof global.origin !== 'string'); | ||
| const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; | ||
| const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/'; | ||
| const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop; | ||
| const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`; | ||
| const patchEsm = () => { | ||
| // NOTE!! This fn cannot use async/await! | ||
| // @ts-ignore | ||
| if ( !(index.CSS && index.CSS.supports && index.CSS.supports('color', 'var(--c)'))) { | ||
| // @ts-ignore | ||
| return Promise.resolve().then(function () { return require(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-1b988199.js'); }).then(() => { | ||
| if ((index.plt.$cssShim$ = index.win.__cssshim)) { | ||
| return index.plt.$cssShim$.i(); | ||
| } | ||
| else { | ||
| // for better minification | ||
| return 0; | ||
| } | ||
| }); | ||
| } | ||
| return index.promiseResolve(); | ||
| }; | ||
| const patchBrowser = () => { | ||
| { | ||
| // shim css vars | ||
| index.plt.$cssShim$ = index.win.__cssshim; | ||
| } | ||
| // @ts-ignore | ||
| const scriptElm = Array.from(index.doc.querySelectorAll('script')).find(s => new RegExp(`\/${index.NAMESPACE}(\\.esm)?\\.js($|\\?|#)`).test(s.src) || s.getAttribute('data-stencil-namespace') === index.NAMESPACE) | ||
| ; | ||
| const opts = scriptElm['data-opts'] || {} ; | ||
| 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() { | ||
| /* promise noop */ | ||
| }, | ||
| }; | ||
| } | ||
| { | ||
| opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, index.win.location.href)).href; | ||
| { | ||
| patchDynamicImport(opts.resourcesUrl, scriptElm); | ||
| } | ||
| if ( !index.win.customElements) { | ||
| // module support, but no custom elements support (Old Edge) | ||
| // @ts-ignore | ||
| return Promise.resolve().then(function () { return require(/* webpackChunkName: "polyfills-dom" */ './dom-760f300f.js'); }).then(() => opts); | ||
| } | ||
| } | ||
| return index.promiseResolve(opts); | ||
| }; | ||
| const patchDynamicImport = (base, orgScriptElm) => { | ||
| const importFunctionName = getDynamicImportFunction(index.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/chromium/issues/detail?id=990810 for more info | ||
| index.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(); | ||
| index.win[importFunctionName] = (src) => { | ||
| const url = new URL(src, base).href; | ||
| let mod = moduleMap.get(url); | ||
| if (!mod) { | ||
| const script = index.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(index.win[importFunctionName].m); | ||
| script.remove(); | ||
| }; | ||
| }); | ||
| moduleMap.set(url, mod); | ||
| index.doc.head.appendChild(script); | ||
| } | ||
| return mod; | ||
| }; | ||
| } | ||
| }; | ||
| exports.patchBrowser = patchBrowser; | ||
| exports.patchEsm = patchEsm; |
| 'use strict'; | ||
| /* | ||
| Stencil Client Platform v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| * | ||
| * This file is a port of shadowCSS from webcomponents.js to TypeScript. | ||
| * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js | ||
| * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts | ||
| */ | ||
| const safeSelector = (selector) => { | ||
| const placeholders = []; | ||
| let index = 0; | ||
| let content; | ||
| // Replaces attribute selectors with placeholders. | ||
| // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator. | ||
| selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => { | ||
| const replaceBy = `__ph-${index}__`; | ||
| placeholders.push(keep); | ||
| index++; | ||
| return replaceBy; | ||
| }); | ||
| // Replaces the expression in `:nth-child(2n + 1)` with a placeholder. | ||
| // WS and "+" would otherwise be interpreted as selector separators. | ||
| content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => { | ||
| const replaceBy = `__ph-${index}__`; | ||
| placeholders.push(exp); | ||
| index++; | ||
| return pseudo + replaceBy; | ||
| }); | ||
| const ss = { | ||
| content, | ||
| placeholders, | ||
| }; | ||
| return ss; | ||
| }; | ||
| const restoreSafeSelector = (placeholders, content) => { | ||
| return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]); | ||
| }; | ||
| const _polyfillHost = '-shadowcsshost'; | ||
| const _polyfillSlotted = '-shadowcssslotted'; | ||
| // note: :host-context pre-processed to -shadowcsshostcontext. | ||
| const _polyfillHostContext = '-shadowcsscontext'; | ||
| const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; | ||
| const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim'); | ||
| const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim'); | ||
| const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim'); | ||
| const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; | ||
| const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; | ||
| const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g]; | ||
| const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$'; | ||
| const _polyfillHostRe = /-shadowcsshost/gim; | ||
| const _colonHostRe = /:host/gim; | ||
| const _colonSlottedRe = /::slotted/gim; | ||
| const _colonHostContextRe = /:host-context/gim; | ||
| const _commentRe = /\/\*\s*[\s\S]*?\*\//g; | ||
| const stripComments = (input) => { | ||
| return input.replace(_commentRe, ''); | ||
| }; | ||
| const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; | ||
| const extractCommentsWithHash = (input) => { | ||
| return input.match(_commentWithHashRe) || []; | ||
| }; | ||
| const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; | ||
| const _curlyRe = /([{}])/g; | ||
| const OPEN_CURLY = '{'; | ||
| const CLOSE_CURLY = '}'; | ||
| const BLOCK_PLACEHOLDER = '%BLOCK%'; | ||
| const processRules = (input, ruleCallback) => { | ||
| const inputWithEscapedBlocks = escapeBlocks(input); | ||
| let nextBlockIndex = 0; | ||
| return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => { | ||
| const selector = m[2]; | ||
| let content = ''; | ||
| let suffix = m[4]; | ||
| let contentPrefix = ''; | ||
| if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) { | ||
| content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; | ||
| suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); | ||
| contentPrefix = '{'; | ||
| } | ||
| const cssRule = { | ||
| selector, | ||
| content, | ||
| }; | ||
| const rule = ruleCallback(cssRule); | ||
| return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`; | ||
| }); | ||
| }; | ||
| const escapeBlocks = (input) => { | ||
| const inputParts = input.split(_curlyRe); | ||
| const resultParts = []; | ||
| const escapedBlocks = []; | ||
| let bracketCount = 0; | ||
| let currentBlockParts = []; | ||
| for (let partIndex = 0; partIndex < inputParts.length; partIndex++) { | ||
| const part = inputParts[partIndex]; | ||
| if (part === CLOSE_CURLY) { | ||
| bracketCount--; | ||
| } | ||
| if (bracketCount > 0) { | ||
| currentBlockParts.push(part); | ||
| } | ||
| else { | ||
| if (currentBlockParts.length > 0) { | ||
| escapedBlocks.push(currentBlockParts.join('')); | ||
| resultParts.push(BLOCK_PLACEHOLDER); | ||
| currentBlockParts = []; | ||
| } | ||
| resultParts.push(part); | ||
| } | ||
| if (part === OPEN_CURLY) { | ||
| bracketCount++; | ||
| } | ||
| } | ||
| if (currentBlockParts.length > 0) { | ||
| escapedBlocks.push(currentBlockParts.join('')); | ||
| resultParts.push(BLOCK_PLACEHOLDER); | ||
| } | ||
| const strEscapedBlocks = { | ||
| escapedString: resultParts.join(''), | ||
| blocks: escapedBlocks, | ||
| }; | ||
| return strEscapedBlocks; | ||
| }; | ||
| const insertPolyfillHostInCssText = (selector) => { | ||
| selector = selector | ||
| .replace(_colonHostContextRe, _polyfillHostContext) | ||
| .replace(_colonHostRe, _polyfillHost) | ||
| .replace(_colonSlottedRe, _polyfillSlotted); | ||
| return selector; | ||
| }; | ||
| const convertColonRule = (cssText, regExp, partReplacer) => { | ||
| // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule | ||
| return cssText.replace(regExp, (...m) => { | ||
| if (m[2]) { | ||
| const parts = m[2].split(','); | ||
| const r = []; | ||
| for (let i = 0; i < parts.length; i++) { | ||
| const p = parts[i].trim(); | ||
| if (!p) | ||
| break; | ||
| r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); | ||
| } | ||
| return r.join(','); | ||
| } | ||
| else { | ||
| return _polyfillHostNoCombinator + m[3]; | ||
| } | ||
| }); | ||
| }; | ||
| const colonHostPartReplacer = (host, part, suffix) => { | ||
| return host + part.replace(_polyfillHost, '') + suffix; | ||
| }; | ||
| const convertColonHost = (cssText) => { | ||
| return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer); | ||
| }; | ||
| const colonHostContextPartReplacer = (host, part, suffix) => { | ||
| if (part.indexOf(_polyfillHost) > -1) { | ||
| return colonHostPartReplacer(host, part, suffix); | ||
| } | ||
| else { | ||
| return host + part + suffix + ', ' + part + ' ' + host + suffix; | ||
| } | ||
| }; | ||
| const convertColonSlotted = (cssText, slotScopeId) => { | ||
| const slotClass = '.' + slotScopeId + ' > '; | ||
| const selectors = []; | ||
| cssText = cssText.replace(_cssColonSlottedRe, (...m) => { | ||
| if (m[2]) { | ||
| const compound = m[2].trim(); | ||
| const suffix = m[3]; | ||
| const slottedSelector = slotClass + compound + suffix; | ||
| let prefixSelector = ''; | ||
| for (let i = m[4] - 1; i >= 0; i--) { | ||
| const char = m[5][i]; | ||
| if (char === '}' || char === ',') { | ||
| break; | ||
| } | ||
| prefixSelector = char + prefixSelector; | ||
| } | ||
| const orgSelector = prefixSelector + slottedSelector; | ||
| const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`; | ||
| if (orgSelector.trim() !== addedSelector.trim()) { | ||
| const updatedSelector = `${addedSelector}, ${orgSelector}`; | ||
| selectors.push({ | ||
| orgSelector, | ||
| updatedSelector, | ||
| }); | ||
| } | ||
| return slottedSelector; | ||
| } | ||
| else { | ||
| return _polyfillHostNoCombinator + m[3]; | ||
| } | ||
| }); | ||
| return { | ||
| selectors, | ||
| cssText, | ||
| }; | ||
| }; | ||
| const convertColonHostContext = (cssText) => { | ||
| return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer); | ||
| }; | ||
| const convertShadowDOMSelectors = (cssText) => { | ||
| return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText); | ||
| }; | ||
| const makeScopeMatcher = (scopeSelector) => { | ||
| const lre = /\[/g; | ||
| const rre = /\]/g; | ||
| scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]'); | ||
| return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); | ||
| }; | ||
| const selectorNeedsScoping = (selector, scopeSelector) => { | ||
| const re = makeScopeMatcher(scopeSelector); | ||
| return !re.test(selector); | ||
| }; | ||
| const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => { | ||
| // In Android browser, the lastIndex is not reset when the regex is used in String.replace() | ||
| _polyfillHostRe.lastIndex = 0; | ||
| if (_polyfillHostRe.test(selector)) { | ||
| const replaceBy = `.${hostSelector}`; | ||
| return selector | ||
| .replace(_polyfillHostNoCombinatorRe, (_, selector) => { | ||
| return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => { | ||
| return before + replaceBy + colon + after; | ||
| }); | ||
| }) | ||
| .replace(_polyfillHostRe, replaceBy + ' '); | ||
| } | ||
| return scopeSelector + ' ' + selector; | ||
| }; | ||
| const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => { | ||
| const isRe = /\[is=([^\]]*)\]/g; | ||
| scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]); | ||
| const className = '.' + scopeSelector; | ||
| const _scopeSelectorPart = (p) => { | ||
| let scopedP = p.trim(); | ||
| if (!scopedP) { | ||
| return ''; | ||
| } | ||
| if (p.indexOf(_polyfillHostNoCombinator) > -1) { | ||
| scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector); | ||
| } | ||
| else { | ||
| // remove :host since it should be unnecessary | ||
| const t = p.replace(_polyfillHostRe, ''); | ||
| if (t.length > 0) { | ||
| const matches = t.match(/([^:]*)(:*)(.*)/); | ||
| if (matches) { | ||
| scopedP = matches[1] + className + matches[2] + matches[3]; | ||
| } | ||
| } | ||
| } | ||
| return scopedP; | ||
| }; | ||
| const safeContent = safeSelector(selector); | ||
| selector = safeContent.content; | ||
| let scopedSelector = ''; | ||
| let startIndex = 0; | ||
| let res; | ||
| const sep = /( |>|\+|~(?!=))\s*/g; | ||
| // If a selector appears before :host it should not be shimmed as it | ||
| // matches on ancestor elements and not on elements in the host's shadow | ||
| // `:host-context(div)` is transformed to | ||
| // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator` | ||
| // the `div` is not part of the component in the 2nd selectors and should not be scoped. | ||
| // Historically `component-tag:host` was matching the component so we also want to preserve | ||
| // this behavior to avoid breaking legacy apps (it should not match). | ||
| // The behavior should be: | ||
| // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything) | ||
| // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a | ||
| // `:host-context(tag)`) | ||
| const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; | ||
| // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present | ||
| let shouldScope = !hasHost; | ||
| while ((res = sep.exec(selector)) !== null) { | ||
| const separator = res[1]; | ||
| const part = selector.slice(startIndex, res.index).trim(); | ||
| shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; | ||
| const scopedPart = shouldScope ? _scopeSelectorPart(part) : part; | ||
| scopedSelector += `${scopedPart} ${separator} `; | ||
| startIndex = sep.lastIndex; | ||
| } | ||
| const part = selector.substring(startIndex); | ||
| shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; | ||
| scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; | ||
| // replace the placeholders with their original values | ||
| return restoreSafeSelector(safeContent.placeholders, scopedSelector); | ||
| }; | ||
| const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => { | ||
| return selector | ||
| .split(',') | ||
| .map(shallowPart => { | ||
| if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) { | ||
| return shallowPart.trim(); | ||
| } | ||
| if (selectorNeedsScoping(shallowPart, scopeSelectorText)) { | ||
| return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim(); | ||
| } | ||
| else { | ||
| return shallowPart.trim(); | ||
| } | ||
| }) | ||
| .join(', '); | ||
| }; | ||
| const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => { | ||
| return processRules(cssText, (rule) => { | ||
| let selector = rule.selector; | ||
| let content = rule.content; | ||
| if (rule.selector[0] !== '@') { | ||
| selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector); | ||
| } | ||
| else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { | ||
| content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector); | ||
| } | ||
| const cssRule = { | ||
| selector: selector.replace(/\s{2,}/g, ' ').trim(), | ||
| content, | ||
| }; | ||
| return cssRule; | ||
| }); | ||
| }; | ||
| const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => { | ||
| cssText = insertPolyfillHostInCssText(cssText); | ||
| cssText = convertColonHost(cssText); | ||
| cssText = convertColonHostContext(cssText); | ||
| const slotted = convertColonSlotted(cssText, slotScopeId); | ||
| cssText = slotted.cssText; | ||
| cssText = convertShadowDOMSelectors(cssText); | ||
| if (scopeId) { | ||
| cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId); | ||
| } | ||
| cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`); | ||
| cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 '); | ||
| return { | ||
| cssText: cssText.trim(), | ||
| slottedSelectors: slotted.selectors, | ||
| }; | ||
| }; | ||
| const scopeCss = (cssText, scopeId, commentOriginalSelector) => { | ||
| const hostScopeId = scopeId + '-h'; | ||
| const slotScopeId = scopeId + '-s'; | ||
| const commentsWithHash = extractCommentsWithHash(cssText); | ||
| cssText = stripComments(cssText); | ||
| const orgSelectors = []; | ||
| if (commentOriginalSelector) { | ||
| const processCommentedSelector = (rule) => { | ||
| const placeholder = `/*!@___${orgSelectors.length}___*/`; | ||
| const comment = `/*!@${rule.selector}*/`; | ||
| orgSelectors.push({ placeholder, comment }); | ||
| rule.selector = placeholder + rule.selector; | ||
| return rule; | ||
| }; | ||
| cssText = processRules(cssText, rule => { | ||
| if (rule.selector[0] !== '@') { | ||
| return processCommentedSelector(rule); | ||
| } | ||
| else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { | ||
| rule.content = processRules(rule.content, processCommentedSelector); | ||
| return rule; | ||
| } | ||
| return rule; | ||
| }); | ||
| } | ||
| const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId); | ||
| cssText = [scoped.cssText, ...commentsWithHash].join('\n'); | ||
| if (commentOriginalSelector) { | ||
| orgSelectors.forEach(({ placeholder, comment }) => { | ||
| cssText = cssText.replace(placeholder, comment); | ||
| }); | ||
| } | ||
| scoped.slottedSelectors.forEach(slottedSelector => { | ||
| cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector); | ||
| }); | ||
| return cssText; | ||
| }; | ||
| exports.scopeCss = scopeCss; |
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| var StyleNode = function () { this.start = 0, this.end = 0, this.previous = null, this.parent = null, this.rules = null, this.parsedCssText = "", this.cssText = "", this.atRule = !1, this.type = 0, this.keyframesName = "", this.selector = "", this.parsedSelector = ""; }; | ||
| function parse(e) { return parseCss(lex(e = clean(e)), e); } | ||
| function clean(e) { return e.replace(RX.comments, "").replace(RX.port, ""); } | ||
| function lex(e) { var t = new StyleNode; t.start = 0, t.end = e.length; for (var r = t, n = 0, s = e.length; n < s; n++) | ||
| if (e[n] === OPEN_BRACE) { | ||
| r.rules || (r.rules = []); | ||
| var o = r, a = o.rules[o.rules.length - 1] || null; | ||
| (r = new StyleNode).start = n + 1, r.parent = o, r.previous = a, o.rules.push(r); | ||
| } | ||
| else | ||
| e[n] === CLOSE_BRACE && (r.end = n + 1, r = r.parent || t); return t; } | ||
| function parseCss(e, t) { var r = t.substring(e.start, e.end - 1); if (e.parsedCssText = e.cssText = r.trim(), e.parent) { | ||
| var n = e.previous ? e.previous.end : e.parent.start; | ||
| r = (r = (r = _expandUnicodeEscapes(r = t.substring(n, e.start - 1))).replace(RX.multipleSpaces, " ")).substring(r.lastIndexOf(";") + 1); | ||
| var s = e.parsedSelector = e.selector = r.trim(); | ||
| e.atRule = 0 === s.indexOf(AT_START), e.atRule ? 0 === s.indexOf(MEDIA_START) ? e.type = types.MEDIA_RULE : s.match(RX.keyframesRule) && (e.type = types.KEYFRAMES_RULE, e.keyframesName = e.selector.split(RX.multipleSpaces).pop()) : 0 === s.indexOf(VAR_START) ? e.type = types.MIXIN_RULE : e.type = types.STYLE_RULE; | ||
| } var o = e.rules; if (o) | ||
| for (var a = 0, i = o.length, l = void 0; a < i && (l = o[a]); a++) | ||
| parseCss(l, t); return e; } | ||
| function _expandUnicodeEscapes(e) { return e.replace(/\\([0-9a-f]{1,6})\s/gi, (function () { for (var e = arguments[1], t = 6 - e.length; t--;) | ||
| e = "0" + e; return "\\" + e; })); } | ||
| var types = { STYLE_RULE: 1, KEYFRAMES_RULE: 7, MEDIA_RULE: 4, MIXIN_RULE: 1e3 }, OPEN_BRACE = "{", CLOSE_BRACE = "}", RX = { comments: /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, port: /@import[^;]*;/gim, customProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim, mixinProp: /(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim, mixinApply: /@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim, varApply: /[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim, keyframesRule: /^@[^\s]*keyframes/, multipleSpaces: /\s+/g }, VAR_START = "--", MEDIA_START = "@media", AT_START = "@"; | ||
| function findRegex(e, t, r) { e.lastIndex = 0; var n = t.substring(r).match(e); if (n) { | ||
| var s = r + n.index; | ||
| return { start: s, end: s + n[0].length }; | ||
| } return null; } | ||
| var VAR_USAGE_START = /\bvar\(/, VAR_ASSIGN_START = /\B--[\w-]+\s*:/, COMMENTS = /\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim, TRAILING_LINES = /^[\t ]+\n/gm; | ||
| function resolveVar(e, t, r) { return e[t] ? e[t] : r ? executeTemplate(r, e) : ""; } | ||
| function findVarEndIndex(e, t) { for (var r = 0, n = t; n < e.length; n++) { | ||
| var s = e[n]; | ||
| if ("(" === s) | ||
| r++; | ||
| else if (")" === s && --r <= 0) | ||
| return n + 1; | ||
| } return n; } | ||
| function parseVar(e, t) { var r = findRegex(VAR_USAGE_START, e, t); if (!r) | ||
| return null; var n = findVarEndIndex(e, r.start), s = e.substring(r.end, n - 1).split(","), o = s[0], a = s.slice(1); return { start: r.start, end: n, propName: o.trim(), fallback: a.length > 0 ? a.join(",").trim() : void 0 }; } | ||
| function compileVar(e, t, r) { var n = parseVar(e, r); if (!n) | ||
| return t.push(e.substring(r, e.length)), e.length; var s = n.propName, o = null != n.fallback ? compileTemplate(n.fallback) : void 0; return t.push(e.substring(r, n.start), (function (e) { return resolveVar(e, s, o); })), n.end; } | ||
| function executeTemplate(e, t) { for (var r = "", n = 0; n < e.length; n++) { | ||
| var s = e[n]; | ||
| r += "string" == typeof s ? s : s(t); | ||
| } return r; } | ||
| function findEndValue(e, t) { for (var r = !1, n = !1, s = t; s < e.length; s++) { | ||
| var o = e[s]; | ||
| if (r) | ||
| n && '"' === o && (r = !1), n || "'" !== o || (r = !1); | ||
| else if ('"' === o) | ||
| r = !0, n = !0; | ||
| else if ("'" === o) | ||
| r = !0, n = !1; | ||
| else { | ||
| if (";" === o) | ||
| return s + 1; | ||
| if ("}" === o) | ||
| return s; | ||
| } | ||
| } return s; } | ||
| function removeCustomAssigns(e) { for (var t = "", r = 0;;) { | ||
| var n = findRegex(VAR_ASSIGN_START, e, r), s = n ? n.start : e.length; | ||
| if (t += e.substring(r, s), !n) | ||
| break; | ||
| r = findEndValue(e, s); | ||
| } return t; } | ||
| function compileTemplate(e) { var t = 0; e = removeCustomAssigns(e = e.replace(COMMENTS, "")).replace(TRAILING_LINES, ""); for (var r = []; t < e.length;) | ||
| t = compileVar(e, r, t); return r; } | ||
| function resolveValues(e) { var t = {}; e.forEach((function (e) { e.declarations.forEach((function (e) { t[e.prop] = e.value; })); })); for (var r = {}, n = Object.entries(t), s = function (e) { var t = !1; if (n.forEach((function (e) { var n = e[0], s = executeTemplate(e[1], r); s !== r[n] && (r[n] = s, t = !0); })), !t) | ||
| return "break"; }, o = 0; o < 10; o++) { | ||
| if ("break" === s()) | ||
| break; | ||
| } return r; } | ||
| function getSelectors(e, t) { if (void 0 === t && (t = 0), !e.rules) | ||
| return []; var r = []; return e.rules.filter((function (e) { return e.type === types.STYLE_RULE; })).forEach((function (e) { var n = getDeclarations(e.cssText); n.length > 0 && e.parsedSelector.split(",").forEach((function (e) { e = e.trim(), r.push({ selector: e, declarations: n, specificity: computeSpecificity(), nu: t }); })), t++; })), r; } | ||
| function computeSpecificity(e) { return 1; } | ||
| var IMPORTANT = "!important", FIND_DECLARATIONS = /(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm; | ||
| function getDeclarations(e) { for (var t, r = []; t = FIND_DECLARATIONS.exec(e.trim());) { | ||
| var n = normalizeValue(t[2]), s = n.value, o = n.important; | ||
| r.push({ prop: t[1].trim(), value: compileTemplate(s), important: o }); | ||
| } return r; } | ||
| function normalizeValue(e) { var t = (e = e.replace(/\s+/gim, " ").trim()).endsWith(IMPORTANT); return t && (e = e.substr(0, e.length - IMPORTANT.length).trim()), { value: e, important: t }; } | ||
| function getActiveSelectors(e, t, r) { var n = [], s = getScopesForElement(t, e); return r.forEach((function (e) { return n.push(e); })), s.forEach((function (e) { return n.push(e); })), sortSelectors(getSelectorsForScopes(n).filter((function (t) { return matches(e, t.selector); }))); } | ||
| function getScopesForElement(e, t) { for (var r = []; t;) { | ||
| var n = e.get(t); | ||
| n && r.push(n), t = t.parentElement; | ||
| } return r; } | ||
| function getSelectorsForScopes(e) { var t = []; return e.forEach((function (e) { t.push.apply(t, e.selectors); })), t; } | ||
| function sortSelectors(e) { return e.sort((function (e, t) { return e.specificity === t.specificity ? e.nu - t.nu : e.specificity - t.specificity; })), e; } | ||
| function matches(e, t) { return ":root" === t || "html" === t || e.matches(t); } | ||
| function parseCSS(e) { var t = parse(e), r = compileTemplate(e); return { original: e, template: r, selectors: getSelectors(t), usesCssVars: r.length > 1 }; } | ||
| function addGlobalStyle(e, t) { if (e.some((function (e) { return e.styleEl === t; }))) | ||
| return !1; var r = parseCSS(t.textContent); return r.styleEl = t, e.push(r), !0; } | ||
| function updateGlobalScopes(e) { var t = resolveValues(getSelectorsForScopes(e)); e.forEach((function (e) { e.usesCssVars && (e.styleEl.textContent = executeTemplate(e.template, t)); })); } | ||
| function reScope(e, t) { var r = e.template.map((function (r) { return "string" == typeof r ? replaceScope(r, e.scopeId, t) : r; })), n = e.selectors.map((function (r) { return Object.assign(Object.assign({}, r), { selector: replaceScope(r.selector, e.scopeId, t) }); })); return Object.assign(Object.assign({}, e), { template: r, selectors: n, scopeId: t }); } | ||
| function replaceScope(e, t, r) { return e = replaceAll(e, "\\." + t, "." + r); } | ||
| function replaceAll(e, t, r) { return e.replace(new RegExp(t, "g"), r); } | ||
| function loadDocument(e, t) { return loadDocumentStyles(e, t), loadDocumentLinks(e, t).then((function () { updateGlobalScopes(t); })); } | ||
| function startWatcher(e, t) { "undefined" != typeof MutationObserver && new MutationObserver((function () { loadDocumentStyles(e, t) && updateGlobalScopes(t); })).observe(document.head, { childList: !0 }); } | ||
| function loadDocumentLinks(e, t) { for (var r = [], n = e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'), s = 0; s < n.length; s++) | ||
| r.push(addGlobalLink(e, t, n[s])); return Promise.all(r); } | ||
| function loadDocumentStyles(e, t) { return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function (e) { return addGlobalStyle(t, e); })).some(Boolean); } | ||
| function addGlobalLink(e, t, r) { var n = r.href; return fetch(n).then((function (e) { return e.text(); })).then((function (s) { if (hasCssVariables(s) && r.parentNode) { | ||
| hasRelativeUrls(s) && (s = fixRelativeUrls(s, n)); | ||
| var o = e.createElement("style"); | ||
| o.setAttribute("data-styles", ""), o.textContent = s, addGlobalStyle(t, o), r.parentNode.insertBefore(o, r), r.remove(); | ||
| } })).catch((function (e) { console.error(e); })); } | ||
| var CSS_VARIABLE_REGEXP = /[\s;{]--[-a-zA-Z0-9]+\s*:/m; | ||
| function hasCssVariables(e) { return e.indexOf("var(") > -1 || CSS_VARIABLE_REGEXP.test(e); } | ||
| var CSS_URL_REGEXP = /url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim; | ||
| function hasRelativeUrls(e) { return CSS_URL_REGEXP.lastIndex = 0, CSS_URL_REGEXP.test(e); } | ||
| function fixRelativeUrls(e, t) { var r = t.replace(/[^/]*$/, ""); return e.replace(CSS_URL_REGEXP, (function (e, t) { var n = r + t; return e.replace(t, n); })); } | ||
| var CustomStyle = function () { function e(e, t) { this.win = e, this.doc = t, this.count = 0, this.hostStyleMap = new WeakMap, this.hostScopeMap = new WeakMap, this.globalScopes = [], this.scopesMap = new Map, this.didInit = !1; } return e.prototype.i = function () { var e = this; return this.didInit || !this.win.requestAnimationFrame ? Promise.resolve() : (this.didInit = !0, new Promise((function (t) { e.win.requestAnimationFrame((function () { startWatcher(e.doc, e.globalScopes), loadDocument(e.doc, e.globalScopes).then((function () { return t(); })); })); }))); }, e.prototype.addLink = function (e) { var t = this; return addGlobalLink(this.doc, this.globalScopes, e).then((function () { t.updateGlobal(); })); }, e.prototype.addGlobalStyle = function (e) { addGlobalStyle(this.globalScopes, e) && this.updateGlobal(); }, e.prototype.createHostStyle = function (e, t, r, n) { if (this.hostScopeMap.has(e)) | ||
| throw new Error("host style already created"); var s = this.registerHostTemplate(r, t, n), o = this.doc.createElement("style"); return o.setAttribute("data-no-shim", ""), s.usesCssVars ? n ? (o["s-sc"] = t = s.scopeId + "-" + this.count, o.textContent = "/*needs update*/", this.hostStyleMap.set(e, o), this.hostScopeMap.set(e, reScope(s, t)), this.count++) : (s.styleEl = o, s.usesCssVars || (o.textContent = executeTemplate(s.template, {})), this.globalScopes.push(s), this.updateGlobal(), this.hostScopeMap.set(e, s)) : o.textContent = r, o; }, e.prototype.removeHost = function (e) { var t = this.hostStyleMap.get(e); t && t.remove(), this.hostStyleMap.delete(e), this.hostScopeMap.delete(e); }, e.prototype.updateHost = function (e) { var t = this.hostScopeMap.get(e); if (t && t.usesCssVars && t.isScoped) { | ||
| var r = this.hostStyleMap.get(e); | ||
| if (r) { | ||
| var n = resolveValues(getActiveSelectors(e, this.hostScopeMap, this.globalScopes)); | ||
| r.textContent = executeTemplate(t.template, n); | ||
| } | ||
| } }, e.prototype.updateGlobal = function () { updateGlobalScopes(this.globalScopes); }, e.prototype.registerHostTemplate = function (e, t, r) { var n = this.scopesMap.get(t); return n || ((n = parseCSS(e)).scopeId = t, n.isScoped = r, this.scopesMap.set(t, n)), n; }, e; }(); | ||
| !function (e) { !e || e.__cssshim || e.CSS && e.CSS.supports && e.CSS.supports("color", "var(--c)") || (e.__cssshim = new CustomStyle(e, e.document)); }("undefined" != typeof window && window); |
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| (function () { | ||
| var aa = new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" ")); | ||
| function g(a) { var b = aa.has(a); a = /^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a); return !b && a; } | ||
| function l(a) { var b = a.isConnected; if (void 0 !== b) | ||
| return b; for (; a && !(a.__CE_isImportDocument || a instanceof Document);) | ||
| a = a.parentNode || (window.ShadowRoot && a instanceof ShadowRoot ? a.host : void 0); return !(!a || !(a.__CE_isImportDocument || a instanceof Document)); } | ||
| function n(a, b) { for (; b && b !== a && !b.nextSibling;) | ||
| b = b.parentNode; return b && b !== a ? b.nextSibling : null; } | ||
| function p(a, b, d) { d = void 0 === d ? new Set : d; for (var c = a; c;) { | ||
| if (c.nodeType === Node.ELEMENT_NODE) { | ||
| var e = c; | ||
| b(e); | ||
| var f = e.localName; | ||
| if ("link" === f && "import" === e.getAttribute("rel")) { | ||
| c = e.import; | ||
| if (c instanceof Node && !d.has(c)) | ||
| for (d.add(c), c = c.firstChild; c; c = c.nextSibling) | ||
| p(c, b, d); | ||
| c = n(a, e); | ||
| continue; | ||
| } | ||
| else if ("template" === f) { | ||
| c = n(a, e); | ||
| continue; | ||
| } | ||
| if (e = e.__CE_shadowRoot) | ||
| for (e = e.firstChild; e; e = e.nextSibling) | ||
| p(e, b, d); | ||
| } | ||
| c = c.firstChild ? c.firstChild : n(a, c); | ||
| } } | ||
| function r(a, b, d) { a[b] = d; } | ||
| function u() { this.a = new Map; this.g = new Map; this.c = []; this.f = []; this.b = !1; } | ||
| function ba(a, b, d) { a.a.set(b, d); a.g.set(d.constructorFunction, d); } | ||
| function ca(a, b) { a.b = !0; a.c.push(b); } | ||
| function da(a, b) { a.b = !0; a.f.push(b); } | ||
| function v(a, b) { a.b && p(b, function (b) { return w(a, b); }); } | ||
| function w(a, b) { if (a.b && !b.__CE_patched) { | ||
| b.__CE_patched = !0; | ||
| for (var d = 0; d < a.c.length; d++) | ||
| a.c[d](b); | ||
| for (d = 0; d < a.f.length; d++) | ||
| a.f[d](b); | ||
| } } | ||
| function x(a, b) { var d = []; p(b, function (b) { return d.push(b); }); for (b = 0; b < d.length; b++) { | ||
| var c = d[b]; | ||
| 1 === c.__CE_state ? a.connectedCallback(c) : y(a, c); | ||
| } } | ||
| function z(a, b) { var d = []; p(b, function (b) { return d.push(b); }); for (b = 0; b < d.length; b++) { | ||
| var c = d[b]; | ||
| 1 === c.__CE_state && a.disconnectedCallback(c); | ||
| } } | ||
| function A(a, b, d) { | ||
| d = void 0 === d ? {} : d; | ||
| var c = d.u || new Set, e = d.i || function (b) { return y(a, b); }, f = []; | ||
| p(b, function (b) { if ("link" === b.localName && "import" === b.getAttribute("rel")) { | ||
| var d = b.import; | ||
| d instanceof Node && (d.__CE_isImportDocument = !0, d.__CE_hasRegistry = !0); | ||
| d && "complete" === d.readyState ? d.__CE_documentLoadHandled = !0 : b.addEventListener("load", function () { var d = b.import; if (!d.__CE_documentLoadHandled) { | ||
| d.__CE_documentLoadHandled = !0; | ||
| var f = new Set(c); | ||
| f.delete(d); | ||
| A(a, d, { u: f, i: e }); | ||
| } }); | ||
| } | ||
| else | ||
| f.push(b); }, c); | ||
| if (a.b) | ||
| for (b = | ||
| 0; b < f.length; b++) | ||
| w(a, f[b]); | ||
| for (b = 0; b < f.length; b++) | ||
| e(f[b]); | ||
| } | ||
| function y(a, b) { | ||
| if (void 0 === b.__CE_state) { | ||
| var d = b.ownerDocument; | ||
| if (d.defaultView || d.__CE_isImportDocument && d.__CE_hasRegistry) | ||
| if (d = a.a.get(b.localName)) { | ||
| d.constructionStack.push(b); | ||
| var c = d.constructorFunction; | ||
| try { | ||
| try { | ||
| if (new c !== b) | ||
| throw Error("The custom element constructor did not produce the element being upgraded."); | ||
| } | ||
| finally { | ||
| d.constructionStack.pop(); | ||
| } | ||
| } | ||
| catch (t) { | ||
| throw b.__CE_state = 2, t; | ||
| } | ||
| b.__CE_state = 1; | ||
| b.__CE_definition = d; | ||
| if (d.attributeChangedCallback) | ||
| for (d = d.observedAttributes, c = 0; c < d.length; c++) { | ||
| var e = d[c], f = b.getAttribute(e); | ||
| null !== f && a.attributeChangedCallback(b, e, null, f, null); | ||
| } | ||
| l(b) && a.connectedCallback(b); | ||
| } | ||
| } | ||
| } | ||
| u.prototype.connectedCallback = function (a) { var b = a.__CE_definition; b.connectedCallback && b.connectedCallback.call(a); }; | ||
| u.prototype.disconnectedCallback = function (a) { var b = a.__CE_definition; b.disconnectedCallback && b.disconnectedCallback.call(a); }; | ||
| u.prototype.attributeChangedCallback = function (a, b, d, c, e) { var f = a.__CE_definition; f.attributeChangedCallback && -1 < f.observedAttributes.indexOf(b) && f.attributeChangedCallback.call(a, b, d, c, e); }; | ||
| function B(a) { var b = document; this.c = a; this.a = b; this.b = void 0; A(this.c, this.a); "loading" === this.a.readyState && (this.b = new MutationObserver(this.f.bind(this)), this.b.observe(this.a, { childList: !0, subtree: !0 })); } | ||
| function C(a) { a.b && a.b.disconnect(); } | ||
| B.prototype.f = function (a) { var b = this.a.readyState; "interactive" !== b && "complete" !== b || C(this); for (b = 0; b < a.length; b++) | ||
| for (var d = a[b].addedNodes, c = 0; c < d.length; c++) | ||
| A(this.c, d[c]); }; | ||
| function ea() { var a = this; this.b = this.a = void 0; this.c = new Promise(function (b) { a.b = b; a.a && b(a.a); }); } | ||
| function D(a) { if (a.a) | ||
| throw Error("Already resolved."); a.a = void 0; a.b && a.b(void 0); } | ||
| function E(a) { this.c = !1; this.a = a; this.j = new Map; this.f = function (b) { return b(); }; this.b = !1; this.g = []; this.o = new B(a); } | ||
| E.prototype.l = function (a, b) { | ||
| var d = this; | ||
| if (!(b instanceof Function)) | ||
| throw new TypeError("Custom element constructors must be functions."); | ||
| if (!g(a)) | ||
| throw new SyntaxError("The element name '" + a + "' is not valid."); | ||
| if (this.a.a.get(a)) | ||
| throw Error("A custom element with name '" + a + "' has already been defined."); | ||
| if (this.c) | ||
| throw Error("A custom element is already being defined."); | ||
| this.c = !0; | ||
| try { | ||
| var c = function (b) { | ||
| var a = e[b]; | ||
| if (void 0 !== a && !(a instanceof Function)) | ||
| throw Error("The '" + b + "' callback must be a function."); | ||
| return a; | ||
| }, e = b.prototype; | ||
| if (!(e instanceof Object)) | ||
| throw new TypeError("The custom element constructor's prototype is not an object."); | ||
| var f = c("connectedCallback"); | ||
| var t = c("disconnectedCallback"); | ||
| var k = c("adoptedCallback"); | ||
| var h = c("attributeChangedCallback"); | ||
| var m = b.observedAttributes || []; | ||
| } | ||
| catch (q) { | ||
| return; | ||
| } | ||
| finally { | ||
| this.c = !1; | ||
| } | ||
| b = { localName: a, constructorFunction: b, connectedCallback: f, disconnectedCallback: t, adoptedCallback: k, attributeChangedCallback: h, observedAttributes: m, constructionStack: [] }; | ||
| ba(this.a, a, b); | ||
| this.g.push(b); | ||
| this.b || (this.b = !0, this.f(function () { return fa(d); })); | ||
| }; | ||
| E.prototype.i = function (a) { A(this.a, a); }; | ||
| function fa(a) { if (!1 !== a.b) { | ||
| a.b = !1; | ||
| for (var b = a.g, d = [], c = new Map, e = 0; e < b.length; e++) | ||
| c.set(b[e].localName, []); | ||
| A(a.a, document, { i: function (b) { if (void 0 === b.__CE_state) { | ||
| var e = b.localName, f = c.get(e); | ||
| f ? f.push(b) : a.a.a.get(e) && d.push(b); | ||
| } } }); | ||
| for (e = 0; e < d.length; e++) | ||
| y(a.a, d[e]); | ||
| for (; 0 < b.length;) { | ||
| var f = b.shift(); | ||
| e = f.localName; | ||
| f = c.get(f.localName); | ||
| for (var t = 0; t < f.length; t++) | ||
| y(a.a, f[t]); | ||
| (e = a.j.get(e)) && D(e); | ||
| } | ||
| } } | ||
| E.prototype.get = function (a) { if (a = this.a.a.get(a)) | ||
| return a.constructorFunction; }; | ||
| E.prototype.m = function (a) { if (!g(a)) | ||
| return Promise.reject(new SyntaxError("'" + a + "' is not a valid custom element name.")); var b = this.j.get(a); if (b) | ||
| return b.c; b = new ea; this.j.set(a, b); this.a.a.get(a) && !this.g.some(function (b) { return b.localName === a; }) && D(b); return b.c; }; | ||
| E.prototype.s = function (a) { C(this.o); var b = this.f; this.f = function (d) { return a(function () { return b(d); }); }; }; | ||
| window.CustomElementRegistry = E; | ||
| E.prototype.define = E.prototype.l; | ||
| E.prototype.upgrade = E.prototype.i; | ||
| E.prototype.get = E.prototype.get; | ||
| E.prototype.whenDefined = E.prototype.m; | ||
| E.prototype.polyfillWrapFlushCallback = E.prototype.s; | ||
| var F = window.Document.prototype.createElement, G = window.Document.prototype.createElementNS, ha = window.Document.prototype.importNode, ia = window.Document.prototype.prepend, ja = window.Document.prototype.append, ka = window.DocumentFragment.prototype.prepend, la = window.DocumentFragment.prototype.append, H = window.Node.prototype.cloneNode, I = window.Node.prototype.appendChild, J = window.Node.prototype.insertBefore, K = window.Node.prototype.removeChild, L = window.Node.prototype.replaceChild, M = Object.getOwnPropertyDescriptor(window.Node.prototype, "textContent"), N = window.Element.prototype.attachShadow, O = Object.getOwnPropertyDescriptor(window.Element.prototype, "innerHTML"), P = window.Element.prototype.getAttribute, Q = window.Element.prototype.setAttribute, R = window.Element.prototype.removeAttribute, S = window.Element.prototype.getAttributeNS, T = window.Element.prototype.setAttributeNS, U = window.Element.prototype.removeAttributeNS, ma = window.Element.prototype.insertAdjacentElement, na = window.Element.prototype.insertAdjacentHTML, oa = window.Element.prototype.prepend, pa = window.Element.prototype.append, V = window.Element.prototype.before, qa = window.Element.prototype.after, ra = window.Element.prototype.replaceWith, sa = window.Element.prototype.remove, ta = window.HTMLElement, W = Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, "innerHTML"), ua = window.HTMLElement.prototype.insertAdjacentElement, va = window.HTMLElement.prototype.insertAdjacentHTML; | ||
| var wa = new function () { }; | ||
| function xa() { | ||
| var a = X; | ||
| window.HTMLElement = function () { | ||
| function b() { | ||
| var b = this.constructor, c = a.g.get(b); | ||
| if (!c) | ||
| throw Error("The custom element being constructed was not registered with `customElements`."); | ||
| var e = c.constructionStack; | ||
| if (0 === e.length) | ||
| return e = F.call(document, c.localName), Object.setPrototypeOf(e, b.prototype), e.__CE_state = 1, e.__CE_definition = c, w(a, e), e; | ||
| c = e.length - 1; | ||
| var f = e[c]; | ||
| if (f === wa) | ||
| throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times."); | ||
| e[c] = wa; | ||
| Object.setPrototypeOf(f, b.prototype); | ||
| w(a, f); | ||
| return f; | ||
| } | ||
| b.prototype = ta.prototype; | ||
| Object.defineProperty(b.prototype, "constructor", { writable: !0, configurable: !0, enumerable: !1, value: b }); | ||
| return b; | ||
| }(); | ||
| } | ||
| function Y(a, b, d) { function c(b) { return function (d) { for (var e = [], c = 0; c < arguments.length; ++c) | ||
| e[c] = arguments[c]; c = []; for (var f = [], m = 0; m < e.length; m++) { | ||
| var q = e[m]; | ||
| q instanceof Element && l(q) && f.push(q); | ||
| if (q instanceof DocumentFragment) | ||
| for (q = q.firstChild; q; q = q.nextSibling) | ||
| c.push(q); | ||
| else | ||
| c.push(q); | ||
| } b.apply(this, e); for (e = 0; e < f.length; e++) | ||
| z(a, f[e]); if (l(this)) | ||
| for (e = 0; e < c.length; e++) | ||
| f = c[e], f instanceof Element && x(a, f); }; } void 0 !== d.h && (b.prepend = c(d.h)); void 0 !== d.append && (b.append = c(d.append)); } | ||
| function ya() { | ||
| var a = X; | ||
| r(Document.prototype, "createElement", function (b) { if (this.__CE_hasRegistry) { | ||
| var d = a.a.get(b); | ||
| if (d) | ||
| return new d.constructorFunction; | ||
| } b = F.call(this, b); w(a, b); return b; }); | ||
| r(Document.prototype, "importNode", function (b, d) { b = ha.call(this, b, !!d); this.__CE_hasRegistry ? A(a, b) : v(a, b); return b; }); | ||
| r(Document.prototype, "createElementNS", function (b, d) { | ||
| if (this.__CE_hasRegistry && (null === b || "http://www.w3.org/1999/xhtml" === b)) { | ||
| var c = a.a.get(d); | ||
| if (c) | ||
| return new c.constructorFunction; | ||
| } | ||
| b = G.call(this, b, d); | ||
| w(a, b); | ||
| return b; | ||
| }); | ||
| Y(a, Document.prototype, { h: ia, append: ja }); | ||
| } | ||
| function za() { | ||
| function a(a, c) { Object.defineProperty(a, "textContent", { enumerable: c.enumerable, configurable: !0, get: c.get, set: function (a) { if (this.nodeType === Node.TEXT_NODE) | ||
| c.set.call(this, a); | ||
| else { | ||
| var d = void 0; | ||
| if (this.firstChild) { | ||
| var e = this.childNodes, k = e.length; | ||
| if (0 < k && l(this)) { | ||
| d = Array(k); | ||
| for (var h = 0; h < k; h++) | ||
| d[h] = e[h]; | ||
| } | ||
| } | ||
| c.set.call(this, a); | ||
| if (d) | ||
| for (a = 0; a < d.length; a++) | ||
| z(b, d[a]); | ||
| } } }); } | ||
| var b = X; | ||
| r(Node.prototype, "insertBefore", function (a, c) { | ||
| if (a instanceof DocumentFragment) { | ||
| var e = Array.prototype.slice.apply(a.childNodes); | ||
| a = J.call(this, a, c); | ||
| if (l(this)) | ||
| for (c = 0; c < e.length; c++) | ||
| x(b, e[c]); | ||
| return a; | ||
| } | ||
| e = l(a); | ||
| c = J.call(this, a, c); | ||
| e && z(b, a); | ||
| l(this) && x(b, a); | ||
| return c; | ||
| }); | ||
| r(Node.prototype, "appendChild", function (a) { if (a instanceof DocumentFragment) { | ||
| var c = Array.prototype.slice.apply(a.childNodes); | ||
| a = I.call(this, a); | ||
| if (l(this)) | ||
| for (var e = 0; e < c.length; e++) | ||
| x(b, c[e]); | ||
| return a; | ||
| } c = l(a); e = I.call(this, a); c && z(b, a); l(this) && x(b, a); return e; }); | ||
| r(Node.prototype, "cloneNode", function (a) { | ||
| a = H.call(this, !!a); | ||
| this.ownerDocument.__CE_hasRegistry ? A(b, a) : v(b, a); | ||
| return a; | ||
| }); | ||
| r(Node.prototype, "removeChild", function (a) { var c = l(a), e = K.call(this, a); c && z(b, a); return e; }); | ||
| r(Node.prototype, "replaceChild", function (a, c) { if (a instanceof DocumentFragment) { | ||
| var e = Array.prototype.slice.apply(a.childNodes); | ||
| a = L.call(this, a, c); | ||
| if (l(this)) | ||
| for (z(b, c), c = 0; c < e.length; c++) | ||
| x(b, e[c]); | ||
| return a; | ||
| } e = l(a); var f = L.call(this, a, c), d = l(this); d && z(b, c); e && z(b, a); d && x(b, a); return f; }); | ||
| M && M.get ? a(Node.prototype, M) : ca(b, function (b) { | ||
| a(b, { enumerable: !0, configurable: !0, get: function () { | ||
| for (var a = [], b = 0; b < this.childNodes.length; b++) { | ||
| var f = this.childNodes[b]; | ||
| f.nodeType !== Node.COMMENT_NODE && a.push(f.textContent); | ||
| } | ||
| return a.join(""); | ||
| }, set: function (a) { for (; this.firstChild;) | ||
| K.call(this, this.firstChild); null != a && "" !== a && I.call(this, document.createTextNode(a)); } }); | ||
| }); | ||
| } | ||
| function Aa(a) { | ||
| function b(b) { return function (e) { for (var c = [], d = 0; d < arguments.length; ++d) | ||
| c[d] = arguments[d]; d = []; for (var k = [], h = 0; h < c.length; h++) { | ||
| var m = c[h]; | ||
| m instanceof Element && l(m) && k.push(m); | ||
| if (m instanceof DocumentFragment) | ||
| for (m = m.firstChild; m; m = m.nextSibling) | ||
| d.push(m); | ||
| else | ||
| d.push(m); | ||
| } b.apply(this, c); for (c = 0; c < k.length; c++) | ||
| z(a, k[c]); if (l(this)) | ||
| for (c = 0; c < d.length; c++) | ||
| k = d[c], k instanceof Element && x(a, k); }; } | ||
| var d = Element.prototype; | ||
| void 0 !== V && (d.before = b(V)); | ||
| void 0 !== V && (d.after = b(qa)); | ||
| void 0 !== ra && | ||
| r(d, "replaceWith", function (b) { for (var e = [], c = 0; c < arguments.length; ++c) | ||
| e[c] = arguments[c]; c = []; for (var d = [], k = 0; k < e.length; k++) { | ||
| var h = e[k]; | ||
| h instanceof Element && l(h) && d.push(h); | ||
| if (h instanceof DocumentFragment) | ||
| for (h = h.firstChild; h; h = h.nextSibling) | ||
| c.push(h); | ||
| else | ||
| c.push(h); | ||
| } k = l(this); ra.apply(this, e); for (e = 0; e < d.length; e++) | ||
| z(a, d[e]); if (k) | ||
| for (z(a, this), e = 0; e < c.length; e++) | ||
| d = c[e], d instanceof Element && x(a, d); }); | ||
| void 0 !== sa && r(d, "remove", function () { var b = l(this); sa.call(this); b && z(a, this); }); | ||
| } | ||
| function Ba() { | ||
| function a(a, b) { Object.defineProperty(a, "innerHTML", { enumerable: b.enumerable, configurable: !0, get: b.get, set: function (a) { var e = this, d = void 0; l(this) && (d = [], p(this, function (a) { a !== e && d.push(a); })); b.set.call(this, a); if (d) | ||
| for (var f = 0; f < d.length; f++) { | ||
| var t = d[f]; | ||
| 1 === t.__CE_state && c.disconnectedCallback(t); | ||
| } this.ownerDocument.__CE_hasRegistry ? A(c, this) : v(c, this); return a; } }); } | ||
| function b(a, b) { r(a, "insertAdjacentElement", function (a, e) { var d = l(e); a = b.call(this, a, e); d && z(c, e); l(a) && x(c, e); return a; }); } | ||
| function d(a, b) { | ||
| function e(a, b) { for (var e = []; a !== b; a = a.nextSibling) | ||
| e.push(a); for (b = 0; b < e.length; b++) | ||
| A(c, e[b]); } | ||
| r(a, "insertAdjacentHTML", function (a, c) { | ||
| a = a.toLowerCase(); | ||
| if ("beforebegin" === a) { | ||
| var d = this.previousSibling; | ||
| b.call(this, a, c); | ||
| e(d || this.parentNode.firstChild, this); | ||
| } | ||
| else if ("afterbegin" === a) | ||
| d = this.firstChild, b.call(this, a, c), e(this.firstChild, d); | ||
| else if ("beforeend" === a) | ||
| d = this.lastChild, b.call(this, a, c), e(d || this.firstChild, null); | ||
| else if ("afterend" === a) | ||
| d = this.nextSibling, b.call(this, a, c), e(this.nextSibling, d); | ||
| else | ||
| throw new SyntaxError("The value provided (" + String(a) + ") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'."); | ||
| }); | ||
| } | ||
| var c = X; | ||
| N && r(Element.prototype, "attachShadow", function (a) { a = N.call(this, a); var b = c; if (b.b && !a.__CE_patched) { | ||
| a.__CE_patched = !0; | ||
| for (var e = 0; e < b.c.length; e++) | ||
| b.c[e](a); | ||
| } return this.__CE_shadowRoot = a; }); | ||
| O && O.get ? a(Element.prototype, O) : W && W.get ? a(HTMLElement.prototype, W) : da(c, function (b) { | ||
| a(b, { enumerable: !0, configurable: !0, get: function () { return H.call(this, !0).innerHTML; }, set: function (a) { var b = "template" === this.localName, c = b ? this.content : this, e = G.call(document, this.namespaceURI, this.localName); for (e.innerHTML = a; 0 < c.childNodes.length;) | ||
| K.call(c, c.childNodes[0]); for (a = b ? e.content : e; 0 < a.childNodes.length;) | ||
| I.call(c, a.childNodes[0]); } }); | ||
| }); | ||
| r(Element.prototype, "setAttribute", function (a, b) { if (1 !== this.__CE_state) | ||
| return Q.call(this, a, b); var e = P.call(this, a); Q.call(this, a, b); b = P.call(this, a); c.attributeChangedCallback(this, a, e, b, null); }); | ||
| r(Element.prototype, "setAttributeNS", function (a, b, d) { if (1 !== this.__CE_state) | ||
| return T.call(this, a, b, d); var e = S.call(this, a, b); T.call(this, a, b, d); d = S.call(this, a, b); c.attributeChangedCallback(this, b, e, d, a); }); | ||
| r(Element.prototype, "removeAttribute", function (a) { if (1 !== this.__CE_state) | ||
| return R.call(this, a); var b = P.call(this, a); R.call(this, a); null !== b && c.attributeChangedCallback(this, a, b, null, null); }); | ||
| r(Element.prototype, "removeAttributeNS", function (a, b) { | ||
| if (1 !== this.__CE_state) | ||
| return U.call(this, a, b); | ||
| var d = S.call(this, a, b); | ||
| U.call(this, a, b); | ||
| var e = S.call(this, a, b); | ||
| d !== e && c.attributeChangedCallback(this, b, d, e, a); | ||
| }); | ||
| ua ? b(HTMLElement.prototype, ua) : ma ? b(Element.prototype, ma) : console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched."); | ||
| va ? d(HTMLElement.prototype, va) : na ? d(Element.prototype, na) : console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched."); | ||
| Y(c, Element.prototype, { h: oa, append: pa }); | ||
| Aa(c); | ||
| } | ||
| var Z = window.customElements; | ||
| if (!Z || Z.forcePolyfill || "function" != typeof Z.define || "function" != typeof Z.get) { | ||
| var X = new u; | ||
| xa(); | ||
| ya(); | ||
| Y(X, DocumentFragment.prototype, { h: ka, append: la }); | ||
| za(); | ||
| Ba(); | ||
| document.__CE_hasRegistry = !0; | ||
| var customElements = new E(X); | ||
| Object.defineProperty(window, "customElements", { configurable: !0, enumerable: !0, value: customElements }); | ||
| } | ||
| }).call(self); | ||
| // Polyfill document.baseURI | ||
| "string" !== typeof document.baseURI && Object.defineProperty(Document.prototype, "baseURI", { enumerable: !0, configurable: !0, get: function () { var a = document.querySelector("base"); return a && a.href ? a.href : document.URL; } }); | ||
| // Polyfill CustomEvent | ||
| "function" !== typeof window.CustomEvent && (window.CustomEvent = function (c, a) { a = a || { bubbles: !1, cancelable: !1, detail: void 0 }; var b = document.createEvent("CustomEvent"); b.initCustomEvent(c, a.bubbles, a.cancelable, a.detail); return b; }, window.CustomEvent.prototype = window.Event.prototype); | ||
| // Event.composedPath | ||
| (function (b, c, d) { b.composedPath || (b.composedPath = function () { if (this.path) | ||
| return this.path; var a = this.target; for (this.path = []; null !== a.parentNode;) | ||
| this.path.push(a), a = a.parentNode; this.path.push(c, d); return this.path; }); })(Event.prototype, document, window); | ||
| /*! | ||
| Element.closest and Element.matches | ||
| https://github.com/jonathantneal/closest | ||
| Creative Commons Zero v1.0 Universal | ||
| */ | ||
| (function (a) { "function" !== typeof a.matches && (a.matches = a.msMatchesSelector || a.mozMatchesSelector || a.webkitMatchesSelector || function (a) { a = (this.document || this.ownerDocument).querySelectorAll(a); for (var b = 0; a[b] && a[b] !== this;) | ||
| ++b; return !!a[b]; }); "function" !== typeof a.closest && (a.closest = function (a) { for (var b = this; b && 1 === b.nodeType;) { | ||
| if (b.matches(a)) | ||
| return b; | ||
| b = b.parentNode; | ||
| } return null; }); })(window.Element.prototype); | ||
| /*! | ||
| Element.getRootNode() | ||
| */ | ||
| (function (c) { function d(a) { a = b(a); return a && 11 === a.nodeType ? d(a.host) : a; } function b(a) { return a && a.parentNode ? b(a.parentNode) : a; } "function" !== typeof c.getRootNode && (c.getRootNode = function (a) { return a && a.composed ? d(this) : b(this); }); })(Element.prototype); | ||
| /*! | ||
| Element.isConnected() | ||
| */ | ||
| (function (a) { "isConnected" in a || Object.defineProperty(a, "isConnected", { configurable: !0, enumerable: !0, get: function () { var a = this.getRootNode({ composed: !0 }); return a && 9 === a.nodeType; } }); })(Element.prototype); | ||
| /*! | ||
| Element.remove() | ||
| */ | ||
| (function (b) { b.forEach(function (a) { a.hasOwnProperty("remove") || Object.defineProperty(a, "remove", { configurable: !0, enumerable: !0, writable: !0, value: function () { null !== this.parentNode && this.parentNode.removeChild(this); } }); }); })([Element.prototype, CharacterData.prototype, DocumentType.prototype]); | ||
| /*! | ||
| Element.classList | ||
| */ | ||
| !function (e) { 'classList' in e || Object.defineProperty(e, "classList", { get: function () { var e = this, t = (e.getAttribute("class") || "").replace(/^\s+|\s$/g, "").split(/\s+/g); function n() { t.length > 0 ? e.setAttribute("class", t.join(" ")) : e.removeAttribute("class"); } return "" === t[0] && t.splice(0, 1), t.toggle = function (e, i) { void 0 !== i ? i ? t.add(e) : t.remove(e) : -1 !== t.indexOf(e) ? t.splice(t.indexOf(e), 1) : t.push(e), n(); }, t.add = function () { for (var e = [].slice.call(arguments), i = 0, s = e.length; i < s; i++) | ||
| -1 === t.indexOf(e[i]) && t.push(e[i]); n(); }, t.remove = function () { for (var e = [].slice.call(arguments), i = 0, s = e.length; i < s; i++) | ||
| -1 !== t.indexOf(e[i]) && t.splice(t.indexOf(e[i]), 1); n(); }, t.item = function (e) { return t[e]; }, t.contains = function (e) { return -1 !== t.indexOf(e); }, t.replace = function (e, i) { -1 !== t.indexOf(e) && t.splice(t.indexOf(e), 1, i), n(); }, t.value = e.getAttribute("class") || "", t; } }); }(Element.prototype); | ||
| /*! | ||
| DOMTokenList | ||
| */ | ||
| (function (b) { try { | ||
| document.body.classList.add(); | ||
| } | ||
| catch (e) { | ||
| var c = b.add, d = b.remove; | ||
| b.add = function () { for (var a = 0; a < arguments.length; a++) | ||
| c.call(this, arguments[a]); }; | ||
| b.remove = function () { for (var a = 0; a < arguments.length; a++) | ||
| d.call(this, arguments[a]); }; | ||
| } })(DOMTokenList.prototype); |
| 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 scopeId; | ||
| var hostTagName; | ||
| var isSvgMode = false; | ||
| var queueCongestion = 0; | ||
| var queuePending = false; | ||
| var win = typeof window !== 'undefined' ? window : {}; | ||
| var CSS = win.CSS; | ||
| 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); }, | ||
| ce: function (eventName, opts) { return new CustomEvent(eventName, opts); }, | ||
| }; | ||
| var supportsShadow = /*@__PURE__*/ (function () { return (doc.head.attachShadow + '').indexOf('[native') > -1; })(); | ||
| var promiseResolve = function (v) { return Promise.resolve(v); }; | ||
| var supportsConstructibleStylesheets = /*@__PURE__*/ (function () { | ||
| try { | ||
| new CSSStyleSheet(); | ||
| return true; | ||
| } | ||
| catch (e) { } | ||
| return false; | ||
| })(); | ||
| var addHostEventListeners = function (elm, hostRef, listeners, attachParentListeners) { | ||
| if (listeners) { | ||
| 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); | ||
| (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(function () { return plt.rel(target, name, handler, opts); }); | ||
| }); | ||
| } | ||
| }; | ||
| 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$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); | ||
| } | ||
| } | ||
| }; }; | ||
| var getHostListenerTarget = function (elm, flags) { | ||
| if (flags & 8 /* TargetWindow */) | ||
| return win; | ||
| return elm; | ||
| }; | ||
| // prettier-ignore | ||
| var hostListenerOpts = function (flags) { return (flags & 2 /* Capture */) !== 0; }; | ||
| var HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; | ||
| 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); | ||
| 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 (hostRef) { | ||
| var cmpMeta = hostRef.$cmpMeta$; | ||
| var elm = hostRef.$hostElement$; | ||
| var flags = cmpMeta.$flags$; | ||
| var endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); | ||
| var scopeId = addStyle(supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm); | ||
| if (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 (cmp, mode) { return 'sc-' + (cmp.$tagName$); }; | ||
| /** | ||
| * 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 noop = function () { | ||
| /* noop*/ | ||
| }; | ||
| var isComplexType = function (o) { | ||
| // https://jsperf.com/typeof-fn-object/5 | ||
| o = typeof o; | ||
| return o === 'object' || o === 'function'; | ||
| }; | ||
| var IS_DENO_ENV = typeof Deno !== 'undefined'; | ||
| var IS_NODE_ENV = !IS_DENO_ENV && | ||
| typeof global !== 'undefined' && | ||
| typeof require === 'function' && | ||
| !!global.process && | ||
| typeof __filename === 'string' && | ||
| (!global.origin || typeof global.origin !== 'string'); | ||
| var IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; | ||
| var getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : function () { return '/'; }; | ||
| var exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop; | ||
| /** | ||
| * 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) { | ||
| 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) { | ||
| if (newValue !== false || elm.getAttribute(memberName) === '') { | ||
| { | ||
| 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 (hostRef, renderFnResults) { | ||
| var hostElm = hostRef.$hostElement$; | ||
| var oldVNode = hostRef.$vnode$ || newVNode(null, null); | ||
| var rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); | ||
| hostTagName = hostElm.tagName; | ||
| 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 getElement = function (ref) { return (getHostRef(ref).$hostElement$); }; | ||
| var createEvent = function (ref, name, flags) { | ||
| var elm = getElement(ref); | ||
| return { | ||
| emit: function (detail) { | ||
| return emitEvent(elm, name, { | ||
| bubbles: !!(flags & 4 /* Bubbles */), | ||
| composed: !!(flags & 2 /* Composed */), | ||
| cancelable: !!(flags & 1 /* Cancellable */), | ||
| detail: detail, | ||
| }); | ||
| }, | ||
| }; | ||
| }; | ||
| var emitEvent = function (elm, name, opts) { | ||
| var ev = plt.ce(name, opts); | ||
| elm.dispatchEvent(ev); | ||
| return ev; | ||
| }; | ||
| var attachToAncestor = function (hostRef, ancestorComponent) { | ||
| if (ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { | ||
| ancestorComponent['s-p'].push(new Promise(function (r) { return (hostRef.$onRenderResolve$ = r); })); | ||
| } | ||
| }; | ||
| var scheduleUpdate = function (hostRef, isInitialLoad) { | ||
| { | ||
| hostRef.$flags$ |= 16 /* isQueuedForUpdate */; | ||
| } | ||
| if (hostRef.$flags$ & 4 /* isWaitingForChildren */) { | ||
| hostRef.$flags$ |= 512 /* needsRerender */; | ||
| return; | ||
| } | ||
| attachToAncestor(hostRef, hostRef.$ancestorComponent$); | ||
| // there is no ancestorc omponent or the ancestor component | ||
| // has already fired off its lifecycle update then | ||
| // fire off the initial update | ||
| var dispatch = function () { return dispatchHooks(hostRef, isInitialLoad); }; | ||
| return writeTask(dispatch); | ||
| }; | ||
| var dispatchHooks = function (hostRef, isInitialLoad) { | ||
| var endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); | ||
| var instance = hostRef.$lazyInstance$; | ||
| var promise; | ||
| if (isInitialLoad) { | ||
| { | ||
| hostRef.$flags$ |= 256 /* isListenReady */; | ||
| if (hostRef.$queuedListeners$) { | ||
| hostRef.$queuedListeners$.map(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(); | ||
| return then(promise, function () { return updateComponent(hostRef, instance, isInitialLoad); }); | ||
| }; | ||
| var updateComponent = function (hostRef, instance, isInitialLoad) { | ||
| // updateComponent | ||
| var elm = hostRef.$hostElement$; | ||
| var endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); | ||
| var rc = elm['s-rc']; | ||
| if (isInitialLoad) { | ||
| // DOM WRITE! | ||
| attachStyles(hostRef); | ||
| } | ||
| var endRender = createTime('render', hostRef.$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(hostRef, callRender(hostRef, instance)); | ||
| } | ||
| } | ||
| if (plt.$cssShim$) { | ||
| plt.$cssShim$.updateHost(elm); | ||
| } | ||
| 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.map(function (cb) { return cb(); }); | ||
| elm['s-rc'] = undefined; | ||
| } | ||
| endRender(); | ||
| endUpdate(); | ||
| { | ||
| var childrenPromises = elm['s-p']; | ||
| var postUpdate = function () { return postUpdateComponent(hostRef); }; | ||
| if (childrenPromises.length === 0) { | ||
| postUpdate(); | ||
| } | ||
| else { | ||
| Promise.all(childrenPromises).then(postUpdate); | ||
| hostRef.$flags$ |= 4 /* isWaitingForChildren */; | ||
| childrenPromises.length = 0; | ||
| } | ||
| } | ||
| }; | ||
| var callRender = function (hostRef, instance) { | ||
| try { | ||
| instance = instance.render(); | ||
| { | ||
| hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; | ||
| } | ||
| { | ||
| hostRef.$flags$ |= 2 /* hasRendered */; | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e); | ||
| } | ||
| return instance; | ||
| }; | ||
| var postUpdateComponent = function (hostRef) { | ||
| var tagName = hostRef.$cmpMeta$.$tagName$; | ||
| var elm = hostRef.$hostElement$; | ||
| var endPostUpdate = createTime('postUpdate', tagName); | ||
| var ancestorComponent = hostRef.$ancestorComponent$; | ||
| if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { | ||
| hostRef.$flags$ |= 64 /* hasLoadedComponent */; | ||
| { | ||
| // DOM WRITE! | ||
| addHydratedFlag(elm); | ||
| } | ||
| 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(hostRef, false); }); | ||
| } | ||
| hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); | ||
| } | ||
| // ( •_•) | ||
| // ( •_•)>⌐■-■ | ||
| // (⌐■_■) | ||
| }; | ||
| var forceUpdate = function (ref) { | ||
| { | ||
| var hostRef = getHostRef(ref); | ||
| var isConnected = hostRef.$hostElement$.isConnected; | ||
| if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { | ||
| scheduleUpdate(hostRef, 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 | ||
| { | ||
| addHydratedFlag(doc.documentElement); | ||
| } | ||
| { | ||
| plt.$flags$ |= 2 /* appLoaded */; | ||
| } | ||
| nextTick(function () { return emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } }); }); | ||
| }; | ||
| 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 addHydratedFlag = function (elm) { return (elm.classList.add('hydrated')); }; | ||
| 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 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 oldVal = hostRef.$instanceValues$.get(propName); | ||
| var flags = hostRef.$flags$; | ||
| var instance = hostRef.$lazyInstance$; | ||
| newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); | ||
| if ((!(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) { | ||
| // 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(hostRef, 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.map(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 initializeComponent = function (elm, hostRef, cmpMeta, hmrVersionId, Cstr) { return __awaiter(void 0, void 0, void 0, function () { | ||
| var endLoad, endNewInstance, style_1, scopeId_1, endRegisterStyles, 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(); | ||
| if (!Cstr.style) return [3 /*break*/, 5]; | ||
| style_1 = Cstr.style; | ||
| scopeId_1 = getScopeId(cmpMeta); | ||
| if (!!styles.has(scopeId_1)) return [3 /*break*/, 5]; | ||
| endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); | ||
| if (!(cmpMeta.$flags$ & 8) /* needsShadowDomShim */) return [3 /*break*/, 4]; /* needsShadowDomShim */ | ||
| return [4 /*yield*/, import('./shadow-css-fb1c6168.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(hostRef, 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) { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| var hostRef_1 = getHostRef(elm); | ||
| var cmpMeta_1 = hostRef_1.$cmpMeta$; | ||
| var endConnected = createTime('connectedCallback', cmpMeta_1.$tagName$); | ||
| 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_1.$members$) { | ||
| Object.entries(cmpMeta_1.$members$).map(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_1); }); | ||
| } | ||
| } | ||
| else { | ||
| // not the first time this has connected | ||
| // reattach any event listeners to the host | ||
| // since they would have been removed when disconnected | ||
| addHostEventListeners(elm, hostRef_1, cmpMeta_1.$listeners$); | ||
| } | ||
| endConnected(); | ||
| } | ||
| }; | ||
| var disconnectedCallback = function (elm) { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| var hostRef = getHostRef(elm); | ||
| { | ||
| if (hostRef.$rmListeners$) { | ||
| hostRef.$rmListeners$.map(function (rmListener) { return rmListener(); }); | ||
| 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 customElements = win.customElements; | ||
| var head = doc.head; | ||
| var metaCharset = /*@__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.map(function (lazyBundle) { return lazyBundle[1].map(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 (!supportsShadow && 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, cmpMeta); | ||
| 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 (supportsShadow) { | ||
| { | ||
| 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); }); | ||
| } | ||
| }; | ||
| HostElement.prototype.disconnectedCallback = function () { | ||
| var _this = this; | ||
| plt.jmp(function () { return disconnectedCallback(_this); }); | ||
| }; | ||
| HostElement.prototype.forceUpdate = function () { | ||
| forceUpdate(this); | ||
| }; | ||
| HostElement.prototype.componentOnReady = function () { | ||
| return getHostRef(this).$onReadyPromise$; | ||
| }; | ||
| return HostElement; | ||
| }(HTMLElement)); | ||
| cmpMeta.$lazyBundleId$ = lazyBundle[0]; | ||
| if (!exclude.includes(tagName) && !customElements.get(tagName)) { | ||
| cmpTags.push(tagName); | ||
| customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); | ||
| } | ||
| }); }); | ||
| { | ||
| visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; | ||
| visibilityStyle.setAttribute('data-styles', ''); | ||
| head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); | ||
| } | ||
| // Process deferred connectedCallbacks now all components have been registered | ||
| isBootstrapping = false; | ||
| if (deferredConnectedCallbacks.length) { | ||
| deferredConnectedCallbacks.map(function (host) { return host.connectedCallback(); }); | ||
| } | ||
| else { | ||
| { | ||
| plt.jmp(function () { return (appLoadFallback = setTimeout(appDidLoad, 30)); }); | ||
| } | ||
| } | ||
| // Fallback appLoad event | ||
| endBootstrap(); | ||
| }; | ||
| 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, cmpMeta) { | ||
| var hostRef = { | ||
| $flags$: 0, | ||
| $hostElement$: elm, | ||
| $cmpMeta$: cmpMeta, | ||
| $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'] = []; | ||
| } | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| return hostRefs.set(elm, hostRef); | ||
| }; | ||
| var isMemberInElement = function (elm, memberName) { return memberName in elm; }; | ||
| var consoleError = function (e) { return console.error(e); }; | ||
| var cmpModules = /*@__PURE__*/ new Map(); | ||
| var loadModule = function (cmpMeta, hostRef, hmrVersionId) { | ||
| // loadModuleImport | ||
| var exportName = cmpMeta.$tagName$.replace(/-/g, '_'); | ||
| var bundleId = cmpMeta.$lazyBundleId$; | ||
| var module = cmpModules.get(bundleId); | ||
| if (module) { | ||
| return module[exportName]; | ||
| } | ||
| return import( | ||
| /* webpackInclude: /\.entry\.js$/ */ | ||
| /* webpackExclude: /\.system\.entry\.js$/ */ | ||
| /* webpackMode: "lazy" */ | ||
| "./" + bundleId + ".entry.js" + '').then(function (importedModule) { | ||
| { | ||
| cmpModules.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); | ||
| // DOM WRITES!!! | ||
| { | ||
| var timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0)) : Infinity; | ||
| 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 promiseResolve().then(cb); }; | ||
| var writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); | ||
| export { CSS as C, NAMESPACE as N, promiseResolve as a, bootstrapLazy as b, createEvent as c, doc as d, getElement as g, h, plt as p, registerInstance as r, win as w }; |
| import { b as bootstrapLazy } from './index-537c62c6.js'; | ||
| import { a as patchEsm } from './patch-ccd9f0f0.js'; | ||
| var defineCustomElements = function (win, options) { | ||
| if (typeof window === 'undefined') | ||
| return Promise.resolve(); | ||
| return patchEsm().then(function () { | ||
| 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], "beforeUnload": [64], "load": [64], "preview": [64] }, [[8, "message", "componentWillLoad"]]]]]], options); | ||
| }); | ||
| }; | ||
| export { defineCustomElements }; |
| 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 }; | ||
| } | ||
| }; | ||
| import { r as registerInstance, c as createEvent, h, g as getElement } from './index-537c62c6.js'; | ||
| var editorCss = ":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}"; | ||
| var Editor = /** @class */ (function () { | ||
| function class_1(hostRef) { | ||
| registerInstance(this, hostRef); | ||
| this.editorEvent = createEvent(this, "editorEvent", 7); | ||
| this.content = ''; | ||
| this.assetsLoaded = false; | ||
| this.modalOpen = false; | ||
| } | ||
| class_1.prototype.sendMessage = function (action, data) { | ||
| this.editorFrame.contentWindow.postMessage({ | ||
| action: action, | ||
| data: data | ||
| }, "*"); | ||
| }; | ||
| class_1.prototype.save = function (opts) { | ||
| if (opts === void 0) { opts = {}; } | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| this.sendMessage("save", opts); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.test = function () { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| console.log("Only a test"); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.spinner = function (behavior) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| if (!['hide', 'show'].includes(behavior)) { | ||
| behavior = 'hide'; | ||
| } | ||
| this.sendMessage("showSpinner", { | ||
| behavior: behavior | ||
| }); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.start = function (data) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| this.sendMessage("load", data); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.sendTest = function (data) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| this.sendMessage("sendTest", data); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.beforeUnload = function (evt) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| this.sendMessage("beforeUnload", evt); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.load = function (data) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| this.sendMessage("load", data); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.preview = function (device) { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| return __generator(this, function (_a) { | ||
| this.sendMessage("preview", device); | ||
| return [2 /*return*/]; | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.initConfig = function () { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| var _a, _b, _c, isDebug; | ||
| return __generator(this, function (_d) { | ||
| switch (_d.label) { | ||
| case 0: | ||
| console.info("MailStyler Plugin: loading assets .."); | ||
| if (!(this.config.rteToolbars && | ||
| this.config.rteToolbars.toolbar_0 && | ||
| this.config.rteToolbars.toolbar_0 instanceof Promise)) return [3 /*break*/, 2]; | ||
| _a = this.config.rteToolbars; | ||
| return [4 /*yield*/, this.config.rteToolbars.toolbar_0]; | ||
| case 1: | ||
| _a.toolbar_0 = _d.sent(); | ||
| _d.label = 2; | ||
| case 2: | ||
| if (!(this.config.lang && | ||
| this.config.lang.custom && | ||
| this.config.lang.custom instanceof Promise)) return [3 /*break*/, 4]; | ||
| _b = this.config.lang; | ||
| return [4 /*yield*/, this.config.lang.custom]; | ||
| case 3: | ||
| _b.custom = _d.sent(); | ||
| _d.label = 4; | ||
| case 4: | ||
| if (!(this.config.rteToolbars && | ||
| this.config.rteToolbars.toolbar_1 && | ||
| this.config.rteToolbars.toolbar_1 instanceof Promise)) return [3 /*break*/, 6]; | ||
| _c = this.config.rteToolbars; | ||
| return [4 /*yield*/, this.config.rteToolbars.toolbar_1]; | ||
| case 5: | ||
| _c.toolbar_1 = _d.sent(); | ||
| _d.label = 6; | ||
| case 6: | ||
| isDebug = (typeof this.config.debug !== "undefined" && this.config.debug); | ||
| this.editorUrl = this.config.editorUrl || "//editor.mailstyler.com"; | ||
| this.mscFrameworkUrl = isDebug ? "http://localhost:4200" : this.editorUrl; | ||
| this.assetsLoaded = true; | ||
| console.info("MailStyler Plugin: assets loaded!"); | ||
| return [2 /*return*/]; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.componentWillRender = function () { | ||
| return __awaiter(this, void 0, void 0, function () { | ||
| var _a; | ||
| return __generator(this, function (_b) { | ||
| switch (_b.label) { | ||
| case 0: | ||
| _a = !this.assetsLoaded && this.config; | ||
| if (!_a) return [3 /*break*/, 2]; | ||
| return [4 /*yield*/, this.initConfig()]; | ||
| case 1: | ||
| _a = (_b.sent()); | ||
| _b.label = 2; | ||
| case 2: | ||
| _a; | ||
| return [2 /*return*/]; | ||
| } | ||
| }); | ||
| }); | ||
| }; | ||
| class_1.prototype.render = function () { | ||
| return (h("iframe", { class: { 'open': this.modalOpen }, src: this.mscFrameworkUrl })); | ||
| }; | ||
| class_1.prototype.editorDidOpen = function () { | ||
| var template = this.content || ''; | ||
| this.load(template).then(function (_) { return console.log("MailStyler Plugin: Template is loaded succesfully"); }); | ||
| }; | ||
| class_1.prototype.listenMessage = function (e) { | ||
| if (e.data && e.data.action) { | ||
| var _a = e.data, action = _a.action, data = _a.data; | ||
| if (action === "appOk") { | ||
| console.info("MailStyler Plugin: Editor is ready!"); | ||
| this.editorDidOpen(); | ||
| } | ||
| else if (action === "appReady") { | ||
| var editorConfig_1 = Object.assign({}, this.config); | ||
| Object.keys(editorConfig_1) | ||
| .filter(function (key) { return typeof editorConfig_1[key] === 'function'; }) | ||
| .forEach(function (key) { return delete editorConfig_1[key]; }); | ||
| this.sendMessage("init", { | ||
| token: this.token, | ||
| hostname: window.location.hostname, | ||
| config: editorConfig_1 | ||
| }); | ||
| } | ||
| else if (action === "appSave") { | ||
| var regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSave) { | ||
| this.config.onSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appAutoSave") { | ||
| var regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onAutoSave) { | ||
| this.config.onAutoSave(data.html, data.raw_html, data.json, data.opts); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onAutoSave callback"); | ||
| } | ||
| } | ||
| else if (action === "appSaveBlock") { | ||
| var regex = new RegExp('bgcolor="none"', 'g'); | ||
| data.html = data.html.replace(regex, ''); | ||
| data.raw_html = data.raw_html.replace(regex, ''); | ||
| if ("function" == typeof this.config.onSaveBlock) { | ||
| this.config.onSaveBlock(data.html, data.raw_html); | ||
| } | ||
| else { | ||
| console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback"); | ||
| } | ||
| } | ||
| else if (action === "appModal") { | ||
| this.modalOpen = data.env === 'open'; | ||
| } | ||
| this.editorEvent.emit({ action: action, data: data }); | ||
| } | ||
| }; | ||
| class_1.prototype.componentWillLoad = function (ev) { | ||
| this.editorFrame = this.element | ||
| .shadowRoot | ||
| .querySelector("iframe"); | ||
| if (ev) { | ||
| this.listenMessage(ev); | ||
| } | ||
| }; | ||
| Object.defineProperty(class_1.prototype, "element", { | ||
| get: function () { return getElement(this); }, | ||
| enumerable: false, | ||
| configurable: true | ||
| }); | ||
| return class_1; | ||
| }()); | ||
| Editor.style = editorCss; | ||
| export { Editor as ms_editor }; |
| import { b as bootstrapLazy } from './index-537c62c6.js'; | ||
| import { p as patchBrowser } from './patch-ccd9f0f0.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], "beforeUnload": [64], "load": [64], "preview": [64] }, [[8, "message", "componentWillLoad"]]]]]], options); | ||
| }); |
| import { C as CSS, p as plt, w as win, a as promiseResolve, d as doc, N as NAMESPACE } from './index-537c62c6.js'; | ||
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| var noop = function () { | ||
| /* noop*/ | ||
| }; | ||
| var IS_DENO_ENV = typeof Deno !== 'undefined'; | ||
| var IS_NODE_ENV = !IS_DENO_ENV && | ||
| typeof global !== 'undefined' && | ||
| typeof require === 'function' && | ||
| !!global.process && | ||
| typeof __filename === 'string' && | ||
| (!global.origin || typeof global.origin !== 'string'); | ||
| var IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; | ||
| var getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : function () { return '/'; }; | ||
| var exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop; | ||
| var getDynamicImportFunction = function (namespace) { return "__sc_import_" + namespace.replace(/\s|-/g, '_'); }; | ||
| var patchEsm = function () { | ||
| // NOTE!! This fn cannot use async/await! | ||
| // @ts-ignore | ||
| if (!(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) { | ||
| // @ts-ignore | ||
| return import(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-5ce2b5c4.js').then(function () { | ||
| if ((plt.$cssShim$ = win.__cssshim)) { | ||
| return plt.$cssShim$.i(); | ||
| } | ||
| else { | ||
| // for better minification | ||
| return 0; | ||
| } | ||
| }); | ||
| } | ||
| return promiseResolve(); | ||
| }; | ||
| var patchBrowser = function () { | ||
| { | ||
| // shim css vars | ||
| plt.$cssShim$ = win.__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'] || {}; | ||
| 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: function () { | ||
| /* promise noop */ | ||
| }, | ||
| }; | ||
| } | ||
| { | ||
| opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href; | ||
| { | ||
| patchDynamicImport(opts.resourcesUrl, scriptElm); | ||
| } | ||
| if (!win.customElements) { | ||
| // module support, but no custom elements support (Old Edge) | ||
| // @ts-ignore | ||
| return import(/* webpackChunkName: "polyfills-dom" */ './dom-91ed8d21.js').then(function () { return opts; }); | ||
| } | ||
| } | ||
| return promiseResolve(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/chromium/issues/detail?id=990810 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; | ||
| }; | ||
| } | ||
| }; | ||
| export { patchEsm as a, patchBrowser as p }; |
| 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; | ||
| }; | ||
| /* | ||
| Stencil Client Platform v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| * | ||
| * This file is a port of shadowCSS from webcomponents.js to TypeScript. | ||
| * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js | ||
| * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts | ||
| */ | ||
| var safeSelector = function (selector) { | ||
| var placeholders = []; | ||
| var index = 0; | ||
| var content; | ||
| // Replaces attribute selectors with placeholders. | ||
| // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator. | ||
| selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) { | ||
| var replaceBy = "__ph-" + index + "__"; | ||
| placeholders.push(keep); | ||
| index++; | ||
| return replaceBy; | ||
| }); | ||
| // Replaces the expression in `:nth-child(2n + 1)` with a placeholder. | ||
| // WS and "+" would otherwise be interpreted as selector separators. | ||
| content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) { | ||
| var replaceBy = "__ph-" + index + "__"; | ||
| placeholders.push(exp); | ||
| index++; | ||
| return pseudo + replaceBy; | ||
| }); | ||
| var ss = { | ||
| content: content, | ||
| placeholders: placeholders, | ||
| }; | ||
| return ss; | ||
| }; | ||
| var restoreSafeSelector = function (placeholders, content) { | ||
| return content.replace(/__ph-(\d+)__/g, function (_, index) { return placeholders[+index]; }); | ||
| }; | ||
| var _polyfillHost = '-shadowcsshost'; | ||
| var _polyfillSlotted = '-shadowcssslotted'; | ||
| // note: :host-context pre-processed to -shadowcsshostcontext. | ||
| var _polyfillHostContext = '-shadowcsscontext'; | ||
| var _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; | ||
| var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim'); | ||
| var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim'); | ||
| var _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim'); | ||
| var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; | ||
| var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; | ||
| var _shadowDOMSelectorsRe = [/::shadow/g, /::content/g]; | ||
| var _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$'; | ||
| var _polyfillHostRe = /-shadowcsshost/gim; | ||
| var _colonHostRe = /:host/gim; | ||
| var _colonSlottedRe = /::slotted/gim; | ||
| var _colonHostContextRe = /:host-context/gim; | ||
| var _commentRe = /\/\*\s*[\s\S]*?\*\//g; | ||
| var stripComments = function (input) { | ||
| return input.replace(_commentRe, ''); | ||
| }; | ||
| var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; | ||
| var extractCommentsWithHash = function (input) { | ||
| return input.match(_commentWithHashRe) || []; | ||
| }; | ||
| var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; | ||
| var _curlyRe = /([{}])/g; | ||
| var OPEN_CURLY = '{'; | ||
| var CLOSE_CURLY = '}'; | ||
| var BLOCK_PLACEHOLDER = '%BLOCK%'; | ||
| var processRules = function (input, ruleCallback) { | ||
| var inputWithEscapedBlocks = escapeBlocks(input); | ||
| var nextBlockIndex = 0; | ||
| return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () { | ||
| var m = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| m[_i] = arguments[_i]; | ||
| } | ||
| var selector = m[2]; | ||
| var content = ''; | ||
| var suffix = m[4]; | ||
| var contentPrefix = ''; | ||
| if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) { | ||
| content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; | ||
| suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); | ||
| contentPrefix = '{'; | ||
| } | ||
| var cssRule = { | ||
| selector: selector, | ||
| content: content, | ||
| }; | ||
| var rule = ruleCallback(cssRule); | ||
| return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix; | ||
| }); | ||
| }; | ||
| var escapeBlocks = function (input) { | ||
| var inputParts = input.split(_curlyRe); | ||
| var resultParts = []; | ||
| var escapedBlocks = []; | ||
| var bracketCount = 0; | ||
| var currentBlockParts = []; | ||
| for (var partIndex = 0; partIndex < inputParts.length; partIndex++) { | ||
| var part = inputParts[partIndex]; | ||
| if (part === CLOSE_CURLY) { | ||
| bracketCount--; | ||
| } | ||
| if (bracketCount > 0) { | ||
| currentBlockParts.push(part); | ||
| } | ||
| else { | ||
| if (currentBlockParts.length > 0) { | ||
| escapedBlocks.push(currentBlockParts.join('')); | ||
| resultParts.push(BLOCK_PLACEHOLDER); | ||
| currentBlockParts = []; | ||
| } | ||
| resultParts.push(part); | ||
| } | ||
| if (part === OPEN_CURLY) { | ||
| bracketCount++; | ||
| } | ||
| } | ||
| if (currentBlockParts.length > 0) { | ||
| escapedBlocks.push(currentBlockParts.join('')); | ||
| resultParts.push(BLOCK_PLACEHOLDER); | ||
| } | ||
| var strEscapedBlocks = { | ||
| escapedString: resultParts.join(''), | ||
| blocks: escapedBlocks, | ||
| }; | ||
| return strEscapedBlocks; | ||
| }; | ||
| var insertPolyfillHostInCssText = function (selector) { | ||
| selector = selector | ||
| .replace(_colonHostContextRe, _polyfillHostContext) | ||
| .replace(_colonHostRe, _polyfillHost) | ||
| .replace(_colonSlottedRe, _polyfillSlotted); | ||
| return selector; | ||
| }; | ||
| var convertColonRule = function (cssText, regExp, partReplacer) { | ||
| // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule | ||
| return cssText.replace(regExp, function () { | ||
| var m = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| m[_i] = arguments[_i]; | ||
| } | ||
| if (m[2]) { | ||
| var parts = m[2].split(','); | ||
| var r = []; | ||
| for (var i = 0; i < parts.length; i++) { | ||
| var p = parts[i].trim(); | ||
| if (!p) | ||
| break; | ||
| r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); | ||
| } | ||
| return r.join(','); | ||
| } | ||
| else { | ||
| return _polyfillHostNoCombinator + m[3]; | ||
| } | ||
| }); | ||
| }; | ||
| var colonHostPartReplacer = function (host, part, suffix) { | ||
| return host + part.replace(_polyfillHost, '') + suffix; | ||
| }; | ||
| var convertColonHost = function (cssText) { | ||
| return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer); | ||
| }; | ||
| var colonHostContextPartReplacer = function (host, part, suffix) { | ||
| if (part.indexOf(_polyfillHost) > -1) { | ||
| return colonHostPartReplacer(host, part, suffix); | ||
| } | ||
| else { | ||
| return host + part + suffix + ', ' + part + ' ' + host + suffix; | ||
| } | ||
| }; | ||
| var convertColonSlotted = function (cssText, slotScopeId) { | ||
| var slotClass = '.' + slotScopeId + ' > '; | ||
| var selectors = []; | ||
| cssText = cssText.replace(_cssColonSlottedRe, function () { | ||
| var m = []; | ||
| for (var _i = 0; _i < arguments.length; _i++) { | ||
| m[_i] = arguments[_i]; | ||
| } | ||
| if (m[2]) { | ||
| var compound = m[2].trim(); | ||
| var suffix = m[3]; | ||
| var slottedSelector = slotClass + compound + suffix; | ||
| var prefixSelector = ''; | ||
| for (var i = m[4] - 1; i >= 0; i--) { | ||
| var char = m[5][i]; | ||
| if (char === '}' || char === ',') { | ||
| break; | ||
| } | ||
| prefixSelector = char + prefixSelector; | ||
| } | ||
| var orgSelector = prefixSelector + slottedSelector; | ||
| var addedSelector = "" + prefixSelector.trimRight() + slottedSelector.trim(); | ||
| if (orgSelector.trim() !== addedSelector.trim()) { | ||
| var updatedSelector = addedSelector + ", " + orgSelector; | ||
| selectors.push({ | ||
| orgSelector: orgSelector, | ||
| updatedSelector: updatedSelector, | ||
| }); | ||
| } | ||
| return slottedSelector; | ||
| } | ||
| else { | ||
| return _polyfillHostNoCombinator + m[3]; | ||
| } | ||
| }); | ||
| return { | ||
| selectors: selectors, | ||
| cssText: cssText, | ||
| }; | ||
| }; | ||
| var convertColonHostContext = function (cssText) { | ||
| return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer); | ||
| }; | ||
| var convertShadowDOMSelectors = function (cssText) { | ||
| return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText); | ||
| }; | ||
| var makeScopeMatcher = function (scopeSelector) { | ||
| var lre = /\[/g; | ||
| var rre = /\]/g; | ||
| scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]'); | ||
| return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); | ||
| }; | ||
| var selectorNeedsScoping = function (selector, scopeSelector) { | ||
| var re = makeScopeMatcher(scopeSelector); | ||
| return !re.test(selector); | ||
| }; | ||
| var applySimpleSelectorScope = function (selector, scopeSelector, hostSelector) { | ||
| // In Android browser, the lastIndex is not reset when the regex is used in String.replace() | ||
| _polyfillHostRe.lastIndex = 0; | ||
| if (_polyfillHostRe.test(selector)) { | ||
| var replaceBy_1 = "." + hostSelector; | ||
| return selector | ||
| .replace(_polyfillHostNoCombinatorRe, function (_, selector) { | ||
| return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) { | ||
| return before + replaceBy_1 + colon + after; | ||
| }); | ||
| }) | ||
| .replace(_polyfillHostRe, replaceBy_1 + ' '); | ||
| } | ||
| return scopeSelector + ' ' + selector; | ||
| }; | ||
| var applyStrictSelectorScope = function (selector, scopeSelector, hostSelector) { | ||
| var isRe = /\[is=([^\]]*)\]/g; | ||
| scopeSelector = scopeSelector.replace(isRe, function (_) { | ||
| var parts = []; | ||
| for (var _i = 1; _i < arguments.length; _i++) { | ||
| parts[_i - 1] = arguments[_i]; | ||
| } | ||
| return parts[0]; | ||
| }); | ||
| var className = '.' + scopeSelector; | ||
| var _scopeSelectorPart = function (p) { | ||
| var scopedP = p.trim(); | ||
| if (!scopedP) { | ||
| return ''; | ||
| } | ||
| if (p.indexOf(_polyfillHostNoCombinator) > -1) { | ||
| scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector); | ||
| } | ||
| else { | ||
| // remove :host since it should be unnecessary | ||
| var t = p.replace(_polyfillHostRe, ''); | ||
| if (t.length > 0) { | ||
| var matches = t.match(/([^:]*)(:*)(.*)/); | ||
| if (matches) { | ||
| scopedP = matches[1] + className + matches[2] + matches[3]; | ||
| } | ||
| } | ||
| } | ||
| return scopedP; | ||
| }; | ||
| var safeContent = safeSelector(selector); | ||
| selector = safeContent.content; | ||
| var scopedSelector = ''; | ||
| var startIndex = 0; | ||
| var res; | ||
| var sep = /( |>|\+|~(?!=))\s*/g; | ||
| // If a selector appears before :host it should not be shimmed as it | ||
| // matches on ancestor elements and not on elements in the host's shadow | ||
| // `:host-context(div)` is transformed to | ||
| // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator` | ||
| // the `div` is not part of the component in the 2nd selectors and should not be scoped. | ||
| // Historically `component-tag:host` was matching the component so we also want to preserve | ||
| // this behavior to avoid breaking legacy apps (it should not match). | ||
| // The behavior should be: | ||
| // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything) | ||
| // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a | ||
| // `:host-context(tag)`) | ||
| var hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; | ||
| // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present | ||
| var shouldScope = !hasHost; | ||
| while ((res = sep.exec(selector)) !== null) { | ||
| var separator = res[1]; | ||
| var part_1 = selector.slice(startIndex, res.index).trim(); | ||
| shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1; | ||
| var scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1; | ||
| scopedSelector += scopedPart + " " + separator + " "; | ||
| startIndex = sep.lastIndex; | ||
| } | ||
| var part = selector.substring(startIndex); | ||
| shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; | ||
| scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; | ||
| // replace the placeholders with their original values | ||
| return restoreSafeSelector(safeContent.placeholders, scopedSelector); | ||
| }; | ||
| var scopeSelector = function (selector, scopeSelectorText, hostSelector, slotSelector) { | ||
| return selector | ||
| .split(',') | ||
| .map(function (shallowPart) { | ||
| if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) { | ||
| return shallowPart.trim(); | ||
| } | ||
| if (selectorNeedsScoping(shallowPart, scopeSelectorText)) { | ||
| return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim(); | ||
| } | ||
| else { | ||
| return shallowPart.trim(); | ||
| } | ||
| }) | ||
| .join(', '); | ||
| }; | ||
| var scopeSelectors = function (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) { | ||
| return processRules(cssText, function (rule) { | ||
| var selector = rule.selector; | ||
| var content = rule.content; | ||
| if (rule.selector[0] !== '@') { | ||
| selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector); | ||
| } | ||
| else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { | ||
| content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector); | ||
| } | ||
| var cssRule = { | ||
| selector: selector.replace(/\s{2,}/g, ' ').trim(), | ||
| content: content, | ||
| }; | ||
| return cssRule; | ||
| }); | ||
| }; | ||
| var scopeCssText = function (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) { | ||
| cssText = insertPolyfillHostInCssText(cssText); | ||
| cssText = convertColonHost(cssText); | ||
| cssText = convertColonHostContext(cssText); | ||
| var slotted = convertColonSlotted(cssText, slotScopeId); | ||
| cssText = slotted.cssText; | ||
| cssText = convertShadowDOMSelectors(cssText); | ||
| if (scopeId) { | ||
| cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId); | ||
| } | ||
| cssText = cssText.replace(/-shadowcsshost-no-combinator/g, "." + hostScopeId); | ||
| cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 '); | ||
| return { | ||
| cssText: cssText.trim(), | ||
| slottedSelectors: slotted.selectors, | ||
| }; | ||
| }; | ||
| var scopeCss = function (cssText, scopeId, commentOriginalSelector) { | ||
| var hostScopeId = scopeId + '-h'; | ||
| var slotScopeId = scopeId + '-s'; | ||
| var commentsWithHash = extractCommentsWithHash(cssText); | ||
| cssText = stripComments(cssText); | ||
| var orgSelectors = []; | ||
| if (commentOriginalSelector) { | ||
| var processCommentedSelector_1 = function (rule) { | ||
| var placeholder = "/*!@___" + orgSelectors.length + "___*/"; | ||
| var comment = "/*!@" + rule.selector + "*/"; | ||
| orgSelectors.push({ placeholder: placeholder, comment: comment }); | ||
| rule.selector = placeholder + rule.selector; | ||
| return rule; | ||
| }; | ||
| cssText = processRules(cssText, function (rule) { | ||
| if (rule.selector[0] !== '@') { | ||
| return processCommentedSelector_1(rule); | ||
| } | ||
| else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { | ||
| rule.content = processRules(rule.content, processCommentedSelector_1); | ||
| return rule; | ||
| } | ||
| return rule; | ||
| }); | ||
| } | ||
| var scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId); | ||
| cssText = __spreadArrays([scoped.cssText], commentsWithHash).join('\n'); | ||
| if (commentOriginalSelector) { | ||
| orgSelectors.forEach(function (_a) { | ||
| var placeholder = _a.placeholder, comment = _a.comment; | ||
| cssText = cssText.replace(placeholder, comment); | ||
| }); | ||
| } | ||
| scoped.slottedSelectors.forEach(function (slottedSelector) { | ||
| cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector); | ||
| }); | ||
| return cssText; | ||
| }; | ||
| export { scopeCss }; |
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| var StyleNode=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector="";};function parse(e){return parseCss(lex(e=clean(e)),e)}function clean(e){return e.replace(RX.comments,"").replace(RX.port,"")}function lex(e){var t=new StyleNode;t.start=0,t.end=e.length;for(var r=t,n=0,s=e.length;n<s;n++)if(e[n]===OPEN_BRACE){r.rules||(r.rules=[]);var o=r,a=o.rules[o.rules.length-1]||null;(r=new StyleNode).start=n+1,r.parent=o,r.previous=a,o.rules.push(r);}else e[n]===CLOSE_BRACE&&(r.end=n+1,r=r.parent||t);return t}function parseCss(e,t){var r=t.substring(e.start,e.end-1);if(e.parsedCssText=e.cssText=r.trim(),e.parent){var n=e.previous?e.previous.end:e.parent.start;r=(r=(r=_expandUnicodeEscapes(r=t.substring(n,e.start-1))).replace(RX.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var s=e.parsedSelector=e.selector=r.trim();e.atRule=0===s.indexOf(AT_START),e.atRule?0===s.indexOf(MEDIA_START)?e.type=types.MEDIA_RULE:s.match(RX.keyframesRule)&&(e.type=types.KEYFRAMES_RULE,e.keyframesName=e.selector.split(RX.multipleSpaces).pop()):0===s.indexOf(VAR_START)?e.type=types.MIXIN_RULE:e.type=types.STYLE_RULE;}var o=e.rules;if(o)for(var a=0,i=o.length,l=void 0;a<i&&(l=o[a]);a++)parseCss(l,t);return e}function _expandUnicodeEscapes(e){return e.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var e=arguments[1],t=6-e.length;t--;)e="0"+e;return "\\"+e}))}var types={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},OPEN_BRACE="{",CLOSE_BRACE="}",RX={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},VAR_START="--",MEDIA_START="@media",AT_START="@";function findRegex(e,t,r){e.lastIndex=0;var n=t.substring(r).match(e);if(n){var s=r+n.index;return {start:s,end:s+n[0].length}}return null}var VAR_USAGE_START=/\bvar\(/,VAR_ASSIGN_START=/\B--[\w-]+\s*:/,COMMENTS=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,TRAILING_LINES=/^[\t ]+\n/gm;function resolveVar(e,t,r){return e[t]?e[t]:r?executeTemplate(r,e):""}function findVarEndIndex(e,t){for(var r=0,n=t;n<e.length;n++){var s=e[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function parseVar(e,t){var r=findRegex(VAR_USAGE_START,e,t);if(!r)return null;var n=findVarEndIndex(e,r.start),s=e.substring(r.end,n-1).split(","),o=s[0],a=s.slice(1);return {start:r.start,end:n,propName:o.trim(),fallback:a.length>0?a.join(",").trim():void 0}}function compileVar(e,t,r){var n=parseVar(e,r);if(!n)return t.push(e.substring(r,e.length)),e.length;var s=n.propName,o=null!=n.fallback?compileTemplate(n.fallback):void 0;return t.push(e.substring(r,n.start),(function(e){return resolveVar(e,s,o)})),n.end}function executeTemplate(e,t){for(var r="",n=0;n<e.length;n++){var s=e[n];r+="string"==typeof s?s:s(t);}return r}function findEndValue(e,t){for(var r=!1,n=!1,s=t;s<e.length;s++){var o=e[s];if(r)n&&'"'===o&&(r=!1),n||"'"!==o||(r=!1);else if('"'===o)r=!0,n=!0;else if("'"===o)r=!0,n=!1;else {if(";"===o)return s+1;if("}"===o)return s}}return s}function removeCustomAssigns(e){for(var t="",r=0;;){var n=findRegex(VAR_ASSIGN_START,e,r),s=n?n.start:e.length;if(t+=e.substring(r,s),!n)break;r=findEndValue(e,s);}return t}function compileTemplate(e){var t=0;e=removeCustomAssigns(e=e.replace(COMMENTS,"")).replace(TRAILING_LINES,"");for(var r=[];t<e.length;)t=compileVar(e,r,t);return r}function resolveValues(e){var t={};e.forEach((function(e){e.declarations.forEach((function(e){t[e.prop]=e.value;}));}));for(var r={},n=Object.entries(t),s=function(e){var t=!1;if(n.forEach((function(e){var n=e[0],s=executeTemplate(e[1],r);s!==r[n]&&(r[n]=s,t=!0);})),!t)return "break"},o=0;o<10;o++){if("break"===s())break}return r}function getSelectors(e,t){if(void 0===t&&(t=0),!e.rules)return [];var r=[];return e.rules.filter((function(e){return e.type===types.STYLE_RULE})).forEach((function(e){var n=getDeclarations(e.cssText);n.length>0&&e.parsedSelector.split(",").forEach((function(e){e=e.trim(),r.push({selector:e,declarations:n,specificity:computeSpecificity(),nu:t});})),t++;})),r}function computeSpecificity(e){return 1}var IMPORTANT="!important",FIND_DECLARATIONS=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function getDeclarations(e){for(var t,r=[];t=FIND_DECLARATIONS.exec(e.trim());){var n=normalizeValue(t[2]),s=n.value,o=n.important;r.push({prop:t[1].trim(),value:compileTemplate(s),important:o});}return r}function normalizeValue(e){var t=(e=e.replace(/\s+/gim," ").trim()).endsWith(IMPORTANT);return t&&(e=e.substr(0,e.length-IMPORTANT.length).trim()),{value:e,important:t}}function getActiveSelectors(e,t,r){var n=[],s=getScopesForElement(t,e);return r.forEach((function(e){return n.push(e)})),s.forEach((function(e){return n.push(e)})),sortSelectors(getSelectorsForScopes(n).filter((function(t){return matches(e,t.selector)})))}function getScopesForElement(e,t){for(var r=[];t;){var n=e.get(t);n&&r.push(n),t=t.parentElement;}return r}function getSelectorsForScopes(e){var t=[];return e.forEach((function(e){t.push.apply(t,e.selectors);})),t}function sortSelectors(e){return e.sort((function(e,t){return e.specificity===t.specificity?e.nu-t.nu:e.specificity-t.specificity})),e}function matches(e,t){return ":root"===t||"html"===t||e.matches(t)}function parseCSS(e){var t=parse(e),r=compileTemplate(e);return {original:e,template:r,selectors:getSelectors(t),usesCssVars:r.length>1}}function addGlobalStyle(e,t){if(e.some((function(e){return e.styleEl===t})))return !1;var r=parseCSS(t.textContent);return r.styleEl=t,e.push(r),!0}function updateGlobalScopes(e){var t=resolveValues(getSelectorsForScopes(e));e.forEach((function(e){e.usesCssVars&&(e.styleEl.textContent=executeTemplate(e.template,t));}));}function reScope(e,t){var r=e.template.map((function(r){return "string"==typeof r?replaceScope(r,e.scopeId,t):r})),n=e.selectors.map((function(r){return Object.assign(Object.assign({},r),{selector:replaceScope(r.selector,e.scopeId,t)})}));return Object.assign(Object.assign({},e),{template:r,selectors:n,scopeId:t})}function replaceScope(e,t,r){return e=replaceAll(e,"\\."+t,"."+r)}function replaceAll(e,t,r){return e.replace(new RegExp(t,"g"),r)}function loadDocument(e,t){return loadDocumentStyles(e,t),loadDocumentLinks(e,t).then((function(){updateGlobalScopes(t);}))}function startWatcher(e,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){loadDocumentStyles(e,t)&&updateGlobalScopes(t);})).observe(document.head,{childList:!0});}function loadDocumentLinks(e,t){for(var r=[],n=e.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(addGlobalLink(e,t,n[s]));return Promise.all(r)}function loadDocumentStyles(e,t){return Array.from(e.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(e){return addGlobalStyle(t,e)})).some(Boolean)}function addGlobalLink(e,t,r){var n=r.href;return fetch(n).then((function(e){return e.text()})).then((function(s){if(hasCssVariables(s)&&r.parentNode){hasRelativeUrls(s)&&(s=fixRelativeUrls(s,n));var o=e.createElement("style");o.setAttribute("data-styles",""),o.textContent=s,addGlobalStyle(t,o),r.parentNode.insertBefore(o,r),r.remove();}})).catch((function(e){console.error(e);}))}var CSS_VARIABLE_REGEXP=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function hasCssVariables(e){return e.indexOf("var(")>-1||CSS_VARIABLE_REGEXP.test(e)}var CSS_URL_REGEXP=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function hasRelativeUrls(e){return CSS_URL_REGEXP.lastIndex=0,CSS_URL_REGEXP.test(e)}function fixRelativeUrls(e,t){var r=t.replace(/[^/]*$/,"");return e.replace(CSS_URL_REGEXP,(function(e,t){var n=r+t;return e.replace(t,n)}))}var CustomStyle=function(){function e(e,t){this.win=e,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1;}return e.prototype.i=function(){var e=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){e.win.requestAnimationFrame((function(){startWatcher(e.doc,e.globalScopes),loadDocument(e.doc,e.globalScopes).then((function(){return t()}));}));})))},e.prototype.addLink=function(e){var t=this;return addGlobalLink(this.doc,this.globalScopes,e).then((function(){t.updateGlobal();}))},e.prototype.addGlobalStyle=function(e){addGlobalStyle(this.globalScopes,e)&&this.updateGlobal();},e.prototype.createHostStyle=function(e,t,r,n){if(this.hostScopeMap.has(e))throw new Error("host style already created");var s=this.registerHostTemplate(r,t,n),o=this.doc.createElement("style");return o.setAttribute("data-no-shim",""),s.usesCssVars?n?(o["s-sc"]=t=s.scopeId+"-"+this.count,o.textContent="/*needs update*/",this.hostStyleMap.set(e,o),this.hostScopeMap.set(e,reScope(s,t)),this.count++):(s.styleEl=o,s.usesCssVars||(o.textContent=executeTemplate(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(e,s)):o.textContent=r,o},e.prototype.removeHost=function(e){var t=this.hostStyleMap.get(e);t&&t.remove(),this.hostStyleMap.delete(e),this.hostScopeMap.delete(e);},e.prototype.updateHost=function(e){var t=this.hostScopeMap.get(e);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(e);if(r){var n=resolveValues(getActiveSelectors(e,this.hostScopeMap,this.globalScopes));r.textContent=executeTemplate(t.template,n);}}},e.prototype.updateGlobal=function(){updateGlobalScopes(this.globalScopes);},e.prototype.registerHostTemplate=function(e,t,r){var n=this.scopesMap.get(t);return n||((n=parseCSS(e)).scopeId=t,n.isScoped=r,this.scopesMap.set(t,n)),n},e}();!function(e){!e||e.__cssshim||e.CSS&&e.CSS.supports&&e.CSS.supports("color","var(--c)")||(e.__cssshim=new CustomStyle(e,e.document));}("undefined"!=typeof window&&window); |
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| (function(){ | ||
| var aa=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function g(a){var b=aa.has(a);a=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(a);return !b&&a}function l(a){var b=a.isConnected;if(void 0!==b)return b;for(;a&&!(a.__CE_isImportDocument||a instanceof Document);)a=a.parentNode||(window.ShadowRoot&&a instanceof ShadowRoot?a.host:void 0);return !(!a||!(a.__CE_isImportDocument||a instanceof Document))} | ||
| function n(a,b){for(;b&&b!==a&&!b.nextSibling;)b=b.parentNode;return b&&b!==a?b.nextSibling:null} | ||
| function p(a,b,d){d=void 0===d?new Set:d;for(var c=a;c;){if(c.nodeType===Node.ELEMENT_NODE){var e=c;b(e);var f=e.localName;if("link"===f&&"import"===e.getAttribute("rel")){c=e.import;if(c instanceof Node&&!d.has(c))for(d.add(c),c=c.firstChild;c;c=c.nextSibling)p(c,b,d);c=n(a,e);continue}else if("template"===f){c=n(a,e);continue}if(e=e.__CE_shadowRoot)for(e=e.firstChild;e;e=e.nextSibling)p(e,b,d);}c=c.firstChild?c.firstChild:n(a,c);}}function r(a,b,d){a[b]=d;}function u(){this.a=new Map;this.g=new Map;this.c=[];this.f=[];this.b=!1;}function ba(a,b,d){a.a.set(b,d);a.g.set(d.constructorFunction,d);}function ca(a,b){a.b=!0;a.c.push(b);}function da(a,b){a.b=!0;a.f.push(b);}function v(a,b){a.b&&p(b,function(b){return w(a,b)});}function w(a,b){if(a.b&&!b.__CE_patched){b.__CE_patched=!0;for(var d=0;d<a.c.length;d++)a.c[d](b);for(d=0;d<a.f.length;d++)a.f[d](b);}} | ||
| function x(a,b){var d=[];p(b,function(b){return d.push(b)});for(b=0;b<d.length;b++){var c=d[b];1===c.__CE_state?a.connectedCallback(c):y(a,c);}}function z(a,b){var d=[];p(b,function(b){return d.push(b)});for(b=0;b<d.length;b++){var c=d[b];1===c.__CE_state&&a.disconnectedCallback(c);}} | ||
| function A(a,b,d){d=void 0===d?{}:d;var c=d.u||new Set,e=d.i||function(b){return y(a,b)},f=[];p(b,function(b){if("link"===b.localName&&"import"===b.getAttribute("rel")){var d=b.import;d instanceof Node&&(d.__CE_isImportDocument=!0,d.__CE_hasRegistry=!0);d&&"complete"===d.readyState?d.__CE_documentLoadHandled=!0:b.addEventListener("load",function(){var d=b.import;if(!d.__CE_documentLoadHandled){d.__CE_documentLoadHandled=!0;var f=new Set(c);f.delete(d);A(a,d,{u:f,i:e});}});}else f.push(b);},c);if(a.b)for(b= | ||
| 0;b<f.length;b++)w(a,f[b]);for(b=0;b<f.length;b++)e(f[b]);} | ||
| function y(a,b){if(void 0===b.__CE_state){var d=b.ownerDocument;if(d.defaultView||d.__CE_isImportDocument&&d.__CE_hasRegistry)if(d=a.a.get(b.localName)){d.constructionStack.push(b);var c=d.constructorFunction;try{try{if(new c!==b)throw Error("The custom element constructor did not produce the element being upgraded.");}finally{d.constructionStack.pop();}}catch(t){throw b.__CE_state=2,t;}b.__CE_state=1;b.__CE_definition=d;if(d.attributeChangedCallback)for(d=d.observedAttributes,c=0;c<d.length;c++){var e= | ||
| d[c],f=b.getAttribute(e);null!==f&&a.attributeChangedCallback(b,e,null,f,null);}l(b)&&a.connectedCallback(b);}}}u.prototype.connectedCallback=function(a){var b=a.__CE_definition;b.connectedCallback&&b.connectedCallback.call(a);};u.prototype.disconnectedCallback=function(a){var b=a.__CE_definition;b.disconnectedCallback&&b.disconnectedCallback.call(a);}; | ||
| u.prototype.attributeChangedCallback=function(a,b,d,c,e){var f=a.__CE_definition;f.attributeChangedCallback&&-1<f.observedAttributes.indexOf(b)&&f.attributeChangedCallback.call(a,b,d,c,e);};function B(a){var b=document;this.c=a;this.a=b;this.b=void 0;A(this.c,this.a);"loading"===this.a.readyState&&(this.b=new MutationObserver(this.f.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}));}function C(a){a.b&&a.b.disconnect();}B.prototype.f=function(a){var b=this.a.readyState;"interactive"!==b&&"complete"!==b||C(this);for(b=0;b<a.length;b++)for(var d=a[b].addedNodes,c=0;c<d.length;c++)A(this.c,d[c]);};function ea(){var a=this;this.b=this.a=void 0;this.c=new Promise(function(b){a.b=b;a.a&&b(a.a);});}function D(a){if(a.a)throw Error("Already resolved.");a.a=void 0;a.b&&a.b(void 0);}function E(a){this.c=!1;this.a=a;this.j=new Map;this.f=function(b){return b()};this.b=!1;this.g=[];this.o=new B(a);} | ||
| E.prototype.l=function(a,b){var d=this;if(!(b instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!g(a))throw new SyntaxError("The element name '"+a+"' is not valid.");if(this.a.a.get(a))throw Error("A custom element with name '"+a+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var c=function(b){var a=e[b];if(void 0!==a&&!(a instanceof Function))throw Error("The '"+b+"' callback must be a function."); | ||
| return a},e=b.prototype;if(!(e instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var f=c("connectedCallback");var t=c("disconnectedCallback");var k=c("adoptedCallback");var h=c("attributeChangedCallback");var m=b.observedAttributes||[];}catch(q){return}finally{this.c=!1;}b={localName:a,constructorFunction:b,connectedCallback:f,disconnectedCallback:t,adoptedCallback:k,attributeChangedCallback:h,observedAttributes:m,constructionStack:[]};ba(this.a, | ||
| a,b);this.g.push(b);this.b||(this.b=!0,this.f(function(){return fa(d)}));};E.prototype.i=function(a){A(this.a,a);}; | ||
| function fa(a){if(!1!==a.b){a.b=!1;for(var b=a.g,d=[],c=new Map,e=0;e<b.length;e++)c.set(b[e].localName,[]);A(a.a,document,{i:function(b){if(void 0===b.__CE_state){var e=b.localName,f=c.get(e);f?f.push(b):a.a.a.get(e)&&d.push(b);}}});for(e=0;e<d.length;e++)y(a.a,d[e]);for(;0<b.length;){var f=b.shift();e=f.localName;f=c.get(f.localName);for(var t=0;t<f.length;t++)y(a.a,f[t]);(e=a.j.get(e))&&D(e);}}}E.prototype.get=function(a){if(a=this.a.a.get(a))return a.constructorFunction}; | ||
| E.prototype.m=function(a){if(!g(a))return Promise.reject(new SyntaxError("'"+a+"' is not a valid custom element name."));var b=this.j.get(a);if(b)return b.c;b=new ea;this.j.set(a,b);this.a.a.get(a)&&!this.g.some(function(b){return b.localName===a})&&D(b);return b.c};E.prototype.s=function(a){C(this.o);var b=this.f;this.f=function(d){return a(function(){return b(d)})};};window.CustomElementRegistry=E;E.prototype.define=E.prototype.l;E.prototype.upgrade=E.prototype.i;E.prototype.get=E.prototype.get; | ||
| E.prototype.whenDefined=E.prototype.m;E.prototype.polyfillWrapFlushCallback=E.prototype.s;var F=window.Document.prototype.createElement,G=window.Document.prototype.createElementNS,ha=window.Document.prototype.importNode,ia=window.Document.prototype.prepend,ja=window.Document.prototype.append,ka=window.DocumentFragment.prototype.prepend,la=window.DocumentFragment.prototype.append,H=window.Node.prototype.cloneNode,I=window.Node.prototype.appendChild,J=window.Node.prototype.insertBefore,K=window.Node.prototype.removeChild,L=window.Node.prototype.replaceChild,M=Object.getOwnPropertyDescriptor(window.Node.prototype, | ||
| "textContent"),N=window.Element.prototype.attachShadow,O=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),P=window.Element.prototype.getAttribute,Q=window.Element.prototype.setAttribute,R=window.Element.prototype.removeAttribute,S=window.Element.prototype.getAttributeNS,T=window.Element.prototype.setAttributeNS,U=window.Element.prototype.removeAttributeNS,ma=window.Element.prototype.insertAdjacentElement,na=window.Element.prototype.insertAdjacentHTML,oa=window.Element.prototype.prepend, | ||
| pa=window.Element.prototype.append,V=window.Element.prototype.before,qa=window.Element.prototype.after,ra=window.Element.prototype.replaceWith,sa=window.Element.prototype.remove,ta=window.HTMLElement,W=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),ua=window.HTMLElement.prototype.insertAdjacentElement,va=window.HTMLElement.prototype.insertAdjacentHTML;var wa=new function(){};function xa(){var a=X;window.HTMLElement=function(){function b(){var b=this.constructor,c=a.g.get(b);if(!c)throw Error("The custom element being constructed was not registered with `customElements`.");var e=c.constructionStack;if(0===e.length)return e=F.call(document,c.localName),Object.setPrototypeOf(e,b.prototype),e.__CE_state=1,e.__CE_definition=c,w(a,e),e;c=e.length-1;var f=e[c];if(f===wa)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times."); | ||
| e[c]=wa;Object.setPrototypeOf(f,b.prototype);w(a,f);return f}b.prototype=ta.prototype;Object.defineProperty(b.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:b});return b}();}function Y(a,b,d){function c(b){return function(d){for(var e=[],c=0;c<arguments.length;++c)e[c]=arguments[c];c=[];for(var f=[],m=0;m<e.length;m++){var q=e[m];q instanceof Element&&l(q)&&f.push(q);if(q instanceof DocumentFragment)for(q=q.firstChild;q;q=q.nextSibling)c.push(q);else c.push(q);}b.apply(this,e);for(e=0;e<f.length;e++)z(a,f[e]);if(l(this))for(e=0;e<c.length;e++)f=c[e],f instanceof Element&&x(a,f);}}void 0!==d.h&&(b.prepend=c(d.h));void 0!==d.append&&(b.append=c(d.append));}function ya(){var a=X;r(Document.prototype,"createElement",function(b){if(this.__CE_hasRegistry){var d=a.a.get(b);if(d)return new d.constructorFunction}b=F.call(this,b);w(a,b);return b});r(Document.prototype,"importNode",function(b,d){b=ha.call(this,b,!!d);this.__CE_hasRegistry?A(a,b):v(a,b);return b});r(Document.prototype,"createElementNS",function(b,d){if(this.__CE_hasRegistry&&(null===b||"http://www.w3.org/1999/xhtml"===b)){var c=a.a.get(d);if(c)return new c.constructorFunction}b=G.call(this,b, | ||
| d);w(a,b);return b});Y(a,Document.prototype,{h:ia,append:ja});}function za(){function a(a,c){Object.defineProperty(a,"textContent",{enumerable:c.enumerable,configurable:!0,get:c.get,set:function(a){if(this.nodeType===Node.TEXT_NODE)c.set.call(this,a);else {var d=void 0;if(this.firstChild){var e=this.childNodes,k=e.length;if(0<k&&l(this)){d=Array(k);for(var h=0;h<k;h++)d[h]=e[h];}}c.set.call(this,a);if(d)for(a=0;a<d.length;a++)z(b,d[a]);}}});}var b=X;r(Node.prototype,"insertBefore",function(a,c){if(a instanceof DocumentFragment){var e=Array.prototype.slice.apply(a.childNodes); | ||
| a=J.call(this,a,c);if(l(this))for(c=0;c<e.length;c++)x(b,e[c]);return a}e=l(a);c=J.call(this,a,c);e&&z(b,a);l(this)&&x(b,a);return c});r(Node.prototype,"appendChild",function(a){if(a instanceof DocumentFragment){var c=Array.prototype.slice.apply(a.childNodes);a=I.call(this,a);if(l(this))for(var e=0;e<c.length;e++)x(b,c[e]);return a}c=l(a);e=I.call(this,a);c&&z(b,a);l(this)&&x(b,a);return e});r(Node.prototype,"cloneNode",function(a){a=H.call(this,!!a);this.ownerDocument.__CE_hasRegistry?A(b,a):v(b, | ||
| a);return a});r(Node.prototype,"removeChild",function(a){var c=l(a),e=K.call(this,a);c&&z(b,a);return e});r(Node.prototype,"replaceChild",function(a,c){if(a instanceof DocumentFragment){var e=Array.prototype.slice.apply(a.childNodes);a=L.call(this,a,c);if(l(this))for(z(b,c),c=0;c<e.length;c++)x(b,e[c]);return a}e=l(a);var f=L.call(this,a,c),d=l(this);d&&z(b,c);e&&z(b,a);d&&x(b,a);return f});M&&M.get?a(Node.prototype,M):ca(b,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){for(var a=[], | ||
| b=0;b<this.childNodes.length;b++){var f=this.childNodes[b];f.nodeType!==Node.COMMENT_NODE&&a.push(f.textContent);}return a.join("")},set:function(a){for(;this.firstChild;)K.call(this,this.firstChild);null!=a&&""!==a&&I.call(this,document.createTextNode(a));}});});}function Aa(a){function b(b){return function(e){for(var c=[],d=0;d<arguments.length;++d)c[d]=arguments[d];d=[];for(var k=[],h=0;h<c.length;h++){var m=c[h];m instanceof Element&&l(m)&&k.push(m);if(m instanceof DocumentFragment)for(m=m.firstChild;m;m=m.nextSibling)d.push(m);else d.push(m);}b.apply(this,c);for(c=0;c<k.length;c++)z(a,k[c]);if(l(this))for(c=0;c<d.length;c++)k=d[c],k instanceof Element&&x(a,k);}}var d=Element.prototype;void 0!==V&&(d.before=b(V));void 0!==V&&(d.after=b(qa));void 0!==ra&& | ||
| r(d,"replaceWith",function(b){for(var e=[],c=0;c<arguments.length;++c)e[c]=arguments[c];c=[];for(var d=[],k=0;k<e.length;k++){var h=e[k];h instanceof Element&&l(h)&&d.push(h);if(h instanceof DocumentFragment)for(h=h.firstChild;h;h=h.nextSibling)c.push(h);else c.push(h);}k=l(this);ra.apply(this,e);for(e=0;e<d.length;e++)z(a,d[e]);if(k)for(z(a,this),e=0;e<c.length;e++)d=c[e],d instanceof Element&&x(a,d);});void 0!==sa&&r(d,"remove",function(){var b=l(this);sa.call(this);b&&z(a,this);});}function Ba(){function a(a,b){Object.defineProperty(a,"innerHTML",{enumerable:b.enumerable,configurable:!0,get:b.get,set:function(a){var e=this,d=void 0;l(this)&&(d=[],p(this,function(a){a!==e&&d.push(a);}));b.set.call(this,a);if(d)for(var f=0;f<d.length;f++){var t=d[f];1===t.__CE_state&&c.disconnectedCallback(t);}this.ownerDocument.__CE_hasRegistry?A(c,this):v(c,this);return a}});}function b(a,b){r(a,"insertAdjacentElement",function(a,e){var d=l(e);a=b.call(this,a,e);d&&z(c,e);l(a)&&x(c,e);return a});} | ||
| function d(a,b){function e(a,b){for(var e=[];a!==b;a=a.nextSibling)e.push(a);for(b=0;b<e.length;b++)A(c,e[b]);}r(a,"insertAdjacentHTML",function(a,c){a=a.toLowerCase();if("beforebegin"===a){var d=this.previousSibling;b.call(this,a,c);e(d||this.parentNode.firstChild,this);}else if("afterbegin"===a)d=this.firstChild,b.call(this,a,c),e(this.firstChild,d);else if("beforeend"===a)d=this.lastChild,b.call(this,a,c),e(d||this.firstChild,null);else if("afterend"===a)d=this.nextSibling,b.call(this,a,c),e(this.nextSibling, | ||
| d);else throw new SyntaxError("The value provided ("+String(a)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");});}var c=X;N&&r(Element.prototype,"attachShadow",function(a){a=N.call(this,a);var b=c;if(b.b&&!a.__CE_patched){a.__CE_patched=!0;for(var e=0;e<b.c.length;e++)b.c[e](a);}return this.__CE_shadowRoot=a});O&&O.get?a(Element.prototype,O):W&&W.get?a(HTMLElement.prototype,W):da(c,function(b){a(b,{enumerable:!0,configurable:!0,get:function(){return H.call(this,!0).innerHTML}, | ||
| set:function(a){var b="template"===this.localName,c=b?this.content:this,e=G.call(document,this.namespaceURI,this.localName);for(e.innerHTML=a;0<c.childNodes.length;)K.call(c,c.childNodes[0]);for(a=b?e.content:e;0<a.childNodes.length;)I.call(c,a.childNodes[0]);}});});r(Element.prototype,"setAttribute",function(a,b){if(1!==this.__CE_state)return Q.call(this,a,b);var e=P.call(this,a);Q.call(this,a,b);b=P.call(this,a);c.attributeChangedCallback(this,a,e,b,null);});r(Element.prototype,"setAttributeNS",function(a, | ||
| b,d){if(1!==this.__CE_state)return T.call(this,a,b,d);var e=S.call(this,a,b);T.call(this,a,b,d);d=S.call(this,a,b);c.attributeChangedCallback(this,b,e,d,a);});r(Element.prototype,"removeAttribute",function(a){if(1!==this.__CE_state)return R.call(this,a);var b=P.call(this,a);R.call(this,a);null!==b&&c.attributeChangedCallback(this,a,b,null,null);});r(Element.prototype,"removeAttributeNS",function(a,b){if(1!==this.__CE_state)return U.call(this,a,b);var d=S.call(this,a,b);U.call(this,a,b);var e=S.call(this, | ||
| a,b);d!==e&&c.attributeChangedCallback(this,b,d,e,a);});ua?b(HTMLElement.prototype,ua):ma?b(Element.prototype,ma):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");va?d(HTMLElement.prototype,va):na?d(Element.prototype,na):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched.");Y(c,Element.prototype,{h:oa,append:pa});Aa(c);}var Z=window.customElements;if(!Z||Z.forcePolyfill||"function"!=typeof Z.define||"function"!=typeof Z.get){var X=new u;xa();ya();Y(X,DocumentFragment.prototype,{h:ka,append:la});za();Ba();document.__CE_hasRegistry=!0;var customElements=new E(X);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:customElements});}}).call(self); | ||
| // Polyfill document.baseURI | ||
| "string"!==typeof document.baseURI&&Object.defineProperty(Document.prototype,"baseURI",{enumerable:!0,configurable:!0,get:function(){var a=document.querySelector("base");return a&&a.href?a.href:document.URL}}); | ||
| // Polyfill CustomEvent | ||
| "function"!==typeof window.CustomEvent&&(window.CustomEvent=function(c,a){a=a||{bubbles:!1,cancelable:!1,detail:void 0};var b=document.createEvent("CustomEvent");b.initCustomEvent(c,a.bubbles,a.cancelable,a.detail);return b},window.CustomEvent.prototype=window.Event.prototype); | ||
| // Event.composedPath | ||
| (function(b,c,d){b.composedPath||(b.composedPath=function(){if(this.path)return this.path;var a=this.target;for(this.path=[];null!==a.parentNode;)this.path.push(a),a=a.parentNode;this.path.push(c,d);return this.path});})(Event.prototype,document,window); | ||
| /*! | ||
| Element.closest and Element.matches | ||
| https://github.com/jonathantneal/closest | ||
| Creative Commons Zero v1.0 Universal | ||
| */ | ||
| (function(a){"function"!==typeof a.matches&&(a.matches=a.msMatchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||function(a){a=(this.document||this.ownerDocument).querySelectorAll(a);for(var b=0;a[b]&&a[b]!==this;)++b;return !!a[b]});"function"!==typeof a.closest&&(a.closest=function(a){for(var b=this;b&&1===b.nodeType;){if(b.matches(a))return b;b=b.parentNode;}return null});})(window.Element.prototype); | ||
| /*! | ||
| Element.getRootNode() | ||
| */ | ||
| (function(c){function d(a){a=b(a);return a&&11===a.nodeType?d(a.host):a}function b(a){return a&&a.parentNode?b(a.parentNode):a}"function"!==typeof c.getRootNode&&(c.getRootNode=function(a){return a&&a.composed?d(this):b(this)});})(Element.prototype); | ||
| /*! | ||
| Element.isConnected() | ||
| */ | ||
| (function(a){"isConnected"in a||Object.defineProperty(a,"isConnected",{configurable:!0,enumerable:!0,get:function(){var a=this.getRootNode({composed:!0});return a&&9===a.nodeType}});})(Element.prototype); | ||
| /*! | ||
| Element.remove() | ||
| */ | ||
| (function(b){b.forEach(function(a){a.hasOwnProperty("remove")||Object.defineProperty(a,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this);}});});})([Element.prototype,CharacterData.prototype,DocumentType.prototype]); | ||
| /*! | ||
| Element.classList | ||
| */ | ||
| !function(e){'classList'in e||Object.defineProperty(e,"classList",{get:function(){var e=this,t=(e.getAttribute("class")||"").replace(/^\s+|\s$/g,"").split(/\s+/g);function n(){t.length>0?e.setAttribute("class",t.join(" ")):e.removeAttribute("class");}return ""===t[0]&&t.splice(0,1),t.toggle=function(e,i){void 0!==i?i?t.add(e):t.remove(e):-1!==t.indexOf(e)?t.splice(t.indexOf(e),1):t.push(e),n();},t.add=function(){for(var e=[].slice.call(arguments),i=0,s=e.length;i<s;i++)-1===t.indexOf(e[i])&&t.push(e[i]);n();},t.remove=function(){for(var e=[].slice.call(arguments),i=0,s=e.length;i<s;i++)-1!==t.indexOf(e[i])&&t.splice(t.indexOf(e[i]),1);n();},t.item=function(e){return t[e]},t.contains=function(e){return -1!==t.indexOf(e)},t.replace=function(e,i){-1!==t.indexOf(e)&&t.splice(t.indexOf(e),1,i),n();},t.value=e.getAttribute("class")||"",t}});}(Element.prototype); | ||
| /*! | ||
| DOMTokenList | ||
| */ | ||
| (function(b){try{document.body.classList.add();}catch(e){var c=b.add,d=b.remove;b.add=function(){for(var a=0;a<arguments.length;a++)c.call(this,arguments[a]);};b.remove=function(){for(var a=0;a<arguments.length;a++)d.call(this,arguments[a]);};}})(DOMTokenList.prototype); |
| const NAMESPACE = 'msf-editor'; | ||
| let scopeId; | ||
| let hostTagName; | ||
| let isSvgMode = false; | ||
| let queueCongestion = 0; | ||
| let queuePending = false; | ||
| const win = typeof window !== 'undefined' ? window : {}; | ||
| const CSS = win.CSS ; | ||
| 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), | ||
| ce: (eventName, opts) => new CustomEvent(eventName, opts), | ||
| }; | ||
| const supportsShadow = /*@__PURE__*/ (() => (doc.head.attachShadow + '').indexOf('[native') > -1)() ; | ||
| const promiseResolve = (v) => Promise.resolve(v); | ||
| const supportsConstructibleStylesheets = /*@__PURE__*/ (() => { | ||
| try { | ||
| new CSSStyleSheet(); | ||
| return true; | ||
| } | ||
| catch (e) { } | ||
| return false; | ||
| })() | ||
| ; | ||
| const addHostEventListeners = (elm, hostRef, listeners, attachParentListeners) => { | ||
| if ( listeners) { | ||
| 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); | ||
| (hostRef.$rmListeners$ = hostRef.$rmListeners$ || []).push(() => plt.rel(target, name, handler, opts)); | ||
| }); | ||
| } | ||
| }; | ||
| const hostListenerProxy = (hostRef, methodName) => (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$ = hostRef.$queuedListeners$ || []).push([methodName, ev]); | ||
| } | ||
| } | ||
| }; | ||
| const getHostListenerTarget = (elm, flags) => { | ||
| if ( flags & 8 /* TargetWindow */) | ||
| return win; | ||
| return elm; | ||
| }; | ||
| // prettier-ignore | ||
| const hostListenerOpts = (flags) => (flags & 2 /* Capture */) !== 0; | ||
| const HYDRATED_CSS = '{visibility:hidden}.hydrated{visibility:inherit}'; | ||
| 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); | ||
| 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 = (hostRef) => { | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const elm = hostRef.$hostElement$; | ||
| const flags = cmpMeta.$flags$; | ||
| const endAttachStyles = createTime('attachStyles', cmpMeta.$tagName$); | ||
| const scopeId = addStyle( supportsShadow && elm.shadowRoot ? elm.shadowRoot : elm.getRootNode(), cmpMeta, hostRef.$modeName$, elm); | ||
| if ( 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 = (cmp, mode) => 'sc-' + ( cmp.$tagName$); | ||
| /** | ||
| * Default style mode id | ||
| */ | ||
| /** | ||
| * Reusable empty obj/array | ||
| * Don't add values to these!! | ||
| */ | ||
| const EMPTY_OBJ = {}; | ||
| const isDef = (v) => v != null; | ||
| const noop = () => { | ||
| /* noop*/ | ||
| }; | ||
| const isComplexType = (o) => { | ||
| // https://jsperf.com/typeof-fn-object/5 | ||
| o = typeof o; | ||
| return o === 'object' || o === 'function'; | ||
| }; | ||
| const IS_DENO_ENV = typeof Deno !== 'undefined'; | ||
| const IS_NODE_ENV = !IS_DENO_ENV && | ||
| typeof global !== 'undefined' && | ||
| typeof require === 'function' && | ||
| !!global.process && | ||
| typeof __filename === 'string' && | ||
| (!global.origin || typeof global.origin !== 'string'); | ||
| const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; | ||
| const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/'; | ||
| const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop; | ||
| /** | ||
| * 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) { | ||
| 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) { | ||
| if (newValue !== false || elm.getAttribute(memberName) === '') { | ||
| { | ||
| 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 = (hostRef, renderFnResults) => { | ||
| const hostElm = hostRef.$hostElement$; | ||
| const oldVNode = hostRef.$vnode$ || newVNode(null, null); | ||
| const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults); | ||
| hostTagName = hostElm.tagName; | ||
| 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 getElement = (ref) => ( getHostRef(ref).$hostElement$ ); | ||
| const createEvent = (ref, name, flags) => { | ||
| const elm = getElement(ref); | ||
| return { | ||
| emit: (detail) => { | ||
| return emitEvent(elm, name, { | ||
| bubbles: !!(flags & 4 /* Bubbles */), | ||
| composed: !!(flags & 2 /* Composed */), | ||
| cancelable: !!(flags & 1 /* Cancellable */), | ||
| detail, | ||
| }); | ||
| }, | ||
| }; | ||
| }; | ||
| const emitEvent = (elm, name, opts) => { | ||
| const ev = plt.ce(name, opts); | ||
| elm.dispatchEvent(ev); | ||
| return ev; | ||
| }; | ||
| const attachToAncestor = (hostRef, ancestorComponent) => { | ||
| if ( ancestorComponent && !hostRef.$onRenderResolve$ && ancestorComponent['s-p']) { | ||
| ancestorComponent['s-p'].push(new Promise(r => (hostRef.$onRenderResolve$ = r))); | ||
| } | ||
| }; | ||
| const scheduleUpdate = (hostRef, isInitialLoad) => { | ||
| { | ||
| hostRef.$flags$ |= 16 /* isQueuedForUpdate */; | ||
| } | ||
| if ( hostRef.$flags$ & 4 /* isWaitingForChildren */) { | ||
| hostRef.$flags$ |= 512 /* needsRerender */; | ||
| return; | ||
| } | ||
| attachToAncestor(hostRef, hostRef.$ancestorComponent$); | ||
| // there is no ancestorc omponent or the ancestor component | ||
| // has already fired off its lifecycle update then | ||
| // fire off the initial update | ||
| const dispatch = () => dispatchHooks(hostRef, isInitialLoad); | ||
| return writeTask(dispatch) ; | ||
| }; | ||
| const dispatchHooks = (hostRef, isInitialLoad) => { | ||
| const endSchedule = createTime('scheduleUpdate', hostRef.$cmpMeta$.$tagName$); | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| let promise; | ||
| if (isInitialLoad) { | ||
| { | ||
| hostRef.$flags$ |= 256 /* isListenReady */; | ||
| if (hostRef.$queuedListeners$) { | ||
| hostRef.$queuedListeners$.map(([methodName, event]) => safeCall(instance, methodName, event)); | ||
| hostRef.$queuedListeners$ = null; | ||
| } | ||
| } | ||
| { | ||
| promise = safeCall(instance, 'componentWillLoad'); | ||
| } | ||
| } | ||
| { | ||
| promise = then(promise, () => safeCall(instance, 'componentWillRender')); | ||
| } | ||
| endSchedule(); | ||
| return then(promise, () => updateComponent(hostRef, instance, isInitialLoad)); | ||
| }; | ||
| const updateComponent = (hostRef, instance, isInitialLoad) => { | ||
| // updateComponent | ||
| const elm = hostRef.$hostElement$; | ||
| const endUpdate = createTime('update', hostRef.$cmpMeta$.$tagName$); | ||
| const rc = elm['s-rc']; | ||
| if ( isInitialLoad) { | ||
| // DOM WRITE! | ||
| attachStyles(hostRef); | ||
| } | ||
| const endRender = createTime('render', hostRef.$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(hostRef, callRender(hostRef, instance)); | ||
| } | ||
| } | ||
| if ( plt.$cssShim$) { | ||
| plt.$cssShim$.updateHost(elm); | ||
| } | ||
| 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.map(cb => cb()); | ||
| elm['s-rc'] = undefined; | ||
| } | ||
| endRender(); | ||
| endUpdate(); | ||
| { | ||
| const childrenPromises = elm['s-p']; | ||
| const postUpdate = () => postUpdateComponent(hostRef); | ||
| if (childrenPromises.length === 0) { | ||
| postUpdate(); | ||
| } | ||
| else { | ||
| Promise.all(childrenPromises).then(postUpdate); | ||
| hostRef.$flags$ |= 4 /* isWaitingForChildren */; | ||
| childrenPromises.length = 0; | ||
| } | ||
| } | ||
| }; | ||
| const callRender = (hostRef, instance) => { | ||
| try { | ||
| instance = instance.render() ; | ||
| { | ||
| hostRef.$flags$ &= ~16 /* isQueuedForUpdate */; | ||
| } | ||
| { | ||
| hostRef.$flags$ |= 2 /* hasRendered */; | ||
| } | ||
| } | ||
| catch (e) { | ||
| consoleError(e); | ||
| } | ||
| return instance; | ||
| }; | ||
| const postUpdateComponent = (hostRef) => { | ||
| const tagName = hostRef.$cmpMeta$.$tagName$; | ||
| const elm = hostRef.$hostElement$; | ||
| const endPostUpdate = createTime('postUpdate', tagName); | ||
| const ancestorComponent = hostRef.$ancestorComponent$; | ||
| if (!(hostRef.$flags$ & 64 /* hasLoadedComponent */)) { | ||
| hostRef.$flags$ |= 64 /* hasLoadedComponent */; | ||
| { | ||
| // DOM WRITE! | ||
| addHydratedFlag(elm); | ||
| } | ||
| 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(hostRef, false)); | ||
| } | ||
| hostRef.$flags$ &= ~(4 /* isWaitingForChildren */ | 512 /* needsRerender */); | ||
| } | ||
| // ( •_•) | ||
| // ( •_•)>⌐■-■ | ||
| // (⌐■_■) | ||
| }; | ||
| const forceUpdate = (ref) => { | ||
| { | ||
| const hostRef = getHostRef(ref); | ||
| const isConnected = hostRef.$hostElement$.isConnected; | ||
| if (isConnected && (hostRef.$flags$ & (2 /* hasRendered */ | 16 /* isQueuedForUpdate */)) === 2 /* hasRendered */) { | ||
| scheduleUpdate(hostRef, 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 | ||
| { | ||
| addHydratedFlag(doc.documentElement); | ||
| } | ||
| { | ||
| plt.$flags$ |= 2 /* appLoaded */; | ||
| } | ||
| nextTick(() => emitEvent(win, 'appload', { detail: { namespace: NAMESPACE } })); | ||
| }; | ||
| 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 addHydratedFlag = (elm) => ( elm.classList.add('hydrated') ); | ||
| 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 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 oldVal = hostRef.$instanceValues$.get(propName); | ||
| const flags = hostRef.$flags$; | ||
| const instance = hostRef.$lazyInstance$ ; | ||
| newVal = parsePropertyValue(newVal, cmpMeta.$members$[propName][0]); | ||
| if (( !(flags & 8 /* isConstructingInstance */) || oldVal === undefined) && newVal !== oldVal) { | ||
| // 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(hostRef, 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.map(([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 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(); | ||
| } | ||
| if ( Cstr.style) { | ||
| // this component has styles but we haven't registered them yet | ||
| let style = Cstr.style; | ||
| const scopeId = getScopeId(cmpMeta); | ||
| if (!styles.has(scopeId)) { | ||
| const endRegisterStyles = createTime('registerStyles', cmpMeta.$tagName$); | ||
| if ( cmpMeta.$flags$ & 8 /* needsShadowDomShim */) { | ||
| style = await import('./shadow-css-fb1c6168.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(hostRef, 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) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| const cmpMeta = hostRef.$cmpMeta$; | ||
| const endConnected = createTime('connectedCallback', cmpMeta.$tagName$); | ||
| 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$).map(([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)); | ||
| } | ||
| } | ||
| else { | ||
| // not the first time this has connected | ||
| // reattach any event listeners to the host | ||
| // since they would have been removed when disconnected | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| } | ||
| endConnected(); | ||
| } | ||
| }; | ||
| const disconnectedCallback = (elm) => { | ||
| if ((plt.$flags$ & 1 /* isTmpDisconnected */) === 0) { | ||
| const hostRef = getHostRef(elm); | ||
| { | ||
| if (hostRef.$rmListeners$) { | ||
| hostRef.$rmListeners$.map(rmListener => rmListener()); | ||
| 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 customElements = win.customElements; | ||
| const head = doc.head; | ||
| const metaCharset = /*@__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.map(lazyBundle => lazyBundle[1].map(compactMeta => { | ||
| const cmpMeta = { | ||
| $flags$: compactMeta[0], | ||
| $tagName$: compactMeta[1], | ||
| $members$: compactMeta[2], | ||
| $listeners$: compactMeta[3], | ||
| }; | ||
| { | ||
| cmpMeta.$members$ = compactMeta[2]; | ||
| } | ||
| { | ||
| cmpMeta.$listeners$ = compactMeta[3]; | ||
| } | ||
| if ( !supportsShadow && 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, cmpMeta); | ||
| 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 (supportsShadow) { | ||
| { | ||
| 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)); | ||
| } | ||
| } | ||
| disconnectedCallback() { | ||
| plt.jmp(() => disconnectedCallback(this)); | ||
| } | ||
| forceUpdate() { | ||
| forceUpdate(this); | ||
| } | ||
| componentOnReady() { | ||
| return getHostRef(this).$onReadyPromise$; | ||
| } | ||
| }; | ||
| cmpMeta.$lazyBundleId$ = lazyBundle[0]; | ||
| if (!exclude.includes(tagName) && !customElements.get(tagName)) { | ||
| cmpTags.push(tagName); | ||
| customElements.define(tagName, proxyComponent(HostElement, cmpMeta, 1 /* isElementConstructor */)); | ||
| } | ||
| })); | ||
| { | ||
| visibilityStyle.innerHTML = cmpTags + HYDRATED_CSS; | ||
| visibilityStyle.setAttribute('data-styles', ''); | ||
| head.insertBefore(visibilityStyle, metaCharset ? metaCharset.nextSibling : head.firstChild); | ||
| } | ||
| // Process deferred connectedCallbacks now all components have been registered | ||
| isBootstrapping = false; | ||
| if (deferredConnectedCallbacks.length) { | ||
| deferredConnectedCallbacks.map(host => host.connectedCallback()); | ||
| } | ||
| else { | ||
| { | ||
| plt.jmp(() => (appLoadFallback = setTimeout(appDidLoad, 30))); | ||
| } | ||
| } | ||
| // Fallback appLoad event | ||
| endBootstrap(); | ||
| }; | ||
| const hostRefs = new WeakMap(); | ||
| const getHostRef = (ref) => hostRefs.get(ref); | ||
| const registerInstance = (lazyInstance, hostRef) => hostRefs.set((hostRef.$lazyInstance$ = lazyInstance), hostRef); | ||
| const registerHost = (elm, cmpMeta) => { | ||
| const hostRef = { | ||
| $flags$: 0, | ||
| $hostElement$: elm, | ||
| $cmpMeta$: cmpMeta, | ||
| $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'] = []; | ||
| } | ||
| addHostEventListeners(elm, hostRef, cmpMeta.$listeners$); | ||
| return hostRefs.set(elm, hostRef); | ||
| }; | ||
| const isMemberInElement = (elm, memberName) => memberName in elm; | ||
| const consoleError = (e) => console.error(e); | ||
| const cmpModules = /*@__PURE__*/ new Map(); | ||
| const loadModule = (cmpMeta, hostRef, hmrVersionId) => { | ||
| // loadModuleImport | ||
| const exportName = cmpMeta.$tagName$.replace(/-/g, '_'); | ||
| const bundleId = cmpMeta.$lazyBundleId$; | ||
| const module = cmpModules.get(bundleId) ; | ||
| if (module) { | ||
| return module[exportName]; | ||
| } | ||
| return import( | ||
| /* webpackInclude: /\.entry\.js$/ */ | ||
| /* webpackExclude: /\.system\.entry\.js$/ */ | ||
| /* webpackMode: "lazy" */ | ||
| `./${bundleId}.entry.js${ ''}`).then(importedModule => { | ||
| { | ||
| cmpModules.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); | ||
| // DOM WRITES!!! | ||
| { | ||
| const timeout = (plt.$flags$ & 6 /* queueMask */) === 2 /* appLoaded */ ? performance.now() + 14 * Math.ceil(queueCongestion * (1.0 / 10.0)) : Infinity; | ||
| consumeTimeout(queueDomWrites, timeout); | ||
| consumeTimeout(queueDomWritesLow, timeout); | ||
| if (queueDomWrites.length > 0) { | ||
| queueDomWritesLow.push(...queueDomWrites); | ||
| queueDomWrites.length = 0; | ||
| } | ||
| if ((queuePending = queueDomReads.length + queueDomWrites.length + queueDomWritesLow.length > 0)) { | ||
| // 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) => promiseResolve().then(cb); | ||
| const writeTask = /*@__PURE__*/ queueTask(queueDomWrites, true); | ||
| export { CSS as C, NAMESPACE as N, promiseResolve as a, bootstrapLazy as b, createEvent as c, doc as d, getElement as g, h, plt as p, registerInstance as r, win as w }; |
| import { b as bootstrapLazy } from './index-537c62c6.js'; | ||
| import { a as patchEsm } from './patch-ccd9f0f0.js'; | ||
| const defineCustomElements = (win, options) => { | ||
| if (typeof window === 'undefined') return Promise.resolve(); | ||
| return patchEsm().then(() => { | ||
| 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],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); | ||
| }; | ||
| export { defineCustomElements }; |
| import { b as bootstrapLazy } from './index-537c62c6.js'; | ||
| import { p as patchBrowser } from './patch-ccd9f0f0.js'; | ||
| patchBrowser().then(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],"beforeUnload":[64],"load":[64],"preview":[64]},[[8,"message","componentWillLoad"]]]]]], options); | ||
| }); |
| import { C as CSS, p as plt, w as win, a as promiseResolve, d as doc, N as NAMESPACE } from './index-537c62c6.js'; | ||
| /* | ||
| Stencil Client Patch v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| const noop = () => { | ||
| /* noop*/ | ||
| }; | ||
| const IS_DENO_ENV = typeof Deno !== 'undefined'; | ||
| const IS_NODE_ENV = !IS_DENO_ENV && | ||
| typeof global !== 'undefined' && | ||
| typeof require === 'function' && | ||
| !!global.process && | ||
| typeof __filename === 'string' && | ||
| (!global.origin || typeof global.origin !== 'string'); | ||
| const IS_DENO_WINDOWS_ENV = IS_DENO_ENV && Deno.build.os === 'windows'; | ||
| const getCurrentDirectory = IS_NODE_ENV ? process.cwd : IS_DENO_ENV ? Deno.cwd : () => '/'; | ||
| const exit = IS_NODE_ENV ? process.exit : IS_DENO_ENV ? Deno.exit : noop; | ||
| const getDynamicImportFunction = (namespace) => `__sc_import_${namespace.replace(/\s|-/g, '_')}`; | ||
| const patchEsm = () => { | ||
| // NOTE!! This fn cannot use async/await! | ||
| // @ts-ignore | ||
| if ( !(CSS && CSS.supports && CSS.supports('color', 'var(--c)'))) { | ||
| // @ts-ignore | ||
| return import(/* webpackChunkName: "polyfills-css-shim" */ './css-shim-5ce2b5c4.js').then(() => { | ||
| if ((plt.$cssShim$ = win.__cssshim)) { | ||
| return plt.$cssShim$.i(); | ||
| } | ||
| else { | ||
| // for better minification | ||
| return 0; | ||
| } | ||
| }); | ||
| } | ||
| return promiseResolve(); | ||
| }; | ||
| const patchBrowser = () => { | ||
| { | ||
| // shim css vars | ||
| plt.$cssShim$ = win.__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'] || {} ; | ||
| 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() { | ||
| /* promise noop */ | ||
| }, | ||
| }; | ||
| } | ||
| { | ||
| opts.resourcesUrl = new URL('.', new URL(scriptElm.getAttribute('data-resources-url') || scriptElm.src, win.location.href)).href; | ||
| { | ||
| patchDynamicImport(opts.resourcesUrl, scriptElm); | ||
| } | ||
| if ( !win.customElements) { | ||
| // module support, but no custom elements support (Old Edge) | ||
| // @ts-ignore | ||
| return import(/* webpackChunkName: "polyfills-dom" */ './dom-91ed8d21.js').then(() => opts); | ||
| } | ||
| } | ||
| return promiseResolve(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/chromium/issues/detail?id=990810 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; | ||
| }; | ||
| } | ||
| }; | ||
| export { patchEsm as a, patchBrowser as p }; |
| /* | ||
| Stencil Client Platform v1.17.4 | MIT Licensed | https://stenciljs.com | ||
| */ | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| * | ||
| * This file is a port of shadowCSS from webcomponents.js to TypeScript. | ||
| * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js | ||
| * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts | ||
| */ | ||
| const safeSelector = (selector) => { | ||
| const placeholders = []; | ||
| let index = 0; | ||
| let content; | ||
| // Replaces attribute selectors with placeholders. | ||
| // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator. | ||
| selector = selector.replace(/(\[[^\]]*\])/g, (_, keep) => { | ||
| const replaceBy = `__ph-${index}__`; | ||
| placeholders.push(keep); | ||
| index++; | ||
| return replaceBy; | ||
| }); | ||
| // Replaces the expression in `:nth-child(2n + 1)` with a placeholder. | ||
| // WS and "+" would otherwise be interpreted as selector separators. | ||
| content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, (_, pseudo, exp) => { | ||
| const replaceBy = `__ph-${index}__`; | ||
| placeholders.push(exp); | ||
| index++; | ||
| return pseudo + replaceBy; | ||
| }); | ||
| const ss = { | ||
| content, | ||
| placeholders, | ||
| }; | ||
| return ss; | ||
| }; | ||
| const restoreSafeSelector = (placeholders, content) => { | ||
| return content.replace(/__ph-(\d+)__/g, (_, index) => placeholders[+index]); | ||
| }; | ||
| const _polyfillHost = '-shadowcsshost'; | ||
| const _polyfillSlotted = '-shadowcssslotted'; | ||
| // note: :host-context pre-processed to -shadowcsshostcontext. | ||
| const _polyfillHostContext = '-shadowcsscontext'; | ||
| const _parenSuffix = ')(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)'; | ||
| const _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim'); | ||
| const _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim'); | ||
| const _cssColonSlottedRe = new RegExp('(' + _polyfillSlotted + _parenSuffix, 'gim'); | ||
| const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator'; | ||
| const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/; | ||
| const _shadowDOMSelectorsRe = [/::shadow/g, /::content/g]; | ||
| const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$'; | ||
| const _polyfillHostRe = /-shadowcsshost/gim; | ||
| const _colonHostRe = /:host/gim; | ||
| const _colonSlottedRe = /::slotted/gim; | ||
| const _colonHostContextRe = /:host-context/gim; | ||
| const _commentRe = /\/\*\s*[\s\S]*?\*\//g; | ||
| const stripComments = (input) => { | ||
| return input.replace(_commentRe, ''); | ||
| }; | ||
| const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g; | ||
| const extractCommentsWithHash = (input) => { | ||
| return input.match(_commentWithHashRe) || []; | ||
| }; | ||
| const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g; | ||
| const _curlyRe = /([{}])/g; | ||
| const OPEN_CURLY = '{'; | ||
| const CLOSE_CURLY = '}'; | ||
| const BLOCK_PLACEHOLDER = '%BLOCK%'; | ||
| const processRules = (input, ruleCallback) => { | ||
| const inputWithEscapedBlocks = escapeBlocks(input); | ||
| let nextBlockIndex = 0; | ||
| return inputWithEscapedBlocks.escapedString.replace(_ruleRe, (...m) => { | ||
| const selector = m[2]; | ||
| let content = ''; | ||
| let suffix = m[4]; | ||
| let contentPrefix = ''; | ||
| if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) { | ||
| content = inputWithEscapedBlocks.blocks[nextBlockIndex++]; | ||
| suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1); | ||
| contentPrefix = '{'; | ||
| } | ||
| const cssRule = { | ||
| selector, | ||
| content, | ||
| }; | ||
| const rule = ruleCallback(cssRule); | ||
| return `${m[1]}${rule.selector}${m[3]}${contentPrefix}${rule.content}${suffix}`; | ||
| }); | ||
| }; | ||
| const escapeBlocks = (input) => { | ||
| const inputParts = input.split(_curlyRe); | ||
| const resultParts = []; | ||
| const escapedBlocks = []; | ||
| let bracketCount = 0; | ||
| let currentBlockParts = []; | ||
| for (let partIndex = 0; partIndex < inputParts.length; partIndex++) { | ||
| const part = inputParts[partIndex]; | ||
| if (part === CLOSE_CURLY) { | ||
| bracketCount--; | ||
| } | ||
| if (bracketCount > 0) { | ||
| currentBlockParts.push(part); | ||
| } | ||
| else { | ||
| if (currentBlockParts.length > 0) { | ||
| escapedBlocks.push(currentBlockParts.join('')); | ||
| resultParts.push(BLOCK_PLACEHOLDER); | ||
| currentBlockParts = []; | ||
| } | ||
| resultParts.push(part); | ||
| } | ||
| if (part === OPEN_CURLY) { | ||
| bracketCount++; | ||
| } | ||
| } | ||
| if (currentBlockParts.length > 0) { | ||
| escapedBlocks.push(currentBlockParts.join('')); | ||
| resultParts.push(BLOCK_PLACEHOLDER); | ||
| } | ||
| const strEscapedBlocks = { | ||
| escapedString: resultParts.join(''), | ||
| blocks: escapedBlocks, | ||
| }; | ||
| return strEscapedBlocks; | ||
| }; | ||
| const insertPolyfillHostInCssText = (selector) => { | ||
| selector = selector | ||
| .replace(_colonHostContextRe, _polyfillHostContext) | ||
| .replace(_colonHostRe, _polyfillHost) | ||
| .replace(_colonSlottedRe, _polyfillSlotted); | ||
| return selector; | ||
| }; | ||
| const convertColonRule = (cssText, regExp, partReplacer) => { | ||
| // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule | ||
| return cssText.replace(regExp, (...m) => { | ||
| if (m[2]) { | ||
| const parts = m[2].split(','); | ||
| const r = []; | ||
| for (let i = 0; i < parts.length; i++) { | ||
| const p = parts[i].trim(); | ||
| if (!p) | ||
| break; | ||
| r.push(partReplacer(_polyfillHostNoCombinator, p, m[3])); | ||
| } | ||
| return r.join(','); | ||
| } | ||
| else { | ||
| return _polyfillHostNoCombinator + m[3]; | ||
| } | ||
| }); | ||
| }; | ||
| const colonHostPartReplacer = (host, part, suffix) => { | ||
| return host + part.replace(_polyfillHost, '') + suffix; | ||
| }; | ||
| const convertColonHost = (cssText) => { | ||
| return convertColonRule(cssText, _cssColonHostRe, colonHostPartReplacer); | ||
| }; | ||
| const colonHostContextPartReplacer = (host, part, suffix) => { | ||
| if (part.indexOf(_polyfillHost) > -1) { | ||
| return colonHostPartReplacer(host, part, suffix); | ||
| } | ||
| else { | ||
| return host + part + suffix + ', ' + part + ' ' + host + suffix; | ||
| } | ||
| }; | ||
| const convertColonSlotted = (cssText, slotScopeId) => { | ||
| const slotClass = '.' + slotScopeId + ' > '; | ||
| const selectors = []; | ||
| cssText = cssText.replace(_cssColonSlottedRe, (...m) => { | ||
| if (m[2]) { | ||
| const compound = m[2].trim(); | ||
| const suffix = m[3]; | ||
| const slottedSelector = slotClass + compound + suffix; | ||
| let prefixSelector = ''; | ||
| for (let i = m[4] - 1; i >= 0; i--) { | ||
| const char = m[5][i]; | ||
| if (char === '}' || char === ',') { | ||
| break; | ||
| } | ||
| prefixSelector = char + prefixSelector; | ||
| } | ||
| const orgSelector = prefixSelector + slottedSelector; | ||
| const addedSelector = `${prefixSelector.trimRight()}${slottedSelector.trim()}`; | ||
| if (orgSelector.trim() !== addedSelector.trim()) { | ||
| const updatedSelector = `${addedSelector}, ${orgSelector}`; | ||
| selectors.push({ | ||
| orgSelector, | ||
| updatedSelector, | ||
| }); | ||
| } | ||
| return slottedSelector; | ||
| } | ||
| else { | ||
| return _polyfillHostNoCombinator + m[3]; | ||
| } | ||
| }); | ||
| return { | ||
| selectors, | ||
| cssText, | ||
| }; | ||
| }; | ||
| const convertColonHostContext = (cssText) => { | ||
| return convertColonRule(cssText, _cssColonHostContextRe, colonHostContextPartReplacer); | ||
| }; | ||
| const convertShadowDOMSelectors = (cssText) => { | ||
| return _shadowDOMSelectorsRe.reduce((result, pattern) => result.replace(pattern, ' '), cssText); | ||
| }; | ||
| const makeScopeMatcher = (scopeSelector) => { | ||
| const lre = /\[/g; | ||
| const rre = /\]/g; | ||
| scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]'); | ||
| return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm'); | ||
| }; | ||
| const selectorNeedsScoping = (selector, scopeSelector) => { | ||
| const re = makeScopeMatcher(scopeSelector); | ||
| return !re.test(selector); | ||
| }; | ||
| const applySimpleSelectorScope = (selector, scopeSelector, hostSelector) => { | ||
| // In Android browser, the lastIndex is not reset when the regex is used in String.replace() | ||
| _polyfillHostRe.lastIndex = 0; | ||
| if (_polyfillHostRe.test(selector)) { | ||
| const replaceBy = `.${hostSelector}`; | ||
| return selector | ||
| .replace(_polyfillHostNoCombinatorRe, (_, selector) => { | ||
| return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => { | ||
| return before + replaceBy + colon + after; | ||
| }); | ||
| }) | ||
| .replace(_polyfillHostRe, replaceBy + ' '); | ||
| } | ||
| return scopeSelector + ' ' + selector; | ||
| }; | ||
| const applyStrictSelectorScope = (selector, scopeSelector, hostSelector) => { | ||
| const isRe = /\[is=([^\]]*)\]/g; | ||
| scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]); | ||
| const className = '.' + scopeSelector; | ||
| const _scopeSelectorPart = (p) => { | ||
| let scopedP = p.trim(); | ||
| if (!scopedP) { | ||
| return ''; | ||
| } | ||
| if (p.indexOf(_polyfillHostNoCombinator) > -1) { | ||
| scopedP = applySimpleSelectorScope(p, scopeSelector, hostSelector); | ||
| } | ||
| else { | ||
| // remove :host since it should be unnecessary | ||
| const t = p.replace(_polyfillHostRe, ''); | ||
| if (t.length > 0) { | ||
| const matches = t.match(/([^:]*)(:*)(.*)/); | ||
| if (matches) { | ||
| scopedP = matches[1] + className + matches[2] + matches[3]; | ||
| } | ||
| } | ||
| } | ||
| return scopedP; | ||
| }; | ||
| const safeContent = safeSelector(selector); | ||
| selector = safeContent.content; | ||
| let scopedSelector = ''; | ||
| let startIndex = 0; | ||
| let res; | ||
| const sep = /( |>|\+|~(?!=))\s*/g; | ||
| // If a selector appears before :host it should not be shimmed as it | ||
| // matches on ancestor elements and not on elements in the host's shadow | ||
| // `:host-context(div)` is transformed to | ||
| // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator` | ||
| // the `div` is not part of the component in the 2nd selectors and should not be scoped. | ||
| // Historically `component-tag:host` was matching the component so we also want to preserve | ||
| // this behavior to avoid breaking legacy apps (it should not match). | ||
| // The behavior should be: | ||
| // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything) | ||
| // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a | ||
| // `:host-context(tag)`) | ||
| const hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1; | ||
| // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present | ||
| let shouldScope = !hasHost; | ||
| while ((res = sep.exec(selector)) !== null) { | ||
| const separator = res[1]; | ||
| const part = selector.slice(startIndex, res.index).trim(); | ||
| shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; | ||
| const scopedPart = shouldScope ? _scopeSelectorPart(part) : part; | ||
| scopedSelector += `${scopedPart} ${separator} `; | ||
| startIndex = sep.lastIndex; | ||
| } | ||
| const part = selector.substring(startIndex); | ||
| shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1; | ||
| scopedSelector += shouldScope ? _scopeSelectorPart(part) : part; | ||
| // replace the placeholders with their original values | ||
| return restoreSafeSelector(safeContent.placeholders, scopedSelector); | ||
| }; | ||
| const scopeSelector = (selector, scopeSelectorText, hostSelector, slotSelector) => { | ||
| return selector | ||
| .split(',') | ||
| .map(shallowPart => { | ||
| if (slotSelector && shallowPart.indexOf('.' + slotSelector) > -1) { | ||
| return shallowPart.trim(); | ||
| } | ||
| if (selectorNeedsScoping(shallowPart, scopeSelectorText)) { | ||
| return applyStrictSelectorScope(shallowPart, scopeSelectorText, hostSelector).trim(); | ||
| } | ||
| else { | ||
| return shallowPart.trim(); | ||
| } | ||
| }) | ||
| .join(', '); | ||
| }; | ||
| const scopeSelectors = (cssText, scopeSelectorText, hostSelector, slotSelector, commentOriginalSelector) => { | ||
| return processRules(cssText, (rule) => { | ||
| let selector = rule.selector; | ||
| let content = rule.content; | ||
| if (rule.selector[0] !== '@') { | ||
| selector = scopeSelector(rule.selector, scopeSelectorText, hostSelector, slotSelector); | ||
| } | ||
| else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { | ||
| content = scopeSelectors(rule.content, scopeSelectorText, hostSelector, slotSelector); | ||
| } | ||
| const cssRule = { | ||
| selector: selector.replace(/\s{2,}/g, ' ').trim(), | ||
| content, | ||
| }; | ||
| return cssRule; | ||
| }); | ||
| }; | ||
| const scopeCssText = (cssText, scopeId, hostScopeId, slotScopeId, commentOriginalSelector) => { | ||
| cssText = insertPolyfillHostInCssText(cssText); | ||
| cssText = convertColonHost(cssText); | ||
| cssText = convertColonHostContext(cssText); | ||
| const slotted = convertColonSlotted(cssText, slotScopeId); | ||
| cssText = slotted.cssText; | ||
| cssText = convertShadowDOMSelectors(cssText); | ||
| if (scopeId) { | ||
| cssText = scopeSelectors(cssText, scopeId, hostScopeId, slotScopeId); | ||
| } | ||
| cssText = cssText.replace(/-shadowcsshost-no-combinator/g, `.${hostScopeId}`); | ||
| cssText = cssText.replace(/>\s*\*\s+([^{, ]+)/gm, ' $1 '); | ||
| return { | ||
| cssText: cssText.trim(), | ||
| slottedSelectors: slotted.selectors, | ||
| }; | ||
| }; | ||
| const scopeCss = (cssText, scopeId, commentOriginalSelector) => { | ||
| const hostScopeId = scopeId + '-h'; | ||
| const slotScopeId = scopeId + '-s'; | ||
| const commentsWithHash = extractCommentsWithHash(cssText); | ||
| cssText = stripComments(cssText); | ||
| const orgSelectors = []; | ||
| if (commentOriginalSelector) { | ||
| const processCommentedSelector = (rule) => { | ||
| const placeholder = `/*!@___${orgSelectors.length}___*/`; | ||
| const comment = `/*!@${rule.selector}*/`; | ||
| orgSelectors.push({ placeholder, comment }); | ||
| rule.selector = placeholder + rule.selector; | ||
| return rule; | ||
| }; | ||
| cssText = processRules(cssText, rule => { | ||
| if (rule.selector[0] !== '@') { | ||
| return processCommentedSelector(rule); | ||
| } | ||
| else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') || rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) { | ||
| rule.content = processRules(rule.content, processCommentedSelector); | ||
| return rule; | ||
| } | ||
| return rule; | ||
| }); | ||
| } | ||
| const scoped = scopeCssText(cssText, scopeId, hostScopeId, slotScopeId); | ||
| cssText = [scoped.cssText, ...commentsWithHash].join('\n'); | ||
| if (commentOriginalSelector) { | ||
| orgSelectors.forEach(({ placeholder, comment }) => { | ||
| cssText = cssText.replace(placeholder, comment); | ||
| }); | ||
| } | ||
| scoped.slottedSelectors.forEach(slottedSelector => { | ||
| cssText = cssText.replace(slottedSelector.orgSelector, slottedSelector.updatedSelector); | ||
| }); | ||
| return cssText; | ||
| }; | ||
| export { scopeCss }; |
| export * from './esm-es5/index.mjs'; |
| (function(doc){ | ||
| var scriptElm = doc.scripts[doc.scripts.length - 1]; | ||
| var warn = ['[msf-editor] Deprecated script, please remove: ' + scriptElm.outerHTML]; | ||
| warn.push('To improve performance it is recommended to set the differential scripts in the head as follows:') | ||
| var parts = scriptElm.src.split('/'); | ||
| parts.pop(); | ||
| parts.push('msf-editor'); | ||
| var url = parts.join('/'); | ||
| var scriptElm = doc.createElement('script'); | ||
| scriptElm.setAttribute('type', 'module'); | ||
| scriptElm.src = url + '/msf-editor.esm.js'; | ||
| warn.push(scriptElm.outerHTML); | ||
| scriptElm.setAttribute('data-stencil-namespace', 'msf-editor'); | ||
| doc.head.appendChild(scriptElm); | ||
| scriptElm = doc.createElement('script'); | ||
| scriptElm.setAttribute('nomodule', ''); | ||
| scriptElm.src = url + '/msf-editor.js'; | ||
| warn.push(scriptElm.outerHTML); | ||
| scriptElm.setAttribute('data-stencil-namespace', 'msf-editor'); | ||
| doc.head.appendChild(scriptElm) | ||
| console.warn(warn.join('\n')); | ||
| })(document); |
Sorry, the diff of this file is too big to display
| System.register(["./p-d13e53c1.system.js","./p-9cbada08.system.js"],(function(){"use strict";var e,t;return{setters:[function(t){e=t.b},function(e){t=e.p}],execute:function(){t().then((function(t){return e([["p-630e7d06.system",[[1,"ms-editor",{token:[1],config:[8],content:[1],modalOpen:[32],save:[64],test:[64],spinner:[64],start:[64],sendTest:[64],beforeUnload:[64],load:[64],preview:[64]},[[8,"message","componentWillLoad"]]]]]],t)}))}}})); |
| import{r as i,c as s,h as t,g as e}from"./p-44776af7.js";const o=class{constructor(t){i(this,t),this.editorEvent=s(this,"editorEvent",7),this.content="",this.assetsLoaded=!1,this.modalOpen=!1}sendMessage(i,s){this.editorFrame.contentWindow.postMessage({action:i,data:s},"*")}async save(i={}){this.sendMessage("save",i)}async test(){console.log("Only a test")}async spinner(i){["hide","show"].includes(i)||(i="hide"),this.sendMessage("showSpinner",{behavior:i})}async start(i){this.sendMessage("load",i)}async sendTest(i){this.sendMessage("sendTest",i)}async beforeUnload(i){this.sendMessage("beforeUnload",i)}async load(i){this.sendMessage("load",i)}async preview(i){this.sendMessage("preview",i)}async initConfig(){console.info("MailStyler Plugin: loading assets .."),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 i=void 0!==this.config.debug&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com",this.mscFrameworkUrl=i?"http://localhost:4200":this.editorUrl,this.assetsLoaded=!0,console.info("MailStyler Plugin: assets loaded!")}async componentWillRender(){!this.assetsLoaded&&this.config&&await this.initConfig()}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(i){if(i.data&&i.data.action){const{action:s,data:t}=i.data;if("appOk"===s)console.info("MailStyler Plugin: Editor is ready!"),this.editorDidOpen();else if("appReady"===s){let i=Object.assign({},this.config);Object.keys(i).filter(s=>"function"==typeof i[s]).forEach(s=>delete i[s]),this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:i})}else if("appSave"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onSave?this.config.onSave(t.html,t.raw_html,t.json,t.opts):console.error("MailStyler Plugin: You should provide a valid onSave callback")}else if("appAutoSave"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onAutoSave?this.config.onAutoSave(t.html,t.raw_html,t.json,t.opts):console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}else if("appSaveBlock"===s){const i=new RegExp('bgcolor="none"',"g");t.html=t.html.replace(i,""),t.raw_html=t.raw_html.replace(i,""),"function"==typeof this.config.onSaveBlock?this.config.onSaveBlock(t.html,t.raw_html):console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}else"appModal"===s&&(this.modalOpen="open"===t.env);this.editorEvent.emit({action:s,data:t})}}componentWillLoad(i){this.editorFrame=this.element.shadowRoot.querySelector("iframe"),i&&this.listenMessage(i)}get element(){return e(this)}};o.style=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";export{o as ms_editor} |
| var n=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};var t={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},r="{",i="}",u={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},e="--",o="@media",f="@";function s(n,t,r){n.lastIndex=0;var i=t.substring(r).match(n);if(i){var u=r+i.index;return{start:u,end:u+i[0].length}}return null}var a=/\bvar\(/,c=/\B--[\w-]+\s*:/,v=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,h=/^[\t ]+\n/gm;function l(n,t,r){var i=function(n,t){var r=s(a,n,t);if(!r)return null;var i=function(n,t){for(var r=0,i=t;i<n.length;i++){var u=n[i];if("("===u)r++;else if(")"===u&&--r<=0)return i+1}return i}(n,r.start),u=n.substring(r.end,i-1).split(","),e=u[0],o=u.slice(1);return{start:r.start,end:i,propName:e.trim(),fallback:o.length>0?o.join(",").trim():void 0}}(n,r);if(!i)return t.push(n.substring(r,n.length)),n.length;var u=i.propName,e=null!=i.fallback?d(i.fallback):void 0;return t.push(n.substring(r,i.start),(function(n){return function(n,t,r){return n[t]?n[t]:r?m(r,n):""}(n,u,e)})),i.end}function m(n,t){for(var r="",i=0;i<n.length;i++){var u=n[i];r+="string"==typeof u?u:u(t)}return r}function p(n,t){for(var r=!1,i=!1,u=t;u<n.length;u++){var e=n[u];if(r)i&&'"'===e&&(r=!1),i||"'"!==e||(r=!1);else if('"'===e)r=!0,i=!0;else if("'"===e)r=!0,i=!1;else{if(";"===e)return u+1;if("}"===e)return u}}return u}function d(n){var t=0;n=function(n){for(var t="",r=0;;){var i=s(c,n,r),u=i?i.start:n.length;if(t+=n.substring(r,u),!i)break;r=p(n,u)}return t}(n=n.replace(v,"")).replace(h,"");for(var r=[];t<n.length;)t=l(n,r,t);return r}function y(n){var t={};n.forEach((function(n){n.declarations.forEach((function(n){t[n.prop]=n.value}))}));for(var r={},i=Object.entries(t),u=function(){var n=!1;if(i.forEach((function(t){var i=t[0],u=m(t[1],r);u!==r[i]&&(r[i]=u,n=!0)})),!n)return"break"},e=0;e<10&&"break"!==u();e++);return r}function g(n,r){if(void 0===r&&(r=0),!n.rules)return[];var i=[];return n.rules.filter((function(n){return n.type===t.STYLE_RULE})).forEach((function(n){var t=function(n){for(var t,r=[];t=w.exec(n.trim());){var i=b(t[2]),u=i.value,e=i.important;r.push({prop:t[1].trim(),value:d(u),important:e})}return r}(n.cssText);t.length>0&&n.parsedSelector.split(",").forEach((function(n){n=n.trim(),i.push({selector:n,declarations:t,specificity:1,nu:r})})),r++})),i}var w=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function b(n){var t=(n=n.replace(/\s+/gim," ").trim()).endsWith("!important");return t&&(n=n.substr(0,n.length-10).trim()),{value:n,important:t}}function E(n){var t=[];return n.forEach((function(n){t.push.apply(t,n.selectors)})),t}function k(s){var a=function(s){return function n(r,i){var s=i.substring(r.start,r.end-1);if(r.parsedCssText=r.cssText=s.trim(),r.parent){s=(s=(s=function(n){return n.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var n=arguments[1],t=6-n.length;t--;)n="0"+n;return"\\"+n}))}(s=i.substring(r.previous?r.previous.end:r.parent.start,r.start-1))).replace(u.multipleSpaces," ")).substring(s.lastIndexOf(";")+1);var a=r.parsedSelector=r.selector=s.trim();r.atRule=0===a.indexOf(f),r.atRule?0===a.indexOf(o)?r.type=t.MEDIA_RULE:a.match(u.keyframesRule)&&(r.type=t.KEYFRAMES_RULE,r.keyframesName=r.selector.split(u.multipleSpaces).pop()):r.type=0===a.indexOf(e)?t.MIXIN_RULE:t.STYLE_RULE}var c=r.rules;if(c)for(var v=0,h=c.length,l=void 0;v<h&&(l=c[v]);v++)n(l,i);return r}(function(t){var u=new n;u.start=0,u.end=t.length;for(var e=u,o=0,f=t.length;o<f;o++)if(t[o]===r){e.rules||(e.rules=[]);var s=e,a=s.rules[s.rules.length-1]||null;(e=new n).start=o+1,e.parent=s,e.previous=a,s.rules.push(e)}else t[o]===i&&(e.end=o+1,e=e.parent||u);return u}(s=function(n){return n.replace(u.comments,"").replace(u.port,"")}(s)),s)}(s),c=d(s);return{original:s,template:c,selectors:g(a),usesCssVars:c.length>1}}function M(n,t){if(n.some((function(n){return n.styleEl===t})))return!1;var r=k(t.textContent);return r.styleEl=t,n.push(r),!0}function O(n){var t=y(E(n));n.forEach((function(n){n.usesCssVars&&(n.styleEl.textContent=m(n.template,t))}))}function R(n,t,r){return function(n,t,r){return n.replace(RegExp(t,"g"),r)}(n,"\\."+t,"."+r)}function A(n,t){return Array.from(n.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(n){return M(t,n)})).some(Boolean)}function L(n,t,r){var i=r.href;return fetch(i).then((function(n){return n.text()})).then((function(u){if(function(n){return n.indexOf("var(")>-1||$.test(n)}(u)&&r.parentNode){(function(n){return j.lastIndex=0,j.test(n)})(u)&&(u=function(n,t){var r=t.replace(/[^/]*$/,"");return n.replace(j,(function(n,t){return n.replace(t,r+t)}))}(u,i));var e=n.createElement("style");e.setAttribute("data-styles",""),e.textContent=u,M(t,e),r.parentNode.insertBefore(e,r),r.remove()}})).catch((function(n){console.error(n)}))}var $=/[\s;{]--[-a-zA-Z0-9]+\s*:/m,j=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim,P=function(){function n(n,t){this.win=n,this.doc=t,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return n.prototype.i=function(){var n=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(t){n.win.requestAnimationFrame((function(){(function(n,t){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){A(n,t)&&O(t)})).observe(document.head,{childList:!0})})(n.doc,n.globalScopes),function(n,t){return A(n,t),function(n,t){for(var r=[],i=n.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),u=0;u<i.length;u++)r.push(L(n,t,i[u]));return Promise.all(r)}(n,t).then((function(){O(t)}))}(n.doc,n.globalScopes).then((function(){return t()}))}))})))},n.prototype.addLink=function(n){var t=this;return L(this.doc,this.globalScopes,n).then((function(){t.updateGlobal()}))},n.prototype.addGlobalStyle=function(n){M(this.globalScopes,n)&&this.updateGlobal()},n.prototype.createHostStyle=function(n,t,r,i){if(this.hostScopeMap.has(n))throw Error("host style already created");var u=this.registerHostTemplate(r,t,i),e=this.doc.createElement("style");return e.setAttribute("data-no-shim",""),u.usesCssVars?i?(e["s-sc"]=t=u.scopeId+"-"+this.count,e.textContent="/*needs update*/",this.hostStyleMap.set(n,e),this.hostScopeMap.set(n,function(n,t){var r=n.template.map((function(r){return"string"==typeof r?R(r,n.scopeId,t):r})),i=n.selectors.map((function(r){return Object.assign(Object.assign({},r),{selector:R(r.selector,n.scopeId,t)})}));return Object.assign(Object.assign({},n),{template:r,selectors:i,scopeId:t})}(u,t)),this.count++):(u.styleEl=e,u.usesCssVars||(e.textContent=m(u.template,{})),this.globalScopes.push(u),this.updateGlobal(),this.hostScopeMap.set(n,u)):e.textContent=r,e},n.prototype.removeHost=function(n){var t=this.hostStyleMap.get(n);t&&t.remove(),this.hostStyleMap.delete(n),this.hostScopeMap.delete(n)},n.prototype.updateHost=function(n){var t=this.hostScopeMap.get(n);if(t&&t.usesCssVars&&t.isScoped){var r=this.hostStyleMap.get(n);if(r){var i=y(function(n,t,r){var i=[],u=function(n,t){for(var r=[];t;){var i=n.get(t);i&&r.push(i),t=t.parentElement}return r}(t,n);return r.forEach((function(n){return i.push(n)})),u.forEach((function(n){return i.push(n)})),function(n){return n.sort((function(n,t){return n.specificity===t.specificity?n.nu-t.nu:n.specificity-t.specificity})),n}(E(i).filter((function(t){return function(n,t){return":root"===t||"html"===t||n.matches(t)}(n,t.selector)})))}(n,this.hostScopeMap,this.globalScopes));r.textContent=m(t.template,i)}}},n.prototype.updateGlobal=function(){O(this.globalScopes)},n.prototype.registerHostTemplate=function(n,t,r){var i=this.scopesMap.get(t);return i||((i=k(n)).scopeId=t,i.isScoped=r,this.scopesMap.set(t,i)),i},n}();!function(n){!n||n.__cssshim||n.CSS&&n.CSS.supports&&n.CSS.supports("color","var(--c)")||(n.__cssshim=new P(n,n.document))}("undefined"!=typeof window&&window); |
| self,function(){var t=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function n(n){var i=t.has(n);return n=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(n),!i&&n}function i(t){var n=t.isConnected;if(void 0!==n)return n;for(;t&&!(t.__CE_isImportDocument||t instanceof Document);)t=t.parentNode||(window.ShadowRoot&&t instanceof ShadowRoot?t.host:void 0);return!(!t||!(t.__CE_isImportDocument||t instanceof Document))}function e(t,n){for(;n&&n!==t&&!n.nextSibling;)n=n.parentNode;return n&&n!==t?n.nextSibling:null}function o(t,n,i){i=void 0===i?new Set:i;for(var r=t;r;){if(r.nodeType===Node.ELEMENT_NODE){var f=r;n(f);var c=f.localName;if("link"===c&&"import"===f.getAttribute("rel")){if((r=f.import)instanceof Node&&!i.has(r))for(i.add(r),r=r.firstChild;r;r=r.nextSibling)o(r,n,i);r=e(t,f);continue}if("template"===c){r=e(t,f);continue}if(f=f.__CE_shadowRoot)for(f=f.firstChild;f;f=f.nextSibling)o(f,n,i)}r=r.firstChild?r.firstChild:e(t,r)}}function r(t,n,i){t[n]=i}function f(){this.a=new Map,this.g=new Map,this.c=[],this.f=[],this.b=!1}function c(t,n){t.b&&o(n,(function(n){return u(t,n)}))}function u(t,n){if(t.b&&!n.__CE_patched){n.__CE_patched=!0;for(var i=0;i<t.c.length;i++)t.c[i](n);for(i=0;i<t.f.length;i++)t.f[i](n)}}function s(t,n){var i=[];for(o(n,(function(t){return i.push(t)})),n=0;n<i.length;n++){var e=i[n];1===e.__CE_state?t.connectedCallback(e):l(t,e)}}function a(t,n){var i=[];for(o(n,(function(t){return i.push(t)})),n=0;n<i.length;n++){var e=i[n];1===e.__CE_state&&t.disconnectedCallback(e)}}function h(t,n,i){var e=(i=void 0===i?{}:i).u||new Set,r=i.i||function(n){return l(t,n)},f=[];if(o(n,(function(n){if("link"===n.localName&&"import"===n.getAttribute("rel")){var i=n.import;i instanceof Node&&(i.__CE_isImportDocument=!0,i.__CE_hasRegistry=!0),i&&"complete"===i.readyState?i.__CE_documentLoadHandled=!0:n.addEventListener("load",(function(){var i=n.import;if(!i.__CE_documentLoadHandled){i.__CE_documentLoadHandled=!0;var o=new Set(e);o.delete(i),h(t,i,{u:o,i:r})}}))}else f.push(n)}),e),t.b)for(n=0;n<f.length;n++)u(t,f[n]);for(n=0;n<f.length;n++)r(f[n])}function l(t,n){if(void 0===n.__CE_state){var e=n.ownerDocument;if((e.defaultView||e.__CE_isImportDocument&&e.__CE_hasRegistry)&&(e=t.a.get(n.localName))){e.constructionStack.push(n);var o=e.constructorFunction;try{try{if(new o!==n)throw Error("The custom element constructor did not produce the element being upgraded.")}finally{e.constructionStack.pop()}}catch(c){throw n.__CE_state=2,c}if(n.__CE_state=1,n.__CE_definition=e,e.attributeChangedCallback)for(e=e.observedAttributes,o=0;o<e.length;o++){var r=e[o],f=n.getAttribute(r);null!==f&&t.attributeChangedCallback(n,r,null,f,null)}i(n)&&t.connectedCallback(n)}}}function d(t){var n=document;this.c=t,this.a=n,this.b=void 0,h(this.c,this.a),"loading"===this.a.readyState&&(this.b=new MutationObserver(this.f.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}))}function w(t){t.b&&t.b.disconnect()}function v(){var t=this;this.b=this.a=void 0,this.c=new Promise((function(n){t.b=n,t.a&&n(t.a)}))}function m(t){if(t.a)throw Error("Already resolved.");t.a=void 0,t.b&&t.b(void 0)}function b(t){this.c=!1,this.a=t,this.j=new Map,this.f=function(t){return t()},this.b=!1,this.g=[],this.o=new d(t)}f.prototype.connectedCallback=function(t){var n=t.__CE_definition;n.connectedCallback&&n.connectedCallback.call(t)},f.prototype.disconnectedCallback=function(t){var n=t.__CE_definition;n.disconnectedCallback&&n.disconnectedCallback.call(t)},f.prototype.attributeChangedCallback=function(t,n,i,e,o){var r=t.__CE_definition;r.attributeChangedCallback&&-1<r.observedAttributes.indexOf(n)&&r.attributeChangedCallback.call(t,n,i,e,o)},d.prototype.f=function(t){var n=this.a.readyState;for("interactive"!==n&&"complete"!==n||w(this),n=0;n<t.length;n++)for(var i=t[n].addedNodes,e=0;e<i.length;e++)h(this.c,i[e])},b.prototype.l=function(t,i){var e=this;if(!(i instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!n(t))throw new SyntaxError("The element name '"+t+"' is not valid.");if(this.a.a.get(t))throw Error("A custom element with name '"+t+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var o=function(t){var n=r[t];if(void 0!==n&&!(n instanceof Function))throw Error("The '"+t+"' callback must be a function.");return n},r=i.prototype;if(!(r instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var f=o("connectedCallback"),c=o("disconnectedCallback"),u=o("adoptedCallback"),s=o("attributeChangedCallback"),a=i.observedAttributes||[]}catch(d){return}finally{this.c=!1}(function(t,n,i){t.a.set(n,i),t.g.set(i.constructorFunction,i)})(this.a,t,i={localName:t,constructorFunction:i,connectedCallback:f,disconnectedCallback:c,adoptedCallback:u,attributeChangedCallback:s,observedAttributes:a,constructionStack:[]}),this.g.push(i),this.b||(this.b=!0,this.f((function(){return function(t){if(!1!==t.b){t.b=!1;for(var n=t.g,i=[],e=new Map,o=0;o<n.length;o++)e.set(n[o].localName,[]);for(h(t.a,document,{i:function(n){if(void 0===n.__CE_state){var o=n.localName,r=e.get(o);r?r.push(n):t.a.a.get(o)&&i.push(n)}}}),o=0;o<i.length;o++)l(t.a,i[o]);for(;0<n.length;){var r=n.shift();o=r.localName,r=e.get(r.localName);for(var f=0;f<r.length;f++)l(t.a,r[f]);(o=t.j.get(o))&&m(o)}}}(e)})))},b.prototype.i=function(t){h(this.a,t)},b.prototype.get=function(t){if(t=this.a.a.get(t))return t.constructorFunction},b.prototype.m=function(t){if(!n(t))return Promise.reject(new SyntaxError("'"+t+"' is not a valid custom element name."));var i=this.j.get(t);return i||(i=new v,this.j.set(t,i),this.a.a.get(t)&&!this.g.some((function(n){return n.localName===t}))&&m(i)),i.c},b.prototype.s=function(t){w(this.o);var n=this.f;this.f=function(i){return t((function(){return n(i)}))}},window.CustomElementRegistry=b,b.prototype.define=b.prototype.l,b.prototype.upgrade=b.prototype.i,b.prototype.get=b.prototype.get,b.prototype.whenDefined=b.prototype.m,b.prototype.polyfillWrapFlushCallback=b.prototype.s;var E=window.Document.prototype.createElement,p=window.Document.prototype.createElementNS,g=window.Document.prototype.importNode,y=window.Document.prototype.prepend,C=window.Document.prototype.append,T=window.DocumentFragment.prototype.prepend,j=window.DocumentFragment.prototype.append,D=window.Node.prototype.cloneNode,N=window.Node.prototype.appendChild,A=window.Node.prototype.insertBefore,O=window.Node.prototype.removeChild,M=window.Node.prototype.replaceChild,k=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),L=window.Element.prototype.attachShadow,S=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),F=window.Element.prototype.getAttribute,H=window.Element.prototype.setAttribute,x=window.Element.prototype.removeAttribute,z=window.Element.prototype.getAttributeNS,P=window.Element.prototype.setAttributeNS,R=window.Element.prototype.removeAttributeNS,$=window.Element.prototype.insertAdjacentElement,_=window.Element.prototype.insertAdjacentHTML,B=window.Element.prototype.prepend,I=window.Element.prototype.append,U=window.Element.prototype.before,W=window.Element.prototype.after,q=window.Element.prototype.replaceWith,G=window.Element.prototype.remove,J=window.HTMLElement,K=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),Q=window.HTMLElement.prototype.insertAdjacentElement,V=window.HTMLElement.prototype.insertAdjacentHTML,X=new function(){};function Y(t,n,e){function o(n){return function(e){for(var o=[],r=0;r<arguments.length;++r)o[r]=arguments[r];r=[];for(var f=[],c=0;c<o.length;c++){var u=o[c];if(u instanceof Element&&i(u)&&f.push(u),u instanceof DocumentFragment)for(u=u.firstChild;u;u=u.nextSibling)r.push(u);else r.push(u)}for(n.apply(this,o),o=0;o<f.length;o++)a(t,f[o]);if(i(this))for(o=0;o<r.length;o++)(f=r[o])instanceof Element&&s(t,f)}}void 0!==e.h&&(n.prepend=o(e.h)),void 0!==e.append&&(n.append=o(e.append))}var Z=window.customElements;if(!Z||Z.forcePolyfill||"function"!=typeof Z.define||"function"!=typeof Z.get){var tt=new f;!function(){var t=tt;window.HTMLElement=function(){function n(){var n=this.constructor,i=t.g.get(n);if(!i)throw Error("The custom element being constructed was not registered with `customElements`.");var e=i.constructionStack;if(0===e.length)return e=E.call(document,i.localName),Object.setPrototypeOf(e,n.prototype),e.__CE_state=1,e.__CE_definition=i,u(t,e),e;var o=e[i=e.length-1];if(o===X)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");return e[i]=X,Object.setPrototypeOf(o,n.prototype),u(t,o),o}return Object.defineProperty(n.prototype=J.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:n}),n}()}(),function(){var t=tt;r(Document.prototype,"createElement",(function(n){if(this.__CE_hasRegistry){var i=t.a.get(n);if(i)return new i.constructorFunction}return n=E.call(this,n),u(t,n),n})),r(Document.prototype,"importNode",(function(n,i){return n=g.call(this,n,!!i),this.__CE_hasRegistry?h(t,n):c(t,n),n})),r(Document.prototype,"createElementNS",(function(n,i){if(this.__CE_hasRegistry&&(null===n||"http://www.w3.org/1999/xhtml"===n)){var e=t.a.get(i);if(e)return new e.constructorFunction}return n=p.call(this,n,i),u(t,n),n})),Y(t,Document.prototype,{h:y,append:C})}(),Y(tt,DocumentFragment.prototype,{h:T,append:j}),function(){function t(t,e){Object.defineProperty(t,"textContent",{enumerable:e.enumerable,configurable:!0,get:e.get,set:function(t){if(this.nodeType===Node.TEXT_NODE)e.set.call(this,t);else{var o=void 0;if(this.firstChild){var r=this.childNodes,f=r.length;if(0<f&&i(this)){o=Array(f);for(var c=0;c<f;c++)o[c]=r[c]}}if(e.set.call(this,t),o)for(t=0;t<o.length;t++)a(n,o[t])}}})}var n=tt;r(Node.prototype,"insertBefore",(function(t,e){if(t instanceof DocumentFragment){var o=Array.prototype.slice.apply(t.childNodes);if(t=A.call(this,t,e),i(this))for(e=0;e<o.length;e++)s(n,o[e]);return t}return o=i(t),e=A.call(this,t,e),o&&a(n,t),i(this)&&s(n,t),e})),r(Node.prototype,"appendChild",(function(t){if(t instanceof DocumentFragment){var e=Array.prototype.slice.apply(t.childNodes);if(t=N.call(this,t),i(this))for(var o=0;o<e.length;o++)s(n,e[o]);return t}return e=i(t),o=N.call(this,t),e&&a(n,t),i(this)&&s(n,t),o})),r(Node.prototype,"cloneNode",(function(t){return t=D.call(this,!!t),this.ownerDocument.__CE_hasRegistry?h(n,t):c(n,t),t})),r(Node.prototype,"removeChild",(function(t){var e=i(t),o=O.call(this,t);return e&&a(n,t),o})),r(Node.prototype,"replaceChild",(function(t,e){if(t instanceof DocumentFragment){var o=Array.prototype.slice.apply(t.childNodes);if(t=M.call(this,t,e),i(this))for(a(n,e),e=0;e<o.length;e++)s(n,o[e]);return t}o=i(t);var r=M.call(this,t,e),f=i(this);return f&&a(n,e),o&&a(n,t),f&&s(n,t),r})),k&&k.get?t(Node.prototype,k):function(t,n){t.b=!0,t.c.push(n)}(n,(function(n){t(n,{enumerable:!0,configurable:!0,get:function(){for(var t=[],n=0;n<this.childNodes.length;n++){var i=this.childNodes[n];i.nodeType!==Node.COMMENT_NODE&&t.push(i.textContent)}return t.join("")},set:function(t){for(;this.firstChild;)O.call(this,this.firstChild);null!=t&&""!==t&&N.call(this,document.createTextNode(t))}})}))}(),function(){function t(t,n){Object.defineProperty(t,"innerHTML",{enumerable:n.enumerable,configurable:!0,get:n.get,set:function(t){var e=this,r=void 0;if(i(this)&&(r=[],o(this,(function(t){t!==e&&r.push(t)}))),n.set.call(this,t),r)for(var u=0;u<r.length;u++){var s=r[u];1===s.__CE_state&&f.disconnectedCallback(s)}return this.ownerDocument.__CE_hasRegistry?h(f,this):c(f,this),t}})}function n(t,n){r(t,"insertAdjacentElement",(function(t,e){var o=i(e);return t=n.call(this,t,e),o&&a(f,e),i(t)&&s(f,e),t}))}function e(t,n){function i(t,n){for(var i=[];t!==n;t=t.nextSibling)i.push(t);for(n=0;n<i.length;n++)h(f,i[n])}r(t,"insertAdjacentHTML",(function(t,e){if("beforebegin"===(t=t.toLowerCase())){var o=this.previousSibling;n.call(this,t,e),i(o||this.parentNode.firstChild,this)}else if("afterbegin"===t)o=this.firstChild,n.call(this,t,e),i(this.firstChild,o);else if("beforeend"===t)o=this.lastChild,n.call(this,t,e),i(o||this.firstChild,null);else{if("afterend"!==t)throw new SyntaxError("The value provided ("+t+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.");o=this.nextSibling,n.call(this,t,e),i(this.nextSibling,o)}}))}var f=tt;L&&r(Element.prototype,"attachShadow",(function(t){t=L.call(this,t);var n=f;if(n.b&&!t.__CE_patched){t.__CE_patched=!0;for(var i=0;i<n.c.length;i++)n.c[i](t)}return this.__CE_shadowRoot=t})),S&&S.get?t(Element.prototype,S):K&&K.get?t(HTMLElement.prototype,K):function(t,n){t.b=!0,t.f.push(n)}(f,(function(n){t(n,{enumerable:!0,configurable:!0,get:function(){return D.call(this,!0).innerHTML},set:function(t){var n="template"===this.localName,i=n?this.content:this,e=p.call(document,this.namespaceURI,this.localName);for(e.innerHTML=t;0<i.childNodes.length;)O.call(i,i.childNodes[0]);for(t=n?e.content:e;0<t.childNodes.length;)N.call(i,t.childNodes[0])}})})),r(Element.prototype,"setAttribute",(function(t,n){if(1!==this.__CE_state)return H.call(this,t,n);var i=F.call(this,t);H.call(this,t,n),n=F.call(this,t),f.attributeChangedCallback(this,t,i,n,null)})),r(Element.prototype,"setAttributeNS",(function(t,n,i){if(1!==this.__CE_state)return P.call(this,t,n,i);var e=z.call(this,t,n);P.call(this,t,n,i),i=z.call(this,t,n),f.attributeChangedCallback(this,n,e,i,t)})),r(Element.prototype,"removeAttribute",(function(t){if(1!==this.__CE_state)return x.call(this,t);var n=F.call(this,t);x.call(this,t),null!==n&&f.attributeChangedCallback(this,t,n,null,null)})),r(Element.prototype,"removeAttributeNS",(function(t,n){if(1!==this.__CE_state)return R.call(this,t,n);var i=z.call(this,t,n);R.call(this,t,n);var e=z.call(this,t,n);i!==e&&f.attributeChangedCallback(this,n,i,e,t)})),Q?n(HTMLElement.prototype,Q):$?n(Element.prototype,$):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched."),V?e(HTMLElement.prototype,V):_?e(Element.prototype,_):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched."),Y(f,Element.prototype,{h:B,append:I}),function(t){function n(n){return function(e){for(var o=[],r=0;r<arguments.length;++r)o[r]=arguments[r];r=[];for(var f=[],c=0;c<o.length;c++){var u=o[c];if(u instanceof Element&&i(u)&&f.push(u),u instanceof DocumentFragment)for(u=u.firstChild;u;u=u.nextSibling)r.push(u);else r.push(u)}for(n.apply(this,o),o=0;o<f.length;o++)a(t,f[o]);if(i(this))for(o=0;o<r.length;o++)(f=r[o])instanceof Element&&s(t,f)}}var e=Element.prototype;void 0!==U&&(e.before=n(U)),void 0!==U&&(e.after=n(W)),void 0!==q&&r(e,"replaceWith",(function(n){for(var e=[],o=0;o<arguments.length;++o)e[o]=arguments[o];o=[];for(var r=[],f=0;f<e.length;f++){var c=e[f];if(c instanceof Element&&i(c)&&r.push(c),c instanceof DocumentFragment)for(c=c.firstChild;c;c=c.nextSibling)o.push(c);else o.push(c)}for(f=i(this),q.apply(this,e),e=0;e<r.length;e++)a(t,r[e]);if(f)for(a(t,this),e=0;e<o.length;e++)(r=o[e])instanceof Element&&s(t,r)})),void 0!==G&&r(e,"remove",(function(){var n=i(this);G.call(this),n&&a(t,this)}))}(f)}(),document.__CE_hasRegistry=!0;var nt=new b(tt);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:nt})}}(),"string"!=typeof document.baseURI&&Object.defineProperty(Document.prototype,"baseURI",{enumerable:!0,configurable:!0,get:function(){var t=document.querySelector("base");return t&&t.href?t.href:document.URL}}),"function"!=typeof window.CustomEvent&&(window.CustomEvent=function(t,n){n=n||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,n.bubbles,n.cancelable,n.detail),i},window.CustomEvent.prototype=window.Event.prototype),function(t,n,i){t.composedPath||(t.composedPath=function(){if(this.path)return this.path;var t=this.target;for(this.path=[];null!==t.parentNode;)this.path.push(t),t=t.parentNode;return this.path.push(n,i),this.path})}(Event.prototype,document,window), | ||
| /*! | ||
| Element.closest and Element.matches | ||
| https://github.com/jonathantneal/closest | ||
| Creative Commons Zero v1.0 Universal | ||
| */ | ||
| function(t){"function"!=typeof t.matches&&(t.matches=t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||function(t){t=(this.document||this.ownerDocument).querySelectorAll(t);for(var n=0;t[n]&&t[n]!==this;)++n;return!!t[n]}),"function"!=typeof t.closest&&(t.closest=function(t){for(var n=this;n&&1===n.nodeType;){if(n.matches(t))return n;n=n.parentNode}return null})}(window.Element.prototype), | ||
| /*! | ||
| Element.getRootNode() | ||
| */ | ||
| function(t){function n(t){return t&&t.parentNode?n(t.parentNode):t}"function"!=typeof t.getRootNode&&(t.getRootNode=function(t){return t&&t.composed?function t(i){return(i=n(i))&&11===i.nodeType?t(i.host):i}(this):n(this)})}(Element.prototype), | ||
| /*! | ||
| Element.isConnected() | ||
| */ | ||
| function(t){"isConnected"in t||Object.defineProperty(t,"isConnected",{configurable:!0,enumerable:!0,get:function(){var t=this.getRootNode({composed:!0});return t&&9===t.nodeType}})}(Element.prototype),[Element.prototype,CharacterData.prototype,DocumentType.prototype].forEach((function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this)}})})),function(t){"classList"in t||Object.defineProperty(t,"classList",{get:function(){var t=this,n=(t.getAttribute("class")||"").replace(/^\s+|\s$/g,"").split(/\s+/g);function i(){n.length>0?t.setAttribute("class",n.join(" ")):t.removeAttribute("class")}return""===n[0]&&n.splice(0,1),n.toggle=function(t,e){void 0!==e?e?n.add(t):n.remove(t):-1!==n.indexOf(t)?n.splice(n.indexOf(t),1):n.push(t),i()},n.add=function(){for(var t=[].slice.call(arguments),e=0,o=t.length;e<o;e++)-1===n.indexOf(t[e])&&n.push(t[e]);i()},n.remove=function(){for(var t=[].slice.call(arguments),e=0,o=t.length;e<o;e++)-1!==n.indexOf(t[e])&&n.splice(n.indexOf(t[e]),1);i()},n.item=function(t){return n[t]},n.contains=function(t){return-1!==n.indexOf(t)},n.replace=function(t,e){-1!==n.indexOf(t)&&n.splice(n.indexOf(t),1,e),i()},n.value=t.getAttribute("class")||"",n}})}(Element.prototype), | ||
| /*! | ||
| DOMTokenList | ||
| */ | ||
| function(t){try{document.body.classList.add()}catch(e){var n=t.add,i=t.remove;t.add=function(){for(var t=0;t<arguments.length;t++)n.call(this,arguments[t])},t.remove=function(){for(var t=0;t<arguments.length;t++)i.call(this,arguments[t])}}}(DOMTokenList.prototype); |
| const e="msf-editor";let t,n,l=0,o=!1;const s="undefined"!=typeof window?window:{},r=s.CSS,c=s.document||{head:{}},i={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},a=(()=>(c.head.attachShadow+"").indexOf("[native")>-1)(),u=e=>Promise.resolve(e),f=(()=>{try{return new CSSStyleSheet,!0}catch(e){}return!1})(),d=(e,t,n)=>{n&&n.map(([n,l,o])=>{const s=m(e,n),r=p(t,o),c=$(n);i.ael(s,l,r,c),(t.o=t.o||[]).push(()=>i.rel(s,l,r,c))})},p=(e,t)=>n=>{256&e.t?e.s[t](n):(e.i=e.i||[]).push([t,n])},m=(e,t)=>8&t?s:e,$=e=>0!=(2&e),y=new WeakMap,h=e=>"sc-"+e.u,b={},w=e=>"object"==(e=typeof e)||"function"===e,g="undefined"!=typeof Deno,_=!(g||"undefined"==typeof global||"function"!=typeof require||!global.process||"string"!=typeof __filename||global.origin&&"string"==typeof global.origin),j=(g&&Deno,_?process:g&&Deno,_?process:g&&Deno,(e,t,...n)=>{let l=null,o=!1,s=!1,r=[];const c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((o="function"!=typeof e&&!w(l))&&(l+=""),o&&s?r[r.length-1].p+=l:r.push(o?v(null,l):l),s=o)};if(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter(t=>e[t]).join(" "))}const i=v(e,null);return i.m=t,r.length>0&&(i.$=r),i}),v=(e,t)=>({t:0,h:e,p:t,g:null,$:null,m:null}),M={},S=(e,t,n,l,o,s)=>{if(n!==l){let c=Z(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,o=k(n),s=k(l);t.remove(...o.filter(e=>e&&!s.includes(e))),t.add(...s.filter(e=>e&&!o.includes(e)))}else{const i=w(l);if((c||i&&null!==l)&&!o)try{if(e.tagName.includes("-"))e[t]=l;else{let o=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(r){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!c||4&s||o)&&!i&&e.setAttribute(t,l=!0===l?"":l)}}},O=/\s/,k=e=>e?e.split(O):[],C=(e,t,n,l)=>{const o=11===t.g.nodeType&&t.g.host?t.g.host:t.g,s=e&&e.m||b,r=t.m||b;for(l in s)l in r||S(o,l,s[l],void 0,n,t.t);for(l in r)S(o,l,s[l],r[l],n,t.t)},P=(e,n,l)=>{let o,s,r=n.$[l],i=0;if(o=r.g=c.createElement(r.h),C(null,r,!1),null!=t&&o["s-si"]!==t&&o.classList.add(o["s-si"]=t),r.$)for(i=0;i<r.$.length;++i)s=P(e,r,i),s&&o.appendChild(s);return o},D=(e,t,l,o,s,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===n&&(i=i.shadowRoot);s<=r;++s)o[s]&&(c=P(null,l,s),c&&(o[s].g=c,i.insertBefore(c,t)))},R=(e,t,n,l)=>{for(;t<=n;++t)(l=e[t])&&l.g.remove()},W=(e,t)=>e.h===t.h,x=(e,t)=>{const n=t.g=e.g,l=e.$,o=t.$;C(e,t,!1),null!==l&&null!==o?((e,t,n,l)=>{let o,s=0,r=0,c=t.length-1,i=t[0],a=t[c],u=l.length-1,f=l[0],d=l[u];for(;s<=c&&r<=u;)null==i?i=t[++s]:null==a?a=t[--c]:null==f?f=l[++r]:null==d?d=l[--u]:W(i,f)?(x(i,f),i=t[++s],f=l[++r]):W(a,d)?(x(a,d),a=t[--c],d=l[--u]):W(i,d)?(x(i,d),e.insertBefore(i.g,a.g.nextSibling),i=t[++s],d=l[--u]):W(a,f)?(x(a,f),e.insertBefore(a.g,i.g),a=t[--c],f=l[++r]):(o=P(t&&t[r],n,r),f=l[++r],o&&i.g.parentNode.insertBefore(o,i.g));s>c?D(e,null==l[u+1]?null:l[u+1].g,n,l,r,u):r>u&&R(t,s,c)})(n,l,t,o):null!==o?D(n,null,t,o,0,o.length-1):null!==l&&R(l,0,l.length-1)},E=e=>Q(e)._,L=(e,t,n)=>{const l=E(e);return{emit:e=>T(l,t,{bubbles:!!(4&n),composed:!!(2&n),cancelable:!!(1&n),detail:e})}},T=(e,t,n)=>{const l=i.ce(t,n);return e.dispatchEvent(l),l},U=(e,t)=>{t&&!e.j&&t["s-p"]&&t["s-p"].push(new Promise(t=>e.j=t))},q=(e,t)=>{if(e.t|=16,!(4&e.t))return U(e,e.v),fe(()=>A(e,t));e.t|=512},A=(e,t)=>{const n=e.s;let l;return t&&(e.t|=256,e.i&&(e.i.map(([e,t])=>z(n,e,t)),e.i=null),l=z(n,"componentWillLoad")),l=B(l,()=>z(n,"componentWillRender")),B(l,()=>N(e,n,t))},N=(e,l,o)=>{const s=e._,r=s["s-rc"];o&&(e=>{const t=e.M,n=e._,l=t.t,o=((e,t)=>{let n=h(t),l=le.get(n);if(e=11===e.nodeType?e:c,l)if("string"==typeof l){let t,o=y.get(e=e.head||e);o||y.set(e,o=new Set),o.has(n)||(t=c.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(a&&n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);((e,l)=>{const o=e._,s=e.S||v(null,null),r=(e=>e&&e.h===M)(l)?l:j(null,null,l);n=o.tagName,r.h=null,r.t|=4,e.S=r,r.g=s.g=o.shadowRoot||o,t=o["s-sc"],x(s,r)})(e,F(e,l)),r&&(r.map(e=>e()),s["s-rc"]=void 0);{const t=s["s-p"],n=()=>H(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},F=(e,t)=>{try{t=t.render(),e.t&=-17,e.t|=2}catch(n){ee(n)}return t},H=e=>{const t=e._,n=e.v;64&e.t||(e.t|=64,G(t),e.O(t),n||V()),e.k(t),e.j&&(e.j(),e.j=void 0),512&e.t&&ue(()=>q(e,!1)),e.t&=-517},V=()=>{G(c.documentElement),i.t|=2,ue(()=>T(s,"appload",{detail:{namespace:"msf-editor"}}))},z=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(l){ee(l)}},B=(e,t)=>e&&e.then?e.then(t):t(),G=e=>e.classList.add("hydrated"),I=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),o=e.prototype;if(l.map(([e,[l]])=>{31&l||2&n&&32&l?Object.defineProperty(o,e,{get(){return((e,t)=>Q(this).P.get(t))(0,e)},set(n){((e,t,n,l)=>{const o=Q(e),s=o.P.get(t),r=o.t,c=o.s;n=((e,t)=>null==e||w(e)?e:1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==s||n===s||(o.P.set(t,n),c&&2==(18&r)&&q(o,!1))})(this,e,n,t)},configurable:!0,enumerable:!0}):1&n&&64&l&&Object.defineProperty(o,e,{value(...t){const n=Q(this);return n.D.then(()=>n.s[e](...t))}})}),1&n){const t=new Map;o.attributeChangedCallback=function(e,n,l){i.jmp(()=>{const n=t.get(e);this[n]=(null!==l||"boolean"!=typeof this[n])&&l})},e.observedAttributes=l.filter(([e,t])=>15&t[0]).map(([e,n])=>{const l=n[1]||e;return t.set(l,e),l})}}return e},J=(e,t={})=>{const n=[],l=t.exclude||[],o=s.customElements,r=c.head,u=r.querySelector("meta[charset]"),p=c.createElement("style"),m=[];let $,y=!0;Object.assign(i,t),i.l=new URL(t.resourcesUrl||"./",c.baseURI).href,t.syncQueue&&(i.t|=4),e.map(e=>e[1].map(t=>{const s={t:t[0],u:t[1],C:t[2],R:t[3]};s.C=t[2],s.R=t[3],!a&&1&s.t&&(s.t|=8);const r=s.u,c=class extends HTMLElement{constructor(e){super(e),Y(e=this,s),1&s.t&&(a?e.attachShadow({mode:"open"}):"shadowRoot"in e||(e.shadowRoot=e))}connectedCallback(){$&&(clearTimeout($),$=null),y?m.push(this):i.jmp(()=>(e=>{if(0==(1&i.t)){const t=Q(e),n=t.M,l=()=>{};if(1&t.t)d(e,t,n.R);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){U(t,t.v=n);break}}n.C&&Object.entries(n.C).map(([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}}),ue(()=>(async(e,t,n,l,o)=>{if(0==(32&t.t)){{if(t.t|=32,(o=ne(n)).then){const e=()=>{};o=await o,e()}o.isProxied||(I(o,n,2),o.isProxied=!0);const e=()=>{};t.t|=8;try{new o(t)}catch(c){ee(c)}t.t&=-9,e()}if(o.style){let e=o.style;const t=h(n);if(!le.has(t)){const l=()=>{};8&n.t&&(e=await __sc_import_msf_editor("./p-7faff4bb.js").then(n=>n.scopeCss(e,t,!1))),((e,t,n)=>{let l=le.get(e);f&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,le.set(e,l)})(t,e,!!(1&n.t)),l()}}}const s=t.v,r=()=>q(t,!0);s&&s["s-rc"]?s["s-rc"].push(r):r()})(0,t,n))}l()}})(this))}disconnectedCallback(){i.jmp(()=>(()=>{if(0==(1&i.t)){const e=Q(this);e.o&&(e.o.map(e=>e()),e.o=void 0)}})())}forceUpdate(){(()=>{{const e=Q(this);e._.isConnected&&2==(18&e.t)&&q(e,!1)}})()}componentOnReady(){return Q(this).W}};s.L=e[0],l.includes(r)||o.get(r)||(n.push(r),o.define(r,I(c,s,1)))})),p.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",p.setAttribute("data-styles",""),r.insertBefore(p,u?u.nextSibling:r.firstChild),y=!1,m.length?m.map(e=>e.connectedCallback()):i.jmp(()=>$=setTimeout(V,30))},K=new WeakMap,Q=e=>K.get(e),X=(e,t)=>K.set(t.s=e,t),Y=(e,t)=>{const n={t:0,_:e,M:t,P:new Map};return n.D=new Promise(e=>n.k=e),n.W=new Promise(e=>n.O=e),e["s-p"]=[],e["s-rc"]=[],d(e,n,t.R),K.set(e,n)},Z=(e,t)=>t in e,ee=e=>console.error(e),te=new Map,ne=e=>{const t=e.u.replace(/-/g,"_"),n=e.L,l=te.get(n);return l?l[t]:__sc_import_msf_editor(`./${n}.entry.js`).then(e=>(te.set(n,e),e[t]),ee)},le=new Map,oe=[],se=[],re=[],ce=(e,t)=>n=>{e.push(n),o||(o=!0,t&&4&i.t?ue(ae):i.raf(ae))},ie=(e,t)=>{let n=0,l=0;for(;n<e.length&&(l=performance.now())<t;)try{e[n++](l)}catch(o){ee(o)}n===e.length?e.length=0:0!==n&&e.splice(0,n)},ae=()=>{l++,(e=>{for(let n=0;n<e.length;n++)try{e[n](performance.now())}catch(t){ee(t)}e.length=0})(oe);{const e=2==(6&i.t)?performance.now()+14*Math.ceil(.1*l):1/0;ie(se,e),ie(re,e),se.length>0&&(re.push(...se),se.length=0),(o=oe.length+se.length+re.length>0)?i.raf(ae):l=0}},ue=e=>u().then(e),fe=ce(se,!0);export{r as C,e as N,u as a,J as b,L as c,c as d,E as g,j as h,i as p,X as r,s as w} |
| var __spreadArrays=this&&this.__spreadArrays||function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),a=0,e=0;e<t;e++)for(var s=arguments[e],c=0,o=s.length;c<o;c++,a++)n[a]=s[c];return n};System.register([],(function(r){"use strict";return{execute:function(){ | ||
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| * | ||
| * This file is a port of shadowCSS from webcomponents.js to TypeScript. | ||
| * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js | ||
| * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts | ||
| */ | ||
| var e=function(r){var e=[];var t=0;var n;r=r.replace(/(\[[^\]]*\])/g,(function(r,n){var a="__ph-"+t+"__";e.push(n);t++;return a}));n=r.replace(/(:nth-[-\w]+)(\([^)]+\))/g,(function(r,n,a){var s="__ph-"+t+"__";e.push(a);t++;return n+s}));var a={content:n,placeholders:e};return a};var t=function(r,e){return e.replace(/__ph-(\d+)__/g,(function(e,t){return r[+t]}))};var n="-shadowcsshost";var a="-shadowcssslotted";var s="-shadowcsscontext";var c=")(?:\\(("+"(?:\\([^)(]*\\)|[^)(]*)+?"+")\\))?([^,{]*)";var o=new RegExp("("+n+c,"gim");var i=new RegExp("("+s+c,"gim");var v=new RegExp("("+a+c,"gim");var u=n+"-no-combinator";var l=/-shadowcsshost-no-combinator([^\s]*)/;var f=[/::shadow/g,/::content/g];var p="([>\\s~+[.,{:][\\s\\S]*)?$";var h=/-shadowcsshost/gim;var g=/:host/gim;var d=/::slotted/gim;var m=/:host-context/gim;var _=/\/\*\s*[\s\S]*?\*\//g;var x=function(r){return r.replace(_,"")};var w=/\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;var S=function(r){return r.match(w)||[]};var b=/(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;var W=/([{}])/g;var O="{";var j="}";var E="%BLOCK%";var R=function(r,e){var t=y(r);var n=0;return t.escapedString.replace(b,(function(){var r=[];for(var a=0;a<arguments.length;a++){r[a]=arguments[a]}var s=r[2];var c="";var o=r[4];var i="";if(o&&o.startsWith("{"+E)){c=t.blocks[n++];o=o.substring(E.length+1);i="{"}var v={selector:s,content:c};var u=e(v);return""+r[1]+u.selector+r[3]+i+u.content+o}))};var y=function(r){var e=r.split(W);var t=[];var n=[];var a=0;var s=[];for(var c=0;c<e.length;c++){var o=e[c];if(o===j){a--}if(a>0){s.push(o)}else{if(s.length>0){n.push(s.join(""));t.push(E);s=[]}t.push(o)}if(o===O){a++}}if(s.length>0){n.push(s.join(""));t.push(E)}var i={escapedString:t.join(""),blocks:n};return i};var k=function(r){r=r.replace(m,s).replace(g,n).replace(d,a);return r};var A=function(r,e,t){return r.replace(e,(function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}if(r[2]){var n=r[2].split(",");var a=[];for(var s=0;s<n.length;s++){var c=n[s].trim();if(!c)break;a.push(t(u,c,r[3]))}return a.join(",")}else{return u+r[3]}}))};var T=function(r,e,t){return r+e.replace(n,"")+t};var C=function(r){return A(r,o,T)};var L=function(r,e,t){if(e.indexOf(n)>-1){return T(r,e,t)}else{return r+e+t+", "+e+" "+r+t}};var B=function(r,e){var t="."+e+" > ";var n=[];r=r.replace(v,(function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}if(r[2]){var a=r[2].trim();var s=r[3];var c=t+a+s;var o="";for(var i=r[4]-1;i>=0;i--){var v=r[5][i];if(v==="}"||v===","){break}o=v+o}var l=o+c;var f=""+o.trimRight()+c.trim();if(l.trim()!==f.trim()){var p=f+", "+l;n.push({orgSelector:l,updatedSelector:p})}return c}else{return u+r[3]}}));return{selectors:n,cssText:r}};var I=function(r){return A(r,i,L)};var K=function(r){return f.reduce((function(r,e){return r.replace(e," ")}),r)};var $=function(r){var e=/\[/g;var t=/\]/g;r=r.replace(e,"\\[").replace(t,"\\]");return new RegExp("^("+r+")"+p,"m")};var M=function(r,e){var t=$(e);return!t.test(r)};var U=function(r,e,t){h.lastIndex=0;if(h.test(r)){var n="."+t;return r.replace(l,(function(r,e){return e.replace(/([^:]*)(:*)(.*)/,(function(r,e,t,a){return e+n+t+a}))})).replace(h,n+" ")}return e+" "+r};var q=function(r,n,a){var s=/\[is=([^\]]*)\]/g;n=n.replace(s,(function(r){var e=[];for(var t=1;t<arguments.length;t++){e[t-1]=arguments[t]}return e[0]}));var c="."+n;var o=function(r){var e=r.trim();if(!e){return""}if(r.indexOf(u)>-1){e=U(r,n,a)}else{var t=r.replace(h,"");if(t.length>0){var s=t.match(/([^:]*)(:*)(.*)/);if(s){e=s[1]+c+s[2]+s[3]}}}return e};var i=e(r);r=i.content;var v="";var l=0;var f;var p=/( |>|\+|~(?!=))\s*/g;var g=r.indexOf(u)>-1;var d=!g;while((f=p.exec(r))!==null){var m=f[1];var _=r.slice(l,f.index).trim();d=d||_.indexOf(u)>-1;var x=d?o(_):_;v+=x+" "+m+" ";l=p.lastIndex}var w=r.substring(l);d=d||w.indexOf(u)>-1;v+=d?o(w):w;return t(i.placeholders,v)};var z=function(r,e,t,n){return r.split(",").map((function(r){if(n&&r.indexOf("."+n)>-1){return r.trim()}if(M(r,e)){return q(r,e,t).trim()}else{return r.trim()}})).join(", ")};var D=function(r,e,t,n,a){return R(r,(function(r){var a=r.selector;var s=r.content;if(r.selector[0]!=="@"){a=z(r.selector,e,t,n)}else if(r.selector.startsWith("@media")||r.selector.startsWith("@supports")||r.selector.startsWith("@page")||r.selector.startsWith("@document")){s=D(r.content,e,t,n)}var c={selector:a.replace(/\s{2,}/g," ").trim(),content:s};return c}))};var F=function(r,e,t,n,a){r=k(r);r=C(r);r=I(r);var s=B(r,n);r=s.cssText;r=K(r);if(e){r=D(r,e,t,n)}r=r.replace(/-shadowcsshost-no-combinator/g,"."+t);r=r.replace(/>\s*\*\s+([^{, ]+)/gm," $1 ");return{cssText:r.trim(),slottedSelectors:s.selectors}};var G=r("scopeCss",(function(r,e,t){var n=e+"-h";var a=e+"-s";var s=S(r);r=x(r);var c=[];if(t){var o=function(r){var e="/*!@___"+c.length+"___*/";var t="/*!@"+r.selector+"*/";c.push({placeholder:e,comment:t});r.selector=e+r.selector;return r};r=R(r,(function(r){if(r.selector[0]!=="@"){return o(r)}else if(r.selector.startsWith("@media")||r.selector.startsWith("@supports")||r.selector.startsWith("@page")||r.selector.startsWith("@document")){r.content=R(r.content,o);return r}return r}))}var i=F(r,e,n,a);r=__spreadArrays([i.cssText],s).join("\n");if(t){c.forEach((function(e){var t=e.placeholder,n=e.comment;r=r.replace(t,n)}))}i.slottedSelectors.forEach((function(e){r=r.replace(e.orgSelector,e.updatedSelector)}));return r}))}}})); |
| System.register([],(function(){"use strict";return{execute:function(){}}})); |
| var __awaiter=this&&this.__awaiter||function(t,e,o,n){function i(t){return t instanceof o?t:new o((function(e){e(t)}))}return new(o||(o=Promise))((function(o,r){function a(t){try{l(n.next(t))}catch(e){r(e)}}function s(t){try{l(n["throw"](t))}catch(e){r(e)}}function l(t){t.done?o(t.value):i(t.value).then(a,s)}l((n=n.apply(t,e||[])).next())}))};var __generator=this&&this.__generator||function(t,e){var o={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},n,i,r,a;return a={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(a[Symbol.iterator]=function(){return this}),a;function s(t){return function(e){return l([t,e])}}function l(a){if(n)throw new TypeError("Generator is already executing.");while(o)try{if(n=1,i&&(r=a[0]&2?i["return"]:a[0]?i["throw"]||((r=i["return"])&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;if(i=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:o.label++;return{value:a[1],done:false};case 5:o.label++;i=a[1];a=[0];continue;case 7:a=o.ops.pop();o.trys.pop();continue;default:if(!(r=o.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){o=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(a[0]===6&&o.label<r[1]){o.label=r[1];r=a;break}if(r&&o.label<r[2]){o.label=r[2];o.ops.push(a);break}if(r[2])o.ops.pop();o.trys.pop();continue}a=e.call(t,o)}catch(s){a=[6,s];i=0}finally{n=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};System.register(["./p-d13e53c1.system.js"],(function(t){"use strict";var e,o,n,i;return{setters:[function(t){e=t.r;o=t.c;n=t.h;i=t.g}],execute:function(){var r=":host{display:block;width:100%;border:0;height:100vh}iframe{height:100%;width:100%;min-width:1024px;border:0;z-index:9999;top:0}iframe.open{position:fixed}";var a=t("ms_editor",function(){function t(t){e(this,t);this.editorEvent=o(this,"editorEvent",7);this.content="";this.assetsLoaded=false;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.beforeUnload=function(t){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.sendMessage("beforeUnload",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,o,n;return __generator(this,(function(i){switch(i.label){case 0:console.info("MailStyler Plugin: loading assets ..");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=i.sent();i.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=i.sent();i.label=4;case 4:if(!(this.config.rteToolbars&&this.config.rteToolbars.toolbar_1&&this.config.rteToolbars.toolbar_1 instanceof Promise))return[3,6];o=this.config.rteToolbars;return[4,this.config.rteToolbars.toolbar_1];case 5:o.toolbar_1=i.sent();i.label=6;case 6:n=typeof this.config.debug!=="undefined"&&this.config.debug;this.editorUrl=this.config.editorUrl||"//editor.mailstyler.com";this.mscFrameworkUrl=n?"http://localhost:4200":this.editorUrl;this.assetsLoaded=true;console.info("MailStyler Plugin: assets loaded!");return[2]}}))}))};t.prototype.componentWillRender=function(){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(e){switch(e.label){case 0:t=!this.assetsLoaded&&this.config;if(!t)return[3,2];return[4,this.initConfig()];case 1:t=e.sent();e.label=2;case 2:t;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,o=e.action,n=e.data;if(o==="appOk"){console.info("MailStyler Plugin: Editor is ready!");this.editorDidOpen()}else if(o==="appReady"){var i=Object.assign({},this.config);Object.keys(i).filter((function(t){return typeof i[t]==="function"})).forEach((function(t){return delete i[t]}));this.sendMessage("init",{token:this.token,hostname:window.location.hostname,config:i})}else if(o==="appSave"){var r=new RegExp('bgcolor="none"',"g");n.html=n.html.replace(r,"");n.raw_html=n.raw_html.replace(r,"");if("function"==typeof this.config.onSave){this.config.onSave(n.html,n.raw_html,n.json,n.opts)}else{console.error("MailStyler Plugin: You should provide a valid onSave callback")}}else if(o==="appAutoSave"){var r=new RegExp('bgcolor="none"',"g");n.html=n.html.replace(r,"");n.raw_html=n.raw_html.replace(r,"");if("function"==typeof this.config.onAutoSave){this.config.onAutoSave(n.html,n.raw_html,n.json,n.opts)}else{console.error("MailStyler Plugin: You should provide a valid onAutoSave callback")}}else if(o==="appSaveBlock"){var r=new RegExp('bgcolor="none"',"g");n.html=n.html.replace(r,"");n.raw_html=n.raw_html.replace(r,"");if("function"==typeof this.config.onSaveBlock){this.config.onSaveBlock(n.html,n.raw_html)}else{console.error("MailStyler Plugin: You should provide a valid onSaveBlock callback")}}else if(o==="appModal"){this.modalOpen=n.env==="open"}this.editorEvent.emit({action:o,data:n})}};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 i(this)},enumerable:false,configurable:true});return t}());a.style=r}}})); |
| System.register([],(function(){"use strict";return{execute:function(){(function(){var t=new Set("annotation-xml color-profile font-face font-face-src font-face-uri font-face-format font-face-name missing-glyph".split(" "));function e(e){var n=t.has(e);e=/^[a-z][.0-9_a-z]*-[\-.0-9_a-z]*$/.test(e);return!n&&e}function n(t){var e=t.isConnected;if(void 0!==e)return e;for(;t&&!(t.__CE_isImportDocument||t instanceof Document);)t=t.parentNode||(window.ShadowRoot&&t instanceof ShadowRoot?t.host:void 0);return!(!t||!(t.__CE_isImportDocument||t instanceof Document))}function o(t,e){for(;e&&e!==t&&!e.nextSibling;)e=e.parentNode;return e&&e!==t?e.nextSibling:null}function i(t,e,n){n=void 0===n?new Set:n;for(var r=t;r;){if(r.nodeType===Node.ELEMENT_NODE){var a=r;e(a);var c=a.localName;if("link"===c&&"import"===a.getAttribute("rel")){r=a.import;if(r instanceof Node&&!n.has(r))for(n.add(r),r=r.firstChild;r;r=r.nextSibling)i(r,e,n);r=o(t,a);continue}else if("template"===c){r=o(t,a);continue}if(a=a.__CE_shadowRoot)for(a=a.firstChild;a;a=a.nextSibling)i(a,e,n)}r=r.firstChild?r.firstChild:o(t,r)}}function r(t,e,n){t[e]=n}function a(){this.a=new Map;this.g=new Map;this.c=[];this.f=[];this.b=!1}function c(t,e,n){t.a.set(e,n);t.g.set(n.constructorFunction,n)}function l(t,e){t.b=!0;t.c.push(e)}function s(t,e){t.b=!0;t.f.push(e)}function u(t,e){t.b&&i(e,(function(e){return f(t,e)}))}function f(t,e){if(t.b&&!e.__CE_patched){e.__CE_patched=!0;for(var n=0;n<t.c.length;n++)t.c[n](e);for(n=0;n<t.f.length;n++)t.f[n](e)}}function p(t,e){var n=[];i(e,(function(t){return n.push(t)}));for(e=0;e<n.length;e++){var o=n[e];1===o.__CE_state?t.connectedCallback(o):m(t,o)}}function h(t,e){var n=[];i(e,(function(t){return n.push(t)}));for(e=0;e<n.length;e++){var o=n[e];1===o.__CE_state&&t.disconnectedCallback(o)}}function d(t,e,n){n=void 0===n?{}:n;var o=n.u||new Set,r=n.i||function(e){return m(t,e)},a=[];i(e,(function(e){if("link"===e.localName&&"import"===e.getAttribute("rel")){var n=e.import;n instanceof Node&&(n.__CE_isImportDocument=!0,n.__CE_hasRegistry=!0);n&&"complete"===n.readyState?n.__CE_documentLoadHandled=!0:e.addEventListener("load",(function(){var n=e.import;if(!n.__CE_documentLoadHandled){n.__CE_documentLoadHandled=!0;var i=new Set(o);i.delete(n);d(t,n,{u:i,i:r})}}))}else a.push(e)}),o);if(t.b)for(e=0;e<a.length;e++)f(t,a[e]);for(e=0;e<a.length;e++)r(a[e])}function m(t,e){if(void 0===e.__CE_state){var o=e.ownerDocument;if(o.defaultView||o.__CE_isImportDocument&&o.__CE_hasRegistry)if(o=t.a.get(e.localName)){o.constructionStack.push(e);var i=o.constructorFunction;try{try{if(new i!==e)throw Error("The custom element constructor did not produce the element being upgraded.")}finally{o.constructionStack.pop()}}catch(c){throw e.__CE_state=2,c}e.__CE_state=1;e.__CE_definition=o;if(o.attributeChangedCallback)for(o=o.observedAttributes,i=0;i<o.length;i++){var r=o[i],a=e.getAttribute(r);null!==a&&t.attributeChangedCallback(e,r,null,a,null)}n(e)&&t.connectedCallback(e)}}}a.prototype.connectedCallback=function(t){var e=t.__CE_definition;e.connectedCallback&&e.connectedCallback.call(t)};a.prototype.disconnectedCallback=function(t){var e=t.__CE_definition;e.disconnectedCallback&&e.disconnectedCallback.call(t)};a.prototype.attributeChangedCallback=function(t,e,n,o,i){var r=t.__CE_definition;r.attributeChangedCallback&&-1<r.observedAttributes.indexOf(e)&&r.attributeChangedCallback.call(t,e,n,o,i)};function y(t){var e=document;this.c=t;this.a=e;this.b=void 0;d(this.c,this.a);"loading"===this.a.readyState&&(this.b=new MutationObserver(this.f.bind(this)),this.b.observe(this.a,{childList:!0,subtree:!0}))}function b(t){t.b&&t.b.disconnect()}y.prototype.f=function(t){var e=this.a.readyState;"interactive"!==e&&"complete"!==e||b(this);for(e=0;e<t.length;e++)for(var n=t[e].addedNodes,o=0;o<n.length;o++)d(this.c,n[o])};function v(){var t=this;this.b=this.a=void 0;this.c=new Promise((function(e){t.b=e;t.a&&e(t.a)}))}function g(t){if(t.a)throw Error("Already resolved.");t.a=void 0;t.b&&t.b(void 0)}function w(t){this.c=!1;this.a=t;this.j=new Map;this.f=function(t){return t()};this.b=!1;this.g=[];this.o=new y(t)}w.prototype.l=function(t,n){var o=this;if(!(n instanceof Function))throw new TypeError("Custom element constructors must be functions.");if(!e(t))throw new SyntaxError("The element name '"+t+"' is not valid.");if(this.a.a.get(t))throw Error("A custom element with name '"+t+"' has already been defined.");if(this.c)throw Error("A custom element is already being defined.");this.c=!0;try{var i=function(t){var e=r[t];if(void 0!==e&&!(e instanceof Function))throw Error("The '"+t+"' callback must be a function.");return e},r=n.prototype;if(!(r instanceof Object))throw new TypeError("The custom element constructor's prototype is not an object.");var a=i("connectedCallback");var l=i("disconnectedCallback");var s=i("adoptedCallback");var u=i("attributeChangedCallback");var f=n.observedAttributes||[]}catch(p){return}finally{this.c=!1}n={localName:t,constructorFunction:n,connectedCallback:a,disconnectedCallback:l,adoptedCallback:s,attributeChangedCallback:u,observedAttributes:f,constructionStack:[]};c(this.a,t,n);this.g.push(n);this.b||(this.b=!0,this.f((function(){return E(o)})))};w.prototype.i=function(t){d(this.a,t)};function E(t){if(!1!==t.b){t.b=!1;for(var e=t.g,n=[],o=new Map,i=0;i<e.length;i++)o.set(e[i].localName,[]);d(t.a,document,{i:function(e){if(void 0===e.__CE_state){var i=e.localName,r=o.get(i);r?r.push(e):t.a.a.get(i)&&n.push(e)}}});for(i=0;i<n.length;i++)m(t.a,n[i]);for(;0<e.length;){var r=e.shift();i=r.localName;r=o.get(r.localName);for(var a=0;a<r.length;a++)m(t.a,r[a]);(i=t.j.get(i))&&g(i)}}}w.prototype.get=function(t){if(t=this.a.a.get(t))return t.constructorFunction};w.prototype.m=function(t){if(!e(t))return Promise.reject(new SyntaxError("'"+t+"' is not a valid custom element name."));var n=this.j.get(t);if(n)return n.c;n=new v;this.j.set(t,n);this.a.a.get(t)&&!this.g.some((function(e){return e.localName===t}))&&g(n);return n.c};w.prototype.s=function(t){b(this.o);var e=this.f;this.f=function(n){return t((function(){return e(n)}))}};window.CustomElementRegistry=w;w.prototype.define=w.prototype.l;w.prototype.upgrade=w.prototype.i;w.prototype.get=w.prototype.get;w.prototype.whenDefined=w.prototype.m;w.prototype.polyfillWrapFlushCallback=w.prototype.s;var _=window.Document.prototype.createElement,C=window.Document.prototype.createElementNS,N=window.Document.prototype.importNode,S=window.Document.prototype.prepend,T=window.Document.prototype.append,D=window.DocumentFragment.prototype.prepend,k=window.DocumentFragment.prototype.append,A=window.Node.prototype.cloneNode,O=window.Node.prototype.appendChild,j=window.Node.prototype.insertBefore,L=window.Node.prototype.removeChild,M=window.Node.prototype.replaceChild,x=Object.getOwnPropertyDescriptor(window.Node.prototype,"textContent"),H=window.Element.prototype.attachShadow,R=Object.getOwnPropertyDescriptor(window.Element.prototype,"innerHTML"),P=window.Element.prototype.getAttribute,F=window.Element.prototype.setAttribute,I=window.Element.prototype.removeAttribute,z=window.Element.prototype.getAttributeNS,U=window.Element.prototype.setAttributeNS,W=window.Element.prototype.removeAttributeNS,q=window.Element.prototype.insertAdjacentElement,B=window.Element.prototype.insertAdjacentHTML,$=window.Element.prototype.prepend,V=window.Element.prototype.append,X=window.Element.prototype.before,G=window.Element.prototype.after,J=window.Element.prototype.replaceWith,K=window.Element.prototype.remove,Q=window.HTMLElement,Y=Object.getOwnPropertyDescriptor(window.HTMLElement.prototype,"innerHTML"),Z=window.HTMLElement.prototype.insertAdjacentElement,tt=window.HTMLElement.prototype.insertAdjacentHTML;var et=new function(){};function nt(){var t=st;window.HTMLElement=function(){function e(){var e=this.constructor,n=t.g.get(e);if(!n)throw Error("The custom element being constructed was not registered with `customElements`.");var o=n.constructionStack;if(0===o.length)return o=_.call(document,n.localName),Object.setPrototypeOf(o,e.prototype),o.__CE_state=1,o.__CE_definition=n,f(t,o),o;n=o.length-1;var i=o[n];if(i===et)throw Error("The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.");o[n]=et;Object.setPrototypeOf(i,e.prototype);f(t,i);return i}e.prototype=Q.prototype;Object.defineProperty(e.prototype,"constructor",{writable:!0,configurable:!0,enumerable:!1,value:e});return e}()}function ot(t,e,o){function i(e){return function(o){for(var i=[],r=0;r<arguments.length;++r)i[r]=arguments[r];r=[];for(var a=[],c=0;c<i.length;c++){var l=i[c];l instanceof Element&&n(l)&&a.push(l);if(l instanceof DocumentFragment)for(l=l.firstChild;l;l=l.nextSibling)r.push(l);else r.push(l)}e.apply(this,i);for(i=0;i<a.length;i++)h(t,a[i]);if(n(this))for(i=0;i<r.length;i++)a=r[i],a instanceof Element&&p(t,a)}}void 0!==o.h&&(e.prepend=i(o.h));void 0!==o.append&&(e.append=i(o.append))}function it(){var t=st;r(Document.prototype,"createElement",(function(e){if(this.__CE_hasRegistry){var n=t.a.get(e);if(n)return new n.constructorFunction}e=_.call(this,e);f(t,e);return e}));r(Document.prototype,"importNode",(function(e,n){e=N.call(this,e,!!n);this.__CE_hasRegistry?d(t,e):u(t,e);return e}));r(Document.prototype,"createElementNS",(function(e,n){if(this.__CE_hasRegistry&&(null===e||"http://www.w3.org/1999/xhtml"===e)){var o=t.a.get(n);if(o)return new o.constructorFunction}e=C.call(this,e,n);f(t,e);return e}));ot(t,Document.prototype,{h:S,append:T})}function rt(){function t(t,o){Object.defineProperty(t,"textContent",{enumerable:o.enumerable,configurable:!0,get:o.get,set:function(t){if(this.nodeType===Node.TEXT_NODE)o.set.call(this,t);else{var i=void 0;if(this.firstChild){var r=this.childNodes,a=r.length;if(0<a&&n(this)){i=Array(a);for(var c=0;c<a;c++)i[c]=r[c]}}o.set.call(this,t);if(i)for(t=0;t<i.length;t++)h(e,i[t])}}})}var e=st;r(Node.prototype,"insertBefore",(function(t,o){if(t instanceof DocumentFragment){var i=Array.prototype.slice.apply(t.childNodes);t=j.call(this,t,o);if(n(this))for(o=0;o<i.length;o++)p(e,i[o]);return t}i=n(t);o=j.call(this,t,o);i&&h(e,t);n(this)&&p(e,t);return o}));r(Node.prototype,"appendChild",(function(t){if(t instanceof DocumentFragment){var o=Array.prototype.slice.apply(t.childNodes);t=O.call(this,t);if(n(this))for(var i=0;i<o.length;i++)p(e,o[i]);return t}o=n(t);i=O.call(this,t);o&&h(e,t);n(this)&&p(e,t);return i}));r(Node.prototype,"cloneNode",(function(t){t=A.call(this,!!t);this.ownerDocument.__CE_hasRegistry?d(e,t):u(e,t);return t}));r(Node.prototype,"removeChild",(function(t){var o=n(t),i=L.call(this,t);o&&h(e,t);return i}));r(Node.prototype,"replaceChild",(function(t,o){if(t instanceof DocumentFragment){var i=Array.prototype.slice.apply(t.childNodes);t=M.call(this,t,o);if(n(this))for(h(e,o),o=0;o<i.length;o++)p(e,i[o]);return t}i=n(t);var r=M.call(this,t,o),a=n(this);a&&h(e,o);i&&h(e,t);a&&p(e,t);return r}));x&&x.get?t(Node.prototype,x):l(e,(function(e){t(e,{enumerable:!0,configurable:!0,get:function(){for(var t=[],e=0;e<this.childNodes.length;e++){var n=this.childNodes[e];n.nodeType!==Node.COMMENT_NODE&&t.push(n.textContent)}return t.join("")},set:function(t){for(;this.firstChild;)L.call(this,this.firstChild);null!=t&&""!==t&&O.call(this,document.createTextNode(t))}})}))}function at(t){function e(e){return function(o){for(var i=[],r=0;r<arguments.length;++r)i[r]=arguments[r];r=[];for(var a=[],c=0;c<i.length;c++){var l=i[c];l instanceof Element&&n(l)&&a.push(l);if(l instanceof DocumentFragment)for(l=l.firstChild;l;l=l.nextSibling)r.push(l);else r.push(l)}e.apply(this,i);for(i=0;i<a.length;i++)h(t,a[i]);if(n(this))for(i=0;i<r.length;i++)a=r[i],a instanceof Element&&p(t,a)}}var o=Element.prototype;void 0!==X&&(o.before=e(X));void 0!==X&&(o.after=e(G));void 0!==J&&r(o,"replaceWith",(function(e){for(var o=[],i=0;i<arguments.length;++i)o[i]=arguments[i];i=[];for(var r=[],a=0;a<o.length;a++){var c=o[a];c instanceof Element&&n(c)&&r.push(c);if(c instanceof DocumentFragment)for(c=c.firstChild;c;c=c.nextSibling)i.push(c);else i.push(c)}a=n(this);J.apply(this,o);for(o=0;o<r.length;o++)h(t,r[o]);if(a)for(h(t,this),o=0;o<i.length;o++)r=i[o],r instanceof Element&&p(t,r)}));void 0!==K&&r(o,"remove",(function(){var e=n(this);K.call(this);e&&h(t,this)}))}function ct(){function t(t,e){Object.defineProperty(t,"innerHTML",{enumerable:e.enumerable,configurable:!0,get:e.get,set:function(t){var o=this,r=void 0;n(this)&&(r=[],i(this,(function(t){t!==o&&r.push(t)})));e.set.call(this,t);if(r)for(var c=0;c<r.length;c++){var l=r[c];1===l.__CE_state&&a.disconnectedCallback(l)}this.ownerDocument.__CE_hasRegistry?d(a,this):u(a,this);return t}})}function e(t,e){r(t,"insertAdjacentElement",(function(t,o){var i=n(o);t=e.call(this,t,o);i&&h(a,o);n(t)&&p(a,o);return t}))}function o(t,e){function n(t,e){for(var n=[];t!==e;t=t.nextSibling)n.push(t);for(e=0;e<n.length;e++)d(a,n[e])}r(t,"insertAdjacentHTML",(function(t,o){t=t.toLowerCase();if("beforebegin"===t){var i=this.previousSibling;e.call(this,t,o);n(i||this.parentNode.firstChild,this)}else if("afterbegin"===t)i=this.firstChild,e.call(this,t,o),n(this.firstChild,i);else if("beforeend"===t)i=this.lastChild,e.call(this,t,o),n(i||this.firstChild,null);else if("afterend"===t)i=this.nextSibling,e.call(this,t,o),n(this.nextSibling,i);else throw new SyntaxError("The value provided ("+String(t)+") is not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.")}))}var a=st;H&&r(Element.prototype,"attachShadow",(function(t){t=H.call(this,t);var e=a;if(e.b&&!t.__CE_patched){t.__CE_patched=!0;for(var n=0;n<e.c.length;n++)e.c[n](t)}return this.__CE_shadowRoot=t}));R&&R.get?t(Element.prototype,R):Y&&Y.get?t(HTMLElement.prototype,Y):s(a,(function(e){t(e,{enumerable:!0,configurable:!0,get:function(){return A.call(this,!0).innerHTML},set:function(t){var e="template"===this.localName,n=e?this.content:this,o=C.call(document,this.namespaceURI,this.localName);for(o.innerHTML=t;0<n.childNodes.length;)L.call(n,n.childNodes[0]);for(t=e?o.content:o;0<t.childNodes.length;)O.call(n,t.childNodes[0])}})}));r(Element.prototype,"setAttribute",(function(t,e){if(1!==this.__CE_state)return F.call(this,t,e);var n=P.call(this,t);F.call(this,t,e);e=P.call(this,t);a.attributeChangedCallback(this,t,n,e,null)}));r(Element.prototype,"setAttributeNS",(function(t,e,n){if(1!==this.__CE_state)return U.call(this,t,e,n);var o=z.call(this,t,e);U.call(this,t,e,n);n=z.call(this,t,e);a.attributeChangedCallback(this,e,o,n,t)}));r(Element.prototype,"removeAttribute",(function(t){if(1!==this.__CE_state)return I.call(this,t);var e=P.call(this,t);I.call(this,t);null!==e&&a.attributeChangedCallback(this,t,e,null,null)}));r(Element.prototype,"removeAttributeNS",(function(t,e){if(1!==this.__CE_state)return W.call(this,t,e);var n=z.call(this,t,e);W.call(this,t,e);var o=z.call(this,t,e);n!==o&&a.attributeChangedCallback(this,e,n,o,t)}));Z?e(HTMLElement.prototype,Z):q?e(Element.prototype,q):console.warn("Custom Elements: `Element#insertAdjacentElement` was not patched.");tt?o(HTMLElement.prototype,tt):B?o(Element.prototype,B):console.warn("Custom Elements: `Element#insertAdjacentHTML` was not patched.");ot(a,Element.prototype,{h:$,append:V});at(a)}var lt=window.customElements;if(!lt||lt.forcePolyfill||"function"!=typeof lt.define||"function"!=typeof lt.get){var st=new a;nt();it();ot(st,DocumentFragment.prototype,{h:D,append:k});rt();ct();document.__CE_hasRegistry=!0;var ut=new w(st);Object.defineProperty(window,"customElements",{configurable:!0,enumerable:!0,value:ut})}}).call(self);"string"!==typeof document.baseURI&&Object.defineProperty(Document.prototype,"baseURI",{enumerable:!0,configurable:!0,get:function(){var t=document.querySelector("base");return t&&t.href?t.href:document.URL}});"function"!==typeof window.CustomEvent&&(window.CustomEvent=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail);return n},window.CustomEvent.prototype=window.Event.prototype);(function(t,e,n){t.composedPath||(t.composedPath=function(){if(this.path)return this.path;var t=this.target;for(this.path=[];null!==t.parentNode;)this.path.push(t),t=t.parentNode;this.path.push(e,n);return this.path})})(Event.prototype,document,window); | ||
| /*! | ||
| Element.closest and Element.matches | ||
| https://github.com/jonathantneal/closest | ||
| Creative Commons Zero v1.0 Universal | ||
| */(function(t){"function"!==typeof t.matches&&(t.matches=t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||function(t){t=(this.document||this.ownerDocument).querySelectorAll(t);for(var e=0;t[e]&&t[e]!==this;)++e;return!!t[e]});"function"!==typeof t.closest&&(t.closest=function(t){for(var e=this;e&&1===e.nodeType;){if(e.matches(t))return e;e=e.parentNode}return null})})(window.Element.prototype); | ||
| /*! | ||
| Element.getRootNode() | ||
| */(function(t){function e(t){t=n(t);return t&&11===t.nodeType?e(t.host):t}function n(t){return t&&t.parentNode?n(t.parentNode):t}"function"!==typeof t.getRootNode&&(t.getRootNode=function(t){return t&&t.composed?e(this):n(this)})})(Element.prototype); | ||
| /*! | ||
| Element.isConnected() | ||
| */(function(t){"isConnected"in t||Object.defineProperty(t,"isConnected",{configurable:!0,enumerable:!0,get:function(){var t=this.getRootNode({composed:!0});return t&&9===t.nodeType}})})(Element.prototype); | ||
| /*! | ||
| Element.remove() | ||
| */(function(t){t.forEach((function(t){t.hasOwnProperty("remove")||Object.defineProperty(t,"remove",{configurable:!0,enumerable:!0,writable:!0,value:function(){null!==this.parentNode&&this.parentNode.removeChild(this)}})}))})([Element.prototype,CharacterData.prototype,DocumentType.prototype]); | ||
| /*! | ||
| Element.classList | ||
| */!function(t){"classList"in t||Object.defineProperty(t,"classList",{get:function(){var t=this,e=(t.getAttribute("class")||"").replace(/^\s+|\s$/g,"").split(/\s+/g);function n(){e.length>0?t.setAttribute("class",e.join(" ")):t.removeAttribute("class")}return""===e[0]&&e.splice(0,1),e.toggle=function(t,o){void 0!==o?o?e.add(t):e.remove(t):-1!==e.indexOf(t)?e.splice(e.indexOf(t),1):e.push(t),n()},e.add=function(){for(var t=[].slice.call(arguments),o=0,i=t.length;o<i;o++)-1===e.indexOf(t[o])&&e.push(t[o]);n()},e.remove=function(){for(var t=[].slice.call(arguments),o=0,i=t.length;o<i;o++)-1!==e.indexOf(t[o])&&e.splice(e.indexOf(t[o]),1);n()},e.item=function(t){return e[t]},e.contains=function(t){return-1!==e.indexOf(t)},e.replace=function(t,o){-1!==e.indexOf(t)&&e.splice(e.indexOf(t),1,o),n()},e.value=t.getAttribute("class")||"",e}})}(Element.prototype); | ||
| /*! | ||
| DOMTokenList | ||
| */(function(t){try{document.body.classList.add()}catch(o){var e=t.add,n=t.remove;t.add=function(){for(var t=0;t<arguments.length;t++)e.call(this,arguments[t])};t.remove=function(){for(var t=0;t<arguments.length;t++)n.call(this,arguments[t])}}})(DOMTokenList.prototype)}}})); |
| /** | ||
| * @license | ||
| * Copyright Google Inc. All Rights Reserved. | ||
| * | ||
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| * | ||
| * This file is a port of shadowCSS from webcomponents.js to TypeScript. | ||
| * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js | ||
| * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts | ||
| */ | ||
| const s=/(-shadowcsshost)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))?([^,{]*)/gim,t=/(-shadowcsscontext)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))?([^,{]*)/gim,o=/(-shadowcssslotted)(?:\(((?:\([^)(]*\)|[^)(]*)+?)\))?([^,{]*)/gim,n=/-shadowcsshost-no-combinator([^\s]*)/,e=[/::shadow/g,/::content/g],c=/-shadowcsshost/gim,r=/:host/gim,h=/::slotted/gim,a=/:host-context/gim,d=/\/\*\s*[\s\S]*?\*\//g,l=/\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g,i=/(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g,g=/([{}])/g,u=(s,t)=>{const o=m(s);let n=0;return o.escapedString.replace(i,(...s)=>{const e=s[2];let c="",r=s[4],h="";r&&r.startsWith("{%BLOCK%")&&(c=o.blocks[n++],r=r.substring(8),h="{");const a=t({selector:e,content:c});return`${s[1]}${a.selector}${s[3]}${h}${a.content}${r}`})},m=s=>{const t=s.split(g),o=[],n=[];let e=0,c=[];for(let r=0;r<t.length;r++){const s=t[r];"}"===s&&e--,e>0?c.push(s):(c.length>0&&(n.push(c.join("")),o.push("%BLOCK%"),c=[]),o.push(s)),"{"===s&&e++}return c.length>0&&(n.push(c.join("")),o.push("%BLOCK%")),{escapedString:o.join(""),blocks:n}},w=(s,t,o)=>s.replace(t,(...s)=>{if(s[2]){const t=s[2].split(","),n=[];for(let e=0;e<t.length;e++){const c=t[e].trim();if(!c)break;n.push(o("-shadowcsshost-no-combinator",c,s[3]))}return n.join(",")}return"-shadowcsshost-no-combinator"+s[3]}),p=(s,t,o)=>s+t.replace("-shadowcsshost","")+o,$=(s,t,o)=>t.indexOf("-shadowcsshost")>-1?p(s,t,o):s+t+o+", "+t+" "+s+o,_=(s,t,o,e)=>u(s,s=>{let r=s.selector,h=s.content;return"@"!==s.selector[0]?r=((s,t,o,e)=>s.split(",").map(s=>e&&s.indexOf("."+e)>-1?s.trim():((s,t)=>!(s=>(s=s.replace(/\[/g,"\\[").replace(/\]/g,"\\]"),RegExp("^("+s+")([>\\s~+[.,{:][\\s\\S]*)?$","m")))(t).test(s))(s,t)?((s,t,o)=>{const e="."+(t=t.replace(/\[is=([^\]]*)\]/g,(s,...t)=>t[0])),r=s=>{let r=s.trim();if(!r)return"";if(s.indexOf("-shadowcsshost-no-combinator")>-1)r=((s,t,o)=>{if(c.lastIndex=0,c.test(s)){const t="."+o;return s.replace(n,(s,o)=>o.replace(/([^:]*)(:*)(.*)/,(s,o,n,e)=>o+t+n+e)).replace(c,t+" ")}return t+" "+s})(s,t,o);else{const t=s.replace(c,"");if(t.length>0){const s=t.match(/([^:]*)(:*)(.*)/);s&&(r=s[1]+e+s[2]+s[3])}}return r},h=(s=>{const t=[];let o,n=0;return o=(s=s.replace(/(\[[^\]]*\])/g,(s,o)=>{const e=`__ph-${n}__`;return t.push(o),n++,e})).replace(/(:nth-[-\w]+)(\([^)]+\))/g,(s,o,e)=>{const c=`__ph-${n}__`;return t.push(e),n++,o+c}),{content:o,placeholders:t}})(s);let a,d="",l=0;const i=/( |>|\+|~(?!=))\s*/g;let g=!((s=h.content).indexOf("-shadowcsshost-no-combinator")>-1);for(;null!==(a=i.exec(s));){const t=a[1],o=s.slice(l,a.index).trim();g=g||o.indexOf("-shadowcsshost-no-combinator")>-1,d+=`${g?r(o):o} ${t} `,l=i.lastIndex}const u=s.substring(l);return g=g||u.indexOf("-shadowcsshost-no-combinator")>-1,d+=g?r(u):u,((s,t)=>t.replace(/__ph-(\d+)__/g,(t,o)=>s[+o]))(h.placeholders,d)})(s,t,o).trim():s.trim()).join(", "))(s.selector,t,o,e):(s.selector.startsWith("@media")||s.selector.startsWith("@supports")||s.selector.startsWith("@page")||s.selector.startsWith("@document"))&&(h=_(s.content,t,o,e)),{selector:r.replace(/\s{2,}/g," ").trim(),content:h}}),f=(n,c,i)=>{const g=c+"-h",m=c+"-s",f=(s=>s.match(l)||[])(n);n=(s=>s.replace(d,""))(n);const b=[];if(i){const s=s=>{const t=`/*!@___${b.length}___*/`;return b.push({placeholder:t,comment:`/*!@${s.selector}*/`}),s.selector=t+s.selector,s};n=u(n,t=>"@"!==t.selector[0]?s(t):t.selector.startsWith("@media")||t.selector.startsWith("@supports")||t.selector.startsWith("@page")||t.selector.startsWith("@document")?(t.content=u(t.content,s),t):t)}const x=((n,c,d,l)=>{const i=((s,t)=>{const n="."+t+" > ",e=[];return s=s.replace(o,(...s)=>{if(s[2]){const t=s[2].trim(),o=n+t+s[3];let c="";for(let n=s[4]-1;n>=0;n--){const t=s[5][n];if("}"===t||","===t)break;c=t+c}const r=c+o,h=`${c.trimRight()}${o.trim()}`;return r.trim()!==h.trim()&&e.push({orgSelector:r,updatedSelector:`${h}, ${r}`}),o}return"-shadowcsshost-no-combinator"+s[3]}),{selectors:e,cssText:s}})(n=(s=>w(s,t,$))(n=(t=>w(t,s,p))(n=(s=>s.replace(a,"-shadowcsscontext").replace(r,"-shadowcsshost").replace(h,"-shadowcssslotted"))(n))),l);return n=(s=>e.reduce((s,t)=>s.replace(t," "),s))(n=i.cssText),c&&(n=_(n,c,d,l)),{cssText:(n=(n=n.replace(/-shadowcsshost-no-combinator/g,"."+d)).replace(/>\s*\*\s+([^{, ]+)/gm," $1 ")).trim(),slottedSelectors:i.selectors}})(n,c,g,m);return n=[x.cssText,...f].join("\n"),i&&b.forEach(({placeholder:s,comment:t})=>{n=n.replace(s,t)}),x.slottedSelectors.forEach(s=>{n=n.replace(s.orgSelector,s.updatedSelector)}),n};export{f as scopeCss} |
| import{C as e,p as o,w as s,a as t,d as n,N as r}from"./p-44776af7.js";const a="undefined"!=typeof Deno,p=!(a||"undefined"==typeof global||"function"!=typeof require||!global.process||"string"!=typeof __filename||global.origin&&"string"==typeof global.origin),i=(a&&Deno,p?process:a&&Deno,p?process:a&&Deno,()=>e&&e.supports&&e.supports("color","var(--c)")?t():__sc_import_msf_editor("./p-0ad0b6e8.js").then(()=>(o.o=s.__cssshim)?(!1).i():0)),c=()=>{o.o=s.__cssshim;const e=Array.from(n.querySelectorAll("script")).find(e=>RegExp(`/${r}(\\.esm)?\\.js($|\\?|#)`).test(e.src)||e.getAttribute("data-stencil-namespace")===r),a=e["data-opts"]||{};return"onbeforeload"in e&&!history.scrollRestoration?{then(){}}:(a.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,s.location.href)).href,m(a.resourcesUrl,e),s.customElements?t(a):__sc_import_msf_editor("./p-3d1015c2.js").then(()=>a))},m=(e,o)=>{const t="__sc_import_"+r.replace(/\s|-/g,"_");try{s[t]=Function("w","return import(w);//"+Math.random())}catch(a){const r=new Map;s[t]=a=>{const p=new URL(a,e).href;let i=r.get(p);if(!i){const e=n.createElement("script");e.type="module",e.crossOrigin=o.crossOrigin,e.src=URL.createObjectURL(new Blob([`import * as m from '${p}'; window.${t}.m = m;`],{type:"application/javascript"})),i=new Promise(o=>{e.onload=()=>{o(s[t].m),e.remove()}}),r.set(p,i),n.head.appendChild(e)}return i}}};export{i as a,c as p} |
| System.register(["./p-d13e53c1.system.js"],(function(e,r){"use strict";var t,n,o,s,i,c;return{setters:[function(e){t=e.C;n=e.p;o=e.w;s=e.a;i=e.d;c=e.N}],execute:function(){var a=function(){};var u=typeof Deno!=="undefined";var f=!u&&typeof global!=="undefined"&&typeof require==="function"&&!!global.process&&typeof __filename==="string"&&(!global.origin||typeof global.origin!=="string");var p=u&&Deno.build.os==="windows";var l=f?process.cwd:u?Deno.cwd:function(){return"/"};var m=f?process.exit:u?Deno.exit:a;var d=function(e){return"__sc_import_"+e.replace(/\s|-/g,"_")};var v=e("a",(function(){if(!(t&&t.supports&&t.supports("color","var(--c)"))){return r.import("./p-fb53799e.system.js").then((function(){if(n.$cssShim$=o.__cssshim){return n.$cssShim$.i()}else{return 0}}))}return s()}));var w=e("p",(function(){{n.$cssShim$=o.__cssshim}var e=Array.from(i.querySelectorAll("script")).find((function(e){return new RegExp("/"+c+"(\\.esm)?\\.js($|\\?|#)").test(e.src)||e.getAttribute("data-stencil-namespace")===c}));var t=e["data-opts"]||{};if("onbeforeload"in e&&!history.scrollRestoration){return{then:function(){}}}{t.resourcesUrl=new URL(".",new URL(e.getAttribute("data-resources-url")||e.src,o.location.href)).href;{g(t.resourcesUrl,e)}if(!o.customElements){return r.import("./p-75076c56.system.js").then((function(){return t}))}}return s(t)}));var g=function(e,r){var t=d(c);try{o[t]=new Function("w","return import(w);//"+Math.random())}catch(s){var n=new Map;o[t]=function(s){var c=new URL(s,e).href;var a=n.get(c);if(!a){var u=i.createElement("script");u.type="module";u.crossOrigin=r.crossOrigin;u.src=URL.createObjectURL(new Blob(["import * as m from '"+c+"'; window."+t+".m = m;"],{type:"application/javascript"}));a=new Promise((function(e){u.onload=function(){e(o[t].m);u.remove()}}));n.set(c,a);i.head.appendChild(u)}return a}}}}}})); |
| var __extends=this&&this.__extends||function(){var e=function(n,r){e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var r in n)if(n.hasOwnProperty(r))e[r]=n[r]};return e(n,r)};return function(n,r){e(n,r);function t(){this.constructor=n}n.prototype=r===null?Object.create(r):(t.prototype=r.prototype,new t)}}();var __awaiter=this&&this.__awaiter||function(e,n,r,t){function a(e){return e instanceof r?e:new r((function(n){n(e)}))}return new(r||(r=Promise))((function(r,i){function o(e){try{l(t.next(e))}catch(n){i(n)}}function s(e){try{l(t["throw"](e))}catch(n){i(n)}}function l(e){e.done?r(e.value):a(e.value).then(o,s)}l((t=t.apply(e,n||[])).next())}))};var __generator=this&&this.__generator||function(e,n){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,a,i,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(n){return l([e,n])}}function l(o){if(t)throw new TypeError("Generator is already executing.");while(r)try{if(t=1,a&&(i=o[0]&2?a["return"]:o[0]?a["throw"]||((i=a["return"])&&i.call(a),0):a.next)&&!(i=i.call(a,o[1])).done)return i;if(a=0,i)o=[o[0]&2,i.value];switch(o[0]){case 0:case 1:i=o;break;case 4:r.label++;return{value:o[1],done:false};case 5:r.label++;a=o[1];o=[0];continue;case 7:o=r.ops.pop();r.trys.pop();continue;default:if(!(i=r.trys,i=i.length>0&&i[i.length-1])&&(o[0]===6||o[0]===2)){r=0;continue}if(o[0]===3&&(!i||o[1]>i[0]&&o[1]<i[3])){r.label=o[1];break}if(o[0]===6&&r.label<i[1]){r.label=i[1];i=o;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(o);break}if(i[2])r.ops.pop();r.trys.pop();continue}o=n.call(e,r)}catch(s){o=[6,s];a=0}finally{t=i=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:true}}};var __spreadArrays=this&&this.__spreadArrays||function(){for(var e=0,n=0,r=arguments.length;n<r;n++)e+=arguments[n].length;for(var t=Array(e),a=0,n=0;n<r;n++)for(var i=arguments[n],o=0,s=i.length;o<s;o++,a++)t[a]=i[o];return t};System.register([],(function(e,n){"use strict";return{execute:function(){var r=this;var t=e("N","msf-editor");var a;var i;var o=false;var s=0;var l=false;var u=e("w",typeof window!=="undefined"?window:{});var f=e("C",u.CSS);var $=e("d",u.document||{head:{}});var c=e("p",{$flags$:0,$resourcesUrl$:"",jmp:function(e){return e()},raf:function(e){return requestAnimationFrame(e)},ael:function(e,n,r,t){return e.addEventListener(n,r,t)},rel:function(e,n,r,t){return e.removeEventListener(n,r,t)},ce:function(e,n){return new CustomEvent(e,n)}});var v=function(){return($.head.attachShadow+"").indexOf("[native")>-1}();var d=e("a",(function(e){return Promise.resolve(e)}));var h=function(){try{new CSSStyleSheet;return true}catch(e){}return false}();var p=function(e,n,r,t){if(r){r.map((function(r){var t=r[0],a=r[1],i=r[2];var o=g(e,t);var s=m(n,i);var l=y(t);c.ael(o,a,s,l);(n.$rmListeners$=n.$rmListeners$||[]).push((function(){return c.rel(o,a,s,l)}))}))}};var m=function(e,n){return function(r){{if(e.$flags$&256){e.$lazyInstance$[n](r)}else{(e.$queuedListeners$=e.$queuedListeners$||[]).push([n,r])}}}};var g=function(e,n){if(n&8)return u;return e};var y=function(e){return(e&2)!==0};var b="{visibility:hidden}.hydrated{visibility:inherit}";var w=function(e,n){if(n===void 0){n=""}{return function(){return}}};var S=function(e,n){{return function(){return}}};var _=new WeakMap;var R=function(e,n,r){var t=xe.get(e);if(h&&r){t=t||new CSSStyleSheet;t.replace(n)}else{t=n}xe.set(e,t)};var L=function(e,n,r,t){var a=C(n);var i=xe.get(a);e=e.nodeType===11?e:$;if(i){if(typeof i==="string"){e=e.head||e;var o=_.get(e);var s=void 0;if(!o){_.set(e,o=new Set)}if(!o.has(a)){{if(c.$cssShim$){s=c.$cssShim$.createHostStyle(t,a,i,!!(n.$flags$&10));var l=s["s-sc"];if(l){a=l;o=null}}else{s=$.createElement("style");s.innerHTML=i}e.insertBefore(s,e.querySelector("link"))}if(o){o.add(a)}}}else if(!e.adoptedStyleSheets.includes(i)){e.adoptedStyleSheets=__spreadArrays(e.adoptedStyleSheets,[i])}}return a};var N=function(e){var n=e.$cmpMeta$;var r=e.$hostElement$;var t=n.$flags$;var a=w("attachStyles",n.$tagName$);var i=L(v&&r.shadowRoot?r.shadowRoot:r.getRootNode(),n,e.$modeName$,r);if(t&10){r["s-sc"]=i;r.classList.add(i+"-h")}a()};var C=function(e,n){return"sc-"+e.$tagName$};var x={};var j=function(e){return e!=null};var E=function(){};var M=function(e){e=typeof e;return e==="object"||e==="function"};var P=typeof Deno!=="undefined";var k=!P&&typeof global!=="undefined"&&typeof require==="function"&&!!global.process&&typeof __filename==="string"&&(!global.origin||typeof global.origin!=="string");var I=P&&Deno.build.os==="windows";var A=k?process.cwd:P?Deno.cwd:function(){return"/"};var O=k?process.exit:P?Deno.exit:E;var q=e("h",(function(e,n){var r=[];for(var t=2;t<arguments.length;t++){r[t-2]=arguments[t]}var a=null;var i=false;var o=false;var s=[];var l=function(n){for(var r=0;r<n.length;r++){a=n[r];if(Array.isArray(a)){l(a)}else if(a!=null&&typeof a!=="boolean"){if(i=typeof e!=="function"&&!M(a)){a=String(a)}if(i&&o){s[s.length-1].$text$+=a}else{s.push(i?B(null,a):a)}o=i}}};l(r);if(n){{var u=n.className||n.class;if(u){n.class=typeof u!=="object"?u:Object.keys(u).filter((function(e){return u[e]})).join(" ")}}}var f=B(e,null);f.$attrs$=n;if(s.length>0){f.$children$=s}return f}));var B=function(e,n){var r={$flags$:0,$tag$:e,$text$:n,$elm$:null,$children$:null};{r.$attrs$=null}return r};var T={};var U=function(e){return e&&e.$tag$===T};var z=function(e,n,r,t,a,i){if(r!==t){var o=Re(e,n);var s=n.toLowerCase();if(n==="class"){var l=e.classList;var u=D(r);var f=D(t);l.remove.apply(l,u.filter((function(e){return e&&!f.includes(e)})));l.add.apply(l,f.filter((function(e){return e&&!u.includes(e)})))}else{var $=M(t);if((o||$&&t!==null)&&!a){try{if(!e.tagName.includes("-")){var c=t==null?"":t;if(n==="list"){o=false}else if(r==null||e[n]!=c){e[n]=c}}else{e[n]=t}}catch(v){}}if(t==null||t===false){if(t!==false||e.getAttribute(n)===""){{e.removeAttribute(n)}}}else if((!o||i&4||a)&&!$){t=t===true?"":t;{e.setAttribute(n,t)}}}}};var H=/\s/;var D=function(e){return!e?[]:e.split(H)};var V=function(e,n,r,t){var a=n.$elm$.nodeType===11&&n.$elm$.host?n.$elm$.host:n.$elm$;var i=e&&e.$attrs$||x;var o=n.$attrs$||x;{for(t in i){if(!(t in o)){z(a,t,i[t],undefined,r,n.$flags$)}}}for(t in o){z(a,t,i[t],o[t],r,n.$flags$)}};var W=function(e,n,r,t){var i=n.$children$[r];var s=0;var l;var u;{l=i.$elm$=$.createElement(i.$tag$);{V(null,i,o)}if(j(a)&&l["s-si"]!==a){l.classList.add(l["s-si"]=a)}if(i.$children$){for(s=0;s<i.$children$.length;++s){u=W(e,i,s);if(u){l.appendChild(u)}}}}return l};var F=function(e,n,r,t,a,o){var s=e;var l;if(s.shadowRoot&&s.tagName===i){s=s.shadowRoot}for(;a<=o;++a){if(t[a]){l=W(null,r,a);if(l){t[a].$elm$=l;s.insertBefore(l,n)}}}};var G=function(e,n,r,t,a){for(;n<=r;++n){if(t=e[n]){a=t.$elm$;a.remove()}}};var Q=function(e,n,r,t){var a=0;var i=0;var o=n.length-1;var s=n[0];var l=n[o];var u=t.length-1;var f=t[0];var $=t[u];var c;while(a<=o&&i<=u){if(s==null){s=n[++a]}else if(l==null){l=n[--o]}else if(f==null){f=t[++i]}else if($==null){$=t[--u]}else if(J(s,f)){K(s,f);s=n[++a];f=t[++i]}else if(J(l,$)){K(l,$);l=n[--o];$=t[--u]}else if(J(s,$)){K(s,$);e.insertBefore(s.$elm$,l.$elm$.nextSibling);s=n[++a];$=t[--u]}else if(J(l,f)){K(l,f);e.insertBefore(l.$elm$,s.$elm$);l=n[--o];f=t[++i]}else{{c=W(n&&n[i],r,i);f=t[++i]}if(c){{s.$elm$.parentNode.insertBefore(c,s.$elm$)}}}}if(a>o){F(e,t[u+1]==null?null:t[u+1].$elm$,r,t,i,u)}else if(i>u){G(n,a,o)}};var J=function(e,n){if(e.$tag$===n.$tag$){return true}return false};var K=function(e,n){var r=n.$elm$=e.$elm$;var t=e.$children$;var a=n.$children$;{{{V(e,n,o)}}if(t!==null&&a!==null){Q(r,t,n,a)}else if(a!==null){F(r,null,n,a,0,a.length-1)}else if(t!==null){G(t,0,t.length-1)}}};var X=function(e,n){var r=e.$hostElement$;var t=e.$vnode$||B(null,null);var o=U(n)?n:q(null,null,n);i=r.tagName;o.$tag$=null;o.$flags$|=4;e.$vnode$=o;o.$elm$=t.$elm$=r.shadowRoot||r;{a=r["s-sc"]}K(t,o)};var Y=e("g",(function(e){return we(e).$hostElement$}));var Z=e("c",(function(e,n,r){var t=Y(e);return{emit:function(e){return ee(t,n,{bubbles:!!(r&4),composed:!!(r&2),cancelable:!!(r&1),detail:e})}}}));var ee=function(e,n,r){var t=c.ce(n,r);e.dispatchEvent(t);return t};var ne=function(e,n){if(n&&!e.$onRenderResolve$&&n["s-p"]){n["s-p"].push(new Promise((function(n){return e.$onRenderResolve$=n})))}};var re=function(e,n){{e.$flags$|=16}if(e.$flags$&4){e.$flags$|=512;return}ne(e,e.$ancestorComponent$);var r=function(){return te(e,n)};return qe(r)};var te=function(e,n){var r=w("scheduleUpdate",e.$cmpMeta$.$tagName$);var t=e.$lazyInstance$;var a;if(n){{e.$flags$|=256;if(e.$queuedListeners$){e.$queuedListeners$.map((function(e){var n=e[0],r=e[1];return ue(t,n,r)}));e.$queuedListeners$=null}}{a=ue(t,"componentWillLoad")}}{a=fe(a,(function(){return ue(t,"componentWillRender")}))}r();return fe(a,(function(){return ae(e,t,n)}))};var ae=function(e,n,r){var t=e.$hostElement$;var a=w("update",e.$cmpMeta$.$tagName$);var i=t["s-rc"];if(r){N(e)}var o=w("render",e.$cmpMeta$.$tagName$);{{X(e,ie(e,n))}}if(c.$cssShim$){c.$cssShim$.updateHost(t)}if(i){i.map((function(e){return e()}));t["s-rc"]=undefined}o();a();{var s=t["s-p"];var l=function(){return oe(e)};if(s.length===0){l()}else{Promise.all(s).then(l);e.$flags$|=4;s.length=0}}};var ie=function(e,n){try{n=n.render();{e.$flags$&=~16}{e.$flags$|=2}}catch(r){Le(r)}return n};var oe=function(e){var n=e.$cmpMeta$.$tagName$;var r=e.$hostElement$;var t=w("postUpdate",n);var a=e.$ancestorComponent$;if(!(e.$flags$&64)){e.$flags$|=64;{$e(r)}t();{e.$onReadyResolve$(r);if(!a){le()}}}else{t()}{e.$onInstanceResolve$(r)}{if(e.$onRenderResolve$){e.$onRenderResolve$();e.$onRenderResolve$=undefined}if(e.$flags$&512){Oe((function(){return re(e,false)}))}e.$flags$&=~(4|512)}};var se=function(e){{var n=we(e);var r=n.$hostElement$.isConnected;if(r&&(n.$flags$&(2|16))===2){re(n,false)}return r}};var le=function(e){{$e($.documentElement)}{c.$flags$|=2}Oe((function(){return ee(u,"appload",{detail:{namespace:t}})}))};var ue=function(e,n,r){if(e&&e[n]){try{return e[n](r)}catch(t){Le(t)}}return undefined};var fe=function(e,n){return e&&e.then?e.then(n):n()};var $e=function(e){return e.classList.add("hydrated")};var ce=function(e,n){if(e!=null&&!M(e)){if(n&1){return String(e)}return e}return e};var ve=function(e,n){return we(e).$instanceValues$.get(n)};var de=function(e,n,r,t){var a=we(e);var i=a.$instanceValues$.get(n);var o=a.$flags$;var s=a.$lazyInstance$;r=ce(r,t.$members$[n][0]);if((!(o&8)||i===undefined)&&r!==i){a.$instanceValues$.set(n,r);if(s){if((o&(2|16))===2){re(a,false)}}}};var he=function(e,n,r){if(n.$members$){var t=Object.entries(n.$members$);var a=e.prototype;t.map((function(e){var t=e[0],i=e[1][0];if(i&31||r&2&&i&32){Object.defineProperty(a,t,{get:function(){return ve(this,t)},set:function(e){de(this,t,e,n)},configurable:true,enumerable:true})}else if(r&1&&i&64){Object.defineProperty(a,t,{value:function(){var e=[];for(var n=0;n<arguments.length;n++){e[n]=arguments[n]}var r=we(this);return r.$onInstancePromise$.then((function(){var n;return(n=r.$lazyInstance$)[t].apply(n,e)}))}})}}));if(r&1){var i=new Map;a.attributeChangedCallback=function(e,n,r){var t=this;c.jmp((function(){var n=i.get(e);t[n]=r===null&&typeof t[n]==="boolean"?false:r}))};e.observedAttributes=t.filter((function(e){var n=e[0],r=e[1];return r[0]&15})).map((function(e){var n=e[0],r=e[1];var t=r[1]||n;i.set(t,n);return t}))}}return e};var pe=function(e,t,a,i,o){return __awaiter(r,void 0,void 0,(function(){var e,r,i,s,l,u,f;return __generator(this,(function($){switch($.label){case 0:if(!((t.$flags$&32)===0))return[3,5];t.$flags$|=32;o=Ce(a);if(!o.then)return[3,2];e=S();return[4,o];case 1:o=$.sent();e();$.label=2;case 2:if(!o.isProxied){he(o,a,2);o.isProxied=true}r=w("createInstance",a.$tagName$);{t.$flags$|=8}try{new o(t)}catch(c){Le(c)}{t.$flags$&=~8}r();if(!o.style)return[3,5];i=o.style;s=C(a);if(!!xe.has(s))return[3,5];l=w("registerStyles",a.$tagName$);if(!(a.$flags$&8))return[3,4];return[4,n.import("./p-50811587.system.js").then((function(e){return e.scopeCss(i,s,false)}))];case 3:i=$.sent();$.label=4;case 4:R(s,i,!!(a.$flags$&1));l();$.label=5;case 5:u=t.$ancestorComponent$;f=function(){return re(t,true)};if(u&&u["s-rc"]){u["s-rc"].push(f)}else{f()}return[2]}}))}))};var me=function(e){if((c.$flags$&1)===0){var n=we(e);var r=n.$cmpMeta$;var t=w("connectedCallback",r.$tagName$);if(!(n.$flags$&1)){n.$flags$|=1;{var a=e;while(a=a.parentNode||a.host){if(a["s-p"]){ne(n,n.$ancestorComponent$=a);break}}}if(r.$members$){Object.entries(r.$members$).map((function(n){var r=n[0],t=n[1][0];if(t&31&&e.hasOwnProperty(r)){var a=e[r];delete e[r];e[r]=a}}))}{Oe((function(){return pe(e,n,r)}))}}else{p(e,n,r.$listeners$)}t()}};var ge=function(e){if((c.$flags$&1)===0){var n=we(e);{if(n.$rmListeners$){n.$rmListeners$.map((function(e){return e()}));n.$rmListeners$=undefined}}if(c.$cssShim$){c.$cssShim$.removeHost(e)}}};var ye=e("b",(function(e,n){if(n===void 0){n={}}var r=w();var t=[];var a=n.exclude||[];var i=u.customElements;var o=$.head;var s=o.querySelector("meta[charset]");var l=$.createElement("style");var f=[];var d;var h=true;Object.assign(c,n);c.$resourcesUrl$=new URL(n.resourcesUrl||"./",$.baseURI).href;{if(n.syncQueue){c.$flags$|=4}}e.map((function(e){return e[1].map((function(n){var r={$flags$:n[0],$tagName$:n[1],$members$:n[2],$listeners$:n[3]};{r.$members$=n[2]}{r.$listeners$=n[3]}if(!v&&r.$flags$&1){r.$flags$|=8}var o=r.$tagName$;var s=function(e){__extends(n,e);function n(n){var t=e.call(this,n)||this;n=t;_e(n,r);if(r.$flags$&1){if(v){{n.attachShadow({mode:"open"})}}else if(!("shadowRoot"in n)){n.shadowRoot=n}}return t}n.prototype.connectedCallback=function(){var e=this;if(d){clearTimeout(d);d=null}if(h){f.push(this)}else{c.jmp((function(){return me(e)}))}};n.prototype.disconnectedCallback=function(){var e=this;c.jmp((function(){return ge(e)}))};n.prototype.forceUpdate=function(){se(this)};n.prototype.componentOnReady=function(){return we(this).$onReadyPromise$};return n}(HTMLElement);r.$lazyBundleId$=e[0];if(!a.includes(o)&&!i.get(o)){t.push(o);i.define(o,he(s,r,1))}}))}));{l.innerHTML=t+b;l.setAttribute("data-styles","");o.insertBefore(l,s?s.nextSibling:o.firstChild)}h=false;if(f.length){f.map((function(e){return e.connectedCallback()}))}else{{c.jmp((function(){return d=setTimeout(le,30)}))}}r()}));var be=new WeakMap;var we=function(e){return be.get(e)};var Se=e("r",(function(e,n){return be.set(n.$lazyInstance$=e,n)}));var _e=function(e,n){var r={$flags$:0,$hostElement$:e,$cmpMeta$:n,$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"]=[]}p(e,r,n.$listeners$);return be.set(e,r)};var Re=function(e,n){return n in e};var Le=function(e){return console.error(e)};var Ne=new Map;var Ce=function(e,r,t){var a=e.$tagName$.replace(/-/g,"_");var i=e.$lazyBundleId$;var o=Ne.get(i);if(o){return o[a]}return n.import("./"+i+".entry.js"+"").then((function(e){{Ne.set(i,e)}return e[a]}),Le)};var xe=new Map;var je=[];var Ee=[];var Me=[];var Pe=function(e,n){return function(r){e.push(r);if(!l){l=true;if(n&&c.$flags$&4){Oe(Ae)}else{c.raf(Ae)}}}};var ke=function(e){for(var n=0;n<e.length;n++){try{e[n](performance.now())}catch(r){Le(r)}}e.length=0};var Ie=function(e,n){var r=0;var t=0;while(r<e.length&&(t=performance.now())<n){try{e[r++](t)}catch(a){Le(a)}}if(r===e.length){e.length=0}else if(r!==0){e.splice(0,r)}};var Ae=function(){{s++}ke(je);{var e=(c.$flags$&6)===2?performance.now()+14*Math.ceil(s*(1/10)):Infinity;Ie(Ee,e);Ie(Me,e);if(Ee.length>0){Me.push.apply(Me,Ee);Ee.length=0}if(l=je.length+Ee.length+Me.length>0){c.raf(Ae)}else{s=0}}};var Oe=function(e){return d().then(e)};var qe=Pe(Ee,true)}}})); |
| System.register([],(function(){"use strict";return{execute:function(){var t=function(){this.start=0,this.end=0,this.previous=null,this.parent=null,this.rules=null,this.parsedCssText="",this.cssText="",this.atRule=!1,this.type=0,this.keyframesName="",this.selector="",this.parsedSelector=""};function e(t){return s(n(t=r(t)),t)}function r(t){return t.replace(c.comments,"").replace(c.port,"")}function n(e){var r=new t;r.start=0,r.end=e.length;for(var n=r,s=0,i=e.length;s<i;s++)if(e[s]===a){n.rules||(n.rules=[]);var o=n,c=o.rules[o.rules.length-1]||null;(n=new t).start=s+1,n.parent=o,n.previous=c,o.rules.push(n)}else e[s]===u&&(n.end=s+1,n=n.parent||r);return r}function s(t,e){var r=e.substring(t.start,t.end-1);if(t.parsedCssText=t.cssText=r.trim(),t.parent){var n=t.previous?t.previous.end:t.parent.start;r=(r=(r=i(r=e.substring(n,t.start-1))).replace(c.multipleSpaces," ")).substring(r.lastIndexOf(";")+1);var a=t.parsedSelector=t.selector=r.trim();t.atRule=0===a.indexOf(f),t.atRule?0===a.indexOf(p)?t.type=o.MEDIA_RULE:a.match(c.keyframesRule)&&(t.type=o.KEYFRAMES_RULE,t.keyframesName=t.selector.split(c.multipleSpaces).pop()):0===a.indexOf(l)?t.type=o.MIXIN_RULE:t.type=o.STYLE_RULE}var u=t.rules;if(u)for(var h=0,v=u.length,m=void 0;h<v&&(m=u[h]);h++)s(m,e);return t}function i(t){return t.replace(/\\([0-9a-f]{1,6})\s/gi,(function(){for(var t=arguments[1],e=6-t.length;e--;)t="0"+t;return"\\"+t}))}var o={STYLE_RULE:1,KEYFRAMES_RULE:7,MEDIA_RULE:4,MIXIN_RULE:1e3},a="{",u="}",c={comments:/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,port:/@import[^;]*;/gim,customProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\n]|$)/gim,mixinProp:/(?:^[^;\-\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\n]|$)?/gim,mixinApply:/@apply\s*\(?[^);]*\)?\s*(?:[;\n]|$)?/gim,varApply:/[^;:]*?:[^;]*?var\([^;]*\)(?:[;\n]|$)?/gim,keyframesRule:/^@[^\s]*keyframes/,multipleSpaces:/\s+/g},l="--",p="@media",f="@";function h(t,e,r){t.lastIndex=0;var n=e.substring(r).match(t);if(n){var s=r+n.index;return{start:s,end:s+n[0].length}}return null}var v=/\bvar\(/,m=/\B--[\w-]+\s*:/,d=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//gim,g=/^[\t ]+\n/gm;function y(t,e,r){return t[e]?t[e]:r?x(r,t):""}function S(t,e){for(var r=0,n=e;n<t.length;n++){var s=t[n];if("("===s)r++;else if(")"===s&&--r<=0)return n+1}return n}function b(t,e){var r=h(v,t,e);if(!r)return null;var n=S(t,r.start),s=t.substring(r.end,n-1).split(","),i=s[0],o=s.slice(1);return{start:r.start,end:n,propName:i.trim(),fallback:o.length>0?o.join(",").trim():void 0}}function E(t,e,r){var n=b(t,r);if(!n)return e.push(t.substring(r,t.length)),t.length;var s=n.propName,i=null!=n.fallback?C(n.fallback):void 0;return e.push(t.substring(r,n.start),(function(t){return y(t,s,i)})),n.end}function x(t,e){for(var r="",n=0;n<t.length;n++){var s=t[n];r+="string"==typeof s?s:s(e)}return r}function M(t,e){for(var r=!1,n=!1,s=e;s<t.length;s++){var i=t[s];if(r)n&&'"'===i&&(r=!1),n||"'"!==i||(r=!1);else if('"'===i)r=!0,n=!0;else if("'"===i)r=!0,n=!1;else{if(";"===i)return s+1;if("}"===i)return s}}return s}function w(t){for(var e="",r=0;;){var n=h(m,t,r),s=n?n.start:t.length;if(e+=t.substring(r,s),!n)break;r=M(t,s)}return e}function C(t){var e=0;t=w(t=t.replace(d,"")).replace(g,"");for(var r=[];e<t.length;)e=E(t,r,e);return r}function I(t){var e={};t.forEach((function(t){t.declarations.forEach((function(t){e[t.prop]=t.value}))}));for(var r={},n=Object.entries(e),s=function(t){var e=!1;if(n.forEach((function(t){var n=t[0],s=x(t[1],r);s!==r[n]&&(r[n]=s,e=!0)})),!e)return"break"},i=0;i<10;i++){if("break"===s())break}return r}function R(t,e){if(void 0===e&&(e=0),!t.rules)return[];var r=[];return t.rules.filter((function(t){return t.type===o.STYLE_RULE})).forEach((function(t){var n=_(t.cssText);n.length>0&&t.parsedSelector.split(",").forEach((function(t){t=t.trim(),r.push({selector:t,declarations:n,specificity:k(),nu:e})})),e++})),r}function k(t){return 1}var A="!important",L=/(?:^|[;\s{]\s*)(--[\w-]*?)\s*:\s*(?:((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};{])+)|\{([^}]*)\}(?:(?=[;\s}])|$))/gm;function _(t){for(var e,r=[];e=L.exec(t.trim());){var n=O(e[2]),s=n.value,i=n.important;r.push({prop:e[1].trim(),value:C(s),important:i})}return r}function O(t){var e=(t=t.replace(/\s+/gim," ").trim()).endsWith(A);return e&&(t=t.substr(0,t.length-A.length).trim()),{value:t,important:e}}function T(t,e,r){var n=[],s=U(e,t);return r.forEach((function(t){return n.push(t)})),s.forEach((function(t){return n.push(t)})),j(N(n).filter((function(e){return $(t,e.selector)})))}function U(t,e){for(var r=[];e;){var n=t.get(e);n&&r.push(n),e=e.parentElement}return r}function N(t){var e=[];return t.forEach((function(t){e.push.apply(e,t.selectors)})),e}function j(t){return t.sort((function(t,e){return t.specificity===e.specificity?t.nu-e.nu:t.specificity-e.specificity})),t}function $(t,e){return":root"===e||"html"===e||t.matches(e)}function G(t){var r=e(t),n=C(t);return{original:t,template:n,selectors:R(r),usesCssVars:n.length>1}}function H(t,e){if(t.some((function(t){return t.styleEl===e})))return!1;var r=G(e.textContent);return r.styleEl=e,t.push(r),!0}function P(t){var e=I(N(t));t.forEach((function(t){t.usesCssVars&&(t.styleEl.textContent=x(t.template,e))}))}function V(t,e){var r=t.template.map((function(r){return"string"==typeof r?Y(r,t.scopeId,e):r})),n=t.selectors.map((function(r){return Object.assign(Object.assign({},r),{selector:Y(r.selector,t.scopeId,e)})}));return Object.assign(Object.assign({},t),{template:r,selectors:n,scopeId:e})}function Y(t,e,r){return t=q(t,"\\."+e,"."+r)}function q(t,e,r){return t.replace(new RegExp(e,"g"),r)}function F(t,e){return D(t,e),W(t,e).then((function(){P(e)}))}function B(t,e){"undefined"!=typeof MutationObserver&&new MutationObserver((function(){D(t,e)&&P(e)})).observe(document.head,{childList:!0})}function W(t,e){for(var r=[],n=t.querySelectorAll('link[rel="stylesheet"][href]:not([data-no-shim])'),s=0;s<n.length;s++)r.push(K(t,e,n[s]));return Promise.all(r)}function D(t,e){return Array.from(t.querySelectorAll("style:not([data-styles]):not([data-no-shim])")).map((function(t){return H(e,t)})).some(Boolean)}function K(t,e,r){var n=r.href;return fetch(n).then((function(t){return t.text()})).then((function(s){if(z(s)&&r.parentNode){J(s)&&(s=Q(s,n));var i=t.createElement("style");i.setAttribute("data-styles",""),i.textContent=s,H(e,i),r.parentNode.insertBefore(i,r),r.remove()}})).catch((function(t){console.error(t)}))}var X=/[\s;{]--[-a-zA-Z0-9]+\s*:/m;function z(t){return t.indexOf("var(")>-1||X.test(t)}var Z=/url[\s]*\([\s]*['"]?(?!(?:https?|data)\:|\/)([^\'\"\)]*)[\s]*['"]?\)[\s]*/gim;function J(t){return Z.lastIndex=0,Z.test(t)}function Q(t,e){var r=e.replace(/[^/]*$/,"");return t.replace(Z,(function(t,e){var n=r+e;return t.replace(e,n)}))}var tt=function(){function t(t,e){this.win=t,this.doc=e,this.count=0,this.hostStyleMap=new WeakMap,this.hostScopeMap=new WeakMap,this.globalScopes=[],this.scopesMap=new Map,this.didInit=!1}return t.prototype.i=function(){var t=this;return this.didInit||!this.win.requestAnimationFrame?Promise.resolve():(this.didInit=!0,new Promise((function(e){t.win.requestAnimationFrame((function(){B(t.doc,t.globalScopes),F(t.doc,t.globalScopes).then((function(){return e()}))}))})))},t.prototype.addLink=function(t){var e=this;return K(this.doc,this.globalScopes,t).then((function(){e.updateGlobal()}))},t.prototype.addGlobalStyle=function(t){H(this.globalScopes,t)&&this.updateGlobal()},t.prototype.createHostStyle=function(t,e,r,n){if(this.hostScopeMap.has(t))throw new Error("host style already created");var s=this.registerHostTemplate(r,e,n),i=this.doc.createElement("style");return i.setAttribute("data-no-shim",""),s.usesCssVars?n?(i["s-sc"]=e=s.scopeId+"-"+this.count,i.textContent="/*needs update*/",this.hostStyleMap.set(t,i),this.hostScopeMap.set(t,V(s,e)),this.count++):(s.styleEl=i,s.usesCssVars||(i.textContent=x(s.template,{})),this.globalScopes.push(s),this.updateGlobal(),this.hostScopeMap.set(t,s)):i.textContent=r,i},t.prototype.removeHost=function(t){var e=this.hostStyleMap.get(t);e&&e.remove(),this.hostStyleMap.delete(t),this.hostScopeMap.delete(t)},t.prototype.updateHost=function(t){var e=this.hostScopeMap.get(t);if(e&&e.usesCssVars&&e.isScoped){var r=this.hostStyleMap.get(t);if(r){var n=I(T(t,this.hostScopeMap,this.globalScopes));r.textContent=x(e.template,n)}}},t.prototype.updateGlobal=function(){P(this.globalScopes)},t.prototype.registerHostTemplate=function(t,e,r){var n=this.scopesMap.get(e);return n||((n=G(t)).scopeId=e,n.isScoped=r,this.scopesMap.set(e,n)),n},t}();!function(t){!t||t.__cssshim||t.CSS&&t.CSS.supports&&t.CSS.supports("color","var(--c)")||(t.__cssshim=new tt(t,t.document))}("undefined"!=typeof window&&window)}}})); |
| export * from '../dist/esm/polyfills/index.js'; | ||
| export * from '../dist/esm/loader.mjs'; |
| (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})(); | ||
| export * from '../dist/esm/polyfills/index.js'; | ||
| export * from '../dist/esm-es5/loader.mjs'; |
| module.exports.applyPolyfills = function() { return Promise.resolve() }; | ||
| module.exports.defineCustomElements = function() { return Promise.resolve() }; |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 2 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 3 instances
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
10
-61.54%3
-40%11
-63.33%326396
-57.86%41
-43.84%5305
-47.01%