Icard/angular-clarity-master(work.../node_modules/@webcomponents/webcomponentsjs/bundles/webcomponents-sd-ce.js.map

1 line
620 KiB
Plaintext

{"version":3,"sources":["../../shadydom/src/shady-data.js"," [synthetic:es6/util/arrayiterator] "," [synthetic:es6/util/makeiterator] "," [synthetic:es6/util/arrayfromiterable] "," [synthetic:es6/util/arrayfromiterator] "," [synthetic:util/global] ","../../shadydom/src/utils.js","../../shadydom/src/patch-native.js","../../shadydom/src/flush.js","../../shadydom/src/observe-changes.js","../../shadydom/src/innerHTML.js","../../shadydom/src/patch-instances.js","../../shadydom/src/patch-events.js","../../shadydom/src/array-splice.js","../../shadydom/src/patches/EventTarget.js","../../shadydom/src/style-scoping.js","../../shadydom/src/patches/Node.js","../../shadydom/src/attach-shadow.js","../../shadydom/src/patches/Slotable.js","../../shadydom/src/selector-parser.js","../../shadydom/src/patches/ParentNode.js","../../shadydom/src/patches/ChildNode.js","../../shadydom/src/patches/Element.js","../../shadydom/src/patches/ElementOrShadowRoot.js","../../shadydom/src/patches/HTMLElement.js","../../shadydom/src/patches/Slot.js","../../shadydom/src/patches/DocumentOrFragment.js","../../shadydom/src/patches/DocumentOrShadowRoot.js","../../shadydom/src/patches/Document.js","../../shadydom/src/patches/Window.js","../../shadydom/src/patch-prototypes.js","../../shadydom/src/link-nodes.js","../../shadydom/src/patches/ShadowRoot.js","../../shadydom/src/patch-shadyRoot.js","../../shadydom/src/wrapper.js","../../shadydom/src/shadydom.js","../../custom-elements/ts_src/Patch/Native.ts","../../custom-elements/ts_src/Utilities.ts","../../custom-elements/ts_src/CustomElementInternals.ts","../../custom-elements/ts_src/custom-elements.ts","../../custom-elements/ts_src/CustomElementState.ts","../../custom-elements/ts_src/Deferred.ts","../../custom-elements/ts_src/DocumentConstructionObserver.ts","../../custom-elements/ts_src/CustomElementRegistry.ts","../../custom-elements/ts_src/Patch/Interface/ParentNode.ts","../../custom-elements/ts_src/Patch/Document.ts","../../custom-elements/ts_src/Patch/Interface/ChildNode.ts","../../custom-elements/ts_src/Patch/Element.ts","../../custom-elements/ts_src/AlreadyConstructedMarker.ts","../../custom-elements/ts_src/Patch/HTMLElement.ts","../../custom-elements/ts_src/Patch/Node.ts","../../custom-elements/ts_src/Patch/DocumentFragment.ts","../../shadycss/src/css-parse.js","../../shadycss/src/style-settings.js","../../shadycss/src/common-regex.js","../../shadycss/src/unscoped-style-handler.js","../../shadycss/src/style-util.js","../../shadycss/src/style-transformer.js","../../shadycss/src/scoping-shim.js","../../shadycss/src/document-watcher.js","../../shadycss/src/style-properties.js","../../shadycss/src/style-info.js","../../shadycss/src/style-placeholder.js","../../shadycss/src/style-cache.js","../../shadycss/src/template-map.js","../../shadycss/src/apply-shim-utils.js","../../shadycss/src/common-utils.js","../../shadycss/entrypoints/scoping-shim.js"],"names":["$jscomp.arrayIteratorImpl","$jscomp.global","$jscomp.getGlobal","ShadyData","toJSON","ensureShadyDataForNode","node","__shady","shadyDataForNode","settings","window","hasNativeShadowDOM","attachShadow","Element","prototype","getRootNode","Node","desc","Object","getOwnPropertyDescriptor","hasDescriptors","configurable","get","inUse","noPatch","preferPerformance","patchOnDemand","userValue","acceptedValues","indexOf","querySelectorImplementation","IS_IE","navigator","userAgent","match","getPropertyName","Document","prefixed","name","isTrackingLogicalChildNodes","nodeData","undefined","firstChild","isShadyRoot","obj","ShadowRoot","hasShadowRootWithSlot","root","_hasInsertionPoint","p","matches","matchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","twiddle","document","createTextNode","content","queue","MutationObserver","length","shift","e","textContent","observe","characterData","microtask","callback","push","documentContains","contains","doc","documentElement","container","createPolyfilledHTMLCollection","nodes","l","getAttribute","isNaN","item","nodes.item","index","namedItem","nodes.namedItem","$jscomp.makeIterator","nativeChildNodesArray","parent","result","n","childNodesArray","patchProperty","proto","descriptor","value","defineProperty","patchProperties","descriptors","prefix","disallowedPatches","patchExistingProperties","getOwnPropertyDescriptors","getOwnPropertyNames","forEach","assign","target","source","names","i","convertIntoANode","arg","convertNodesIntoANode","args","fragment","createDocumentFragment","appendChild","flat","array","depth","reduce","acc","Array","isArray","$jscomp.arrayFromIterable","deduplicate","results","set","Set","has","add","flushList","scheduled","enqueue","flush","didFlush","constructor","AsyncObserver","_scheduled","addedNodes","removedNodes","callbacks","schedule","mutations","takeRecords","cb","observeChildren","sd","observer","_callback","_observer","_node","unobserveChildren","handle","delete","size","filterMutations","targetRootNode","map","mutation","mutationInScope","slice","call","filter","create","m","escapeAttrRegExp","escapeDataRegExp","escapeReplace","c","makeSet","arr","voidElements","plaintextParents","getInnerHTML","localName","s","c$","childNodes","child","nodeType","ELEMENT_NODE","tagName","attrs","attributes","attr","replace","TEXT_NODE","data","parentNode","COMMENT_NODE","console","error","Error","nativeMethods","querySelector","selector","querySelectorAll","nativeTree","installNativeAccessor","NATIVE_PREFIX","defineNativeAccessors","prop","copyProperties","list","nodeWalker","createTreeWalker","NodeFilter","SHOW_ALL","elementWalker","SHOW_ELEMENT","inertDoc","implementation","createHTMLDocument","clearNode","ParentNodeAccessors","ParentNodeMethods","addNativePrefixedProperties","eventProps","EventTarget","Window","XMLHttpRequest","currentNode","lastChild","previousSibling","nextSibling","parentElement","DOCUMENT_FRAGMENT_NODE","textWalker","SHOW_TEXT","nextNode","nodeValue","HTMLElement","ParentNodeWalkerDescriptors","firstElementChild","lastElementChild","children","childElementCount","previousElementSibling","nextElementSibling","innerHTML","containerName","htmlContainer","namespaceURI","createElementNS","createElement","newContent","className","setAttribute","HTMLTemplateElement","DocumentFragment","InsideDescriptors","shadowRoot","TextContentInnerHTMLDescriptors","OutsideDescriptors","makeNonEnumerable","enumerable","noInstancePatching","patchOutsideElementAccessors","element","__outsideAccessors","patchInsideElementAccessors","__insideAccessors","customElements","eventWrappersName","Date","now","composedGetter","composedProp","Event","ev","supportsEventOptions","listener","supported","eventOptions","capture","addEventListener","removeEventListener","parseEventOptions","optionsOrCapture","once","shadyTarget","__shadyTarget","nativeEventOptions","alwaysComposed","unpatchedEvents","getRootNodeWithFallback","eventTarget","pathComposer","startNode","composed","composedPath","current","startRoot","host","event","__composedPath","retarget","refNode","path","refNodePath","ancestor","lastRoot","rootIdx","EventPatches","__composed","type","isTrusted","currentTarget","relatedTarget","__relatedTarget","__relatedTargetComposedPath","stopPropagation","__propagationStopped","stopImmediatePropagation","__immediatePropagationStopped","eventPhaseDescriptor","AT_TARGET","mixinComposedFlag","Base","klazz","options","__proto__","nonBubblingEventsToRetarget","hasRetargeted","fireHandlers","phase","hs","__handlers","fn","shadyDispatchEventNeedsProxyEvent","hasOwnProperty","shadyDispatchEvent","originalEvent","retargetedPath","bubbles","prevCurrentTargetDesc","eventPhase","CAPTURING_PHASE","prevEventPhaseDesc","atTarget","BUBBLING_PHASE","findListener","wrappers","savedType","savedListener","savedCapture","savedNode","dispatchEvent","patchEvent","fnOrObj","handlerType","handleEvent","wrapperFn","lastCurrentTargetDesc","lastEventPhaseDesc","ret","idx","splice","activateFocusEventOverrides","EventPatchesDescriptors","getPrototypeOf","SHADY_PROTO","patchedProto","SHADY_SOURCE_PROTO","PatchedEvent","PatchedCustomEvent","CustomEvent","PatchedMouseEvent","MouseEvent","patchClick","composedClickFn","cancelable","click","eventPropertyNamesForElement","substring","eventPropertyNamesForHTMLElement","wrappedDescriptorForEventProperty","property","shadyData","eventName","__onCallbackListeners","newSplice","addedCount","removed","calcSplices","currentEnd","old","oldEnd","currentStart","oldStart","prefixCount","suffixCount","minLength","Math","min","currentValue","previousValue","index1","index2","count","equals","rowCount","columnCount","distances","j","north","west","edits","EDIT_ADD","EDIT_DELETE","northWest","EDIT_LEAVE","EDIT_UPDATE","reverse","splices","oldIndex","EventTargetPatches","scopingShim","getScopingShim","scopeClassAttribute","removeShadyScoping","currentScopeName","currentScopeIsCorrect","newScopeName","correctScope","currentScope","currentScopeForNode","treeVisitor","visitorFn","nativeIsConnectedAccessors","nativeIsConnected","removeOwnerShadyRoot","ownerShadyRoot","firstComposedNode","flattened","flattenedNodes","scheduleObserver","addedNode","removedNode","NodePatches","childNodes.item","isConnected","ownerDocument","tc","join","insertBefore","ref_node","refData","slotsAdded","ownerRoot","ownerShadyRootForNode","oldScopeName","skipUnscoping","allowNativeInsert","needsScoping","needsSlotFinding","_ensureSlotData","_pendingSlots","_asyncRender","recordInsertBefore","parentData","adoptNode","removeChild","removingInsertionPoint","_removeContainedSlots","recordRemoveChild","preventNativeRemove","changeSlotContent","replaceChild","cloneNode","deep","ATTRIBUTE_NODE","nc","SlotablePatches","assignedSlot","_render","PARENS","Map","end","matchNestedParens","k","v","findNext","str","start","queryChars","parenInfo","parseSelectorList","endComplexSelector","chunks","pop","compoundSelectors","x","combinators","prevChunk","nextIndex","nextChunk","query","matcher","halter","queryChildNodes","ParentNodePatches","append","prepend","logicalQuerySelectorAll","contextNode","selectorList","matchesCompoundSelector","compoundSelector","complexSelectors","cursors","complexSelectorParts","matchedElement","some","cursor","lastIndex","combinator","sibling","QueryPatches","candidates","candidate","useNative","ParentNodeDocumentOrFragmentPatches","ChildNodePatches","after","before","remove","replaceWith","distributeAttributeChange","_slotList","_validateSlots","oldName","__slotName","_nameForSlot","slots","_slotMap","_sortSlots","ElementPatches","slot","removeAttribute","toggleAttribute","force","ElementShadowPatches","_init","recordChildNodes","ShadyRoot","ShadyRootConstructionToken","publicRoot","ElementOrShadowRootPatches","HTMLElementPatches","blur","shadowActive","activeElement","SlotPatches","assignedNodes","flatten","DocumentOrFragmentPatches","getElementById","id","getElInRoot","roots","el","elRoot","getAncestorRoots","docOrRoot","elementsFromPointProperty","DocumentOrShadowRootPatches","active","activeRoot","elementsFromPoint","y","nativeResult","USE_NATIVE_DOCUMENT_EFP","nativeArray","ancestorRoots","rootedResult","r","elementFromPoint","DocumentPatches","importNode","WindowPatches","bind","NonStandardHTMLElement","patchMap","Text","Comment","CDATASection","ProcessingInstruction","HTMLSlotElement","CharacterData","disallowedNativePatches","applyPatchList","disallowed","patch","applyPatches","ctor","PROTO_IS_PATCHED","PATCHED_PROTO","patchElementProto","patchNode","nativeProto","setPrototypeOf","OutsideAccessors","InsideAcccessors","linkNode","containerData","ref_nodeData","psd","nsd","first","adoptedParent","previous","ShadowRootPatches","patchShadyAccessors","isRendering","readyState","rootRendered","ancestorList","ancestors","unshift","token","TypeError","mode","hostData","MODE_CLOSED","rootData","_renderPending","renderRoot","__childSlotCount","_renderSelf","wasRendering","_distribute","slotData","n$","_previouslyAssignedNodes","_prevAssignedSlot","_distributeNodeToSlot","slotParentRoot","slotParentData","_addAssignedToFlattenedNodes","prevAssignedNodes","dirty","_fireSlotChange","_compose","composeList","targetNode","distributedNode","d","next","_hasRendered","forcedSlot","oldSlot","CATCHALL_NAME","assigned","nestedAssigned","slotNamesToSort","slotParent","_mapSlots","sort","a","b","listA","listB","nA","nB","didRemove","patchShadyRoot","SHADY_PREFIX","defineProperties","nodeName","define","connectMap","clear","ManageConnect","base","connected","disconnected","counter","connectFlag","connectedCallback","disconnectedCallback","originalDefine","Wrapper","?.prototype","focus","DOCUMENT_NODE","$jscomp.global.Object.defineProperties","_activeElement","addEventPropertyWrapper","wrapperMap","WeakMap","wrap","wrapper","ShadyDOM","flushInitial","Document_createElement","Document_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_toggleAttribute","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","reservedElementNameSet","isValidCustomElementName","reserved","validForm","test","nativeContains","nativeValue","__CE_isImportDocument","childrenFromFragment","nativeChildren","nextSiblingOrAncestorSibling","walkDeepDescendantElements","visitedImports","import","__CE_shadowRoot","CustomElementInternals","noDocumentConstructionObserver","priorCustomElements","shadyDomFastWalk","_patchesNode","_patchesElement","_hasPatches","useDocumentConstructionObserver","forEachElement","elements","addNodePatch","addElementPatch","patchTree","patchElement","__CE_patched","connectTree","custom","__CE_state","upgradeReaction","disconnectTree","patchAndUpgradeTree","upgrade","gatherElements","__CE_registry","__CE_documentLoadHandled","clonedVisitedImports","registry","defaultView","internal_localNameToDefinition","definition","constructionStack","constructorFunction","failed","__CE_definition","attributeChangedCallback","hasAttributes","observedAttributes","_upgradeAnElement","reportTheException","oldValue","newValue","namespace","createAnElement","NS_HTML","HTMLUnknownElement","message","filename","lineno","colno","sourceURL","fileName","line","lineNumber","column","columnNumber","String","ErrorEvent","initErrorEvent","createEvent","preventDefault","event.preventDefault","defaultPrevented","Deferred","_value","_promise","Promise","resolve","_resolve","DocumentConstructionObserver","internals","_internals","_document","_handleMutations","childList","subtree","disconnect","CustomElementRegistry","_localNameToConstructorGetter","_localNameToDefinition","_constructorToDefinition","_elementDefinitionIsRunning","_whenDefinedDeferred","_flushCallback","this._flushCallback","_flushPending","_unflushedLocalNames","_documentConstructionObserver","polyfillDefineLazy","constructorGetter","Function","internal_assertCanDefineLocalName","_flush","internal_reifyDefinition","SyntaxError","getCallback","callbackValue","adoptedCallback","elementsWithStableDefinitions","unflushedLocalNames","elementsWithPendingDefinitions","pendingElements","pendingUpgradableElements","deferred","whenDefined","reject","prior","anyDefinitionExists","definitionHasFlushed","polyfillWrapFlushCallback","outer","inner","existingDefinition","destination","builtIn","appendPrependPatch","builtInMethod","connectedElements","apply","Document.prototype.createElement","Document.prototype.importNode","clone","Document.prototype.createElementNS","PatchParentNode","beforeAfterPatch","destination.replaceWith","wasConnected","destination.remove","patch_innerHTML","baseDescriptor","htmlString","removedElements","patch_insertAdjacentElement","baseMethod","insertAdjacentElement","destination.insertAdjacentElement","position","insertedElement","patch_insertAdjacentHTML","upgradeNodesInRange","insertAdjacentHTML","destination.insertAdjacentHTML","text","strPosition","toLowerCase","marker","Element.prototype.attachShadow","init","assignedValue","isTemplate","rawElement","Element.prototype.setAttribute","Element.prototype.setAttributeNS","Element.prototype.removeAttribute","Element.prototype.toggleAttribute","hadAttribute","hasAttribute","Element.prototype.removeAttributeNS","PatchChildNode","alreadyConstructedMarker","PatchedHTMLElement","writable","patch_textContent","childNodesLength","Node.prototype.insertBefore","insertedNodes","nodeWasConnectedElement","Node.prototype.appendChild","Node.prototype.cloneNode","Node.prototype.removeChild","Node.prototype.replaceChild","nodeToInsert","nodeToRemove","nodeToInsertWasConnectedElement","thisIsConnected","parts","installPolyfill","PatchHTMLElement","PatchDocument","PatchNode","PatchElement","StyleNode","parse","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.comments","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.port","OPEN_BRACE","CLOSE_BRACE","parseCss","t","trim","ss","_expandUnicodeEscapes","RX$$module$node_modules$$webcomponents$shadycss$src$css_parse.multipleSpaces","lastIndexOf","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","split","VAR_START","types$$module$node_modules$$webcomponents$shadycss$src$css_parse.MIXIN_RULE","types$$module$node_modules$$webcomponents$shadycss$src$css_parse.STYLE_RULE","r$","code","repeat","stringify","preserveProperties","cssText","rules","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","STYLE_RULE","KEYFRAMES_RULE","MEDIA_RULE","MIXIN_RULE","comments","port","customProp","mixinProp","mixinApply","varApply","keyframesRule","multipleSpaces","nativeShadow","nativeCssVariables_","calcCssVariables","shimcssproperties","CSS","supports","cssBuild","ShadyCSS","disableRuntime","nativeCss","nativeCssVariables","VAR_ASSIGN","MIXIN_MATCH","VAR_CONSUMED","ANIMATION_MATCH","MEDIA_MATCH","BRACKETED","styleTextSet","toCssText","forEachRule","rulesForStyle","style","isKeyframesSelector","rule","styleRuleCallback","keyframesRuleCallback","onlyActiveRules","skipRules","matchMedia","applyCss","moniker","applyStyle","lastHeadApplyNode","applyStylePlaceHolder","placeHolder","createComment","scope","head","compareDocumentPosition","DOCUMENT_POSITION_PRECEDING","findMatchingParen","level","processVariableAndFallback","suffix","comma","fallback","setElementClassRaw","getIsExtends","typeExtension","is","extends","splitSelectorList","part","getCssBuild","__cssBuild","attrValue","CSS_BUILD_ATTR","buildComment","commentParts","isOptimalCssBuild","StyleTransformer","domAddScope","_transformDom","transformer","_content","shouldRemoveScope","classList","SCOPE_NAME","CLASS","domReplaceScope","oldScope","newScope","domRemoveScope","elementStyles","styleRules","css","ext","hostScope","_calcHostScope","CSS_CLASS_PREFIX","isScoped","transformedSelector","_transformRuleCss","self","_transformComplexSelector","p$","COMPLEX_SELECTOR_SEP","_twiddleNthPlus","NTH","inside","_preserveMatchesPseudo","MATCHES","input","MATCHES_REPLACEMENT","_replaceMatchesPseudo","cur","stop","isNth","isMatches","SLOTTED_START","SIMPLE_SELECTOR_SEP","info","_transformCompoundSelector","DIR_PAREN","dir","slottedIndex","SLOTTED","HOST","_transformHostSelector","_transformSimpleSelector","slotted","SLOTTED_PAREN","paren","output","PSEUDO_PREFIX","HOST_PAREN","SIMPLE_SELECTOR_PREFIX","typeSelector","SELECTOR_NO_MATCH","normalizeRootSelector","ROOT","_transformDocumentSelector","SCOPE_DOC_SELECTOR","$jscompDefaultExport","StyleInfo","ast","placeholder","ownStylePropertyNames","overrideStyleProperties","customStyle","scopeSelector","styleProperties","infoKey","styleInfo","_getStyleRules","method","rootSelector","StyleProperties","decorateStyles","props","keyframes","ruleIndex","decorateRule","exec","onKeyframesRule","_keyframes","propertyInfo","properties","collectProperties","hasProperties","rx","any","valueForProperty","valueForProperties","propertyValue","colon","pp","propertyDataFromStyles","o","selectorToMatch","parseInt","key","whenHostOrRootRule","parsedSelector","isHost","isRoot","hostAndRootPropertiesForScope","hostProps","rootProps","_element","transformStyles","hostSelector","hostRx","RegExp","HOST_PREFIX","rxHostSelector","HOST_SUFFIX","StyleInfo$$module$node_modules$$webcomponents$shadycss$src$style_info.get","keyframeTransforms","_elementKeyframeTransforms","hasAnimations","keyframeNamesToTransform","keyframe","transform","keyframesRules","keyframesNameRx","transformedKeyframesName","scopeId","_keyframesRuleTransformer","applyCustomStyle","XSCOPE_NAME","placeholderMap","ce","origDefine","wrappedDefine","clazz","StyleCache","cache","store","tagname","styleElement","typeMax","scopeRegExp","getCurrentScope","getOwnerScope","handler","mxns","mxn","unscopedNodes","unscopedNode","scopeForPreviouslyUnscopedNode","delayedStart","body","requestAnimationFrame","templateMap","promise","invalidate","elementName","template","CURRENT_VERSION","VALIDATING_VERSION","NEXT_VERSION","templateIsValid","startValidatingTemplate","_validating","then","adoptedCssTextMap","styleCache","ScopingShim","_scopeCounter","_documentOwner","_documentOwnerStyleInfo","StyleInfo$$module$node_modules$$webcomponents$shadycss$src$style_info.set","_elementsHaveApplied","_customStyleInterface","_applyShim","watcherFlush","getStyleAst","styleAstToString","prepareTemplate","prepareTemplateDom","prepareTemplateStyles","_prepared","optimalBuild","styleTextParts","styles","scopingAttribute","newStyle","_ensure","hasMixins","ownPropertyNames","shadowroot","_style","_ownPropertyNames","prepareAdoptedCssText","cssTextArray","_domPrepared","_prepareHost","_ensureCustomStyleInterface","CustomStyleInterface","transformCustomStyleForDocument","flushCustomStyles","_ensureApplyShim","ApplyShim","needsApplyShimUpdate","customStyles","_revalidateCustomStyleApplyShim","_reorderCustomStylesRules","_updateProperties","_applyCustomStyles","styleDocument","DOCUMENT_POSITION_FOLLOWING","overrideProps","styleElementNativeVariables","_isRootOwner","styleElementShimVariables","cacheEntry","entry","pn","cachedStyle","oldScopeSelector","cachedScopeSelector","applyElementStyle","removeProperty","setProperty","_styleOwnerForNode","owner","ownerStyleInfo","ownerProperties","hostAndRootProps","propertiesMatchingHost","propertyData","overrides","reify","styleSubtree","wrappedHost","isRootOwner","descendantRoot","descendantHosts","from","documentRule","_transformRule","getComputedStyleValue","getComputedStyle","getPropertyValue","setElementClass","classString","classes","definitelyString","scopeName","classAttr","k$","_styleInfoForNode","scopeNode","unscopeNode","scopeForNode","elementExtends"],"mappings":"A;;;;;;;;;;;;;;;;;;aAUA,IAAA,CCiB4B,SAAA,GAAQ,CAAC,CAAD,CAAQ,CAC1C,IAAI,EAAQ,CACZ,OAAO,SAAQ,EAAG,CAChB,MAAI,EAAJ,CAAY,CAAZ,CAAkB,MAAlB,CACS,CACL,KAAM,CAAA,CADD,CAEL,MAAO,CAAA,CAAM,CAAA,EAAN,CAFF,CADT,CAMS,CAAC,KAAM,CAAA,CAAP,CAPO,CAFwB,CCGrB,QAAA,EAAQ,CAAC,CAAD,CAAW,CAExC,IAAI,EAAoC,WAApC,EAAmB,MAAO,OAA1B,EAAmD,MAAnD,CAA0D,QAA1D,EACmB,CAAD,CAAW,MAAX,CAAkB,QAAlB,CACtB,OAAO,EAAA,CAAmB,CAAA,CAAiB,IAAjB,CAAsB,CAAtB,CAAnB,CDc6B,CAAC,KAAMA,EAAA,CCbM,CDaN,CAAP,CClBI,CCDd,QAAA,EAAQ,CAAC,CAAD,CAAW,CAC7C,GAAI,EAAA,CAAA,WAAoB,MAApB,CAAJ,CAAA,CAGS,CAAA,CAAA,CAAA,CAAA,CAAA,CCET,KAFA,IAAI,CAAJ,CACI,EAAM,EACV,CAAO,EAAE,CAAF,CAAM,CAAA,CAAS,IAAT,EAAN,EAAuB,IAA9B,CAAA,CACE,CAAA,CAAI,IAAJ,CAAS,CAAT,CAAW,KAAX,CAEF,EAAA,CAAO,CDRP,CAAA,MAAA,EAD6C;AEI3B,QAAA,GAAQ,CAAC,CAAD,CAAe,CACrC,CAAA,CAAkB,CAKpB,QALoB,EAKR,MAAO,W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,CAuEhBM,SAAUA,EAvEM,CAyEhBE,eAAgBA,EAzEA,CA4Ed+P,GAAJ,GACEzsC,MADF,CACSy8B,QADT,CACkBgQ,SADlB,CAC8BA,EAD9B,CAIIJ,GAAJ,GACErsC,MADF,CACSy8B,QADT,CACkB4P,oBADlB,CACyCA,EADzC,C","file":"webcomponents-sd-ce.js","sourcesContent":["/**\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\nexport class ShadyData {\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",null,null,null,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*/\nimport {shadyDataForNode} from './shady-data.js';\n\n/** @type {!Object} */\nexport const settings = window['ShadyDOM'] || {};\n\nsettings.hasNativeShadowDOM = Boolean(\n Element.prototype.attachShadow && Node.prototype.getRootNode\n);\n\n// The user might need to pass the custom elements polyfill a flag by setting an\n// object to `customElements`, so check for `customElements.define` also.\nexport const hasCustomElements = () =>\n Boolean(window.customElements && window.customElements.define);\n// The custom elements polyfill is typically loaded after Shady DOM, so this\n// check isn't reliable during initial evaluation. However, because the\n// polyfills are loaded immediately after one another, it works at runtime.\nexport const hasPolyfilledCustomElements = () =>\n Boolean(\n window.customElements && window.customElements['polyfillWrapFlushCallback']\n );\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 = /** @type {string|boolean} */ (settings['noPatch'] || false);\n// eslint-disable-next-line no-self-assign\nsettings.preferPerformance = settings['preferPerformance'];\nsettings.patchOnDemand = settings.noPatch === 'on-demand';\nsettings.querySelectorImplementation = (() => {\n const acceptedValues = ['native', 'selectorEngine'];\n const userValue = settings['querySelectorImplementation'];\n if (acceptedValues.indexOf(userValue) > -1) {\n return userValue;\n }\n return undefined;\n})();\n\nconst IS_IE = navigator.userAgent.match('Trident');\nsettings.IS_IE = IS_IE;\n\n// Helper for prefixed properties.\nexport const getPropertyName = (obj, name) => {\n const prefixed = `ms${name[0].toUpperCase() + name.slice(1)}`;\n return obj[prefixed] ? prefixed : name;\n};\n\nexport const canUpgrade = () => !settings.IS_IE;\n\nexport const isTrackingLogicalChildNodes = (node) => {\n const nodeData = shadyDataForNode(node);\n return nodeData && nodeData.firstChild !== undefined;\n};\n\nexport const isShadyRoot = (obj) => obj instanceof ShadowRoot;\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 =\n p.matches ||\n p.matchesSelector ||\n p.mozMatchesSelector ||\n p.msMatchesSelector ||\n p.oMatchesSelector ||\n 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\n/** @type {function(!Document, !Node): boolean} */\nexport const documentContains = (() => {\n if (document.contains) {\n return (doc, node) => doc[NATIVE_PREFIX + 'contains'](node);\n } else {\n return (doc, node) =>\n doc === node ||\n (doc.documentElement &&\n doc.documentElement[NATIVE_PREFIX + 'contains'](node));\n }\n})();\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\nexport const nativeChildNodesArray = (parent) => {\n const result = [];\n for (\n let n = parent[NATIVE_PREFIX + 'firstChild'];\n n;\n n = n[NATIVE_PREFIX + 'nextSibling']\n ) {\n result.push(n);\n }\n return result;\n};\n\nexport const childNodesArray = (parent) => {\n const result = [];\n for (\n let n = parent[SHADY_PREFIX + 'firstChild'];\n n;\n n = n[SHADY_PREFIX + 'nextSibling']\n ) {\n result.push(n);\n }\n return result;\n};\n\nconst patchProperty = (proto, name, descriptor) => {\n descriptor.configurable = true;\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 (descriptor.value) {\n proto[name] = descriptor.value;\n } else {\n try {\n Object.defineProperty(proto, name, descriptor);\n } catch (e) {\n // this error is harmless so we just trap it.\n }\n }\n};\n\n/**\n * Patch a group of accessors on an object. By default this overrides\n * @param {!Object} proto\n * @param {!Object} descriptors\n * @param {string=} prefix\n * @param {Array=} disallowedPatches\n */\nexport const patchProperties = (\n proto,\n descriptors,\n prefix = '',\n disallowedPatches\n) => {\n for (let name in descriptors) {\n if (disallowedPatches && disallowedPatches.indexOf(name) >= 0) {\n continue;\n }\n patchProperty(proto, prefix + name, descriptors[name]);\n }\n};\n\nexport const patchExistingProperties = (proto, descriptors) => {\n for (let name in descriptors) {\n if (name in proto) {\n patchProperty(proto, name, descriptors[name]);\n }\n }\n};\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\nexport const assign = (target, source) => {\n const names = Object.getOwnPropertyNames(source);\n for (let i = 0, p; i < names.length; i++) {\n p = names[i];\n target[p] = source[p];\n }\n};\n\nexport const arrayFrom = (object) => {\n return [].slice.call(/** @type {IArrayLike} */ (object));\n};\n\n/**\n * Converts a single value to a node for `convertNodesIntoANode`.\n *\n * @param {*} arg\n * @return {!Node}\n */\nconst convertIntoANode = (arg) => {\n // `\"\" + arg` is used to implicitly coerce the value to a string (coercing a\n // symbol *should* fail here) before passing to `createTextNode`, which has\n // argument type `(number|string)`.\n return !(arg instanceof Node) ? document.createTextNode('' + arg) : arg;\n};\n\n/**\n * Implements 'convert nodes into a node'. The spec text indicates that strings\n * become text nodes, but doesn't describe what should happen if a non-Node,\n * non-string value is found in the arguments list. In practice, browsers coerce\n * these values to strings and convert those to text nodes.\n * https://dom.spec.whatwg.org/#converting-nodes-into-a-node\n *\n * @param {...*} args\n * @return {!Node}\n */\nexport const convertNodesIntoANode = (...args) => {\n if (args.length === 1) {\n return convertIntoANode(args[0]);\n }\n\n const fragment = document.createDocumentFragment();\n for (const arg of args) {\n fragment.appendChild(convertIntoANode(arg));\n }\n return fragment;\n};\n\n/**\n * Equivalent to `Array.prototype.flat`. Closure does not compile out this\n * function, so we need an implementation for browsers that don't natively\n * support it.\n *\n * @template T\n * @param {!Array<!T | !Array<!T>>} array\n * @param {number} depth\n * @return {!Array<!T>}\n */\nexport const flat = (array, depth = 1) => {\n for (; depth > 0; depth--) {\n array = array.reduce((acc, item) => {\n if (Array.isArray(item)) {\n acc.push(...item);\n } else {\n acc.push(item);\n }\n return acc;\n }, []);\n }\n\n return array;\n};\n\n/**\n * Deduplicates items in an array.\n *\n * This function could normally be implemented as merely `Array.from(new\n * Set(...))`. However, in IE 11, `Set` does not support being constructed with\n * an iterable. Further, some polyfills for `Array.from` effectively default to\n * `Array.prototype.slice.call(...)` when they are unable to find\n * `[Symbol.iterator]`; this is incompatible with `Set` which has no `length` or\n * indexable properties.\n *\n * @template T\n * @param {!Array<!T>} array\n * @return {!Array<!T>}\n */\nexport const deduplicate = (array) => {\n const results = [];\n const set = new Set();\n for (const item of array) {\n if (!set.has(item)) {\n results.push(item);\n set.add(item);\n }\n }\n return results;\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\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/** @type {!TreeWalker} */\nconst nodeWalker = document.createTreeWalker(\n document,\n NodeFilter.SHOW_ALL,\n null,\n false\n);\n\n/** @type {!TreeWalker} */\nconst elementWalker = document.createTreeWalker(\n document,\n NodeFilter.SHOW_ELEMENT,\n null,\n false\n);\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',\n 'prepend',\n 'replaceChildren',\n];\n\nexport const addNativePrefixedProperties = () => {\n // EventTarget\n const eventProps = [\n 'dispatchEvent',\n 'addEventListener',\n 'removeEventListener',\n ];\n if (window.EventTarget) {\n copyProperties(window.EventTarget.prototype, eventProps);\n\n // In Firefox 31, `EventTarget` exists, but `EventTarget.prototype` is not\n // in the prototype chain of `window` and, strangely,\n // `window instanceof EventTarget` still returns true.\n if (window[NATIVE_PREFIX + 'addEventListener'] === undefined) {\n copyProperties(Window.prototype, eventProps);\n }\n } else {\n copyProperties(Node.prototype, eventProps);\n copyProperties(Window.prototype, eventProps);\n copyProperties(XMLHttpRequest.prototype, eventProps);\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 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 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 // eslint-disable-next-line no-case-declarations\n const textWalker = document.createTreeWalker(\n this,\n NodeFilter.SHOW_TEXT,\n null,\n false\n );\n // eslint-disable-next-line no-case-declarations\n let content = '',\n 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'](\n document.createTextNode(value),\n undefined\n );\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 // NOTE, on some browsers IE 11 / Edge 15 some properties are incorrectly on HTMLElement\n copyProperties(HTMLElement.prototype, ['parentElement', 'contains']);\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 'className',\n ]);\n\n // NOTE, on some browsers IE 11 / Edge 15 some properties are incorrectly on HTMLElement\n copyProperties(HTMLElement.prototype, [\n 'children',\n 'innerHTML',\n 'className',\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, utils.nativeChildNodesArray);\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 =\n this.localName === 'template'\n ? /** @type {HTMLTemplateElement} */ (this).content\n : this;\n clearNode(content);\n const containerName = this.localName || 'div';\n let htmlContainer;\n if (\n !this.namespaceURI ||\n this.namespaceURI === inertDoc.namespaceURI\n ) {\n htmlContainer = inertDoc.createElement(containerName);\n } else {\n htmlContainer = inertDoc.createElementNS(\n this.namespaceURI,\n containerName\n );\n }\n htmlContainer.innerHTML = value;\n const newContent =\n this.localName === 'template'\n ? /** @type {HTMLTemplateElement} */ (htmlContainer).content\n : 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 className: {\n /** @this {Element} */\n get() {\n return this.getAttribute('class') || '';\n },\n /** @this {Element} */\n set(value) {\n this.setAttribute('class', value);\n },\n },\n });\n }\n\n copyProperties(Element.prototype, [\n 'setAttribute',\n 'getAttribute',\n 'hasAttribute',\n 'removeAttribute',\n 'toggleAttribute',\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, ['focus', 'blur']);\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(\n DocumentFragment.prototype,\n ParentNodeWalkerDescriptors\n );\n }\n\n copyProperties(DocumentFragment.prototype, ParentNodeMethods);\n\n // Document\n if (hasDescriptors) {\n copyProperties(Document.prototype, ParentNodeAccessors);\n copyProperties(Document.prototype, ['activeElement']);\n } else {\n defineNativeAccessors(Document.prototype, ParentNodeWalkerDescriptors);\n }\n\n copyProperties(Document.prototype, [\n 'importNode',\n 'getElementById',\n 'elementFromPoint',\n utils.getPropertyName(Document.prototype, 'elementsFromPoint'),\n ]);\n copyProperties(Document.prototype, ParentNodeMethods);\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 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 {\n addedNodes: this.addedNodes,\n removedNodes: this.removedNodes,\n },\n ];\n this.addedNodes = [];\n this.removedNodes = [];\n return mutations;\n }\n return [];\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\n .map(function (mutation) {\n /** @const {boolean} */\n const mutationInScope = targetRootNode === mutation.target.getRootNode();\n if (mutationInScope && mutation.addedNodes) {\n let nodes = utils.arrayFrom(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 })\n .filter(function (m) {\n return m;\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\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 '&amp;';\n case '<':\n return '&lt;';\n case '>':\n return '&gt;';\n case '\"':\n return '&quot;';\n case '\\u00A0':\n return '&nbsp;';\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*/\n\nimport * as utils from './utils.js';\nimport {ensureShadyDataForNode} from './shady-data.js';\n\nexport const InsideDescriptors = utils.getOwnPropertyDescriptors({\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 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 shadowRoot() {\n return this[utils.SHADY_PREFIX + 'shadowRoot'];\n },\n});\n\nexport const TextContentInnerHTMLDescriptors = utils.getOwnPropertyDescriptors({\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 innerHTML() {\n return this[utils.SHADY_PREFIX + 'innerHTML'];\n },\n\n /** @this {Node} */\n set innerHTML(value) {\n this[utils.SHADY_PREFIX + 'innerHTML'] = value;\n },\n});\n\nexport const OutsideDescriptors = utils.getOwnPropertyDescriptors({\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 this[utils.SHADY_PREFIX + 'className'] = value;\n },\n});\n\nconst makeNonEnumerable = (descriptors) => {\n for (let prop in descriptors) {\n const descriptor = descriptors[prop];\n // NOTE, the only known reason the descriptor wouldn't exist here is\n // if someone has patched `Object.getOwnPropertyNames`, but we've seen this\n // so this is just to be extra safe.\n if (descriptor) {\n descriptor.enumerable = false;\n }\n }\n};\n\nmakeNonEnumerable(InsideDescriptors);\nmakeNonEnumerable(TextContentInnerHTMLDescriptors);\nmakeNonEnumerable(OutsideDescriptors);\n\nconst noInstancePatching =\n utils.settings.hasDescriptors || utils.settings.noPatch === true;\n\n// ensure an element has patched \"outside\" accessors; no-op when not needed\nexport let patchOutsideElementAccessors = noInstancePatching\n ? function () {}\n : function (element) {\n const sd = ensureShadyDataForNode(element);\n if (!sd.__outsideAccessors) {\n sd.__outsideAccessors = true;\n utils.patchExistingProperties(element, OutsideDescriptors);\n }\n };\n\n// ensure an element has patched \"inside\" accessors; no-op when not needed\nexport let patchInsideElementAccessors = noInstancePatching\n ? function () {}\n : function (element) {\n const sd = ensureShadyDataForNode(element);\n if (!sd.__insideAccessors) {\n sd.__insideAccessors = true;\n utils.patchExistingProperties(element, InsideDescriptors);\n // NOTE: There are compatibility issues with patches for `textContent`\n // and `innerHTML` between CE and SD. Since SD patches are applied\n // via `ShadyDOM.patch` and CE patches are applied as the tree is walked,\n // SD patches overwrite CE patches.\n // * When SD is in patching mode, SD calls through to native\n // methods not patched by CE (since SD is at the bottom) and CE does not\n // upgrade, connect, or disconnect elements. Therefore do *not patch*\n // these accessors in this case.\n // * When SD is in `noPatch` mode, the SD patches call through to\n // \"native\" methods that are patched by CE (since CE is at the bottom).\n // Therefore continue to patch in this case.\n // If the custom elements polyfill is not loaded, then these accessors\n // should be patched so they work correctly.\n if (!utils.hasPolyfilledCustomElements() || utils.settings.noPatch) {\n utils.patchExistingProperties(\n element,\n TextContentInnerHTMLDescriptors\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';\nimport {flush} from './flush.js';\nimport {shadyDataForNode, ensureShadyDataForNode} 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(\n Event.prototype,\n 'composed'\n );\n return composedProp ? (ev) => composedProp.get.call(ev) : null;\n})();\n\nconst supportsEventOptions = (() => {\n let supported = false;\n let eventOptions = {\n get capture() {\n supported = true;\n return false;\n },\n };\n const listener = () => {};\n // NOTE: These will be unpatched at this point.\n window.addEventListener('test', listener, eventOptions);\n window.removeEventListener('test', listener, eventOptions);\n return supported;\n})();\n\nconst parseEventOptions = (optionsOrCapture) => {\n let capture, once, shadyTarget;\n if (\n optionsOrCapture !== null &&\n (typeof optionsOrCapture === 'object' ||\n typeof optionsOrCapture === 'function')\n ) {\n capture = Boolean(optionsOrCapture.capture);\n once = Boolean(optionsOrCapture.once);\n shadyTarget = optionsOrCapture.__shadyTarget;\n } else {\n capture = Boolean(optionsOrCapture);\n once = false;\n }\n return {\n shadyTarget,\n capture,\n once,\n nativeEventOptions: supportsEventOptions ? optionsOrCapture : capture,\n };\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 (\n current.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&\n current.host &&\n (composed || current !== startRoot)\n ) {\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 * @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 =\n this.type === 'focusin' ||\n this.type === 'focusout' ||\n 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(\n this.currentTarget || this['__previousCurrentTarget'],\n this.composedPath()\n );\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(\n this.__relatedTarget,\n true\n );\n }\n // find the deepest node in relatedTarget composed path that is in the same root with the currentTarget\n return retarget(\n this.currentTarget || this['__previousCurrentTarget'],\n /** @type {!Event} */ (this).__relatedTargetComposedPath\n );\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// Some browsers have missing or broken descriptors. If this is the case\n// eventPhase can't be polyfilled. For example, Chrome 41 does not\n// have prototypical descriptors on DOM objects and Safari 9 has broken ones\n// that cannot be used.\nconst eventPhaseDescriptor =\n utils.settings.hasDescriptors &&\n Object.getOwnPropertyDescriptor(Event.prototype, 'eventPhase');\nif (eventPhaseDescriptor) {\n Object.defineProperty(\n EventPatches,\n 'eventPhase',\n /** @type {!ObjectPropertyDescriptor<!Event>} */ ({\n /**\n * @this {Event}\n */\n get() {\n return this.currentTarget === this.target\n ? Event.AT_TARGET\n : this[utils.NATIVE_PREFIX + 'eventPhase'];\n },\n enumerable: true,\n configurable: true,\n })\n );\n\n Object.defineProperty(\n EventPatches,\n utils.NATIVE_PREFIX + 'eventPhase',\n eventPhaseDescriptor\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 * 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 (\n event['__target'] !== event.target ||\n event.__relatedTarget !== event.relatedTarget\n );\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 =\n node.__handlers &&\n 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\n// In Chrome 41, `currentTarget` is an own property of every `Event` and its\n// descriptor is a _data_ descriptor and not an accessor descriptor (so there is\n// no getter that could be saved and wrapped) but the browser effectively treats\n// this property as if it had a getter and returns different values on getting\n// as necessary. Further, setting a new descriptor for `currentTarget`, as\n// `shadyDispatchEvent` does below, permanently breaks this special descriptor\n// behavior. In this case, `shadyDispatchEvent` creates a new object with the\n// original event as its prototype (via `Object.create`) and modifies that\n// object's `currentTarget` instead, to avoid breaking the descriptor on the\n// original event.\n//\n// In Chrome 104 and Safari 9, some getters on events do not allow `this` to be\n// anything other than exactly the original event object. This means that the\n// above process of using a proxy-like (not a `Proxy`) object for the event\n// fails because any user that attempts to use properties of the original event\n// will be using the proxy as `this`.\n//\n// Fortunately, these two issues seem to be mutually exclusive amongst the\n// browsers that we test on, so we can specifically check if `currentTarget`\n// exists on a new `Event` and switch based off of that.\n// `utils.settings.hasDescriptors` is not sufficient for deciding this behavior\n// because, in Safari 9, `currentTarget` is not an own property of events, but\n// `.hasDescriptors` is still false.\nconst shadyDispatchEventNeedsProxyEvent = new Event('e').hasOwnProperty(\n 'currentTarget'\n);\n\nfunction shadyDispatchEvent(originalEvent) {\n const e = shadyDispatchEventNeedsProxyEvent\n ? Object.create(originalEvent)\n : originalEvent;\n const path = e.composedPath();\n const retargetedPath = path.map((node) => retarget(node, path));\n const bubbles = e.bubbles;\n\n let currentTarget;\n // override `currentTarget` to let patched `target` calculate correctly\n const prevCurrentTargetDesc = Object.getOwnPropertyDescriptor(\n e,\n 'currentTarget'\n );\n Object.defineProperty(e, 'currentTarget', {\n configurable: true,\n enumerable: true,\n get: function () {\n return currentTarget;\n },\n });\n\n let eventPhase = Event.CAPTURING_PHASE;\n const prevEventPhaseDesc = Object.getOwnPropertyDescriptor(e, 'eventPhase');\n Object.defineProperty(e, 'eventPhase', {\n configurable: true,\n enumerable: true,\n get: function () {\n return eventPhase;\n },\n });\n\n try {\n for (let i = path.length - 1; i >= 0; i--) {\n currentTarget = path[i];\n eventPhase =\n currentTarget === retargetedPath[i]\n ? Event.AT_TARGET\n : Event.CAPTURING_PHASE;\n // capture phase fires all capture handlers\n fireHandlers(e, currentTarget, 'capture');\n if (e.__propagationStopped) {\n return;\n }\n }\n\n for (let i = 0; i < path.length; i++) {\n currentTarget = path[i];\n const atTarget = currentTarget === retargetedPath[i];\n if (atTarget || bubbles) {\n eventPhase = atTarget ? Event.AT_TARGET : Event.BUBBLING_PHASE;\n fireHandlers(e, currentTarget, 'bubble');\n if (e.__propagationStopped) {\n return;\n }\n }\n }\n } finally {\n if (!shadyDispatchEventNeedsProxyEvent) {\n // Restore previous currentTarget & eventPhase descriptors when\n // dispatching is complete\n if (prevCurrentTargetDesc) {\n Object.defineProperty(e, 'currentTarget', prevCurrentTargetDesc);\n } else {\n delete e['currentTarget'];\n }\n if (prevEventPhaseDesc) {\n Object.defineProperty(e, 'eventPhase', prevEventPhaseDesc);\n } else {\n delete e['eventPhase'];\n }\n }\n }\n}\n\nfunction listenerSettingsEqual(savedListener, node, type, capture) {\n let {node: savedNode, type: savedType, capture: savedCapture} = savedListener;\n return node === savedNode && type === savedType && capture === savedCapture;\n}\n\nexport function findListener(wrappers, node, type, capture) {\n for (let i = 0; i < wrappers.length; i++) {\n if (listenerSettingsEqual(wrappers[i], node, type, capture)) {\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\nfunction targetNeedsPathCheck(node) {\n return utils.isShadyRoot(node) || node.localName === 'slot';\n}\n\n/** @this {Node} */\nexport function dispatchEvent(event) {\n flush();\n // If the target is disconnected from the real document, it might still be\n // connected in the user-facing tree. To allow its path to potentially\n // include both connected and disconnected parts, dispatch it manually.\n if (\n !utils.settings.preferPerformance &&\n this instanceof Node &&\n !utils.documentContains(document, this)\n ) {\n if (!event['__target']) {\n patchEvent(event, this);\n }\n return shadyDispatchEvent(event);\n } else {\n return this[utils.NATIVE_PREFIX + 'dispatchEvent'](event);\n }\n}\n\n/**\n * @this {EventTarget}\n */\nexport function addEventListener(type, fnOrObj, optionsOrCapture) {\n const {capture, once, shadyTarget, nativeEventOptions} = parseEventOptions(\n optionsOrCapture\n );\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 (\n handlerType === 'object' &&\n (!fnOrObj.handleEvent || typeof fnOrObj.handleEvent !== 'function')\n ) {\n return;\n }\n\n if (unpatchedEvents[type]) {\n return this[utils.NATIVE_PREFIX + 'addEventListener'](\n type,\n fnOrObj,\n nativeEventOptions\n );\n }\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 = shadyTarget || this;\n\n let wrappers = fnOrObj[eventWrappersName];\n if (wrappers) {\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 // Stop if the wrapper function has already been created.\n if (findListener(wrappers, target, type, capture) > -1) {\n return;\n }\n } else {\n fnOrObj[eventWrappersName] = [];\n }\n\n /**\n * @this {EventTarget}\n * @param {Event} e\n */\n const wrapperFn = (e) => {\n // Support `once` option.\n if (once) {\n this[utils.SHADY_PREFIX + 'removeEventListener'](\n type,\n fnOrObj,\n optionsOrCapture\n );\n }\n if (!e['__target']) {\n patchEvent(e);\n }\n let lastCurrentTargetDesc;\n let lastEventPhaseDesc;\n if (target !== this) {\n // replace `currentTarget` to make `target` and `relatedTarget` correct for inside the shadowroot\n lastCurrentTargetDesc = Object.getOwnPropertyDescriptor(\n e,\n 'currentTarget'\n );\n Object.defineProperty(e, 'currentTarget', {\n get() {\n return target;\n },\n configurable: true,\n });\n lastEventPhaseDesc = Object.getOwnPropertyDescriptor(e, 'eventPhase');\n Object.defineProperty(e, 'eventPhase', {\n configurable: true,\n enumerable: true,\n get() {\n // Shady DOM doesn't support dispatching to a shadow root as the\n // target, so we don't need to handle Event.AT_TARGET.\n return capture ? Event.CAPTURING_PHASE : Event.BUBBLING_PHASE;\n },\n });\n }\n e['__previousCurrentTarget'] = e['currentTarget'];\n // Always check if a shadowRoot or slot 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 (\n targetNeedsPathCheck(target) &&\n e.composedPath().indexOf(target) == -1\n ) {\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 (\n e.eventPhase !== Event.CAPTURING_PHASE &&\n !e.bubbles &&\n e.target !== target &&\n !(target instanceof Window)\n ) {\n return;\n }\n let ret =\n handlerType === 'function'\n ? fnOrObj.call(target, e)\n : fnOrObj.handleEvent && fnOrObj.handleEvent(e);\n if (target !== this) {\n // Replace the original descriptors for `currentTarget` and `eventPhase`.\n if (lastCurrentTargetDesc) {\n Object.defineProperty(e, 'currentTarget', lastCurrentTargetDesc);\n lastCurrentTargetDesc = null;\n } else {\n delete e['currentTarget'];\n }\n if (lastEventPhaseDesc) {\n Object.defineProperty(e, 'eventPhase', lastEventPhaseDesc);\n lastEventPhaseDesc = null;\n } else {\n delete e['eventPhase'];\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,\n capture,\n wrapperFn,\n });\n\n this.__handlers = this.__handlers || {};\n this.__handlers[type] = this.__handlers[type] || {\n 'capture': [],\n 'bubble': [],\n };\n this.__handlers[type][capture ? 'capture' : 'bubble'].push(wrapperFn);\n\n if (!nonBubblingEventsToRetarget[type]) {\n this[utils.NATIVE_PREFIX + 'addEventListener'](\n type,\n wrapperFn,\n nativeEventOptions\n );\n }\n}\n\n/**\n * @this {EventTarget}\n */\nexport function removeEventListener(type, fnOrObj, optionsOrCapture) {\n if (!fnOrObj) {\n return;\n }\n const {capture, shadyTarget, nativeEventOptions} = parseEventOptions(\n optionsOrCapture\n );\n if (unpatchedEvents[type]) {\n return this[utils.NATIVE_PREFIX + 'removeEventListener'](\n type,\n fnOrObj,\n nativeEventOptions\n );\n }\n let target = 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);\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'](\n type,\n wrapperFn || fnOrObj,\n nativeEventOptions\n );\n if (wrapperFn && 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'](\n ev,\n function (e) {\n if (!e['__target']) {\n patchEvent(e);\n shadyDispatchEvent(e);\n }\n },\n true\n );\n }\n}\n\nconst EventPatchesDescriptors = utils.getOwnPropertyDescriptors(EventPatches);\n\nconst SHADY_PROTO = '__shady_patchedProto';\nconst SHADY_SOURCE_PROTO = '__shady_sourceProto';\n\nfunction patchEvent(event, target = event.target) {\n event['__target'] = 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 // eslint-disable-next-line no-prototype-builtins\n if (!proto.hasOwnProperty(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\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 (\n !composedGetter &&\n Object.getOwnPropertyDescriptor(Event.prototype, 'isTrusted')\n ) {\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 eventPropertyNamesForElement = Object.getOwnPropertyNames(\n Element.prototype\n).filter((name) => name.substring(0, 2) === 'on');\n\nexport const eventPropertyNamesForHTMLElement = Object.getOwnPropertyNames(\n HTMLElement.prototype\n).filter((name) => name.substring(0, 2) === 'on');\n\n/**\n * @param {string} property\n * @return {!ObjectPropertyDescriptor<Element>}\n */\nexport const wrappedDescriptorForEventProperty = (property) => {\n return {\n /** @this {Element} */\n set: function (fn) {\n const shadyData = ensureShadyDataForNode(this);\n const eventName = property.substring(2);\n if (!shadyData.__onCallbackListeners) {\n shadyData.__onCallbackListeners = {};\n }\n shadyData.__onCallbackListeners[property] &&\n this.removeEventListener(\n eventName,\n shadyData.__onCallbackListeners[property]\n );\n this[utils.SHADY_PREFIX + 'addEventListener'](eventName, fn);\n shadyData.__onCallbackListeners[property] = fn;\n },\n /** @this {Element} */\n get() {\n const shadyData = shadyDataForNode(this);\n return (\n shadyData &&\n shadyData.__onCallbackListeners &&\n shadyData.__onCallbackListeners[property]\n );\n },\n configurable: true,\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\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(\n current,\n currentStart,\n currentEnd,\n old,\n oldStart,\n oldEnd\n) {\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\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\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, 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\n if (currentEnd == current.length && oldEnd == old.length) {\n suffixCount = sharedSuffix(current, old, minLength - prefixCount);\n }\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\n if (currentStart == currentEnd) {\n splice = newSplice(currentStart, [], 0);\n while (oldStart < oldEnd) {\n splice.removed.push(old[oldStart++]);\n }\n\n return [splice];\n } else if (oldStart == oldEnd) {\n return [newSplice(currentStart, [], currentEnd - currentStart)];\n }\n\n let ops = spliceOperationsFromEditDistances(\n calcEditDistances(current, currentStart, currentEnd, old, oldStart, oldEnd)\n );\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\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\n splice.addedCount++;\n index++;\n break;\n case EDIT_DELETE:\n if (!splice) {\n splice = newSplice(index, [], 0);\n }\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 }\n }\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\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, previous.length);\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// prettier-ignore\nimport {addEventListener, removeEventListener, dispatchEvent} from '../patch-events.js';\n\nexport const EventTargetPatches = utils.getOwnPropertyDescriptors({\n dispatchEvent,\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';\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 for (\n let n = node[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n correctScope = correctScope && currentScopeIsCorrect(n, 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 for (\n let n = node[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n if (n.nodeType === Node.ELEMENT_NODE) {\n treeVisitor(n, visitorFn);\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// prettier-ignore\nimport {getScopingShim, removeShadyScoping, replaceShadyScoping, 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 = /** @type {ObjectPropertyDescriptor} */ (Object.getOwnPropertyDescriptor(\n Node.prototype,\n 'isConnected'\n));\n\nconst nativeIsConnected =\n 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 for (\n let n = node[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\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 // Note, if `flattened` is falsey, it means that the containing shadowRoot\n // has not rendered and therefore the `<slot>` is still in the composed\n // DOM. If that's the case the `<slot>` is the first composed node.\n if (flattened) {\n composed = flattened.length\n ? flattened[0]\n : firstComposedNode(node[utils.SHADY_PREFIX + 'nextSibling']);\n }\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 if (addedNode.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n for (let i = 0, l = addedNode.childNodes.length; i < l; i++) {\n observer.addedNodes.push(addedNode.childNodes[i]);\n }\n } else {\n observer.addedNodes.push(addedNode);\n }\n }\n if (removedNode) {\n observer.removedNodes.push(removedNode);\n }\n observer.schedule();\n }\n}\n\nexport const NodePatches = utils.getOwnPropertyDescriptors({\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 (\n let n = this[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\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 (ownerDocument === null || utils.documentContains(ownerDocument, this)) {\n return true;\n }\n // Slow path for non-distributed nodes.\n let node = this;\n while (node && !(node instanceof Document)) {\n node =\n node[utils.SHADY_PREFIX + 'parentNode'] ||\n (utils.isShadyRoot(node)\n ? /** @type {ShadowRoot} */ (node).host\n : 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 (\n let n = this[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n if (n.nodeType !== Node.COMMENT_NODE) {\n tc.push(n[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 (\n !utils.isTrackingLogicalChildNodes(this) &&\n utils.settings.hasDescriptors\n ) {\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 (\n firstChild != this[utils.SHADY_PREFIX + 'lastChild'] ||\n (firstChild && firstChild.nodeType != Node.TEXT_NODE)\n ) {\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'](\n document.createTextNode(value)\n );\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(\n `Failed to execute 'appendChild' on 'Node': The new child element contains the parent.`\n );\n }\n if (ref_node) {\n const refData = shadyDataForNode(ref_node);\n const p = refData && refData.parentNode;\n if (\n (p !== undefined && p !== this) ||\n (p === undefined &&\n ref_node[utils.NATIVE_PREFIX + 'parentNode'] !== this)\n ) {\n throw Error(\n `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 }\n if (ref_node === node) {\n return node;\n }\n scheduleObserver(this, node);\n /** @type {!Array<!HTMLSlotElement>} */\n const slotsAdded = [];\n const ownerRoot = ownerShadyRootForNode(this);\n /** @type {string} */\n const newScopeName = ownerRoot\n ? ownerRoot.host.localName\n : 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 const skipUnscoping =\n // Don't remove scoping if we're inserting into another shadowRoot;\n // this would be unnecessary since it will be re-scoped below\n Boolean(ownerRoot) ||\n // Don't remove scoping if we're being moved between non-shadowRoot\n // locations (the likely case is when moving pre-scoped nodes in a template)\n !ownerShadyRootForNode(node) ||\n // Under preferPerformance, don't remove scoping when moving back into\n // a document fragment that was previously scoped; the assumption is\n // that the user should only move correctly-scoped DOM back into it\n (preferPerformance && this['__noInsertionPoint'] !== undefined);\n parentNode[utils.SHADY_PREFIX + 'removeChild'](node, skipUnscoping);\n }\n // add to new parent\n let allowNativeInsert = true;\n const needsScoping =\n (!preferPerformance ||\n // Under preferPerformance, only re-scope if we're not coming from a\n // pre-scoped doc fragment or back into a pre-scoped doc fragment\n (node['__noInsertionPoint'] === undefined &&\n this['__noInsertionPoint'] === undefined)) &&\n !currentScopeIsCorrect(node, newScopeName);\n const needsSlotFinding =\n ownerRoot &&\n !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 (slotsAdded.length) {\n ownerRoot._addSlots(slotsAdded);\n ownerRoot._asyncRender();\n }\n if (utils.isTrackingLogicalChildNodes(this)) {\n recordInsertBefore(node, this, ref_node);\n const parentData = shadyDataForNode(this);\n // if the node being inserted into has a shadowRoot, do not perform\n // a native insertion\n if (parentData.root) {\n allowNativeInsert = false;\n // when inserting into a host with a shadowRoot with slot, use\n // `shadowRoot._asyncRender()` via `attach-shadow` module\n // when inserting into a host with shadowRoot with NO slot, do nothing\n // as the node should not be added to composed DOM anywhere.\n if (utils.hasShadowRootWithSlot(this)) {\n parentData.root._asyncRender();\n }\n }\n // when inserting into a slot inside a shadowRoot, render the\n // containing shadowRoot to update fallback content.\n else if (ownerRoot && this.localName === 'slot') {\n allowNativeInsert = false;\n ownerRoot._asyncRender();\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\n : 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 }\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 return node;\n },\n\n /**\n * @this {Node}\n * @param {Node} node\n */\n appendChild(node) {\n // if this is a shadowRoot and the shadowRoot is passed as `node`\n // then an optimized append has already been performed, so do nothing.\n if (!(this == node && utils.isShadyRoot(node))) {\n return this[utils.SHADY_PREFIX + 'insertBefore'](node);\n }\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(\n 'The node to be removed is not a child of this node: ' + node\n );\n }\n scheduleObserver(this, null, node);\n let preventNativeRemove;\n let ownerRoot = ownerShadyRootForNode(node);\n const removingInsertionPoint =\n 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 (\n getScopingShim() &&\n !skipUnscoping &&\n ownerRoot &&\n node.nodeType !== Node.TEXT_NODE\n ) {\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.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 (\n !(parentData.root || node.localName === 'slot') ||\n container === node[utils.NATIVE_PREFIX + 'parentNode']\n ) {\n container[utils.NATIVE_PREFIX + 'removeChild'](node);\n }\n }\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 for (\n let c = this[utils.SHADY_PREFIX + 'firstChild'], nc;\n c;\n c = c[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n nc = c[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) {\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\n ? parent[utils.SHADY_PREFIX + 'getRootNode'](options)\n : 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 return root;\n },\n\n /** @this {Node} */\n contains(node) {\n return utils.contains(this, node);\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';\n\nconst MODE_CLOSED = 'closed';\n\nlet isRendering =\n utils.settings['deferConnectionCallbacks'] &&\n 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 constructor(token, host, options) {\n if (token !== ShadyRootConstructionToken) {\n throw new TypeError('Illegal constructor');\n }\n /** @type {boolean} */\n this._renderPending;\n /** @type {boolean} */\n this._hasRendered;\n /** @type {?Array<HTMLSlotElement>} */\n this._slotList = null;\n /** @type {?Object<string, Array<HTMLSlotElement>>} */\n this._slotMap;\n /** @type {?Array<HTMLSlotElement>} */\n this._pendingSlots;\n this._init(host, options);\n }\n\n _init(host, options) {\n // root <=> host\n this.host = host;\n /** @type {!string|undefined} */\n this.mode = options && options.mode;\n recordChildNodes(this.host);\n const hostData = ensureShadyDataForNode(this.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 = rootData.parentNode = rootData.nextSibling = rootData.previousSibling = 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 = this.host[utils.NATIVE_PREFIX + 'firstChild'])) {\n this.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 for (\n let n = this.host[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n const data = shadyDataForNode(n);\n if (\n n[utils.NATIVE_PREFIX + 'parentNode'] === this.host &&\n (n.localName === 'slot' || !data.assignedSlot)\n ) {\n this.host[utils.NATIVE_PREFIX + 'removeChild'](n);\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 (\n let n = this.host[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\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 (\n let n = slot[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n this._distributeNodeToSlot(n, slot);\n }\n }\n const slotParentData = shadyDataForNode(\n slot[utils.SHADY_PREFIX + 'parentNode']\n );\n const slotParentRoot = slotParentData && slotParentData.root;\n if (\n slotParentRoot &&\n (slotParentRoot._hasInsertionPoint() || slotParentRoot._renderPending)\n ) {\n slotParentRoot._renderSelf();\n }\n this._addAssignedToFlattenedNodes(\n slotData.flattenedNodes,\n slotData.assignedNodes\n );\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) && 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 for (\n let n = node[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\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(n)) {\n let flattenedNodes = shadyDataForNode(n).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(n);\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 = utils.nativeChildNodesArray(container);\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++) {\n // 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 =\n (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$ = utils.childNodesArray(nA[utils.SHADY_PREFIX + 'parentNode']);\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(\n slot[utils.SHADY_PREFIX + 'parentNode']\n );\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 let root;\n // Optimization for booting up a shadowRoot from a fragment rather than\n // creating one.\n if (options['shadyUpgradeFragment'] && utils.canUpgrade()) {\n root = options['shadyUpgradeFragment'];\n root.__proto__ = ShadowRoot.prototype;\n root._init(host, options);\n recordChildNodes(root, root);\n // Note: qsa is native when used with noPatch.\n /** @type {?NodeList<Element>} */\n const slotsAdded = root['__noInsertionPoint']\n ? null\n : root.querySelectorAll('slot');\n // Reset scoping information so normal scoing rules apply after this.\n root['__noInsertionPoint'] = undefined;\n // if a slot is added, must render containing root.\n if (slotsAdded && slotsAdded.length) {\n root._addSlots(slotsAdded);\n root._asyncRender();\n }\n /** @type {ShadowRoot} */ (root).host[utils.NATIVE_PREFIX + 'appendChild'](\n root\n );\n } else {\n root = new ShadyRoot(ShadyRootConstructionToken, host, options);\n }\n return root;\n};\n\n// Mitigate connect/disconnect spam by wrapping custom element classes. This\n// should happen if custom elements are available in any capacity, polyfilled or\n// not.\nif (\n utils.hasCustomElements() &&\n utils.settings.inUse &&\n !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],\n 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(\n 'readystatechange',\n () => {\n isRendering = false;\n rootRendered();\n },\n {once: true}\n );\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 /** @this {!HTMLElement} */\n base.prototype.connectedCallback = base.prototype[\n '__shadydom_connectedCallback'\n ] = 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[\n '__shadydom_disconnectedCallback'\n ] = 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 originalDefine = window['customElements']['define'];\n const define = function (name, constructor) {\n const connected = constructor.prototype.connectedCallback;\n const disconnected = constructor.prototype.disconnectedCallback;\n originalDefine.call(\n window['customElements'],\n name,\n ManageConnect(constructor, connected, disconnected)\n );\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 // Note, it would be better to only patch the CustomElementRegistry.prototype,\n // but ShadyCSS patches define directly.\n window.customElements.define = define;\n // Still patch the registry directly since Safari 10 loses the patch\n // unless this is done.\n Object.defineProperty(window['CustomElementRegistry'].prototype, 'define', {\n value: define,\n configurable: true,\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","/**\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 /** @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 * @license\n * Copyright (c) 2022 The Polymer Project Authors\n * SPDX-License-Identifier: BSD-3-Clause\n */\n\n/**\n * A map describing parentheses-like grouping characters and their behavior. The\n * keys are the group's start character and the value's `end` property contains\n * the end character. The `matchNestedParens` property indicates whether or not\n * other grouping characters nested in the group retain their grouping behavior\n * within that group - i.e. if nested grouping characters need to be matched.\n *\n * @type {!Map<string, {end: string, matchNestedParens: boolean}>}\n */\nconst PARENS = new Map();\n// IE 11 doesn't support `Map`'s constructor parameter.\n[\n ['(', {end: ')', matchNestedParens: true}],\n ['[', {end: ']', matchNestedParens: true}],\n ['\"', {end: '\"', matchNestedParens: false}],\n [\"'\", {end: \"'\", matchNestedParens: false}],\n].forEach(([k, v]) => {\n PARENS.set(k, v);\n});\n\n/**\n * Finds the first character of `queryChars` within `str` from index `start`\n * onwards that is _not_ nested within any parentheses, brackets, or\n * single/double-quoted strings or part of an escape sequence.\n *\n * If the end of the string is reached without finding a character in\n * `queryChars`, the length of the string is returned.\n *\n * @param {string} str\n * @param {number} start\n * @param {!Array<string>} queryChars\n * @param {boolean} matchNestedParens\n * @return {number}\n */\nconst findNext = (str, start, queryChars, matchNestedParens = true) => {\n for (let i = start; i < str.length; i++) {\n if (str[i] === '\\\\' && i < str.length - 1 && str[i + 1] !== '\\n') {\n // Skip escape sequences.\n i++;\n } else if (queryChars.indexOf(str[i]) !== -1) {\n // One of `queryChars` was found.\n return i;\n } else if (matchNestedParens && PARENS.has(str[i])) {\n // Handle any grouping characters by skipping over the group.\n const parenInfo = PARENS.get(str[i]);\n i = findNext(str, i + 1, [parenInfo.end], parenInfo.matchNestedParens);\n continue;\n }\n\n // Do nothing, let `i++` happen.\n }\n\n // Reached the end of the string without finding a final char.\n return str.length;\n};\n\n/**\n * Arrays of compound selectors and combinators that form a complex selector\n * when interleaved.\n *\n * @typedef {{\n * compoundSelectors: !Array<string>,\n * combinators: !Array<string>,\n * }}\n */\nexport let ComplexSelectorParts;\n\n/**\n * Splits a selector list into individual complex selectors and creates a\n * `ComplexSelectorParts` for each.\n *\n * @param {string} str\n * @return {!Array<!ComplexSelectorParts>}\n */\nexport const parseSelectorList = (str) => {\n /**\n * @type {!Array<!ComplexSelectorParts>}\n */\n const results = [];\n\n /**\n * Compound selectors and combinators parsed from the current complex\n * selector.\n *\n * @type {!Array<string>}\n */\n const chunks = [];\n\n /**\n * Creates a new `ComplexSelectorParts` from the current `chunks`, pushes it\n * into `results` and resets `chunks`.\n */\n const endComplexSelector = () => {\n if (chunks.length > 0) {\n while (chunks[chunks.length - 1] === ' ') {\n chunks.pop();\n }\n results.push({\n compoundSelectors: chunks.filter((x, i) => i % 2 === 0),\n combinators: chunks.filter((x, i) => i % 2 === 1),\n });\n chunks.length = 0;\n }\n };\n\n for (let i = 0; i < str.length; ) {\n const prevChunk = chunks[chunks.length - 1];\n // `nextIndex` is the next complex selector boundary, combinator, or\n // whitespace that isn't inside other grouping characters.\n const nextIndex = findNext(str, i, [',', ' ', '>', '+', '~']);\n // If `nextIndex` is `i`, then the chunk we're considering is only the next\n // single character.\n const nextChunk = nextIndex === i ? str[i] : str.substring(i, nextIndex);\n\n if (nextChunk === ',') {\n endComplexSelector();\n } else if (\n [undefined, ' ', '>', '+', '~'].indexOf(prevChunk) !== -1 &&\n nextChunk === ' '\n ) {\n // Ignore leading whitespace and whitespace directly after combinators.\n } else if (prevChunk === ' ' && ['>', '+', '~'].indexOf(nextChunk) !== -1) {\n // If the last chunk was whitespace and this chunk is a non-whitespace\n // combinator, replace the whitespace with this combinator.\n chunks[chunks.length - 1] = nextChunk;\n } else {\n chunks.push(nextChunk);\n }\n\n i = nextIndex + (nextIndex === i ? 1 : 0);\n }\n\n endComplexSelector();\n\n return results;\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';\nimport {ComplexSelectorParts, parseSelectorList} from '../selector-parser.js'; // eslint-disable-line @typescript-eslint/no-unused-vars\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 queryChildNodes(node, matcher, halter, list);\n return list;\n}\n\nfunction queryChildNodes(parent, matcher, halter, list) {\n for (\n let n = parent[utils.SHADY_PREFIX + 'firstChild'];\n n;\n n = n[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n if (\n n.nodeType === Node.ELEMENT_NODE &&\n queryElement(n, matcher, halter, list)\n ) {\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 queryChildNodes(node, matcher, halter, list);\n}\n\n// Needed on Element, DocumentFragment, Document\nexport const ParentNodePatches = utils.getOwnPropertyDescriptors({\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(\n Array.prototype.filter.call(utils.childNodesArray(this), (n) => {\n return n.nodeType === Node.ELEMENT_NODE;\n })\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 /** @this {Element} */\n append(...args) {\n this[utils.SHADY_PREFIX + 'insertBefore'](\n utils.convertNodesIntoANode(...args),\n null\n );\n },\n\n /** @this {Element} */\n prepend(...args) {\n this[utils.SHADY_PREFIX + 'insertBefore'](\n utils.convertNodesIntoANode(...args),\n this[utils.SHADY_PREFIX + 'firstChild']\n );\n },\n\n /** @this {Element} */\n ['replaceChildren'](...args) {\n let child;\n while ((child = this[utils.SHADY_PREFIX + 'firstChild']) !== null) {\n this[utils.SHADY_PREFIX + 'removeChild'](child);\n }\n this[utils.SHADY_PREFIX + 'insertBefore'](\n utils.convertNodesIntoANode(...args),\n null\n );\n },\n});\n\n/**\n * Performs the equivalent of `querySelectorAll` within Shady DOM's logical\n * model of the tree for a selector list.\n *\n * See <./logicalQuerySelectorAll.md> for implementation details.\n *\n * @param {!ParentNode} contextNode\n * @param {string} selectorList\n * @return {!Array<!Element>}\n */\nconst logicalQuerySelectorAll = (contextNode, selectorList) => {\n /**\n * @type {!Array<!ComplexSelectorParts>}\n */\n const complexSelectors = parseSelectorList(selectorList);\n\n if (complexSelectors.length < 1) {\n return [];\n }\n\n /**\n * Determines if a single compound selector matches an element. If the\n * selector contains `:scope` (as a substring), then the selector only is only\n * considered matching if `element` is `contextNode`.\n *\n * @param {!Element} element\n * @param {string} compoundSelector\n * @return {boolean}\n */\n const matchesCompoundSelector = (element, compoundSelector) => {\n return (\n (element === contextNode || compoundSelector.indexOf(':scope') === -1) &&\n utils.matchesSelector(element, compoundSelector)\n );\n };\n\n /**\n * An object used to track the current position of a potential selector match.\n *\n * - `target` is the element that would be considered matching if the cursor\n * eventually results in a complete match.\n *\n * - `complexSelectorParts` is the parsed representation of the complex\n * selector that this cursor is attempting to match.\n *\n * - `index` is the index into `.complexSelectorParts.compoundSelectors` of\n * the last successfully matched compound selector.\n *\n * - `matchedElement` is the element that successfully matched the compound\n * selector in `.complexSelectorParts.compoundSelectors` at `index`.\n *\n * @typedef {{\n * target: !Element,\n * complexSelectorParts: !ComplexSelectorParts,\n * matchedElement: !Element,\n * index: number,\n * }}\n */\n let SelectorMatchingCursor; // eslint-disable-line @typescript-eslint/no-unused-vars\n\n /**\n * The list of `SelectorMatchingCursor`s, initialized with cursors pointing at\n * all descendants of `contextNode` that match the last compound selector in\n * any complex selector in `selectorList`.\n *\n * @type {!Array<!SelectorMatchingCursor>}\n */\n let cursors = utils.flat(\n query(contextNode, (_element) => true).map((element) => {\n return utils.flat(\n complexSelectors.map((complexSelectorParts) => {\n const {compoundSelectors} = complexSelectorParts;\n // Selectors are matched by iterating their compound selectors in\n // reverse order for efficiency. In particular, when finding\n // candidates for the descendant combinator, iterating forwards would\n // imply needing to walk all descendants of the last matched element\n // for possible candidates, but iterating backwards only requires\n // walking up the ancestor chain.\n const index = compoundSelectors.length - 1;\n if (matchesCompoundSelector(element, compoundSelectors[index])) {\n return {\n target: element,\n complexSelectorParts,\n matchedElement: element,\n index,\n };\n } else {\n return [];\n }\n })\n );\n })\n );\n\n // At each step, any remaining cursors that have not finished matching (i.e.\n // with `cursor.index > 0`) should be replaced with new cursors for any valid\n // candidates that match the next compound selector.\n while (cursors.some((cursor) => cursor.index > 0)) {\n cursors = utils.flat(\n cursors.map((cursor) => {\n // Cursors with `index` of 0 have already matched and should not be\n // replaced or removed.\n if (cursor.index <= 0) {\n return cursor;\n }\n\n const {\n target,\n matchedElement,\n complexSelectorParts,\n index: lastIndex,\n } = cursor;\n const index = lastIndex - 1;\n const combinator = complexSelectorParts.combinators[index];\n const compoundSelector = complexSelectorParts.compoundSelectors[index];\n\n if (combinator === ' ') {\n const results = [];\n\n // For `a b`, where existing cursors have `matchedElement`s matching\n // `b`, the candidates to test against `a` are all ancestors of each\n // cursor's `matchedElement`.\n for (\n let ancestor = matchedElement[utils.SHADY_PREFIX + 'parentElement'];\n ancestor;\n ancestor = ancestor[utils.SHADY_PREFIX + 'parentElement']\n ) {\n if (matchesCompoundSelector(ancestor, compoundSelector)) {\n results.push({\n target,\n complexSelectorParts,\n matchedElement: ancestor,\n index,\n });\n }\n }\n\n return results;\n } else if (combinator === '>') {\n const parent = matchedElement[utils.SHADY_PREFIX + 'parentElement'];\n\n // For `a > b`, where existing cursors have `matchedElement`s matching\n // `b`, the candidates to test against `a` are the parents of each\n // cursor's `matchedElement`.\n if (matchesCompoundSelector(parent, compoundSelector)) {\n return {\n target,\n complexSelectorParts,\n matchedElement: parent,\n index,\n };\n }\n\n return [];\n } else if (combinator === '+') {\n const sibling =\n matchedElement[utils.SHADY_PREFIX + 'previousElementSibling'];\n\n // For `a + b`, where existing cursors have `matchedElement`s matching\n // `b`, the candidates to test against `a` are the immediately\n // preceding siblings of each cursor's `matchedElement`.\n if (sibling && matchesCompoundSelector(sibling, compoundSelector)) {\n return {\n target,\n complexSelectorParts,\n matchedElement: sibling,\n index,\n };\n }\n\n return [];\n } else if (combinator === '~') {\n const results = [];\n\n // For `a ~ b`, where existing cursors have `matchedElement`s matching\n // `b`, the candidates to test against `a` are all preceding siblings\n // of each cursor's `matchedElement`.\n for (\n let sibling =\n matchedElement[utils.SHADY_PREFIX + 'previousElementSibling'];\n sibling;\n sibling = sibling[utils.SHADY_PREFIX + 'previousElementSibling']\n ) {\n if (matchesCompoundSelector(sibling, compoundSelector)) {\n results.push({\n target,\n complexSelectorParts,\n matchedElement: sibling,\n index,\n });\n }\n }\n\n return results;\n } else {\n // As of writing, there are no other combinators:\n // <https://drafts.csswg.org/selectors/#combinators>\n throw new Error(`Unrecognized combinator: '${combinator}'.`);\n }\n })\n );\n }\n\n // Map remaining cursors to their `target` and deduplicate.\n return utils.deduplicate(cursors.map(({target}) => target));\n};\n\nconst querySelectorImplementation =\n utils.settings['querySelectorImplementation'];\n\nexport const QueryPatches = utils.getOwnPropertyDescriptors({\n /**\n * @this {!ParentNode}\n * @param {string} selector\n */\n querySelector(selector) {\n if (querySelectorImplementation === 'native') {\n // Polyfilled `ShadowRoot`s don't have a native `querySelectorAll`.\n const target =\n this instanceof ShadowRoot\n ? /** @type {!ShadowRoot} */ (this).host\n : this;\n const candidates = Array.prototype.slice.call(\n target[utils.NATIVE_PREFIX + 'querySelectorAll'](selector)\n );\n const root = this[utils.SHADY_PREFIX + 'getRootNode']();\n // This could use `find`, but Closure doesn't polyfill it.\n for (const candidate of candidates) {\n if (candidate[utils.SHADY_PREFIX + 'getRootNode']() == root) {\n return candidate;\n }\n }\n return null;\n } else if (querySelectorImplementation === 'selectorEngine') {\n return logicalQuerySelectorAll(this, selector)[0] || null;\n } else if (querySelectorImplementation === undefined) {\n // match selector and halt on first result.\n let result = query(\n this,\n function (n) {\n return utils.matchesSelector(n, selector);\n },\n function (n) {\n return Boolean(n);\n }\n )[0];\n return result || null;\n } else {\n throw new Error(\n 'Unrecognized value of ShadyDOM.querySelectorImplementation: ' +\n `'${querySelectorImplementation}'`\n );\n }\n },\n\n /**\n * @this {!ParentNode}\n * @param {string} selector\n * @param {boolean} useNative\n */\n querySelectorAll(selector, useNative) {\n if (useNative || querySelectorImplementation === 'native') {\n // Polyfilled `ShadowRoot`s don't have a native `querySelectorAll`.\n const target =\n this instanceof ShadowRoot\n ? /** @type {!ShadowRoot} */ (this).host\n : this;\n const candidates = Array.prototype.slice.call(\n target[utils.NATIVE_PREFIX + 'querySelectorAll'](selector)\n );\n const root = this[utils.SHADY_PREFIX + 'getRootNode']();\n return utils.createPolyfilledHTMLCollection(\n candidates.filter(\n (e) => e[utils.SHADY_PREFIX + 'getRootNode']() == root\n )\n );\n } else if (querySelectorImplementation === 'selectorEngine') {\n return utils.createPolyfilledHTMLCollection(\n logicalQuerySelectorAll(this, selector)\n );\n } else if (querySelectorImplementation === undefined) {\n return utils.createPolyfilledHTMLCollection(\n query(this, function (n) {\n return utils.matchesSelector(n, selector);\n })\n );\n } else {\n throw new Error(\n 'Unrecognized value of ShadyDOM.querySelectorImplementation: ' +\n `'${querySelectorImplementation}'`\n );\n }\n },\n});\n\n// In preferPerformance mode, create a custom `ParentNodeDocumentOrFragment`\n// that optionally does not mixin querySelector/All; this is a performance\n// optimization. In noPatch, we need to keep the query patches here in order to\n// ensure the query API is available on the wrapper\nexport const ParentNodeDocumentOrFragmentPatches =\n utils.settings.preferPerformance && !utils.settings.noPatch\n ? utils.assign({}, ParentNodePatches)\n : ParentNodePatches;\n\nutils.assign(ParentNodePatches, QueryPatches);\n","/**\n@license\nCopyright (c) 2020 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 ChildNodePatches = utils.getOwnPropertyDescriptors({\n /** @this {Element} */\n after(...args) {\n const parentNode = this[utils.SHADY_PREFIX + 'parentNode'];\n if (parentNode === null) {\n return;\n }\n const nextSibling = this[utils.SHADY_PREFIX + 'nextSibling'];\n parentNode[utils.SHADY_PREFIX + 'insertBefore'](\n utils.convertNodesIntoANode(...args),\n nextSibling\n );\n },\n\n /** @this {Element} */\n before(...args) {\n const parentNode = this[utils.SHADY_PREFIX + 'parentNode'];\n if (parentNode === null) {\n return;\n }\n parentNode[utils.SHADY_PREFIX + 'insertBefore'](\n utils.convertNodesIntoANode(...args),\n this\n );\n },\n\n /** @this {Element} */\n remove() {\n const parentNode = this[utils.SHADY_PREFIX + 'parentNode'];\n if (parentNode === null) {\n return;\n }\n parentNode[utils.SHADY_PREFIX + 'removeChild'](this);\n },\n\n /** @this {Element} */\n replaceWith(...args) {\n const parentNode = this[utils.SHADY_PREFIX + 'parentNode'];\n if (parentNode === null) {\n return;\n }\n const nextSibling = this[utils.SHADY_PREFIX + 'nextSibling'];\n parentNode[utils.SHADY_PREFIX + 'removeChild'](this);\n parentNode[utils.SHADY_PREFIX + 'insertBefore'](\n utils.convertNodesIntoANode(...args),\n nextSibling\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// prettier-ignore\nimport {eventPropertyNamesForElement, wrappedDescriptorForEventProperty} from '../patch-events.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 /** @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 /** @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 if (this.ownerDocument !== doc) {\n this[utils.NATIVE_PREFIX + 'removeAttribute'](attr);\n } else if (!scopeClassAttribute(this, attr, '')) {\n this[utils.NATIVE_PREFIX + 'removeAttribute'](attr);\n distributeAttributeChange(this, attr);\n } else if (this.getAttribute(attr) === '') {\n // When attr='class', scopeClassAttribute() will handle the change as a\n // side-effect and return `true`, allowing us to get to this branch,\n // which cleans up the 'class' attribute if it's empty and we were\n // supposed to have removed it.\n this[utils.NATIVE_PREFIX + 'removeAttribute'](attr);\n }\n },\n\n /**\n * @this {Element}\n * @param {string} attr\n * @param {boolean | undefined} force\n */\n toggleAttribute(attr, force) {\n if (this.ownerDocument !== doc) {\n return this[utils.NATIVE_PREFIX + 'toggleAttribute'](attr, force);\n } else if (!scopeClassAttribute(this, attr, '')) {\n const result = this[utils.NATIVE_PREFIX + 'toggleAttribute'](attr, force);\n distributeAttributeChange(this, attr);\n return result;\n } else if (this.getAttribute(attr) === '' && !force) {\n // When attr='class', scopeClassAttribute() will handle the change as a\n // side-effect and return `true`, allowing us to get to this branch,\n // which cleans up the 'class' attribute if it's empty and we were\n // supposed to have removed it.\n // We check for `force` being falsey because we only want to clean up on\n // removal of the attribute.\n return this[utils.NATIVE_PREFIX + 'toggleAttribute'](attr, force);\n }\n },\n});\n\nif (!utils.settings.preferPerformance) {\n eventPropertyNamesForElement.forEach((property) => {\n ElementPatches[property] = wrappedDescriptorForEventProperty(property);\n });\n}\n\nexport const ElementShadowPatches = utils.getOwnPropertyDescriptors({\n /**\n * @this {Element}\n * @param {!{mode: string}} options\n */\n attachShadow(options) {\n const root = attachShadow(this, options);\n // TODO(sorvell): Workaround for CE not seeing shadowRoot in `on-demand`\n // noPatch mode. CE's attachShadow patch is overwritten by this patch\n // and cannot set its own special tracking for shadowRoot. It does this\n // to be able to see closed shadowRoots.\n // This is necessary so that the CE polyfill can traverse into nodes\n // with shadowRoot that will under `on-demand` have their childNodes patched.\n this['__CE_shadowRoot'] = root;\n return root;\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\nutils.assign(ElementPatches, ElementShadowPatches);\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 /** @this {Element} */\n get innerHTML() {\n if (utils.isTrackingLogicalChildNodes(this)) {\n const content =\n this.localName === 'template'\n ? /** @type {HTMLTemplateElement} */ (this).content\n : this;\n return getInnerHTML(content, utils.childNodesArray);\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(\n this.namespaceURI,\n containerName\n );\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@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// prettier-ignore\nimport {eventPropertyNamesForHTMLElement, wrappedDescriptorForEventProperty} from '../patch-events.js';\nimport {shadyDataForNode} from '../shady-data.js';\n\nexport const HTMLElementPatches = utils.getOwnPropertyDescriptors({\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\nif (!utils.settings.preferPerformance) {\n eventPropertyNamesForHTMLElement.forEach((property) => {\n HTMLElementPatches[property] = wrappedDescriptorForEventProperty(property);\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';\nimport {addEventListener, removeEventListener} from '../patch-events.js';\n\nexport const SlotPatches = utils.getOwnPropertyDescriptors({\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\n ? nodeData.flattenedNodes\n : nodeData.assignedNodes) || []\n : [];\n }\n },\n\n /**\n * @this {HTMLSlotElement}\n * @param {string} type\n * @param {Function} fn\n * @param {Object|boolean=} optionsOrCapture\n */\n addEventListener(type, fn, optionsOrCapture) {\n // NOTE, check if this is a `slot` because these patches are installed on\n // Element where browsers don't have `<slot>`\n if (this.localName !== 'slot' || type === 'slotchange') {\n addEventListener.call(this, type, fn, optionsOrCapture);\n } else {\n if (typeof optionsOrCapture !== 'object') {\n optionsOrCapture = {\n capture: Boolean(optionsOrCapture),\n };\n }\n const parent = this[utils.SHADY_PREFIX + 'parentNode'];\n if (!parent) {\n throw new Error(\n 'ShadyDOM cannot attach event to slot unless it has a `parentNode`'\n );\n }\n optionsOrCapture.__shadyTarget = this;\n parent[utils.SHADY_PREFIX + 'addEventListener'](\n type,\n fn,\n optionsOrCapture\n );\n }\n },\n\n /**\n * @this {HTMLSlotElement}\n * @param {string} type\n * @param {Function} fn\n * @param {Object|boolean=} optionsOrCapture\n */\n removeEventListener(type, fn, optionsOrCapture) {\n // NOTE, check if this is a `slot` because these patches are installed on\n // Element where browsers don't have `<slot>`\n if (this.localName !== 'slot' || type === 'slotchange') {\n removeEventListener.call(this, type, fn, optionsOrCapture);\n } else {\n if (typeof optionsOrCapture !== 'object') {\n optionsOrCapture = {\n capture: Boolean(optionsOrCapture),\n };\n }\n const parent = this[utils.SHADY_PREFIX + 'parentNode'];\n if (!parent) {\n throw new Error(\n 'ShadyDOM cannot attach event to slot unless it has a `parentNode`'\n );\n }\n optionsOrCapture.__shadyTarget = this;\n parent[utils.SHADY_PREFIX + 'removeEventListener'](\n type,\n fn,\n optionsOrCapture\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*/\nimport * as utils from '../utils.js';\nimport {query} from './ParentNode.js';\n\nexport const DocumentOrFragmentPatches = utils.getOwnPropertyDescriptors({\n /**\n * @this {Element}\n * @param {string} id\n */\n getElementById(id) {\n if (id === '') {\n return null;\n }\n let result = query(\n this,\n function (n) {\n return n.id == id;\n },\n function (n) {\n return Boolean(n);\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\n// Get the element within the given set of roots.\nfunction getElInRoot(roots, el) {\n let elRoot;\n while (\n el &&\n !roots.has((elRoot = el[utils.SHADY_PREFIX + 'getRootNode']()))\n ) {\n el = elRoot.host;\n }\n return el;\n}\n\nfunction getAncestorRoots(docOrRoot) {\n const roots = new Set();\n roots.add(docOrRoot);\n while (utils.isShadyRoot(docOrRoot) && docOrRoot.host) {\n docOrRoot = docOrRoot.host[utils.SHADY_PREFIX + 'getRootNode']();\n roots.add(docOrRoot);\n }\n return roots;\n}\n\nconst USE_NATIVE_DOCUMENT_EFP = 'useNativeDocumentEFP';\n\nconst elementsFromPointProperty =\n utils.NATIVE_PREFIX +\n utils.getPropertyName(Document.prototype, 'elementsFromPoint');\n\nexport const DocumentOrShadowRootPatches = utils.getOwnPropertyDescriptors({\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 (\n this.host === active ||\n !this.host[utils.NATIVE_PREFIX + 'contains'](active)\n ) {\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 /** @this {Document|ShadowRoot} */\n elementsFromPoint(x, y) {\n const nativeResult = document[elementsFromPointProperty](x, y);\n // support optionally opt-ing out for document\n if (this === document && utils.settings[USE_NATIVE_DOCUMENT_EFP]) {\n return nativeResult;\n }\n const nativeArray = utils.arrayFrom(nativeResult);\n // Filter native result to return the element in this root\n // OR an above root.\n // Set containing this root and its ancestor roots.\n const ancestorRoots = getAncestorRoots(this);\n // Use a Set since the elements can repeat.\n const rootedResult = new Set();\n for (let i = 0; i < nativeArray.length; i++) {\n rootedResult.add(getElInRoot(ancestorRoots, nativeArray[i]));\n }\n // Note, for IE compat avoid Array.from(set).\n const r = [];\n rootedResult.forEach((x) => r.push(x));\n return r;\n },\n\n /** @this {Document|ShadowRoot} */\n elementFromPoint(x, y) {\n // support optionally opt-ing out for document\n return this === document && utils.settings[USE_NATIVE_DOCUMENT_EFP]\n ? this[utils.NATIVE_PREFIX + 'elementFromPoint'](x, y)\n : this[utils.SHADY_PREFIX + 'elementsFromPoint'](x, y)[0] || 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';\n\nconst doc = window.document;\n\nexport const DocumentPatches = utils.getOwnPropertyDescriptors({\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 for (\n let c = node[utils.SHADY_PREFIX + 'firstChild'], nc;\n c;\n c = c[utils.SHADY_PREFIX + 'nextSibling']\n ) {\n nc = this[utils.SHADY_PREFIX + 'importNode'](c, 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';\n// prettier-ignore\nimport {addEventListener, removeEventListener, dispatchEvent} from '../patch-events.js';\n\nexport const WindowPatches = utils.getOwnPropertyDescriptors({\n // Ensure that `dispatchEvent` is patched directly on Window since on\n // IE11, Window does not descend from EventTarget.\n dispatchEvent,\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';\n// prettier-ignore\nimport {ParentNodePatches, ParentNodeDocumentOrFragmentPatches} from './patches/ParentNode.js';\nimport {ChildNodePatches} from './patches/ChildNode.js';\nimport {ElementPatches, ElementShadowPatches} 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 =\n !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 Comment: [SlotablePatches],\n CDATASection: [SlotablePatches],\n ProcessingInstruction: [SlotablePatches],\n Element: [\n ElementPatches,\n ParentNodePatches,\n ChildNodePatches,\n SlotablePatches,\n ElementShouldHaveInnerHTML ? ElementOrShadowRootPatches : null,\n !window.HTMLSlotElement ? SlotPatches : null,\n ],\n HTMLElement: [HTMLElementPatches, NonStandardHTMLElement],\n HTMLSlotElement: [SlotPatches],\n DocumentFragment: [\n ParentNodeDocumentOrFragmentPatches,\n DocumentOrFragmentPatches,\n ],\n Document: [\n DocumentPatches,\n ParentNodeDocumentOrFragmentPatches,\n DocumentOrFragmentPatches,\n DocumentOrShadowRootPatches,\n ],\n Window: [WindowPatches],\n CharacterData: [ChildNodePatches],\n XMLHttpRequest: [!window.EventTarget ? EventTargetPatches : null],\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\n ? null\n : ['innerHTML', 'textContent'];\n\n/**\n * Patch a group of accessors on an object.\n * @param {!Object} proto\n * @param {!Array<Object>} list\n * @param {string=} prefix\n * @param {Array=} disallowed\n */\nfunction applyPatchList(proto, list, prefix, disallowed) {\n list.forEach(\n (patch) =>\n proto && patch && utils.patchProperties(proto, patch, prefix, disallowed)\n );\n}\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 applyPatchList(proto, patchMap[p], prefix, disallowed);\n }\n};\n\nconst PROTO_IS_PATCHED = utils.SHADY_PREFIX + 'protoIsPatched';\n\n// This property is stored directly on these objects, rather than in a local\n// Map, because IE11 has a bug around `defineProperty`/`hasOwnProperty` which\n// breaks Closure Compiler's WeakMap polyfill when using both certain native\n// prototypes (e.g. of CDATASection) and their instances as keys - even if\n// they're isolated to different WeakMaps. Closure's WeakMap polyfill is used\n// transitively by its own Map and Set polyfills, so this bug applies to any\n// situation where either of Map or Set are polyfilled also.\nconst PATCHED_PROTO = utils.SHADY_PREFIX + 'patchedProto';\n\n// Patch non-element prototypes up front so that we don't have to check\n// the type of Node when patching an can always assume we're patching an element.\n['Text', 'Comment', 'CDATASection', 'ProcessingInstruction'].forEach((name) => {\n const ctor = window[name];\n const patchedProto = Object.create(ctor.prototype);\n patchedProto[PROTO_IS_PATCHED] = true;\n applyPatchList(patchedProto, patchMap.EventTarget);\n applyPatchList(patchedProto, patchMap.Node);\n if (patchMap[name]) {\n applyPatchList(patchedProto, patchMap[name]);\n }\n ctor.prototype[PATCHED_PROTO] = patchedProto;\n});\n\nexport const patchElementProto = (proto) => {\n proto[PROTO_IS_PATCHED] = true;\n applyPatchList(proto, patchMap.EventTarget);\n applyPatchList(proto, patchMap.Node);\n applyPatchList(proto, patchMap.Element);\n applyPatchList(proto, patchMap.HTMLElement);\n applyPatchList(proto, patchMap.HTMLSlotElement);\n return proto;\n};\n\nexport const patchNodeProto = (node) => {\n if (node[PROTO_IS_PATCHED] || utils.isShadyRoot(node)) {\n return;\n }\n const nativeProto = Object.getPrototypeOf(node);\n // Note, this hasOwnProperty check is critical to avoid seeing a patched\n // prototype lower in the prototype chain, e.g. if an <s> element has been\n // patched, without this check, an <input> element would get the wrong patch.\n let proto =\n nativeProto.hasOwnProperty(PATCHED_PROTO) && nativeProto[PATCHED_PROTO];\n if (!proto) {\n proto = Object.create(nativeProto);\n patchElementProto(proto);\n nativeProto[PATCHED_PROTO] = proto;\n }\n Object.setPrototypeOf(node, proto);\n};\n\nexport const patchShadowOnElement = () => {\n utils.patchProperties(Element.prototype, ElementShadowPatches);\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\nimport * as utils from './utils.js';\nimport {shadyDataForNode, ensureShadyDataForNode} from './shady-data.js';\n// prettier-ignore\nimport {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-instances.js';\nimport {patchNodeProto} from './patch-prototypes.js';\n\nconst OutsideAccessors = 1;\nconst InsideAcccessors = 2;\n\nconst patchOnDemand = utils.settings.patchOnDemand;\nconst hasDescriptors = utils.settings.hasDescriptors;\n\nfunction patchNode(node, type) {\n if (patchOnDemand) {\n patchNodeProto(node);\n }\n if (!hasDescriptors) {\n if (type === OutsideAccessors) {\n patchOutsideElementAccessors(node);\n } else if (type === InsideAcccessors) {\n patchInsideElementAccessors(node);\n }\n }\n}\n\nfunction linkNode(node, container, containerData, ref_node) {\n patchNode(node, OutsideAccessors);\n ref_node = ref_node || null;\n const nodeData = ensureShadyDataForNode(node);\n const ref_nodeData = ref_node ? ensureShadyDataForNode(ref_node) : null;\n // update ref_node.previousSibling <-> node\n nodeData.previousSibling = ref_node\n ? 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 patchNode(container, InsideAcccessors);\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 // Note, documentFragments should not have logical DOM so there's\n // no need update that. It is possible to append a ShadowRoot, but we're\n // choosing not to support that.\n const first = node[utils.NATIVE_PREFIX + 'firstChild'];\n for (let n = first; n; n = n[utils.NATIVE_PREFIX + 'nextSibling']) {\n linkNode(n, container, containerData, ref_node);\n }\n } else {\n linkNode(node, container, containerData, 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 = nodeData.nextSibling = undefined;\n if (containerData.childNodes !== undefined) {\n // remove caching of childNodes\n containerData.childNodes = null;\n }\n};\n\n/**\n * @param {!Node|DocumentFragment} node\n * @param {!Node|DocumentFragment=} adoptedParent\n */\nexport const recordChildNodes = (node, adoptedParent) => {\n const nodeData = ensureShadyDataForNode(node);\n if (!adoptedParent && nodeData.firstChild !== undefined) {\n return;\n }\n // remove caching of childNodes\n nodeData.childNodes = null;\n const first = (nodeData.firstChild =\n node[utils.NATIVE_PREFIX + 'firstChild']);\n nodeData.lastChild = node[utils.NATIVE_PREFIX + 'lastChild'];\n patchNode(node, InsideAcccessors);\n for (let n = first, previous; n; n = n[utils.NATIVE_PREFIX + 'nextSibling']) {\n const sd = ensureShadyDataForNode(n);\n sd.parentNode = adoptedParent || node;\n sd.nextSibling = n[utils.NATIVE_PREFIX + 'nextSibling'];\n sd.previousSibling = previous || null;\n previous = n;\n patchNode(n, OutsideAccessors);\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 * @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 // Note, `__shadyTarget` may already be set if an event was added on a <slot> child\n optionsOrCapture.__shadyTarget = optionsOrCapture.__shadyTarget || this;\n this.host[utils.SHADY_PREFIX + 'addEventListener'](\n type,\n fn,\n optionsOrCapture\n );\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 // Note, `__shadyTarget` may already be set if an event was added on a <slot> child\n optionsOrCapture.__shadyTarget = optionsOrCapture.__shadyTarget || this;\n this.host[utils.SHADY_PREFIX + 'removeEventListener'](\n type,\n fn,\n 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';\n// prettier-ignore\nimport {OutsideDescriptors, InsideDescriptors, TextContentInnerHTMLDescriptors} 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 }\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 utils.patchProperties(proto, TextContentInnerHTMLDescriptors);\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 ['localName', 'namespaceURI', 'prefix'].forEach((prop) => {\n Object.defineProperty(proto, prop, {\n value: undefined,\n configurable: true,\n });\n });\n\n // defer properties to host\n ['ownerDocument', 'baseURI', 'isConnected'].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';\n// prettier-ignore\nimport {eventPropertyNamesForElement, eventPropertyNamesForHTMLElement} from './patch-events.js';\n\n/** @implements {IWrapper} */\nclass Wrapper {\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'](\n name,\n fn,\n options\n );\n }\n\n removeEventListener(name, fn, options) {\n return this.node[utils.SHADY_PREFIX + 'removeEventListener'](\n name,\n fn,\n options\n );\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 toggleAttribute(name, force) {\n return this.node[utils.SHADY_PREFIX + 'toggleAttribute'](name, force);\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 (\n utils.isShadyRoot(this.node) ||\n this.node.nodeType === Node.DOCUMENT_NODE\n ) {\n const e = this.node[utils.SHADY_PREFIX + 'activeElement'];\n return e;\n }\n return undefined;\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 elementsFromPoint(x, y) {\n return this.node[utils.SHADY_PREFIX + 'elementsFromPoint'](x, y);\n }\n\n elementFromPoint(x, y) {\n return this.node[utils.SHADY_PREFIX + 'elementFromPoint'](x, y);\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'](\n selector,\n useNative\n );\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 return undefined;\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 get className() {\n return this.node[utils.SHADY_PREFIX + 'className'];\n }\n\n set className(value) {\n this.node[utils.SHADY_PREFIX + 'className'] = value;\n }\n\n append(...args) {\n return this.node[utils.SHADY_PREFIX + 'append'](...args);\n }\n\n prepend(...args) {\n return this.node[utils.SHADY_PREFIX + 'prepend'](...args);\n }\n\n replaceChildren(...args) {\n return this.node[utils.SHADY_PREFIX + 'replaceChildren'](...args);\n }\n\n after(...args) {\n return this.node[utils.SHADY_PREFIX + 'after'](...args);\n }\n\n before(...args) {\n return this.node[utils.SHADY_PREFIX + 'before'](...args);\n }\n\n remove() {\n return this.node[utils.SHADY_PREFIX + 'remove']();\n }\n\n replaceWith(...args) {\n return this.node[utils.SHADY_PREFIX + 'replaceWith'](...args);\n }\n}\n\nconst addEventPropertyWrapper = (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\neventPropertyNamesForElement.forEach((name) => addEventPropertyWrapper(name));\neventPropertyNamesForHTMLElement.forEach((name) =>\n addEventPropertyWrapper(name)\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\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';\n// prettier-ignore\nimport {observeChildren, unobserveChildren, filterMutations} from './observe-changes.js';\n// prettier-ignore\nimport {addNativePrefixedProperties, nativeMethods, nativeTree} from './patch-native.js';\n// prettier-ignore\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';\n// prettier-ignore\nimport {addShadyPrefixedProperties, applyPatches, patchShadowOnElement, patchElementProto} from './patch-prototypes.js';\n\nif (utils.settings.inUse) {\n const patch = utils.settings.hasDescriptors\n ? (n) => n\n : (node) => {\n patchInsideElementAccessors(node);\n patchOutsideElementAccessors(node);\n return node;\n };\n\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': patch,\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 // Ensure the node is wrapped. This should be used when `noPatch` is set\n // to ensure Shadow DOM compatible DOM operation.\n // Note, wrap falls back to patch so that it ensures API \"always just works\"\n 'wrap': utils.settings.noPatch ? wrap : patch,\n // When code should be compatible with `noPatch` `true` and `on-demand`\n // settings, `wrapIfNeeded` can be used for optimal performance (v. `wrap`)\n // for all DOM operations except the following: `appendChild` and\n // `insertBefore` (when the node is being moved from a location where it\n // was logically positioned in the DOM); when setting `className`/`class`;\n // when calling `querySelector|All`; when setting `textContent` or\n // `innerHTML`; `addEventListener`, `removeEventListener` and\n // `dispatchEvent`; and all scope specific API's like `getRootNode`,\n // `isConnected`, `slot`, `assignedSlot`, `assignedNodes`. Note,\n // `wrapIfNeeded` falls back to a pass through to preserve optimal\n // performance.\n 'wrapIfNeeded': utils.settings.noPatch === true ? 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 //\n // WARNING: When `noPatch` is set and the Custom Elements polyfill is\n // needed, the Custom Elements polyfill must be loaded before this\n // polyfill; however, when `noPatch` is not used, this polyfill should be\n // loaded before the Custom Elements polyfill. This is because\n // ShadyDOM captures DOM mutation methods and when `noPatch` is used,\n // ShadyDOM must call the mutation methods patched by the Custom Elements\n // polyfill or custom elements will not function as expected. When `noPatch`\n // is not used, the Custom Elements polyfill patches call through to the\n // ShadyDOM patches so ShadyDOM should be loaded first.\n 'noPatch': utils.settings.noPatch,\n 'patchOnDemand': utils.settings.patchOnDemand,\n 'nativeMethods': nativeMethods,\n 'nativeTree': nativeTree,\n 'patchElementProto': patchElementProto,\n // Use this setting to choose the implementation of `querySelector` and\n // `querySelectorAll`. The options provide different tradeoffs between\n // accuracy and performance, as explained below. More specifically, the\n // logical tree exposed by Shady DOM through the DOM APIs it wraps doesn't\n // match the structure of the tree seen by the browser (the 'real tree'), so\n // the degree to which the browser itself is used to match selectors affects\n // this tradeoff.\n //\n // - `undefined` (default): Shady DOM will walk the logical descendants of\n // the context element and call `matches` with the given selector to find\n // matching elements.\n //\n // This option is a balance between accuracy and performance. This option\n // will be able to match all logical descendants of the context element\n // (i.e. including descendants of unassigned nodes) but selectors are\n // matched against the real tree, so complex selectors may fail to match\n // since their combinators will attempt to match against the structure of\n // the real tree. Generally, you should only pass compound selectors when\n // using the default implementation. This implementation also breaks the\n // semantics of `:scope` because the wrapped `querySelector` call is\n // translated into many `matches` calls on different elements.\n //\n // - `'native'`: Shady DOM's wrapper for (e.g.) `querySelector` will call\n // into the native `querySelector` function and then filter out results that\n // are not in the same shadow root in the logical tree.\n //\n // This is the fastest option. This option will not match elements that\n // are logical descendants of unassigned nodes because they will not be in\n // the real tree, against which the browser matches the selector. Like the\n // default option, this option may not correctly match complex selectors\n // (i.e. those with combinators) due to the structural differences between\n // the real tree and the logical tree. This option preserves the semantics\n // of `:scope` because the context element of the call to the wrapper is\n // also the context element of the call to the native function.\n //\n // - `'selectorEngine'`: Shady DOM's wrapper for (e.g.) `querySelector` will\n // partially parse the given selector list and perform the tree-traversal\n // steps of a selector engine against the logical tree.\n //\n // This is the slowest and most accurate option. This option is able to\n // find all logical descendants of the context element by manually walking\n // the tree. This option is also able to correctly match complex selectors\n // because it does not rely on the browser to handle combinators. Despite\n // using `matches` to match compound selectors during selector evaluation,\n // this option preserves the semantics of `:scope` by only considering\n // compound selectors containing `:scope` to be matching if the context\n // element of the `matches` call is also the context element of the\n // wrapper call.\n //\n // However, the parser used for this option is not strictly correct.\n // Notable caveats include:\n //\n // - The parser assumes the selector list it's given is syntactically\n // correct. When given a selector that would not parse under a full\n // implementation, this implementation may fail silently.\n //\n // - Nested selectors are _not_ taken into consideration while walking\n // the tree. Each outer-most compound selector is tested against\n // candidate elements as a whole, without modification. This means that\n // selectors nested in arguments of functional pseudo-classes, such as\n // `a > b` in `:is(a > b)`, are still matched by the browser against the\n // real tree, not Shady DOM's logical tree.\n //\n // - `:scope` is only supported at the top-level. Particularly, if the\n // text `:scope` appears anywhere within a compound selector, then the\n // selector engine will only allow that compound selector to match the\n // context element. Having the text `:scope` inside a string\n // (`x[y=\":scope\"]`) or an argument to a functional pseudo-selector\n // (`:not(:scope > x)`) will likely break your selector.\n //\n // - The `:host` and `:host-context` pseudo-classes are not supported.\n //\n // - Comments are not supported. (e.g. `a /* b */ c`)\n //\n // - The (draft) column combinator is not supported. (e.g. `a || b`)\n 'querySelectorImplementation':\n utils.settings['querySelectorImplementation'],\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 } else if (utils.settings.patchOnDemand) {\n // In `on-demand` patching, do patch `attachShadow` and `shadowRoot`.\n // These are the only patched properties in `on-demand` mode and these\n // patches kick off patching \"on-demand\" for other nodes.\n patchShadowOnElement();\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","/**\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nexport const Document_createElement = window.Document.prototype.createElement;\nexport const Document_createElementNS =\n window.Document.prototype.createElementNS;\nexport const Document_importNode = window.Document.prototype.importNode;\n\nexport const Document_prepend = window.Document.prototype['prepend'];\nexport const Document_append = window.Document.prototype['append'];\nexport const DocumentFragment_prepend =\n window.DocumentFragment.prototype['prepend'];\nexport const DocumentFragment_append =\n window.DocumentFragment.prototype['append'];\nexport const Node_cloneNode = window.Node.prototype.cloneNode;\nexport const Node_appendChild = window.Node.prototype.appendChild;\nexport const Node_insertBefore = window.Node.prototype.insertBefore;\nexport const Node_removeChild = window.Node.prototype.removeChild;\nexport const Node_replaceChild = window.Node.prototype.replaceChild;\nexport const Node_textContent = Object.getOwnPropertyDescriptor(\n window.Node.prototype,\n 'textContent'\n);\nexport const Element_attachShadow = window.Element.prototype['attachShadow'];\nexport const Element_innerHTML = Object.getOwnPropertyDescriptor(\n window.Element.prototype,\n 'innerHTML'\n);\nexport const Element_getAttribute = window.Element.prototype.getAttribute;\nexport const Element_setAttribute = window.Element.prototype.setAttribute;\nexport const Element_removeAttribute = window.Element.prototype.removeAttribute;\nexport const Element_toggleAttribute = window.Element.prototype.toggleAttribute;\nexport const Element_getAttributeNS = window.Element.prototype.getAttributeNS;\nexport const Element_setAttributeNS = window.Element.prototype.setAttributeNS;\nexport const Element_removeAttributeNS =\n window.Element.prototype.removeAttributeNS;\nexport const Element_insertAdjacentElement =\n window.Element.prototype['insertAdjacentElement'];\nexport const Element_insertAdjacentHTML =\n window.Element.prototype['insertAdjacentHTML'];\nexport const Element_prepend = window.Element.prototype['prepend'];\nexport const Element_append = window.Element.prototype['append'];\nexport const Element_before = window.Element.prototype['before'];\nexport const Element_after = window.Element.prototype['after'];\nexport const Element_replaceWith = window.Element.prototype['replaceWith'];\nexport const Element_remove = window.Element.prototype['remove'];\nexport const HTMLElement = window.HTMLElement;\nexport const HTMLElement_innerHTML = Object.getOwnPropertyDescriptor(\n window.HTMLElement.prototype,\n 'innerHTML'\n);\nexport const HTMLElement_insertAdjacentElement =\n window.HTMLElement.prototype['insertAdjacentElement'];\nexport const HTMLElement_insertAdjacentHTML =\n window.HTMLElement.prototype['insertAdjacentHTML'];\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nconst reservedElementNameSet = new Set<string>();\n// IE11 does not support constructing a set using an iterable.\n[\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].forEach((item) => reservedElementNameSet.add(item));\n\nexport function isValidCustomElementName(localName: string) {\n const reserved = reservedElementNameSet.has(localName);\n const validForm = /^[a-z][.0-9_a-z]*-[-.0-9_a-z]*$/.test(localName);\n return !reserved && validForm;\n}\n\n// Note, IE11 doesn't have `document.contains`.\nconst nativeContains = document.contains\n ? document.contains.bind(document)\n : document.documentElement.contains.bind(document.documentElement);\n\nexport function isConnected(node: Node) {\n // Use `Node#isConnected`, if defined.\n const nativeValue = node.isConnected;\n if (nativeValue !== undefined) {\n return nativeValue;\n }\n // Optimization: It's significantly faster here to try to use `contains`,\n // especially on Edge/IE/\n if (nativeContains(node)) {\n return true;\n }\n\n let current: Node | undefined = node;\n while (\n current &&\n !(current.__CE_isImportDocument || current instanceof Document)\n ) {\n current =\n current.parentNode ||\n (window.ShadowRoot && current instanceof ShadowRoot\n ? current.host\n : undefined);\n }\n return !!(\n current &&\n (current.__CE_isImportDocument || current instanceof Document)\n );\n}\n\nexport function childrenFromFragment(\n fragment: DocumentFragment\n): Array<Element> {\n // Note, IE doesn't have `children` on document fragments.\n const nativeChildren = fragment.children;\n if (nativeChildren) {\n return Array.prototype.slice.call(nativeChildren);\n }\n const children: Array<Element> = [];\n for (let n = fragment.firstChild; n; n = n.nextSibling) {\n if (n.nodeType === Node.ELEMENT_NODE) {\n children.push(n as Element);\n }\n }\n return children;\n}\n\nfunction nextSiblingOrAncestorSibling(root: Node, start: Node) {\n let node: Node | null = start;\n while (node && node !== root && !node.nextSibling) {\n node = node.parentNode;\n }\n return !node || node === root ? null : node.nextSibling;\n}\n\nfunction nextNode(root: Node, start: Node) {\n return start.firstChild\n ? start.firstChild\n : nextSiblingOrAncestorSibling(root, start);\n}\n\nexport function walkDeepDescendantElements(\n root: Node,\n callback: (elem: Element) => void,\n visitedImports?: Set<Node>\n) {\n let node: Node | null = root;\n while (node) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as Element;\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 its root node available,\n // walk it.\n const importNode = (element as HTMLLinkElement).import;\n if (visitedImports === undefined) {\n visitedImports = new Set();\n }\n if (importNode instanceof Node && !visitedImports.has(importNode)) {\n // Prevent multiple walks of the same import root.\n visitedImports.add(importNode);\n\n for (\n let child = importNode.firstChild;\n child;\n child = child.nextSibling\n ) {\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 (\n let child = shadowRoot.firstChild;\n child;\n child = child.nextSibling\n ) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n }\n\n node = nextNode(root, node);\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementRegistry from './CustomElementRegistry.js';\nimport {CustomElementState as CEState} from './CustomElementState.js';\nimport * as Native from './Patch/Native.js';\nimport * as Utilities from './Utilities.js';\n\nconst NS_HTML = 'http://www.w3.org/1999/xhtml';\n\nexport default class CustomElementInternals {\n private readonly _patchesNode: Array<(node: Node) => void> = [];\n private readonly _patchesElement: Array<(elem: Element) => void> = [];\n private _hasPatches = false;\n public readonly shadyDomFastWalk: boolean;\n public readonly useDocumentConstructionObserver: boolean;\n\n constructor(options: {\n shadyDomFastWalk: boolean;\n noDocumentConstructionObserver: boolean;\n }) {\n this.shadyDomFastWalk = options.shadyDomFastWalk;\n this.useDocumentConstructionObserver = !options.noDocumentConstructionObserver;\n }\n\n forEachElement(\n node: Node,\n callback: (elem: Element) => void,\n visitedImports?: Set<Node>\n ) {\n const sd = window['ShadyDOM'];\n if (this.shadyDomFastWalk && sd && sd['inUse']) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as Element;\n callback(element);\n }\n // most easily gets to document, element, documentFragment\n if ((node as Element).querySelectorAll!) {\n const elements = sd['nativeMethods'].querySelectorAll.call(node, '*');\n for (let i = 0; i < elements.length; i++) {\n callback(elements[i]);\n }\n }\n } else {\n Utilities.walkDeepDescendantElements(node, callback, visitedImports);\n }\n }\n\n addNodePatch(patch: (node: Node) => void) {\n this._hasPatches = true;\n this._patchesNode.push(patch);\n }\n\n addElementPatch(patch: (element: Element) => void) {\n this._hasPatches = true;\n this._patchesElement.push(patch);\n }\n\n patchTree(node: Node) {\n if (!this._hasPatches) {\n return;\n }\n\n this.forEachElement(node, (element) => this.patchElement(element));\n }\n\n patchNode(node: Node) {\n if (!this._hasPatches) {\n return;\n }\n\n if (node.__CE_patched) {\n return;\n }\n node.__CE_patched = true;\n\n for (let i = 0; i < this._patchesNode.length; i++) {\n this._patchesNode[i](node);\n }\n }\n\n patchElement(element: Element) {\n if (!this._hasPatches) {\n return;\n }\n\n if (element.__CE_patched) {\n return;\n }\n element.__CE_patched = true;\n\n for (let i = 0; i < this._patchesNode.length; i++) {\n this._patchesNode[i](element);\n }\n\n for (let i = 0; i < this._patchesElement.length; i++) {\n this._patchesElement[i](element);\n }\n }\n\n connectTree(root: Node) {\n const elements: Array<Element> = [];\n\n this.forEachElement(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.upgradeReaction(element as HTMLElement);\n }\n }\n }\n\n disconnectTree(root: Node) {\n const elements: Array<Element> = [];\n\n this.forEachElement(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\n * that is already created but not customized (i.e. by the parser), does\n * *not* prevent the element from reading the 'final' (true) state of the\n * tree. For example, the element, during truly synchronous parsing /\n * construction would see that it contains no children as they have not yet\n * been inserted. However, this function does not modify the tree, the\n * element will (incorrectly) have children. Additionally, self-modification\n * restrictions for custom element constructors imposed by the DOM spec are\n * *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\n * and 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 patchAndUpgradeTree(\n root: Node,\n options: {\n visitedImports?: Set<Node>;\n upgrade?: (elem: HTMLElement) => void;\n } = {}\n ) {\n const visitedImports = options.visitedImports;\n const upgrade =\n options.upgrade || ((element) => this.upgradeReaction(element));\n\n const elements: Array<Element> = [];\n\n const gatherElements = (element: Element) => {\n if (this._hasPatches) {\n this.patchElement(element);\n }\n if (\n element.localName === 'link' &&\n element.getAttribute('rel') === 'import'\n ) {\n const importElem = element as HTMLLinkElement;\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 = importElem.import;\n\n if (importNode instanceof Node) {\n importNode.__CE_isImportDocument = true;\n // Connected links are associated with the global registry.\n importNode.__CE_registry = document.__CE_registry;\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\n // be walked. Wait for 'load' and walk it when it's ready.\n element.addEventListener('load', () => {\n const importNode = importElem.import!;\n\n if (importNode.__CE_documentLoadHandled) {\n return;\n }\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\n // to be added. Then, remove *this* link's import node so that we\n // can walk that import again, even if it was partially walked\n // later during the same `patchAndUpgradeTree` call.\n const clonedVisitedImports = new Set<Node>();\n if (visitedImports) {\n // IE11 does not support constructing a set using an iterable.\n visitedImports.forEach((item) => clonedVisitedImports.add(item));\n clonedVisitedImports.delete(importNode);\n }\n this.patchAndUpgradeTree(importNode, {\n visitedImports: clonedVisitedImports,\n upgrade,\n });\n });\n }\n } else {\n elements.push(element);\n }\n };\n\n // `forEachElement` populates (and internally checks against)\n // `visitedImports` when traversing a loaded import.\n this.forEachElement(root, gatherElements, visitedImports);\n\n for (let i = 0; i < elements.length; i++) {\n upgrade(elements[i] as HTMLElement);\n }\n }\n\n upgradeReaction(element: HTMLElement) {\n try {\n const definition = this._lookupACustomElementDefinition(\n element.ownerDocument!,\n element.localName\n );\n if (definition) {\n this._upgradeAnElement(element, definition);\n }\n } catch (e: unknown) {\n this.reportTheException(e);\n }\n }\n\n /**\n * @see https://html.spec.whatwg.org/multipage/custom-elements.html#concept-upgrade-an-element\n */\n private _upgradeAnElement(\n element: HTMLElement,\n definition: CustomElementDefinition\n ) {\n const currentState = element.__CE_state;\n if (currentState !== undefined) {\n return;\n }\n\n definition.constructionStack.push(element);\n\n try {\n try {\n const result = new definition.constructorFunction();\n if (result !== element) {\n throw new Error(\n 'The custom element constructor did not produce the element being upgraded.'\n );\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 // Check `hasAttributes` here to avoid iterating when it's not necessary.\n if (definition.attributeChangedCallback && element.hasAttributes()) {\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 connectedCallback(element: Element) {\n const definition = element.__CE_definition!;\n if (definition.connectedCallback) {\n try {\n definition.connectedCallback.call(element);\n } catch (e: unknown) {\n this.reportTheException(e);\n }\n }\n }\n\n disconnectedCallback(element: Element) {\n const definition = element.__CE_definition!;\n if (definition.disconnectedCallback) {\n try {\n definition.disconnectedCallback.call(element);\n } catch (e: unknown) {\n this.reportTheException(e);\n }\n }\n }\n\n attributeChangedCallback(\n element: Element,\n name: string,\n oldValue?: string | null,\n newValue?: string | null,\n namespace?: string | null\n ) {\n const definition = element.__CE_definition!;\n if (\n definition.attributeChangedCallback &&\n definition.observedAttributes.indexOf(name) > -1\n ) {\n try {\n definition.attributeChangedCallback.call(\n element,\n name,\n oldValue,\n newValue,\n namespace\n );\n } catch (e: unknown) {\n this.reportTheException(e);\n }\n }\n }\n\n /**\n * Runs HTML's 'look up a custom element definition', excluding the namespace\n * check.\n *\n * @see https://html.spec.whatwg.org/multipage/custom-elements.html#look-up-a-custom-element-definition\n */\n private _lookupACustomElementDefinition(\n doc: Document,\n localName: string\n ): CustomElementDefinition | undefined {\n // The document must be associated with a registry.\n const registry = doc.__CE_registry;\n if (!registry) {\n return;\n }\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 if (!doc.defaultView && !doc.__CE_isImportDocument) {\n return;\n }\n\n return registry.internal_localNameToDefinition(localName);\n }\n\n /**\n * Runs the DOM's 'create an element'. If namespace is not null, then the\n * native `createElementNS` is used. Otherwise, `createElement` is used.\n *\n * Note, the template polyfill only wraps `createElement`, preventing this\n * function from using `createElementNS` in all cases.\n *\n * @see https://dom.spec.whatwg.org/#concept-create-element\n */\n createAnElement(\n doc: Document,\n localName: string,\n namespace: string | null\n ): Element {\n const registry = doc.__CE_registry;\n // Only create custom elements if the document is associated with a\n // registry.\n if (registry && (namespace === null || namespace === NS_HTML)) {\n const definition = ((registry as unknown) as CustomElementRegistry).internal_localNameToDefinition(\n localName\n );\n if (definition) {\n try {\n const result = new definition.constructorFunction();\n\n // These conformance checks can't be performed when the user calls\n // the element's constructor themselves. However, this also true in\n // native implementations.\n\n if (\n result.__CE_state === undefined ||\n result.__CE_definition === undefined\n ) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n 'The returned value was not constructed with the HTMLElement ' +\n 'constructor.'\n );\n }\n\n if (result.namespaceURI !== NS_HTML) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n \"The constructed element's namespace must be the HTML \" +\n 'namespace.'\n );\n }\n\n // The following Errors should be DOMExceptions but DOMException\n // isn't constructible in all browsers.\n\n if (result.hasAttributes()) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n 'The constructed element must not have any attributes.'\n );\n }\n\n // ShadyDOM doesn't wrap `#hasChildNodes`, so we check `#firstChild`\n // instead.\n if (result.firstChild !== null) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n 'The constructed element must not have any children.'\n );\n }\n\n if (result.parentNode !== null) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n 'The constructed element must not have a parent node.'\n );\n }\n\n if (result.ownerDocument !== doc) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n \"The constructed element's owner document is incorrect.\"\n );\n }\n\n if (result.localName !== localName) {\n throw new Error(\n `Failed to construct '${localName}': ` +\n \"The constructed element's local name is incorrect.\"\n );\n }\n\n return result;\n } catch (e: unknown) {\n this.reportTheException(e);\n\n // When construction fails, a new HTMLUnknownElement is produced.\n // However, there's no direct way to create one, so we create a\n // regular HTMLElement and replace its prototype.\n const result =\n namespace === null\n ? Native.Document_createElement.call(doc, localName)\n : Native.Document_createElementNS.call(doc, namespace, localName);\n Object.setPrototypeOf(result, HTMLUnknownElement.prototype);\n result.__CE_state = CEState.failed;\n result.__CE_definition = undefined;\n this.patchElement(result);\n return result;\n }\n }\n }\n\n const result =\n namespace === null\n ? Native.Document_createElement.call(doc, localName)\n : Native.Document_createElementNS.call(doc, namespace, localName);\n this.patchElement(result);\n return result;\n }\n\n /**\n * Runs the DOM's 'report the exception' algorithm.\n *\n * @see https://html.spec.whatwg.org/multipage/webappapis.html#report-the-exception\n */\n reportTheException(arg: unknown) {\n interface ExtendedError extends Error {\n // Non-standard Safari properties.\n sourceURL?: string;\n line?: number;\n column?: number;\n\n // Non-standard Firefox properties.\n fileName?: string;\n lineNumber?: number;\n columnNumber?: number;\n }\n\n let message = '';\n let filename = '';\n let lineno = 0;\n let colno = 0;\n\n if (arg instanceof Error) {\n const error = arg as ExtendedError;\n message = error.message;\n filename = error.sourceURL || error.fileName || '';\n lineno = error.line || error.lineNumber || 0;\n colno = error.column || error.columnNumber || 0;\n } else {\n message = `Uncaught ${String(arg)}`;\n }\n\n let event: ErrorEvent | undefined = undefined;\n if (ErrorEvent.prototype.initErrorEvent === undefined) {\n event = new ErrorEvent('error', {\n cancelable: true,\n message,\n filename,\n lineno,\n colno,\n error: arg,\n });\n } else {\n event = document.createEvent('ErrorEvent') as ErrorEvent;\n // initErrorEvent(type, bubbles, cancelable, message, filename, line)\n event.initErrorEvent!('error', false, true, message, filename, lineno);\n // Hack for IE, where ErrorEvent#preventDefault does not set\n // #defaultPrevented to true.\n event.preventDefault = function (this: ErrorEvent) {\n Object.defineProperty(this, 'defaultPrevented', {\n configurable: true,\n get: function (this: ErrorEvent) {\n return true;\n },\n });\n };\n }\n\n if (event.error === undefined) {\n Object.defineProperty(event, 'error', {\n configurable: true,\n enumerable: true,\n get: function () {\n return arg;\n },\n });\n }\n\n window.dispatchEvent(event);\n if (!event.defaultPrevented) {\n // In 'report the exception', UAs may optionally write errors to the\n // console if their associated ErrorEvent isn't handled during dispatch\n // (indicated by calling `preventDefault`). In practice, these errors are\n // always displayed.\n console.error(arg);\n }\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from './CustomElementInternals.js';\nimport CustomElementRegistry from './CustomElementRegistry.js';\nimport PatchDocument from './Patch/Document.js';\nimport PatchDocumentFragment from './Patch/DocumentFragment.js';\nimport PatchElement from './Patch/Element.js';\nimport PatchHTMLElement from './Patch/HTMLElement.js';\nimport PatchNode from './Patch/Node.js';\n\nconst priorCustomElements = window['customElements'];\n\nfunction installPolyfill() {\n const noDocumentConstructionObserver = !!priorCustomElements?.[\n 'noDocumentConstructionObserver'\n ];\n const shadyDomFastWalk = !!priorCustomElements?.['shadyDomFastWalk'];\n\n const internals = new CustomElementInternals({\n noDocumentConstructionObserver,\n shadyDomFastWalk,\n });\n\n PatchHTMLElement(internals);\n PatchDocument(internals);\n PatchDocumentFragment(internals);\n PatchNode(internals);\n PatchElement(internals);\n\n window[\n 'CustomElementRegistry'\n ] = (CustomElementRegistry as unknown) as typeof window['CustomElementRegistry'];\n\n const customElements = new CustomElementRegistry(internals);\n\n // The main document is associated with the global registry.\n document.__CE_registry = customElements;\n\n Object.defineProperty(window, 'customElements', {\n configurable: true,\n enumerable: true,\n value: customElements,\n });\n}\n\nif (\n !priorCustomElements ||\n priorCustomElements['forcePolyfill'] ||\n typeof priorCustomElements['define'] != 'function' ||\n typeof priorCustomElements['get'] != 'function'\n) {\n installPolyfill();\n}\n\n// This is NOT public API and is only meant to work around a GC bug in older\n// versions of Safari that randomly removes the polyfill during tests.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(window as any)['__CE_installPolyfill'] = installPolyfill;\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nexport const CustomElementState = {\n custom: 1,\n failed: 2,\n} as const;\nexport type CustomElementState =\n | typeof CustomElementState.custom\n | typeof CustomElementState.failed;\n\nexport default CustomElementState;\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nexport default class Deferred<T> {\n private _value: T | undefined = undefined;\n\n private _resolve!: (val: T) => void;\n\n private readonly _promise: Promise<T>;\n constructor() {\n this._promise = new Promise((resolve) => {\n this._resolve = resolve;\n });\n }\n\n resolve(value: T) {\n if (this._value) {\n throw new Error('Already resolved.');\n }\n\n this._value = value;\n this._resolve(value);\n }\n\n toPromise() {\n return this._promise;\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from './CustomElementInternals.js';\n\nexport default class DocumentConstructionObserver {\n private readonly _internals: CustomElementInternals;\n private readonly _document: Document;\n private _observer: MutationObserver | undefined = undefined;\n constructor(internals: CustomElementInternals, doc: Document) {\n this._internals = internals;\n this._document = doc;\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\n // inline 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 private _handleMutations(mutations: ReadonlyArray<MutationRecord>) {\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","/**\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport {AlreadyConstructedMarkerType} from './AlreadyConstructedMarker.js';\nimport CustomElementInternals from './CustomElementInternals.js';\nimport Deferred from './Deferred.js';\nimport DocumentConstructionObserver from './DocumentConstructionObserver.js';\nimport * as Utilities from './Utilities.js';\n\ninterface ElementConstructor {\n new (): HTMLElement;\n observedAttributes?: Array<string>;\n}\ntype ConstructorGetter = () => ElementConstructor;\n\n/**\n * @unrestricted\n */\nexport default class CustomElementRegistry {\n private readonly _localNameToConstructorGetter = new Map<\n string,\n ConstructorGetter\n >();\n private readonly _localNameToDefinition = new Map<\n string,\n CustomElementDefinition\n >();\n private readonly _constructorToDefinition = new Map<\n ElementConstructor,\n CustomElementDefinition\n >();\n private _elementDefinitionIsRunning = false;\n private readonly _internals: CustomElementInternals;\n private readonly _whenDefinedDeferred = new Map<\n string,\n Deferred<undefined>\n >();\n\n /**\n * The default flush callback triggers the document walk synchronously.\n */\n private _flushCallback: (fn: () => void) => void = (fn) => fn();\n private _flushPending = false;\n\n /**\n * A map from `localName`s of definitions that were defined *after* the\n * last flush to unupgraded elements matching that definition, in document\n * order. Entries are added to this map when a definition is registered,\n * but the list of elements is only populated during a flush after which\n * all of the entries are removed. DO NOT edit outside of `#_flush`.\n */\n private readonly _unflushedLocalNames: Array<string> = [];\n\n private readonly _documentConstructionObserver:\n | DocumentConstructionObserver\n | undefined;\n\n constructor(internals: CustomElementInternals) {\n this._internals = internals;\n this._documentConstructionObserver = internals.useDocumentConstructionObserver\n ? new DocumentConstructionObserver(internals, document)\n : undefined;\n }\n\n polyfillDefineLazy(localName: string, constructorGetter: ConstructorGetter) {\n if (!(constructorGetter instanceof Function)) {\n throw new TypeError(\n 'Custom element constructor getters must be functions.'\n );\n }\n this.internal_assertCanDefineLocalName(localName);\n this._localNameToConstructorGetter.set(localName, constructorGetter);\n this._unflushedLocalNames.push(localName);\n // If we've already called the flush callback and it hasn't called back\n // yet, don't call it again.\n if (!this._flushPending) {\n this._flushPending = true;\n this._flushCallback(() => this._flush());\n }\n }\n\n define(localName: string, constructor: Function) {\n if (!(constructor instanceof Function)) {\n throw new TypeError('Custom element constructors must be functions.');\n }\n\n this.internal_assertCanDefineLocalName(localName);\n\n this.internal_reifyDefinition(localName, constructor as ElementConstructor);\n this._unflushedLocalNames.push(localName);\n // If we've already called the flush callback and it hasn't called back\n // yet, don't call it again.\n if (!this._flushPending) {\n this._flushPending = true;\n this._flushCallback(() => this._flush());\n }\n }\n\n internal_assertCanDefineLocalName(localName: string) {\n if (!Utilities.isValidCustomElementName(localName)) {\n throw new SyntaxError(`The element name '${localName}' is not valid.`);\n }\n\n if (this.internal_localNameToDefinition(localName)) {\n throw new Error(\n `A custom element with name ` +\n `'${localName}' has already been defined.`\n );\n }\n\n if (this._elementDefinitionIsRunning) {\n throw new Error('A custom element is already being defined.');\n }\n }\n\n internal_reifyDefinition(localName: string, constructor: ElementConstructor) {\n this._elementDefinitionIsRunning = true;\n\n let connectedCallback: CustomElementDefinition['connectedCallback'];\n let disconnectedCallback: CustomElementDefinition['disconnectedCallback'];\n let adoptedCallback: CustomElementDefinition['adoptedCallback'];\n let attributeChangedCallback: CustomElementDefinition['attributeChangedCallback'];\n let observedAttributes: CustomElementDefinition['observedAttributes'];\n try {\n const prototype = constructor.prototype;\n if (!(prototype instanceof Object)) {\n throw new TypeError(\n \"The custom element constructor's prototype is not an object.\"\n );\n }\n\n type CEReactionCallback =\n | 'connectedCallback'\n | 'disconnectedCallback'\n | 'adoptedCallback'\n | 'attributeChangedCallback';\n const getCallback = function getCallback(name: CEReactionCallback) {\n const callbackValue = prototype[name];\n if (\n callbackValue !== undefined &&\n !(callbackValue instanceof Function)\n ) {\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` should not be read unless an\n // `attributesChangedCallback` exists\n observedAttributes =\n (attributeChangedCallback && constructor['observedAttributes']) || [];\n // eslint-disable-next-line no-useless-catch\n } catch (e) {\n throw e;\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: [] as Array<\n HTMLElement | AlreadyConstructedMarkerType\n >,\n };\n\n this._localNameToDefinition.set(localName, definition);\n this._constructorToDefinition.set(\n definition.constructorFunction,\n definition\n );\n\n return definition;\n }\n\n upgrade(node: Node): void {\n this._internals.patchAndUpgradeTree(node);\n }\n\n private _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) {\n return;\n }\n this._flushPending = false;\n\n /**\n * Unupgraded elements with definitions that were defined *before* the last\n * flush, in document order.\n */\n const elementsWithStableDefinitions: Array<HTMLElement> = [];\n\n const unflushedLocalNames = this._unflushedLocalNames;\n const elementsWithPendingDefinitions = new Map<\n string,\n Array<HTMLElement>\n >();\n for (let i = 0; i < unflushedLocalNames.length; i++) {\n elementsWithPendingDefinitions.set(unflushedLocalNames[i], []);\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) {\n return;\n }\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\n // it to the list of elements with stable definitions that need to be\n // upgraded.\n } else if (this._localNameToDefinition.has(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.upgradeReaction(elementsWithStableDefinitions[i]);\n }\n\n // Upgrade elements with 'pending' definitions in the order they were\n // defined.\n for (let i = 0; i < unflushedLocalNames.length; i++) {\n const localName = unflushedLocalNames[i];\n const pendingUpgradableElements = elementsWithPendingDefinitions.get(\n localName\n )!;\n\n // Attempt to upgrade all applicable elements.\n for (let i = 0; i < pendingUpgradableElements.length; i++) {\n this._internals.upgradeReaction(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 unflushedLocalNames.length = 0;\n }\n\n get(localName: string): undefined | {new (): HTMLElement} {\n const definition = this.internal_localNameToDefinition(localName);\n if (definition) {\n return definition.constructorFunction;\n }\n\n return undefined;\n }\n\n whenDefined(localName: string): Promise<void> {\n if (!Utilities.isValidCustomElementName(localName)) {\n return Promise.reject(\n new SyntaxError(`'${localName}' is not a valid custom element name.`)\n );\n }\n\n const prior = this._whenDefinedDeferred.get(localName);\n if (prior) {\n return prior.toPromise();\n }\n\n const deferred = new Deferred<undefined>();\n this._whenDefinedDeferred.set(localName, deferred);\n\n // Resolve immediately if the given local name has a regular or lazy\n // definition *and* the full document walk to upgrade elements with that\n // local name has already happened.\n //\n // The behavior of the returned promise differs between the lazy and the\n // non-lazy cases if the definition fails. Normally, the definition would\n // fail synchronously and no pending promises would resolve. However, if\n // the definition is lazy but has not yet been reified, the promise is\n // resolved early here even though it might fail later when reified.\n const anyDefinitionExists =\n this._localNameToDefinition.has(localName) ||\n this._localNameToConstructorGetter.has(localName);\n const definitionHasFlushed =\n this._unflushedLocalNames.indexOf(localName) === -1;\n if (anyDefinitionExists && definitionHasFlushed) {\n deferred.resolve(undefined);\n }\n\n return deferred.toPromise();\n }\n\n polyfillWrapFlushCallback(outer: (fn: () => void) => void) {\n if (this._documentConstructionObserver) {\n this._documentConstructionObserver.disconnect();\n }\n const inner = this._flushCallback;\n this._flushCallback = (flush) => outer(() => inner(flush));\n }\n\n internal_localNameToDefinition(\n localName: string\n ): CustomElementDefinition | undefined {\n const existingDefinition = this._localNameToDefinition.get(localName);\n if (existingDefinition) {\n return existingDefinition;\n }\n\n const constructorGetter = this._localNameToConstructorGetter.get(localName);\n if (constructorGetter) {\n this._localNameToConstructorGetter.delete(localName);\n try {\n return this.internal_reifyDefinition(localName, constructorGetter());\n } catch (e: unknown) {\n this._internals.reportTheException(e);\n }\n }\n\n return undefined;\n }\n\n internal_constructorToDefinition(\n constructor: ElementConstructor\n ): CustomElementDefinition | undefined {\n return this._constructorToDefinition.get(constructor);\n }\n}\n\n// Closure compiler exports.\n/* eslint-disable no-self-assign */\nCustomElementRegistry.prototype['define'] =\n CustomElementRegistry.prototype.define;\nCustomElementRegistry.prototype['upgrade'] =\n CustomElementRegistry.prototype.upgrade;\nCustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;\nCustomElementRegistry.prototype['whenDefined'] =\n CustomElementRegistry.prototype.whenDefined;\nCustomElementRegistry.prototype['polyfillDefineLazy'] =\n CustomElementRegistry.prototype.polyfillDefineLazy;\nCustomElementRegistry.prototype['polyfillWrapFlushCallback'] =\n CustomElementRegistry.prototype.polyfillWrapFlushCallback;\n/* eslint-enable no-self-assign */\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\ntype NativeMethod = (this: Node, ...args: Array<Node | string>) => void;\n\ninterface ParentNodeNativeMethods {\n prepend: NativeMethod;\n append: NativeMethod;\n}\n\nexport default function (\n internals: CustomElementInternals,\n destination: ParentNode,\n builtIn: ParentNodeNativeMethods\n) {\n function appendPrependPatch(builtInMethod: NativeMethod): NativeMethod {\n return function (this: Node, ...nodes) {\n /**\n * A copy of `nodes`, with any DocumentFragment replaced by its children.\n */\n const flattenedNodes: Array<Node | string> = [];\n\n /**\n * Elements in `nodes` that were connected before this call.\n */\n const connectedElements: Array<Node> = [];\n\n for (let 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 destination.prepend = appendPrependPatch(builtIn.prepend);\n }\n\n if (builtIn.append !== undefined) {\n 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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from '../CustomElementInternals.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\nimport * as Native from './Native.js';\n\nexport default function (internals: CustomElementInternals) {\n Document.prototype.createElement = function (\n this: Document,\n localName: string\n ) {\n return internals.createAnElement(this, localName, null);\n } as typeof Document.prototype.createElement;\n\n Document.prototype.importNode = function <T extends Node>(\n this: Document,\n node: T,\n deep?: boolean\n ): T {\n const clone = Native.Document_importNode.call(this, node, !!deep) as T;\n // Only create custom elements if this document is associated with the\n // registry.\n if (!this.__CE_registry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n };\n\n Document.prototype.createElementNS = function (\n this: Document,\n namespace: string | null,\n localName: string\n ) {\n return internals.createAnElement(this, localName, namespace);\n } as typeof Document.prototype.createElementNS;\n\n PatchParentNode(internals, Document.prototype, {\n prepend: Native.Document_prepend,\n append: Native.Document_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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\ntype NativeMethod = (this: ChildNode, ...args: Array<Node | string>) => void;\n\ninterface ChildNodeNativeMethods {\n before: NativeMethod;\n after: NativeMethod;\n replaceWith: NativeMethod;\n remove: (this: ChildNode) => void;\n}\n\nexport default function (\n internals: CustomElementInternals,\n destination: ChildNode,\n builtIn: ChildNodeNativeMethods\n) {\n function beforeAfterPatch(builtInMethod: NativeMethod): NativeMethod {\n return function (this: ChildNode, ...nodes) {\n const flattenedNodes: Array<string | Node> = [];\n const connectedElements: Array<Node> = [];\n\n for (let 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 destination.before = beforeAfterPatch(builtIn.before);\n }\n\n if (builtIn.after !== undefined) {\n destination.after = beforeAfterPatch(builtIn.after);\n }\n\n if (builtIn.replaceWith !== undefined) {\n destination.replaceWith = function (\n this: ChildNode,\n ...nodes: Array<Node | string>\n ) {\n /**\n * A copy of `nodes`, with any DocumentFragment replaced by its children.\n */\n const flattenedNodes: Array<Node | string> = [];\n\n /**\n * Elements in `nodes` that were connected before this call.\n */\n const connectedElements: Array<Node> = [];\n\n for (let 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 destination.remove = function (this: ChildNode) {\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\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchChildNode from './Interface/ChildNode.js';\nimport PatchParentNode from './Interface/ParentNode.js';\nimport * as Native from './Native.js';\n\nexport default function (internals: CustomElementInternals) {\n if (Native.Element_attachShadow) {\n Element.prototype.attachShadow = function (\n this: Element,\n init: ShadowRootInit\n ) {\n const shadowRoot = Native.Element_attachShadow.call(this, init);\n internals.patchNode(shadowRoot);\n this.__CE_shadowRoot = shadowRoot;\n return shadowRoot;\n };\n }\n\n function patch_innerHTML(\n destination: Element,\n baseDescriptor: PropertyDescriptor\n ) {\n Object.defineProperty(destination, 'innerHTML', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: function (this: Element, 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 let removedElements: undefined | Array<Element> = undefined;\n if (isConnected) {\n removedElements = [];\n internals.forEachElement(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_registry) {\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 internals.addElementPatch(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: function (this: Element) {\n return (Native.Node_cloneNode.call(this, true) as Element).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: function (this: Element, 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 const content = isTemplate\n ? (this as HTMLTemplateElement).content\n : this;\n const rawElement = Native.Document_createElementNS.call(\n document,\n this.namespaceURI,\n this.localName\n );\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\n ? (rawElement as HTMLTemplateElement).content\n : rawElement;\n while (container.childNodes.length > 0) {\n Native.Node_appendChild.call(content, container.childNodes[0]);\n }\n },\n });\n });\n }\n\n Element.prototype.setAttribute = function (this: Element, 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 Element.prototype.setAttributeNS = function (\n this: Element,\n namespace,\n name,\n newValue\n ) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttributeNS.call(\n this,\n namespace,\n name,\n newValue\n );\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(\n this,\n name,\n oldValue,\n newValue,\n namespace\n );\n };\n\n Element.prototype.removeAttribute = function (this: Element, 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 if (Native.Element_toggleAttribute) {\n Element.prototype.toggleAttribute = function (\n this: Element,\n name,\n force?: boolean | undefined\n ) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_toggleAttribute.call(this, name, force);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n const hadAttribute = oldValue !== null;\n const hasAttribute = Native.Element_toggleAttribute.call(\n this,\n name,\n force\n );\n if (hadAttribute !== hasAttribute) {\n internals.attributeChangedCallback(\n this,\n name,\n oldValue,\n hasAttribute ? '' : null,\n null\n );\n }\n return hasAttribute;\n };\n }\n\n Element.prototype.removeAttributeNS = function (\n this: Element,\n namespace,\n name\n ) {\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(\n this,\n name,\n oldValue,\n newValue,\n namespace\n );\n }\n };\n\n function patch_insertAdjacentElement(\n destination: Element,\n baseMethod: Element['insertAdjacentElement']\n ) {\n destination.insertAdjacentElement = function (\n this: Element,\n position,\n element\n ) {\n const wasConnected = Utilities.isConnected(element);\n const insertedElement = 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(\n HTMLElement.prototype,\n Native.HTMLElement_insertAdjacentElement\n );\n } else if (Native.Element_insertAdjacentElement) {\n patch_insertAdjacentElement(\n Element.prototype,\n Native.Element_insertAdjacentElement\n );\n }\n\n function patch_insertAdjacentHTML(\n destination: Element,\n baseMethod: Element['insertAdjacentHTML']\n ) {\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 */\n function upgradeNodesInRange(start: Node, end: Node | null) {\n const nodes = [];\n for (let node: 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 destination.insertAdjacentHTML = function (this: Element, position, text) {\n const strPosition = position.toLowerCase();\n\n if (strPosition === 'beforebegin') {\n const marker = this.previousSibling;\n baseMethod.call(this, strPosition, text);\n upgradeNodesInRange(marker || this.parentNode!.firstChild!, this);\n } else if (strPosition === 'afterbegin') {\n const marker = this.firstChild;\n baseMethod.call(this, strPosition, text);\n upgradeNodesInRange(this.firstChild!, marker);\n } else if (strPosition === 'beforeend') {\n const marker = this.lastChild;\n baseMethod.call(this, strPosition, text);\n upgradeNodesInRange(marker || this.firstChild!, null);\n } else if (strPosition === 'afterend') {\n const marker = this.nextSibling;\n baseMethod.call(this, strPosition, text);\n upgradeNodesInRange(this.nextSibling!, marker);\n } else {\n throw new SyntaxError(\n `The value provided (${String(strPosition)}) is ` +\n \"not one of 'beforebegin', 'afterbegin', 'beforeend', or 'afterend'.\"\n );\n }\n };\n }\n\n if (Native.HTMLElement_insertAdjacentHTML) {\n patch_insertAdjacentHTML(\n HTMLElement.prototype,\n Native.HTMLElement_insertAdjacentHTML\n );\n } else if (Native.Element_insertAdjacentHTML) {\n patch_insertAdjacentHTML(\n Element.prototype,\n Native.Element_insertAdjacentHTML\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","/**\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\n/**\n * Represents the 'already constructed marker' used in custom\n * element construction stacks.\n *\n * https://html.spec.whatwg.org/#concept-already-constructed-marker\n */\nconst alreadyConstructedMarker = {} as {_alreadyConstructedMarker: never};\n\nexport default alreadyConstructedMarker;\nexport type AlreadyConstructedMarkerType = typeof alreadyConstructedMarker;\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport AlreadyConstructedMarker from '../AlreadyConstructedMarker.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport * as Native from './Native.js';\n\nexport default function (internals: CustomElementInternals) {\n const PatchedHTMLElement = function HTMLElement(this: HTMLElement) {\n // This should really be `new.target` but `new.target` can't be\n // emulated in ES5. Assuming the user keeps the default value of the\n // constructor's prototype's `constructor` property, this is\n // equivalent.\n const constructor = this.constructor as {new (): HTMLElement};\n\n // Always look up the definition from the global registry.\n const registry = document.__CE_registry!;\n const definition = registry.internal_constructorToDefinition(constructor);\n if (!definition) {\n throw new Error(\n 'Failed to construct a custom element: ' +\n 'The constructor was not registered with `customElements`.'\n );\n }\n\n const constructionStack = definition.constructionStack;\n\n if (constructionStack.length === 0) {\n const element = Native.Document_createElement.call(\n document,\n definition.localName\n ) as HTMLElement;\n Object.setPrototypeOf(element, constructor.prototype as typeof element);\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n internals.patchElement(element);\n return element;\n }\n\n const lastIndex = constructionStack.length - 1;\n const element = constructionStack[lastIndex];\n if (element === AlreadyConstructedMarker) {\n const localName = definition.localName;\n throw new Error(\n `Failed to construct '${localName}': ` +\n 'This element was already constructed.'\n );\n }\n const toConstructElement = element as HTMLElement;\n constructionStack[lastIndex] = AlreadyConstructedMarker;\n\n Object.setPrototypeOf(\n toConstructElement,\n constructor.prototype as typeof toConstructElement\n );\n internals.patchElement(toConstructElement);\n\n return toConstructElement;\n };\n\n PatchedHTMLElement.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: PatchedHTMLElement,\n });\n\n window['HTMLElement'] = (PatchedHTMLElement as unknown) as typeof HTMLElement;\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\nimport * as Native from './Native.js';\n\nexport default function (internals: CustomElementInternals) {\n // `Node#nodeValue` is implemented on `Attr`.\n // `Node#textContent` is implemented on `Attr`, `Element`.\n\n Node.prototype.insertBefore = function <T extends Node>(\n this: Node,\n node: T,\n refNode: Node | null\n ) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Utilities.childrenFromFragment(node);\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 as T;\n }\n\n const nodeWasConnectedElement =\n node instanceof Element && Utilities.isConnected(node);\n const nativeResult = Native.Node_insertBefore.call(\n this,\n node,\n refNode\n ) as T;\n\n if (nodeWasConnectedElement) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n };\n\n Node.prototype.appendChild = function <T extends Node>(this: Node, node: T) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Utilities.childrenFromFragment(node);\n const nativeResult = Native.Node_appendChild.call(this, node) as T;\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 nodeWasConnectedElement =\n node instanceof Element && Utilities.isConnected(node);\n const nativeResult = Native.Node_appendChild.call(this, node) as T;\n\n if (nodeWasConnectedElement) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n };\n\n Node.prototype.cloneNode = function (this: Node, 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_registry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n };\n\n Node.prototype.removeChild = function <T extends Node>(this: Node, node: T) {\n const nodeWasConnectedElement =\n node instanceof Element && Utilities.isConnected(node);\n const nativeResult = Native.Node_removeChild.call(this, node) as T;\n\n if (nodeWasConnectedElement) {\n internals.disconnectTree(node);\n }\n\n return nativeResult;\n };\n\n Node.prototype.replaceChild = function <T extends Node>(\n this: Node,\n nodeToInsert: Node,\n nodeToRemove: T\n ) {\n if (nodeToInsert instanceof DocumentFragment) {\n const insertedNodes = Utilities.childrenFromFragment(nodeToInsert);\n const nativeResult = Native.Node_replaceChild.call(\n this,\n nodeToInsert,\n nodeToRemove\n ) as T;\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 nodeToInsertWasConnectedElement =\n nodeToInsert instanceof Element && Utilities.isConnected(nodeToInsert);\n const nativeResult = Native.Node_replaceChild.call(\n this,\n nodeToInsert,\n nodeToRemove\n ) as T;\n const thisIsConnected = Utilities.isConnected(this);\n\n if (thisIsConnected) {\n internals.disconnectTree(nodeToRemove);\n }\n\n if (nodeToInsertWasConnectedElement) {\n internals.disconnectTree(nodeToInsert);\n }\n\n if (thisIsConnected) {\n internals.connectTree(nodeToInsert);\n }\n\n return nativeResult;\n };\n\n function patch_textContent(\n destination: Node,\n baseDescriptor: PropertyDescriptor\n ) {\n Object.defineProperty(destination, 'textContent', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: function (this: Node, 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.addNodePatch(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: function (this: Node) {\n const parts: Array<string | null> = [];\n\n for (let n = this.firstChild; n; n = n.nextSibling) {\n if (n.nodeType === Node.COMMENT_NODE) {\n continue;\n }\n parts.push(n.textContent);\n }\n\n return parts.join('');\n },\n set: function (this: Node, assignedValue) {\n while (this.firstChild) {\n Native.Node_removeChild.call(this, this.firstChild);\n }\n // `textContent = null | undefined | ''` does not result in\n // a TextNode childNode\n if (assignedValue != null && assignedValue !== '') {\n Native.Node_appendChild.call(\n this,\n document.createTextNode(assignedValue)\n );\n }\n },\n });\n });\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\n * http://polymer.github.io/LICENSE.txt The complete set of authors may be found\n * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may\n * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by\n * Google as part of the polymer project is also subject to an additional IP\n * rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from '../CustomElementInternals.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\nimport * as Native from './Native.js';\n\nexport default function (internals: CustomElementInternals) {\n PatchParentNode(internals, DocumentFragment.prototype, {\n prepend: Native.DocumentFragment_prepend,\n append: Native.DocumentFragment_append,\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']\n ? node['previous']['end']\n : 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'] = 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; 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; i < l && (r = r$[i]); i++) {\n cssText = stringify(r, preserveProperties, cssText);\n }\n } else {\n cssText = preserveProperties\n ? 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 (\n Boolean(r) &&\n Boolean(r['selector']) &&\n r['selector'].indexOf(VAR_START) === 0\n );\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.replace(RX.customProp, '').replace(RX.mixinProp, '');\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomPropApply(cssText) {\n return cssText.replace(RX.mixinApply, '').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 = !(\n window['ShadyDOM'] && window['ShadyDOM']['inUse']\n);\n/** @type {boolean} */\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_ =\n nativeShadow ||\n Boolean(\n !navigator.userAgent.match(/AppleWebKit\\/601|Edge\\/15/) &&\n window.CSS &&\n CSS.supports &&\n CSS.supports('box-shadow', '0 0 0 var(--foo)')\n );\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(\n window.ShadyCSS && window.ShadyCSS.disableRuntime\n);\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","/**\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 = document.createElement('style');\n newStyle.setAttribute('shady-unscoped', '');\n newStyle.textContent = text;\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","/**\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 @typescript-eslint/no-unused-vars\nimport {MEDIA_MATCH} from './common-regex.js';\n// prettier-ignore\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 (\n Boolean(rule['parent']) && rule['parent']['type'] === types.KEYFRAMES_RULE\n );\n}\n\n/**\n * @param {StyleNode} node\n * @param {Function=} styleRuleCallback\n * @param {Function=} keyframesRuleCallback\n * @param {boolean=} onlyActiveRules\n */\nexport function forEachRule(\n node,\n styleRuleCallback,\n keyframesRuleCallback,\n onlyActiveRules\n) {\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 && 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(\n ' Shady DOM styles for ' + moniker + ' '\n );\n let after = lastHeadApplyNode ? 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) || 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(\n element,\n 'class',\n value\n );\n }\n}\n\n/**\n * @type {function(*):*}\n */\nexport const wrap =\n (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 = '',\n 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(\n 'style'\n ));\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 =\n 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 =\n 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 @typescript-eslint/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 /** @return {string} */\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$ =\n /** @type {!ParentNode} */ (startNode).children || 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 (!(/** @type {?} */ (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, 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[\n 'selector'\n ] = /** @type {?} */ (rule).transformedSelector = this._transformRuleCss(\n rule,\n transformer,\n scope,\n hostScope\n );\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(\n (acc, cur, idx) => acc + cur + parts[idx + 1],\n parts[0]\n );\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(\n NTH,\n (m, type, inner) => `:${type}(${inner.replace(/\\s/g, '')})`\n );\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 selector = selector.replace(\n DIR_PAREN,\n (m, before, dir, after) =>\n `[dir=\"${dir}\"] ${before}${after}, ${before}[dir=\"${dir}\"]${after}`\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\n ? 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 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 }\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 }\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 {parse, StyleNode} from './css-parse.js';\n// prettier-ignore\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';\n// prettier-ignore\nimport {ensureStylePlaceholder, getStylePlaceholder} from './style-placeholder.js';\nimport StyleInfo from './style-info.js';\nimport StyleCache from './style-cache.js';\n// prettier-ignore\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';\n// prettier-ignore\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nimport {CustomStyleInterfaceInterface, CustomStyleProvider} from './custom-style-interface.js';\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(\n this._documentOwner,\n new StyleInfo(ast)\n );\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 =\n 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(\n info,\n template['_styleAst'],\n root,\n placeholder,\n cssBuild,\n optimalBuild ? cssText : ''\n );\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(\n info,\n rules,\n shadowroot,\n placeholder,\n cssBuild,\n cssText\n ) {\n cssText = StyleTransformer.elementStyles(\n info,\n rules,\n null,\n cssBuild,\n cssText\n );\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 /**\n * Returns a boolean that indicates if styles need to be reprocessed because\n * the apply shim is now available.\n * @return {boolean}\n */\n _ensureApplyShim() {\n if (!this._applyShim && window.ShadyCSS && window.ShadyCSS.ApplyShim) {\n this._applyShim = /** @type {!Object} */ (window.ShadyCSS.ApplyShim);\n this._applyShim['invalidCallback'] = ApplyShimUtils.invalidate;\n return true;\n }\n return false;\n }\n _ensureCustomStyleInterface() {\n if (this._customStyleInterface) {\n return;\n } else if (window.ShadyCSS && window.ShadyCSS.CustomStyleInterface) {\n this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */ (window\n .ShadyCSS.CustomStyleInterface);\n /** @type {function(!HTMLStyleElement)} */\n this._customStyleInterface['transformCallback'] = (style) => {\n this.transformCustomStyleForDocument(style);\n };\n this._customStyleInterface['validateCallback'] = () => {\n requestAnimationFrame(() => {\n if (\n this._customStyleInterface['enqueued'] ||\n this._elementsHaveApplied\n ) {\n this.flushCustomStyles();\n }\n });\n };\n }\n }\n /**\n * Returns a boolean that indicates if styles need to be reprocessed because\n * the apply shim is now available.\n * @return {boolean}\n */\n _ensure() {\n const needsApplyShimUpdate = this._ensureApplyShim();\n this._ensureCustomStyleInterface();\n return needsApplyShimUpdate;\n }\n /**\n * Flush and apply custom styles to document\n */\n flushCustomStyles() {\n if (disableRuntime) {\n return;\n }\n const needsApplyShimUpdate = 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 (!needsApplyShimUpdate && !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._reorderCustomStylesRules(customStyles);\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 * Reorder of custom styles for Custom Property shim\n * @param {!Array<!CustomStyleProvider>} customStyles\n */\n _reorderCustomStylesRules(customStyles) {\n const styles = customStyles\n .map((c) => this._customStyleInterface['getStyleForCustomStyle'](c))\n .filter((s) => !!s);\n // sort styles in document order\n styles.sort((a, b) => {\n // use `b.compare(a)` to be more straightforward\n const position = b.compareDocumentPosition(a);\n if (position & Node.DOCUMENT_POSITION_FOLLOWING) {\n // A is after B, A should be higher sorted\n return 1;\n } else if (position & Node.DOCUMENT_POSITION_PRECEDING) {\n // A is before B, A should be lower sorted\n return -1;\n } else {\n return 0;\n }\n });\n // sort ast ordering for document\n this._documentOwnerStyleInfo.styleRules['rules'] = styles.map((s) =>\n StyleUtil.rulesForStyle(s)\n );\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 = 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 (\n styleInfo.ownStylePropertyNames &&\n styleInfo.ownStylePropertyNames.length\n ) {\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 (\n template &&\n template._style &&\n !ApplyShimUtils.templateIsValid(template)\n ) {\n // update template\n if (!ApplyShimUtils.templateIsValidating(template)) {\n this._ensure();\n this._applyShim &&\n this._applyShim['transformRules'](template['_styleAst'], is);\n template._style.textContent = StyleTransformer.elementStyles(\n host,\n styleInfo.styleRules\n );\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(\n host,\n styleInfo.styleRules\n );\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(\n is,\n styleInfo.styleProperties,\n styleInfo.ownStylePropertyNames\n );\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 =\n cachedScopeSelector || this._generateScopeSelector(is);\n let style = StyleProperties.applyElementStyle(\n host,\n styleInfo.styleProperties,\n styleInfo.scopeSelector,\n cachedStyle\n );\n if (!nativeShadow) {\n StyleProperties.applyElementScopeSelector(\n host,\n styleInfo.scopeSelector,\n oldScopeSelector\n );\n }\n if (!cacheEntry) {\n styleCache.store(\n is,\n styleInfo.styleProperties,\n style,\n styleInfo.scopeSelector\n );\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(\n host,\n styleInfo.styleRules,\n styleInfo.cssBuild\n );\n let propertyData = StyleProperties.propertyDataFromStyles(\n ownerStyleInfo.styleRules,\n host\n );\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 const root = wrappedHost.shadowRoot;\n const isRootOwner = this._isRootOwner(host);\n if (root || isRootOwner) {\n this.styleElement(host, properties);\n }\n const descendantRoot = isRootOwner ? wrappedHost : root;\n if (descendantRoot) {\n const descendantHosts = Array.from(\n descendantRoot.querySelectorAll('*')\n ).filter((x) => StyleUtil.wrap(x).shadowRoot);\n for (let i = 0; i < descendantHosts.length; i++) {\n this.styleSubtree(descendantHosts[i]);\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(\n s,\n this._documentOwnerStyleInfo.styleProperties\n );\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 =\n StyleInfo.get(element) ||\n StyleInfo.get(this._styleOwnerForNode(element));\n value = styleInfo.styleProperties[property];\n }\n // fall back to the property value from the computed styling\n value =\n 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;\n if (classString) {\n let definitelyString =\n typeof classString === 'string' ? classString : String(classString);\n classes = definitelyString.split(/\\s/);\n } else {\n classes = [];\n }\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'] =\n ScopingShim.prototype.prepareTemplate;\nScopingShim.prototype['styleElement'] = ScopingShim.prototype.styleElement;\nScopingShim.prototype['styleDocument'] = ScopingShim.prototype.styleDocument;\nScopingShim.prototype['styleSubtree'] = ScopingShim.prototype.styleSubtree;\nScopingShim.prototype['getComputedStyleValue'] =\n ScopingShim.prototype.getComputedStyleValue;\nScopingShim.prototype['setElementClass'] =\n ScopingShim.prototype.setElementClass;\nScopingShim.prototype['_styleInfoForNode'] =\n ScopingShim.prototype._styleInfoForNode;\nScopingShim.prototype['transformCustomStyleForDocument'] =\n ScopingShim.prototype.transformCustomStyleForDocument;\nScopingShim.prototype['getStyleAst'] = ScopingShim.prototype.getStyleAst;\nScopingShim.prototype['styleAstToString'] =\n ScopingShim.prototype.styleAstToString;\nScopingShim.prototype['flushCustomStyles'] =\n ScopingShim.prototype.flushCustomStyles;\nScopingShim.prototype['scopeNode'] = ScopingShim.prototype.scopeNode;\nScopingShim.prototype['unscopeNode'] = ScopingShim.prototype.unscopeNode;\nScopingShim.prototype['scopeForNode'] = ScopingShim.prototype.scopeForNode;\nScopingShim.prototype['currentScopeForNode'] =\n ScopingShim.prototype.currentScopeForNode;\nScopingShim.prototype['prepareAdoptedCssText'] =\n 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 {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'][\n 'querySelectorAll'\n ].call(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 (\n mxn.target === document.documentElement ||\n mxn.target === document.head\n ) {\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 (\n currentScope &&\n root === n.ownerDocument &&\n !isElementWithBuiltCss(n)\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 (\n !nativeShadow &&\n !(window['ShadyDOM'] && window['ShadyDOM']['handlesDynamicScoping'])\n) {\n let observer = new MutationObserver(handler);\n let start = (node) => {\n observer.observe(node, {childList: true, subtree: true});\n };\n let nativeCustomElements =\n 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 @typescript-eslint/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 =\n this.matches ||\n this.matchesSelector ||\n this.mozMatchesSelector ||\n this.msMatchesSelector ||\n this.oMatchesSelector ||\n this.webkitMatchesSelector;\n return method && method.call(this, selector);\n};\n\nconst rootSelector = /:host\\s*>\\s*/;\n\nfunction checkRoot(hostScope, selector) {\n return (\n Boolean(selector.match(rootSelector)) ||\n (hostScope === 'html' && selector.indexOf('html') > -1)\n );\n}\n\nconst IS_IE = navigator.userAgent.match('Trident');\n\nconst XSCOPE_NAME = 'x-scope';\n\nclass StyleProperties {\n /** @return {string} */\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,\n props = {},\n keyframes = [],\n ruleIndex = 0;\n StyleUtil.forEachRule(\n rules,\n 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 },\n function onKeyframesRule(rule) {\n keyframes.push(rule);\n }\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 = {},\n 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,\n 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 // 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, '').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 =\n 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] =\n p && p.lastIndexOf(';') === p.length - 1\n ? p.slice(0, -1) // strip trailing ;\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(\n rules,\n (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 =\n 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 },\n null,\n true\n );\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 (!(/** @type {?} */ (rule.propertyInfo))) {\n this.decorateRule(rule);\n }\n if (!(/** @type {?} */ (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 = checkRoot(hostScope, parsedSelector);\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 =\n parsedSelector === hostScope + ' > *.' + hostScope ||\n 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 (!(/** @type {?} */ (rule.transformedSelector))) {\n // transform :host into a matchable selector\n rule.transformedSelector = StyleTransformer._transformRuleCss(\n rule,\n StyleTransformer._transformComplexSelector,\n StyleTransformer._calcElementScope(is),\n hostScope\n );\n }\n selectorToMatch =\n /** @type {?} */ (rule.transformedSelector) || hostScope;\n }\n if (isRoot && hostScope === 'html') {\n selectorToMatch =\n /** @type {?} */ (rule.transformedSelector) ||\n /** @type {?} */ (rule.parsedSelector);\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 = {},\n rootProps = {};\n // note: active rules excludes non-matching @media rules\n StyleUtil.forEachRule(\n rules,\n (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 },\n null,\n true\n );\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._calcHostScope(is, typeExtension);\n let rxHostSelector = element.extends\n ? '\\\\' + hostSelector.slice(0, -1) + '\\\\]'\n : hostSelector;\n let hostRx = new RegExp(RX.HOST_PREFIX + rxHostSelector + RX.HOST_SUFFIX);\n let {styleRules: rules, cssBuild} = StyleInfo.get(element);\n let keyframeTransforms = this._elementKeyframeTransforms(\n element,\n rules,\n scopeSelector\n );\n return StyleTransformer.elementStyles(\n element,\n rules,\n function (rule) {\n self.applyProperties(rule, properties);\n if (\n !nativeShadow &&\n !StyleUtil.isKeyframesSelector(rule) &&\n rule['cssText']\n ) {\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 },\n cssBuild\n );\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 (\n let i = 0, keyframesRule = keyframesRules[i];\n i < keyframesRules.length;\n keyframesRule = keyframesRules[++i]\n ) {\n this._scopeKeyframes(keyframesRule, scopeSelector);\n keyframeTransforms[\n 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 /** @type {?} */ (keyframesRule.keyframesNameRx),\n /** @type {?} */ (keyframesRule.transformedKeyframesName)\n );\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(\n `\\\\b${rule['keyframesName']}(?!\\\\B|-)`,\n 'g'\n );\n rule.transformedKeyframesName = rule['keyframesName'] + '-' + scopeId;\n rule.transformedSelector =\n /** @type {?} */ (rule.transformedSelector) || rule['selector'];\n rule['selector'] = /** @type {?} */ (rule.transformedSelector).replace(\n rule['keyframesName'],\n rule.transformedKeyframesName\n );\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 =\n /** @type {?} */ (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 );\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\n ? 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(\n cssText,\n selector,\n element.shadowRoot,\n styleInfo.placeholder\n );\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(\n cssText,\n selector,\n null,\n styleInfo.placeholder\n );\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(\n /** @type {HTMLStyleElement} */ (style)\n );\n let self = this;\n style.textContent = StyleUtil.toCssText(rules, function (\n /** StyleNode */ rule\n ) {\n let css = (rule['cssText'] = rule['parsedCssText']);\n if (\n /** @type {?} */ (rule.propertyInfo) &&\n /** @type {?} */ (rule.propertyInfo).cssText\n ) {\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","/**\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 @typescript-eslint/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(\n ast,\n placeholder,\n ownStylePropertyNames,\n elementName,\n typeExtension,\n cssBuild\n ) {\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 {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(\n /** @type {!CustomElementRegistry} */ (ce),\n name,\n clazz,\n options\n );\n };\n ce['define'] = wrappedDefine;\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'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 @typescript-eslint/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 (\n !templateIsValid(template) &&\n template[VALIDATING_VERSION] === template[NEXT_VERSION]\n );\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';\n// prettier-ignore\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"]}