text: "use strict";var ApplicationConfiguration=function(){var applicationModuleName="mean",applicationModuleVendorDependencies=["ngResource","ngAnimate","ngMessages","ui.router","ui.bootstrap","ui.utils","angularFileUpload"],registerModule=function(moduleName,dependencies){angular.module(moduleName,dependencies||[]),angular.module(applicationModuleName).requires.push(moduleName)};return{applicationModuleName:applicationModuleName,applicationModuleVendorDependencies:applicationModuleVendorDependencies,registerModule:registerModule}}();
  "use strict";angular.module(ApplicationConfiguration.applicationModuleName,ApplicationConfiguration.applicationModuleVendorDependencies),angular.module(ApplicationConfiguration.applicationModuleName).config(["$locationProvider","$httpProvider",function($locationProvider,$httpProvider){$locationProvider.html5Mode(!0).hashPrefix("!"),$httpProvider.interceptors.push("authInterceptor")}]),angular.module(ApplicationConfiguration.applicationModuleName).run(["$rootScope","$state","Authentication",function($rootScope,$state,Authentication){function storePreviousState(state,params){state.data&&state.data.ignoreState||($state.previous={state:state,params:params,href:$state.href(state,params)})}$rootScope.$on("$stateChangeStart",function(event,toState,toParams,fromState,fromParams){if(toState.data&&toState.data.roles&&toState.data.roles.length>0){var allowed=!1;toState.data.roles.forEach(function(role){if(void 0!==Authentication.user.roles&&Authentication.user.roles.indexOf(role)!==-1)return allowed=!0,!0}),allowed||(event.preventDefault(),void 0!==Authentication.user&&"object"==typeof Authentication.user?$state.go("forbidden"):$state.go("authentication.signin").then(function(){storePreviousState(toState,toParams)}))}}),$rootScope.$on("$stateChangeSuccess",function(event,toState,toParams,fromState,fromParams){storePreviousState(fromState,fromParams)})}]),angular.element(document).ready(function(){if(window.location.hash&&"#_=_"===window.location.hash)if(window.history&&history.pushState)window.history.pushState("",document.title,window.location.pathname);else{var scroll={top:document.body.scrollTop,left:document.body.scrollLeft};window.location.hash="",document.body.scrollTop=scroll.top,document.body.scrollLeft=scroll.left}angular.bootstrap(document,[ApplicationConfiguration.applicationModuleName])});
  !function(app){"use strict";app.registerModule("accounts")}(ApplicationConfiguration);
  "use strict";ApplicationConfiguration.registerModule("core"),ApplicationConfiguration.registerModule("core.admin",["core"]),ApplicationConfiguration.registerModule("core.admin.routes",["ui.router"]);
  "use strict";ApplicationConfiguration.registerModule("users",["core"]),ApplicationConfiguration.registerModule("users.admin",["core.admin"]),ApplicationConfiguration.registerModule("users.admin.routes",["core.admin.routes"]);
  !function(app){"use strict";app.registerModule("masterlists")}(ApplicationConfiguration);
  !function(app){"use strict";app.registerModule("months")}(ApplicationConfiguration);
  !function(){"use strict";function menuConfig(menuService){menuService.addMenuItem("topbar",{title:"Accounts",state:"accounts",type:"dropdown",roles:["*"]}),menuService.addSubMenuItem("topbar","accounts",{title:"List Accounts",state:"accounts.list"}),menuService.addSubMenuItem("topbar","accounts",{title:"Create Account",state:"accounts.create",roles:["user"]})}angular.module("accounts").run(menuConfig),menuConfig.$inject=["Menus"]}();
  !function(){"use strict";function routeConfig($stateProvider){$stateProvider.state("accounts",{"abstract":!0,url:"/accounts",template:"<ui-view/>"}).state("accounts.list",{url:"",templateUrl:"modules/accounts/client/views/list-accounts.client.view.html",controller:"AccountsListController",controllerAs:"vm",data:{pageTitle:"Accounts List"}}).state("accounts.create",{url:"/create",templateUrl:"modules/accounts/client/views/form-account.client.view.html",controller:"AccountsController",controllerAs:"vm",resolve:{accountResolve:newAccount},data:{roles:["user","admin"],pageTitle:"Accounts Create"}}).state("accounts.edit",{url:"/:accountId/edit",templateUrl:"modules/accounts/client/views/form-account.client.view.html",controller:"AccountsController",controllerAs:"vm",resolve:{accountResolve:getAccount},data:{roles:["user","admin"],pageTitle:"Edit Account {{ accountResolve.name }}"}}).state("accounts.view",{url:"/:accountId",templateUrl:"modules/accounts/client/views/view-account.client.view.html",controller:"AccountsController",controllerAs:"vm",resolve:{accountResolve:getAccount},data:{pageTitle:"Account {{ accountResolve.name }}"}}).state("accounts.listDay",{url:"/:accountId/:day/listday",templateUrl:"modules/accounts/client/views/listday.client.view.html",controller:"AccountsController",controllerAs:"vm",resolve:{accountResolve:getAccount},data:{roles:["user","admin"],pageTitle:"Days {{ accountResolve.name }}"}})}function getAccount($stateParams,AccountsService){return AccountsService.get({accountId:$stateParams.accountId}).$promise}function newAccount(AccountsService){return new AccountsService}angular.module("accounts").config(routeConfig),routeConfig.$inject=["$stateProvider"],getAccount.$inject=["$stateParams","AccountsService"],newAccount.$inject=["AccountsService"]}();
  !function(){"use strict";function AccountsService($resource){return $resource("api/accounts/:accountId",{accountId:"@_id"},{update:{method:"PUT"}})}angular.module("accounts").factory("AccountsService",AccountsService),AccountsService.$inject=["$resource"]}();
  !function(){"use strict";function AccountsController($scope,$state,$window,Authentication,account,MasterlistsService,MonthsService,$stateParams){function remove(){$window.confirm("Are you sure you want to delete?")&&vm.account.$remove($state.go("accounts.list"))}function save(isValid){function successCallback(res){$state.go("accounts.view",{accountId:res._id})}function errorCallback(res){vm.error=res.data.message}return isValid?void(vm.account._id?vm.account.$update(successCallback,errorCallback):vm.account.$save(successCallback,errorCallback)):($scope.$broadcast("show-errors-check-validity","vm.form.accountForm"),!1)}var vm=this;vm.authentication=Authentication,vm.account=account,vm.error=null,vm.form={},vm.remove=remove,vm.save=save,vm.masterlists=MasterlistsService.query(),vm.months=MonthsService.query(),$stateParams.day&&(vm.day=$stateParams.day);for(var listday=[],firstday=vm.account.month.items[0].indexday,indexs=0,listdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=0;i<firstday;i++)indexs=firstday-(i+1),listday.push({nameday:listdays[indexs],day:0});vm.account.month.items=listday.concat(vm.account.month.items),$scope.selectList=function(item){vm.prices=item.prices,vm.status="",vm.account.lists.length>0&&vm.account.lists.forEach(function(list){list.master._id===item._id&&(vm.status="have")}),""===vm.status||"have"!==vm.status||(alert("คุณเลือกรายการซ้ำ"),vm.list="",vm.prices="")},$scope.addList=function(item){vm.account.lists=vm.account.lists?vm.account.lists:[],vm.account.lists.push({master:item}),vm.list="",vm.prices="",$scope.calOutcome(),$scope.calIncome()},$scope.addComment=function(){vm.account.comment=vm.account.comment?vm.account.comment:[],vm.account.comment.push({other:vm.commentOther,price:vm.commentPrice,types:vm.commentTypes}),vm.commentOther="",vm.commentPrice="",vm.commentTypes="",$scope.calOutcome(),$scope.calIncome()},$scope.addListOutcome=function(){vm.account.month.items.forEach(function(list){list.day===Number(vm.day)&&list.lists.push({name:vm.listOutcome,prices:vm.priceOutcome,types:"Outcome"})}),$scope.calListOutcome(),vm.listOutcome="",vm.priceOutcome=""},vm.listOutcometotal=0,vm.listOutcomeAmount=0,vm.listOutcomeBalance=0,vm.listOutcomeAmount=vm.account.amount/vm.account.month.days-vm.listOutcometotal,vm.account._id&&vm.account.month.items.forEach(function(list){list.total=0,list.lists&&list.lists.forEach(function(sumPrice){list.day===Number(vm.day)&&(list.total+=sumPrice.prices,vm.listOutcometotal=list.total)})}),vm.listOutcomeBalance=vm.account.amount/vm.account.month.days-vm.listOutcometotal,$scope.calListOutcome=function(){vm.listOutcometotal=0,vm.listOutcomeBalance=0,vm.account.month.items.forEach(function(list){list.total=0,list.lists.forEach(function(sumPrice){list.day===Number(vm.day)&&(list.total+=sumPrice.prices,vm.listOutcometotal=list.total)})}),vm.listOutcomeBalance=vm.account.amount/vm.account.month.days-vm.listOutcometotal},$scope.calOutcome=function(){vm.account.total=0;var sumOutcome=0,sumCommmentOutcome=0;angular.forEach(vm.account.lists,function(list){sumOutcome+=list.master.prices}),angular.forEach(vm.account.comment,function(comment){"Outcome"===comment.types&&(sumCommmentOutcome+=comment.price)}),vm.account.total=sumOutcome+sumCommmentOutcome},$scope.calIncome=function(){vm.account.amount=0;var sumIncome=0,sumCommmentIncome=0;angular.forEach(vm.masterlists,function(list){"Income"===list.types&&(sumIncome+=list.prices)}),angular.forEach(vm.account.comment,function(comment){"Income"===comment.types&&(sumCommmentIncome+=comment.price)}),vm.account.amount=sumIncome+sumCommmentIncome-vm.account.total},$scope.removeList=function(item){vm.account.lists.splice(item,1),$scope.calOutcome(),$scope.calIncome()},$scope.removeComment=function(item){vm.account.comment.splice(item,1),$scope.calOutcome(),$scope.calIncome()},$scope.removeListOutcome=function(item){vm.account.month.items.forEach(function(list){list.lists.forEach(function(sumPrice){list.day===Number(vm.day)&&list.lists.splice(item,1)})}),$scope.calListOutcome()}}angular.module("accounts").controller("AccountsController",AccountsController),AccountsController.$inject=["$scope","$state","$window","Authentication","accountResolve","MasterlistsService","MonthsService","$stateParams"]}();
  !function(){"use strict";function AccountsListController(AccountsService,$scope,$http,Authentication){var vm=this;vm.authentication=Authentication,vm.accounts=AccountsService.query(),$scope.getYears=function(year){$http.get("/api/checkyear/"+year).then(function(res){$scope.years=res.data.years})},$scope.getYears(),$scope.checkYear=function(year){$http.get("/api/checkyear/"+year).then(function(res){res.data.status?$scope.addYear(year):alert(res.data.message)})},$scope.addYear=function(year){function successCallback(res){checkLoop+=1,number===checkLoop&&(vm.accounts=AccountsService.query(),$scope.getYears())}function errorCallback(res){vm.error=res.data.message}for(var number=0,checkLoop=0,i=0;i<12;i++){for(var saveNo=i+1,setDate=new Date(year,i+1,0),month=["January","February","March","April","May","June","July","August","September","October","November","December"],saveName=month[setDate.getMonth()],saveDay=setDate.getDate(),itemsDay=[],j=0;j<saveDay;j++){var cookingDay=new Date(year,i,j+1),listdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];itemsDay.push({day:j+1,nameday:listdays[cookingDay.getDay()],indexday:cookingDay.getDay()})}var saveAccount=new AccountsService({year:year,month:{name:saveName,days:saveDay,no:saveNo,items:itemsDay}});number=i+1,saveAccount.$save(successCallback,errorCallback)}}}angular.module("accounts").controller("AccountsListController",AccountsListController),AccountsListController.$inject=["AccountsService","$scope","$http","Authentication"]}();
  "use strict";angular.module("core.admin").run(["Menus",function(Menus){Menus.addMenuItem("topbar",{title:"Admin",state:"admin",type:"dropdown",roles:["admin"]})}]);
  "use strict";angular.module("core.admin.routes").config(["$stateProvider",function($stateProvider){$stateProvider.state("admin",{"abstract":!0,url:"/admin",template:"<ui-view/>",data:{roles:["admin"]}})}]);
  "use strict";angular.module("core").config(["$stateProvider","$urlRouterProvider",function($stateProvider,$urlRouterProvider){$urlRouterProvider.otherwise(function($injector,$location){$injector.get("$state").transitionTo("not-found",null,{location:!1})}),$stateProvider.state("home",{url:"/",templateUrl:"modules/core/client/views/home.client.view.html"}).state("not-found",{url:"/not-found",templateUrl:"modules/core/client/views/404.client.view.html",data:{ignoreState:!0}}).state("bad-request",{url:"/bad-request",templateUrl:"modules/core/client/views/400.client.view.html",data:{ignoreState:!0}}).state("forbidden",{url:"/forbidden",templateUrl:"modules/core/client/views/403.client.view.html",data:{ignoreState:!0}})}]);
  "use strict";angular.module("core").controller("HeaderController",["$scope","$state","Authentication","Menus",function($scope,$state,Authentication,Menus){$scope.$state=$state,$scope.authentication=Authentication,$scope.menu=Menus.getMenu("topbar"),$scope.isCollapsed=!1,$scope.toggleCollapsibleMenu=function(){$scope.isCollapsed=!$scope.isCollapsed},$scope.$on("$stateChangeSuccess",function(){$scope.isCollapsed=!1})}]);
  "use strict";angular.module("core").controller("HomeController",["$scope","Authentication",function($scope,Authentication){$scope.authentication=Authentication,$scope.helloText="Welcome in INSPINIA MEAN.JS Boilerplate",$scope.descriptionText="It is an application skeleton for a typical MEAN web app. You can use it to quickly bootstrap your project."}]);
  "use strict";angular.module("core").directive("sideNavigation",["$timeout",function($timeout){return{restrict:"A",link:function(scope,element){scope.$watch("authentication.user",function(){$timeout(function(){element.metisMenu()})})}}}]).directive("minimalizaSidebar",["$timeout",function($timeout){return{restrict:"A",template:'<a class="navbar-minimalize minimalize-styl-2 btn btn-primary " href="" ng-click="minimalize()"><i class="fa fa-bars"></i></a>',controller:["$scope","$element",function($scope,$element){$scope.minimalize=function(){angular.element("body").toggleClass("mini-navbar"),!angular.element("body").hasClass("mini-navbar")||angular.element("body").hasClass("body-small")?(angular.element("#side-menu").hide(),$timeout(function(){angular.element("#side-menu").fadeIn(400)},200)):angular.element("#side-menu").removeAttr("style")}}]}}]);
  "use strict";angular.module("core").directive("showErrors",["$timeout","$interpolate",function($timeout,$interpolate){var linkFn=function(scope,el,attrs,formCtrl){var inputEl,inputName,inputNgEl,options,showSuccess,toggleClasses,initCheck=!1,showValidationMessages=!1;if(options=scope.$eval(attrs.showErrors)||{},showSuccess=options.showSuccess||!1,inputEl=el[0].querySelector(".form-control[name]")||el[0].querySelector("[name]"),inputNgEl=angular.element(inputEl),inputName=$interpolate(inputNgEl.attr("name")||"")(scope),!inputName)throw"show-errors element has no child input elements with a 'name' attribute class";var reset=function(){return $timeout(function(){el.removeClass("has-error"),el.removeClass("has-success"),showValidationMessages=!1},0,!1)};scope.$watch(function(){return formCtrl[inputName]&&formCtrl[inputName].$invalid},function(invalid){return toggleClasses(invalid)}),scope.$on("show-errors-check-validity",function(event,name){if(angular.isUndefined(name)||formCtrl.$name===name)return initCheck=!0,showValidationMessages=!0,toggleClasses(formCtrl[inputName].$invalid)}),scope.$on("show-errors-reset",function(event,name){if(angular.isUndefined(name)||formCtrl.$name===name)return reset()}),toggleClasses=function(invalid){if(el.toggleClass("has-error",showValidationMessages&&invalid),showSuccess)return el.toggleClass("has-success",showValidationMessages&&!invalid)}};return{restrict:"A",require:"^form",compile:function(elem,attrs){if(attrs.showErrors.indexOf("skipFormGroupCheck")===-1&&!elem.hasClass("form-group")&&!elem.hasClass("input-group"))throw"show-errors element does not have the 'form-group' or 'input-group' class";return linkFn}}}]);
  "use strict";angular.module("core").service("Menus",[function(){this.defaultRoles=["user","admin"],this.menus={};var shouldRender=function(user){if(~this.roles.indexOf("*"))return!0;if(!user)return!1;for(var userRoleIndex in user.roles)for(var roleIndex in this.roles)if(this.roles[roleIndex]===user.roles[userRoleIndex])return!0;return!1};this.validateMenuExistance=function(menuId){if(menuId&&menuId.length){if(this.menus[menuId])return!0;throw new Error("Menu does not exist")}throw new Error("MenuId was not provided")},this.getMenu=function(menuId){return this.validateMenuExistance(menuId),this.menus[menuId]},this.addMenu=function(menuId,options){return options=options||{},this.menus[menuId]={roles:options.roles||this.defaultRoles,items:options.items||[],shouldRender:shouldRender},this.menus[menuId]},this.removeMenu=function(menuId){this.validateMenuExistance(menuId),delete this.menus[menuId]},this.addMenuItem=function(menuId,options){if(options=options||{},this.validateMenuExistance(menuId),this.menus[menuId].items.push({title:options.title||"",state:options.state||"",type:options.type||"item","class":options["class"],roles:null===options.roles||"undefined"==typeof options.roles?this.defaultRoles:options.roles,position:options.position||0,items:[],shouldRender:shouldRender}),options.items)for(var i in options.items)this.addSubMenuItem(menuId,options.state,options.items[i]);return this.menus[menuId]},this.addSubMenuItem=function(menuId,parentItemState,options){options=options||{},this.validateMenuExistance(menuId);for(var itemIndex in this.menus[menuId].items)this.menus[menuId].items[itemIndex].state===parentItemState&&this.menus[menuId].items[itemIndex].items.push({title:options.title||"",state:options.state||"",roles:null===options.roles||"undefined"==typeof options.roles?this.menus[menuId].items[itemIndex].roles:options.roles,position:options.position||0,shouldRender:shouldRender});return this.menus[menuId]},this.removeMenuItem=function(menuId,menuItemState){this.validateMenuExistance(menuId);for(var itemIndex in this.menus[menuId].items)this.menus[menuId].items[itemIndex].state===menuItemState&&this.menus[menuId].items.splice(itemIndex,1);return this.menus[menuId]},this.removeSubMenuItem=function(menuId,submenuItemState){this.validateMenuExistance(menuId);for(var itemIndex in this.menus[menuId].items)for(var subitemIndex in this.menus[menuId].items[itemIndex].items)this.menus[menuId].items[itemIndex].items[subitemIndex].state===submenuItemState&&this.menus[menuId].items[itemIndex].items.splice(subitemIndex,1);return this.menus[menuId]},this.addMenu("topbar",{roles:["*"]})}]);
  "use strict";angular.module("core").service("Socket",["Authentication","$state","$timeout",function(Authentication,$state,$timeout){this.connect=function(){Authentication.user&&(this.socket=io())},this.connect(),this.on=function(eventName,callback){this.socket&&this.socket.on(eventName,function(data){$timeout(function(){callback(data)})})},this.emit=function(eventName,data){this.socket&&this.socket.emit(eventName,data)},this.removeListener=function(eventName){this.socket&&this.socket.removeListener(eventName)}}]);
  "use strict";angular.module("users.admin").run(["Menus",function(Menus){Menus.addSubMenuItem("topbar","admin",{title:"Manage Users",state:"admin.users"})}]);
  "use strict";angular.module("users.admin.routes").config(["$stateProvider",function($stateProvider){$stateProvider.state("admin.users",{url:"/users",templateUrl:"modules/users/client/views/admin/list-users.client.view.html",controller:"UserListController"}).state("admin.user",{url:"/users/:userId",templateUrl:"modules/users/client/views/admin/view-user.client.view.html",controller:"UserController",resolve:{userResolve:["$stateParams","Admin",function($stateParams,Admin){return Admin.get({userId:$stateParams.userId})}]}}).state("admin.user-edit",{url:"/users/:userId/edit",templateUrl:"modules/users/client/views/admin/edit-user.client.view.html",controller:"UserController",resolve:{userResolve:["$stateParams","Admin",function($stateParams,Admin){return Admin.get({userId:$stateParams.userId})}]}})}]);
  "use strict";angular.module("users").config(["$httpProvider",function($httpProvider){$httpProvider.interceptors.push(["$q","$location","Authentication",function($q,$location,Authentication){return{responseError:function(rejection){switch(rejection.status){case 401:Authentication.user=null,$location.path("signin");break;case 403:}return $q.reject(rejection)}}}])}]);
  "use strict";angular.module("users").config(["$stateProvider",function($stateProvider){$stateProvider.state("settings",{"abstract":!0,url:"/settings",templateUrl:"modules/users/client/views/settings/settings.client.view.html",data:{roles:["user","admin"]}}).state("settings.profile",{url:"/profile",templateUrl:"modules/users/client/views/settings/edit-profile.client.view.html"}).state("settings.password",{url:"/password",templateUrl:"modules/users/client/views/settings/change-password.client.view.html"}).state("settings.accounts",{url:"/accounts",templateUrl:"modules/users/client/views/settings/manage-social-accounts.client.view.html"}).state("settings.picture",{url:"/picture",templateUrl:"modules/users/client/views/settings/change-profile-picture.client.view.html"}).state("authentication",{"abstract":!0,url:"/authentication",templateUrl:"modules/users/client/views/authentication/authentication.client.view.html"}).state("authentication.signup",{url:"/signup",templateUrl:"modules/users/client/views/authentication/signup.client.view.html"}).state("authentication.signin",{url:"/signin?err",templateUrl:"modules/users/client/views/authentication/signin.client.view.html"}).state("password",{"abstract":!0,url:"/password",template:"<ui-view/>"}).state("password.forgot",{url:"/forgot",templateUrl:"modules/users/client/views/password/forgot-password.client.view.html"}).state("password.reset",{"abstract":!0,url:"/reset",template:"<ui-view/>"}).state("password.reset.invalid",{url:"/invalid",templateUrl:"modules/users/client/views/password/reset-password-invalid.client.view.html"}).state("password.reset.success",{url:"/success",templateUrl:"modules/users/client/views/password/reset-password-success.client.view.html"}).state("password.reset.form",{url:"/:token",templateUrl:"modules/users/client/views/password/reset-password.client.view.html"})}]);
  "use strict";angular.module("users").controller("AuthenticationController",["$scope","$state","$http","$location","$window","Authentication","PasswordValidator",function($scope,$state,$http,$location,$window,Authentication,PasswordValidator){$scope.authentication=Authentication,$scope.popoverMsg=PasswordValidator.getPopoverMsg(),$scope.error=$location.search().err,$scope.authentication.user&&$location.path("/"),$scope.signup=function(isValid){return $scope.error=null,isValid?void $http.post("/api/auth/signup",$scope.credentials).success(function(response){$scope.authentication.user=response,$state.go($state.previous.state.name||"home",$state.previous.params)}).error(function(response){$scope.error=response.message}):($scope.$broadcast("show-errors-check-validity","userForm"),!1)},$scope.signin=function(isValid){return $scope.error=null,isValid?void $http.post("/api/auth/signin",$scope.credentials).success(function(response){$scope.authentication.user=response,$state.go($state.previous.state.name||"home",$state.previous.params)}).error(function(response){$scope.error=response.message}):($scope.$broadcast("show-errors-check-validity","userForm"),!1)},$scope.callOauthProvider=function(url){$state.previous&&$state.previous.href&&(url+="?redirect_to="+encodeURIComponent($state.previous.href)),$window.location.href=url}}]);
  "use strict";angular.module("users").controller("PasswordController",["$scope","$stateParams","$http","$location","Authentication","PasswordValidator",function($scope,$stateParams,$http,$location,Authentication,PasswordValidator){$scope.authentication=Authentication,$scope.popoverMsg=PasswordValidator.getPopoverMsg(),$scope.authentication.user&&$location.path("/"),$scope.askForPasswordReset=function(isValid){return $scope.success=$scope.error=null,isValid?void $http.post("/api/auth/forgot",$scope.credentials).success(function(response){$scope.credentials=null,$scope.success=response.message}).error(function(response){$scope.credentials=null,$scope.error=response.message}):($scope.$broadcast("show-errors-check-validity","forgotPasswordForm"),!1)},$scope.resetUserPassword=function(isValid){return $scope.success=$scope.error=null,isValid?void $http.post("/api/auth/reset/"+$stateParams.token,$scope.passwordDetails).success(function(response){$scope.passwordDetails=null,Authentication.user=response,$location.path("/password/reset/success")}).error(function(response){$scope.error=response.message}):($scope.$broadcast("show-errors-check-validity","resetPasswordForm"),!1)}}]);
  "use strict";angular.module("users").directive("passwordValidator",["PasswordValidator",function(PasswordValidator){return{require:"ngModel",link:function(scope,element,attrs,ngModel){ngModel.$validators.requirements=function(password){var status=!0;if(password){var result=PasswordValidator.getResult(password),requirementsIdx=0,requirementsMeter=[{color:"danger",progress:"20"},{color:"warning",progress:"40"},{color:"info",progress:"60"},{color:"primary",progress:"80"},{color:"success",progress:"100"}];result.errors.length<requirementsMeter.length&&(requirementsIdx=requirementsMeter.length-result.errors.length-1),scope.requirementsColor=requirementsMeter[requirementsIdx].color,scope.requirementsProgress=requirementsMeter[requirementsIdx].progress,result.errors.length?(scope.popoverMsg=PasswordValidator.getPopoverMsg(),scope.passwordErrors=result.errors,status=!1):(scope.popoverMsg="",scope.passwordErrors=[],status=!0)}return status}}}}]);
  "use strict";angular.module("users").directive("passwordVerify",[function(){return{require:"ngModel",scope:{passwordVerify:"="},link:function(scope,element,attrs,ngModel){scope.$watch(function(){var combined;return(scope.passwordVerify||ngModel)&&(combined=scope.passwordVerify+"_"+ngModel),combined},function(value){value&&(ngModel.$validators.passwordVerify=function(password){var origin=scope.passwordVerify;return origin===password})})}}}]);
  "use strict";angular.module("users").directive("lowercase",function(){return{require:"ngModel",link:function(scope,element,attrs,modelCtrl){modelCtrl.$parsers.push(function(input){return input?input.toLowerCase():""}),element.css("text-transform","lowercase")}}});
  "use strict";angular.module("users").factory("Authentication",["$window",function($window){var auth={user:$window.user};return auth}]);
  "use strict";angular.module("users").factory("PasswordValidator",["$window",function($window){var owaspPasswordStrengthTest=$window.owaspPasswordStrengthTest;return{getResult:function(password){var result=owaspPasswordStrengthTest.test(password);return result},getPopoverMsg:function(){var popoverMsg="Please enter a passphrase or password with greater than 10 characters, numbers, lowercase, upppercase, and special characters.";return popoverMsg}}}]);
  "use strict";angular.module("users").factory("Users",["$resource",function($resource){return $resource("api/users",{},{update:{method:"PUT"}})}]),angular.module("users.admin").factory("Admin",["$resource",function($resource){return $resource("api/users/:userId",{userId:"@_id"},{update:{method:"PUT"}})}]);
  !function(){"use strict";function menuConfig(menuService){menuService.addMenuItem("topbar",{title:"Masterlists",state:"masterlists",type:"dropdown",roles:["*"]}),menuService.addSubMenuItem("topbar","masterlists",{title:"List Masterlists",state:"masterlists.list"}),menuService.addSubMenuItem("topbar","masterlists",{title:"Create Masterlist",state:"masterlists.create",roles:["user"]})}angular.module("masterlists").run(menuConfig),menuConfig.$inject=["Menus"]}();
  !function(){"use strict";function routeConfig($stateProvider){$stateProvider.state("masterlists",{"abstract":!0,url:"/masterlists",template:"<ui-view/>"}).state("masterlists.list",{url:"",templateUrl:"modules/masterlists/client/views/list-masterlists.client.view.html",controller:"MasterlistsListController",controllerAs:"vm",data:{pageTitle:"Masterlists List"}}).state("masterlists.create",{url:"/create",templateUrl:"modules/masterlists/client/views/form-masterlist.client.view.html",controller:"MasterlistsController",controllerAs:"vm",resolve:{masterlistResolve:newMasterlist},data:{roles:["user","admin"],pageTitle:"Masterlists Create"}}).state("masterlists.edit",{url:"/:masterlistId/edit",templateUrl:"modules/masterlists/client/views/form-masterlist.client.view.html",controller:"MasterlistsController",controllerAs:"vm",resolve:{masterlistResolve:getMasterlist},data:{roles:["user","admin"],pageTitle:"Edit Masterlist {{ masterlistResolve.name }}"}}).state("masterlists.view",{url:"/:masterlistId",templateUrl:"modules/masterlists/client/views/view-masterlist.client.view.html",controller:"MasterlistsController",controllerAs:"vm",resolve:{masterlistResolve:getMasterlist},data:{pageTitle:"Masterlist {{ masterlistResolve.name }}"}})}function getMasterlist($stateParams,MasterlistsService){return MasterlistsService.get({masterlistId:$stateParams.masterlistId}).$promise}function newMasterlist(MasterlistsService){return new MasterlistsService}angular.module("masterlists").config(routeConfig),routeConfig.$inject=["$stateProvider"],getMasterlist.$inject=["$stateParams","MasterlistsService"],newMasterlist.$inject=["MasterlistsService"]}();
  !function(){"use strict";function MasterlistsListController(MasterlistsService,Authentication){var vm=this;vm.authentication=Authentication,vm.masterlists=MasterlistsService.query()}angular.module("masterlists").controller("MasterlistsListController",MasterlistsListController),MasterlistsListController.$inject=["MasterlistsService","Authentication"]}();
  !function(){"use strict";function MasterlistsController($scope,$state,$window,Authentication,masterlist){function remove(){$window.confirm("Are you sure you want to delete?")&&vm.masterlist.$remove($state.go("masterlists.list"))}function save(isValid){function successCallback(res){$state.go("masterlists.list",{masterlistId:res._id})}function errorCallback(res){vm.error=res.data.message}return isValid?void(vm.masterlist._id?vm.masterlist.$update(successCallback,errorCallback):vm.masterlist.$save(successCallback,errorCallback)):($scope.$broadcast("show-errors-check-validity","vm.form.masterlistForm"),!1)}var vm=this;vm.authentication=Authentication,vm.masterlist=masterlist,vm.error=null,vm.form={},vm.remove=remove,vm.save=save}angular.module("masterlists").controller("MasterlistsController",MasterlistsController),MasterlistsController.$inject=["$scope","$state","$window","Authentication","masterlistResolve"]}();
  !function(){"use strict";function MasterlistsService($resource){return $resource("api/masterlists/:masterlistId",{masterlistId:"@_id"},{update:{method:"PUT"}})}angular.module("masterlists").factory("MasterlistsService",MasterlistsService),MasterlistsService.$inject=["$resource"]}();
  !function(){"use strict";function menuConfig(menuService){menuService.addMenuItem("topbar",{title:"Months",state:"months",type:"dropdown",roles:["*"]}),menuService.addSubMenuItem("topbar","months",{title:"List Months",state:"months.list"}),menuService.addSubMenuItem("topbar","months",{title:"Create Month",state:"months.create",roles:["user"]})}angular.module("months").run(menuConfig),menuConfig.$inject=["Menus"]}();
  !function(){"use strict";function routeConfig($stateProvider){$stateProvider.state("months",{"abstract":!0,url:"/months",template:"<ui-view/>"}).state("months.list",{url:"",templateUrl:"modules/months/client/views/list-months.client.view.html",controller:"MonthsListController",controllerAs:"vm",data:{pageTitle:"Months List"}}).state("months.create",{url:"/create",templateUrl:"modules/months/client/views/form-month.client.view.html",controller:"MonthsController",controllerAs:"vm",resolve:{monthResolve:newMonth},data:{roles:["user","admin"],pageTitle:"Months Create"}}).state("months.edit",{url:"/:monthId/edit",templateUrl:"modules/months/client/views/form-month.client.view.html",controller:"MonthsController",controllerAs:"vm",resolve:{monthResolve:getMonth},data:{roles:["user","admin"],pageTitle:"Edit Month {{ monthResolve.name }}"}}).state("months.view",{url:"/:monthId",templateUrl:"modules/months/client/views/view-month.client.view.html",controller:"MonthsController",controllerAs:"vm",resolve:{monthResolve:getMonth},data:{pageTitle:"Month {{ monthResolve.name }}"}})}function getMonth($stateParams,MonthsService){return MonthsService.get({monthId:$stateParams.monthId}).$promise}function newMonth(MonthsService){return new MonthsService}angular.module("months").config(routeConfig),routeConfig.$inject=["$stateProvider"],getMonth.$inject=["$stateParams","MonthsService"],newMonth.$inject=["MonthsService"]}();
  !function(){"use strict";function MonthsListController(MonthsService){var vm=this;vm.months=MonthsService.query()}angular.module("months").controller("MonthsListController",MonthsListController),MonthsListController.$inject=["MonthsService"]}();
  !function(){"use strict";function MonthsController($scope,$state,$window,Authentication,month){function remove(){$window.confirm("Are you sure you want to delete?")&&vm.month.$remove($state.go("months.list"))}function save(isValid){function successCallback(res){$state.go("months.view",{monthId:res._id})}function errorCallback(res){vm.error=res.data.message}return isValid?void(vm.month._id?vm.month.$update(successCallback,errorCallback):vm.month.$save(successCallback,errorCallback)):($scope.$broadcast("show-errors-check-validity","vm.form.monthForm"),!1)}var vm=this;vm.authentication=Authentication,vm.month=month,vm.error=null,vm.form={},vm.remove=remove,vm.save=save}angular.module("months").controller("MonthsController",MonthsController),MonthsController.$inject=["$scope","$state","$window","Authentication","monthResolve"]}();
  !function(){"use strict";function MonthsService($resource){return $resource("api/months/:monthId",{monthId:"@_id"},{update:{method:"PUT"}})}angular.module("months").factory("MonthsService",MonthsService),MonthsService.$inject=["$resource"]}();
  "use strict";angular.module("core").factory("authInterceptor",["$q","$injector",function($q,$injector){return{responseError:function(rejection){if(!rejection.config.ignoreAuthModule)switch(rejection.status){case 401:$injector.get("$state").transitionTo("authentication.signin");break;case 403:$injector.get("$state").transitionTo("forbidden")}return $q.reject(rejection)}}}]);
  "use strict";angular.module("users.admin").controller("UserListController",["$scope","$filter","Admin",function($scope,$filter,Admin){Admin.query(function(data){$scope.users=data,$scope.buildPager()}),$scope.buildPager=function(){$scope.pagedItems=[],$scope.itemsPerPage=15,$scope.currentPage=1,$scope.figureOutItemsToDisplay()},$scope.figureOutItemsToDisplay=function(){$scope.filteredItems=$filter("filter")($scope.users,{$:$scope.search}),$scope.filterLength=$scope.filteredItems.length;var begin=($scope.currentPage-1)*$scope.itemsPerPage,end=begin+$scope.itemsPerPage;$scope.pagedItems=$scope.filteredItems.slice(begin,end)},$scope.pageChanged=function(){$scope.figureOutItemsToDisplay()}}]);
  "use strict";angular.module("users.admin").controller("UserController",["$scope","$state","Authentication","userResolve",function($scope,$state,Authentication,userResolve){$scope.authentication=Authentication,$scope.user=userResolve,$scope.remove=function(user){confirm("Are you sure you want to delete this user?")&&(user?(user.$remove(),$scope.users.splice($scope.users.indexOf(user),1)):$scope.user.$remove(function(){$state.go("admin.users")}))},$scope.update=function(isValid){if(!isValid)return $scope.$broadcast("show-errors-check-validity","userForm"),!1;var user=$scope.user;user.$update(function(){$state.go("admin.user",{userId:user._id})},function(errorResponse){$scope.error=errorResponse.data.message})}}]);
  "use strict";angular.module("users").controller("ChangePasswordController",["$scope","$http","Authentication","PasswordValidator",function($scope,$http,Authentication,PasswordValidator){$scope.user=Authentication.user,$scope.popoverMsg=PasswordValidator.getPopoverMsg(),$scope.changeUserPassword=function(isValid){return $scope.success=$scope.error=null,isValid?void $http.post("/api/users/password",$scope.passwordDetails).success(function(response){$scope.$broadcast("show-errors-reset","passwordForm"),$scope.success=!0,$scope.passwordDetails=null}).error(function(response){$scope.error=response.message}):($scope.$broadcast("show-errors-check-validity","passwordForm"),!1)}}]);
  "use strict";angular.module("users").controller("ChangeProfilePictureController",["$scope","$timeout","$window","Authentication","FileUploader",function($scope,$timeout,$window,Authentication,FileUploader){$scope.user=Authentication.user,$scope.imageURL=$scope.user.profileImageURL,$scope.uploader=new FileUploader({url:"api/users/picture",alias:"newProfilePicture"}),$scope.uploader.filters.push({name:"imageFilter",fn:function(item,options){var type="|"+item.type.slice(item.type.lastIndexOf("/")+1)+"|";return"|jpg|png|jpeg|bmp|gif|".indexOf(type)!==-1}}),$scope.uploader.onAfterAddingFile=function(fileItem){if($window.FileReader){var fileReader=new FileReader;fileReader.readAsDataURL(fileItem._file),fileReader.onload=function(fileReaderEvent){$timeout(function(){$scope.imageURL=fileReaderEvent.target.result},0)}}},$scope.uploader.onSuccessItem=function(fileItem,response,status,headers){$scope.success=!0,$scope.user=Authentication.user=response,$scope.cancelUpload()},$scope.uploader.onErrorItem=function(fileItem,response,status,headers){$scope.cancelUpload(),$scope.error=response.message},$scope.uploadProfilePicture=function(){$scope.success=$scope.error=null,$scope.uploader.uploadAll()},$scope.cancelUpload=function(){$scope.uploader.clearQueue(),$scope.imageURL=$scope.user.profileImageURL}}]);
  "use strict";angular.module("users").controller("EditProfileController",["$scope","$http","$location","Users","Authentication",function($scope,$http,$location,Users,Authentication){$scope.user=Authentication.user,$scope.updateUserProfile=function(isValid){if($scope.success=$scope.error=null,!isValid)return $scope.$broadcast("show-errors-check-validity","userForm"),!1;var user=new Users($scope.user);user.$update(function(response){$scope.$broadcast("show-errors-reset","userForm"),$scope.success=!0,Authentication.user=response},function(response){$scope.error=response.data.message})}}]);
  "use strict";angular.module("users").controller("SocialAccountsController",["$scope","$http","Authentication",function($scope,$http,Authentication){$scope.user=Authentication.user,$scope.hasConnectedAdditionalSocialAccounts=function(provider){for(var i in $scope.user.additionalProvidersData)return!0;return!1},$scope.isConnectedSocialAccount=function(provider){return $scope.user.provider===provider||$scope.user.additionalProvidersData&&$scope.user.additionalProvidersData[provider]},$scope.removeUserSocialAccount=function(provider){$scope.success=$scope.error=null,$http["delete"]("/api/users/accounts",{params:{provider:provider}}).success(function(response){$scope.success=!0,$scope.user=Authentication.user=response}).error(function(response){$scope.error=response.message})}}]);
  "use strict";angular.module("users").controller("SettingsController",["$scope","Authentication",function($scope,Authentication){$scope.user=Authentication.user}]);