2 lines
84 KiB
JavaScript
2 lines
84 KiB
JavaScript
function l(){var n,e,t=arguments[0],i=t,r=arguments;for(labels[t]?i=labels[t]:clabels[t]&&(i=clabels[t]),n=1,e=0;n<r.length;n++,e++)i=i.replace("%{"+e+"}",r[n]);return(n=1)<r.length&&(i=i.replace(/%((%)|s|d)/g,function(e){var t=null;if(e[2])t=e[2];else{switch(t=r[n],e){case"%d":t=parseFloat(t),isNaN(t)&&(t=0)}n++}return t})),i}function hexToRgb(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?{r:parseInt(t[1],16),g:parseInt(t[2],16),b:parseInt(t[3],16)}:null}function contrast(e){var t,n,i=1;if(t=hexToRgb(e)){n=[t.r/255,t.g/255,t.b/255];for(var r=0;r<n.length;++r)n[r]<=.03928?n[r]=n[r]/12.92:n[r]=Math.pow((n[r]+.055)/1.055,2.4);i=.2126*n[0]+.7152*n[1]+.0722*n[2]}return.179<i?"black":"white"}function guid(){function e(){return(65536*(1+Math.random())|0).toString(16).substring(1)}return(e()+e()+"-"+e()+"-4"+e().substr(0,3)+"-"+e()+"-"+e()+e()+e()).toLowerCase()}!function(){"use strict";function e(e,t,n,i,r,o,s){e.classNameFilter(/^(?:(?!ng-animate-disabled).)*$/),r.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"]}),r.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"]}),r.definePalette("sogo-paper",{50:"fcf7f8",100:"f7f1dc",200:"ede5ca",300:"e6d8ba",400:"e2d2a3",500:"d6c48d",600:"baa870",700:"857545",800:"524517",900:"433809",1e3:"000000",A100:"ffffff",A200:"eeeeee",A400:"bdbdbd",A700:"616161",contrastDefaultColor:"dark",contrastLightColors:["800","900"]});var a=r.extendPalette("grey",{1e3:"baa870"});r.definePalette("sogo-grey",a),r.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"}).backgroundPalette("sogo-grey"),r.registerStyles([".md-autocomplete-suggestions.md-3-line li p {"," color: '{{foreground-2}}';","}"].join("")),r.registerStyles([".sg-time-selection-indicator.sg-time-selected,",".sg-time-selection-indicator:hover.sg-time-selected,",".sg-time-selection-indicator.md-focus.sg-time-selected {"," background: '{{primary-500}}';","}",".sg-timepicker-open .sg-timepicker-icon {"," color: '{{primary-900}}';","}",".sg-timepicker-time,",".sg-timepicker-open .sg-timepicker-input-container {"," background: '{{background-hue-1}}';","}",".sg-timepicker-input-mask-opaque {"," box-shadow: 0 0 0 9999px '{{background-hue-1}}';","}"].join("")),r.registerStyles(["[ui-view=calendars] .hours {"," color: '{{primary-700}}';","}",".attendees .busy {"," background-color: '{{background-1000}}';","}",".attendees .event {"," background-color: '{{primary-300}}';","}"].join("")),r.registerStyles([".sg-message-thread {"," background-color: '{{primary-100}}';","}",".sg-message-thread-first {"," background-color: '{{primary-200}}';","}"].join("")),window.DebugEnabled||(t.debugEnabled(!1),n.debugInfoEnabled(!1),o.disableWarnings(),s.errorOnUnhandledRejections(!1),r.generateThemesOnDemand(!0)),i.interceptors.push("AuthInterceptor"),i.interceptors.push("ErrorInterceptor")}function a(t,e,n,i,r){var o,s;return o=e.defer(),(s=angular.element('<iframe class="ng-hide" src="'+t.UserFolderURL+'recover"></iframe>')).on("load",function(){var e=i.get("$state");r.config.attempt?(angular.element(t).off("beforeunload"),t.location.href=t.ApplicationBaseURL+e.href(e.current),o.reject()):n(function(){var e=i.get("$http");r.config.attempt=1,e(r.config).then(function(e){o.resolve(e)}),n(s.remove,500)},100)}),document.body.appendChild(s[0]),o.promise}function t(n,i,r,o){return{response:function(e){var t;return e&&/^application\/json/.test(e.config.headers.Accept)&&/^[\n\r\t ]*<!DOCTYPE html/.test(e.data)?n.usesCASAuthentication||n.usesSAML2Authentication?a(n,i,r,o,e):(t=o.get("$state"),angular.element(n).off("beforeunload"),n.location.href=n.ApplicationBaseURL+t.href(t.current),i.reject()):e}}}function n(n,i,r,o,s){return{responseError:function(e){var t;if(/^application\/json/.test(e.config.headers.Accept)){if((i.usesCASAuthentication||i.usesSAML2Authentication)&&-1==e.status)return a(i,r,o,s,e);i.usesSAML2Authentication&&401==e.status&&!i.recovered?(t=s.get("$state"),angular.element(i).off("beforeunload"),i.recovered=!0,i.location.href=i.ApplicationBaseURL+t.href(t.current)):e.data.quiet||n.$broadcast("http:Error",e)}return r.reject(e)}}}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(e){var t={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 e?t[e]:t},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(e).factory("AuthInterceptor",t).factory("ErrorInterceptor",n),e.$inject=["$animateProvider","$logProvider","$compileProvider","$httpProvider","$mdThemingProvider","$mdAriaProvider","$qProvider"],t.$inject=["$window","$q","$timeout","$injector"],n.$inject=["$rootScope","$window","$q","$timeout","$injector"]}(),function(){"use strict";var v;function e(e){v=e}function t(e,t,n){function i(e){return e.join("")}for(var r=e(i([".md-{{theme}}-theme",".md-fg"])+" { color:{{value}};}"),o=e(i([".md-{{theme}}-theme",".md-bg"])+" { background-color:{{value}};}"),s=e(i([".md-{{theme}}-theme",".md-bdr"])+" { border-color:{{value}};}"),a=e(i([".md-{{theme}}-theme",".md-{{hue}}",".md-fg"])+" { color:{{value}};}"),l=e(i([".md-{{theme}}-theme",".md-{{hue}}",".md-bg"])+" { background-color:{{value}};}"),c=e(i([".md-{{theme}}-theme",".md-{{palette}}",".md-fg"])+" { color:{{value}};}"),u=e(i([".md-{{theme}}-theme",".md-{{palette}}",".md-bg"])+" { background-color:{{value}}; color:{{contrast}} !important; }"),d=e(i([".md-{{theme}}-theme",".md-{{palette}}",".md-bdr"])+" { border-color:{{value}};}"),h=e(i([".md-{{theme}}-theme",".md-{{palette}}.md-{{hue}}",".md-fg"])+" { color:{{value}};}"),m=e(i([".md-{{theme}}-theme",".md-{{palette}}.md-{{hue}}",".md-bg"])+" { background-color:{{value}};}"),g=function(){var e=t[0].head.querySelector('style[title="Dynamic-Generated-by-mdColors"]');null===e&&((e=t[0].createElement("style")).title="Dynamic-Generated-by-mdColors",e.appendChild(t[0].createTextNode("")),t[0].head.appendChild(e));return e.sheet}(),p=0;0<g.cssRules.length;)g.deleteRule(0);function f(e,t,n,i,r,o){if(r){var s={theme:n,palette:i,value:"rgb("+r.value[0]+","+r.value[1]+","+r.value[2]+")",contrast:"rgb("+r.contrast[0]+","+r.contrast[1]+","+r.contrast[2]+")",hue:o};g.insertRule(e(s),p),p+=1,g.insertRule(t(s),p),p+=1}}function y(e,t,n,i,r){if(i){var o="rgb("+i.value[0]+","+i.value[1]+","+i.value[2]+")";g.insertRule(e({theme:t,palette:n,value:o,hue:r}),p),p+=1}}angular.forEach(v._THEMES,function(e,n){f(r,o,n,"primary",v._PALETTES[e.colors.primary.name][e.colors.primary.hues.default]),f(a,l,n,"primary",v._PALETTES[e.colors.primary.name][e.colors.primary.hues["hue-2"]],"hue-2"),f(a,l,n,"primary",v._PALETTES[e.colors.primary.name][e.colors.primary.hues["hue-3"]],"hue-3"),f(a,l,n,"primary",v._PALETTES[e.colors.primary.name][e.colors.primary.hues["hue-1"]],"hue-1"),y(s,n,"primary",v._PALETTES[e.colors.primary.name][e.colors.primary.hues.default]),angular.forEach(e.colors,function(e,t){f(c,u,n,t,v._PALETTES[e.name][e.hues.default]),y(d,n,t,v._PALETTES[e.name][e.hues.default]),f(h,m,n,t,v._PALETTES[e.name][e.hues["hue-2"]],"hue-2"),f(h,m,n,t,v._PALETTES[e.name][e.hues["hue-3"]],"hue-3"),f(h,m,n,t,v._PALETTES[e.name][e.hues["hue-1"]],"hue-1")})})}angular.module("mdColors",["ngMaterial"]).config(e).run(t),e.$inject=["$mdThemingProvider"],t.$inject=["$interpolate","$document","$log"]}(),function(){"use strict";function e(e){return e.decodeURIComponent}e.$inject=["$window"],angular.module("SOGo.Common").filter("decodeUri",e)}(),function(){"use strict";function e(e){return e.encodeURIComponent}e.$inject=["$window"],angular.module("SOGo.Common").filter("encodeUri",e)}(),function(){"use strict";function e(n){return function(e){var t=angular.element("<div>"+e+"</div>");return t.find("a").attr("target","_blank"),n.trustAs("html",t.html())}}e.$inject=["$sce"],angular.module("SOGo.Common").filter("ensureTarget",e)}(),function(){"use strict";angular.module("SOGo.Common").filter("loc",function(){return l})}(),function(){"use strict";angular.module("SOGo.Common").filter("range",function(){return function(e){for(var t=[],n=0;n<parseInt(e);n++)t.push(n);return t}})}(),function(){"use strict";function e(t){return function(e){return e?String(t(e," _blank",{rel:"noopener"})).replace(/ /gm,"<br>"):void 0}}e.$inject=["linkyFilter"],angular.module("SOGo.Common").filter("txt2html",e)}(),function(){"use strict";function e(t,n,e,i,r,o,s){var a=this;function c(e,t){if(t&&t.target.parentNode.classList.contains("md-secondary"))return!1;a.selectedUid==e.uid?a.selectedUid=null:(a.selectedUid=e.uid,(a.selectedUser=e).inactive||a.selectedUser.$rights())}a.users=r,a.folder=s,a.selectedUser=null,a.selectedUid=null,a.userToAdd="",a.searchText="",a.folderClassName=function(){return!!angular.isFunction(s.getClassName)&&s.getClassName("bg")},a.templateName=function(e){return"UIx"+(t[0].getElementById("UIxAnonymousUserRightsEditor")&&e.$isAnonymous()?"Anonymous":"")+"UserRightsEditor"},a.userFilter=function(e){return o.$filter(e,s.$acl.users)},a.closeModal=function(){s.$acl.$resetUsersRights(),e.hide()},a.saveModal=function(){s.$acl.$saveUsersRights().then(function(){e.hide()},function(e,t){i.alert(l("Warning"),l("An error occured, please try again."))})},a.confirmChange=function(e){var t=e.$confirmRights(a.folder);t&&(a.confirmation.showing=!0,a.confirmation.message=t)},a.removeUser=function(e){n(function(){s.$acl.$removeUser(e.uid)},500)},a.addUser=function(e){e&&s.$acl.$addUser(e).then(function(e){a.userToAdd="",a.searchText="",a.selectedUid=null,e&&c(e)})},a.selectAllRights=function(e){s.$acl.$selectAllRights(e)},a.selectUser=c,a.hasNoRight=function(e){return s.$acl.$hasNoRight(e)},a.showRights=function(e){return a.selectedUid==e.uid&&!e.inactive},a.confirmation={showing:!1,message:""}}e.$inject=["$document","$timeout","$mdDialog","Dialog","usersWithACL","User","folder"],angular.module("SOGo.Common").controller("AclController",e)}(),function(){"use strict";function e(e,t,n,i,r,o,s,a,c,u,d,h,m,g){var p=new m(h.baseURL(),h.activeUser());function f(e,t){var n;t.data&&t.data.message&&angular.isString(t.data.message)?n=t.data.message:t.status&&(n=t.statusText),n?a.show({template:["<md-toast>",' <div class="md-toast-content">',' <md-icon class="md-warn md-hue-1">error_outline</md-icon>'," <span flex>"+l(n)+"</span>"," </div>","</md-toast>"].join(""),hideDelay:5e3,position:"top right"}):u.debug("untrap error")}this.$onInit=function(){t.isPopup=h.isPopup,t.activeUser=h.activeUser(),t.baseURL=h.baseURL(),t.leftIsClose=!c(d["gt-md"]),t.centerIsClose=!!o.centerIsClose&&!t.leftIsClose,t.currentDay=window.currentDay,n(function(){i(function(){r.get("../date").then(function(e){t.currentDay=e})},864e5)},1e3*window.currentDay.secondsBeforeTomorrow),t.$watch(function(){return c(d["gt-xs"])},function(e){t.isGtExtraSmall=e}),t.$watch(function(){return c(d["gt-md"])},function(e){(t.isGtMedium=e)&&(t.leftIsClose=!1)}),e.$on("http:Error",f),h.activeUser("path").calendar&&g.getAlarms()},t.toggleLeft=function(){t.isGtMedium?t.leftIsClose=!t.leftIsClose:(t.leftIsClose=!s("left").isOpen(),t.leftIsClose&&angular.element(o).triggerHandler("resize"),s("left").toggle().then(function(){u.debug("toggle left is done")}))},t.toggleRight=function(){s("right").toggle().then(function(){u.debug("toggle right is done")})},t.toggleCenter=function(e){t.centerIsClose=!t.centerIsClose,e&&e.save&&p.post(null,"saveListState",{state:t.centerIsClose?"collapse":"rise"})}}e.$inject=["$rootScope","$scope","$timeout","$interval","$http","$window","$mdSidenav","$mdToast","$mdMedia","$log","sgConstant","sgSettings","Resource","Alarm"],angular.module("SOGo.Common").controller("navController",e)}(),function(){"use strict";function s(e){this.folderId=e}s.factory=["$q","$timeout","sgSettings","Resource","User",function(e,t,n,i,r){return angular.extend(s,{$q:e,$timeout:t,$$resource:new i(n.activeUser("folderURL"),n.activeUser()),$User:r}),s}],angular.module("SOGo.Common").factory("Acl",s.factory),s.prototype.$users=function(t){var n,i=this,r=s.$q.defer();return this.users?(r.resolve(this.users),r.promise):(angular.isDefined(t)?s.$$resource.userResource(t).fetch(this.folderId,"acls"):s.$$resource.fetch(this.folderId,"acls")).then(function(e){return i.users=[],angular.forEach(e.users,function(e){(n=new s.$User(e)).canSubscribeUser=n.isSubscribed,n.wasSubscribed=n.isSubscribed,n.$rights=angular.bind(n,n.$acl,i.folderId,t),i.users.push(n)}),r.resolve(i.users),i.users})},s.prototype.$addUser=function(e,t){var n=this,i=s.$q.defer(),r={uid:e.uid};!e.uid||-1<_.indexOf(_.map(this.users,"uid"),e.uid)?i.resolve():(angular.isDefined(t)?s.$$resource.userResource(t).fetch(this.folderId,"addUserInAcls",r):s.$$resource.fetch(this.folderId,"addUserInAcls",r)).then(function(){e.wasSubscribed=!1,e.userClass=e.isGroup?"normal-group":"normal-user",e.$rights=angular.bind(e,e.$acl,n.folderId,t),n.users.push(e),i.resolve(e)},function(e,t){i.reject(l("An error occured, please try again."))});return i.promise},s.prototype.$removeUser=function(t,e){var n=this,i={uid:t};return(angular.isDefined(e)?s.$$resource.userResource(e).fetch(this.folderId,"removeUserFromAcls",i):s.$$resource.fetch(this.folderId,"removeUserFromAcls",i)).then(function(){var e=_.indexOf(_.map(n.users,"uid"),t);0<=e&&(n.users[e].$shadowRights=null,n.users.splice(e,1))})},s.prototype.$selectAllRights=function(n){_.forEach(n.rights,function(e,t){angular.isNumber(n.rights[t])?n.rights[t]=1:n.rights[t]="Modifier"})},s.prototype.$hasNoRight=function(e){var t=_.find(e.rights,function(e,t){return angular.isNumber(e)?1===e:"None"!==e});return _.isUndefined(t)},s.prototype.$resetUsersRights=function(){angular.forEach(this.users,function(e){e.$resetRights()})},s.prototype.$saveUsersRights=function(e){var t=this,n=s.$q.defer(),i=s.$q.defer(),r={action:"saveUserRights"},o=[];(angular.forEach(this.users,function(e){e.$rightsAreDirty()&&o.push(e.$omit())}),o.length)?(angular.isDefined(e)?s.$$resource.userResource(e).save(this.folderId,o,r):s.$$resource.save(this.folderId,o,r)).then(function(){angular.forEach(t.users,function(e){e.$rightsAreDirty()&&(e.$shadowRights=angular.copy(e.rights))}),n.resolve()},n.reject):n.resolve();return o=[],angular.forEach(this.users,function(e){!e.wasSubscribed&&e.isSubscribed&&o.push(e.uid)}),o.length?(r={uids:o.join(",")},s.$$resource.fetch(this.folderId,"subscribeUsers",r).then(function(){angular.forEach(t.users,function(e){e.wasSubscribed=e.isSubscribed}),i.resolve()},i.reject)):i.resolve(),s.$q.all([n.promise,i.promise])}}(),function(){"use strict";function u(){this.currentAlarm=null}function e(e,t,n,i){return angular.extend(u,{$timeout:e,$$resource:new n(t.activeUser("folderURL")+"Calendar",t.activeUser()),$toast:i}),u}u.getAlarms=function(){var c=this,e=new Date,t=Math.floor(e.getTime()/1e3);this.$$resource.fetch("","alarmslist?browserTime="+t).then(function(e){var t=e.alarms.sort(function(e,t){var n=parseInt(e[2]);return parseInt(t[2])-n});if(0<t.length){var n=t.pop(),i=new Date,r=Math.floor(i.getTime()/1e3),o=n[0]+"/"+n[1],s=parseInt(n[2]),a=s;0<s&&(a-=r);new Date(1e3*s);var l=angular.bind(c,u.showAlarm,o);c.currentAlarm&&c.$timeout.cancel(c.currentAlarm),c.currentAlarm=c.$timeout(l,1e3*a)}})},u.showAlarm=function(t){var r=this;this.$$resource.fetch(t,"?resetAlarm=yes").then(function(i){function e(e,t,n){e.summary=i.summary,e.reminder="10",e.close=function(){t.hide()},e.snooze=function(){r.$$resource.fetch(n,"view?snoozeAlarm="+e.reminder),t.hide()}}r.$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="snooze()">',l("Snooze")," </md-button>",' <md-button ng-click="close()">',l("Close")," </md-button>"," </div>"," </div>"," </div>","</md-toast>"].join(""),locals:{url:t},controller:e}),e.$inject=["scope","$mdToast","url"]})},e.$inject=["$timeout","sgSettings","Resource","$mdToast"],angular.module("SOGo.Common").factory("Alarm",e)}(),function(){"use strict";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",function(){function h(e,t){var n,i,r,o,s;return n=e,t&&(n+="@"+t.value),i=""+window.location.href,"/"==(r=ApplicationBaseURL+encodeURIComponent(n))[0]&&(s=(o=i.split("/"))[2],r=o[0]+"//"+s+r),i.startsWith(r)&&!i.endsWith("/logoff")?i:r}function e(c,u,o,d){return{login:function(e){var t,r=c.defer(),n=e.username,i=e.password,o=e.verificationCode,s=e.domain,a=e.rememberLogin?1:0;return e.loginSuffix&&!n.endsWith(e.loginSuffix)&&(n+=loginSuffix,s=!1),e.language&&"WONoSelectionString"!=e.language&&(t=e.language),u({method:"POST",url:"/SOGo/connect",data:{userName:n,password:i,verificationCode:o,domain:s,language:t,rememberLogin:a}}).then(function(e){var t=e.data;navigator&&!navigator.cookieEnabled?r.reject({error:l("cookiesNotEnabled")}):void 0!==t.GoogleAuthenticatorMissingKey&&202==e.status?r.resolve({gamissingkey:1}):void 0!==t.expire&&void 0!==t.grace?t.expire<0&&0<t.grace?r.reject({grace:t.grace}):0<t.expire&&-1==t.grace?r.reject({expire:t.expire}):r.resolve({cn:t.cn,url:h(n,s)}):r.resolve({url:h(n,s)})},function(e){var t,n,i=e.data;t=i&&i.GoogleAuthenticatorInvalidKey?l("You provided an invalid Google Authenticator key."):i&&i.LDAPPasswordPolicyError?(n=i.LDAPPasswordPolicyError)==d.PolicyNoError?l("Wrong username or password."):n==d.PolicyAccountLocked?l("Your account was locked due to too many failed attempts."):l("Login failed due to unhandled error case: ")+n:l("Unhandled error response"),r.reject({error:t})}),r.promise},changePassword:function(e){var i=c.defer(),r=o.get("XSRF-TOKEN");return o.remove("XSRF-TOKEN",{path:"/SOGo/"}),u({method:"POST",url:"/SOGo/so/changePassword",headers:{"X-XSRF-TOKEN":r},data:{newPassword:e}}).then(i.resolve,function(e){var t,n=e.data.LDAPPasswordPolicyError;n?n==d.PolicyNoError?t=l("Password change failed"):n==d.PolicyPasswordModNotAllowed?t=l("Password change failed - Permission denied"):n==d.PolicyInsufficientPasswordQuality?t=l("Password change failed - Insufficient password quality"):n==d.PolicyPasswordTooShort?t=l("Password change failed - Password is too short"):n==d.PolicyPasswordTooYoung?t=l("Password change failed - Password is too young"):n==d.PolicyPasswordInHistory?t=l("Password change failed - Password is in history"):(t=l("Unhandled policy error: %{0}").formatted(n),n=d.PolicyPasswordUnknown):(n=d.PolicyPasswordSystemUnknown,t=_("Unhandled error response")),o.put("XSRF-TOKEN",r,{path:"/SOGo/"}),i.reject(t)}),i.promise}}}(this.$get=e).$inject=["$q","$http","$cookies","passwordPolicyConfig"]})}(),function(){"use strict";function n(){}function e(e,t){return angular.extend(n,{$q:e,$modal:t}),n}n.alert=function(e,t){var n=this.$modal.alert().title(e).htmlContent(t).ok(l("OK")).multiple(!0);this.$modal.show(n)},n.confirm=function(e,t,n){var i=this.$modal.confirm().title(e).htmlContent(t).ok(n&&n.ok?n.ok:l("OK")).cancel(n&&n.cancel?n.cancel:l("Cancel"));return this.$modal.show(i)},n.prompt=function(n,e,t){var i=t||{},r=n.asCSSIdentifier(),o=this.$q.defer();function s(e,t){e.title=n,e.name="",e.cancel=function(){o.reject(),t.hide()},e.ok=function(){o.resolve(e.name),t.hide()}}return this.$modal.show({parent:angular.element(document.body),clickOutsideToClose:!0,escapeToClose:!0,template:['<md-dialog flex="50" flex-xs="90">',' <form name="'+r+'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>"+e+"</label>",' <input type="'+(i.inputType||"text")+'"',' aria-label="'+n+'"',' 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="'+r+'Form.$invalid">'," "+l("OK")," </md-button>"," </md-dialog-actions>"," </form>","</md-dialog>"].join(""),controller:s}),s.$inject=["scope","$mdDialog"],o.promise},e.$inject=["$q","$mdDialog"],angular.module("SOGo.Common").factory("Dialog",e)}(),function(){"use strict";angular.module("SOGo.Common").factory("Gravatar",function(){return function(e,t,n,i){var r,o,s,a=t,l=n;return e?(0<=(r=e.indexOf("<"))&&r<(o=e.indexOf(">",r))&&(e=e.substring(r+1,o)),t||(a=48),s=e.md5(),l&&"none"!=l||(n=i&&i.no_404?"mm":"404"),"https://www.gravatar.com/avatar/"+s+"?s="+a+"&d="+n):""}})}(),function(){"use strict";function a(e,t,n,i,r,o,s){angular.extend(this,{_http:e,_q:t,_window:n,_cookies:i,_path:r,_activeUser:o}),angular.extend(this,s),this._path=this._path.replace(/\/$/,"")}a.$factory=["$http","$q","$window","$cookies",function(i,r,o,s){return function(e,t,n){return new a(i,r,o,s,e,t,n)}}],angular.module("SOGo.Common").factory("Resource",a.$factory),a.prototype.encodeURL=function(e){var t=this,n=e;return angular.isArray(n)||(n=e.split("/")),_.map(n,function(e){return t._window.encodeURIComponent(e.toString())})},a.prototype.userResource=function(e){var t=_.compact(this._activeUser.folderURL.split("/"));return e&&t.splice(t.length-1,1,escape(e)),new a(this._http,this._q,this._window,this._cookies,"/"+t.join("/"),this._activeUser)},a.prototype.path=function(){var e=[this._path];return 0<arguments.length&&Array.prototype.push.apply(e,Array.prototype.slice.call(arguments)),e.join("/")},a.prototype.fetch=function(e,t,n){var i=this._q.defer(),r=[this._path];return e&&r.push(this.encodeURL(e)),t&&r.push(t),r=_.compact(_.flatten(r)).join("/"),this._http({method:"GET",url:r,params:n}).then(function(e){return i.resolve(e.data)},i.reject),i.promise},a.prototype.quietFetch=function(e,t,n){var i=this._q.defer(),r=[this._path];return e&&r.push(this.encodeURL(e)),t&&r.push(t),r=_.compact(_.flatten(r)).join("/"),this._http({method:"GET",url:r,params:n,transformResponse:function(e){var t;try{t=angular.fromJson(e)}catch(e){t={}}return angular.extend({quiet:!0},t)}}).then(function(e){return i.resolve(e.data)},i.reject),i.promise},a.prototype.newguid=function(e){var t=this._q.defer(),n=this._path+"/"+e+"/newguid";return this._http.get(n).then(function(e){return t.resolve(e.data)},t.reject),t.promise},a.prototype.create=function(e,t){var n=this._q.defer(),i=this._path+"/"+e;return this._http.post(i,{name:t}).then(function(e){return n.resolve(e.data)},n.reject),n.promise},a.prototype.post=function(e,t,n){var i=this._q.defer(),r=[this._path];return e&&r.push(this.encodeURL(e)),t&&r.push(t),r=_.compact(_.flatten(r)).join("/"),this._http.post(r,n).then(function(e){return i.resolve(e.data)},i.reject),i.promise},a.prototype.save=function(e,t,n){var i=n&&n.action?n.action:"save";return this.post(e,i,t)},a.prototype.download=function(e,t,n,o){this._q.defer();var s=o&&o.type?o.type:"application/zip",i=[this._path];if(e&&i.push(this.encodeURL(e)),t&&i.push(t),i=_.compact(_.flatten(i)).join("/"),"undefined"==typeof saveAs)throw new Error("To use Resource.download, FileSaver.js must be loaded.");return this._http({method:"POST",url:i,data:n,headers:{accept:s},responseType:"arraybuffer",cache:!1,transformResponse:function(e,t,n){var i,r=null;if(n<200||299<n)throw new Error("Bad gateway");e&&(r=new Blob([e],{type:s})),o&&o.filename?i=o.filename:function(e){e&&e.split(";")[1].trim().split("=")[1].replace(/"/g,"")}(t("content-disposition")),saveAs(r,i)}})},a.prototype.open=function(e,t){var n,i=[this._path];n=this._cookies.get("XSRF-TOKEN"),e&&i.push(e),t&&i.push(t),i=_.compact(_.flatten(i)).join("/"),n&&(i+="?X-XSRF-TOKEN="+n),this._window.location.href=i},a.prototype.remove=function(e){var t=this._q.defer(),n=_.flatten([this._path,this.encodeURL(e),"delete"]).join("/");return this._http.get(n).then(function(e){return t.resolve(e.data)},t.reject),t.promise}}(),function(){"use strict";function e(t,n){return function(e){n(function(){t.$broadcast("sgFocusOn",e)})}}e.$inject=["$rootScope","$timeout"],angular.module("SOGo.Common").factory("sgFocus",e)}(),function(){"use strict";function e(e,t){return angular.extend(t,{$modal:e}),new t}e.$inject=["$mdDialog","$sgHotkeys"],angular.module("SOGo.Common").service("sgHotkeys",e).provider("$sgHotkeys",function(){var r={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"},o={42:"*",63:"?"};function e(i,e){function t(e){this.id=e.id||guid(),this.key=e.key,this.description=e.description||null,this.context=e.context||null,this.callback=e.callback,this.preventInClass=e.preventInClass,this.args=e.args,this.onKeyUp=!1,1<this.key.length&&(this.lkey=l("key_"+this.key))}t.prototype.clone=function(){return new t(this)};function n(){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 n.prototype.initialize=function(){this.registerHotkey(this.createHotkey({key:"?",description:l("Show or hide this help"),callback:this._toggleCheatSheet.bind(this)})),e.addEventListener("keydown",this._onKeydown,!0),e.addEventListener("keyup",this._onKeyup,!0),e.addEventListener("keypress",this._onKeypress,!0)},n.prototype._invokeHotkeyHandlers=function(e,t,n){for(var i=0,r=n.length;i<r;i++){var o=n[i],s=e.target||e.srcElement,a=s.nodeName.toUpperCase();if(!_.includes(this._preventIn,a)&&0===_.intersection(s.classList,this._preventInClass).length&&0===_.intersection(s.classList,o.preventInClass).length)try{o.callback.call(o.context,e,o.args)}catch(e){console.error("HotKeys: ",o.key,e.message)}}},n.prototype._onKeydown=function(e){var t=this.keyStringFromEvent(e);this._hotkeys[t]&&this._invokeHotkeyHandlers(e,t,this._hotkeys[t])},n.prototype._onKeyup=function(e){var t=this.keyStringFromEvent(e);this._hotkeysUp[t]&&this._invokeHotkeyHandlers(this._hotkeysUp[t],t)},n.prototype._onKeypress=function(e){var t,n;t=e.keyCode||e.which,(n=o[t])&&this._hotkeys[n]&&this._invokeHotkeyHandlers(e,n,this._hotkeys[n])},n.prototype.keyStringFromEvent=function(e){var t=[],n=e.which;return n=r[n]?r[n]:String.fromCharCode(n).toLowerCase(),e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.metaKey&&t.push("meta"),t.push(n),_.uniq(t).join("+")},n.prototype._deregisterHotkey=function(e){var t,n=this._hotkeys;if(e.onKeyUp&&(n=this._hotkeysUp),n[e.key]){for(var i=n[e.key],r=0;r<i.length;++r){var o=i[r];(e.callback===o.callback&&o.context===e.context||e.id===o.id)&&(t=i.splice(r,1))}0===i.length&&delete this._hotkeys[e.key]}return t},n.prototype.deregisterHotkey=function(e){var t=[];if(this._validateHotkey(e),angular.isArray(e.key))for(var n=e.key.length-1;0<=n;n--){var i=e.clone();i.key=e.key[n];var r=this._deregisterHotkey(i);void 0!==r&&t.push(r[0])}else t.push(this._deregisterHotkey(e));return t},n.prototype._validateHotkey=function(e){if(!(e instanceof t))throw new TypeError("Hotkeys: Expected a hotkey object be instance of HotKey")},n.prototype._registerKey=function(e){var t=this._hotkeys;return e.onKeyUp&&(t=this._hotkeysUp),t[e.key]=t[e.key]||[],t[e.key].push(e),e},n.prototype._registerKeys=function(e){var t=[];if(angular.isArray(e.key))for(var n=e.key.length-1;0<=n;n--){var i=e.clone();i.id=guid(),i.key=e.key[n],t.push(this._registerKey(i))}else t.push(this._registerKey(e));return t},n.prototype.registerHotkey=function(e){return this._validateHotkey(e),this._registerKeys(e)},n.prototype.registerHotkeyUp=function(e){this._validateHotkey(e),e.onKeyUp=!0,this._registerKeys(e)},n.prototype.createHotkey=function(e){if(null===e.key||void 0===e.key)throw new TypeError('HotKeys: Argument "key" is required');if(null===e.callback||void 0===e.callback)throw new TypeError('HotKeys: Argument "callback" is required');return e.callback=function(n){return function(e,t){i.$apply(function(){n.call(this,e,t)}.bind(this))}}(e.callback),new t(e)},n.prototype.match=function(e,t){angular.isArray(t)||(t=[t]);var n=this.keyStringFromEvent(e);return Boolean(~t.indexOf(n))},n.prototype._toggleCheatSheet=function(){var e=this;function t(e,t){e.hotkeys=t,e.closeDialog=function(){n.$modal.hide()}}this._cheatSheet?(n.$modal.hide(),this._cheatSheet=null):this._cheatSheet=n.$modal.show({clickOutsideToClose:!0,escapeToClose:!0,template:["<md-dialog>",' <md-toolbar class="md-hue-2">',' <div class="md-toolbar-tools">'," <div ng-bind=\"::'Keyboard Shortcuts' | loc\"></div>"," </div>"," </md-toolbar>"," <md-dialog-content>"," <md-list>",' <md-list-item ng-repeat="(hotkey, keys) in hotkeys">'," {{keys[0].description}}",' <div class="md-secondary sg-hotkey-container">'," <sg-hotkey>{{keys[0].lkey || hotkey}}</sg-hotkey>"," </div>"," </md-list-item>"," </md-list>"," </md-dialog-content>","</md-dialog>"].join(""),controller:t,locals:{hotkeys:e._hotkeys}}).finally(function(){e._cheatSheet=null}),t.$inject=["$scope","hotkeys"]},n}(this.$get=e).$inject=["$rootScope","$window"]})}(),function(){"use strict";function c(e){e&&this.init(e)}c.factory=["$q","$log","sgSettings","Resource",function(e,t,n,i){return angular.extend(c,{$q:e,$log:t,$$resource:new i(n.activeUser("folderURL"),n.activeUser()),$query:"",$users:[]}),c}],angular.module("SOGo.Common").factory("User",c.factory),c.$filter=function(e,s,a){var t=c.$$resource,n={search:e};if(a&&a.dry)a&&a.uid&&(t=c.$$resource.userResource(a.uid));else{if(!e)return c.$users.splice(0,c.$users.length),c.$q.when(c.$users);if(c.$query==e)return c.$q.when(c.$users);c.$query=e}return t.fetch(null,"usersSearch",n).then(function(e){function i(e){return this.uid==e.uid}var t,n,r,o;for(a?a.dry?o=[]:a.results&&(o=a.results):o=c.$users,t=s?_.filter(e.users,function(e){return!_.find(s,_.bind(i,e))}):e.users,n=o.length-1;0<=n;n--)r=o[n],_.find(t,_.bind(i,r))||o.splice(n,1);return _.forEach(t,function(e,t){if(_.isUndefined(_.find(o,_.bind(i,e)))){var n=new c(e);o.splice(t,0,n)}}),c.$log.debug(o),o})},c.prototype.init=function(e){angular.extend(this,e),this.$$shortFormat||(this.$$shortFormat=this.$shortFormat()),this.$$image||(this.$$image=this.image),this.$avatarIcon=this.$isGroup()||this.$isSpecial()?"group":"person",this.empty=" "},c.prototype.$fullname=function(){var e=this.cn||this.uid;return this.c_info&&(e+=" ("+this.c_info.split("\n").join("; ")+")"),e},c.prototype.$shortFormat=function(e){var t=this.$fullname(),n=this.c_email;return!(e&&!1===e.email)&&n&&t!=n&&(t+=" <"+n+">"),t},c.prototype.$acl=function(e,t){var n=this,i=c.$q.defer(),r={uid:this.uid};this.$shadowRights?i.resolve(this.rights):(angular.isDefined(t)?c.$$resource.userResource(t).fetch(e,"userRights",r):c.$$resource.fetch(e,"userRights",r)).then(function(e){return n.rights=e,n.$shadowRights=angular.copy(e),i.resolve(e),e});return i.promise},c.prototype.$isGroup=function(){return this.isGroup||this.userClass&&"normal-group"==this.userClass},c.prototype.$isAnonymous=function(){return"anonymous"==this.uid},c.prototype.$isSpecial=function(){return this.userClass&&"public-user"==this.userClass},c.prototype.$confirmRights=function(e){var t=!1;return!this.$confirmation&&(_.some(_.values(this.rights))&&("anonymous"==this.uid?"AddressBook"==e.constructor.name?t=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?',e.name):"Calendar"==e.constructor.name&&(t=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?',e.name)):"anyone"!=this.uid&&"<default>"!=this.uid||("AddressBook"==e.constructor.name?t=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?',e.name):"Calendar"==e.constructor.name?t=l('Any user with an account on this system will be able to access your calendar "%{0}". Are you certain you trust them all?',e.name):"Mailbox"==e.constructor.name&&(t=l('Any user with an account on this system will be able to access your mailbox "%{0}". Are you certain you trust them all?',e.name)))),this.$confirmation=t)},c.prototype.$rightsAreDirty=function(){return this.rights&&!_.isEqual(this.rights,this.$shadowRights)},c.prototype.$resetRights=function(e){var t=this;e?_.map(_.keys(this.rights),function(e){angular.isString(t.rights[e])?t.rights[e]="None":t.rights[e]=0}):this.$shadowRights&&(this.rights=angular.copy(this.$shadowRights))},c.prototype.$folders=function(e){var t=this,n=c.$q.defer(),i={type:e};return this.$$folders?n.resolve(this.$$folders):c.$$resource.userResource(this.uid).fetch(null,"foldersSearch",i).then(function(e){t.$$folders=e.folders,n.resolve(e.folders)}),n.promise},c.prototype.$omit=function(){var n={};return angular.forEach(this,function(e,t){"constructor"!=t&&"$"!=t[0]&&(n[t]=e)}),n},c.prototype.toString=function(){return"[User "+this.c_email+"]"}}(),function(){"use strict";function e(l,c){return{restrict:"A",scope:{autogrow:"=sgAutogrow"},link:function(e,t,n){if(e.autogrow){var i=t[0],r=l[0].createElement("div"),o=null;r.classList.add("md-input"),r.classList.add("plain-text"),r.style.display="none",r.style.whiteSpace="pre-wrap",r.style.wordWrap="break-word",i.parentNode.appendChild(r),i.style.resize="none",i.style.overflow="hidden",t.on("keyup",a),t.on("paste",a);var s=e.$watch(function(){return t[0].value},function(e){e&&(a(),s())})}function a(){c(function(){o=(o=i.value.encodeEntities()).replace(/\n/g,"<br>"),r.innerHTML=o+'<br style="line-height: 3px;">',r.style.visibility="hidden",r.style.display="block",i.style.height=r.offsetHeight+"px",r.style.visibility="visible",r.style.display="none"})}}}}e.$inject=["$document","$timeout"],angular.module("SOGo.Common").directive("sgAutogrow",e)}(),function(){"use strict";function e(e,t,n,i,r,o){var s,a;function l(){s.url=null,s.urlEmail=null,s.img.addClass("ng-hide"),s.genericImg.removeClass("ng-hide")}function c(){s.genericImg.addClass("ng-hide"),s.img.removeClass("ng-hide")}s=this,e.$on("$destroy",function(){a&&t.off("click",a)}),e.$watch(function(){return s.email},function(e,t){e&&s.urlEmail!=e?(l(),r.defaults.SOGoGravatarEnabled&&function(e){var t=o(e,s.size,r.defaults.SOGoAlternateAvatar);n({method:"GET",url:t,cache:!0,headers:{Accept:"image/*"}}).then(function(){s.url||(s.url=t,s.urlEmail=e,c())},function(){l()})}(e)):e||l()}),"sg-src"in t[0].attributes&&e.$watch(function(){return s.src},function(e){e&&(s.url=e,s.urlEmail=""+s.email,t.addClass("sg-avatar-image--zoomable"),a=function(){t.toggleClass("sg-avatar-image--zoom")},t.on("click",a),c())})}e.$inject=["$scope","$element","$http","$q","Preferences","Gravatar"],angular.module("SOGo.Common").directive("sgAvatarImage",function(){return{restrict:"AE",scope:{},bindToController:{size:"@",email:"=sgEmail",src:"=sgSrc"},transclude:!0,template:['<div class="sg-icon-badge-container">'," <md-icon ng-transclude></md-icon>",' <md-icon class="md-warn sg-icon--badge sg-icon--badge-bottom"',' style="display: none">not_interested</md-icon>',' <img class="ng-hide" ng-src="{{vm.url}}">',"</div>"].join(""),link:function(e,t,n,i){var r,o=t.find("img"),s=t.find("md-icon"),a=angular.element(s[0]),l=angular.element(s[1]);n.size&&(o.attr("width",n.size),o.attr("height",n.size),a.css("font-size",n.size+"px"),l.css("font-size",parseInt(.4*n.size)+"px"));angular.isDefined(n.ngDisabled)&&(r=e.$watch(n.ngDisabled,function(e){n.disabled&&l.css({display:"block"}),r()}));i.img=o,i.genericImg=a},controller:"sgAvatarImageController",controllerAs:"vm"}}).controller("sgAvatarImageController",e)}(),function(){"use strict";function e(e,l,c){return{link:function(e,t){var n=t[0].querySelector(".sg-button-toggle"),i=n.querySelector(".sg-icon-toggle"),r="md-rotate-180-ccw",o=t[0].querySelector(".sg-block-toggle"),s=!1;function a(){o.setAttribute("aria-hidden",!s),o.setAttribute("aria-expanded",s),s||(o.style.visibility="hidden")}n.classList.add("md-clickable"),angular.element(n).on("click",function(){(s=!s)?i.classList.add(r):i.classList.remove(r),s&&(o.style.visibility="visible"),c(function(){var e=s?o.scrollHeight:0;l(angular.element(o),{easing:"cubic-bezier(0.35, 0, 0.25, 1)",to:{height:e+"px"},duration:.75}).start().then(function(){a()})})}),a()}}}e.$inject=["$mdUtil","$animateCss","$$rAF"],angular.module("SOGo.Common").directive("sgBlockToggle",e)}(),function(){"use strict";function e(a,l,c,u){var d="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:function(e,t){return e.on("click",function(e){this.hasAttribute("disabled")&&e.stopImmediatePropagation()}),function(e,n,t,i){var r=s(a,e,"sgTrueValue",t.sgTrueValue,!0),o=s(a,e,"sgFalseValue",t.sgFalseValue,!1);function s(e,t,n,i,r){var o;if(angular.isDefined(i)){if(!(o=e(i)).constant)throw Error("Expected constant expression for `"+n+"`, but saw `"+i+"`.");return o(t)}return r}i=i||u.fakeNgModel(),c(n),l.expectWithText(n,"aria-label"),n.on("click",function(t){if(n[0].hasAttribute("disabled"))return;e.$apply(function(){var e=i.$viewValue==r?o:r;i.$setViewValue(e,t&&t.type),i.$render()})}),i.$render=function(){i.$viewValue==r?n.addClass(d):n.removeClass(d)}}}}}angular.module("SOGo.Common").directive("sgCheckmark",e),e.$inject=["$parse","$mdAria","$mdTheming","$mdUtil"]}(),function(){"use strict";function e(e,t,d,h){var m,g,p;function f(e){p=e,m.buttonIcon.css("color",p)}this.$onInit=function(){m=this,g=t.controller("ngModel")},this.$postLink=function(){this.buttonIcon=t.find("md-icon"),g.$render=function(){f(g.$viewValue)}},this.showPicker=function(e){for(var t=d.newPanelPosition().relativeTo(m.buttonIcon).addPanelPosition(d.xPosition.ALIGN_START,d.yPosition.ALIGN_TOPS),n=d.newPanelAnimation().openFrom(m.buttonIcon).duration(100).withAnimation(d.animation.FADE),i=[],r="",o=0;o<h.selection.length;o++){var s=h.selection[o],a=contrast(s),l=s==p;o%7==0&&(r.length&&i.push(r),r=""),r+="<span ",l&&(r+='class="selected" '),r+='style="background-color: '+s+'" ng-click="$menuCtrl.setColor($event, \''+s+"')\">",l&&(r+='<md-icon style="color: '+a+'">check</md-icon>'),r+="</span>"}var c={attachTo:angular.element(document.body),bindToController:!0,controller:u,controllerAs:"$menuCtrl",position:t,animation:n,targetEvent:e,template:['<div class="sg-color-picker-panel" md-whiteframe="3">'," <div>"+i.join("</div><div>")+"</div>","</div>"].join(""),trapFocus:!0,clickOutsideToClose:!0,escapeToClose:!0,focusOnOpen:!0};function u(e,t,n,i){this.setColor=function(e,t){e&&(_.forEach(e.currentTarget.parentElement.children,function(e){e.classList.remove("selected")}),e.currentTarget.classList.add("selected")),f(t),g.$setViewValue(t)}}d.open(c).then(function(e){e.panelEl.one("click",function(){e.close()})}),u.$inject=["mdPanelRef","$state","$mdDialog","User"]}}e.$inject=["$scope","$element","$mdPanel","sgColors"],angular.module("SOGo.Common").directive("sgColorPicker",function(){return{restrict:"E",require:"ngModel",template:[' <md-button class="md-icon-button"',' label:aria-label="Options"',' ng-click="$ctrl.showPicker($event)">'," <md-icon>format_color_fill</md-icon>"," </md-button>"].join(""),controller:e,controllerAs:"$ctrl"}})}(),function(){"use strict";function e(o){return{restrict:"A",link:function(t,n,i){var r=t.$watch(function(e){return e.$eval(i.sgCompile)},function(e){n.html(e),o(n.contents())(t),r()})}}}e.$inject=["$compile"],angular.module("SOGo.Common").directive("sgCompile",e)}(),function(){"use strict";angular.module("SOGo.Common").directive("sgDatepickerReadonlyInput",function(){return{link:function(e,t,n,i){var r=e.$watch(function(){return t.find("input").eq(0)},function(e){e.length&&(r(),e.prop("disabled",!0),e.parent().addClass("sg-datepicker-readonly-input-container"))})},require:"mdDatepicker",restrict:"A"}})}(),function(){"use strict";function e(l,n,c,e,u){return{restrict:"A",link:function(i,r,o){var s;function a(e,t,n,i){if(this.$element=e,this.folder=t,this.dragStart=n,this.count=i,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)}e(function(){var e,t,n;e=l(o.sgDraggable)(i),t=o.sgDragStart?l(o.sgDragStart):null,n=o.sgDragCount?l(o.sgDragCount):null,s=new a(r,e,t,n)}),i.$on("$destroy",function(){s.$destroy()}),a.prototype={dragHasStarted:!1,$destroy:function(){this.$element.off("mousedown",this.bindedOnDragDetect)},getDistanceFromStart:function(e){var t=this.startPosition.clientX-e.clientX,n=this.startPosition.clientY-e.clientY;return Math.sqrt(t*t+n*n)},onDragDetect:function(e){e.stopPropagation(),this.dragStart&&!this.dragStart(i)||(c.on("mousemove",this.bindedOnDrag),c.one("mouseup",angular.bind(this,this.onDragEnd)))},onDrag:function(e){var t;this.startPosition?!this.dragHasStarted&&10<this.getDistanceFromStart(e)&&(t=this.helper.find("sg-draggable-helper-counter"),this.dragHasStarted=!0,this.helper.removeClass("ng-hide"),this.count&&1<this.count(i)?t.text(this.count(i)).removeClass("ng-hide"):t.addClass("ng-hide"),u.debug("emit folder:dragstart"),n.$emit("folder:dragstart",this.folder)):this.startPosition={clientX:e.clientX,clientY:e.clientY},this.dragHasStarted&&(e.shiftKey||this.folder.isRemote?this.helper.addClass("sg-draggable-helper--copy"):this.helper.removeClass("sg-draggable-helper--copy"),this.helper.css({top:e.pageY+5+"px",left:e.pageX+5+"px"}))},onDragEnd:function(e){var t="move";this.startPosition=null,c.off("mousemove",this.bindedOnDrag),this.dragHasStarted&&((e.shiftKey||this.folder.isRemote)&&(t="copy"),u.debug("emit folder:dragend"),n.$emit("folder:dragend",this.folder,t),this.dragHasStarted=!1,this.helper.addClass("ng-hide"))}}}}}e.$inject=["$parse","$rootScope","$document","$timeout","$log"],angular.module("SOGo.Common").directive("sgDraggable",e)}(),function(){"use strict";function e(u,d,e,t,n){return{restrict:"A",link:function(i,r,e){var o,n,t,s,a=!1;if(!e.sgDrop)throw Error("sg-droppable requires a sg-drop action.");function l(e){a=!0,r.addClass("sg-droppable-over")}function c(e){a=!1,this.classList.remove("sg-droppable-over"),r.off("mousemove")}a=!1,n=u(e.sgDroppable),o=u(e.sgDrop),t=d.$on("folder:dragstart",function(e,t){n(i,{dragFolder:t})&&(r.on("mouseenter",l),r.on("mouseleave",c))}),s=d.$on("folder:dragend",function(e,t,n){r.off("mouseenter"),r.off("mouseleave"),a&&(angular.bind(r[0],c)(e),o(i,{dragFolder:t,dragMode:n}))}),i.$on("destroy",function(){t(),s()})}}}e.$inject=["$parse","$rootScope","$document","$timeout","$log"],angular.module("SOGo.Common").directive("sgDroppable",e)}(),function(){"use strict";angular.module("SOGo.Common").directive("sgEnter",function(){return function(t,e,n){e.bind("keydown keypress",function(e){13===e.which&&(t.$apply(n.sgEnter),e.preventDefault())})}})}(),function(){"use strict";angular.module("SOGo.Common").directive("sgEscape",function(){return function(t,e,n){e.bind("keydown",function(e){27===e.keyCode&&t.$apply(n.sgEscape)})}})}(),function(){"use strict";angular.module("SOGo.Common").directive("sgFocusOn",function(){return function(e,n,i){e.$on("sgFocusOn",function(e,t){t===i.sgFocusOn&&(n[0].focus(),"function"==typeof n[0].select&&n[0].select())})}})}(),function(){"use strict";angular.module("SOGo.Common").directive("sgFolderStylesheet",function(){return{restrict:"E",require:"ngModel",scope:{ngModel:"="},replace:!0,bindToController:!0,controller:function(){this.contrast=contrast,this.transparent=function(e,t){var n=hexToRgb(e);return["rgba("+n.r,n.g,n.b,t+")"].join(",")}},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("")}})}(),function(){"use strict";function e(o,s,a){return{restrict:"A",link:function(e,t,n){var i=n.sgLabels,r=new s(o.activeUser("folderURL"),o.activeUser());_.includes(a.labels._loadedFrameworks,i)||r.post("labels",null,{framework:i}).then(function(e){var t=a.labels._loadedFrameworks;angular.extend(a.labels,e.labels),a.labels._loadedFrameworks=_.concat(a.labels._loadedFrameworks,t)})}}}e.$inject=["sgSettings","Resource","$window"],angular.module("SOGo.Common").directive("sgLabels",e)}(),function(){"use strict";angular.module("SOGo.Common").directive("sgNoDirtyCheck",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,i){i&&i.$pristine&&!i.$dirty&&(i.$pristine=!1,i.$dirty=!0)}}})}(),function(){"use strict";angular.module("SOGo.Common").directive("sgPlaceholder",function(){return{restrict:"A",scope:{placeholder:"=sgPlaceholder"},link:function(e,t,n){e.$watch("placeholder",function(){t[0].placeholder=e.placeholder})}}})}(),function(){"use strict";function e(s){return{restrict:"E",scope:{text:"@",width:"@",height:"@"},link:function(e,t,n){var i=parseInt(e.width)||256,r=parseInt(e.height)||i,o="otpauth://totp/SOGo:"+s.activeUser("email")+"?secret="+e.text.replace(/=+$/,"")+"&issuer=SOGo";new QRCode(t[0],{text:o,width:i,height:r})}}}e.$inject=["sgSettings"],angular.module("SOGo.Common").directive("sgQrCode",e)}(),function(){"use strict";angular.module("SOGo.Common").directive("sgResetOnDisabled",function(){return{link:function(e,t,n,i){var r=e.$watch(function(){return t.find("input").eq(0)},function(e){e.length&&(r(),i.$scope.$watch("ctrl.isDisabled",function(e){e&&i.ngModelCtrl.$invalid&&i.$scope.$emit("md-calendar-change",i.date)}))})},require:"mdDatepicker",restrict:"A"}})}(),function(){"use strict";function e(l,c){return{restrict:"A",compile:function(e,t){return function(e,n,t){var i,r,o,s;for(s=n.attr("sg-ripple-click"),o=n[0].parentNode;o&&o.id!=s;)o=o.parentNode;function a(e){var t;n[0].hasAttribute("disabled")||(t=e.pageX&&e.pageY?{left:e.pageX,top:e.pageY}:e.target.getBoundingClientRect(),r.classList.contains("ng-hide")?(angular.element(o).css({overflow:"hidden",position:"relative"}),angular.element(r).css({top:o.scrollTop+"px"}),c(function(){i.css({top:t.top-o.offsetTop+o.scrollTop+"px",left:t.left-o.offsetLeft+"px",height:"400vmin",width:"400vmin"}),r.classList.remove("ng-hide")})):(i.css({top:t.top-o.offsetTop+o.scrollTop+"px",left:t.left-o.offsetLeft+"px",height:"0px",width:"0px"}),r.classList.add("ng-hide"),c(function(){angular.element(o).css({overflow:"",position:""})},800)))}o?(r=o.querySelector("sg-ripple-content"))?((i=o.querySelector("sg-ripple"))?i=angular.element(i):(i=angular.element('<sg-ripple class="md-default-theme md-bg"></sg-ripple>'),o.appendChild(i[0]),r.classList.contains("ng-hide")||r.classList.add("ng-hide")),n.on("click",a),e.$on("$destroy",function(){n.off("click",a)})):l.error("sg-ripple-content not found inside #"+s):l.error("No parent element found with id "+s)}}}}angular.module("SOGo.Common").directive("sgRippleClick",e),e.$inject=["$log","$timeout"]}(),function(){"use strict";function e(a){return{restrict:"A",controller:"sgSearchController",controllerAs:"$sgSearchController",priority:1001,compile:function(e,t){e.find("md-input-container");var o=e.find("input"),n=e.find("md-select"),s=e.find("md-button");o.attr("ng-model","$sgSearchController.searchText"),o.attr("ng-model-options","$sgSearchController.searchTextOptions"),o.attr("ng-change","$sgSearchController.onChange()"),n&&(n.attr("ng-model","$sgSearchController.searchField"),n.attr("ng-change","$sgSearchController.onChange()"));s&&s.attr("sg-search-cancel")?(s.attr("ng-click",s.attr("sg-search-cancel")),s.removeAttr("sg-search-cancel")):s=null;return function(e,t,n,i){var r=t.find("button");i.formName=t.attr("name"),i.inputName=o.attr("name"),i.allowDot=a(t.attr("sg-allow-dot"))(e),i.fields=a(t.attr("sg-search-fields"))(e),i.doSearch=a(t.attr("sg-search")),s&&r&&r.on("click",i.cancelSearch)}}}}function t(e,i,t){var r=this;if(r.searchText=null,r.searchTextOptions={updateOn:"default blur",debounce:{default:300,blur:0}},t.attr("sg-search-fields"))var n=i.$watch(r.fields,function(e){r.searchField=_.clone(r.fields),n()});r.onChange=function(){var e=i[r.formName],t=e[r.inputName],n=t.$viewValue;(r.allowDot&&"."==n||e.$valid&&n)&&("."==n&&t.$setValidity("minlength",!0),r.doSearch(i,{searchText:n,searchField:r.searchField}))},r.cancelSearch=function(){r.searchText=null}}e.$inject=["$parse"],t.$inject=["$window","$scope","$element"],angular.module("SOGo.Common").controller("sgSearchController",t).directive("sgSearch",e).directive("sgSearch",function(){return{restrict:"A",priority:1e3,transclude:!0,compile:function(e,t){return function(e,t,n,i,r){r(function(e){t.append(e)})}}}})}(),function(){"use strict";angular.module("SOGo.Common").directive("sgSelectOnly",function(){return{link:function(n,e,t,i){var r=n.$watch(function(){return e.find("input").eq(0)},function(e){var t;e.length&&(r(),t=e.controller("ngModel"),e.on("blur",function(){i.scope.selectedItem||n.$applyAsync(t.$setValidity("required",!1))}))})},require:"mdAutocomplete",restrict:"A"}})}(),function(){"use strict";function e(e){return{restrict:"A",scope:{folderType:"@sgSubscribe",onFolderSelect:"&sgSubscribeOnSelect"},replace:!1,bindToController:!0,controller:n,controllerAs:"$sgSubscribeDialogController",link:t}}function t(e,t,n,i){t.find("input");t.on("click",i.showDialog)}function n(e){var t=this;t.showDialog=function(){e.show({templateUrl:"../Contacts/UIxContactsUserFolders",clickOutsideToClose:!0,locals:{folderType:t.folderType,onFolderSelect:t.onFolderSelect},controller:i,controllerAs:"subscribe"})}}function i(e,t,n,i){var r=this;r.selectedUser=null,r.users=[],r.searchTextOptions={updateOn:"default blur",debounce:{default:300,blur:0}},r.onChange=function(t){i.$filter(r.searchText,null,{results:r.users}).then(function(e){t.$setValidity("matches",0<e.length),t.$setTouched(),r.selectedUser&&_.isUndefined(_.find(e,function(e){return e.uid==r.selectedUser.uid}))&&(r.selectedUser=null)})},r.selectUser=function(e){r.selectedUser==r.users[e]?r.selectedUser=null:r.users[e].$folders(t).then(function(){r.selectedUser=r.users[e]})},r.selectFolder=function(e){n({folderData:e})},r.close=function(){e.hide()}}e.$inject=["User"],n.$inject=["$mdDialog"],i.$inject=["$mdDialog","folderType","onFolderSelect","User"],angular.module("SOGo.Common").directive("sgSubscribe",e)}(),function(){"use strict";angular.module("SOGo.Common").directive("sgTimePane",function(){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:e,controllerAs:"ctrl",bindToController:!0,link:function(e,t,n,i){var r=i[0],o=i[1];if(i[2])throw Error("sg-timepicker should not be placed inside md-input-container.");o.configureNgModel(r,o)}}});var g=0;function e(e,t,n,i,r,o,s,a,l){var c;o(e),this.$element=e,this.$scope=t,this.dateUtil=n,this.$mdUtil=i,this.keyCode=r.KEY_CODE,this.$$rAF=s,this.timePaneElement=e[0].querySelector(".sg-time-pane"),this.ngModelCtrl=null,this.SELECTED_TIME_CLASS="sg-time-selected",this.FOCUSED_TIME_CLASS="md-focus",this.id=g++,this.displayTime=null,this.selectedTime=null,this.isInitialized=!1,t.hours=[],t.hours[0]=[],t.hours[0][0]=[],t.hours[0][1]=[],t.hours[1]=[],t.hours[1][0]=[],t.hours[1][1]=[];for(var u=0;u<6;u++)t.hours[0][0][u]={id:"tp-"+this.id+"-hour-"+u,displayName:u<10?"0"+u:""+u,selected:!1},t.hours[0][1][u]={id:"tp-"+this.id+"-hour-"+(u+6),displayName:u+6<10?"0"+(u+6):""+(u+6),selected:!1},t.hours[1][0][u]={id:"tp-"+this.id+"-hour-"+(u+12),displayName:""+(u+12),selected:!1},t.hours[1][1][u]={id:"tp-"+this.id+"-hour-"+(u+18),displayName:""+(u+18),selected:!1};for(t.min5=[],t.min5[0]=[],t.min5[1]=[],u=0;u<6;u++)c=5*u,t.min5[0][u]={id:"tp-"+this.id+"-minute5-"+c,displayName:c<10?":0"+c:":"+c,selected:!0},t.min5[1][u]={id:"tp-"+this.id+"-minute5-"+(c+30),displayName:":"+(c+30),selected:!1};for(t.min1=[],u=0;u<12;u++){t.min1[u]=[];for(var d=0;d<5;d++)c=5*u+d,t.min1[u][d]={id:"tp-"+this.id+"-minute-"+c,displayName:c<10?":0"+c:":"+c,selected:!0}}t.show5min=!0,t.getToggleBtnLbl=function(){return t.is5min()?">>":"<<"},t.toggleManual5min=function(){t.manual5min=!t.is5min()},t.is5min=function(){return!0===t.manual5min||!1===t.manual5min?t.manual5min:t.show5min},a.tabindex||e.attr("tabindex","-1");var h=this;this.hourClickHandler=function(e){var t=new Date(h.displayTime);t.setHours(Number(e)),h.setNgModelValue(t,"hours")},t.hourClickHandler=this.hourClickHandler,this.minuteClickHandler=function(e){var t=e.substr(1),n=new Date(h.displayTime);n.setMinutes(Number(t)),h.setNgModelValue(n,"minutes")},t.minuteClickHandler=this.minuteClickHandler;var m=angular.bind(this,this.handleKeyEvent);angular.element(document.body).on("keydown",m),t.$on("$destroy",function(){angular.element(document.body).off("keydown",m)})}e.$inject=["$element","$scope","$$mdDateUtil","$mdUtil","$mdConstant","$mdTheming","$$rAF","$attrs","$mdDateLocale"],e.prototype.configureNgModel=function(e,t){var n=this;n.ngModelCtrl=e,n.$mdUtil.nextTick(function(){n.isInitialized=!0}),e.$render=function(){var e=this.$viewValue;n.$mdUtil.nextTick(function(){n.changeSelectedTime(e,t)})}},e.prototype.changeSelectedTime=function(e,t){var n=this.selectedTime;if(this.selectedTime=e,this.displayTime=new Date(e),n){var i=n.getHours(),r=document.getElementById("tp-"+t.id+"-hour-"+i);r&&(r.classList.remove(this.SELECTED_TIME_CLASS),r.setAttribute("aria-selected","false"));var o=n.getMinutes(),s=document.getElementById("tp-"+t.id+"-minute-"+o);s&&(s.classList.remove(this.SELECTED_TIME_CLASS),s.setAttribute("aria-selected","false"));var a=document.getElementById("tp-"+t.id+"-minute5-"+o);a&&(a.classList.remove(this.SELECTED_TIME_CLASS),a.setAttribute("aria-selected","false"))}if(e){var l,c=e.getHours(),u=document.getElementById("tp-"+t.id+"-hour-"+c);u&&(u.classList.add(this.SELECTED_TIME_CLASS),u.setAttribute("aria-selected","true"));var d=e.getMinutes();d%5==0?(t.$scope.show5min=!0,(l=document.getElementById("tp-"+t.id+"-minute5-"+d))&&(l.classList.add(this.SELECTED_TIME_CLASS),l.setAttribute("aria-selected","true"))):t.$scope.show5min=!1,(l=document.getElementById("tp-"+t.id+"-minute-"+d))&&(l.classList.add(this.SELECTED_TIME_CLASS),l.setAttribute("aria-selected","true"))}},e.prototype.setNgModelValue=function(e,t){return this.$scope.$emit("sg-time-pane-change",{date:e,changed:t}),this.ngModelCtrl.$setViewValue(e),this.ngModelCtrl.$render(),e},e.prototype.handleKeyEvent=function(e){var t=this;this.$scope.$apply(function(){return e.which==t.keyCode.ESCAPE||e.which==t.keyCode.TAB?(t.$scope.$emit("md-time-pane-close"),void(e.which==t.keyCode.TAB&&e.preventDefault())):e.which===t.keyCode.ENTER?(t.setNgModelValue(t.displayTime,"enter"),void e.preventDefault()):void 0})},e.prototype.focus=function(e,t){var n=e||this.selectedTime||this.today,i=this.timePaneElement.querySelector(".md-focus");if(i&&i.classList.remove(this.FOCUSED_TIME_CLASS),n){var r=n.getHours(),o=document.getElementById("tp-"+t.id+"-hour-"+r);o&&(o.classList.add(this.FOCUSED_TIME_CLASS),o.focus())}}}(),function(){"use strict";function e(d,h,m){return{template:function(e,t){var n=t.ariaLabel||t.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" ',n?'aria-label="'+n+'" ':"",' 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">',' <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","?^mdInputContainer","?^form"],scope:{placeholder:"@mdPlaceholder"},controller:t,controllerAs:"ctrl",bindToController:!0,link:function(e,t,n,i){var r=i[0],o=i[1],s=i[2],a=i[3],l=d.parseAttributeBoolean(n.mdNoAsterisk);if(o.configureNgModel(r,s,m),s){var c=t[0].querySelector(".md-errors-spacer");c&&t.after(angular.element("<div>").append(c)),s.setHasPlaceholder(n.mdPlaceholder),s.input=t,s.element.addClass(p).toggleClass(f,"time"!==n.mdHideIcons&&"all"!==n.mdHideIcons),s.label?l||n.$observe("required",function(e){s.label.toggleClass("md-required",!!e)}):h.expect(t,"aria-label",n.mdPlaceholder),e.$watch(s.isErrorGetter||function(){return r.$invalid&&(r.$touched||a&&a.$submitted)},s.setInvalid)}else if(a)var u=e.$watch(function(){return a.$submitted},function(e){e&&(o.updateErrorState(),u())})}}}angular.module("SOGo.Common").directive("sgTimepicker",e),e.$inject=["$mdUtil","$mdAria","inputDirective"];var r="sg-timepicker-invalid",g="sg-timepicker-open",p="_sg-timepicker-floating-label",f="_sg-timepicker-has-calendar-icon",y={MIN5:{GTXS:192,XS:311},MIN1:{GTXS:384,XS:474}},v={GTXS:530,XS:294},h=/ipad|iphone|ipod|android/i;function t(e,t,n,i,r,o,s,a,l,c,u){this.$window=i,this.dateLocale=a,this.dateUtil=l,this.$mdConstant=r,this.$mdUtil=s,this.$$rAF=c,this.$mdMedia=u,this.documentElement=angular.element(document.documentElement),this.ngModelCtrl=null,this.inputElement=t[0].querySelector("input"),this.ngInputElement=angular.element(this.inputElement),this.inputContainer=t[0].querySelector(".sg-timepicker-input-container"),this.timePane=t[0].querySelector(".sg-timepicker-time-pane"),this.timeButton=t[0].querySelector(".sg-timepicker-button"),this.inputMask=angular.element(t[0].querySelector(".sg-timepicker-input-mask-opaque")),this.$element=t,this.$attrs=n,this.$scope=e,this.time=null,this.isFocused=!1,this.isDisabled=!1,this.setDisabled(t[0].disabled||angular.isString(n.disabled)),this.isTimeOpen=!1,this.timePaneOpenedFrom=null,this.timePaneId="sg-time-pane"+s.nextUid(),this.bodyClickHandler=angular.bind(this,this.handleBodyClick),this.windowEventName=h.test(navigator.userAgent||navigator.vendor||window.opera)?"orientationchange":"resize",this.windowEventHandler=s.debounce(angular.bind(this,this.closeTimePane),100),this.windowBlurHandler=angular.bind(this,this.handleWindowBlur),this.leftMargin=20,this.topMargin=null,n.tabindex?(this.ngInputElement.attr("tabindex",n.tabindex),n.$set("tabindex",null)):n.$set("tabindex","-1"),o(t),o(angular.element(this.timePane));var d=this;e.$on("$destroy",function(){d.detachTimePane()}),n.mdIsOpen&&e.$watch("ctrl.isOpen",function(e){e?d.openTimePane({target:d.inputElement}):d.closeTimePane()})}t.$inject=["$scope","$element","$attrs","$window","$mdConstant","$mdTheming","$mdUtil","$mdDateLocale","$$mdDateUtil","$$rAF","$mdMedia"],t.prototype.$onInit=function(){this.installPropertyInterceptors(),this.attachChangeListeners(),this.attachInteractionListeners()},t.prototype.configureNgModel=function(e,t,n){this.ngModelCtrl=e,this.mdInputContainer=t,this.$attrs.$set("type","date");var i=this;i.ngModelCtrl.$formatters.push(function(e){if(e&&!(e instanceof Date))throw Error("The ng-model for sg-timepicker must be a Date instance. Currently the model is a: "+typeof e);return i.onExternalChange(e),e}),e.$viewChangeListeners.unshift(angular.bind(this,this.updateErrorState));var r=i.$mdUtil.getModelOption(e,"updateOn");r&&this.ngInputElement.on(r,angular.bind(this.$element,this.$element.triggerHandler,r))},t.prototype.attachChangeListeners=function(){var i=this;i.$scope.$on("sg-time-pane-change",function(e,t){var n=new Date(t.date);i.setModelValue(n),i.onExternalChange(n),"minutes"==t.changed&&i.closeTimePane()}),i.ngInputElement.on("input",angular.bind(i,i.resizeInputElement));var e=angular.isDefined(this.debounceInterval)?this.debounceInterval:500;i.ngInputElement.on("input",i.$mdUtil.debounce(i.handleInputEvent,e,i))},t.prototype.attachInteractionListeners=function(){var t=this,n=this.$scope,i=this.$mdConstant.KEY_CODE;t.ngInputElement.on("keydown",function(e){e.altKey&&e.keyCode==i.DOWN_ARROW&&(t.openTimePane(e),n.$digest())}),n.$on("md-time-close",function(){t.closeTimePane()})},t.prototype.installPropertyInterceptors=function(){var t=this;if(this.$attrs.ngDisabled){var e=this.$scope.$parent;e&&e.$watch(this.$attrs.ngDisabled,function(e){t.setDisabled(e)})}Object.defineProperty(this,"placeholder",{get:function(){return t.inputElement.placeholder},set:function(e){t.inputElement.placeholder=e||""}})},t.prototype.setDisabled=function(e){this.isDisabled=e,this.inputElement.disabled=e,this.timeButton&&(this.timeButton.disabled=e)},t.prototype.updateErrorState=function(e){var t=e||this.time;this.clearErrorState(),this.dateUtil.isValidDate(t)||this.ngModelCtrl.$setValidity("valid",null===t);var n=this.inputElement.value,i=this.dateLocale.parseTime(n);!this.isInputValid(n,i)&&this.ngModelCtrl.$valid&&this.ngModelCtrl.$setValidity("valid",null==t),angular.element(this.inputContainer).toggleClass(r,!this.ngModelCtrl.$valid)},t.prototype.isInputValid=function(e,t){return""===e||this.dateUtil.isValidDate(t)},t.prototype.clearErrorState=function(){this.inputContainer.classList.remove(r),["valid"].forEach(function(e){this.ngModelCtrl.$setValidity(e,!0)},this)},t.prototype.resizeInputElement=function(){this.inputElement.size=this.inputElement.value.length+3},t.prototype.handleInputEvent=function(e){var t=this.inputElement.value,n=t?this.dateLocale.parseTime(t):null;if(this.isInputValid(t,n)){var i=new Date(this.time);n?(i.setHours(n.getHours()),i.setMinutes(n.getMinutes())):i=null,this.setModelValue(i),this.time=i}this.updateErrorState(n)},t.prototype.attachTimePane=function(){var e=this.timePane,t=document.body;e.style.transform="",this.$element.addClass(g),angular.element(t).addClass("md-datepicker-is-showing");var n=this.inputContainer.getBoundingClientRect(),i=t.getBoundingClientRect();(!this.topMargin||this.topMargin<0)&&(this.topMargin=(this.inputMask.parent().prop("clientHeight")-this.ngInputElement.prop("clientHeight"))/2);var r=n.top-i.top-this.topMargin,o=n.left-i.left-this.leftMargin,s=i.top<0&&0===t.scrollTop?-i.top:document.body.scrollTop,a=i.left<0&&0===t.scrollLeft?-i.left:document.body.scrollLeft,l=s+this.$window.innerHeight,c=a+this.$window.innerWidth;this.inputMask.css({position:"absolute",left:this.leftMargin+"px",top:this.topMargin+"px",width:n.width-1+"px",height:n.height-2+"px"});var u=this.$mdMedia("xs")?v.XS:v.GTXS;if(c<o+u){if(0<c-u)o=c-u;else{o=a;var d=this.$window.innerWidth/u;e.style.transform="scale("+d+")"}e.classList.add("sg-timepicker-pos-adjusted")}var h=this.time&&this.time.getMinutes()%5==0?"MIN5":"MIN1",m=this.$mdMedia("xs")?y[h].XS:y[h].GTXS;l<r+m&&s<l-m&&(r=l-m,e.classList.add("sg-timepicker-pos-adjusted")),e.style.left=o+"px",e.style.top=r+"px",document.body.appendChild(e),this.$$rAF(function(){e.classList.add("md-pane-open")})},t.prototype.detachTimePane=function(){this.$element.removeClass(g),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)},t.prototype.openTimePane=function(e){if(!this.isTimeOpen&&!this.isDisabled){this.isTimeOpen=!0,this.timePaneOpenedFrom=e.target,this.$mdUtil.disableScrollAround(this.timePane),this.attachTimePane(),this.evalAttr("ngFocus");var t=this;this.$mdUtil.nextTick(function(){t.documentElement.on("click touchstart",t.bodyClickHandler)},!1),window.addEventListener(this.windowEventName,this.windowEventHandler)}},t.prototype.closeTimePane=function(){if(this.isTimeOpen){var e=this;e.detachTimePane(),e.ngModelCtrl.$setTouched(),e.evalAttr("ngBlur"),e.documentElement.off("click touchstart",e.bodyClickHandler),window.removeEventListener(e.windowEventName,e.windowEventHandler),e.timePaneOpenedFrom.focus(),e.timePaneOpenedFrom=null,e.isTimeOpen=!1}},t.prototype.getTimePaneCtrl=function(){return angular.element(this.timePane.querySelector("sg-time-pane")).controller("sgTimePane")},t.prototype.focusTime=function(){var t=this;this.$mdUtil.nextTick(function(){var e=t.getTimePaneCtrl();t.getTimePaneCtrl().focus(null,e)},!1)},t.prototype.setFocused=function(e){e||this.ngModelCtrl.$setTouched(),this.evalAttr(e?"ngFocus":"ngBlur"),this.isFocused=e},t.prototype.handleBodyClick=function(e){this.isTimeOpen&&(this.$mdUtil.getClosest(e.target,"sg-time-pane")||this.closeTimePane(),this.$scope.$digest())},t.prototype.handleWindowBlur=function(){this.inputFocusedOnWindowBlur=document.activeElement===this.inputElement},t.prototype.evalAttr=function(e){this.$attrs[e]&&this.$scope.$parent.$eval(this.$attrs[e])},t.prototype.setModelValue=function(e){this.ngModelCtrl.$setViewValue(e)},t.prototype.onExternalChange=function(e){this.time=e,this.inputElement.value=this.dateLocale.formatTime(e),this.mdInputContainer&&this.mdInputContainer.setHasValue(!!e),this.resizeInputElement(),this.updateErrorState()}}(),function(){"use strict";function e(e,p,f){return{restrict:"A",require:["mdGridList","?ngModel"],compile:function(h,m){var g="md-default-theme md-accent md-bg md-bdr";return function(i,n,e,t){var r,o,s,a,l,c=h.find("md-grid-tile"),u=[];for((o=t[1]||p.fakeNgModel()).$render=function(){var n=o.$viewValue;u=o.$viewValue,m.sgToggleGridAttr&&(a=m.sgToggleGridAttr,n=_.map(o.$viewValue,m.sgToggleGridAttr));_.forEach(c,function(e){var t=angular.element(e);_.includes(n,t.attr("value"))&&t.addClass(g)}),o.$validate(),d(o.$invalid)},o.$isEmpty=function(e){return!e||0===e.length},l=function(){var e=angular.element(this),t=e.attr("value");e.toggleClass(g),function(t){var e=_.findIndex(u,function(e){return a?e[a]==t:e==t});if(e<0)if(a){var n={};n[a]=t,u.push(n)}else u.push(t);else u.splice(e,1);i.$apply(function(){o.$setViewValue(u),o.$setDirty(),o.$validate(),d(o.$invalid)})}(t)},s=0;s<c.length;s++)(r=angular.element(c[s])).addClass("sg-icon-button"),r.find("figure").addClass("md-icon"),r.on("click",l);function d(e){var t=n.parent().children()[0];e?(n.addClass("sg-toggle-grid-invalid"),"LABEL"==t.tagName&&(t.style.color=f.getThemeColor("warn"))):(n.removeClass("sg-toggle-grid-invalid"),"LABEL"==t.tagName&&(t.style.color=""))}}}}}e.$inject=["$parse","$mdUtil","$mdColors"],angular.module("SOGo.Common").directive("sgToggleGrid",e)}(),String.prototype.endsWith=function(e){return-1!==this.indexOf(e,this.length-e.length)},String.prototype.startsWith=function(e,t){return t=angular.isNumber(t)?t:0,this.lastIndexOf(e,t)===t},String.prototype.encodeEntities=function(){return this.replace(/&/g,"&").replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,function(e){return"&#"+(1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320)+65536)+";"}).replace(/([^#-~ |!])/g,function(e){return"&#"+e.charCodeAt(0)+";"}).replace(/</g,"<").replace(/>/g,">")},String.prototype._base64_keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",String.prototype.base64encode=function(){for(var e,t,n,i,r,o,s,a="",l=0,c=this.utf8encode();l<c.length;)i=(e=c.charCodeAt(l++))>>2,r=(3&e)<<4|(t=c.charCodeAt(l++))>>4,o=(15&t)<<2|(n=c.charCodeAt(l++))>>6,s=63&n,isNaN(t)?o=s=64:isNaN(n)&&(s=64),a=a+this._base64_keyStr.charAt(i)+this._base64_keyStr.charAt(r)+this._base64_keyStr.charAt(o)+this._base64_keyStr.charAt(s);return a},String.prototype.base64decode=function(){for(var e,t,n,i,r,o,s="",a=0,l=""+this;a<l.length;)e=this._base64_keyStr.indexOf(l.charAt(a++))<<2|(i=this._base64_keyStr.indexOf(l.charAt(a++)))>>4,t=(15&i)<<4|(r=this._base64_keyStr.indexOf(l.charAt(a++)))>>2,n=(3&r)<<6|(o=this._base64_keyStr.indexOf(l.charAt(a++))),s+=String.fromCharCode(e),64!=r&&(s+=String.fromCharCode(t)),64!=o&&(s+=String.fromCharCode(n));return s},String.prototype.md5=function(){if(this.length){return function(e){function a(e,t){return e<<t|e>>>32-t}function l(e,t){var n,i,r,o,s;return r=2147483648&e,o=2147483648&t,s=(1073741823&e)+(1073741823&t),(n=1073741824&e)&(i=1073741824&t)?2147483648^s^r^o:n|i?1073741824&s?3221225472^s^r^o:1073741824^s^r^o:s^r^o}function t(e,t,n,i,r,o,s){return l(a(e=l(e,l(l(function(e,t,n){return e&t|~e&n}(t,n,i),r),s)),o),t)}function n(e,t,n,i,r,o,s){return l(a(e=l(e,l(l(function(e,t,n){return e&n|t&~n}(t,n,i),r),s)),o),t)}function i(e,t,n,i,r,o,s){return l(a(e=l(e,l(l(function(e,t,n){return e^t^n}(t,n,i),r),s)),o),t)}function r(e,t,n,i,r,o,s){return l(a(e=l(e,l(l(function(e,t,n){return t^(e|~n)}(t,n,i),r),s)),o),t)}function o(e){var t,n="",i="";for(t=0;t<=3;t++)n+=(i="0"+(e>>>8*t&255).toString(16)).substr(i.length-2,2);return n}var s,c,u,d,h,m,g,p,f,y=Array();for(y=function(e){for(var t,n=e.length,i=n+8,r=16*(1+(i-i%64)/64),o=Array(r-1),s=0,a=0;a<n;)s=a%4*8,o[t=(a-a%4)/4]=o[t]|e.charCodeAt(a)<<s,a++;return s=a%4*8,o[t=(a-a%4)/4]=o[t]|128<<s,o[r-2]=n<<3,o[r-1]=n>>>29,o}(e=function(e){e=e.replace(/rn/g,"n");for(var t="",n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t+=String.fromCharCode(i):(127<i&&i<2048?t+=String.fromCharCode(i>>6|192):(t+=String.fromCharCode(i>>12|224),t+=String.fromCharCode(i>>6&63|128)),t+=String.fromCharCode(63&i|128))}return t}(e)),m=1732584193,g=4023233417,p=2562383102,f=271733878,s=0;s<y.length;s+=16)g=r(g=r(g=r(g=r(g=i(g=i(g=i(g=i(g=n(g=n(g=n(g=n(g=t(g=t(g=t(g=t(u=g,p=t(d=p,f=t(h=f,m=t(c=m,g,p,f,y[s+0],7,3614090360),g,p,y[s+1],12,3905402710),m,g,y[s+2],17,606105819),f,m,y[s+3],22,3250441966),p=t(p,f=t(f,m=t(m,g,p,f,y[s+4],7,4118548399),g,p,y[s+5],12,1200080426),m,g,y[s+6],17,2821735955),f,m,y[s+7],22,4249261313),p=t(p,f=t(f,m=t(m,g,p,f,y[s+8],7,1770035416),g,p,y[s+9],12,2336552879),m,g,y[s+10],17,4294925233),f,m,y[s+11],22,2304563134),p=t(p,f=t(f,m=t(m,g,p,f,y[s+12],7,1804603682),g,p,y[s+13],12,4254626195),m,g,y[s+14],17,2792965006),f,m,y[s+15],22,1236535329),p=n(p,f=n(f,m=n(m,g,p,f,y[s+1],5,4129170786),g,p,y[s+6],9,3225465664),m,g,y[s+11],14,643717713),f,m,y[s+0],20,3921069994),p=n(p,f=n(f,m=n(m,g,p,f,y[s+5],5,3593408605),g,p,y[s+10],9,38016083),m,g,y[s+15],14,3634488961),f,m,y[s+4],20,3889429448),p=n(p,f=n(f,m=n(m,g,p,f,y[s+9],5,568446438),g,p,y[s+14],9,3275163606),m,g,y[s+3],14,4107603335),f,m,y[s+8],20,1163531501),p=n(p,f=n(f,m=n(m,g,p,f,y[s+13],5,2850285829),g,p,y[s+2],9,4243563512),m,g,y[s+7],14,1735328473),f,m,y[s+12],20,2368359562),p=i(p,f=i(f,m=i(m,g,p,f,y[s+5],4,4294588738),g,p,y[s+8],11,2272392833),m,g,y[s+11],16,1839030562),f,m,y[s+14],23,4259657740),p=i(p,f=i(f,m=i(m,g,p,f,y[s+1],4,2763975236),g,p,y[s+4],11,1272893353),m,g,y[s+7],16,4139469664),f,m,y[s+10],23,3200236656),p=i(p,f=i(f,m=i(m,g,p,f,y[s+13],4,681279174),g,p,y[s+0],11,3936430074),m,g,y[s+3],16,3572445317),f,m,y[s+6],23,76029189),p=i(p,f=i(f,m=i(m,g,p,f,y[s+9],4,3654602809),g,p,y[s+12],11,3873151461),m,g,y[s+15],16,530742520),f,m,y[s+2],23,3299628645),p=r(p,f=r(f,m=r(m,g,p,f,y[s+0],6,4096336452),g,p,y[s+7],10,1126891415),m,g,y[s+14],15,2878612391),f,m,y[s+5],21,4237533241),p=r(p,f=r(f,m=r(m,g,p,f,y[s+12],6,1700485571),g,p,y[s+3],10,2399980690),m,g,y[s+10],15,4293915773),f,m,y[s+1],21,2240044497),p=r(p,f=r(f,m=r(m,g,p,f,y[s+8],6,1873313359),g,p,y[s+15],10,4264355552),m,g,y[s+6],15,2734768916),f,m,y[s+13],21,1309151649),p=r(p,f=r(f,m=r(m,g,p,f,y[s+4],6,4149444226),g,p,y[s+11],10,3174756917),m,g,y[s+2],15,718787259),f,m,y[s+9],21,3951481745),m=l(m,c),g=l(g,u),p=l(p,d),f=l(f,h);return(o(m)+o(g)+o(p)+o(f)).toLowerCase()}(this.toLowerCase())}},String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)},String.prototype.asDate=function(){var e,t=this.split("/");return 3==t.length?e=new Date(t[2],t[1]-1,t[0]):3==(t=this.split("-")).length?e=new Date(t[0],t[1]-1,t[2]):8==this.length&&(e=new Date(this.substring(0,4),this.substring(4,6)-1,this.substring(6,8))),e},String.prototype.formatted=function(){for(var e=this,t=0;t<arguments.length;t++)e=e.replace("%{"+t+"}",arguments[t],"g");return e},String.prototype.isValidEmail=function(){return/^([\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.test(this)},String.prototype.asCSSIdentifier=function(){for(var e=["_","\\.","#","@","\\*",":",","," ","'","&","\\+"],t=["_U_","_D_","_H_","_A_","_S_","_C_","_CO_","_SP_","_SQ_","_AM_","_P_"],n=this,i=0;i<e.length;i++){var r=new RegExp(e[i],"g");n=n.replace(r,t[i])}return n=n.replace(/[^\x00-\x7F]/g,""),/^\d+/.test(n)&&(n="_"+n),n},String.prototype.timeInterval=function(){return"once_per_hour"==this?3600:"every_minute"==this?60:60*parseInt(this.substr(6))},String.prototype.parseDate=function(n,e){var t,i,r,o,s,a,c,u,d,h;for(t=""+this,i=/%[dembByYHIMp]/g,s=new Date,a={year:s.getYear()+1900,month:s.getMonth(),day:s.getDate(),hour:0,minute:0},c={"%d":[/\d\d/,function(e){return a.day=parseInt(e),a.day<32}],"%e":[/ ?\d?\d/,function(e){return a.day=parseInt(e),a.day<32}],"%m":[/\d\d/,function(e){return a.month=parseInt(e)-1,a.month<12}],"%b":[/[^\d\s\.\/\-]{2,}/,function(e){var t=_.indexOf(_.map(n.shortMonths,_.toLower),_.toLower(e));return 0<=t&&(a.month=t),0<=t}],"%B":[/[^\d\s\.\/\-]{2,}/,function(e){var t=_.indexOf(_.map(n.months,_.toLower),_.toLower(e));return 0<=t&&(a.month=t),0<=t}],"%y":[/\d\d/,function(e){var t=parseInt(s.getFullYear().toString().substring(2))+5;return a.year=parseInt(e),a.year<t?a.year+=2e3:a.year+=1900,!0}],"%Y":[/[12]\d\d\d/,function(e){return a.year=parseInt(e),!0}],"%H":[/\d{1,2}/,function(e){return a.hour=parseInt(e),a.hour<24}],"%I":[/\d{1,2}/,function(e){return a.hour=parseInt(e),a.hour<=12}],"%M":[/[0-5]\d/,function(e){return a.minute=parseInt(e),a.minute<60}],"%p":[/[^\d\s\/\-]+/,function(e){var t=_.toLower(e),n=_.toLower(l("AM")),i=_.toLower(l("PM"));return t==i&&(a.hour+=12),t==n||t==i}]},r=e.match(i)||[],u=h=0;u<r.length;u++)o=r[u],(d=(t.match(c[o][0])||[])[0])&&(t=t.slice(t.indexOf(d)+d.length),c[o][1](d)&&h++);return r.length===h?new Date(a.year,a.month,a.day,a.hour,a.minute):new Date(NaN)},Date.prototype.clone=function(){var e=new Date;return e.setTime(this.getTime()),e},Date.prototype.daysUpTo=function(e){var t=[],n=this.getTime(),i=e.getTime();if(i<n){var r=n;n=i,i=r}for(var o=Math.round((i-n)/9e7)+1,s=0;s<o;s++){var a=new Date;a.setTime(n+9e7*s),a.setHours(this.getHours()),a.setMinutes(this.getMinutes()),a.setSeconds(this.getSeconds()),a.setMilliseconds(this.getMilliseconds()),t.push(a)}return t},Date.prototype.minutesTo=function(e){return Math.floor(e.valueOf()-this.valueOf())/1e3/60-(e.getTimezoneOffset()-this.getTimezoneOffset())},Date.prototype.stringWithSeparator=function(e){var t=""+(this.getMonth()+1),n=""+this.getDate(),i=this.getYear();return i<1e3&&(i=""+(i+1900)),1==t.length&&(t="0"+t),1==n.length&&(n="0"+n),str="-"==e?i+"-"+t+"-"+n:n+"/"+t+"/"+i,str},Date.prototype.addDays=function(e){var t,n,i;return n=this.getTime(),t=new Date(n),n+=864e5*e,this.setTime(n),0!=(i=this.getTimezoneOffset()-t.getTimezoneOffset())&&(n=this.getTime()+60*i*1e3,this.setTime(n)),this},Date.prototype.addHours=function(e){var t=this.getTime();t+=36e5*e,this.setTime(t)},Date.prototype.addMinutes=function(e){var t=this.getTime();t+=6e4*e,this.setTime(t)},Date.prototype.beginOfDay=function(){var e=new Date(this.getTime());return e.setHours(0),e.setMinutes(0),e.setSeconds(0),e.setMilliseconds(0),e},Date.prototype.dayOfWeek=function(e){var t,n;return t=e.firstDayOfWeek,(n=this.getDay())<t&&(n+=7),n-t},Date.prototype.firstWeekOfYearForDate=function(e){var t,n,i;return t=e.firstWeekOfYear,(i=new Date(this.getTime())).setMonth(0),i.setDate(1),n=i.dayOfWeek(e),"First4DayWeek"==t?n<4?i.beginOfWeek(e.firstDayOfWeek):i.addDays(7).beginOfWeek(e.firstDayOfWeek):"FirstFullWeek"==t?0===n?i.beginOfWeek(e.firstDayOfWeek):i.addDays(7).beginOfWeek(e.firstDayOfWeek):i.beginOfWeek(e.firstDayOfWeek)},Date.prototype.getWeek=function(e){var t,n,i;return(i=new Date(this.getTime())).addDays(6),(t=i.firstWeekOfYearForDate(e)).getTime()<i.getTime()?1+Math.floor((i.getTime()-t.getTime())/6048e5):((n=new Date(i.getTime())).addDays(-7),t=n.firstWeekOfYearForDate(e),2+Math.floor((n.getTime()-t.getTime())/6048e5))},Date.prototype.beginOfWeek=function(e){var t=e-this.getDay();0<t&&(t-=7);var n=this.beginOfDay();return n.setHours(12),n.addDays(t),n},Date.prototype.endOfWeek=function(e){var t=this.beginOfWeek(e);return t.addDays(6),t.setHours(23),t.setMinutes(59),t.setSeconds(59),t.setMilliseconds(999),t},Date.prototype.getDayString=function(){var e=this.getYear();e<1e3&&(e+=1900);var t=""+(this.getMonth()+1);1==t.length&&(t="0"+t),e+=t;var n=""+this.getDate();return 1==n.length&&(n="0"+n),e+=n},Date.prototype.getHourString=function(){var e=this.getHours()+"00";return 3==e.length&&(e="0"+e),e},Date.prototype.format=function(e,t){var n,i,r,o,s=[],a=/%[deaAmbByYUHIMp]/g,c={"%d":this.getDate(),"%e":this.getDate(),"%a":e.shortDays[this.getDay()],"%A":e.days[this.getDay()],"%m":this.getMonth()+1,"%b":e.shortMonths[this.getMonth()],"%B":e.months[this.getMonth()],"%y":this.getFullYear().toString().substring(2),"%Y":this.getFullYear(),"%U":this.getWeek(e),"%H":this.getHours(),"%M":this.getMinutes()};for(c["%I"]=12<c["%H"]?c["%H"]%12:c["%H"],c["%p"]=c["%H"]<12?l("AM"):l("PM"),c["%d"]=(c["%d"]<10?"0":"")+c["%d"],c["%e"]=(c["%e"]<10?" ":"")+c["%e"],c["%m"]=(c["%m"]<10?"0":"")+c["%m"],c["%H"]=(c["%H"]<10?"0":"")+c["%H"],c["%I"]=(c["%I"]<10?"0":"")+c["%I"],c["%M"]=(c["%M"]<10?"0":"")+c["%M"],n=t.replace(a,"\0").split("\0"),r=0,o=(i=t.match(a)).length;r<=o;r++)n.length&&s.push(n.shift()),s.push(c[i[r]]);return s.join("")},Element.prototype.setCaretTo=function(e){if(this.setSelectionRange)this.focus(),this.setSelectionRange(e,e);else if(this.createTextRange){var t=this.createTextRange();t.move("character",e),t.select()}},Element.prototype.selectText=function(e,t){if(this.setSelectionRange)this.setSelectionRange(e,t);else if(this.createTextRange){var n=this.createTextRange();n.moveStart("character",e),n.moveEnd("character",t-element.value.length),n.select()}else this.select()};
|
|
//# sourceMappingURL=Common.js.map
|