text: define(["exports","../../@polymer/polymer/lib/elements/dom-module.js","./vaadin-theme-property-mixin.js"],function(_exports,_domModule,_vaadinThemePropertyMixin){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.ThemableMixin=void 0;/**
   * @polymerMixin
   * @mixes Vaadin.ThemePropertyMixin
   */var ThemableMixin=function ThemableMixin(superClass){return(/*#__PURE__*/function(_ThemePropertyMixin){babelHelpers.inherits(VaadinThemableMixin,_ThemePropertyMixin);function VaadinThemableMixin(){babelHelpers.classCallCheck(this,VaadinThemableMixin);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(VaadinThemableMixin).apply(this,arguments))}babelHelpers.createClass(VaadinThemableMixin,null,[{key:"finalize",/** @protected */value:function finalize(){var _this=this;babelHelpers.get(babelHelpers.getPrototypeOf(VaadinThemableMixin),"finalize",this).call(this);var template=this.prototype._template,hasOwnTemplate=this.template&&this.template.parentElement&&this.template.parentElement.id===this.is,inheritedTemplate=Object.getPrototypeOf(this.prototype)._template;if(inheritedTemplate&&!hasOwnTemplate){// The element doesn't define its own template -> include the theme modules from the inherited template
  Array.from(inheritedTemplate.content.querySelectorAll("style[include]")).forEach(function(s){_this._includeStyle(s.getAttribute("include"),template)})}this._includeMatchingThemes(template)}/** @protected */},{key:"_includeMatchingThemes",value:function _includeMatchingThemes(template){var _this2=this,domModule=_domModule.DomModule,modules=domModule.prototype.modules,hasThemes=!1,defaultModuleName=this.is+"-default-theme";Object.keys(modules).sort(function(moduleNameA,moduleNameB){var vaadinA=0===moduleNameA.indexOf("vaadin-"),vaadinB=0===moduleNameB.indexOf("vaadin-"),vaadinThemePrefixes=["lumo-","material-"],vaadinThemeA=0<vaadinThemePrefixes.filter(function(prefix){return 0===moduleNameA.indexOf(prefix)}).length,vaadinThemeB=0<vaadinThemePrefixes.filter(function(prefix){return 0===moduleNameB.indexOf(prefix)}).length;if(vaadinA!==vaadinB){// Include vaadin core styles first
  return vaadinA?-1:1}else if(vaadinThemeA!==vaadinThemeB){// Include vaadin theme styles after that
  return vaadinThemeA?-1:1}else{// Lastly include custom styles so they override all vaadin styles
  return 0}}).forEach(function(moduleName){if(moduleName!==defaultModuleName){var themeFor=modules[moduleName].getAttribute("theme-for");if(themeFor){themeFor.split(" ").forEach(function(themeForToken){if(new RegExp("^"+themeForToken.split("*").join(".*")+"$").test(_this2.is)){hasThemes=!0;_this2._includeStyle(moduleName,template)}})}}});if(!hasThemes&&modules[defaultModuleName]){// No theme modules found, include the default module if it exists
  this._includeStyle(defaultModuleName,template)}}/** @private */},{key:"_includeStyle",value:function _includeStyle(moduleName,template){if(template&&!template.content.querySelector("style[include=\"".concat(moduleName,"\"]"))){var styleEl=document.createElement("style");styleEl.setAttribute("include",moduleName);template.content.appendChild(styleEl)}}}]);return VaadinThemableMixin}((0,_vaadinThemePropertyMixin.ThemePropertyMixin)(superClass)))};_exports.ThemableMixin=ThemableMixin});