var hexcase=1,salt="nn5d1s2sdfsdf098llz4r7nahkwi8bsy6we26cns9s2gasfasf787ds089lkjecy620cu3l4lzaz0kjswq3";String.prototype.removeDashes=function(){return this.replace(/-/g,"")};String.prototype.removeSpaces=function(){return this.replace(/\s+/g,"")};
function onLoaded(){var a=new CSInterface;"FLPR"!=a.hostEnvironment.appName&&loadJSX();try{var d=readPrefs();d.serialNumber&&d.email&&d.name&&serialCorrect(d)?$("#main").show():($("#registration").show(),d.serialNumber&&$("#serialNumber").val(d.serialNumber),d.email&&$("#email").val(d.email),d.name&&$("#name").val(d.name))}catch(b){alert(b)}updateThemeWithAppSkinInfo(a.hostEnvironment.appSkinInfo);a.addEventListener(CSInterface.THEME_COLOR_CHANGED_EVENT,onAppThemeColorChanged);d=new CSEvent("com.adobe.PhotoshopPersistent",
"APPLICATION");d.extensionId="PhotobacksCartoonCC";a.dispatchEvent(d)}function Dodge(){evalScript("$._ext_PHXS.Dodge()")}function Burn(){evalScript("$._ext_PHXS.Burn()")}
function updateThemeWithAppSkinInfo(a){var d=a.panelBackgroundColor.color;document.body.bgColor=toHex(d);var b=(new CSInterface).hostEnvironment.appName;"PHXS"==b&&addRule("ppstyle","button, select, input[type=button], input[type=submit]","border-radius:3px;");if("PHXS"==b||"PPRO"==b||"PRLD"==b){var b="background-image: -webkit-linear-gradient(top, "+toHex(d,40)+" , "+toHex(d,10)+");",c="background-image: -webkit-linear-gradient(top, "+toHex(d,15)+" , "+toHex(d,5)+");",e,f,g,h,k;127<d.red?(e="#000000;",
f="color:"+toHex(d,-70)+";",g="border-color: "+toHex(d,-90)+";",h=toHex(d,54)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(d,-40)+" , "+toHex(d,-50)+");"):(e="#ffffff;",f="color:"+toHex(d,100)+";",g="border-color: "+toHex(d,-45)+";",h=toHex(d,-20)+";",k="background-image: -webkit-linear-gradient(top, "+toHex(d,-20)+" , "+toHex(d,-30)+");");addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+e+"; background-color:"+toHex(d)+";");addRule("ppstyle","button, select, input[type=text], input[type=button], input[type=submit]",
g);addRule("ppstyle","button, select, input[type=button], input[type=submit]",b);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]",c);addRule("ppstyle","[disabled]",f);addRule("ppstyle","input[type=text]","padding:1px 3px;");addRule("ppstyle","input[type=text]","background-color: "+h)+";";addRule("ppstyle","input[type=text]:focus","background-color: #ffffff;");addRule("ppstyle","input[type=text]:focus","color: #000000;")}else addRule("ppstyle",".default","font-size:"+a.baseFontSize+"px; color:"+reverseColor(d)+"; background-color:"+toHex(d,20)),addRule("ppstyle","button","border-color: "+toHex(panelBgColor,
-50))}function addRule(a,d,b){if(a=document.getElementById(a))a=a.sheet,a.addRule?a.addRule(d,b):a.insertRule&&a.insertRule(d+" { "+b+" }",a.cssRules.length)}function reverseColor(a,d){return toHex({red:Math.abs(255-a.red),green:Math.abs(255-a.green),blue:Math.abs(255-a.blue)},d)}function toHex(a,d){function b(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 c="";if(a)with(a)c=b(red,d)+b(green,d)+b(blue,d);return"#"+c}
function onAppThemeColorChanged(a){a=JSON.parse(window.__adobe_cep__.getHostEnvironment()).appSkinInfo;updateThemeWithAppSkinInfo(a)}function loadJSX(){var a=new CSInterface,d=a.getSystemPath(SystemPath.EXTENSION)+"/jsx/";a.evalScript('$._ext.evalFiles("'+d+'")')}function evalScript(a,d){(new CSInterface).evalScript(a,d)}function onClickButton(a){evalScript('$._ext_PHXS.run("'+a+'")')}
function readPrefs(){var a={},d=(new CSInterface).getSystemPath(SystemPath.USER_DATA),d=d+"/LocalStore",b=window.cep.fs.readdir(d);window.cep.fs.ERR_NOT_FOUND==b.err&&window.cep.fs.makedir(d);b=window.cep.fs.readFile(d+"/photobacks_cartoon.json");try{b.err==window.cep.fs.NO_ERROR&&b.data&&(a=JSON.parse(b.data))}catch(c){}return a}
function savePrefs(a){var d=(new CSInterface).getSystemPath(SystemPath.USER_DATA),d=d+"/LocalStore",b=window.cep.fs.readdir(d);window.cep.fs.ERR_NOT_FOUND==b.err&&window.cep.fs.makedir(d);window.cep.fs.writeFile(d+"/photobacks_cartoon.json",JSON.stringify(a))}
function activateClick(){var a=readPrefs();a.serialNumber=$("#serialNumber").val();a.email=$("#email").val();a.name=$("#name").val();savePrefs(a);serialCorrect(a)?($("#main").show(),$("#registration").hide()):alert("Your Activation Code is incorrect. Please check and try again.")}function serialCorrect(a){try{if("C576ED243E91134B"==a.serialNumber.removeDashes())return!0}catch(d){}return!1}function hex_md5(a){return rstr2hex(rstr_md5(str2rstr_utf8(a)))}
function rstr_md5(a){return binl2rstr(binl_md5(rstr2binl(a),8*a.length))}function rstr2hex(a){try{hexcase}catch(d){hexcase=0}for(var b=hexcase?"0123456789ABCDEF":"0123456789abcdef",c="",e,f=0;f<a.length;f++)e=a.charCodeAt(f),c+=b.charAt(e>>>4&15)+b.charAt(e&15);return c}
function str2rstr_utf8(a){for(var d="",b=-1,c,e;++b<a.length;)c=a.charCodeAt(b),e=b+1<a.length?a.charCodeAt(b+1):0,55296<=c&&(56319>=c&&56320<=e&&57343>=e)&&(c=65536+((c&1023)<<10)+(e&1023),b++),127>=c?d+=String.fromCharCode(c):2047>=c?d+=String.fromCharCode(192|c>>>6&31,128|c&63):65535>=c?d+=String.fromCharCode(224|c>>>12&15,128|c>>>6&63,128|c&63):2097151>=c&&(d+=String.fromCharCode(240|c>>>18&7,128|c>>>12&63,128|c>>>6&63,128|c&63));return d}
function rstr2binl(a){for(var d=Array(a.length>>2),b=0;b<d.length;b++)d[b]=0;for(b=0;b<8*a.length;b+=8)d[b>>5]|=(a.charCodeAt(b/8)&255)<<b%32;return d}function binl2rstr(a){for(var d="",b=0;b<32*a.length;b+=8)d+=String.fromCharCode(a[b>>5]>>>b%32&255);return d}
function binl_md5(a,d){a[d>>5]|=128<<d%32;a[(d+64>>>9<<4)+14]=d;for(var b=1732584193,c=-271733879,e=-1732584194,f=271733878,g=0;g<a.length;g+=16)var h=b,k=c,l=e,m=f,b=md5_ff(b,c,e,f,a[g+0],7,-680876936),f=md5_ff(f,b,c,e,a[g+1],12,-389564586),e=md5_ff(e,f,b,c,a[g+2],17,606105819),c=md5_ff(c,e,f,b,a[g+3],22,-1044525330),b=md5_ff(b,c,e,f,a[g+4],7,-176418897),f=md5_ff(f,b,c,e,a[g+5],12,1200080426),e=md5_ff(e,f,b,c,a[g+6],17,-1473231341),c=md5_ff(c,e,f,b,a[g+7],22,-45705983),b=md5_ff(b,c,e,f,a[g+8],7,
1770035416),f=md5_ff(f,b,c,e,a[g+9],12,-1958414417),e=md5_ff(e,f,b,c,a[g+10],17,-42063),c=md5_ff(c,e,f,b,a[g+11],22,-1990404162),b=md5_ff(b,c,e,f,a[g+12],7,1804603682),f=md5_ff(f,b,c,e,a[g+13],12,-40341101),e=md5_ff(e,f,b,c,a[g+14],17,-1502002290),c=md5_ff(c,e,f,b,a[g+15],22,1236535329),b=md5_gg(b,c,e,f,a[g+1],5,-165796510),f=md5_gg(f,b,c,e,a[g+6],9,-1069501632),e=md5_gg(e,f,b,c,a[g+11],14,643717713),c=md5_gg(c,e,f,b,a[g+0],20,-373897302),b=md5_gg(b,c,e,f,a[g+5],5,-701558691),f=md5_gg(f,b,c,e,a[g+
10],9,38016083),e=md5_gg(e,f,b,c,a[g+15],14,-660478335),c=md5_gg(c,e,f,b,a[g+4],20,-405537848),b=md5_gg(b,c,e,f,a[g+9],5,568446438),f=md5_gg(f,b,c,e,a[g+14],9,-1019803690),e=md5_gg(e,f,b,c,a[g+3],14,-187363961),c=md5_gg(c,e,f,b,a[g+8],20,1163531501),b=md5_gg(b,c,e,f,a[g+13],5,-1444681467),f=md5_gg(f,b,c,e,a[g+2],9,-51403784),e=md5_gg(e,f,b,c,a[g+7],14,1735328473),c=md5_gg(c,e,f,b,a[g+12],20,-1926607734),b=md5_hh(b,c,e,f,a[g+5],4,-378558),f=md5_hh(f,b,c,e,a[g+8],11,-2022574463),e=md5_hh(e,f,b,c,a[g+
11],16,1839030562),c=md5_hh(c,e,f,b,a[g+14],23,-35309556),b=md5_hh(b,c,e,f,a[g+1],4,-1530992060),f=md5_hh(f,b,c,e,a[g+4],11,1272893353),e=md5_hh(e,f,b,c,a[g+7],16,-155497632),c=md5_hh(c,e,f,b,a[g+10],23,-1094730640),b=md5_hh(b,c,e,f,a[g+13],4,681279174),f=md5_hh(f,b,c,e,a[g+0],11,-358537222),e=md5_hh(e,f,b,c,a[g+3],16,-722521979),c=md5_hh(c,e,f,b,a[g+6],23,76029189),b=md5_hh(b,c,e,f,a[g+9],4,-640364487),f=md5_hh(f,b,c,e,a[g+12],11,-421815835),e=md5_hh(e,f,b,c,a[g+15],16,530742520),c=md5_hh(c,e,f,
b,a[g+2],23,-995338651),b=md5_ii(b,c,e,f,a[g+0],6,-198630844),f=md5_ii(f,b,c,e,a[g+7],10,1126891415),e=md5_ii(e,f,b,c,a[g+14],15,-1416354905),c=md5_ii(c,e,f,b,a[g+5],21,-57434055),b=md5_ii(b,c,e,f,a[g+12],6,1700485571),f=md5_ii(f,b,c,e,a[g+3],10,-1894986606),e=md5_ii(e,f,b,c,a[g+10],15,-1051523),c=md5_ii(c,e,f,b,a[g+1],21,-2054922799),b=md5_ii(b,c,e,f,a[g+8],6,1873313359),f=md5_ii(f,b,c,e,a[g+15],10,-30611744),e=md5_ii(e,f,b,c,a[g+6],15,-1560198380),c=md5_ii(c,e,f,b,a[g+13],21,1309151649),b=md5_ii(b,
c,e,f,a[g+4],6,-145523070),f=md5_ii(f,b,c,e,a[g+11],10,-1120210379),e=md5_ii(e,f,b,c,a[g+2],15,718787259),c=md5_ii(c,e,f,b,a[g+9],21,-343485551),b=safe_add(b,h),c=safe_add(c,k),e=safe_add(e,l),f=safe_add(f,m);return[b,c,e,f]}function md5_cmn(a,d,b,c,e,f){return safe_add(bit_rol(safe_add(safe_add(d,a),safe_add(c,f)),e),b)}function md5_ff(a,d,b,c,e,f,g){return md5_cmn(d&b|~d&c,a,d,e,f,g)}function md5_gg(a,d,b,c,e,f,g){return md5_cmn(d&c|b&~c,a,d,e,f,g)}
function md5_hh(a,d,b,c,e,f,g){return md5_cmn(d^b^c,a,d,e,f,g)}function md5_ii(a,d,b,c,e,f,g){return md5_cmn(b^(d|~c),a,d,e,f,g)}function safe_add(a,d){var b=(a&65535)+(d&65535);return(a>>16)+(d>>16)+(b>>16)<<16|b&65535}function bit_rol(a,d){return a<<d|a>>>32-d};
