4 lines
75 KiB
JavaScript
4 lines
75 KiB
JavaScript
function l(){var a,b,c=arguments[0],d=c,e=arguments;for(labels[c]?d=labels[c]:clabels[c]&&(d=clabels[c]),a=1,b=0;a<e.length;a++,b++)d=d.replace("%{"+b+"}",e[a]);return a=1,e.length>1&&(d=d.replace(/%((%)|s|d)/g,function(b){var c=null;if(b[2])c=b[2];else{switch(c=e[a],b){case"%d":c=parseFloat(c),isNaN(c)&&(c=0)}a++}return c})),d}function hexToRgb(a){var b=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(a);return b?{r:parseInt(b[1],16),g:parseInt(b[2],16),b:parseInt(b[3],16)}:null}function contrast(a){var b,c,d=1;if(b=hexToRgb(a)){c=[b.r/255,b.g/255,b.b/255];for(var e=0;e<c.length;++e)c[e]<=.03928?c[e]=c[e]/12.92:c[e]=Math.pow((c[e]+.055)/1.055,2.4);d=.2126*c[0]+.7152*c[1]+.0722*c[2]}return d>.179?"black":"white"}function guid(){function a(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return(a()+a()+"-"+a()+"-4"+a().substr(0,3)+"-"+a()+"-"+a()+a()+a()).toLowerCase()}!function(){"use strict";function a(a,b,c,d,e){d.definePalette("sogo-green",{50:"eaf5e9",100:"cbe5c8",200:"aad6a5",300:"88c781",400:"66b86a",500:"56b04c",600:"4da143",700:"388e3c",800:"367d2e",900:"225e1b",A100:"fafafa",A200:"69f0ae",A400:"00e676",A700:"00c853",contrastDefaultColor:"dark",contrastLightColors:["300","400","500","600","700","800","900"]}),d.definePalette("sogo-blue",{50:"f0faf9",100:"e1f5f3",200:"ceebe8",300:"bfe0dd",400:"b2d6d3",500:"a1ccc8",600:"8ebfbb",700:"7db3b0",800:"639997",900:"4d8080",A100:"d4f7fa",A200:"c3f5fa",A400:"53e3f0",A700:"00b0c0",contrastDefaultColor:"light",contrastDarkColors:["50","100","200"]}),d.definePalette("sogo-paper",{50:"fcf7f8",100:"f7f1dc",200:"ede5ca",300:"e6d8ba",400:"e2d2a3",500:"d6c48d",600:"baa870",700:"857545",800:"524517",900:"433809",1000:"000000",A100:"ffffff",A200:"eeeeee",A400:"bdbdbd",A700:"616161",contrastDefaultColor:"dark",contrastLightColors:["800","900"]}),d.theme("default").primaryPalette("sogo-blue",{default:"900","hue-1":"400","hue-2":"800","hue-3":"A700"}).accentPalette("sogo-green",{default:"500","hue-1":"A100","hue-2":"300","hue-3":"A700"}),DebugEnabled||(a.debugEnabled(!1),b.debugInfoEnabled(!1),e.disableWarnings(),d.generateThemesOnDemand(!0)),c.interceptors.push("AuthInterceptor"),c.interceptors.push("ErrorInterceptor")}function b(a,b){return{response:function(c){return c&&/^application\/json/.test(c.config.headers.Accept)&&/^<!DOCTYPE html>/.test(c.data)?(a.location.reload(!0),b.reject()):c}}}function c(a,b){return{responseError:function(c){return/^application\/json/.test(c.config.headers.Accept)&&a.$broadcast("http:Error",c),b.reject(c)}}}angular.module("SOGo.Common",["ngAnimate","ngMessages","ngSanitize","ngMaterial","mdColors"]).value("sgSettings",{isPopup:document.body.classList.contains("popup"),baseURL:function(){return ApplicationBaseURL||null},resourcesURL:function(){return ResourcesURL||null},activeUser:function(a){var b={login:UserLogin||null,identification:UserIdentification||null,email:UserEmail||null,language:UserLanguage||null,folderURL:UserFolderURL||null,isSuperUser:IsSuperUser||null,path:{calendar:UserCalendarPath||null,contacts:UserContactsPath||null,mail:UserMailPath||null,preferences:UserPreferencesPath||null,administration:IsSuperUser?UserAdministrationPath:null,help:HelpURL||null,logoff:UserLogoffPath||null}};return a?b[a]:b},minimumSearchLength:function(){return angular.isNumber(minimumSearchLength)?minimumSearchLength:2}}).constant("sgColors",{selection:["#FFFFFF","#330033","#C0C0C0","#999999","#666666","#333333","#000000","#FFCCCC","#FF6666","#FF0000","#CC0000","#990000","#660000","#330000","#FFCC99","#FF9966","#FF9900","#FF6600","#CC6600","#993300","#663300","#FFFF99","#FFFF66","#FFCC66","#FFCC33","#CC9933","#996633","#663333","#FFFFCC","#FFFF33","#FFFF00","#FFCC00","#999900","#666600","#333300","#CCCCCC","#66FF99","#33FF33","#33CC00","#009900","#006600","#003300","#99FFFF","#33FFFF","#66CCCC","#00CCCC","#339999","#336666","#003333","#CCFFFF","#66FFFF","#33CCFF","#3366FF","#3333FF","#000099","#000066","#CCCCFF","#9999FF","#6666CC","#6633FF","#6600CC","#333399","#330099","#FFCCFF","#FF99FF","#CC66CC","#CC33CC","#993399","#663366","#99FF99"]}).constant("sgConstant",{xs:"(max-width: 599px)","gt-xs":"(min-width: 600px)",sm:"(min-width: 600px) and (max-width: 959px)","gt-sm":"(min-width: 960px)",md:"(min-width: 960px) and (max-width: 1023px)","gt-md":"(min-width: 1024px)",lg:"(min-width: 1024px) and (max-width: 1279px)","gt-lg":"(min-width: 1280px)",xl:"(min-width: 1920px)",print:"print"}).config(a).factory("AuthInterceptor",b).factory("ErrorInterceptor",c),a.$inject=["$logProvider","$compileProvider","$httpProvider","$mdThemingProvider","$mdAriaProvider"],b.$inject=["$window","$q"],c.$inject=["$rootScope","$q"]}(),function(){"use strict";function a(a){c=a}function b(a,b,d){function e(a){var b=a.join("");return b}function f(a,b,c,d,e,f){if(e){var g="rgb("+e.value[0]+","+e.value[1]+","+e.value[2]+")",h="rgb("+e.contrast[0]+","+e.contrast[1]+","+e.contrast[2]+")",i={theme:c,palette:d,value:g,contrast:h,hue:f};s.insertRule(a(i),t),t+=1,s.insertRule(b(i),t),t+=1}}function g(a,b,c,d,e){if(d){var f="rgb("+d.value[0]+","+d.value[1]+","+d.value[2]+")";s.insertRule(a({theme:b,palette:c,value:f,hue:e}),t),t+=1}}function h(){var a=b[0].head.querySelector('style[title="Dynamic-Generated-by-mdColors"]');return null===a&&(a=b[0].createElement("style"),a.title="Dynamic-Generated-by-mdColors",a.appendChild(b[0].createTextNode("")),b[0].head.appendChild(a)),a.sheet}for(var i=a(e([".md-{{theme}}-theme",".md-fg"])+" { color:{{value}};}"),j=a(e([".md-{{theme}}-theme",".md-bg"])+" { background-color:{{value}};}"),k=a(e([".md-{{theme}}-theme",".md-bdr"])+" { border-color:{{value}};}"),l=a(e([".md-{{theme}}-theme",".md-{{hue}}",".md-fg"])+" { color:{{value}};}"),m=a(e([".md-{{theme}}-theme",".md-{{hue}}",".md-bg"])+" { background-color:{{value}};}"),n=a(e([".md-{{theme}}-theme",".md-{{palette}}",".md-fg"])+" { color:{{value}};}"),o=a(e([".md-{{theme}}-theme",".md-{{palette}}",".md-bg"])+" { background-color:{{value}}; color:{{contrast}} !important; }"),p=a(e([".md-{{theme}}-theme",".md-{{palette}}",".md-bdr"])+" { border-color:{{value}};}"),q=a(e([".md-{{theme}}-theme",".md-{{palette}}.md-{{hue}}",".md-fg"])+" { color:{{value}};}"),r=a(e([".md-{{theme}}-theme",".md-{{palette}}.md-{{hue}}",".md-bg"])+" { background-color:{{value}};}"),s=h(),t=0;s.cssRules.length>0;)s.deleteRule(0);angular.forEach(c._THEMES,function(a,b){f(i,j,b,"primary",c._PALETTES[a.colors.primary.name][a.colors.primary.hues.default]),f(l,m,b,"primary",c._PALETTES[a.colors.primary.name][a.colors.primary.hues["hue-2"]],"hue-2"),f(l,m,b,"primary",c._PALETTES[a.colors.primary.name][a.colors.primary.hues["hue-3"]],"hue-3"),f(l,m,b,"primary",c._PALETTES[a.colors.primary.name][a.colors.primary.hues["hue-1"]],"hue-1"),g(k,b,"primary",c._PALETTES[a.colors.primary.name][a.colors.primary.hues.default]),angular.forEach(a.colors,function(a,d){f(n,o,b,d,c._PALETTES[a.name][a.hues.default]),g(p,b,d,c._PALETTES[a.name][a.hues.default]),f(q,r,b,d,c._PALETTES[a.name][a.hues["hue-2"]],"hue-2"),f(q,r,b,d,c._PALETTES[a.name][a.hues["hue-3"]],"hue-3"),f(q,r,b,d,c._PALETTES[a.name][a.hues["hue-1"]],"hue-1")})})}var c;angular.module("mdColors",["ngMaterial"]).config(a).run(b),a.$inject=["$mdThemingProvider"],b.$inject=["$interpolate","$document","$log"]}(),function(){"use strict";function a(a){return a.decodeURIComponent}a.$inject=["$window"],angular.module("SOGo.Common").filter("decodeUri",a)}(),function(){"use strict";function a(a){return a.encodeURIComponent}a.$inject=["$window"],angular.module("SOGo.Common").filter("encodeUri",a)}(),function(){"use strict";function a(a){return function(b){var c=angular.element("<div>"+b+"</div>");return c.find("a").attr("target","_blank"),a.trustAs("html",c.html())}}a.$inject=["$sce"],angular.module("SOGo.Common").filter("ensureTarget",a)}(),function(){"use strict";function a(){return function(a){return _.last(a)}}angular.module("SOGo.Common").filter("last",a)}(),function(){"use strict";function a(){return function(a){return a?String(a).replace(/\r?\n/gm,"<br>"):void 0}}angular.module("SOGo.Common").filter("ln2br",a)}(),function(){"use strict";function a(){return l}angular.module("SOGo.Common").filter("loc",a)}(),function(){"use strict";function a(){return function(a){for(var b=[],c=0;c<parseInt(a);c++)b.push(c);return b}}angular.module("SOGo.Common").filter("range",a)}(),function(){"use strict";function a(){return function(a){return a?String(a).replace(/<[^>]+>/gm,""):""}}angular.module("SOGo.Common").filter("stripTags",a)}(),function(){"use strict";function a(){return function(a){return a.indexOf("://")<0?"http://"+a:a}}angular.module("SOGo.Common").filter("url",a)}(),function(){"use strict";function a(a,b,c,d,e,f){function g(a){return e.$filter(a,f.$acl.users)}function h(){f.$acl.$resetUsersRights(),b.hide()}function i(){f.$acl.$saveUsersRights().then(function(){b.hide()},function(a,b){c.alert(l("Warning"),l("An error occured please try again."))})}function j(a){var b=a.$confirmRights(p.folder);b&&(p.confirmation.showing=!0,p.confirmation.message=b)}function k(b){a(function(){f.$acl.$removeUser(b.uid)},500)}function m(a){a&&f.$acl.$addUser(a).then(function(a){p.userToAdd="",p.searchText="",p.selectedUid=null,a&&o(a)})}function n(a){f.$acl.$selectAllRights(a)}function o(a,b){return(!b||!b.target.parentNode.classList.contains("md-secondary"))&&void(p.selectedUid==a.uid?p.selectedUid=null:(p.selectedUid=a.uid,p.selectedUser=a,p.selectedUser.$rights()))}var p=this;p.users=d,p.folder=f,p.selectedUser=null,p.selectedUid=null,p.userToAdd="",p.searchText="",p.userFilter=g,p.closeModal=h,p.saveModal=i,p.confirmChange=j,p.removeUser=k,p.addUser=m,p.selectAllRights=n,p.selectUser=o,p.confirmation={showing:!1,message:""}}a.$inject=["$timeout","$mdDialog","Dialog","usersWithACL","User","folder"],angular.module("SOGo.Common").controller("AclController",a)}(),function(){"use strict";function a(a,b,c,d,e,f,g,h,i,j,k,m,n,o){function p(){return!g("left").isOpen()}function q(a,b){var c;b.data&&b.data.message&&angular.isString(b.data.message)?c=b.data.message:b.status&&(c=b.statusText),c?h.show({template:["<md-toast>",' <div class="md-toast-content">',' <md-icon class="md-warn md-hue-1">error_outline</md-icon>'," <span flex>"+l(c)+"</span>"," </div>","</md-toast>"].join(""),hideDelay:5e3,position:"top right"}):j.debug("untrap error")}var r=new n(m.baseURL(),m.activeUser());b.isPopup=m.isPopup,b.activeUser=m.activeUser(),b.baseURL=m.baseURL(),b.leftIsClose=!i(k["gt-md"]),b.centerIsClose=!!f.centerIsClose,b.currentDay=window.currentDay,c(function(){d(function(){e.get("../date").then(function(a){b.currentDay=a})},864e5)},1e3*window.currentDay.secondsBeforeTomorrow),b.toggleLeft=function(){b.isGtMedium?b.leftIsClose=!b.leftIsClose:(b.leftIsClose=p(),b.leftIsClose&&angular.element(f).triggerHandler("resize"),g("left").toggle().then(function(){j.debug("toggle left is done")}))},b.toggleRight=function(){g("right").toggle().then(function(){j.debug("toggle right is done")})},b.toggleCenter=function(a){b.centerIsClose=!b.centerIsClose,a&&a.save&&r.post(null,"saveListState",{state:b.centerIsClose?"collapse":"rise"})},b.$watch(function(){return i(k["gt-md"])},function(a){b.isGtMedium=a,a&&(b.leftIsClose=!1)}),a.$on("http:Error",q),o.getAlarms()}a.$inject=["$rootScope","$scope","$timeout","$interval","$http","$window","$mdSidenav","$mdToast","$mdMedia","$log","sgConstant","sgSettings","Resource","Alarm"],angular.module("SOGo.Common").controller("navController",a)}(),function(){"use strict";function a(a){this.folderId=a}a.factory=["$q","$timeout","sgSettings","Resource","User",function(b,c,d,e,f){return angular.extend(a,{$q:b,$timeout:c,$$resource:new e(d.activeUser("folderURL"),d.activeUser()),$User:f}),a}],angular.module("SOGo.Common").factory("Acl",a.factory),a.prototype.$users=function(b){var c,d=this,e=a.$q.defer();if(!this.users){var f;return f=angular.isDefined(b)?a.$$resource.userResource(b).fetch(this.folderId,"acls"):a.$$resource.fetch(this.folderId,"acls"),f.then(function(f){return d.users=[],angular.forEach(f.users,function(e){c=new a.$User(e),c.canSubscribeUser=c.isSubscribed,c.wasSubscribed=c.isSubscribed,c.$rights=angular.bind(c,c.$acl,d.folderId,b),d.users.push(c)}),e.resolve(d.users),d.users})}return e.resolve(this.users),e.promise},a.prototype.$addUser=function(b,c){var d=this,e=a.$q.defer(),f={uid:b.uid};if(!b.uid||_.indexOf(_.map(this.users,"uid"),b.uid)>-1)e.resolve();else{var g;g=angular.isDefined(c)?a.$$resource.userResource(c).fetch(this.folderId,"addUserInAcls",f):a.$$resource.fetch(this.folderId,"addUserInAcls",f),g.then(function(){b.wasSubscribed=!1,b.userClass=b.isGroup?"normal-group":"normal-user",b.$rights=angular.bind(b,b.$acl,d.folderId,c),d.users.push(b),e.resolve(b)},function(a,b){e.reject(l("An error occured please try again."))})}return e.promise},a.prototype.$removeUser=function(b,c){var d,e=this,f={uid:b};return d=angular.isDefined(c)?a.$$resource.userResource(c).fetch(this.folderId,"removeUserFromAcls",f):a.$$resource.fetch(this.folderId,"removeUserFromAcls",f),d.then(function(){var a=_.indexOf(_.map(e.users,"uid"),b);a>=0&&(e.users[a].$shadowRights=null,e.users.splice(a,1))})},a.prototype.$selectAllRights=function(a){_.forEach(a.rights,function(b,c){angular.isNumber(a.rights[c])&&(a.rights[c]=1)})},a.prototype.$resetUsersRights=function(){angular.forEach(this.users,function(a){a.$resetRights()})},a.prototype.$saveUsersRights=function(b){var c=this,d=a.$q.defer(),e=a.$q.defer(),f={action:"saveUserRights"},g=[];if(angular.forEach(this.users,function(a){a.$rightsAreDirty()&&g.push(a.$omit())}),g.length){var h;h=angular.isDefined(b)?a.$$resource.userResource(b).save(this.folderId,g,f):a.$$resource.save(this.folderId,g,f),h.then(function(){angular.forEach(c.users,function(a){a.$rightsAreDirty()&&(a.$shadowRights=angular.copy(a.rights))}),d.resolve()},d.reject)}else d.resolve();return g=[],angular.forEach(this.users,function(a){!a.wasSubscribed&&a.isSubscribed&&g.push(a.uid)}),g.length?(f={uids:g.join(",")},a.$$resource.fetch(this.folderId,"subscribeUsers",f).then(function(){angular.forEach(c.users,function(a){a.wasSubscribed=a.isSubscribed}),e.resolve()},e.reject)):e.resolve(),a.$q.all([d.promise,e.promise])}}(),function(){"use strict";function a(){this.currentAlarm=null}function b(b,c,d,e){return angular.extend(a,{$timeout:b,$$resource:new d(c.activeUser("folderURL")+"Calendar",c.activeUser()),$toast:e}),a}a.getAlarms=function(){var b=this,c=new Date,d=Math.floor(c.getTime()/1e3);this.$$resource.fetch("","alarmslist?browserTime="+d).then(function(c){var d=c.alarms.sort(function(a,b){var c=parseInt(a[2]),d=parseInt(b[2]);return d-c});if(d.length>0){var e=d.pop(),f=new Date,g=Math.floor(f.getTime()/1e3),h=e[0]+"/"+e[1],i=parseInt(e[2]),j=i;i>0&&(j-=g);var k=(new Date(1e3*i),angular.bind(b,a.showAlarm,h));b.currentAlarm&&b.$timeout.cancel(b.currentAlarm),b.currentAlarm=b.$timeout(k,1e3*j)}})},a.showAlarm=function(a){var b=this;this.$$resource.fetch(a,"?resetAlarm=yes").then(function(c){function d(a,d,e){a.summary=c.summary,a.reminder="10",a.cancel=function(){d.hide()},a.ok=function(){b.$$resource.fetch(e,"view?snoozeAlarm="+a.reminder),d.hide()}}b.$toast.show({position:"top right",hideDelay:0,template:["<md-toast>",' <div class="md-toast-content">',' <div layout="column" layout="start end">',' <p class="sg-padded--top">{{ summary }}</p>',' <div layout="row" layout-align="start center">'," <md-input-container>",' <label style="color: white">{{ "Snooze for " | loc }}</label>',' <md-select ng-model="reminder">',' <md-option value="5">',l("5 minutes")," </md-option>",' <md-option value="10">',l("10 minutes")," </md-option>",' <md-option value="15">',l("15 minutes")," </md-option>",' <md-option value="30">',l("30 minutes")," </md-option>",' <md-option value="45">',l("45 minutes")," </md-option>",' <md-option value="60">',l("1 hour")," </md-option>",' <md-option value="1440">',l("1 day")," </md-option>"," </md-select>"," </md-input-container>",' <md-button ng-click="cancel()">',l("Cancel")," </md-button>",' <md-button ng-click="ok()">',l("Ok")," </md-button>"," </div>"," </div>"," </div>","</md-toast>"].join(""),locals:{url:a},controller:d}),d.$inject=["scope","$mdToast","url"]})},b.$inject=["$timeout","sgSettings","Resource","$mdToast"],angular.module("SOGo.Common").factory("Alarm",b)}(),function(){"use strict";function a(){function a(a,b){var c,d,e,f,g,h,i,j;return c=a,b&&(c+="@"+b.value),d=""+window.location.href,e=ApplicationBaseURL+"/"+encodeURIComponent(c),"/"==e[0]&&(g=d.split("/"),h=g[2],i=g[0],e=i+"//"+h+e),g=e.split("/"),g.splice(0,3),f=g.join("/"),j=!d.startsWith(e)&&!d.startsWith(f)||d.endsWith("/logoff")?e:d}function b(b,c,d,e){function f(){var a,b=null,c=d.get("0xHIGHFLYxSOGo");return c&&c.length>8&&(a=decodeURIComponent(c.substr(8)),b=a.base64decode().split(":")),b}var g;return g={login:function(d){var g,h=b.defer(),i=d.username,j=d.password,k=d.domain,m=d.rememberLogin?1:0;return d.loginSuffix&&!i.endsWith(d.loginSuffix)&&(i+=loginSuffix,k=!1),d.language&&"WONoSelectionString"!=d.language&&(g=d.language),c({method:"POST",url:"/SOGo/connect",data:{userName:i,password:j,domain:k,language:g,rememberLogin:m}}).then(function(b){var c=b.data,d=f();d?"undefined"!=typeof c.expire&&"undefined"!=typeof c.grace?c.expire<0&&c.grace>0?h.reject({grace:c.grace}):c.expire>0&&c.grace==-1?h.reject({expire:c.expire}):h.resolve({cn:c.cn,url:a(i,k)}):h.resolve(a(i,k)):h.reject(l("cookiesNotEnabled"))},function(a){var b,c,d=a.data;d&&d.LDAPPasswordPolicyError?(c=d.LDAPPasswordPolicyError,b=c==e.PolicyNoError?l("Wrong username or password."):c==e.PolicyAccountLocked?l("Your account was locked due to too many failed attempts."):l("Login failed due to unhandled error case: ")+c):b=l("Unhandled error response"),h.reject({error:b})}),h.promise},changePassword:function(a){var g=b.defer(),h=f(),i=d.get("XSRF-TOKEN");return d.remove("XSRF-TOKEN",{path:"/SOGo/"}),c({method:"POST",url:"/SOGo/so/changePassword",headers:{"X-XSRF-TOKEN":i},data:{userName:h[0],password:h[1],newPassword:a}}).then(g.resolve,function(a){var b,c=a.data,f=c.LDAPPasswordPolicyError;f?f==e.PolicyNoError?b=l("Password change failed"):f==e.PolicyPasswordModNotAllowed?b=l("Password change failed - Permission denied"):f==e.PolicyInsufficientPasswordQuality?b=l("Password change failed - Insufficient password quality"):f==e.PolicyPasswordTooShort?b=l("Password change failed - Password is too short"):f==e.PolicyPasswordTooYoung?b=l("Password change failed - Password is too young"):f==e.PolicyPasswordInHistory?b=l("Password change failed - Password is in history"):(b=l("Unhandled policy error: %{0}").formatted(f),f=e.PolicyPasswordUnknown):(f=e.PolicyPasswordSystemUnknown,b=_("Unhandled error response")),d.put("XSRF-TOKEN",i,{path:"/SOGo/"}),g.reject(b)}),g.promise}}}this.$get=b,b.$inject=["$q","$http","$cookies","passwordPolicyConfig"]}angular.module("SOGo.Authentication",["ngCookies"]).constant("passwordPolicyConfig",{PolicyPasswordChangeUnsupported:-3,PolicyPasswordSystemUnknown:-2,PolicyPasswordUnknown:-1,PolicyPasswordExpired:0,PolicyAccountLocked:1,PolicyChangeAfterReset:2,PolicyPasswordModNotAllowed:3,PolicyMustSupplyOldPassword:4,PolicyInsufficientPasswordQuality:5,PolicyPasswordTooShort:6,PolicyPasswordTooYoung:7,PolicyPasswordInHistory:8,PolicyNoError:65535}).provider("Authentication",a)}(),function(){"use strict";function a(){}function b(b,c){return angular.extend(a,{$q:b,$modal:c}),a}a.alert=function(a,b){var c=this.$modal.alert().title(a).htmlContent(b).ok(l("OK"));this.$modal.show(c)},a.confirm=function(a,b,c){var d=this.$modal.confirm().title(a).htmlContent(b).ok(c&&c.ok?c.ok:l("OK")).cancel(c&&c.cancel?c.cancel:l("Cancel"));return this.$modal.show(d)},a.prompt=function(a,b,c){function d(b,c){b.title=a,b.name="",b.cancel=function(){g.reject(),c.hide()},b.ok=function(){g.resolve(b.name),c.hide()}}var e=c||{},f=a.asCSSIdentifier(),g=this.$q.defer();return this.$modal.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,template:['<md-dialog flex="50" flex-xs="90">',' <form name="'+f+'Form" ng-submit="ok()">',' <md-dialog-content class="md-dialog-content" layout="column">',' <h2 class="md-title" ng-bind="title"></h2>'," <md-input-container>"," <label>"+b+"</label>",' <input type="'+(e.inputType||"text")+'"',' aria-label="'+a+'"',' ng-model="name" md-autofocus="true" required />'," </md-input-container>"," </md-dialog-content>"," <md-dialog-actions>",' <md-button ng-click="cancel()">'," "+l("Cancel")," </md-button>",' <md-button type="submit" class="md-primary" ng-disabled="'+f+'Form.$invalid">'," "+l("OK")," </md-button>"," </md-dialog-actions>"," </form>","</md-dialog>"].join(""),controller:d}),d.$inject=["scope","$mdDialog"],g.promise},b.$inject=["$q","$mdDialog"],angular.module("SOGo.Common").factory("Dialog",b)}(),function(){"use strict";function a(){return function(a,b,c,d){var e,f,g,h=b,i=c;return a?(e=a.indexOf("<"),e>=0&&(f=a.indexOf(">",e),f>e&&(a=a.substring(e+1,f))),b||(h=48),g=a.md5(),i&&"none"!=i||(c=d&&d.no_404?"mm":"404"),"https://www.gravatar.com/avatar/"+g+"?s="+h+"&d="+c):""}}angular.module("SOGo.Common").factory("Gravatar",a)}(),function(){"use strict";function a(a,b,c,d,e){angular.extend(this,{_http:a,_q:b,_path:c,_activeUser:d}),angular.extend(this,e),this._path=this._path.replace(/\/$/,"")}a.$factory=["$http","$q",function(b,c){return function(d,e,f){return new a(b,c,d,e,f)}}],angular.module("SOGo.Common").factory("Resource",a.$factory),a.prototype.userResource=function(b){var c=_.compact(this._activeUser.folderURL.split("/"));return c.splice(c.length-1,1,escape(b)),new a(this._http,this._q,"/"+c.join("/"),this._activeUser)},a.prototype.fetch=function(a,b,c){var d=this._q.defer(),e=[this._path];return a&&e.push(a.split("/")),b&&e.push(b),e=_.compact(_.flatten(e)).join("/"),this._http({method:"GET",url:e,params:c}).then(function(a){return d.resolve(a.data)},d.reject),d.promise},a.prototype.newguid=function(a){var b=this._q.defer(),c=this._path+"/"+a+"/newguid";return this._http.get(c).then(function(a){return b.resolve(a.data)},b.reject),b.promise},a.prototype.create=function(a,b){var c=this._q.defer(),d=this._path+"/"+a;return this._http.post(d,{name:b}).then(function(a){return c.resolve(a.data)},c.reject),c.promise},a.prototype.post=function(a,b,c){var d=this._q.defer(),e=[this._path];return a&&e.push(a),b&&e.push(b),e=_.compact(_.flatten(e)).join("/"),this._http.post(e,c).then(function(a){return d.resolve(a.data)},d.reject),d.promise},a.prototype.save=function(a,b,c){var d=c&&c.action?c.action:"save";return this.post(a,d,b)},a.prototype.download=function(a,b,c,d){function e(a){var b;return a?(b=a.split(";")[1].trim().split("=")[1],b.replace(/"/g,"")):null}var f=(this._q.defer(),d&&d.type?d.type:"application/zip"),g=[this._path];return a&&g.push(a),b&&g.push(b),g=_.compact(_.flatten(g)).join("/"),this._http({method:"POST",url:g,data:c,headers:{accept:f},responseType:"arraybuffer",cache:!1,transformResponse:function(a,b){var c,d=null;if(a&&(d=new Blob([a],{type:f})),c=e(b("content-disposition")),!saveAs)throw new Error("To use Resource.download, FileSaver.js must be loaded.");saveAs(d,c)}})},a.prototype.remove=function(a){var b=this._q.defer(),c=this._path+"/"+a+"/delete";return this._http.get(c).then(function(a){return b.resolve(a.data)},b.reject),b.promise}}(),function(){"use strict";function a(a,b){return function(c){b(function(){a.$broadcast("sgFocusOn",c)})}}a.$inject=["$rootScope","$timeout"],angular.module("SOGo.Common").factory("sgFocus",a)}(),function(){"use strict";function a(){function a(a,d){var e=function(b){return function(c,d){a.$apply(function(){b.call(this,c,d)}.bind(this))}},f=function(a){this.id=a.id||guid(),this.key=a.key,this.description=a.description||null,this.context=a.context||null,this.callback=a.callback,this.preventInClass=a.preventInClass,this.args=a.args,this.onKeyUp=!1,this.key.length>1&&(this.lkey=l("key_"+this.key))};f.prototype.clone=function(){return new f(this)};var g=function(){this._hotkeys={},this._hotkeysUp={},this._preventIn=["INPUT","SELECT","TEXTAREA","MD-OPTION"],this._preventInClass=["md-chip-content"],this._onKeydown=this._onKeydown.bind(this),this._onKeyup=this._onKeyup.bind(this),this._onKeypress=this._onKeypress.bind(this),this.initialize()};return g.prototype.initialize=function(){this.registerHotkey(this.createHotkey({key:"?",description:l("Show or hide this help"),callback:this._toggleCheatSheet.bind(this)})),d.addEventListener("keydown",this._onKeydown,!0),d.addEventListener("keyup",this._onKeyup,!0),d.addEventListener("keypress",this._onKeypress,!0)},g.prototype._invokeHotkeyHandlers=function(a,b,c){for(var d=0,e=c.length;d<e;d++){var f=c[d],g=a.target||a.srcElement,h=g.nodeName.toUpperCase();if(!_.includes(this._preventIn,h)&&0===_.intersection(g.classList,this._preventInClass).length&&0===_.intersection(g.classList,f.preventInClass).length)try{f.callback.call(f.context,a,f.args)}catch(a){console.error("HotKeys: ",f.key,a.message)}}},g.prototype._onKeydown=function(a){var b=this.keyStringFromEvent(a);this._hotkeys[b]&&this._invokeHotkeyHandlers(a,b,this._hotkeys[b])},g.prototype._onKeyup=function(a){var b=this.keyStringFromEvent(a);this._hotkeysUp[b]&&this._invokeHotkeyHandlers(this._hotkeysUp[b],b)},g.prototype._onKeypress=function(a){var b,d;b=a.keyCode||a.which,d=c[b],d&&this._hotkeys[d]&&this._invokeHotkeyHandlers(a,d,this._hotkeys[d])},g.prototype.keyStringFromEvent=function(a){var c=[],d=a.which;return d=b[d]?b[d]:String.fromCharCode(d).toLowerCase(),a.ctrlKey&&c.push("ctrl"),a.altKey&&c.push("alt"),a.shiftKey&&c.push("shift"),a.metaKey&&c.push("meta"),c.push(d),_.uniq(c).join("+")},g.prototype._deregisterHotkey=function(a){var b,c=this._hotkeys;if(a.onKeyUp&&(c=this._hotkeysUp),c[a.key]){for(var d=c[a.key],e=0;e<d.length;++e){var f=d[e];(a.callback===f.callback&&f.context===a.context||a.id===f.id)&&(b=d.splice(e,1))}0===d.length&&delete this._hotkeys[a.key]}return b},g.prototype.deregisterHotkey=function(a){var b=[];if(this._validateHotkey(a),angular.isArray(a.key))for(var c=a.key.length-1;c>=0;c--){var d=a.clone();d.key=a.key[c];var e=this._deregisterHotkey(d);void 0!==e&&b.push(e[0])}else b.push(this._deregisterHotkey(a));return b},g.prototype._validateHotkey=function(a){if(!(a instanceof f))throw new TypeError("Hotkeys: Expected a hotkey object be instance of HotKey")},g.prototype._registerKey=function(a){var b=this._hotkeys;return a.onKeyUp&&(b=this._hotkeysUp),b[a.key]=b[a.key]||[],b[a.key].push(a),a},g.prototype._registerKeys=function(a){var b=[];if(angular.isArray(a.key))for(var c=a.key.length-1;c>=0;c--){var d=a.clone();d.id=guid(),d.key=a.key[c],b.push(this._registerKey(d))}else b.push(this._registerKey(a));return b},g.prototype.registerHotkey=function(a){return this._validateHotkey(a),this._registerKeys(a)},g.prototype.registerHotkeyUp=function(a){this._validateHotkey(a),a.onKeyUp=!0,this._registerKeys(a)},g.prototype.createHotkey=function(a){if(null===a.key||void 0===a.key)throw new TypeError('HotKeys: Argument "key" is required');if(null===a.callback||void 0===a.callback)throw new TypeError('HotKeys: Argument "callback" is required');return a.callback=e(a.callback),new f(a)},g.prototype.match=function(a,b){angular.isArray(b)||(b=[b]);var c=this.keyStringFromEvent(a);return Boolean(~b.indexOf(c))},g.prototype._toggleCheatSheet=function(){function a(a,b){a.hotkeys=b,a.closeDialog=function(){g.$modal.hide()}}var b=this;this._cheatSheet?(g.$modal.hide(),this._cheatSheet=null):this._cheatSheet=g.$modal.show({clickOutsideToClose:!0,escapeToClose:!0,template:["<md-dialog>"," <md-dialog-content>"," <md-list>",' <md-list-item ng-repeat="(hotkey, keys) in hotkeys">',' <div class="sg-hotkey-container">'," <sg-hotkey>{{keys[0].lkey || hotkey}}</sg-hotkey>"," </div>"," {{keys[0].description}}"," </md-list-item>"," </md-list>"," </md-dialog-content>","</md-dialog>"].join(""),controller:a,locals:{hotkeys:b._hotkeys}}).finally(function(){b._cheatSheet=null}),a.$inject=["$scope","hotkeys"]},g}var b={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",19:"pause",20:"caps",27:"escape",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},c={42:"*",63:"?"};this.$get=a,a.$inject=["$rootScope","$window"]}function b(a,b){return angular.extend(b,{$modal:a}),new b}b.$inject=["$mdDialog","$sgHotkeys"],angular.module("SOGo.Common").service("sgHotkeys",b).provider("$sgHotkeys",a)}(),function(){"use strict";function a(a){a&&this.init(a)}a.factory=["$q","$log","sgSettings","Resource",function(b,c,d,e){return angular.extend(a,{$q:b,$log:c,$$resource:new e(d.activeUser("folderURL"),d.activeUser()),$query:"",$users:[]}),a}],angular.module("SOGo.Common").factory("User",a.factory),a.$filter=function(b,c,d){var e={search:b};if(!d||!d.dry){if(!b)return a.$users.splice(0,a.$users.length),a.$q.when(a.$users);if(a.$query==b)return a.$q.when(a.$users);a.$query=b}return a.$$resource.fetch(null,"usersSearch",e).then(function(b){var e,f,g,h,i=function(a){return this.uid==a.uid};for(d?d.dry?h=[]:d.results&&(h=d.results):h=a.$users,e=c?_.filter(b.users,function(a){return!_.find(c,_.bind(i,a))}):b.users,f=h.length-1;f>=0;f--)g=h[f],_.find(e,_.bind(i,g))||h.splice(f,1);return _.forEach(e,function(b,c){if(_.isUndefined(_.find(h,_.bind(i,b)))){var d=new a(b);h.splice(c,0,d)}}),a.$log.debug(h),h})},a.prototype.init=function(a){angular.extend(this,a),this.$$shortFormat||(this.$$shortFormat=this.$shortFormat()),this.$$image||(this.$$image=this.image),this.$avatarIcon=this.$isGroup()||this.$isSpecial()?"group":"person",this.empty=" "},a.prototype.$shortFormat=function(a){var b=this.cn||this.c_email,c=this.c_email,d=a&&a.email===!1;return!d&&c&&b!=c&&(b+=" <"+c+">"),b},a.prototype.$acl=function(b,c){var d=this,e=a.$q.defer(),f={uid:this.uid};if(this.$shadowRights)e.resolve(this.rights);else{var g;g=angular.isDefined(c)?a.$$resource.userResource(c).fetch(b,"userRights",f):a.$$resource.fetch(b,"userRights",f),g.then(function(a){return d.rights=a,d.$shadowRights=angular.copy(a),e.resolve(a),a})}return e.promise},a.prototype.$isGroup=function(){return this.isGroup||this.userClass&&"normal-group"==this.userClass},a.prototype.$isAnonymous=function(){return"anonymous"==this.uid},a.prototype.$isSpecial=function(){return this.userClass&&"public-user"==this.userClass},a.prototype.$confirmRights=function(a){var b=!1;return!this.$confirmation&&(_.some(_.values(this.rights))&&("anonymous"==this.uid?"AddressBook"==a.constructor.name?b=l('Potentially anyone on the Internet will be able to access your address book "%{0}", even if they do not have an account on this system. Is this information suitable for the public Internet?',a.name):"Calendar"==a.constructor.name&&(b=l('Potentially anyone on the Internet will be able to access your calendar "%{0}", even if they do not have an account on this system. Is this information suitable for the public Internet?',a.name)):"anyone"!=this.uid&&"<default>"!=this.uid||("AddressBook"==a.constructor.name?b=l('Any user with an account on this system will be able to access your address book "%{0}". Are you certain you trust them all?',a.name):"Calendar"==a.constructor.name?b=l('Any user with an account on this system will be able to access your calendar "%{0}". Are you certain you trust them all?',a.name):"Mailbox"==a.constructor.name&&(b=l('Any user with an account on this system will be able to access your mailbox "%{0}". Are you certain you trust them all?',a.name)))),
|
|
this.$confirmation=b,b)},a.prototype.$rightsAreDirty=function(){return this.rights&&!_.isEqual(this.rights,this.$shadowRights)},a.prototype.$resetRights=function(a){var b=this;a?_.map(_.keys(this.rights),function(a){angular.isString(b.rights[a])?b.rights[a]="None":b.rights[a]=0}):this.$shadowRights&&(this.rights=angular.copy(this.$shadowRights))},a.prototype.$folders=function(b){var c=this,d=a.$q.defer(),e={type:b};return this.$$folders?d.resolve(this.$$folders):a.$$resource.userResource(this.uid).fetch(null,"foldersSearch",e).then(function(a){c.$$folders=a.folders,d.resolve(a.folders)}),d.promise},a.prototype.$omit=function(){var a={};return angular.forEach(this,function(b,c){"constructor"!=c&&"$"!=c[0]&&(a[c]=b)}),a},a.prototype.toString=function(){return"[User "+this.c_email+"]"}}(),function(){"use strict";function a(){return{restrict:"AE",scope:{},bindToController:{size:"@",email:"=sgEmail",src:"=sgSrc"},transclude:!0,template:["<md-icon ng-transclude></md-icon>",'<img class="ng-hide" ng-src="{{vm.url}}" />'].join(""),link:b,controller:"sgAvatarImageController",controllerAs:"vm"}}function b(a,b,c,d){var e=b.find("img"),f=b.find("md-icon");c.size&&(e.attr("width",c.size),e.attr("height",c.size),f.css("font-size",c.size+"px")),d.img=e,d.genericImg=f}function c(a,b,c,d,e,f){function g(a){var b=f(a,k.size,e.defaults.SOGoAlternateAvatar);c({method:"GET",url:b,cache:!0,headers:{Accept:"image/*"}}).then(function(){k.url||(k.url=b,k.urlEmail=a,i())},function(){h()})}function h(){k.url=null,k.urlEmail=null,k.img.addClass("ng-hide"),k.genericImg.removeClass("ng-hide")}function i(){k.genericImg.addClass("ng-hide"),k.img.removeClass("ng-hide")}function j(){b.addClass("sg-avatar-image--zoomable"),l=function(){b.toggleClass("sg-avatar-image--zoom")},b.on("click",l)}var k,l;k=this,a.$on("$destroy",function(){l&&b.off("click",l)}),e.ready().then(function(){a.$watch(function(){return k.email},function(a,b){a&&k.urlEmail!=a?(h(),e.defaults.SOGoGravatarEnabled&&g(a)):a||h()})}),"sg-src"in b[0].attributes&&a.$watch(function(){return k.src},function(a){a&&(k.url=a,k.urlEmail=""+k.email,j(),i())})}c.$inject=["$scope","$element","$http","$q","Preferences","Gravatar"],angular.module("SOGo.Common").directive("sgAvatarImage",a).controller("sgAvatarImageController",c)}(),function(){"use strict";function a(a,b,c,d){function e(e,g){return e.on("click",function(a){this.hasAttribute("disabled")&&a.stopImmediatePropagation()}),function(e,g,h,i){function j(a,b,c,d,e){var f;if(angular.isDefined(d)){if(f=a(d),!f.constant)throw Error("Expected constant expression for `"+c+"`, but saw `"+d+"`.");return f(b)}return e}function k(a){g[0].hasAttribute("disabled")||e.$apply(function(){var b=i.$viewValue==m?n:m;i.$setViewValue(b,a&&a.type),i.$render()})}function l(){i.$viewValue==m?g.addClass(f):g.removeClass(f)}var m=j(a,e,"sgTrueValue",h.sgTrueValue,!0),n=j(a,e,"sgFalseValue",h.sgFalseValue,!1);i=i||d.fakeNgModel(),c(g),b.expectWithText(g,"aria-label"),g.on("click",k),i.$render=l}}var f="sg-checked";return{restrict:"E",replace:!0,transclude:!0,require:"?ngModel",template:['<button class="md-button sg-checkmark" type="button">'," <md-icon>check</md-icon>"," <span ng-transclude></span","</button>"].join(""),compile:e}}angular.module("SOGo.Common").directive("sgCheckmark",a),a.$inject=["$parse","$mdAria","$mdTheming","$mdUtil"]}(),function(){"use strict";function a(){function a(a,b,c,d){d.$render=function(){a.sgColor=d.$viewValue,a.sgIconColor=contrast(d.$viewValue)}}return{restrict:"E",require:"ngModel",template:["<md-menu>",' <md-button class="md-icon-button"',' label:aria-label="Options"'," ng-style=\"{ 'background-color': sgColor }\"",' ng-click="$mdOpenMenu()"',' md-menu-origin="md-menu-origin">',' <md-icon ng-style="{ color: sgIconColor }">color_lens</md-icon>'," </md-button>",' <md-menu-content width="3">',' <md-content class="md-padding">',' <md-grid-list class="sg-color-picker" md-cols="7" md-row-height="1:1" md-gutter="0.5em">',' <md-grid-tile ng-repeat="color in ::sgColors track by $index"'," ng-style=\"::{ 'background-color': color }\"",' ng-class="::{ selected: color == sgColor }"',' ng-click="setColor($event, color)"><md-icon ng-style="::{ color: color }">check_box</md-icon></md-grid-tile>'," </md-grid-list>"," </md-content>"," </md-menu-content>","</md-menu>"].join(""),replace:!0,controller:b,link:a}}function b(a,b,c){var d=b.controller("ngModel");a.sgColors=c.selection,a.setColor=function(b,c){b&&(_.forEach(b.currentTarget.parentElement.children,function(a){a.classList.remove("selected")}),b.currentTarget.classList.add("selected")),a.sgColor=c,a.sgIconColor=contrast(c),d.$setViewValue(c)}}b.$inject=["$scope","$element","sgColors"],angular.module("SOGo.Common").directive("sgColorPicker",a)}(),function(){"use strict";function a(a){function b(b,c,d){var e=b.$watch(function(a){return a.$eval(d.sgCompile)},function(d){c.html(d),a(c.contents())(b),e()})}return{restrict:"A",link:b}}a.$inject=["$compile"],angular.module("SOGo.Common").directive("sgCompile",a)}(),function(){"use strict";function a(){function a(a,b,c,d){function e(){return b.find("input").eq(0)}var f=a.$watch(e,function(a){a.length&&(f(),a.prop("disabled",!0),a.parent().addClass("sg-datepicker-readonly-input-container"))})}return{link:a,require:"mdDatepicker",restrict:"A"}}angular.module("SOGo.Common").directive("sgDatepickerReadonlyInput",a)}(),function(){"use strict";function a(a,b,c,d,e){function f(f,g,h){function i(a,b,d,e){if(this.$element=a,this.folder=b,this.dragStart=d,this.count=e,this.helper=c.find("sg-draggable-helper"),!this.helper)throw Error("sg-draggable requires a sg-draggable-helper element.");this.bindedOnDragDetect=angular.bind(this,this.onDragDetect),this.bindedOnDrag=angular.bind(this,this.onDrag),this.$element.on("mousedown",this.bindedOnDragDetect)}var j;d(function(){var b,c,d;b=a(h.sgDraggable)(f),c=h.sgDragStart?a(h.sgDragStart):null,d=h.sgDragCount?a(h.sgDragCount):null,j=new i(g,b,c,d)}),f.$on("$destroy",function(){j.$destroy()}),i.prototype={dragHasStarted:!1,$destroy:function(){this.$element.off("mousedown",this.bindedOnDragDetect)},getDistanceFromStart:function(a){var b={x:this.startPosition.clientX-a.clientX,y:this.startPosition.clientY-a.clientY};return Math.sqrt(b.x*b.x+b.y*b.y)},onDragDetect:function(a){a.stopPropagation(),this.dragStart&&!this.dragStart(f)||(c.on("mousemove",this.bindedOnDrag),c.one("mouseup",angular.bind(this,this.onDragEnd)))},onDrag:function(a){var c;this.startPosition?!this.dragHasStarted&&this.getDistanceFromStart(a)>10&&(c=this.helper.find("sg-draggable-helper-counter"),this.dragHasStarted=!0,this.helper.removeClass("ng-hide"),this.count&&this.count(f)>1?c.text(this.count(f)).removeClass("ng-hide"):c.addClass("ng-hide"),e.debug("emit folder:dragstart"),b.$emit("folder:dragstart",this.folder)):this.startPosition={clientX:a.clientX,clientY:a.clientY},this.dragHasStarted&&(a.shiftKey?this.helper.addClass("sg-draggable-helper--copy"):this.helper.removeClass("sg-draggable-helper--copy"),this.helper.css({top:a.pageY+5+"px",left:a.pageX+5+"px"}))},onDragEnd:function(a){this.startPosition=null,c.off("mousemove",this.bindedOnDrag),this.dragHasStarted&&(e.debug("emit folder:dragend"),b.$emit("folder:dragend",this.folder,a.shiftKey?"copy":"move"),this.dragHasStarted=!1,this.helper.addClass("ng-hide"))}}}return{restrict:"A",link:f}}a.$inject=["$parse","$rootScope","$document","$timeout","$log"],angular.module("SOGo.Common").directive("sgDraggable",a)}(),function(){"use strict";function a(a,b,c,d,e){function f(c,d,e){function f(a){l=!0,d.addClass("sg-droppable-over")}function g(a){l=!1,this.classList.remove("sg-droppable-over"),d.off("mousemove")}var h,i,j,k,l=!1;if(!e.sgDrop)throw Error("sg-droppable requires a sg-drop action.");l=!1,i=a(e.sgDroppable),h=a(e.sgDrop),j=b.$on("folder:dragstart",function(a,b){i(c,{dragFolder:b})&&(d.on("mouseenter",f),d.on("mouseleave",g))}),k=b.$on("folder:dragend",function(a,b,e){d.off("mouseenter"),d.off("mouseleave"),l&&(angular.bind(d[0],g)(a),h(c,{dragFolder:b,dragMode:e}))}),c.$on("destroy",function(){j(),k()})}return{restrict:"A",link:f}}a.$inject=["$parse","$rootScope","$document","$timeout","$log"],angular.module("SOGo.Common").directive("sgDroppable",a)}(),function(){"use strict";function a(){var a=13;return function(b,c,d){c.bind("keydown keypress",function(c){c.which===a&&(b.$apply(d.sgEnter),c.preventDefault())})}}angular.module("SOGo.Common").directive("sgEnter",a)}(),function(){"use strict";function a(){var a=27;return function(b,c,d){c.bind("keydown",function(c){c.keyCode===a&&b.$apply(d.sgEscape)})}}angular.module("SOGo.Common").directive("sgEscape",a)}(),function(){"use strict";function a(){return function(a,b,c){a.$on("sgFocusOn",function(a,d){d===c.sgFocusOn&&(b[0].focus(),b[0].select())})}}angular.module("SOGo.Common").directive("sgFocusOn",a)}(),function(){"use strict";function a(){function a(){var a=this;a.contrast=contrast,a.transparent=function(a,b){var c=hexToRgb(a);return["rgba("+c.r,c.g,c.b,b+")"].join(",")}}return{restrict:"E",require:"ngModel",scope:{ngModel:"="},replace:!0,bindToController:!0,controller:a,controllerAs:"cssCtrl",template:['<style type="text/css">'," .bg-folder{{ cssCtrl.ngModel.id }} {"," background-color: {{ cssCtrl.ngModel.color }} !important;"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .sg-event.bg-folder{{ cssCtrl.ngModel.id }} md-icon {"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," md-toolbar.bg-folder{{ cssCtrl.ngModel.id }} md-icon:not(.sg-icon-toolbar-bg) {"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .bg-folder{{ cssCtrl.ngModel.id }} label,"," .bg-folder{{ cssCtrl.ngModel.id }} .md-input {"," color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," opacity: 0.8;"," }"," .fg-folder{{ cssCtrl.ngModel.id }},"," .sg-event.fg-folder{{ cssCtrl.ngModel.id }} md-icon {"," color: {{ cssCtrl.ngModel.color }} !important;"," }"," .bdr-folder{{ cssCtrl.ngModel.id }} {"," border-color: {{ cssCtrl.ngModel.color }} !important;"," }"," .contrast-bdr-folder{{ cssCtrl.ngModel.id }} {"," border-color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .checkbox-folder{{ cssCtrl.ngModel.id }} .md-icon {"," background-color: {{ cssCtrl.ngModel.color }} !important;"," }"," .checkbox-folder{{ cssCtrl.ngModel.id }}.md-checked .md-icon:after {"," border-color: {{ cssCtrl.contrast(cssCtrl.ngModel.color) }} !important;"," }"," .md-switch-folder{{ cssCtrl.ngModel.id }}.md-checked .md-thumb {"," background-color: {{ cssCtrl.ngModel.color }} !important;"," }"," .md-switch-folder{{ cssCtrl.ngModel.id }}.md-checked .md-bar {",' background-color: {{ cssCtrl.transparent(cssCtrl.ngModel.color, "0.5") }} !important;'," }"," .md-switch-folder{{ cssCtrl.ngModel.id }} .md-bar {",' background-color: {{ cssCtrl.transparent(cssCtrl.ngModel.color, "0.3") }} !important;'," }","</style>"].join("")}}angular.module("SOGo.Common").directive("sgFolderStylesheet",a)}(),function(){"use strict";function a(){return{restrict:"A",scope:{placeholder:"=sgPlaceholder"},link:function(a,b,c){a.$watch("placeholder",function(){b[0].placeholder=a.placeholder})}}}angular.module("SOGo.Common").directive("sgPlaceholder",a)}(),function(){"use strict";function a(){function a(a,b,c,d){function e(){return b.find("input").eq(0)}var f=a.$watch(e,function(a){a.length&&(f(),d.$scope.$watch("ctrl.isDisabled",function(a){a&&d.ngModelCtrl.$invalid&&d.$scope.$emit("md-calendar-change",d.date)}))})}return{link:a,require:"mdDatepicker",restrict:"A"}}angular.module("SOGo.Common").directive("sgResetOnDisabled",a)}(),function(){"use strict";function a(a,b){function c(c,d){return function(c,d,e){function f(a){var c;d[0].hasAttribute("disabled")||(c=a.pageX&&a.pageY?{left:a.pageX,top:a.pageY}:a.target.getBoundingClientRect(),h.classList.contains("ng-hide")?(angular.element(i).css({overflow:"hidden",position:"relative"}),angular.element(h).css({top:i.scrollTop+"px"}),b(function(){g.css({top:c.top-i.offsetTop+i.scrollTop+"px",left:c.left-i.offsetLeft+"px",height:"400vmin",width:"400vmin"}),h.classList.remove("ng-hide")})):(g.css({top:c.top-i.offsetTop+i.scrollTop+"px",left:c.left-i.offsetLeft+"px",height:"0px",width:"0px"}),h.classList.add("ng-hide"),b(function(){angular.element(i).css({overflow:"",position:""})},800)))}var g,h,i,j;for(j=d.attr("sg-ripple-click"),i=d[0].parentNode;i&&i.id!=j;)i=i.parentNode;return i?(h=i.querySelector("sg-ripple-content"))?(g=i.querySelector("sg-ripple"),g?g=angular.element(g):(g=angular.element('<sg-ripple class="md-default-theme md-bg"></sg-ripple>'),i.appendChild(g[0]),h.classList.contains("ng-hide")||h.classList.add("ng-hide")),d.on("click",f),void c.$on("$destroy",function(){d.off("click",f)})):void a.error("sg-ripple-content not found inside #"+j):void a.error("No parent element found with id "+j)}}return{restrict:"A",compile:c}}angular.module("SOGo.Common").directive("sgRippleClick",a),a.$inject=["$log","$timeout"]}(),function(){"use strict";function a(a){function b(b,c){var d=(b.find("md-input-container"),b.find("input")),e=b.find("md-select"),f=b.find("md-button");return d.attr("ng-model","$sgSearchController.searchText"),d.attr("ng-model-options","$sgSearchController.searchTextOptions"),d.attr("ng-change","$sgSearchController.onChange()"),e&&(e.attr("ng-model","$sgSearchController.searchField"),e.attr("ng-change","$sgSearchController.onChange()")),f&&f.attr("sg-search-cancel")?(f.attr("ng-click",f.attr("sg-search-cancel")),f.removeAttr("sg-search-cancel")):f=null,function(b,c,e,g){var h=c.find("button");g.formName=c.attr("name"),g.inputName=d.attr("name"),g.allowDot=a(c.attr("sg-allow-dot"))(b),g.doSearch=a(c.attr("sg-search")),f&&h&&h.on("click",g.cancelSearch)}}return{restrict:"A",controller:"sgSearchController",controllerAs:"$sgSearchController",priority:1001,compile:b}}function b(){function a(a,b){return function(a,b,c,d,e){e(function(a){b.append(a)})}}return{restrict:"A",priority:1e3,transclude:!0,compile:a}}function c(a,b,c){var d=this;d.searchText=null,d.searchTextOptions={updateOn:"default blur",debounce:{default:300,blur:0}},d.onChange=function(){var a=b[d.formName],c=a[d.inputName],e=c.$viewValue;(d.allowDot&&"."==e||a.$valid&&e)&&("."==e&&c.$setValidity("minlength",!0),d.doSearch(b,{searchText:e,searchField:d.searchField}))},d.cancelSearch=function(){d.searchText=null}}a.$inject=["$parse"],c.$inject=["$window","$scope","$element"],angular.module("SOGo.Common").controller("sgSearchController",c).directive("sgSearch",a).directive("sgSearch",b)}(),function(){"use strict";function a(){function a(a,b,c,d){function e(){return b.find("input").eq(0)}var f=a.$watch(e,function(b){var c;b.length&&(f(),c=b.controller("ngModel"),b.on("blur",function(){d.scope.selectedItem||a.$applyAsync(c.$setValidity("required",!1))}))})}return{link:a,require:"mdAutocomplete",restrict:"A"}}angular.module("SOGo.Common").directive("sgSelectOnly",a)}(),function(){"use strict";function a(a){return{restrict:"A",scope:{folderType:"@sgSubscribe",onFolderSelect:"&sgSubscribeOnSelect"},replace:!1,bindToController:!0,controller:c,controllerAs:"$sgSubscribeDialogController",link:b}}function b(a,b,c,d){b.find("input");b.on("click",d.showDialog)}function c(a){var b=this;b.showDialog=function(){a.show({templateUrl:"../Contacts/UIxContactsUserFolders",clickOutsideToClose:!0,locals:{folderType:b.folderType,onFolderSelect:b.onFolderSelect},controller:d,controllerAs:"subscribe"})}}function d(a,b,c,d){var e=this;e.selectedUser=null,e.users=[],e.searchTextOptions={updateOn:"default blur",debounce:{default:300,blur:0}},e.onChange=function(a){d.$filter(e.searchText,null,{results:e.users}).then(function(b){a.$setValidity("matches",b.length>0),a.$setTouched(),e.selectedUser&&_.isUndefined(_.find(b,function(a){return a.uid==e.selectedUser.uid}))&&(e.selectedUser=null)})},e.selectUser=function(a){e.selectedUser==e.users[a]?e.selectedUser=null:e.users[a].$folders(b).then(function(){e.selectedUser=e.users[a]})},e.selectFolder=function(a){c({folderData:a})},e.close=function(){a.hide()}}a.$inject=["User"],c.$inject=["$mdDialog"],d.$inject=["$mdDialog","folderType","onFolderSelect","User"],angular.module("SOGo.Common").directive("sgSubscribe",a)}(),function(){"use strict";function a(){return{template:['<div class="sg-time-pane">',' <div class="hours-pane">',' <div ng-repeat="hoursBigLine in hours" layout="row" layout-xs="column">',' <div ng-repeat="hoursLine in hoursBigLine" layout="row" class="hours">',' <md-button class="hourBtn sg-time-selection-indicator" id="{{hour.id}}"'," md-no-ink",' ng-repeat="hour in hoursLine"',' ng-click="hourClickHandler(hour.displayName)">{{hour.displayName}}</md-button>'," </div>"," </div>"," </div>",' <div class="min5" ng-show="is5min()">',' <div layout="row" layout-xs="column">',' <div ng-repeat="minutesLine in min5" layout="row">',' <md-button class="minuteBtn sg-time-selection-indicator" id="{{minute.id}}"'," md-no-ink",' ng-repeat="minute in minutesLine"',' ng-click="minuteClickHandler(minute.displayName)">{{minute.displayName}}</md-button>'," </div>"," </div>"," </div>",' <div class="sg-time-scroll-mask" ng-hide="is5min()">',' <div class="min1" layout="row" layout-xs="column" layout-wrap>',' <div ng-repeat="minutesLine in min1" layout="row" layout-align="space-around center">',' <md-button class="minuteBtn sg-time-selection-indicator" id="{{minute.id}}"'," md-no-ink",' ng-repeat="minute in minutesLine"',' ng-click="minuteClickHandler(minute.displayName)">{{minute.displayName}}</md-button>'," </div>"," </div>"," </div>",' <div flex layout="row" layout-align="center center" md-colors="::{background: \'default-background-200\'}">',' <md-button class="toggleBtn md-fab md-mini" ng-bind="getToggleBtnLbl()" ng-click="toggleManual5min()"></md-button>'," </div>","</div>"].join(""),scope:{},require:["ngModel","sgTimePane","?^mdInputContainer"],controller:b,controllerAs:"ctrl",bindToController:!0,link:function(a,b,c,d){var e=d[0],f=d[1],g=d[2];if(g)throw Error("sg-timepicker should not be placed inside md-input-container.");f.configureNgModel(e,f)}}}function b(a,b,d,e,f,g,h,i,j){var k;g(a),this.$element=a,this.$scope=b,this.dateUtil=d,this.$mdUtil=e,this.keyCode=f.KEY_CODE,this.$$rAF=h,this.timePaneElement=a[0].querySelector(".sg-time-pane"),this.ngModelCtrl=null,this.SELECTED_TIME_CLASS="sg-time-selected",this.FOCUSED_TIME_CLASS="md-focus",this.id=c++,this.displayTime=null,this.selectedTime=null,this.isInitialized=!1,b.hours=[],b.hours[0]=[],b.hours[0][0]=[],b.hours[0][1]=[],b.hours[1]=[],b.hours[1][0]=[],b.hours[1][1]=[];for(var l=0;l<6;l++)b.hours[0][0][l]={id:"tp-"+this.id+"-hour-"+l,displayName:l<10?"0"+l:""+l,selected:!1},b.hours[0][1][l]={id:"tp-"+this.id+"-hour-"+(l+6),displayName:l+6<10?"0"+(l+6):""+(l+6),selected:!1},b.hours[1][0][l]={id:"tp-"+this.id+"-hour-"+(l+12),displayName:""+(l+12),selected:!1},b.hours[1][1][l]={id:"tp-"+this.id+"-hour-"+(l+18),displayName:""+(l+18),selected:!1};for(b.min5=[],b.min5[0]=[],b.min5[1]=[],l=0;l<6;l++)k=5*l,b.min5[0][l]={id:"tp-"+this.id+"-minute5-"+k,displayName:k<10?":0"+k:":"+k,selected:!0},b.min5[1][l]={id:"tp-"+this.id+"-minute5-"+(k+30),displayName:":"+(k+30),selected:!1};for(b.min1=[],l=0;l<12;l++){b.min1[l]=[];for(var m=0;m<5;m++)k=5*l+m,b.min1[l][m]={id:"tp-"+this.id+"-minute-"+k,displayName:k<10?":0"+k:":"+k,selected:!0}}b.show5min=!0,b.getToggleBtnLbl=function(){return b.is5min()?">>":"<<"},b.toggleManual5min=function(){b.manual5min=!b.is5min()},b.is5min=function(){return b.manual5min===!0||b.manual5min===!1?b.manual5min:b.show5min},i.tabindex||a.attr("tabindex","-1");var n=this;this.hourClickHandler=function(a){var b=new Date(n.displayTime);b.setHours(Number(a)),n.setNgModelValue(b,"hours")},b.hourClickHandler=this.hourClickHandler,this.minuteClickHandler=function(a){var b=a.substr(1),c=new Date(n.displayTime);c.setMinutes(Number(b)),n.setNgModelValue(c,"minutes")},b.minuteClickHandler=this.minuteClickHandler;var o=angular.bind(this,this.handleKeyEvent);angular.element(document.body).on("keydown",o),b.$on("$destroy",function(){angular.element(document.body).off("keydown",o)})}angular.module("SOGo.Common").directive("sgTimePane",a);var c=0;b.$inject=["$element","$scope","$$mdDateUtil","$mdUtil","$mdConstant","$mdTheming","$$rAF","$attrs","$mdDateLocale"],b.prototype.configureNgModel=function(a,b){var c=this;c.ngModelCtrl=a,c.$mdUtil.nextTick(function(){c.isInitialized=!0}),a.$render=function(){var a=this.$viewValue;c.$mdUtil.nextTick(function(){c.changeSelectedTime(a,b)})}},b.prototype.changeSelectedTime=function(a,b){var c=this.selectedTime;if(this.selectedTime=a,this.displayTime=new Date(a),c){var d=c.getHours(),e=document.getElementById("tp-"+b.id+"-hour-"+d);e&&(e.classList.remove(this.SELECTED_TIME_CLASS),e.setAttribute("aria-selected","false"));var f=c.getMinutes(),g=document.getElementById("tp-"+b.id+"-minute-"+f);g&&(g.classList.remove(this.SELECTED_TIME_CLASS),g.setAttribute("aria-selected","false"));var h=document.getElementById("tp-"+b.id+"-minute5-"+f);h&&(h.classList.remove(this.SELECTED_TIME_CLASS),h.setAttribute("aria-selected","false"))}if(a){var i,j=a.getHours(),k=document.getElementById("tp-"+b.id+"-hour-"+j);k&&(k.classList.add(this.SELECTED_TIME_CLASS),k.setAttribute("aria-selected","true"));var l=a.getMinutes();l%5===0?(b.$scope.show5min=!0,i=document.getElementById("tp-"+b.id+"-minute5-"+l),i&&(i.classList.add(this.SELECTED_TIME_CLASS),i.setAttribute("aria-selected","true"))):b.$scope.show5min=!1,i=document.getElementById("tp-"+b.id+"-minute-"+l),i&&(i.classList.add(this.SELECTED_TIME_CLASS),i.setAttribute("aria-selected","true"))}},b.prototype.setNgModelValue=function(a,b){return this.$scope.$emit("sg-time-pane-change",{date:a,changed:b}),this.ngModelCtrl.$setViewValue(a),this.ngModelCtrl.$render(),a},b.prototype.handleKeyEvent=function(a){var b=this;this.$scope.$apply(function(){return a.which==b.keyCode.ESCAPE||a.which==b.keyCode.TAB?(b.$scope.$emit("md-time-pane-close"),void(a.which==b.keyCode.TAB&&a.preventDefault())):a.which===b.keyCode.ENTER?(b.setNgModelValue(b.displayTime,"enter"),void a.preventDefault()):void 0})},b.prototype.focus=function(a,b){var c=a||this.selectedTime||this.today,d=this.timePaneElement.querySelector(".md-focus");if(d&&d.classList.remove(this.FOCUSED_TIME_CLASS),c){var e=c.getHours(),f=document.getElementById("tp-"+b.id+"-hour-"+e);f&&(f.classList.add(this.FOCUSED_TIME_CLASS),f.focus())}}}(),function(){"use strict";function a(a,c){return{template:function(a,b){var c=b.ariaLabel||b.mdPlaceholder;return['<md-button class="sg-timepicker-button md-icon-button" type="button" ',' tabindex="-1" aria-hidden="true" ',' ng-click="ctrl.openTimePane($event)">',' <md-icon class="sg-timepicker-icon">access_time</md-icon>',"</md-button>",'<div class="md-default-theme sg-timepicker-input-container" '," ng-class=\"{'sg-timepicker-focused': ctrl.isFocused}\">",' <input class="sg-timepicker-input" ',c?'aria-label="'+c+'" ':"",' aria-haspopup="true"',' aria-expanded="{{ctrl.isTimeOpen}}" ',' aria-owns="{{::ctrl.timePaneId}}"',' ng-focus="ctrl.setFocused(true)" ng-blur="ctrl.setFocused(false)">',' <md-button type="button" md-no-ink ',' class="sg-timepicker-triangle-button md-icon-button" ',' ng-click="ctrl.openTimePane($event)" ',' aria-label="{{::ctrl.dateLocale.msgOpenCalendar}}">',' <div class="sg-timepicker-expand-triangle"></div>'," </md-button>","</div>",'<div class="sg-timepicker-time-pane md-whiteframe-z1" id="{{::ctrl.timePaneId}}">',' <div class="sg-timepicker-input-mask">',' <div class="sg-timepicker-input-mask-opaque"></div>'," </div>",' <div class="sg-timepicker-time" md-colors="::{background: \'default-background-A100\'}">',' <sg-time-pane role="dialog" aria-label="{{::ctrl.dateLocale.msgCalendar}}" ',' ng-model="ctrl.time" ng-if="ctrl.isTimeOpen"></sg-time-pane>'," </div>","</div>"].join("")},require:["ngModel","sgTimepicker","?^form"],scope:{placeholder:"@mdPlaceholder"},controller:b,controllerAs:"ctrl",bindToController:!0,link:function(b,c,d,e){var f=e[0],g=e[1],h=e[2];a.parseAttributeBoolean(d.mdNoAsterisk);if(g.configureNgModel(f),h)var i=b.$watch(function(){return h.$submitted},function(a){a&&(g.updateErrorState(),i())})}}}function b(a,b,c,d,e,f,g,h,j,k,l){this.$window=d,this.dateLocale=h,this.dateUtil=j,this.$mdConstant=e,this.$mdUtil=g,this.$$rAF=k,this.$mdMedia=l,this.documentElement=angular.element(document.documentElement),this.ngModelCtrl=null,this.inputElement=b[0].querySelector("input"),this.ngInputElement=angular.element(this.inputElement),this.inputContainer=b[0].querySelector(".sg-timepicker-input-container"),this.timePane=b[0].querySelector(".sg-timepicker-time-pane"),this.timeButton=b[0].querySelector(".sg-timepicker-button"),this.inputMask=angular.element(b[0].querySelector(".sg-timepicker-input-mask-opaque")),this.$element=b,this.$attrs=c,this.$scope=a,this.date=null,this.isFocused=!1,this.isDisabled=!1,this.setDisabled(b[0].disabled||angular.isString(c.disabled)),this.isTimeOpen=!1,this.timePaneOpenedFrom=null,this.timePaneId="sg-time-pane"+g.nextUid(),this.bodyClickHandler=angular.bind(this,this.handleBodyClick),this.windowEventName=i.test(navigator.userAgent||navigator.vendor||window.opera)?"orientationchange":"resize",this.windowEventHandler=g.debounce(angular.bind(this,this.closeTimePane),100),this.windowBlurHandler=angular.bind(this,this.handleWindowBlur),this.leftMargin=20,this.topMargin=null,c.tabindex?(this.ngInputElement.attr("tabindex",c.tabindex),c.$set("tabindex",null)):c.$set("tabindex","-1"),f(b),f(angular.element(this.timePane)),this.installPropertyInterceptors(),this.attachChangeListeners(),this.attachInteractionListeners();var m=this;a.$on("$destroy",function(){m.detachTimePane()})}angular.module("SOGo.Common").directive("sgTimepicker",a),a.$inject=["$mdUtil","$mdAria"];var c=3,d="sg-timepicker-invalid",e="sg-timepicker-open",f=500,g={MIN5:{GTXS:192,XS:311},MIN1:{GTXS:384,XS:474}},h={GTXS:530,XS:294},i=/ipad|iphone|ipod|android/i;b.$inject=["$scope","$element","$attrs","$window","$mdConstant","$mdTheming","$mdUtil","$mdDateLocale","$$mdDateUtil","$$rAF","$mdMedia"],b.prototype.configureNgModel=function(a){this.ngModelCtrl=a;var b=this;b.ngModelCtrl.$formatters.push(function(a){if(a&&!(a instanceof Date))throw Error("The ng-model for sg-timepicker must be a Date instance. Currently the model is a: "+typeof a);return b.time=a,b.inputElement.value=b.dateLocale.formatTime(a),b.resizeInputElement(),b.updateErrorState(),a}),a.$viewChangeListeners.unshift(angular.bind(this,this.updateErrorState))},b.prototype.attachChangeListeners=function(){var a=this;a.$scope.$on("sg-time-pane-change",function(b,c){var e=new Date(c.date);a.ngModelCtrl.$setViewValue(e),a.time=e,a.inputElement.value=a.dateLocale.formatTime(e),"minutes"==c.changed&&a.closeTimePane(),a.resizeInputElement(),a.inputContainer.classList.remove(d)}),a.ngInputElement.on("input",angular.bind(a,a.resizeInputElement));var b=angular.isDefined(this.debounceInterval)?this.debounceInterval:f;a.ngInputElement.on("input",a.$mdUtil.debounce(a.handleInputEvent,b,a))},b.prototype.attachInteractionListeners=function(){var a=this,b=this.$scope,c=this.$mdConstant.KEY_CODE;a.ngInputElement.on("keydown",function(d){d.altKey&&d.keyCode==c.DOWN_ARROW&&(a.openTimePane(d),b.$digest())}),b.$on("md-time-close",function(){a.closeTimePane()})},b.prototype.installPropertyInterceptors=function(){var a=this;if(this.$attrs.ngDisabled){var b=this.$scope.$parent;b&&b.$watch(this.$attrs.ngDisabled,function(b){a.setDisabled(b)})}Object.defineProperty(this,"placeholder",{get:function(){return a.inputElement.placeholder},set:function(b){a.inputElement.placeholder=b||""}})},b.prototype.setDisabled=function(a){this.isDisabled=a,this.inputElement.disabled=a,this.timeButton&&(this.timeButton.disabled=a)},b.prototype.updateErrorState=function(a){var b=a||this.date;this.clearErrorState(),this.dateUtil.isValidDate(b)||this.ngModelCtrl.$setValidity("valid",null===b),this.ngModelCtrl.$valid||this.inputContainer.classList.add(d)},b.prototype.clearErrorState=function(){this.inputContainer.classList.remove(d),["valid"].forEach(function(a){this.ngModelCtrl.$setValidity(a,!0)},this)},b.prototype.resizeInputElement=function(){this.inputElement.size=this.inputElement.value.length+c},b.prototype.handleInputEvent=function(a){var b=this.inputElement.value,c=b?this.dateLocale.parseTime(b):null,d=""===b||this.dateUtil.isValidDate(c);if(d){var e=new Date(this.time);e.setHours(c.getHours()),e.setMinutes(c.getMinutes()),this.ngModelCtrl.$setViewValue(e),this.time=e}this.updateErrorState(c)},b.prototype.attachTimePane=function(){var a=this.timePane,b=document.body;a.style.transform="",this.$element.addClass(e),angular.element(b).addClass("md-datepicker-is-showing");var c=this.inputContainer.getBoundingClientRect(),d=b.getBoundingClientRect();(!this.topMargin||this.topMargin<0)&&(this.topMargin=(this.inputMask.parent().prop("clientHeight")-this.ngInputElement.prop("clientHeight"))/2);var f=c.top-d.top-this.topMargin,i=c.left-d.left-this.leftMargin,j=d.top<0&&0===b.scrollTop?-d.top:document.body.scrollTop,k=d.left<0&&0===b.scrollLeft?-d.left:document.body.scrollLeft,l=j+this.$window.innerHeight,m=k+this.$window.innerWidth;this.inputMask.css({position:"absolute",left:this.leftMargin+"px",top:this.topMargin+"px",width:c.width-1+"px",height:c.height-2+"px"});var n=this.$mdMedia("xs")?h.XS:h.GTXS;if(i+n>m){if(m-n>0)i=m-n;else{i=k;var o=this.$window.innerWidth/n;a.style.transform="scale("+o+")"}a.classList.add("sg-timepicker-pos-adjusted")}var p="object"==typeof this.time&&this.time.getMinutes()%5===0?"MIN5":"MIN1",q=this.$mdMedia("xs")?g[p].XS:g[p].GTXS;f+q>l&&l-q>j&&(f=l-q,a.classList.add("sg-timepicker-pos-adjusted")),a.style.left=i+"px",a.style.top=f+"px",document.body.appendChild(a),this.$$rAF(function(){a.classList.add("md-pane-open")})},b.prototype.detachTimePane=function(){this.$element.removeClass(e),angular.element(document.body).removeClass("md-datepicker-is-showing"),this.timePane.classList.remove("md-pane-open"),this.timePane.classList.remove("md-timepicker-pos-adjusted"),this.isTimeOpen&&this.$mdUtil.enableScrolling(),this.timePane.parentNode&&this.timePane.parentNode.removeChild(this.timePane)},b.prototype.openTimePane=function(a){if(!this.isTimeOpen&&!this.isDisabled){this.isTimeOpen=!0,this.timePaneOpenedFrom=a.target,this.$mdUtil.disableScrollAround(this.timePane),this.attachTimePane(),this.evalAttr("ngFocus");var b=this;this.$mdUtil.nextTick(function(){b.documentElement.on("click touchstart",b.bodyClickHandler)},!1),window.addEventListener(this.windowEventName,this.windowEventHandler)}},b.prototype.closeTimePane=function(){if(this.isTimeOpen){var a=this;a.detachTimePane(),a.ngModelCtrl.$setTouched(),a.evalAttr("ngBlur"),a.documentElement.off("click touchstart",a.bodyClickHandler),window.removeEventListener(a.windowEventName,a.windowEventHandler),a.timePaneOpenedFrom.focus(),a.timePaneOpenedFrom=null,a.isTimeOpen=!1}},b.prototype.getTimePaneCtrl=function(){return angular.element(this.timePane.querySelector("sg-time-pane")).controller("sgTimePane")},b.prototype.focusTime=function(){var a=this;this.$mdUtil.nextTick(function(){var b=a.getTimePaneCtrl();a.getTimePaneCtrl().focus(null,b)},!1)},b.prototype.setFocused=function(a){a||this.ngModelCtrl.$setTouched(),this.evalAttr(a?"ngFocus":"ngBlur"),this.isFocused=a},b.prototype.handleBodyClick=function(a){
|
|
if(this.isTimeOpen){var b=this.$mdUtil.getClosest(a.target,"sg-time-pane");b||this.closeTimePane(),this.$scope.$digest()}},b.prototype.handleWindowBlur=function(){this.inputFocusedOnWindowBlur=document.activeElement===this.inputElement},b.prototype.evalAttr=function(a){this.$attrs[a]&&this.$scope.$parent.$eval(this.$attrs[a])}}(),function(){"use strict";function a(a,b){function c(a,c){return function(d,e,f,g){function h(){var a=g.$viewValue;l=g.$viewValue,c.sgToggleGridAttr&&(m=c.sgToggleGridAttr,a=_.map(g.$viewValue,c.sgToggleGridAttr)),_.forEach(o,function(b){var c=angular.element(b);_.includes(a,c.attr("value"))&&c.addClass("sg-active")})}function i(a){var b=_.findIndex(l,function(b){return m?b[m]==a:b==a});if(b<0)if(m){var c={};c[m]=a,l.push(c)}else l.push(a);else l.splice(b,1);d.$apply(function(){g.$setViewValue(l),g.$setDirty()})}var j,k,l,m,n,o=a.find("md-grid-tile");for(g=g||b.fakeNgModel(),g.$render=h,n=function(){var a=angular.element(this),b=a.attr("value");a.toggleClass("sg-active"),i(b)},k=0;k<o.length;k++)j=angular.element(o[k]),j.addClass("sg-icon-button"),j.find("figure").addClass("md-icon"),j.on("click",n)}}return{restrict:"A",require:"?ngModel",compile:c}}a.$inject=["$parse","$mdUtil"],angular.module("SOGo.Common").directive("sgToggleGrid",a)}(),function(){"use strict";function a(a,b){function c(c,d,e,f){var g=[];f.onInputBlur=function(){var c;this.inputHasFocus=!1,c=function(){var a=this.getChipBuffer().trim();this.validateModel();var b=this.ngModelCtrl.$valid;this.userInputNgModelCtrl&&(b&=this.userInputNgModelCtrl.$valid),a&&b&&(this.appendChip(a),this.resetChipBuffer())}.bind(this),this.autocompleteCtrl?(g.push(c),a.addEventListener("click",function(a){for(;g.length>0;){var c=g.splice(0,1)[0];b(function(){b(c)})}},!1)):c()}}return{link:c,require:"mdChips",restrict:"A"}}a.$inject=["$window","$timeout"],angular.module("SOGo.Common").directive("sgTransformOnBlur",a)}(),function(){"use strict";function a(){function a(a,b,c,d){console.debug("scroll shrink height = "+b.prop("offsetHeight"))}return{restrict:"C",link:a}}angular.module("SOGo.Common").directive("sgVariableScrollShrink",a)}(),String.prototype.endsWith=function(a){return this.indexOf(a,this.length-a.length)!==-1},String.prototype.startsWith=function(a,b){return b=angular.isNumber(b)?b:0,this.lastIndexOf(a,b)===b},String.prototype._base64_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",String.prototype.base64encode=function(){for(var a,b,c,d,e,f,g,h="",i=0,j=this.utf8encode();i<j.length;)a=j.charCodeAt(i++),b=j.charCodeAt(i++),c=j.charCodeAt(i++),d=a>>2,e=(3&a)<<4|b>>4,f=(15&b)<<2|c>>6,g=63&c,isNaN(b)?f=g=64:isNaN(c)&&(g=64),h=h+this._base64_keyStr.charAt(d)+this._base64_keyStr.charAt(e)+this._base64_keyStr.charAt(f)+this._base64_keyStr.charAt(g);return h},String.prototype.base64decode=function(){for(var a,b,c,d,e,f,g,h="",i=0,j=""+this;i<j.length;)d=this._base64_keyStr.indexOf(j.charAt(i++)),e=this._base64_keyStr.indexOf(j.charAt(i++)),f=this._base64_keyStr.indexOf(j.charAt(i++)),g=this._base64_keyStr.indexOf(j.charAt(i++)),a=d<<2|e>>4,b=(15&e)<<4|f>>2,c=(3&f)<<6|g,h+=String.fromCharCode(a),64!=f&&(h+=String.fromCharCode(b)),64!=g&&(h+=String.fromCharCode(c));return h},String.prototype.md5=function(){if(this.length){var a=function(a){function b(a,b){return a<<b|a>>>32-b}function c(a,b){var c,d,e,f,g;return e=2147483648&a,f=2147483648&b,c=1073741824&a,d=1073741824&b,g=(1073741823&a)+(1073741823&b),c&d?2147483648^g^e^f:c|d?1073741824&g?3221225472^g^e^f:1073741824^g^e^f:g^e^f}function d(a,b,c){return a&b|~a&c}function e(a,b,c){return a&c|b&~c}function f(a,b,c){return a^b^c}function g(a,b,c){return b^(a|~c)}function h(a,e,f,g,h,i,j){return a=c(a,c(c(d(e,f,g),h),j)),c(b(a,i),e)}function i(a,d,f,g,h,i,j){return a=c(a,c(c(e(d,f,g),h),j)),c(b(a,i),d)}function j(a,d,e,g,h,i,j){return a=c(a,c(c(f(d,e,g),h),j)),c(b(a,i),d)}function k(a,d,e,f,h,i,j){return a=c(a,c(c(g(d,e,f),h),j)),c(b(a,i),d)}function l(a){for(var b,c=a.length,d=c+8,e=(d-d%64)/64,f=16*(e+1),g=Array(f-1),h=0,i=0;i<c;)b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|a.charCodeAt(i)<<h,i++;return b=(i-i%4)/4,h=i%4*8,g[b]=g[b]|128<<h,g[f-2]=c<<3,g[f-1]=c>>>29,g}function m(a){var b,c,d="",e="";for(c=0;c<=3;c++)b=a>>>8*c&255,e="0"+b.toString(16),d+=e.substr(e.length-2,2);return d}function n(a){a=a.replace(/rn/g,"n");for(var b="",c=0;c<a.length;c++){var d=a.charCodeAt(c);d<128?b+=String.fromCharCode(d):d>127&&d<2048?(b+=String.fromCharCode(d>>6|192),b+=String.fromCharCode(63&d|128)):(b+=String.fromCharCode(d>>12|224),b+=String.fromCharCode(d>>6&63|128),b+=String.fromCharCode(63&d|128))}return b}var o,p,q,r,s,t,u,v,w,x=Array(),y=7,z=12,A=17,B=22,C=5,D=9,E=14,F=20,G=4,H=11,I=16,J=23,K=6,L=10,M=15,N=21;for(a=n(a),x=l(a),t=1732584193,u=4023233417,v=2562383102,w=271733878,o=0;o<x.length;o+=16)p=t,q=u,r=v,s=w,t=h(t,u,v,w,x[o+0],y,3614090360),w=h(w,t,u,v,x[o+1],z,3905402710),v=h(v,w,t,u,x[o+2],A,606105819),u=h(u,v,w,t,x[o+3],B,3250441966),t=h(t,u,v,w,x[o+4],y,4118548399),w=h(w,t,u,v,x[o+5],z,1200080426),v=h(v,w,t,u,x[o+6],A,2821735955),u=h(u,v,w,t,x[o+7],B,4249261313),t=h(t,u,v,w,x[o+8],y,1770035416),w=h(w,t,u,v,x[o+9],z,2336552879),v=h(v,w,t,u,x[o+10],A,4294925233),u=h(u,v,w,t,x[o+11],B,2304563134),t=h(t,u,v,w,x[o+12],y,1804603682),w=h(w,t,u,v,x[o+13],z,4254626195),v=h(v,w,t,u,x[o+14],A,2792965006),u=h(u,v,w,t,x[o+15],B,1236535329),t=i(t,u,v,w,x[o+1],C,4129170786),w=i(w,t,u,v,x[o+6],D,3225465664),v=i(v,w,t,u,x[o+11],E,643717713),u=i(u,v,w,t,x[o+0],F,3921069994),t=i(t,u,v,w,x[o+5],C,3593408605),w=i(w,t,u,v,x[o+10],D,38016083),v=i(v,w,t,u,x[o+15],E,3634488961),u=i(u,v,w,t,x[o+4],F,3889429448),t=i(t,u,v,w,x[o+9],C,568446438),w=i(w,t,u,v,x[o+14],D,3275163606),v=i(v,w,t,u,x[o+3],E,4107603335),u=i(u,v,w,t,x[o+8],F,1163531501),t=i(t,u,v,w,x[o+13],C,2850285829),w=i(w,t,u,v,x[o+2],D,4243563512),v=i(v,w,t,u,x[o+7],E,1735328473),u=i(u,v,w,t,x[o+12],F,2368359562),t=j(t,u,v,w,x[o+5],G,4294588738),w=j(w,t,u,v,x[o+8],H,2272392833),v=j(v,w,t,u,x[o+11],I,1839030562),u=j(u,v,w,t,x[o+14],J,4259657740),t=j(t,u,v,w,x[o+1],G,2763975236),w=j(w,t,u,v,x[o+4],H,1272893353),v=j(v,w,t,u,x[o+7],I,4139469664),u=j(u,v,w,t,x[o+10],J,3200236656),t=j(t,u,v,w,x[o+13],G,681279174),w=j(w,t,u,v,x[o+0],H,3936430074),v=j(v,w,t,u,x[o+3],I,3572445317),u=j(u,v,w,t,x[o+6],J,76029189),t=j(t,u,v,w,x[o+9],G,3654602809),w=j(w,t,u,v,x[o+12],H,3873151461),v=j(v,w,t,u,x[o+15],I,530742520),u=j(u,v,w,t,x[o+2],J,3299628645),t=k(t,u,v,w,x[o+0],K,4096336452),w=k(w,t,u,v,x[o+7],L,1126891415),v=k(v,w,t,u,x[o+14],M,2878612391),u=k(u,v,w,t,x[o+5],N,4237533241),t=k(t,u,v,w,x[o+12],K,1700485571),w=k(w,t,u,v,x[o+3],L,2399980690),v=k(v,w,t,u,x[o+10],M,4293915773),u=k(u,v,w,t,x[o+1],N,2240044497),t=k(t,u,v,w,x[o+8],K,1873313359),w=k(w,t,u,v,x[o+15],L,4264355552),v=k(v,w,t,u,x[o+6],M,2734768916),u=k(u,v,w,t,x[o+13],N,1309151649),t=k(t,u,v,w,x[o+4],K,4149444226),w=k(w,t,u,v,x[o+11],L,3174756917),v=k(v,w,t,u,x[o+2],M,718787259),u=k(u,v,w,t,x[o+9],N,3951481745),t=c(t,p),u=c(u,q),v=c(v,r),w=c(w,s);var O=m(t)+m(u)+m(v)+m(w);return O.toLowerCase()};return a(this.toLowerCase())}},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.asDate=function(){var a,b=this.split("/");return 3==b.length?a=new Date(b[2],b[1]-1,b[0]):(b=this.split("-"),3==b.length?a=new Date(b[0],b[1]-1,b[2]):8==this.length&&(a=new Date(this.substring(0,4),this.substring(4,6)-1,this.substring(6,8)))),a},String.prototype.formatted=function(){for(var a=this,b=0;b<arguments.length;b++)a=a.replace("%{"+b+"}",arguments[b],"g");return a},String.prototype.isValidEmail=function(){var a=/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i;return a.test(this)},String.prototype.asCSSIdentifier=function(){for(var a=["_","\\.","#","@","\\*",":",","," ","'","&","\\+"],b=["_U_","_D_","_H_","_A_","_S_","_C_","_CO_","_SP_","_SQ_","_AM_","_P_"],c=this,d=0;d<a.length;d++){var e=new RegExp(a[d],"g");c=c.replace(e,b[d])}return/^\d+/.test(c)&&(c="_"+c),c},String.prototype.timeInterval=function(){var a;return a="once_per_hour"==this?3600:"every_minute"==this?60:60*parseInt(this.substr(6))},String.prototype.parseDate=function(a,b){var c,d,e,f,g,h,i,j,k,m;for(c=""+this,d=/%[dembByYHIMp]/g,g=new Date,h={year:g.getYear()+1900,month:g.getMonth(),day:g.getDate(),hour:0,minute:0},i={"%d":[/\d\d/,function(a){return h.day=parseInt(a),h.day<32}],"%e":[/ ?\d?\d/,function(a){return h.day=parseInt(a),h.day<32}],"%m":[/\d\d/,function(a){return h.month=parseInt(a)-1,h.month<12}],"%b":[/[^\d\s\.\/\-]{2,}/,function(b){var c=_.indexOf(_.map(a.shortMonths,_.toLower),_.toLower(b));return c>=0&&(h.month=c),c>=0}],"%B":[/[^\d\s\.\/\-]{2,}/,function(b){var c=_.indexOf(_.map(a.months,_.toLower),_.toLower(b));return c>=0&&(h.month=c),c>=0}],"%y":[/\d\d/,function(a){var b=parseInt(g.getFullYear().toString().substring(2))+5;return h.year=parseInt(a),h.year<b?h.year+=2e3:h.year+=1900,!0}],"%Y":[/[12]\d\d\d/,function(a){return h.year=parseInt(a),!0}],"%H":[/\d{1,2}/,function(a){return h.hour=parseInt(a),h.hour<24}],"%I":[/\d{1,2}/,function(a){return h.hour=parseInt(a),h.hour<=12}],"%M":[/[0-5]\d/,function(a){return h.minute=parseInt(a),h.minute<60}],"%p":[/[^\d\s\/\-]+/,function(a){var b=_.toLower(a),c=_.toLower(l("AM")),d=_.toLower(l("PM"));return b==d&&(h.hour+=12),b==c||b==d}]},e=b.match(d)||[],m=0,j=0;j<e.length;j++)f=e[j],k=(c.match(i[f][0])||[])[0],k&&(c=c.slice(c.indexOf(k)+k.length),i[f][1](k)&&m++);return e.length===m?new Date(h.year,h.month,h.day,h.hour,h.minute):new Date(NaN)},Date.prototype.daysUpTo=function(a){var b=[],c=this.getTime(),d=a.getTime();if(c>d){var e=c;c=d,d=e}for(var f=Math.round((d-c)/864e5)+1,g=0;g<f;g++){var h=new Date;h.setTime(c+864e5*g),b.push(h)}return b},Date.prototype.minutesTo=function(a){var b,c;return b=Math.floor(a.valueOf()-this.valueOf())/1e3/60,c=a.getTimezoneOffset()-this.getTimezoneOffset(),b-c},Date.prototype.stringWithSeparator=function(a){var b=""+(this.getMonth()+1),c=""+this.getDate(),d=this.getYear();return d<1e3&&(d=""+(d+1900)),1==b.length&&(b="0"+b),1==c.length&&(c="0"+c),"-"==a?str=d+"-"+b+"-"+c:str=c+"/"+b+"/"+d,str},Date.prototype.addDays=function(a){var b,c,d;return c=this.getTime(),b=new Date(c),c+=864e5*a,this.setTime(c),d=this.getTimezoneOffset()-b.getTimezoneOffset(),0!==d&&(c=this.getTime()+60*d*1e3,this.setTime(c)),this},Date.prototype.addHours=function(a){var b=this.getTime();b+=36e5*a,this.setTime(b)},Date.prototype.addMinutes=function(a){var b=this.getTime();b+=6e4*a,this.setTime(b)},Date.prototype.beginOfDay=function(){var a=new Date(this.getTime());return a.setHours(0),a.setMinutes(0),a.setSeconds(0),a.setMilliseconds(0),a},Date.prototype.firstWeekOfYearForDate=function(a){var b,c,d,e;return b=a.firstWeekOfYear,d=new Date(this.getTime()),d.setMonth(0),d.setDate(1),c=d.getDay(),e="First4DayWeek"==b?(c+a.firstDayOfWeek)%7<4?d.beginOfWeek(a.firstDayOfWeek):d.addDays(7).beginOfWeek(a.firstDayOfWeek):"FirstFullWeek"==b?0===c?d.beginOfWeek(a.firstDayOfWeek):d.addDays(7).beginOfWeek(a.firstDayOfWeek):d.beginOfWeek(a.firstDayOfWeek)},Date.prototype.getWeek=function(a){var b,c,d,e;return e=new Date(this.getTime()),e.addDays(6),b=e.firstWeekOfYearForDate(a),b.getTime()<e.getTime()?d=1+Math.floor((e.getTime()-b.getTime())/6048e5):(c=new Date(e.getTime()),c.addDays(-7),b=c.firstWeekOfYearForDate(a),d=2+Math.floor((c.getTime()-b.getTime())/6048e5)),d},Date.prototype.beginOfWeek=function(a){var b=a-this.getDay();b>0&&(b-=7);var c=this.beginOfDay();return c.setHours(12),c.addDays(b),c},Date.prototype.endOfWeek=function(a){var b=this.beginOfWeek(a);return b.addDays(6),b.setHours(23),b.setMinutes(59),b.setSeconds(59),b.setMilliseconds(999),b},Date.prototype.getDayString=function(){var a=this.getYear();a<1e3&&(a+=1900);var b=""+(this.getMonth()+1);1==b.length&&(b="0"+b),a+=b;var c=""+this.getDate();return 1==c.length&&(c="0"+c),a+=c},Date.prototype.getHourString=function(){var a=this.getHours()+"00";return 3==a.length&&(a="0"+a),a},Date.prototype.format=function(a,b){var c,d,e,f,g=[],h=/%[deaAmbByYUHIMp]/g,i={"%d":this.getDate(),"%e":this.getDate(),"%a":a.shortDays[this.getDay()],"%A":a.days[this.getDay()],"%m":this.getMonth()+1,"%b":a.shortMonths[this.getMonth()],"%B":a.months[this.getMonth()],"%y":this.getFullYear().toString().substring(2),"%Y":this.getFullYear(),"%U":this.getWeek(a),"%H":this.getHours(),"%M":this.getMinutes()};for(i["%I"]=i["%H"]>12?i["%H"]%12:i["%H"],i["%p"]=l(i["%H"]<12?"AM":"PM"),i["%d"]=(i["%d"]<10?"0":"")+i["%d"],i["%e"]=(i["%e"]<10?" ":"")+i["%e"],i["%m"]=(i["%m"]<10?"0":"")+i["%m"],i["%H"]=(i["%H"]<10?"0":"")+i["%H"],i["%I"]=(i["%I"]<10?"0":"")+i["%I"],i["%M"]=(i["%M"]<10?"0":"")+i["%M"],c=b.replace(h,"\0").split("\0"),d=b.match(h),e=0,f=d.length;e<=f;e++)c.length&&g.push(c.shift()),g.push(i[d[e]]);return g.join("")};
|
|
//# sourceMappingURL=Common.js.map
|