forked from webcomponents/webcomponentsjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webcomponents-sd-ce.js.map
1 lines (1 loc) · 381 KB
/
webcomponents-sd-ce.js.map
1
{"version":3,"sources":[" [synthetic:base] "," [synthetic:util/global] ","entrypoints/webcomponents-sd-ce-index.js","bower_components/shadycss/src/scoping-shim.js","bower_components/shadycss/src/custom-style-interface.js","bower_components/shadycss/src/document-watcher.js","bower_components/shadycss/src/style-cache.js","bower_components/shadycss/src/style-properties.js","bower_components/shadycss/src/style-info.js","bower_components/shadycss/src/style-transformer.js","bower_components/shadycss/src/css-parse.js","bower_components/custom-elements/src/Patch/Element.js","bower_components/custom-elements/src/CustomElementState.js","bower_components/custom-elements/src/Patch/Interface/ChildNode.js","bower_components/custom-elements/src/Patch/Node.js","bower_components/custom-elements/src/Patch/Document.js","bower_components/custom-elements/src/Patch/Interface/ParentNode.js","bower_components/custom-elements/src/Patch/HTMLElement.js","bower_components/custom-elements/src/CustomElementRegistry.js","bower_components/custom-elements/src/Deferred.js","bower_components/custom-elements/src/DocumentConstructionObserver.js","bower_components/custom-elements/src/CustomElementInternals.js","bower_components/shadydom/src/attach-shadow.js","bower_components/shadydom/src/distributor.js","bower_components/shadydom/src/logical-tree.js","bower_components/shadydom/src/observe-changes.js","bower_components/shadydom/src/utils.js","bower_components/shadydom/src/flush.js","bower_components/shadydom/src/innerHTML.js","bower_components/shadydom/src/native-tree.js","bower_components/shadydom/src/patch-accessors.js","bower_components/shadydom/src/logical-mutation.js","bower_components/shadydom/src/patch-events.js","bower_components/shadydom/src/array-splice.js","bower_components/shadydom/src/patch-builtins.js","bower_components/custom-elements/src/Utilities.js","bower_components/shadycss/src/style-settings.js","bower_components/shadycss/src/style-util.js","bower_components/shadycss/src/apply-shim-utils.js","bower_components/shadycss/src/document-wait.js","bower_components/shadydom/src/native-methods.js","bower_components/shadydom/src/shadydom.js","bower_components/custom-elements/src/Patch/Native.js","bower_components/custom-elements/src/AlreadyConstructedMarker.js","bower_components/custom-elements/src/custom-elements.js","bower_components/shadycss/src/common-regex.js","bower_components/shadycss/src/style-placeholder.js","bower_components/shadycss/src/template-map.js","bower_components/shadycss/src/common-utils.js","bower_components/shadycss/entrypoints/scoping-shim.js"],"names":["constructor","ScopingShim","_scopeCounter","_documentOwner","document","documentElement","ast","StyleNode","_documentOwnerStyleInfo","StyleInfo","set","_elementsHaveApplied","_customStyleInterface","_applyShim","documentWait","_ensure","CustomStyleInterface$1","flush$1","StyleCache","typeMax","cache","StyleProperties","placeholder","ownStylePropertyNames","elementName","typeExtension","cssBuild","styleRules","overrideStyleProperties","customStyle","scopeSelector","styleProperties","StyleTransformer","PatchElement","internals","patch_innerHTML","destination","baseDescriptor","Object","defineProperty","enumerable","configurable","get","htmlString","removedElements","undefined","isConnected","isConnected$$1","walkDeepDescendantElements","element","push","call","i","length","custom","__CE_state","disconnectedCallback","ownerDocument","__CE_hasRegistry","patchAndUpgradeTree","patchTree","patch_insertAdjacentElement","baseMethod","setPropertyUnchecked","where","wasConnected","insertedElement","disconnectTree","connectTree","Element_attachShadow","Element","prototype","init","__CE_shadowRoot","shadowRoot","console","warn","Element_innerHTML","HTMLElement_innerHTML","HTMLElement","rawDiv","Document_createElement","addPatch","Node_cloneNode","innerHTML","assignedValue","content","localName","childNodes","Node_removeChild","Node_appendChild","name","newValue","Element_setAttribute","oldValue","Element_getAttribute","attributeChangedCallback","namespace","Element_setAttributeNS","Element_getAttributeNS","Element_removeAttribute","Element_removeAttributeNS","HTMLElement_insertAdjacentElement","Element_insertAdjacentElement","PatchParentNode","prepend","Element_prepend","append","Element_append","PatchChildNode","before","Element_before","after","Element_after","replaceWith","Element_replaceWith","remove","Element_remove","builtIn","connectedBefore","nodes","filter","node","Node","apply","PatchNode","patch_textContent","nodeType","TEXT_NODE","removedNodes","firstChild","childNodesLength","Array","refNode","DocumentFragment","insertedNodes","slice","nativeResult","Node_insertBefore","nodeWasConnected","deep","clone","nodeToInsert","nodeToRemove","Node_replaceChild","nodeToInsertWasConnected","thisIsConnected","Node_textContent","parts","textContent","join","createTextNode","PatchDocument","Document","definition","localNameToDefinition","result","patch","Document_importNode","NS_HTML","Document_createElementNS","Document_prepend","Document_append","PatchHTMLElement","window","constructorToDefinition","Error","constructionStack","setPrototypeOf","__CE_definition","lastIndex","AlreadyConstructedMarker$1","CustomElementRegistry","_elementDefinitionIsRunning","_internals","_whenDefinedDeferred","Map","_flushCallback","this._flushCallback","fn","_flushPending","_unflushedLocalNames","_documentConstructionObserver","DocumentConstructionObserver","Deferred","_resolve","_value","_promise","Promise","resolve","doc","_document","_observer","readyState","MutationObserver","_handleMutations","bind","observe","childList","subtree","CustomElementInternals","_localNameToDefinition","_constructorToDefinition","_patches","_hasPatches","ShadyRoot","token","host","ShadyRootConstructionToken","TypeError","createDocumentFragment","__proto__","_init","root","insertionPointTag","recordChildNodes","__shady","lastChild","patchInsideElementAccessors","c$","n","parentNode","nextSibling","previousSibling","patchOutsideElementAccessors","unobserveChildren","handle","observer","callbacks","delete","_callback","size","_node","observeChildren","callback","AsyncObserver","add","takeRecords","_scheduled","addedNodes","Set","isShadyRoot","obj","__localName","ownerShadyRootForNode","getRootNode","extend","target","source","n$","getOwnPropertyNames","pd","getOwnPropertyDescriptor","extendAll","sources","mixin","microtask","queue","twiddle","enqueue","scheduled","flush","flushList","didFlush","shift","filterMutations","mutations","targetRootNode","map","mutation","mutationInScope","from","create","value","m","escapeReplace","c","makeSet","arr","getInnerHTML","s","l","child","attr","ELEMENT_NODE","tagName","attrs","attributes","replace","escapeAttrRegExp","voidElements","data","plaintextParents","escapeDataRegExp","COMMENT_NODE","error","nodeWalker","currentNode","parentElement","elementWalker","firstElementChild","lastElementChild","previousElementSibling","nextElementSibling","children","nodeValue","textWalker","createTreeWalker","NodeFilter","SHOW_TEXT","nextNode","patchAccessorGroup","descriptors","force","p","objDesc","patchAccessors","proto","OutsideAccessors","InsideAccessors","ActiveElementAccessor","linkNode","container","ref_node","ps","ns","removeNode","logicalParent","distributed","ownerRoot","maybeDistributeParent","hostNeedsDist","ip$","_getInsertionPoints","insertionPoint","dc$","j","assignedNodes","flatten","parent","removeChild","removedDistributed","addedInsertionPoint","getInsertionPointTag","_skipUpdateInsertionPoints","updateRootViaContentChange","_removeOwnerShadyRoot","_scheduleObserver","addedNode","removedNode","schedule","ownerShadyRoot","contains","_maybeAddInsertionPoint","added","DOCUMENT_FRAGMENT_NODE","querySelectorAll","np","na","_nodeNeedsDistribution","hasInsertionPoint","_changePending","update","distributeAttributeChange","query","matcher","halter","list","_queryElements","elements","renderRootNode","render","insertBefore$1","ipAdded","resetTo","fragContent","querySelector","wrappedContent","hasContent","needsDist","handled","_renderPending","isFinalDestination","insertBefore","appendChild","importNode$1","importNode","nc","pathComposer","startNode","composed","composedPath","current","startRoot","assignedSlot","retarget","path","refNodePath","ancestor","lastRoot","rootIdx","indexOf","mixinComposedFlag","Base","klazz","type","options","event","__composed","fireHandlers","phase","hs","__handlers","__immediatePropagationStopped","retargetNonBubblingEvent","e","__propagationStopped","Event","AT_TARGET","lastFiredRoot","activateFocusEventOverrides","ev","nonBubblingEventsToRetarget","addEventListener","patchEvent","stopImmediatePropagation","__relatedTarget","relatedTarget","settings","hasDescriptors","eventMixin","getPrototypeOf","hasOwnProperty","patchProto","__sourceProto","newSplice","index","removed","addedCount","calcSplices","currentStart","currentEnd","old","oldStart","oldEnd","prefixCount","suffixCount","minLength","Math","min","currentValue","previousValue","index1","index2","count","searchLength","equals","splice","rowCount","columnCount","distances","north","west","edits","EDIT_ADD","EDIT_DELETE","northWest","EDIT_LEAVE","EDIT_UPDATE","reverse","splices","oldIndex","getAssignedSlot","patchBuiltin","d","isValidCustomElementName","reserved","reservedTagList","has","validForm","test","nativeValue","__CE_isImportDocument","ShadowRoot","nextSiblingOrAncestorSibling","start","visitedImports","getAttribute","import","parse","text","RX","comments","port","parseCss","OPEN_BRACE","previous","CLOSE_BRACE","t","substring","trim","ss","_expandUnicodeEscapes","multipleSpaces","lastIndexOf","AT_START","MEDIA_START","types","MEDIA_RULE","match","keyframesRule","KEYFRAMES_RULE","split","pop","VAR_START","MIXIN_RULE","STYLE_RULE","r$","r","code","repeat","stringify","preserveProperties","cssText","rules","customProp","mixinProp","mixinApply","varApply","parseSettings","nativeCssVariables","nativeShadow","toCssText","forEachRule","rulesForStyle","style","isKeyframesSelector","rule","styleRuleCallback","keyframesRuleCallback","onlyActiveRules","skipRules","matchMedia","MEDIA_MATCH","matches","applyCss","moniker","contextNode","createElement","setAttribute","applyStyle","head","lastHeadApplyNode","compareDocumentPosition","position","DOCUMENT_POSITION_PRECEDING","processVariableAndFallback","str","end","level","inner","prefix","suffix","comma","fallback","setElementClassRaw","getIsExtends","is","extends","invalidate","template","templateMap","startValidatingTemplate","_validating","promise","then","requestAnimationFrame","whenReady","readyPromise","resolveFn","hasNativeShadowDOM","attachShadow","desc","inUse","matchesSelector","mozMatchesSelector","msMatchesSelector","oMatchesSelector","webkitMatchesSelector","characterData","forEach","cb","removeAttribute","cloneNode","removeEventListener","nativeMethods","freeze","SHOW_ALL","SHOW_ELEMENT","nativeTree","nativeInnerHTMLDesc","htmlContainer","implementation","createHTMLDocument","inertDoc","nativeActiveElementDescriptor","className","tc","cn","ShadowRootAccessor","activeElement","active","isShadyRoot$$1","activeRoot","__outsideAccessors","__insideAccessors","scopingShim","alwaysComposed","isTrusted","__composedPath","currentTarget","__relatedTargetComposedPath","stopPropagation","PatchedEvent","PatchedCustomEvent","CustomEvent","PatchedMouseEvent","MouseEvent","NormalizedEvent","inType","params","createEvent","initEvent","bubbles","cancelable","getInsertionPoints","isInsertionPoint","distribute","distributePool","collectPool","pool","dirtyRoots","p$","distributeInsertionPoint","prevAssignedNodes","clearAssignedSlots","needsSlotChange","anyDistributed","matchesInsertionPoint","_prevAssignedSlot","distributeNodeInto","children$$1","setDistributedNodesOnInsertionPoint","_fireSlotChange","slot","savePrevious","slotName","distributedNodes","d$","dispatchEvent","ShadyRoot.prototype._init","_hasRendered","_distributor","Distributor","ShadyRoot.prototype.update","_getRenderRoot","ShadyRoot.prototype._getRenderRoot","renderRoot","_rendererForHost","ShadyRoot.prototype._rendererForHost","ShadyRoot.prototype.render","__insertionPoints","updateInsertionPoints","compose","forceRender","ShadyRoot.prototype.forceRender","ShadyRoot.prototype.distribute","ShadyRoot.prototype.updateInsertionPoints","i$","_insertionPoints","ShadyRoot.prototype.compose","_composeTree","ShadyRoot.prototype._composeTree","_updateChildNodes","_composeNode","ShadyRoot.prototype._composeNode","distributedNode","ShadyRoot.prototype.isFinalDestination","ShadyRoot.prototype._updateChildNodes","next","ShadyRoot.prototype.getInsertionPointTag","ShadyRoot.prototype.hasInsertionPoint","ShadyRoot.prototype._getInsertionPoints","patchShadowRootAccessors","nodeMixin","addEventListener$1","optionsOrCapture","capture","once","passive","__eventWrappers","wrapperFn","eventPhase","BUBBLING_PHASE","removeEventListener$1","idx","nativeParent","replaceChild","ownerDocumentElement","textMixin","fragmentMixin","selector","slotMixin","elementMixin","defineProperties","documentMixin","ShadyDOM","Text","HTMLSlotElement","setDefinition","listener","__CE_patched","connectedCallback","upgradeElement","gatherElements","__CE_documentLoadHandled","failed","observedAttributes","disconnect","toPromise","define","Function","SyntaxError","adoptedCallback","getCallback","callbackValue","_flush","deferred","whenDefined","reject","prior","polyfillWrapFlushCallback","outer","createElementNS","getAttributeNS","setAttributeNS","removeAttributeNS","AlreadyConstructedMarker","priorCustomElements","customElements","navigator","userAgent","CSS","supports","ShadyCSS","VAR_ASSIGN","MIXIN_MATCH","VAR_CONSUMED","ANIMATION_MATCH","BRACKETED","dom","scope","shouldRemoveScope","_transformDom","_content","classList","SCOPE_NAME","CLASS","elementStyles","cssBuildType","css","ext","hostScope","_calcHostScope","_calcElementScope","self","isScoped","CSS_CLASS_PREFIX","_transformRule","_transformComplexSelector","transformer","transformedSelector","_transformRuleCss","COMPLEX_SELECTOR_SEP","stop","NTH","SLOTTED_START","HOST","SIMPLE_SELECTOR_SEP","info","_transformCompoundSelector","combinator","slottedIndex","SLOTTED","_transformHostSelector","_transformSimpleSelector","slotted","SLOTTED_PAREN","paren","DIR_PAREN","dir","PSEUDO_PREFIX","HOST_PAREN","SIMPLE_SELECTOR_PREFIX","typeSelector","SELECTOR_NO_MATCH","documentRule","normalizeRootSelector","_transformDocumentSelector","ROOT","SCOPE_DOC_SELECTOR","RegExp","StyleTransformer$1","styleInfo","_getStyleRules","matchesSelector$1","IS_IE","decorateStyles","props","keyframes","ruleIndex","decorateRule","collectPropertiesInCssText","propertyInfo","onKeyframesRule","_keyframes","names","properties","collectProperties","hasProperties","collectCssText","assign","exec","any","collectConsumingCssText","reify","valueForProperty","property","valueForProperties","propertyValue","colon","pp","applyProperties","output","applyKeyframeTransforms","keyframeTransforms","input","hasAnimations","keyframeNamesToTransform","keyframe","transform","propertyDataFromStyles","o","selectorToMatch","parseInt","key","whenHostOrRootRule","parsedSelector","isRoot","isHost","hostAndRootPropertiesForScope","hostProps","rootProps","_element","transformStyles","hostSelector","rxHostSelector","hostRx","HOST_PREFIX","HOST_SUFFIX","_elementKeyframeTransforms","_scopeSelector","keyframesRules","_scopeKeyframes","_keyframesRuleTransformer","keyframesNameRx","transformedKeyframesName","scopeId","applyElementScopeSelector","v","applyElementStyle","applyCustomStyle","XSCOPE_NAME","StyleProperties$1","placeholderMap","ce","origDefine","wrappedDefine","clazz","placeHolder","createComment","_validate","cacheEntry","ownPropertyNames","pn","store","tagname","styleElement","fetch","entry","handler","mxns","x","mxn","hasAttribute","classes","classIdx","delayedStart","body","transformFn","validateFn","enqueueDocumentValidation","addCustomStyle","getStyleForCustomStyle","processStyles","cs","appliedStyle","styleToTransform","needsEnqueue","styleCache","_generateScopeSelector","id","getStyleAst","styleAstToString","_gatherStyles","styles","_getCssBuild","prepareTemplate","_prepared","__cssBuild","hasMixins","_cssBuild","_generateStaticStyle","_style","_ownPropertyNames","shadowroot","_prepareHost","_ensureApplyShim","ApplyShim","_ensureCustomStyleInterface","CustomStyleInterface","transformCustomStyleForDocument","flushCustomStyles","customStyles","_revalidateCustomStyleApplyShim","_updateProperties","_applyCustomStyles","styleDocument","overrideProps","_isRootOwner","removeProperty","setProperty","_applyStyleProperties","_styleOwnerForNode","cachedStyle","oldScopeSelector","owner","ownerStyleInfo","hostAndRootProps","propertiesMatchingHost","propertyData","_mixinOverrideStyles","overrides","styleSubtree","shadowChildren","_revalidateApplyShim","getComputedStyleValue","getComputedStyle","getPropertyValue","setElementClass","classString","scopeName","classAttr","k$","_styleInfoForNode","scopingShim$1","elementExtends","nativeCss"],"mappings":"A;;;;;;;;;;;;;;;;;;;;;;;;aAyBA,IAAI,GAAU,CAGN,MAAQ,EAHF,CCIN,UAAY,QAAQ,CAAC,CAAD,CAAc,CACxC,MAAyB,WAAlB,EAAC,MAAO,OAAR,EAAiC,MAAjC,GAA4C,CAA5C,CACH,CADG,CAEe,WAAlB,EAAC,MAAO,OAAR,EAA2C,IAA3C,EAAiC,MAAjC,CAAmD,MAAnD,CAA4D,CAHxB,CDJ5B,CCkBd,GAAA,OAAA,CAAiB,EAAA,UAAA,CAAkB,IAAlB,CC3ChB;SAAS,EAAG,CCiCXA,QADmBC,EACR,EAAG,CAAA,IAAA,EAAA,IACZ,KAAAC,cAAA,CAAqB,EACrB,KAAAC,eAAA,CAAsBC,QAAAC,gBACtB,KAAIC,EAAM,IAAIC,EACdD,EAAA,MAAA,CAAe,EACf,KAAAE,wBAAA,CAA+BC,CAAAC,IAAA,CAAc,IAAAP,eAAd,CAAmC,IAAIM,CAAJ,CAAcH,CAAd,CAAnC,CAC/B,KAAAK,qBAAA,CAA4B,CAAA,CAG5B,KAAAC,sBAAA,CAFA,IAAAC,WAEA,CAFkB,IAGlBC,GAAA,CAAa,QAAA,EAAM,CACjB,CAAAC,QAAA,EADiB,CAAnB,CAVY,CCUdf,QADmBgB,EACR,EAAG,CAEZ,IAAA,aAAA,CAAuB,EACvB,KAAA,SAAA,CAAmB,CAAA,CAHP,CC3BGC,QAAA,GAAA,EAAW,ECJ5BjB,QADmBkB,GAC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CAAD,CAAU,CACpB85B,CAAAjC,kBAAA,EACAiC,EAAA9E,aAAA,CAAyBh1B,CAAzB,CAFoB,CAxBN,CAgChBk4B,cAAAA,QAAa,CAACxH,CAAD,CAAa,CACxBoJ,CAAAjC,kBAAA,EACAiC,EAAA5B,cAAA,CAA0BxH,CAA1B,CAFwB,CAhCV,CA0ChB2I,sBAAAA,QAAqB,CAACr5B,CAAD,CAAUoxB,CAAV,CAAoB,CACvC,MAAO0I,EAAAT,sBAAA,CAAkCr5B,CAAlC,CAA2CoxB,CAA3C,CADgC,CA1CzB,CA8ChB4I,UAAW/b,CA9CK,CAgDhBC,aAAcA,CAhDE,CAmDduZ,GAAJ,GACEtwB,MAAA8kB,SAAAwL,UADF,CAC8BA,EAD9B,CAIIE,GAAJ,GACExwB,MAAA8kB,SAAA0L,qBADF,CACyCA,EADzC,C/ChFa,CAAZ,CAAA","file":"webcomponents-sd-ce.js","sourcesContent":[null,null,"/**\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\n/*\n * Polyfills loaded: Custom Elements, Shady DOM/Shady CSS\n * Used in: Safari 9, Firefox, Edge\n */\n\nimport '../bower_components/shadydom/src/shadydom.js'\nimport '../bower_components/custom-elements/src/custom-elements.js'\nimport '../bower_components/shadycss/entrypoints/scoping-shim.js'\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'\nimport {nativeShadow, nativeCssVariables} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport StyleProperties from './style-properties'\nimport placeholderMap from './style-placeholder'\nimport StyleInfo from './style-info'\nimport StyleCache from './style-cache'\nimport {flush as watcherFlush} from './document-watcher'\nimport templateMap from './template-map'\nimport * as ApplyShimUtils from './apply-shim-utils'\nimport documentWait from './document-wait'\nimport {updateNativeProperties} from './common-utils'\nimport {CustomStyleInterfaceInterface} from './custom-style-interface' //eslint-disable-line no-unused-vars\n\n/**\n * @const {StyleCache}\n */\nconst styleCache = new StyleCache();\n\nexport default class ScopingShim {\n constructor() {\n this._scopeCounter = {};\n this._documentOwner = document.documentElement;\n let ast = new StyleNode();\n ast['rules'] = [];\n this._documentOwnerStyleInfo = StyleInfo.set(this._documentOwner, new StyleInfo(ast));\n this._elementsHaveApplied = false;\n this._applyShim = null;\n /** @type {?CustomStyleInterfaceInterface} */\n this._customStyleInterface = null;\n documentWait(() => {\n this._ensure();\n });\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 let styles = template.content.querySelectorAll('style');\n let cssText = [];\n for (let i = 0; i < styles.length; i++) {\n let s = styles[i];\n cssText.push(s.textContent);\n s.parentNode.removeChild(s);\n }\n return cssText.join('').trim();\n }\n _getCssBuild(template) {\n let style = template.content.querySelector('style');\n if (!style) {\n return '';\n }\n return style.getAttribute('css-build') || '';\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 if (template._prepared) {\n return;\n }\n template._prepared = true;\n template.name = elementName;\n template.extends = typeExtension;\n templateMap[elementName] = template;\n let cssBuild = this._getCssBuild(template);\n let cssText = this._gatherStyles(template);\n let info = {\n is: elementName,\n extends: typeExtension,\n __cssBuild: cssBuild,\n };\n if (!nativeShadow) {\n StyleTransformer.dom(template.content, elementName);\n }\n // check if the styling has mixin definitions or uses\n this._ensure();\n let hasMixins = this._applyShim['detectMixin'](cssText);\n let ast = parse(cssText);\n // only run the applyshim transforms if there is a mixin involved\n if (hasMixins && nativeCssVariables) {\n this._applyShim['transformRules'](ast, elementName);\n }\n template['_styleAst'] = ast;\n template._cssBuild = cssBuild;\n\n let ownPropertyNames = [];\n if (!nativeCssVariables) {\n ownPropertyNames = StyleProperties.decorateStyles(template['_styleAst'], info);\n }\n if (!ownPropertyNames.length || nativeCssVariables) {\n let root = nativeShadow ? template.content : null;\n let placeholder = placeholderMap[elementName];\n let style = this._generateStaticStyle(info, template['_styleAst'], root, placeholder);\n template._style = style;\n }\n template._ownPropertyNames = ownPropertyNames;\n }\n _generateStaticStyle(info, rules, shadowroot, placeholder) {\n let cssText = StyleTransformer.elementStyles(info, rules);\n if (cssText.length) {\n return StyleUtil.applyCss(cssText, info.is, shadowroot, placeholder);\n }\n }\n _prepareHost(host) {\n let {is, typeExtension} = StyleUtil.getIsExtends(host);\n let placeholder = placeholderMap[is];\n let template = templateMap[is];\n let ast;\n let ownStylePropertyNames;\n let cssBuild;\n if (template) {\n ast = template['_styleAst'];\n ownStylePropertyNames = template._ownPropertyNames;\n cssBuild = template._cssBuild;\n }\n return StyleInfo.set(host,\n new StyleInfo(\n ast,\n placeholder,\n ownStylePropertyNames,\n is,\n typeExtension,\n cssBuild\n )\n );\n }\n _ensureApplyShim() {\n if (this._applyShim) {\n return;\n } else if (window.ShadyCSS.ApplyShim) {\n this._applyShim = window.ShadyCSS.ApplyShim;\n this._applyShim['invalidCallback'] = ApplyShimUtils.invalidate;\n } else {\n this._applyShim = {\n /* eslint-disable no-unused-vars */\n ['detectMixin'](str){return false},\n ['transformRule'](ast){},\n ['transformRules'](ast, name){},\n /* eslint-enable no-unused-vars */\n }\n }\n }\n _ensureCustomStyleInterface() {\n if (this._customStyleInterface) {\n return;\n } else if (window.ShadyCSS.CustomStyleInterface) {\n this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */(window.ShadyCSS.CustomStyleInterface);\n /** @type {function(!HTMLStyleElement)} */\n this._customStyleInterface['transformCallback'] = (style) => {this.transformCustomStyleForDocument(style)};\n this._customStyleInterface['validateCallback'] = () => {\n requestAnimationFrame(() => {\n if (this._customStyleInterface['enqueued'] || this._elementsHaveApplied) {\n this.flushCustomStyles();\n }\n })\n };\n } else {\n this._customStyleInterface = /** @type {!CustomStyleInterfaceInterface} */({\n ['processStyles']() {},\n ['enqueued']: false,\n ['getStyleForCustomStyle'](s) { return null } // eslint-disable-line no-unused-vars\n })\n }\n }\n _ensure() {\n this._ensureApplyShim();\n this._ensureCustomStyleInterface();\n }\n /**\n * Flush and apply custom styles to document\n */\n flushCustomStyles() {\n this._ensure();\n let customStyles = this._customStyleInterface['processStyles']();\n // early return if custom-styles don't need validation\n if (!this._customStyleInterface['enqueued']) {\n return;\n }\n if (!nativeCssVariables) {\n this._updateProperties(this._documentOwner, this._documentOwnerStyleInfo);\n this._applyCustomStyles(customStyles);\n } else {\n this._revalidateCustomStyleApplyShim(customStyles);\n }\n this._customStyleInterface['enqueued'] = false;\n // if custom elements have upgraded and there are no native css variables, we must recalculate the whole tree\n if (this._elementsHaveApplied && !nativeCssVariables) {\n this.styleDocument();\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 let {is} = StyleUtil.getIsExtends(host);\n let styleInfo = StyleInfo.get(host);\n if (!styleInfo) {\n styleInfo = this._prepareHost(host);\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 styleInfo.overrideStyleProperties =\n styleInfo.overrideStyleProperties || {};\n Object.assign(styleInfo.overrideStyleProperties, overrideProps);\n }\n if (!nativeCssVariables) {\n this._updateProperties(host, styleInfo);\n if (styleInfo.ownStylePropertyNames && styleInfo.ownStylePropertyNames.length) {\n this._applyStyleProperties(host, styleInfo);\n }\n } else {\n if (styleInfo.overrideStyleProperties) {\n updateNativeProperties(host, styleInfo.overrideStyleProperties);\n }\n let template = templateMap[is];\n // bail early if there is no shadowroot for this element\n if (!template && !this._isRootOwner(host)) {\n return;\n }\n if (template && template._style && !ApplyShimUtils.templateIsValid(template)) {\n // update template\n if (!ApplyShimUtils.templateIsValidating(template)) {\n this._ensure();\n this._applyShim['transformRules'](template['_styleAst'], is);\n template._style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n ApplyShimUtils.startValidatingTemplate(template);\n }\n // update instance if native shadowdom\n if (nativeShadow) {\n let root = host.shadowRoot;\n if (root) {\n let style = root.querySelector('style');\n style.textContent = StyleTransformer.elementStyles(host, styleInfo.styleRules);\n }\n }\n styleInfo.styleRules = template['_styleAst'];\n }\n }\n }\n _styleOwnerForNode(node) {\n let root = node.getRootNode();\n let host = root.host;\n if (host) {\n if (StyleInfo.get(host)) {\n return host;\n } else {\n return this._styleOwnerForNode(host);\n }\n }\n return this._documentOwner;\n }\n _isRootOwner(node) {\n return (node === this._documentOwner);\n }\n _applyStyleProperties(host, styleInfo) {\n let is = StyleUtil.getIsExtends(host).is;\n let cacheEntry = styleCache.fetch(is, styleInfo.styleProperties, styleInfo.ownStylePropertyNames);\n let cachedScopeSelector = cacheEntry && cacheEntry.scopeSelector;\n let cachedStyle = cacheEntry ? cacheEntry.styleElement : null;\n let oldScopeSelector = styleInfo.scopeSelector;\n // only generate new scope if cached style is not found\n styleInfo.scopeSelector = cachedScopeSelector || this._generateScopeSelector(is);\n let style = StyleProperties.applyElementStyle(host, styleInfo.styleProperties, styleInfo.scopeSelector, cachedStyle);\n if (!nativeShadow) {\n StyleProperties.applyElementScopeSelector(host, styleInfo.scopeSelector, oldScopeSelector);\n }\n if (!cacheEntry) {\n styleCache.store(is, styleInfo.styleProperties, style, styleInfo.scopeSelector);\n }\n return style;\n }\n _updateProperties(host, styleInfo) {\n let owner = this._styleOwnerForNode(host);\n let ownerStyleInfo = StyleInfo.get(owner);\n let ownerProperties = ownerStyleInfo.styleProperties;\n let props = Object.create(ownerProperties || null);\n let hostAndRootProps = StyleProperties.hostAndRootPropertiesForScope(host, styleInfo.styleRules);\n let propertyData = StyleProperties.propertyDataFromStyles(ownerStyleInfo.styleRules, host);\n let propertiesMatchingHost = propertyData.properties\n Object.assign(\n props,\n hostAndRootProps.hostProps,\n propertiesMatchingHost,\n hostAndRootProps.rootProps\n );\n this._mixinOverrideStyles(props, styleInfo.overrideStyleProperties);\n StyleProperties.reify(props);\n styleInfo.styleProperties = props;\n }\n _mixinOverrideStyles(props, overrides) {\n for (let p in overrides) {\n let v = overrides[p];\n // skip override props if they are not truthy or 0\n // in order to fall back to inherited values\n if (v || v === 0) {\n props[p] = v;\n }\n }\n }\n /**\n * Update styles of the whole document\n *\n * @param {Object=} properties\n */\n styleDocument(properties) {\n this.styleSubtree(this._documentOwner, properties);\n }\n /**\n * Update styles of a subtree\n *\n * @param {!HTMLElement} host\n * @param {Object=} properties\n */\n styleSubtree(host, properties) {\n let root = host.shadowRoot;\n if (root || this._isRootOwner(host)) {\n this.styleElement(host, properties);\n }\n // process the shadowdom children of `host`\n let shadowChildren = root && (root.children || root.childNodes);\n if (shadowChildren) {\n for (let i = 0; i < shadowChildren.length; i++) {\n let c = /** @type {!HTMLElement} */(shadowChildren[i]);\n this.styleSubtree(c);\n }\n } else {\n // process the lightdom children of `host`\n let children = host.children || host.childNodes;\n if (children) {\n for (let i = 0; i < children.length; i++) {\n let c = /** @type {!HTMLElement} */(children[i]);\n this.styleSubtree(c);\n }\n }\n }\n }\n /* Custom Style operations */\n _revalidateCustomStyleApplyShim(customStyles) {\n for (let i = 0; i < customStyles.length; i++) {\n let c = customStyles[i];\n let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n if (s) {\n this._revalidateApplyShim(s);\n }\n }\n }\n _applyCustomStyles(customStyles) {\n for (let i = 0; i < customStyles.length; i++) {\n let c = customStyles[i];\n let s = this._customStyleInterface['getStyleForCustomStyle'](c);\n if (s) {\n StyleProperties.applyCustomStyle(s, this._documentOwnerStyleInfo.styleProperties);\n }\n }\n }\n transformCustomStyleForDocument(style) {\n 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) {\n this._ensure();\n 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) {\n let ast = StyleUtil.rulesForStyle(style);\n this._ensure();\n this._applyShim['transformRules'](ast);\n style.textContent = StyleUtil.toCssText(ast);\n }\n }\n getComputedStyleValue(element, property) {\n let value;\n if (!nativeCssVariables) {\n // element is either a style host, or an ancestor of a style host\n let styleInfo = StyleInfo.get(element) || StyleInfo.get(this._styleOwnerForNode(element));\n value = styleInfo.styleProperties[property];\n }\n // fall back to the property value from the computed styling\n value = value || window.getComputedStyle(element).getPropertyValue(property);\n // trim whitespace that can come after the `:` in css\n // example: padding: 2px -> \" 2px\"\n return value ? value.trim() : '';\n }\n // given an element and a classString, replaces\n // the element's class with the provided classString and adds\n // any necessary ShadyCSS static and property based scoping selectors\n setElementClass(element, classString) {\n let root = element.getRootNode();\n let classes = classString ? classString.split(/\\s/) : [];\n let scopeName = root.host && root.host.localName;\n // If no scope, try to discover scope name from existing class.\n // This can occur if, for example, a template stamped element that\n // has been scoped is manipulated when not in a root.\n if (!scopeName) {\n var classAttr = element.getAttribute('class');\n if (classAttr) {\n let k$ = classAttr.split(/\\s/);\n for (let i=0; i < k$.length; i++) {\n if (k$[i] === StyleTransformer.SCOPE_NAME) {\n scopeName = k$[i+1];\n break;\n }\n }\n }\n }\n if (scopeName) {\n classes.push(StyleTransformer.SCOPE_NAME, scopeName);\n }\n if (!nativeCssVariables) {\n let styleInfo = StyleInfo.get(element);\n if (styleInfo && styleInfo.scopeSelector) {\n classes.push(StyleProperties.XSCOPE_NAME, styleInfo.scopeSelector);\n }\n }\n StyleUtil.setElementClassRaw(element, classes.join(' '));\n }\n _styleInfoForNode(node) {\n return StyleInfo.get(node);\n }\n}\n\n/* exports */\nScopingShim.prototype['flush'] = ScopingShim.prototype.flush;\nScopingShim.prototype['prepareTemplate'] = ScopingShim.prototype.prepareTemplate;\nScopingShim.prototype['styleElement'] = ScopingShim.prototype.styleElement;\nScopingShim.prototype['styleDocument'] = ScopingShim.prototype.styleDocument;\nScopingShim.prototype['styleSubtree'] = ScopingShim.prototype.styleSubtree;\nScopingShim.prototype['getComputedStyleValue'] = ScopingShim.prototype.getComputedStyleValue;\nScopingShim.prototype['setElementClass'] = ScopingShim.prototype.setElementClass;\nScopingShim.prototype['_styleInfoForNode'] = ScopingShim.prototype._styleInfoForNode;\nScopingShim.prototype['transformCustomStyleForDocument'] = ScopingShim.prototype.transformCustomStyleForDocument;\nScopingShim.prototype['getStyleAst'] = ScopingShim.prototype.getStyleAst;\nScopingShim.prototype['styleAstToString'] = ScopingShim.prototype.styleAstToString;\nScopingShim.prototype['flushCustomStyles'] = ScopingShim.prototype.flushCustomStyles;\nObject.defineProperties(ScopingShim.prototype, {\n 'nativeShadow': {\n get() {\n return nativeShadow;\n }\n },\n 'nativeCss': {\n get() {\n return nativeCssVariables;\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 documentWait from './document-wait'\n\n/**\n * @typedef {HTMLStyleElement | {getStyle: function():HTMLStyleElement}}\n */\nexport let CustomStyleProvider;\n\nconst SEEN_MARKER = '__seenByShadyCSS';\nconst CACHED_STYLE = '__shadyCSSCachedStyle';\n\n/** @type {?function(!HTMLStyleElement)} */\nlet transformFn = null;\n\n/** @type {?function()} */\nlet validateFn = null;\n\n/**\nThis interface is provided to add document-level <style> elements to ShadyCSS for processing.\nThese styles must be processed by ShadyCSS to simulate ShadowRoot upper-bound encapsulation from outside styles\nIn addition, these styles may also need to be processed for @apply rules and CSS Custom Properties\n\nTo add document-level styles to ShadyCSS, one can call `ShadyCSS.addDocumentStyle(styleElement)` or `ShadyCSS.addDocumentStyle({getStyle: () => styleElement})`\n\nIn addition, if the process used to discover document-level styles can be synchronously flushed, one should set `ShadyCSS.documentStyleFlush`.\nThis function will be called when calculating styles.\n\nAn example usage of the document-level styling api can be found in `examples/document-style-lib.js`\n\n@unrestricted\n*/\nexport default class CustomStyleInterface {\n constructor() {\n /** @type {!Array<!CustomStyleProvider>} */\n this['customStyles'] = [];\n this['enqueued'] = false;\n }\n /**\n * Queue a validation for new custom styles to batch style recalculations\n */\n enqueueDocumentValidation() {\n if (this['enqueued'] || !validateFn) {\n return;\n }\n this['enqueued'] = true;\n documentWait(validateFn);\n }\n /**\n * @param {!HTMLStyleElement} style\n */\n addCustomStyle(style) {\n if (!style[SEEN_MARKER]) {\n style[SEEN_MARKER] = true;\n this['customStyles'].push(style);\n this.enqueueDocumentValidation();\n }\n }\n /**\n * @param {!CustomStyleProvider} customStyle\n * @return {HTMLStyleElement}\n */\n getStyleForCustomStyle(customStyle) {\n if (customStyle[CACHED_STYLE]) {\n return customStyle[CACHED_STYLE];\n }\n let style;\n if (customStyle['getStyle']) {\n style = customStyle['getStyle']();\n } else {\n style = customStyle;\n }\n return style;\n }\n /**\n * @return {!Array<!CustomStyleProvider>}\n */\n processStyles() {\n let cs = this['customStyles'];\n for (let i = 0; i < cs.length; i++) {\n let customStyle = cs[i];\n if (customStyle[CACHED_STYLE]) {\n continue;\n }\n let style = this.getStyleForCustomStyle(customStyle);\n if (style) {\n // HTMLImports polyfill may have cloned the style into the main document,\n // which is referenced with __appliedElement.\n // Also, we must copy over the attributes.\n let appliedStyle = /** @type {HTMLStyleElement} */(style['__appliedElement']);\n if (appliedStyle) {\n for (let i = 0; i < style.attributes.length; i++) {\n let attr = style.attributes[i];\n appliedStyle.setAttribute(attr.name, attr.value);\n }\n }\n let styleToTransform = appliedStyle || style;\n if (transformFn) {\n transformFn(styleToTransform);\n }\n customStyle[CACHED_STYLE] = styleToTransform;\n }\n }\n return cs;\n }\n}\n\nCustomStyleInterface.prototype['addCustomStyle'] = CustomStyleInterface.prototype.addCustomStyle;\nCustomStyleInterface.prototype['getStyleForCustomStyle'] = CustomStyleInterface.prototype.getStyleForCustomStyle;\nCustomStyleInterface.prototype['processStyles'] = CustomStyleInterface.prototype.processStyles;\n\nObject.defineProperties(CustomStyleInterface.prototype, {\n 'transformCallback': {\n /** @return {?function(!HTMLStyleElement)} */\n get() {\n return transformFn;\n },\n /** @param {?function(!HTMLStyleElement)} fn */\n set(fn) {\n transformFn = fn;\n }\n },\n 'validateCallback': {\n /** @return {?function()} */\n get() {\n return validateFn;\n },\n /**\n * @param {?function()} fn\n * @this {CustomStyleInterface}\n */\n set(fn) {\n let needsEnqueue = false;\n if (!validateFn) {\n needsEnqueue = true;\n }\n validateFn = fn;\n if (needsEnqueue) {\n this.enqueueDocumentValidation();\n }\n },\n }\n})\n\n/** @typedef {{\n * customStyles: !Array<!CustomStyleProvider>,\n * addCustomStyle: function(!CustomStyleProvider),\n * getStyleForCustomStyle: function(!CustomStyleProvider): HTMLStyleElement,\n * findStyles: function(),\n * transformCallback: ?function(!HTMLStyleElement),\n * validateCallback: ?function()\n * }}\n */\nexport let CustomStyleInterfaceInterface;","/**\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'\nimport StyleTransformer from './style-transformer'\nimport {getIsExtends} from './style-util'\n\nexport let flush = function() {};\n\nif (!nativeShadow) {\n let elementNeedsScoping = (element) => {\n return (element.classList &&\n !element.classList.contains(StyleTransformer.SCOPE_NAME) ||\n // note: necessary for IE11\n (element instanceof window['SVGElement'] && (!element.hasAttribute('class') ||\n element.getAttribute('class').indexOf(StyleTransformer.SCOPE_NAME) < 0)));\n }\n\n/**\n * @param {Array<MutationRecord|null>|null} mxns\n */\n let handler = (mxns) => {\n for (let x=0; x < mxns.length; x++) {\n let mxn = mxns[x];\n if (mxn.target === document.documentElement ||\n mxn.target === document.head) {\n continue;\n }\n for (let i=0; i < mxn.addedNodes.length; i++) {\n let n = mxn.addedNodes[i];\n if (elementNeedsScoping(n)) {\n let root = n.getRootNode();\n if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n // may no longer be in a shadowroot\n let host = /** @type {ShadowRoot} */(root).host;\n if (host) {\n let {is: scope} = getIsExtends(host);\n StyleTransformer.dom(n, scope);\n }\n }\n }\n }\n for (let i=0; i < mxn.removedNodes.length; i++) {\n let n = /** @type {HTMLElement} */(mxn.removedNodes[i]);\n if (n.nodeType === Node.ELEMENT_NODE) {\n let classes = undefined;\n if (n.classList) {\n classes = Array.from(n.classList);\n } else if (n.hasAttribute('class')) {\n classes = n.getAttribute('class').split(/\\s+/);\n }\n if (classes !== undefined) {\n // NOTE: relies on the scoping class always being adjacent to the\n // SCOPE_NAME class.\n let classIdx = classes.indexOf(StyleTransformer.SCOPE_NAME);\n if (classIdx >= 0) {\n let scope = classes[classIdx + 1];\n if (scope) {\n StyleTransformer.dom(n, scope, true);\n }\n }\n }\n }\n }\n }\n };\n\n let observer = new MutationObserver(handler);\n let start = (node) => {\n observer.observe(node, {childList: true, subtree: true});\n }\n let nativeCustomElements = (window.customElements &&\n !window['customElements']['flush']);\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'use strict';\n\nexport default class StyleCache {\n constructor(typeMax = 100) {\n // map element name -> [{properties, styleElement, scopeSelector}]\n this.cache = {};\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\nimport {removeCustomPropAssignment, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {nativeShadow} from './style-settings'\nimport StyleTransformer from './style-transformer'\nimport * as StyleUtil from './style-util'\nimport * as RX from './common-regex'\nimport StyleInfo from './style-info'\n\n// TODO: dedupe with shady\n/**\n * @const {function(string):boolean}\n */\nconst matchesSelector = ((p) => p.matches || p.matchesSelector ||\n p.mozMatchesSelector || p.msMatchesSelector ||\np.oMatchesSelector || p.webkitMatchesSelector)(window.Element.prototype);\n\nconst IS_IE = navigator.userAgent.match('Trident');\n\nconst XSCOPE_NAME = 'x-scope';\n\nclass StyleProperties {\n get XSCOPE_NAME() {\n return XSCOPE_NAME;\n }\n/**\n * decorates styles with rule info and returns an array of used style property names\n *\n * @param {StyleNode} rules\n * @return {Array<string>}\n */\n decorateStyles(rules) {\n let self = this, props = {}, keyframes = [], ruleIndex = 0;\n StyleUtil.forEachRule(rules, function(rule) {\n self.decorateRule(rule);\n // mark in-order position of ast rule in styles block, used for cache key\n rule.index = ruleIndex++;\n self.collectPropertiesInCssText(rule.propertyInfo.cssText, props);\n }, function onKeyframesRule(rule) {\n keyframes.push(rule);\n });\n // Cache all found keyframes rules for later reference:\n rules._keyframes = keyframes;\n // return this list of property names *consumes* in these styles.\n let names = [];\n for (let i in props) {\n names.push(i);\n }\n return names;\n }\n\n // decorate a single rule with property info\n decorateRule(rule) {\n if (rule.propertyInfo) {\n return rule.propertyInfo;\n }\n let info = {}, properties = {};\n let hasProperties = this.collectProperties(rule, properties);\n if (hasProperties) {\n info.properties = properties;\n // TODO(sorvell): workaround parser seeing mixins as additional rules\n rule['rules'] = null;\n }\n info.cssText = this.collectCssText(rule);\n rule.propertyInfo = info;\n return info;\n }\n\n // collects the custom properties from a rule's cssText\n collectProperties(rule, properties) {\n let info = rule.propertyInfo;\n if (info) {\n if (info.properties) {\n Object.assign(properties, info.properties);\n return true;\n }\n } else {\n let m, rx = RX.VAR_ASSIGN;\n let cssText = rule['parsedCssText'];\n let value;\n let any;\n while ((m = rx.exec(cssText))) {\n // note: group 2 is var, 3 is mixin\n value = (m[2] || m[3]).trim();\n // value of 'inherit' or 'unset' is equivalent to not setting the property here\n if (value !== 'inherit' || value !== 'unset') {\n properties[m[1].trim()] = value;\n }\n any = true;\n }\n return any;\n }\n\n }\n\n // returns cssText of properties that consume variables/mixins\n collectCssText(rule) {\n return this.collectConsumingCssText(rule['parsedCssText']);\n }\n\n // NOTE: we support consumption inside mixin assignment\n // but not production, so strip out {...}\n collectConsumingCssText(cssText) {\n return cssText.replace(RX.BRACKETED, '')\n .replace(RX.VAR_ASSIGN, '');\n }\n\n collectPropertiesInCssText(cssText, props) {\n let m;\n while ((m = RX.VAR_CONSUMED.exec(cssText))) {\n let name = m[1];\n // This regex catches all variable names, and following non-whitespace char\n // If next char is not ':', then variable is a consumer\n if (m[2] !== ':') {\n props[name] = true;\n }\n }\n }\n\n // turns custom properties into realized values.\n reify(props) {\n // big perf optimization here: reify only *own* properties\n // since this object has __proto__ of the element's scope properties\n let names = Object.getOwnPropertyNames(props);\n for (let i=0, n; i < names.length; i++) {\n n = names[i];\n props[n] = this.valueForProperty(props[n], props);\n }\n }\n\n // given a property value, returns the reified value\n // a property value may be:\n // (1) a literal value like: red or 5px;\n // (2) a variable value like: var(--a), var(--a, red), or var(--a, --b) or\n // var(--a, var(--b));\n // (3) a literal mixin value like { properties }. Each of these properties\n // can have values that are: (a) literal, (b) variables, (c) @apply mixins.\n valueForProperty(property, props) {\n // case (1) default\n // case (3) defines a mixin and we have to reify the internals\n if (property) {\n if (property.indexOf(';') >=0) {\n property = this.valueForProperties(property, props);\n } else {\n // case (2) variable\n let self = this;\n let fn = function(prefix, value, fallback, suffix) {\n if (!value) {\n return prefix + suffix;\n }\n let propertyValue = self.valueForProperty(props[value], props);\n // if value is \"initial\", then the variable should be treated as unset\n if (!propertyValue || propertyValue === 'initial') {\n // fallback may be --a or var(--a) or literal\n propertyValue = self.valueForProperty(props[fallback] || fallback, props) ||\n fallback;\n } else if (propertyValue === 'apply-shim-inherit') {\n // CSS build will replace `inherit` with `apply-shim-inherit`\n // for use with native css variables.\n // Since we have full control, we can use `inherit` directly.\n propertyValue = 'inherit';\n }\n return prefix + (propertyValue || '') + suffix;\n };\n property = StyleUtil.processVariableAndFallback(property, fn);\n }\n }\n return property && property.trim() || '';\n }\n\n // note: we do not yet support mixin within mixin\n valueForProperties(property, props) {\n let parts = property.split(';');\n for (let i=0, p, m; i<parts.length; i++) {\n if ((p = parts[i])) {\n RX.MIXIN_MATCH.lastIndex = 0;\n m = RX.MIXIN_MATCH.exec(p);\n if (m) {\n p = this.valueForProperty(props[m[1]], props);\n } else {\n let colon = p.indexOf(':');\n if (colon !== -1) {\n let pp = p.substring(colon);\n pp = pp.trim();\n pp = this.valueForProperty(pp, props) || pp;\n p = p.substring(0, colon) + pp;\n }\n }\n parts[i] = (p && p.lastIndexOf(';') === p.length - 1) ?\n // strip trailing ;\n p.slice(0, -1) :\n p || '';\n }\n }\n return parts.join(';');\n }\n\n applyProperties(rule, props) {\n let output = '';\n // dynamically added sheets may not be decorated so ensure they are.\n if (!rule.propertyInfo) {\n this.decorateRule(rule);\n }\n if (rule.propertyInfo.cssText) {\n output = this.valueForProperties(rule.propertyInfo.cssText, props);\n }\n rule['cssText'] = output;\n }\n\n // Apply keyframe transformations to the cssText of a given rule. The\n // keyframeTransforms object is a map of keyframe names to transformer\n // functions which take in cssText and spit out transformed cssText.\n applyKeyframeTransforms(rule, keyframeTransforms) {\n let input = rule['cssText'];\n let output = rule['cssText'];\n if (rule.hasAnimations == null) {\n // Cache whether or not the rule has any animations to begin with:\n rule.hasAnimations = RX.ANIMATION_MATCH.test(input);\n }\n // If there are no animations referenced, we can skip transforms:\n if (rule.hasAnimations) {\n let transform;\n // If we haven't transformed this rule before, we iterate over all\n // transforms:\n if (rule.keyframeNamesToTransform == null) {\n rule.keyframeNamesToTransform = [];\n for (let keyframe in keyframeTransforms) {\n transform = keyframeTransforms[keyframe];\n output = transform(input);\n // If the transform actually changed the CSS text, we cache the\n // transform name for future use:\n if (input !== output) {\n input = output;\n rule.keyframeNamesToTransform.push(keyframe);\n }\n }\n } else {\n // If we already have a list of keyframe names that apply to this\n // rule, we apply only those keyframe name transforms:\n for (let i = 0; i < rule.keyframeNamesToTransform.length; ++i) {\n transform = keyframeTransforms[rule.keyframeNamesToTransform[i]];\n input = transform(input);\n }\n output = input;\n }\n }\n rule['cssText'] = output;\n }\n\n // Test if the rules in these styles matches the given `element` and if so,\n // collect any custom properties into `props`.\n /**\n * @param {StyleNode} rules\n * @param {Element} element\n */\n propertyDataFromStyles(rules, element) {\n let props = {}, self = this;\n // generates a unique key for these matches\n let o = [];\n // note: active rules excludes non-matching @media rules\n StyleUtil.forEachRule(rules, function(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 self.decorateRule(rule);\n }\n // match element against transformedSelector: selector may contain\n // unwanted uniquification and parsedSelector does not directly match\n // for :host selectors.\n let selectorToMatch = rule.transformedSelector || rule['parsedSelector'];\n if (element && rule.propertyInfo.properties && selectorToMatch) {\n if (matchesSelector.call(element, selectorToMatch)) {\n self.collectProperties(rule, props);\n // produce numeric key for these matches for lookup\n addToBitMask(rule.index, o);\n }\n }\n }, null, true);\n return {properties: props, key: o};\n }\n\n /**\n * @param {Element} scope\n * @param {StyleNode} rule\n * @param {string|undefined} cssBuild\n * @param {function(Object)} callback\n */\n whenHostOrRootRule(scope, rule, cssBuild, callback) {\n if (!rule.propertyInfo) {\n this.decorateRule(rule);\n }\n if (!rule.propertyInfo.properties) {\n return;\n }\n let {is, typeExtension} = StyleUtil.getIsExtends(scope);\n let hostScope = is ?\n StyleTransformer._calcHostScope(is, typeExtension) :\n 'html';\n let parsedSelector = rule['parsedSelector'];\n let isRoot = (parsedSelector === ':host > *' || parsedSelector === 'html');\n let isHost = parsedSelector.indexOf(':host') === 0 && !isRoot;\n // build info is either in scope (when scope is an element) or in the style\n // when scope is the default scope; note: this allows default scope to have\n // mixed mode built and unbuilt styles.\n if (cssBuild === 'shady') {\n // :root -> x-foo > *.x-foo for elements and html for custom-style\n isRoot = parsedSelector === (hostScope + ' > *.' + hostScope) || parsedSelector.indexOf('html') !== -1;\n // :host -> x-foo for elements, but sub-rules have .x-foo in them\n isHost = !isRoot && parsedSelector.indexOf(hostScope) === 0;\n }\n if (cssBuild === 'shadow') {\n isRoot = parsedSelector === ':host > *' || parsedSelector === 'html';\n isHost = isHost && !isRoot;\n }\n if (!isRoot && !isHost) {\n return;\n }\n let selectorToMatch = hostScope;\n if (isHost) {\n // need to transform :host under ShadowDOM because `:host` does not work with `matches`\n if (nativeShadow && !rule.transformedSelector) {\n // transform :host into a matchable selector\n rule.transformedSelector =\n StyleTransformer._transformRuleCss(\n rule,\n StyleTransformer._transformComplexSelector,\n StyleTransformer._calcElementScope(is),\n hostScope\n );\n }\n selectorToMatch = rule.transformedSelector || hostScope;\n }\n callback({\n selector: selectorToMatch,\n isHost: isHost,\n isRoot: isRoot\n });\n }\n/**\n * @param {Element} scope\n * @param {StyleNode} rules\n * @return {Object}\n */\n hostAndRootPropertiesForScope(scope, rules) {\n let hostProps = {}, rootProps = {}, self = this;\n // note: active rules excludes non-matching @media rules\n let cssBuild = rules && rules['__cssBuild'];\n StyleUtil.forEachRule(rules, function(rule) {\n // if scope is StyleDefaults, use _element for matchesSelector\n self.whenHostOrRootRule(scope, rule, cssBuild, function(info) {\n let element = scope._element || scope;\n if (matchesSelector.call(element, info.selector)) {\n if (info.isHost) {\n self.collectProperties(rule, hostProps);\n } else {\n self.collectProperties(rule, rootProps);\n }\n }\n });\n }, null, true);\n return {rootProps: rootProps, hostProps: hostProps};\n }\n\n /**\n * @param {Element} element\n * @param {Object} properties\n * @param {string} scopeSelector\n */\n transformStyles(element, properties, scopeSelector) {\n let self = this;\n let {is, typeExtension} = StyleUtil.getIsExtends(element);\n let hostSelector = StyleTransformer\n ._calcHostScope(is, typeExtension);\n let rxHostSelector = element.extends ?\n '\\\\' + hostSelector.slice(0, -1) + '\\\\]' :\n hostSelector;\n let hostRx = new RegExp(RX.HOST_PREFIX + rxHostSelector +\n RX.HOST_SUFFIX);\n let rules = StyleInfo.get(element).styleRules;\n let keyframeTransforms =\n this._elementKeyframeTransforms(element, rules, scopeSelector);\n return StyleTransformer.elementStyles(element, rules, function(rule) {\n self.applyProperties(rule, properties);\n if (!nativeShadow &&\n !StyleUtil.isKeyframesSelector(rule) &&\n rule['cssText']) {\n // NOTE: keyframe transforms only scope munge animation names, so it\n // is not necessary to apply them in ShadowDOM.\n self.applyKeyframeTransforms(rule, keyframeTransforms);\n self._scopeSelector(rule, hostRx, hostSelector, scopeSelector);\n }\n });\n }\n\n /**\n * @param {Element} element\n * @param {StyleNode} rules\n * @param {string} scopeSelector\n * @return {Object}\n */\n _elementKeyframeTransforms(element, rules, scopeSelector) {\n let keyframesRules = rules._keyframes;\n let keyframeTransforms = {};\n if (!nativeShadow && keyframesRules) {\n // For non-ShadowDOM, we transform all known keyframes rules in\n // advance for the current scope. This allows us to catch keyframes\n // rules that appear anywhere in the stylesheet:\n for (let i = 0, keyframesRule = keyframesRules[i];\n i < keyframesRules.length;\n keyframesRule = keyframesRules[++i]) {\n this._scopeKeyframes(keyframesRule, scopeSelector);\n keyframeTransforms[keyframesRule['keyframesName']] =\n this._keyframesRuleTransformer(keyframesRule);\n }\n }\n return keyframeTransforms;\n }\n\n // Generate a factory for transforming a chunk of CSS text to handle a\n // particular scoped keyframes rule.\n /**\n * @param {StyleNode} keyframesRule\n * @return {function(string):string}\n */\n _keyframesRuleTransformer(keyframesRule) {\n return function(cssText) {\n return cssText.replace(\n keyframesRule.keyframesNameRx,\n keyframesRule.transformedKeyframesName);\n };\n }\n\n/**\n * Transforms `@keyframes` names to be unique for the current host.\n * Example: @keyframes foo-anim -> @keyframes foo-anim-x-foo-0\n *\n * @param {StyleNode} rule\n * @param {string} scopeId\n */\n _scopeKeyframes(rule, scopeId) {\n rule.keyframesNameRx = new RegExp(rule['keyframesName'], 'g');\n rule.transformedKeyframesName = rule['keyframesName'] + '-' + scopeId;\n rule.transformedSelector = rule.transformedSelector || rule['selector'];\n rule['selector'] = rule.transformedSelector.replace(\n rule['keyframesName'], rule.transformedKeyframesName);\n }\n\n // Strategy: x scope shim a selector e.g. to scope `.x-foo-42` (via classes):\n // non-host selector: .a.x-foo -> .x-foo-42 .a.x-foo\n // host selector: x-foo.wide -> .x-foo-42.wide\n // note: we use only the scope class (.x-foo-42) and not the hostSelector\n // (x-foo) to scope :host rules; this helps make property host rules\n // have low specificity. They are overrideable by class selectors but,\n // unfortunately, not by type selectors (e.g. overriding via\n // `.special` is ok, but not by `x-foo`).\n /**\n * @param {StyleNode} rule\n * @param {RegExp} hostRx\n * @param {string} hostSelector\n * @param {string} scopeId\n */\n _scopeSelector(rule, hostRx, hostSelector, scopeId) {\n rule.transformedSelector = rule.transformedSelector || rule['selector'];\n let selector = rule.transformedSelector;\n let scope = '.' + scopeId;\n let parts = selector.split(',');\n for (let i=0, l=parts.length, p; (i<l) && (p=parts[i]); i++) {\n parts[i] = p.match(hostRx) ?\n p.replace(hostSelector, scope) :\n scope + ' ' + p;\n }\n rule['selector'] = parts.join(',');\n }\n\n /**\n * @param {Element} element\n * @param {string} selector\n * @param {string} old\n */\n applyElementScopeSelector(element, selector, old) {\n let c = element.getAttribute('class') || '';\n let v = c;\n if (old) {\n v = c.replace(\n new RegExp('\\\\s*' + XSCOPE_NAME + '\\\\s*' + old + '\\\\s*', 'g'), ' ');\n }\n v += (v ? ' ' : '') + XSCOPE_NAME + ' ' + selector;\n if (c !== v) {\n StyleUtil.setElementClassRaw(element, v);\n }\n }\n\n /**\n * @param {HTMLElement} element\n * @param {Object} properties\n * @param {string} selector\n * @param {HTMLStyleElement} style\n * @return {HTMLStyleElement}\n */\n applyElementStyle(element, properties, selector, style) {\n // calculate cssText to apply\n let cssText = style ? style.textContent || '' :\n this.transformStyles(element, properties, selector);\n // if shady and we have a cached style that is not style, decrement\n let styleInfo = StyleInfo.get(element);\n let s = styleInfo.customStyle;\n if (s && !nativeShadow && (s !== style)) {\n s['_useCount']--;\n if (s['_useCount'] <= 0 && s.parentNode) {\n s.parentNode.removeChild(s);\n }\n }\n // apply styling always under native or if we generated style\n // or the cached style is not in document(!)\n if (nativeShadow) {\n // update existing style only under native\n if (styleInfo.customStyle) {\n styleInfo.customStyle.textContent = cssText;\n style = styleInfo.customStyle;\n // otherwise, if we have css to apply, do so\n } else if (cssText) {\n // apply css after the scope style of the element to help with\n // style precedence rules.\n style = StyleUtil.applyCss(cssText, selector, element.shadowRoot,\n styleInfo.placeholder);\n }\n } else {\n // shady and no cache hit\n if (!style) {\n // apply css after the scope style of the element to help with\n // style precedence rules.\n if (cssText) {\n style = StyleUtil.applyCss(cssText, selector, null,\n styleInfo.placeholder);\n }\n // shady and cache hit but not in document\n } else if (!style.parentNode) {\n StyleUtil.applyStyle(style, null, styleInfo.placeholder);\n }\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 // @media rules may be stale in IE 10 and 11\n if (IS_IE) {\n style.textContent = style.textContent;\n }\n return style;\n }\n\n /**\n * @param {Element} style\n * @param {Object} properties\n */\n applyCustomStyle(style, properties) {\n let rules = StyleUtil.rulesForStyle(/** @type {HTMLStyleElement} */(style));\n let self = this;\n style.textContent = StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n let css = rule['cssText'] = rule['parsedCssText'];\n if (rule.propertyInfo && rule.propertyInfo.cssText) {\n // remove property assignments\n // so next function isn't confused\n // NOTE: we have 3 categories of css:\n // (1) normal properties,\n // (2) custom property assignments (--foo: red;),\n // (3) custom property usage: border: var(--foo); @apply(--foo);\n // In elements, 1 and 3 are separated for efficiency; here they\n // are not and this makes this case unique.\n css = removeCustomPropAssignment(/** @type {string} */(css));\n // replace with reified properties, scenario is same as mixin\n rule['cssText'] = self.valueForProperties(css, properties);\n }\n });\n }\n}\n\n/**\n * @param {number} n\n * @param {Array<number>} bits\n */\nfunction addToBitMask(n, bits) {\n let o = parseInt(n / 32, 10);\n let v = 1 << (n % 32);\n bits[o] = (bits[o] || 0) | v;\n}\n\nexport default new StyleProperties();","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\n\n/** @const {string} */\nconst infoKey = '__styleInfo';\n\nexport default class StyleInfo {\n /**\n * @param {Element} node\n * @return {StyleInfo}\n */\n static get(node) {\n if (node) {\n return node[infoKey];\n } else {\n return null;\n }\n }\n /**\n * @param {!Element} node\n * @param {StyleInfo} styleInfo\n * @return {StyleInfo}\n */\n static set(node, styleInfo) {\n node[infoKey] = styleInfo;\n return styleInfo;\n }\n /**\n * @param {StyleNode} ast\n * @param {Node=} placeholder\n * @param {Array<string>=} ownStylePropertyNames\n * @param {string=} elementName\n * @param {string=} typeExtension\n * @param {string=} cssBuild\n */\n constructor(ast, placeholder, ownStylePropertyNames, elementName, typeExtension, cssBuild) {\n /** @type {StyleNode} */\n this.styleRules = ast || null;\n /** @type {Node} */\n this.placeholder = placeholder || null;\n /** @type {!Array<string>} */\n this.ownStylePropertyNames = ownStylePropertyNames || [];\n /** @type {Array<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\nStyleInfo.prototype['_getStyleRules'] = StyleInfo.prototype._getStyleRules;","/**\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' // eslint-disable-line no-unused-vars\nimport * as StyleUtil from './style-util'\nimport {nativeShadow} from './style-settings'\n\n/* Transforms ShadowDOM styling into ShadyDOM styling\n\n* scoping:\n\n * elements in scope get scoping selector class=\"x-foo-scope\"\n * selectors re-written as follows:\n\n div button -> div.x-foo-scope button.x-foo-scope\n\n* :host -> scopeName\n\n* :host(...) -> scopeName...\n\n* ::slotted(...) -> scopeName > ...\n\n* ...:dir(ltr|rtl) -> [dir=\"ltr|rtl\"] ..., ...[dir=\"ltr|rtl\"]\n\n* :host(:dir[rtl]) -> scopeName:dir(rtl) -> [dir=\"rtl\"] scopeName, scopeName[dir=\"rtl\"]\n\n*/\nconst SCOPE_NAME = 'style-scope';\n\nclass StyleTransformer {\n get SCOPE_NAME() {\n return SCOPE_NAME;\n }\n // 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 dom(node, scope, shouldRemoveScope) {\n // one time optimization to skip scoping...\n if (node['__styleScoped']) {\n node['__styleScoped'] = null;\n } else {\n this._transformDom(node, scope || '', shouldRemoveScope);\n }\n }\n\n _transformDom(node, selector, shouldRemoveScope) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n this.element(node, selector, shouldRemoveScope);\n }\n let c$ = (node.localName === 'template') ?\n (node.content || node._content).childNodes :\n node.children || node.childNodes;\n if (c$) {\n for (let i=0; i<c$.length; i++) {\n this._transformDom(c$[i], selector, shouldRemoveScope);\n }\n }\n }\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 elementStyles(element, styleRules, callback) {\n let cssBuildType = element['__cssBuild'];\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 let cssText = '';\n if (nativeShadow || cssBuildType === '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 return cssText.trim();\n }\n\n // Given a string of cssText and a scoping string (scope), returns\n // a string of scoped css where each selector is transformed to include\n // a class created from the scope. ShadowDOM selectors are also transformed\n // (e.g. :host) to use the scoping selector.\n css(rules, scope, ext, callback) {\n let hostScope = this._calcHostScope(scope, ext);\n scope = this._calcElementScope(scope);\n let self = this;\n return StyleUtil.toCssText(rules, function(/** StyleNode */rule) {\n if (!rule.isScoped) {\n self.rule(rule, scope, hostScope);\n rule.isScoped = true;\n }\n if (callback) {\n callback(rule, scope, hostScope);\n }\n });\n }\n\n _calcElementScope(scope) {\n if (scope) {\n return CSS_CLASS_PREFIX + scope;\n } else {\n return '';\n }\n }\n\n _calcHostScope(scope, ext) {\n return ext ? `[is=${scope}]` : scope;\n }\n\n rule(rule, scope, hostScope) {\n this._transformRule(rule, this._transformComplexSelector,\n scope, hostScope);\n }\n\n /**\n * transforms a css rule to a scoped rule.\n *\n * @param {StyleNode} rule\n * @param {Function} transformer\n * @param {string=} scope\n * @param {string=} hostScope\n */\n _transformRule(rule, transformer, scope, hostScope) {\n // NOTE: save transformedSelector for subsequent matching of elements\n // against selectors (e.g. when calculating style properties)\n rule['selector'] = rule.transformedSelector =\n this._transformRuleCss(rule, transformer, scope, hostScope);\n }\n\n /**\n * @param {StyleNode} rule\n * @param {Function} transformer\n * @param {string=} scope\n * @param {string=} hostScope\n */\n _transformRuleCss(rule, transformer, scope, hostScope) {\n let p$ = rule['selector'].split(COMPLEX_SELECTOR_SEP);\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$.join(COMPLEX_SELECTOR_SEP);\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 selector = selector.replace(NTH, (m, type, inner) => `:${type}(${inner.replace(/\\s/g, '')})`);\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 return selector;\n }\n\n _transformCompoundSelector(selector, combinator, scope, hostScope) {\n // replace :host with host scoping class\n let slottedIndex = selector.indexOf(SLOTTED);\n if (selector.indexOf(HOST) >= 0) {\n selector = this._transformHostSelector(selector, hostScope);\n // replace other selectors with scoping class\n } else if (slottedIndex !== 0) {\n selector = scope ? this._transformSimpleSelector(selector, scope) :\n selector;\n }\n // mark ::slotted() scope jump to replace with descendant selector + arg\n // also ignore left-side combinator\n let slotted = false;\n if (slottedIndex >= 0) {\n combinator = '';\n slotted = true;\n }\n // process scope jumping selectors up to the scope jump and then stop\n let stop;\n if (slotted) {\n stop = true;\n if (slotted) {\n // .zonk ::slotted(.foo) -> .zonk.scope > .foo\n selector = selector.replace(SLOTTED_PAREN, (m, paren) => ` > ${paren}`);\n }\n }\n selector = selector.replace(DIR_PAREN, (m, before, dir) =>\n `[dir=\"${dir}\"] ${before}, ${before}[dir=\"${dir}\"]`);\n return {value: selector, combinator, stop};\n }\n\n _transformSimpleSelector(selector, scope) {\n let p$ = selector.split(PSEUDO_PREFIX);\n p$[0] += scope;\n return p$.join(PSEUDO_PREFIX);\n }\n\n // :host(...) -> scopeName...\n _transformHostSelector(selector, hostScope) {\n let m = selector.match(HOST_PAREN);\n let paren = m && m[2].trim() || '';\n if (paren) {\n if (!paren[0].match(SIMPLE_SELECTOR_PREFIX)) {\n // paren starts with a type selector\n let typeSelector = paren.split(SIMPLE_SELECTOR_PREFIX)[0];\n // if the type selector is our hostScope then avoid pre-pending it\n if (typeSelector === hostScope) {\n return paren;\n // otherwise, this selector should not match in this scope so\n // output a bogus selector.\n } else {\n return SELECTOR_NO_MATCH;\n }\n } else {\n // make sure to do a replace here to catch selectors like:\n // `:host(.foo)::before`\n return selector.replace(HOST_PAREN, function(m, host, paren) {\n return hostScope + paren;\n });\n }\n // if no paren, do a straight :host replacement.\n // TODO(sorvell): this should not strictly be necessary but\n // it's needed to maintain support for `:host[foo]` type selectors\n // which have been improperly used under Shady DOM. This should be\n // deprecated.\n } else {\n return selector.replace(HOST, hostScope);\n }\n }\n\n /**\n * @param {StyleNode} rule\n */\n documentRule(rule) {\n // reset selector in case this is redone.\n rule['selector'] = rule['parsedSelector'];\n this.normalizeRootSelector(rule);\n this._transformRule(rule, this._transformDocumentSelector);\n }\n\n /**\n * @param {StyleNode} rule\n */\n normalizeRootSelector(rule) {\n if (rule['selector'] === ROOT) {\n rule['selector'] = 'html';\n }\n }\n\n/**\n * @param {string} selector\n */\n _transformDocumentSelector(selector) {\n return selector.match(SLOTTED) ?\n this._transformComplexSelector(selector, SCOPE_DOC_SELECTOR) :\n this._transformSimpleSelector(selector.trim(), SCOPE_DOC_SELECTOR);\n }\n}\n\nlet NTH = /:(nth[-\\w]+)\\(([^)]+)\\)/;\nlet SCOPE_DOC_SELECTOR = `:not(.${SCOPE_NAME})`;\nlet COMPLEX_SELECTOR_SEP = ',';\nlet SIMPLE_SELECTOR_SEP = /(^|[\\s>+~]+)((?:\\[.+?\\]|[^\\s>+~=\\[])+)/g;\nlet SIMPLE_SELECTOR_PREFIX = /[[.:#*]/;\nlet HOST = ':host';\nlet ROOT = ':root';\nlet SLOTTED = '::slotted';\nlet 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\nlet HOST_PAREN = /(:host)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\n// similar to HOST_PAREN\nlet SLOTTED_PAREN = /(?:::slotted)(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))/;\nlet DIR_PAREN = /(.*):dir\\((?:(ltr|rtl))\\)/;\nlet CSS_CLASS_PREFIX = '.';\nlet PSEUDO_PREFIX = ':';\nlet CLASS = 'class';\nlet SELECTOR_NO_MATCH = 'should_not_match';\n\nexport default new StyleTransformer()","/**\n@license\nCopyright (c) 2017 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n/*\nExtremely simple css parser. Intended to be not more than what we need\nand definitely not necessarily correct =).\n*/\n\n'use strict';\n\n/** @unrestricted */\nclass StyleNode {\n constructor() {\n /** @type {number} */\n this['start'] = 0;\n /** @type {number} */\n this['end'] = 0;\n /** @type {StyleNode} */\n this['previous'] = null;\n /** @type {StyleNode} */\n this['parent'] = null;\n /** @type {Array<StyleNode>} */\n this['rules'] = null;\n /** @type {string} */\n this['parsedCssText'] = '';\n /** @type {string} */\n this['cssText'] = '';\n /** @type {boolean} */\n this['atRule'] = false;\n /** @type {number} */\n this['type'] = 0;\n /** @type {string} */\n this['keyframesName'] = '';\n /** @type {string} */\n this['selector'] = '';\n /** @type {string} */\n this['parsedSelector'] = '';\n }\n}\n\nexport {StyleNode}\n\n// given a string of css, return a simple rule tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nexport function parse(text) {\n text = clean(text);\n return parseCss(lex(text), text);\n}\n\n// remove stuff we don't care about that may hinder parsing\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction clean(cssText) {\n return cssText.replace(RX.comments, '').replace(RX.port, '');\n}\n\n// super simple {...} lexer that returns a node tree\n/**\n * @param {string} text\n * @return {StyleNode}\n */\nfunction lex(text) {\n let root = new StyleNode();\n root['start'] = 0;\n root['end'] = text.length\n let n = root;\n for (let i = 0, l = text.length; i < l; i++) {\n if (text[i] === OPEN_BRACE) {\n if (!n['rules']) {\n n['rules'] = [];\n }\n let p = n;\n let previous = p['rules'][p['rules'].length - 1] || null;\n n = new StyleNode();\n n['start'] = i + 1;\n n['parent'] = p;\n n['previous'] = previous;\n p['rules'].push(n);\n } else if (text[i] === CLOSE_BRACE) {\n n['end'] = i + 1;\n n = n['parent'] || root;\n }\n }\n return root;\n}\n\n// add selectors/cssText to node tree\n/**\n * @param {StyleNode} node\n * @param {string} text\n * @return {StyleNode}\n */\nfunction parseCss(node, text) {\n let t = text.substring(node['start'], node['end'] - 1);\n node['parsedCssText'] = node['cssText'] = t.trim();\n if (node['parent']) {\n let ss = node['previous'] ? node['previous']['end'] : node['parent']['start'];\n t = text.substring(ss, node['start'] - 1);\n t = _expandUnicodeEscapes(t);\n t = t.replace(RX.multipleSpaces, ' ');\n // TODO(sorvell): ad hoc; make selector include only after last ;\n // helps with mixin syntax\n t = t.substring(t.lastIndexOf(';') + 1);\n let s = node['parsedSelector'] = node['selector'] = t.trim();\n node['atRule'] = (s.indexOf(AT_START) === 0);\n // note, support a subset of rule types...\n if (node['atRule']) {\n if (s.indexOf(MEDIA_START) === 0) {\n node['type'] = types.MEDIA_RULE;\n } else if (s.match(RX.keyframesRule)) {\n node['type'] = types.KEYFRAMES_RULE;\n node['keyframesName'] =\n node['selector'].split(RX.multipleSpaces).pop();\n }\n } else {\n if (s.indexOf(VAR_START) === 0) {\n node['type'] = types.MIXIN_RULE;\n } else {\n node['type'] = types.STYLE_RULE;\n }\n }\n }\n let r$ = node['rules'];\n if (r$) {\n for (let i = 0, l = r$.length, r;\n (i < l) && (r = r$[i]); i++) {\n parseCss(r, text);\n }\n }\n return node;\n}\n\n/**\n * conversion of sort unicode escapes with spaces like `\\33 ` (and longer) into\n * expanded form that doesn't require trailing space `\\000033`\n * @param {string} s\n * @return {string}\n */\nfunction _expandUnicodeEscapes(s) {\n return s.replace(/\\\\([0-9a-f]{1,6})\\s/gi, function() {\n let code = arguments[1],\n repeat = 6 - code.length;\n while (repeat--) {\n code = '0' + code;\n }\n return '\\\\' + code;\n });\n}\n\n/**\n * stringify parsed css.\n * @param {StyleNode} node\n * @param {boolean=} preserveProperties\n * @param {string=} text\n * @return {string}\n */\nexport function stringify(node, preserveProperties, text = '') {\n // calc rule cssText\n let cssText = '';\n if (node['cssText'] || node['rules']) {\n let r$ = node['rules'];\n if (r$ && !_hasMixinRules(r$)) {\n for (let i = 0, l = r$.length, r;\n (i < l) && (r = r$[i]); i++) {\n cssText = stringify(r, preserveProperties, cssText);\n }\n } else {\n cssText = preserveProperties ? node['cssText'] :\n removeCustomProps(node['cssText']);\n cssText = cssText.trim();\n if (cssText) {\n cssText = ' ' + cssText + '\\n';\n }\n }\n }\n // emit rule if there is cssText\n if (cssText) {\n if (node['selector']) {\n text += node['selector'] + ' ' + OPEN_BRACE + '\\n';\n }\n text += cssText;\n if (node['selector']) {\n text += CLOSE_BRACE + '\\n\\n';\n }\n }\n return text;\n}\n\n/**\n * @param {Array<StyleNode>} rules\n * @return {boolean}\n */\nfunction _hasMixinRules(rules) {\n let r = rules[0];\n return Boolean(r) && Boolean(r['selector']) && r['selector'].indexOf(VAR_START) === 0;\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomProps(cssText) {\n cssText = removeCustomPropAssignment(cssText);\n return removeCustomPropApply(cssText);\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nexport function removeCustomPropAssignment(cssText) {\n return cssText\n .replace(RX.customProp, '')\n .replace(RX.mixinProp, '');\n}\n\n/**\n * @param {string} cssText\n * @return {string}\n */\nfunction removeCustomPropApply(cssText) {\n return cssText\n .replace(RX.mixinApply, '')\n .replace(RX.varApply, '');\n}\n\n/** @enum {number} */\nexport const types = {\n STYLE_RULE: 1,\n KEYFRAMES_RULE: 7,\n MEDIA_RULE: 4,\n MIXIN_RULE: 1000\n}\n\nconst OPEN_BRACE = '{';\nconst CLOSE_BRACE = '}';\n\n// helper regexp's\nconst RX = {\n comments: /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//gim,\n port: /@import[^;]*;/gim,\n customProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?(?:[;\\n]|$)/gim,\n mixinProp: /(?:^[^;\\-\\s}]+)?--[^;{}]*?:[^{};]*?{[^}]*?}(?:[;\\n]|$)?/gim,\n mixinApply: /@apply\\s*\\(?[^);]*\\)?\\s*(?:[;\\n]|$)?/gim,\n varApply: /[^;:]*?:[^;]*?var\\([^;]*\\)(?:[;\\n]|$)?/gim,\n keyframesRule: /^@[^\\s]*keyframes/,\n multipleSpaces: /\\s+/g\n}\n\nconst VAR_START = '--';\nconst MEDIA_START = '@media';\nconst AT_START = '@';\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\nimport PatchChildNode from './Interface/ChildNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n if (Native.Element_attachShadow) {\n Utilities.setPropertyUnchecked(Element.prototype, 'attachShadow',\n /**\n * @this {Element}\n * @param {!{mode: string}} init\n * @return {ShadowRoot}\n */\n function(init) {\n const shadowRoot = Native.Element_attachShadow.call(this, init);\n this.__CE_shadowRoot = shadowRoot;\n return shadowRoot;\n });\n } else {\n console.warn('Custom Elements: `Element#attachShadow` was not patched.');\n }\n\n\n function patch_innerHTML(destination, baseDescriptor) {\n Object.defineProperty(destination, 'innerHTML', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: /** @this {Element} */ function(htmlString) {\n const isConnected = Utilities.isConnected(this);\n\n // NOTE: In IE11, when using the native `innerHTML` setter, all nodes\n // that were previously descendants of the context element have all of\n // their children removed as part of the set - the entire subtree is\n // 'disassembled'. This work around walks the subtree *before* using the\n // native setter.\n /** @type {!Array<!Element>|undefined} */\n let removedElements = undefined;\n if (isConnected) {\n removedElements = [];\n Utilities.walkDeepDescendantElements(this, element => {\n if (element !== this) {\n removedElements.push(element);\n }\n });\n }\n\n baseDescriptor.set.call(this, htmlString);\n\n if (removedElements) {\n for (let i = 0; i < removedElements.length; i++) {\n const element = removedElements[i];\n if (element.__CE_state === CEState.custom) {\n internals.disconnectedCallback(element);\n }\n }\n }\n\n // Only create custom elements if this element's owner document is\n // associated with the registry.\n if (!this.ownerDocument.__CE_hasRegistry) {\n internals.patchTree(this);\n } else {\n internals.patchAndUpgradeTree(this);\n }\n return htmlString;\n },\n });\n }\n\n if (Native.Element_innerHTML && Native.Element_innerHTML.get) {\n patch_innerHTML(Element.prototype, Native.Element_innerHTML);\n } else if (Native.HTMLElement_innerHTML && Native.HTMLElement_innerHTML.get) {\n patch_innerHTML(HTMLElement.prototype, Native.HTMLElement_innerHTML);\n } else {\n\n /** @type {HTMLDivElement} */\n const rawDiv = Native.Document_createElement.call(document, 'div');\n\n internals.addPatch(function(element) {\n patch_innerHTML(element, {\n enumerable: true,\n configurable: true,\n // Implements getting `innerHTML` by performing an unpatched `cloneNode`\n // of the element and returning the resulting element's `innerHTML`.\n // TODO: Is this too expensive?\n get: /** @this {Element} */ function() {\n return Native.Node_cloneNode.call(this, true).innerHTML;\n },\n // Implements setting `innerHTML` by creating an unpatched element,\n // setting `innerHTML` of that element and replacing the target\n // element's children with those of the unpatched element.\n set: /** @this {Element} */ function(assignedValue) {\n // NOTE: re-route to `content` for `template` elements.\n // We need to do this because `template.appendChild` does not\n // route into `template.content`.\n /** @type {!Node} */\n const content = this.localName === 'template' ? (/** @type {!HTMLTemplateElement} */ (this)).content : this;\n rawDiv.innerHTML = assignedValue;\n\n while (content.childNodes.length > 0) {\n Native.Node_removeChild.call(content, content.childNodes[0]);\n }\n while (rawDiv.childNodes.length > 0) {\n Native.Node_appendChild.call(content, rawDiv.childNodes[0]);\n }\n },\n });\n });\n }\n\n\n Utilities.setPropertyUnchecked(Element.prototype, 'setAttribute',\n /**\n * @this {Element}\n * @param {string} name\n * @param {string} newValue\n */\n function(name, newValue) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttribute.call(this, name, newValue);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n Native.Element_setAttribute.call(this, name, newValue);\n newValue = Native.Element_getAttribute.call(this, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, null);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'setAttributeNS',\n /**\n * @this {Element}\n * @param {?string} namespace\n * @param {string} name\n * @param {string} newValue\n */\n function(namespace, name, newValue) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n }\n\n const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n Native.Element_setAttributeNS.call(this, namespace, name, newValue);\n newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'removeAttribute',\n /**\n * @this {Element}\n * @param {string} name\n */\n function(name) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_removeAttribute.call(this, name);\n }\n\n const oldValue = Native.Element_getAttribute.call(this, name);\n Native.Element_removeAttribute.call(this, name);\n if (oldValue !== null) {\n internals.attributeChangedCallback(this, name, oldValue, null, null);\n }\n });\n\n Utilities.setPropertyUnchecked(Element.prototype, 'removeAttributeNS',\n /**\n * @this {Element}\n * @param {?string} namespace\n * @param {string} name\n */\n function(namespace, name) {\n // Fast path for non-custom elements.\n if (this.__CE_state !== CEState.custom) {\n return Native.Element_removeAttributeNS.call(this, namespace, name);\n }\n\n const oldValue = Native.Element_getAttributeNS.call(this, namespace, name);\n Native.Element_removeAttributeNS.call(this, namespace, name);\n // In older browsers, `Element#getAttributeNS` may return the empty string\n // instead of null if the attribute does not exist. For details, see;\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttributeNS#Notes\n const newValue = Native.Element_getAttributeNS.call(this, namespace, name);\n if (oldValue !== newValue) {\n internals.attributeChangedCallback(this, name, oldValue, newValue, namespace);\n }\n });\n\n\n function patch_insertAdjacentElement(destination, baseMethod) {\n Utilities.setPropertyUnchecked(destination, 'insertAdjacentElement',\n /**\n * @this {Element}\n * @param {string} where\n * @param {!Element} element\n * @return {?Element}\n */\n function(where, element) {\n const wasConnected = Utilities.isConnected(element);\n const insertedElement = /** @type {!Element} */\n (baseMethod.call(this, where, element));\n\n if (wasConnected) {\n internals.disconnectTree(element);\n }\n\n if (Utilities.isConnected(insertedElement)) {\n internals.connectTree(element);\n }\n return insertedElement;\n });\n }\n\n if (Native.HTMLElement_insertAdjacentElement) {\n patch_insertAdjacentElement(HTMLElement.prototype, Native.HTMLElement_insertAdjacentElement);\n } else if (Native.Element_insertAdjacentElement) {\n patch_insertAdjacentElement(Element.prototype, Native.Element_insertAdjacentElement);\n } else {\n console.warn('Custom Elements: `Element#insertAdjacentElement` was not patched.');\n }\n\n\n 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 * @enum {number}\n */\nconst CustomElementState = {\n custom: 1,\n failed: 2,\n};\n\nexport default CustomElementState;\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n * before: !function(...(!Node|string)),\n * after: !function(...(!Node|string)),\n * replaceWith: !function(...(!Node|string)),\n * remove: !function(),\n * }}\n */\nlet ChildNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ChildNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['before'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.before.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['after'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.after.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['replaceWith'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n const wasConnected = Utilities.isConnected(this);\n\n builtIn.replaceWith.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (wasConnected) {\n internals.disconnectTree(this);\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n destination['remove'] = function() {\n const wasConnected = Utilities.isConnected(this);\n\n builtIn.remove.call(this);\n\n if (wasConnected) {\n internals.disconnectTree(this);\n }\n };\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n // `Node#nodeValue` is implemented on `Attr`.\n // `Node#textContent` is implemented on `Attr`, `Element`.\n\n Utilities.setPropertyUnchecked(Node.prototype, 'insertBefore',\n /**\n * @this {Node}\n * @param {!Node} node\n * @param {?Node} refNode\n * @return {!Node}\n */\n function(node, refNode) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_insertBefore.call(this, node, refNode);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'appendChild',\n /**\n * @this {Node}\n * @param {!Node} node\n * @return {!Node}\n */\n function(node) {\n if (node instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(node.childNodes);\n const nativeResult = Native.Node_appendChild.call(this, node);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_appendChild.call(this, node);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n if (Utilities.isConnected(this)) {\n internals.connectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'cloneNode',\n /**\n * @this {Node}\n * @param {boolean=} deep\n * @return {!Node}\n */\n function(deep) {\n const clone = Native.Node_cloneNode.call(this, deep);\n // Only create custom elements if this element's owner document is\n // associated with the registry.\n if (!this.ownerDocument.__CE_hasRegistry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'removeChild',\n /**\n * @this {Node}\n * @param {!Node} node\n * @return {!Node}\n */\n function(node) {\n const nodeWasConnected = Utilities.isConnected(node);\n const nativeResult = Native.Node_removeChild.call(this, node);\n\n if (nodeWasConnected) {\n internals.disconnectTree(node);\n }\n\n return nativeResult;\n });\n\n Utilities.setPropertyUnchecked(Node.prototype, 'replaceChild',\n /**\n * @this {Node}\n * @param {!Node} nodeToInsert\n * @param {!Node} nodeToRemove\n * @return {!Node}\n */\n function(nodeToInsert, nodeToRemove) {\n if (nodeToInsert instanceof DocumentFragment) {\n const insertedNodes = Array.prototype.slice.apply(nodeToInsert.childNodes);\n const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n\n // DocumentFragments can't be connected, so `disconnectTree` will never\n // need to be called on a DocumentFragment's children after inserting it.\n\n if (Utilities.isConnected(this)) {\n internals.disconnectTree(nodeToRemove);\n for (let i = 0; i < insertedNodes.length; i++) {\n internals.connectTree(insertedNodes[i]);\n }\n }\n\n return nativeResult;\n }\n\n const nodeToInsertWasConnected = Utilities.isConnected(nodeToInsert);\n const nativeResult = Native.Node_replaceChild.call(this, nodeToInsert, nodeToRemove);\n const thisIsConnected = Utilities.isConnected(this);\n\n if (thisIsConnected) {\n internals.disconnectTree(nodeToRemove);\n }\n\n if (nodeToInsertWasConnected) {\n internals.disconnectTree(nodeToInsert);\n }\n\n if (thisIsConnected) {\n internals.connectTree(nodeToInsert);\n }\n\n return nativeResult;\n });\n\n\n function patch_textContent(destination, baseDescriptor) {\n Object.defineProperty(destination, 'textContent', {\n enumerable: baseDescriptor.enumerable,\n configurable: true,\n get: baseDescriptor.get,\n set: /** @this {Node} */ function(assignedValue) {\n // If this is a text node then there are no nodes to disconnect.\n if (this.nodeType === Node.TEXT_NODE) {\n baseDescriptor.set.call(this, assignedValue);\n return;\n }\n\n let removedNodes = undefined;\n // Checking for `firstChild` is faster than reading `childNodes.length`\n // to compare with 0.\n if (this.firstChild) {\n // Using `childNodes` is faster than `children`, even though we only\n // care about elements.\n const childNodes = this.childNodes;\n const childNodesLength = childNodes.length;\n if (childNodesLength > 0 && Utilities.isConnected(this)) {\n // Copying an array by iterating is faster than using slice.\n removedNodes = new Array(childNodesLength);\n for (let i = 0; i < childNodesLength; i++) {\n removedNodes[i] = childNodes[i];\n }\n }\n }\n\n baseDescriptor.set.call(this, assignedValue);\n\n if (removedNodes) {\n for (let i = 0; i < removedNodes.length; i++) {\n internals.disconnectTree(removedNodes[i]);\n }\n }\n },\n });\n }\n\n if (Native.Node_textContent && Native.Node_textContent.get) {\n patch_textContent(Node.prototype, Native.Node_textContent);\n } else {\n internals.addPatch(function(element) {\n patch_textContent(element, {\n enumerable: true,\n configurable: true,\n // NOTE: This implementation of the `textContent` getter assumes that\n // text nodes' `textContent` getter will not be patched.\n get: /** @this {Node} */ function() {\n /** @type {!Array<string>} */\n const parts = [];\n\n for (let i = 0; i < this.childNodes.length; i++) {\n parts.push(this.childNodes[i].textContent);\n }\n\n return parts.join('');\n },\n set: /** @this {Node} */ function(assignedValue) {\n while (this.firstChild) {\n Native.Node_removeChild.call(this, this.firstChild);\n }\n Native.Node_appendChild.call(this, document.createTextNode(assignedValue));\n },\n });\n });\n }\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport * as Utilities from '../Utilities.js';\n\nimport PatchParentNode from './Interface/ParentNode.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n Utilities.setPropertyUnchecked(Document.prototype, 'createElement',\n /**\n * @this {Document}\n * @param {string} localName\n * @return {!Element}\n */\n function(localName) {\n // Only create custom elements if this document is associated with the registry.\n if (this.__CE_hasRegistry) {\n const definition = internals.localNameToDefinition(localName);\n if (definition) {\n return new (definition.constructor)();\n }\n }\n\n const result = /** @type {!Element} */\n (Native.Document_createElement.call(this, localName));\n internals.patch(result);\n return result;\n });\n\n Utilities.setPropertyUnchecked(Document.prototype, 'importNode',\n /**\n * @this {Document}\n * @param {!Node} node\n * @param {boolean=} deep\n * @return {!Node}\n */\n function(node, deep) {\n const clone = Native.Document_importNode.call(this, node, deep);\n // Only create custom elements if this document is associated with the registry.\n if (!this.__CE_hasRegistry) {\n internals.patchTree(clone);\n } else {\n internals.patchAndUpgradeTree(clone);\n }\n return clone;\n });\n\n const NS_HTML = \"http://www.w3.org/1999/xhtml\";\n\n Utilities.setPropertyUnchecked(Document.prototype, 'createElementNS',\n /**\n * @this {Document}\n * @param {?string} namespace\n * @param {string} localName\n * @return {!Element}\n */\n function(namespace, localName) {\n // Only create custom elements if this document is associated with the registry.\n if (this.__CE_hasRegistry && (namespace === null || namespace === NS_HTML)) {\n const definition = internals.localNameToDefinition(localName);\n if (definition) {\n return new (definition.constructor)();\n }\n }\n\n const result = /** @type {!Element} */\n (Native.Document_createElementNS.call(this, namespace, localName));\n internals.patch(result);\n return result;\n });\n\n PatchParentNode(internals, Document.prototype, {\n prepend: Native.Document_prepend,\n append: Native.Document_append,\n });\n};\n","import CustomElementInternals from '../../CustomElementInternals.js';\nimport * as Utilities from '../../Utilities.js';\n\n/**\n * @typedef {{\n * prepend: !function(...(!Node|string)),\n * append: !function(...(!Node|string)),\n * }}\n */\nlet ParentNodeNativeMethods;\n\n/**\n * @param {!CustomElementInternals} internals\n * @param {!Object} destination\n * @param {!ParentNodeNativeMethods} builtIn\n */\nexport default function(internals, destination, builtIn) {\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['prepend'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.prepend.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n\n /**\n * @param {...(!Node|string)} nodes\n */\n destination['append'] = function(...nodes) {\n // TODO: Fix this for when one of `nodes` is a DocumentFragment!\n const connectedBefore = /** @type {!Array<!Node>} */ (nodes.filter(node => {\n // DocumentFragments are not connected and will not be added to the list.\n return node instanceof Node && Utilities.isConnected(node);\n }));\n\n builtIn.append.apply(this, nodes);\n\n for (let i = 0; i < connectedBefore.length; i++) {\n internals.disconnectTree(connectedBefore[i]);\n }\n\n if (Utilities.isConnected(this)) {\n for (let i = 0; i < nodes.length; i++) {\n const node = nodes[i];\n if (node instanceof Element) {\n internals.connectTree(node);\n }\n }\n }\n };\n};\n","import Native from './Native.js';\nimport CustomElementInternals from '../CustomElementInternals.js';\nimport CEState from '../CustomElementState.js';\nimport AlreadyConstructedMarker from '../AlreadyConstructedMarker.js';\n\n/**\n * @param {!CustomElementInternals} internals\n */\nexport default function(internals) {\n window['HTMLElement'] = (function() {\n /**\n * @type {function(new: HTMLElement): !HTMLElement}\n */\n function HTMLElement() {\n // This should really be `new.target` but `new.target` can't be emulated\n // in ES5. Assuming the user keeps the default value of the constructor's\n // prototype's `constructor` property, this is equivalent.\n /** @type {!Function} */\n const constructor = this.constructor;\n\n const definition = internals.constructorToDefinition(constructor);\n if (!definition) {\n throw new Error('The custom element being constructed was not registered with `customElements`.');\n }\n\n const constructionStack = definition.constructionStack;\n\n if (constructionStack.length === 0) {\n const element = Native.Document_createElement.call(document, definition.localName);\n Object.setPrototypeOf(element, constructor.prototype);\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n internals.patch(element);\n return element;\n }\n\n const lastIndex = constructionStack.length - 1;\n const element = constructionStack[lastIndex];\n if (element === AlreadyConstructedMarker) {\n throw new Error('The HTMLElement constructor was either called reentrantly for this constructor or called multiple times.');\n }\n constructionStack[lastIndex] = AlreadyConstructedMarker;\n\n Object.setPrototypeOf(element, constructor.prototype);\n internals.patch(/** @type {!HTMLElement} */ (element));\n\n return element;\n }\n\n HTMLElement.prototype = Native.HTMLElement.prototype;\n\n return HTMLElement;\n })();\n};\n","import CustomElementInternals from './CustomElementInternals.js';\nimport DocumentConstructionObserver from './DocumentConstructionObserver.js';\nimport Deferred from './Deferred.js';\nimport * as Utilities from './Utilities.js';\n\n/**\n * @unrestricted\n */\nexport default class CustomElementRegistry {\n\n /**\n * @param {!CustomElementInternals} internals\n */\n constructor(internals) {\n /**\n * @private\n * @type {boolean}\n */\n this._elementDefinitionIsRunning = false;\n\n /**\n * @private\n * @type {!CustomElementInternals}\n */\n this._internals = internals;\n\n /**\n * @private\n * @type {!Map<string, !Deferred<undefined>>}\n */\n this._whenDefinedDeferred = new Map();\n\n /**\n * The default flush callback triggers the document walk synchronously.\n * @private\n * @type {!Function}\n */\n this._flushCallback = fn => fn();\n\n /**\n * @private\n * @type {boolean}\n */\n this._flushPending = false;\n\n /**\n * @private\n * @type {!Array<string>}\n */\n this._unflushedLocalNames = [];\n\n /**\n * @private\n * @type {!DocumentConstructionObserver}\n */\n this._documentConstructionObserver = new DocumentConstructionObserver(internals, document);\n }\n\n /**\n * @param {string} localName\n * @param {!Function} constructor\n */\n define(localName, constructor) {\n if (!(constructor instanceof Function)) {\n throw new TypeError('Custom element constructors must be functions.');\n }\n\n if (!Utilities.isValidCustomElementName(localName)) {\n throw new SyntaxError(`The element name '${localName}' is not valid.`);\n }\n\n if (this._internals.localNameToDefinition(localName)) {\n throw new Error(`A custom element with name '${localName}' has already been defined.`);\n }\n\n if (this._elementDefinitionIsRunning) {\n throw new Error('A custom element is already being defined.');\n }\n this._elementDefinitionIsRunning = true;\n\n let connectedCallback;\n let disconnectedCallback;\n let adoptedCallback;\n let attributeChangedCallback;\n let observedAttributes;\n try {\n /** @type {!Object} */\n const prototype = constructor.prototype;\n if (!(prototype instanceof Object)) {\n throw new TypeError('The custom element constructor\\'s prototype is not an object.');\n }\n\n function getCallback(name) {\n const callbackValue = prototype[name];\n if (callbackValue !== undefined && !(callbackValue instanceof Function)) {\n throw new Error(`The '${name}' callback must be a function.`);\n }\n return callbackValue;\n }\n\n connectedCallback = getCallback('connectedCallback');\n disconnectedCallback = getCallback('disconnectedCallback');\n adoptedCallback = getCallback('adoptedCallback');\n attributeChangedCallback = getCallback('attributeChangedCallback');\n observedAttributes = constructor['observedAttributes'] || [];\n } catch (e) {\n return;\n } finally {\n this._elementDefinitionIsRunning = false;\n }\n\n const definition = {\n localName,\n constructor,\n connectedCallback,\n disconnectedCallback,\n adoptedCallback,\n attributeChangedCallback,\n observedAttributes,\n constructionStack: [],\n };\n\n this._internals.setDefinition(localName, definition);\n\n this._unflushedLocalNames.push(localName);\n\n // If we've already called the flush callback and it hasn't called back yet,\n // don't call it again.\n if (!this._flushPending) {\n this._flushPending = true;\n this._flushCallback(() => this._flush());\n }\n }\n\n _flush() {\n // If no new definitions were defined, don't attempt to flush. This could\n // happen if a flush callback keeps the function it is given and calls it\n // multiple times.\n if (this._flushPending === false) return;\n\n this._flushPending = false;\n this._internals.patchAndUpgradeTree(document);\n\n while (this._unflushedLocalNames.length > 0) {\n const localName = this._unflushedLocalNames.shift();\n const deferred = this._whenDefinedDeferred.get(localName);\n if (deferred) {\n deferred.resolve(undefined);\n }\n }\n }\n\n /**\n * @param {string} localName\n * @return {Function|undefined}\n */\n get(localName) {\n const definition = this._internals.localNameToDefinition(localName);\n if (definition) {\n return definition.constructor;\n }\n\n return undefined;\n }\n\n /**\n * @param {string} localName\n * @return {!Promise<undefined>}\n */\n whenDefined(localName) {\n if (!Utilities.isValidCustomElementName(localName)) {\n return Promise.reject(new SyntaxError(`'${localName}' is not a valid custom element name.`));\n }\n\n const prior = this._whenDefinedDeferred.get(localName);\n if (prior) {\n return prior.toPromise();\n }\n\n const deferred = new Deferred();\n this._whenDefinedDeferred.set(localName, deferred);\n\n const definition = this._internals.localNameToDefinition(localName);\n // Resolve immediately only if the given local name has a definition *and*\n // the full document walk to upgrade elements with that local name has\n // already happened.\n if (definition && this._unflushedLocalNames.indexOf(localName) === -1) {\n deferred.resolve(undefined);\n }\n\n return deferred.toPromise();\n }\n\n polyfillWrapFlushCallback(outer) {\n this._documentConstructionObserver.disconnect();\n const inner = this._flushCallback;\n this._flushCallback = flush => outer(() => inner(flush));\n }\n}\n\n// Closure compiler exports.\nwindow['CustomElementRegistry'] = CustomElementRegistry;\nCustomElementRegistry.prototype['define'] = CustomElementRegistry.prototype.define;\nCustomElementRegistry.prototype['get'] = CustomElementRegistry.prototype.get;\nCustomElementRegistry.prototype['whenDefined'] = CustomElementRegistry.prototype.whenDefined;\nCustomElementRegistry.prototype['polyfillWrapFlushCallback'] = CustomElementRegistry.prototype.polyfillWrapFlushCallback;\n","/**\n * @template T\n */\nexport default class Deferred {\n constructor() {\n /**\n * @private\n * @type {T|undefined}\n */\n this._value = undefined;\n\n /**\n * @private\n * @type {Function|undefined}\n */\n this._resolve = undefined;\n\n /**\n * @private\n * @type {!Promise<T>}\n */\n this._promise = new Promise(resolve => {\n this._resolve = resolve;\n\n if (this._value) {\n resolve(this._value);\n }\n });\n }\n\n /**\n * @param {T} value\n */\n resolve(value) {\n if (this._value) {\n throw new Error('Already resolved.');\n }\n\n this._value = value;\n\n if (this._resolve) {\n this._resolve(value);\n }\n }\n\n /**\n * @return {!Promise<T>}\n */\n toPromise() {\n return this._promise;\n }\n}\n","import CustomElementInternals from './CustomElementInternals.js';\n\nexport default class DocumentConstructionObserver {\n constructor(internals, doc) {\n /**\n * @type {!CustomElementInternals}\n */\n this._internals = internals;\n\n /**\n * @type {!Document}\n */\n this._document = doc;\n\n /**\n * @type {MutationObserver|undefined}\n */\n this._observer = undefined;\n\n\n // Simulate tree construction for all currently accessible nodes in the\n // document.\n this._internals.patchAndUpgradeTree(this._document);\n\n if (this._document.readyState === 'loading') {\n this._observer = new MutationObserver(this._handleMutations.bind(this));\n\n // Nodes created by the parser are given to the observer *before* the next\n // task runs. Inline scripts are run in a new task. This means that the\n // observer will be able to handle the newly parsed nodes before the inline\n // script is run.\n this._observer.observe(this._document, {\n childList: true,\n subtree: true,\n });\n }\n }\n\n disconnect() {\n if (this._observer) {\n this._observer.disconnect();\n }\n }\n\n /**\n * @param {!Array<!MutationRecord>} mutations\n */\n _handleMutations(mutations) {\n // Once the document's `readyState` is 'interactive' or 'complete', all new\n // nodes created within that document will be the result of script and\n // should be handled by patching.\n const readyState = this._document.readyState;\n if (readyState === 'interactive' || readyState === 'complete') {\n this.disconnect();\n }\n\n for (let i = 0; i < mutations.length; i++) {\n const addedNodes = mutations[i].addedNodes;\n for (let j = 0; j < addedNodes.length; j++) {\n const node = addedNodes[j];\n this._internals.patchAndUpgradeTree(node);\n }\n }\n }\n}\n","import * as Utilities from './Utilities.js';\nimport CEState from './CustomElementState.js';\n\nexport default class CustomElementInternals {\n constructor() {\n /** @type {!Map<string, !CustomElementDefinition>} */\n this._localNameToDefinition = new Map();\n\n /** @type {!Map<!Function, !CustomElementDefinition>} */\n this._constructorToDefinition = new Map();\n\n /** @type {!Array<!function(!Node)>} */\n this._patches = [];\n\n /** @type {boolean} */\n this._hasPatches = false;\n }\n\n /**\n * @param {string} localName\n * @param {!CustomElementDefinition} definition\n */\n setDefinition(localName, definition) {\n this._localNameToDefinition.set(localName, definition);\n this._constructorToDefinition.set(definition.constructor, definition);\n }\n\n /**\n * @param {string} localName\n * @return {!CustomElementDefinition|undefined}\n */\n localNameToDefinition(localName) {\n return this._localNameToDefinition.get(localName);\n }\n\n /**\n * @param {!Function} constructor\n * @return {!CustomElementDefinition|undefined}\n */\n constructorToDefinition(constructor) {\n return this._constructorToDefinition.get(constructor);\n }\n\n /**\n * @param {!function(!Node)} listener\n */\n addPatch(listener) {\n this._hasPatches = true;\n this._patches.push(listener);\n }\n\n /**\n * @param {!Node} node\n */\n patchTree(node) {\n if (!this._hasPatches) return;\n\n Utilities.walkDeepDescendantElements(node, element => this.patch(element));\n }\n\n /**\n * @param {!Node} node\n */\n patch(node) {\n if (!this._hasPatches) return;\n\n if (node.__CE_patched) return;\n node.__CE_patched = true;\n\n for (let i = 0; i < this._patches.length; i++) {\n this._patches[i](node);\n }\n }\n\n /**\n * @param {!Node} root\n */\n connectTree(root) {\n const elements = [];\n\n Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (element.__CE_state === CEState.custom) {\n this.connectedCallback(element);\n } else {\n this.upgradeElement(element);\n }\n }\n }\n\n /**\n * @param {!Node} root\n */\n disconnectTree(root) {\n const elements = [];\n\n Utilities.walkDeepDescendantElements(root, element => elements.push(element));\n\n for (let i = 0; i < elements.length; i++) {\n const element = elements[i];\n if (element.__CE_state === CEState.custom) {\n this.disconnectedCallback(element);\n }\n }\n }\n\n /**\n * Upgrades all uncustomized custom elements at and below a root node for\n * which there is a definition. When custom element reaction callbacks are\n * assumed to be called synchronously (which, by the current DOM / HTML spec\n * definitions, they are *not*), callbacks for both elements customized\n * synchronously by the parser and elements being upgraded occur in the same\n * relative order.\n *\n * NOTE: This function, when used to simulate the construction of a tree that\n * is already created but not customized (i.e. by the parser), does *not*\n * prevent the element from reading the 'final' (true) state of the tree. For\n * example, the element, during truly synchronous parsing / construction would\n * see that it contains no children as they have not yet been inserted.\n * However, this function does not modify the tree, the element will\n * (incorrectly) have children. Additionally, self-modification restrictions\n * for custom element constructors imposed by the DOM spec are *not* enforced.\n *\n *\n * The following nested list shows the steps extending down from the HTML\n * spec's parsing section that cause elements to be synchronously created and\n * upgraded:\n *\n * The \"in body\" insertion mode:\n * https://html.spec.whatwg.org/multipage/syntax.html#parsing-main-inbody\n * - Switch on token:\n * .. other cases ..\n * -> Any other start tag\n * - [Insert an HTML element](below) for the token.\n *\n * Insert an HTML element:\n * https://html.spec.whatwg.org/multipage/syntax.html#insert-an-html-element\n * - Insert a foreign element for the token in the HTML namespace:\n * https://html.spec.whatwg.org/multipage/syntax.html#insert-a-foreign-element\n * - Create an element for a token:\n * https://html.spec.whatwg.org/multipage/syntax.html#create-an-element-for-the-token\n * - Will execute script flag is true?\n * - (Element queue pushed to the custom element reactions stack.)\n * - Create an element:\n * https://dom.spec.whatwg.org/#concept-create-element\n * - Sync CE flag is true?\n * - Constructor called.\n * - Self-modification restrictions enforced.\n * - Sync CE flag is false?\n * - (Upgrade reaction enqueued.)\n * - Attributes appended to element.\n * (`attributeChangedCallback` reactions enqueued.)\n * - Will execute script flag is true?\n * - (Element queue popped from the custom element reactions stack.\n * Reactions in the popped stack are invoked.)\n * - (Element queue pushed to the custom element reactions stack.)\n * - Insert the element:\n * https://dom.spec.whatwg.org/#concept-node-insert\n * - Shadow-including descendants are connected. During parsing\n * construction, there are no shadow-*excluding* descendants.\n * However, the constructor may have validly attached a shadow\n * tree to itself and added descendants to that shadow tree.\n * (`connectedCallback` reactions enqueued.)\n * - (Element queue popped from the custom element reactions stack.\n * Reactions in the popped stack are invoked.)\n *\n * @param {!Node} root\n * @param {!Set<Node>=} visitedImports\n */\n patchAndUpgradeTree(root, visitedImports = new Set()) {\n const elements = [];\n\n const gatherElements = element => {\n if (element.localName === 'link' && element.getAttribute('rel') === 'import') {\n // The HTML Imports polyfill sets a descendant element of the link to\n // the `import` property, specifically this is *not* a Document.\n const importNode = /** @type {?Node} */ (element.import);\n\n if (importNode instanceof Node && importNode.readyState === 'complete') {\n importNode.__CE_isImportDocument = true;\n\n // Connected links are associated with the registry.\n importNode.__CE_hasRegistry = true;\n } else {\n // If this link's import root is not available, its contents can't be\n // walked. Wait for 'load' and walk it when it's ready.\n element.addEventListener('load', () => {\n const importNode = /** @type {!Node} */ (element.import);\n\n if (importNode.__CE_documentLoadHandled) return;\n importNode.__CE_documentLoadHandled = true;\n\n importNode.__CE_isImportDocument = true;\n\n // Connected links are associated with the registry.\n importNode.__CE_hasRegistry = true;\n\n // Clone the `visitedImports` set that was populated sync during\n // the `patchAndUpgradeTree` call that caused this 'load' handler to\n // be added. Then, remove *this* link's import node so that we can\n // walk that import again, even if it was partially walked later\n // during the same `patchAndUpgradeTree` call.\n const clonedVisitedImports = new Set(visitedImports);\n visitedImports.delete(importNode);\n\n this.patchAndUpgradeTree(importNode, visitedImports);\n });\n }\n } else {\n elements.push(element);\n }\n };\n\n // `walkDeepDescendantElements` populates (and internally checks against)\n // `visitedImports` when traversing a loaded import.\n Utilities.walkDeepDescendantElements(root, gatherElements, visitedImports);\n\n if (this._hasPatches) {\n for (let i = 0; i < elements.length; i++) {\n this.patch(elements[i]);\n }\n }\n\n for (let i = 0; i < elements.length; i++) {\n this.upgradeElement(elements[i]);\n }\n }\n\n /**\n * @param {!Element} element\n */\n upgradeElement(element) {\n const currentState = element.__CE_state;\n if (currentState !== undefined) return;\n\n const definition = this.localNameToDefinition(element.localName);\n if (!definition) return;\n\n definition.constructionStack.push(element);\n\n const constructor = definition.constructor;\n try {\n try {\n let result = new (constructor)();\n if (result !== element) {\n throw new Error('The custom element constructor did not produce the element being upgraded.');\n }\n } finally {\n definition.constructionStack.pop();\n }\n } catch (e) {\n element.__CE_state = CEState.failed;\n throw e;\n }\n\n element.__CE_state = CEState.custom;\n element.__CE_definition = definition;\n\n if (definition.attributeChangedCallback) {\n const observedAttributes = definition.observedAttributes;\n for (let i = 0; i < observedAttributes.length; i++) {\n const name = observedAttributes[i];\n const value = element.getAttribute(name);\n if (value !== null) {\n this.attributeChangedCallback(element, name, null, value, null);\n }\n }\n }\n\n if (Utilities.isConnected(element)) {\n this.connectedCallback(element);\n }\n }\n\n /**\n * @param {!Element} element\n */\n connectedCallback(element) {\n const definition = element.__CE_definition;\n if (definition.connectedCallback) {\n definition.connectedCallback.call(element);\n }\n }\n\n /**\n * @param {!Element} element\n */\n disconnectedCallback(element) {\n const definition = element.__CE_definition;\n if (definition.disconnectedCallback) {\n definition.disconnectedCallback.call(element);\n }\n }\n\n /**\n * @param {!Element} element\n * @param {string} name\n * @param {?string} oldValue\n * @param {?string} newValue\n * @param {?string} namespace\n */\n attributeChangedCallback(element, name, oldValue, newValue, namespace) {\n const definition = element.__CE_definition;\n if (\n definition.attributeChangedCallback &&\n definition.observedAttributes.indexOf(name) > -1\n ) {\n definition.attributeChangedCallback.call(element, name, oldValue, newValue, namespace);\n }\n }\n}\n","/**\n@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'use strict';\n\nimport {calculateSplices} from './array-splice'\nimport * as utils from './utils'\nimport {enqueue} from './flush'\nimport {recordChildNodes} from './logical-tree'\nimport {removeChild, insertBefore} from './native-methods'\nimport {parentNode, childNodes} from './native-tree'\nimport {patchShadowRootAccessors} from './patch-accessors'\nimport Distributor from './distributor'\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\n/**\n * @constructor\n * @extends {ShadowRoot}\n */\nexport let ShadyRoot = function(token, host) {\n if (token !== ShadyRootConstructionToken) {\n throw new TypeError('Illegal constructor');\n }\n // NOTE: this strange construction is necessary because\n // DocumentFragment cannot be subclassed on older browsers.\n let shadowRoot = document.createDocumentFragment();\n shadowRoot.__proto__ = ShadyRoot.prototype;\n /** @type {ShadyRoot} */ (shadowRoot)._init(host);\n return shadowRoot;\n};\n\nShadyRoot.prototype = Object.create(DocumentFragment.prototype);\n\nShadyRoot.prototype._init = function(host) {\n // NOTE: set a fake local name so this element can be\n // distinguished from a DocumentFragment when patching.\n // FF doesn't allow this to be `localName`\n this.__localName = 'ShadyRoot';\n // logical dom setup\n recordChildNodes(host);\n recordChildNodes(this);\n // root <=> host\n host.shadowRoot = this;\n this.host = host;\n // state flags\n this._renderPending = false;\n this._hasRendered = false;\n this._changePending = false;\n this._distributor = new Distributor(this);\n this.update();\n}\n\n\n// async render\nShadyRoot.prototype.update = function() {\n if (!this._renderPending) {\n this._renderPending = true;\n enqueue(() => this.render());\n }\n}\n\n// returns the oldest renderPending ancestor root.\nShadyRoot.prototype._getRenderRoot = function() {\n let renderRoot = this;\n let root = this;\n while (root) {\n if (root._renderPending) {\n renderRoot = root;\n }\n root = root._rendererForHost();\n }\n return renderRoot;\n}\n\n// Returns the shadyRoot `this.host` if `this.host`\n// has children that require distribution.\nShadyRoot.prototype._rendererForHost = function() {\n let root = this.host.getRootNode();\n if (utils.isShadyRoot(root)) {\n let c$ = this.host.childNodes;\n for (let i=0, c; i < c$.length; i++) {\n c = c$[i];\n if (this._distributor.isInsertionPoint(c)) {\n return root;\n }\n }\n }\n}\n\nShadyRoot.prototype.render = function() {\n if (this._renderPending) {\n this._getRenderRoot()['_render']();\n }\n}\n\n// NOTE: avoid renaming to ease testability.\nShadyRoot.prototype['_render'] = function() {\n this._renderPending = false;\n this._changePending = false;\n if (!this._skipUpdateInsertionPoints) {\n this.updateInsertionPoints();\n } else if (!this._hasRendered) {\n this.__insertionPoints = [];\n }\n this._skipUpdateInsertionPoints = false;\n // TODO(sorvell): can add a first render optimization here\n // to use if there are no insertion points\n // 1. clear host node of composed children\n // 2. appendChild the shadowRoot itself or (more robust) its logical children\n // NOTE: this didn't seem worth it in perf testing\n // but not ready to delete this info.\n // logical\n this.distribute();\n // physical\n this.compose();\n this._hasRendered = true;\n}\n\nShadyRoot.prototype.forceRender = function() {\n this._renderPending = true;\n this.render();\n}\n\nShadyRoot.prototype.distribute = function() {\n let dirtyRoots = this._distributor.distribute();\n for (let i=0; i<dirtyRoots.length; i++) {\n dirtyRoots[i]['_render']();\n }\n}\n\nShadyRoot.prototype.updateInsertionPoints = function() {\n let i$ = this._insertionPoints;\n // if any insertion points have been removed, clear their distribution info\n if (i$) {\n for (let i=0, c; i < i$.length; i++) {\n c = i$[i];\n if (c.getRootNode() !== this) {\n this._distributor.clearAssignedSlots(c);\n }\n }\n }\n i$ = this._insertionPoints = this._distributor.getInsertionPoints();\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 for (let i=0, c; i < i$.length; i++) {\n c = i$[i];\n c.__shady = c.__shady || {};\n recordChildNodes(c);\n recordChildNodes(c.parentNode);\n }\n}\n\nShadyRoot.prototype.compose = function() {\n // compose self\n // note: it's important to mark this clean before distribution\n // so that attachment that provokes additional distribution (e.g.\n // adding something to your parentNode) works\n this._composeTree();\n // TODO(sorvell): See fast paths here in Polymer v1\n // (these seem unnecessary)\n}\n\n// Reify dom such that it is at its correct rendering position\n// based on logical distribution.\nShadyRoot.prototype._composeTree = function() {\n this._updateChildNodes(this.host, this._composeNode(this.host));\n let p$ = this._getInsertionPoints();\n for (let i=0, l=p$.length, p, parent; (i<l) && (p=p$[i]); i++) {\n parent = p.parentNode;\n if ((parent !== this.host) && (parent !== this)) {\n this._updateChildNodes(parent, this._composeNode(parent));\n }\n }\n}\n\n// Returns the list of nodes which should be rendered inside `node`.\nShadyRoot.prototype._composeNode = function(node) {\n let children = [];\n let c$ = ((node.__shady && node.__shady.root) || node).childNodes;\n for (let i = 0; i < c$.length; i++) {\n let child = c$[i];\n if (this._distributor.isInsertionPoint(child)) {\n let distributedNodes = child.__shady.distributedNodes ||\n (child.__shady.distributedNodes = []);\n for (let j = 0; j < distributedNodes.length; j++) {\n let distributedNode = distributedNodes[j];\n if (this.isFinalDestination(child, distributedNode)) {\n children.push(distributedNode);\n }\n }\n } else {\n children.push(child);\n }\n }\n return children;\n}\n\nShadyRoot.prototype.isFinalDestination = function(insertionPoint, node) {\n return this._distributor.isFinalDestination(\n insertionPoint, node);\n}\n\n// Ensures that the rendered node list inside `container` is `children`.\nShadyRoot.prototype._updateChildNodes = function(container, children) {\n let composed = childNodes(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 (parentNode(n) === container) {\n removeChild.call(container, n);\n }\n composed.splice(s.index + d, 1);\n }\n d -= s.addedCount;\n }\n // process adds\n for (let i=0, s, next; (i<splices.length) && (s=splices[i]); i++) { //eslint-disable-line no-redeclare\n next = composed[s.index];\n for (let j=s.index, n; j < s.index + s.addedCount; j++) {\n n = children[j];\n insertBefore.call(container, n, next);\n // TODO(sorvell): is this splice strictly needed?\n composed.splice(j, 0, n);\n }\n }\n}\n\nShadyRoot.prototype.getInsertionPointTag = function() {\n return this._distributor.insertionPointTag;\n}\n\nShadyRoot.prototype.hasInsertionPoint = function() {\n return Boolean(this._insertionPoints && this._insertionPoints.length);\n}\n\nShadyRoot.prototype._getInsertionPoints = function() {\n if (!this._insertionPoints) {\n this.updateInsertionPoints();\n }\n return this._insertionPoints;\n}\n\n/**\n Implements a pared down version of ShadowDOM's scoping, which is easy to\n polyfill across browsers.\n*/\nexport function attachShadow(host, options) {\n if (!host) {\n throw 'Must provide a host.';\n }\n if (!options) {\n throw 'Not enough arguments.'\n }\n return new ShadyRoot(ShadyRootConstructionToken, host);\n}\n\npatchShadowRootAccessors(ShadyRoot.prototype);\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'use strict';\n\nimport {removeChild} from './native-methods'\nimport {parentNode} from './native-tree'\n\n// NOTE: normalize event contruction where necessary (IE11)\nlet NormalizedEvent = typeof Event === 'function' ? Event :\n function(inType, params) {\n params = params || {};\n var e = document.createEvent('Event');\n e.initEvent(inType, Boolean(params.bubbles), Boolean(params.cancelable));\n return e;\n };\n\nexport default class {\n\n constructor(root) {\n this.root = root;\n this.insertionPointTag = 'slot';\n }\n\n getInsertionPoints() {\n return this.root.querySelectorAll(this.insertionPointTag);\n }\n\n isInsertionPoint(node) {\n return node.localName && node.localName == this.insertionPointTag;\n }\n\n distribute() {\n if (this.root.hasInsertionPoint()) {\n return this.distributePool(this.root, this.collectPool());\n }\n return [];\n }\n\n // Gather the pool of nodes that should be distributed. We will combine\n // these with the \"content root\" to arrive at the composed tree.\n collectPool() {\n let host = this.root.host;\n let pool=[], i=0;\n for (let n=host.firstChild; n; n=n.nextSibling) {\n pool[i++] = n;\n }\n return pool;\n }\n\n // perform \"logical\" distribution; note, no actual dom is moved here,\n // instead elements are distributed into storage\n // array where applicable.\n distributePool(node, pool) {\n let dirtyRoots = [];\n let p$ = this.root._getInsertionPoints();\n for (let i=0, l=p$.length, p; (i<l) && (p=p$[i]); i++) {\n this.distributeInsertionPoint(p, pool);\n // provoke redistribution on insertion point parents\n // must do this on all candidate hosts since distribution in this\n // scope invalidates their distribution.\n // only get logical parent.\n let parent = p.parentNode;\n let root = parent && parent.__shady && parent.__shady.root\n if (root && root.hasInsertionPoint()) {\n dirtyRoots.push(root);\n }\n }\n for (let i=0; i < pool.length; i++) {\n let p = pool[i];\n if (p) {\n p.__shady = p.__shady || {};\n p.__shady.assignedSlot = undefined;\n // remove undistributed elements from physical dom.\n let parent = parentNode(p);\n if (parent) {\n removeChild.call(parent, p);\n }\n }\n }\n return dirtyRoots;\n }\n\n distributeInsertionPoint(insertionPoint, pool) {\n let prevAssignedNodes = insertionPoint.__shady.assignedNodes;\n if (prevAssignedNodes) {\n this.clearAssignedSlots(insertionPoint, true);\n }\n insertionPoint.__shady.assignedNodes = [];\n let needsSlotChange = false;\n // distribute nodes from the pool that this selector matches\n let anyDistributed = false;\n for (let i=0, l=pool.length, node; i < l; i++) {\n node=pool[i];\n // skip nodes that were already used\n if (!node) {\n continue;\n }\n // distribute this node if it matches\n if (this.matchesInsertionPoint(node, insertionPoint)) {\n if (node.__shady._prevAssignedSlot != insertionPoint) {\n needsSlotChange = true;\n }\n this.distributeNodeInto(node, insertionPoint)\n // remove this node from the pool\n pool[i] = undefined;\n // since at least one node matched, we won't need fallback content\n anyDistributed = true;\n }\n }\n // Fallback content if nothing was distributed here\n if (!anyDistributed) {\n let children = insertionPoint.childNodes;\n for (let j = 0, node; j < children.length; j++) {\n node = children[j];\n if (node.__shady._prevAssignedSlot != insertionPoint) {\n needsSlotChange = true;\n }\n this.distributeNodeInto(node, insertionPoint);\n }\n }\n // we're already dirty if a node was newly added to the slot\n // and we're also dirty if the assigned count decreased.\n if (prevAssignedNodes) {\n // TODO(sorvell): the tracking of previously assigned slots\n // could instead by done with a Set and then we could\n // avoid needing to iterate here to clear the info.\n for (let i=0; i < prevAssignedNodes.length; i++) {\n prevAssignedNodes[i].__shady._prevAssignedSlot = null;\n }\n if (insertionPoint.__shady.assignedNodes.length < prevAssignedNodes.length) {\n needsSlotChange = true;\n }\n }\n this.setDistributedNodesOnInsertionPoint(insertionPoint);\n if (needsSlotChange) {\n this._fireSlotChange(insertionPoint);\n }\n }\n\n clearAssignedSlots(slot, savePrevious) {\n let n$ = slot.__shady.assignedNodes;\n if (n$) {\n for (let i=0; i < n$.length; i++) {\n let n = n$[i];\n if (savePrevious) {\n n.__shady._prevAssignedSlot = n.__shady.assignedSlot;\n }\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.__shady.assignedSlot === slot) {\n n.__shady.assignedSlot = null;\n }\n }\n }\n }\n\n matchesInsertionPoint(node, insertionPoint) {\n let slotName = insertionPoint.getAttribute('name');\n slotName = slotName ? slotName.trim() : '';\n let slot = node.getAttribute && node.getAttribute('slot');\n slot = slot ? slot.trim() : '';\n return (slot == slotName);\n }\n\n distributeNodeInto(child, insertionPoint) {\n insertionPoint.__shady.assignedNodes.push(child);\n child.__shady.assignedSlot = insertionPoint;\n }\n\n setDistributedNodesOnInsertionPoint(insertionPoint) {\n let n$ = insertionPoint.__shady.assignedNodes;\n insertionPoint.__shady.distributedNodes = [];\n for (let i=0, n; (i<n$.length) && (n=n$[i]) ; i++) {\n if (this.isInsertionPoint(n)) {\n let d$ = n.__shady.distributedNodes;\n if (d$) {\n for (let j=0; j < d$.length; j++) {\n insertionPoint.__shady.distributedNodes.push(d$[j]);\n }\n }\n } else {\n insertionPoint.__shady.distributedNodes.push(n$[i]);\n }\n }\n }\n\n _fireSlotChange(insertionPoint) {\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 insertionPoint.dispatchEvent(new NormalizedEvent('slotchange'));\n if (insertionPoint.__shady.assignedSlot) {\n this._fireSlotChange(insertionPoint.__shady.assignedSlot);\n }\n }\n\n isFinalDestination(insertionPoint) {\n return !(insertionPoint.__shady.assignedSlot);\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'use strict';\n\nimport {patchInsideElementAccessors, patchOutsideElementAccessors} from './patch-accessors'\nimport {firstChild, lastChild, childNodes} from './native-tree'\n\nexport function recordInsertBefore(node, container, ref_node) {\n patchInsideElementAccessors(container);\n container.__shady = container.__shady || {};\n if (container.__shady.firstChild !== undefined) {\n container.__shady.childNodes = null;\n }\n // handle document fragments\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n let c$ = node.childNodes;\n for (let i=0; i < c$.length; i++) {\n linkNode(c$[i], container, ref_node);\n }\n // cleanup logical dom in doc fragment.\n node.__shady = node.__shady || {};\n let resetTo = (node.__shady.firstChild !== undefined) ? null : undefined;\n node.__shady.firstChild = node.__shady.lastChild = resetTo;\n node.__shady.childNodes = resetTo;\n } else {\n linkNode(node, container, ref_node);\n }\n}\n\nfunction linkNode(node, container, ref_node) {\n patchOutsideElementAccessors(node);\n ref_node = ref_node || null;\n node.__shady = node.__shady || {};\n container.__shady = container.__shady || {};\n if (ref_node) {\n ref_node.__shady = ref_node.__shady || {};\n }\n // update ref_node.previousSibling <-> node\n node.__shady.previousSibling = ref_node ? ref_node.__shady.previousSibling :\n container.lastChild;\n let ps = node.__shady.previousSibling;\n if (ps && ps.__shady) {\n ps.__shady.nextSibling = node;\n }\n // update node <-> ref_node\n let ns = node.__shady.nextSibling = ref_node;\n if (ns && ns.__shady) {\n ns.__shady.previousSibling = node;\n }\n // update node <-> container\n node.__shady.parentNode = container;\n if (ref_node) {\n if (ref_node === container.__shady.firstChild) {\n container.__shady.firstChild = node;\n }\n } else {\n container.__shady.lastChild = node;\n if (!container.__shady.firstChild) {\n container.__shady.firstChild = node;\n }\n }\n // remove caching of childNodes\n container.__shady.childNodes = null;\n}\n\nexport function recordRemoveChild(node, container) {\n node.__shady = node.__shady || {};\n container.__shady = container.__shady || {};\n if (node === container.__shady.firstChild) {\n container.__shady.firstChild = node.__shady.nextSibling;\n }\n if (node === container.__shady.lastChild) {\n container.__shady.lastChild = node.__shady.previousSibling;\n }\n let p = node.__shady.previousSibling;\n let n = node.__shady.nextSibling;\n if (p) {\n p.__shady = p.__shady || {};\n p.__shady.nextSibling = n;\n }\n if (n) {\n n.__shady = n.__shady || {};\n n.__shady.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 node.__shady.parentNode = node.__shady.previousSibling =\n node.__shady.nextSibling = undefined;\n if (container.__shady.childNodes !== undefined) {\n // remove caching of childNodes\n container.__shady.childNodes = null;\n }\n}\n\nexport let recordChildNodes = function(node) {\n if (!node.__shady || node.__shady.firstChild === undefined) {\n node.__shady = node.__shady || {};\n node.__shady.firstChild = firstChild(node);\n node.__shady.lastChild = lastChild(node);\n patchInsideElementAccessors(node);\n let c$ = node.__shady.childNodes = childNodes(node);\n for (let i=0, n; (i<c$.length) && (n=c$[i]); i++) {\n n.__shady = n.__shady || {};\n n.__shady.parentNode = node;\n n.__shady.nextSibling = c$[i+1] || null;\n n.__shady.previousSibling = c$[i-1] || null;\n patchOutsideElementAccessors(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\n'use strict';\n\nimport * as utils from './utils'\n\nclass AsyncObserver {\n\n constructor() {\n this._scheduled = false;\n this.addedNodes = [];\n this.removedNodes = [];\n this.callbacks = new Set();\n }\n\n schedule() {\n if (!this._scheduled) {\n this._scheduled = true;\n utils.microtask(() => {\n this.flush();\n });\n }\n }\n\n flush() {\n if (this._scheduled) {\n this._scheduled = false;\n let mutations = this.takeRecords();\n if (mutations.length) {\n this.callbacks.forEach(function(cb) {\n cb(mutations);\n });\n }\n }\n }\n\n takeRecords() {\n if (this.addedNodes.length || this.removedNodes.length) {\n let mutations = [{\n addedNodes: this.addedNodes,\n removedNodes: this.removedNodes\n }];\n this.addedNodes = [];\n this.removedNodes = [];\n return mutations;\n }\n return [];\n }\n\n}\n\n// TODO(sorvell): consider instead polyfilling MutationObserver\n// directly so that users do not have to fork their code.\n// Supporting the entire api may be challenging: e.g. filtering out\n// removed nodes in the wrong scope and seeing non-distributing\n// subtree child mutations.\nexport let observeChildren = function(node, callback) {\n node.__shady = node.__shady || {};\n if (!node.__shady.observer) {\n node.__shady.observer = new AsyncObserver();\n }\n node.__shady.observer.callbacks.add(callback);\n let observer = node.__shady.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 handle._node.__shady.observer = null;\n }\n }\n}\n\nexport function filterMutations(mutations, target) {\n /** @const {Node} */\n const targetRootNode = target.getRootNode();\n return mutations.map(function(mutation) {\n /** @const {boolean} */\n const mutationInScope = (targetRootNode === mutation.target.getRootNode());\n if (mutationInScope && mutation.addedNodes) {\n let nodes = Array.from(mutation.addedNodes).filter(function(n) {\n return (targetRootNode === n.getRootNode());\n });\n if (nodes.length) {\n mutation = Object.create(mutation);\n Object.defineProperty(mutation, 'addedNodes', {\n value: nodes,\n configurable: true\n });\n return mutation;\n }\n } else if (mutationInScope) {\n return mutation;\n }\n }).filter(function(m) { return m});\n}","/**\n@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'use strict';\n\nexport let settings = window['ShadyDOM'] || {};\n\nsettings.hasNativeShadowDOM = Boolean(Element.prototype.attachShadow && Node.prototype.getRootNode);\n\nlet desc = Object.getOwnPropertyDescriptor(Node.prototype, 'firstChild');\n\nsettings.hasDescriptors = Boolean(desc && desc.configurable && desc.get);\nsettings.inUse = settings['force'] || !settings.hasNativeShadowDOM;\n\nexport function isShadyRoot(obj) {\n return Boolean(obj.__localName === 'ShadyRoot');\n}\n\nexport function ownerShadyRootForNode(node) {\n let root = node.getRootNode();\n if (isShadyRoot(root)) {\n return root;\n }\n}\n\nlet p = Element.prototype;\nlet matches = p.matches || p.matchesSelector ||\n p.mozMatchesSelector || p.msMatchesSelector ||\n p.oMatchesSelector || p.webkitMatchesSelector;\n\nexport function matchesSelector(element, selector) {\n return matches.call(element, selector);\n}\n\nfunction copyOwnProperty(name, source, target) {\n let pd = Object.getOwnPropertyDescriptor(source, name);\n if (pd) {\n Object.defineProperty(target, name, pd);\n }\n}\n\nexport function extend(target, source) {\n if (target && source) {\n let n$ = Object.getOwnPropertyNames(source);\n for (let i=0, n; (i<n$.length) && (n=n$[i]); i++) {\n copyOwnProperty(n, source, target);\n }\n }\n return target || source;\n}\n\nexport function extendAll(target, ...sources) {\n for (let i=0; i < sources.length; i++) {\n extend(target, sources[i]);\n }\n return target;\n}\n\nexport function mixin(target, source) {\n for (var i in source) {\n target[i] = source[i];\n }\n return target;\n}\n\nexport function patchPrototype(obj, mixin) {\n let proto = Object.getPrototypeOf(obj);\n if (!proto.hasOwnProperty('__patchProto')) {\n let patchProto = Object.create(proto);\n patchProto.__sourceProto = proto;\n extend(patchProto, mixin);\n proto['__patchProto'] = patchProto;\n }\n // old browsers don't have setPrototypeOf\n obj.__proto__ = proto['__patchProto'];\n}\n\n\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 function microtask(callback) {\n queue.push(callback);\n twiddle.textContent = content++;\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'use strict';\n\nimport * as utils from './utils'\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@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'use strict';\n\n// Cribbed from ShadowDOM polyfill\n// https://github.com/webcomponents/webcomponentsjs/blob/master/src/ShadowDOM/wrappers/HTMLElement.js#L28\n/////////////////////////////////////////////////////////////////////////////\n// innerHTML and outerHTML\n\n// http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#escapingString\nlet escapeAttrRegExp = /[&\\u00A0\"]/g;\nlet escapeDataRegExp = /[&\\u00A0<>]/g;\n\nfunction escapeReplace(c) {\n switch (c) {\n case '&':\n return '&';\n case '<':\n return '<';\n case '>':\n return '>';\n case '\"':\n return '"';\n case '\\u00A0':\n return ' ';\n }\n}\n\nfunction escapeAttr(s) {\n return s.replace(escapeAttrRegExp, escapeReplace);\n}\n\nfunction escapeData(s) {\n return s.replace(escapeDataRegExp, escapeReplace);\n}\n\nfunction makeSet(arr) {\n let set = {};\n for (let i = 0; i < arr.length; i++) {\n set[arr[i]] = true;\n }\n return set;\n}\n\n// http://www.whatwg.org/specs/web-apps/current-work/#void-elements\nlet voidElements = makeSet([\n 'area',\n 'base',\n 'br',\n 'col',\n 'command',\n 'embed',\n 'hr',\n 'img',\n 'input',\n 'keygen',\n 'link',\n 'meta',\n 'param',\n 'source',\n 'track',\n 'wbr'\n]);\n\nlet plaintextParents = makeSet([\n 'style',\n 'script',\n 'xmp',\n 'iframe',\n 'noembed',\n 'noframes',\n 'plaintext',\n 'noscript'\n]);\n\n/**\n * @param {Node} node\n * @param {Node} parentNode\n * @param {Function=} callback\n */\nexport function getOuterHTML(node, parentNode, callback) {\n switch (node.nodeType) {\n case Node.ELEMENT_NODE: {\n let tagName = node.localName;\n let s = '<' + tagName;\n let attrs = node.attributes;\n for (let i = 0, attr; (attr = attrs[i]); i++) {\n s += ' ' + attr.name + '=\"' + escapeAttr(attr.value) + '\"';\n }\n s += '>';\n if (voidElements[tagName]) {\n return s;\n }\n return s + getInnerHTML(node, callback) + '</' + tagName + '>';\n }\n case Node.TEXT_NODE: {\n let data = /** @type {Text} */ (node).data;\n if (parentNode && plaintextParents[parentNode.localName]) {\n return data;\n }\n return escapeData(data);\n }\n case Node.COMMENT_NODE: {\n return '<!--' + /** @type {Comment} */ (node).data + '-->';\n }\n default: {\n window.console.error(node);\n throw new Error('not implemented');\n }\n }\n}\n\n/**\n * @param {Node} node\n * @param {Function=} callback\n */\nexport function getInnerHTML(node, callback) {\n if (node.localName === 'template') {\n node = /** @type {HTMLTemplateElement} */ (node).content;\n }\n let s = '';\n let c$ = callback ? callback(node) : node.childNodes;\n for (let i=0, l=c$.length, child; (i<l) && (child=c$[i]); i++) {\n s += getOuterHTML(child, node, callback);\n }\n return s;\n}","/**\n@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'use strict';\n\nimport {getInnerHTML} from './innerHTML'\n\nlet nodeWalker = document.createTreeWalker(document, NodeFilter.SHOW_ALL,\n null, false);\n\nlet elementWalker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT,\n null, false);\n\nexport function parentNode(node) {\n nodeWalker.currentNode = node;\n return nodeWalker.parentNode();\n}\n\nexport function firstChild(node) {\n nodeWalker.currentNode = node;\n return nodeWalker.firstChild();\n}\n\nexport function lastChild(node) {\n nodeWalker.currentNode = node;\n return nodeWalker.lastChild();\n}\n\nexport function previousSibling(node) {\n nodeWalker.currentNode = node;\n return nodeWalker.previousSibling();\n}\n\nexport function nextSibling(node) {\n nodeWalker.currentNode = node;\n return nodeWalker.nextSibling();\n}\n\nexport function childNodes(node) {\n let nodes = [];\n nodeWalker.currentNode = node;\n let n = nodeWalker.firstChild();\n while (n) {\n nodes.push(n);\n n = nodeWalker.nextSibling();\n }\n return nodes;\n}\n\nexport function parentElement(node) {\n elementWalker.currentNode = node;\n return elementWalker.parentNode();\n}\n\nexport function firstElementChild(node) {\n elementWalker.currentNode = node;\n return elementWalker.firstChild();\n}\n\nexport function lastElementChild(node) {\n elementWalker.currentNode = node;\n return elementWalker.lastChild();\n}\n\nexport function previousElementSibling(node) {\n elementWalker.currentNode = node;\n return elementWalker.previousSibling();\n}\n\nexport function nextElementSibling(node) {\n elementWalker.currentNode = node;\n return elementWalker.nextSibling();\n}\n\nexport function children(node) {\n let nodes = [];\n elementWalker.currentNode = node;\n let n = elementWalker.firstChild();\n while (n) {\n nodes.push(n);\n n = elementWalker.nextSibling();\n }\n return nodes;\n}\n\nexport function innerHTML(node) {\n return getInnerHTML(node, (n) => childNodes(n));\n}\n\nexport function textContent(node) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n return node.nodeValue;\n }\n let textWalker = document.createTreeWalker(node, NodeFilter.SHOW_TEXT,\n null, false);\n let content = '', n;\n while ( (n = textWalker.nextNode()) ) {\n // TODO(sorvell): can't use textContent since we patch it on Node.prototype!\n // However, should probably patch it only on element.\n content += n.nodeValue;\n }\n return content;\n}","/**\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'use strict';\n\nimport * as utils from './utils'\nimport {getInnerHTML} from './innerHTML'\nimport * as nativeTree from './native-tree'\n\nfunction clearNode(node) {\n while (node.firstChild) {\n node.removeChild(node.firstChild);\n }\n}\n\nconst nativeInnerHTMLDesc = /** @type {ObjectPropertyDescriptor} */(\n Object.getOwnPropertyDescriptor(Element.prototype, 'innerHTML') ||\n Object.getOwnPropertyDescriptor(HTMLElement.prototype, 'innerHTML'));\n\nconst inertDoc = document.implementation.createHTMLDocument('inert');\nconst htmlContainer = inertDoc.createElement('div');\n\nconst nativeActiveElementDescriptor =\n /** @type {ObjectPropertyDescriptor} */(\n Object.getOwnPropertyDescriptor(Document.prototype, 'activeElement')\n );\nfunction getDocumentActiveElement() {\n if (nativeActiveElementDescriptor && nativeActiveElementDescriptor.get) {\n return nativeActiveElementDescriptor.get.call(document);\n } else if (!utils.settings.hasDescriptors) {\n return document.activeElement;\n }\n}\n\nfunction activeElementForNode(node) {\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(node));\n if (node !== 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 (node.host === active ||\n !node.host.contains(active)) {\n return null;\n }\n }\n // This node is either the document or a shady root of which the active\n // element is a (composed) descendant of its host; iterate upwards to\n // find the active element's most shallow host within it.\n let activeRoot = utils.ownerShadyRootForNode(active);\n while (activeRoot && activeRoot !== node) {\n active = activeRoot.host;\n activeRoot = utils.ownerShadyRootForNode(active);\n }\n if (node === 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 === node ? active : null;\n }\n}\n\nlet OutsideAccessors = {\n\n parentElement: {\n /** @this {Node} */\n get() {\n let l = this.__shady && this.__shady.parentElement;\n return l !== undefined ? l : nativeTree.parentElement(this);\n },\n configurable: true\n },\n\n parentNode: {\n /** @this {Node} */\n get() {\n let l = this.__shady && this.__shady.parentNode;\n return l !== undefined ? l : nativeTree.parentNode(this);\n },\n configurable: true\n },\n\n nextSibling: {\n /** @this {Node} */\n get() {\n let l = this.__shady && this.__shady.nextSibling;\n return l !== undefined ? l : nativeTree.nextSibling(this);\n },\n configurable: true\n },\n\n previousSibling: {\n /** @this {Node} */\n get() {\n let l = this.__shady && this.__shady.previousSibling;\n return l !== undefined ? l : nativeTree.previousSibling(this);\n },\n configurable: true\n },\n\n className: {\n /**\n * @this {HTMLElement}\n */\n get() {\n return this.getAttribute('class');\n },\n /**\n * @this {HTMLElement}\n */\n set(value) {\n this.setAttribute('class', value);\n },\n configurable: true\n },\n\n // fragment, element, document\n nextElementSibling: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.nextSibling !== undefined) {\n let n = this.nextSibling;\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n.nextSibling;\n }\n return n;\n } else {\n return nativeTree.nextElementSibling(this);\n }\n },\n configurable: true\n },\n\n previousElementSibling: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.previousSibling !== undefined) {\n let n = this.previousSibling;\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n.previousSibling;\n }\n return n;\n } else {\n return nativeTree.previousElementSibling(this);\n }\n },\n configurable: true\n }\n\n};\n\nlet InsideAccessors = {\n\n childNodes: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.firstChild !== undefined) {\n if (!this.__shady.childNodes) {\n this.__shady.childNodes = [];\n for (let n=this.firstChild; n; n=n.nextSibling) {\n this.__shady.childNodes.push(n);\n }\n }\n return this.__shady.childNodes;\n } else {\n return nativeTree.childNodes(this);\n }\n },\n configurable: true\n },\n\n firstChild: {\n /** @this {HTMLElement} */\n get() {\n let l = this.__shady && this.__shady.firstChild;\n return l !== undefined ? l : nativeTree.firstChild(this);\n },\n configurable: true\n },\n\n lastChild: {\n /** @this {HTMLElement} */\n get() {\n let l = this.__shady && this.__shady.lastChild;\n return l !== undefined ? l : nativeTree.lastChild(this);\n },\n configurable: true\n },\n\n textContent: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.firstChild !== undefined) {\n let tc = [];\n for (let i = 0, cn = this.childNodes, c; (c = cn[i]); i++) {\n if (c.nodeType !== Node.COMMENT_NODE) {\n tc.push(c.textContent);\n }\n }\n return tc.join('');\n } else {\n return nativeTree.textContent(this);\n }\n },\n /**\n * @this {HTMLElement}\n */\n set(text) {\n if (this.nodeType !== Node.ELEMENT_NODE) {\n // TODO(sorvell): can't do this if patch nodeValue.\n this.nodeValue = text;\n } else {\n clearNode(this);\n if (text) {\n this.appendChild(document.createTextNode(text));\n }\n }\n },\n configurable: true\n },\n\n // fragment, element, document\n firstElementChild: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.firstChild !== undefined) {\n let n = this.firstChild;\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n.nextSibling;\n }\n return n;\n } else {\n return nativeTree.firstElementChild(this);\n }\n },\n configurable: true\n },\n\n lastElementChild: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.lastChild !== undefined) {\n let n = this.lastChild;\n while (n && n.nodeType !== Node.ELEMENT_NODE) {\n n = n.previousSibling;\n }\n return n;\n } else {\n return nativeTree.lastElementChild(this);\n }\n },\n configurable: true\n },\n\n children: {\n /**\n * @this {HTMLElement}\n */\n get() {\n if (this.__shady && this.__shady.firstChild !== undefined) {\n return Array.prototype.filter.call(this.childNodes, function(n) {\n return (n.nodeType === Node.ELEMENT_NODE);\n });\n } else {\n return nativeTree.children(this);\n }\n },\n configurable: true\n },\n\n // element (HTMLElement on IE11)\n innerHTML: {\n /**\n * @this {HTMLElement}\n */\n get() {\n let content = this.localName === 'template' ?\n /** @type {HTMLTemplateElement} */(this).content : this;\n if (this.__shady && this.__shady.firstChild !== undefined) {\n return getInnerHTML(content);\n } else {\n return nativeTree.innerHTML(content);\n }\n },\n /**\n * @this {HTMLElement}\n */\n set(text) {\n let content = this.localName === 'template' ?\n /** @type {HTMLTemplateElement} */(this).content : this;\n clearNode(content);\n if (nativeInnerHTMLDesc && nativeInnerHTMLDesc.set) {\n nativeInnerHTMLDesc.set.call(htmlContainer, text);\n } else {\n htmlContainer.innerHTML = text;\n }\n while (htmlContainer.firstChild) {\n content.appendChild(htmlContainer.firstChild);\n }\n },\n configurable: true\n }\n\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).\nexport let ShadowRootAccessor = {\n\n shadowRoot: {\n /**\n * @this {HTMLElement}\n */\n get() {\n return this.__shady && this.__shady.root || null;\n },\n /**\n * @this {HTMLElement}\n */\n set(value) {\n this.__shady = this.__shady || {};\n this.__shady.root = value;\n },\n configurable: true\n }\n};\n\n// Note: Can be patched on document prototype on browsers with builtin accessors.\n// Must be patched separately on simulated ShadowRoot.\n// Must be patched as `_activeElement` on browsers without builtin accessors.\nexport let ActiveElementAccessor = {\n\n activeElement: {\n /**\n * @this {HTMLElement}\n */\n get() {\n return activeElementForNode(this);\n },\n /**\n * @this {HTMLElement}\n */\n set() {},\n configurable: true\n }\n\n};\n\n// patch a group of descriptors on an object only if it exists or if the `force`\n// argument is true.\n/**\n * @param {!Object} obj\n * @param {!Object} descriptors\n * @param {boolean=} force\n */\nfunction patchAccessorGroup(obj, descriptors, force) {\n for (let p in descriptors) {\n let objDesc = Object.getOwnPropertyDescriptor(obj, p);\n if ((objDesc && objDesc.configurable) ||\n (!objDesc && force)) {\n Object.defineProperty(obj, p, descriptors[p]);\n } else if (force) {\n console.warn('Could not define', p, 'on', obj);\n }\n }\n}\n\n// patch dom accessors on proto where they exist\nexport function patchAccessors(proto) {\n patchAccessorGroup(proto, OutsideAccessors);\n patchAccessorGroup(proto, InsideAccessors);\n patchAccessorGroup(proto, ActiveElementAccessor);\n}\n\n// ensure element descriptors (IE/Edge don't have em)\nexport function patchShadowRootAccessors(proto) {\n patchAccessorGroup(proto, InsideAccessors, true);\n patchAccessorGroup(proto, ActiveElementAccessor, true);\n}\n\n// ensure an element has patched \"outside\" accessors; no-op when not needed\nexport let patchOutsideElementAccessors = utils.settings.hasDescriptors ?\n function() {} : function(element) {\n if (!(element.__shady && element.__shady.__outsideAccessors)) {\n element.__shady = element.__shady || {};\n element.__shady.__outsideAccessors = true;\n patchAccessorGroup(element, OutsideAccessors, true);\n }\n }\n\n// ensure an element has patched \"inside\" accessors; no-op when not needed\nexport let patchInsideElementAccessors = utils.settings.hasDescriptors ?\n function() {} : function(element) {\n if (!(element.__shady && element.__shady.__insideAccessors)) {\n element.__shady = element.__shady || {};\n element.__shady.__insideAccessors = true;\n patchAccessorGroup(element, InsideAccessors, true);\n patchAccessorGroup(element, ShadowRootAccessor, 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\n'use strict';\n\nimport * as utils from './utils'\nimport * as logicalTree from './logical-tree'\nimport * as nativeMethods from './native-methods'\nimport {parentNode} from './native-tree'\n\n/**\n * Try to add node. Record logical info, track insertion points, perform\n * distribution iff needed. Return true if the add is handled.\n * @param {Node} container\n * @param {Node} node\n * @param {Node} ref_node\n * @return {boolean}\n */\nfunction addNode(container, node, ref_node) {\n let ownerRoot = utils.ownerShadyRootForNode(container);\n let ipAdded;\n if (ownerRoot) {\n // optimization: special insertion point tracking\n // TODO(sorvell): verify that the renderPending check here should not be needed.\n if (node['__noInsertionPoint'] && !ownerRoot._changePending) {\n ownerRoot._skipUpdateInsertionPoints = true;\n }\n // note: we always need to see if an insertion point is added\n // since this saves logical tree info; however, invalidation state\n // needs\n ipAdded = _maybeAddInsertionPoint(node, container, ownerRoot);\n // invalidate insertion points IFF not already invalid!\n if (ipAdded) {\n ownerRoot._skipUpdateInsertionPoints = false;\n }\n }\n if (container.__shady && container.__shady.firstChild !== undefined) {\n logicalTree.recordInsertBefore(node, container, ref_node);\n }\n // if not distributing and not adding to host, do a fast path addition\n // TODO(sorvell): revisit flow since `ipAdded` needed here if\n // node is a fragment that has a patched QSA.\n let handled = _maybeDistribute(node, container, ownerRoot, ipAdded) ||\n container.__shady.root ||\n // TODO(sorvell): we *should* consider the add \"handled\"\n // if the container or ownerRoot is `_renderPending`.\n // However, this will regress performance right now and is blocked on a\n // fix for https://github.com/webcomponents/shadydom/issues/95\n // handled if ref_node parent is a root that is rendering.\n (ref_node && utils.isShadyRoot(ref_node.parentNode) &&\n ref_node.parentNode._renderPending);\n return handled;\n}\n\n\n/**\n * Try to remove node: update logical info and perform distribution iff\n * needed. Return true if the removal has been handled.\n * note that it's possible for both the node's host and its parent\n * to require distribution... both cases are handled here.\n * @param {Node} node\n * @return {boolean}\n */\nfunction removeNode(node) {\n // important that we want to do this only if the node has a logical parent\n let logicalParent = node.__shady && node.__shady.parentNode;\n let distributed;\n let ownerRoot = utils.ownerShadyRootForNode(node);\n if (logicalParent || ownerRoot) {\n // distribute node's parent iff needed\n distributed = maybeDistributeParent(node);\n if (logicalParent) {\n logicalTree.recordRemoveChild(node, logicalParent);\n }\n // remove node from root and distribute it iff needed\n let removedDistributed = ownerRoot &&\n _removeDistributedChildren(ownerRoot, node);\n let addedInsertionPoint = (logicalParent && ownerRoot &&\n logicalParent.localName === ownerRoot.getInsertionPointTag());\n if (removedDistributed || addedInsertionPoint) {\n ownerRoot._skipUpdateInsertionPoints = false;\n updateRootViaContentChange(ownerRoot);\n }\n }\n _removeOwnerShadyRoot(node);\n return distributed;\n}\n\n/**\n * @param {Node} node\n * @param {Node=} addedNode\n * @param {Node=} removedNode\n */\nfunction _scheduleObserver(node, addedNode, removedNode) {\n let observer = node.__shady && node.__shady.observer;\n if (observer) {\n if (addedNode) {\n observer.addedNodes.push(addedNode);\n }\n if (removedNode) {\n observer.removedNodes.push(removedNode);\n }\n observer.schedule();\n }\n}\n\nfunction removeNodeFromParent(node, logicalParent) {\n if (logicalParent) {\n _scheduleObserver(logicalParent, null, node);\n return removeNode(node);\n } else {\n // composed but not logical parent\n if (node.parentNode) {\n nativeMethods.removeChild.call(node.parentNode, node);\n }\n _removeOwnerShadyRoot(node);\n }\n}\n\nfunction _hasCachedOwnerRoot(node) {\n return Boolean(node.__shady && node.__shady.ownerShadyRoot !== undefined);\n}\n\n/**\n * @param {Node} node\n * @param {Object=} options\n */\nexport function getRootNode(node, options) { // eslint-disable-line no-unused-vars\n if (!node || !node.nodeType) {\n return;\n }\n node.__shady = node.__shady || {};\n let root = node.__shady.ownerShadyRoot;\n if (root === undefined) {\n if (utils.isShadyRoot(node)) {\n root = node;\n } else {\n let parent = node.parentNode;\n root = parent ? getRootNode(parent) : node;\n }\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.contains(node)) {\n node.__shady.ownerShadyRoot = root;\n }\n }\n return root;\n}\n\nfunction _maybeDistribute(node, container, ownerRoot, ipAdded) {\n // TODO(sorvell): technically we should check non-fragment nodes for\n // <content> children but since this case is assumed to be exceedingly\n // rare, we avoid the cost and will address with some specific api\n // when the need arises. For now, the user must call\n // distributeContent(true), which updates insertion points manually\n // and forces distribution.\n let insertionPointTag = ownerRoot && ownerRoot.getInsertionPointTag() || '';\n let fragContent = (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) &&\n !node['__noInsertionPoint'] &&\n insertionPointTag && node.querySelector(insertionPointTag);\n let wrappedContent = fragContent &&\n (fragContent.parentNode.nodeType !==\n Node.DOCUMENT_FRAGMENT_NODE);\n let hasContent = fragContent || (node.localName === insertionPointTag);\n // There are 3 possible cases where a distribution may need to occur:\n // 1. <content> being inserted (the host of the shady root where\n // content is inserted needs distribution)\n // 2. children being inserted into parent with a shady root (parent\n // needs distribution)\n // 3. container is an insertionPoint\n if (hasContent || (container.localName === insertionPointTag) || ipAdded) {\n if (ownerRoot) {\n // note, insertion point list update is handled after node\n // mutations are complete\n updateRootViaContentChange(ownerRoot);\n }\n }\n let needsDist = _nodeNeedsDistribution(container);\n if (needsDist) {\n let root = container.__shady && container.__shady.root;\n updateRootViaContentChange(root);\n }\n // Return true when distribution will fully handle the composition\n // Note that if a content was being inserted that was wrapped by a node,\n // and the parent does not need distribution, return false to allow\n // the nodes to be added directly, after which children may be\n // distributed and composed into the wrapping node(s)\n return needsDist || (hasContent && !wrappedContent);\n}\n\n/* note: parent argument is required since node may have an out\nof date parent at this point; returns true if a <content> is being added */\nfunction _maybeAddInsertionPoint(node, parent, root) {\n let added;\n let insertionPointTag = root.getInsertionPointTag();\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE &&\n !node['__noInsertionPoint']) {\n let c$ = node.querySelectorAll(insertionPointTag);\n for (let i=0, n, np, na; (i<c$.length) && (n=c$[i]); i++) {\n np = n.parentNode;\n // don't allow node's parent to be fragment itself\n if (np === node) {\n np = parent;\n }\n na = _maybeAddInsertionPoint(n, np, root);\n added = added || na;\n }\n } else if (node.localName === insertionPointTag) {\n logicalTree.recordChildNodes(parent);\n logicalTree.recordChildNodes(node);\n added = true;\n }\n return added;\n}\n\nfunction _nodeNeedsDistribution(node) {\n let root = node && node.__shady && node.__shady.root;\n return root && root.hasInsertionPoint();\n}\n\nfunction _removeDistributedChildren(root, container) {\n let hostNeedsDist;\n let ip$ = root._getInsertionPoints();\n for (let i=0; i<ip$.length; i++) {\n let insertionPoint = ip$[i];\n if (_contains(container, insertionPoint)) {\n let dc$ = insertionPoint.assignedNodes({flatten: true});\n for (let j=0; j<dc$.length; j++) {\n hostNeedsDist = true;\n let node = dc$[j];\n let parent = parentNode(node);\n if (parent) {\n nativeMethods.removeChild.call(parent, node);\n }\n }\n }\n }\n return hostNeedsDist;\n}\n\nfunction _contains(container, node) {\n while (node) {\n if (node == container) {\n return true;\n }\n node = node.parentNode;\n }\n}\n\nfunction _removeOwnerShadyRoot(node) {\n // optimization: only reset the tree if node is actually in a root\n if (_hasCachedOwnerRoot(node)) {\n let c$ = node.childNodes;\n for (let i=0, l=c$.length, n; (i<l) && (n=c$[i]); i++) {\n _removeOwnerShadyRoot(n);\n }\n }\n node.__shady = node.__shady || {};\n node.__shady.ownerShadyRoot = undefined;\n}\n\n// TODO(sorvell): This will fail if distribution that affects this\n// question is pending; this is expected to be exceedingly rare, but if\n// the issue comes up, we can force a flush in this case.\nfunction firstComposedNode(insertionPoint) {\n let n$ = insertionPoint.assignedNodes({flatten: true});\n let root = getRootNode(insertionPoint);\n for (let i=0, l=n$.length, n; (i<l) && (n=n$[i]); i++) {\n // means that we're composed to this spot.\n if (root.isFinalDestination(insertionPoint, n)) {\n return n;\n }\n }\n}\n\nfunction maybeDistributeParent(node) {\n let parent = node.parentNode;\n if (_nodeNeedsDistribution(parent)) {\n updateRootViaContentChange(parent.__shady.root);\n return true;\n }\n}\n\nfunction updateRootViaContentChange(root) {\n // mark root as mutation based on a mutation\n root._changePending = true;\n root.update();\n}\n\nfunction distributeAttributeChange(node, name) {\n if (name === 'slot') {\n maybeDistributeParent(node);\n } else if (node.localName === 'slot' && name === 'name') {\n let root = utils.ownerShadyRootForNode(node);\n if (root) {\n root.update();\n }\n }\n}\n\n// NOTE: `query` is used primarily for ShadyDOM's querySelector impl,\n// but it's also generally useful to recurse through the element tree\n// and is used by Polymer's styling system.\n/**\n * @param {Node} node\n * @param {Function} matcher\n * @param {Function=} halter\n */\nexport function query(node, matcher, halter) {\n let list = [];\n _queryElements(node.childNodes, matcher,\n halter, list);\n return list;\n}\n\nfunction _queryElements(elements, matcher, halter, list) {\n for (let i=0, l=elements.length, c; (i<l) && (c=elements[i]); i++) {\n if (c.nodeType === Node.ELEMENT_NODE &&\n _queryElement(c, matcher, halter, list)) {\n return true;\n }\n }\n}\n\nfunction _queryElement(node, matcher, halter, list) {\n let result = matcher(node);\n if (result) {\n list.push(node);\n }\n if (halter && halter(result)) {\n return result;\n }\n _queryElements(node.childNodes, matcher,\n halter, list);\n}\n\nexport function renderRootNode(element) {\n var root = element.getRootNode();\n if (utils.isShadyRoot(root)) {\n root.render();\n }\n}\n\nlet scopingShim = null;\n\nexport function setAttribute(node, attr, value) {\n if (!scopingShim) {\n scopingShim = window['ShadyCSS'] && window['ShadyCSS']['ScopingShim'];\n }\n if (scopingShim && attr === 'class') {\n scopingShim['setElementClass'](node, value);\n } else {\n nativeMethods.setAttribute.call(node, attr, value);\n distributeAttributeChange(node, attr);\n }\n}\n\nexport function removeAttribute(node, attr) {\n nativeMethods.removeAttribute.call(node, attr);\n distributeAttributeChange(node, attr);\n}\n\n// cases in which we may not be able to just do standard native call\n// 1. container has a shadyRoot (needsDistribution IFF the shadyRoot\n// has an insertion point)\n// 2. container is a shadyRoot (don't distribute, instead set\n// container to container.host.\n// 3. node is <content> (host of container needs distribution)\n/**\n * @param {Node} parent\n * @param {Node} node\n * @param {Node=} ref_node\n */\nexport function insertBefore(parent, node, ref_node) {\n if (ref_node) {\n let p = ref_node.__shady && ref_node.__shady.parentNode;\n if ((p !== undefined && p !== parent) ||\n (p === undefined && parentNode(ref_node) !== parent)) {\n throw Error(`Failed to execute 'insertBefore' on 'Node': The node ` +\n `before which the new node is to be inserted is not a child of this node.`);\n }\n }\n if (ref_node === node) {\n return node;\n }\n // remove node from its current position iff it's in a tree.\n if (node.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {\n let parent = node.__shady && node.__shady.parentNode;\n removeNodeFromParent(node, parent);\n }\n if (!addNode(parent, node, ref_node)) {\n if (ref_node) {\n // if ref_node is an insertion point replace with first distributed node\n let root = utils.ownerShadyRootForNode(ref_node);\n if (root) {\n ref_node = ref_node.localName === root.getInsertionPointTag() ?\n firstComposedNode(/** @type {!HTMLSlotElement} */(ref_node)) : ref_node;\n }\n }\n // if adding to a shadyRoot, add to host instead\n let container = utils.isShadyRoot(parent) ? /** @type {ShadowRoot} */(parent).host : parent;\n if (ref_node) {\n nativeMethods.insertBefore.call(container, node, ref_node);\n } else {\n nativeMethods.appendChild.call(container, node);\n }\n }\n _scheduleObserver(parent, node);\n return node;\n}\n\n/**\n Removes the given `node` from the element's `lightChildren`.\n This method also performs dom composition.\n*/\nexport function removeChild(parent, node) {\n if (node.parentNode !== parent) {\n throw Error('The node to be removed is not a child of this node: ' +\n node);\n }\n if (!removeNode(node)) {\n // if removing from a shadyRoot, remove form host instead\n let container = utils.isShadyRoot(parent) ?\n parent.host :\n parent;\n // not guaranteed to physically be in container; e.g.\n // undistributed nodes.\n let nativeParent = parentNode(node);\n if (container === nativeParent) {\n nativeMethods.removeChild.call(container, node);\n }\n }\n _scheduleObserver(parent, null, node);\n return node;\n}\n\nexport function cloneNode(node, deep) {\n if (node.localName == 'template') {\n return nativeMethods.cloneNode.call(node, deep);\n } else {\n let n = nativeMethods.cloneNode.call(node, false);\n if (deep) {\n let c$ = node.childNodes;\n for (let i=0, nc; i < c$.length; i++) {\n nc = c$[i].cloneNode(true);\n n.appendChild(nc);\n }\n }\n return n;\n }\n}\n\n// note: Though not technically correct, we fast path `importNode`\n// when called on a node not owned by the main document.\n// This allows, for example, elements that cannot\n// contain custom elements and are therefore not likely to contain shadowRoots\n// to cloned natively. This is a fairly significant performance win.\nexport function importNode(node, deep) {\n if (node.ownerDocument !== document) {\n return nativeMethods.importNode.call(document, node, deep);\n }\n let n = nativeMethods.importNode.call(document, node, false);\n if (deep) {\n let c$ = node.childNodes;\n for (let i=0, nc; i < c$.length; i++) {\n nc = importNode(c$[i], true);\n n.appendChild(nc);\n }\n }\n return 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'use strict';\n\nimport * as utils from './utils'\nimport {addEventListener as nativeAddEventListener,\n removeEventListener as nativeRemoveEventListener} from './native-methods'\n\n// https://github.com/w3c/webcomponents/issues/513#issuecomment-224183937\nlet alwaysComposed = {\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\nfunction pathComposer(startNode, composed) {\n let composedPath = [];\n let current = startNode;\n let startRoot = startNode === window ? window : startNode.getRootNode();\n while (current) {\n composedPath.push(current);\n if (current.assignedSlot) {\n current = current.assignedSlot;\n } else if (current.nodeType === Node.DOCUMENT_FRAGMENT_NODE && current.host && (composed || current !== startRoot)) {\n current = current.host;\n } else {\n current = current.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\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 = ancestor === window ? window : ancestor.getRootNode();\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 eventMixin = {\n\n /**\n * @this {Event}\n */\n get composed() {\n // isTrusted may not exist in this browser, so just check if isTrusted is explicitly false\n if (this.isTrusted !== false && this.__composed === undefined) {\n this.__composed = alwaysComposed[this.type];\n }\n return 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 this.__composedPath;\n },\n\n /**\n * @this {Event}\n */\n get target() {\n return retarget(this.currentTarget, this.composedPath());\n },\n\n // http://w3c.github.io/webcomponents/spec/shadow/#event-relatedtarget-retargeting\n /**\n * @this {Event}\n */\n get relatedTarget() {\n if (!this.__relatedTarget) {\n return null;\n }\n if (!this.__relatedTargetComposedPath) {\n this.__relatedTargetComposedPath = pathComposer(this.__relatedTarget, true);\n }\n // find the deepest node in relatedTarget composed path that is in the same root with the currentTarget\n return retarget(this.currentTarget, this.__relatedTargetComposedPath);\n },\n /**\n * @this {Event}\n */\n stopPropagation() {\n Event.prototype.stopPropagation.call(this);\n this.__propagationStopped = true;\n },\n /**\n * @this {Event}\n */\n stopImmediatePropagation() {\n Event.prototype.stopImmediatePropagation.call(this);\n this.__immediatePropagationStopped = true;\n this.__propagationStopped = true;\n }\n\n};\n\nfunction mixinComposedFlag(Base) {\n // NOTE: avoiding use of `class` here so that transpiled output does not\n // try to do `Base.call` with a dom construtor.\n let klazz = function(type, options) {\n let event = new Base(type, options);\n event.__composed = options && Boolean(options['composed']);\n return event;\n }\n // put constructor properties on subclass\n utils.mixin(klazz, Base);\n klazz.prototype = Base.prototype;\n return klazz;\n}\n\nlet nonBubblingEventsToRetarget = {\n 'focus': true,\n 'blur': true\n};\n\n\nfunction fireHandlers(event, node, phase) {\n let hs = node.__handlers && node.__handlers[event.type] &&\n node.__handlers[event.type][phase];\n if (hs) {\n for (let i = 0, fn; (fn = hs[i]); i++) {\n fn.call(node, event);\n if (event.__immediatePropagationStopped) {\n return;\n }\n }\n }\n}\n\nfunction retargetNonBubblingEvent(e) {\n let path = e.composedPath();\n let node;\n // override `currentTarget` to let patched `target` calculate correctly\n Object.defineProperty(e, 'currentTarget', {\n get: function() {\n return node;\n },\n configurable: true\n });\n for (let i = path.length - 1; i >= 0; i--) {\n node = path[i];\n // capture phase fires all capture handlers\n fireHandlers(e, node, 'capture');\n if (e.__propagationStopped) {\n return;\n }\n }\n\n // set the event phase to `AT_TARGET` as in spec\n Object.defineProperty(e, 'eventPhase', {value: Event.AT_TARGET});\n\n // the event only needs to be fired when owner roots change when iterating the event path\n // keep track of the last seen owner root\n let lastFiredRoot;\n for (let i = 0; i < path.length; i++) {\n node = path[i];\n if (i === 0 || (node.shadowRoot && node.shadowRoot === lastFiredRoot)) {\n fireHandlers(e, node, 'bubble');\n // don't bother with window, it doesn't have `getRootNode` and will be last in the path anyway\n if (node !== window) {\n lastFiredRoot = node.getRootNode();\n }\n if (e.__propagationStopped) {\n return;\n }\n }\n }\n}\n\n/**\n * @this {Event}\n */\nexport function addEventListener(type, fn, optionsOrCapture) {\n if (!fn) {\n return;\n }\n\n // The callback `fn` might be used for multiple nodes/events. Since we generate\n // a wrapper function, we need to keep track of it when we remove the listener.\n // It's more efficient to store the node/type/options information as Array in\n // `fn` itself rather than the node (we assume that the same callback is used\n // for few nodes at most, whereas a node will likely have many event listeners).\n // NOTE(valdrin) invoking external functions is costly, inline has better perf.\n let capture, once, passive;\n if (typeof optionsOrCapture === 'object') {\n capture = Boolean(optionsOrCapture.capture);\n once = Boolean(optionsOrCapture.once);\n passive = Boolean(optionsOrCapture.passive);\n } else {\n capture = Boolean(optionsOrCapture);\n once = false;\n passive = false;\n }\n if (fn.__eventWrappers) {\n // Stop if the wrapper function has already been created.\n for (let i = 0; i < fn.__eventWrappers.length; i++) {\n if (fn.__eventWrappers[i].node === this &&\n fn.__eventWrappers[i].type === type &&\n fn.__eventWrappers[i].capture === capture &&\n fn.__eventWrappers[i].once === once &&\n fn.__eventWrappers[i].passive === passive) {\n return;\n }\n }\n } else {\n fn.__eventWrappers = [];\n }\n\n /**\n * @this {HTMLElement}\n */\n const wrapperFn = function(e) {\n // Support `once` option.\n if (once) {\n this.removeEventListener(type, fn, optionsOrCapture);\n }\n if (!e['__target']) {\n patchEvent(e);\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(this) > -1) {\n if (e.eventPhase === Event.BUBBLING_PHASE) {\n if (e.target === e.relatedTarget) {\n e.stopImmediatePropagation();\n return;\n }\n }\n return fn(e);\n }\n };\n // Store the wrapper information.\n fn.__eventWrappers.push({\n node: this,\n type: type,\n capture: capture,\n once: once,\n passive: passive,\n wrapperFn: wrapperFn\n });\n\n if (nonBubblingEventsToRetarget[type]) {\n this.__handlers = this.__handlers || {};\n this.__handlers[type] = this.__handlers[type] ||\n {'capture': [], 'bubble': []};\n this.__handlers[type][capture ? 'capture' : 'bubble'].push(wrapperFn);\n } else {\n nativeAddEventListener.call(this, type, wrapperFn, optionsOrCapture);\n }\n}\n\n/**\n * @this {Event}\n */\nexport function removeEventListener(type, fn, optionsOrCapture) {\n if (!fn) {\n return;\n }\n\n // NOTE(valdrin) invoking external functions is costly, inline has better perf.\n let capture, once, passive;\n if (typeof optionsOrCapture === 'object') {\n capture = Boolean(optionsOrCapture.capture);\n once = Boolean(optionsOrCapture.once);\n passive = Boolean(optionsOrCapture.passive);\n } else {\n capture = Boolean(optionsOrCapture);\n once = false;\n passive = false;\n }\n // Search the wrapped function.\n let wrapperFn = undefined;\n if (fn.__eventWrappers) {\n for (let i = 0; i < fn.__eventWrappers.length; i++) {\n if (fn.__eventWrappers[i].node === this &&\n fn.__eventWrappers[i].type === type &&\n fn.__eventWrappers[i].capture === capture &&\n fn.__eventWrappers[i].once === once &&\n fn.__eventWrappers[i].passive === passive) {\n wrapperFn = fn.__eventWrappers.splice(i, 1)[0].wrapperFn;\n // Cleanup.\n if (!fn.__eventWrappers.length) {\n fn.__eventWrappers = undefined;\n }\n break;\n }\n }\n }\n\n nativeRemoveEventListener.call(this, type, wrapperFn || fn, optionsOrCapture);\n if (wrapperFn && nonBubblingEventsToRetarget[type] &&\n this.__handlers && this.__handlers[type]) {\n const arr = this.__handlers[type][capture ? 'capture' : 'bubble'];\n const idx = arr.indexOf(wrapperFn);\n if (idx > -1) {\n arr.splice(idx, 1);\n }\n }\n}\n\nfunction activateFocusEventOverrides() {\n for (let ev in nonBubblingEventsToRetarget) {\n window.addEventListener(ev, function(e) {\n if (!e['__target']) {\n patchEvent(e);\n retargetNonBubblingEvent(e);\n e.stopImmediatePropagation();\n }\n }, true);\n }\n}\n\nfunction patchEvent(event) {\n event['__target'] = event.target;\n event.__relatedTarget = event.relatedTarget;\n // patch event prototype if we can\n if (utils.settings.hasDescriptors) {\n utils.patchPrototype(event, eventMixin);\n // and fallback to patching instance\n } else {\n utils.extend(event, eventMixin);\n }\n}\n\nlet PatchedEvent = mixinComposedFlag(window.Event);\nlet PatchedCustomEvent = mixinComposedFlag(window.CustomEvent);\nlet PatchedMouseEvent = mixinComposedFlag(window.MouseEvent);\n\nexport function patchEvents() {\n window.Event = PatchedEvent;\n window.CustomEvent = PatchedCustomEvent;\n window.MouseEvent = PatchedMouseEvent;\n activateFocusEventOverrides();\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'use strict';\n\nfunction newSplice(index, removed, addedCount) {\n return {\n index: index,\n removed: removed,\n addedCount: addedCount\n };\n}\n\nconst EDIT_LEAVE = 0;\nconst EDIT_UPDATE = 1;\nconst EDIT_ADD = 2;\nconst EDIT_DELETE = 3;\n\n// Note: This function is *based* on the computation of the Levenshtein\n// \"edit\" distance. The one change is that \"updates\" are treated as two\n// edits - not one. With Array splices, an update is really a delete\n// followed by an add. By retaining this, we optimize for \"keeping\" the\n// maximum array items in the original array. For example:\n//\n// 'xxxx123' -> '123yyyy'\n//\n// With 1-edit updates, the shortest path would be just to update all seven\n// characters. With 2-edit updates, we delete 4, leave 3, and add 4. This\n// leaves the substring '123' intact.\nfunction calcEditDistances(current, currentStart, currentEnd,\n old, oldStart, oldEnd) {\n // \"Deletion\" columns\n let rowCount = oldEnd - oldStart + 1;\n let columnCount = currentEnd - currentStart + 1;\n let distances = new Array(rowCount);\n\n // \"Addition\" rows. Initialize null column.\n for (let i = 0; i < rowCount; i++) {\n distances[i] = new Array(columnCount);\n distances[i][0] = i;\n }\n\n // Initialize null row\n for (let j = 0; j < columnCount; j++)\n distances[0][j] = j;\n\n for (let i = 1; i < rowCount; i++) {\n for (let j = 1; j < columnCount; j++) {\n if (equals(current[currentStart + j - 1], old[oldStart + i - 1]))\n distances[i][j] = distances[i - 1][j - 1];\n else {\n let north = distances[i - 1][j] + 1;\n let west = distances[i][j - 1] + 1;\n distances[i][j] = north < west ? north : west;\n }\n }\n }\n\n return distances;\n}\n\n// This starts at the final weight, and walks \"backward\" by finding\n// the minimum previous weight recursively until the origin of the weight\n// matrix.\nfunction spliceOperationsFromEditDistances(distances) {\n let i = distances.length - 1;\n let j = distances[0].length - 1;\n let current = distances[i][j];\n let edits = [];\n while (i > 0 || j > 0) {\n if (i == 0) {\n edits.push(EDIT_ADD);\n j--;\n continue;\n }\n if (j == 0) {\n edits.push(EDIT_DELETE);\n i--;\n continue;\n }\n let northWest = distances[i - 1][j - 1];\n let west = distances[i - 1][j];\n let north = distances[i][j - 1];\n\n let min;\n if (west < north)\n min = west < northWest ? west : northWest;\n else\n min = north < northWest ? north : northWest;\n\n if (min == northWest) {\n if (northWest == current) {\n edits.push(EDIT_LEAVE);\n } else {\n edits.push(EDIT_UPDATE);\n current = northWest;\n }\n i--;\n j--;\n } else if (min == west) {\n edits.push(EDIT_DELETE);\n i--;\n current = west;\n } else {\n edits.push(EDIT_ADD);\n j--;\n current = north;\n }\n }\n\n edits.reverse();\n return edits;\n}\n\n/**\n * Splice Projection functions:\n *\n * A splice map is a representation of how a previous array of items\n * was transformed into a new array of items. Conceptually it is a list of\n * tuples of\n *\n * <index, removed, addedCount>\n *\n * which are kept in ascending index order of. The tuple represents that at\n * the |index|, |removed| sequence of items were removed, and counting forward\n * from |index|, |addedCount| items were added.\n */\n\n/**\n * Lacking individual splice mutation information, the minimal set of\n * splices can be synthesized given the previous state and final state of an\n * array. The basic approach is to calculate the edit distance matrix and\n * choose the shortest path through it.\n *\n * Complexity: O(l * p)\n * l: The length of the current array\n * p: The length of the old array\n */\nfunction calcSplices(current, currentStart, currentEnd,\n old, oldStart, oldEnd) {\n let prefixCount = 0;\n let suffixCount = 0;\n let splice;\n\n let minLength = Math.min(currentEnd - currentStart, oldEnd - oldStart);\n if (currentStart == 0 && oldStart == 0)\n prefixCount = sharedPrefix(current, old, minLength);\n\n if (currentEnd == current.length && oldEnd == old.length)\n suffixCount = sharedSuffix(current, old, minLength - prefixCount);\n\n currentStart += prefixCount;\n oldStart += prefixCount;\n currentEnd -= suffixCount;\n oldEnd -= suffixCount;\n\n if (currentEnd - currentStart == 0 && oldEnd - oldStart == 0)\n return [];\n\n if (currentStart == currentEnd) {\n splice = newSplice(currentStart, [], 0);\n while (oldStart < oldEnd)\n splice.removed.push(old[oldStart++]);\n\n return [ splice ];\n } else if (oldStart == oldEnd)\n return [ newSplice(currentStart, [], currentEnd - currentStart) ];\n\n let ops = spliceOperationsFromEditDistances(\n calcEditDistances(current, currentStart, currentEnd,\n old, oldStart, oldEnd));\n\n splice = undefined;\n let splices = [];\n let index = currentStart;\n let oldIndex = oldStart;\n for (let i = 0; i < ops.length; i++) {\n switch(ops[i]) {\n case EDIT_LEAVE:\n if (splice) {\n splices.push(splice);\n splice = undefined;\n }\n\n index++;\n oldIndex++;\n break;\n case EDIT_UPDATE:\n if (!splice)\n splice = newSplice(index, [], 0);\n\n splice.addedCount++;\n index++;\n\n splice.removed.push(old[oldIndex]);\n oldIndex++;\n break;\n case EDIT_ADD:\n if (!splice)\n splice = newSplice(index, [], 0);\n\n splice.addedCount++;\n index++;\n break;\n case EDIT_DELETE:\n if (!splice)\n splice = newSplice(index, [], 0);\n\n splice.removed.push(old[oldIndex]);\n oldIndex++;\n break;\n }\n }\n\n if (splice) {\n splices.push(splice);\n }\n return splices;\n}\n\nfunction sharedPrefix(current, old, searchLength) {\n for (let i = 0; i < searchLength; i++)\n if (!equals(current[i], old[i]))\n return i;\n return searchLength;\n}\n\nfunction sharedSuffix(current, old, searchLength) {\n let index1 = current.length;\n let index2 = old.length;\n let count = 0;\n while (count < searchLength && equals(current[--index1], old[--index2]))\n count++;\n\n return count;\n}\n\nfunction equals(currentValue, previousValue) {\n return currentValue === previousValue;\n}\n\nexport function calculateSplices(current, previous) {\n return calcSplices(current, 0, current.length, previous, 0,\n previous.length);\n}\n\n","/**\n@license\nCopyright (c) 2016 The Polymer Project Authors. All rights reserved.\nThis code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt\nThe complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\nThe complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\nCode distributed by Google as part of the polymer project is also\nsubject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n*/\n\n'use strict';\n\nimport * as utils from './utils'\nimport * as mutation from './logical-mutation'\nimport {ActiveElementAccessor, ShadowRootAccessor, patchAccessors} from './patch-accessors'\nimport {addEventListener, removeEventListener} from './patch-events'\nimport {attachShadow, ShadyRoot} from './attach-shadow'\n\nfunction getAssignedSlot(node) {\n mutation.renderRootNode(node);\n return node.__shady && node.__shady.assignedSlot || null;\n}\n\nlet nodeMixin = {\n\n addEventListener: addEventListener,\n\n removeEventListener: removeEventListener,\n\n appendChild(node) {\n return mutation.insertBefore(this, node);\n },\n\n insertBefore(node, ref_node) {\n return mutation.insertBefore(this, node, ref_node);\n },\n\n removeChild(node) {\n return mutation.removeChild(this, node);\n },\n\n /**\n * @this {Node}\n */\n replaceChild(node, ref_node) {\n this.insertBefore(node, ref_node);\n this.removeChild(ref_node);\n return node;\n },\n\n /**\n * @this {Node}\n */\n cloneNode(deep) {\n return mutation.cloneNode(this, deep);\n },\n\n /**\n * @this {Node}\n */\n getRootNode(options) {\n return mutation.getRootNode(this, options);\n },\n\n /**\n * @this {Node}\n */\n get isConnected() {\n // Fast path for distributed nodes.\n const ownerDocument = this.ownerDocument;\n if (ownerDocument && ownerDocument.contains && ownerDocument.contains(this)) return true;\n const ownerDocumentElement = ownerDocument.documentElement;\n if (ownerDocumentElement && ownerDocumentElement.contains && ownerDocumentElement.contains(this)) return true;\n\n let node = this;\n while (node && !(node instanceof Document)) {\n node = node.parentNode || (node instanceof ShadyRoot ? /** @type {ShadowRoot} */(node).host : undefined);\n }\n return !!(node && node instanceof Document);\n }\n\n};\n\n// NOTE: For some reason `Text` redefines `assignedSlot`\nlet textMixin = {\n /**\n * @this {Text}\n */\n get assignedSlot() {\n return getAssignedSlot(this);\n }\n};\n\nlet fragmentMixin = {\n\n // TODO(sorvell): consider doing native QSA and filtering results.\n /**\n * @this {DocumentFragment}\n */\n querySelector(selector) {\n // match selector and halt on first result.\n let result = mutation.query(this, function(n) {\n return utils.matchesSelector(n, selector);\n }, function(n) {\n return Boolean(n);\n })[0];\n return result || null;\n },\n\n /**\n * @this {DocumentFragment}\n */\n querySelectorAll(selector) {\n return mutation.query(this, function(n) {\n return utils.matchesSelector(n, selector);\n });\n }\n\n};\n\nlet slotMixin = {\n\n /**\n * @this {HTMLSlotElement}\n */\n assignedNodes(options) {\n if (this.localName === 'slot') {\n mutation.renderRootNode(this);\n return this.__shady ?\n ((options && options.flatten ? this.__shady.distributedNodes :\n this.__shady.assignedNodes) || []) :\n [];\n }\n }\n\n};\n\nlet elementMixin = utils.extendAll({\n\n /**\n * @this {HTMLElement}\n */\n setAttribute(name, value) {\n mutation.setAttribute(this, name, value);\n },\n\n /**\n * @this {HTMLElement}\n */\n removeAttribute(name) {\n mutation.removeAttribute(this, name);\n },\n\n /**\n * @this {HTMLElement}\n */\n attachShadow(options) {\n return attachShadow(this, options);\n },\n\n /**\n * @this {HTMLElement}\n */\n get slot() {\n return this.getAttribute('slot');\n },\n\n /**\n * @this {HTMLElement}\n */\n set slot(value) {\n this.setAttribute('slot', value);\n },\n\n /**\n * @this {HTMLElement}\n */\n get assignedSlot() {\n return getAssignedSlot(this);\n }\n\n}, fragmentMixin, slotMixin);\n\nObject.defineProperties(elementMixin, ShadowRootAccessor);\n\nlet documentMixin = utils.extendAll({\n /**\n * @this {Document}\n */\n importNode(node, deep) {\n return mutation.importNode(node, deep);\n }\n}, fragmentMixin);\n\nObject.defineProperties(documentMixin, {\n '_activeElement': ActiveElementAccessor.activeElement\n});\n\nfunction patchBuiltin(proto, obj) {\n let n$ = Object.getOwnPropertyNames(obj);\n for (let i=0; i < n$.length; i++) {\n let n = n$[i];\n let d = Object.getOwnPropertyDescriptor(obj, n);\n // NOTE: we prefer writing directly here because some browsers\n // have descriptors that are writable but not configurable (e.g.\n // `appendChild` on older browsers)\n if (d.value) {\n proto[n] = d.value;\n } else {\n Object.defineProperty(proto, n, d);\n }\n }\n}\n\n\n// Apply patches to builtins (e.g. Element.prototype). Some of these patches\n// can be done unconditionally (mostly methods like\n// `Element.prototype.appendChild`) and some can only be done when the browser\n// has proper descriptors on the builtin prototype\n// (e.g. `Element.prototype.firstChild`)`. When descriptors are not available,\n// elements are individually patched when needed (see e.g.\n// `patchInside/OutsideElementAccessors` in `patch-accessors.js`).\nexport function patchBuiltins() {\n // These patches can always be done, for all supported browsers.\n patchBuiltin(window.Node.prototype, nodeMixin);\n patchBuiltin(window.Text.prototype, textMixin);\n patchBuiltin(window.DocumentFragment.prototype, fragmentMixin);\n patchBuiltin(window.Element.prototype, elementMixin);\n patchBuiltin(window.Document.prototype, documentMixin);\n if (window.HTMLSlotElement) {\n patchBuiltin(window.HTMLSlotElement.prototype, slotMixin);\n }\n // These patches can *only* be done\n // on browsers that have proper property descriptors on builtin prototypes.\n // This includes: IE11, Edge, Chrome >= 4?; Safari >= 10, Firefox\n // On older browsers (Chrome <= 4?, Safari 9), a per element patching\n // strategy is used for patching accessors.\n if (utils.settings.hasDescriptors) {\n patchAccessors(window.Node.prototype);\n patchAccessors(window.Text.prototype);\n patchAccessors(window.DocumentFragment.prototype);\n patchAccessors(window.Element.prototype);\n let nativeHTMLElement =\n (window['customElements'] && window['customElements']['nativeHTMLElement']) ||\n HTMLElement;\n patchAccessors(nativeHTMLElement.prototype);\n patchAccessors(window.Document.prototype);\n if (window.HTMLSlotElement) {\n patchAccessors(window.HTMLSlotElement.prototype);\n }\n }\n}\n","const reservedTagList = new Set([\n 'annotation-xml',\n 'color-profile',\n 'font-face',\n 'font-face-src',\n 'font-face-uri',\n 'font-face-format',\n 'font-face-name',\n 'missing-glyph',\n]);\n\n/**\n * @param {string} localName\n * @returns {boolean}\n */\nexport function isValidCustomElementName(localName) {\n const reserved = reservedTagList.has(localName);\n const validForm = /^[a-z][.0-9_a-z]*-[\\-.0-9_a-z]*$/.test(localName);\n return !reserved && validForm;\n}\n\n/**\n * @private\n * @param {!Node} node\n * @return {boolean}\n */\nexport function isConnected(node) {\n // Use `Node#isConnected`, if defined.\n const nativeValue = node.isConnected;\n if (nativeValue !== undefined) {\n return nativeValue;\n }\n\n /** @type {?Node|undefined} */\n let current = node;\n while (current && !(current.__CE_isImportDocument || current instanceof Document)) {\n current = current.parentNode || (window.ShadowRoot && current instanceof ShadowRoot ? current.host : undefined);\n }\n return !!(current && (current.__CE_isImportDocument || current instanceof Document));\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextSiblingOrAncestorSibling(root, start) {\n let node = start;\n while (node && node !== root && !node.nextSibling) {\n node = node.parentNode;\n }\n return (!node || node === root) ? null : node.nextSibling;\n}\n\n/**\n * @param {!Node} root\n * @param {!Node} start\n * @return {?Node}\n */\nfunction nextNode(root, start) {\n return start.firstChild ? start.firstChild : nextSiblingOrAncestorSibling(root, start);\n}\n\n/**\n * @param {!Node} root\n * @param {!function(!Element)} callback\n * @param {!Set<Node>=} visitedImports\n */\nexport function walkDeepDescendantElements(root, callback, visitedImports = new Set()) {\n let node = root;\n while (node) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = /** @type {!Element} */(node);\n\n callback(element);\n\n const localName = element.localName;\n if (localName === 'link' && element.getAttribute('rel') === 'import') {\n // If this import (polyfilled or not) has it's root node available,\n // walk it.\n const importNode = /** @type {!Node} */ (element.import);\n if (importNode instanceof Node && !visitedImports.has(importNode)) {\n // Prevent multiple walks of the same import root.\n visitedImports.add(importNode);\n\n for (let child = importNode.firstChild; child; child = child.nextSibling) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n\n // Ignore descendants of import links to prevent attempting to walk the\n // elements created by the HTML Imports polyfill that we just walked\n // above.\n node = nextSiblingOrAncestorSibling(root, element);\n continue;\n } else if (localName === 'template') {\n // Ignore descendants of templates. There shouldn't be any descendants\n // because they will be moved into `.content` during construction in\n // browsers that support template but, in case they exist and are still\n // waiting to be moved by a polyfill, they will be ignored.\n node = nextSiblingOrAncestorSibling(root, element);\n continue;\n }\n\n // Walk shadow roots.\n const shadowRoot = element.__CE_shadowRoot;\n if (shadowRoot) {\n for (let child = shadowRoot.firstChild; child; child = child.nextSibling) {\n walkDeepDescendantElements(child, callback, visitedImports);\n }\n }\n }\n\n node = nextNode(root, node);\n }\n}\n\n/**\n * Used to suppress Closure's \"Modifying the prototype is only allowed if the\n * constructor is in the same scope\" warning without using\n * `@suppress {newCheckTypes, duplicate}` because `newCheckTypes` is too broad.\n *\n * @param {!Object} destination\n * @param {string} name\n * @param {*} value\n */\nexport function setPropertyUnchecked(destination, name, value) {\n destination[name] = value;\n}\n","/**\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 let nativeShadow = !(window['ShadyDOM'] && window['ShadyDOM']['inUse']);\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\nexport let nativeCssVariables = (!navigator.userAgent.match('AppleWebKit/601') &&\nwindow.CSS && CSS.supports && CSS.supports('box-shadow', '0 0 0 var(--foo)'));\n\n/**\n * @param {ShadyCSSOptions | ShadyCSSInterface | undefined} settings\n */\nfunction parseSettings(settings) {\n if (settings) {\n nativeCssVariables = nativeCssVariables && !settings['nativeCss'] && !settings['shimcssproperties'];\n nativeShadow = nativeShadow && !settings['nativeShadow'] && !settings['shimshadow'];\n }\n}\n\nif (window.ShadyCSS) {\n parseSettings(window.ShadyCSS);\n} else if (window['WebComponents']) {\n parseSettings(window['WebComponents']['flags']);\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} from './style-settings'\nimport {parse, stringify, types, StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\nimport {MEDIA_MATCH} from './common-regex';\n\n/**\n * @param {string|StyleNode} rules\n * @param {function(StyleNode)=} callback\n * @return {string}\n */\nexport function toCssText (rules, callback) {\n if (!rules) {\n return '';\n }\n if (typeof rules === 'string') {\n rules = parse(rules);\n }\n if (callback) {\n forEachRule(rules, callback);\n }\n return stringify(rules, nativeCssVariables);\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @return {StyleNode}\n */\nexport function rulesForStyle(style) {\n if (!style['__cssRules'] && style.textContent) {\n style['__cssRules'] = parse(style.textContent);\n }\n return style['__cssRules'] || null;\n}\n\n// Tests if a rule is a keyframes selector, which looks almost exactly\n// like a normal selector but is not (it has nothing to do with scoping\n// for example).\n/**\n * @param {StyleNode} rule\n * @return {boolean}\n */\nexport function isKeyframesSelector(rule) {\n return Boolean(rule['parent']) &&\n rule['parent']['type'] === types.KEYFRAMES_RULE;\n}\n\n/**\n * @param {StyleNode} node\n * @param {Function=} styleRuleCallback\n * @param {Function=} keyframesRuleCallback\n * @param {boolean=} onlyActiveRules\n */\nexport function forEachRule(node, styleRuleCallback, keyframesRuleCallback, onlyActiveRules) {\n if (!node) {\n return;\n }\n let skipRules = false;\n let type = node['type'];\n if (onlyActiveRules) {\n if (type === types.MEDIA_RULE) {\n let matchMedia = node['selector'].match(MEDIA_MATCH);\n if (matchMedia) {\n // if rule is a non matching @media rule, skip subrules\n if (!window.matchMedia(matchMedia[1]).matches) {\n skipRules = true;\n }\n }\n }\n }\n if (type === types.STYLE_RULE) {\n styleRuleCallback(node);\n } else if (keyframesRuleCallback &&\n type === types.KEYFRAMES_RULE) {\n keyframesRuleCallback(node);\n } else if (type === types.MIXIN_RULE) {\n skipRules = true;\n }\n let r$ = node['rules'];\n if (r$ && !skipRules) {\n for (let i=0, l=r$.length, r; (i<l) && (r=r$[i]); i++) {\n forEachRule(r, styleRuleCallback, keyframesRuleCallback, onlyActiveRules);\n }\n }\n}\n\n// add a string of cssText to the document.\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @param {Node} target\n * @param {Node} contextNode\n * @return {HTMLStyleElement}\n */\nexport function applyCss(cssText, moniker, target, contextNode) {\n let style = createScopeStyle(cssText, moniker);\n applyStyle(style, target, contextNode);\n return style;\n}\n\n/**\n * @param {string} cssText\n * @param {string} moniker\n * @return {HTMLStyleElement}\n */\nexport function createScopeStyle(cssText, moniker) {\n let style = /** @type {HTMLStyleElement} */(document.createElement('style'));\n if (moniker) {\n style.setAttribute('scope', moniker);\n }\n style.textContent = cssText;\n return style;\n}\n\n/**\n * Track the position of the last added style for placing placeholders\n * @type {Node}\n */\nlet lastHeadApplyNode = null;\n\n// insert a comment node as a styling position placeholder.\n/**\n * @param {string} moniker\n * @return {!Comment}\n */\nexport function applyStylePlaceHolder(moniker) {\n let placeHolder = document.createComment(' Shady DOM styles for ' +\n moniker + ' ');\n let after = lastHeadApplyNode ?\n lastHeadApplyNode['nextSibling'] : null;\n let scope = document.head;\n scope.insertBefore(placeHolder, after || scope.firstChild);\n lastHeadApplyNode = placeHolder;\n return placeHolder;\n}\n\n/**\n * @param {HTMLStyleElement} style\n * @param {?Node} target\n * @param {?Node} contextNode\n */\nexport function applyStyle(style, target, contextNode) {\n target = target || document.head;\n let after = (contextNode && contextNode.nextSibling) ||\n target.firstChild;\n target.insertBefore(style, after);\n if (!lastHeadApplyNode) {\n lastHeadApplyNode = style;\n } else {\n // only update lastHeadApplyNode if the new style is inserted after the old lastHeadApplyNode\n let position = style.compareDocumentPosition(lastHeadApplyNode);\n if (position === Node.DOCUMENT_POSITION_PRECEDING) {\n lastHeadApplyNode = style;\n }\n }\n}\n\n/**\n * @param {string} buildType\n * @return {boolean}\n */\nexport function isTargetedBuild(buildType) {\n return nativeShadow ? buildType === 'shadow' : buildType === 'shady';\n}\n\n/**\n * @param {Element} element\n * @return {?string}\n */\nexport function getCssBuildType(element) {\n return element.getAttribute('css-build');\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 */\nfunction findMatchingParen(text, start) {\n let level = 0;\n for (let i=start, l=text.length; i < l; i++) {\n if (text[i] === '(') {\n level++;\n } else if (text[i] === ')') {\n if (--level === 0) {\n return i;\n }\n }\n }\n return -1;\n}\n\n/**\n * @param {string} str\n * @param {function(string, string, string, string)} callback\n */\nexport function processVariableAndFallback(str, callback) {\n // find 'var('\n let start = str.indexOf('var(');\n if (start === -1) {\n // no var?, everything is prefix\n return callback(str, '', '', '');\n }\n //${prefix}var(${inner})${suffix}\n let end = findMatchingParen(str, start + 3);\n let inner = str.substring(start + 4, end);\n let prefix = str.substring(0, start);\n // suffix may have other variables\n let suffix = processVariableAndFallback(str.substring(end + 1), callback);\n let comma = inner.indexOf(',');\n // value and fallback args should be trimmed to match in property lookup\n if (comma === -1) {\n // variable, no fallback\n return callback(prefix, inner.trim(), '', suffix);\n }\n // var(${value},${fallback})\n let value = inner.substring(0, comma).trim();\n let fallback = inner.substring(comma + 1).trim();\n return callback(prefix, value, fallback, suffix);\n}\n\n/**\n * @param {Element} element\n * @param {string} value\n */\nexport function setElementClassRaw(element, value) {\n // use native setAttribute provided by ShadyDOM when setAttribute is patched\n if (nativeShadow) {\n element.setAttribute('class', value);\n } else {\n window['ShadyDOM']['nativeMethods']['setAttribute'].call(element, 'class', value);\n }\n}\n\n/**\n * @param {Element | {is: string, extends: string}} element\n * @return {{is: string, typeExtension: string}}\n */\nexport function getIsExtends(element) {\n let localName = element['localName'];\n let is = '', typeExtension = '';\n /*\n NOTE: technically, this can be wrong for certain svg elements\n with `-` in the name like `<font-face>`\n */\n if (localName) {\n if (localName.indexOf('-') > -1) {\n is = localName;\n } else {\n typeExtension = localName;\n is = (element.getAttribute && element.getAttribute('is')) || '';\n }\n } else {\n is = /** @type {?} */(element).is;\n typeExtension = /** @type {?} */(element).extends;\n }\n return {is, typeExtension};\n}","/**\n@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'\nimport {StyleNode} from './css-parse' // eslint-disable-line no-unused-vars\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 * @param {HTMLTemplateElement} template\n */\nexport function invalidateTemplate(template) {\n template['_applyShimInvalid'] = true;\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['_applyShimInvalid'];\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 * @param {HTMLTemplateElement} template\n * @return {boolean}\n */\nexport function templateIsValidating(template) {\n return template._validating;\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 * @param {HTMLTemplateElement} template\n */\nexport function startValidatingTemplate(template) {\n if (!template._validating) {\n template._validating = true;\n promise.then(function() {\n template['_applyShimInvalid'] = false;\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@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 {Promise<void>} */\nlet readyPromise = null;\n\n/** @type {?function(?function())} */\nlet whenReady = window['HTMLImports'] && window['HTMLImports']['whenReady'] || null;\n\n/** @type {function()} */\nlet resolveFn;\n\n/**\n * @param {?function()} callback\n */\nexport default function documentWait(callback) {\n requestAnimationFrame(function() {\n if (whenReady) {\n whenReady(callback)\n } else {\n if (!readyPromise) {\n readyPromise = new Promise((resolve) => {resolveFn = resolve});\n if (document.readyState === 'complete') {\n resolveFn();\n } else {\n document.addEventListener('readystatechange', () => {\n if (document.readyState === 'complete') {\n resolveFn();\n }\n });\n }\n }\n readyPromise.then(function(){ callback && callback(); });\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\n'use strict';\n\nexport let appendChild = Element.prototype.appendChild;\nexport let insertBefore = Element.prototype.insertBefore;\nexport let removeChild = Element.prototype.removeChild;\nexport let setAttribute = Element.prototype.setAttribute;\nexport let removeAttribute = Element.prototype.removeAttribute;\nexport let cloneNode = Element.prototype.cloneNode;\nexport let importNode = Document.prototype.importNode;\nexport let addEventListener = Element.prototype.addEventListener;\nexport let removeEventListener = Element.prototype.removeEventListener;\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\n'use strict';\nimport * as utils from './utils'\nimport {flush, enqueue} from './flush'\nimport {observeChildren, unobserveChildren, filterMutations} from './observe-changes'\nimport * as nativeMethods from './native-methods'\nimport * as nativeTree from './native-tree'\nimport {patchBuiltins} from './patch-builtins'\nimport {patchEvents} from './patch-events'\nimport {ShadyRoot} from './attach-shadow'\n\nif (utils.settings.inUse) {\n let ShadyDOM = {\n // TODO(sorvell): remove when Polymer does not depend on this.\n 'inUse': utils.settings.inUse,\n // TODO(sorvell): remove when Polymer does not depend on this\n 'patch': (node) => node,\n 'isShadyRoot': utils.isShadyRoot,\n 'enqueue': enqueue,\n 'flush': flush,\n 'settings': utils.settings,\n 'filterMutations': filterMutations,\n 'observeChildren': observeChildren,\n 'unobserveChildren': unobserveChildren,\n 'nativeMethods': nativeMethods,\n 'nativeTree': nativeTree\n };\n\n window['ShadyDOM'] = ShadyDOM;\n\n // Apply patches to events...\n patchEvents();\n // Apply patches to builtins (e.g. Element.prototype) where applicable.\n patchBuiltins();\n\n window.ShadowRoot = ShadyRoot;\n}","export default {\n Document_createElement: window.Document.prototype.createElement,\n Document_createElementNS: window.Document.prototype.createElementNS,\n Document_importNode: window.Document.prototype.importNode,\n Document_prepend: window.Document.prototype['prepend'],\n Document_append: window.Document.prototype['append'],\n Node_cloneNode: window.Node.prototype.cloneNode,\n Node_appendChild: window.Node.prototype.appendChild,\n Node_insertBefore: window.Node.prototype.insertBefore,\n Node_removeChild: window.Node.prototype.removeChild,\n Node_replaceChild: window.Node.prototype.replaceChild,\n Node_textContent: Object.getOwnPropertyDescriptor(window.Node.prototype, 'textContent'),\n Element_attachShadow: window.Element.prototype['attachShadow'],\n Element_innerHTML: Object.getOwnPropertyDescriptor(window.Element.prototype, 'innerHTML'),\n Element_getAttribute: window.Element.prototype.getAttribute,\n Element_setAttribute: window.Element.prototype.setAttribute,\n Element_removeAttribute: window.Element.prototype.removeAttribute,\n Element_getAttributeNS: window.Element.prototype.getAttributeNS,\n Element_setAttributeNS: window.Element.prototype.setAttributeNS,\n Element_removeAttributeNS: window.Element.prototype.removeAttributeNS,\n Element_insertAdjacentElement: window.Element.prototype['insertAdjacentElement'],\n Element_prepend: window.Element.prototype['prepend'],\n Element_append: window.Element.prototype['append'],\n Element_before: window.Element.prototype['before'],\n Element_after: window.Element.prototype['after'],\n Element_replaceWith: window.Element.prototype['replaceWith'],\n Element_remove: window.Element.prototype['remove'],\n HTMLElement: window.HTMLElement,\n HTMLElement_innerHTML: Object.getOwnPropertyDescriptor(window.HTMLElement.prototype, 'innerHTML'),\n HTMLElement_insertAdjacentElement: window.HTMLElement.prototype['insertAdjacentElement'],\n};\n","/**\n * This class exists only to work around Closure's lack of a way to describe\n * singletons. It represents the 'already constructed marker' used in custom\n * element construction stacks.\n *\n * https://html.spec.whatwg.org/#concept-already-constructed-marker\n */\nclass AlreadyConstructedMarker {}\n\nexport default new 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 http://polymer.github.io/LICENSE.txt\n * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt\n * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt\n * Code distributed by Google as part of the polymer project is also\n * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt\n */\n\nimport CustomElementInternals from './CustomElementInternals.js';\nimport CustomElementRegistry from './CustomElementRegistry.js';\n\nimport PatchHTMLElement from './Patch/HTMLElement.js';\nimport PatchDocument from './Patch/Document.js';\nimport PatchNode from './Patch/Node.js';\nimport PatchElement from './Patch/Element.js';\n\nconst priorCustomElements = window['customElements'];\n\nif (!priorCustomElements ||\n priorCustomElements['forcePolyfill'] ||\n (typeof priorCustomElements['define'] != 'function') ||\n (typeof priorCustomElements['get'] != 'function')) {\n /** @type {!CustomElementInternals} */\n const internals = new CustomElementInternals();\n\n PatchHTMLElement(internals);\n PatchDocument(internals);\n PatchNode(internals);\n PatchElement(internals);\n\n // The main document is always associated with the registry.\n document.__CE_hasRegistry = true;\n\n /** @type {!CustomElementRegistry} */\n const customElements = new CustomElementRegistry(internals);\n\n Object.defineProperty(window, 'customElements', {\n configurable: true,\n enumerable: true,\n value: customElements,\n });\n}\n","/**\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[^(]*(\\([^)]*\\))/;\nexport const IS_VAR = /^--/;\nexport const BRACKETED = /\\{[^}]*\\}/g;\nexport const HOST_PREFIX = '(?:^|[^.#[:])';\nexport const HOST_SUFFIX = '($|[.:[\\\\s>+~])';","/**\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'\nimport {nativeShadow} from './style-settings'\n\n/** @type {Object<string, !Node>} */\nlet placeholderMap = {};\n\n/**\n * @const {CustomElementRegistry}\n */\nconst ce = window['customElements'];\nif (ce && !nativeShadow) {\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 * @return {function(new:HTMLElement)}\n */\n const wrappedDefine = (name, clazz, options) => {\n placeholderMap[name] = applyStylePlaceHolder(name);\n return origDefine.call(/** @type {!CustomElementRegistry} */(ce), name, clazz, options);\n }\n ce['define'] = wrappedDefine;\n}\n\nexport default placeholderMap;\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';\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@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'\nimport {nativeCssVariables, nativeShadow} from '../src/style-settings'\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 {!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 /**\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\nif (ApplyShim) {\n window.ShadyCSS.ApplyShim = ApplyShim;\n}\n\nif (CustomStyleInterface) {\n window.ShadyCSS.CustomStyleInterface = CustomStyleInterface;\n}"]}