function ThemeManager(){this.baseColor=this.getBaseColor(),this.csInterface=new CSInterface}ThemeManager.prototype.init=function(){const e=this;e.updateTheme(),e.csInterface.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,function(){e.updateTheme()})},ThemeManager.prototype.updateTheme=function(){this.getAllColors(this);const e={body:{selector:"body",declarations:{"background-color":this.darkColor,color:this.lightColor}},textarea:{selector:"textarea",declarations:{"background-color":this.darkColor,color:this.lightColor}},section:{selector:"section",declarations:{"background-color":this.darkColor}},button:{selector:"button",declarations:{"background-color":this.darkColor,"border-color":this.lightColor,color:this.lightColor}},buttonHover:{selector:"button",pseudoClass:"hover",declarations:{"background-color":this.lightColor,color:this.darkColor}},buttonSVG:{selector:"button svg",declarations:{fill:this.lightColor}},buttonSVGHover:{selector:"button:hover svg",declarations:{fill:this.darkColor}},textInput:{selector:"input",type:"text",declarations:{"background-color":this.interactionColor,"border-color":"rgb(49, 49, 49)",color:this.lightColor}},textInputFocus:{selector:"input",type:"text",pseudoClass:"focus",declarations:{"background-color":"rgb(255, 255, 255)",color:"rgb(39, 39, 39)"}},progressBar:{selector:"progress",pseudoElement:"-webkit-progress-bar",declarations:{"background-color":this.interactionColor}},progressValue:{selector:"progress",pseudoElement:"-webkit-progress-value",declarations:{"background-color":this.accentColor}}};this.insertRules(this,e)},ThemeManager.prototype.getAllColors=function(e){e.baseColor=e.getBaseColor(),e.accentColor=e.colorToRGB(e.getAccentColor()),e.darkColor=e.colorToRGB(e.getDarkColor()),e.interactionColor=e.colorToRGB(e.getInteractionColor()),e.lightColor=e.colorToRGB(e.getLightColor()),e.rangeHoverColor=e.colorToRGB(e.getRangeHoverColor()),e.rangeTrackColor=e.colorToRGB(e.getRangeTrackColor())},ThemeManager.prototype.insertRules=function(e,o){for(key in o)if(!0===o.hasOwnProperty(key)){const r=o[key];e.insertRule(r)}},ThemeManager.prototype.insertRule=function(e){const o=e.selector,r=e.type&&e.type.length>0?"[type="+e.type+"]":"",t=e.pseudoClass&&e.pseudoClass.length>0?":"+e.pseudoClass:"",n=e.pseudoElement&&e.pseudoElement.length>0?"::"+e.pseudoElement:"",l=e.declarations;let a="";for(key in l)!0===l.hasOwnProperty(key)&&(a+=key+": "+l[key]+"; ");const s=o+r+t+n+" { "+a+"}",c=document.styleSheets[0];c.insertRule(s,c.cssRules.length)},ThemeManager.prototype.colorToRGB=function(e){return"rgb("+e.red+", "+e.green+", "+e.blue+")"},ThemeManager.prototype.getBaseColor=function(){const e=window.__adobe_cep__.getHostEnvironment();return JSON.parse(e).appSkinInfo.panelBackgroundColor.color},ThemeManager.prototype.getDarkColor=function(){return{red:Math.round(this.baseColor.red),green:Math.round(this.baseColor.green),blue:Math.round(this.baseColor.blue)}},ThemeManager.prototype.getLightColor=function(){return{red:this.baseColor.red>62?186:138,green:this.baseColor.green>62?186:138,blue:this.baseColor.blue>62?186:138}},ThemeManager.prototype.getAccentColor=function(){return{red:52,green:142,blue:232}},ThemeManager.prototype.getInteractionColor=function(){return{red:Math.round(this.baseColor.red)-18,green:Math.round(this.baseColor.green)-18,blue:Math.round(this.baseColor.blue)-18}},ThemeManager.prototype.getRangeTrackColor=function(){return{red:Math.round(this.baseColor.red+34),green:Math.round(this.baseColor.green+34),blue:Math.round(this.baseColor.blue+34)}},ThemeManager.prototype.getRangeHoverColor=function(){const e=this.getLightColor();return{red:Math.round(e.red+.35*e.red),green:Math.round(e.green+.35*e.green),blue:Math.round(e.blue+.35*e.blue)}};const themeManager=new ThemeManager;themeManager.init();