function updateThemeWithAppSkinInfo(a){var b=a.panelBackgroundColor.color;document.body.bgColor=toHex(b);var c=(new CSInterface).hostEnvironment.appName;"PHXS"==c&&addRule("ppstyle","button, select, input[type=button], input[type=submit]","border-radius:3px;");if("PHXS"==c||"PPRO"==c||"PRLD"==c){var c="background-image: -webkit-linear-gradient(top, "+toHex(b,40)+" , "+toHex(b,10)+");",d="background-image: -webkit-linear-gradient(top, "+toHex(b,15)+" , "+toHex(b,5)+");",e,g,h,f,k;127<b.red?(e="#000000;",
g="color:"+toHex(b,-70)+";",h="border-color: "+toHex(b,-90)+";",f=toHex(b,54)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(b,-40)+" , "+toHex(b,-50)+");"):(e="#ffffff;",g="color:"+toHex(b,100)+";",h="border-color: "+toHex(b,-45)+";",f=toHex(b,-20)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(b,-20)+" , "+toHex(b,-30)+");");addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+e+"; background-color:"+toHex(b)+";");addRule("ppstyle","button, select, input[type=text], input[type=button], input[type=submit]",
h);addRule("ppstyle","button.default, select, input[type=button], input[type=submit]",c);addRule("ppstyle","button, select, input[type=button], input[type=submit]","-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2);");addRule("ppstyle","button:enabled:active, input[type=button]:enabled:active, input[type=submit]:enabled:active",k);addRule("ppstyle","button:enabled:active, input[type=button]:enabled:active, input[type=submit]:enabled:active","-webkit-box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.6);");
addRule("ppstyle","[disabled]",d);addRule("ppstyle","[disabled]",g);addRule("ppstyle","input[type=text]","padding:1px 3px;");addRule("ppstyle","input[type=text]","background-color: "+f+";");addRule("ppstyle","input[type=text]:focus","background-color: #ffffff;");addRule("ppstyle","input[type=text]:focus","color: #000000;");addRule("ppstyle","select","color: "+e+";");addRule("ppstyle","select","background:"+f+";");addRule("ppstyle",".modal-content","color: "+e+";");addRule("ppstyle",".modal-content",
"background-color: "+f+";");addRule("ppstyle",".settings-modal-content","color: "+e+";");addRule("ppstyle",".settings-modal-content","background-color: "+f+";")}else addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+reverseColor(b)+"; background-color:"+toHex(b,20)),addRule("ppstyle","button","border-color: "+toHex(panelBgColor,-50))}
function addRule(a,b,c){if(a=document.getElementById(a))a=a.sheet,a.addRule?a.addRule(b,c):a.insertRule&&a.insertRule(b+" { "+c+" }",a.cssRules.length)}function reverseColor(a,b){return toHex({red:Math.abs(255-a.red),green:Math.abs(255-a.green),blue:Math.abs(255-a.blue)},b)}function toHex(a,b){function c(a,b){var c=!isNaN(b)?a+b:a;0>c?c=0:255<c&&(c=255);c=c.toString(16);return 1==c.length?"0"+c:c}var d="";if(a)with(a)d=c(red,b)+c(green,b)+c(blue,b);return"#"+d}
function onAppThemeColorChanged(a){a=JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;updateThemeWithAppSkinInfo(a)}function loadJSX(){var a=new CSInterface,b=a.getSystemPath(SystemPath.EXTENSION)+"/jsx/";a.evalScript('$._ext.evalFiles("'+b+'")')}function evalScript(a,b){(new CSInterface).evalScript(a,b)}
function onClickButton(a){"FLPR"==a?evalScript('fl.createDocument(); fl.getDocumentDOM().addNewText({left:100, top:100, right:300, bottom:300} , "Hello Flash!"); '):evalScript("$._ext_"+a+".run()")}function onLoaded(){var a=new CSInterface;"FLPR"!=a.hostEnvironment.appName&&loadJSX();updateThemeWithAppSkinInfo(a.hostEnvironment.appSkinInfo);a.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,onAppThemeColorChanged)}
$(document).ready(function(){var a=null===localStorage.getItem("sliderValueIntro")||void 0===localStorage.getItem("sliderValueIntro")?1:localStorage.getItem("sliderValueIntro"),b=null===localStorage.getItem("tkLANGDEFAULT")||void 0===localStorage.getItem("tkLANGDEFAULT")?"EN":localStorage.getItem("tkLANGDEFAULT"),c=null===localStorage.getItem("selectionIndicatorSetting")||void 0===localStorage.getItem("selectionIndicatorSetting")?"fixed":localStorage.getItem("selectionIndicatorSetting");$("#Slider").val(a);
TKResetLang(b);updateSlider(a);$("#selectSELECTIONINDICATOR").val(c);("fixed"===c||"animated"===c)&&startActiveSelectionIndicator(c)});
function updateSlider(a){var b=document.getElementsByClassName("default"),c,d,e;for(c=0;c<b.length;c++)d=document.getElementsByClassName("default")[c].style.border,d=d.split(" "),6===d.length?(d.pop(),d.push(a+")"),d=d.join(" "),document.getElementsByClassName("default")[c].style.border=d):5===d.length&&(e=d[d.length-1],e=e.slice(0,-1),d.pop(),d.push(e+","),d.push(a+")"),e=d[2],e=e.split(""),e.splice(3,0,"a"),e=e.join(""),d[2]=e,d=d.join(" "),document.getElementsByClassName("default")[c].style.border=
d);document.getElementById("tktips").style.border="1px solid rgba(255, 204, 51, "+a+")";localStorage.setItem("sliderValueIntro",a)}$("#English, #Italian, #German, #Spanish, #Chinese").click(function(){var a=this.value;localStorage.setItem("tkLANGDEFAULT",a);TKResetLang(a)});
function TKResetLang(a){"object"===typeof lang_IT&&"object"===typeof lang_DE&&"object"===typeof lang_ES&&"object"===typeof lang_EN?$(".default").css("display","block"):$(".default").css("display","none");tkLANG="IT"==a?lang_IT:"DE"==a?lang_DE:"ES"==a?lang_ES:lang_EN;TKTT("tipCLEAR");$("#spanLIGHTS").html(tkLANG.spanLIGHTS);$("#spanDARKS").html(tkLANG.spanDARKS);$("#spanMIDTONES").html(tkLANG.spanMIDTONES);$("#spanDIRECTIONS").html(tkLANG.spanDIRECTIONS);$("#buttonADJUST").html(tkLANG.buttonADJUST);
$("#buttonSELECT").html(tkLANG.buttonSELECT);$("#buttonCHANNEL").html(tkLANG.buttonCHANNEL);$("#buttonPIXELS").html(tkLANG.buttonPIXELS);$("#buttonAPPLY").html(tkLANG.buttonAPPLY);$("#buttonLUMLOCK").html(tkLANG.buttonLUMLOCK);$("#buttonIMAGE").html(tkLANG.buttonIMAGE);$("#buttonMASK").html(tkLANG.buttonMASK);$("#buttonPICK").html(tkLANG.buttonPICK);$("#CURVES").html(tkLANG.CURVES);$("#LEVELS").html(tkLANG.LEVELS);$("#BRIGHTNESSCONTRAST").html(tkLANG.BRIGHTNESSCONTRAST);$("#HUESAT").html(tkLANG.HUESAT);
$("#BLACKANDWHITE").html(tkLANG.BLACKANDWHITE);$("#PHOTOFILTER").html(tkLANG.PHOTOFILTER);$("#SELECTIVECOLOR").html(tkLANG.SELECTIVECOLOR);$("#VIBRANCE").html(tkLANG.VIBRANCE);$("#COLORBALANCE").html(tkLANG.COLORBALANCE);$("#CHANNELMIXER").html(tkLANG.CHANNELMIXER);$("#EXPOSURE").html(tkLANG.EXPOSURE);$("#INVERT").html(tkLANG.INVERT);$("#SOLIDCOLOR").html(tkLANG.SOLIDCOLOR);$("#spanCOLORSETTINGS").html(tkLANG.spanCOLORSETTINGS);$("#spanSELECTIONINDICATOR").html(tkLANG.spanSELECTIONINDICATOR);$("#optionFIXED").html(tkLANG.optionFIXED);
$("#optionANIMATED").html(tkLANG.optionANIMATED);$("#optionOFF").html(tkLANG.optionOFF)}function TKTT(a){"tipCLEAR"===a?$("#tktips").css({"font-size":"18px","font-family":"Verdana","text-align":"center","vertical-align":"middle","line-height":"85px",color:"#ffffff"}):$("#tktips").css({"font-size":"11px","font-family":"Arial","text-align":"left","vertical-align":"baseline","line-height":"10px",color:"#000000"});$("#tktips").html(tkLANG[a])}
function modalForAdjustButton(){var a=document.getElementById("adjustModal");a.style.display="block";window.onclick=function(b){b.target==a&&(a.style.display="none")}}function createAdjustLayer(a){$("#adjustModal").hide();evalScript("$._ext_"+a+".run()")}
function openSettings(){var a=document.getElementById("settingsModal"),b=document.getElementById("spanCLOSESETTINGS");a.style.display="block";b.onclick=function(){a.style.display="none"};window.onclick=function(b){b.target==a&&(a.style.display="none")}}$("#selectSELECTIONINDICATOR").change(function(){var a=$("#selectSELECTIONINDICATOR").val();localStorage.setItem("selectionIndicatorSetting",a)});
function startActiveSelectionIndicator(a){var b;"fixed"===a&&(b="activeSelectionImg");"animated"===a&&(b="activeSelectionGIF");(new PSSelectEvent).start(function(){document.getElementById(b).style.visibility="visible"},function(){document.getElementById(b).style.visibility="hidden"})};
