!function(){"use strict";angular.module("app.core",["app.layout","app.tk","app.ps","app.events"]).service("csInterface",function(){return new CSInterface}).factory("themeManager",["csInterface",function(e){function t(e,t){function n(e,t){var n=isNaN(t)?e:e+t;return 0>n?n=0:n>255&&(n=255),n=Math.floor(n),n=n.toString(16),1===n.length?"0"+n:n}var o="";return e&&(o=n(e.red,t)+n(e.green,t)+n(e.blue,t)),o}function n(e,t,n){var o=document.getElementById(e);o&&(o=o.sheet,o.insertRule(t+" { "+n+" }",o.cssRules.length))}function o(e){var o,r="hostStyle",c=e.panelBackgroundColor.color.red,a=c>128;c>200?document.getElementById("theme").href="content/css/topcoat-desktop-lightlight.css":c>180?document.getElementById("theme").href="content/css/topcoat-desktop-light.css":c>80?document.getElementById("theme").href="content/css/topcoat-desktop-dark.css":c>=50&&(document.getElementById("theme").href="content/css/topcoat-desktop-darkdark.css"),o=a?"333":"DDD",n(r,"body","background-color:#"+t(e.panelBackgroundColor.color)),n(r,"body","color:#"+o)}function r(t){var n=e.getHostEnvironment().appSkinInfo;o(n)}function c(){var t=e.getHostEnvironment().appSkinInfo;o(t),e.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,r)}return{init:c}}])}();