var locamail=locamail||{};locamail.utils=function(){"use strict";return{roundNumber:function(t,n){return t.toFixed(n)/1},kbitsToGigabits:function(t){return t/1024/1024},detectIE:function(){var t=window.navigator.userAgent,n=t.indexOf("MSIE ");if(n>0)return parseInt(t.substring(n+5,t.indexOf(".",n)),10);if(t.indexOf("Trident/")>0){var e=t.indexOf("rv:");return parseInt(t.substring(e+3,t.indexOf(".",e)),10)}var a=t.indexOf("Edge/");return a>0&&parseInt(t.substring(a+5,t.indexOf(".",a)),10)},renderAvatarName:function(t){var n=$.trim($(t).text()).toLocaleUpperCase().charAt(0);$(t).html(n)},bindForceCloseDropdown:function(t,n,e){0!==t.length&&$(t).each((function(t,a){a.on(n||"mousedown",e||"",(function(){$(".lm-dropdown-user").removeClass("open")}))}))},setup:function(){$.validator.addMethod("dateGreaterThan",(function(t,n,e){var a;return""===$(e[0]).val()||(a=moment(t,"DD/MM/YYYY").tz(moment.tz.guess()),moment($(e[0]).val(),"DD/MM/YYYY").tz(moment.tz.guess()).diff(a)<0)}),rcmail.gettext("form_validate_greater_than","locamail_translate"))},randomColor:function(){var t=["#75ca17","#3080c7","#429c42","#eb9c35","#31b5db","#9757ad","#1ccbce","#e96827","#3a55a4","#ddb808","#e971cb"];return t[Math.floor(Math.random()*t.length)]},getInitials:function(t){var n="string"==typeof t&&t.length?t.split(" "):"*",e=n[0].substring(0,1);return n.length>1?e+n[n.length-1].substring(0,1):e},encodeBars:function(t){return t&&t.replace(/\\/g,"\\\\")},encodeQuotes:function(t){return t&&t.replace(/"/g,"&quot;")},isImage:function(t){return!("application/octet-stream"!==rcmail.env.attachments[t]||!locamail.utils.hasImageExtension(t))||["image/png","image/svg+xml","image/jpeg","image/gif"].indexOf(rcmail.env.attachments[t])>=0},hasImageExtension:function(t){if(!t)return!1;var n=t.toString().replace(/\./g,"\\.");return!!$("#attach"+n).attr("class").match(/(png|svg|jpg|jpeg|gif)/g)},imageToBase64:function(t,n){var e,a,r;a=(e=document.createElement("canvas")).getContext("2d"),e.width=this.width,e.height=this.height,a.drawImage(this,0,0),r=e.toDataURL(t),n&&"function"==typeof n&&n(r)},handleImage:function(t,n,e){var a=new Image;a.crossOrigin="Anonymous",a.src=t,a.onload=locamail.utils.imageToBase64.bind(a,n,e)},location:function(t){window.location.href=t},emailValidator:function(t){return/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(t)}}}();