1 | {"version":3,"sources":["../../../../node_modules/core-js/modules/_global.js","../../../../node_modules/core-js/modules/_core.js","../../../../node_modules/core-js/modules/_is-object.js","../../../../node_modules/core-js/modules/_an-object.js","../../../../node_modules/core-js/modules/_fails.js","../../../../node_modules/core-js/modules/_descriptors.js","../../../../node_modules/core-js/modules/_dom-create.js","../../../../node_modules/core-js/modules/_ie8-dom-define.js","../../../../node_modules/core-js/modules/_to-primitive.js","../../../../node_modules/core-js/modules/_object-dp.js","../../../../node_modules/core-js/modules/_property-desc.js","../../../../node_modules/core-js/modules/_hide.js","../../../../node_modules/core-js/modules/_has.js","../../../../node_modules/core-js/modules/_uid.js","../../../../node_modules/core-js/modules/_library.js","../../../../node_modules/core-js/modules/_shared.js","../../../../node_modules/core-js/modules/_function-to-string.js","../../../../node_modules/core-js/modules/_redefine.js","../../../../node_modules/core-js/modules/_a-function.js","../../../../node_modules/core-js/modules/_ctx.js","../../../../node_modules/core-js/modules/_export.js","../../../../node_modules/core-js/modules/_user-agent.js","../../../../node_modules/core-js/modules/web.timers.js","../../../../node_modules/core-js/modules/_invoke.js","../../../../node_modules/core-js/modules/_html.js","../../../../node_modules/core-js/modules/_cof.js","../../../../node_modules/core-js/modules/_task.js","../../../../node_modules/core-js/modules/web.immediate.js","../../../../node_modules/core-js/modules/_wks.js","../../../../node_modules/core-js/modules/_add-to-unscopables.js","../../../../node_modules/core-js/modules/_iter-step.js","../../../../node_modules/core-js/modules/_iterators.js","../../../../node_modules/core-js/modules/_iobject.js","../../../../node_modules/core-js/modules/_defined.js","../../../../node_modules/core-js/modules/_to-iobject.js","../../../../node_modules/core-js/modules/_to-integer.js","../../../../node_modules/core-js/modules/_to-length.js","../../../../node_modules/core-js/modules/_to-absolute-index.js","../../../../node_modules/core-js/modules/_array-includes.js","../../../../node_modules/core-js/modules/_shared-key.js","../../../../node_modules/core-js/modules/_object-keys-internal.js","../../../../node_modules/core-js/modules/_enum-bug-keys.js","../../../../node_modules/core-js/modules/_object-keys.js","../../../../node_modules/core-js/modules/_object-dps.js","../../../../node_modules/core-js/modules/_object-create.js","../../../../node_modules/core-js/modules/_set-to-string-tag.js","../../../../node_modules/core-js/modules/_iter-create.js","../../../../node_modules/core-js/modules/_to-object.js","../../../../node_modules/core-js/modules/_object-gpo.js","../../../../node_modules/core-js/modules/_iter-define.js","../../../../node_modules/core-js/modules/es6.array.iterator.js","../../../../node_modules/core-js/modules/web.dom.iterable.js","node_modules/@webcomponents/webcomponents-platform/webcomponents-platform.js"," [synthetic:util/global] "," [synthetic:util/defineproperty] "," [synthetic:es6/symbol] "," [synthetic:es6/util/makeiterator] ","node_modules/@webcomponents/template/template.js","node_modules/promise-polyfill/src/index.js","node_modules/promise-polyfill/src/finally.js","src/promise.js","node_modules/@webcomponents/html-imports/src/html-imports.js","src/pre-polyfill.js","node_modules/@webcomponents/shadydom/src/shady-data.js","node_modules/@webcomponents/shadydom/src/utils.js","node_modules/@webcomponents/shadydom/src/flush.js","node_modules/@webcomponents/shadydom/src/observe-changes.js","node_modules/@webcomponents/shadydom/src/innerHTML.js","node_modules/@webcomponents/shadydom/src/patch-native.js","node_modules/@webcomponents/shadydom/src/patch-instances.js","node_modules/@webcomponents/shadydom/src/patch-events.js","node_modules/@webcomponents/shadydom/src/array-splice.js","node_modules/@webcomponents/shadydom/src/link-nodes.js","node_modules/@webcomponents/shadydom/src/style-scoping.js","node_modules/@webcomponents/shadydom/src/patches/Node.js","node_modules/@webcomponents/shadydom/src/attach-shadow.js"," [synthetic:es6/util/arrayfromiterable] "," [synthetic:es6/util/arrayfromiterator] ","node_modules/@webcomponents/shadydom/src/patches/ParentNode.js","node_modules/@webcomponents/shadydom/src/patches/DocumentOrFragment.js","node_modules/@webcomponents/shadydom/src/patches/DocumentOrShadowRoot.js","node_modules/@webcomponents/shadydom/src/patches/ElementOrShadowRoot.js","node_modules/@webcomponents/shadydom/src/patches/ShadowRoot.js","node_modules/@webcomponents/shadydom/src/patch-shadyRoot.js","node_modules/@webcomponents/shadydom/src/wrapper.js","node_modules/@webcomponents/shadydom/src/patches/EventTarget.js","node_modules/@webcomponents/shadydom/src/patches/Slotable.js","node_modules/@webcomponents/shadydom/src/patches/Element.js","node_modules/@webcomponents/shadydom/src/patches/HTMLElement.js","node_modules/@webcomponents/shadydom/src/patches/Slot.js","node_modules/@webcomponents/shadydom/src/patches/Document.js","node_modules/@webcomponents/shadydom/src/patches/Window.js","node_modules/@webcomponents/shadydom/src/patch-prototypes.js","node_modules/@webcomponents/shadydom/src/shadydom.js","node_modules/@webcomponents/custom-elements/src/Utilities.js","node_modules/@webcomponents/custom-elements/src/CustomElementInternals.js","node_modules/@webcomponents/custom-elements/src/CustomElementState.js","node_modules/@webcomponents/custom-elements/src/DocumentConstructionObserver.js","node_modules/@webcomponents/custom-elements/src/CustomElementRegistry.js","node_modules/@webcomponents/custom-elements/src/Deferred.js","node_modules/@webcomponents/custom-elements/src/Patch/Native.js","node_modules/@webcomponents/custom-elements/src/AlreadyConstructedMarker.js","node_modules/@webcomponents/custom-elements/src/Patch/Interface/ParentNode.js","node_modules/@webcomponents/custom-elements/src/custom-elements.js","node_modules/@webcomponents/custom-elements/src/Patch/HTMLElement.js","node_modules/@webcomponents/custom-elements/src/Patch/Document.js","node_modules/@webcomponents/custom-elements/src/Patch/DocumentFragment.js","node_modules/@webcomponents/custom-elements/src/Patch/Node.js","node_modules/@webcomponents/custom-elements/src/Patch/Element.js","node_modules/@webcomponents/custom-elements/src/Patch/Interface/ChildNode.js","node_modules/@webcomponents/shadycss/src/css-parse.js","node_modules/@webcomponents/shadycss/src/style-settings.js","node_modules/@webcomponents/shadycss/src/common-regex.js","node_modules/@webcomponents/shadycss/src/unscoped-style-handler.js","node_modules/@webcomponents/shadycss/src/style-util.js","node_modules/@webcomponents/shadycss/src/style-transformer.js","node_modules/@webcomponents/shadycss/src/document-watcher.js","node_modules/@webcomponents/shadycss/src/style-properties.js","node_modules/@webcomponents/shadycss/src/style-info.js","node_modules/@webcomponents/shadycss/src/scoping-shim.js","node_modules/@webcomponents/shadycss/src/style-placeholder.js","node_modules/@webcomponents/shadycss/src/style-cache.js","node_modules/@webcomponents/shadycss/src/template-map.js","node_modules/@webcomponents/shadycss/src/apply-shim-utils.js","node_modules/@webcomponents/shadycss/src/common-utils.js","node_modules/@webcomponents/shadycss/entrypoints/scoping-shim.js","src/post-polyfill.js","src/unresolved.js","polyfills.ts"],"names":["$jscomp.global","$jscomp.defineProperty","$jscomp.initSymbol","$jscomp.Symbol","$jscomp.SYMBOL_PREFIX","$jscomp.iteratorPrototype","$jscomp.initSymbolIterator","$jscomp.arrayIterator","e","document","initEvent","preventDefault","defaultPrevented","origPreventDefault","Event","prototype","Event.prototype.preventDefault","Object","get","configurable","isIE","navigator","window","CustomEvent","window.CustomEvent","inType","params","initCustomEvent","origEvent","window.Event","i","MouseEvent","origMouseEvent","window.MouseEvent","initMouseEvent","Array","Array.from","object","call","assign","Object.assign","target","sources","s","args","arguments","n$","source","p","PolyfilledHTMLTemplateElement","QSA","node","selector","length","Node","needsTemplate","brokenDocFragment","needsDocFrag","test","insertBefore","newNode","refNode","child","origInsertBefore","origCloneNode","cloneNode","Node.prototype.cloneNode","deep","newDom","DocumentFragment","querySelectorAll","HTMLElement","querySelector","defineProperties","DOCUMENT_FRAGMENT_NODE","origAppendChild","appendChild","Node.prototype.appendChild","origRemoveChild","removeChild","origReplaceChild","replaceChild","Node.prototype.replaceChild","newChild","oldChild","createDocumentFragment","Document.prototype.createDocumentFragment","frag","__proto__","origImportNode","Document","importNode","Document.prototype.importNode","impNode","capturedCloneNode","capturedCreateElement","createElement","capturedImportNode","capturedRemoveChild","capturedAppendChild","capturedReplaceChild","capturedParseFromString","DOMParser","parseFromString","capturedHTMLElementInnerHTML","innerHTML","set","text","capturedChildNodes","childNodes","elementQuerySelectorAll","Element","docQuerySelectorAll","fragQuerySelectorAll","needsCloning","t","t2","content","clone","firstChild","contentDoc","createHTMLDocument","canDecorate","templateStyle","textContent","head","canProtoPatch","decorate","PolyfilledHTMLTemplateElement.decorate","template","namespaceURI","template.cloneNode","_cloneNode","defineInnerHTML","defineOuterHTML","err","topLevelWrappingMap","obj","wrap","body","j","Error","docFrag","bootstrap","PolyfilledHTMLTemplateElement.bootstrap","doc","l","templates","TEMPLATE_TAG","addEventListener","Document.prototype.createElement","el","DOMParser.prototype.parseFromString","defineProperty","enumerable","escapeAttrRegExp","escapeDataRegExp","escapeReplace","c","voidElements","makeSet","arr","plaintextParents","getInnerHTML","callback","c$","tagName","attrs","attr","replace","data","parentNode","console","error","PolyfilledHTMLTemplateElement._cloneNode","fixClonedDom","s$","t$","ownerDocument","dom","nodeType","element","scripts","scriptSelector","a","ai","ns","setTimeoutFunc","setTimeout","noop","Promise","fn","TypeError","_handled","_value","undefined","_deferreds","handle","self","deferred","push","Promise$$module$node_modules$promise_polyfill$src$index._immediateFn","cb","resolve","reject","ret","newValue","then","doResolve","bind","thisArg","finale","len","Handler","onFulfilled","onRejected","promise","done","value","reason","ex","Promise.prototype.then","prom","finallyConstructor","constructor","setImmediate","res","val","remaining","slice","Promise.race","values","Promise.resolve","Promise.reject","callbacks","MutationObserver","splice","characterData","PromisePolyfill._immediateFn","scope","newCustomEvent","type","event","importForElement","useNative","importSelector","isImportLink","whenDocumentReady","stateChanged","whenReady","whenImportsReady","imports","rootImportSelector","pending","forEach","imp","whenElementLoaded","onLoadingDone","documents","inflight","dynamicImportsMO","m","handleMutations","observe","childList","subtree","loadImports","emptyNodeList","list","inverseOrder","increment","link","currentScript","CSS_URL_REGEXP","CSS_IMPORT_REGEXP","STYLESHEET_REGEXP","Path","fixUrls","base","src","r","replaceUrls","linkUrl","regexp","pre","url","post","urlPath","resolveUrl","u","URL","pathname","__workingURL","href","__base","__anchor","Xhr","async","load","success","fail","resource","pieces","atob","decodeURIComponent","request","XMLHttpRequest","open","onload","request.onload","redirectedUrl","location","send","links","loadImport","processImportsIfLoadingDone","makeDocument","match","p1","p2","replaceScripts","fragment","scriptsSelector","script","setAttribute","baseEl","importDependenciesSelector","inlineScriptIndex","n","importDependencyAttr","encodeURIComponent","disconnect","flatten","scriptsOk","stylesOk","waitForStyles","runScripts","pendingScriptsSelector","cloneScript","removeAttribute","pendingStylesSelector","needsMove","disabledLinkSelector","placeholder","newSibling","fireEvents","fireEventIfNeeded","readyState","bubbles","cancelable","detail","mutations","elem","importer","imps","native_baseURI","klass","ownerDoc","HTMLLinkElement","Importer","dispatchEvent","flagMatcher","flags","option","parts","split","f","forceShady","forceCE","dirty","flattenedNodes","__insideAccessors","__onCallbackListeners","ensureShadyDataForNode","ShadyData","__shady","shadyDataForNode","toJSON","settings","hasNativeShadowDOM","attachShadow","getRootNode","desc","nodeData","isShadyRoot","hasShadowRootWithSlot","root","_hasInsertionPoint","hasDescriptors","inUse","noPatch","preferPerformance","isTrackingLogicalChildNodes","matches","twiddle","queue","hasDocumentContains","contains","container","createPolyfilledHTMLCollection","nodes","name","isNaN","nodes.item","index","namedItem","nodes.namedItem","$jscomp.makeIterator","patchProperties","proto","descriptors","prefix","disallowedPatches","newDescriptor","getOwnPropertyDescriptors","getOwnPropertyNames","scheduled","flushList","enqueue","microtask","flush","didFlush","addedNodes","removedNodes","Set","takeRecords","nativeMethods","nativeTree","NATIVE_PREFIX","defineNativeAccessors","prop","installNativeAccessor","copyProperties","descriptor","nodeWalker","NodeFilter","elementWalker","inertDoc","ParentNodeAccessors","ParentNodeMethods","InsideDescriptors","lastChild","childElementCount","children","firstElementChild","lastElementChild","shadowRoot","OutsideDescriptors","parentElement","nextSibling","previousSibling","nextElementSibling","previousElementSibling","className","noInstancePatching","patchOutsideElementAccessors","sd","__outsideAccessors","patchInsideElementAccessors","eventWrappersName","Date","composedGetter","composedProp","ev","alwaysComposed","unpatchedEvents","getRootNodeWithFallback","eventTarget","pathComposer","startNode","composed","composedPath","current","startRoot","retarget","path","refNodePath","ancestor","lastRoot","rootIdx","mixinComposedFlag","Base","klazz","options","nonBubblingEventsToRetarget","hasRetargeted","fireHandlers","phase","hs","retargetNonBubblingEvent","lastFiredRoot","AT_TARGET","findListener","wrappers","capture","once","passive","savedType","savedListener","savedCapture","savedOnce","savedPassive","fnOrObj","optionsOrCapture","handlerType","handleEvent","wrapperFn","patchEvent","lastCurrentTargetDesc","removeEventListener","idx","EventPatchesDescriptors","EventPatches","__composed","__composedPath","relatedTarget","__relatedTargetComposedPath","stopPropagation","__propagationStopped","stopImmediatePropagation","__relatedTarget","SHADY_PROTO","patchedProto","PatchedEvent","PatchedCustomEvent","PatchedMouseEvent","eventPropertyNames","newSplice","addedCount","removed","calcSplices","currentEnd","old","oldEnd","currentStart","oldStart","prefixCount","suffixCount","minLength","Math","index1","index2","count","equals","rowCount","columnCount","distances","north","west","edits","EDIT_ADD","EDIT_DELETE","northWest","min","EDIT_LEAVE","EDIT_UPDATE","reverse","splices","oldIndex","currentValue","previousValue","linkNode","ref_node","containerData","ref_nodeData","psd","nsd","recordChildNodes","first","previous","scopingShim","getScopingShim","removeShadyScoping","currentScopeName","currentScopeForNode","treeVisitor","visitorFn","nativeIsConnectedAccessors","nativeIsConnected","clearNode","scheduleObserver","addedNode","removedNode","observer","schedule","NodePatches","item","childNodes.item","isConnected","tc","cn","join","refData","slotsAdded","newScopeName","ownerRoot","ownerShadyRootForNode","localName","oldScopeName","allowNativeInsert","needsScoping","currentScopeIsCorrect","correctScope","currentScope","needsSlotFinding","_addSlots","_ensureSlotData","$jscomp.arrayFromIterator","_asyncRender","recordInsertBefore","resetTo","parentData","firstComposedNode","flattened","adoptNode","skipUnscoping","removingInsertionPoint","_removeContainedSlots","_validateSlots","map","slots","slot","x","indexOf","slotParentData","_removeFlattenedNodes","parent","assignedNodes","recordRemoveChild","preventNativeRemove","removeOwnerShadyRoot","changeSlotContent","nc","query","matcher","halter","queryElements","elements","result","ParentNodePatches","filter","QueryPatches","o","ParentNodeDocumentOrFragmentPatches","DocumentOrFragmentPatches","getElementById","id","DocumentOrShadowRootPatches","activeElement","active","activeRoot","ElementOrShadowRootPatches","containerName","htmlContainer","ShadowRootPatches","__shadyTarget","host","patchShadyAccessors","rootRendered","ShadyRootConstructionToken","isRendering","ancestorList","ancestors","unshift","token","SHADYROOT_NAME","mode","hostData","publicRoot","MODE_CLOSED","rootData","_hasRendered","_pendingSlots","_render","_renderPending","_getPendingDistributionRoot","renderRoot","_getDistributionParent","_distributeNodeToSlot","forcedSlot","oldSlot","_prevAssignedSlot","CATCHALL_NAME","_addAssignedToFlattenedNodes","assigned","nestedAssigned","_fireSlotChange","slotData","_mapSlots","slotNamesToSort","slotParent","_nameForSlot","_slotMap","_slotList","_sortSlots","__slotName","sort","b","listA","listB","nA","nB","_renderSelf","wasRendering","_distribute","_clearSlotAssignedNodes","assignedSlot","prevAssignedNodes","slotParentRoot","_previouslyAssignedNodes","composeList","_compose","_composeNode","_isInsertionPoint","_updateChildNodes","d","next","patchShadyRoot","SHADY_PREFIX","nodeName","nodeValue","ShadyRoot","connectMap","Map","v","k","clear","ManageConnect","define","connected","connectedCallback","disconnected","disconnectedCallback","counter","connectFlag","__shadydom_connectedCallback","base.prototype.__shadydom_connectedCallback","__shadydom_disconnectedCallback","base.prototype.__shadydom_disconnectedCallback","addEventListener.prototype","getAttribute","hasAttribute","focus","blur","_activeElement","Wrapper","wrapperMap","WeakMap","EventTargetPatches","SlotablePatches","distributeAttributeChange","_updateSlotName","oldName","ElementPatches","HTMLElementPatches","shadowActive","property","shadyData","eventName","SlotPatches","DocumentPatches","WindowPatches","NonStandardHTMLElement","getOwnPropertyDescriptor","patchMap","EventTarget","Text","HTMLSlotElement","Window","disallowedNativePatches","disallowed","patch","ShadyDOM","flushInitial","_flushInitial","filterMutations","targetRootNode","mutation","mutationInScope","AsyncObserver","add","_callback","_observer","_node","unobserveChildren","delete","size","wrapper","eventProps","currentNode","textWalker","ParentNodeWalkerDescriptors","newContent","HTMLTemplateElement","applyPatches","patchClick","composedClickFn","click","activateFocusEventOverrides","ShadowRoot","reservedTagList","isValidCustomElementName","reserved","validForm","nativeValue","nextSiblingOrAncestorSibling","start","walkDeepDescendantElements","visitedImports","setPropertyUnchecked","destination","_constructorToDefinition","_patches","_hasPatches","addPatch","listener","patchTree","connectTree","upgradeElement","disconnectTree","patchAndUpgradeTree","upgrade","gatherElements","__CE_documentLoadHandled","clonedVisitedImports","definition","localNameToDefinition","pop","__CE_state","failed","custom","__CE_definition","observedAttributes","internals","_internals","_document","_resolve","_promise","_whenDefinedDeferred","_flushCallback","this._flushCallback","_flushPending","_pendingDefinitions","_documentConstructionObserver","DocumentConstructionObserver","attributeChangedCallback","oldValue","namespace","_handleMutations","define.prototype","SyntaxError","_localNameToDefinition","getCallback","callbackValue","adoptedCallback","constructorFunction","constructionStack","setDefinition","_flush","pendingDefinitions","elementsWithStableDefinitions","elementsWithPendingDefinitions","pendingElements","pendingUpgradableElements","get.prototype","CustomElementRegistry$$module$node_modules$$webcomponents$custom_elements$src$CustomElementRegistry_prototype$whenDefined","whenDefined","prior","Deferred","some","polyfillWrapFlushCallback","outer","inner","CustomElementRegistry","Document_createElement","Document_createElementNS","createElementNS","Document_importNode","Document_prepend","Document_append","DocumentFragment_prepend","DocumentFragment_append","Node_cloneNode","Node_appendChild","Node_insertBefore","Node_removeChild","Node_replaceChild","Node_textContent","Element_attachShadow","Element_innerHTML","Element_getAttribute","Element_setAttribute","Element_removeAttribute","Element_getAttributeNS","getAttributeNS","Element_setAttributeNS","setAttributeNS","Element_removeAttributeNS","removeAttributeNS","Element_insertAdjacentElement","Element_insertAdjacentHTML","Element_prepend","Element_append","Element_before","Element_after","Element_replaceWith","Element_remove","HTMLElement_innerHTML","HTMLElement_insertAdjacentElement","HTMLElement_insertAdjacentHTML","$jscompDefaultExport","AlreadyConstructedMarker","builtIn","appendPrependPatch","builtInMethod","connectedElements","priorCustomElements","CustomElementInternals","constructorToDefinition","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Document_createElement.call","lastIndex","setPrototypeOf","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.HTMLElement","writable","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Document_importNode.call","__CE_hasRegistry","NS_HTML","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Document_createElementNS.call","prepend","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Document_prepend","append","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Document_append","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.DocumentFragment_prepend","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.DocumentFragment_append","patch_textContent","baseDescriptor","assignedValue","childNodesLength","insertedNodes","apply","nativeResult","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_insertBefore.call","nodeWasConnected","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_appendChild.call","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_cloneNode.call","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_removeChild.call","nodeToInsert","nodeToRemove","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_replaceChild.call","nodeToInsertWasConnected","thisIsConnected","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_textContent.get","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Node_textContent","patch_innerHTML","htmlString","removedElements","patch_insertAdjacentElement","baseMethod","position","wasConnected","insertedElement","patch_insertAdjacentHTML","upgradeNodesInRange","end","marker","String","init","__CE_shadowRoot","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_attachShadow.call","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_innerHTML.get","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_innerHTML","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.HTMLElement_innerHTML","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.HTMLElement_innerHTML.get","isTemplate","rawElement","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_getAttribute.call","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_getAttributeNS.call","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.HTMLElement_insertAdjacentElement","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_insertAdjacentElement","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.HTMLElement_insertAdjacentHTML","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_insertAdjacentHTML","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_prepend","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_append","beforeAfterPatch","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_before","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_after","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_replaceWith","$jscompDefaultExport$$module$node_modules$$webcomponents$custom_elements$src$Patch$Native.Element_remove","customElements","parse","parseCss","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.comments","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.port","StyleNode","OPEN_BRACE","CLOSE_BRACE","r$","_expandUnicodeEscapes","repeat","code","ss","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.multipleSpaces","AT_START","MEDIA_START","types$$module$node_modules$$webcomponents$shadycss$src$css_parse.MEDIA_RULE","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.keyframesRule","types$$module$node_modules$$webcomponents$shadycss$src$css_parse.KEYFRAMES_RULE","VAR_START","types$$module$node_modules$$webcomponents$shadycss$src$css_parse.MIXIN_RULE","types$$module$node_modules$$webcomponents$shadycss$src$css_parse.STYLE_RULE","STYLE_RULE","nativeCssVariables_","cssBuild","KEYFRAMES_RULE","MEDIA_RULE","MIXIN_RULE","comments","port","customProp","mixinProp","mixinApply","varApply","keyframesRule","multipleSpaces","nativeShadow","calcCssVariables","CSS","ShadyCSS","disableRuntime","nativeCss","nativeCssVariables","module$node_modules$$webcomponents$shadycss$src$style_settings.cssBuild","VAR_ASSIGN","MIXIN_MATCH","VAR_CONSUMED","ANIMATION_MATCH","MEDIA_MATCH","BRACKETED","styleTextSet","toCssText","rules","forEachRule","stringify","preserveProperties","cssText","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.customProp","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.mixinProp","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.mixinApply","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.varApply","rulesForStyle","style","isKeyframesSelector","rule","styleRuleCallback","keyframesRuleCallback","onlyActiveRules","skipRules","matchMedia","applyCss","moniker","contextNode","lastHeadApplyNode","applyStylePlaceHolder","placeHolder","after","applyStyle","findMatchingParen","level","setElementClassRaw","getIsExtends","typeExtension","is","splitSelectorList","part","getCssBuild","attrValue","CSS_BUILD_ATTR","buildComment","commentParts","trim","__cssBuild","isOptimalCssBuild","_transformDom","transformer","shouldRemoveScope","remove","SCOPE_NAME","CLASS","domReplaceScope","oldScope","newScope","StyleTransformer","domRemoveScope","elementStyles","styleRules","css","ext","hostScope","_calcHostScope","CSS_CLASS_PREFIX","_calcElementScope","_transformRuleCss","_transformRule","p$","COMPLEX_SELECTOR_SEP","_twiddleNthPlus","NTH","inside","_transformSimpleSelector","attributes","output","PSEUDO_PREFIX","normalizeRootSelector","ROOT","_transformComplexSelector","stop","isNth","isMatches","MATCHES","_preserveMatchesPseudo","MATCHES_REPLACEMENT","SLOTTED_START","SIMPLE_SELECTOR_SEP","info","_transformCompoundSelector","combinator","slottedIndex","SLOTTED","slotted","HOST","_transformHostSelector","HOST_PAREN","paren","SIMPLE_SELECTOR_PREFIX","SELECTOR_NO_MATCH","SLOTTED_PAREN","DIR_PAREN","before","dir","_replaceMatchesPseudo","reduce","acc","cur","_transformDocumentSelector","SCOPE_DOC_SELECTOR","ast","ownStylePropertyNames","overrideStyleProperties","customStyle","styleInfo","matchesSelector","method","_getStyleRules","StyleInfo","IS_IE","StyleProperties","decorateRule","properties","collectConsumingCssText","propertyInfo","collectProperties","valueForProperty","props","valueForProperties","processVariableAndFallback","str","suffix","comma","fallback","propertyValue","colon","pp","hostAndRootPropertiesForScope","hostProps","rootProps","whenHostOrRootRule","parsedSelector","isRoot","isHost","selectorToMatch","transformStyles","scopeSelector","hostSelector","hostRx","RegExp","StyleInfo$$module$node_modules$$webcomponents$shadycss$src$style_info.get","keyframeTransforms","_elementKeyframeTransforms","keyframesRules","keyframesNameRx","_scopeKeyframes","transformedKeyframesName","scopeId","transformedSelector","_keyframesRuleTransformer","applyProperties","applyKeyframeTransforms","input","keyframe","transform","_scopeSelector","applyCustomStyle","$jscomp.global.Object.defineProperties","XSCOPE_NAME","placeholderMap","ce","origDefine","wrappedDefine","clazz","store","tagname","styleElement","cache","scopeRegExp","getCurrentScope","getOwnerScope","handler","mxns","mxn","unscopedNodes","scopeForPreviouslyUnscopedNode","unscopedNode","delayedStart","requestAnimationFrame","module$node_modules$$webcomponents$shadycss$src$document_watcher.flush","templateMap","invalidate","elementName","templateIsValid","adoptedCssTextMap","styleCache","StyleCache","ScopingShim","_documentOwner","_documentOwnerStyleInfo","StyleInfo$$module$node_modules$$webcomponents$shadycss$src$style_info.set","_elementsHaveApplied","_customStyleInterface","_prepareHost","_ensure","_ensureApplyShim","ApplyShim","_ensureCustomStyleInterface","CustomStyleInterface","styleElementNativeVariables","removeProperty","setProperty","startValidatingTemplate","_validating","_styleOwnerForNode","_updateProperties","owner","ownerStyleInfo","ownerProperties","_mixinOverrideStyles","hostAndRootProps","propertiesMatchingHost","propertyDataFromStyles","parseInt","key","overrides","reify","names","styleProperties","flush.prototype","getStyleAst","styleAstToString","prepareTemplate","prepareTemplateStyles","_prepared","extends","optimalBuild","styleTextParts","styles","scopingAttribute","has","newStyle","_gatherStyles","ownPropertyNames","decorateStyles","keyframes","ruleIndex","collectPropertiesInCssText","onKeyframesRule","_keyframes","_generateStaticStyle","shadowroot","_ownPropertyNames","prepareAdoptedCssText","cssTextArray","prepareTemplateDom","domAddScope","flushCustomStyles.prototype","flushCustomStyles","customStyles","_revalidateCustomStyleApplyShim","_revalidateApplyShim","_applyShim","_applyCustomStyles","overrideProps","_mixOverrideStyleProps","styleElementShimVariables","cacheEntry","_applyStyleProperties","fetch","entry","_validate","pn","cachedStyle","oldScopeSelector","_generateScopeSelector","applyElementStyle","applyElementScopeSelector","styleDocument.prototype","styleDocument","styleSubtree","wrappedHost","shadowChildren","transformCustomStyleForDocument","documentRule","getComputedStyleValue","setElementClass","classString","classes","scopeName","classAttr","k$","_styleInfoForNode","scopeNode","unscopeNode","scopeForNode","elementExtends","HTMLImports","Template","WebComponents","flushCallback","runAndClearCallback","origWhenReady","ready"],"mappings":";;AACA,IAAA,EAAA,OAAA,QAAA,oBAAA,QAAA,OAAA,MAAA,KACA,OAAA,oBAAA,MAAA,KAAA,MAAA,KAAA,KAEA,SAAA,cAAA,GACA,iBAAA,MAAA,IAAA;;ACLA,IAAA,EAAA,OAAA,QAAA,CAAA,QAAA,SACA,iBAAA,MAAA,IAAA;;ACDA,OAAA,QAAA,SAAA,GACA,MAAA,iBAAA,EAAA,OAAA,EAAA,mBAAA;;ACDA,IAAA,EAAA,QAAA,gBACA,OAAA,QAAA,SAAA,GACA,IAAA,EAAA,GAAA,MAAA,UAAA,EAAA,sBACA,OAAA;;ACHA,OAAA,QAAA,SAAA,GACA,IACA,QAAA,IACA,MAAA,GACA,OAAA;;ACHA,OAAA,SAAA,QAAA,WAAA,C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AA,aAAA,CAAA,OAAA,IAAA,QAAA","file":"polyfills.72777680.js","sourceRoot":"../src/app/client/application","sourcesContent":["// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n","var core = module.exports = { version: '2.6.9' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n","module.exports = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n","var isObject = require('./_is-object');\nmodule.exports = function (it) {\n if (!isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n","module.exports = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n","// Thank's IE8 for his funny defineProperty\nmodule.exports = !require('./_fails')(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n","var isObject = require('./_is-object');\nvar document = require('./_global').document;\n// typeof document.createElement is 'object' in old IE\nvar is = isObject(document) && isObject(document.createElement);\nmodule.exports = function (it) {\n return is ? document.createElement(it) : {};\n};\n","module.exports = !require('./_descriptors') && !require('./_fails')(function () {\n return Object.defineProperty(require('./_dom-create')('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n","// 7.1.1 ToPrimitive(input [, PreferredType])\nvar isObject = require('./_is-object');\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nmodule.exports = function (it, S) {\n if (!isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n","var anObject = require('./_an-object');\nvar IE8_DOM_DEFINE = require('./_ie8-dom-define');\nvar toPrimitive = require('./_to-primitive');\nvar dP = Object.defineProperty;\n\nexports.f = require('./_descriptors') ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n anObject(O);\n P = toPrimitive(P, true);\n anObject(Attributes);\n if (IE8_DOM_DEFINE) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n","module.exports = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n","var dP = require('./_object-dp');\nvar createDesc = require('./_property-desc');\nmodule.exports = require('./_descriptors') ? function (object, key, value) {\n return dP.f(object, key, createDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n","var hasOwnProperty = {}.hasOwnProperty;\nmodule.exports = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n","var id = 0;\nvar px = Math.random();\nmodule.exports = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n","module.exports = false;\n","var core = require('./_core');\nvar global = require('./_global');\nvar SHARED = '__core-js_shared__';\nvar store = global[SHARED] || (global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: core.version,\n mode: require('./_library') ? 'pure' : 'global',\n copyright: '© 2019 Denis Pushkarev (zloirock.ru)'\n});\n","module.exports = require('./_shared')('native-function-to-string', Function.toString);\n","var global = require('./_global');\nvar hide = require('./_hide');\nvar has = require('./_has');\nvar SRC = require('./_uid')('src');\nvar $toString = require('./_function-to-string');\nvar TO_STRING = 'toString';\nvar TPL = ('' + $toString).split(TO_STRING);\n\nrequire('./_core').inspectSource = function (it) {\n return $toString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) has(val, 'name') || hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || $toString.call(this);\n});\n","module.exports = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n","// optional / simple context binding\nvar aFunction = require('./_a-function');\nmodule.exports = function (fn, that, length) {\n aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n","var global = require('./_global');\nvar core = require('./_core');\nvar hide = require('./_hide');\nvar redefine = require('./_redefine');\nvar ctx = require('./_ctx');\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;\n // extend global\n if (target) redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\nglobal.core = core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nmodule.exports = $export;\n","var global = require('./_global');\nvar navigator = global.navigator;\n\nmodule.exports = navigator && navigator.userAgent || '';\n","// ie9- setTimeout & setInterval additional parameters fix\nvar global = require('./_global');\nvar $export = require('./_export');\nvar userAgent = require('./_user-agent');\nvar slice = [].slice;\nvar MSIE = /MSIE .\\./.test(userAgent); // <- dirty ie9- check\nvar wrap = function (set) {\n return function (fn, time /* , ...args */) {\n var boundArgs = arguments.length > 2;\n var args = boundArgs ? slice.call(arguments, 2) : false;\n return set(boundArgs ? function () {\n // eslint-disable-next-line no-new-func\n (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);\n } : fn, time);\n };\n};\n$export($export.G + $export.B + $export.F * MSIE, {\n setTimeout: wrap(global.setTimeout),\n setInterval: wrap(global.setInterval)\n});\n","// fast apply, http://jsperf.lnkit.com/fast-apply/5\nmodule.exports = function (fn, args, that) {\n var un = that === undefined;\n switch (args.length) {\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};\n","var document = require('./_global').document;\nmodule.exports = document && document.documentElement;\n","var toString = {}.toString;\n\nmodule.exports = function (it) {\n return toString.call(it).slice(8, -1);\n};\n","var ctx = require('./_ctx');\nvar invoke = require('./_invoke');\nvar html = require('./_html');\nvar cel = require('./_dom-create');\nvar global = require('./_global');\nvar process = global.process;\nvar setTask = global.setImmediate;\nvar clearTask = global.clearImmediate;\nvar MessageChannel = global.MessageChannel;\nvar Dispatch = global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\nvar run = function () {\n var id = +this;\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function (event) {\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (require('./_cof')(process) == 'process') {\n defer = function (id) {\n process.nextTick(ctx(run, id, 1));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if (MessageChannel) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {\n defer = function (id) {\n global.postMessage(id + '', '*');\n };\n global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in cel('script')) {\n defer = function (id) {\n html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {\n html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(ctx(run, id, 1), 0);\n };\n }\n}\nmodule.exports = {\n set: setTask,\n clear: clearTask\n};\n","var $export = require('./_export');\nvar $task = require('./_task');\n$export($export.G + $export.B, {\n setImmediate: $task.set,\n clearImmediate: $task.clear\n});\n","var store = require('./_shared')('wks');\nvar uid = require('./_uid');\nvar Symbol = require('./_global').Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n","// 22.1.3.31 Array.prototype[@@unscopables]\nvar UNSCOPABLES = require('./_wks')('unscopables');\nvar ArrayProto = Array.prototype;\nif (ArrayProto[UNSCOPABLES] == undefined) require('./_hide')(ArrayProto, UNSCOPABLES, {});\nmodule.exports = function (key) {\n ArrayProto[UNSCOPABLES][key] = true;\n};\n","module.exports = function (done, value) {\n return { value: value, done: !!done };\n};\n","module.exports = {};\n","// fallback for non-array-like ES3 and non-enumerable old V8 strings\nvar cof = require('./_cof');\n// eslint-disable-next-line no-prototype-builtins\nmodule.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return cof(it) == 'String' ? it.split('') : Object(it);\n};\n","// 7.2.1 RequireObjectCoercible(argument)\nmodule.exports = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n","// to indexed object, toObject with fallback for non-array-like ES3 strings\nvar IObject = require('./_iobject');\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return IObject(defined(it));\n};\n","// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nmodule.exports = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n","// 7.1.15 ToLength\nvar toInteger = require('./_to-integer');\nvar min = Math.min;\nmodule.exports = function (it) {\n return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n","var toInteger = require('./_to-integer');\nvar max = Math.max;\nvar min = Math.min;\nmodule.exports = function (index, length) {\n index = toInteger(index);\n return index < 0 ? max(index + length, 0) : min(index, length);\n};\n","// false -> Array#indexOf\n// true -> Array#includes\nvar toIObject = require('./_to-iobject');\nvar toLength = require('./_to-length');\nvar toAbsoluteIndex = require('./_to-absolute-index');\nmodule.exports = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = toIObject($this);\n var length = toLength(O.length);\n var index = toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n","var shared = require('./_shared')('keys');\nvar uid = require('./_uid');\nmodule.exports = function (key) {\n return shared[key] || (shared[key] = uid(key));\n};\n","var has = require('./_has');\nvar toIObject = require('./_to-iobject');\nvar arrayIndexOf = require('./_array-includes')(false);\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\n\nmodule.exports = function (object, names) {\n var O = toIObject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n","// IE 8- don't enum bug keys\nmodule.exports = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n","// 19.1.2.14 / 15.2.3.14 Object.keys(O)\nvar $keys = require('./_object-keys-internal');\nvar enumBugKeys = require('./_enum-bug-keys');\n\nmodule.exports = Object.keys || function keys(O) {\n return $keys(O, enumBugKeys);\n};\n","var dP = require('./_object-dp');\nvar anObject = require('./_an-object');\nvar getKeys = require('./_object-keys');\n\nmodule.exports = require('./_descriptors') ? Object.defineProperties : function defineProperties(O, Properties) {\n anObject(O);\n var keys = getKeys(Properties);\n var length = keys.length;\n var i = 0;\n var P;\n while (length > i) dP.f(O, P = keys[i++], Properties[P]);\n return O;\n};\n","// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])\nvar anObject = require('./_an-object');\nvar dPs = require('./_object-dps');\nvar enumBugKeys = require('./_enum-bug-keys');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar Empty = function () { /* empty */ };\nvar PROTOTYPE = 'prototype';\n\n// Create object with fake `null` prototype: use iframe Object with cleared prototype\nvar createDict = function () {\n // Thrash, waste and sodomy: IE GC bug\n var iframe = require('./_dom-create')('iframe');\n var i = enumBugKeys.length;\n var lt = '<';\n var gt = '>';\n var iframeDocument;\n iframe.style.display = 'none';\n require('./_html').appendChild(iframe);\n iframe.src = 'javascript:'; // eslint-disable-line no-script-url\n // createDict = iframe.contentWindow.Object;\n // html.removeChild(iframe);\n iframeDocument = iframe.contentWindow.document;\n iframeDocument.open();\n iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);\n iframeDocument.close();\n createDict = iframeDocument.F;\n while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];\n return createDict();\n};\n\nmodule.exports = Object.create || function create(O, Properties) {\n var result;\n if (O !== null) {\n Empty[PROTOTYPE] = anObject(O);\n result = new Empty();\n Empty[PROTOTYPE] = null;\n // add \"__proto__\" for Object.getPrototypeOf polyfill\n result[IE_PROTO] = O;\n } else result = createDict();\n return Properties === undefined ? result : dPs(result, Properties);\n};\n","var def = require('./_object-dp').f;\nvar has = require('./_has');\nvar TAG = require('./_wks')('toStringTag');\n\nmodule.exports = function (it, tag, stat) {\n if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });\n};\n","'use strict';\nvar create = require('./_object-create');\nvar descriptor = require('./_property-desc');\nvar setToStringTag = require('./_set-to-string-tag');\nvar IteratorPrototype = {};\n\n// 25.1.2.1.1 %IteratorPrototype%[@@iterator]()\nrequire('./_hide')(IteratorPrototype, require('./_wks')('iterator'), function () { return this; });\n\nmodule.exports = function (Constructor, NAME, next) {\n Constructor.prototype = create(IteratorPrototype, { next: descriptor(1, next) });\n setToStringTag(Constructor, NAME + ' Iterator');\n};\n","// 7.1.13 ToObject(argument)\nvar defined = require('./_defined');\nmodule.exports = function (it) {\n return Object(defined(it));\n};\n","// 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)\nvar has = require('./_has');\nvar toObject = require('./_to-object');\nvar IE_PROTO = require('./_shared-key')('IE_PROTO');\nvar ObjectProto = Object.prototype;\n\nmodule.exports = Object.getPrototypeOf || function (O) {\n O = toObject(O);\n if (has(O, IE_PROTO)) return O[IE_PROTO];\n if (typeof O.constructor == 'function' && O instanceof O.constructor) {\n return O.constructor.prototype;\n } return O instanceof Object ? ObjectProto : null;\n};\n","'use strict';\nvar LIBRARY = require('./_library');\nvar $export = require('./_export');\nvar redefine = require('./_redefine');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar $iterCreate = require('./_iter-create');\nvar setToStringTag = require('./_set-to-string-tag');\nvar getPrototypeOf = require('./_object-gpo');\nvar ITERATOR = require('./_wks')('iterator');\nvar BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`\nvar FF_ITERATOR = '@@iterator';\nvar KEYS = 'keys';\nvar VALUES = 'values';\n\nvar returnThis = function () { return this; };\n\nmodule.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {\n $iterCreate(Constructor, NAME, next);\n var getMethod = function (kind) {\n if (!BUGGY && kind in proto) return proto[kind];\n switch (kind) {\n case KEYS: return function keys() { return new Constructor(this, kind); };\n case VALUES: return function values() { return new Constructor(this, kind); };\n } return function entries() { return new Constructor(this, kind); };\n };\n var TAG = NAME + ' Iterator';\n var DEF_VALUES = DEFAULT == VALUES;\n var VALUES_BUG = false;\n var proto = Base.prototype;\n var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];\n var $default = $native || getMethod(DEFAULT);\n var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;\n var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;\n var methods, key, IteratorPrototype;\n // Fix native\n if ($anyNative) {\n IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));\n if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {\n // Set @@toStringTag to native iterators\n setToStringTag(IteratorPrototype, TAG, true);\n // fix for some old engines\n if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);\n }\n }\n // fix Array#{values, @@iterator}.name in V8 / FF\n if (DEF_VALUES && $native && $native.name !== VALUES) {\n VALUES_BUG = true;\n $default = function values() { return $native.call(this); };\n }\n // Define iterator\n if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {\n hide(proto, ITERATOR, $default);\n }\n // Plug for library\n Iterators[NAME] = $default;\n Iterators[TAG] = returnThis;\n if (DEFAULT) {\n methods = {\n values: DEF_VALUES ? $default : getMethod(VALUES),\n keys: IS_SET ? $default : getMethod(KEYS),\n entries: $entries\n };\n if (FORCED) for (key in methods) {\n if (!(key in proto)) redefine(proto, key, methods[key]);\n } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);\n }\n return methods;\n};\n","'use strict';\nvar addToUnscopables = require('./_add-to-unscopables');\nvar step = require('./_iter-step');\nvar Iterators = require('./_iterators');\nvar toIObject = require('./_to-iobject');\n\n// 22.1.3.4 Array.prototype.entries()\n// 22.1.3.13 Array.prototype.keys()\n// 22.1.3.29 Array.prototype.values()\n// 22.1.3.30 Array.prototype[@@iterator]()\nmodule.exports = require('./_iter-define')(Array, 'Array', function (iterated, kind) {\n this._t = toIObject(iterated); // target\n this._i = 0; // next index\n this._k = kind; // kind\n// 22.1.5.2.1 %ArrayIteratorPrototype%.next()\n}, function () {\n var O = this._t;\n var kind = this._k;\n var index = this._i++;\n if (!O || index >= O.length) {\n this._t = undefined;\n return step(1);\n }\n if (kind == 'keys') return step(0, index);\n if (kind == 'values') return step(0, O[index]);\n return step(0, [index, O[index]]);\n}, 'values');\n\n// argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)\nIterators.Arguments = Iterators.Array;\n\naddToUnscopables('keys');\naddToUnscopables('values');\naddToUnscopables('entries');\n","var $iterators = require('./es6.array.iterator');\nvar getKeys = require('./_object-keys');\nvar redefine = require('./_redefine');\nvar global = require('./_global');\nvar hide = require('./_hide');\nvar Iterators = require('./_iterators');\nvar wks = require('./_wks');\nvar ITERATOR = wks('iterator');\nvar TO_STRING_TAG = wks('toStringTag');\nvar ArrayValues = Iterators.Array;\n\nvar DOMIterables = {\n CSSRuleList: true, // TODO: Not spec compliant, should be false.\n CSSStyleDeclaration: false,\n CSSValueList: false,\n ClientRectList: false,\n DOMRectList: false,\n DOMStringList: false,\n DOMTokenList: true,\n DataTransferItemList: false,\n FileList: false,\n HTMLAllCollection: false,\n HTMLCollection: false,\n HTMLFormElement: false,\n HTMLSelectElement: false,\n MediaList: true, // TODO: Not spec compliant, should be false.\n MimeTypeArray: false,\n NamedNodeMap: false,\n NodeList: true,\n PaintRequestList: false,\n Plugin: false,\n PluginArray: false,\n SVGLengthList: false,\n SVGNumberList: false,\n SVGPathSegList: false,\n SVGPointList: false,\n SVGStringList: false,\n SVGTransformList: false,\n SourceBufferList: false,\n StyleSheetList: true, // TODO: Not spec compliant, should be false.\n TextTrackCueList: false,\n TextTrackList: false,\n TouchList: false\n};\n\nfor (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {\n var NAME = collections[i];\n var explicit = DOMIterables[NAME];\n var Collection = global[NAME];\n var proto = Collection && Collection.prototype;\n var key;\n if (proto) {\n if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);\n if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);\n Iterators[NAME] = ArrayValues;\n if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);\n }\n}\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n(function(scope) {\n\n 'use strict';\n\n // defaultPrevented is broken in IE.\n // https://connect.microsoft.com/IE/feedback/details/790389/event-defaultprevented-returns-false-after-preventdefault-was-called\n var workingDefaultPrevented = (function() {\n var e = document.createEvent('Event');\n e.initEvent('foo', true, true);\n e.preventDefault();\n return e.defaultPrevented;\n })();\n\n if (!workingDefaultPrevented) {\n var origPreventDefault = Event.prototype.preventDefault;\n Event.prototype.preventDefault = function() {\n if (!this.cancelable) {\n return;\n }\n\n origPreventDefault.call(this);\n\n Object.defineProperty(this, 'defaultPrevented', {\n get: function() {\n return true;\n },\n configurable: true\n });\n };\n }\n\n var isIE = /Trident/.test(navigator.userAgent);\n\n // CustomEvent constructor shim\n if (!window.CustomEvent || isIE && (typeof window.CustomEvent !== 'function')) {\n window.CustomEvent = function(inType, params) {\n params = params || {};\n var e = document.createEvent('CustomEvent');\n e.initCustomEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);\n return e;\n };\n window.CustomEvent.prototype = window.Event.prototype;\n }\n\n // Event constructor shim\n if (!window.Event || isIE && (typeof window.Event !== 'function')) {\n var origEvent = window.Event;\n window.Event = function(inType, params) {\n params = params || {};\n var e = document.createEvent('Event');\n e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));\n return e;\n };\n if (origEvent) {\n for (var i in origEvent) {\n window.Event[i] = origEvent[i];\n }\n }\n window.Event.prototype = origEvent.prototype;\n }\n\n if (!window.MouseEvent || isIE && (typeof window.MouseEvent !== 'function')) {\n var origMouseEvent = window.MouseEvent;\n window.MouseEvent = function(inType, params) {\n params = params || {};\n var e = document.createEvent('MouseEvent');\n e.initMouseEvent(inType,\n Boolean(params.bubbles), Boolean(params.cancelable),\n params.view || window, params.detail,\n params.screenX, params.screenY, params.clientX, params.clientY,\n params.ctrlKey, params.altKey, params.shiftKey, params.metaKey,\n params.button, params.relatedTarget);\n return e;\n };\n if (origMouseEvent) {\n for (var i in origMouseEvent) {\n window.MouseEvent[i] = origMouseEvent[i];\n }\n }\n window.MouseEvent.prototype = origMouseEvent.prototype;\n }\n\n // ES6 stuff\n if (!Array.from) {\n Array.from = function (object) {\n return [].slice.call(object);\n };\n }\n\n if (!Object.assign) {\n var assign = function(target, source) {\n var n$ = Object.getOwnPropertyNames(source);\n for (var i=0, p; i < n$.length; i++) {\n p = n$[i];\n target[p] = source[p];\n }\n }\n\n Object.assign = function(target, sources) {\n var args = [].slice.call(arguments, 1);\n for (var i=0, s; i < args.length; i++) {\n s = args[i];\n if (s) {\n assign(target, s);\n }\n }\n return target;\n }\n }\n\n})(window.WebComponents);\n",null,null,null,null,"/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n// minimal template polyfill\n(function() {\n 'use strict';\n\n var needsTemplate = (typeof HTMLTemplateElement === 'undefined');\n var brokenDocFragment = !(document.createDocumentFragment().cloneNode() instanceof DocumentFragment);\n var needsDocFrag = false;\n\n // NOTE: Replace DocumentFragment to work around IE11 bug that\n // causes children of a document fragment modified while\n // there is a mutation observer to not have a parentNode, or\n // have a broken parentNode (!?!)\n if (/Trident/.test(navigator.userAgent)) {\n (function() {\n\n needsDocFrag = true;\n\n var origCloneNode = Node.prototype.cloneNode;\n Node.prototype.cloneNode = function cloneNode(deep) {\n var newDom = origCloneNode.call(this, deep);\n if (this instanceof DocumentFragment) {\n newDom.__proto__ = DocumentFragment.prototype;\n }\n return newDom;\n };\n\n // IE's DocumentFragment querySelector code doesn't work when\n // called on an element instance\n DocumentFragment.prototype.querySelectorAll = HTMLElement.prototype.querySelectorAll;\n DocumentFragment.prototype.querySelector = HTMLElement.prototype.querySelector;\n\n Object.defineProperties(DocumentFragment.prototype, {\n 'nodeType': {\n get: function () {\n return Node.DOCUMENT_FRAGMENT_NODE;\n },\n configurable: true\n },\n\n 'localName': {\n get: function () {\n return undefined;\n },\n configurable: true\n },\n\n 'nodeName': {\n get: function () {\n return '#document-fragment';\n },\n configurable: true\n }\n });\n\n var origInsertBefore = Node.prototype.insertBefore;\n function insertBefore(newNode, refNode) {\n if (newNode instanceof DocumentFragment) {\n var child;\n while ((child = newNode.firstChild)) {\n origInsertBefore.call(this, child, refNode);\n }\n } else {\n origInsertBefore.call(this, newNode, refNode);\n }\n return newNode;\n }\n Node.prototype.insertBefore = insertBefore;\n\n var origAppendChild = Node.prototype.appendChild;\n Node.prototype.appendChild = function appendChild(child) {\n if (child instanceof DocumentFragment) {\n insertBefore.call(this, child, null);\n } else {\n origAppendChild.call(this, child);\n }\n return child;\n };\n\n var origRemoveChild = Node.prototype.removeChild;\n var origReplaceChild = Node.prototype.replaceChild;\n Node.prototype.replaceChild = function replaceChild(newChild, oldChild) {\n if (newChild instanceof DocumentFragment) {\n insertBefore.call(this, newChild, oldChild);\n origRemoveChild.call(this, oldChild);\n } else {\n origReplaceChild.call(this, newChild, oldChild);\n }\n return oldChild;\n };\n\n Document.prototype.createDocumentFragment = function createDocumentFragment() {\n var frag = this.createElement('df');\n frag.__proto__ = DocumentFragment.prototype;\n return frag;\n };\n\n var origImportNode = Document.prototype.importNode;\n Document.prototype.importNode = function importNode(impNode, deep) {\n deep = deep || false;\n var newNode = origImportNode.call(this, impNode, deep);\n if (impNode instanceof DocumentFragment) {\n newNode.__proto__ = DocumentFragment.prototype;\n }\n return newNode;\n };\n })();\n }\n\n // NOTE: we rely on this cloneNode not causing element upgrade.\n // This means this polyfill must load before the CE polyfill and\n // this would need to be re-worked if a browser supports native CE\n // but not <template>.\n var capturedCloneNode = Node.prototype.cloneNode;\n var capturedCreateElement = Document.prototype.createElement;\n var capturedImportNode = Document.prototype.importNode;\n var capturedRemoveChild = Node.prototype.removeChild;\n var capturedAppendChild = Node.prototype.appendChild;\n var capturedReplaceChild = Node.prototype.replaceChild;\n var capturedParseFromString = DOMParser.prototype.parseFromString;\n var capturedHTMLElementInnerHTML = Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML') || {\n /**\n * @this {!HTMLElement}\n * @return {string}\n */\n get: function() {\n return this.innerHTML;\n },\n /**\n * @this {!HTMLElement}\n * @param {string}\n */\n set: function(text) {\n this.innerHTML = text;\n }\n };\n var capturedChildNodes = Object.getOwnPropertyDescriptor(window.Node.prototype, 'childNodes') || {\n /**\n * @this {!Node}\n * @return {!NodeList}\n */\n get: function() {\n return this.childNodes;\n }\n };\n\n var elementQuerySelectorAll = Element.prototype.querySelectorAll;\n var docQuerySelectorAll = Document.prototype.querySelectorAll;\n var fragQuerySelectorAll = DocumentFragment.prototype.querySelectorAll;\n\n var scriptSelector = 'script:not([type]),script[type=\"application/javascript\"],script[type=\"text/javascript\"]';\n\n function QSA(node, selector) {\n // IE 11 throws a SyntaxError with `scriptSelector` if the node has no children due to the `:not([type])` syntax\n if (!node.childNodes.length) {\n return [];\n }\n switch (node.nodeType) {\n case Node.DOCUMENT_NODE:\n return docQuerySelectorAll.call(node, selector);\n case Node.DOCUMENT_FRAGMENT_NODE:\n return fragQuerySelectorAll.call(node, selector);\n default:\n return elementQuerySelectorAll.call(node, selector);\n }\n }\n\n // returns true if nested templates cannot be cloned (they cannot be on\n // some impl's like Safari 8 and Edge)\n // OR if cloning a document fragment does not result in a document fragment\n var needsCloning = (function() {\n if (!needsTemplate) {\n var t = document.createElement('template');\n var t2 = document.createElement('template');\n t2.content.appendChild(document.createElement('div'));\n t.content.appendChild(t2);\n var clone = t.cloneNode(true);\n return (clone.content.childNodes.length === 0 || clone.content.firstChild.content.childNodes.length === 0\n || brokenDocFragment);\n }\n })();\n\n var TEMPLATE_TAG = 'template';\n var PolyfilledHTMLTemplateElement = function() {};\n\n if (needsTemplate) {\n\n var contentDoc = document.implementation.createHTMLDocument('template');\n var canDecorate = true;\n\n var templateStyle = document.createElement('style');\n templateStyle.textContent = TEMPLATE_TAG + '{display:none;}';\n\n var head = document.head;\n head.insertBefore(templateStyle, head.firstElementChild);\n\n /**\n Provides a minimal shim for the <template> element.\n */\n PolyfilledHTMLTemplateElement.prototype = Object.create(HTMLElement.prototype);\n\n\n // if elements do not have `innerHTML` on instances, then\n // templates can be patched by swizzling their prototypes.\n var canProtoPatch =\n !(document.createElement('div').hasOwnProperty('innerHTML'));\n\n /**\n The `decorate` method moves element children to the template's `content`.\n NOTE: there is no support for dynamically adding elements to templates.\n */\n PolyfilledHTMLTemplateElement.decorate = function(template) {\n // if the template is decorated or not in HTML namespace, return fast\n if (template.content ||\n template.namespaceURI !== document.documentElement.namespaceURI) {\n return;\n }\n template.content = contentDoc.createDocumentFragment();\n var child;\n while ((child = template.firstChild)) {\n capturedAppendChild.call(template.content, child);\n }\n // NOTE: prefer prototype patching for performance and\n // because on some browsers (IE11), re-defining `innerHTML`\n // can result in intermittent errors.\n if (canProtoPatch) {\n template.__proto__ = PolyfilledHTMLTemplateElement.prototype;\n } else {\n template.cloneNode = function(deep) {\n return PolyfilledHTMLTemplateElement._cloneNode(this, deep);\n };\n // add innerHTML to template, if possible\n // Note: this throws on Safari 7\n if (canDecorate) {\n try {\n defineInnerHTML(template);\n defineOuterHTML(template);\n } catch (err) {\n canDecorate = false;\n }\n }\n }\n // bootstrap recursively\n PolyfilledHTMLTemplateElement.bootstrap(template.content);\n };\n\n // Taken from https://github.com/jquery/jquery/blob/73d7e6259c63ac45f42c6593da8c2796c6ce9281/src/manipulation/wrapMap.js\n var topLevelWrappingMap = {\n 'option': ['select'],\n 'thead': ['table'],\n 'col': ['colgroup', 'table'],\n 'tr': ['tbody', 'table'],\n 'th': ['tr', 'tbody', 'table'],\n 'td': ['tr', 'tbody', 'table']\n };\n\n var getTagName = function(text) {\n // Taken from https://github.com/jquery/jquery/blob/73d7e6259c63ac45f42c6593da8c2796c6ce9281/src/manipulation/var/rtagName.js\n return ( /<([a-z][^/\\0>\\x20\\t\\r\\n\\f]+)/i.exec(text) || ['', ''])[1].toLowerCase();\n };\n\n var defineInnerHTML = function defineInnerHTML(obj) {\n Object.defineProperty(obj, 'innerHTML', {\n get: function() {\n return getInnerHTML(this);\n },\n set: function(text) {\n // For IE11, wrap the text in the correct (table) context\n var wrap = topLevelWrappingMap[getTagName(text)];\n if (wrap) {\n for (var i = 0; i < wrap.length; i++) {\n text = '<' + wrap[i] + '>' + text + '</' + wrap[i] + '>';\n }\n }\n contentDoc.body.innerHTML = text;\n PolyfilledHTMLTemplateElement.bootstrap(contentDoc);\n while (this.content.firstChild) {\n capturedRemoveChild.call(this.content, this.content.firstChild);\n }\n var body = contentDoc.body;\n // If we had wrapped, get back to the original node\n if (wrap) {\n for (var j = 0; j < wrap.length; j++) {\n body = body.lastChild;\n }\n }\n while (body.firstChild) {\n capturedAppendChild.call(this.content, body.firstChild);\n }\n },\n configurable: true\n });\n };\n\n var defineOuterHTML = function defineOuterHTML(obj) {\n Object.defineProperty(obj, 'outerHTML', {\n get: function() {\n return '<' + TEMPLATE_TAG + '>' + this.innerHTML + '</' + TEMPLATE_TAG + '>';\n },\n set: function(innerHTML) {\n if (this.parentNode) {\n contentDoc.body.innerHTML = innerHTML;\n var docFrag = this.ownerDocument.createDocumentFragment();\n while (contentDoc.body.firstChild) {\n capturedAppendChild.call(docFrag, contentDoc.body.firstChild);\n }\n capturedReplaceChild.call(this.parentNode, docFrag, this);\n } else {\n throw new Error(\"Failed to set the 'outerHTML' property on 'Element': This element has no parent node.\");\n }\n },\n configurable: true\n });\n };\n\n defineInnerHTML(PolyfilledHTMLTemplateElement.prototype);\n defineOuterHTML(PolyfilledHTMLTemplateElement.prototype);\n\n /**\n The `bootstrap` method is called automatically and \"fixes\" all\n <template> elements in the document referenced by the `doc` argument.\n */\n PolyfilledHTMLTemplateElement.bootstrap = function bootstrap(doc) {\n var templates = QSA(doc, TEMPLATE_TAG);\n for (var i=0, l=templates.length, t; (i<l) && (t=templates[i]); i++) {\n PolyfilledHTMLTemplateElement.decorate(t);\n }\n };\n\n // auto-bootstrapping for main document\n document.addEventListener('DOMContentLoaded', function() {\n PolyfilledHTMLTemplateElement.bootstrap(document);\n });\n\n // Patch document.createElement to ensure newly created templates have content\n Document.prototype.createElement = function createElement() {\n var el = capturedCreateElement.apply(this, arguments);\n if (el.localName === 'template') {\n PolyfilledHTMLTemplateElement.decorate(el);\n }\n return el;\n };\n\n DOMParser.prototype.parseFromString = function() {\n var el = capturedParseFromString.apply(this, arguments);\n PolyfilledHTMLTemplateElement.bootstrap(el);\n return el;\n };\n\n Object.defineProperty(HTMLElement.prototype, 'innerHTML', {\n get: function() {\n return getInnerHTML(this);\n },\n set: function(text) {\n capturedHTMLElementInnerHTML.set.call(this, text);\n PolyfilledHTMLTemplateElement.bootstrap(this);\n },\n configurable: true,\n enumerable: true\n });\n\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString\n var escapeAttrRegExp = /[&\\u00A0\"]/g;\n var escapeDataRegExp = /[&\\u00A0<>]/g;\n\n var escapeReplace = function(c) {\n switch (c) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case '\\u00A0':\n return ' ';\n }\n };\n\n var escapeAttr = function(s) {\n return s.replace(escapeAttrRegExp, escapeReplace);\n };\n\n var escapeData = function(s) {\n return s.replace(escapeDataRegExp, escapeReplace);\n };\n\n var makeSet = function(arr) {\n var set = {};\n for (var i = 0; i < arr.length; i++) {\n set[arr[i]] = true;\n }\n return set;\n };\n\n // http://www.whatwg.org/specs/web-apps/current-work/#void-elements\n var voidElements = makeSet([\n 'area',\n 'base',\n 'br',\n 'col',\n 'command',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'keygen',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr'\n ]);\n\n var plaintextParents = makeSet([\n 'style',\n 'script',\n 'xmp',\n 'iframe',\n 'noembed',\n 'noframes',\n 'plaintext',\n 'noscript'\n ]);\n\n /**\n * @param {Node} node\n * @param {Node} parentNode\n * @param {Function=} callback\n */\n var getOuterHTML = function(node, parentNode, callback) {\n switch (node.nodeType) {\n case Node.ELEMENT_NODE: {\n var tagName = node.localName;\n var s = '<' + tagName;\n var attrs = node.attributes;\n for (var i = 0, attr; (attr = attrs[i]); i++) {\n s += ' ' + attr.name + '=\"' + escapeAttr(attr.value) + '\"';\n }\n s += '>';\n if (voidElements[tagName]) {\n return s;\n }\n return s + getInnerHTML(node, callback) + '</' + tagName + '>';\n }\n case Node.TEXT_NODE: {\n var data = /** @type {Text} */ (node).data;\n if (parentNode && plaintextParents[parentNode.localName]) {\n return data;\n }\n return escapeData(data);\n }\n case Node.COMMENT_NODE: {\n return '<!--' + /** @type {Comment} */ (node).data + '-->';\n }\n default: {\n window.console.error(node);\n throw new Error('not implemented');\n }\n }\n };\n\n /**\n * @param {Node} node\n * @param {Function=} callback\n */\n var getInnerHTML = function(node, callback) {\n if (node.localName === 'template') {\n node = /** @type {HTMLTemplateElement} */ (node).content;\n }\n var s = '';\n var c$ = callback ? callback(node) : capturedChildNodes.get.call(node);\n for (var i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) {\n s += getOuterHTML(child, node, callback);\n }\n return s;\n };\n\n }\n\n // make cloning/importing work!\n if (needsTemplate || needsCloning) {\n\n PolyfilledHTMLTemplateElement._cloneNode = function _cloneNode(template, deep) {\n var clone = capturedCloneNode.call(template, false);\n // NOTE: decorate doesn't auto-fix children because they are already\n // decorated so they need special clone fixup.\n if (this.decorate) {\n this.decorate(clone);\n }\n if (deep) {\n // NOTE: use native clone node to make sure CE's wrapped\n // cloneNode does not cause elements to upgrade.\n capturedAppendChild.call(clone.content, capturedCloneNode.call(template.content, true));\n // now ensure nested templates are cloned correctly.\n fixClonedDom(clone.content, template.content);\n }\n return clone;\n };\n\n // Given a source and cloned subtree, find <template>'s in the cloned\n // subtree and replace them with cloned <template>'s from source.\n // We must do this because only the source templates have proper .content.\n var fixClonedDom = function fixClonedDom(clone, source) {\n // do nothing if cloned node is not an element\n if (!source.querySelectorAll) return;\n // these two lists should be coincident\n var s$ = QSA(source, TEMPLATE_TAG);\n if (s$.length === 0) {\n return;\n }\n var t$ = QSA(clone, TEMPLATE_TAG);\n for (var i=0, l=t$.length, t, s; i<l; i++) {\n s = s$[i];\n t = t$[i];\n if (PolyfilledHTMLTemplateElement && PolyfilledHTMLTemplateElement.decorate) {\n PolyfilledHTMLTemplateElement.decorate(s);\n }\n capturedReplaceChild.call(t.parentNode, cloneNode.call(s, true), t);\n }\n };\n\n // make sure scripts inside of a cloned template are executable\n var fixClonedScripts = function fixClonedScripts(fragment) {\n var scripts = QSA(fragment, scriptSelector);\n for (var ns, s, i = 0; i < scripts.length; i++) {\n s = scripts[i];\n ns = capturedCreateElement.call(document, 'script');\n ns.textContent = s.textContent;\n var attrs = s.attributes;\n for (var ai = 0, a; ai < attrs.length; ai++) {\n a = attrs[ai];\n ns.setAttribute(a.name, a.value);\n }\n capturedReplaceChild.call(s.parentNode, ns, s);\n }\n };\n\n // override all cloning to fix the cloned subtree to contain properly\n // cloned templates.\n var cloneNode = Node.prototype.cloneNode = function cloneNode(deep) {\n var dom;\n // workaround for Edge bug cloning documentFragments\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/8619646/\n if (!needsDocFrag && brokenDocFragment && this instanceof DocumentFragment) {\n if (!deep) {\n return this.ownerDocument.createDocumentFragment();\n } else {\n dom = importNode.call(this.ownerDocument, this, true);\n }\n } else if (this.nodeType === Node.ELEMENT_NODE &&\n this.localName === TEMPLATE_TAG &&\n this.namespaceURI == document.documentElement.namespaceURI) {\n dom = PolyfilledHTMLTemplateElement._cloneNode(this, deep);\n } else {\n dom = capturedCloneNode.call(this, deep);\n }\n // template.content is cloned iff `deep`.\n if (deep) {\n fixClonedDom(dom, this);\n }\n return dom;\n };\n\n // NOTE: we are cloning instead of importing <template>'s.\n // However, the ownerDocument of the cloned template will be correct!\n // This is because the native import node creates the right document owned\n // subtree and `fixClonedDom` inserts cloned templates into this subtree,\n // thus updating the owner doc.\n var importNode = Document.prototype.importNode = function importNode(element, deep) {\n deep = deep || false;\n if (element.localName === TEMPLATE_TAG) {\n return PolyfilledHTMLTemplateElement._cloneNode(element, deep);\n } else {\n var dom = capturedImportNode.call(this, element, deep);\n if (deep) {\n fixClonedDom(dom, element);\n fixClonedScripts(dom);\n }\n return dom;\n }\n };\n }\n\n if (needsTemplate) {\n window.HTMLTemplateElement = PolyfilledHTMLTemplateElement;\n }\n\n})();\n","import promiseFinally from './finally';\n\n// Store setTimeout reference so promise-polyfill will be unaffected by\n// other code modifying setTimeout (like sinon.useFakeTimers())\nvar setTimeoutFunc = setTimeout;\n\nfunction noop() {}\n\n// Polyfill for Function.prototype.bind\nfunction bind(fn, thisArg) {\n return function() {\n fn.apply(thisArg, arguments);\n };\n}\n\n/**\n * @constructor\n * @param {Function} fn\n */\nfunction Promise(fn) {\n if (!(this instanceof Promise))\n throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function') throw new TypeError('not a function');\n /** @type {!number} */\n this._state = 0;\n /** @type {!boolean} */\n this._handled = false;\n /** @type {Promise|undefined} */\n this._value = undefined;\n /** @type {!Array<!Function>} */\n this._deferreds = [];\n\n doResolve(fn, this);\n}\n\nfunction handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function() {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n}\n\nfunction resolve(self, newValue) {\n try {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self)\n throw new TypeError('A promise cannot be resolved with itself.');\n if (\n newValue &&\n (typeof newValue === 'object' || typeof newValue === 'function')\n ) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n}\n\nfunction reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n}\n\nfunction finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function() {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n}\n\n/**\n * @constructor\n */\nfunction Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n}\n\n/**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\nfunction doResolve(fn, self) {\n var done = false;\n try {\n fn(\n function(value) {\n if (done) return;\n done = true;\n resolve(self, value);\n },\n function(reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n }\n );\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n}\n\nPromise.prototype['catch'] = function(onRejected) {\n return this.then(null, onRejected);\n};\n\nPromise.prototype.then = function(onFulfilled, onRejected) {\n // @ts-ignore\n var prom = new this.constructor(noop);\n\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n};\n\nPromise.prototype['finally'] = promiseFinally;\n\nPromise.all = function(arr) {\n return new Promise(function(resolve, reject) {\n if (!arr || typeof arr.length === 'undefined')\n throw new TypeError('Promise.all accepts an array');\n var args = Array.prototype.slice.call(arr);\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(\n val,\n function(val) {\n res(i, val);\n },\n reject\n );\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n};\n\nPromise.resolve = function(value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n\n return new Promise(function(resolve) {\n resolve(value);\n });\n};\n\nPromise.reject = function(value) {\n return new Promise(function(resolve, reject) {\n reject(value);\n });\n};\n\nPromise.race = function(values) {\n return new Promise(function(resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n};\n\n// Use polyfill for setImmediate for performance gains\nPromise._immediateFn =\n (typeof setImmediate === 'function' &&\n function(fn) {\n setImmediate(fn);\n }) ||\n function(fn) {\n setTimeoutFunc(fn, 0);\n };\n\nPromise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\n }\n};\n\nexport default Promise;\n","/**\n * @this {Promise}\n */\nfunction finallyConstructor(callback) {\n var constructor = this.constructor;\n return this.then(\n function(value) {\n return constructor.resolve(callback()).then(function() {\n return value;\n });\n },\n function(reason) {\n return constructor.resolve(callback()).then(function() {\n return constructor.reject(reason);\n });\n }\n );\n}\n\nexport default finallyConstructor;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport PromisePolyfill from '../node_modules/promise-polyfill/src/index.js';\n\nif (!window.Promise) {\n window.Promise = PromisePolyfill;\n // save Promise API that is removed by closure compiler\n // catch and finally are safe, as they are stringified in the library source\n /* eslint-disable no-self-assign */\n PromisePolyfill.prototype['then'] = PromisePolyfill.prototype.then;\n PromisePolyfill['all'] = PromisePolyfill.all;\n PromisePolyfill['race'] = PromisePolyfill.race;\n PromisePolyfill['resolve'] = PromisePolyfill.resolve;\n PromisePolyfill['reject'] = PromisePolyfill.reject;\n /* eslint-enable */\n\n // approach copied from https://github.com/Polymer/polymer/blob/v3.0.2/lib/utils/async.js\n const node = document.createTextNode('');\n const twiddleNode = function twiddleNode() {\n node.textContent = node.textContent.length > 0 ? '' : 'a';\n };\n /** @type {!Array<function():void>} */\n const callbacks = [];\n (new MutationObserver(() => {\n const len = callbacks.length;\n for (let i = 0; i < len; i++) {\n callbacks[i]();\n }\n callbacks.splice(0, len);\n }).observe(node, {characterData: true}));\n\n // set _immediateFn to a MutationObserver for close-to-native timing\n PromisePolyfill._immediateFn = (fn) => {\n callbacks.push(fn);\n twiddleNode();\n };\n}\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n(scope => {\n\n /********************* base setup *********************/\n const link = document.createElement('link');\n const useNative = Boolean('import' in link);\n const emptyNodeList = link.querySelectorAll('*');\n\n // Polyfill `currentScript` for browsers without it.\n let currentScript = null;\n if ('currentScript' in document === false) {\n Object.defineProperty(document, 'currentScript', {\n get() {\n return currentScript ||\n // NOTE: only works when called in synchronously executing code.\n // readyState should check if `loading` but IE10 is\n // interactive when scripts run so we cheat. This is not needed by\n // html-imports polyfill but helps generally polyfill `currentScript`.\n (document.readyState !== 'complete' ?\n document.scripts[document.scripts.length - 1] : null);\n },\n configurable: true\n });\n }\n\n /**\n * @param {Array|NodeList|NamedNodeMap} list\n * @param {!Function} callback\n * @param {boolean=} inverseOrder\n */\n const forEach = (list, callback, inverseOrder) => {\n const length = list ? list.length : 0;\n const increment = inverseOrder ? -1 : 1;\n let i = inverseOrder ? length - 1 : 0;\n for (; i < length && i >= 0; i = i + increment) {\n callback(list[i], i);\n }\n };\n\n /**\n * @param {!Node} node\n * @param {!string} selector\n * @return {!NodeList<!Element>}\n */\n const QSA = (node, selector) => {\n // IE 11 throws a SyntaxError if a node with no children is queried with\n // a selector containing the `:not([type])` syntax.\n if (!node.childNodes.length) {\n return emptyNodeList;\n }\n return node.querySelectorAll(selector);\n };\n\n /**\n * @param {!DocumentFragment} fragment\n */\n const replaceScripts = (fragment) => {\n forEach(QSA(fragment, 'template'), template => {\n forEach(QSA(template.content, scriptsSelector), script => {\n const clone = /** @type {!HTMLScriptElement} */\n (document.createElement('script'));\n forEach(script.attributes, attr => clone.setAttribute(attr.name, attr.value));\n clone.textContent = script.textContent;\n script.parentNode.replaceChild(clone, script);\n });\n replaceScripts(template.content);\n });\n };\n\n /********************* path fixup *********************/\n const CSS_URL_REGEXP = /(url\\()([^)]*)(\\))/g;\n const CSS_IMPORT_REGEXP = /(@import[\\s]+(?!url\\())([^;]*)(;)/g;\n const STYLESHEET_REGEXP = /(<link[^>]*)(rel=['|\"]?stylesheet['|\"]?[^>]*>)/g;\n\n // path fixup: style elements in imports must be made relative to the main\n // document. We fixup url's in url() and @import.\n const Path = {\n\n fixUrls(element, base) {\n if (element.href) {\n element.setAttribute('href',\n Path.resolveUrl(element.getAttribute('href'), base));\n }\n if (element.src) {\n element.setAttribute('src',\n Path.resolveUrl(element.getAttribute('src'), base));\n }\n if (element.localName === 'style') {\n const r = Path.replaceUrls(element.textContent, base, CSS_URL_REGEXP);\n element.textContent = Path.replaceUrls(r, base, CSS_IMPORT_REGEXP);\n }\n },\n\n replaceUrls(text, linkUrl, regexp) {\n return text.replace(regexp, (m, pre, url, post) => {\n let urlPath = url.replace(/[\"']/g, '');\n if (linkUrl) {\n urlPath = Path.resolveUrl(urlPath, linkUrl);\n }\n return pre + '\\'' + urlPath + '\\'' + post;\n });\n },\n\n resolveUrl(url, base) {\n // Lazy feature detection.\n if (Path.__workingURL === undefined) {\n Path.__workingURL = false;\n try {\n const u = new URL('b', 'http://a');\n u.pathname = 'c%20d';\n Path.__workingURL = (u.href === 'http://a/c%20d');\n } catch (e) {}\n }\n\n if (Path.__workingURL) {\n return (new URL(url, base)).href;\n }\n\n // Fallback to creating an anchor into a disconnected document.\n let doc = Path.__tempDoc;\n if (!doc) {\n doc = document.implementation.createHTMLDocument('temp');\n Path.__tempDoc = doc;\n doc.__base = doc.createElement('base');\n doc.head.appendChild(doc.__base);\n doc.__anchor = doc.createElement('a');\n }\n doc.__base.href = base;\n doc.__anchor.href = url;\n return doc.__anchor.href || url;\n }\n };\n\n /********************* Xhr processor *********************/\n const Xhr = {\n\n async: true,\n\n /**\n * @param {!string} url\n * @param {!function(!string, string=)} success\n * @param {!function(!string)} fail\n */\n load(url, success, fail) {\n if (!url) {\n fail('error: href must be specified');\n } else if (url.match(/^data:/)) {\n // Handle Data URI Scheme\n const pieces = url.split(',');\n const header = pieces[0];\n let resource = pieces[1];\n if (header.indexOf(';base64') > -1) {\n resource = atob(resource);\n } else {\n resource = decodeURIComponent(resource);\n }\n success(resource);\n } else {\n const request = new XMLHttpRequest();\n request.open('GET', url, Xhr.async);\n request.onload = () => {\n // Servers redirecting an import can add a Location header to help us\n // polyfill correctly. Handle relative and full paths.\n // Prefer responseURL which already resolves redirects\n // https://xhr.spec.whatwg.org/#the-responseurl-attribute\n let redirectedUrl = request.responseURL || request.getResponseHeader('Location');\n if (redirectedUrl && redirectedUrl.indexOf('/') === 0) {\n // In IE location.origin might not work\n // https://connect.microsoft.com/IE/feedback/details/1763802/location-origin-is-undefined-in-ie-11-on-windows-10-but-works-on-windows-7\n const origin = (location.origin || location.protocol + '//' + location.host);\n redirectedUrl = origin + redirectedUrl;\n }\n const resource = /** @type {string} */ (request.response || request.responseText);\n if (request.status === 304 || request.status === 0 ||\n request.status >= 200 && request.status < 300) {\n success(resource, redirectedUrl);\n } else {\n fail(resource);\n }\n };\n request.send();\n }\n }\n };\n\n /********************* importer *********************/\n\n const isIE = /Trident/.test(navigator.userAgent) ||\n /Edge\\/\\d./i.test(navigator.userAgent);\n\n const importSelector = 'link[rel=import]';\n\n // Used to disable loading of resources.\n const importDisableType = 'import-disable';\n\n const disabledLinkSelector = `link[rel=stylesheet][href][type=${importDisableType}]`;\n\n const scriptsSelector = `script:not([type]),script[type=\"application/javascript\"],` +\n `script[type=\"text/javascript\"],script[type=\"module\"]`;\n\n const importDependenciesSelector = `${importSelector},${disabledLinkSelector},` +\n `style:not([type]),link[rel=stylesheet][href]:not([type]),` + scriptsSelector;\n\n const importDependencyAttr = 'import-dependency';\n\n const rootImportSelector = `${importSelector}:not([${importDependencyAttr}])`;\n\n const pendingScriptsSelector = `script[${importDependencyAttr}]`;\n\n const pendingStylesSelector = `style[${importDependencyAttr}],` +\n `link[rel=stylesheet][${importDependencyAttr}]`;\n\n /**\n * Importer will:\n * - load any linked import documents (with deduping)\n * - whenever an import is loaded, prompt the parser to try to parse\n * - observe imported documents for new elements (these are handled via the\n * dynamic importer)\n */\n class Importer {\n constructor() {\n this.documents = {};\n // Used to keep track of pending loads, so that flattening and firing of\n // events can be done when all resources are ready.\n this.inflight = 0;\n this.dynamicImportsMO = new MutationObserver(m => this.handleMutations(m));\n // Observe changes on <head>.\n this.dynamicImportsMO.observe(document.head, {\n childList: true,\n subtree: true\n });\n // 1. Load imports contents\n // 2. Assign them to first import links on the document\n // 3. Wait for import styles & scripts to be done loading/running\n // 4. Fire load/error events\n this.loadImports(document);\n }\n\n /**\n * @param {!(HTMLDocument|DocumentFragment|Element)} doc\n */\n loadImports(doc) {\n const links = /** @type {!NodeList<!HTMLLinkElement>} */\n (QSA(doc, importSelector));\n forEach(links, link => this.loadImport(link));\n }\n\n /**\n * @param {!HTMLLinkElement} link\n */\n loadImport(link) {\n const url = link.href;\n // This resource is already being handled by another import.\n if (this.documents[url] !== undefined) {\n // If import is already loaded, we can safely associate it to the link\n // and fire the load/error event.\n const imp = this.documents[url];\n if (imp && imp['__loaded']) {\n link['__import'] = imp;\n this.fireEventIfNeeded(link);\n }\n return;\n }\n this.inflight++;\n // Mark it as pending to notify others this url is being loaded.\n this.documents[url] = 'pending';\n Xhr.load(url, (resource, redirectedUrl) => {\n const doc = this.makeDocument(resource, redirectedUrl || url);\n this.documents[url] = doc;\n this.inflight--;\n // Load subtree.\n this.loadImports(doc);\n this.processImportsIfLoadingDone();\n }, () => {\n // If load fails, handle error.\n this.documents[url] = null;\n this.inflight--;\n this.processImportsIfLoadingDone();\n });\n }\n\n /**\n * Creates a new document containing resource and normalizes urls accordingly.\n * @param {string=} resource\n * @param {string=} url\n * @return {!DocumentFragment}\n */\n makeDocument(resource, url) {\n if (!resource) {\n return document.createDocumentFragment();\n }\n\n if (isIE) {\n // <link rel=stylesheet> should be appended to <head>. Not doing so\n // in IE/Edge breaks the cascading order. We disable the loading by\n // setting the type before setting innerHTML to avoid loading\n // resources twice.\n resource = resource.replace(STYLESHEET_REGEXP, (match, p1, p2) => {\n if (match.indexOf('type=') === -1) {\n return `${p1} type=${importDisableType} ${p2}`;\n }\n return match;\n });\n }\n\n let content;\n const template = /** @type {!HTMLTemplateElement} */\n (document.createElement('template'));\n template.innerHTML = resource;\n if (template.content) {\n content = template.content;\n // Clone scripts inside templates since they won't execute when the\n // hosting template is cloned.\n replaceScripts(content);\n } else {\n // <template> not supported, create fragment and move content into it.\n content = document.createDocumentFragment();\n while (template.firstChild) {\n content.appendChild(template.firstChild);\n }\n }\n\n // Support <base> in imported docs. Resolve url and remove its href.\n const baseEl = content.querySelector('base');\n if (baseEl) {\n url = Path.resolveUrl(baseEl.getAttribute('href'), url);\n baseEl.removeAttribute('href');\n }\n\n const n$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)>} */\n (QSA(content, importDependenciesSelector));\n // For source map hints.\n let inlineScriptIndex = 0;\n forEach(n$, n => {\n // Listen for load/error events, then fix urls.\n whenElementLoaded(n);\n Path.fixUrls(n, url);\n // Mark for easier selectors.\n n.setAttribute(importDependencyAttr, '');\n // Generate source map hints for inline scripts.\n if (n.localName === 'script' && !n.src && n.textContent) {\n if(n.type === 'module') {\n throw new Error('Inline module scripts are not supported in HTML Imports.');\n }\n const num = inlineScriptIndex ? `-${inlineScriptIndex}` : '';\n const content = n.textContent + `\\n//# sourceURL=${url}${num}.js\\n`;\n // We use the src attribute so it triggers load/error events, and it's\n // easier to capture errors (e.g. parsing) like this.\n n.setAttribute('src', 'data:text/javascript;charset=utf-8,' + encodeURIComponent(content));\n n.textContent = '';\n inlineScriptIndex++;\n }\n });\n return content;\n }\n\n /**\n * Waits for loaded imports to finish loading scripts and styles, then fires\n * the load/error events.\n */\n processImportsIfLoadingDone() {\n // Wait until all resources are ready, then load import resources.\n if (this.inflight) return;\n\n // Stop observing, flatten & load resource, then restart observing <head>.\n this.dynamicImportsMO.disconnect();\n this.flatten(document);\n // We wait for styles to load, and at the same time we execute the scripts,\n // then fire the load/error events for imports to have faster whenReady\n // callback execution.\n // NOTE: This is different for native behavior where scripts would be\n // executed after the styles before them are loaded.\n // To achieve that, we could select pending styles and scripts in the\n // document and execute them sequentially in their dom order.\n let scriptsOk = false,\n stylesOk = false;\n const onLoadingDone = () => {\n if (stylesOk && scriptsOk) {\n // Catch any imports that might have been added while we\n // weren't looking, wait for them as well.\n this.loadImports(document);\n if (this.inflight) return;\n\n // Restart observing.\n this.dynamicImportsMO.observe(document.head, {\n childList: true,\n subtree: true\n });\n this.fireEvents();\n }\n }\n this.waitForStyles(() => {\n stylesOk = true;\n onLoadingDone();\n });\n this.runScripts(() => {\n scriptsOk = true;\n onLoadingDone();\n });\n }\n\n /**\n * @param {!HTMLDocument} doc\n */\n flatten(doc) {\n const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\n (QSA(doc, importSelector));\n forEach(n$, n => {\n const imp = this.documents[n.href];\n n['__import'] = /** @type {!Document} */ (imp);\n if (imp && imp.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n // We set the .import to be the link itself, and update its readyState.\n // Other links with the same href will point to this link.\n this.documents[n.href] = n;\n n.readyState = 'loading';\n n['__import'] = n;\n this.flatten(imp);\n n.appendChild(imp);\n }\n });\n }\n\n /**\n * Replaces all the imported scripts with a clone in order to execute them.\n * Updates the `currentScript`.\n * @param {!function()} callback\n */\n runScripts(callback) {\n const s$ = QSA(document, pendingScriptsSelector);\n const l = s$.length;\n const cloneScript = i => {\n if (i < l) {\n // The pending scripts have been generated through innerHTML and\n // browsers won't execute them for security reasons. We cannot use\n // s.cloneNode(true) either, the only way to run the script is manually\n // creating a new element and copying its attributes.\n const s = s$[i];\n const clone = /** @type {!HTMLScriptElement} */\n (document.createElement('script'));\n // Remove import-dependency attribute to avoid double cloning.\n s.removeAttribute(importDependencyAttr);\n forEach(s.attributes, attr => clone.setAttribute(attr.name, attr.value));\n // Update currentScript and replace original with clone script.\n currentScript = clone;\n s.parentNode.replaceChild(clone, s);\n whenElementLoaded(clone, () => {\n currentScript = null;\n cloneScript(i + 1);\n });\n } else {\n callback();\n }\n };\n cloneScript(0);\n }\n\n /**\n * Waits for all the imported stylesheets/styles to be loaded.\n * @param {!function()} callback\n */\n waitForStyles(callback) {\n const s$ = /** @type {!NodeList<!(HTMLLinkElement|HTMLStyleElement)>} */\n (QSA(document, pendingStylesSelector));\n let pending = s$.length;\n if (!pending) {\n callback();\n return;\n }\n // <link rel=stylesheet> should be appended to <head>. Not doing so\n // in IE/Edge breaks the cascading order\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10472273/\n // If there is one <link rel=stylesheet> imported, we must move all imported\n // links and styles to <head>.\n const needsMove = isIE && !!document.querySelector(disabledLinkSelector);\n forEach(s$, s => {\n // Listen for load/error events, remove selector once is done loading.\n whenElementLoaded(s, () => {\n s.removeAttribute(importDependencyAttr);\n if (--pending === 0) {\n callback();\n }\n });\n // Check if was already moved to head, to handle the case where the element\n // has already been moved but it is still loading.\n if (needsMove && s.parentNode !== document.head) {\n // Replace the element we're about to move with a placeholder.\n const placeholder = document.createElement(s.localName);\n // Add reference of the moved element.\n placeholder['__appliedElement'] = s;\n // Disable this from appearing in document.styleSheets.\n placeholder.setAttribute('type', 'import-placeholder');\n // Append placeholder next to the sibling, and move original to <head>.\n s.parentNode.insertBefore(placeholder, s.nextSibling);\n let newSibling = importForElement(s);\n while (newSibling && importForElement(newSibling)) {\n newSibling = importForElement(newSibling);\n }\n if (newSibling.parentNode !== document.head) {\n newSibling = null;\n }\n document.head.insertBefore(s, newSibling);\n // Enable the loading of <link rel=stylesheet>.\n s.removeAttribute('type');\n }\n });\n }\n\n /**\n * Fires load/error events for imports in the right order .\n */\n fireEvents() {\n const n$ = /** @type {!NodeList<!HTMLLinkElement>} */\n (QSA(document, importSelector));\n // Inverse order to have events firing bottom-up.\n forEach(n$, n => this.fireEventIfNeeded(n), true);\n }\n\n /**\n * Fires load/error event for the import if this wasn't done already.\n * @param {!HTMLLinkElement} link\n */\n fireEventIfNeeded(link) {\n // Don't fire twice same event.\n if (!link['__loaded']) {\n link['__loaded'] = true;\n // Update link's import readyState.\n link.import && (link.import.readyState = 'complete');\n const eventType = link.import ? 'load' : 'error';\n link.dispatchEvent(newCustomEvent(eventType, {\n bubbles: false,\n cancelable: false,\n detail: undefined\n }));\n }\n }\n\n /**\n * @param {Array<MutationRecord>} mutations\n */\n handleMutations(mutations) {\n forEach(mutations, m => forEach(m.addedNodes, elem => {\n if (elem && elem.nodeType === Node.ELEMENT_NODE) {\n // NOTE: added scripts are not updating currentScript in IE.\n if (isImportLink(elem)) {\n this.loadImport( /** @type {!HTMLLinkElement} */ (elem));\n } else {\n this.loadImports( /** @type {!Element} */ (elem));\n }\n }\n }));\n }\n }\n\n /**\n * @param {!Node} node\n * @return {boolean}\n */\n const isImportLink = node => {\n return node.nodeType === Node.ELEMENT_NODE && node.localName === 'link' &&\n ( /** @type {!HTMLLinkElement} */ (node).rel === 'import');\n };\n\n /**\n * Waits for an element to finish loading. If already done loading, it will\n * mark the element accordingly.\n * @param {!(HTMLLinkElement|HTMLScriptElement|HTMLStyleElement)} element\n * @param {function()=} callback\n */\n const whenElementLoaded = (element, callback) => {\n if (element['__loaded']) {\n callback && callback();\n } else if ((element.localName === 'script' && !element.src) ||\n (element.localName === 'style' && !element.firstChild)) {\n // Inline scripts and empty styles don't trigger load/error events,\n // consider them already loaded.\n element['__loaded'] = true;\n callback && callback();\n } else {\n const onLoadingDone = event => {\n element.removeEventListener(event.type, onLoadingDone);\n element['__loaded'] = true;\n callback && callback();\n };\n element.addEventListener('load', onLoadingDone);\n // NOTE: We listen only for load events in IE/Edge, because in IE/Edge\n // <style> with @import will fire error events for each failing @import,\n // and finally will trigger the load event when all @import are\n // finished (even if all fail).\n if (!isIE || element.localName !== 'style') {\n element.addEventListener('error', onLoadingDone);\n }\n }\n }\n\n /**\n * Calls the callback when all imports in the document at call time\n * (or at least document ready) have loaded. Callback is called synchronously\n * if imports are already done loading.\n * @param {function()=} callback\n */\n const whenReady = callback => {\n // 1. ensure the document is in a ready state (has dom), then\n // 2. watch for loading of imports and call callback when done\n whenDocumentReady(() => whenImportsReady(() => callback && callback()));\n }\n\n /**\n * Invokes the callback when document is in ready state. Callback is called\n * synchronously if document is already done loading.\n * @param {!function()} callback\n */\n const whenDocumentReady = callback => {\n const stateChanged = () => {\n // NOTE: Firefox can hit readystate interactive without document.body existing.\n // This is anti-spec, but we handle it here anyways by waiting for next change.\n if (document.readyState !== 'loading' && !!document.body) {\n document.removeEventListener('readystatechange', stateChanged);\n callback();\n }\n }\n document.addEventListener('readystatechange', stateChanged);\n stateChanged();\n }\n\n /**\n * Invokes the callback after all imports are loaded. Callback is called\n * synchronously if imports are already done loading.\n * @param {!function()} callback\n */\n const whenImportsReady = callback => {\n let imports = /** @type {!NodeList<!HTMLLinkElement>} */\n (QSA(document, rootImportSelector));\n let pending = imports.length;\n if (!pending) {\n callback();\n return;\n }\n forEach(imports, imp => whenElementLoaded(imp, () => {\n if (--pending === 0) {\n callback();\n }\n }));\n }\n\n /**\n * Returns the import document containing the element.\n * @param {!Node} element\n * @return {HTMLLinkElement|Document|undefined}\n */\n const importForElement = element => {\n if (useNative) {\n // Return only if not in the main doc!\n return element.ownerDocument !== document ? element.ownerDocument : null;\n }\n let doc = element['__importDoc'];\n if (!doc && element.parentNode) {\n doc = /** @type {!Element} */ (element.parentNode);\n if (typeof doc.closest === 'function') {\n // Element.closest returns the element itself if it matches the selector,\n // so we search the closest import starting from the parent.\n doc = doc.closest(importSelector);\n } else {\n // Walk up the parent tree until we find an import.\n while (!isImportLink(doc) && (doc = doc.parentNode)) {}\n }\n element['__importDoc'] = doc;\n }\n return doc;\n }\n\n let importer = null;\n /**\n * Ensures imports contained in the element are imported.\n * Use this to handle dynamic imports attached to body.\n * @param {!(HTMLDocument|Element)} doc\n */\n const loadImports = (doc) => {\n if (importer) {\n importer.loadImports(doc);\n }\n };\n\n const newCustomEvent = (type, params) => {\n if (typeof window.CustomEvent === 'function') {\n return new CustomEvent(type, params);\n }\n const event = /** @type {!CustomEvent} */ (document.createEvent('CustomEvent'));\n event.initCustomEvent(type, Boolean(params.bubbles), Boolean(params.cancelable), params.detail);\n return event;\n };\n\n if (useNative) {\n // Check for imports that might already be done loading by the time this\n // script is actually executed. Native imports are blocking, so the ones\n // available in the document by this time should already have failed\n // or have .import defined.\n const imps = /** @type {!NodeList<!HTMLLinkElement>} */\n (QSA(document, importSelector));\n forEach(imps, imp => {\n if (!imp.import || imp.import.readyState !== 'loading') {\n imp['__loaded'] = true;\n }\n });\n // Listen for load/error events to capture dynamically added scripts.\n /**\n * @type {!function(!Event)}\n */\n const onLoadingDone = event => {\n const elem = /** @type {!Element} */ (event.target);\n if (isImportLink(elem)) {\n elem['__loaded'] = true;\n }\n };\n document.addEventListener('load', onLoadingDone, true /* useCapture */ );\n document.addEventListener('error', onLoadingDone, true /* useCapture */ );\n } else {\n // Override baseURI so that imported elements' baseURI can be used seemlessly\n // on native or polyfilled html-imports.\n // NOTE: a <link rel=import> will have `link.baseURI === link.href`, as the link\n // itself is used as the `import` document.\n /** @type {Object|undefined} */\n const native_baseURI = Object.getOwnPropertyDescriptor(Node.prototype, 'baseURI');\n // NOTE: if not configurable (e.g. safari9), set it on the Element prototype.\n const klass = !native_baseURI || native_baseURI.configurable ? Node : Element;\n Object.defineProperty(klass.prototype, 'baseURI', {\n get() {\n const ownerDoc = /** @type {HTMLLinkElement} */ (isImportLink(this) ? this : importForElement(this));\n if (ownerDoc) return ownerDoc.href;\n // Use native baseURI if possible.\n if (native_baseURI && native_baseURI.get) return native_baseURI.get.call(this);\n // Polyfill it if not available.\n const base = /** @type {HTMLBaseElement} */ (document.querySelector('base'));\n return (base || window.location).href;\n },\n configurable: true,\n enumerable: true\n });\n\n // Define 'import' read-only property.\n Object.defineProperty(HTMLLinkElement.prototype, 'import', {\n get() {\n return /** @type {HTMLLinkElement} */ (this)['__import'] || null;\n },\n configurable: true,\n enumerable: true\n });\n\n whenDocumentReady(() => {\n importer = new Importer()\n });\n }\n\n /**\n Add support for the `HTMLImportsLoaded` event and the `HTMLImports.whenReady`\n method. This api is necessary because unlike the native implementation,\n script elements do not force imports to resolve. Instead, users should wrap\n code in either an `HTMLImportsLoaded` handler or after load time in an\n `HTMLImports.whenReady(callback)` call.\n\n NOTE: This module also supports these apis under the native implementation.\n Therefore, if this file is loaded, the same code can be used under both\n the polyfill and native implementation.\n */\n whenReady(() => document.dispatchEvent(newCustomEvent('HTMLImportsLoaded', {\n cancelable: true,\n bubbles: true,\n detail: undefined\n })));\n\n // exports\n scope.useNative = useNative;\n scope.whenReady = whenReady;\n scope.importForElement = importForElement;\n scope.loadImports = loadImports;\n\n})(window.HTMLImports = (window.HTMLImports || {}));","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nexport {};\n\n// Establish scope.\nwindow['WebComponents'] = window['WebComponents'] || {'flags':{}};\n\n// loading script\nlet file = 'webcomponents-lite.js';\nlet script = document.querySelector('script[src*=\"' + file + '\"]');\nlet flagMatcher = /wc-(.+)/;\n\n// Flags. Convert url arguments to flags\nlet flags = {};\nif (!flags['noOpts']) {\n // from url\n location.search.slice(1).split('&').forEach(function(option) {\n let parts = option.split('=');\n let match;\n if (parts[0] && (match = parts[0].match(flagMatcher))) {\n flags[match[1]] = parts[1] || true;\n }\n });\n // from script\n if (script) {\n for (let i=0, a; (a=script.attributes[i]); i++) {\n if (a.name !== 'src') {\n flags[a.name] = a.value || true;\n }\n }\n }\n // log flags\n if (flags['log'] && flags['log']['split']) {\n let parts = flags['log'].split(',');\n flags['log'] = {};\n parts.forEach(function(f) {\n flags['log'][f] = true;\n });\n } else {\n flags['log'] = {};\n }\n}\n\n// exports\nwindow['WebComponents']['flags'] = flags;\nlet forceShady = flags['shadydom'];\nif (forceShady) {\n window['ShadyDOM'] = window['ShadyDOM'] || {};\n window['ShadyDOM']['force'] = forceShady;\n}\n\nlet forceCE = flags['register'] || flags['ce'];\nif (forceCE && window['customElements']) {\n window['customElements']['forcePolyfill'] = forceCE;\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n\nexport class ShadyData {\n constructor() {\n /** @type {ShadowRoot} */\n this.root = null;\n /** @type {ShadowRoot} */\n this.publicRoot = null;\n this.dirty = false;\n this.observer = null;\n /** @type {Array<Node>} */\n this.assignedNodes = null;\n /** @type {Element} */\n this.assignedSlot = null;\n /** @type {Array<Node>} */\n this._previouslyAssignedNodes = null;\n /** @type {Element} */\n this._prevAssignedSlot = null;\n /** @type {Array<Node>} */\n this.flattenedNodes = null;\n this.ownerShadyRoot = undefined;\n /** @type {Node|undefined} */\n this.parentNode = undefined;\n /** @type {Node|undefined} */\n this.firstChild = undefined;\n /** @type {Node|undefined} */\n this.lastChild = undefined;\n /** @type {Node|undefined} */\n this.previousSibling = undefined;\n /** @type {Node|undefined} */\n this.nextSibling = undefined;\n /** @type {Array<Node>|undefined} */\n this.childNodes = undefined;\n this.__outsideAccessors = false;\n this.__insideAccessors = false;\n this.__onCallbackListeners = {};\n }\n\n /** @override */\n toJSON() {\n return {};\n }\n}\n\nexport function ensureShadyDataForNode(node) {\n if (!node.__shady) {\n node.__shady = new ShadyData();\n }\n return node.__shady;\n}\n\nexport function shadyDataForNode(node) {\n return node && node.__shady;\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\nimport {shadyDataForNode} from './shady-data.js';\n\n/** @type {!Object} */\nexport const settings = window['ShadyDOM'] || {};\n\nsettings.hasNativeShadowDOM = Boolean(Element.prototype.attachShadow && Node.prototype.getRootNode);\n\nconst desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild');\n\nsettings.hasDescriptors = Boolean(desc && desc.configurable && desc.get);\nsettings.inUse = settings['force'] || !settings.hasNativeShadowDOM;\nsettings.noPatch = settings['noPatch'] || false;\nsettings.preferPerformance = settings['preferPerformance'];\n\nexport const isTrackingLogicalChildNodes = (node) => {\n const nodeData = shadyDataForNode(node);\n return (nodeData && nodeData.firstChild !== undefined);\n}\n\nexport const isShadyRoot = (obj) => {\n return Boolean(obj._localName === 'ShadyRoot');\n}\n\nexport const hasShadowRootWithSlot = (node) => {\n const nodeData = shadyDataForNode(node);\n let root = nodeData && nodeData.root;\n return (root && root._hasInsertionPoint());\n}\n\nlet p = Element.prototype;\nlet matches = p.matches || p.matchesSelector ||\n p.mozMatchesSelector || p.msMatchesSelector ||\n p.oMatchesSelector || p.webkitMatchesSelector;\n\nexport const matchesSelector = (element, selector) => {\n return matches.call(element, selector);\n}\n\nexport const mixin = (target, source) => {\n for (var i in source) {\n target[i] = source[i];\n }\n return target;\n}\n\n// NOTE, prefer MutationObserver over Promise for microtask timing\n// for consistency x-platform.\nlet twiddle = document.createTextNode('');\nlet content = 0;\nlet queue = [];\nnew MutationObserver(() => {\n while (queue.length) {\n // catch errors in user code...\n try {\n queue.shift()();\n } catch(e) {\n // enqueue another record and throw\n twiddle.textContent = content++;\n throw(e);\n }\n }\n}).observe(twiddle, {characterData: true});\n\n// use MutationObserver to get microtask async timing.\nexport const microtask = (callback) => {\n queue.push(callback);\n twiddle.textContent = content++;\n}\n\nexport const hasDocumentContains = Boolean(document.contains);\n\nexport const contains = (container, node) => {\n while (node) {\n if (node == container) {\n return true;\n }\n node = node[SHADY_PREFIX + 'parentNode'];\n }\n return false;\n}\n\nconst getNodeHTMLCollectionName = (node) =>\n node.getAttribute('id') || node.getAttribute('name');\n\nconst isValidHTMLCollectionName = (name) => name !== 'length' && isNaN(name);\n\nexport const createPolyfilledHTMLCollection = (nodes) => {\n // Note: loop in reverse so that the first named item matches the named property\n for (let l = nodes.length - 1; l >= 0; l--) {\n const node = nodes[l];\n const name = getNodeHTMLCollectionName(node);\n\n if (name && isValidHTMLCollectionName(name)) {\n nodes[name] = node;\n }\n }\n nodes.item = function(index) {\n return nodes[index];\n }\n nodes.namedItem = function(name) {\n if (isValidHTMLCollectionName(name) && nodes[name]) {\n return nodes[name];\n }\n\n for (const node of nodes) {\n const nodeName = getNodeHTMLCollectionName(node);\n\n if (nodeName == name) {\n return node;\n }\n }\n\n return null;\n };\n return nodes;\n}\n\nexport const NATIVE_PREFIX = '__shady_native_';\nexport const SHADY_PREFIX = '__shady_';\n\n\n\n/**\n * Patch a group of accessors on an object only if it exists or if the `force`\n * argument is true.\n * @param {!Object} proto\n * @param {!Object} descriptors\n * @param {string=} prefix\n * @param {Array=} disallowedPatches\n */\nexport const patchProperties = (proto, descriptors, prefix = '', disallowedPatches) => {\n for (let p in descriptors) {\n const newDescriptor = descriptors[p];\n if (disallowedPatches && disallowedPatches.indexOf(p) >= 0) {\n continue;\n }\n newDescriptor.configurable = true;\n const name = prefix + p;\n // NOTE: we prefer writing directly because some browsers\n // have descriptors that are writable but not configurable (e.g.\n // `appendChild` on older browsers)\n if (newDescriptor.value) {\n proto[name] = newDescriptor.value;\n } else {\n // NOTE: this can throw if 'force' is used so catch the error.\n try {\n Object.defineProperty(proto, name, newDescriptor);\n } catch(e) {\n // this error is harmless so we just trap it.\n }\n }\n }\n}\n\n/** @type {!function(new:HTMLElement)} */\nexport const NativeHTMLElement =\n (window['customElements'] && window['customElements']['nativeHTMLElement']) ||\n HTMLElement;\n\n// note, this is not a perfect polyfill since it doesn't include symbols\n/** @return {!Object<!ObjectPropertyDescriptor>} */\nexport const getOwnPropertyDescriptors = (obj) => {\n const descriptors = {};\n Object.getOwnPropertyNames(obj).forEach((name) => {\n descriptors[name] = Object.getOwnPropertyDescriptor(obj, name);\n });\n return descriptors;\n};\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\n\n// render enqueuer/flusher\nlet flushList = [];\nlet scheduled;\nexport function enqueue(callback) {\n if (!scheduled) {\n scheduled = true;\n utils.microtask(flush);\n }\n flushList.push(callback);\n}\n\nexport function flush() {\n scheduled = false;\n let didFlush = Boolean(flushList.length);\n while (flushList.length) {\n flushList.shift()();\n }\n return didFlush;\n}\n\nflush['list'] = flushList;\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {ensureShadyDataForNode} from './shady-data.js';\n\nclass AsyncObserver {\n\n constructor() {\n this._scheduled = false;\n this.addedNodes = [];\n this.removedNodes = [];\n this.callbacks = new Set();\n }\n\n schedule() {\n if (!this._scheduled) {\n this._scheduled = true;\n utils.microtask(() => {\n this.flush();\n });\n }\n }\n\n flush() {\n if (this._scheduled) {\n this._scheduled = false;\n let mutations = this.takeRecords();\n if (mutations.length) {\n this.callbacks.forEach(function(cb) {\n cb(mutations);\n });\n }\n }\n }\n\n takeRecords() {\n if (this.addedNodes.length || this.removedNodes.length) {\n let mutations = [{\n addedNodes: this.addedNodes,\n removedNodes: this.removedNodes\n }];\n this.addedNodes = [];\n this.removedNodes = [];\n return mutations;\n }\n return [];\n }\n\n}\n\n// TODO(sorvell): consider instead polyfilling MutationObserver\n// directly so that users do not have to fork their code.\n// Supporting the entire api may be challenging: e.g. filtering out\n// removed nodes in the wrong scope and seeing non-distributing\n// subtree child mutations.\nexport let observeChildren = function(node, callback) {\n const sd = ensureShadyDataForNode(node);\n if (!sd.observer) {\n sd.observer = new AsyncObserver();\n }\n sd.observer.callbacks.add(callback);\n let observer = sd.observer;\n return {\n _callback: callback,\n _observer: observer,\n _node: node,\n takeRecords() {\n return observer.takeRecords()\n }\n };\n}\n\nexport let unobserveChildren = function(handle) {\n let observer = handle && handle._observer;\n if (observer) {\n observer.callbacks.delete(handle._callback);\n if (!observer.callbacks.size) {\n ensureShadyDataForNode(handle._node).observer = null;\n }\n }\n}\n\nexport function filterMutations(mutations, target) {\n /** @const {Node} */\n const targetRootNode = target.getRootNode();\n return mutations.map(function(mutation) {\n /** @const {boolean} */\n const mutationInScope = (targetRootNode === mutation.target.getRootNode());\n if (mutationInScope && mutation.addedNodes) {\n let nodes = Array.from(mutation.addedNodes).filter(function(n) {\n return (targetRootNode === n.getRootNode());\n });\n if (nodes.length) {\n mutation = Object.create(mutation);\n Object.defineProperty(mutation, 'addedNodes', {\n value: nodes,\n configurable: true\n });\n return mutation;\n }\n } else if (mutationInScope) {\n return mutation;\n }\n }).filter(function(m) { return m});\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n// Cribbed from ShadowDOM polyfill\n// https://github.com/webcomponents/webcomponentsjs/blob/master/src/ShadowDOM/wrappers/HTMLElement.js#L28\n/////////////////////////////////////////////////////////////////////////////\n// innerHTML and outerHTML\n\n// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString\nlet escapeAttrRegExp = /[&\\u00A0\"]/g;\nlet escapeDataRegExp = /[&\\u00A0<>]/g;\n\nfunction escapeReplace(c) {\n switch (c) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case '\\u00A0':\n return ' ';\n }\n}\n\nfunction escapeAttr(s) {\n return s.replace(escapeAttrRegExp, escapeReplace);\n}\n\nfunction escapeData(s) {\n return s.replace(escapeDataRegExp, escapeReplace);\n}\n\nfunction makeSet(arr) {\n let set = {};\n for (let i = 0; i < arr.length; i++) {\n set[arr[i]] = true;\n }\n return set;\n}\n\n// http://www.whatwg.org/specs/web-apps/current-work/#void-elements\nlet voidElements = makeSet([\n 'area',\n 'base',\n 'br',\n 'col',\n 'command',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'keygen',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr'\n]);\n\nlet plaintextParents = makeSet([\n 'style',\n 'script',\n 'xmp',\n 'iframe',\n 'noembed',\n 'noframes',\n 'plaintext',\n 'noscript'\n]);\n\n/**\n * @param {Node} node\n * @param {Node} parentNode\n * @param {Function=} callback\n */\nexport function getOuterHTML(node, parentNode, callback) {\n switch (node.nodeType) {\n case Node.ELEMENT_NODE: {\n let tagName = node.localName;\n let s = '<' + tagName;\n let attrs = node.attributes;\n for (let i = 0, attr; (attr = attrs[i]); i++) {\n s += ' ' + attr.name + '=\"' + escapeAttr(attr.value) + '\"';\n }\n s += '>';\n if (voidElements[tagName]) {\n return s;\n }\n return s + getInnerHTML(node, callback) + '</' + tagName + '>';\n }\n case Node.TEXT_NODE: {\n let data = /** @type {Text} */ (node).data;\n if (parentNode && plaintextParents[parentNode.localName]) {\n return data;\n }\n return escapeData(data);\n }\n case Node.COMMENT_NODE: {\n return '<!--' + /** @type {Comment} */ (node).data + '-->';\n }\n default: {\n window.console.error(node);\n throw new Error('not implemented');\n }\n }\n}\n\n/**\n * @param {Node} node\n * @param {Function=} callback\n */\nexport function getInnerHTML(node, callback) {\n if (node.localName === 'template') {\n node = /** @type {HTMLTemplateElement} */ (node).content;\n }\n let s = '';\n let c$ = callback ? callback(node) : node.childNodes;\n for (let i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) {\n s += getOuterHTML(child, node, callback);\n }\n return s;\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\nimport * as utils from './utils.js';\nimport {patchProperties} from './utils.js';\nimport {getInnerHTML} from './innerHTML.js';\n\nconst hasDescriptors = utils.settings.hasDescriptors;\nexport const NATIVE_PREFIX = utils.NATIVE_PREFIX;\n\n// Object on which raw native methods are stored.\n// e.g. `nativeMethods.querySelector.call(node, selector)`\n// same as `node.querySelector(selector)`\nexport const nativeMethods = {\n /** @this {Element} */\n querySelector(selector) {\n return this[NATIVE_PREFIX + 'querySelector'](selector);\n },\n /** @this {Element} */\n querySelectorAll(selector) {\n return this[NATIVE_PREFIX + 'querySelectorAll'](selector);\n }\n};\n// Object on which raw native accessors are available via `accessorName(node)`.\n// e.g. `nativeTree.firstChild(node)`\n// same as `node.firstChild`\nexport const nativeTree = {};\n\nconst installNativeAccessor = (name) => {\n nativeTree[name] = (node) => node[NATIVE_PREFIX + name];\n}\n\nconst installNativeMethod = (name, fn) => {\n if (!nativeMethods[name]) {\n nativeMethods[name] = fn;\n }\n}\n\n\nconst defineNativeAccessors = (proto, descriptors) => {\n patchProperties(proto, descriptors, NATIVE_PREFIX);\n // make native accessors available to users\n for (let prop in descriptors) {\n installNativeAccessor(prop);\n }\n}\n\nconst copyProperties = (proto, list = []) => {\n for (let i = 0; i < list.length; i++) {\n const name = list[i];\n const descriptor = Object.getOwnPropertyDescriptor(proto, name);\n if (descriptor) {\n Object.defineProperty(proto, NATIVE_PREFIX + name, descriptor);\n // make native methods/accessors available to users\n if (descriptor.value) {\n installNativeMethod(name, descriptor.value);\n } else {\n installNativeAccessor(name);\n\n }\n }\n }\n}\n\n/** @type {!TreeWalker} */\nconst nodeWalker = document.createTreeWalker(document, NodeFilter.SHOW_ALL,\n null, false);\n\n/** @type {!TreeWalker} */\nconst elementWalker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT,\n null, false);\n\n/** @type {!Document} */\nconst inertDoc = document.implementation.createHTMLDocument('inert');\n\nconst clearNode = node => {\n let firstChild;\n while ((firstChild = node[NATIVE_PREFIX + 'firstChild'])) {\n node[NATIVE_PREFIX + 'removeChild'](firstChild);\n }\n}\n\nconst ParentNodeAccessors = [\n 'firstElementChild',\n 'lastElementChild',\n 'children',\n 'childElementCount',\n];\n\nconst ParentNodeMethods = [\n 'querySelector',\n 'querySelectorAll'\n // 'append', 'prepend'\n];\n\nexport const addNativePrefixedProperties = () => {\n\n // EventTarget\n const eventProps = [\n 'dispatchEvent',\n 'addEventListener',\n 'removeEventListener'\n ];\n if (window.EventTarget) {\n copyProperties(window.EventTarget.prototype, eventProps);\n } else {\n copyProperties(Node.prototype, eventProps);\n copyProperties(Window.prototype, eventProps);\n }\n\n\n // Node\n if (hasDescriptors) {\n copyProperties(Node.prototype, [\n 'parentNode',\n 'firstChild',\n 'lastChild',\n 'previousSibling',\n 'nextSibling',\n 'childNodes',\n 'parentElement',\n 'textContent',\n ]);\n } else {\n defineNativeAccessors(Node.prototype, {\n parentNode: {\n /** @this {Node} */\n get() {\n nodeWalker.currentNode = this;\n return nodeWalker.parentNode();\n }\n },\n firstChild: {\n /** @this {Node} */\n get() {\n nodeWalker.currentNode = this;\n return nodeWalker.firstChild();\n }\n },\n lastChild: {\n /** @this {Node} */\n get() {\n nodeWalker.currentNode = this;\n return nodeWalker.lastChild();\n }\n\n },\n previousSibling: {\n /** @this {Node} */\n get() {\n nodeWalker.currentNode = this;\n return nodeWalker.previousSibling();\n }\n },\n nextSibling: {\n /** @this {Node} */\n get() {\n nodeWalker.currentNode = this;\n return nodeWalker.nextSibling();\n }\n },\n // TODO(sorvell): make this a NodeList or whatever\n childNodes: {\n /** @this {Node} */\n get() {\n const nodes = [];\n nodeWalker.currentNode = this;\n let n = nodeWalker.firstChild();\n while (n) {\n nodes.push(n);\n n = nodeWalker.nextSibling();\n }\n return nodes;\n }\n },\n parentElement: {\n /** @this {Node} */\n get() {\n elementWalker.currentNode = this;\n return elementWalker.parentNode();\n }\n },\n textContent: {\n /** @this {Node} */\n get() {\n /* eslint-disable no-case-declarations */\n switch (this.nodeType) {\n case Node.ELEMENT_NODE:\n case Node.DOCUMENT_FRAGMENT_NODE:\n // TODO(sorvell): This cannot be a single TreeWalker that's reused\n // at least for Safari 9, but it's unclear why.\n const textWalker = document.createTreeWalker(this, NodeFilter.SHOW_TEXT,\n null, false);\n let content = '', n;\n while ( (n = textWalker.nextNode()) ) {\n // TODO(sorvell): can't use textContent since we patch it on Node.prototype!\n // However, should probably patch it only on element.\n content += n.nodeValue;\n }\n return content;\n default:\n return this.nodeValue;\n }\n },\n // Needed on browsers that do not proper accessors (e.g. old versions of Chrome)\n /** @this {Node} */\n set(value) {\n if (typeof value === 'undefined' || value === null) {\n value = ''\n }\n switch (this.nodeType) {\n case Node.ELEMENT_NODE:\n case Node.DOCUMENT_FRAGMENT_NODE:\n clearNode(this);\n // Document fragments must have no childnodes if setting a blank string\n if (value.length > 0 || this.nodeType === Node.ELEMENT_NODE) {\n // Note: old Chrome versions require 2nd argument here\n this[NATIVE_PREFIX + 'insertBefore'](document.createTextNode(value), undefined);\n }\n break;\n default:\n // TODO(sorvell): can't do this if patch nodeValue.\n this.nodeValue = value;\n break;\n }\n }\n }\n });\n }\n\n copyProperties(Node.prototype, [\n 'appendChild',\n 'insertBefore',\n 'removeChild',\n 'replaceChild',\n 'cloneNode',\n 'contains'\n ]);\n\n const ParentNodeWalkerDescriptors = {\n firstElementChild: {\n /** @this {ParentNode} */\n get() {\n elementWalker.currentNode = this;\n return elementWalker.firstChild();\n }\n },\n lastElementChild: {\n /** @this {ParentNode} */\n get() {\n elementWalker.currentNode = this;\n return elementWalker.lastChild();\n }\n },\n children: {\n /** @this {ParentNode} */\n get() {\n let nodes = [];\n elementWalker.currentNode = this;\n let n = elementWalker.firstChild();\n while (n) {\n nodes.push(n);\n n = elementWalker.nextSibling();\n }\n return utils.createPolyfilledHTMLCollection(nodes);\n }\n },\n childElementCount: {\n /** @this {ParentNode} */\n get() {\n if (this.children) {\n return this.children.length;\n }\n return 0;\n }\n }\n };\n\n // Element\n if (hasDescriptors) {\n copyProperties(Element.prototype, ParentNodeAccessors);\n\n copyProperties(Element.prototype, [\n 'previousElementSibling',\n 'nextElementSibling',\n 'innerHTML'\n ]);\n\n // NOTE, on IE 11 / Edge 15 children and/or innerHTML are on HTMLElement instead of Element\n if (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'children')) {\n copyProperties(HTMLElement.prototype, [\n 'children'\n ]);\n }\n if (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML')) {\n copyProperties(HTMLElement.prototype, [\n 'innerHTML'\n ]);\n }\n } else {\n defineNativeAccessors(Element.prototype, ParentNodeWalkerDescriptors);\n defineNativeAccessors(Element.prototype, {\n previousElementSibling: {\n /** @this {Element} */\n get() {\n elementWalker.currentNode = this;\n return elementWalker.previousSibling();\n }\n },\n nextElementSibling: {\n /** @this {Element} */\n get() {\n elementWalker.currentNode = this;\n return elementWalker.nextSibling();\n }\n },\n innerHTML: {\n /** @this {Element} */\n get() {\n return getInnerHTML(this, n => n[NATIVE_PREFIX + 'childNodes']);\n },\n // Needed on browsers that do not proper accessors (e.g. old versions of Chrome)\n /** @this {Element} */\n set(value) {\n const content = this.localName === 'template' ?\n /** @type {HTMLTemplateElement} */(this).content : this;\n clearNode(content);\n const containerName = this.localName || 'div';\n let htmlContainer;\n if (!this.namespaceURI || this.namespaceURI === inertDoc.namespaceURI) {\n htmlContainer = inertDoc.createElement(containerName);\n } else {\n htmlContainer = inertDoc.createElementNS(this.namespaceURI, containerName);\n }\n htmlContainer.innerHTML = value;\n const newContent = this.localName === 'template' ?\n /** @type {HTMLTemplateElement} */(htmlContainer).content : htmlContainer;\n let firstChild;\n while ((firstChild = newContent[NATIVE_PREFIX + 'firstChild'])) {\n // Note: old Chrome versions require 2nd argument here\n content[NATIVE_PREFIX + 'insertBefore'](firstChild, undefined);\n }\n }\n }\n });\n }\n\n copyProperties(Element.prototype, [\n 'setAttribute',\n 'getAttribute',\n 'hasAttribute',\n 'removeAttribute',\n // on older Safari, these are on Element.\n 'focus',\n 'blur',\n ]);\n copyProperties(Element.prototype, ParentNodeMethods);\n\n // HTMLElement\n copyProperties(HTMLElement.prototype, [\n 'focus',\n 'blur',\n // On IE these are on HTMLElement\n 'contains'\n ]);\n\n if (hasDescriptors) {\n copyProperties(HTMLElement.prototype, [\n 'parentElement',\n 'children',\n 'innerHTML'\n ]);\n }\n\n // HTMLTemplateElement\n if (window.HTMLTemplateElement) {\n copyProperties(window.HTMLTemplateElement.prototype, ['innerHTML']);\n }\n\n // DocumentFragment\n if (hasDescriptors) {\n // NOTE, IE 11 does not have on DocumentFragment\n // firstElementChild\n // lastElementChild\n copyProperties(DocumentFragment.prototype, ParentNodeAccessors);\n } else {\n defineNativeAccessors(DocumentFragment.prototype, ParentNodeWalkerDescriptors);\n }\n\n copyProperties(DocumentFragment.prototype, ParentNodeMethods);\n\n // Document\n if (hasDescriptors) {\n copyProperties(Document.prototype, ParentNodeAccessors);\n copyProperties(Document.prototype, [\n 'activeElement'\n ]);\n } else {\n defineNativeAccessors(Document.prototype, ParentNodeWalkerDescriptors);\n }\n\n copyProperties(Document.prototype, [\n 'importNode',\n 'getElementById'\n ]);\n copyProperties(Document.prototype, ParentNodeMethods);\n\n};\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {ensureShadyDataForNode} from './shady-data.js';\n\nexport const InsideDescriptors = utils.getOwnPropertyDescriptors({\n\n /** @this {Node} */\n get childNodes() {\n return this[utils.SHADY_PREFIX + 'childNodes'];\n },\n\n /** @this {Node} */\n get firstChild() {\n return this[utils.SHADY_PREFIX + 'firstChild'];\n },\n\n /** @this {Node} */\n get lastChild() {\n return this[utils.SHADY_PREFIX + 'lastChild'];\n },\n\n /** @this {Node} */\n get textContent() {\n return this[utils.SHADY_PREFIX + 'textContent'];\n },\n\n /** @this {Node} */\n set textContent(value) {\n this[utils.SHADY_PREFIX + 'textContent'] = value;\n },\n\n /** @this {Node} */\n get childElementCount() {\n return this[utils.SHADY_PREFIX + 'childElementCount'];\n },\n\n /** @this {Node} */\n get children() {\n return this[utils.SHADY_PREFIX + 'children'];\n },\n\n /** @this {Node} */\n get firstElementChild() {\n return this[utils.SHADY_PREFIX + 'firstElementChild'];\n },\n\n /** @this {Node} */\n get lastElementChild() {\n return this[utils.SHADY_PREFIX + 'lastElementChild'];\n },\n\n /** @this {Node} */\n get innerHTML() {\n return this[utils.SHADY_PREFIX + 'innerHTML'];\n },\n\n /** @this {Node} */\n set innerHTML(value) {\n return this[utils.SHADY_PREFIX + 'innerHTML'] = value;\n },\n\n /** @this {Node} */\n get shadowRoot() {\n return this[utils.SHADY_PREFIX + 'shadowRoot'];\n }\n\n});\n\nexport const OutsideDescriptors = utils.getOwnPropertyDescriptors({\n\n /** @this {Node} */\n get parentElement() {\n return this[utils.SHADY_PREFIX + 'parentElement'];\n },\n\n /** @this {Node} */\n get parentNode() {\n return this[utils.SHADY_PREFIX + 'parentNode'];\n },\n\n /** @this {Node} */\n get nextSibling() {\n return this[utils.SHADY_PREFIX + 'nextSibling'];\n },\n\n /** @this {Node} */\n get previousSibling() {\n return this[utils.SHADY_PREFIX + 'previousSibling'];\n },\n\n /** @this {Node} */\n get nextElementSibling() {\n return this[utils.SHADY_PREFIX + 'nextElementSibling'];\n },\n\n /** @this {Node} */\n get previousElementSibling() {\n return this[utils.SHADY_PREFIX + 'previousElementSibling'];\n },\n\n /** @this {Node} */\n get className() {\n return this[utils.SHADY_PREFIX + 'className'];\n },\n\n /** @this {Node} */\n set className(value) {\n return this[utils.SHADY_PREFIX + 'className'] = value;\n }\n\n});\n\nfor (let prop in InsideDescriptors) {\n InsideDescriptors[prop].enumerable = false;\n}\n\nfor (let prop in OutsideDescriptors) {\n OutsideDescriptors[prop].enumerable = false;\n}\n\nconst noInstancePatching = utils.settings.hasDescriptors || utils.settings.noPatch;\n\n// ensure an element has patched \"outside\" accessors; no-op when not needed\nexport let patchOutsideElementAccessors = noInstancePatching ?\n function() {} : function(element) {\n const sd = ensureShadyDataForNode(element);\n if (!sd.__outsideAccessors) {\n sd.__outsideAccessors = true;\n utils.patchProperties(element, OutsideDescriptors);\n }\n }\n\n// ensure an element has patched \"inside\" accessors; no-op when not needed\nexport let patchInsideElementAccessors = noInstancePatching ?\n function() {} : function(element) {\n const sd = ensureShadyDataForNode(element);\n if (!sd.__insideAccessors) {\n sd.__insideAccessors = true;\n utils.patchProperties(element, InsideDescriptors);\n }\n }","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {shadyDataForNode} from './shady-data.js';\n\n/*\nMake this name unique so it is unlikely to conflict with properties on objects passed to `addEventListener`\nhttps://github.com/webcomponents/shadydom/issues/173\n*/\nconst /** string */ eventWrappersName = `__eventWrappers${Date.now()}`;\n\n/** @type {?function(!Event): boolean} */\nconst composedGetter = (() => {\n const composedProp = Object.getOwnPropertyDescriptor(Event.prototype, 'composed');\n return composedProp ? (ev) => composedProp.get.call(ev) : null;\n})();\n\n// https://github.com/w3c/webcomponents/issues/513#issuecomment-224183937\nconst alwaysComposed = {\n 'blur': true,\n 'focus': true,\n 'focusin': true,\n 'focusout': true,\n 'click': true,\n 'dblclick': true,\n 'mousedown': true,\n 'mouseenter': true,\n 'mouseleave': true,\n 'mousemove': true,\n 'mouseout': true,\n 'mouseover': true,\n 'mouseup': true,\n 'wheel': true,\n 'beforeinput': true,\n 'input': true,\n 'keydown': true,\n 'keyup': true,\n 'compositionstart': true,\n 'compositionupdate': true,\n 'compositionend': true,\n 'touchstart': true,\n 'touchend': true,\n 'touchmove': true,\n 'touchcancel': true,\n 'pointerover': true,\n 'pointerenter': true,\n 'pointerdown': true,\n 'pointermove': true,\n 'pointerup': true,\n 'pointercancel': true,\n 'pointerout': true,\n 'pointerleave': true,\n 'gotpointercapture': true,\n 'lostpointercapture': true,\n 'dragstart': true,\n 'drag': true,\n 'dragenter': true,\n 'dragleave': true,\n 'dragover': true,\n 'drop': true,\n 'dragend': true,\n 'DOMActivate': true,\n 'DOMFocusIn': true,\n 'DOMFocusOut': true,\n 'keypress': true\n};\n\nconst unpatchedEvents = {\n 'DOMAttrModified': true,\n 'DOMAttributeNameChanged': true,\n 'DOMCharacterDataModified': true,\n 'DOMElementNameChanged': true,\n 'DOMNodeInserted': true,\n 'DOMNodeInsertedIntoDocument': true,\n 'DOMNodeRemoved': true,\n 'DOMNodeRemovedFromDocument': true,\n 'DOMSubtreeModified': true\n}\n\n/**\n * Some EventTarget subclasses are not Node subclasses, and you cannot call\n * `getRootNode()` on them.\n *\n * @param {!(Node|EventTarget)} eventTarget\n * @return {!(Node|EventTarget)}\n */\nfunction getRootNodeWithFallback(eventTarget) {\n if (eventTarget instanceof Node) {\n return eventTarget[utils.SHADY_PREFIX + 'getRootNode']();\n } else {\n return eventTarget;\n }\n}\n\nfunction pathComposer(startNode, composed) {\n let composedPath = [];\n let current = startNode;\n let startRoot = getRootNodeWithFallback(startNode);\n while (current) {\n composedPath.push(current);\n if (current[utils.SHADY_PREFIX + 'assignedSlot']) {\n current = current[utils.SHADY_PREFIX + 'assignedSlot'];\n } else if (current.nodeType === Node.DOCUMENT_FRAGMENT_NODE && current.host && (composed || current !== startRoot)) {\n current = current.host;\n } else {\n current = current[utils.SHADY_PREFIX + 'parentNode'];\n }\n }\n // event composedPath includes window when startNode's ownerRoot is document\n if (composedPath[composedPath.length - 1] === document) {\n composedPath.push(window);\n }\n return composedPath;\n}\n\nexport const composedPath = (event) => {\n if (!event.__composedPath) {\n event.__composedPath = pathComposer(event.target, true);\n }\n return event.__composedPath;\n}\n\nfunction retarget(refNode, path) {\n if (!utils.isShadyRoot) {\n return refNode;\n }\n // If ANCESTOR's root is not a shadow root or ANCESTOR's root is BASE's\n // shadow-including inclusive ancestor, return ANCESTOR.\n let refNodePath = pathComposer(refNode, true);\n let p$ = path;\n for (let i=0, ancestor, lastRoot, root, rootIdx; i < p$.length; i++) {\n ancestor = p$[i];\n root = getRootNodeWithFallback(ancestor);\n if (root !== lastRoot) {\n rootIdx = refNodePath.indexOf(root);\n lastRoot = root;\n }\n if (!utils.isShadyRoot(root) || rootIdx > -1) {\n return ancestor;\n }\n }\n}\n\nlet EventPatches = {\n\n /**\n * @this {Event}\n */\n get composed() {\n if (this.__composed === undefined) {\n // if there's an original `composed` getter on the Event prototype, use that\n if (composedGetter) {\n // TODO(web-padawan): see https://github.com/webcomponents/shadydom/issues/275\n this.__composed = this.type === 'focusin' || this.type === 'focusout' || composedGetter(this);\n // If the event is trusted, or `isTrusted` is not supported, check the list of always composed events\n } else if (this.isTrusted !== false) {\n this.__composed = alwaysComposed[this.type];\n }\n }\n return /** @type {!Event} */(this).__composed || false;\n },\n\n /**\n * @this {Event}\n */\n composedPath() {\n if (!this.__composedPath) {\n this.__composedPath = pathComposer(this['__target'], this.composed);\n }\n return /** @type {!Event} */(this).__composedPath;\n },\n\n /**\n * @this {Event}\n */\n get target() {\n return retarget(this.currentTarget || this['__previousCurrentTarget'], this.composedPath());\n },\n\n // http://w3c.github.io/webcomponents/spec/shadow/#event-relatedtarget-retargeting\n /**\n * @this {Event}\n */\n get relatedTarget() {\n if (!this.__relatedTarget) {\n return null;\n }\n if (!this.__relatedTargetComposedPath) {\n this.__relatedTargetComposedPath = pathComposer(this.__relatedTarget, true);\n }\n // find the deepest node in relatedTarget composed path that is in the same root with the currentTarget\n return retarget(this.currentTarget || this['__previousCurrentTarget'], /** @type {!Event} */(this).__relatedTargetComposedPath);\n },\n /**\n * @this {Event}\n */\n stopPropagation() {\n Event.prototype.stopPropagation.call(this);\n this.__propagationStopped = true;\n },\n /**\n * @this {Event}\n */\n stopImmediatePropagation() {\n Event.prototype.stopImmediatePropagation.call(this);\n this.__immediatePropagationStopped = true;\n this.__propagationStopped = true;\n }\n\n};\n\nfunction mixinComposedFlag(Base) {\n // NOTE: avoiding use of `class` here so that transpiled output does not\n // try to do `Base.call` with a dom construtor.\n let klazz = function(type, options) {\n let event = new Base(type, options);\n event.__composed = options && Boolean(options['composed']);\n return event;\n }\n // put constructor properties on subclass\n klazz.__proto__ = Base;\n klazz.prototype = Base.prototype;\n return klazz;\n}\n\nlet nonBubblingEventsToRetarget = {\n 'focus': true,\n 'blur': true\n};\n\n\n/**\n * Check if the event has been retargeted by comparing original `target`, and calculated `target`\n * @param {Event} event\n * @return {boolean} True if the original target and calculated target are the same\n */\nfunction hasRetargeted(event) {\n return event['__target'] !== event.target || event.__relatedTarget !== event.relatedTarget;\n}\n\n/**\n *\n * @param {Event} event\n * @param {Node} node\n * @param {string} phase\n */\nfunction fireHandlers(event, node, phase) {\n let hs = node.__handlers && node.__handlers[event.type] &&\n node.__handlers[event.type][phase];\n if (hs) {\n for (let i = 0, fn; (fn = hs[i]); i++) {\n if (hasRetargeted(event) && event.target === event.relatedTarget) {\n return;\n }\n fn.call(node, event);\n if (event.__immediatePropagationStopped) {\n return;\n }\n }\n }\n}\n\nfunction retargetNonBubblingEvent(e) {\n let path = e.composedPath();\n let node;\n // override `currentTarget` to let patched `target` calculate correctly\n Object.defineProperty(e, 'currentTarget', {\n get: function() {\n return node;\n },\n configurable: true\n });\n for (let i = path.length - 1; i >= 0; i--) {\n node = path[i];\n // capture phase fires all capture handlers\n fireHandlers(e, node, 'capture');\n if (e.__propagationStopped) {\n return;\n }\n }\n\n // set the event phase to `AT_TARGET` as in spec\n Object.defineProperty(e, 'eventPhase', {get() { return Event.AT_TARGET }});\n\n // the event only needs to be fired when owner roots change when iterating the event path\n // keep track of the last seen owner root\n let lastFiredRoot;\n for (let i = 0; i < path.length; i++) {\n node = path[i];\n const nodeData = shadyDataForNode(node);\n const root = nodeData && nodeData.root;\n if (i === 0 || (root && root === lastFiredRoot)) {\n fireHandlers(e, node, 'bubble');\n // don't bother with window, it doesn't have `getRootNode` and will be last in the path anyway\n if (node !== window) {\n lastFiredRoot = node[utils.SHADY_PREFIX + 'getRootNode']();\n }\n if (e.__propagationStopped) {\n return;\n }\n }\n }\n}\n\nfunction listenerSettingsEqual(savedListener, node, type, capture, once, passive) {\n let {\n node: savedNode,\n type: savedType,\n capture: savedCapture,\n once: savedOnce,\n passive: savedPassive\n } = savedListener;\n return node === savedNode &&\n type === savedType &&\n capture === savedCapture &&\n once === savedOnce &&\n passive === savedPassive;\n}\n\nexport function findListener(wrappers, node, type, capture, once, passive) {\n for (let i = 0; i < wrappers.length; i++) {\n if (listenerSettingsEqual(wrappers[i], node, type, capture, once, passive)) {\n return i;\n }\n }\n return -1;\n}\n\n/**\n * Firefox can throw on accessing eventWrappers inside of `removeEventListener` during a selenium run\n * Try/Catch accessing eventWrappers to work around\n * https://bugzilla.mozilla.org/show_bug.cgi?id=1353074\n */\nfunction getEventWrappers(eventLike) {\n let wrappers = null;\n try {\n wrappers = eventLike[eventWrappersName];\n } catch (e) {} // eslint-disable-line no-empty\n return wrappers;\n}\n\n/**\n * @this {EventTarget}\n */\nexport function addEventListener(type, fnOrObj, optionsOrCapture) {\n if (!fnOrObj) {\n return;\n }\n\n const handlerType = typeof fnOrObj;\n\n // bail if `fnOrObj` is not a function, not an object\n if (handlerType !== 'function' && handlerType !== 'object') {\n return;\n }\n\n // bail if `fnOrObj` is an object without a `handleEvent` method\n if (handlerType === 'object' && (!fnOrObj.handleEvent || typeof fnOrObj.handleEvent !== 'function')) {\n return;\n }\n\n if (unpatchedEvents[type]) {\n return this[utils.NATIVE_PREFIX + 'addEventListener'](type, fnOrObj, optionsOrCapture);\n }\n\n // The callback `fn` might be used for multiple nodes/events. Since we generate\n // a wrapper function, we need to keep track of it when we remove the listener.\n // It's more efficient to store the node/type/options information as Array in\n // `fn` itself rather than the node (we assume that the same callback is used\n // for few nodes at most, whereas a node will likely have many event listeners).\n // NOTE(valdrin) invoking external functions is costly, inline has better perf.\n let capture, once, passive;\n if (optionsOrCapture && typeof optionsOrCapture === 'object') {\n capture = Boolean(optionsOrCapture.capture);\n once = Boolean(optionsOrCapture.once);\n passive = Boolean(optionsOrCapture.passive);\n } else {\n capture = Boolean(optionsOrCapture);\n once = false;\n passive = false;\n }\n // hack to let ShadyRoots have event listeners\n // event listener will be on host, but `currentTarget`\n // will be set to shadyroot for event listener\n let target = (optionsOrCapture && optionsOrCapture.__shadyTarget) || this;\n\n let wrappers = fnOrObj[eventWrappersName];\n if (wrappers) {\n // Stop if the wrapper function has already been created.\n if (findListener(wrappers, target, type, capture, once, passive) > -1) {\n return;\n }\n } else {\n fnOrObj[eventWrappersName] = [];\n }\n\n /**\n * @this {HTMLElement}\n * @param {Event} e\n */\n const wrapperFn = function(e) {\n // Support `once` option.\n if (once) {\n this[utils.SHADY_PREFIX + 'removeEventListener'](type, fnOrObj, optionsOrCapture);\n }\n if (!e['__target']) {\n patchEvent(e);\n }\n let lastCurrentTargetDesc;\n if (target !== this) {\n // replace `currentTarget` to make `target` and `relatedTarget` correct for inside the shadowroot\n lastCurrentTargetDesc = Object.getOwnPropertyDescriptor(e, 'currentTarget');\n Object.defineProperty(e, 'currentTarget', {get() { return target }, configurable: true});\n }\n e['__previousCurrentTarget'] = e['currentTarget'];\n // Always check if a shadowRoot is in the current event path.\n // If it is not, the event was generated on either the host of the shadowRoot\n // or a children of the host.\n if (utils.isShadyRoot(target) && e.composedPath().indexOf(target) == -1) {\n return;\n }\n // There are two critera that should stop events from firing on this node\n // 1. the event is not composed and the current node is not in the same root as the target\n // 2. when bubbling, if after retargeting, relatedTarget and target point to the same node\n if (e.composed || e.composedPath().indexOf(target) > -1) {\n if (hasRetargeted(e) && e.target === e.relatedTarget) {\n if (e.eventPhase === Event.BUBBLING_PHASE) {\n e.stopImmediatePropagation();\n }\n return;\n }\n // prevent non-bubbling events from triggering bubbling handlers on shadowroot, but only if not in capture phase\n if (e.eventPhase !== Event.CAPTURING_PHASE && !e.bubbles && e.target !== target && !(target instanceof Window)) {\n return;\n }\n let ret = handlerType === 'function' ?\n fnOrObj.call(target, e) :\n (fnOrObj.handleEvent && fnOrObj.handleEvent(e));\n if (target !== this) {\n // replace the \"correct\" `currentTarget`\n if (lastCurrentTargetDesc) {\n Object.defineProperty(e, 'currentTarget', lastCurrentTargetDesc);\n lastCurrentTargetDesc = null;\n } else {\n delete e['currentTarget'];\n }\n }\n return ret;\n }\n };\n\n // Store the wrapper information.\n fnOrObj[eventWrappersName].push({\n // note: use target here which is either a shadowRoot\n // (when the host element is proxy'ing the event) or this element\n node: target,\n type: type,\n capture: capture,\n once: once,\n passive: passive,\n wrapperFn: wrapperFn\n });\n\n if (nonBubblingEventsToRetarget[type]) {\n this.__handlers = this.__handlers || {};\n this.__handlers[type] = this.__handlers[type] ||\n {'capture': [], 'bubble': []};\n this.__handlers[type][capture ? 'capture' : 'bubble'].push(wrapperFn);\n } else {\n this[utils.NATIVE_PREFIX + 'addEventListener'](type, wrapperFn, optionsOrCapture);\n }\n}\n\n/**\n * @this {EventTarget}\n */\nexport function removeEventListener(type, fnOrObj, optionsOrCapture) {\n if (!fnOrObj) {\n return;\n }\n if (unpatchedEvents[type]) {\n return this[utils.NATIVE_PREFIX + 'removeEventListener'](type, fnOrObj, optionsOrCapture);\n }\n // NOTE(valdrin) invoking external functions is costly, inline has better perf.\n let capture, once, passive;\n if (optionsOrCapture && typeof optionsOrCapture === 'object') {\n capture = Boolean(optionsOrCapture.capture);\n once = Boolean(optionsOrCapture.once);\n passive = Boolean(optionsOrCapture.passive);\n } else {\n capture = Boolean(optionsOrCapture);\n once = false;\n passive = false;\n }\n let target = (optionsOrCapture && optionsOrCapture.__shadyTarget) || this;\n // Search the wrapped function.\n let wrapperFn = undefined;\n let wrappers = getEventWrappers(fnOrObj);\n if (wrappers) {\n let idx = findListener(wrappers, target, type, capture, once, passive);\n if (idx > -1) {\n wrapperFn = wrappers.splice(idx, 1)[0].wrapperFn;\n // Cleanup.\n if (!wrappers.length) {\n fnOrObj[eventWrappersName] = undefined;\n }\n }\n }\n this[utils.NATIVE_PREFIX + 'removeEventListener'](type, wrapperFn || fnOrObj, optionsOrCapture);\n if (wrapperFn && nonBubblingEventsToRetarget[type] &&\n this.__handlers && this.__handlers[type]) {\n const arr = this.__handlers[type][capture ? 'capture' : 'bubble'];\n const idx = arr.indexOf(wrapperFn);\n if (idx > -1) {\n arr.splice(idx, 1);\n }\n }\n}\n\nfunction activateFocusEventOverrides() {\n for (let ev in nonBubblingEventsToRetarget) {\n window[utils.NATIVE_PREFIX + 'addEventListener'](ev, function(e) {\n if (!e['__target']) {\n patchEvent(e);\n retargetNonBubblingEvent(e);\n }\n }, true);\n }\n}\n\nconst EventPatchesDescriptors = utils.getOwnPropertyDescriptors(EventPatches);\n\nconst SHADY_PROTO = '__shady_patchedProto';\nconst SHADY_SOURCE_PROTO = '__shady_sourceProto';\n\nfunction patchEvent(event) {\n event['__target'] = event.target;\n event.__relatedTarget = event.relatedTarget;\n // attempt to patch prototype (via cache)\n if (utils.settings.hasDescriptors) {\n const proto = Object.getPrototypeOf(event);\n if (!Object.hasOwnProperty(proto, SHADY_PROTO)) {\n const patchedProto = Object.create(proto);\n patchedProto[SHADY_SOURCE_PROTO] = proto;\n utils.patchProperties(patchedProto, EventPatchesDescriptors);\n proto[SHADY_PROTO] = patchedProto;\n }\n event.__proto__ = proto[SHADY_PROTO];\n // and fallback to patching instance\n } else {\n utils.patchProperties(event, EventPatchesDescriptors);\n }\n}\n\nlet PatchedEvent = mixinComposedFlag(Event);\nlet PatchedCustomEvent = mixinComposedFlag(CustomEvent);\nlet PatchedMouseEvent = mixinComposedFlag(MouseEvent);\n\n\nexport function patchEvents() {\n activateFocusEventOverrides();\n window.Event = PatchedEvent;\n window.CustomEvent = PatchedCustomEvent;\n window.MouseEvent = PatchedMouseEvent;\n}\n\nexport function patchClick() {\n // Fix up `Element.prototype.click()` if `isTrusted` is supported, but `composed` isn't\n if (!composedGetter && Object.getOwnPropertyDescriptor(Event.prototype, 'isTrusted')) {\n /** @this {Element} */\n const composedClickFn = function() {\n const ev = new MouseEvent('click', {\n bubbles: true,\n cancelable: true,\n composed: true\n });\n this[utils.SHADY_PREFIX + 'dispatchEvent'](ev);\n };\n if (Element.prototype.click) {\n Element.prototype.click = composedClickFn;\n } else if (HTMLElement.prototype.click) {\n HTMLElement.prototype.click = composedClickFn;\n }\n }\n}\n\nexport const eventPropertyNames = Object.getOwnPropertyNames(Document.prototype)\n .filter(name => name.substring(0,2) === 'on');\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nfunction newSplice(index, removed, addedCount) {\n return {\n index: index,\n removed: removed,\n addedCount: addedCount\n };\n}\n\nconst EDIT_LEAVE = 0;\nconst EDIT_UPDATE = 1;\nconst EDIT_ADD = 2;\nconst EDIT_DELETE = 3;\n\n// Note: This function is *based* on the computation of the Levenshtein\n// \"edit\" distance. The one change is that \"updates\" are treated as two\n// edits - not one. With Array splices, an update is really a delete\n// followed by an add. By retaining this, we optimize for \"keeping\" the\n// maximum array items in the original array. For example:\n//\n// 'xxxx123' -> '123yyyy'\n//\n// With 1-edit updates, the shortest path would be just to update all seven\n// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This\n// leaves the substring '123' intact.\nfunction calcEditDistances(current, currentStart, currentEnd,\n old, oldStart, oldEnd) {\n // \"Deletion\" columns\n let rowCount = oldEnd - oldStart + 1;\n let columnCount = currentEnd - currentStart + 1;\n let distances = new Array(rowCount);\n\n // \"Addition\" rows. Initialize null column.\n for (let i = 0; i < rowCount; i++) {\n distances[i] = new Array(columnCount);\n distances[i][0] = i;\n }\n\n // Initialize null row\n for (let j = 0; j < columnCount; j++)\n distances[0][j] = j;\n\n for (let i = 1; i < rowCount; i++) {\n for (let j = 1; j < columnCount; j++) {\n if (equals(current[currentStart + j - 1], old[oldStart + i - 1]))\n distances[i][j] = distances[i - 1][j - 1];\n else {\n let north = distances[i - 1][j] + 1;\n let west = distances[i][j - 1] + 1;\n distances[i][j] = north < west ? north : west;\n }\n }\n }\n\n return distances;\n}\n\n// This starts at the final weight, and walks \"backward\" by finding\n// the minimum previous weight recursively until the origin of the weight\n// matrix.\nfunction spliceOperationsFromEditDistances(distances) {\n let i = distances.length - 1;\n let j = distances[0].length - 1;\n let current = distances[i][j];\n let edits = [];\n while (i > 0 || j > 0) {\n if (i == 0) {\n edits.push(EDIT_ADD);\n j--;\n continue;\n }\n if (j == 0) {\n edits.push(EDIT_DELETE);\n i--;\n continue;\n }\n let northWest = distances[i - 1][j - 1];\n let west = distances[i - 1][j];\n let north = distances[i][j - 1];\n\n let min;\n if (west < north)\n min = west < northWest ? west : northWest;\n else\n min = north < northWest ? north : northWest;\n\n if (min == northWest) {\n if (northWest == current) {\n edits.push(EDIT_LEAVE);\n } else {\n edits.push(EDIT_UPDATE);\n current = northWest;\n }\n i--;\n j--;\n } else if (min == west) {\n edits.push(EDIT_DELETE);\n i--;\n current = west;\n } else {\n edits.push(EDIT_ADD);\n j--;\n current = north;\n }\n }\n\n edits.reverse();\n return edits;\n}\n\n/**\n * Splice Projection functions:\n *\n * A splice map is a representation of how a previous array of items\n * was transformed into a new array of items. Conceptually it is a list of\n * tuples of\n *\n * <index, removed, addedCount>\n *\n * which are kept in ascending index order of. The tuple represents that at\n * the |index|, |removed| sequence of items were removed, and counting forward\n * from |index|, |addedCount| items were added.\n */\n\n/**\n * Lacking individual splice mutation information, the minimal set of\n * splices can be synthesized given the previous state and final state of an\n * array. The basic approach is to calculate the edit distance matrix and\n * choose the shortest path through it.\n *\n * Complexity: O(l * p)\n * l: The length of the current array\n * p: The length of the old array\n */\nfunction calcSplices(current, currentStart, currentEnd,\n old, oldStart, oldEnd) {\n let prefixCount = 0;\n let suffixCount = 0;\n let splice;\n\n let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);\n if (currentStart == 0 && oldStart == 0)\n prefixCount = sharedPrefix(current, old, minLength);\n\n if (currentEnd == current.length && oldEnd == old.length)\n suffixCount = sharedSuffix(current, old, minLength - prefixCount);\n\n currentStart += prefixCount;\n oldStart += prefixCount;\n currentEnd -= suffixCount;\n oldEnd -= suffixCount;\n\n if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)\n return [];\n\n if (currentStart == currentEnd) {\n splice = newSplice(currentStart, [], 0);\n while (oldStart < oldEnd)\n splice.removed.push(old[oldStart++]);\n\n return [ splice ];\n } else if (oldStart == oldEnd)\n return [ newSplice(currentStart, [], currentEnd - currentStart) ];\n\n let ops = spliceOperationsFromEditDistances(\n calcEditDistances(current, currentStart, currentEnd,\n old, oldStart, oldEnd));\n\n splice = undefined;\n let splices = [];\n let index = currentStart;\n let oldIndex = oldStart;\n for (let i = 0; i < ops.length; i++) {\n switch(ops[i]) {\n case EDIT_LEAVE:\n if (splice) {\n splices.push(splice);\n splice = undefined;\n }\n\n index++;\n oldIndex++;\n break;\n case EDIT_UPDATE:\n if (!splice)\n splice = newSplice(index, [], 0);\n\n splice.addedCount++;\n index++;\n\n splice.removed.push(old[oldIndex]);\n oldIndex++;\n break;\n case EDIT_ADD:\n if (!splice)\n splice = newSplice(index, [], 0);\n\n splice.addedCount++;\n index++;\n break;\n case EDIT_DELETE:\n if (!splice)\n splice = newSplice(index, [], 0);\n\n splice.removed.push(old[oldIndex]);\n oldIndex++;\n break;\n }\n }\n\n if (splice) {\n splices.push(splice);\n }\n return splices;\n}\n\nfunction sharedPrefix(current, old, searchLength) {\n for (let i = 0; i < searchLength; i++)\n if (!equals(current[i], old[i]))\n return i;\n return searchLength;\n}\n\nfunction sharedSuffix(current, old, searchLength) {\n let index1 = current.length;\n let index2 = old.length;\n let count = 0;\n while (count < searchLength && equals(current[--index1], old[--index2]))\n count++;\n\n return count;\n}\n\nfunction equals(currentValue, previousValue) {\n return currentValue === previousValue;\n}\n\nexport function calculateSplices(current, previous) {\n return calcSplices(current, 0, current.length, previous, 0,\n previous.length);\n}\n\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {shadyDataForNode, ensureShadyDataForNode} from './shady-data.js';\nimport {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-instances.js';\n\nfunction linkNode(node, container, ref_node) {\n patchOutsideElementAccessors(node);\n ref_node = ref_node || null;\n const nodeData = ensureShadyDataForNode(node);\n const containerData = ensureShadyDataForNode(container);\n const ref_nodeData = ref_node ? ensureShadyDataForNode(ref_node) : null;\n // update ref_node.previousSibling <-> node\n nodeData.previousSibling = ref_node ? ref_nodeData.previousSibling :\n container[utils.SHADY_PREFIX + 'lastChild'];\n let psd = shadyDataForNode(nodeData.previousSibling);\n if (psd) {\n psd.nextSibling = node;\n }\n // update node <-> ref_node\n let nsd = shadyDataForNode(nodeData.nextSibling = ref_node);\n if (nsd) {\n nsd.previousSibling = node;\n }\n // update node <-> container\n nodeData.parentNode = container;\n if (ref_node) {\n if (ref_node === containerData.firstChild) {\n containerData.firstChild = node;\n }\n } else {\n containerData.lastChild = node;\n if (!containerData.firstChild) {\n containerData.firstChild = node;\n }\n }\n // remove caching of childNodes\n containerData.childNodes = null;\n}\n\nexport const recordInsertBefore = (node, container, ref_node) => {\n patchInsideElementAccessors(container);\n const containerData = ensureShadyDataForNode(container);\n if (containerData.firstChild !== undefined) {\n containerData.childNodes = null;\n }\n // handle document fragments\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n let c$ = node[utils.SHADY_PREFIX + 'childNodes'];\n for (let i=0; i < c$.length; i++) {\n linkNode(c$[i], container, ref_node);\n }\n // cleanup logical dom in doc fragment.\n const nodeData = ensureShadyDataForNode(node);\n let resetTo = (nodeData.firstChild !== undefined) ? null : undefined;\n nodeData.firstChild = nodeData.lastChild = resetTo;\n nodeData.childNodes = resetTo;\n } else {\n linkNode(node, container, ref_node);\n }\n}\n\nexport const recordRemoveChild = (node, container) => {\n const nodeData = ensureShadyDataForNode(node);\n const containerData = ensureShadyDataForNode(container);\n if (node === containerData.firstChild) {\n containerData.firstChild = nodeData.nextSibling;\n }\n if (node === containerData.lastChild) {\n containerData.lastChild = nodeData.previousSibling;\n }\n let p = nodeData.previousSibling;\n let n = nodeData.nextSibling;\n if (p) {\n ensureShadyDataForNode(p).nextSibling = n;\n }\n if (n) {\n ensureShadyDataForNode(n).previousSibling = p;\n }\n // When an element is removed, logical data is no longer tracked.\n // Explicitly set `undefined` here to indicate this. This is disginguished\n // from `null` which is set if info is null.\n nodeData.parentNode = nodeData.previousSibling =\n nodeData.nextSibling = undefined;\n if (containerData.childNodes !== undefined) {\n // remove caching of childNodes\n containerData.childNodes = null;\n }\n}\n\n/**\n * @param {!Node} node\n */\nexport const recordChildNodes = (node) => {\n const nodeData = ensureShadyDataForNode(node);\n if (nodeData.firstChild === undefined) {\n // remove caching of childNodes\n nodeData.childNodes = null;\n const first = nodeData.firstChild = node[utils.NATIVE_PREFIX + 'firstChild'] || null;\n nodeData.lastChild = node[utils.NATIVE_PREFIX + 'lastChild'] || null;\n patchInsideElementAccessors(node);\n for (let n = first, previous; n; (n = n[utils.NATIVE_PREFIX + 'nextSibling'])) {\n const sd = ensureShadyDataForNode(n);\n sd.parentNode = node;\n sd.nextSibling = n[utils.NATIVE_PREFIX + 'nextSibling'] || null;\n sd.previousSibling = previous || null;\n previous = n;\n patchOutsideElementAccessors(n);\n }\n }\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\n\nlet scopingShim = null;\n\nexport function getScopingShim() {\n if (!scopingShim) {\n scopingShim = window['ShadyCSS'] && window['ShadyCSS']['ScopingShim'];\n }\n return scopingShim || null;\n}\n\n/**\n * @param {!Node} node\n * @param {string} attr\n * @param {string} value\n */\nexport function scopeClassAttribute(node, attr, value) {\n const scopingShim = getScopingShim();\n if (scopingShim && attr === 'class') {\n scopingShim['setElementClass'](node, value);\n return true;\n }\n return false;\n}\n\n/**\n * @param {!Node} node\n * @param {string} newScopeName\n */\nexport function addShadyScoping(node, newScopeName) {\n const scopingShim = getScopingShim();\n if (!scopingShim) {\n return;\n }\n scopingShim['scopeNode'](node, newScopeName);\n}\n\n/**\n * @param {!Node} node\n * @param {string} currentScopeName\n */\nexport function removeShadyScoping(node, currentScopeName) {\n const scopingShim = getScopingShim();\n if (!scopingShim) {\n return;\n }\n scopingShim['unscopeNode'](node, currentScopeName);\n}\n\n/**\n * @param {!Node} node\n * @param {string} newScopeName\n * @param {string} oldScopeName\n */\nexport function replaceShadyScoping(node, newScopeName, oldScopeName) {\n const scopingShim = getScopingShim();\n if (!scopingShim) {\n return;\n }\n if (oldScopeName) {\n removeShadyScoping(node, oldScopeName);\n }\n addShadyScoping(node, newScopeName);\n}\n\n/**\n * @param {!Node} node\n * @param {string} newScopeName\n * @return {boolean}\n */\nexport function currentScopeIsCorrect(node, newScopeName) {\n const scopingShim = getScopingShim();\n if (!scopingShim) {\n return true;\n }\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n // NOTE: as an optimization, only check that all the top-level children\n // have the correct scope.\n let correctScope = true;\n const childNodes = node[utils.SHADY_PREFIX + 'childNodes'];\n for (let idx = 0; correctScope && (idx < childNodes.length); idx++) {\n correctScope = correctScope &&\n currentScopeIsCorrect(childNodes[idx], newScopeName);\n }\n return correctScope;\n }\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return true;\n }\n const currentScope = scopingShim['currentScopeForNode'](node);\n return currentScope === newScopeName;\n}\n\n/**\n * @param {!Node} node\n * @return {string}\n */\nexport function currentScopeForNode(node) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return '';\n }\n const scopingShim = getScopingShim();\n if (!scopingShim) {\n return '';\n }\n return scopingShim['currentScopeForNode'](node);\n}\n\n/**\n * Walk over a node's tree and apply visitorFn to each element node\n *\n * @param {Node} node\n * @param {function(!Node):void} visitorFn\n */\nexport function treeVisitor(node, visitorFn) {\n if (!node) {\n return;\n }\n // this check is necessary if `node` is a Document Fragment\n if (node.nodeType === Node.ELEMENT_NODE) {\n visitorFn(node);\n }\n const childNodes = node[utils.SHADY_PREFIX + 'childNodes'];\n for (let idx = 0, n; idx < childNodes.length; idx++) {\n n = childNodes[idx];\n if (n.nodeType === Node.ELEMENT_NODE) {\n treeVisitor(n, visitorFn);\n }\n }\n}","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {getScopingShim, removeShadyScoping, replaceShadyScoping,\n treeVisitor, currentScopeForNode, currentScopeIsCorrect } from '../style-scoping.js';\nimport {shadyDataForNode, ensureShadyDataForNode} from '../shady-data.js';\nimport {recordInsertBefore, recordRemoveChild} from '../link-nodes.js';\nimport {ownerShadyRootForNode} from '../attach-shadow.js';\n\nconst doc = window.document;\n\nconst preferPerformance = utils.settings.preferPerformance;\n\nconst nativeIsConnectedAccessors =\n/** @type {ObjectPropertyDescriptor} */(\n Object.getOwnPropertyDescriptor(Node.prototype, 'isConnected')\n);\n\nconst nativeIsConnected = nativeIsConnectedAccessors && nativeIsConnectedAccessors.get;\n\nexport function clearNode(node) {\n let firstChild;\n while ((firstChild = node[utils.SHADY_PREFIX + 'firstChild'])) {\n node[utils.SHADY_PREFIX + 'removeChild'](firstChild);\n }\n}\n\nfunction removeOwnerShadyRoot(node) {\n // optimization: only reset the tree if node is actually in a root\n if (hasCachedOwnerRoot(node)) {\n let c$ = node[utils.SHADY_PREFIX + 'childNodes'];\n for (let i=0, l=c$.length, n; (i<l) && (n=c$[i]); i++) {\n removeOwnerShadyRoot(n);\n }\n }\n const nodeData = shadyDataForNode(node);\n if (nodeData) {\n nodeData.ownerShadyRoot = undefined;\n }\n}\n\nfunction hasCachedOwnerRoot(node) {\n const nodeData = shadyDataForNode(node);\n return Boolean(nodeData && nodeData.ownerShadyRoot !== undefined);\n}\n\n/**\n * Finds the first flattened node that is composed in the node's parent.\n * If the given node is a slot, then the first flattened node is returned\n * if it exists, otherwise advance to the node's nextSibling.\n * @param {Node} node within which to find first composed node\n * @returns {Node} first composed node\n */\nfunction firstComposedNode(node) {\n let composed = node;\n if (node && node.localName === 'slot') {\n const nodeData = shadyDataForNode(node);\n const flattened = nodeData && nodeData.flattenedNodes;\n composed = flattened && flattened.length ? flattened[0] :\n firstComposedNode(node[utils.SHADY_PREFIX + 'nextSibling']);\n }\n return composed;\n}\n\n/**\n * @param {Node} node\n * @param {Node=} addedNode\n * @param {Node=} removedNode\n */\nfunction scheduleObserver(node, addedNode, removedNode) {\n const nodeData = shadyDataForNode(node);\n const observer = nodeData && nodeData.observer;\n if (observer) {\n if (addedNode) {\n observer.addedNodes.push(addedNode);\n }\n if (removedNode) {\n observer.removedNodes.push(removedNode);\n }\n observer.schedule();\n }\n}\n\nexport const NodePatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Node} */\n get parentNode() {\n const nodeData = shadyDataForNode(this);\n const l = nodeData && nodeData.parentNode;\n return l !== undefined ? l : this[utils.NATIVE_PREFIX + 'parentNode'];\n },\n\n /** @this {Node} */\n get firstChild() {\n const nodeData = shadyDataForNode(this);\n const l = nodeData && nodeData.firstChild;\n return l !== undefined ? l : this[utils.NATIVE_PREFIX + 'firstChild'];\n },\n\n /** @this {Node} */\n get lastChild() {\n const nodeData = shadyDataForNode(this);\n const l = nodeData && nodeData.lastChild;\n return l !== undefined ? l : this[utils.NATIVE_PREFIX + 'lastChild'];\n },\n\n /** @this {Node} */\n get nextSibling() {\n const nodeData = shadyDataForNode(this);\n const l = nodeData && nodeData.nextSibling;\n return l !== undefined ? l : this[utils.NATIVE_PREFIX + 'nextSibling'];\n },\n\n /** @this {Node} */\n get previousSibling() {\n const nodeData = shadyDataForNode(this);\n const l = nodeData && nodeData.previousSibling;\n return l !== undefined ? l : this[utils.NATIVE_PREFIX + 'previousSibling'];\n },\n\n /** @this {Node} */\n get childNodes() {\n let childNodes;\n if (utils.isTrackingLogicalChildNodes(this)) {\n const nodeData = shadyDataForNode(this);\n if (!nodeData.childNodes) {\n nodeData.childNodes = [];\n for (let n=this[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) {\n nodeData.childNodes.push(n);\n }\n }\n childNodes = nodeData.childNodes;\n } else {\n childNodes = this[utils.NATIVE_PREFIX + 'childNodes'];\n }\n childNodes.item = function(index) {\n return childNodes[index];\n }\n return childNodes;\n },\n\n /** @this {Node} */\n get parentElement() {\n const nodeData = shadyDataForNode(this);\n let l = nodeData && nodeData.parentNode;\n if (l && l.nodeType !== Node.ELEMENT_NODE) {\n l = null;\n }\n return l !== undefined ? l : this[utils.NATIVE_PREFIX + 'parentElement'];\n },\n\n /** @this {Node} */\n get isConnected() {\n if (nativeIsConnected && nativeIsConnected.call(this)) {\n return true;\n }\n if (this.nodeType == Node.DOCUMENT_FRAGMENT_NODE) {\n return false;\n }\n // Fast path for distributed nodes.\n const ownerDocument = this.ownerDocument;\n if (utils.hasDocumentContains) {\n if (ownerDocument[utils.NATIVE_PREFIX + 'contains'](this)) {\n return true;\n }\n } else if (ownerDocument.documentElement &&\n ownerDocument.documentElement[utils.NATIVE_PREFIX + 'contains'](this)) {\n return true;\n }\n // Slow path for non-distributed nodes.\n let node = this;\n while (node && !(node instanceof Document)) {\n node = node[utils.SHADY_PREFIX + 'parentNode'] || (utils.isShadyRoot(node) ? /** @type {ShadowRoot} */(node).host : undefined);\n }\n return !!(node && node instanceof Document);\n },\n\n /** @this {Node} */\n get textContent() {\n if (utils.isTrackingLogicalChildNodes(this)) {\n let tc = [];\n for (let i = 0, cn = this[utils.SHADY_PREFIX + 'childNodes'], c; (c = cn[i]); i++) {\n if (c.nodeType !== Node.COMMENT_NODE) {\n tc.push(c[utils.SHADY_PREFIX + 'textContent']);\n }\n }\n return tc.join('');\n } else {\n return this[utils.NATIVE_PREFIX + 'textContent'];\n }\n },\n\n /**\n * @this {Node}\n * @param {string} value\n */\n set textContent(value) {\n if (typeof value === 'undefined' || value === null) {\n value = ''\n }\n switch (this.nodeType) {\n case Node.ELEMENT_NODE:\n case Node.DOCUMENT_FRAGMENT_NODE:\n if (!utils.isTrackingLogicalChildNodes(this) && utils.settings.hasDescriptors) {\n // may be removing a nested slot but fast path if we know we are not.\n const firstChild = this[utils.SHADY_PREFIX + 'firstChild'];\n if (firstChild != this[utils.SHADY_PREFIX + 'lastChild'] ||\n (firstChild && firstChild.nodeType != Node.TEXT_NODE)) {\n clearNode(this);\n }\n this[utils.NATIVE_PREFIX + 'textContent'] = value;\n } else {\n clearNode(this);\n // Document fragments must have no childNodes if setting a blank string\n if (value.length > 0 || this.nodeType === Node.ELEMENT_NODE) {\n this[utils.SHADY_PREFIX + 'insertBefore'](document.createTextNode(value))\n }\n }\n break;\n default:\n // Note, be wary of patching `nodeValue`.\n this.nodeValue = value;\n break;\n }\n },\n\n // Patched `insertBefore`. Note that all mutations that add nodes are routed\n // here. When a <slot> is added or a node is added to a host with a shadowRoot\n // with a slot, a standard dom `insert` call is aborted and `_asyncRender`\n // is called on the relevant shadowRoot. In all other cases, a standard dom\n // `insert` can be made, but the location and ref_node may need to be changed.\n /**\n * @this {Node}\n * @param {Node} node\n * @param {Node=} ref_node\n */\n insertBefore(node, ref_node) {\n // optimization: assume native insertBefore is ok if the nodes are not in the document.\n if (this.ownerDocument !== doc && node.ownerDocument !== doc) {\n this[utils.NATIVE_PREFIX + 'insertBefore'](node, ref_node);\n return node;\n }\n if (node === this) {\n throw Error(`Failed to execute 'appendChild' on 'Node': The new child element contains the parent.`);\n }\n if (ref_node) {\n const refData = shadyDataForNode(ref_node);\n const p = refData && refData.parentNode;\n if ((p !== undefined && p !== this) ||\n (p === undefined && ref_node[utils.NATIVE_PREFIX + 'parentNode'] !== this)) {\n throw Error(`Failed to execute 'insertBefore' on 'Node': The node ` +\n `before which the new node is to be inserted is not a child of this node.`);\n }\n }\n if (ref_node === node) {\n return node;\n }\n /** @type {!Array<!HTMLSlotElement>} */\n const slotsAdded = [];\n const ownerRoot = ownerShadyRootForNode(this);\n /** @type {string} */\n const newScopeName = ownerRoot ? ownerRoot.host.localName : currentScopeForNode(this);\n /** @type {string} */\n let oldScopeName;\n // remove from existing location\n const parentNode = node[utils.SHADY_PREFIX + 'parentNode'];\n if (parentNode) {\n oldScopeName = currentScopeForNode(node);\n parentNode[utils.SHADY_PREFIX + 'removeChild'](node,\n Boolean(ownerRoot) || !ownerShadyRootForNode(node));\n }\n // add to new parent\n let allowNativeInsert = true;\n const needsScoping = (!preferPerformance || node['__noInsertionPoint'] === undefined) &&\n !currentScopeIsCorrect(node, newScopeName);\n const needsSlotFinding = ownerRoot && !node['__noInsertionPoint'] &&\n (!preferPerformance || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE);\n if (needsSlotFinding || needsScoping) {\n // NOTE: avoid node.removeChild as this *can* trigger another patched\n // method (e.g. custom elements) and we want only the shady method to run.\n // The following table describes what style scoping actions should happen as a result of this insertion.\n // document -> shadowRoot: replace\n // shadowRoot -> shadowRoot: replace\n // shadowRoot -> shadowRoot of same type: do nothing\n // shadowRoot -> document: allow unscoping\n // document -> document: do nothing\n // The \"same type of shadowRoot\" and \"document to document cases rely on `currentScopeIsCorrect` returning true\n if (needsScoping) {\n // in a document or disconnected tree, replace scoping if necessary\n oldScopeName = oldScopeName || currentScopeForNode(node);\n }\n treeVisitor(node, (node) => {\n if (needsSlotFinding && node.localName === 'slot') {\n slotsAdded.push(/** @type {!HTMLSlotElement} */(node));\n }\n if (needsScoping) {\n replaceShadyScoping(node, newScopeName, oldScopeName);\n }\n });\n }\n // if a slot is added, must render containing root.\n if (this.localName === 'slot' || slotsAdded.length) {\n if (slotsAdded.length) {\n ownerRoot._addSlots(slotsAdded);\n }\n if (ownerRoot) {\n ownerRoot._asyncRender();\n }\n }\n if (utils.isTrackingLogicalChildNodes(this)) {\n recordInsertBefore(node, this, ref_node);\n // when inserting into a host with a shadowRoot with slot, use\n // `shadowRoot._asyncRender()` via `attach-shadow` module\n const parentData = shadyDataForNode(this);\n if (utils.hasShadowRootWithSlot(this)) {\n parentData.root._asyncRender();\n allowNativeInsert = false;\n // when inserting into a host with shadowRoot with NO slot, do nothing\n // as the node should not be added to composed dome anywhere.\n } else if (parentData.root) {\n allowNativeInsert = false;\n }\n }\n if (allowNativeInsert) {\n // if adding to a shadyRoot, add to host instead\n let container = utils.isShadyRoot(this) ?\n /** @type {ShadowRoot} */(this).host : this;\n // if ref_node, get the ref_node that's actually in composed dom.\n if (ref_node) {\n ref_node = firstComposedNode(ref_node);\n container[utils.NATIVE_PREFIX + 'insertBefore'](node, ref_node);\n } else {\n container[utils.NATIVE_PREFIX + 'appendChild'](node);\n }\n // Since ownerDocument is not patched, it can be incorrect after this call\n // if the node is physically appended via distribution. This can result\n // in the custom elements polyfill not upgrading the node if it's in an inert doc.\n // We correct this by calling `adoptNode`.\n } else if (node.ownerDocument !== this.ownerDocument) {\n this.ownerDocument.adoptNode(node);\n }\n scheduleObserver(this, node);\n return node;\n },\n\n /**\n * @this {Node}\n * @param {Node} node\n */\n appendChild(node) {\n return this[utils.SHADY_PREFIX + 'insertBefore'](node);\n },\n\n /**\n * Patched `removeChild`. Note that all dom \"removals\" are routed here.\n * Removes the given `node` from the element's `children`.\n * This method also performs dom composition.\n * @this {Node}\n * @param {Node} node\n * @param {boolean=} skipUnscoping\n */\n removeChild(node, skipUnscoping = false) {\n if (this.ownerDocument !== doc) {\n return this[utils.NATIVE_PREFIX + 'removeChild'](node);\n }\n if (node[utils.SHADY_PREFIX + 'parentNode'] !== this) {\n throw Error('The node to be removed is not a child of this node: ' +\n node);\n }\n let preventNativeRemove;\n let ownerRoot = ownerShadyRootForNode(node);\n const removingInsertionPoint = ownerRoot && ownerRoot._removeContainedSlots(node);\n const parentData = shadyDataForNode(this);\n if (utils.isTrackingLogicalChildNodes(this)) {\n recordRemoveChild(node, this);\n if (utils.hasShadowRootWithSlot(this)) {\n parentData.root._asyncRender();\n preventNativeRemove = true;\n }\n }\n // unscope a node leaving a ShadowRoot if ShadyCSS is present, and this node\n // is not going to be rescoped in `insertBefore`\n if (getScopingShim() && !skipUnscoping && ownerRoot) {\n const oldScopeName = currentScopeForNode(node);\n treeVisitor(node, (node) => {\n removeShadyScoping(node, oldScopeName);\n });\n }\n removeOwnerShadyRoot(node);\n // if removing slot, must render containing root\n if (ownerRoot) {\n let changeSlotContent = this && this.localName === 'slot';\n if (changeSlotContent) {\n preventNativeRemove = true;\n }\n if (removingInsertionPoint || changeSlotContent) {\n ownerRoot._asyncRender();\n }\n }\n if (!preventNativeRemove) {\n // if removing from a shadyRoot, remove from host instead\n let container = utils.isShadyRoot(this) ?\n /** @type {ShadowRoot} */(this).host :\n this;\n // not guaranteed to physically be in container; e.g.\n // (1) if parent has a shadyRoot, element may or may not at distributed\n // location (could be undistributed)\n // (2) if parent is a slot, element may not ben in composed dom\n if (!(parentData.root || node.localName === 'slot') ||\n (container === node[utils.NATIVE_PREFIX + 'parentNode'])) {\n container[utils.NATIVE_PREFIX + 'removeChild'](node);\n }\n }\n scheduleObserver(this, null, node);\n return node;\n },\n\n /**\n * @this {Node}\n * @param {Node} node\n * @param {Node=} ref_node\n */\n replaceChild(node, ref_node) {\n this[utils.SHADY_PREFIX + 'insertBefore'](node, ref_node);\n this[utils.SHADY_PREFIX + 'removeChild'](ref_node);\n return node;\n },\n\n /**\n * @this {Node}\n * @param {boolean=} deep\n */\n cloneNode(deep) {\n if (this.localName == 'template') {\n return this[utils.NATIVE_PREFIX + 'cloneNode'](deep);\n } else {\n const n = this[utils.NATIVE_PREFIX + 'cloneNode'](false);\n // Attribute nodes historically had childNodes, but they have later\n // been removed from the spec.\n // Make sure we do not do a deep clone on them for old browsers (IE11)\n if (deep && n.nodeType !== Node.ATTRIBUTE_NODE) {\n let c$ = this[utils.SHADY_PREFIX + 'childNodes'];\n for (let i=0, nc; i < c$.length; i++) {\n nc = c$[i][utils.SHADY_PREFIX + 'cloneNode'](true);\n n[utils.SHADY_PREFIX + 'appendChild'](nc);\n }\n }\n return n;\n }\n },\n\n /**\n * @this {Node}\n * @param {Object=} options\n */\n // TODO(sorvell): implement `options` e.g. `{ composed: boolean }`\n getRootNode(options) { // eslint-disable-line no-unused-vars\n if (!this || !this.nodeType) {\n return;\n }\n const nodeData = ensureShadyDataForNode(this);\n let root = nodeData.ownerShadyRoot;\n if (root === undefined) {\n if (utils.isShadyRoot(this)) {\n root = this;\n nodeData.ownerShadyRoot = root;\n } else {\n let parent = this[utils.SHADY_PREFIX + 'parentNode'];\n root = parent ? parent[utils.SHADY_PREFIX + 'getRootNode'](options) : this;\n // memo-ize result for performance but only memo-ize\n // result if node is in the document. This avoids a problem where a root\n // can be cached while an element is inside a fragment.\n // If this happens and we cache the result, the value can become stale\n // because for perf we avoid processing the subtree of added fragments.\n if (document.documentElement[utils.NATIVE_PREFIX + 'contains'](this)) {\n nodeData.ownerShadyRoot = root;\n }\n }\n\n }\n return root;\n },\n\n /** @this {Node} */\n contains(node) {\n return utils.contains(this, node);\n }\n\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport {calculateSplices} from './array-splice.js';\nimport * as utils from './utils.js';\nimport {enqueue} from './flush.js';\nimport {ensureShadyDataForNode, shadyDataForNode} from './shady-data.js';\nimport {recordChildNodes} from './link-nodes.js';\nimport {patchShadyRoot} from './patch-shadyRoot.js';\n\n// Do not export this object. It must be passed as the first argument to the\n// ShadyRoot constructor in `attachShadow` to prevent the constructor from\n// throwing. This prevents the user from being able to manually construct a\n// ShadyRoot (i.e. `new ShadowRoot()`).\nconst ShadyRootConstructionToken = {};\n\nconst CATCHALL_NAME = '__catchall';\nconst SHADYROOT_NAME = 'ShadyRoot';\n\nconst MODE_CLOSED = 'closed';\n\nlet isRendering = utils.settings['deferConnectionCallbacks'] && document.readyState === 'loading';\nlet rootRendered;\n\nfunction ancestorList(node) {\n let ancestors = [];\n do {\n ancestors.unshift(node);\n } while ((node = node[utils.SHADY_PREFIX + 'parentNode']));\n return ancestors;\n}\n\n/**\n * @extends {ShadowRoot}\n */\nclass ShadyRoot {\n\n constructor(token, host, options) {\n if (token !== ShadyRootConstructionToken) {\n throw new TypeError('Illegal constructor');\n }\n // NOTE: set a fake local name so this element can be\n // distinguished from a DocumentFragment when patching.\n // FF doesn't allow this to be `localName`\n this._localName = SHADYROOT_NAME;\n // root <=> host\n this.host = host;\n /** @type {!string|undefined} */\n this.mode = options && options.mode;\n recordChildNodes(host);\n const hostData = ensureShadyDataForNode(host);\n /** @type {!ShadyRoot} */\n hostData.root = this;\n hostData.publicRoot = this.mode !== MODE_CLOSED ? this : null;\n // setup root\n const rootData = ensureShadyDataForNode(this);\n rootData.firstChild = rootData.lastChild =\n rootData.parentNode = rootData.nextSibling =\n rootData.previousSibling = null;\n rootData.childNodes = [];\n // state flags\n this._renderPending = false;\n this._hasRendered = false;\n // marsalled lazily\n this._slotList = null;\n /** @type {Object<string, Array<HTMLSlotElement>>} */\n this._slotMap = null;\n this._pendingSlots = null;\n // NOTE: optimization flag, only require an asynchronous render\n // to record parsed children if flag is not set.\n if (utils.settings['preferPerformance']) {\n let n;\n while ((n = host[utils.NATIVE_PREFIX + 'firstChild'])) {\n host[utils.NATIVE_PREFIX + 'removeChild'](n);\n }\n } else {\n this._asyncRender();\n }\n }\n\n _asyncRender() {\n if (!this._renderPending) {\n this._renderPending = true;\n enqueue(() => this._render());\n }\n }\n\n // returns the oldest renderPending ancestor root.\n _getPendingDistributionRoot() {\n let renderRoot;\n let root = this;\n while (root) {\n if (root._renderPending) {\n renderRoot = root;\n }\n root = root._getDistributionParent();\n }\n return renderRoot;\n }\n\n // Returns the shadyRoot `this.host` if `this.host`\n // has children that require distribution.\n _getDistributionParent() {\n let root = this.host[utils.SHADY_PREFIX + 'getRootNode']();\n if (!utils.isShadyRoot(root)) {\n return;\n }\n const nodeData = shadyDataForNode(this.host);\n if (nodeData && nodeData.__childSlotCount > 0) {\n return root;\n }\n }\n\n // Renders the top most render pending shadowRoot in the distribution tree.\n // This is safe because when a distribution parent renders, all children render.\n _render() {\n // If this root is not pending, it needs no rendering work. Any pending\n // parent that needs to render wll cause this root to render.\n const root = this._renderPending && this._getPendingDistributionRoot();\n if (root) {\n root._renderSelf();\n }\n }\n\n _flushInitial() {\n if (!this._hasRendered && this._renderPending) {\n this._render();\n }\n }\n\n /** @override */\n _renderSelf() {\n // track rendering state.\n const wasRendering = isRendering;\n isRendering = true;\n this._renderPending = false;\n if (this._slotList) {\n this._distribute();\n this._compose();\n }\n // NOTE: optimization flag, only process parsed children\n // if optimization flag is not set.\n // on initial render remove any undistributed children.\n if (!utils.settings['preferPerformance'] && !this._hasRendered) {\n const c$ = this.host[utils.SHADY_PREFIX + 'childNodes'];\n for (let i=0, l=c$.length; i < l; i++) {\n const child = c$[i];\n const data = shadyDataForNode(child);\n if (child[utils.NATIVE_PREFIX + 'parentNode'] === this.host &&\n (child.localName === 'slot' || !data.assignedSlot)) {\n this.host[utils.NATIVE_PREFIX + 'removeChild'](child);\n }\n }\n }\n this._hasRendered = true;\n isRendering = wasRendering;\n if (rootRendered) {\n rootRendered();\n }\n }\n\n _distribute() {\n this._validateSlots();\n // capture # of previously assigned nodes to help determine if dirty.\n for (let i=0, slot; i < this._slotList.length; i++) {\n slot = this._slotList[i];\n this._clearSlotAssignedNodes(slot);\n }\n // distribute host children.\n for (let n=this.host[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) {\n this._distributeNodeToSlot(n);\n }\n // fallback content, slotchange, and dirty roots\n for (let i=0; i < this._slotList.length; i++) {\n const slot = this._slotList[i];\n const slotData = shadyDataForNode(slot);\n // distribute fallback content\n if (!slotData.assignedNodes.length) {\n for (let n=slot[utils.SHADY_PREFIX + 'firstChild']; n; n=n[utils.SHADY_PREFIX + 'nextSibling']) {\n this._distributeNodeToSlot(n, slot);\n }\n }\n const slotParentData = shadyDataForNode(slot[utils.SHADY_PREFIX + 'parentNode']);\n const slotParentRoot = slotParentData && slotParentData.root;\n if (slotParentRoot && (slotParentRoot._hasInsertionPoint() || slotParentRoot._renderPending)) {\n slotParentRoot._renderSelf();\n }\n this._addAssignedToFlattenedNodes(slotData.flattenedNodes,\n slotData.assignedNodes);\n let prevAssignedNodes = slotData._previouslyAssignedNodes;\n if (prevAssignedNodes) {\n for (let i=0; i < prevAssignedNodes.length; i++) {\n shadyDataForNode(prevAssignedNodes[i])._prevAssignedSlot = null;\n }\n slotData._previouslyAssignedNodes = null;\n // dirty if previously less assigned nodes than previously assigned.\n if (prevAssignedNodes.length > slotData.assignedNodes.length) {\n slotData.dirty = true;\n }\n }\n /* Note: A slot is marked dirty whenever a node is newly assigned to it\n or a node is assigned to a different slot (done in `_distributeNodeToSlot`)\n or if the number of nodes assigned to the slot has decreased (done above);\n */\n if (slotData.dirty) {\n slotData.dirty = false;\n this._fireSlotChange(slot);\n }\n }\n }\n\n /**\n * Distributes given `node` to the appropriate slot based on its `slot`\n * attribute. If `forcedSlot` is given, then the node is distributed to the\n * `forcedSlot`.\n * Note: slot to which the node is assigned will be marked dirty for firing\n * `slotchange`.\n * @param {Node} node\n * @param {Node=} forcedSlot\n *\n */\n _distributeNodeToSlot(node, forcedSlot) {\n const nodeData = ensureShadyDataForNode(node);\n let oldSlot = nodeData._prevAssignedSlot;\n nodeData._prevAssignedSlot = null;\n let slot = forcedSlot;\n if (!slot) {\n let name = node[utils.SHADY_PREFIX + 'slot'] || CATCHALL_NAME;\n const list = this._slotMap[name];\n slot = list && list[0];\n }\n if (slot) {\n const slotData = ensureShadyDataForNode(slot);\n slotData.assignedNodes.push(node);\n nodeData.assignedSlot = slot;\n } else {\n nodeData.assignedSlot = undefined;\n }\n if (oldSlot !== nodeData.assignedSlot) {\n if (nodeData.assignedSlot) {\n ensureShadyDataForNode(nodeData.assignedSlot).dirty = true;\n }\n }\n }\n\n /**\n * Clears the assignedNodes tracking data for a given `slot`. Note, the current\n * assigned node data is tracked (via _previouslyAssignedNodes and\n * _prevAssignedSlot) to see if `slotchange` should fire. This data may be out\n * of date at this time because the assigned nodes may have already been\n * distributed to another root. This is ok since this data is only used to\n * track changes.\n * @param {HTMLSlotElement} slot\n */\n _clearSlotAssignedNodes(slot) {\n const slotData = shadyDataForNode(slot);\n let n$ = slotData.assignedNodes;\n slotData.assignedNodes = [];\n slotData.flattenedNodes = [];\n slotData._previouslyAssignedNodes = n$;\n if (n$) {\n for (let i=0; i < n$.length; i++) {\n let n = shadyDataForNode(n$[i]);\n n._prevAssignedSlot = n.assignedSlot;\n // only clear if it was previously set to this slot;\n // this helps ensure that if the node has otherwise been distributed\n // ignore it.\n if (n.assignedSlot === slot) {\n n.assignedSlot = null;\n }\n }\n }\n }\n\n _addAssignedToFlattenedNodes(flattened, assigned) {\n for (let i=0, n; (i<assigned.length) && (n=assigned[i]); i++) {\n if (n.localName == 'slot') {\n const nestedAssigned = shadyDataForNode(n).assignedNodes;\n if (nestedAssigned && nestedAssigned.length) {\n this._addAssignedToFlattenedNodes(flattened, nestedAssigned);\n }\n } else {\n flattened.push(assigned[i]);\n }\n }\n }\n\n _fireSlotChange(slot) {\n // NOTE: cannot bubble correctly here so not setting bubbles: true\n // Safari tech preview does not bubble but chrome does\n // Spec says it bubbles (https://dom.spec.whatwg.org/#mutation-observers)\n slot[utils.NATIVE_PREFIX + 'dispatchEvent'](new Event('slotchange'));\n const slotData = shadyDataForNode(slot);\n if (slotData.assignedSlot) {\n this._fireSlotChange(slotData.assignedSlot);\n }\n }\n\n // Reify dom such that it is at its correct rendering position\n // based on logical distribution.\n // NOTE: here we only compose parents of <slot> elements and not the\n // shadowRoot into the host. The latter is performend via a fast path\n // in the `logical-mutation`.insertBefore.\n _compose() {\n const slots = this._slotList;\n let composeList = [];\n for (let i=0; i < slots.length; i++) {\n const parent = slots[i][utils.SHADY_PREFIX + 'parentNode'];\n /* compose node only if:\n (1) parent does not have a shadowRoot since shadowRoot has already\n composed into the host\n (2) we're not already composing it\n [consider (n^2) but rare better than Set]\n */\n const parentData = shadyDataForNode(parent);\n if (!(parentData && parentData.root) &&\n composeList.indexOf(parent) < 0) {\n composeList.push(parent);\n }\n }\n for (let i=0; i < composeList.length; i++) {\n const node = composeList[i];\n const targetNode = node === this ? this.host : node;\n this._updateChildNodes(targetNode, this._composeNode(node));\n }\n }\n\n // Returns the list of nodes which should be rendered inside `node`.\n _composeNode(node) {\n let children = [];\n let c$ = node[utils.SHADY_PREFIX + 'childNodes'];\n for (let i = 0; i < c$.length; i++) {\n let child = c$[i];\n // Note: if we see a slot here, the nodes are guaranteed to need to be\n // composed here. This is because if there is redistribution, it has\n // already been handled by this point.\n if (this._isInsertionPoint(child)) {\n let flattenedNodes = shadyDataForNode(child).flattenedNodes;\n for (let j = 0; j < flattenedNodes.length; j++) {\n let distributedNode = flattenedNodes[j];\n children.push(distributedNode);\n }\n } else {\n children.push(child);\n }\n }\n return children;\n }\n\n _isInsertionPoint(node) {\n return node.localName == 'slot';\n }\n\n // Ensures that the rendered node list inside `container` is `children`.\n _updateChildNodes(container, children) {\n let composed = Array.prototype.slice.call(container[utils.NATIVE_PREFIX + 'childNodes']);\n let splices = calculateSplices(children, composed);\n // process removals\n for (let i=0, d=0, s; (i<splices.length) && (s=splices[i]); i++) {\n for (let j=0, n; (j < s.removed.length) && (n=s.removed[j]); j++) {\n // check if the node is still where we expect it is before trying\n // to remove it; this can happen if we move a node and\n // then schedule its previous host for distribution resulting in\n // the node being removed here.\n if (n[utils.NATIVE_PREFIX + 'parentNode'] === container) {\n container[utils.NATIVE_PREFIX + 'removeChild'](n);\n }\n // TODO(sorvell): avoid the need for splicing here.\n composed.splice(s.index + d, 1);\n }\n d -= s.addedCount;\n }\n // process adds\n for (let i=0, s, next; (i<splices.length) && (s=splices[i]); i++) { //eslint-disable-line no-redeclare\n next = composed[s.index];\n for (let j=s.index, n; j < s.index + s.addedCount; j++) {\n n = children[j];\n container[utils.NATIVE_PREFIX + 'insertBefore'](n, next);\n composed.splice(j, 0, n);\n }\n }\n }\n\n _ensureSlotData() {\n this._pendingSlots = this._pendingSlots || [];\n this._slotList = this._slotList || [];\n this._slotMap = this._slotMap || {};\n }\n\n _addSlots(slots) {\n this._ensureSlotData();\n this._pendingSlots.push(...slots);\n }\n\n _validateSlots() {\n if (this._pendingSlots && this._pendingSlots.length) {\n this._mapSlots(this._pendingSlots);\n this._pendingSlots = [];\n }\n }\n\n /**\n * Adds the given slots. Slots are maintained in an dom-ordered list.\n * In addition a map of name to slot is updated.\n */\n _mapSlots(slots) {\n let slotNamesToSort;\n for (let i=0; i < slots.length; i++) {\n const slot = slots[i];\n // ensure insertionPoints's and their parents have logical dom info.\n // save logical tree info\n // a. for shadyRoot\n // b. for insertion points (fallback)\n // c. for parents of insertion points\n recordChildNodes(slot);\n const slotParent = slot[utils.SHADY_PREFIX + 'parentNode'];\n recordChildNodes(slotParent);\n const slotParentData = shadyDataForNode(slotParent);\n slotParentData.__childSlotCount = (slotParentData.__childSlotCount || 0) + 1;\n let name = this._nameForSlot(slot);\n if (this._slotMap[name]) {\n slotNamesToSort = slotNamesToSort || {};\n slotNamesToSort[name] = true;\n this._slotMap[name].push(slot);\n } else {\n this._slotMap[name] = [slot];\n }\n this._slotList.push(slot);\n }\n if (slotNamesToSort) {\n for (let n in slotNamesToSort) {\n this._slotMap[n] = this._sortSlots(this._slotMap[n]);\n }\n }\n }\n\n _nameForSlot(slot) {\n const name = slot['name'] || slot.getAttribute('name') || CATCHALL_NAME;\n slot.__slotName = name;\n return name;\n }\n\n /**\n * Slots are kept in an ordered list. Slots with the same name\n * are sorted here by tree order.\n */\n _sortSlots(slots) {\n // NOTE: Cannot use `compareDocumentPosition` because it's not polyfilled,\n // but the code here could be used to polyfill the preceeding/following info\n // in `compareDocumentPosition`.\n return slots.sort((a, b) => {\n let listA = ancestorList(a);\n let listB = ancestorList(b);\n for (var i=0; i < listA.length; i++) {\n let nA = listA[i];\n let nB = listB[i];\n if (nA !== nB) {\n let c$ = Array.from(nA[utils.SHADY_PREFIX + 'parentNode'][utils.SHADY_PREFIX + 'childNodes']);\n return c$.indexOf(nA) - c$.indexOf(nB);\n }\n }\n });\n }\n\n /**\n * Removes from tracked slot data any slots contained within `container` and\n * then updates the tracked data (_slotList and _slotMap).\n * Any removed slots also have their `assignedNodes` removed from comopsed dom.\n */\n _removeContainedSlots(container) {\n if (!this._slotList) {\n return;\n }\n this._validateSlots();\n let didRemove;\n const map = this._slotMap;\n for (let n in map) {\n const slots = map[n];\n for (let i=0; i < slots.length; i++) {\n const slot = slots[i];\n if (utils.contains(container, slot)) {\n slots.splice(i, 1);\n const x = this._slotList.indexOf(slot);\n if (x >= 0) {\n this._slotList.splice(x, 1);\n const slotParentData = shadyDataForNode(slot[utils.SHADY_PREFIX + 'parentNode']);\n if (slotParentData && slotParentData.__childSlotCount) {\n slotParentData.__childSlotCount--;\n }\n }\n i--;\n this._removeFlattenedNodes(slot);\n didRemove = true;\n }\n }\n }\n return didRemove;\n }\n\n _updateSlotName(slot) {\n if (!this._slotList) {\n return;\n }\n // make sure slotMap is initialized with this slot\n this._validateSlots();\n const oldName = slot.__slotName;\n const name = this._nameForSlot(slot);\n if (name === oldName) {\n return;\n }\n // remove from existing tracking\n let slots = this._slotMap[oldName];\n const i = slots.indexOf(slot);\n if (i >= 0) {\n slots.splice(i, 1);\n }\n // add to new location and sort if nedessary\n let list = this._slotMap[name] || (this._slotMap[name] = []);\n list.push(slot);\n if (list.length > 1) {\n this._slotMap[name] = this._sortSlots(list);\n }\n }\n\n _removeFlattenedNodes(slot) {\n const data = shadyDataForNode(slot);\n let n$ = data.flattenedNodes;\n if (n$) {\n for (let i=0; i<n$.length; i++) {\n let node = n$[i];\n let parent = node[utils.NATIVE_PREFIX + 'parentNode'];\n if (parent) {\n parent[utils.NATIVE_PREFIX + 'removeChild'](node);\n }\n }\n }\n data.flattenedNodes = [];\n data.assignedNodes = [];\n }\n\n _hasInsertionPoint() {\n this._validateSlots();\n return Boolean(this._slotList && this._slotList.length);\n }\n}\n\npatchShadyRoot(ShadyRoot.prototype);\nexport {ShadyRoot};\n\n/**\n Implements a pared down version of ShadowDOM's scoping, which is easy to\n polyfill across browsers.\n*/\nexport const attachShadow = (host, options) => {\n if (!host) {\n throw new Error('Must provide a host.');\n }\n if (!options) {\n throw new Error('Not enough arguments.');\n }\n return new ShadyRoot(ShadyRootConstructionToken, host, options);\n}\n\n// Mitigate connect/disconnect spam by wrapping custom element classes.\nif (window['customElements'] && utils.settings.inUse && !utils.settings['preferPerformance']) {\n\n // process connect/disconnect after roots have rendered to avoid\n // issues with reaction stack.\n let connectMap = new Map();\n rootRendered = function() {\n // allow elements to connect\n // save map state (without needing polyfills on IE11)\n const r = [];\n connectMap.forEach((v, k) => {\n r.push([k, v]);\n });\n connectMap.clear();\n for (let i=0; i < r.length; i++) {\n const e = r[i][0], value = r[i][1];\n if (value) {\n e.__shadydom_connectedCallback();\n } else {\n e.__shadydom_disconnectedCallback();\n }\n }\n }\n\n // Document is in loading state and flag is set (deferConnectionCallbacks)\n // so process connection stack when `readystatechange` fires.\n if (isRendering) {\n document.addEventListener('readystatechange', () => {\n isRendering = false;\n rootRendered();\n }, {once: true});\n }\n\n /*\n * (1) elements can only be connected/disconnected if they are in the expected\n * state.\n * (2) never run connect/disconnect during rendering to avoid reaction stack issues.\n */\n const ManageConnect = (base, connected, disconnected) => {\n let counter = 0;\n const connectFlag = `__isConnected${counter++}`;\n if (connected || disconnected) {\n\n /** @this {!HTMLElement} */\n base.prototype.connectedCallback = base.prototype.__shadydom_connectedCallback = function() {\n // if rendering defer connected\n // otherwise connect only if we haven't already\n if (isRendering) {\n connectMap.set(this, true);\n } else if (!this[connectFlag]) {\n this[connectFlag] = true;\n if (connected) {\n connected.call(this);\n }\n }\n }\n\n /** @this {!HTMLElement} */\n base.prototype.disconnectedCallback = base.prototype.__shadydom_disconnectedCallback = function() {\n // if rendering, cancel a pending connection and queue disconnect,\n // otherwise disconnect only if a connection has been allowed\n if (isRendering) {\n // This is necessary only because calling removeChild\n // on a node that requires distribution leaves it in the DOM tree\n // until distribution.\n // NOTE: remember this is checking the patched isConnected to determine\n // if the node is in the logical tree.\n if (!this.isConnected) {\n connectMap.set(this, false);\n }\n } else if (this[connectFlag]) {\n this[connectFlag] = false;\n if (disconnected) {\n disconnected.call(this);\n }\n }\n }\n }\n\n return base;\n }\n\n const define = window['customElements']['define'];\n // NOTE: Instead of patching customElements.define,\n // re-define on the CustomElementRegistry.prototype.define\n // for Safari 10 compatibility (it's flakey otherwise).\n Object.defineProperty(window['CustomElementRegistry'].prototype, 'define', {\n value: function(name, constructor) {\n const connected = constructor.prototype.connectedCallback;\n const disconnected = constructor.prototype.disconnectedCallback;\n define.call(window['customElements'], name,\n ManageConnect(constructor, connected, disconnected));\n // unpatch connected/disconnected on class; custom elements tears this off\n // so the patch is maintained, but if the user calls these methods for\n // e.g. testing, they will be as expected.\n constructor.prototype.connectedCallback = connected;\n constructor.prototype.disconnectedCallback = disconnected;\n }\n });\n\n}\n\n/** @return {!ShadyRoot|undefined} */\nexport const ownerShadyRootForNode = (node) => {\n let root = node[utils.SHADY_PREFIX + 'getRootNode']();\n if (utils.isShadyRoot(root)) {\n return root;\n }\n}\n",null,null,"/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {shadyDataForNode} from '../shady-data.js';\n\n/**\n * @param {Node} node\n * @param {Function} matcher\n * @param {Function=} halter\n */\nexport function query(node, matcher, halter) {\n let list = [];\n queryElements(node[utils.SHADY_PREFIX + 'childNodes'], matcher,\n halter, list);\n return list;\n}\n\nfunction queryElements(elements, matcher, halter, list) {\n for (let i=0, l=elements.length, c; (i<l) && (c=elements[i]); i++) {\n if (c.nodeType === Node.ELEMENT_NODE &&\n queryElement(c, matcher, halter, list)) {\n return true;\n }\n }\n}\n\nfunction queryElement(node, matcher, halter, list) {\n let result = matcher(node);\n if (result) {\n list.push(node);\n }\n if (halter && halter(result)) {\n return result;\n }\n queryElements(node[utils.SHADY_PREFIX + 'childNodes'], matcher,\n halter, list);\n}\n\n// Needed on Element, DocumentFragment, Document\nexport const ParentNodePatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Element} */\n get firstElementChild() {\n const nodeData = shadyDataForNode(this);\n if (nodeData && nodeData.firstChild !== undefined) {\n let n = this[utils.SHADY_PREFIX + 'firstChild'];\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n[utils.SHADY_PREFIX + 'nextSibling'];\n }\n return n;\n } else {\n return this[utils.NATIVE_PREFIX + 'firstElementChild'];\n }\n },\n\n /** @this {Element} */\n get lastElementChild() {\n const nodeData = shadyDataForNode(this);\n if (nodeData && nodeData.lastChild !== undefined) {\n let n = this[utils.SHADY_PREFIX + 'lastChild'];\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n[utils.SHADY_PREFIX + 'previousSibling'];\n }\n return n;\n } else {\n return this[utils.NATIVE_PREFIX + 'lastElementChild'];\n }\n },\n\n /** @this {Element} */\n get children() {\n if (!utils.isTrackingLogicalChildNodes(this)) {\n return this[utils.NATIVE_PREFIX + 'children'];\n }\n return utils.createPolyfilledHTMLCollection(Array.prototype.filter.call(\n this[utils.SHADY_PREFIX + 'childNodes'], function(n) {\n return (n.nodeType === Node.ELEMENT_NODE);\n }));\n },\n\n /** @this {Element} */\n get childElementCount() {\n let children = this[utils.SHADY_PREFIX + 'children'];\n if(children) {\n return children.length;\n }\n return 0;\n }\n\n});\n\nexport const QueryPatches = utils.getOwnPropertyDescriptors({\n // TODO(sorvell): consider doing native QSA and filtering results.\n /**\n * @this {Element}\n * @param {string} selector\n */\n querySelector(selector) {\n // match selector and halt on first result.\n let result = query(this, function(n) {\n return utils.matchesSelector(n, selector);\n }, function(n) {\n return Boolean(n);\n })[0];\n return result || null;\n },\n\n /**\n * @this {Element}\n * @param {string} selector\n * @param {boolean} useNative\n */\n // TODO(sorvell): `useNative` option relies on native querySelectorAll and\n // misses distributed nodes, see\n // https://github.com/webcomponents/shadydom/pull/210#issuecomment-361435503\n querySelectorAll(selector, useNative) {\n if (useNative) {\n const o = Array.prototype.slice.call(this[utils.NATIVE_PREFIX + 'querySelectorAll'](selector));\n const root = this[utils.SHADY_PREFIX + 'getRootNode']();\n return o.filter(e => e[utils.SHADY_PREFIX + 'getRootNode']() == root);\n }\n return query(this, function(n) {\n return utils.matchesSelector(n, selector);\n });\n }\n\n});\n\n// Create a custom `ParentNodeDocumentOrFragment` that optionally does not\n// mixin querySelector/All; this is a performance optimization.\nexport const ParentNodeDocumentOrFragmentPatches = utils.settings.preferPerformance ?\n Object.assign({}, ParentNodePatches) : ParentNodePatches;\n\nObject.assign(ParentNodePatches, QueryPatches);","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\nimport * as utils from '../utils.js';\nimport { query } from './ParentNode.js';\n\nexport const DocumentOrFragmentPatches = utils.getOwnPropertyDescriptors({\n\n /**\n * @this {Element}\n * @param {string} id\n */\n getElementById(id) {\n if (id === '') {\n return null;\n }\n let result = query(this, function(n) {\n return n.id == id;\n }, function(n) {\n return Boolean(n);\n })[0];\n return result || null;\n }\n\n});","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {ownerShadyRootForNode} from '../attach-shadow.js';\n\nfunction getDocumentActiveElement() {\n if (utils.settings.hasDescriptors) {\n return document[utils.NATIVE_PREFIX + 'activeElement'];\n } else {\n return document.activeElement;\n }\n}\n\nexport const DocumentOrShadowRootPatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Document|ShadowRoot} */\n get activeElement() {\n let active = getDocumentActiveElement();\n // In IE11, activeElement might be an empty object if the document is\n // contained in an iframe.\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/10998788/\n if (!active || !active.nodeType) {\n return null;\n }\n let isShadyRoot = !!(utils.isShadyRoot(this));\n if (this !== document) {\n // If this node isn't a document or shady root, then it doesn't have\n // an active element.\n if (!isShadyRoot) {\n return null;\n }\n // If this shady root's host is the active element or the active\n // element is not a descendant of the host (in the composed tree),\n // then it doesn't have an active element.\n if (this.host === active ||\n !this.host[utils.NATIVE_PREFIX + 'contains'](active)) {\n return null;\n }\n }\n // This node is either the document or a shady root of which the active\n // element is a (composed) descendant of its host; iterate upwards to\n // find the active element's most shallow host within it.\n let activeRoot = ownerShadyRootForNode(active);\n while (activeRoot && activeRoot !== this) {\n active = activeRoot.host;\n activeRoot = ownerShadyRootForNode(active);\n }\n if (this === document) {\n // This node is the document, so activeRoot should be null.\n return activeRoot ? null : active;\n } else {\n // This node is a non-document shady root, and it should be\n // activeRoot.\n return activeRoot === this ? active : null;\n }\n }\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {getInnerHTML} from '../innerHTML.js';\nimport {clearNode} from './Node.js';\n\n/** @type {!Document} */\nconst inertDoc = document.implementation.createHTMLDocument('inert');\n\nexport const ElementOrShadowRootPatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Element} */\n get innerHTML() {\n if (utils.isTrackingLogicalChildNodes(this)) {\n const content = this.localName === 'template' ?\n /** @type {HTMLTemplateElement} */(this).content : this;\n return getInnerHTML(content, (e) => e[utils.SHADY_PREFIX + 'childNodes']);\n } else {\n return this[utils.NATIVE_PREFIX + 'innerHTML'];\n }\n },\n\n /**\n * @this {Element}\n * @param {string} value\n */\n set innerHTML(value) {\n if (this.localName === 'template') {\n this[utils.NATIVE_PREFIX + 'innerHTML'] = value;\n } else {\n clearNode(this);\n const containerName = this.localName || 'div';\n let htmlContainer;\n if (!this.namespaceURI || this.namespaceURI === inertDoc.namespaceURI) {\n htmlContainer = inertDoc.createElement(containerName);\n } else {\n htmlContainer = inertDoc.createElementNS(this.namespaceURI, containerName);\n }\n if (utils.settings.hasDescriptors) {\n htmlContainer[utils.NATIVE_PREFIX + 'innerHTML'] = value;\n } else {\n htmlContainer.innerHTML = value;\n }\n let firstChild;\n while ((firstChild = htmlContainer[utils.SHADY_PREFIX + 'firstChild'])) {\n this[utils.SHADY_PREFIX + 'insertBefore'](firstChild);\n }\n }\n }\n\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\n\nexport const ShadowRootPatches = utils.getOwnPropertyDescriptors({\n\n /**\n * @this {ShadowRoot}\n * @param {string} type\n * @param {Function} fn\n * @param {Object|boolean=} optionsOrCapture\n */\n addEventListener(type, fn, optionsOrCapture) {\n if (typeof optionsOrCapture !== 'object') {\n optionsOrCapture = {\n capture: Boolean(optionsOrCapture)\n }\n }\n optionsOrCapture.__shadyTarget = this;\n this.host[utils.SHADY_PREFIX + 'addEventListener'](type, fn, optionsOrCapture);\n },\n\n /**\n * @this {ShadowRoot}\n * @param {string} type\n * @param {Function} fn\n * @param {Object|boolean=} optionsOrCapture\n */\n removeEventListener(type, fn, optionsOrCapture) {\n if (typeof optionsOrCapture !== 'object') {\n optionsOrCapture = {\n capture: Boolean(optionsOrCapture)\n }\n }\n optionsOrCapture.__shadyTarget = this;\n this.host[utils.SHADY_PREFIX + 'removeEventListener'](type, fn, optionsOrCapture);\n }\n\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {NodePatches} from './patches/Node.js';\nimport {OutsideDescriptors, InsideDescriptors} from './patch-instances.js';\nimport {ParentNodePatches} from './patches/ParentNode.js';\nimport {DocumentOrFragmentPatches} from './patches/DocumentOrFragment.js';\nimport {DocumentOrShadowRootPatches} from './patches/DocumentOrShadowRoot.js';\nimport {ElementOrShadowRootPatches} from './patches/ElementOrShadowRoot.js';\nimport {ShadowRootPatches} from './patches/ShadowRoot.js';\n\n/**\n * @param {!Object} proto\n * @param {string=} prefix\n */\nconst patchShadyAccessors = (proto, prefix) => {\n utils.patchProperties(proto, ShadowRootPatches, prefix);\n utils.patchProperties(proto, DocumentOrShadowRootPatches, prefix);\n utils.patchProperties(proto, ElementOrShadowRootPatches, prefix);\n // We ensure ParentNode accessors since these do not exist in Edge/IE on DocumentFragments.\n utils.patchProperties(proto, ParentNodePatches, prefix);\n // Ensure `shadowRoot` has basic descriptors when we cannot rely\n // on them coming from DocumentFragment.\n //\n // Case 1, noPatching: Because we want noPatch ShadyRoots to have native property\n // names so that they do not have to be wrapped...\n // When we do *not* patch Node/DocumentFragment.prototype\n // we must manually install those properties on ShadyRoot's prototype.\n // Note, it's important to only install these in this mode so as not to stomp\n // over CustomElements polyfill's patches on Node/DocumentFragment methods.\n if (utils.settings.noPatch && !prefix) {\n utils.patchProperties(proto, NodePatches, prefix);\n utils.patchProperties(proto, DocumentOrFragmentPatches, prefix);\n // Case 2, bad descriptors: Ensure accessors are on ShadowRoot.\n // These descriptors are normally used for instance patching but because\n // ShadyRoot can always be patched, just do it to the prototype.\n } else if (!utils.settings.hasDescriptors) {\n utils.patchProperties(proto, OutsideDescriptors);\n utils.patchProperties(proto, InsideDescriptors);\n }\n}\n\nexport const patchShadyRoot = (proto) => {\n proto.__proto__ = DocumentFragment.prototype;\n\n // patch both prefixed and not, even when noPatch == true.\n patchShadyAccessors(proto, utils.SHADY_PREFIX);\n patchShadyAccessors(proto);\n\n // Ensure native properties are all safely wrapped since ShadowRoot is not an\n // actual DocumentFragment instance.\n Object.defineProperties(proto, {\n nodeType: {\n value: Node.DOCUMENT_FRAGMENT_NODE,\n configurable: true\n },\n nodeName: {\n value: '#document-fragment',\n configurable: true\n },\n nodeValue: {\n value: null,\n configurable: true\n }\n });\n\n // make undefined\n [\n 'localName',\n 'namespaceURI',\n 'prefix'\n ].forEach((prop) => {\n Object.defineProperty(proto, prop, {\n value: undefined,\n configurable: true\n });\n });\n\n // defer properties to host\n [\n 'ownerDocument',\n 'baseURI',\n 'isConnected'\n ].forEach((prop) => {\n Object.defineProperty(proto, prop, {\n /** @this {ShadowRoot} */\n get() {\n return this.host[prop];\n },\n configurable: true\n });\n });\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {eventPropertyNames} from './patch-events.js';\n\n/** @implements {IWrapper} */\nclass Wrapper {\n\n /** @param {!Node} node */\n constructor(node) {\n this.node = node;\n }\n\n // node\n addEventListener(name, fn, options) {\n return this.node[utils.SHADY_PREFIX + 'addEventListener'](name, fn, options);\n }\n\n removeEventListener(name, fn, options) {\n return this.node[utils.SHADY_PREFIX + 'removeEventListener'](name, fn, options);\n }\n\n appendChild(node) {\n return this.node[utils.SHADY_PREFIX + 'appendChild'](node);\n }\n\n insertBefore(node, ref_node) {\n return this.node[utils.SHADY_PREFIX + 'insertBefore'](node, ref_node);\n }\n\n removeChild(node) {\n return this.node[utils.SHADY_PREFIX + 'removeChild'](node);\n }\n\n replaceChild(node, ref_node) {\n return this.node[utils.SHADY_PREFIX + 'replaceChild'](node, ref_node);\n }\n\n cloneNode(deep) {\n return this.node[utils.SHADY_PREFIX + 'cloneNode'](deep);\n }\n\n getRootNode(options) {\n return this.node[utils.SHADY_PREFIX + 'getRootNode'](options);\n }\n\n contains(node) {\n return this.node[utils.SHADY_PREFIX + 'contains'](node);\n }\n\n dispatchEvent(event) {\n return this.node[utils.SHADY_PREFIX + 'dispatchEvent'](event);\n }\n\n // element\n setAttribute(name, value) {\n this.node[utils.SHADY_PREFIX + 'setAttribute'](name, value);\n }\n\n // NOTE: not needed, just here for balance\n getAttribute(name) {\n return this.node[utils.NATIVE_PREFIX + 'getAttribute'](name);\n }\n\n // NOTE: not needed, just here for balance\n hasAttribute(name) {\n return this.node[utils.NATIVE_PREFIX + 'hasAttribute'](name);\n }\n\n removeAttribute(name) {\n this.node[utils.SHADY_PREFIX + 'removeAttribute'](name);\n }\n\n attachShadow(options) {\n return this.node[utils.SHADY_PREFIX + 'attachShadow'](options);\n }\n\n /** @return {!Node|undefined} */\n get activeElement() {\n if (utils.isShadyRoot(this.node) || this.node.nodeType === Node.DOCUMENT_NODE) {\n const e = this.node[utils.SHADY_PREFIX + 'activeElement'];\n return e;\n }\n }\n\n /**\n * Installed for compatibility with browsers (older Chrome/Safari) that do\n * not have a configurable `activeElement` accessor. Enables noPatch and\n * patch mode both to consistently use ShadyDOM.wrap(document)._activeElement.\n * @override\n * @return {!Node|undefined}\n */\n get _activeElement() {\n return this.activeElement;\n }\n\n // NOTE: not needed, just here for balance\n /** @override */\n focus() {\n this.node[utils.NATIVE_PREFIX + 'focus']();\n }\n\n blur() {\n this.node[utils.SHADY_PREFIX + 'blur']();\n }\n\n // document\n importNode(node, deep) {\n if (this.node.nodeType === Node.DOCUMENT_NODE) {\n return this.node[utils.SHADY_PREFIX + 'importNode'](node, deep);\n }\n }\n\n getElementById(id) {\n if (this.node.nodeType === Node.DOCUMENT_NODE) {\n return this.node[utils.SHADY_PREFIX + 'getElementById'](id);\n }\n }\n\n // query\n querySelector(selector) {\n return this.node[utils.SHADY_PREFIX + 'querySelector'](selector);\n }\n\n querySelectorAll(selector, useNative) {\n return this.node[utils.SHADY_PREFIX + 'querySelectorAll'](selector, useNative);\n }\n\n // slot\n assignedNodes(options) {\n if (this.node.localName === 'slot') {\n return this.node[utils.SHADY_PREFIX + 'assignedNodes'](options);\n }\n }\n\n get host() {\n if (utils.isShadyRoot(this.node)) {\n return /** @type {!ShadowRoot} */(this.node).host;\n }\n }\n\n get parentNode() {\n return this.node[utils.SHADY_PREFIX + 'parentNode'];\n }\n\n get firstChild() {\n return this.node[utils.SHADY_PREFIX + 'firstChild'];\n }\n\n get lastChild() {\n return this.node[utils.SHADY_PREFIX + 'lastChild'];\n }\n\n get nextSibling() {\n return this.node[utils.SHADY_PREFIX + 'nextSibling'];\n }\n\n get previousSibling() {\n return this.node[utils.SHADY_PREFIX + 'previousSibling'];\n }\n\n get childNodes() {\n return this.node[utils.SHADY_PREFIX + 'childNodes'];\n }\n\n get parentElement() {\n return this.node[utils.SHADY_PREFIX + 'parentElement'];\n }\n\n get firstElementChild() {\n return this.node[utils.SHADY_PREFIX + 'firstElementChild'];\n }\n\n get lastElementChild() {\n return this.node[utils.SHADY_PREFIX + 'lastElementChild'];\n }\n\n get nextElementSibling() {\n return this.node[utils.SHADY_PREFIX + 'nextElementSibling'];\n }\n\n get previousElementSibling() {\n return this.node[utils.SHADY_PREFIX + 'previousElementSibling'];\n }\n\n get children() {\n return this.node[utils.SHADY_PREFIX + 'children'];\n }\n\n get childElementCount() {\n return this.node[utils.SHADY_PREFIX + 'childElementCount'];\n }\n\n get shadowRoot() {\n return this.node[utils.SHADY_PREFIX + 'shadowRoot'];\n }\n\n get assignedSlot() {\n return this.node[utils.SHADY_PREFIX + 'assignedSlot'];\n }\n\n get isConnected() {\n return this.node[utils.SHADY_PREFIX + 'isConnected'];\n }\n\n get innerHTML() {\n return this.node[utils.SHADY_PREFIX + 'innerHTML'];\n }\n\n set innerHTML(value) {\n this.node[utils.SHADY_PREFIX + 'innerHTML'] = value;\n }\n\n get textContent() {\n return this.node[utils.SHADY_PREFIX + 'textContent'];\n }\n\n set textContent(value) {\n this.node[utils.SHADY_PREFIX + 'textContent'] = value;\n }\n\n get slot() {\n return this.node[utils.SHADY_PREFIX + 'slot'];\n }\n\n set slot(value) {\n this.node[utils.SHADY_PREFIX + 'slot'] = value;\n }\n\n}\n\neventPropertyNames.forEach(name => {\n Object.defineProperty(Wrapper.prototype, name, {\n /** @this {Wrapper} */\n get() {\n return this.node[utils.SHADY_PREFIX + name];\n },\n /** @this {Wrapper} */\n set(value) {\n this.node[utils.SHADY_PREFIX + name] = value;\n },\n configurable: true\n });\n\n});\n\nexport {Wrapper};\n\nconst wrapperMap = new WeakMap();\n\nexport function wrap(obj) {\n if (utils.isShadyRoot(obj) || obj instanceof Wrapper) {\n return obj;\n }\n let wrapper = wrapperMap.get(obj)\n if (!wrapper) {\n wrapper = new Wrapper(obj);\n wrapperMap.set(obj, wrapper);\n }\n return wrapper;\n}\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {flush} from '../flush.js';\nimport {addEventListener, removeEventListener} from '../patch-events.js';\n\nexport const EventTargetPatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Node} */\n dispatchEvent(event) {\n flush();\n return this[utils.NATIVE_PREFIX + 'dispatchEvent'](event);\n },\n\n addEventListener,\n\n removeEventListener\n\n});","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {shadyDataForNode} from '../shady-data.js';\n\nexport const SlotablePatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Node} */\n get assignedSlot() {\n // Force any parent's shadowRoot to flush so that distribution occurs\n // and this node has an assignedSlot.\n const parent = this[utils.SHADY_PREFIX + 'parentNode'];\n const ownerRoot = parent && parent[utils.SHADY_PREFIX + 'shadowRoot'];\n if (ownerRoot) {\n ownerRoot._render();\n }\n const nodeData = shadyDataForNode(this);\n return nodeData && nodeData.assignedSlot || null;\n }\n\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {scopeClassAttribute} from '../style-scoping.js';\nimport {shadyDataForNode} from '../shady-data.js';\nimport {attachShadow, ownerShadyRootForNode} from '../attach-shadow.js';\n\nconst doc = window.document;\n\n/**\n * Should be called whenever an attribute changes. If the `slot` attribute\n * changes, provokes rendering if necessary. If a `<slot>` element's `name`\n * attribute changes, updates the root's slot map and renders.\n * @param {Node} node\n * @param {string} name\n */\nfunction distributeAttributeChange(node, name) {\n if (name === 'slot') {\n const parent = node[utils.SHADY_PREFIX + 'parentNode'];\n if (utils.hasShadowRootWithSlot(parent)) {\n shadyDataForNode(parent).root._asyncRender();\n }\n } else if (node.localName === 'slot' && name === 'name') {\n let root = ownerShadyRootForNode(node);\n if (root) {\n root._updateSlotName(node);\n root._asyncRender();\n }\n }\n}\n\nexport const ElementPatches = utils.getOwnPropertyDescriptors({\n\n /** @this {Element} */\n get previousElementSibling() {\n const nodeData = shadyDataForNode(this);\n if (nodeData && nodeData.previousSibling !== undefined) {\n let n = this[utils.SHADY_PREFIX + 'previousSibling'];\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n[utils.SHADY_PREFIX + 'previousSibling'];\n }\n return n;\n } else {\n return this[utils.NATIVE_PREFIX + 'previousElementSibling'];\n }\n },\n\n /** @this {Element} */\n get nextElementSibling() {\n const nodeData = shadyDataForNode(this);\n if (nodeData && nodeData.nextSibling !== undefined) {\n let n = this[utils.SHADY_PREFIX + 'nextSibling'];\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n[utils.SHADY_PREFIX + 'nextSibling'];\n }\n return n;\n } else {\n return this[utils.NATIVE_PREFIX + 'nextElementSibling'];\n }\n },\n\n /** @this {Element} */\n get slot() {\n return this.getAttribute('slot');\n },\n\n /** @this {Element} */\n set slot(value) {\n this[utils.SHADY_PREFIX + 'setAttribute']('slot', value);\n },\n\n // Note: Can be patched on element prototype on all browsers.\n // Must be patched on instance on browsers that support native Shadow DOM\n // but do not have builtin accessors (old Chrome).\n /** @this {Element} */\n get shadowRoot() {\n const nodeData = shadyDataForNode(this);\n return nodeData && nodeData.publicRoot || null;\n },\n\n /** @this {Element} */\n get className() {\n return this.getAttribute('class') || '';\n },\n\n /**\n * @this {Element}\n * @param {string} value\n */\n set className(value) {\n this[utils.SHADY_PREFIX + 'setAttribute']('class', value);\n },\n\n /**\n * @this {Element}\n * @param {string} attr\n * @param {string} value\n */\n setAttribute(attr, value) {\n if (this.ownerDocument !== doc) {\n this[utils.NATIVE_PREFIX + 'setAttribute'](attr, value);\n } else if (!scopeClassAttribute(this, attr, value)) {\n this[utils.NATIVE_PREFIX + 'setAttribute'](attr, value);\n distributeAttributeChange(this, attr);\n }\n },\n\n /**\n * @this {Element}\n * @param {string} attr\n */\n removeAttribute(attr) {\n this[utils.NATIVE_PREFIX + 'removeAttribute'](attr);\n distributeAttributeChange(this, attr);\n },\n\n /**\n * @this {Element}\n * @param {!{mode: string}} options\n */\n attachShadow(options) {\n return attachShadow(this, options);\n }\n\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {eventPropertyNames} from '../patch-events.js';\nimport {shadyDataForNode, ensureShadyDataForNode} from '../shady-data.js';\n\nexport const HTMLElementPatches = utils.getOwnPropertyDescriptors({\n\n /** @this {HTMLElement} */\n blur() {\n const nodeData = shadyDataForNode(this);\n let root = nodeData && nodeData.root;\n let shadowActive = root && root.activeElement;\n if (shadowActive) {\n shadowActive[utils.SHADY_PREFIX + 'blur']();\n } else {\n this[utils.NATIVE_PREFIX + 'blur']();\n }\n }\n\n});\n\neventPropertyNames.forEach(property => {\n HTMLElementPatches[property] = {\n /** @this {HTMLElement} */\n set: function(fn) {\n const shadyData = ensureShadyDataForNode(this);\n const eventName = property.substring(2);\n shadyData.__onCallbackListeners[property] && this.removeEventListener(eventName, shadyData.__onCallbackListeners[property]);\n this[utils.SHADY_PREFIX + 'addEventListener'](eventName, fn);\n shadyData.__onCallbackListeners[property] = fn;\n },\n /** @this {HTMLElement} */\n get() {\n const shadyData = shadyDataForNode(this);\n return shadyData && shadyData.__onCallbackListeners[property];\n },\n configurable: true\n };\n});\n\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\nimport {shadyDataForNode} from '../shady-data.js';\n\nexport const SlotPatches = utils.getOwnPropertyDescriptors({\n\n /**\n * @this {HTMLSlotElement}\n * @param {Object=} options\n */\n assignedNodes(options) {\n if (this.localName === 'slot') {\n // Force any containing shadowRoot to flush so that distribution occurs\n // and this node has assignedNodes.\n const root = this[utils.SHADY_PREFIX + 'getRootNode']();\n if (root && utils.isShadyRoot(root)) {\n root._render();\n }\n const nodeData = shadyDataForNode(this);\n return nodeData ?\n ((options && options.flatten ? nodeData.flattenedNodes :\n nodeData.assignedNodes) || []) :\n [];\n }\n }\n\n});\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from '../utils.js';\n\nconst doc = window.document;\n\nexport const DocumentPatches = utils.getOwnPropertyDescriptors({\n\n // note: Though not technically correct, we fast path `importNode`\n // when called on a node not owned by the main document.\n // This allows, for example, elements that cannot\n // contain custom elements and are therefore not likely to contain shadowRoots\n // to cloned natively. This is a fairly significant performance win.\n /**\n * @this {Document}\n * @param {Node} node\n * @param {boolean} deep\n */\n importNode(node, deep) {\n // A template element normally has no children with shadowRoots, so make\n // sure we always make a deep copy to correctly construct the template.content\n if (node.ownerDocument !== doc || node.localName === 'template') {\n return this[utils.NATIVE_PREFIX + 'importNode'](node, deep);\n }\n let n = this[utils.NATIVE_PREFIX + 'importNode'](node, false);\n if (deep) {\n let c$ = node[utils.SHADY_PREFIX + 'childNodes'];\n for (let i=0, nc; i < c$.length; i++) {\n nc = this[utils.SHADY_PREFIX + 'importNode'](c$[i], true);\n n[utils.SHADY_PREFIX + 'appendChild'](nc);\n }\n }\n return n;\n }\n\n});","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\nimport * as utils from '../utils.js';\nimport {addEventListener, removeEventListener} from '../patch-events.js';\n\nexport const WindowPatches = utils.getOwnPropertyDescriptors({\n\n // NOTE: ensure these methods are bound to `window` so that `this` is correct\n // when called directly from global context without a receiver; e.g.\n // `addEventListener(...)`.\n addEventListener: addEventListener.bind(window),\n\n removeEventListener: removeEventListener.bind(window)\n\n});","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nimport * as utils from './utils.js';\nimport {EventTargetPatches} from './patches/EventTarget.js';\nimport {NodePatches} from './patches/Node.js';\nimport {SlotablePatches} from './patches/Slotable.js';\nimport {ParentNodePatches, ParentNodeDocumentOrFragmentPatches} from './patches/ParentNode.js';\nimport {ElementPatches} from './patches/Element.js';\nimport {ElementOrShadowRootPatches} from './patches/ElementOrShadowRoot.js';\nimport {HTMLElementPatches} from './patches/HTMLElement.js';\nimport {SlotPatches} from './patches/Slot.js';\nimport {DocumentOrFragmentPatches} from './patches/DocumentOrFragment.js';\nimport {DocumentOrShadowRootPatches} from './patches/DocumentOrShadowRoot.js';\nimport {DocumentPatches} from './patches/Document.js';\nimport {WindowPatches} from './patches/Window.js';\n\n// Some browsers (IE/Edge) have non-standard HTMLElement accessors.\nconst NonStandardHTMLElement = {};\n\nif (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'parentElement')) {\n NonStandardHTMLElement.parentElement = NodePatches.parentElement;\n}\n\nif (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'contains')) {\n NonStandardHTMLElement.contains = NodePatches.contains;\n}\n\nif (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'children')) {\n NonStandardHTMLElement.children = ParentNodePatches.children;\n}\n\nif (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML')) {\n NonStandardHTMLElement.innerHTML = ElementOrShadowRootPatches.innerHTML;\n}\n\nif (Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'className')) {\n NonStandardHTMLElement.className = ElementPatches.className;\n}\n\n// Avoid patching `innerHTML` if it does not exist on Element (IE)\n// and we can patch accessors (hasDescriptors).\nconst ElementShouldHaveInnerHTML = !utils.settings.hasDescriptors || 'innerHTML' in Element.prototype;\n\n// setup patching\nconst patchMap = {\n EventTarget: [EventTargetPatches],\n Node: [NodePatches, !window.EventTarget ? EventTargetPatches : null],\n Text: [SlotablePatches],\n Element: [ElementPatches, ParentNodePatches, SlotablePatches,\n ElementShouldHaveInnerHTML ? ElementOrShadowRootPatches : null,\n !window.HTMLSlotElement ? SlotPatches : null],\n HTMLElement: [HTMLElementPatches, NonStandardHTMLElement],\n HTMLSlotElement: [SlotPatches],\n DocumentFragment: [ParentNodeDocumentOrFragmentPatches, DocumentOrFragmentPatches],\n Document: [DocumentPatches, ParentNodeDocumentOrFragmentPatches, DocumentOrFragmentPatches, DocumentOrShadowRootPatches],\n Window: [WindowPatches]\n}\n\nconst getPatchPrototype = (name) => window[name] && window[name].prototype;\n\n// Note, must avoid patching accessors on prototypes when descriptors are not correct\n// because the CustomElements polyfill checks if these exist before patching instances.\n// CustomElements polyfill *only* cares about these accessors.\nconst disallowedNativePatches = utils.settings.hasDescriptors ? null : ['innerHTML', 'textContent'];\n\n/** @param {string=} prefix */\nexport const applyPatches = (prefix) => {\n const disallowed = prefix ? null : disallowedNativePatches;\n for (let p in patchMap) {\n const proto = getPatchPrototype(p);\n patchMap[p].forEach(patch => proto && patch &&\n utils.patchProperties(proto, patch, prefix, disallowed));\n }\n}\n\nexport const addShadyPrefixedProperties = () => {\n // perform shady patches\n applyPatches(utils.SHADY_PREFIX);\n\n // install `_activeElement` because some browsers (older Chrome/Safari) do not have\n // a 'configurable' `activeElement` accesssor.\n const descriptor = DocumentOrShadowRootPatches.activeElement;\n Object.defineProperty(document, '_activeElement', descriptor);\n\n // On Window, we're patching `addEventListener` which is a weird auto-bound\n // property that is not directly on the Window prototype.\n utils.patchProperties(Window.prototype, WindowPatches, utils.SHADY_PREFIX);\n};\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/**\n * Patches elements that interacts with ShadyDOM\n * such that tree traversal and mutation apis act like they would under\n * ShadowDOM.\n *\n * This import enables seemless interaction with ShadyDOM powered\n * custom elements, enabling better interoperation with 3rd party code,\n * libraries, and frameworks that use DOM tree manipulation apis.\n */\n\nimport * as utils from './utils.js';\nimport {flush, enqueue} from './flush.js';\nimport {observeChildren, unobserveChildren, filterMutations} from './observe-changes.js';\nimport {addNativePrefixedProperties, nativeMethods, nativeTree} from './patch-native.js';\nimport {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-instances.js';\nimport {patchEvents, patchClick, composedPath} from './patch-events.js';\nimport {ShadyRoot} from './attach-shadow.js';\nimport {wrap, Wrapper} from './wrapper.js';\nimport {addShadyPrefixedProperties, applyPatches} from './patch-prototypes.js';\n\nif (utils.settings.inUse) {\n let ShadyDOM = {\n // TODO(sorvell): remove when Polymer does not depend on this.\n 'inUse': utils.settings.inUse,\n // NOTE: old browsers without prototype accessors (very old Chrome\n // and Safari) need manually patched accessors to properly set\n // `innerHTML` and `textContent` when an element is:\n // (1) inside a shadowRoot\n // (2) does not have special (slot) children itself\n // (3) and setting the property needs to provoke distribution (because\n // a nested slot is added/removed)\n 'patch': (node) => {\n patchInsideElementAccessors(node);\n patchOutsideElementAccessors(node);\n return node;\n },\n 'isShadyRoot': utils.isShadyRoot,\n 'enqueue': enqueue,\n 'flush': flush,\n 'flushInitial': (root) => {\n root._flushInitial();\n },\n 'settings': utils.settings,\n 'filterMutations': filterMutations,\n 'observeChildren': observeChildren,\n 'unobserveChildren': unobserveChildren,\n // Set to true to defer native custom elements connection until the\n // document has fully parsed. This enables custom elements that create\n // shadowRoots to be defined while the document is loading. Elements\n // customized as they are created by the parser will successfully\n // render with this flag on.\n 'deferConnectionCallbacks': utils.settings['deferConnectionCallbacks'],\n // Set to true to speed up the polyfill slightly at the cost of correctness\n // * does not patch querySelector/All on Document or DocumentFragment\n // * does not wrap connected/disconnected callbacks to de-dup these\n // when using native customElements\n // * does not wait to process children of elements with shadowRoots\n // meaning shadowRoots should not be created while an element is parsing\n // (e.g. if a custom element that creates a shadowRoot is defined before\n // a candidate element in the document below it.\n 'preferPerformance': utils.settings['preferPerformance'],\n // Integration point with ShadyCSS to disable styling MutationObserver,\n // as ShadyDOM will now handle dynamic scoping.\n 'handlesDynamicScoping': true,\n 'wrap': utils.settings.noPatch ? wrap : (n) => n,\n 'Wrapper': Wrapper,\n 'composedPath': composedPath,\n // Set to true to avoid patching regular platform property names. When set,\n // Shadow DOM compatible behavior is only available when accessing DOM\n // API using `ShadyDOM.wrap`, e.g. `ShadyDOM.wrap(element).shadowRoot`.\n // This setting provides a small performance boost, but requires all DOM API\n // access that requires Shadow DOM behavior to be proxied via `ShadyDOM.wrap`.\n 'noPatch': utils.settings.noPatch,\n 'nativeMethods': nativeMethods,\n 'nativeTree': nativeTree\n };\n\n window['ShadyDOM'] = ShadyDOM;\n\n // Modifies native prototypes for Node, Element, etc. to\n // make native platform behavior available at prefixed names, e.g.\n // `utils.NATIVE_PREFIX + 'firstChild'` or `__shady_native_firstChild`.\n // This allows the standard names to be safely patched while retaining the\n // ability for native behavior to be used. This polyfill manipulates DOM\n // by using this saved native behavior.\n // Note, some browsers do not have proper element descriptors for\n // accessors; in this case, native behavior for these accessors is simulated\n // via a TreeWalker.\n addNativePrefixedProperties();\n\n // Modifies native prototypes for Node, Element, etc. to make ShadowDOM\n // behavior available at prefixed names, e.g.\n // `utils.SHADY_PREFIX + 'firstChild` or `__shady_firstChild`. This is done\n // so this polyfill can perform Shadow DOM style DOM manipulation.\n // Because patching normal platform property names is optional, these prefixed\n // names are used internally.\n addShadyPrefixedProperties();\n\n // Modifies native prototypes for Node, Element, etc. to patch\n // regular platform property names to have Shadow DOM compatible API behavior.\n // This applies the utils.SHADY_PREFIX behavior to normal names. For example,\n // if `noPatch` is not set, then `el.__shady_firstChild` is equivalent to\n // `el.firstChild`.\n // NOTE, on older browsers (old Chrome/Safari) native accessors cannot be\n // patched on prototypes (e.g. Node.prototype.firstChild cannot be modified).\n // On these browsers, instance level patching is performed where needed; this\n // instance patching is only done when `noPatch` is *not* set.\n if (!utils.settings.noPatch) {\n applyPatches();\n // Patch click event behavior only if we're patching\n patchClick()\n }\n\n // For simplicity, patch events unconditionally.\n // Patches the event system to have Shadow DOM compatible behavior (e.g.\n // event retargeting). When `noPatch` is set, retargeting is only available\n // when adding event listeners and dispatching events via `ShadyDOM.wrap`\n // (e.g. `ShadyDOM.wrap(element).addEventListener(...)`).\n patchEvents();\n\n window.ShadowRoot = /** @type {function(new:ShadowRoot)} */(ShadyRoot);\n}\n","const reservedTagList = new Set([\n 'annotation-xml',\n 'color-profile',\n 'font-face',\n 'font-face-src',\n 'font-face-uri',\n 'font-face-format',\n 'font-face-name',\n 'missing-glyph',\n]);\n\n/**\n * @param {string} localName\n * @returns {boolean}\n */\nexport function isValidCustomElementName(localName) {\n const reserved = reservedTagList.has(localName);\n const validForm = /^[a-z][.0-9_a-z]*-[\\-.0-9_a-z]*$/.test(localName);\n return !reserved && validForm;\n}\n\n/**\n * @private\n * @param {!Node} node\n * @return {boolean}\n */\nexport function isConnected(node) {\n // Use `Node#isConnected`, if defined.\n const nativeValue = node.isConnected;\n if (nativeValue !== undefined) {\n return nativeValue;\n }\n\n /** @type {?Node|undefined} */\n let current = node;\n while (current && !(current.__CE_isImportDocument || current instanceof Document)) {\n current = current.parentNode || (window.ShadowRoot && current instanceof ShadowRoot ? current.host : undefined);\n }\n return !!(current && (current.__CE_isImportDocument || current instanceof Document));\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextSiblingOrAncestorSibling(root, start) {\n let node = start;\n while (node && node !== root && !node.nextSibling) {\n node = node.parentNode;\n }\n return (!node || node === root) ? null : node.nextSibling;\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextNode(root, start) {\n return start.firstChild ? start.firstChild : nextSiblingOrAncestorSibling(root, start);\n}\n\n/**\n * @param {!Node} root\n * @param {!function(!Element)} callback\n * @param {!Set<Node>=} visitedImports\n */\nexport function walkDeepDescendantElements(root, callback, visitedImports = new Set()) {\n let node = root;\n while (node) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = /** @type {!Element} */(node);\n\n callback(element);\n\n const localName = element.localName;\n if (localName === 'link' && element.getAttribute('rel') === 'import') {\n // If this import (polyfilled or not) has it's root node available,\n // walk it.\n const importNode = /** @type {!Node} */ (element.import);\n if (importNode instanceof Node && !visitedImports.has(importNode)) {\n // Prevent multiple walks of the same import root.\n visitedImports.add(importNode);\n\n for (let child = importNode.firstChild; child; child = child.nextSibling) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n\n // Ignore descendants of import links to prevent attempting to walk the\n // elements created by the HTML Imports polyfill that we just walked\n // above.\n node = nextSiblingOrAncestorSibling(root, element);\n continue;\n } else if (localName === 'template') {\n // Ignore descendants of templates. There shouldn't be any descendants\n // because they will be moved into `.content` during construction in\n // browsers that support template but, in case they exist and are still\n // waiting to be moved by a polyfill, they will be ignored.\n node = nextSiblingOrAncestorSibling(root, element);\n continue;\n }\n\n // Walk shadow roots.\n const shadowRoot = element.__CE_shadowRoot;\n if (shadowRoot) {\n for (let child = shadowRoot.firstChild; child; child = child.nextSibling) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n }\n\n node = nextNode(root, node);\n }\n}\n\n/**\n * Used to suppress Closure's \"Modifying the prototype is only allowed if the\n * constructor is in the same scope\" warning without using\n * `@suppress {newCheckTypes, duplicate}` because `newCheckTypes` is too broad.\n *\n * @param {!Object} destination\n * @param {string} name\n * @param {*} value\n */\nexport function setPropertyUnchecked(destination, name, value) {\n destination[name] = value;\n}\n","import * as Utilities from './Utilities.js';\nimport CEState from './CustomElementState.js';\n\nexport default class CustomElementInternals {\n constructor() {\n /** @type {!Map<string, !CustomElementDefinition>} */\n this._localNameToDefinition = new Map();\n\n /** @type {!Map<!Function, !CustomElementDefinition>} */\n this._constructorToDefinition = new Map();\n\n /** @type {!Array<!function(!Node)>} */\n this._patches = [];\n\n /** @type {boolean} */\n this._hasPatches = false;\n }\n\n /**\n * @param {string} localName\n * @param {!CustomElementDefinition} definition\n */\n setDefinition(localName, definition) {\n this._localNameToDefinition.set(localName, definition);\n this._constructorToDefinition.set(definition.constructorFunction, definition);\n }\n\n /**\n * @param {string} localName\n * @return {!CustomElementDefinition|undefined}\n */\n localNameToDefinition(localName) {\n return this._localNameToDefinition.get(localName);\n }\n\n /**\n * @param {!Function} constructor\n * @return {!CustomElementDefinition|undefined}\n */\n constructorToDefinition(constructor) {\n return this._constructorToDefinition.get(constructor);\n }\n\n /**\n * @param {!function(!Node)} listener\n */\n addPatch(listener) {\n this._hasPatches = true;\n this._patches.push(listener);\n }\n\n /**\n * @param {!Node} node\n */\n patchTree(node) {\n if (!this._hasPatches) return;\n\n Utilities.walkDeepDescendantElements(node, element => this.patch(element));\n }\n\n /**\n * @param {!Node} node\n */\n patch(node) {\n if (!this._hasPatches) return;\n\n if (node.__CE_patched) return;\n node.__CE_patched = true;\n\n for (let i = 0; i < this._patches.length; i++) {\n this._patches[i](node);\n }\n }\n\n /**\n * @param {!Node} root\n */\n connectTree(root) {\n const elements = [];\n\n Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (element.__CE_state === CEState.custom) {\n this.connectedCallback(element);\n } else {\n this.upgradeElement(element);\n }\n }\n }\n\n /**\n * @param {!Node} root\n */\n disconnectTree(root) {\n const elements = [];\n\n Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (element.__CE_state === CEState.custom) {\n this.disconnectedCallback(element);\n }\n }\n }\n\n /**\n * Upgrades all uncustomized custom elements at and below a root node for\n * which there is a definition. When custom element reaction callbacks are\n * assumed to be called synchronously (which, by the current DOM / HTML spec\n * definitions, they are *not*), callbacks for both elements customized\n * synchronously by the parser and elements being upgraded occur in the same\n * relative order.\n *\n * NOTE: This function, when used to simulate the construction of a tree that\n * is already created but not customized (i.e. by the parser), does *not*\n * prevent the element from reading the 'final' (true) state of the tree. For\n * example, the element, during truly synchronous parsing / construction would\n * see that it contains no children as they have not yet been inserted.\n * However, this function does not modify the tree, the element will\n * (incorrectly) have children. Additionally, self-modification restrictions\n * for custom element constructors imposed by the DOM spec are *not* enforced.\n *\n *\n * The following nested list shows the steps extending down from the HTML\n * spec's parsing section that cause elements to be synchronously created and\n * upgraded:\n *\n * The \"in body\" insertion mode:\n * https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody\n * - Switch on token:\n * .. other cases ..\n * -> Any other start tag\n * - [Insert an HTML element](below) for the token.\n *\n * Insert an HTML element:\n * https://html.spec.whatwg.org/multipage/syntax.html#insert-an-html-element\n * - Insert a foreign element for the token in the HTML namespace:\n * https://html.spec.whatwg.org/multipage/syntax.html#insert-a-foreign-element\n * - Create an element for a token:\n * https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token\n * - Will execute script flag is true?\n * - (Element queue pushed to the custom element reactions stack.)\n * - Create an element:\n * https://dom.spec.whatwg.org/#concept-create-element\n * - Sync CE flag is true?\n * - Constructor called.\n * - Self-modification restrictions enforced.\n * - Sync CE flag is false?\n * - (Upgrade reaction enqueued.)\n * - Attributes appended to element.\n * (`attributeChangedCallback` reactions enqueued.)\n * - Will execute script flag is true?\n * - (Element queue popped from the custom element reactions stack.\n * Reactions in the popped stack are invoked.)\n * - (Element queue pushed to the custom element reactions stack.)\n * - Insert the element:\n * https://dom.spec.whatwg.org/#concept-node-insert\n * - Shadow-including descendants are connected. During parsing\n * construction, there are no shadow-*excluding* descendants.\n * However, the constructor may have validly attached a shadow\n * tree to itself and added descendants to that shadow tree.\n * (`connectedCallback` reactions enqueued.)\n * - (Element queue popped from the custom element reactions stack.\n * Reactions in the popped stack are invoked.)\n *\n * @param {!Node} root\n * @param {{\n * visitedImports: (!Set<!Node>|undefined),\n * upgrade: (!function(!Element)|undefined),\n * }=} options\n */\n patchAndUpgradeTree(root, options = {}) {\n const visitedImports = options.visitedImports || new Set();\n const upgrade = options.upgrade || (element => this.upgradeElement(element));\n\n const elements = [];\n\n const gatherElements = element => {\n if (element.localName === 'link' && element.getAttribute('rel') === 'import') {\n // The HTML Imports polyfill sets a descendant element of the link to\n // the `import` property, specifically this is *not* a Document.\n const importNode = /** @type {?Node} */ (element.import);\n\n if (importNode instanceof Node) {\n importNode.__CE_isImportDocument = true;\n // Connected links are associated with the registry.\n importNode.__CE_hasRegistry = true;\n }\n\n if (importNode && importNode.readyState === 'complete') {\n importNode.__CE_documentLoadHandled = true;\n } else {\n // If this link's import root is not available, its contents can't be\n // walked. Wait for 'load' and walk it when it's ready.\n element.addEventListener('load', () => {\n const importNode = /** @type {!Node} */ (element.import);\n\n if (importNode.__CE_documentLoadHandled) return;\n importNode.__CE_documentLoadHandled = true;\n\n // Clone the `visitedImports` set that was populated sync during\n // the `patchAndUpgradeTree` call that caused this 'load' handler to\n // be added. Then, remove *this* link's import node so that we can\n // walk that import again, even if it was partially walked later\n // during the same `patchAndUpgradeTree` call.\n const clonedVisitedImports = new Set(visitedImports);\n clonedVisitedImports.delete(importNode);\n\n this.patchAndUpgradeTree(importNode, {visitedImports: clonedVisitedImports, upgrade});\n });\n }\n } else {\n elements.push(element);\n }\n };\n\n // `walkDeepDescendantElements` populates (and internally checks against)\n // `visitedImports` when traversing a loaded import.\n Utilities.walkDeepDescendantElements(root, gatherElements, visitedImports);\n\n if (this._hasPatches) {\n for (let i = 0; i < elements.length; i++) {\n this.patch(elements[i]);\n }\n }\n\n for (let i = 0; i < elements.length; i++) {\n upgrade(elements[i]);\n }\n }\n\n /**\n * @param {!HTMLElement} element\n */\n upgradeElement(element) {\n const currentState = element.__CE_state;\n if (currentState !== undefined) return;\n\n // Prevent elements created in documents without a browsing context from\n // upgrading.\n //\n // https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition\n // \"If document does not have a browsing context, return null.\"\n //\n // https://html.spec.whatwg.org/multipage/window-object.html#dom-document-defaultview\n // \"The defaultView IDL attribute of the Document interface, on getting,\n // must return this Document's browsing context's WindowProxy object, if\n // this Document has an associated browsing context, or null otherwise.\"\n const ownerDocument = element.ownerDocument;\n if (\n !ownerDocument.defaultView &&\n !(ownerDocument.__CE_isImportDocument && ownerDocument.__CE_hasRegistry)\n ) return;\n\n const definition = this.localNameToDefinition(element.localName);\n if (!definition) return;\n\n definition.constructionStack.push(element);\n\n const constructor = definition.constructorFunction;\n try {\n try {\n let result = new (constructor)();\n if (result !== element) {\n throw new Error('The custom element constructor did not produce the element being upgraded.');\n }\n } finally {\n definition.constructionStack.pop();\n }\n } catch (e) {\n element.__CE_state = CEState.failed;\n throw e;\n }\n\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n\n if (definition.attributeChangedCallback) {\n const observedAttributes = definition.observedAttributes;\n for (let i = 0; i < observedAttributes.length; i++) {\n const name = observedAttributes[i];\n const value = element.getAttribute(name);\n if (value !== null) {\n this.attributeChangedCallback(element, name, null, value, null);\n }\n }\n }\n\n if (Utilities.isConnected(element)) {\n this.connectedCallback(element);\n }\n }\n\n /**\n * @param {!Element} element\n */\n connectedCallback(element) {\n const definition = element.__CE_definition;\n if (definition.connectedCallback) {\n definition.connectedCallback.call(element);\n }\n }\n\n /**\n * @param {!Element} element\n */\n disconnectedCallback(element) {\n const definition = element.__CE_definition;\n if (definition.disconnectedCallback) {\n definition.disconnectedCallback.call(element);\n }\n }\n\n /**\n * @param {!Element} element\n * @param {string} name\n * @param {?string} oldValue\n * @param {?string} newValue\n * @param {?string} namespace\n */\n attributeChangedCallback(element, name, oldValue, newValue, namespace) {\n const definition = element.__CE_definition;\n if (\n definition.attributeChangedCallback &&\n definition.observedAttributes.indexOf(name) > -1\n ) {\n definition.attributeChangedCallback.call(element, name, oldValue, newValue, namespace);\n }\n }\n}\n","/**\n * @enum {number}\n */\nconst CustomElementState = {\n custom: 1,\n failed: 2,\n};\n\nexport default CustomElementState;\n","import CustomElementInternals from './CustomElementInternals.js';\n\nexport default class DocumentConstructionObserver {\n constructor(internals, doc) {\n /**\n * @type {!CustomElementInternals}\n */\n this._internals = internals;\n\n /**\n * @type {!Document}\n */\n this._document = doc;\n\n /**\n * @type {MutationObserver|undefined}\n */\n this._observer = undefined;\n\n\n // Simulate tree construction for all currently accessible nodes in the\n // document.\n this._internals.patchAndUpgradeTree(this._document);\n\n if (this._document.readyState === 'loading') {\n this._observer = new MutationObserver(this._handleMutations.bind(this));\n\n // Nodes created by the parser are given to the observer *before* the next\n // task runs. Inline scripts are run in a new task. This means that the\n // observer will be able to handle the newly parsed nodes before the inline\n // script is run.\n this._observer.observe(this._document, {\n childList: true,\n subtree: true,\n });\n }\n }\n\n disconnect() {\n if (this._observer) {\n this._observer.disconnect();\n }\n }\n\n /**\n * @param {!Array<!MutationRecord>} mutations\n */\n _handleMutations(mutations) {\n // Once the document's `readyState` is 'interactive' or 'complete', all new\n // nodes created within that document will be the result of script and\n // should be handled by patching.\n const readyState = this._document.readyState;\n if (readyState === 'interactive' || readyState === 'complete') {\n this.disconnect();\n }\n\n for (let i = 0; i < mutations.length; i++) {\n const addedNodes = mutations[i].addedNodes;\n for (let j = 0; j < addedNodes.length; j++) {\n const node = addedNodes[j];\n this._internals.patchAndUpgradeTree(node);\n }\n }\n }\n}\n","import CustomElementInternals from './CustomElementInternals.js';\nimport DocumentConstructionObserver from './DocumentConstructionObserver.js';\nimport Deferred from './Deferred.js';\nimport * as Utilities from './Utilities.js';\n\n/**\n * @unrestricted\n */\nexport default class CustomElementRegistry {\n\n /**\n * @param {!CustomElementInternals} internals\n */\n constructor(internals) {\n /**\n * @private\n * @type {boolean}\n */\n this._elementDefinitionIsRunning = false;\n\n /**\n * @private\n * @type {!CustomElementInternals}\n */\n this._internals = internals;\n\n /**\n * @private\n * @type {!Map<string, !Deferred<undefined>>}\n */\n this._whenDefinedDeferred = new Map();\n\n /**\n * The default flush callback triggers the document walk synchronously.\n * @private\n * @type {!Function}\n */\n this._flushCallback = fn => fn();\n\n /**\n * @private\n * @type {boolean}\n */\n this._flushPending = false;\n\n /**\n * @private\n * @type {!Array<!CustomElementDefinition>}\n */\n this._pendingDefinitions = [];\n\n /**\n * @private\n * @type {!DocumentConstructionObserver}\n */\n this._documentConstructionObserver = new DocumentConstructionObserver(internals, document);\n }\n\n /**\n * @param {string} localName\n * @param {!Function} constructor\n */\n define(localName, constructor) {\n if (!(constructor instanceof Function)) {\n throw new TypeError('Custom element constructors must be functions.');\n }\n\n if (!Utilities.isValidCustomElementName(localName)) {\n throw new SyntaxError(`The element name '${localName}' is not valid.`);\n }\n\n if (this._internals.localNameToDefinition(localName)) {\n throw new Error(`A custom element with name '${localName}' has already been defined.`);\n }\n\n if (this._elementDefinitionIsRunning) {\n throw new Error('A custom element is already being defined.');\n }\n this._elementDefinitionIsRunning = true;\n\n let connectedCallback;\n let disconnectedCallback;\n let adoptedCallback;\n let attributeChangedCallback;\n let observedAttributes;\n try {\n /** @type {!Object} */\n const prototype = constructor.prototype;\n if (!(prototype instanceof Object)) {\n throw new TypeError('The custom element constructor\\'s prototype is not an object.');\n }\n\n function getCallback(name) {\n const callbackValue = prototype[name];\n if (callbackValue !== undefined && !(callbackValue instanceof Function)) {\n throw new Error(`The '${name}' callback must be a function.`);\n }\n return callbackValue;\n }\n\n connectedCallback = getCallback('connectedCallback');\n disconnectedCallback = getCallback('disconnectedCallback');\n adoptedCallback = getCallback('adoptedCallback');\n attributeChangedCallback = getCallback('attributeChangedCallback');\n observedAttributes = constructor['observedAttributes'] || [];\n } catch (e) {\n return;\n } finally {\n this._elementDefinitionIsRunning = false;\n }\n\n const definition = {\n localName,\n constructorFunction: constructor,\n connectedCallback,\n disconnectedCallback,\n adoptedCallback,\n attributeChangedCallback,\n observedAttributes,\n constructionStack: [],\n };\n\n this._internals.setDefinition(localName, definition);\n this._pendingDefinitions.push(definition);\n\n // If we've already called the flush callback and it hasn't called back yet,\n // don't call it again.\n if (!this._flushPending) {\n this._flushPending = true;\n this._flushCallback(() => this._flush());\n }\n }\n\n upgrade(element) {\n this._internals.patchAndUpgradeTree(element);\n }\n\n _flush() {\n // If no new definitions were defined, don't attempt to flush. This could\n // happen if a flush callback keeps the function it is given and calls it\n // multiple times.\n if (this._flushPending === false) return;\n this._flushPending = false;\n\n const pendingDefinitions = this._pendingDefinitions;\n\n /**\n * Unupgraded elements with definitions that were defined *before* the last\n * flush, in document order.\n * @type {!Array<!HTMLElement>}\n */\n const elementsWithStableDefinitions = [];\n\n /**\n * A map from `localName`s of definitions that were defined *after* the last\n * flush to unupgraded elements matching that definition, in document order.\n * @type {!Map<string, !Array<!HTMLElement>>}\n */\n const elementsWithPendingDefinitions = new Map();\n for (let i = 0; i < pendingDefinitions.length; i++) {\n elementsWithPendingDefinitions.set(pendingDefinitions[i].localName, []);\n }\n\n this._internals.patchAndUpgradeTree(document, {\n upgrade: element => {\n // Ignore the element if it has already upgraded or failed to upgrade.\n if (element.__CE_state !== undefined) return;\n\n const localName = element.localName;\n\n // If there is an applicable pending definition for the element, add the\n // element to the list of elements to be upgraded with that definition.\n const pendingElements = elementsWithPendingDefinitions.get(localName);\n if (pendingElements) {\n pendingElements.push(element);\n // If there is *any other* applicable definition for the element, add it\n // to the list of elements with stable definitions that need to be upgraded.\n } else if (this._internals.localNameToDefinition(localName)) {\n elementsWithStableDefinitions.push(element);\n }\n },\n });\n\n // Upgrade elements with 'stable' definitions first.\n for (let i = 0; i < elementsWithStableDefinitions.length; i++) {\n this._internals.upgradeElement(elementsWithStableDefinitions[i]);\n }\n\n // Upgrade elements with 'pending' definitions in the order they were defined.\n while (pendingDefinitions.length > 0) {\n const definition = pendingDefinitions.shift();\n const localName = definition.localName;\n\n // Attempt to upgrade all applicable elements.\n const pendingUpgradableElements = elementsWithPendingDefinitions.get(definition.localName);\n for (let i = 0; i < pendingUpgradableElements.length; i++) {\n this._internals.upgradeElement(pendingUpgradableElements[i]);\n }\n\n // Resolve any promises created by `whenDefined` for the definition.\n const deferred = this._whenDefinedDeferred.get(localName);\n if (deferred) {\n deferred.resolve(undefined);\n }\n }\n }\n\n /**\n * @param {string} localName\n * @return {Function|undefined}\n */\n get(localName) {\n const definition = this._internals.localNameToDefinition(localName);\n if (definition) {\n return definition.constructorFunction;\n }\n\n return undefined;\n }\n\n /**\n * @param {string} localName\n * @return {!Promise<undefined>}\n */\n whenDefined(localName) {\n if (!Utilities.isValidCustomElementName(localName)) {\n return Promise.reject(new SyntaxError(`'${localName}' is not a valid custom element name.`));\n }\n\n const prior = this._whenDefinedDeferred.get(localName);\n if (prior) {\n return prior.toPromise();\n }\n\n const deferred = new Deferred();\n this._whenDefinedDeferred.set(localName, deferred);\n\n const definition = this._internals.localNameToDefinition(localName);\n // Resolve immediately only if the given local name has a definition *and*\n // the full document walk to upgrade elements with that local name has\n // already happened.\n if (definition && !this._pendingDefinitions.some(d => d.localName === localName)) {\n deferred.resolve(undefined);\n }\n\n return deferred.toPromise();\n }\n\n polyfillWrapFlushCallback(outer) {\n this._documentConstructionObserver.disconnect();\n const inner = this._flushCallback;\n this._flushCallback = flush => outer(() => inner(flush));\n }\n}\n\n// Closure compiler exports.\nwindow['CustomElementRegistry'] = CustomElementRegistry;\nCustomElementRegistry.prototype['define'] = CustomElementRegistry.prototype.define;\nCustomElementRegistry.prototype['upgrade'] = CustomElementRegistry.prototype.upgrade;\nCustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;\nCustomElementRegistry.prototype['whenDefined'] = CustomElementRegistry.prototype.whenDefined;\nCustomElementRegistry.prototype['polyfillWrapFlushCallback'] = CustomElementRegistry.prototype.polyfillWrapFlushCallback;\n","/**\n * @template T\n */\nexport default class Deferred {\n constructor() {\n /**\n * @private\n * @type {T|undefined}\n */\n this._value = undefined;\n\n /**\n * @private\n * @type {Function|undefined}\n */\n this._resolve = undefined;\n\n /**\n * @private\n * @type {!Promise<T>}\n */\n this._promise = new Promise(resolve => {\n this._resolve = resolve;\n\n if (this._value) {\n resolve(this._value);\n }\n });\n }\n\n /**\n * @param {T} value\n */\n resolve(value) {\n if (this._value) {\n throw new Error('Already resolved.');\n }\n\n this._value = value;\n\n if (this._resolve) {\n this._resolve(value);\n }\n }\n\n /**\n * @return {!Promise<T>}\n */\n toPromise() {\n return this._promise;\n }\n}\n","export default {\n Document_createElement: window.Document.prototype.createElement,\n Document_createElementNS: window.Document.prototype.createElementNS,\n Document_importNode: window.Document.prototype.importNode,\n Document_prepend: window.Document.prototype['prepend'],\n Document_append: window.Document.prototype['append'],\n DocumentFragment_prepend: window.DocumentFragment.prototype['prepend'],\n DocumentFragment_append: window.DocumentFragment.prototype['append'],\n Node_cloneNode: window.Node.prototype.cloneNode,\n Node_appendChild: window.Node.prototype.appendChild,\n Node_insertBefore: window.Node.prototype.insertBefore,\n Node_removeChild: window.Node.prototype.removeChild,\n Node_replaceChild: window.Node.prototype.replaceChild,\n Node_textContent: Object.getOwnPropertyDescriptor(window.Node.prototype, 'textContent'),\n Element_attachShadow: window.Element.prototype['attachShadow'],\n Element_innerHTML: Object.getOwnPropertyDescriptor(window.Element.prototype, 'innerHTML'),\n Element_getAttribute: window.Element.prototype.getAttribute,\n Element_setAttribute: window.Element.prototype.setAttribute,\n Element_removeAttribute: window.Element.prototype.removeAttribute,\n Element_getAttributeNS: window.Element.prototype.getAttributeNS,\n Element_setAttributeNS: window.Element.prototype.setAttributeNS,\n Element_removeAttributeNS: window.Element.prototype.removeAttributeNS,\n Element_insertAdjacentElement: window.Element.prototype['insertAdjacentElement'],\n Element_insertAdjacentHTML: window.Element.prototype['insertAdjacentHTML'],\n Element_prepend: window.Element.prototype['prepend'],\n Element_append: window.Element.prototype['append'],\n Element_before: window.Element.prototype['before'],\n Element_after: window.Element.prototype['after'],\n Element_replaceWith: window.Element.prototype['replaceWith'],\n Element_remove: window.Element.prototype['remove'],\n HTMLElement: window.HTMLElement,\n HTMLElement_innerHTML: Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML'),\n HTMLElement_insertAdjacentElement: window.HTMLElement.prototype['insertAdjacentElement'],\n HTMLElement_insertAdjacentHTML: window.HTMLElement.prototype['insertAdjacentHTML'],\n};\n","/**\n * This class exists only to work around Closure's lack of a way to describe\n * singletons. It represents the 'already constructed marker' used in custom\n * element construction stacks.\n *\n * https://html.spec.whatwg.org/#concept-already-constructed-marker\n * @extends AlreadyConstructedMarkerType\n */\nclass AlreadyConstructedMarker {}\n\nexport default new AlreadyConstructedMarker();\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n * prepend: !function(...(!Node|string)),\n * append: !function(...(!Node|string)),\n * }}\n */\nlet ParentNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ParentNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n /**\n * @param {!function(...(!Node|string))} builtInMethod\n * @return {!function(...(!Node|string))}\n */\n function appendPrependPatch(builtInMethod) {\n return function(...nodes) {\n /**\n * A copy of `nodes`, with any DocumentFragment replaced by its children.\n * @type {!Array<!Node>}\n */\n const flattenedNodes = [];\n\n /**\n * Elements in `nodes` that were connected before this call.\n * @type {!Array<!Node>}\n */\n const connectedElements = [];\n\n for (var i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if (node instanceof Element && Utilities.isConnected(node)) {\n connectedElements.push(node);\n }\n\n if (node instanceof DocumentFragment) {\n for (let child = node.firstChild; child; child = child.nextSibling) {\n flattenedNodes.push(child);\n }\n } else {\n flattenedNodes.push(node);\n }\n }\n\n builtInMethod.apply(this, nodes);\n\n for (let i = 0; i < connectedElements.length; i++) {\n internals.disconnectTree(connectedElements[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < flattenedNodes.length; i++) {\n const node = flattenedNodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n }\n\n if (builtIn.prepend !== undefined) {\n Utilities.setPropertyUnchecked(destination, 'prepend', appendPrependPatch(builtIn.prepend));\n }\n\n if (builtIn.append !== undefined) {\n Utilities.setPropertyUnchecked(destination, 'append', appendPrependPatch(builtIn.append));\n }\n};\n","/**\n * @license\n * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from './CustomElementInternals.js';\nimport CustomElementRegistry from './CustomElementRegistry.js';\n\nimport PatchHTMLElement from './Patch/HTMLElement.js';\nimport PatchDocument from './Patch/Document.js';\nimport PatchDocumentFragment from './Patch/DocumentFragment.js';\nimport PatchNode from './Patch/Node.js';\nimport PatchElement from './Patch/Element.js';\n\nconst priorCustomElements = window['customElements'];\n\nif (!priorCustomElements ||\n priorCustomElements['forcePolyfill'] ||\n (typeof priorCustomElements['define'] != 'function') ||\n (typeof priorCustomElements['get'] != 'function')) {\n /** @type {!CustomElementInternals} */\n const internals = new CustomElementInternals();\n\n PatchHTMLElement(internals);\n PatchDocument(internals);\n PatchDocumentFragment(internals);\n PatchNode(internals);\n PatchElement(internals);\n\n // The main document is always associated with the registry.\n document.__CE_hasRegistry = true;\n\n /** @type {!CustomElementRegistry} */\n const customElements = new CustomElementRegistry(internals);\n\n Object.defineProperty(window, 'customElements', {\n configurable: true,\n enumerable: true,\n value: customElements,\n });\n}\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport AlreadyConstructedMarker from '../AlreadyConstructedMarker.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n window['HTMLElement'] = (function() {\n /**\n * @type {function(new: HTMLElement): !HTMLElement}\n */\n function HTMLElement() {\n // This should really be `new.target` but `new.target` can't be emulated\n // in ES5. Assuming the user keeps the default value of the constructor's\n // prototype's `constructor` property, this is equivalent.\n const constructor = /** @type {!Function} */ (this.constructor);\n\n const definition = internals.constructorToDefinition(constructor);\n if (!definition) {\n throw new Error('The custom element being constructed was not registered with `customElements`.');\n }\n\n const constructionStack = definition.constructionStack;\n\n if (constructionStack.length === 0) {\n const element = /** @type {!HTMLElement} */ (Native.Document_createElement.call(document, definition.localName));\n Object.setPrototypeOf(element, constructor.prototype);\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n internals.patch(element);\n return element;\n }\n\n const lastIndex = constructionStack.length - 1;\n const element = constructionStack[lastIndex];\n if (element === AlreadyConstructedMarker) {\n throw new Error('The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.');\n }\n const toConstructElement = /** @type {!HTMLElement} */ (element);\n constructionStack[lastIndex] = AlreadyConstructedMarker;\n\n Object.setPrototypeOf(toConstructElement, constructor.prototype);\n internals.patch(toConstructElement);\n\n return toConstructElement;\n }\n\n HTMLElement.prototype = Native.HTMLElement.prototype;\n // Safari 9 has `writable: false` on the propertyDescriptor\n // Make it writable so that TypeScript can patch up the\n // constructor in the ES5 compiled code.\n Object.defineProperty(HTMLElement.prototype, 'constructor', {\n writable: true,\n configurable: true,\n enumerable: false,\n value: HTMLElement\n });\n\n return HTMLElement;\n })();\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n Utilities.setPropertyUnchecked(Document.prototype, 'createElement',\n /**\n * @this {Document}\n * @param {string} localName\n * @return {!Element}\n */\n function(localName) {\n // Only create custom elements if this document is associated with the registry.\n if (this.__CE_hasRegistry) {\n const definition = internals.localNameToDefinition(localName);\n if (definition) {\n return new (definition.constructorFunction)();\n }\n }\n\n const result = /** @type {!Element} */\n (Native.Document_createElement.call(this, localName));\n internals.patch(result);\n return result;\n });\n\n Utilities.setPropertyUnchecked(Document.prototype, 'importNode',\n /**\n * @this {Document}\n * @param {!Node} node\n * @param {boolean=} deep\n * @return {!Node}\n */\n function(node, deep) {\n const clone = /** @type {!Node} */ (Native.Document_importNode.call(this, node, !!deep));\n // Only create custom elements if this document is associated with the registry.\n if (!this.__CE_hasRegistry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n });\n\n const NS_HTML = \"http://www.w3.org/1999/xhtml\";\n\n Utilities.setPropertyUnchecked(Document.prototype, 'createElementNS',\n /**\n * @this {Document}\n * @param {?string} namespace\n * @param {string} localName\n * @return {!Element}\n */\n function(namespace, localName) {\n // Only create custom elements if this document is associated with the registry.\n if (this.__CE_hasRegistry && (namespace === null || namespace === NS_HTML)) {\n const definition = internals.localNameToDefinition(localName);\n if (definition) {\n return new (definition.constructorFunction)();\n }\n }\n\n const result = /** @type {!Element} */\n (Native.Document_createElementNS.call(this, namespace, localName));\n internals.patch(result);\n return result;\n });\n\n PatchParentNode(internals, Document.prototype, {\n prepend: Native.Document_prepend,\n append: Native.Document_append,\n });\n};\n","import CustomElementInternals from '../CustomElementInternals.js';\nimport Native from './Native.js';\nimport PatchParentNode from './Interface/ParentNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n PatchParentNode(internals, DocumentFragment.prototype, {\n prepend: Native.DocumentFragment_prepend,\n append: Native.DocumentFragment_append,\n });\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n // `Node#nodeValue` is implemented on `Attr`.\n // `Node#textContent` is implemented on `Attr`, `Element`.\n\n Utilities.setPropertyUnchecked(Node.prototype, 'insertBefore',\n /**\n * @this {Node}\n * @param {!Node} node\n * @param {?Node} refNode\n * @return {!Node}\n */\n function(node, refNode) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'appendChild',\n /**\n * @this {Node}\n * @param {!Node} node\n * @return {!Node}\n */\n function(node) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n const nativeResult = Native.Node_appendChild.call(this, node);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_appendChild.call(this, node);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'cloneNode',\n /**\n * @this {Node}\n * @param {boolean=} deep\n * @return {!Node}\n */\n function(deep) {\n const clone = Native.Node_cloneNode.call(this, !!deep);\n // Only create custom elements if this element's owner document is\n // associated with the registry.\n if (!this.ownerDocument.__CE_hasRegistry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'removeChild',\n /**\n * @this {Node}\n * @param {!Node} node\n * @return {!Node}\n */\n function(node) {\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_removeChild.call(this, node);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'replaceChild',\n /**\n * @this {Node}\n * @param {!Node} nodeToInsert\n * @param {!Node} nodeToRemove\n * @return {!Node}\n */\n function(nodeToInsert, nodeToRemove) {\n if (nodeToInsert instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(nodeToInsert.childNodes);\n const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n internals.disconnectTree(nodeToRemove);\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeToInsertWasConnected = Utilities.isConnected(nodeToInsert);\n const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n const thisIsConnected = Utilities.isConnected(this);\n\n if (thisIsConnected) {\n internals.disconnectTree(nodeToRemove);\n }\n\n if (nodeToInsertWasConnected) {\n internals.disconnectTree(nodeToInsert);\n }\n\n if (thisIsConnected) {\n internals.connectTree(nodeToInsert);\n }\n\n return nativeResult;\n });\n\n\n function patch_textContent(destination, baseDescriptor) {\n Object.defineProperty(destination, 'textContent', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: /** @this {Node} */ function(assignedValue) {\n // If this is a text node then there are no nodes to disconnect.\n if (this.nodeType === Node.TEXT_NODE) {\n baseDescriptor.set.call(this, assignedValue);\n return;\n }\n\n let removedNodes = undefined;\n // Checking for `firstChild` is faster than reading `childNodes.length`\n // to compare with 0.\n if (this.firstChild) {\n // Using `childNodes` is faster than `children`, even though we only\n // care about elements.\n const childNodes = this.childNodes;\n const childNodesLength = childNodes.length;\n if (childNodesLength > 0 && Utilities.isConnected(this)) {\n // Copying an array by iterating is faster than using slice.\n removedNodes = new Array(childNodesLength);\n for (let i = 0; i < childNodesLength; i++) {\n removedNodes[i] = childNodes[i];\n }\n }\n }\n\n baseDescriptor.set.call(this, assignedValue);\n\n if (removedNodes) {\n for (let i = 0; i < removedNodes.length; i++) {\n internals.disconnectTree(removedNodes[i]);\n }\n }\n },\n });\n }\n\n if (Native.Node_textContent && Native.Node_textContent.get) {\n patch_textContent(Node.prototype, Native.Node_textContent);\n } else {\n internals.addPatch(function(element) {\n patch_textContent(element, {\n enumerable: true,\n configurable: true,\n // NOTE: This implementation of the `textContent` getter assumes that\n // text nodes' `textContent` getter will not be patched.\n get: /** @this {Node} */ function() {\n /** @type {!Array<string>} */\n const parts = [];\n\n for (let i = 0; i < this.childNodes.length; i++) {\n parts.push(this.childNodes[i].textContent);\n }\n\n return parts.join('');\n },\n set: /** @this {Node} */ function(assignedValue) {\n while (this.firstChild) {\n Native.Node_removeChild.call(this, this.firstChild);\n }\n Native.Node_appendChild.call(this, document.createTextNode(assignedValue));\n },\n });\n });\n }\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\nimport PatchChildNode from './Interface/ChildNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n if (Native.Element_attachShadow) {\n Utilities.setPropertyUnchecked(Element.prototype, 'attachShadow',\n /**\n * @this {Element}\n * @param {!{mode: string}} init\n * @return {ShadowRoot}\n */\n function(init) {\n const shadowRoot = Native.Element_attachShadow.call(this, init);\n this.__CE_shadowRoot = shadowRoot;\n return shadowRoot;\n });\n }\n\n\n function patch_innerHTML(destination, baseDescriptor) {\n Object.defineProperty(destination, 'innerHTML', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: /** @this {Element} */ function(htmlString) {\n const isConnected = Utilities.isConnected(this);\n\n // NOTE: In IE11, when using the native `innerHTML` setter, all nodes\n // that were previously descendants of the context element have all of\n // their children removed as part of the set - the entire subtree is\n // 'disassembled'. This work around walks the subtree *before* using the\n // native setter.\n /** @type {!Array<!Element>|undefined} */\n let removedElements = undefined;\n if (isConnected) {\n removedElements = [];\n Utilities.walkDeepDescendantElements(this, element => {\n if (element !== this) {\n removedElements.push(element);\n }\n });\n }\n\n baseDescriptor.set.call(this, htmlString);\n\n if (removedElements) {\n for (let i = 0; i < removedElements.length; i++) {\n const element = removedElements[i];\n if (element.__CE_state === CEState.custom) {\n internals.disconnectedCallback(element);\n }\n }\n }\n\n // Only create custom elements if this element's owner document is\n // associated with the registry.\n if (!this.ownerDocument.__CE_hasRegistry) {\n internals.patchTree(this);\n } else {\n internals.patchAndUpgradeTree(this);\n }\n return htmlString;\n },\n });\n }\n\n if (Native.Element_innerHTML && Native.Element_innerHTML.get) {\n patch_innerHTML(Element.prototype, Native.Element_innerHTML);\n } else if (Native.HTMLElement_innerHTML && Native.HTMLElement_innerHTML.get) {\n patch_innerHTML(HTMLElement.prototype, Native.HTMLElement_innerHTML);\n } else {\n\n internals.addPatch(function(element) {\n patch_innerHTML(element, {\n enumerable: true,\n configurable: true,\n // Implements getting `innerHTML` by performing an unpatched `cloneNode`\n // of the element and returning the resulting element's `innerHTML`.\n // TODO: Is this too expensive?\n get: /** @this {Element} */ function() {\n return Native.Node_cloneNode.call(this, true).innerHTML;\n },\n // Implements setting `innerHTML` by creating an unpatched element,\n // setting `innerHTML` of that element and replacing the target\n // element's children with those of the unpatched element.\n set: /** @this {Element} */ function(assignedValue) {\n // NOTE: re-route to `content` for `template` elements.\n // We need to do this because `template.appendChild` does not\n // route into `template.content`.\n const isTemplate = (this.localName === 'template');\n /** @type {!Node} */\n const content = isTemplate ? (/** @type {!HTMLTemplateElement} */\n (this)).content : this;\n /** @type {!Node} */\n const rawElement = Native.Document_createElementNS.call(document,\n this.namespaceURI, this.localName);\n rawElement.innerHTML = assignedValue;\n\n while (content.childNodes.length > 0) {\n Native.Node_removeChild.call(content, content.childNodes[0]);\n }\n const container = isTemplate ? rawElement.content : rawElement;\n while (container.childNodes.length > 0) {\n Native.Node_appendChild.call(content, container.childNodes[0]);\n }\n },\n });\n });\n }\n\n\n Utilities.setPropertyUnchecked(Element.prototype, 'setAttribute',\n /**\n * @this {Element}\n * @param {string} name\n * @param {string} newValue\n */\n function(name, newValue) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttribute.call(this, name, newValue);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n Native.Element_setAttribute.call(this, name, newValue);\n newValue = Native.Element_getAttribute.call(this, name);\n internals.attributeChangedCallback(this, name, oldValue, newValue, null);\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'setAttributeNS',\n /**\n * @this {Element}\n * @param {?string} namespace\n * @param {string} name\n * @param {string} newValue\n */\n function(namespace, name, newValue) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n }\n\n const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'removeAttribute',\n /**\n * @this {Element}\n * @param {string} name\n */\n function(name) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_removeAttribute.call(this, name);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n Native.Element_removeAttribute.call(this, name);\n if (oldValue !== null) {\n internals.attributeChangedCallback(this, name, oldValue, null, null);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'removeAttributeNS',\n /**\n * @this {Element}\n * @param {?string} namespace\n * @param {string} name\n */\n function(namespace, name) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_removeAttributeNS.call(this, namespace, name);\n }\n\n const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n Native.Element_removeAttributeNS.call(this, namespace, name);\n // In older browsers, `Element#getAttributeNS` may return the empty string\n // instead of null if the attribute does not exist. For details, see;\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNS#Notes\n const newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n }\n });\n\n\n function patch_insertAdjacentElement(destination, baseMethod) {\n Utilities.setPropertyUnchecked(destination, 'insertAdjacentElement',\n /**\n * @this {Element}\n * @param {string} position\n * @param {!Element} element\n * @return {?Element}\n */\n function(position, element) {\n const wasConnected = Utilities.isConnected(element);\n const insertedElement = /** @type {!Element} */\n (baseMethod.call(this, position, element));\n\n if (wasConnected) {\n internals.disconnectTree(element);\n }\n\n if (Utilities.isConnected(insertedElement)) {\n internals.connectTree(element);\n }\n return insertedElement;\n });\n }\n\n if (Native.HTMLElement_insertAdjacentElement) {\n patch_insertAdjacentElement(HTMLElement.prototype, Native.HTMLElement_insertAdjacentElement);\n } else if (Native.Element_insertAdjacentElement) {\n patch_insertAdjacentElement(Element.prototype, Native.Element_insertAdjacentElement);\n } else {\n console.warn('Custom Elements: `Element#insertAdjacentElement` was not patched.');\n }\n\n\n function patch_insertAdjacentHTML(destination, baseMethod) {\n /**\n * Patches and upgrades all nodes which are siblings between `start`\n * (inclusive) and `end` (exclusive). If `end` is `null`, then all siblings\n * following `start` will be patched and upgraded.\n * @param {!Node} start\n * @param {?Node} end\n */\n function upgradeNodesInRange(start, end) {\n const nodes = [];\n for (let node = start; node !== end; node = node.nextSibling) {\n nodes.push(node);\n }\n for (let i = 0; i < nodes.length; i++) {\n internals.patchAndUpgradeTree(nodes[i]);\n }\n }\n\n Utilities.setPropertyUnchecked(destination, 'insertAdjacentHTML',\n /**\n * @this {Element}\n * @param {string} position\n * @param {string} text\n */\n function(position, text) {\n position = position.toLowerCase();\n\n if (position === \"beforebegin\") {\n const marker = this.previousSibling;\n baseMethod.call(this, position, text);\n upgradeNodesInRange(marker || /** @type {!Node} */ (this.parentNode.firstChild), this);\n } else if (position === \"afterbegin\") {\n const marker = this.firstChild;\n baseMethod.call(this, position, text);\n upgradeNodesInRange(/** @type {!Node} */ (this.firstChild), marker);\n } else if (position === \"beforeend\") {\n const marker = this.lastChild;\n baseMethod.call(this, position, text);\n upgradeNodesInRange(marker || /** @type {!Node} */ (this.firstChild), null);\n } else if (position === \"afterend\") {\n const marker = this.nextSibling;\n baseMethod.call(this, position, text);\n upgradeNodesInRange(/** @type {!Node} */ (this.nextSibling), marker);\n } else {\n throw new SyntaxError(`The value provided (${String(position)}) is ` +\n \"not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.\");\n }\n });\n }\n\n if (Native.HTMLElement_insertAdjacentHTML) {\n patch_insertAdjacentHTML(HTMLElement.prototype, Native.HTMLElement_insertAdjacentHTML);\n } else if (Native.Element_insertAdjacentHTML) {\n patch_insertAdjacentHTML(Element.prototype, Native.Element_insertAdjacentHTML);\n } else {\n console.warn('Custom Elements: `Element#insertAdjacentHTML` was not patched.');\n }\n\n\n PatchParentNode(internals, Element.prototype, {\n prepend: Native.Element_prepend,\n append: Native.Element_append,\n });\n\n PatchChildNode(internals, Element.prototype, {\n before: Native.Element_before,\n after: Native.Element_after,\n replaceWith: Native.Element_replaceWith,\n remove: Native.Element_remove,\n });\n};\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n * before: !function(...(!Node|string)),\n * after: !function(...(!Node|string)),\n * replaceWith: !function(...(!Node|string)),\n * remove: !function(),\n * }}\n */\nlet ChildNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ChildNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n /**\n * @param {!function(...(!Node|string))} builtInMethod\n * @return {!function(...(!Node|string))}\n */\n function beforeAfterPatch(builtInMethod) {\n return function(...nodes) {\n /**\n * A copy of `nodes`, with any DocumentFragment replaced by its children.\n * @type {!Array<!Node>}\n */\n const flattenedNodes = [];\n\n /**\n * Elements in `nodes` that were connected before this call.\n * @type {!Array<!Node>}\n */\n const connectedElements = [];\n\n for (var i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if (node instanceof Element && Utilities.isConnected(node)) {\n connectedElements.push(node);\n }\n\n if (node instanceof DocumentFragment) {\n for (let child = node.firstChild; child; child = child.nextSibling) {\n flattenedNodes.push(child);\n }\n } else {\n flattenedNodes.push(node);\n }\n }\n\n builtInMethod.apply(this, nodes);\n\n for (let i = 0; i < connectedElements.length; i++) {\n internals.disconnectTree(connectedElements[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < flattenedNodes.length; i++) {\n const node = flattenedNodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n }\n\n if (builtIn.before !== undefined) {\n Utilities.setPropertyUnchecked(destination, 'before', beforeAfterPatch(builtIn.before));\n }\n\n if (builtIn.before !== undefined) {\n Utilities.setPropertyUnchecked(destination, 'after', beforeAfterPatch(builtIn.after));\n }\n\n if (builtIn.replaceWith !== undefined) {\n Utilities.setPropertyUnchecked(destination, 'replaceWith',\n /**\n * @param {...(!Node|string)} nodes\n */\n function(...nodes) {\n /**\n * A copy of `nodes`, with any DocumentFragment replaced by its children.\n * @type {!Array<!Node|string>}\n */\n const flattenedNodes = [];\n\n /**\n * Elements in `nodes` that were connected before this call.\n * @type {!Array<!Node>}\n */\n const connectedElements = [];\n\n for (var i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n\n if (node instanceof Element && Utilities.isConnected(node)) {\n connectedElements.push(node);\n }\n\n if (node instanceof DocumentFragment) {\n for (let child = node.firstChild; child; child = child.nextSibling) {\n flattenedNodes.push(child);\n }\n } else {\n flattenedNodes.push(node);\n }\n }\n\n const wasConnected = Utilities.isConnected(this);\n\n builtIn.replaceWith.apply(this, nodes);\n\n for (let i = 0; i < connectedElements.length; i++) {\n internals.disconnectTree(connectedElements[i]);\n }\n\n if (wasConnected) {\n internals.disconnectTree(this);\n for (let i = 0; i < flattenedNodes.length; i++) {\n const node = flattenedNodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n });\n }\n\n if (builtIn.remove !== undefined) {\n Utilities.setPropertyUnchecked(destination, 'remove',\n function() {\n const wasConnected = Utilities.isConnected(this);\n\n builtIn.remove.call(this);\n\n if (wasConnected) {\n internals.disconnectTree(this);\n }\n });\n }\n};\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/*\nExtremely simple css parser. Intended to be not more than what we need\nand definitely not necessarily correct =).\n*/\n\n'use strict';\n\n/** @unrestricted */\nclass StyleNode {\n constructor() {\n /** @type {number} */\n this['start'] = 0;\n /** @type {number} */\n this['end'] = 0;\n /** @type {StyleNode} */\n this['previous'] = null;\n /** @type {StyleNode} */\n this['parent'] = null;\n /** @type {Array<StyleNode>} */\n this['rules'] = null;\n /** @type {string} */\n this['parsedCssText'] = '';\n /** @type {string} */\n this['cssText'] = '';\n /** @type {boolean} */\n this['atRule'] = false;\n /** @type {number} */\n this['type'] = 0;\n /** @type {string} */\n this['keyframesName'] = '';\n /** @type {string} */\n this['selector'] = '';\n /** @type {string} */\n this['parsedSelector'] = '';\n }\n}\n\nexport {StyleNode}\n\n// given a string of css, return a simple rule tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nexport function parse(text) {\n text = clean(text);\n return parseCss(lex(text), text);\n}\n\n// remove stuff we don't care about that may hinder parsing\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction clean(cssText) {\n return cssText.replace(RX.comments, '').replace(RX.port, '');\n}\n\n// super simple {...} lexer that returns a node tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nfunction lex(text) {\n let root = new StyleNode();\n root['start'] = 0;\n root['end'] = text.length\n let n = root;\n for (let i = 0, l = text.length; i < l; i++) {\n if (text[i] === OPEN_BRACE) {\n if (!n['rules']) {\n n['rules'] = [];\n }\n let p = n;\n let previous = p['rules'][p['rules'].length - 1] || null;\n n = new StyleNode();\n n['start'] = i + 1;\n n['parent'] = p;\n n['previous'] = previous;\n p['rules'].push(n);\n } else if (text[i] === CLOSE_BRACE) {\n n['end'] = i + 1;\n n = n['parent'] || root;\n }\n }\n return root;\n}\n\n// add selectors/cssText to node tree\n/**\n * @param {StyleNode} node\n * @param {string} text\n * @return {StyleNode}\n */\nfunction parseCss(node, text) {\n let t = text.substring(node['start'], node['end'] - 1);\n node['parsedCssText'] = node['cssText'] = t.trim();\n if (node['parent']) {\n let ss = node['previous'] ? node['previous']['end'] : node['parent']['start'];\n t = text.substring(ss, node['start'] - 1);\n t = _expandUnicodeEscapes(t);\n t = t.replace(RX.multipleSpaces, ' ');\n // TODO(sorvell): ad hoc; make selector include only after last ;\n // helps with mixin syntax\n t = t.substring(t.lastIndexOf(';') + 1);\n let s = node['parsedSelector'] = node['selector'] = t.trim();\n node['atRule'] = (s.indexOf(AT_START) === 0);\n // note, support a subset of rule types...\n if (node['atRule']) {\n if (s.indexOf(MEDIA_START) === 0) {\n node['type'] = types.MEDIA_RULE;\n } else if (s.match(RX.keyframesRule)) {\n node['type'] = types.KEYFRAMES_RULE;\n node['keyframesName'] =\n node['selector'].split(RX.multipleSpaces).pop();\n }\n } else {\n if (s.indexOf(VAR_START) === 0) {\n node['type'] = types.MIXIN_RULE;\n } else {\n node['type'] = types.STYLE_RULE;\n }\n }\n }\n let r$ = node['rules'];\n if (r$) {\n for (let i = 0, l = r$.length, r;\n (i < l) && (r = r$[i]); i++) {\n parseCss(r, text);\n }\n }\n return node;\n}\n\n/**\n * conversion of sort unicode escapes with spaces like `\\33 ` (and longer) into\n * expanded form that doesn't require trailing space `\\000033`\n * @param {string} s\n * @return {string}\n */\nfunction _expandUnicodeEscapes(s) {\n return s.replace(/\\\\([0-9a-f]{1,6})\\s/gi, function() {\n let code = arguments[1],\n repeat = 6 - code.length;\n while (repeat--) {\n code = '0' + code;\n }\n return '\\\\' + code;\n });\n}\n\n/**\n * stringify parsed css.\n * @param {StyleNode} node\n * @param {boolean=} preserveProperties\n * @param {string=} text\n * @return {string}\n */\nexport function stringify(node, preserveProperties, text = '') {\n // calc rule cssText\n let cssText = '';\n if (node['cssText'] || node['rules']) {\n let r$ = node['rules'];\n if (r$ && !_hasMixinRules(r$)) {\n for (let i = 0, l = r$.length, r;\n (i < l) && (r = r$[i]); i++) {\n cssText = stringify(r, preserveProperties, cssText);\n }\n } else {\n cssText = preserveProperties ? node['cssText'] :\n removeCustomProps(node['cssText']);\n cssText = cssText.trim();\n if (cssText) {\n cssText = ' ' + cssText + '\\n';\n }\n }\n }\n // emit rule if there is cssText\n if (cssText) {\n if (node['selector']) {\n text += node['selector'] + ' ' + OPEN_BRACE + '\\n';\n }\n text += cssText;\n if (node['selector']) {\n text += CLOSE_BRACE + '\\n\\n';\n }\n }\n return text;\n}\n\n/**\n * @param {Array<StyleNode>} rules\n * @return {boolean}\n */\nfunction _hasMixinRules(rules) {\n let r = rules[0];\n return Boolean(r) && Boolean(r['selector']) && r['selector'].indexOf(VAR_START) === 0;\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomProps(cssText) {\n cssText = removeCustomPropAssignment(cssText);\n return removeCustomPropApply(cssText);\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nexport function removeCustomPropAssignment(cssText) {\n return cssText\n .replace(RX.customProp, '')\n .replace(RX.mixinProp, '');\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomPropApply(cssText) {\n return cssText\n .replace(RX.mixinApply, '')\n .replace(RX.varApply, '');\n}\n\n/** @enum {number} */\nexport const types = {\n STYLE_RULE: 1,\n KEYFRAMES_RULE: 7,\n MEDIA_RULE: 4,\n MIXIN_RULE: 1000\n}\n\nconst OPEN_BRACE = '{';\nconst CLOSE_BRACE = '}';\n\n// helper regexp's\nconst RX = {\n comments: /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//gim,\n port: /@import[^;]*;/gim,\n customProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\\n]|$)/gim,\n mixinProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\\n]|$)?/gim,\n mixinApply: /@apply\\s*\\(?[^);]*\\)?\\s*(?:[;\\n]|$)?/gim,\n varApply: /[^;:]*?:[^;]*?var\\([^;]*\\)(?:[;\\n]|$)?/gim,\n keyframesRule: /^@[^\\s]*keyframes/,\n multipleSpaces: /\\s+/g\n}\n\nconst VAR_START = '--';\nconst MEDIA_START = '@media';\nconst AT_START = '@';\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nexport const nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']);\nlet nativeCssVariables_;\n\n/**\n * @param {(ShadyCSSOptions | ShadyCSSInterface)=} settings\n */\nfunction calcCssVariables(settings) {\n if (settings && settings['shimcssproperties']) {\n nativeCssVariables_ = false;\n } else {\n // chrome 49 has semi-working css vars, check if box-shadow works\n // safari 9.1 has a recalc bug: https://bugs.webkit.org/show_bug.cgi?id=155782\n // However, shim css custom properties are only supported with ShadyDOM enabled,\n // so fall back on native if we do not detect ShadyDOM\n // Edge 15: custom properties used in ::before and ::after will also be used in the parent element\n // https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12414257/\n nativeCssVariables_ = nativeShadow || Boolean(!navigator.userAgent.match(/AppleWebKit\\/601|Edge\\/15/) &&\n window.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n }\n}\n\n/** @type {string | undefined} */\nexport let cssBuild;\nif (window.ShadyCSS && window.ShadyCSS.cssBuild !== undefined) {\n cssBuild = window.ShadyCSS.cssBuild;\n}\n\n/** @type {boolean} */\nexport const disableRuntime = Boolean(window.ShadyCSS && window.ShadyCSS.disableRuntime);\n\nif (window.ShadyCSS && window.ShadyCSS.nativeCss !== undefined) {\n nativeCssVariables_ = window.ShadyCSS.nativeCss;\n} else if (window.ShadyCSS) {\n calcCssVariables(window.ShadyCSS);\n // reset window variable to let ShadyCSS API take its place\n window.ShadyCSS = undefined;\n} else {\n calcCssVariables(window['WebComponents'] && window['WebComponents']['flags']);\n}\n\n// Hack for type error under new type inference which doesn't like that\n// nativeCssVariables is updated in a function and assigns the type\n// `function(): ?` instead of `boolean`.\nexport const nativeCssVariables = /** @type {boolean} */(nativeCssVariables_);","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\nexport const VAR_ASSIGN = /(?:^|[;\\s{]\\s*)(--[\\w-]*?)\\s*:\\s*(?:((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};{])+)|\\{([^}]*)\\}(?:(?=[;\\s}])|$))/gi;\nexport const MIXIN_MATCH = /(?:^|\\W+)@apply\\s*\\(?([^);\\n]*)\\)?/gi;\nexport const VAR_CONSUMED = /(--[\\w-]+)\\s*([:,;)]|$)/gi;\nexport const ANIMATION_MATCH = /(animation\\s*:)|(animation-name\\s*:)/;\nexport const MEDIA_MATCH = /@media\\s(.*)/;\nexport const IS_VAR = /^--/;\nexport const BRACKETED = /\\{[^}]*\\}/g;\nexport const HOST_PREFIX = '(?:^|[^.#[:])';\nexport const HOST_SUFFIX = '($|[.:[\\\\s>+~])';\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/** @type {!Set<string>} */\nconst styleTextSet = new Set();\n\nexport const scopingAttribute = 'shady-unscoped';\n\n/**\n * Add a specifically-marked style to the document directly, and only one copy of that style.\n *\n * @param {!HTMLStyleElement} style\n * @return {undefined}\n */\nexport function processUnscopedStyle(style) {\n const text = style.textContent;\n if (!styleTextSet.has(text)) {\n styleTextSet.add(text);\n const newStyle = style.cloneNode(true);\n document.head.appendChild(newStyle);\n }\n}\n\n/**\n * Check if a style is supposed to be unscoped\n * @param {!HTMLStyleElement} style\n * @return {boolean} true if the style has the unscoping attribute\n */\nexport function isUnscopedStyle(style) {\n return style.hasAttribute(scopingAttribute);\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow, nativeCssVariables, cssBuild} from './style-settings.js';\nimport {parse, stringify, types, StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars\nimport {MEDIA_MATCH} from './common-regex.js';\nimport {processUnscopedStyle, isUnscopedStyle} from './unscoped-style-handler.js';\n\n/**\n * @param {string|StyleNode} rules\n * @param {function(StyleNode)=} callback\n * @return {string}\n */\nexport function toCssText (rules, callback) {\n if (!rules) {\n return '';\n }\n if (typeof rules === 'string') {\n rules = parse(rules);\n }\n if (callback) {\n forEachRule(rules, callback);\n }\n return stringify(rules, nativeCssVariables);\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @return {StyleNode}\n */\nexport function rulesForStyle(style) {\n if (!style['__cssRules'] && style.textContent) {\n style['__cssRules'] = parse(style.textContent);\n }\n return style['__cssRules'] || null;\n}\n\n// Tests if a rule is a keyframes selector, which looks almost exactly\n// like a normal selector but is not (it has nothing to do with scoping\n// for example).\n/**\n * @param {StyleNode} rule\n * @return {boolean}\n */\nexport function isKeyframesSelector(rule) {\n return Boolean(rule['parent']) &&\n rule['parent']['type'] === types.KEYFRAMES_RULE;\n}\n\n/**\n * @param {StyleNode} node\n * @param {Function=} styleRuleCallback\n * @param {Function=} keyframesRuleCallback\n * @param {boolean=} onlyActiveRules\n */\nexport function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {\n if (!node) {\n return;\n }\n let skipRules = false;\n let type = node['type'];\n if (onlyActiveRules) {\n if (type === types.MEDIA_RULE) {\n let matchMedia = node['selector'].match(MEDIA_MATCH);\n if (matchMedia) {\n // if rule is a non matching @media rule, skip subrules\n if (!window.matchMedia(matchMedia[1]).matches) {\n skipRules = true;\n }\n }\n }\n }\n if (type === types.STYLE_RULE) {\n styleRuleCallback(node);\n } else if (keyframesRuleCallback &&\n type === types.KEYFRAMES_RULE) {\n keyframesRuleCallback(node);\n } else if (type === types.MIXIN_RULE) {\n skipRules = true;\n }\n let r$ = node['rules'];\n if (r$ && !skipRules) {\n for (let i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) {\n forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules);\n }\n }\n}\n\n// add a string of cssText to the document.\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @param {Node} target\n * @param {Node} contextNode\n * @return {HTMLStyleElement}\n */\nexport function applyCss(cssText, moniker, target, contextNode) {\n let style = createScopeStyle(cssText, moniker);\n applyStyle(style, target, contextNode);\n return style;\n}\n\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @return {HTMLStyleElement}\n */\nexport function createScopeStyle(cssText, moniker) {\n let style = /** @type {HTMLStyleElement} */(document.createElement('style'));\n if (moniker) {\n style.setAttribute('scope', moniker);\n }\n style.textContent = cssText;\n return style;\n}\n\n/**\n * Track the position of the last added style for placing placeholders\n * @type {Node}\n */\nlet lastHeadApplyNode = null;\n\n// insert a comment node as a styling position placeholder.\n/**\n * @param {string} moniker\n * @return {!Comment}\n */\nexport function applyStylePlaceHolder(moniker) {\n let placeHolder = document.createComment(' Shady DOM styles for ' +\n moniker + ' ');\n let after = lastHeadApplyNode ?\n lastHeadApplyNode['nextSibling'] : null;\n let scope = document.head;\n scope.insertBefore(placeHolder, after || scope.firstChild);\n lastHeadApplyNode = placeHolder;\n return placeHolder;\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @param {?Node} target\n * @param {?Node} contextNode\n */\nexport function applyStyle(style, target, contextNode) {\n target = target || document.head;\n let after = (contextNode && contextNode.nextSibling) ||\n target.firstChild;\n target.insertBefore(style, after);\n if (!lastHeadApplyNode) {\n lastHeadApplyNode = style;\n } else {\n // only update lastHeadApplyNode if the new style is inserted after the old lastHeadApplyNode\n let position = style.compareDocumentPosition(lastHeadApplyNode);\n if (position === Node.DOCUMENT_POSITION_PRECEDING) {\n lastHeadApplyNode = style;\n }\n }\n}\n\n/**\n * @param {string} buildType\n * @return {boolean}\n */\nexport function isTargetedBuild(buildType) {\n return nativeShadow ? buildType === 'shadow' : buildType === 'shady';\n}\n\n/**\n * Walk from text[start] matching parens and\n * returns position of the outer end paren\n * @param {string} text\n * @param {number} start\n * @return {number}\n */\nexport function findMatchingParen(text, start) {\n let level = 0;\n for (let i=start, l=text.length; i < l; i++) {\n if (text[i] === '(') {\n level++;\n } else if (text[i] === ')') {\n if (--level === 0) {\n return i;\n }\n }\n }\n return -1;\n}\n\n/**\n * @param {string} str\n * @param {function(string, string, string, string)} callback\n */\nexport function processVariableAndFallback(str, callback) {\n // find 'var('\n let start = str.indexOf('var(');\n if (start === -1) {\n // no var?, everything is prefix\n return callback(str, '', '', '');\n }\n //${prefix}var(${inner})${suffix}\n let end = findMatchingParen(str, start + 3);\n let inner = str.substring(start + 4, end);\n let prefix = str.substring(0, start);\n // suffix may have other variables\n let suffix = processVariableAndFallback(str.substring(end + 1), callback);\n let comma = inner.indexOf(',');\n // value and fallback args should be trimmed to match in property lookup\n if (comma === -1) {\n // variable, no fallback\n return callback(prefix, inner.trim(), '', suffix);\n }\n // var(${value},${fallback})\n let value = inner.substring(0, comma).trim();\n let fallback = inner.substring(comma + 1).trim();\n return callback(prefix, value, fallback, suffix);\n}\n\n/**\n * @param {Element} element\n * @param {string} value\n */\nexport function setElementClassRaw(element, value) {\n // use native setAttribute provided by ShadyDOM when setAttribute is patched\n if (nativeShadow) {\n element.setAttribute('class', value);\n } else {\n window['ShadyDOM']['nativeMethods']['setAttribute'].call(element, 'class', value);\n }\n}\n\n/**\n * @type {function(*):*}\n */\nexport const wrap = window['ShadyDOM'] && window['ShadyDOM']['wrap'] || ((node) => node);\n\n/**\n * @param {Element | {is: string, extends: string}} element\n * @return {{is: string, typeExtension: string}}\n */\nexport function getIsExtends(element) {\n let localName = element['localName'];\n let is = '', typeExtension = '';\n /*\n NOTE: technically, this can be wrong for certain svg elements\n with `-` in the name like `<font-face>`\n */\n if (localName) {\n if (localName.indexOf('-') > -1) {\n is = localName;\n } else {\n typeExtension = localName;\n is = (element.getAttribute && element.getAttribute('is')) || '';\n }\n } else {\n is = /** @type {?} */(element).is;\n typeExtension = /** @type {?} */(element).extends;\n }\n return {is, typeExtension};\n}\n\n/**\n * @param {Element|DocumentFragment} element\n * @return {string}\n */\nexport function gatherStyleText(element) {\n /** @type {!Array<string>} */\n const styleTextParts = [];\n const styles = /** @type {!NodeList<!HTMLStyleElement>} */(element.querySelectorAll('style'));\n for (let i = 0; i < styles.length; i++) {\n const style = styles[i];\n if (isUnscopedStyle(style)) {\n if (!nativeShadow) {\n processUnscopedStyle(style);\n style.parentNode.removeChild(style);\n }\n } else {\n styleTextParts.push(style.textContent);\n style.parentNode.removeChild(style);\n }\n }\n return styleTextParts.join('').trim();\n}\n\n/**\n * Split a selector separated by commas into an array in a smart way\n * @param {string} selector\n * @return {!Array<string>}\n */\nexport function splitSelectorList(selector) {\n const parts = [];\n let part = '';\n for (let i = 0; i >= 0 && i < selector.length; i++) {\n // A selector with parentheses will be one complete part\n if (selector[i] === '(') {\n // find the matching paren\n const end = findMatchingParen(selector, i);\n // push the paren block into the part\n part += selector.slice(i, end + 1);\n // move the index to after the paren block\n i = end;\n } else if (selector[i] === ',') {\n parts.push(part);\n part = '';\n } else {\n part += selector[i];\n }\n }\n // catch any pieces after the last comma\n if (part) {\n parts.push(part);\n }\n return parts;\n}\n\nconst CSS_BUILD_ATTR = 'css-build';\n\n/**\n * Return the polymer-css-build \"build type\" applied to this element\n *\n * @param {!HTMLElement} element\n * @return {string} Can be \"\", \"shady\", or \"shadow\"\n */\nexport function getCssBuild(element) {\n if (cssBuild !== undefined) {\n return /** @type {string} */(cssBuild);\n }\n if (element.__cssBuild === undefined) {\n // try attribute first, as it is the common case\n const attrValue = element.getAttribute(CSS_BUILD_ATTR);\n if (attrValue) {\n element.__cssBuild = attrValue;\n } else {\n const buildComment = getBuildComment(element);\n if (buildComment !== '') {\n // remove build comment so it is not needlessly copied into every element instance\n removeBuildComment(element);\n }\n element.__cssBuild = buildComment;\n }\n }\n return element.__cssBuild || '';\n}\n\n/**\n * Check if the given element, either a <template> or <style>, has been processed\n * by polymer-css-build.\n *\n * If so, then we can make a number of optimizations:\n * - polymer-css-build will decompose mixins into individual CSS Custom Properties,\n * so the ApplyShim can be skipped entirely.\n * - Under native ShadowDOM, the style text can just be copied into each instance\n * without modification\n * - If the build is \"shady\" and ShadyDOM is in use, the styling does not need\n * scoping beyond the shimming of CSS Custom Properties\n *\n * @param {!HTMLElement} element\n * @return {boolean}\n */\nexport function elementHasBuiltCss(element) {\n return getCssBuild(element) !== '';\n}\n\n/**\n * For templates made with tagged template literals, polymer-css-build will\n * insert a comment of the form `<!--css-build:shadow-->`\n *\n * @param {!HTMLElement} element\n * @return {string}\n */\nexport function getBuildComment(element) {\n const buildComment = element.localName === 'template' ?\n /** @type {!HTMLTemplateElement} */ (element).content.firstChild :\n element.firstChild;\n if (buildComment instanceof Comment) {\n const commentParts = buildComment.textContent.trim().split(':');\n if (commentParts[0] === CSS_BUILD_ATTR) {\n return commentParts[1];\n }\n }\n return '';\n}\n\n/**\n * Check if the css build status is optimal, and do no unneeded work.\n *\n * @param {string=} cssBuild CSS build status\n * @return {boolean} css build is optimal or not\n */\nexport function isOptimalCssBuild(cssBuild = '') {\n // CSS custom property shim always requires work\n if (cssBuild === '' || !nativeCssVariables) {\n return false;\n }\n return nativeShadow ? cssBuild === 'shadow' : cssBuild === 'shady';\n}\n\n/**\n * @param {!HTMLElement} element\n */\nfunction removeBuildComment(element) {\n const buildComment = element.localName === 'template' ?\n /** @type {!HTMLTemplateElement} */ (element).content.firstChild :\n element.firstChild;\n buildComment.parentNode.removeChild(buildComment);\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars\nimport * as StyleUtil from './style-util.js';\nimport {nativeShadow} from './style-settings.js';\n\n/* Transforms ShadowDOM styling into ShadyDOM styling\n\n* scoping:\n\n * elements in scope get scoping selector class=\"x-foo-scope\"\n * selectors re-written as follows:\n\n div button -> div.x-foo-scope button.x-foo-scope\n\n* :host -> scopeName\n\n* :host(...) -> scopeName...\n\n* ::slotted(...) -> scopeName > ...\n\n* ...:dir(ltr|rtl) -> [dir=\"ltr|rtl\"] ..., ...[dir=\"ltr|rtl\"]\n\n* :host(:dir[rtl]) -> scopeName:dir(rtl) -> [dir=\"rtl\"] scopeName, scopeName[dir=\"rtl\"]\n\n*/\nconst SCOPE_NAME = 'style-scope';\n\nclass StyleTransformer {\n get SCOPE_NAME() {\n return SCOPE_NAME;\n }\n /**\n * Given a node and scope name, add a scoping class to each node\n * in the tree. This facilitates transforming css into scoped rules.\n * @param {!Node} node\n * @param {string} scope\n * @param {boolean=} shouldRemoveScope\n * @deprecated\n */\n dom(node, scope, shouldRemoveScope) {\n const fn = (node) => {\n this.element(node, scope || '', shouldRemoveScope);\n };\n this._transformDom(node, fn);\n }\n\n /**\n * Given a node and scope name, add a scoping class to each node in the tree.\n * @param {!Node} node\n * @param {string} scope\n */\n domAddScope(node, scope) {\n const fn = (node) => {\n this.element(node, scope || '');\n };\n this._transformDom(node, fn);\n }\n\n /**\n * @param {!Node} startNode\n * @param {!function(!Node)} transformer\n */\n _transformDom(startNode, transformer) {\n if (startNode.nodeType === Node.ELEMENT_NODE) {\n transformer(startNode)\n }\n let c$;\n if (startNode.localName === 'template') {\n const template = /** @type {!HTMLTemplateElement} */ (startNode);\n // In case the template is in svg context, fall back to the node\n // since it won't be an HTMLTemplateElement with a .content property\n c$ = (template.content || template._content || template).childNodes;\n } else {\n c$ = /** @type {!ParentNode} */ (startNode).children ||\n startNode.childNodes;\n }\n if (c$) {\n for (let i = 0; i < c$.length; i++) {\n this._transformDom(c$[i], transformer);\n }\n }\n }\n\n /**\n * @param {?} element\n * @param {?} scope\n * @param {?=} shouldRemoveScope\n */\n element(element, scope, shouldRemoveScope) {\n // note: if using classes, we add both the general 'style-scope' class\n // as well as the specific scope. This enables easy filtering of all\n // `style-scope` elements\n if (scope) {\n // note: svg on IE does not have classList so fallback to class\n if (element.classList) {\n if (shouldRemoveScope) {\n element.classList.remove(SCOPE_NAME);\n element.classList.remove(scope);\n } else {\n element.classList.add(SCOPE_NAME);\n element.classList.add(scope);\n }\n } else if (element.getAttribute) {\n let c = element.getAttribute(CLASS);\n if (shouldRemoveScope) {\n if (c) {\n let newValue = c.replace(SCOPE_NAME, '').replace(scope, '');\n StyleUtil.setElementClassRaw(element, newValue);\n }\n } else {\n let newValue = (c ? c + ' ' : '') + SCOPE_NAME + ' ' + scope;\n StyleUtil.setElementClassRaw(element, newValue);\n }\n }\n }\n }\n\n /**\n * Given a node, replace the scoping class to each subnode in the tree.\n * @param {!Node} node\n * @param {string} oldScope\n * @param {string} newScope\n */\n domReplaceScope(node, oldScope, newScope) {\n const fn = (node) => {\n this.element(node, oldScope, true);\n this.element(node, newScope);\n };\n this._transformDom(node, fn);\n }\n /**\n * Given a node, remove the scoping class to each subnode in the tree.\n * @param {!Node} node\n * @param {string} oldScope\n */\n domRemoveScope(node, oldScope) {\n const fn = (node) => {\n this.element(node, oldScope || '', true);\n };\n this._transformDom(node, fn);\n }\n\n /**\n * @param {?} element\n * @param {?} styleRules\n * @param {?=} callback\n * @param {string=} cssBuild\n * @param {string=} cssText\n * @return {string}\n */\n elementStyles(element, styleRules, callback, cssBuild = '', cssText = '') {\n // no need to shim selectors if settings.useNativeShadow, also\n // a shady css build will already have transformed selectors\n // NOTE: This method may be called as part of static or property shimming.\n // When there is a targeted build it will not be called for static shimming,\n // but when the property shim is used it is called and should opt out of\n // static shimming work when a proper build exists.\n if (cssText === '') {\n if (nativeShadow || cssBuild === 'shady') {\n cssText = StyleUtil.toCssText(styleRules, callback);\n } else {\n let {is, typeExtension} = StyleUtil.getIsExtends(element);\n cssText = this.css(styleRules, is, typeExtension, callback) + '\\n\\n';\n }\n }\n return cssText.trim();\n }\n\n // Given a string of cssText and a scoping string (scope), returns\n // a string of scoped css where each selector is transformed to include\n // a class created from the scope. ShadowDOM selectors are also transformed\n // (e.g. :host) to use the scoping selector.\n css(rules, scope, ext, callback) {\n let hostScope = this._calcHostScope(scope, ext);\n scope = this._calcElementScope(scope);\n let self = this;\n return StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n if (!rule.isScoped) {\n self.rule(rule, scope, hostScope);\n rule.isScoped = true;\n }\n if (callback) {\n callback(rule, scope, hostScope);\n }\n });\n }\n\n _calcElementScope(scope) {\n if (scope) {\n return CSS_CLASS_PREFIX + scope;\n } else {\n return '';\n }\n }\n\n _calcHostScope(scope, ext) {\n return ext ? `[is=${scope}]` : scope;\n }\n\n rule(rule, scope, hostScope) {\n this._transformRule(rule, this._transformComplexSelector,\n scope, hostScope);\n }\n\n /**\n * transforms a css rule to a scoped rule.\n *\n * @param {StyleNode} rule\n * @param {Function} transformer\n * @param {string=} scope\n * @param {string=} hostScope\n */\n _transformRule(rule, transformer, scope, hostScope) {\n // NOTE: save transformedSelector for subsequent matching of elements\n // against selectors (e.g. when calculating style properties)\n rule['selector'] = rule.transformedSelector =\n this._transformRuleCss(rule, transformer, scope, hostScope);\n }\n\n /**\n * @param {StyleNode} rule\n * @param {Function} transformer\n * @param {string=} scope\n * @param {string=} hostScope\n */\n _transformRuleCss(rule, transformer, scope, hostScope) {\n let p$ = StyleUtil.splitSelectorList(rule['selector']);\n // we want to skip transformation of rules that appear in keyframes,\n // because they are keyframe selectors, not element selectors.\n if (!StyleUtil.isKeyframesSelector(rule)) {\n for (let i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) {\n p$[i] = transformer.call(this, p, scope, hostScope);\n }\n }\n return p$.filter((part) => Boolean(part)).join(COMPLEX_SELECTOR_SEP);\n }\n\n /**\n * @param {string} selector\n * @return {string}\n */\n _twiddleNthPlus(selector) {\n return selector.replace(NTH, (m, type, inside) => {\n if (inside.indexOf('+') > -1) {\n inside = inside.replace(/\\+/g, '___');\n } else if (inside.indexOf('___') > -1) {\n inside = inside.replace(/___/g, '+');\n }\n return `:${type}(${inside})`;\n });\n }\n\n /**\n * Preserve `:matches()` selectors by replacing them with MATCHES_REPLACMENT\n * and returning an array of `:matches()` selectors.\n * Use `_replacesMatchesPseudo` to replace the `:matches()` parts\n *\n * @param {string} selector\n * @return {{selector: string, matches: !Array<string>}}\n */\n _preserveMatchesPseudo(selector) {\n /** @type {!Array<string>} */\n const matches = [];\n let match;\n while ((match = selector.match(MATCHES))) {\n const start = match.index;\n const end = StyleUtil.findMatchingParen(selector, start);\n if (end === -1) {\n throw new Error(`${match.input} selector missing ')'`)\n }\n const part = selector.slice(start, end + 1);\n selector = selector.replace(part, MATCHES_REPLACEMENT);\n matches.push(part);\n }\n return {selector, matches};\n }\n\n /**\n * Replace MATCHES_REPLACMENT character with the given set of `:matches()`\n * selectors.\n *\n * @param {string} selector\n * @param {!Array<string>} matches\n * @return {string}\n */\n _replaceMatchesPseudo(selector, matches) {\n const parts = selector.split(MATCHES_REPLACEMENT);\n return matches.reduce((acc, cur, idx) => acc + cur + parts[idx + 1], parts[0]);\n }\n\n/**\n * @param {string} selector\n * @param {string} scope\n * @param {string=} hostScope\n */\n _transformComplexSelector(selector, scope, hostScope) {\n let stop = false;\n selector = selector.trim();\n // Remove spaces inside of selectors like `:nth-of-type` because it confuses SIMPLE_SELECTOR_SEP\n let isNth = NTH.test(selector);\n if (isNth) {\n selector = selector.replace(NTH, (m, type, inner) => `:${type}(${inner.replace(/\\s/g, '')})`)\n selector = this._twiddleNthPlus(selector);\n }\n // Preserve selectors like `:-webkit-any` so that SIMPLE_SELECTOR_SEP does\n // not get confused by spaces inside the pseudo selector\n const isMatches = MATCHES.test(selector);\n /** @type {!Array<string>} */\n let matches;\n if (isMatches) {\n ({selector, matches} = this._preserveMatchesPseudo(selector));\n }\n selector = selector.replace(SLOTTED_START, `${HOST} $1`);\n selector = selector.replace(SIMPLE_SELECTOR_SEP, (m, c, s) => {\n if (!stop) {\n let info = this._transformCompoundSelector(s, c, scope, hostScope);\n stop = stop || info.stop;\n c = info.combinator;\n s = info.value;\n }\n return c + s;\n });\n // replace `:matches()` selectors\n if (isMatches) {\n selector = this._replaceMatchesPseudo(selector, matches);\n }\n if (isNth) {\n selector = this._twiddleNthPlus(selector);\n }\n return selector;\n }\n\n _transformCompoundSelector(selector, combinator, scope, hostScope) {\n // replace :host with host scoping class\n let slottedIndex = selector.indexOf(SLOTTED);\n if (selector.indexOf(HOST) >= 0) {\n selector = this._transformHostSelector(selector, hostScope);\n // replace other selectors with scoping class\n } else if (slottedIndex !== 0) {\n selector = scope ? this._transformSimpleSelector(selector, scope) :\n selector;\n }\n // mark ::slotted() scope jump to replace with descendant selector + arg\n // also ignore left-side combinator\n let slotted = false;\n if (slottedIndex >= 0) {\n combinator = '';\n slotted = true;\n }\n // process scope jumping selectors up to the scope jump and then stop\n let stop;\n if (slotted) {\n stop = true;\n if (slotted) {\n // .zonk ::slotted(.foo) -> .zonk.scope > .foo\n selector = selector.replace(SLOTTED_PAREN, (m, paren) => ` > ${paren}`);\n }\n }\n selector = selector.replace(DIR_PAREN, (m, before, dir) =>\n `[dir=\"${dir}\"] ${before}, ${before}[dir=\"${dir}\"]`);\n return {value: selector, combinator, stop};\n }\n\n _transformSimpleSelector(selector, scope) {\n const attributes = selector.split(/(\\[.+?\\])/);\n\n const output = [];\n for (let i = 0; i < attributes.length; i++) {\n // Do not attempt to transform any attribute selector content\n if ((i % 2) === 1) {\n output.push(attributes[i]);\n } else {\n const part = attributes[i];\n\n if (!(part === '' && i === attributes.length - 1)) {\n let p$ = part.split(PSEUDO_PREFIX);\n p$[0] += scope;\n output.push(p$.join(PSEUDO_PREFIX));\n }\n }\n }\n\n return output.join('');\n }\n\n // :host(...) -> scopeName...\n _transformHostSelector(selector, hostScope) {\n let m = selector.match(HOST_PAREN);\n let paren = m && m[2].trim() || '';\n if (paren) {\n if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) {\n // paren starts with a type selector\n let typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0];\n // if the type selector is our hostScope then avoid pre-pending it\n if (typeSelector === hostScope) {\n return paren;\n // otherwise, this selector should not match in this scope so\n // output a bogus selector.\n } else {\n return SELECTOR_NO_MATCH;\n }\n } else {\n // make sure to do a replace here to catch selectors like:\n // `:host(.foo)::before`\n return selector.replace(HOST_PAREN, function(m, host, paren) {\n return hostScope + paren;\n });\n }\n // if no paren, do a straight :host replacement.\n // TODO(sorvell): this should not strictly be necessary but\n // it's needed to maintain support for `:host[foo]` type selectors\n // which have been improperly used under Shady DOM. This should be\n // deprecated.\n } else {\n return selector.replace(HOST, hostScope);\n }\n }\n\n /**\n * @param {StyleNode} rule\n */\n documentRule(rule) {\n // reset selector in case this is redone.\n rule['selector'] = rule['parsedSelector'];\n this.normalizeRootSelector(rule);\n this._transformRule(rule, this._transformDocumentSelector);\n }\n\n /**\n * @param {StyleNode} rule\n */\n normalizeRootSelector(rule) {\n if (rule['selector'] === ROOT) {\n rule['selector'] = 'html';\n }\n }\n\n/**\n * @param {string} selector\n */\n _transformDocumentSelector(selector) {\n if (selector.match(HOST)) {\n // remove ':host' type selectors in document rules\n return '';\n } else if (selector.match(SLOTTED)) {\n return this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR)\n } else {\n return this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);\n }\n }\n}\n\nconst NTH = /:(nth[-\\w]+)\\(([^)]+)\\)/;\nconst SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`;\nconst COMPLEX_SELECTOR_SEP = ',';\nconst SIMPLE_SELECTOR_SEP = /(^|[\\s>+~]+)((?:\\[.+?\\]|[^\\s>+~=[])+)/g;\nconst SIMPLE_SELECTOR_PREFIX = /[[.:#*]/;\nconst HOST = ':host';\nconst ROOT = ':root';\nconst SLOTTED = '::slotted';\nconst SLOTTED_START = new RegExp(`^(${SLOTTED})`);\n// NOTE: this supports 1 nested () pair for things like\n// :host(:not([selected]), more general support requires\n// parsing which seems like overkill\nconst HOST_PAREN = /(:host)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\n// similar to HOST_PAREN\nconst SLOTTED_PAREN = /(?:::slotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\nconst DIR_PAREN = /(.*):dir\\((?:(ltr|rtl))\\)/;\nconst CSS_CLASS_PREFIX = '.';\nconst PSEUDO_PREFIX = ':';\nconst CLASS = 'class';\nconst SELECTOR_NO_MATCH = 'should_not_match';\nconst MATCHES = /:(?:matches|any|-(?:webkit|moz)-any)/;\nconst MATCHES_REPLACEMENT = '\\u{e000}';\n\nexport default new StyleTransformer()\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {nativeShadow} from './style-settings.js';\nimport StyleTransformer from './style-transformer.js';\nimport {getIsExtends, elementHasBuiltCss, wrap} from './style-util.js';\n\nexport let flush = function() {};\n\n/**\n * @param {!Element} element\n * @return {string}\n */\nfunction getClasses(element) {\n if (element.classList && element.classList.value) {\n return element.classList.value;\n } else {\n // NOTE: className is patched to remove scoping classes in ShadyDOM\n // use getAttribute('class') instead, which is unpatched\n return element.getAttribute('class') || '';\n }\n}\n\nconst scopeRegExp = new RegExp(`${StyleTransformer.SCOPE_NAME}\\\\s*([^\\\\s]*)`);\n\n/**\n * @param {!Element} element\n * @return {string}\n */\nexport function getCurrentScope(element) {\n const match = getClasses(element).match(scopeRegExp);\n if (match) {\n return match[1];\n } else {\n return '';\n }\n}\n\n/**\n * @param {!Node} node\n */\nexport function getOwnerScope(node) {\n const ownerRoot = wrap(node).getRootNode();\n if (ownerRoot === node || ownerRoot === node.ownerDocument) {\n return '';\n }\n const host = /** @type {!ShadowRoot} */(ownerRoot).host;\n if (!host) {\n // this may actually be a document fragment\n return '';\n }\n return getIsExtends(host).is;\n}\n\n/**\n * @param {!Element} element\n */\nexport function ensureCorrectScope(element) {\n const currentScope = getCurrentScope(element);\n const ownerRoot = wrap(element).getRootNode();\n if (ownerRoot === element) {\n return;\n }\n if (currentScope && ownerRoot === element.ownerDocument) {\n // node was scoped, but now is in document\n StyleTransformer.domRemoveScope(element, currentScope);\n } else if (ownerRoot instanceof ShadowRoot) {\n const ownerScope = getOwnerScope(element);\n if (ownerScope !== currentScope) {\n // node was scoped, but not by its current owner\n StyleTransformer.domReplaceScope(element, currentScope, ownerScope);\n }\n }\n}\n\n/**\n * @param {!HTMLElement|!HTMLDocument} element\n */\nexport function ensureCorrectSubtreeScoping(element) {\n // find unscoped subtree nodes\n const unscopedNodes = window['ShadyDOM']['nativeMethods']['querySelectorAll'].call(\n element, `:not(.${StyleTransformer.SCOPE_NAME})`);\n\n for (let j = 0; j < unscopedNodes.length; j++) {\n // it's possible, during large batch inserts, that nodes that aren't\n // scoped within the current scope were added.\n // To make sure that any unscoped nodes that were inserted in the current batch are correctly styled,\n // query all unscoped nodes and force their style-scope to be applied.\n // This could happen if a sub-element appended an unscoped node in its shadowroot and this function\n // runs on a parent element of the host of that unscoped node:\n // parent-element -> element -> unscoped node\n // Here unscoped node should have the style-scope element, not parent-element.\n const unscopedNode = unscopedNodes[j];\n const scopeForPreviouslyUnscopedNode = getOwnerScope(unscopedNode);\n if (scopeForPreviouslyUnscopedNode) {\n StyleTransformer.element(unscopedNode, scopeForPreviouslyUnscopedNode);\n }\n }\n}\n\n/**\n * @param {HTMLElement} el\n * @return {boolean}\n */\nfunction isElementWithBuiltCss(el) {\n if (el.localName === 'style' || el.localName === 'template') {\n return elementHasBuiltCss(el);\n }\n return false;\n}\n\n/**\n * @param {Array<MutationRecord|null>|null} mxns\n */\nfunction handler(mxns) {\n for (let x=0; x < mxns.length; x++) {\n let mxn = mxns[x];\n if (mxn.target === document.documentElement ||\n mxn.target === document.head) {\n continue;\n }\n for (let i=0; i < mxn.addedNodes.length; i++) {\n let n = mxn.addedNodes[i];\n if (n.nodeType !== Node.ELEMENT_NODE) {\n continue;\n }\n n = /** @type {HTMLElement} */(n); // eslint-disable-line no-self-assign\n let root = n.getRootNode();\n let currentScope = getCurrentScope(n);\n // node was scoped, but now is in document\n // If this element has built css, we must not remove scoping as this node\n // will be used as a template or style without re - applying scoping as an optimization\n if (currentScope && root === n.ownerDocument && !isElementWithBuiltCss(n)) {\n StyleTransformer.domRemoveScope(n, currentScope);\n } else if (root instanceof ShadowRoot) {\n const newScope = getOwnerScope(n);\n // rescope current node and subtree if necessary\n if (newScope !== currentScope) {\n StyleTransformer.domReplaceScope(n, currentScope, newScope);\n }\n // make sure all the subtree elements are scoped correctly\n ensureCorrectSubtreeScoping(n);\n }\n }\n }\n}\n\n// if native Shadow DOM is being used, or ShadyDOM handles dynamic scoiping, do not activate the MutationObserver\nif (!nativeShadow && !(window['ShadyDOM'] && window['ShadyDOM']['handlesDynamicScoping'])) {\n let observer = new MutationObserver(handler);\n let start = (node) => {\n observer.observe(node, {childList: true, subtree: true});\n }\n let nativeCustomElements = (window['customElements'] &&\n !window['customElements']['polyfillWrapFlushCallback']);\n // need to start immediately with native custom elements\n // TODO(dfreedm): with polyfilled HTMLImports and native custom elements\n // excessive mutations may be observed; this can be optimized via cooperation\n // with the HTMLImports polyfill.\n if (nativeCustomElements) {\n start(document);\n } else {\n let delayedStart = () => {\n start(document.body);\n }\n // use polyfill timing if it's available\n if (window['HTMLImports']) {\n window['HTMLImports']['whenReady'](delayedStart);\n // otherwise push beyond native imports being ready\n // which requires RAF + readystate interactive.\n } else {\n requestAnimationFrame(function() {\n if (document.readyState === 'loading') {\n let listener = function() {\n delayedStart();\n document.removeEventListener('readystatechange', listener);\n }\n document.addEventListener('readystatechange', listener);\n } else {\n delayedStart();\n }\n });\n }\n }\n\n flush = function() {\n handler(observer.takeRecords());\n }\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {removeCustomPropAssignment, StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars\nimport {nativeShadow} from './style-settings.js';\nimport StyleTransformer from './style-transformer.js';\nimport * as StyleUtil from './style-util.js';\nimport * as RX from './common-regex.js';\nimport StyleInfo from './style-info.js';\n\n// TODO: dedupe with shady\n/**\n * @param {string} selector\n * @return {boolean}\n * @this {Element}\n */\nconst matchesSelector = function(selector) {\n const method = this.matches || this.matchesSelector ||\n this.mozMatchesSelector || this.msMatchesSelector ||\n this.oMatchesSelector || this.webkitMatchesSelector;\n return method && method.call(this, selector);\n};\n\nconst IS_IE = navigator.userAgent.match('Trident');\n\nconst XSCOPE_NAME = 'x-scope';\n\nclass StyleProperties {\n get XSCOPE_NAME() {\n return XSCOPE_NAME;\n }\n/**\n * decorates styles with rule info and returns an array of used style property names\n *\n * @param {StyleNode} rules\n * @return {Array<string>}\n */\n decorateStyles(rules) {\n let self = this, props = {}, keyframes = [], ruleIndex = 0;\n StyleUtil.forEachRule(rules, function(rule) {\n self.decorateRule(rule);\n // mark in-order position of ast rule in styles block, used for cache key\n rule.index = ruleIndex++;\n self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);\n }, function onKeyframesRule(rule) {\n keyframes.push(rule);\n });\n // Cache all found keyframes rules for later reference:\n rules._keyframes = keyframes;\n // return this list of property names *consumes* in these styles.\n let names = [];\n for (let i in props) {\n names.push(i);\n }\n return names;\n }\n\n // decorate a single rule with property info\n decorateRule(rule) {\n if (rule.propertyInfo) {\n return rule.propertyInfo;\n }\n let info = {}, properties = {};\n let hasProperties = this.collectProperties(rule, properties);\n if (hasProperties) {\n info.properties = properties;\n // TODO(sorvell): workaround parser seeing mixins as additional rules\n rule['rules'] = null;\n }\n info.cssText = this.collectCssText(rule);\n rule.propertyInfo = info;\n return info;\n }\n\n // collects the custom properties from a rule's cssText\n collectProperties(rule, properties) {\n let info = rule.propertyInfo;\n if (info) {\n if (info.properties) {\n Object.assign(properties, info.properties);\n return true;\n }\n } else {\n let m, rx = RX.VAR_ASSIGN;\n let cssText = rule['parsedCssText'];\n let value;\n let any;\n while ((m = rx.exec(cssText))) {\n // note: group 2 is var, 3 is mixin\n value = (m[2] || m[3]).trim();\n // value of 'inherit' or 'unset' is equivalent to not setting the property here\n if (value !== 'inherit' || value !== 'unset') {\n properties[m[1].trim()] = value;\n }\n any = true;\n }\n return any;\n }\n\n }\n\n // returns cssText of properties that consume variables/mixins\n collectCssText(rule) {\n return this.collectConsumingCssText(rule['parsedCssText']);\n }\n\n // NOTE: we support consumption inside mixin assignment\n // but not production, so strip out {...}\n collectConsumingCssText(cssText) {\n return cssText.replace(RX.BRACKETED, '')\n .replace(RX.VAR_ASSIGN, '');\n }\n\n collectPropertiesInCssText(cssText, props) {\n let m;\n while ((m = RX.VAR_CONSUMED.exec(cssText))) {\n let name = m[1];\n // This regex catches all variable names, and following non-whitespace char\n // If next char is not ':', then variable is a consumer\n if (m[2] !== ':') {\n props[name] = true;\n }\n }\n }\n\n // turns custom properties into realized values.\n reify(props) {\n // big perf optimization here: reify only *own* properties\n // since this object has __proto__ of the element's scope properties\n let names = Object.getOwnPropertyNames(props);\n for (let i=0, n; i < names.length; i++) {\n n = names[i];\n props[n] = this.valueForProperty(props[n], props);\n }\n }\n\n // given a property value, returns the reified value\n // a property value may be:\n // (1) a literal value like: red or 5px;\n // (2) a variable value like: var(--a), var(--a, red), or var(--a, --b) or\n // var(--a, var(--b));\n // (3) a literal mixin value like { properties }. Each of these properties\n // can have values that are: (a) literal, (b) variables, (c) @apply mixins.\n valueForProperty(property, props) {\n // case (1) default\n // case (3) defines a mixin and we have to reify the internals\n if (property) {\n if (property.indexOf(';') >=0) {\n property = this.valueForProperties(property, props);\n } else {\n // case (2) variable\n let self = this;\n let fn = function(prefix, value, fallback, suffix) {\n if (!value) {\n return prefix + suffix;\n }\n let propertyValue = self.valueForProperty(props[value], props);\n // if value is \"initial\", then the variable should be treated as unset\n if (!propertyValue || propertyValue === 'initial') {\n // fallback may be --a or var(--a) or literal\n propertyValue = self.valueForProperty(props[fallback] || fallback, props) ||\n fallback;\n } else if (propertyValue === 'apply-shim-inherit') {\n // CSS build will replace `inherit` with `apply-shim-inherit`\n // for use with native css variables.\n // Since we have full control, we can use `inherit` directly.\n propertyValue = 'inherit';\n }\n return prefix + (propertyValue || '') + suffix;\n };\n property = StyleUtil.processVariableAndFallback(property, fn);\n }\n }\n return property && property.trim() || '';\n }\n\n // note: we do not yet support mixin within mixin\n valueForProperties(property, props) {\n let parts = property.split(';');\n for (let i=0, p, m; i<parts.length; i++) {\n if ((p = parts[i])) {\n RX.MIXIN_MATCH.lastIndex = 0;\n m = RX.MIXIN_MATCH.exec(p);\n if (m) {\n p = this.valueForProperty(props[m[1]], props);\n } else {\n let colon = p.indexOf(':');\n if (colon !== -1) {\n let pp = p.substring(colon);\n pp = pp.trim();\n pp = this.valueForProperty(pp, props) || pp;\n p = p.substring(0, colon) + pp;\n }\n }\n parts[i] = (p && p.lastIndexOf(';') === p.length - 1) ?\n // strip trailing ;\n p.slice(0, -1) :\n p || '';\n }\n }\n return parts.join(';');\n }\n\n applyProperties(rule, props) {\n let output = '';\n // dynamically added sheets may not be decorated so ensure they are.\n if (!rule.propertyInfo) {\n this.decorateRule(rule);\n }\n if (rule.propertyInfo.cssText) {\n output = this.valueForProperties(rule.propertyInfo.cssText, props);\n }\n rule['cssText'] = output;\n }\n\n // Apply keyframe transformations to the cssText of a given rule. The\n // keyframeTransforms object is a map of keyframe names to transformer\n // functions which take in cssText and spit out transformed cssText.\n applyKeyframeTransforms(rule, keyframeTransforms) {\n let input = rule['cssText'];\n let output = rule['cssText'];\n if (rule.hasAnimations == null) {\n // Cache whether or not the rule has any animations to begin with:\n rule.hasAnimations = RX.ANIMATION_MATCH.test(input);\n }\n // If there are no animations referenced, we can skip transforms:\n if (rule.hasAnimations) {\n let transform;\n // If we haven't transformed this rule before, we iterate over all\n // transforms:\n if (rule.keyframeNamesToTransform == null) {\n rule.keyframeNamesToTransform = [];\n for (let keyframe in keyframeTransforms) {\n transform = keyframeTransforms[keyframe];\n output = transform(input);\n // If the transform actually changed the CSS text, we cache the\n // transform name for future use:\n if (input !== output) {\n input = output;\n rule.keyframeNamesToTransform.push(keyframe);\n }\n }\n } else {\n // If we already have a list of keyframe names that apply to this\n // rule, we apply only those keyframe name transforms:\n for (let i = 0; i < rule.keyframeNamesToTransform.length; ++i) {\n transform = keyframeTransforms[rule.keyframeNamesToTransform[i]];\n input = transform(input);\n }\n output = input;\n }\n }\n rule['cssText'] = output;\n }\n\n // Test if the rules in these styles matches the given `element` and if so,\n // collect any custom properties into `props`.\n /**\n * @param {StyleNode} rules\n * @param {Element} element\n */\n propertyDataFromStyles(rules, element) {\n let props = {};\n // generates a unique key for these matches\n let o = [];\n // note: active rules excludes non-matching @media rules\n StyleUtil.forEachRule(rules, (rule) => {\n // TODO(sorvell): we could trim the set of rules at declaration\n // time to only include ones that have properties\n if (!rule.propertyInfo) {\n this.decorateRule(rule);\n }\n // match element against transformedSelector: selector may contain\n // unwanted uniquification and parsedSelector does not directly match\n // for :host selectors.\n let selectorToMatch = rule.transformedSelector || rule['parsedSelector'];\n if (element && rule.propertyInfo.properties && selectorToMatch) {\n if (matchesSelector.call(element, selectorToMatch)) {\n this.collectProperties(rule, props);\n // produce numeric key for these matches for lookup\n addToBitMask(rule.index, o);\n }\n }\n }, null, true);\n return {properties: props, key: o};\n }\n\n /**\n * @param {Element} scope\n * @param {StyleNode} rule\n * @param {string} cssBuild\n * @param {function(Object)} callback\n */\n whenHostOrRootRule(scope, rule, cssBuild, callback) {\n if (!rule.propertyInfo) {\n this.decorateRule(rule);\n }\n if (!rule.propertyInfo.properties) {\n return;\n }\n let {is, typeExtension} = StyleUtil.getIsExtends(scope);\n let hostScope = is ?\n StyleTransformer._calcHostScope(is, typeExtension) :\n 'html';\n let parsedSelector = rule['parsedSelector'];\n let isRoot = (parsedSelector === ':host > *' || parsedSelector === 'html');\n let isHost = parsedSelector.indexOf(':host') === 0 && !isRoot;\n // build info is either in scope (when scope is an element) or in the style\n // when scope is the default scope; note: this allows default scope to have\n // mixed mode built and unbuilt styles.\n if (cssBuild === 'shady') {\n // :root -> x-foo > *.x-foo for elements and html for custom-style\n isRoot = parsedSelector === (hostScope + ' > *.' + hostScope) || parsedSelector.indexOf('html') !== -1;\n // :host -> x-foo for elements, but sub-rules have .x-foo in them\n isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0;\n }\n if (!isRoot && !isHost) {\n return;\n }\n let selectorToMatch = hostScope;\n if (isHost) {\n // need to transform :host because `:host` does not work with `matches`\n if (!rule.transformedSelector) {\n // transform :host into a matchable selector\n rule.transformedSelector =\n StyleTransformer._transformRuleCss(\n rule,\n StyleTransformer._transformComplexSelector,\n StyleTransformer._calcElementScope(is),\n hostScope\n );\n }\n selectorToMatch = rule.transformedSelector || hostScope;\n }\n callback({\n selector: selectorToMatch,\n isHost: isHost,\n isRoot: isRoot\n });\n }\n/**\n * @param {Element} scope\n * @param {StyleNode} rules\n * @param {string} cssBuild\n * @return {Object}\n */\n hostAndRootPropertiesForScope(scope, rules, cssBuild) {\n let hostProps = {}, rootProps = {};\n // note: active rules excludes non-matching @media rules\n StyleUtil.forEachRule(rules, (rule) => {\n // if scope is StyleDefaults, use _element for matchesSelector\n this.whenHostOrRootRule(scope, rule, cssBuild, (info) => {\n let element = scope._element || scope;\n if (matchesSelector.call(element, info.selector)) {\n if (info.isHost) {\n this.collectProperties(rule, hostProps);\n } else {\n this.collectProperties(rule, rootProps);\n }\n }\n });\n }, null, true);\n return {rootProps: rootProps, hostProps: hostProps};\n }\n\n /**\n * @param {Element} element\n * @param {Object} properties\n * @param {string} scopeSelector\n */\n transformStyles(element, properties, scopeSelector) {\n let self = this;\n let {is, typeExtension} = StyleUtil.getIsExtends(element);\n let hostSelector = StyleTransformer\n ._calcHostScope(is, typeExtension);\n let rxHostSelector = element.extends ?\n '\\\\' + hostSelector.slice(0, -1) + '\\\\]' :\n hostSelector;\n let hostRx = new RegExp(RX.HOST_PREFIX + rxHostSelector +\n RX.HOST_SUFFIX);\n let {styleRules: rules, cssBuild} = StyleInfo.get(element);\n let keyframeTransforms =\n this._elementKeyframeTransforms(element, rules, scopeSelector);\n return StyleTransformer.elementStyles(element, rules, function(rule) {\n self.applyProperties(rule, properties);\n if (!nativeShadow &&\n !StyleUtil.isKeyframesSelector(rule) &&\n rule['cssText']) {\n // NOTE: keyframe transforms only scope munge animation names, so it\n // is not necessary to apply them in ShadowDOM.\n self.applyKeyframeTransforms(rule, keyframeTransforms);\n self._scopeSelector(rule, hostRx, hostSelector, scopeSelector);\n }\n }, cssBuild);\n }\n\n /**\n * @param {Element} element\n * @param {StyleNode} rules\n * @param {string} scopeSelector\n * @return {Object}\n */\n _elementKeyframeTransforms(element, rules, scopeSelector) {\n let keyframesRules = rules._keyframes;\n let keyframeTransforms = {};\n if (!nativeShadow && keyframesRules) {\n // For non-ShadowDOM, we transform all known keyframes rules in\n // advance for the current scope. This allows us to catch keyframes\n // rules that appear anywhere in the stylesheet:\n for (let i = 0, keyframesRule = keyframesRules[i];\n i < keyframesRules.length;\n keyframesRule = keyframesRules[++i]) {\n this._scopeKeyframes(keyframesRule, scopeSelector);\n keyframeTransforms[keyframesRule['keyframesName']] =\n this._keyframesRuleTransformer(keyframesRule);\n }\n }\n return keyframeTransforms;\n }\n\n // Generate a factory for transforming a chunk of CSS text to handle a\n // particular scoped keyframes rule.\n /**\n * @param {StyleNode} keyframesRule\n * @return {function(string):string}\n */\n _keyframesRuleTransformer(keyframesRule) {\n return function(cssText) {\n return cssText.replace(\n keyframesRule.keyframesNameRx,\n keyframesRule.transformedKeyframesName);\n };\n }\n\n/**\n * Transforms `@keyframes` names to be unique for the current host.\n * Example: @keyframes foo-anim -> @keyframes foo-anim-x-foo-0\n *\n * @param {StyleNode} rule\n * @param {string} scopeId\n */\n _scopeKeyframes(rule, scopeId) {\n // Animation names are of the form [\\w-], so ensure that the name regex does not partially apply\n // to similarly named keyframe names by checking for a word boundary at the beginning and\n // a non-word boundary or `-` at the end.\n rule.keyframesNameRx = new RegExp(`\\\\b${rule['keyframesName']}(?!\\\\B|-)`, 'g');\n rule.transformedKeyframesName = rule['keyframesName'] + '-' + scopeId;\n rule.transformedSelector = rule.transformedSelector || rule['selector'];\n rule['selector'] = rule.transformedSelector.replace(\n rule['keyframesName'], rule.transformedKeyframesName);\n }\n\n // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes):\n // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo\n // host selector: x-foo.wide -> .x-foo-42.wide\n // note: we use only the scope class (.x-foo-42) and not the hostSelector\n // (x-foo) to scope :host rules; this helps make property host rules\n // have low specificity. They are overrideable by class selectors but,\n // unfortunately, not by type selectors (e.g. overriding via\n // `.special` is ok, but not by `x-foo`).\n /**\n * @param {StyleNode} rule\n * @param {RegExp} hostRx\n * @param {string} hostSelector\n * @param {string} scopeId\n */\n _scopeSelector(rule, hostRx, hostSelector, scopeId) {\n rule.transformedSelector = rule.transformedSelector || rule['selector'];\n let selector = rule.transformedSelector;\n let scope = '.' + scopeId;\n let parts = StyleUtil.splitSelectorList(selector);\n for (let i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) {\n parts[i] = p.match(hostRx) ?\n p.replace(hostSelector, scope) :\n scope + ' ' + p;\n }\n rule['selector'] = parts.join(',');\n }\n\n /**\n * @param {Element} element\n * @param {string} selector\n * @param {string} old\n */\n applyElementScopeSelector(element, selector, old) {\n let c = element.getAttribute('class') || '';\n let v = c;\n if (old) {\n v = c.replace(\n new RegExp('\\\\s*' + XSCOPE_NAME + '\\\\s*' + old + '\\\\s*', 'g'), ' ');\n }\n v += (v ? ' ' : '') + XSCOPE_NAME + ' ' + selector;\n if (c !== v) {\n StyleUtil.setElementClassRaw(element, v);\n }\n }\n\n /**\n * @param {HTMLElement} element\n * @param {Object} properties\n * @param {string} selector\n * @param {HTMLStyleElement} style\n * @return {HTMLStyleElement}\n */\n applyElementStyle(element, properties, selector, style) {\n // calculate cssText to apply\n let cssText = style ? style.textContent || '' :\n this.transformStyles(element, properties, selector);\n // if shady and we have a cached style that is not style, decrement\n let styleInfo = StyleInfo.get(element);\n let s = styleInfo.customStyle;\n if (s && !nativeShadow && (s !== style)) {\n s['_useCount']--;\n if (s['_useCount'] <= 0 && s.parentNode) {\n s.parentNode.removeChild(s);\n }\n }\n // apply styling always under native or if we generated style\n // or the cached style is not in document(!)\n if (nativeShadow) {\n // update existing style only under native\n if (styleInfo.customStyle) {\n styleInfo.customStyle.textContent = cssText;\n style = styleInfo.customStyle;\n // otherwise, if we have css to apply, do so\n } else if (cssText) {\n // apply css after the scope style of the element to help with\n // style precedence rules.\n style = StyleUtil.applyCss(cssText, selector, element.shadowRoot,\n styleInfo.placeholder);\n }\n } else {\n // shady and no cache hit\n if (!style) {\n // apply css after the scope style of the element to help with\n // style precedence rules.\n if (cssText) {\n style = StyleUtil.applyCss(cssText, selector, null,\n styleInfo.placeholder);\n }\n // shady and cache hit but not in document\n } else if (!style.parentNode) {\n if (IS_IE && cssText.indexOf('@media') > -1) {\n // @media rules may be stale in IE 10 and 11\n // refresh the text content of the style to revalidate them.\n style.textContent = cssText;\n }\n StyleUtil.applyStyle(style, null, styleInfo.placeholder);\n }\n }\n // ensure this style is our custom style and increment its use count.\n if (style) {\n style['_useCount'] = style['_useCount'] || 0;\n // increment use count if we changed styles\n if (styleInfo.customStyle != style) {\n style['_useCount']++;\n }\n styleInfo.customStyle = style;\n }\n return style;\n }\n\n /**\n * @param {Element} style\n * @param {Object} properties\n */\n applyCustomStyle(style, properties) {\n let rules = StyleUtil.rulesForStyle(/** @type {HTMLStyleElement} */(style));\n let self = this;\n style.textContent = StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n let css = rule['cssText'] = rule['parsedCssText'];\n if (rule.propertyInfo && rule.propertyInfo.cssText) {\n // remove property assignments\n // so next function isn't confused\n // NOTE: we have 3 categories of css:\n // (1) normal properties,\n // (2) custom property assignments (--foo: red;),\n // (3) custom property usage: border: var(--foo); @apply(--foo);\n // In elements, 1 and 3 are separated for efficiency; here they\n // are not and this makes this case unique.\n css = removeCustomPropAssignment(/** @type {string} */(css));\n // replace with reified properties, scenario is same as mixin\n rule['cssText'] = self.valueForProperties(css, properties);\n }\n });\n }\n}\n\n/**\n * @param {number} n\n * @param {Array<number>} bits\n */\nfunction addToBitMask(n, bits) {\n let o = parseInt(n / 32, 10);\n let v = 1 << (n % 32);\n bits[o] = (bits[o] || 0) | v;\n}\n\nexport default new StyleProperties();","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars\n\n/** @const {string} */\nconst infoKey = '__styleInfo';\n\nexport default class StyleInfo {\n /**\n * @param {Element} node\n * @return {StyleInfo}\n */\n static get(node) {\n if (node) {\n return node[infoKey];\n } else {\n return null;\n }\n }\n /**\n * @param {!Element} node\n * @param {StyleInfo} styleInfo\n * @return {StyleInfo}\n */\n static set(node, styleInfo) {\n node[infoKey] = styleInfo;\n return styleInfo;\n }\n /**\n * @param {StyleNode} ast\n * @param {Node=} placeholder\n * @param {Array<string>=} ownStylePropertyNames\n * @param {string=} elementName\n * @param {string=} typeExtension\n * @param {string=} cssBuild\n */\n constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) {\n /** @type {StyleNode} */\n this.styleRules = ast || null;\n /** @type {Node} */\n this.placeholder = placeholder || null;\n /** @type {!Array<string>} */\n this.ownStylePropertyNames = ownStylePropertyNames || [];\n /** @type {Object} */\n this.overrideStyleProperties = null;\n /** @type {string} */\n this.elementName = elementName || '';\n /** @type {string} */\n this.cssBuild = cssBuild || '';\n /** @type {string} */\n this.typeExtension = typeExtension || '';\n /** @type {Object<string, string>} */\n this.styleProperties = null;\n /** @type {?string} */\n this.scopeSelector = null;\n /** @type {HTMLStyleElement} */\n this.customStyle = null;\n }\n _getStyleRules() {\n return this.styleRules;\n }\n}\n\n/* eslint-disable-next-line no-self-assign */\nStyleInfo.prototype['_getStyleRules'] = StyleInfo.prototype._getStyleRules;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {parse, StyleNode} from './css-parse.js';\nimport {nativeShadow, nativeCssVariables, disableRuntime} from './style-settings.js';\nimport StyleTransformer from './style-transformer.js';\nimport * as StyleUtil from './style-util.js';\nimport StyleProperties from './style-properties.js';\nimport {ensureStylePlaceholder, getStylePlaceholder} from './style-placeholder.js';\nimport StyleInfo from './style-info.js';\nimport StyleCache from './style-cache.js';\nimport {flush as watcherFlush, getOwnerScope, getCurrentScope} from './document-watcher.js';\nimport templateMap from './template-map.js';\nimport * as ApplyShimUtils from './apply-shim-utils.js';\nimport {updateNativeProperties, detectMixin} from './common-utils.js';\nimport {CustomStyleInterfaceInterface} from './custom-style-interface.js'; // eslint-disable-line no-unused-vars\n\n/** @type {!Object<string, string>} */\nconst adoptedCssTextMap = {};\n\n/**\n * @const {StyleCache}\n */\nconst styleCache = new StyleCache();\n\nexport default class ScopingShim {\n constructor() {\n this._scopeCounter = {};\n this._documentOwner = /** @type {!HTMLElement} */(document.documentElement);\n let ast = new StyleNode();\n ast['rules'] = [];\n this._documentOwnerStyleInfo = StyleInfo.set(this._documentOwner, new StyleInfo(ast));\n this._elementsHaveApplied = false;\n /** @type {?Object} */\n this._applyShim = null;\n /** @type {?CustomStyleInterfaceInterface} */\n this._customStyleInterface = null;\n }\n flush() {\n watcherFlush();\n }\n _generateScopeSelector(name) {\n let id = this._scopeCounter[name] = (this._scopeCounter[name] || 0) + 1;\n return `${name}-${id}`;\n }\n getStyleAst(style) {\n return StyleUtil.rulesForStyle(style);\n }\n styleAstToString(ast) {\n return StyleUtil.toCssText(ast);\n }\n _gatherStyles(template) {\n return StyleUtil.gatherStyleText(template.content);\n }\n /**\n * Prepare the styling and template for the given element type\n *\n * @param {!HTMLTemplateElement} template\n * @param {string} elementName\n * @param {string=} typeExtension\n */\n prepareTemplate(template, elementName, typeExtension) {\n this.prepareTemplateDom(template, elementName);\n this.prepareTemplateStyles(template, elementName, typeExtension);\n }\n /**\n * Prepare styling for the given element type\n * @param {!HTMLTemplateElement} template\n * @param {string} elementName\n * @param {string=} typeExtension\n */\n prepareTemplateStyles(template, elementName, typeExtension) {\n if (template._prepared || disableRuntime) {\n return;\n }\n // style placeholders are only used when ShadyDOM is active\n if (!nativeShadow) {\n ensureStylePlaceholder(elementName);\n }\n template._prepared = true;\n template.name = elementName;\n template.extends = typeExtension;\n templateMap[elementName] = template;\n let cssBuild = StyleUtil.getCssBuild(template);\n const optimalBuild = StyleUtil.isOptimalCssBuild(cssBuild);\n let info = {\n is: elementName,\n extends: typeExtension,\n };\n let cssText = this._gatherStyles(template) + (adoptedCssTextMap[elementName] || '');\n // check if the styling has mixin definitions or uses\n this._ensure();\n if (!optimalBuild) {\n let hasMixins = !cssBuild && detectMixin(cssText);\n let ast = parse(cssText);\n // only run the applyshim transforms if there is a mixin involved\n if (hasMixins && nativeCssVariables && this._applyShim) {\n this._applyShim['transformRules'](ast, elementName);\n }\n template['_styleAst'] = ast;\n }\n let ownPropertyNames = [];\n if (!nativeCssVariables) {\n ownPropertyNames = StyleProperties.decorateStyles(template['_styleAst']);\n }\n if (!ownPropertyNames.length || nativeCssVariables) {\n let root = nativeShadow ? template.content : null;\n let placeholder = getStylePlaceholder(elementName);\n let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder, cssBuild, optimalBuild ? cssText : '');\n template._style = style;\n }\n template._ownPropertyNames = ownPropertyNames;\n }\n\n /**\n * @param {!Array<string>} cssTextArray\n * @param {string} elementName\n */\n prepareAdoptedCssText(cssTextArray, elementName) {\n adoptedCssTextMap[elementName] = cssTextArray.join(' ');\n }\n /**\n * Prepare template for the given element type\n * @param {!HTMLTemplateElement} template\n * @param {string} elementName\n */\n prepareTemplateDom(template, elementName) {\n if (disableRuntime) {\n return;\n }\n const cssBuild = StyleUtil.getCssBuild(template);\n if (!nativeShadow && cssBuild !== 'shady' && !template._domPrepared) {\n template._domPrepared = true;\n StyleTransformer.domAddScope(template.content, elementName);\n }\n }\n /**\n * @param {!{is: string, extends: (string|undefined)}} info\n * @param {!StyleNode} rules\n * @param {DocumentFragment} shadowroot\n * @param {Node} placeholder\n * @param {string} cssBuild\n * @param {string=} cssText\n * @return {?HTMLStyleElement}\n */\n _generateStaticStyle(info, rules, shadowroot, placeholder, cssBuild, cssText) {\n cssText = StyleTransformer.elementStyles(info, rules, null, cssBuild, cssText);\n if (cssText.length) {\n return StyleUtil.applyCss(cssText, info.is, shadowroot, placeholder);\n }\n return null;\n }\n _prepareHost(host) {\n const {is, typeExtension} = StyleUtil.getIsExtends(host);\n const placeholder = getStylePlaceholder(is);\n const template = templateMap[is];\n if (!template) {\n return;\n }\n const ast = template['_styleAst'];\n const ownStylePropertyNames = template._ownPropertyNames;\n const cssBuild = StyleUtil.getCssBuild(template);\n const styleInfo = new StyleInfo(\n ast,\n placeholder,\n ownStylePropertyNames,\n is,\n typeExtension,\n cssBuild\n );\n StyleInfo.set(host, styleInfo);\n return styleInfo;\n }\n _ensureApplyShim() {\n if (this._applyShim) {\n return;\n } else if (window.ShadyCSS && window.ShadyCSS.ApplyShim) {\n this._applyShim = /** @type {!Object} */ (window.ShadyCSS.ApplyShim);\n this._applyShim['invalidCallback'] = ApplyShimUtils.invalidate;\n }\n }\n _ensureCustomStyleInterface() {\n if (this._customStyleInterface) {\n return;\n } else if (window.ShadyCSS && window.ShadyCSS.CustomStyleInterface) {\n this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */(window.ShadyCSS.CustomStyleInterface);\n /** @type {function(!HTMLStyleElement)} */\n this._customStyleInterface['transformCallback'] = (style) => {this.transformCustomStyleForDocument(style)};\n this._customStyleInterface['validateCallback'] = () => {\n requestAnimationFrame(() => {\n if (this._customStyleInterface['enqueued'] || this._elementsHaveApplied) {\n this.flushCustomStyles();\n }\n })\n };\n }\n }\n _ensure() {\n this._ensureApplyShim();\n this._ensureCustomStyleInterface();\n }\n /**\n * Flush and apply custom styles to document\n */\n flushCustomStyles() {\n if (disableRuntime) {\n return;\n }\n this._ensure();\n if (!this._customStyleInterface) {\n return;\n }\n let customStyles = this._customStyleInterface['processStyles']();\n // early return if custom-styles don't need validation\n if (!this._customStyleInterface['enqueued']) {\n return;\n }\n // bail if custom styles are built optimally\n if (StyleUtil.isOptimalCssBuild(this._documentOwnerStyleInfo.cssBuild)) {\n return;\n }\n if (!nativeCssVariables) {\n this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo);\n this._applyCustomStyles(customStyles);\n if (this._elementsHaveApplied) {\n // if custom elements have upgraded and there are no native css variables, we must recalculate the whole tree\n this.styleDocument();\n }\n } else if (!this._documentOwnerStyleInfo.cssBuild) {\n this._revalidateCustomStyleApplyShim(customStyles);\n }\n this._customStyleInterface['enqueued'] = false;\n }\n /**\n * Apply styles for the given element\n *\n * @param {!HTMLElement} host\n * @param {Object=} overrideProps\n */\n styleElement(host, overrideProps) {\n if (disableRuntime) {\n if (overrideProps) {\n if (!StyleInfo.get(host)) {\n StyleInfo.set(host, new StyleInfo(null));\n }\n const styleInfo = /** @type {!StyleInfo} */(StyleInfo.get(host));\n this._mixOverrideStyleProps(styleInfo, overrideProps);\n this.styleElementNativeVariables(host, styleInfo);\n }\n return;\n }\n const styleInfo = StyleInfo.get(host) || this._prepareHost(host);\n // if there is no style info at this point, bail\n if (!styleInfo) {\n return;\n }\n // Only trip the `elementsHaveApplied` flag if a node other that the root document has `applyStyle` called\n if (!this._isRootOwner(host)) {\n this._elementsHaveApplied = true;\n }\n if (overrideProps) {\n this._mixOverrideStyleProps(styleInfo, overrideProps);\n }\n if (!nativeCssVariables) {\n this.styleElementShimVariables(host, styleInfo);\n } else {\n this.styleElementNativeVariables(host, styleInfo);\n }\n }\n /**\n * @param {!StyleInfo} styleInfo\n * @param {Object} overrideProps\n */\n _mixOverrideStyleProps(styleInfo, overrideProps) {\n styleInfo.overrideStyleProperties =\n styleInfo.overrideStyleProperties || {};\n Object.assign(styleInfo.overrideStyleProperties, overrideProps);\n }\n /**\n * @param {!HTMLElement} host\n * @param {!StyleInfo} styleInfo\n */\n styleElementShimVariables(host, styleInfo) {\n this.flush();\n this._updateProperties(host, styleInfo);\n if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) {\n this._applyStyleProperties(host, styleInfo);\n }\n }\n /**\n * @param {!HTMLElement} host\n * @param {!StyleInfo} styleInfo\n */\n styleElementNativeVariables(host, styleInfo) {\n const { is } = StyleUtil.getIsExtends(host);\n if (styleInfo.overrideStyleProperties) {\n updateNativeProperties(host, styleInfo.overrideStyleProperties);\n }\n const template = templateMap[is];\n // bail early if there is no shadowroot for this element\n if (!template && !this._isRootOwner(host)) {\n return;\n }\n // bail early if the template was built with polymer-css-build\n if (template && StyleUtil.elementHasBuiltCss(template)) {\n return;\n }\n if (template && template._style && !ApplyShimUtils.templateIsValid(template)) {\n // update template\n if (!ApplyShimUtils.templateIsValidating(template)) {\n this._ensure();\n this._applyShim && this._applyShim['transformRules'](template['_styleAst'], is);\n template._style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n ApplyShimUtils.startValidatingTemplate(template);\n }\n // update instance if native shadowdom\n if (nativeShadow) {\n let root = host.shadowRoot;\n if (root) {\n let style = root.querySelector('style');\n if (style) {\n style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n }\n }\n }\n styleInfo.styleRules = template['_styleAst'];\n }\n }\n _styleOwnerForNode(node) {\n let root = StyleUtil.wrap(node).getRootNode();\n let host = root.host;\n if (host) {\n if (StyleInfo.get(host) || this._prepareHost(host)) {\n return host;\n } else {\n return this._styleOwnerForNode(host);\n }\n }\n return this._documentOwner;\n }\n _isRootOwner(node) {\n return (node === this._documentOwner);\n }\n _applyStyleProperties(host, styleInfo) {\n let is = StyleUtil.getIsExtends(host).is;\n let cacheEntry = styleCache.fetch(is, styleInfo.styleProperties, styleInfo.ownStylePropertyNames);\n let cachedScopeSelector = cacheEntry && cacheEntry.scopeSelector;\n let cachedStyle = cacheEntry ? cacheEntry.styleElement : null;\n let oldScopeSelector = styleInfo.scopeSelector;\n // only generate new scope if cached style is not found\n styleInfo.scopeSelector = cachedScopeSelector || this._generateScopeSelector(is);\n let style = StyleProperties.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle);\n if (!nativeShadow) {\n StyleProperties.applyElementScopeSelector(host, styleInfo.scopeSelector, oldScopeSelector);\n }\n if (!cacheEntry) {\n styleCache.store(is, styleInfo.styleProperties, style, styleInfo.scopeSelector);\n }\n return style;\n }\n _updateProperties(host, styleInfo) {\n let owner = this._styleOwnerForNode(host);\n let ownerStyleInfo = StyleInfo.get(owner);\n let ownerProperties = ownerStyleInfo.styleProperties;\n // style owner has not updated properties yet\n // go up the chain and force property update,\n // except if the owner is the document\n if (owner !== this._documentOwner && !ownerProperties) {\n this._updateProperties(owner, ownerStyleInfo);\n ownerProperties = ownerStyleInfo.styleProperties;\n }\n let props = Object.create(ownerProperties || null);\n let hostAndRootProps = StyleProperties.hostAndRootPropertiesForScope(host, styleInfo.styleRules, styleInfo.cssBuild);\n let propertyData = StyleProperties.propertyDataFromStyles(ownerStyleInfo.styleRules, host);\n let propertiesMatchingHost = propertyData.properties\n Object.assign(\n props,\n hostAndRootProps.hostProps,\n propertiesMatchingHost,\n hostAndRootProps.rootProps\n );\n this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties);\n StyleProperties.reify(props);\n styleInfo.styleProperties = props;\n }\n _mixinOverrideStyles(props, overrides) {\n for (let p in overrides) {\n let v = overrides[p];\n // skip override props if they are not truthy or 0\n // in order to fall back to inherited values\n if (v || v === 0) {\n props[p] = v;\n }\n }\n }\n /**\n * Update styles of the whole document\n *\n * @param {Object=} properties\n */\n styleDocument(properties) {\n this.styleSubtree(this._documentOwner, properties);\n }\n /**\n * Update styles of a subtree\n *\n * @param {!HTMLElement} host\n * @param {Object=} properties\n */\n styleSubtree(host, properties) {\n const wrappedHost = StyleUtil.wrap(host);\n let root = wrappedHost.shadowRoot;\n if (root || this._isRootOwner(host)) {\n this.styleElement(host, properties);\n }\n // process the shadowdom children of `host`\n let shadowChildren =\n root && (/** @type {!ParentNode} */ (root).children || root.childNodes);\n if (shadowChildren) {\n for (let i = 0; i < shadowChildren.length; i++) {\n let c = /** @type {!HTMLElement} */(shadowChildren[i]);\n this.styleSubtree(c);\n }\n } else {\n // process the lightdom children of `host`\n let children = wrappedHost.children || wrappedHost.childNodes;\n if (children) {\n for (let i = 0; i < children.length; i++) {\n let c = /** @type {!HTMLElement} */(children[i]);\n this.styleSubtree(c);\n }\n }\n }\n }\n /* Custom Style operations */\n _revalidateCustomStyleApplyShim(customStyles) {\n for (let i = 0; i < customStyles.length; i++) {\n let c = customStyles[i];\n let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n if (s) {\n this._revalidateApplyShim(s);\n }\n }\n }\n _applyCustomStyles(customStyles) {\n for (let i = 0; i < customStyles.length; i++) {\n let c = customStyles[i];\n let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n if (s) {\n StyleProperties.applyCustomStyle(s, this._documentOwnerStyleInfo.styleProperties);\n }\n }\n }\n transformCustomStyleForDocument(style) {\n const cssBuild = StyleUtil.getCssBuild(style);\n if (cssBuild !== this._documentOwnerStyleInfo.cssBuild) {\n this._documentOwnerStyleInfo.cssBuild = cssBuild;\n }\n if (StyleUtil.isOptimalCssBuild(cssBuild)) {\n return;\n }\n let ast = StyleUtil.rulesForStyle(style);\n StyleUtil.forEachRule(ast, (rule) => {\n if (nativeShadow) {\n StyleTransformer.normalizeRootSelector(rule);\n } else {\n StyleTransformer.documentRule(rule);\n }\n if (nativeCssVariables && cssBuild === '') {\n this._ensure();\n this._applyShim && this._applyShim['transformRule'](rule);\n }\n });\n if (nativeCssVariables) {\n style.textContent = StyleUtil.toCssText(ast);\n } else {\n this._documentOwnerStyleInfo.styleRules['rules'].push(ast);\n }\n }\n _revalidateApplyShim(style) {\n if (nativeCssVariables && this._applyShim) {\n let ast = StyleUtil.rulesForStyle(style);\n this._ensure();\n this._applyShim['transformRules'](ast);\n style.textContent = StyleUtil.toCssText(ast);\n }\n }\n getComputedStyleValue(element, property) {\n let value;\n if (!nativeCssVariables) {\n // element is either a style host, or an ancestor of a style host\n let styleInfo = StyleInfo.get(element) || StyleInfo.get(this._styleOwnerForNode(element));\n value = styleInfo.styleProperties[property];\n }\n // fall back to the property value from the computed styling\n value = value || window.getComputedStyle(element).getPropertyValue(property);\n // trim whitespace that can come after the `:` in css\n // example: padding: 2px -> \" 2px\"\n return value ? value.trim() : '';\n }\n // given an element and a classString, replaces\n // the element's class with the provided classString and adds\n // any necessary ShadyCSS static and property based scoping selectors\n setElementClass(element, classString) {\n let root = StyleUtil.wrap(element).getRootNode();\n let classes = classString ? classString.split(/\\s/) : [];\n let scopeName = root.host && root.host.localName;\n // If no scope, try to discover scope name from existing class.\n // This can occur if, for example, a template stamped element that\n // has been scoped is manipulated when not in a root.\n if (!scopeName) {\n var classAttr = element.getAttribute('class');\n if (classAttr) {\n let k$ = classAttr.split(/\\s/);\n for (let i=0; i < k$.length; i++) {\n if (k$[i] === StyleTransformer.SCOPE_NAME) {\n scopeName = k$[i+1];\n break;\n }\n }\n }\n }\n if (scopeName) {\n classes.push(StyleTransformer.SCOPE_NAME, scopeName);\n }\n if (!nativeCssVariables) {\n let styleInfo = StyleInfo.get(element);\n if (styleInfo && styleInfo.scopeSelector) {\n classes.push(StyleProperties.XSCOPE_NAME, styleInfo.scopeSelector);\n }\n }\n StyleUtil.setElementClassRaw(element, classes.join(' '));\n }\n _styleInfoForNode(node) {\n return StyleInfo.get(node);\n }\n /**\n * @param {!Element} node\n * @param {string} scope\n */\n scopeNode(node, scope) {\n StyleTransformer.element(node, scope);\n }\n /**\n * @param {!Element} node\n * @param {string} scope\n */\n unscopeNode(node, scope) {\n StyleTransformer.element(node, scope, true);\n }\n /**\n * @param {!Node} node\n * @return {string}\n */\n scopeForNode(node) {\n return getOwnerScope(node);\n }\n /**\n * @param {!Element} node\n * @return {string}\n */\n currentScopeForNode(node) {\n return getCurrentScope(node);\n }\n}\n\n/* exports */\n/* eslint-disable no-self-assign */\nScopingShim.prototype['flush'] = ScopingShim.prototype.flush;\nScopingShim.prototype['prepareTemplate'] = ScopingShim.prototype.prepareTemplate;\nScopingShim.prototype['styleElement'] = ScopingShim.prototype.styleElement;\nScopingShim.prototype['styleDocument'] = ScopingShim.prototype.styleDocument;\nScopingShim.prototype['styleSubtree'] = ScopingShim.prototype.styleSubtree;\nScopingShim.prototype['getComputedStyleValue'] = ScopingShim.prototype.getComputedStyleValue;\nScopingShim.prototype['setElementClass'] = ScopingShim.prototype.setElementClass;\nScopingShim.prototype['_styleInfoForNode'] = ScopingShim.prototype._styleInfoForNode;\nScopingShim.prototype['transformCustomStyleForDocument'] = ScopingShim.prototype.transformCustomStyleForDocument;\nScopingShim.prototype['getStyleAst'] = ScopingShim.prototype.getStyleAst;\nScopingShim.prototype['styleAstToString'] = ScopingShim.prototype.styleAstToString;\nScopingShim.prototype['flushCustomStyles'] = ScopingShim.prototype.flushCustomStyles;\nScopingShim.prototype['scopeNode'] = ScopingShim.prototype.scopeNode;\nScopingShim.prototype['unscopeNode'] = ScopingShim.prototype.unscopeNode;\nScopingShim.prototype['scopeForNode'] = ScopingShim.prototype.scopeForNode;\nScopingShim.prototype['currentScopeForNode'] = ScopingShim.prototype.currentScopeForNode;\nScopingShim.prototype['prepareAdoptedCssText'] = ScopingShim.prototype.prepareAdoptedCssText;\n/* eslint-enable no-self-assign */\nObject.defineProperties(ScopingShim.prototype, {\n 'nativeShadow': {\n get() {\n return nativeShadow;\n }\n },\n 'nativeCss': {\n get() {\n return nativeCssVariables;\n }\n }\n});\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {applyStylePlaceHolder} from './style-util.js';\nimport {nativeShadow, disableRuntime} from './style-settings.js';\n\n/** @type {!Object<string, !Node>} */\nconst placeholderMap = {};\n\n/**\n * @param {string} elementName\n * @return {Node}\n */\nexport function getStylePlaceholder(elementName) {\n return placeholderMap[elementName] || null;\n}\n\n/**\n * @param {string} elementName\n */\nexport function ensureStylePlaceholder(elementName) {\n if (!placeholderMap[elementName]) {\n placeholderMap[elementName] = applyStylePlaceHolder(elementName);\n }\n}\n\n/**\n * @const {CustomElementRegistry}\n */\nconst ce = window['customElements'];\nif (ce && !nativeShadow && !disableRuntime) {\n /**\n * @const {function(this:CustomElementRegistry, string,function(new:HTMLElement),{extends: string}=)}\n */\n const origDefine = ce['define'];\n /**\n * @param {string} name\n * @param {function(new:HTMLElement)} clazz\n * @param {{extends: string}=} options\n */\n const wrappedDefine = (name, clazz, options) => {\n ensureStylePlaceholder(name);\n origDefine.call(/** @type {!CustomElementRegistry} */(ce), name, clazz, options);\n };\n ce['define'] = wrappedDefine;\n}","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n'use strict';\n\nexport default class StyleCache {\n constructor(typeMax = 100) {\n // map element name -> [{properties, styleElement, scopeSelector}]\n this.cache = {};\n /** @type {number} */\n this.typeMax = typeMax;\n }\n\n _validate(cacheEntry, properties, ownPropertyNames) {\n for (let idx = 0; idx < ownPropertyNames.length; idx++) {\n let pn = ownPropertyNames[idx];\n if (cacheEntry.properties[pn] !== properties[pn]) {\n return false;\n }\n }\n return true;\n }\n\n store(tagname, properties, styleElement, scopeSelector) {\n let list = this.cache[tagname] || [];\n list.push({properties, styleElement, scopeSelector});\n if (list.length > this.typeMax) {\n list.shift();\n }\n this.cache[tagname] = list;\n }\n\n fetch(tagname, properties, ownPropertyNames) {\n let list = this.cache[tagname];\n if (!list) {\n return;\n }\n // reverse list for most-recent lookups\n for (let idx = list.length - 1; idx >= 0; idx--) {\n let entry = list[idx];\n if (this._validate(entry, properties, ownPropertyNames)) {\n return entry;\n }\n }\n }\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\n/**\n * @const {!Object<string, !HTMLTemplateElement>}\n */\nconst templateMap = {};\nexport default templateMap;\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\nimport templateMap from './template-map.js';\nimport {StyleNode} from './css-parse.js'; // eslint-disable-line no-unused-vars\n\n/*\n * Utilities for handling invalidating apply-shim mixins for a given template.\n *\n * The invalidation strategy involves keeping track of the \"current\" version of a template's mixins, and updating that count when a mixin is invalidated.\n * The template\n */\n\n/** @const {string} */\nconst CURRENT_VERSION = '_applyShimCurrentVersion';\n\n/** @const {string} */\nconst NEXT_VERSION = '_applyShimNextVersion';\n\n/** @const {string} */\nconst VALIDATING_VERSION = '_applyShimValidatingVersion';\n\n/**\n * @const {Promise<void>}\n */\nconst promise = Promise.resolve();\n\n/**\n * @param {string} elementName\n */\nexport function invalidate(elementName){\n let template = templateMap[elementName];\n if (template) {\n invalidateTemplate(template);\n }\n}\n\n/**\n * This function can be called multiple times to mark a template invalid\n * and signal that the style inside must be regenerated.\n *\n * Use `startValidatingTemplate` to begin an asynchronous validation cycle.\n * During that cycle, call `templateIsValidating` to see if the template must\n * be revalidated\n * @param {HTMLTemplateElement} template\n */\nexport function invalidateTemplate(template) {\n // default the current version to 0\n template[CURRENT_VERSION] = template[CURRENT_VERSION] || 0;\n // ensure the \"validating for\" flag exists\n template[VALIDATING_VERSION] = template[VALIDATING_VERSION] || 0;\n // increment the next version\n template[NEXT_VERSION] = (template[NEXT_VERSION] || 0) + 1;\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValid(elementName) {\n let template = templateMap[elementName];\n if (template) {\n return templateIsValid(template);\n }\n return true;\n}\n\n/**\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValid(template) {\n return template[CURRENT_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * @param {string} elementName\n * @return {boolean}\n */\nexport function isValidating(elementName) {\n let template = templateMap[elementName];\n if (template) {\n return templateIsValidating(template);\n }\n return false;\n}\n\n/**\n * Returns true if the template is currently invalid and `startValidating` has been called since the last invalidation.\n * If false, the template must be validated.\n * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValidating(template) {\n return !templateIsValid(template) && template[VALIDATING_VERSION] === template[NEXT_VERSION];\n}\n\n/**\n * the template is marked as `validating` for one microtask so that all instances\n * found in the tree crawl of `applyStyle` will update themselves,\n * but the template will only be updated once.\n * @param {string} elementName\n*/\nexport function startValidating(elementName) {\n let template = templateMap[elementName];\n startValidatingTemplate(template);\n}\n\n/**\n * Begin an asynchronous invalidation cycle.\n * This should be called after every validation of a template\n *\n * After one microtask, the template will be marked as valid until the next call to `invalidateTemplate`\n * @param {HTMLTemplateElement} template\n */\nexport function startValidatingTemplate(template) {\n // remember that the current \"next version\" is the reason for this validation cycle\n template[VALIDATING_VERSION] = template[NEXT_VERSION];\n // however, there only needs to be one async task to clear the counters\n if (!template._validating) {\n template._validating = true;\n promise.then(function() {\n // sync the current version to let future invalidations cause a refresh cycle\n template[CURRENT_VERSION] = template[NEXT_VERSION];\n template._validating = false;\n });\n }\n}\n\n/**\n * @return {boolean}\n */\nexport function elementsAreInvalid() {\n for (let elementName in templateMap) {\n let template = templateMap[elementName];\n if (!templateIsValid(template)) {\n return true;\n }\n }\n return false;\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport { MIXIN_MATCH, VAR_ASSIGN } from './common-regex.js';\n\n/**\n * @param {Element} element\n * @param {Object=} properties\n */\nexport function updateNativeProperties(element, properties) {\n // remove previous properties\n for (let p in properties) {\n // NOTE: for bc with shim, don't apply null values.\n if (p === null) {\n element.style.removeProperty(p);\n } else {\n element.style.setProperty(p, properties[p]);\n }\n }\n}\n\n/**\n * @param {Element} element\n * @param {string} property\n * @return {string}\n */\nexport function getComputedStyleValue(element, property) {\n /**\n * @const {string}\n */\n const value = window.getComputedStyle(element).getPropertyValue(property);\n if (!value) {\n return '';\n } else {\n return value.trim();\n }\n}\n\n/**\n * return true if `cssText` contains a mixin definition or consumption\n * @param {string} cssText\n * @return {boolean}\n */\nexport function detectMixin(cssText) {\n const has = MIXIN_MATCH.test(cssText) || VAR_ASSIGN.test(cssText);\n // reset state of the regexes\n MIXIN_MATCH.lastIndex = 0;\n VAR_ASSIGN.lastIndex = 0;\n return has;\n}\n","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport ScopingShim from '../src/scoping-shim.js';\nimport {nativeCssVariables, nativeShadow, cssBuild, disableRuntime} from '../src/style-settings.js';\n\n/** @const {ScopingShim} */\nconst scopingShim = new ScopingShim();\n\nlet ApplyShim, CustomStyleInterface;\n\nif (window['ShadyCSS']) {\n ApplyShim = window['ShadyCSS']['ApplyShim'];\n CustomStyleInterface = window['ShadyCSS']['CustomStyleInterface'];\n}\n\nwindow.ShadyCSS = {\n ScopingShim: scopingShim,\n /**\n * @param {!HTMLTemplateElement} template\n * @param {string} elementName\n * @param {string=} elementExtends\n */\n prepareTemplate(template, elementName, elementExtends) {\n scopingShim.flushCustomStyles();\n scopingShim.prepareTemplate(template, elementName, elementExtends)\n },\n\n /**\n * @param {!HTMLTemplateElement} template\n * @param {string} elementName\n */\n prepareTemplateDom(template, elementName) {\n scopingShim.prepareTemplateDom(template, elementName);\n },\n\n /**\n * @param {!HTMLTemplateElement} template\n * @param {string} elementName\n * @param {string=} elementExtends\n */\n prepareTemplateStyles(template, elementName, elementExtends) {\n scopingShim.flushCustomStyles();\n scopingShim.prepareTemplateStyles(template, elementName, elementExtends)\n },\n /**\n * @param {!HTMLElement} element\n * @param {Object=} properties\n */\n styleSubtree(element, properties) {\n scopingShim.flushCustomStyles();\n scopingShim.styleSubtree(element, properties);\n },\n\n /**\n * @param {!HTMLElement} element\n */\n styleElement(element) {\n scopingShim.flushCustomStyles();\n scopingShim.styleElement(element);\n },\n\n /**\n * @param {Object=} properties\n */\n styleDocument(properties) {\n scopingShim.flushCustomStyles();\n scopingShim.styleDocument(properties);\n },\n\n flushCustomStyles() {\n scopingShim.flushCustomStyles();\n },\n\n /**\n * @param {Element} element\n * @param {string} property\n * @return {string}\n */\n getComputedStyleValue(element, property) {\n return scopingShim.getComputedStyleValue(element, property);\n },\n\n nativeCss: nativeCssVariables,\n\n nativeShadow: nativeShadow,\n\n cssBuild: cssBuild,\n\n disableRuntime: disableRuntime,\n};\n\nif (ApplyShim) {\n window.ShadyCSS.ApplyShim = ApplyShim;\n}\n\nif (CustomStyleInterface) {\n window.ShadyCSS.CustomStyleInterface = CustomStyleInterface;\n}","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nexport {};\n\nlet customElements = window['customElements'];\nlet HTMLImports = window['HTMLImports'];\nlet Template = window['HTMLTemplateElement'];\n\n// global for (1) existence means `WebComponentsReady` will file,\n// (2) WebComponents.ready == true means event has fired.\nwindow.WebComponents = window.WebComponents || {};\n\nif (customElements && customElements['polyfillWrapFlushCallback']) {\n // Here we ensure that the public `HTMLImports.whenReady`\n // always comes *after* custom elements have upgraded.\n let flushCallback;\n let runAndClearCallback = function runAndClearCallback() {\n if (flushCallback) {\n // make sure to run the HTMLTemplateElement polyfill before custom elements upgrade\n if (Template.bootstrap) {\n Template.bootstrap(window.document);\n }\n let cb = flushCallback;\n flushCallback = null;\n cb();\n return true;\n }\n }\n let origWhenReady = HTMLImports['whenReady'];\n customElements['polyfillWrapFlushCallback'](function(cb) {\n flushCallback = cb;\n origWhenReady(runAndClearCallback);\n });\n\n HTMLImports['whenReady'] = function(cb) {\n origWhenReady(function() {\n // custom element code may add dynamic imports\n // to match processing of native custom elements before\n // domContentLoaded, we wait for these imports to resolve first.\n if (runAndClearCallback()) {\n HTMLImports['whenReady'](cb);\n } else {\n cb();\n }\n });\n }\n\n}\n\nHTMLImports['whenReady'](function() {\n requestAnimationFrame(function() {\n window.WebComponents.ready = true;\n document.dispatchEvent(new CustomEvent('WebComponentsReady', {bubbles: true}));\n });\n});\n","/**\n * @license\n * Copyright (c) 2014 The Polymer Project Authors. All rights reserved.\n * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nexport {};\n\n// It's desireable to provide a default stylesheet\n// that's convenient for styling unresolved elements, but\n// it's cumbersome to have to include this manually in every page.\n// It would make sense to put inside some HTMLImport but\n// the HTMLImports polyfill does not allow loading of stylesheets\n// that block rendering. Therefore this injection is tolerated here.\n//\n// NOTE: position: relative fixes IE's failure to inherit opacity\n// when a child is not statically positioned.\nlet style = document.createElement('style');\nstyle.textContent = ''\n + 'body {'\n + 'transition: opacity ease-in 0.2s;'\n + ' } \\n'\n + 'body[unresolved] {'\n + 'opacity: 0; display: block; overflow: hidden; position: relative;'\n + ' } \\n'\n ;\nlet head = document.querySelector('head');\nhead.insertBefore(style, head.firstChild);\n","import '@babel/polyfill';\nimport '@webcomponents/webcomponentsjs';\n\n"]} |