!function(){var r=new CSInterface,s=r.getSystemPath(SystemPath.USER_DATA)+"/BattleAxe/Overlord/";firebase.initializeApp({apiKey:"AIzaSyA1DIJ8dnyhGYVkjI9fK8viu7Aws87j3DQ",authDomain:"aslan-479b7.firebaseapp.com",databaseURL:"https://aslan-479b7.firebaseio.com",storageBucket:"aslan-479b7.appspot.com",messagingSenderId:"486655706957"}),r.setWindowTitle("Overlord Settings"),angular.module("BattleAxe",["ngAnimate"]);var e=firebase.auth(),o=firebase.database(),a=(firebase.storage().ref("Overlord"),["Coded with love in the American South.","A product of the hermit kingdom of Battleaxia.","Forged in the fires of chaos at the foot of the Obelisk.","Distilled from the ether in solitude.","Believe in yourself. And fear your inevitable doom.","The scariest moment is always just before you start.","Do not mistake movement for progress."]),l=Math.floor(Math.random()*a.length);angular.module("BattleAxe").controller("modal",["$scope",function(n){var t={};n.downloadMessage="Consulting the oracle of infinite knowledge",function(e){var o=window.cep.fs.readFile(e+"/config/prefs.json");if(0===o.err){var a=JSON.parse(o.data);null==a.artboardButton&&(a.artboardButton="ai"),null==a.compDuration&&(a.compDuration=5),null==a.compFramerate&&(a.compFramerate=24),null==a.aeGuides&&(a.aeGuides=!1),null==a.layerPos&&(a.layerPos=!0),n.overlordPrefs=a}}(s),setTimeout(function(){n.loginUser()},100),n.loginUser=function(){console.log(e),e.signInWithEmailAndPassword(n.overlordPrefs.registeredTo,"abcdefgh").catch(function(e){e.code;var o=e.message;console.log(o)})},n.logoutUser=function(){e.signOut()},e.onAuthStateChanged(function(e){(n.firebaseUser=e)&&n.checkVersion(),n.$apply()}),n.openUserPath=function(){r.evalScript("Folder('"+s+"').execute()")},n.checkVersion=function(){if(event.altKey)n.openUserPath();else{console.log("check version");var e=n.overlordPrefs.registeredTo.split("@")[0];console.log(e),o.ref("products/Overlord/"+e).once("value").then(function(e){n.newestVersion=parseFloat(e.val().split("_")[1]).toFixed(2),n.downloadButton="Download v"+n.newestVersion,n.newestVersion>parseFloat(n.overlordPrefs.version)?(console.log("new Version available"),n.updateAvailable=!0,n.updateUnavailable=!1):n.updateUnavailable=!0,n.$apply()})}},n.deauthorize=function(){n.overlordPrefs.licenseKey="",n.savePrefs(!0)},n.downloadUpdate=function(e){r.openURLInDefaultBrowser("http://license.battleaxe.co")};r.setContextMenu('<Menu>                            <MenuItem Id="help" Label="Help" Enabled="true" Checked="false"/>                    </Menu>',function(e){"help"==e&&r.openURLInDefaultBrowser("http://www.battleaxe.co/overlord-braindump")}),n.isIllustrator="ILST"===r.getApplicationID(),n.isAfterEffects="AEFT"===r.getApplicationID(),n.userPath=s,n.savePrefs=function(e){t=n.overlordPrefs,window.cep.fs.writeFile(s+"/config/prefs.json",JSON.stringify(t,null,2));var o={cmd:"ol_updatePrefs",prefs:t},a=new VulcanMessage(VulcanMessage.TYPE_PREFIX+"com.overlord.vulcan");a.setPayload(JSON.stringify(o)),VulcanInterface.dispatchMessage(a),e&&function(){console.log("reload"),message={cmd:"ol_reload"};var e=new VulcanMessage(VulcanMessage.TYPE_PREFIX+"com.overlord.vulcan");e.setPayload(JSON.stringify(message)),VulcanInterface.dispatchMessage(e)}(),r.closeExtension()},n.cancel=function(){r.closeExtension()},n.launchUrl=function(e){r.openURLInDefaultBrowser(e)},n.builtIn=function(){return a[l]},window.addEventListener("keydown",function(e){13==e.keyCode&&n.savePrefs()})}])}();