text: webpackJsonp([1],{237:function(e,t,s){"use strict";function i(){this.tenants=n.observableArray([]),this.selectedTenantId=n.observable(0),this.selectedTenant=n.computed(function(){return o.find(this.tenants(),function(e){return e.Id===this.selectedTenantId()}.bind(this))||{Name:""}},this),h.dbSettingsChanged.subscribe(function(){h.dbSettingsChanged()&&a.send(u.ServerModuleName,"GetEntityList",{Type:"Tenant"})})}var o=s(2),n=s(44),r=s(181),a=s(191),l=s(182),h=s(43),u=s(238);i.prototype.init=function(e){l.subscribeEvent("ReceiveAjaxResponse::after",this.onAjaxResponse.bind(this));var t=e[u.ServerModuleName];this.parseTenants(t?t.Tenants:[])},i.prototype.onAjaxResponse=function(e){if(e.Response.Module===u.ServerModuleName&&"GetEntityList"===e.Response.Method&&"Tenant"===e.Request.Parameters.Type){var t=r.pString(e.Request.Parameters.Search),s=r.pInt(e.Request.Parameters.Offset);""===t&&0===s&&this.parseTenants(e.Response.Result)}},i.prototype.setSelectedTenant=function(e){o.find(this.tenants(),function(t){return t.Id===e})&&this.selectedTenantId(e)},i.prototype.parseTenants=function(e){var t=this.selectedTenantId(),s=!1,i=e&&o.isArray(e.Items)?e.Items:[],n=[];o.each(i,function(e){var i={Name:e.Name,Id:r.pInt(e.Id)};i.Id===t&&(s=!0),n.push(i)}),s||this.selectedTenantId(n.length>0?n[0].Id:0),this.tenants(n)},e.exports=new i},238:function(e,t,s){"use strict";var i=s(2),o=s(181);e.exports={ServerModuleName:"AdminPanelWebclient",HashModuleName:"admin",EntitiesPerPage:20,TabsOrder:["licensing","admin-security","admin-db","logs-viewer","system","common","modules"],EntitiesOrder:[],EnableMultiTenant:!1,init:function(e){var t=e[this.ServerModuleName],s=e.Core;i.isEmpty(t)||(this.EntitiesPerPage=o.pPositiveInt(t.EntitiesPerPage,this.EntitiesPerPage),this.TabsOrder=o.pArray(t.TabsOrder,this.TabsOrder),this.EntitiesOrder=o.pArray(t.EntitiesOrder,this.EntitiesOrder)),i.isEmpty(s)||(this.EnableMultiTenant=o.pBool(s.EnableMultiTenant,this.EnableMultiTenant))}}},239:function(e,t,s){"use strict";function i(e){this.sServerModule=e?e:"Core",this.isSaving=n.observable(!1),this.visible=n.observable(!0),this.sSavedState="",this.bShown=!1,this.aSettingsSections=[]}var o=s(2),n=s(44),r=s(185),a=s(191),l=s(186),h=s(188),u=s(192),c=s(201);i.prototype.ViewTemplate="",i.prototype.addSettingsSection=function(e){this.aSettingsSections.push(e)},i.prototype.onRoute=function(e){var t=!this.bShown;this.bShown=!0,t&&o.isFunction(this.onShow)&&this.onShow(),this.revert(),o.isFunction(this.onRouteChild)&&this.onRouteChild(e),o.each(this.aSettingsSections,function(t){o.isFunction(t.onShow)&&t.onShow(e)})},i.prototype.hide=function(e,t){var s=this.getCurrentState()!==this.sSavedState;o.each(this.aSettingsSections,function(e){o.isFunction(e.getCurrentState)&&(s=s||e.getCurrentState()!==e.sSavedState)}),s?u.showPopup(c,[r.i18n("COREWEBCLIENT/CONFIRM_DISCARD_CHANGES"),o.bind(function(s){s?(this.bShown=!1,e(),this.revert()):o.isFunction(t)&&t()},this)]):(this.bShown=!1,e())},i.prototype.getCurrentValues=function(){return[]},i.prototype.getCurrentState=function(){var e=this.getCurrentValues();return e.join(":")},i.prototype.updateSavedState=function(){this.sSavedState=this.getCurrentState()},i.prototype.revertGlobalValues=function(){},i.prototype.revert=function(){o.each(this.aSettingsSections,function(e){o.isFunction(e.revert)&&e.revert()}),this.revertGlobalValues(),this.updateSavedState()},i.prototype.getParametersForSave=function(){return{}},i.prototype.save=function(){o.isFunction(this.validateBeforeSave)&&!this.validateBeforeSave()||(this.isSaving(!0),a.send(this.sServerModule,"UpdateSettings",this.getParametersForSave(),this.onResponse,this))},i.prototype.applySavedValues=function(e){},i.prototype.onResponse=function(e,t){if(this.isSaving(!1),e.Result){var s=t.Parameters;this.updateSavedState(),this.applySavedValues(s),h.showReport(r.i18n("COREWEBCLIENT/REPORT_SETTINGS_UPDATE_SUCCESS"))}else l.showErrorByCode(e,r.i18n("COREWEBCLIENT/ERROR_SAVING_SETTINGS_FAILED"))},i.prototype.setAccessLevel=function(e,t){},e.exports=i},240:function(e,t,s){"use strict";function i(e){return u===e.substr(0,1)&&/^[1-9][\d]*$/.test(e.substr(u.length))}function o(e){return h===e.substr(0,h.length)}var n=s(2),r=s(181),a=s(241),l=s(238),h="s.",u="p.",c={};c.get=function(e,t,s,i,o){var c=[l.HashModuleName],d=!0;return t=t||[],n.each(a.getData(),function(s){d&&(r.isPositiveNumber(t[s.Type])?"User"===s.Type&&"MailingList"===e||c.push(s.ScreenHash.substr(0,1)+t[s.Type]):e===s.Type&&c.push(s.ScreenHash),e===s.Type&&(d=!1))}),r.isPositiveNumber(i)&&i>1&&c.push(u+i),r.isNonEmptyString(o)&&c.push(h+o),r.isNonEmptyString(s)&&c.push(s),c},c.parse=function(e){var t=0,s={},l="",c=1,d="",p="";return n.each(a.getData(),function(n){e[t]&&n.ScreenHash===e[t]&&(l=n.Type,t++),e[t]&&n.ScreenHash.substr(0,1)===e[t].substr(0,1)&&r.pInt(e[t].substr(1))>0&&(s[n.Type]=r.pInt(e[t].substr(1)),l=n.Type,t++),e.length>t&&(p=r.pString(e[t]),i(p)&&(c=r.pInt(p.substr(u.length)),c<=0&&(c=1),t++)),e.length>t&&(p=r.pString(e[t]),o(p)&&(d=p.substr(h.length),t++))}),{Entities:s,CurrentType:l,Last:r.isNonEmptyString(e[t])?e[t]:"",Page:c,Search:d}},e.exports=c},241:function(e,t,s){"use strict";function i(){this.aData=[],r.EnableMultiTenant&&this.aData.push({Type:"Tenant",ScreenHash:"tenants",LinkTextKey:"ADMINPANELWEBCLIENT/HEADING_TENANTS_SETTINGS_TABNAME",EditView:s(242),ServerModuleName:r.ServerModuleName,GetListRequest:"GetEntityList",GetRequest:"GetEntity",CreateRequest:"CreateTenant",UpdateRequest:"UpdateEntity",DeleteRequest:"DeleteEntities",NoEntitiesFoundText:n.i18n("ADMINPANELWEBCLIENT/INFO_NO_ENTITIES_FOUND_TENANT"),ActionCreateText:n.i18n("ADMINPANELWEBCLIENT/ACTION_CREATE_ENTITY_TENANT"),ReportSuccessCreateText:n.i18n("ADMINPANELWEBCLIENT/REPORT_CREATE_ENTITY_TENANT"),ErrorCreateText:n.i18n("ADMINPANELWEBCLIENT/ERROR_CREATE_ENTITY_TENANT"),CommonSettingsHeadingText:n.i18n("COREWEBCLIENT/HEADING_COMMON_SETTINGS"),ReportSuccessUpdate:n.i18n("ADMINPANELWEBCLIENT/REPORT_UPDATE_ENTITY_TENANT"),ErrorUpdate:n.i18n("ADMINPANELWEBCLIENT/ERROR_UPDATE_ENTITY_TENANT"),ActionDeleteText:n.i18n("ADMINPANELWEBCLIENT/ACTION_DELETE_TENANT"),ConfirmDeleteLangConst:"ADMINPANELWEBCLIENT/CONFIRM_DELETE_TENANT_PLURAL",ReportSuccessDeleteLangConst:"ADMINPANELWEBCLIENT/REPORT_DELETE_ENTITIES_TENANT_PLURAL",ErrorDeleteLangConst:"ADMINPANELWEBCLIENT/ERROR_DELETE_ENTITIES_TENANT_PLURAL"}),this.aData.push({Type:"User",ScreenHash:"users",LinkTextKey:"ADMINPANELWEBCLIENT/HEADING_USERS_SETTINGS_TABNAME",EditView:s(243),ServerModuleName:r.ServerModuleName,GetListRequest:"GetEntityList",GetRequest:"GetEntity",CreateRequest:"CreateUser",UpdateRequest:"UpdateEntity",DeleteRequest:"DeleteEntities",NoEntitiesFoundText:n.i18n("ADMINPANELWEBCLIENT/INFO_NO_ENTITIES_FOUND_USER"),ActionCreateText:n.i18n("ADMINPANELWEBCLIENT/ACTION_CREATE_ENTITY_USER"),ReportSuccessCreateText:n.i18n("ADMINPANELWEBCLIENT/REPORT_CREATE_ENTITY_USER"),ErrorCreateText:n.i18n("ADMINPANELWEBCLIENT/ERROR_CREATE_ENTITY_USER"),CommonSettingsHeadingText:n.i18n("COREWEBCLIENT/HEADING_COMMON_SETTINGS"),ReportSuccessUpdate:n.i18n("ADMINPANELWEBCLIENT/REPORT_UPDATE_ENTITY_USER"),ErrorUpdate:n.i18n("ADMINPANELWEBCLIENT/ERROR_UPDATE_ENTITY_USER"),ActionDeleteText:n.i18n("ADMINPANELWEBCLIENT/ACTION_DELETE_USER"),ConfirmDeleteLangConst:"ADMINPANELWEBCLIENT/CONFIRM_DELETE_USER_PLURAL",ReportSuccessDeleteLangConst:"ADMINPANELWEBCLIENT/REPORT_DELETE_ENTITIES_USER_PLURAL",ErrorDeleteLangConst:"ADMINPANELWEBCLIENT/ERROR_DELETE_ENTITIES_USER_PLURAL"}),this.sortEntitiesData()}var o=s(2),n=s(185),r=s(238);i.prototype.getData=function(){return this.aData},i.prototype.getEntityData=function(e){return o.find(this.aData,function(t){return t.Type===e})},i.prototype.getEditView=function(e){var t=this.getEntityData(e);return t?t.EditView:null},i.prototype.registerEntityType=function(e){this.aData.push(e),this.sortEntitiesData()},i.prototype.sortEntitiesData=function(){this.aData=o.sortBy(this.aData,function(e){var t=o.indexOf(r.EntitiesOrder,e.Type);return t!==-1?t:r.EntitiesOrder.length})},i.prototype.changeEntityData=function(e){var t=this.getEntityData(e.Type);t&&o.each(e,function(e,s){t[s]=e})},e.exports=new i},242:function(e,t,s){(function(t){"use strict";function i(e){var t=l.pArray(window.auroraAppData&&window.auroraAppData.additional_entity_fields_to_edit);return n.filter(t,function(t){return t.value=r.observable(""),t.Entity===e})}function o(){this.id=r.observable(0),this.name=r.observable(""),this.description=r.observable(""),this.webDomain=r.observable(""),this.siteName=r.observable(""),this.sHeading=a.i18n("ADMINPANELWEBCLIENT/HEADING_CREATE_TENANT"),this.sActionCreate=a.i18n("COREWEBCLIENT/ACTION_CREATE"),this.sActionCreateInProgress=a.i18n("COREWEBCLIENT/ACTION_CREATE_IN_PROGRESS"),this.aAdditionalFields=i("Tenant")}var n=s(2),r=s(44),a=s(185),l=s(181),h=s(188);o.prototype.ViewTemplate="AdminPanelWebclient_EditTenantView",o.prototype.getCurrentValues=function(){var e=[this.id(),this.name(),this.description(),this.webDomain(),this.siteName()];return n.each(this.aAdditionalFields,function(t){e.push(t.value())}),e},o.prototype.clearFields=function(){this.id(0),this.name(""),this.description(""),this.webDomain(""),this.siteName(""),n.each(this.aAdditionalFields,function(e){e.value("")})},o.prototype.parse=function(e,t){t?(this.id(e),this.name(t.Name),this.description(t.Description),this.webDomain(t.WebDomain),this.siteName(t.SiteName),n.each(this.aAdditionalFields,function(e){e.value(l.pString(t[e.FieldName]))})):this.clearFields()},o.prototype.isValidSaveData=function(){return""===t.trim(this.name())?(h.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_TENANT_NAME_EMPTY")),!1):!/[\\\/\:\*\?\\\"\<\>\|]/gi.test(this.name())||(h.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_TENANT_NAME_INVALID")),!1)},o.prototype.getParametersForSave=function(){var e={Id:this.id(),Name:this.name(),Description:this.description(),WebDomain:this.webDomain(),SiteName:this.siteName()};return n.each(this.aAdditionalFields,function(t){e[t.FieldName]=t.value()}),e},e.exports=new o}).call(t,s(1))},243:function(e,t,s){"use strict";function i(){this.id=r.observable(0),this.publicId=r.observable(""),this.aRoles=[{text:a.i18n("ADMINPANELWEBCLIENT/LABEL_ADMINISTRATOR"),value:Enums.UserRole.SuperAdmin},{text:a.i18n("ADMINPANELWEBCLIENT/LABEL_USER"),value:Enums.UserRole.NormalUser},{text:a.i18n("ADMINPANELWEBCLIENT/LABEL_GUEST"),value:Enums.UserRole.Customer}],this.role=r.observable(Enums.UserRole.NormalUser),this.writeSeparateLog=r.observable(!1),this.sHeading=a.i18n("ADMINPANELWEBCLIENT/HEADING_CREATE_USER"),this.sActionCreate=a.i18n("COREWEBCLIENT/ACTION_CREATE"),this.sActionCreateInProgress=a.i18n("COREWEBCLIENT/ACTION_CREATE_IN_PROGRESS"),h.broadcastEvent("AdminPanelWebclient::ConstructView::after",{Name:this.ViewConstructorName,View:this})}var o=s(2),n=s(1),r=s(44),a=s(185),l=s(188),h=s(182);i.prototype.ViewTemplate="AdminPanelWebclient_EditUserView",i.prototype.ViewConstructorName="CEditUserView",i.prototype.getCurrentValues=function(){return[this.id(),this.publicId(),this.role(),this.writeSeparateLog()]},i.prototype.clearFields=function(){this.id(0),this.publicId(""),this.role(Enums.UserRole.NormalUser),this.writeSeparateLog(!1)},i.prototype.parse=function(e,t){t?(this.id(e),this.publicId(t.PublicId),this.role(t.Role),this.writeSeparateLog(!!t.WriteSeparateLog)):this.clearFields()},i.prototype.isValidSaveData=function(){var e=""!==n.trim(this.publicId());return e||l.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_USER_NAME_EMPTY")),e},i.prototype.getParametersForSave=function(){return{Id:this.id(),PublicId:n.trim(this.publicId()),Role:this.role(),WriteSeparateLog:this.writeSeparateLog()}},i.prototype.saveEntity=function(e,t){o.each(e,function(e){"CEntitiesView"===e.constructor.name&&o.isFunction(e.createEntity)&&e.createEntity(),"CCommonSettingsPaneView"===e.constructor.name&&o.isFunction(e.save)&&e.save(t)})},e.exports=new i},244:function(e,t,s){"use strict";function i(){p.call(this,"AdminPanelWebclient"),this.tenants=g.tenants,this.selectedTenant=g.selectedTenant,this.currentEntityType=r.observable(""),this.currentEntitiesId=r.observable({}),this.lastSavedEntitiesId=r.observable({}),this.showTenantsSelector=r.computed(function(){return b.EnableMultiTenant&&this.tenants().length>1},this),this.aScreens=[{linkHash:r.observable(d.buildHashFromArray(m.get(""))),sLinkText:l.i18n("ADMINPANELWEBCLIENT/HEADING_SYSTEM_SETTINGS_TABNAME"),sType:"",oView:null}],o.each(f.getData(),o.bind(function(e){var t=new v(e.Type),s=o.bind(function(e,t,s){if("create"===s)this.createEntity();else if(e===this.currentEntityType())this.changeEntity(e,t,s||"");else{var i=o.clone(this.currentEntitiesId());h.isNumber(t)?e&&(i[e]=t,delete i[this.currentEntityType()]):i[e]&&delete i[e],d.replaceHash(m.get(this.currentEntityType(),i,""))}},this);t.setChangeEntityHandler(s),this.aScreens.push({linkHash:r.computed(function(){var t=o.clone(this.lastSavedEntitiesId());return o.extend(t,this.currentEntitiesId()),d.buildHashFromArray(m.get(e.Type,t))},this),sLinkText:l.i18n(e.LinkTextKey),sType:e.Type,oView:t})},this)),this.currentEntitiesView=r.computed(function(){var e=this.currentEntityType(),t=o.find(this.aScreens,function(t){return t.sType===e});return t?t.oView:null},this),this.currentEntitiesView.subscribe(function(){this.currentEntitiesView()&&this.currentEntitiesView().onHide()},this,"beforeChange"),this.currentEntitiesView.subscribe(function(){this.currentEntitiesView()&&this.currentEntitiesView().onShow()},this),this.tabs=r.observableArray([]),this.visibleTabsCount=r.computed(function(){var e=0;return o.each(this.tabs(),function(t){t.view&&(void 0===t.view.visible||t.view.visible())&&e++}),e},this),this.showModulesTabs=r.computed(function(){return""===this.currentEntityType()||this.currentEntitiesView().hasSelectedEntity()},this),this.currentTab=r.observable(null),this.aStartErrors=[],u.subscribeEvent("SendAjaxRequest::before",this.onAjaxSend.bind(this)),u.broadcastEvent("AdminPanelWebclient::ConstructView::after",{Name:this.ViewConstructorName,View:this})}var o=s(2),n=s(1),r=s(44),a=s(3),l=s(185),h=s(181),u=s(182),c=s(188),d=s(195),p=s(198),m=s(240),g=s(237),f=s(241),b=s(238),v=s(245);o.extendOwn(i.prototype,p.prototype),i.prototype.ViewTemplate="AdminPanelWebclient_SettingsView",i.prototype.ViewConstructorName="CSettingsView",i.prototype.onAjaxSend=function(e){""===this.currentEntityType()||e.Parameters.TenantId||(e.Parameters.TenantId=g.selectedTenantId())},i.prototype.selectTenant=function(e){var t=o.clone(this.currentEntitiesId());t.Tenant=e,d.setHash(m.get(this.currentEntityType(),t))},i.prototype.registerTab=function(e,t,s){if(o.isFunction(e)){var i=this.tabs;return new a(e).then(function(e){i.push({view:e,name:t,title:s})},function(e){})}return!1},i.prototype.sortRegisterTabs=function(){this.tabs(o.sortBy(this.tabs(),function(e){var t=o.indexOf(b.TabsOrder,e.name);return t!==-1?t:b.TabsOrder.length}))},i.prototype.registerTabSection=function(e,t){var s=o.findWhere(this.tabs(),{name:t}),i=e();s&&s.view.addSettingsSection(i)},i.prototype.cancelCreatingEntity=function(){d.setHash(m.get(this.currentEntityType(),this.currentEntitiesId(),""))},i.prototype.createEntity=function(){var e=o.clone(this.currentEntitiesId());delete e[this.currentEntityType()],"Tenant"!==this.currentEntityType()&&!e.Tenant&&g.selectedTenantId()&&(e.Tenant=g.selectedTenantId()),d.setHash(m.get(this.currentEntityType(),e,"create"))},i.prototype.changeEntity=function(e,t,s){var i=o.clone(this.currentEntitiesId()),n=!!o.find(this.tabs(),function(e){return e.name===s}),r=this.currentTab()?this.currentTab().name:"";e&&(i[e]=t),"Tenant"!==e&&g.selectedTenantId()&&(i.Tenant=g.selectedTenantId()),d.setHash(m.get(e,i,n?s:r))},i.prototype.onBind=function(){o.each(this.tabs(),o.bind(function(e){if(e.view&&o.isFunction(e.view.getStartError)){var t=e.view.getStartError();o.isFunction(t)&&(t.subscribe(function(){this.showStartError()},this),this.aStartErrors.push(t))}},this)),this.showStartError()},i.prototype.showStartError=function(){var e=[];o.each(this.aStartErrors,function(t){var s=t();""!==s&&e.push(s)}),c.showError(e.join("<br /><br />"),!0)},i.prototype.onRoute=function(e){var t=m.parse(e),s=e.slice(1),i=this.currentEntityType()===t.CurrentType,r=this.currentEntitiesId()[t.CurrentType]===t.Entities[t.CurrentType],a=this.currentTab()&&this.currentTab().name===t.Last,l=JSON.stringify(this.currentEntitiesId())===JSON.stringify(t.Entities),h=this.currentTab(),u=o.bind(function(){this.showNewScreenView(t),this.showNewTabView(t.Last,s)},this),c=o.bind(function(){h&&d.replaceHashDirectly(m.get(this.currentEntityType(),this.currentEntitiesId(),this.currentTab()?this.currentTab().name:""))},this);i&&r&&a&&l?h&&h.view.onRoute(s,this.currentEntitiesId()):h&&n.isFunction(h.view.hide)?h.view.hide(u,c):u()},i.prototype.showNewScreenView=function(e){var t=o.find(this.aScreens,function(t){return t.sType===e.CurrentType});this.currentEntityType(e.CurrentType),this.currentEntitiesId(e.Entities),o.isEmpty(e.Entities)||this.lastSavedEntitiesId(e.Entities),g.setSelectedTenant(e.Entities.Tenant),t&&t.oView&&("create"===e.Last?t.oView.openCreateForm():t.oView.cancelCreatingEntity(),t.oView.changeEntity(e.Entities[e.CurrentType],e.Entities))},i.prototype.showNewTabView=function(e,t){o.each(this.tabs(),o.bind(function(e){e.view&&o.isFunction(e.view.setAccessLevel)&&e.view.setAccessLevel(this.currentEntityType(),this.currentEntitiesId()[this.currentEntityType()])},this));var s=o.find(this.tabs(),function(t){return t.name===e});s&&s.view&&s.view.visible()||(s=o.find(this.tabs(),function(e){return e.view&&e.view.visible()})),s&&(n.isFunction(s.view.onRoute)&&s.view.onRoute(t,this.currentEntitiesId()),this.currentTab(s))},i.prototype.changeTab=function(e){var t=this.currentEntityType()?this.currentEntitiesId():{};d.setHash(m.get(this.currentEntityType(),t,e))},i.prototype.logout=function(){u.logout()},i.prototype.deleteCurrentEntity=function(){this.currentEntitiesView()&&this.currentEntitiesView().deleteCurrentEntity()},i.prototype.setAddHash=function(e){d.setHash(o.union([b.HashModuleName,this.currentTab()?this.currentTab().name:""],e))},e.exports=new i},245:function(e,t,s){"use strict";function i(e){g.selectedTenantId.subscribe(function(){"Tenant"!==this.sType&&this.requestEntities()},this),this.sType=e,this.oEntityCreateView=f.getEditView(this.sType),this.oEntityData=f.getEntityData(this.sType),this.sActionCreateText=this.oEntityData.ActionCreateText,this.sNoEntitiesFoundText=this.oEntityData.NoEntitiesFoundText,this.entities=n.observableArray([]),this.aFilters=[],this.initFilters(),this.totalEntitiesCount=n.observable(0),this.current=n.observable(0),this.showCreateForm=n.observable(!1),this.isCreating=n.observable(!1),this.hasSelectedEntity=n.computed(function(){var e=o.map(this.entities(),function(e){return e.Id});return o.indexOf(e,this.current())!==-1},this),this.justCreatedId=n.observable(0),this.fChangeEntityHandler=function(){},n.computed(function(){0===this.justCreatedId()&&!this.showCreateForm()&&!this.hasSelectedEntity()&&this.entities().length>0&&this.fChangeEntityHandler(this.sType,this.entities()[0].Id)},this).extend({throttle:1}),this.checkedEntities=n.computed(function(){return o.filter(this.entities(),function(e){return e.checked()},this)},this),this.hasCheckedEntities=n.computed(function(){return this.checkedEntities().length>0},this),this.deleteCommand=l.createCommand(this,this.deleteCheckedEntities,this.hasCheckedEntities),this.selectedCount=n.computed(function(){return this.checkedEntities().length},this),this.searchValue=n.observable(""),this.newSearchValue=n.observable(""),this.isSearchFocused=n.observable(!1),this.loading=n.observable(!1),this.searchText=n.computed(function(){return r.i18n("ADMINPANELWEBCLIENT/INFO_SEARCH_RESULT",{SEARCH:this.searchValue()})},this),this.oPageSwitcher=new d(0,b.EntitiesPerPage),this.oPageSwitcher.currentPage.subscribe(function(){this.requestEntities()},this),this.totalEntitiesCount.subscribe(function(){this.oPageSwitcher.setCount(this.totalEntitiesCount())},this),this.aIdListDeleteProcess=[],this.aAdditionalButtons=[],this.initAdditionalButtons()}var o=s(2),n=s(44),r=s(185),a=s(181),l=s(217),h=s(191),u=s(186),c=s(188),d=s(246),p=s(192),m=s(201),g=s(237),f=s(241),b=s(238);i.prototype.ViewTemplate="AdminPanelWebclient_EntitiesView",i.prototype.CreateFormViewTemplate="AdminPanelWebclient_EntityCreateFormView",i.prototype.onShow=function(){this.bShown=!0,this.requestEntities()},i.prototype.onHide=function(){this.bShown=!1},i.prototype.search=function(){this.oPageSwitcher.setPage(1,b.EntitiesPerPage),this.requestEntities()},i.prototype.clearSearch=function(){this.newSearchValue(""),this.requestEntities()},i.prototype.initFilters=function(){o.each(this.oEntityData.Filters,function(e){var t={list:n.computed(function(){var t=[];return o.isFunction(e.mList)?(t=e.mList(),o.isArray(t)||(t=[])):o.isArray(e.mList)&&(t=e.mList),t.length>0&&(e.sAllText&&t.unshift({text:e.sAllText,value:-1}),e.sNotInAnyText&&t.push({text:e.sNotInAnyText,value:0})),t},this),selectedValue:n.observable(-1),requestValue:n.observable(-1),sAllText:e.sAllText,sFileld:e.sField,sEntity:e.sEntity};t.selectedValue.subscribe(function(){t.sEntity?this.fChangeEntityHandler(t.sEntity,t.selectedValue()):t.requestValue(t.selectedValue())},this),t.requestValue.subscribe(function(){this.requestEntities()},this),this.aFilters.push(t)}.bind(this))},i.prototype.initAdditionalButtons=function(){o.each(this.oEntityData.AdditionalButtons,function(e){e&&e.ButtonView&&(o.isFunction(e.ButtonView.init)&&e.ButtonView.init(this.hasCheckedEntities,this.checkedEntities),this.aAdditionalButtons.push(e))}.bind(this))},i.prototype.requestEntities=function(){if(this.bShown&&("Tenant"===this.sType||a.isPositiveNumber(g.selectedTenantId()))){var e={TenantId:g.selectedTenantId(),Type:this.sType,Offset:(this.oPageSwitcher.currentPage()-1)*b.EntitiesPerPage,Limit:b.EntitiesPerPage,Search:this.newSearchValue()};o.each(this.aFilters,function(t){e[t.sFileld]=t.requestValue()}),this.searchValue(this.newSearchValue()),this.loading(!0),h.send(this.oEntityData.ServerModuleName,this.oEntityData.GetListRequest,e,function(e){if(this.loading(!1),e.Result){var t=o.isArray(e.Result.Items)?e.Result.Items:[],s=[],i=a.pInt(e.Result.Count);o.each(t,function(e){e&&e.Id&&(e.Id=a.pInt(e.Id),e.checked=n.observable(!1),e.trottleChecked=function(e,t){t.stopPropagation(),this.checked(!this.checked())},s.push(e))}),this.entities(s),this.totalEntitiesCount(i),0===this.entities().length?this.fChangeEntityHandler(this.sType,void 0,"create"):0!==this.justCreatedId()&&this.fChangeEntityHandler(this.sType,this.justCreatedId()),this.aIdListDeleteProcess=[]}else u.showErrorByCode(e),this.entities([])},this)}},i.prototype.setChangeEntityHandler=function(e){this.fChangeEntityHandler=e},i.prototype.changeEntity=function(e,t){o.each(this.aFilters,function(e){t[e.sEntity]?(e.selectedValue(t[e.sEntity]),e.requestValue(t[e.sEntity])):e.requestValue()===-1&&0===e.requestValue()||(e.selectedValue()===-1||0===e.selectedValue()?e.requestValue(e.selectedValue()):(e.selectedValue(-1),e.requestValue(-1)))}.bind(this)),this.current(a.pInt(e)),this.justCreatedId(0)},i.prototype.openCreateForm=function(){this.showCreateForm(!0),this.oEntityCreateView.clearFields()},i.prototype.cancelCreatingEntity=function(){this.showCreateForm(!1)},i.prototype.createEntity=function(){if(this.oEntityCreateView&&("Tenant"===this.sType||a.isPositiveNumber(g.selectedTenantId()))&&(!o.isFunction(this.oEntityCreateView.isValidSaveData)||this.oEntityCreateView.isValidSaveData())){var e=this.oEntityCreateView.getParametersForSave();e.TenantId=g.selectedTenantId(),this.isCreating(!0),h.send(this.oEntityData.ServerModuleName,this.oEntityData.CreateRequest,e,function(e){e.Result?(c.showReport(this.oEntityData.ReportSuccessCreateText),this.justCreatedId(a.pInt(e.Result)),this.oEntityCreateView.updateSavedState(),this.cancelCreatingEntity()):u.showErrorByCode(e,this.oEntityData.ErrorCreateText),this.requestEntities(),this.isCreating(!1)},this),this.oEntityCreateView.clearFields()}},i.prototype.deleteCurrentEntity=function(){this.deleteEntities([this.current()])},i.prototype.deleteCheckedEntities=function(){var e=o.map(this.checkedEntities(),function(e){return e.Id});this.deleteEntities(e)},i.prototype.deleteEntities=function(e){if(a.isNonEmptyArray(this.aIdListDeleteProcess)?(e=o.difference(e,this.aIdListDeleteProcess),this.aIdListDeleteProcess=o.union(e,this.aIdListDeleteProcess)):this.aIdListDeleteProcess=e,e.length>0){var t="",s=1===e.length?o.find(this.entities(),function(t){return t.Id===e[0]}):null;s&&(t=s.Name),p.showPopup(m,[r.i18n(this.oEntityData.ConfirmDeleteLangConst,{},null,e.length),o.bind(this.confirmedDeleteEntities,this,e),t,r.i18n("COREWEBCLIENT/ACTION_DELETE")])}},i.prototype.confirmedDeleteEntities=function(e,t){if(t&&a.isPositiveNumber(g.selectedTenantId())){var s={TenantId:g.selectedTenantId(),Type:this.sType,IdList:e};h.send(this.oEntityData.ServerModuleName,this.oEntityData.DeleteRequest,s,function(t){t.Result?c.showReport(r.i18n(this.oEntityData.ReportSuccessDeleteLangConst,{},null,e.length)):c.showError(r.i18n(this.oEntityData.ErrorDeleteLangConst,{},null,e.length)),this.requestEntities()},this)}else this.aIdListDeleteProcess=[]},i.prototype.groupCheck=function(){var e=!this.hasCheckedEntities();o.each(this.entities(),function(t){t.checked(e)})},e.exports=i},246:function(e,t,s){"use strict";function i(e,t){this.bShown=!1,this.currentPage=r.observable(1),this.count=r.observable(e),this.perPage=r.observable(t),this.firstPage=r.observable(1),this.lastPage=r.observable(1),this.pagesCount=r.computed(function(){var e=this.perPage()>0?Math.ceil(this.count()/this.perPage()):0;return e>0?e:1},this),r.computed(function(){var e=20,t=4,s=this.pagesCount(),i=this.currentPage(),o=i,n=i;if(s>1)for(;;){if(e--,1<o&&(o--,t--),0===t)break;if(s>n&&(n++,t--),0===t)break;if(0===e)break}this.firstPage(o),this.lastPage(n)},this),this.visibleFirst=r.computed(function(){return this.firstPage()>1},this),this.visibleLast=r.computed(function(){return this.lastPage()<this.pagesCount()},this),this.clickPage=o.bind(this.clickPage,this),this.pages=r.computed(function(){var e=this.firstPage(),t=[];if(this.firstPage()<this.lastPage())for(;e<=this.lastPage();e++)t.push({number:e,current:e===this.currentPage(),clickFunc:this.clickPage});return t},this),l.isMobile()||this.hotKeysBind()}var o=s(2),n=s(1),r=s(44),a=s(217),l=s(182);i.prototype.ViewTemplate="CoreWebclient_PageSwitcherView",i.prototype.hotKeysBind=function(){n(document).on("keydown",n.proxy(function(e){if(this.bShown&&!a.isTextFieldFocused()){var t=e.keyCode;e.ctrlKey&&t===Enums.Key.Left?this.clickPreviousPage():e.ctrlKey&&t===Enums.Key.Right&&this.clickNextPage()}},this))},i.prototype.hide=function(){this.bShown=!1},i.prototype.show=function(){this.bShown=!0},i.prototype.clear=function(){this.currentPage(1),this.count(0)},i.prototype.setCount=function(e){this.count(e),this.currentPage()>this.pagesCount()&&this.currentPage(this.pagesCount())},i.prototype.setPage=function(e,t){this.perPage(t),e>this.pagesCount()?this.currentPage(this.pagesCount()):this.currentPage(e)},i.prototype.clickPage=function(e){var t=e.number;t<1&&(t=1),t>this.pagesCount()&&(t=this.pagesCount()),this.currentPage(t)},i.prototype.clickFirstPage=function(){this.currentPage(1)},i.prototype.clickPreviousPage=function(){var e=this.currentPage()-1;e<1&&(e=1),this.currentPage(e)},i.prototype.clickNextPage=function(){var e=this.currentPage()+1;e>this.pagesCount()&&(e=this.pagesCount()),this.currentPage(e)},i.prototype.clickLastPage=function(){this.currentPage(this.pagesCount())},e.exports=i},247:function(e,t,s){"use strict";function i(){c.call(this,h.ServerModuleName),this.sFakePass="xxxxxxxxxx",this.dbLogin=r.observable(h.DbLogin),this.dbPassword=r.observable(this.sFakePass),this.dbName=r.observable(h.DbName),this.dbHost=r.observable(h.DbHost),this.startError=r.observable(""),this.setStartError()}var o=s(2),n=s(1),r=s(44),a=s(185),l=s(188),h=s(43),u=s(248),c=s(239),d=s(192),p=s(201);o.extendOwn(i.prototype,c.prototype),i.prototype.ViewTemplate="AdminPanelWebclient_DbAdminSettingsView",i.prototype.setStartError=function(){this.startError(""===h.DbLogin||""===h.DbName||""===h.DbHost?a.i18n("ADMINPANELWEBCLIENT/ERROR_DB_ACCESS"):"")},i.prototype.getStartError=function(){return this.startError},i.prototype.getCurrentValues=function(){return[this.dbLogin(),this.dbPassword(),this.dbName(),this.dbHost()]},i.prototype.revertGlobalValues=function(){this.dbLogin(h.DbLogin),this.dbPassword(this.sFakePass),this.dbName(h.DbName),this.dbHost(h.DbHost)},i.prototype.getParametersForSave=function(){return this.dbPassword()===this.sFakePass?{DbLogin:n.trim(this.dbLogin()),DbName:n.trim(this.dbName()),DbHost:n.trim(this.dbHost())}:{DbLogin:n.trim(this.dbLogin()),DbPassword:n.trim(this.dbPassword()),DbName:n.trim(this.dbName()),DbHost:n.trim(this.dbHost())}},i.prototype.applySavedValues=function(e){h.updateDb(e.DbLogin,e.DbName,e.DbHost),this.setStartError()},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},i.prototype.testConnection=function(){u.send("TestDbConnection",this.getParametersForSave(),function(e){e.Result?l.showReport(a.i18n("ADMINPANELWEBCLIENT/REPORT_DB_CONNECT_SUCCESSFUL")):l.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_DB_CONNECT_FAILED"))},this)},i.prototype.createTables=function(){var e=function(){u.send("CreateTables",null,function(e){e.Result?l.showReport(a.i18n("ADMINPANELWEBCLIENT/REPORT_CREATE_TABLES_SUCCESSFUL")):l.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_CREATE_TABLES_FAILED"))})};this.sSavedState!==this.getCurrentState()?d.showPopup(p,[a.i18n("ADMINPANELWEBCLIENT/CONFIRM_SAVE_CHANGES_BEFORE_CREATE_TABLES"),o.bind(function(t){if(t){var s=this.isSaving.subscribe(function(t){t||(e(),s.dispose())},this);this.save()}},this)]):e()},e.exports=new i},248:function(e,t,s){"use strict";var i=s(191),o=s(238);i.registerAbortRequestHandler(o.ServerModuleName,function(e,t){var s=e.Parameters,i=t.Parameters;switch(e.Method){case"GetEntityList":return"GetEntityList"===t.Method&&i.Type===s.Type}return!1}),e.exports={send:function(e,t,s,n){i.send(o.ServerModuleName,e,t,s,n)}}},249:function(e,t,s){"use strict";function i(){c.call(this,u.ServerModuleName),this.aLanguages=u.LanguageList,this.login=r.observable(u.AdminLogin),this.pass=r.observable(""),this.newPass=r.observable(""),this.confirmPass=r.observable(""),this.selectedLanguage=r.observable(u.AdminLanguage),this.passFocused=r.observable(!1),this.newPassFocused=r.observable(!1),this.startError=r.observable(""),this.setStartError()}var o=s(2),n=s(1),r=s(44),a=s(185),l=s(186),h=s(188),u=s(43),c=s(239);o.extendOwn(i.prototype,c.prototype),i.prototype.ViewTemplate="AdminPanelWebclient_SecurityAdminSettingsView",i.prototype.setStartError=function(){var e=[];u.AdminHasPassword||e.push(a.i18n("ADMINPANELWEBCLIENT/ERROR_ADMIN_EMPTY_PASSWORD")),u.SaltNotEmpty||e.push(a.i18n("ADMINPANELWEBCLIENT/ERROR_SALT_EMPTY")),this.startError(e.join("<br /><br />"))},i.prototype.getStartError=function(){return this.startError},i.prototype.getCurrentValues=function(){return[this.login(),this.pass(),this.newPass(),this.confirmPass(),this.selectedLanguage()]},i.prototype.revertGlobalValues=function(){this.login(u.AdminLogin),this.pass(""),this.newPass(""),this.confirmPass(""),this.selectedLanguage(u.AdminLanguage)},i.prototype.getParametersForSave=function(){var e={AdminLogin:n.trim(this.login()),Password:n.trim(this.pass()),NewPassword:n.trim(this.newPass())};return this.selectedLanguage()!==u.AdminLanguage&&(e.AdminLanguage=this.selectedLanguage()),e},i.prototype.applySavedValues=function(e){this.selectedLanguage()!==u.AdminLanguage&&window.location.reload(),u.updateSecurity(e.AdminLogin,u.AdminHasPassword||""!==e.NewPassword),this.setStartError()},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},i.prototype.validateBeforeSave=function(){
  var e=n.trim(this.pass()),t=n.trim(this.newPass()),s=n.trim(this.confirmPass());return u.AdminHasPassword&&""===e&&""!==t?(h.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_CURRENT_PASSWORD_EMPTY")),this.passFocused(!0),!1):""!==e&&""===t?(h.showError(a.i18n("ADMINPANELWEBCLIENT/ERROR_NEW_PASSWORD_EMPTY")),this.newPassFocused(!0),!1):""===e||t===s||(h.showError(a.i18n("COREWEBCLIENT/ERROR_PASSWORDS_DO_NOT_MATCH")),this.newPassFocused(!0),!1)},i.prototype.onResponse=function(e,t){if(this.isSaving(!1),e.Result){var s=t.Parameters;this.pass(""),this.newPass(""),this.confirmPass(""),this.updateSavedState(),this.applySavedValues(s),h.showReport(a.i18n("COREWEBCLIENT/REPORT_SETTINGS_UPDATE_SUCCESS"))}else l.showErrorByCode(e,a.i18n("COREWEBCLIENT/ERROR_SAVING_SETTINGS_FAILED"))},e.exports=new i},250:function(e,t,s){"use strict";function i(){c.call(this),this.type=n.observable("User"),this.id=n.observable(0),this.entityCreateView=n.computed(function(){var e=u.getEditView(this.type());return e&&(o.isFunction(e.updateSavedState)||(e.updateSavedState=this.updateSavedState.bind(this)),o.isFunction(e.setRequestEntityDataFunction)&&e.setRequestEntityDataFunction(this.requestEntityData.bind(this))),e},this),this.entityCreateView.subscribe(function(){this.updateSavedState()},this),this.entityData=n.computed(function(){return u.getEntityData(this.type())},this),this.allowSave=n.computed(function(){return!!this.entityData()&&!!this.entityData().UpdateRequest},this),this.updateSavedState()}var o=s(2),n=s(44),r=s(181),a=s(191),l=s(182),h=s(188),u=s(241),c=s(239);o.extendOwn(i.prototype,c.prototype),i.prototype.ViewTemplate="AdminPanelWebclient_CommonSettingsPaneView",i.prototype.getCurrentValues=function(){return this.entityCreateView()?this.entityCreateView().getCurrentValues():[]},i.prototype.revertGlobalValues=function(){this.entityCreateView()&&this.entityCreateView().clearFields(),this.updateSavedState()},i.prototype.save=function(e){this.entityData().UpdateRequest&&this.entityCreateView()&&r.isPositiveNumber(this.id())&&(!o.isFunction(this.entityCreateView().isValidSaveData)||this.entityCreateView().isValidSaveData())&&a.send(this.entityData().ServerModuleName,this.entityData().UpdateRequest,{Type:this.type(),Data:this.entityCreateView()?this.entityCreateView().getParametersForSave():{}},function(t){t.Result?o.isFunction(this.entityCreateView().showAdvancedReport)?this.entityCreateView().showAdvancedReport(this.entityData().ReportSuccessUpdate,t):h.showReport(this.entityData().ReportSuccessUpdate):h.showError(this.entityData().ErrorUpdate),e&&o.isFunction(e.currentEntitiesView)&&o.isFunction(e.currentEntitiesView().requestEntities)&&e.currentEntitiesView().requestEntities(),this.updateSavedState()},this)},i.prototype.requestEntityData=function(){r.isPositiveNumber(this.id())&&a.send(this.entityData().ServerModuleName,this.entityData().GetRequest,{Type:this.type(),Id:this.id()},function(e,t){this.id()===t.Parameters.Id&&(this.entityCreateView()&&this.entityCreateView().parse(this.id(),e.Result||{}),this.updateSavedState())},this)},i.prototype.setAccessLevel=function(e,t){this.visible(""!==e),this.type(e),this.id(r.pInt(t)),r.isPositiveNumber(this.id())?this.requestEntityData():this.updateSavedState()},i.prototype.onRoute=function(e,t){o.isFunction(this.entityCreateView().onRoute)&&this.entityCreateView().onRoute(e,t),l.broadcastEvent("CCommonSettingsPaneView::onRoute::after",{View:this.entityCreateView(),Id:this.id()})},e.exports=new i},251:function(e,t,s){"use strict";function i(){a.call(this,r.ServerModuleName),this.sVersion=n.pString(r.Version),this.sProductName=n.pString(r.ProductName)}var o=s(2),n=s(181),r=s(43),a=s(239);o.extendOwn(i.prototype,a.prototype),i.prototype.ViewTemplate="AdminPanelWebclient_AboutAdminSettingsView",i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i},256:function(e,t,s){"use strict";var i=s(2),o=s(188),n={};n.checkIfFieldsEmpty=function(e,t){var s=i.find(e,function(e){return""===e()});return!s||(t&&o.showError(t),s.focused(!0),!1)},n.checkPassword=function(e,t){var i=s(185),n=s(43),r=!1;return t!==e?o.showError(i.i18n("COREWEBCLIENT/ERROR_PASSWORDS_DO_NOT_MATCH")):n.PasswordMinLength>0&&e.length<n.PasswordMinLength?o.showError(i.i18n("COREWEBCLIENT/ERROR_PASSWORD_TOO_SHORT").replace("%N%",n.PasswordMinLength)):!n.PasswordMustBeComplex||e.match(/([0-9])/)&&e.match(/([!,%,&,@,#,$,^,*,?,_,~])/)?r=!0:o.showError(i.i18n("COREWEBCLIENT/ERROR_PASSWORD_TOO_SIMPLE")),r},e.exports=n},265:function(e,t,s){"use strict";function i(){this.iTimeStampInUTC=0,this.oMoment=null}var o=s(49),n=s(185),r=s(217),a=s(43);i.prototype.parse=function(e){this.iTimeStampInUTC=e,this.oMoment=o.unix(this.iTimeStampInUTC)},i.prototype.setDate=function(e,t,s){this.oMoment=o([e,t,s])},i.prototype.getTimeFormat=function(){return a.timeFormat()===window.Enums.TimeFormat.F24?"HH:mm":"hh:mm A"},i.prototype.getFullDate=function(){return this.getDate()+" "+this.getTime()},i.prototype.getMidDate=function(){return this.getShortDate(!0)},i.prototype.getShortDate=function(e){var t="",s=null;return this.oMoment&&(s=o(),s.format("L")===this.oMoment.format("L")?t=this.oMoment.format(this.getTimeFormat()):(t=s.clone().subtract(1,"days").format("L")===this.oMoment.format("L")?n.i18n("COREWEBCLIENT/LABEL_YESTERDAY"):a.UserSelectsDateFormat?this.oMoment.format(r.getDateFormatForMoment(a.dateFormat())):s.year()===this.oMoment.year()?this.oMoment.format("MMM D"):this.oMoment.format("MMM D, YYYY"),e&&(t+=", "+this.oMoment.format(this.getTimeFormat())))),t},i.prototype.getDate=function(){var e="ddd, MMM D, YYYY";return a.UserSelectsDateFormat&&(e="ddd, "+r.getDateFormatForMoment(a.dateFormat())),this.oMoment?this.oMoment.format(e):""},i.prototype.getTime=function(){return this.oMoment?this.oMoment.format(this.getTimeFormat()):""},i.prototype.getTimeStampInUTC=function(){return this.iTimeStampInUTC},e.exports=i},276:function(e,t,s){var i,o=o||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,s=function(){return e.URL||e.webkitURL||e},i=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in i,n=function(e){var t=new MouseEvent("click");e.dispatchEvent(t)},r=/constructor/i.test(e.HTMLElement)||e.safari,a=/CriOS\/[\d]+/.test(navigator.userAgent),l=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},h="application/octet-stream",u=4e4,c=function(e){var t=function(){"string"==typeof e?s().revokeObjectURL(e):e.remove()};setTimeout(t,u)},d=function(e,t,s){t=[].concat(t);for(var i=t.length;i--;){var o=e["on"+t[i]];if("function"==typeof o)try{o.call(e,s||e)}catch(e){l(e)}}},p=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},m=function(t,l,u){u||(t=p(t));var m,g=this,f=t.type,b=f===h,v=function(){d(g,"writestart progress write writeend".split(" "))},E=function(){if((a||b&&r)&&e.FileReader){var i=new FileReader;return i.onloadend=function(){var t=a?i.result:i.result.replace(/^data:[^;]*;/,"data:attachment/file;"),s=e.open(t,"_blank");s||(e.location.href=t),t=void 0,g.readyState=g.DONE,v()},i.readAsDataURL(t),void(g.readyState=g.INIT)}if(m||(m=s().createObjectURL(t)),b)e.location.href=m;else{var o=e.open(m,"_blank");o||(e.location.href=m)}g.readyState=g.DONE,v(),c(m)};return g.readyState=g.INIT,o?(m=s().createObjectURL(t),void setTimeout(function(){i.href=m,i.download=l,n(i),v(),c(m),g.readyState=g.DONE})):void E()},g=m.prototype,f=function(e,t,s){return new m(e,t||e.name||"download",s)};return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,s){return t=t||e.name||"download",s||(e=p(e)),navigator.msSaveOrOpenBlob(e,t)}:(g.abort=function(){},g.readyState=g.INIT=0,g.WRITING=1,g.DONE=2,g.error=g.onwritestart=g.onprogress=g.onwrite=g.onabort=g.onerror=g.onwriteend=null,f)}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==e&&e.exports?e.exports.saveAs=o:null!==s(46)&&null!==s(277)&&(i=function(){return o}.call(t,s,t,e),!(void 0!==i&&(e.exports=i)))},277:function(e,t){(function(t){e.exports=t}).call(t,{})},278:function(e,t,s){"use strict";function i(e){return void 0===e}function o(e,t){var s=!1;return e&&t&&(s=e===t||(e.contains?e.contains(t):!!t.compareDocumentPosition&&!!(8&t.compareDocumentPosition(e)))),s}function n(e){0<e&&clearTimeout(e),e=0}function r(e){return e=e&&(e.originalEvent?e.originalEvent:e)||window.event,e.dataTransfer?e:null}function a(e,t,s){return e&&t&&!i(e[t])?e[t]:s}function l(e,t,s){e[t]=s}function h(e,t){return function(){return e.apply(i(t)?null:t,Array.prototype.slice.call(arguments))}}function u(e){var t="",s="0123456789abcdefghijklmnopqrstuvwxyz";for(e=i(e)?32:w.pInt(e);t.length<e;)t+=s.substr(Math.round(Math.random()*s.length),1);return t}function c(){return"jua-uid-"+u(16)+"-"+(new Date).getTime()}function d(e,t){var s=i(e.fileName)?i(e.name)?null:e.name:e.fileName,o=i(e.fileSize)?i(e.size)?null:e.size:e.fileSize,n=i(e.type)?null:e.type;return{FileName:s,Size:o,Type:n,Folder:i(t)?"":t,File:e}}function p(e,t,s,o,n,r){var a=0,l=0,h=0,u=null,c=null,p=!1,m=!1,g=function(e,t,s,l){if(e&&!i(e.name))if(t=t||"",e.isFile)e.file(function(e){!p||0<=--n?s(d(e,t)):p&&!m&&0>n&&r&&(m=!0,r(a))});else if(o&&e.isDirectory&&e.createReader){var h=e.createReader(),u=0,c=0;h&&h.readEntries&&h.readEntries(function(i){if(i&&w.isNonEmptyArray(i))for(u=0,c=i.length;u<c;u++)g(i[u],t+e.name+"/",s,l)})}};if(o=!!i(o)||!!o,s=!i(s)&&!!s,n=i(n)?M:w.pInt(n),a=n,p=0<n,e=e&&0<e.length?e:null)for(h=0,l=e.length;h<l;h++)u=e[h],u&&(s?"file"===u.kind&&u.webkitGetAsEntry&&(c=u.webkitGetAsEntry(),c&&g(c,"",t,r)):!p||0<=--n?t(d(u)):p&&!m&&0>n&&r&&(m=!0,r(a)))}function m(e,t,s,i){var o=e&&e.files&&0<e.files.length?e.files:null;o?p(o,t,!1,!1,s,i):t({FileName:e.value.split("\\").pop().split("/").pop(),Size:null,Type:null,Folder:"",File:null})}function g(e){var t=!1;if(e&&e.dataTransfer&&e.dataTransfer.types&&e.dataTransfer.types.length)for(var s=0,i=e.dataTransfer.types.length;s<i;s++)if("files"===e.dataTransfer.types[s].toLowerCase()){t=!0;break}return t}function f(e,t,s,i,o){var n=null,l=null;e=r(e),e&&(n=(e.dataTransfer?a(e.dataTransfer,"items",null):null)||a(e,"items",null),n&&0<n.length&&n[0]&&n[0].webkitGetAsEntry?p(n,t,!0,o,s,i):g(e)&&(l=a(e,"files",null)||(e.dataTransfer?a(e.dataTransfer,"files",null):null),l&&0<l.length&&p(l,t,!1,!1,s,i)))}function b(){return C('<label style="position: absolute; background-color:#fff; right: 0px; top: 0px; left: 0px; bottom: 0px; margin: 0px; padding: 0px; cursor: pointer;"></label>').css({opacity:0})}function v(e,t){return""!==t&&(t=' accept="'+t+'"'),C('<input type="file" tabindex="-1" hidefocus="hidefocus" style="position: absolute; '+e+': -9999px;"'+t+" />")}function E(e,t,s,o){e=i(e)?"":""+e,s=i(s)?"left":""+s,o=i(o)?"":""+o;var n=v(s,o);return 0<e.length&&n.attr("name",e),!i(t)&&!t||n.prop("multiple",!0),n}function y(e,t){return w.pString(F.isFunction(e)?e.apply(null,F.isArray(t)?t:[]):e)}function A(e,t){this.oXhrs={},this.oUids={},this.oJua=e,this.oOptions=t}function S(e,t){this.oUids={},this.oForms={},this.oJua=e,this.oOptions=t}function I(e){e=i(e)?{}:e;var t=this;t.bEnableDnD=!0,t.bEnableButton=!0,t.oEvents={onDialog:null,onSelect:null,onStart:null,onComplete:null,onCompleteAll:null,onProgress:null,onDragEnter:null,onDragLeave:null,onDrop:null,onBodyDragEnter:null,onBodyDragLeave:null,onLimitReached:null},t.oOptions=F.extend({action:"",name:"",hidden:{},queueSize:10,clickElement:!1,dragAndDropElement:!1,dragAndDropBodyElement:!1,disableAjaxUpload:!1,disableFolderDragAndDrop:!0,disableDragAndDrop:!1,disableMultiple:!1,disableDocumentDropPrevent:!1,disableAutoUploadOnDrop:!1,multipleSizeLimit:50,hiddenElementsPosition:"left"},e),t.oQueue=L(w.pInt(a(t.oOptions,"queueSize",10))),t.runEvent("onCompleteAll")&&t.oQueue.await(function(){t.runEvent("onCompleteAll")}),t.oDriver=t.isAjaxUploaderSupported()&&!a(t.oOptions,"disableAjaxUpload",!1)?new A(t,t.oOptions):new S(t,t.oOptions),t.oClickElement=a(t.oOptions,"clickElement",null),t.oClickElement&&(C(t.oClickElement).css({position:"relative",overflow:"hidden"}),"inline"===C(this.oClickElement).css("display")&&C(this.oClickElement).css("display","inline-block"),this.oDriver.generateNewInput(this.oClickElement)),this.oDriver.isDragAndDropSupported()&&a(this.oOptions,"dragAndDropElement",!1)&&!a(this.oOptions,"disableAjaxUpload",!1)?!function(e){var t=C(document),s=C(a(e.oOptions,"dragAndDropBodyElement",!1)||t),i=a(e.oOptions,"dragAndDropElement",!1),l=function(t){if(e.bEnableDnD&&t&&(t=r(t),t&&t.dataTransfer&&g(t)))try{var i=t.dataTransfer.effectAllowed;n(e.iDocTimer),t.dataTransfer.dropEffect="move"===i||"linkMove"===i?"move":"copy",t.stopPropagation(),t.preventDefault(),s.trigger("dragover",t)}catch(e){}},h=function(t){e.bEnableDnD&&t&&(t=r(t),t&&g(t)&&(t.preventDefault(),f(t,function(s){s&&(a(e.oOptions,"disableAutoUploadOnDrop",!1)?e.runEvent("onDrop",[s,t,function(){e.addNewFile(s),n(e.iDocTimer)}]):(e.runEvent("onDrop",[s,t]),e.addNewFile(s),n(e.iDocTimer)))},a(e.oOptions,"multipleSizeLimit",M),e.getEvent("onLimitReached"),!a(e.oOptions,"disableFolderDragAndDrop",!0)))),e.runEvent("onDragLeave",[t])},u=function(t){e.bEnableDnD&&t&&(t=r(t),t&&g(t)&&(n(e.iDocTimer),t.preventDefault(),e.runEvent("onDragEnter",[i,t])))},c=function(t){if(e.bEnableDnD&&t){if(t=r(t)){var s=document.elementFromPoint?document.elementFromPoint(t.clientX,t.clientY):null;if(s&&o(this,s))return;n(e.iDocTimer),e.runEvent("onDragLeave",[i,t])}}else;};i&&(a(e.oOptions,"disableDocumentDropPrevent",!1)||t.on("dragover",function(t){if(e.bEnableDnD&&t&&(t=r(t),t&&t.dataTransfer&&g(t)))try{t.dataTransfer.dropEffect="none",t.preventDefault()}catch(e){}}),s&&s[0]&&s.on("dragover",function(t){e.bEnableDnD&&t&&n(e.iDocTimer)}).on("dragenter",function(t){e.bEnableDnD&&t&&(t=r(t),t&&g(t)&&(n(e.iDocTimer),t.preventDefault(),e.runEvent("onBodyDragEnter",[t])))}).on("dragleave",function(t){e.bEnableDnD&&t&&(t=r(t),t&&(n(e.iDocTimer),e.iDocTimer=setTimeout(function(){e.runEvent("onBodyDragLeave",[t])},200)))}).on("drop",function(t){if(e.bEnableDnD&&t&&(t=r(t))){var s=g(t);return s&&t.preventDefault(),e.runEvent("onBodyDragLeave",[t]),!s}return!1}),C(i).bind("dragenter",u).bind("dragover",l).bind("dragleave",c).bind("drop",h))}(t):t.bEnableDnD=!1,l(t,"on",t.on),l(t,"cancel",t.cancel),l(t,"isDragAndDropSupported",t.isDragAndDropSupported),l(t,"isAjaxUploaderSupported",t.isAjaxUploaderSupported),l(t,"setDragAndDropEnabledStatus",t.setDragAndDropEnabledStatus)}var C=s(1),F=s(2),T=s(44),L=s(279),w=s(181),N=s(182),M=20;A.prototype.oXhrs={},A.prototype.oUids={},A.prototype.oJua=null,A.prototype.oOptions={},A.prototype.isDragAndDropSupported=function(){return!0},A.prototype.regTaskUid=function(e){this.oUids[e]=!0},A.prototype.uploadTask=function(e,t,s,o,n,r,l){if(!1===this.oUids[e]||!t||!t.File)return o(null,e),!1;try{var h=this,u=new XMLHttpRequest,c=new FormData,d=a(this.oOptions,"action",""),p=F.clone(a(this.oOptions,"hidden",{})),m=this.oJua.getEvent("onStart"),g=this.oJua.getEvent("onComplete"),f=this.oJua.getEvent("onProgress");return u.open("POST",d,!0),u.setRequestHeader("Authorization","Bearer "+C.cookie("AuthToken")),f&&u.upload&&(u.upload.onprogress=function(s){s&&s.lengthComputable&&!i(s.loaded)&&!i(s.total)&&(void 0===l?f(e,s.loaded,s.total):f(e,l+s.loaded>t.Size?t.Size:l+s.loaded,t.Size))}),u.onreadystatechange=function(){if(4===u.readyState&&200===u.status){if(g&&!n){var t=!1,s=null;try{s=C.parseJSON(u.responseText),t=!0}catch(e){s=null}g(e,t,s)}i(h.oXhrs[e])||(h.oXhrs[e]=null),r?o(u.responseText,e):o(null,e)}else 4===u.readyState&&(g(e,!1,null),o(null,e))},m&&m(e),c.append("jua-post-type","ajax"),c.append(a(this.oOptions,"name","juaFile"),t.File,t.FileName),s=F.extend(s,t.Hidden||{}),p.Parameters=JSON.stringify(s),C.each(p,function(e,s){c.append(e,y(s,[t]))}),u.send(c),this.oXhrs[e]=u,!0}catch(e){window.console&&window.console.error(e)}return o(null,e),!1},A.prototype.generateNewInput=function(e){var t=this,s=null,i=null;e&&(i=E("",!a(this.oOptions,"disableMultiple",!1),a(this.oOptions,"hiddenElementsPosition","left"),a(this.oOptions,"accept","")),s=b(),s.append(i),C(e).append(s),i.on("click",function(e){if(!t.oJua.bEnableButton)return void e.preventDefault();var s=t.oJua.getEvent("onDialog");s&&s()}).on("change",function(){m(this,function(i){t.oJua.addNewFile(i),t.generateNewInput(e),setTimeout(function(){s.remove()},10)},a(t.oOptions,"multipleSizeLimit",M),t.oJua.getEvent("onLimitReached"))}))},A.prototype.cancel=function(e){if(this.oUids[e]=!1,this.oXhrs[e]){try{this.oXhrs[e].abort&&this.oXhrs[e].abort()}catch(e){}this.oXhrs[e]=null}},S.prototype.oUids={},S.prototype.oForms={},S.prototype.oJua=null,S.prototype.oOptions={},S.prototype.isDragAndDropSupported=function(){return!1},S.prototype.regTaskUid=function(e){this.oUids[e]=!0},S.prototype.uploadTask=function(e,t,s,i,o,n,r){if(!1===this.oUids[e])return i(null,e),!1;var l=this.oForms[e],h=F.clone(a(this.oOptions,"hidden",{})),u=this.oJua.getEvent("onStart"),c=this.oJua.getEvent("onComplete");return l?(l.append(C('<input type="hidden" />').attr("name","jua-post-type").val("iframe")),s=F.extend(s,t.Hidden||{}),h.Parameters=JSON.stringify(s),C.each(h,function(e,s){l.append(C('<input type="hidden" />').attr("name",e).val(y(s,[t])))}),l.trigger("submit"),u&&u(e),l.find("iframe").on("load",function(t){var s=!1,o=null,n={};if(c){try{o=this.contentDocument?this.contentDocument:this.contentWindow.document,n=C.parseJSON(o.body.innerHTML),s=!0}catch(e){n={}}c(e,s,n)}i(null,e),window.setTimeout(function(){l.remove()},100)})):i(null,e),!0},S.prototype.generateNewInput=function(e){var t=this,s="",i=null,o=null,n=a(this.oOptions,"action",""),r=null,l=a(this.oOptions,"hiddenElementsPosition","left");e&&(s=c(),i=E(a(this.oOptions,"name","juaFile"),!a(this.oOptions,"disableMultiple",!1),a(this.oOptions,"hiddenElementsPosition","left"),a(this.oOptions,"accept","")),r=C('<form action="'+n+'" target="iframe-'+s+'"  method="POST" enctype="multipart/form-data" style="display: block; cursor: pointer;"></form>'),o=C('<iframe name="iframe-'+s+'" tabindex="-1" src="javascript:void(0);"  style="position: absolute; top: -1000px; '+l+': -1000px; cursor: pointer;" />').css({opacity:0}),r.append(b().append(i)).append(o),C(e).append(r),this.oForms[s]=r,i.on("click",function(e){if(!t.oJua.bEnableButton)return void e.preventDefault();var s=t.oJua.getEvent("onDialog");s&&s()}).on("change",function(){m(this,function(i){if(i){var o=a(t.oOptions,"hiddenElementsPosition","left");r.css({position:"absolute",top:-1e3}),r.css(o,-1e3),t.oJua.addFile(s,i),t.generateNewInput(e)}},a(t.oOptions,"multipleSizeLimit",M),t.oJua.getEvent("onLimitReached"))}))},S.prototype.cancel=function(e){this.oUids[e]=!1,this.oForms[e]&&(this.oForms[e].remove(),this.oForms[e]=!1)},I.prototype.bEnableDnD=!0,I.prototype.iDocTimer=0,I.prototype.oOptions={},I.prototype.oEvents={},I.prototype.oQueue=null,I.prototype.oDriver=null,I.prototype.on=function(e,t){return this.oEvents[e]=t,this},I.prototype.runEvent=function(e,t){this.oEvents[e]&&this.oEvents[e].apply(null,t||[])},I.prototype.getEvent=function(e){return this.oEvents[e]||null},I.prototype.cancel=function(e){this.oDriver.cancel(e)},I.prototype.isAjaxUploaderSupported=function(){return function(){var e=document.createElement("input");return e.type="file",!!("XMLHttpRequest"in window&&"multiple"in e&&"FormData"in window&&(new XMLHttpRequest).upload)}()},I.prototype.setDragAndDropEnabledStatus=function(e){this.bEnableDnD=!!e},I.prototype.isDragAndDropSupported=function(){return this.oDriver.isDragAndDropSupported()},I.prototype.addNewFile=function(e){this.addFile(c(),e)},I.prototype.addFile=function(e,t){var s=this.getEvent("onSelect"),i=null,o=!1,n=a(this.oOptions,"hidden",{}),r=this.getEvent("onComplete"),l=F.bind(function(e,t){var s=a(this.oOptions,"hidden",{}),i=JSON.parse(y(s.Parameters,[t]));this.oDriver.regTaskUid(e),this.oQueue.defer(h(this.oDriver.uploadTask,this.oDriver),e,t,i)},this),u=this.getEvent("onCancel");if(!t||s&&!1===s(e,t))this.oDriver.cancel(e);else{i=F.bind(function(e,t,s,o,n,l){var h=null;h=function(t,o){var n=null;try{n=C.parseJSON(t)}catch(e){}n&&n.Result&&!n.Result.Error&&!n.ErrorCode?s(e,i):n&&n.Result&&n.Result.Error?(N.broadcastEvent("Jua::FileUploadingError"),r(o,!1,{ErrorCode:n.Result.Error})):n&&n.ErrorCode?(N.broadcastEvent("Jua::FileUploadingError"),r(o,!1,{ErrorCode:n.ErrorCode})):(N.broadcastEvent("Jua::FileUploadingError"),r(o,!1))};var u=a(this.oOptions,"hidden",{}),c=JSON.parse(y(u.Parameters,[t]));this.oDriver.regTaskUid(e),this.oDriver.uploadTask(e,t,c,h,o<n,!0,l)},this);var c=T.observable(!0),d=JSON.parse(y(n.Parameters,[t]));N.broadcastEvent("Jua::FileUpload::isUploadAvailable",{isUploadAvailable:c,sModuleName:n.Module,sUid:e,oFileInfo:t}),c()?(o=N.broadcastEvent("Jua::FileUpload::before",{sUid:e,oFileInfo:t,fOnChunkReadyCallback:i,sModuleName:n.Module,fRegularUploadFileCallback:l,fCancelFunction:u,sStorageType:d.Type}),o===!1&&l(e,t)):F.isFunction(u)&&u(e)}},I.prototype.setOption=function(e,t){this.oOptions[e]=t},e.exports=I},279:function(e,t,s){var i;!function(){function o(e){function t(){for(;a=u<h.length&&e>c;){var t=u++,i=h[t],o=r.call(i,1);o.push(s(t)),++c,i[0].apply(null,o)}}function s(e){return function(s,o){--c,null==p&&(null!=s?(p=s,u=d=NaN,i()):(h[e]=o,--d?a||t():i()))}}function i(){null!=p?m(p):l?m(p,h):m.apply(null,[p].concat(h))}var o,a,l,h=[],u=0,c=0,d=0,p=null,m=n;return e||(e=1/0),o={defer:function(){return p||(h.push(arguments),++d,t()),o},await:function(e){return m=e,l=!1,d||i(),o},awaitAll:function(e){return m=e,l=!0,d||i(),o}}}function n(){}var r=[].slice;o.version="1.0.7",i=function(){return o}.call(t,s,t,e),!(void 0!==i&&(e.exports=i))}()},286:function(e,t,s){"use strict";var i=s(2),o=s(44),n=s(181);e.exports={ServerModuleName:"Dropbox",HashModuleName:"dropbox",Connected:!1,EnableModule:!1,Id:"",Secret:"",Scopes:[],init:function(e){var t=e.Dropbox;i.isEmpty(t)||(this.Connected=n.pBool(t.Connected,this.Connected),this.EnableModule=n.pBool(t.EnableModule,this.EnableModule),this.Id=n.pString(t.Id,this.Id),this.Secret=n.pString(t.Secret,this.Secret),this.Scopes=n.pArray(t.Scopes,this.Scopes))},getScopesCopy:function(){var e=[];return i.each(this.Scopes,function(t){e.push({Description:t.Description,Name:t.Name,Value:o.observable(t.Value)})}),e},updateScopes:function(e,t){var s=[];i.each(t,function(e){s.push({Description:e.Description,Name:e.Name,Value:e.Value()})}),this.Connected=e,this.Scopes=s},updateAdmin:function(e,t,s,i){this.EnableModule=e,this.Id=t,this.Secret=s,this.Scopes=i}}},288:function(e,t,s){"use strict";function i(){h.call(this,u.ServerModuleName),this.enable=n.observable(u.EnableModule),this.id=n.observable(u.Id),this.secret=n.observable(u.Secret),this.scopes=n.observable(u.getScopesCopy())}var o=s(2),n=s(44),r=s(185),a=s(42),l=s(188),h=a.run("AdminPanelWebclient","getAbstractSettingsFormViewClass"),u=s(286);o.extendOwn(i.prototype,h.prototype),i.prototype.ViewTemplate="Dropbox_AdminSettingsView",i.prototype.getCurrentValues=function(){var e=o.map(this.scopes(),function(e){return e.Name+e.Value()});return[this.enable(),this.id(),this.secret(),e]},i.prototype.revertGlobalValues=function(){this.enable(u.EnableModule),this.id(u.Id),this.secret(u.Secret),this.scopes(u.getScopesCopy())},i.prototype.validateBeforeSave=function(){return!this.enable()||""!==this.id()&&""!==this.secret()||(l.showError(r.i18n("COREWEBCLIENT/ERROR_REQUIRED_FIELDS_EMPTY")),!1)},i.prototype.getParametersForSave=function(){return{EnableModule:this.enable(),Id:this.id(),Secret:this.secret(),Scopes:o.map(this.scopes(),function(e){return{Name:e.Name,Description:e.Description,Value:e.Value()}})}},i.prototype.applySavedValues=function(e){u.updateAdmin(e.EnableModule,e.Id,e.Secret,e.Scopes)},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i},290:function(e,t,s){"use strict";var i=s(2),o=s(44),n=s(181);e.exports={ServerModuleName:"Facebook",HashModuleName:"facebook",Connected:!1,EnableModule:!1,Id:"",Secret:"",Scopes:[],init:function(e){var t=e.Facebook;i.isEmpty(t)||(this.Connected=n.pBool(t.Connected,this.Connected),this.EnableModule=n.pBool(t.EnableModule,this.EnableModule),this.Id=n.pString(t.Id,this.Id),this.Secret=n.pString(t.Secret,this.Secret),this.Scopes=n.pArray(t.Scopes,this.Scopes))},getScopesCopy:function(){var e=[];return i.each(this.Scopes,function(t){e.push({Description:t.Description,Name:t.Name,Value:o.observable(t.Value)})}),e},updateScopes:function(e,t){var s=[];i.each(t,function(e){s.push({Description:e.Description,Name:e.Name,Value:e.Value()})}),this.Connected=e,this.Scopes=s},updateAdmin:function(e,t,s,i){this.EnableModule=e,this.Id=t,this.Secret=s,this.Scopes=i}}},292:function(e,t,s){"use strict";function i(){h.call(this,u.ServerModuleName),this.enable=n.observable(u.EnableModule),this.id=n.observable(u.Id),this.secret=n.observable(u.Secret),this.scopes=n.observable(u.getScopesCopy())}var o=s(2),n=s(44),r=s(185),a=s(42),l=s(188),h=a.run("AdminPanelWebclient","getAbstractSettingsFormViewClass"),u=s(290);o.extendOwn(i.prototype,h.prototype),i.prototype.ViewTemplate="Facebook_AdminSettingsView",i.prototype.getCurrentValues=function(){var e=o.map(this.scopes(),function(e){return e.Name+e.Value()});return[this.enable(),this.id(),this.secret(),e]},i.prototype.revertGlobalValues=function(){this.enable(u.EnableModule),this.id(u.Id),this.secret(u.Secret),this.scopes(u.getScopesCopy())},i.prototype.validateBeforeSave=function(){return!this.enable()||""!==this.id()&&""!==this.secret()||(l.showError(r.i18n("COREWEBCLIENT/ERROR_REQUIRED_FIELDS_EMPTY")),!1)},i.prototype.getParametersForSave=function(){return{EnableModule:this.enable(),Id:this.id(),Secret:this.secret(),Scopes:o.map(this.scopes(),function(e){return{Name:e.Name,Description:e.Description,Value:e.Value()}})}},i.prototype.applySavedValues=function(e){u.updateAdmin(e.EnableModule,e.Id,e.Secret,e.Scopes)},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i},294:function(e,t,s){"use strict";var i=s(2),o=s(44),n=s(181);e.exports={ServerModuleName:"Google",HashModuleName:"google",Connected:!1,EnableModule:!1,Id:"",Secret:"",Key:"",Scopes:[],init:function(e){var t=i.extend({},e[this.ServerModuleName]||{},e.Google||{});i.isEmpty(t)||(this.Connected=n.pBool(t.Connected,this.Connected),this.EnableModule=n.pBool(t.EnableModule,this.EnableModule),this.Id=n.pString(t.Id,this.Id),this.Secret=n.pString(t.Secret,this.Secret),this.Key=n.pString(t.Key,this.Key),this.Scopes=n.pArray(t.Scopes,this.Scopes))},getScopesCopy:function(){var e=[];return i.each(this.Scopes,function(t){e.push({Description:t.Description,Name:t.Name,Value:o.observable(t.Value)})}),e},updateScopes:function(e,t){var s=[];i.each(t,function(e){s.push({Description:e.Description,Name:e.Name,Value:e.Value()})}),this.Connected=e,this.Scopes=s},updateAdmin:function(e,t,s,i,o){this.EnableModule=e,this.Id=t,this.Secret=s,this.Key=i,this.Scopes=o}}},296:function(e,t,s){"use strict";function i(){h.call(this,u.ServerModuleName),this.enable=n.observable(u.EnableModule),this.id=n.observable(u.Id),this.secret=n.observable(u.Secret),this.key=n.observable(u.Key),this.scopes=n.observable(u.getScopesCopy())}var o=s(2),n=s(44),r=s(185),a=s(42),l=s(188),h=a.run("AdminPanelWebclient","getAbstractSettingsFormViewClass"),u=s(294);o.extendOwn(i.prototype,h.prototype),i.prototype.ViewTemplate="Google_AdminSettingsView",i.prototype.getCurrentValues=function(){var e=o.map(this.scopes(),function(e){return e.Name+e.Value()});return[this.enable(),this.id(),this.secret(),this.key(),e]},i.prototype.revertGlobalValues=function(){this.enable(u.EnableModule),this.id(u.Id),this.secret(u.Secret),this.key(u.Key),this.scopes(u.getScopesCopy())},i.prototype.validateBeforeSave=function(){return!this.enable()||""!==this.id()&&""!==this.secret()&&""!==this.key()||(l.showError(r.i18n("COREWEBCLIENT/ERROR_REQUIRED_FIELDS_EMPTY")),!1)},i.prototype.getParametersForSave=function(){return{EnableModule:this.enable(),Id:this.id(),Secret:this.secret(),Key:this.key(),Scopes:o.map(this.scopes(),function(e){return{Name:e.Name,Description:e.Description,Value:e.Value()}})}},i.prototype.applySavedValues=function(e){u.updateAdmin(e.EnableModule,e.Id,e.Secret,e.Key,e.Scopes)},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i},298:function(e,t,s){"use strict";var i=s(2),o=s(181);e.exports={ServerModuleName:"LogsViewerWebclient",HashModuleName:"logs-viewer",EnableLogging:!1,EnableEventLogging:!1,LoggingLevel:0,LogSizeBytes:0,EventLogSizeBytes:0,LogFileName:"",EventLogFileName:"",ViewLastLogSize:0,init:function(e){var t=e.Core,s=e[this.ServerModuleName];i.isEmpty(t)||(this.ViewLastLogSize=s.ViewLastLogSize,this.ELogLevel=o.pObject(t.ELogLevel),this.EnableLogging=o.pBool(t.EnableLogging),this.EnableEventLogging=o.pBool(t.EnableEventLogging),this.LoggingLevel=o.pEnum(t.LoggingLevel,this.ELogLevel,this.LoggingLevel),this.updateLogsData(o.pObject(t.LogFilesData)))},updateLogging:function(e,t,s){this.EnableLogging=!!e,this.EnableEventLogging=!!t,this.LoggingLevel=o.pInt(s)},updateLogsData:function(e){this.LogSizeBytes=o.pInt(e.LogSizeBytes),this.EventLogSizeBytes=o.pInt(e.EventLogSizeBytes),this.LogFileName=o.pString(e.LogFileName),this.EventLogFileName=o.pString(e.EventLogFileName)}}},300:function(e,t,s){"use strict";function i(){f.call(this,"Core"),this.iViewLogSizeBytes=m.ViewLastLogSize,this.aLevelOptions=[{text:l.i18n("LOGSVIEWERWEBCLIENT/LABEL_LOGGING_DEBUG"),value:Enums.LogLevel.Full},{text:l.i18n("LOGSVIEWERWEBCLIENT/LABEL_LOGGING_WARNINGS"),value:Enums.LogLevel.Warning},{text:l.i18n("LOGSVIEWERWEBCLIENT/LABEL_LOGGING_ERRORS"),value:Enums.LogLevel.Error}],this.logSize=r.observable(m.LogSizeBytes),this.downloadLogText=r.computed(function(){return l.i18n("LOGSVIEWERWEBCLIENT/BUTTON_LOGGING_DOWNLOAD",{SIZE:l.getFriendlySize(this.logSize())})},this),this.viewLogText=r.computed(function(){return this.logSize()<this.iViewLogSizeBytes?l.i18n("LOGSVIEWERWEBCLIENT/BUTTON_LOGGING_VIEW"):l.i18n("LOGSVIEWERWEBCLIENT/BUTTON_LOGGING_VIEW_LAST",{SIZE:l.getFriendlySize(this.iViewLogSizeBytes)})},this),this.eventsLogSize=r.observable(m.EventLogSizeBytes),this.downloadEventsLogText=r.computed(function(){return l.i18n("LOGSVIEWERWEBCLIENT/BUTTON_LOGGING_DOWNLOAD_EVENTS",{SIZE:l.getFriendlySize(this.eventsLogSize())})},this),this.viewEventsLogText=r.computed(function(){return this.eventsLogSize()<this.iViewLogSizeBytes?l.i18n("LOGSVIEWERWEBCLIENT/BUTTON_LOGGING_VIEW"):l.i18n("LOGSVIEWERWEBCLIENT/BUTTON_LOGGING_VIEW_LAST",{SIZE:l.getFriendlySize(this.iViewLogSizeBytes)})},this),this.usersWithSeparateLog=r.observableArray([]),this.enableLogging=r.observable(m.EnableLogging),this.enableEventLogging=r.observable(m.EnableEventLogging),this.loggingLevel=r.observable(m.LoggingLevel)}var o=s(2),n=s(1),r=s(44),a=s(276),l=s(185),h=s(181),u=s(191),c=s(186),d=s(200),p=s(43),m=s(298),g=s(42),f=g.run("AdminPanelWebclient","getAbstractSettingsFormViewClass");o.extendOwn(i.prototype,f.prototype),i.prototype.ViewTemplate="LogsViewerWebclient_AdminSettingsView",i.prototype.onRouteChild=function(){this.setUpdateStatusTimer();var e=""===p.DbLogin||""===p.DbName||""===p.DbHost;e||u.send(m.ServerModuleName,"GetUsersWithSeparateLog",null,function(e){e.Result?this.usersWithSeparateLog(o.isArray(e.Result)?e.Result:[]):c.showErrorByCode(e)},this)},i.prototype.turnOffSeparateLogs=function(){this.usersWithSeparateLog([]),u.send(m.ServerModuleName,"TurnOffSeparateLogs")},i.prototype.clearSeparateLogs=function(){u.send(m.ServerModuleName,"ClearSeparateLogs")},i.prototype.setUpdateStatusTimer=function(){this.bShown&&setTimeout(o.bind(function(){u.send(m.ServerModuleName,"GetLogFilesData",null,function(e){e.Result&&(m.updateLogsData(e.Result),this.logSize(m.LogSizeBytes),this.eventsLogSize(m.EventLogSizeBytes)),
  this.setUpdateStatusTimer()},this)},this),5e3)},i.prototype.getCurrentValues=function(){return[this.enableLogging(),this.enableEventLogging(),h.pInt(this.loggingLevel())]},i.prototype.revertGlobalValues=function(){this.enableLogging(m.EnableLogging),this.enableEventLogging(m.EnableEventLogging),this.loggingLevel(m.LoggingLevel)},i.prototype.getParametersForSave=function(){return{EnableLogging:this.enableLogging(),EnableEventLogging:this.enableEventLogging(),LoggingLevel:h.pInt(this.loggingLevel())}},i.prototype.applySavedValues=function(e){m.updateLogging(e.EnableLogging,e.EnableEventLogging,e.LoggingLevel)},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},i.prototype.downloadLog=function(e,t){u.send(m.ServerModuleName,"GetLogFile",{EventsLog:e,PublicId:t||""},function(s){var i=new Blob([s.ResponseText],{type:"text/plain;charset=utf-8"}),o=""!==h.pString(t)?t+"-":"";a.saveAs(i,e?m.EventLogFileName:o+m.LogFileName)},this,void 0,{Format:"Raw"})},i.prototype.viewLog=function(e){u.send(m.ServerModuleName,"GetLog",{EventsLog:e},function(e){if(e.Result){var t=d.open("","view-log");t&&n(t.document.body).html("<pre>"+e.Result+"</pre>")}},this)},i.prototype.clearLog=function(e){u.send(m.ServerModuleName,"ClearLog",{EventsLog:e},function(t){t.Result&&(e?this.eventsLogSize(0):this.logSize(0))},this)},e.exports=new i},302:function(e,t,s){"use strict";var i=s(2),o=s(181);e.exports={ServerModuleName:"MailChangePasswordPoppassdPlugin",HashModuleName:"mail-poppassd-plugin",SupportedServers:"",Host:"",Port:0,init:function(e){var t=e.MailChangePasswordPoppassdPlugin;i.isEmpty(t)||(this.SupportedServers=o.pString(t.SupportedServers,this.SupportedServers),this.Host=o.pString(t.Host,this.Host),this.Port=o.pNonNegativeInt(t.Port,this.Port))},updateAdmin:function(e,t,s){this.SupportedServers=o.pString(e,this.SupportedServers),this.Host=o.pString(t,this.Host),this.Port=o.pNonNegativeInt(s,this.Port)}}},303:function(e,t,s){"use strict";function i(){h.call(this,"MailChangePasswordPoppassdPlugin"),this.supportedServers=n.observable(a.SupportedServers),this.host=n.observable(a.Host),this.port=n.observable(a.Port)}var o=s(2),n=s(44),r=s(181),a=s(302),l=s(42),h=l.run("AdminPanelWebclient","getAbstractSettingsFormViewClass");o.extendOwn(i.prototype,h.prototype),i.prototype.ViewTemplate="MailChangePasswordPoppassdPlugin_AdminSettingsView",i.prototype.getCurrentValues=function(){return[r.pString(this.supportedServers()),r.pString(this.host()),r.pInt(this.port())]},i.prototype.revertGlobalValues=function(){this.supportedServers(a.SupportedServers),this.host(a.Host),this.port(a.Port)},i.prototype.getParametersForSave=function(){return{SupportedServers:r.pString(this.supportedServers()),Host:r.pString(this.host()),Port:r.pInt(this.port())}},i.prototype.applySavedValues=function(e){a.updateAdmin(e.SupportedServers,e.Host,e.Port)},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i},313:function(e,t,s){"use strict";var i=s(44),o=s(2),n=s(181),r=s(182);e.exports={ServerModuleName:"Mail",HashModuleName:"mail",FetchersServerModuleName:"MtaConnector",EnableMultiTenant:!1,AllowAddAccounts:!1,AllowAutoresponder:!1,AllowAutosaveInDrafts:!0,AllowDefaultAccountForUser:!0,AllowEditDomainsInServer:!0,AllowFetchers:!1,AllowFilters:!1,AllowForward:!1,AllowIdentities:!1,AllowInsertImage:!0,AllowMultiAccounts:!1,AutoSaveIntervalSeconds:60,AllowTemplateFolders:!1,AllowAlwaysRefreshFolders:!1,AutocreateMailAccountOnNewUserFirstLogin:!1,IgnoreImapSubscription:!1,ImageUploadSizeLimit:0,AllowAppRegisterMailto:!1,AllowChangeInputDirection:!0,AllowExpandFolders:!1,AllowSpamFolder:!0,AllowAddNewFolderOnMainScreen:!1,ComposeToolbarOrder:["back","send","save","importance","MailSensitivity","confirmation","OpenPgp"],DefaultFontName:"Tahoma",DefaultFontSize:3,JoinReplyPrefixes:!0,MailsPerPage:20,MaxMessagesBodiesSizeToPrefetch:5e4,MessageBodyTruncationThreshold:65e4,ShowEmailAsTabName:!0,AllowShowMessagesCountInFolderList:!1,showMessagesCountInFolderList:i.observable(!1),AllowSearchMessagesBySubject:!1,PrefixesToRemoveBeforeSearchMessagesBySubject:[],AllowHorizontalLayout:!1,HorizontalLayout:!1,HorizontalLayoutByDefault:!1,userMailAccountsCount:i.observable(0),mailAccountsEmails:i.observableArray([]),init:function(e){var t=e.Core,s=e[this.ServerModuleName],i=e.MailWebclient,a=e[this.FetchersServerModuleName];o.isEmpty(t)||(this.EnableMultiTenant=n.pBool(t.EnableMultiTenant,this.EnableMultiTenant)),o.isEmpty(s)||(this.AllowAddAccounts=n.pBool(s.AllowAddAccounts,this.AllowAddAccounts),this.AllowAutoresponder=n.pBool(s.AllowAutoresponder,this.AllowAutoresponder),this.AllowAutosaveInDrafts=n.pBool(s.AllowAutosaveInDrafts,this.AllowAutosaveInDrafts),this.AllowDefaultAccountForUser=n.pBool(s.AllowDefaultAccountForUser,this.AllowDefaultAccountForUser),this.AllowEditDomainsInServer=n.pBool(s.AllowEditDomainsInServer,this.AllowEditDomainsInServer),this.AllowFilters=n.pBool(s.AllowFilters,this.AllowFilters),this.AllowForward=n.pBool(s.AllowForward,this.AllowForward),this.AllowIdentities=n.pBool(s.AllowIdentities,this.AllowIdentities),this.AllowInsertImage=n.pBool(s.AllowInsertImage,this.AllowInsertImage),this.AllowMultiAccounts=n.pBool(s.AllowMultiAccounts,this.AllowMultiAccounts),this.AutoSaveIntervalSeconds=n.pNonNegativeInt(s.AutoSaveIntervalSeconds,this.AutoSaveIntervalSeconds),this.AllowTemplateFolders=n.pBool(s.AllowTemplateFolders,this.AllowTemplateFolders),this.AllowAlwaysRefreshFolders=n.pBool(s.AllowAlwaysRefreshFolders,this.AllowAlwaysRefreshFolders),this.AutocreateMailAccountOnNewUserFirstLogin=n.pBool(s.AutocreateMailAccountOnNewUserFirstLogin,this.AutocreateMailAccountOnNewUserFirstLogin),this.IgnoreImapSubscription=n.pBool(s.IgnoreImapSubscription,this.IgnoreImapSubscription),this.ImageUploadSizeLimit=n.pNonNegativeInt(s.ImageUploadSizeLimit,this.ImageUploadSizeLimit),window.Enums.SmtpAuthType=n.pObject(s.SmtpAuthType)),o.isEmpty(i)||(this.AllowAppRegisterMailto=n.pBool(i.AllowAppRegisterMailto,this.AllowAppRegisterMailto),this.AllowChangeInputDirection=n.pBool(i.AllowChangeInputDirection,this.AllowChangeInputDirection),this.AllowExpandFolders=n.pBool(i.AllowExpandFolders,this.AllowExpandFolders),this.AllowSpamFolder=n.pBool(i.AllowSpamFolder,this.AllowSpamFolder),this.AllowAddNewFolderOnMainScreen=n.pBool(i.AllowAddNewFolderOnMainScreen,this.AllowAddNewFolderOnMainScreen),this.ComposeToolbarOrder=n.pArray(i.ComposeToolbarOrder,this.ComposeToolbarOrder),this.DefaultFontName=n.pString(i.DefaultFontName,this.DefaultFontName),this.DefaultFontSize=n.pPositiveInt(i.DefaultFontSize,this.DefaultFontSize),this.JoinReplyPrefixes=n.pBool(i.JoinReplyPrefixes,this.JoinReplyPrefixes),this.MailsPerPage=n.pPositiveInt(i.MailsPerPage,this.MailsPerPage),this.MaxMessagesBodiesSizeToPrefetch=n.pNonNegativeInt(i.MaxMessagesBodiesSizeToPrefetch,this.MaxMessagesBodiesSizeToPrefetch),this.MessageBodyTruncationThreshold=n.pNonNegativeInt(i.MessageBodyTruncationThreshold,this.MessageBodyTruncationThreshold),this.ShowEmailAsTabName=n.pBool(i.ShowEmailAsTabName,this.ShowEmailAsTabName),this.AllowShowMessagesCountInFolderList=n.pBool(i.AllowShowMessagesCountInFolderList,this.AllowShowMessagesCountInFolderList),this.showMessagesCountInFolderList(n.pBool(i.ShowMessagesCountInFolderList,this.showMessagesCountInFolderList())),this.AllowSearchMessagesBySubject=n.pBool(i.AllowSearchMessagesBySubject,this.AllowSearchMessagesBySubject),this.PrefixesToRemoveBeforeSearchMessagesBySubject=n.pArray(i.PrefixesToRemoveBeforeSearchMessagesBySubject,this.PrefixesToRemoveBeforeSearchMessagesBySubject),this.AllowHorizontalLayout=n.pBool(i.AllowHorizontalLayout,this.AllowHorizontalLayout),this.HorizontalLayout=this.AllowHorizontalLayout&&n.pBool(i.HorizontalLayout,this.HorizontalLayout),this.HorizontalLayoutByDefault=this.AllowHorizontalLayout&&n.pBool(i.HorizontalLayoutByDefault,this.HorizontalLayoutByDefault)),o.isEmpty(a)||(this.AllowFetchers=n.pBool(a.AllowFetchers,this.AllowFetchers)),r.registerUserAccountsCount(this.userMailAccountsCount),r.registerAccountsWithPass(this.mailAccountsEmails)},update:function(e,t,s,i){this.AllowAutosaveInDrafts=n.pBool(t,this.AllowAutosaveInDrafts),this.AllowChangeInputDirection=n.pBool(s,this.AllowChangeInputDirection),this.MailsPerPage=n.pPositiveInt(e,this.MailsPerPage),this.showMessagesCountInFolderList(n.pBool(i,this.showMessagesCountInFolderList()))},updateAdmin:function(e,t,s){this.AutocreateMailAccountOnNewUserFirstLogin=n.pBool(e,this.AutocreateMailAccountOnNewUserFirstLogin),this.AllowAddAccounts=n.pBool(t,this.AllowAddAccounts),this.HorizontalLayoutByDefault=n.pBool(s,this.HorizontalLayoutByDefault)},disableEditDomainsInServer:function(){this.AllowEditDomainsInServer=!1}}},314:function(e,t,s){"use strict";function i(){this.collection=n.observableArray([])}var o=s(2),n=s(44),r=s(181),a=s(182),l=a.isNewTab()&&window.opener?window.opener.MainTabMailMethods:null,h=s(195),u=s(191),c=s(315),d=s(318),p=s(313),m=s(343),g=s(347),f=s(348);i.prototype.getAccountByHash=function(e){return o.find(this.collection(),function(t){return t.hash()===e},this)},i.prototype.changeCurrentAccountByHash=function(e){var t=this.getAccountByHash(e);t&&t.id()!==this.currentId()&&this.changeCurrentAccount(t.id(),!1)},i.prototype.changeCurrentAccount=function(e,t){var s=this.getCurrent(),i=this.getAccount(e);i&&this.currentId()!==e?(s&&s.isCurrent(!1),this.currentId(e),i.isCurrent(!0)):s||this.currentId(0),t&&h.setHash(d.getMailbox())},i.prototype.changeEditedAccountByHash=function(e){var t=this.getAccountByHash(e);t&&t.id()!==this.editedId()&&this.changeEditedAccount(t.id())},i.prototype.changeEditedAccount=function(e){var t=this.getEdited(),s=this.getAccount(e);s&&this.editedId()!==e?(t&&t.isEdited(!1),this.editedId(e),s.isEdited(!0)):t||this.editedId(0)},i.prototype.getDefaultFriendlyName=function(){var e=this.getCurrent(),t=o.find(e&&e.identities()||[],function(e){return e.isDefault()})||e;return t?t.friendlyName()||t.email():""},i.prototype.getIdentityByHash=function(e){var t=null;return o.each(this.collection(),function(s){t||(t=o.find(s.identities()||[],function(t){return t.hash()===e}))},this),t},i.prototype.getFetcherByHash=function(e){var t=null;return o.each(this.collection(),function(s){t||(t=o.find(s.fetchers(),function(t){return t.hash()===e}))},this),t},i.prototype.parse=function(e){o.isArray(e)&&(this.collection(o.map(e,function(e){return new m(e)})),this.initObservables(this.collection().length>0?this.collection()[0].id():0))},i.prototype.initObservables=function(e){var t=this.getAccount(e);t&&(t.isCurrent(!0),t.isEdited(!0)),this.currentId=n.observable(e),this.editedId=n.observable(e)},i.prototype.hasAccount=function(){return this.collection().length>0},i.prototype.getAccount=function(e){var t=o.find(this.collection(),function(t){return t.id()===e},this);return t},i.prototype.getDefault=function(){var e=o.find(this.collection(),function(e){return e.bDefault},this);return e},i.prototype.getCurrent=function(){return this.getAccount(this.currentId())},i.prototype.getEdited=function(){return this.getAccount(this.editedId())},i.prototype.getEmail=function(e){e=e||this.currentId();var t="",s=this.getAccount(e);return s&&(t=s.email()),t},i.prototype.addAccount=function(e){this.collection.push(e)},i.prototype.deleteAccount=function(e){this.collection.remove(function(t){return t.id()===e});var t=this.collection().length>0?this.collection()[0].id():0;this.changeCurrentAccount(t,!1),this.changeEditedAccount(t)},i.prototype.hasAccountWithId=function(e){var t=o.find(this.collection(),function(t){return t.id()===e},this);return!!t},i.prototype.populateFetchersIdentities=function(){this.populateFetchers(),this.populateIdentities()},i.prototype.populateFetchers=function(){p.AllowFetchers&&u.send(p.FetchersServerModuleName,"GetFetchers",{AccountID:this.editedId()},this.onGetFetchersResponse,this)},i.prototype.onGetFetchersResponse=function(e,t){var s={};r.isNonEmptyArray(e.Result)&&o.each(e.Result,function(e){var t=new g;t.parse(e),s[t.accountId()]||(s[t.accountId()]=[]),s[t.accountId()].push(t)}),o.each(this.collection(),function(e){var t=r.isNonEmptyArray(s[e.id()])?s[e.id()]:[];e.fetchers(t)},this)},i.prototype.populateIdentities=function(e){p.AllowIdentities&&this.collection().length>=1&&c.send("GetIdentities",null,function(t,s){this.onGetIdentitiesResponse(t,s),o.isFunction(e)&&e()},this)},i.prototype.onGetIdentitiesResponse=function(e,t){var s={};r.isNonEmptyArray(e.Result)&&o.each(e.Result,function(e){var t=new f,i=-1;t.parse(e),i=t.accountId(),s[i]||(s[i]=[]),s[i].push(t)}),o.each(this.collection(),function(e){var t=s[e.id()],i=new f;r.isNonEmptyArray(t)||(t=[]),i.parse({"@Object":"Object/Aurora\\Modules\\Mail\\Classes\\Identity",AccountPart:!0,Default:!o.find(t,function(e){return e.isDefault()}),Email:e.email(),FriendlyName:e.friendlyName(),IdAccount:e.id(),EntityId:1e5*e.id(),Signature:e.signature(),UseSignature:e.useSignature()}),t.unshift(i),e.identities(t)})},i.prototype.populateIdentitiesFromSourceAccount=function(e){e&&o.each(this.collection(),function(t){var s=e.getAccount(t.id());s&&(t.fetchers(s.fetchers()),t.identities(s.identities()),t.signature(s.signature()),t.useSignature(s.useSignature()))})},i.prototype.getAccountsEmails=function(){return o.uniq(o.map(this.collection(),function(e){return e.email()}))},i.prototype.getAllFullEmails=function(){var e=[];return o.each(this.collection(),function(t){t&&(r.isNonEmptyArray(t.identities())?o.each(t.identities(),function(t){e.push(t.fullEmail())}):e.push(t.fullEmail()),o.each(t.fetchers(),function(t){t.isEnabled()&&t.isOutgoingEnabled()&&""!==t.fullEmail()&&e.push(t.fullEmail())}))}),e},i.prototype.getCurrentFetchersAndFiltersFolderNames=function(){var e=this.getCurrent(),t=[];return e&&(e.filters()&&o.each(e.filters().collection(),function(e){t.push(e.folder())},this),o.each(e.fetchers(),function(e){t.push(e.folder())},this)),t},i.prototype.getAttendee=function(e){var t=[],s="";return o.each(this.collection(),function(e){t=e.isCurrent()?o.union([e.email()],e.getFetchersIdentitiesEmails(),t):o.union(t,[e.email()],e.getFetchersIdentitiesEmails())}),t=o.uniq(t),o.each(t,o.bind(function(t){if(""===s){var i=o.find(e,function(e){return e===t});i===t&&(s=t)}},this)),s};var b=new i;window.auroraAppData.Mail&&o.isArray(window.auroraAppData.Mail.Accounts)?b.parse(window.auroraAppData.Mail.Accounts):b.parse([]),l&&b.populateIdentitiesFromSourceAccount(l.getAccountList()),e.exports=b},315:function(e,t,s){"use strict";var i=s(191),o=s(313);i.registerAbortRequestHandler(o.ServerModuleName,function(e,t){var s=e.Parameters,i=t.Parameters;switch(e.Method){case"MoveMessages":case"DeleteMessages":return"GetMessage"===t.Method||"GetMessages"===t.Method&&i.Folder===s.Folder;case"GetMessages":case"SetMessagesSeen":case"SetMessageFlagged":return"GetMessages"===t.Method&&i.Folder===s.Folder;case"SetAllMessagesSeen":return("GetMessages"===t.Method||"GetMessages"===t.Method)&&i.Folder===s.Folder;case"ClearFolder":return"GetRelevantFoldersInformation"===t.Method||"GetMessages"===t.Method&&i.Folder===s.Folder;case"GetRelevantFoldersInformation":return"GetRelevantFoldersInformation"===t.Method&&s.AccountID===i.AccountID;case"GetMessagesFlags":return"GetMessagesFlags"===t.Method}return!1}),e.exports={getOpenedRequest:function(e){i.getOpenedRequest("Mail",e)},hasOpenedRequests:function(e){i.hasOpenedRequests("Mail",e)},registerOnAllRequestsClosedHandler:i.registerOnAllRequestsClosedHandler,send:function(e,t,n,r){var a=s(316),l="GetMessagesBodies"===e?1e5:void 0;t&&!t.AccountID&&(t.AccountID=a.currentAccountId()),i.send(o.ServerModuleName,e,t,n,r,l)}}},316:function(e,t,s){"use strict";function i(){this.currentAccountId=y.currentId,this.currentAccountId.subscribe(function(e){var t=y.getAccount(e),s=this.oFolderListItems[e];t?(t.quotaRecieved(!1),this.messagesLoadingError(!1),s?this.folderList(s):(this.messagesLoading(!0),this.folderList(new C),this.messages([]),this.currentMessage(null),this.getFolderList(e))):this.folderList(new C)},this),this.editedAccountId=y.editedId,this.editedAccountId.subscribe(function(e){var t=this.oFolderListItems[e];t?this.editedFolderList(t):this.currentAccountId()!==e&&(this.editedFolderList(new C),this.getFolderList(e))},this),this.oFolderListItems={},this.quotaChangeTrigger=r.observable(!1),this.checkMailStarted=r.observable(!1),this.checkMailStartedAccountId=r.observable(0),this.folderList=r.observable(new C),this.folderListLoading=r.observableArray([]),this.editedFolderList=r.observable(new C),this.newMessagesCount=r.computed(function(){var e=this.folderList().inboxFolder();return e?e.unseenMessageCount():0},this),this.messages=r.observableArray([]),this.messages.subscribe(function(){this.messages().length>0&&this.messagesLoadingError(!1)},this),this.uidList=r.observable(new F),this.page=r.observable(1),this.messagesLoading=r.observable(!1),this.messagesLoadingError=r.observable(!1),this.currentMessage=r.observable(null),this.nextMessageUid=r.observable(""),this.prevMessageUid=r.observable(""),this.savingDraftUid=r.observable(""),this.editedDraftUid=r.observable(""),this.disableComposeAutosave=r.observable(!1),this.aResponseHandlers=[],this.iAutoCheckMailTimer=-1,this.waitForUnseenMessages=r.observable(!0),this.iSetMessagesSeenCount=0,d.subscribeEvent("ReceiveAjaxResponse::after",o.bind(function(e){!this.checkMailStarted()&&"Ping"===e.Response.Method&&"Core"===e.Response.Module&&e.Response.Result&&this.setAutocheckmailTimer()},this))}var o=s(2),n=s(1),r=s(44),a=s(49),l=s(185),h=s(181),u=s(217),c=s(186),d=s(182),p=s(317),m=s(195),g=s(43),f=s(200),b=s(192),v=s(201),E=s(318),y=s(314),A=s(315),S=null,I=s(313),C=s(319),F=s(328),T=d.isNewTab()&&window.opener&&window.opener.MainTabMailMethods;i.prototype.requirePrefetcher=function(){S=s(329)},i.prototype.init=function(){if(A.registerOnAllRequestsClosedHandler(function(){o.delay(function(){A.hasOpenedRequests()||(L.checkMailStarted(!1),L.folderListLoading.removeAll())},10),A.hasOpenedRequests()||L.savingDraftUid("")}),T){if(this.oFolderListItems=T.getFolderListItems(),this.uidList(T.getUidList()),window.name){var e=h.pInt(window.name);0===e&&(e=T.getComposedMessageAccountId(window.name)),0!==e&&this.currentAccountId(e)}this.currentAccountId.valueHasMutated(),this.initPrevNextSubscribes()}else this.currentAccountId.valueHasMutated()},i.prototype.initPrevNextSubscribes=function(){this.bInThreadLevel=!1,this.currentMessage.subscribe(this.calcNextMessageUid,this),this.uidList.subscribe(this.calcNextMessageUid,this),this.currentMessage.subscribe(this.calcPrevMessageUid,this),this.uidList.subscribe(this.calcPrevMessageUid,this)},i.prototype.calcNextMessageUid=function(){var e="",t="",s=null,i=null,n=!1;this.currentMessage()&&(n=this.currentMessage().threadPart()&&""!==this.currentMessage().threadParentUid(),s=this.folderList().getFolderByFullName(this.currentMessage().folder()),e=this.currentMessage().uid(),this.bInThreadLevel||n?(this.bInThreadLevel=!0,n&&(i=s.getMessageByUid(this.currentMessage().threadParentUid()),i&&(o.each(i.threadUids(),function(s,i,o){s===e&&i>0&&(t=o[i-1])}),h.isNonEmptyString(t)||(t=i.uid())))):(o.each(this.uidList().collection(),function(s,i,o){s===e&&i>0&&(t=o[i-1]||"")}),""===t&&T&&(this.requirePrefetcher(),S.prefetchNextPage(e)))),this.nextMessageUid(t)},i.prototype.calcPrevMessageUid=function(){var e=this.currentMessage()?this.currentMessage().uid():"",t="",s=null,i=null,n=!1;this.currentMessage()&&(n=this.currentMessage().threadPart()&&""!==this.currentMessage().threadParentUid(),s=this.folderList().getFolderByFullName(this.currentMessage().folder()),e=this.currentMessage().uid(),this.bInThreadLevel||n?(this.bInThreadLevel=!0,n?(i=s.getMessageByUid(this.currentMessage().threadParentUid()),i&&o.each(i.threadUids(),function(s,i,o){s===e&&i+1<o.length&&(t=o[i+1]||"")})):this.currentMessage().threadCount()>0&&(t=this.currentMessage().threadUids()[0])):(o.each(this.uidList().collection(),function(s,i,o){s===e&&i+1<o.length&&(t=o[i+1]||"")}),""===t&&T&&(this.requirePrefetcher(),S.prefetchPrevPage(e)))),this.prevMessageUid(t)},i.prototype.getCurrentFolder=function(){return this.folderList().currentFolder()},i.prototype.getFolderByFullName=function(e,t){var s=this.oFolderListItems[e];return s?s.getFolderByFullName(t):null},i.prototype.checkCurrentFolderList=function(){var e=y.getCurrent(),t=e?this.oFolderListItems[e.id()]:null;!e||t||this.messagesLoading()||(this.messagesLoading(!0),this.messagesLoadingError(!1),this.getFolderList(e.id()))},i.prototype.getFolderList=function(e){var t=y.getAccount(e);t?(this.folderListLoading.push(e),A.send("GetFolders",{AccountID:e},this.onGetFoldersResponse,this)):e===this.currentAccountId()&&this.messagesLoading(!1)},i.prototype.markMessageReplied=function(e,t,s,i){var o=this.oFolderListItems[e],n=null;o&&(n=o.getFolderByFullName(t),n&&n.markMessageReplied(s,i))},i.prototype.hideThreads=function(e){var t=y.getCurrent();t&&t.threadingIsAvailable()&&e.folder()===this.folderList().currentFolderFullName()&&!e.threadOpened()&&this.folderList().currentFolder().hideThreadMessages(e)},i.prototype.showOpenedThreads=function(e){this.messages(this.getMessagesWithThreads(e,this.uidList(),this.messages()))},i.prototype.useThreadingInCurrentList=function(e){e=e||this.uidList();var t=y.getCurrent(),s=this.folderList().currentFolder(),i=s&&s.withoutThreads(),o=""===e.search()&&""===e.filters();return t&&t.threadingIsAvailable()&&!i&&o},i.prototype.getMessagesWithThreads=function(e,t,s){var i=[],n=[],r=this.folderList().currentFolder();return r&&e===r.fullName()&&this.useThreadingInCurrentList(t)?(n=o.filter(s,function(e){return!e.threadPart()}),o.each(n,function(e){var t=[];i.push(e),e.threadCount()>0&&(e.threadOpened()&&(t=this.folderList().currentFolder().getThreadMessages(e),i=o.union(i,t)),r.computeThreadData(e))},this),i):s},i.prototype.setMessagesFromUidList=function(e,t,s,i){var n=e.getUidsForOffset(t,s),r=o.map(n,function(e){return s[e]},this),a=r.length;return i&&(this.messages(this.getMessagesWithThreads(this.folderList().currentFolderFullName(),e,r)),t+a<e.resultCount()&&a<I.MailsPerPage&&(e.filters()!==Enums.FolderFilter.Unseen||this.waitForUnseenMessages())&&this.messagesLoading(!0),this.currentMessage()&&(this.currentMessage().deleted()||this.currentMessage().folder()!==this.folderList().currentFolderFullName())&&this.currentMessage(null)),n},i.prototype.getNamesOfFoldersToRefresh=function(){var e=this.oFolderListItems[this.currentAccountId()],t=e?e.getNamesOfFoldersToRefresh():[],s=y.getCurrentFetchersAndFiltersFolderNames();return t=o.uniq(o.compact(o.union(t,s)))},i.prototype.getUseListStatusIfPossibleValue=function(e){var t=this.oFolderListItems[this.currentAccountId()],s=t?t.getFoldersCount():0;return s<100||e>50},i.prototype.executeCheckMail=function(e){var t=this.currentAccountId(),s=this.getNamesOfFoldersToRefresh(),i=this.checkMailStarted()&&this.checkMailStartedAccountId()===t,o=null;d.getUserRole()!==Enums.UserRole.Anonymous&&(e||!A.hasOpenedRequests("GetRelevantFoldersInformation")||!i)&&s.length>0&&(o={AccountID:t,Folders:s,UseListStatusIfPossible:this.getUseListStatusIfPossibleValue(s.length)},this.checkMailStarted(!0),this.checkMailStartedAccountId(t),y.getAccount(t)&&A.send("GetRelevantFoldersInformation",o,this.onGetRelevantFoldersInformationResponse,this))},i.prototype.setAutocheckmailTimer=function(){clearTimeout(this.iAutoCheckMailTimer),!d.isNewTab()&&g.AutoRefreshIntervalMinutes>0&&(this.iAutoCheckMailTimer=setTimeout(function(){L.isSearchExecuting()||(L.checkMessageFlags(),L.executeCheckMail(!1))},60*g.AutoRefreshIntervalMinutes*1e3))},i.prototype.isSearchExecuting=function(){var e=A.getOpenedRequest("GetMessages"),t=e&&e.Parameters;return t&&""!==t.Search},i.prototype.checkMessageFlags=function(){var e=this.folderList().inboxFolder(),t=e?e.getFlaggedMessageUids():[],s={Folder:this.folderList().inboxFolderFullName(),Uids:t};t.length>0&&A.send("GetMessagesFlags",s,this.onGetMessagesFlagsResponse,this)},i.prototype.onGetMessagesFlagsResponse=function(e,t){var s=t.Parameters,i=this.oFolderListItems[s.AccountID],n=i?i.inboxFolder():null;n&&(e.Result&&o.each(e.Result,function(e,t){o.indexOf(e,"\\flagged")===-1&&n.setMessageUnflaggedByUid(t)}),n.removeFlaggedMessageListsFromCache(),this.requirePrefetcher(),S.prefetchStarredMessageList())},i.prototype.changeCurrentMessageList=function(e,t,s,i){this.requestCurrentMessageList(e,t,s,i,!0)},i.prototype.requestCurrentMessageList=function(e,t,s,i,o){var n=this.requestMessageList(e,t,s,i||"",!0,o||!1),r=60*g.AutoRefreshIntervalMinutes*1e3,l=n.Folder.relevantInformationLastMoment?a().diff(n.Folder.relevantInformationLastMoment):r+1;this.uidList(n.UidList),this.page(t),this.messagesLoading(n.RequestStarted),this.messagesLoadingError(!1),!n.RequestStarted&&r>0&&l>r&&this.executeCheckMail(!0)},i.prototype.requestMessageList=function(e,t,s,i,o,n){var r=this.oFolderListItems[this.currentAccountId()],a=r?r.getFolderByFullName(e):null,l=a&&a.withoutThreads(),h=y.getCurrent(),u=h&&h.threadingIsAvailable()&&!l&&""===s&&""===i,c=a?a.getUidList(s,i):null,d=c&&c.resultCount()===-1,p=(t-1)*I.MailsPerPage,m={Folder:e,Offset:p,Limit:I.MailsPerPage,Search:s,Filters:i,UseThreading:u},g=!1,f=!1,b=o?this.onCurrentGetMessagesResponse:this.onGetMessagesResponse,v=[];return a.type()===Enums.FolderTypes.Inbox&&""===i?m.InboxUidnext=a.sUidNext:m.InboxUidnext="",d&&c.search()===this.uidList().search()&&c.filters()===this.uidList().filters()&&(c=this.uidList()),c&&(v=this.setMessagesFromUidList(c,p,a.oMessages,n)),c&&(f=d||p+v.length<c.resultCount()&&v.length<I.MailsPerPage,g=a.hasChanges()||f),g?A.send("GetMessages",m,b,this):this.waitForUnseenMessages(!1),{UidList:c,RequestStarted:g,DataExpected:f,Folder:a}},i.prototype.executeEmptyTrash=function(){var e=this.folderList().trashFolder();e&&e.emptyFolder()},i.prototype.executeEmptySpam=function(){var e=this.folderList().spamFolder();e&&e.emptyFolder()},i.prototype.onClearFolder=function(e){if(e&&e.selected()){this.messages.removeAll(),this.currentMessage(null);var t=e?e.getUidList(this.uidList().search(),this.uidList().filters()):null;t?this.uidList(t):this.uidList(new F),this.checkMailStarted(!1),this.setAutocheckmailTimer()}},i.prototype.getOpenedDraftUids=function(){var e=f.getOpenedWindows(),t=o.map(e,function(e){return e.SlaveTabMailMethods&&window.location.origin===e.location.origin?e.SlaveTabMailMethods.getEditedDraftUid():""});return b.hasOpenedMinimizedPopups()&&t.push(this.editedDraftUid()),o.uniq(o.compact(t))},i.prototype.closeComposesWithDraftUids=function(e){var t=f.getOpenedWindows();if(o.each(t,function(t){t.SlaveTabMailMethods&&window.location.origin===t.location.origin&&-1!==n.inArray(t.SlaveTabMailMethods.getEditedDraftUid(),e)&&t.close()}),-1!==n.inArray(this.editedDraftUid(),e)){var i=s(330);o.isFunction(i.closeComposePopup)&&i.closeComposePopup()}},i.prototype.moveMessagesToFolder=function(e,t){if(t.length>0){var s=this.folderList().currentFolder(),i=s&&s.type()===Enums.FolderTypes.Drafts,r=i&&this.getOpenedDraftUids(),a=i&&o.find(t,o.bind(function(e){return-1!==n.inArray(e,r)},this)),h=this.folderList().getFolderByFullName(e),u={Folder:s?s.fullName():"",ToFolder:e,Uids:t.join(",")},c=null,d=o.bind(function(){this.uidList().filters()===Enums.FolderFilter.Unseen&&this.uidList().resultCount()>I.MailsPerPage&&this.waitForUnseenMessages(!0),c=s.markDeletedByUids(t),h.addMessagesCountsDiff(c.MinusDiff,c.UnseenMinusDiff),h.recivedAnim(!0),this.excludeDeletedMessages(),h.markHasChanges(),A.send("MoveMessages",u,this.onMoveMessagesResponse,this)},this);s&&h&&(a?(this.disableComposeAutosave(!0),b.showPopup(v,[l.i18n("MAILWEBCLIENT/CONFIRM_MESSAGE_FOR_DELETE_IS_EDITED"),o.bind(function(e){e&&(this.closeComposesWithDraftUids(t),d()),this.disableComposeAutosave(!1)},this),"",l.i18n("MAILWEBCLIENT/ACTION_CLOSE_DELETE_DRAFT")])):d())}},i.prototype.copyMessagesToFolder=function(e,t){if(t.length>0){var s=this.folderList().currentFolder(),i=this.folderList().getFolderByFullName(e),o={Folder:s?s.fullName():"",ToFolder:e,Uids:t.join(",")};s&&i&&(i.recivedAnim(!0),i.markHasChanges(),A.send("CopyMessages",o,this.onCopyMessagesResponse,this))}},i.prototype.excludeDeletedMessages=function(){o.delay(o.bind(function(){var e=this.folderList().currentFolder(),t=(this.page()-1)*I.MailsPerPage;this.setMessagesFromUidList(this.uidList(),t,e.oMessages,!0)},this),500)},i.prototype.removeOneMessageFromCacheForFolder=function(e,t,s){var i=this.oFolderListItems[e],o=i?i.getFolderByFullName(t):null;o&&o.type()===Enums.FolderTypes.Drafts&&(o.markDeletedByUids([s]),o.commitDeleted([s]))},i.prototype.startMessagesLoadingWhenDraftSaving=function(e,t){var s=this.oFolderListItems[e],i=s?s.getFolderByFullName(t):null;i&&i.type()===Enums.FolderTypes.Drafts&&i.selected()&&this.messagesLoading(!0)},i.prototype.removeMessagesFromCacheForFolder=function(e,t){var s=this.oFolderListItems[e],i=s?s.getFolderByFullName(t):null,o=s?s.currentFolderFullName():null;i&&(i.markHasChanges(),this.currentAccountId()===e&&t===o&&this.requestCurrentMessageList(o,this.page(),this.uidList().search(),"",!0))},i.prototype.deleteMessages=function(e){var t=this.folderList().currentFolder();t&&this.deleteMessagesFromFolder(t,e)},i.prototype.deleteMessagesFromFolder=function(e,t){var s={Folder:e.fullName(),Uids:t.join(",")};e.markDeletedByUids(t),this.excludeDeletedMessages(),A.send("DeleteMessages",s,this.onMoveMessagesResponse,this)},i.prototype.showExternalPictures=function(e){var t=[],s=null;this.currentMessage()&&(t=this.currentMessage().oFrom.aCollection,s=this.folderList().getFolderByFullName(this.currentMessage().folder()),e&&t.length>0?s.alwaysShowExternalPicturesForSender(t[0].sEmail):s.showExternalPictures(this.currentMessage().uid()))},i.prototype.setCurrentMessage=function(e,t){var s=this.folderList().currentFolder(),i=null;!d.isNewTab()||s&&s.fullName()===t||(this.folderList().setCurrentFolder(t,""),s=this.folderList().currentFolder()),s&&e&&(i=s.oMessages[e]),i&&!i.deleted()?(this.currentMessage(i),this.currentMessage().seen()||this.executeGroupOperation("SetMessagesSeen",[this.currentMessage().uid()],"seen",!0),s.getCompletelyFilledMessage(e,this.onCurrentMessageResponse,this)):(this.currentMessage(null),d.isNewTab()&&s&&s.getCompletelyFilledMessage(e,this.onCurrentMessageResponse,this))},i.prototype.onCurrentMessageResponse=function(e,t,s){var i=this.currentMessage()?this.currentMessage().uid():"";null===e&&T&&s&&c.showErrorByCode(s,"",!0),null===e&&i===t?this.currentMessage(null):e&&i===t?this.currentMessage.valueHasMutated():d.isNewTab()&&e&&null===this.currentMessage()&&this.currentMessage(e)},i.prototype.getMessage=function(e,t,s,i){var o=this.folderList().getFolderByFullName(e);o&&o.getCompletelyFilledMessage(t,s,i)},i.prototype.executeGroupOperation=function(e,t,s,i){var o=this.folderList().currentFolder(),n={Folder:o?o.fullName():"",Uids:t.join(","),SetAction:i},r=(this.page()-1)*I.MailsPerPage,a=t.length,l=this.folderList().oStarredFolder?this.folderList().oStarredFolder.messageCount():0,h=o?o.getUidList("",Enums.FolderFilter.Flagged):null,u="SetMessagesSeen"===e?this.onSetMessagesSeenResponse:function(){};o&&("SetMessagesSeen"===e&&this.iSetMessagesSeenCount++,A.send(e,n,u,this),o.executeGroupOperation(s,t,i),o.type()===Enums.FolderTypes.Inbox&&"flagged"===s&&(this.uidList().filters()===Enums.FolderFilter.Flagged?i||(this.uidList().deleteUids(t),this.folderList().oStarredFolder&&this.folderList().oStarredFolder.messageCount(h.resultCount())):(o.removeFlaggedMessageListsFromCache(),""===this.uidList().search()&&this.folderList().oStarredFolder&&(i?this.folderList().oStarredFolder.messageCount(l+a):this.folderList().oStarredFolder.messageCount(l-a>0?l-a:0)))),"seen"===s&&o.removeUnseenMessageListsFromCache(),(this.uidList().filters()!==Enums.FolderFilter.Unseen||this.waitForUnseenMessages())&&this.setMessagesFromUidList(this.uidList(),r,o.oMessages,!0))},i.prototype.onSetMessagesSeenResponse=function(e,t){this.iSetMessagesSeenCount--,
  this.iSetMessagesSeenCount<0&&(this.iSetMessagesSeenCount=0),this.folderList().currentFolder()&&0===this.iSetMessagesSeenCount&&(this.uidList().filters()!==Enums.FolderFilter.Unseen||this.waitForUnseenMessages())&&this.requestCurrentMessageList(this.folderList().currentFolder().fullName(),this.page(),this.uidList().search(),this.uidList().filters(),!1)},i.prototype.onGetFoldersResponse=function(e,t){var s=t.Parameters,i=new C,n=s.AccountID,r=this.oFolderListItems[n],a=r?r.oNamedCollection:{};e.Result===!1?(c.showErrorByCode(e),s.AccountID===this.currentAccountId()&&0===this.messages().length&&(this.messagesLoading(!1),this.messagesLoadingError(!0))):(i.parse(n,e.Result,a),r&&i.oStarredFolder.messageCount(r.oStarredFolder.messageCount()),this.oFolderListItems[n]=i,setTimeout(o.bind(this.getAllFoldersRelevantInformation,this,n),2e3),this.currentAccountId()===n&&this.folderList(i),this.editedAccountId()===n&&this.editedFolderList(i)),this.folderListLoading.remove(n)},i.prototype.getAllFoldersRelevantInformation=function(e){var t=this.oFolderListItems[e],s=t?t.getFoldersWithoutCountInfo():[],i={AccountID:e,Folders:s,UseListStatusIfPossible:this.getUseListStatusIfPossibleValue(s.length)};s.length>0&&y.getAccount(e)&&A.send("GetRelevantFoldersInformation",i,this.onGetRelevantFoldersInformationResponse,this)},i.prototype.onGetRelevantFoldersInformationResponse=function(e,t){var s=!1,i=t.Parameters,n=i.AccountID,r=this.oFolderListItems[n],a=this.folderList().currentFolderFullName(),l=this.currentAccountId()===n;e.Result===!1?(c.showErrorByCode(e),A.hasOpenedRequests("GetRelevantFoldersInformation")&&(s=!0)):r&&(o.each(e.Result&&e.Result.Counts,function(e,t){if(o.isArray(e)&&e.length>3){var i=e[0],n=e[1],h=e[2],u=e[3],c=!1,d=!1,p=null;p=r.getFolderByFullName(t),p&&(d=l&&p.fullName()===a,c=p.setRelevantInformation(h,u,i,n,d),d&&c&&this.uidList().filters()!==Enums.FolderFilter.Unseen&&(this.requestCurrentMessageList(p.fullName(),this.page(),this.uidList().search(),this.uidList().filters(),!1),s=!0))}},this),r.countsCompletelyFilled(!0)),this.checkMailStarted(s),this.checkMailStarted()||this.setAutocheckmailTimer()},i.prototype.showNotificationsForNewMessages=function(e){var t=this.folderList().currentFolderFullName(),s=0,i="",n={},r="",a=[];e.Result.New&&e.Result.New.length>0&&(s=e.Result.New.length,i=e.Result.New[0].Uid,n={action:"show",icon:"static/styles/images/logo_140x140.png",title:l.i18n("MAILWEBCLIENT/INFO_NEW_MESSAGES_PLURAL",{COUNT:s},null,s),timeout:5e3,callback:function(){window.focus(),m.setHash(E.getMailbox(t,1,i,"",""))}},1===s&&(h.isNonEmptyString(e.Result.New[0].Subject)&&a.push(l.i18n("MAILWEBCLIENT/LABEL_SUBJECT")+": "+e.Result.New[0].Subject),r=o.map(e.Result.New[0].From,function(e){return""!==e.DisplayName?e.DisplayName:e.Email}).join(", "),h.isNonEmptyString(r)&&a.push(l.i18n("MAILWEBCLIENT/LABEL_FROM")+": "+r),n.body=a.join("\r\n")),u.desktopNotify(n))},i.prototype.onCurrentGetMessagesResponse=function(e,t){this.checkMailStarted(!1),e.Result?(this.messagesLoadingError(!1),this.parseMessageList(e,t)):(c.showErrorByCode(e),this.messagesLoading()!==!0||0!==this.messages().length&&e.ErrorCode===Enums.Errors.NotDisplayedError||this.messagesLoadingError(!0),this.messagesLoading(!1),this.setAutocheckmailTimer())},i.prototype.onGetMessagesResponse=function(e,t){e&&e.Result&&this.parseMessageList(e,t)},i.prototype.parseMessageList=function(e,t){var s=e.Result,i=t.Parameters,n=i.AccountID,r=this.oFolderListItems[n],a=null,l=null,h=i.UseThreading,u=!1,c=this.currentAccountId()===n&&this.folderList().currentFolderFullName()===s.FolderName,d=c&&this.uidList().search()===s.Search&&this.uidList().filters()===s.Filters,p=this.page()===s.Offset/I.MailsPerPage+1,m=[];this.showNotificationsForNewMessages(e),s!==!1&&"Collection/MessageCollection"===s["@Object"]&&(a=r.getFolderByFullName(s.FolderName),a.setRelevantInformation(""+s.UidNext,s.FolderHash,s.MessageCount,s.MessageUnseenCount,c&&!d),u=a.hasChanges(),a.removeAllMessageListsFromCacheIfHasChanges(),l=a.getUidList(s.Search,s.Filters),l.setUidsAndCount(s),o.each(s["@Collection"],function(e){var t=a.parseAndCacheMessage(e,!1,h);m.push(t)},this),d&&(this.uidList(l),p&&(l.filters()!==Enums.FolderFilter.Unseen||this.waitForUnseenMessages())&&(this.messagesLoading(!1),this.waitForUnseenMessages(!1),this.setMessagesFromUidList(l,s.Offset,a.oMessages,!0),this.messagesLoading()||this.setAutocheckmailTimer())),!u||!c||d&&p||this.uidList().filters()===Enums.FolderFilter.Unseen||this.requestCurrentMessageList(this.folderList().currentFolderFullName(),this.page(),this.uidList().search(),this.uidList().filters(),!1),a.type()===Enums.FolderTypes.Inbox&&l.filters()===Enums.FolderFilter.Flagged&&""===l.search()&&this.folderList().oStarredFolder&&(this.folderList().oStarredFolder.messageCount(l.resultCount()),this.folderList().oStarredFolder.hasExtendedInfo(!0)))},i.prototype.increaseStarredCount=function(){this.folderList().oStarredFolder&&this.folderList().oStarredFolder.increaseCountIfHasNotInfo()},i.prototype.onMoveMessagesResponse=function(e,t){var s=e.Result,i=t.Parameters,n=this.folderList().getFolderByFullName(i.Folder),r=this.folderList().getFolderByFullName(i.ToFolder),a=r&&r.type()===Enums.FolderTypes.Trash,u=r&&r.type()===Enums.FolderTypes.Spam,d=null,p=a?l.i18n("MAILWEBCLIENT/CONFIRM_MESSAGES_DELETE_WITHOUT_TRASH"):l.i18n("MAILWEBCLIENT/CONFIRM_MESSAGES_MARK_SPAM_WITHOUT_SPAM"),g=o.bind(function(e){e&&n&&this.deleteMessagesFromFolder(n,i.Uids.split(","))},this),f=this.folderList().currentFolder(),E=f?f.fullName():"",y=!1;if(s===!1?(n&&(d=n.revertDeleted(i.Uids.split(","))),r?(d&&r.addMessagesCountsDiff(-d.PlusDiff,-d.UnseenPlusDiff),e.ErrorCode===Enums.MailErrors.CannotMoveMessageQuota&&(a||u)?(h.isNonEmptyString(e.ErrorMessage)&&(p+=" ("+e.ErrorMessage+")"),b.showPopup(v,[p,g])):c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_MOVING_MESSAGES"))):c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_DELETING_MESSAGES")),y=!0):n&&(n.commitDeleted(i.Uids.split(",")),o.each(i.Uids.split(","),function(e){m.replaceHashWithoutMessageUid(e)})),n&&E===n.fullName()||r&&E===r.fullName())switch(f.markHasChanges(),this.uidList().filters()){case Enums.FolderFilter.Flagged:break;case Enums.FolderFilter.Unseen:this.waitForUnseenMessages()&&this.requestCurrentMessageList(E,this.page(),this.uidList().search(),this.uidList().filters(),y);break;default:this.requestCurrentMessageList(E,this.page(),this.uidList().search(),this.uidList().filters(),y)}else n&&E!==n.fullName()?(this.requirePrefetcher(),S.startFolderPrefetch(n)):r&&E!==r.fullName()&&(this.requirePrefetcher(),S.startFolderPrefetch(r))},i.prototype.onCopyMessagesResponse=function(e,t){var s=e.Result,i=t.Parameters,o=this.folderList().getFolderByFullName(i.Folder),n=this.folderList().getFolderByFullName(i.ToFolder),r=this.folderList().currentFolder(),a=r.fullName();s===!1&&c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_COPYING_MESSAGES")),a===o.fullName()||n&&a===n.fullName()?(r.markHasChanges(),this.requestCurrentMessageList(a,this.page(),this.uidList().search(),"",!1)):a!==o.fullName()?(this.requirePrefetcher(),S.startFolderPrefetch(o)):n&&a!==n.fullName()&&(this.requirePrefetcher(),S.startFolderPrefetch(n))},i.prototype.searchMessagesInCurrentFolder=function(e){var t=this.folderList().currentFolderFullName()||"INBOX",s=this.currentMessage()?this.currentMessage().uid():"",i=this.uidList().filters();m.setHash(E.getMailbox(t,1,s,e,i))},i.prototype.searchMessagesInInbox=function(e){m.setHash(E.getMailbox(this.folderList().inboxFolderFullName()||"INBOX",1,"",e,""))},i.prototype.getFolderHash=function(e){return m.buildHashFromArray(E.getMailbox(e,1,"","",""))},i.prototype.countMessages=function(e){var t=[],s=function(e){o.each(e.subfolders(),function(e,i){e.subscribed()&&(t.push(e.unseenMessageCount()),e.subfolders().length&&e.subscribed()&&s(e))},this)};e.expanded()||e.bNamespace?e.subfoldersMessagesCount(0):(s(e),e.subfoldersMessagesCount(o.reduce(t,function(e,t){return e+t},0)))},i.prototype.changeDatesInMessages=function(){o.each(this.oFolderListItems,function(e){o.each(e.oNamedCollection,function(e){o.each(e.oMessages,function(e){e.updateMomentDate()},this)})})},i.prototype.clearMessagesCache=function(e){var t=this.oFolderListItems[e];o.each(t.collection(),function(e){e.markHasChanges(),e.removeAllMessageListsFromCacheIfHasChanges()},this),e===this.currentAccountId()&&this.messages([])},i.prototype.getTemplateFolder=function(){var e=this.folderList(),t="",s=e.currentFolder()?e.currentFolder().fullName():"";return h.isNonEmptyArray(this.getCurrentTemplateFolders())&&(t=-1!==n.inArray(s,this.getCurrentTemplateFolders())?s:o.find(this.getCurrentTemplateFolders(),function(t){return!!e.oNamedCollection[t]})),"string"==typeof t?t:""},i.prototype.getCurrentTemplateFolders=function(){return I.AllowTemplateFolders?this.folderList().aTemplateFolders:[]},i.prototype.changeTemplateFolder=function(e,t){I.AllowTemplateFolders&&this.folderList().changeTemplateFolder(e,t)};var L=new i;p.registerDayOfMonthFunction(o.bind(L.changeDatesInMessages,L)),g.timeFormat.subscribe(L.changeDatesInMessages,L),g.dateFormat.subscribe(L.changeDatesInMessages,L),e.exports=L},317:function(e,t,s){"use strict";var i=s(2),o=s(1),n=s(44),r=s(49),a=[],l=[],h=n.observable(r().date());window.setInterval(function(){i.each(a,function(e){e()}),h(r().date())},6e4),h.subscribe(function(){i.each(l,function(e){e()})},this),e.exports={registerEveryMinuteFunction:function(e){o.isFunction(e)&&a.push(e)},registerDayOfMonthFunction:function(e){o.isFunction(e)&&l.push(e)}}},318:function(e,t,s){"use strict";function i(e){return"p"===e.substr(0,1)&&/^[1-9][\d]*$/.test(e.substr(1))}function o(e){return"msg"===e.substr(0,3)&&/^[1-9][\d]*$/.test(e.substr(3))}var n=s(2),r=s(181),a=s(313),l={};l.getMailbox=function(e,t,i,o,n,l){var h=s(314),u=h.getCurrent(),c=[a.HashModuleName,u?u.hash():""];return t=r.pInt(t,1),i=r.pString(i),o=r.pString(o),n=r.pString(n),e&&""!==e&&c.push(e),n&&""!==n&&c.push("filter:"+n),1<t&&c.push("p"+t),i&&""!==i&&c.push("msg"+i),o&&""!==o&&c.push(o),l&&""!==l&&c.push("custom:"+l),c},l.parseMailbox=function(e,t){var s=e.length>0&&"compose"===e[0]&&"to"===e[1],n=s?[]:e,a="",l="INBOX",h=1,u="",c="",d="",p="",m="",g=0;return r.isNonEmptyArray(n)&&(a=r.pString(n[g]),g++),r.isNonEmptyArray(n)&&(l=r.pString(n[g]),g++,n.length>g&&(m=r.pString(n[g]),m==="filter:"+Enums.FolderFilter.Flagged&&(d=Enums.FolderFilter.Flagged,g++),m==="filter:"+Enums.FolderFilter.Unseen&&(d=Enums.FolderFilter.Unseen,g++)),n.length>g&&(m=r.pString(n[g]),i(m)&&(h=r.pInt(m.substr(1)),h<=0&&(h=1),g++)),n.length>g&&(m=r.pString(n[g]),o(m)&&(u=m.substr(3),g++)),n.length>g&&(m=r.pString(n[g]),"custom:"!==m.substr(0,7)&&(c=m,g++)),n.length>g&&(m=r.pString(n[g]),"custom:"===m.substr(0,7)&&(p=m.substr(7)))),{MailtoCompose:s,AccountHash:a,Folder:""===l?t:l,Page:h,Uid:u,Search:c,Filters:d,Custom:p}},l.getViewMessage=function(e,t){var i=s(314),o=i.getCurrent(),n=o?o.hash():"";return[a.HashModuleName+"-view",n,e,"msg"+t]},l.getCompose=function(){var e=s(314),t=e.getCurrent(),i=t?t.hash():"";return[a.HashModuleName+"-compose",i]},l.getComposeFromMessage=function(e,t,i){var o=s(314),n=o.getCurrent(),r=n?n.hash():"";return[a.HashModuleName+"-compose",r,e,t,i]},l.getComposeWithToField=function(e){var t=s(314),i=t.getCurrent(),o=i?i.hash():"";return[a.HashModuleName+"-compose",o,"to",e]},l.getComposeWithObject=function(e,t){var i=s(314),o=i.getCurrent(),n=o?o.hash():"";return[a.HashModuleName+"-compose",n,e,t]},l.getComposeWithEmlObject=function(e,t,i){var o=s(314),n=o.getCurrent(),r=n?n.hash():"";return[a.HashModuleName+"-compose",r,Enums.ReplyType.ForwardAsAttach,e,t,i]},l.parseCompose=function(e){var t=e.length>0?e[0]:"",s=e.length>1?e[1]:"",i=(s===Enums.ReplyType.ForwardAsAttach||"attachments"===s)&&e.length>2?s===Enums.ReplyType.ForwardAsAttach?e[4]:e[2]:null,o="to"===s&&e.length>2?l.parseToAddr(e[2]):null,n=(s===Enums.ReplyType.Reply||s===Enums.ReplyType.ReplyAll||s===Enums.ReplyType.Resend||s===Enums.ReplyType.Forward||"drafts"===s||s===Enums.ReplyType.ForwardAsAttach)&&e.length>2,r=n?e[2]:"",a=n?e[3]:"";return{AccountHash:t,RouteType:s,ToAddr:o,Object:i,MessageFolderName:r,MessageUid:a}},l.parseToAddr=function(e){var t=decodeURI(r.pString(e)),s=t.indexOf("mailto:")!==-1,i=[],o=[],a="",l="",h="",u="";return s&&(i=t.replace(/^mailto:/,"").split("?"),t=i[0],2===i.length&&(o=i[1].split("&"),n.each(o,function(e){var t=e.split("=");if(2===t.length)switch(t[0].toLowerCase()){case"subject":a=t[1];break;case"cc":l=t[1];break;case"bcc":h=t[1];break;case"body":u=t[1]}}))),{to:t,hasMailto:s,subject:a,cc:l,bcc:h,body:u}},e.exports=l},319:function(e,t,s){"use strict";function i(){this.iAccountId=0,this.initialized=n.observable(!1),this.bExpandFolders=!1,this.expandNames=n.observableArray([]),this.collection=n.observableArray([]),this.options=n.observableArray([]),this.sNamespaceFolder="",this.oStarredFolder=null,this.oNamedCollection={},this.aLinedCollection=[];var e=this,t=function(e){return function(t){t&&t.type(e)}},s=function(t){return{read:function(){return this.collection(),t()?t().fullName():""},write:function(e){t(this.getFolderByFullName(e))},owner:e}};this.currentFolder=n.observable(null),this.inboxFolder=n.observable(null),this.sentFolder=n.observable(null),this.draftsFolder=n.observable(null),this.spamFolder=n.observable(null),this.trashFolder=n.observable(null),this.aTemplateFolders=[],this.countsCompletelyFilled=n.observable(!1),this.inboxFolder.subscribe(t(Enums.FolderTypes.User),this,"beforeChange"),this.sentFolder.subscribe(t(Enums.FolderTypes.User),this,"beforeChange"),this.draftsFolder.subscribe(t(Enums.FolderTypes.User),this,"beforeChange"),this.spamFolder.subscribe(t(Enums.FolderTypes.User),this,"beforeChange"),this.trashFolder.subscribe(t(Enums.FolderTypes.User),this,"beforeChange"),this.inboxFolder.subscribe(t(Enums.FolderTypes.Inbox)),this.sentFolder.subscribe(t(Enums.FolderTypes.Sent)),this.draftsFolder.subscribe(t(Enums.FolderTypes.Drafts)),this.spamFolder.subscribe(t(Enums.FolderTypes.Spam)),this.trashFolder.subscribe(t(Enums.FolderTypes.Trash)),this.inboxFolderFullName=n.computed(s(this.inboxFolder)),this.sentFolderFullName=n.computed(s(this.sentFolder)),this.draftsFolderFullName=n.computed(s(this.draftsFolder)),this.spamFolderFullName=n.computed(s(this.spamFolder)),this.trashFolderFullName=n.computed(s(this.trashFolder)),this.currentFolderFullName=n.computed(s(this.currentFolder)),this.currentFolderType=n.computed(function(){return this.currentFolder()?this.currentFolder().type():Enums.FolderTypes.User},this),this.sDelimiter=""}var o=s(2),n=s(44),r=s(181),a=s(221),l=s(313),h=s(320);i.prototype.getFoldersCount=function(){return this.aLinedCollection.length},i.prototype.getTotalMessageCount=function(){var e=0;return o.each(this.oNamedCollection,function(t){e+=t.messageCount()},this),e},i.prototype.getFoldersWithoutCountInfo=function(){var e=o.compact(o.map(this.oNamedCollection,function(e,t){return e.canBeSelected()&&!e.hasExtendedInfo()?t:null}));return e},i.prototype.getNamesOfFoldersToRefresh=function(){var e=[this.inboxFolderFullName(),this.spamFolderFullName(),this.currentFolderFullName()];return o.each(this.oNamedCollection,function(t){t.isAlwaysRefresh()&&e.push(t.fullName())}),o.uniq(e)},i.prototype.setCurrentFolder=function(e,t){var s=this.getFolderByFullName(e);null!==s&&s.canBeSelected()||(s=this.inboxFolder()),null!==s&&(this.currentFolder()&&(this.currentFolder().selected(!1),this.oStarredFolder&&this.oStarredFolder.selected(!1)),this.currentFolder(s),t===Enums.FolderFilter.Flagged?this.oStarredFolder&&this.oStarredFolder.selected(!0):this.currentFolder().selected(!0))},i.prototype.getFolderByFullName=function(e){var t=this.oNamedCollection[e];return t?t:null},i.prototype.renameFolder=function(e,t,s){var i=this.oNamedCollection[e];i.fullName(t),i.fullNameHash(s),this.oNamedCollection[t]=i,this.oNamedCollection[e]=void 0},i.prototype.changeTemplateFolder=function(e,t){l.AllowTemplateFolders&&(t?this.aTemplateFolders.push(e):this.aTemplateFolders=o.without(this.aTemplateFolders,e))},i.prototype.parse=function(e,t,s){var i=r.pString(t.Namespace),o=t.Folders["@Collection"];i.length>0&&(this.sNamespaceFolder=i.substring(0,i.length-1)),this.iAccountId=e,this.initialized(!0),this.bExpandFolders=l.AllowExpandFolders&&!a.hasData("folderAccordion"),a.hasData("folderAccordion")||a.setData("folderAccordion",[]),this.oNamedCollection={},this.aLinedCollection=[],this.collection(this.parseRecursively(o,s))},i.prototype.parseRecursively=function(e,t,s,i){var n=[],l=0,u=0,c=null,d=null,p="",m=null,g=[];if(i=i||"",void 0===s&&(s=-1),s++,o.isArray(e)){for(u=e.length;l<u;l++){switch(p=r.pString(e[l].FullNameRaw),d=t[p],c=new h(this.iAccountId),m=c.parse(e[l],i,this.sNamespaceFolder),d&&d.hasExtendedInfo()&&!c.hasExtendedInfo()&&c.setRelevantInformation(d.sUidNext,d.sHash,d.messageCount(),d.unseenMessageCount(),!1),this.bExpandFolders&&null!==m&&(c.expanded(!0),this.expandNames().push(r.pString(e[l].Name))),c.setLevel(s),c.type()){case Enums.FolderTypes.Inbox:this.inboxFolder(c),this.sDelimiter=c.sDelimiter;break;case Enums.FolderTypes.Sent:this.sentFolder(c);break;case Enums.FolderTypes.Drafts:this.draftsFolder(c);break;case Enums.FolderTypes.Trash:this.trashFolder(c);break;case Enums.FolderTypes.Spam:this.spamFolder(c);break;case Enums.FolderTypes.Template:this.aTemplateFolders.push(c.fullName())}this.oNamedCollection[c.fullName()]=c,this.aLinedCollection.push(c),n.push(c),null===m&&c.type()===Enums.FolderTypes.Inbox?(this.createStarredFolder(c.fullName(),s),this.oStarredFolder&&n.push(this.oStarredFolder)):null!==m&&(g=this.parseRecursively(m["@Collection"],t,s,c.fullName()),c.type()===Enums.FolderTypes.Inbox&&(c.bNamespace?(this.createStarredFolder(c.fullName(),s+1),this.oStarredFolder&&g.unshift(this.oStarredFolder)):(this.createStarredFolder(c.fullName(),s),this.oStarredFolder&&n.push(this.oStarredFolder))),c.subfolders(g))}this.bExpandFolders&&a.setData("folderAccordion",this.expandNames())}return n},i.prototype.createStarredFolder=function(e,t){this.oStarredFolder=new h(this.iAccountId),this.oStarredFolder.initStarredFolder(t,e)},i.prototype.repopulateLinedCollection=function(){function e(s){o.each(s,function(s){t.aLinedCollection.push(s),s.subfolders().length>0&&e(s.subfolders())})}var t=this;return this.aLinedCollection=[],e(this.collection()),this.aLinedCollection},i.prototype.getOptions=function(e,t,s,i,n){t=!!t,s=!!s,i=!!i,n=!!n;var r="    ",a=[];return o.each(this.aLinedCollection,function(e){if(e&&!e.bVirtual&&(!s||Enums.FolderTypes.Inbox!==e.type())&&(!n||e.subscribed())){var o=Array(e.iLevel+1).join(r);a.push({name:e.name(),fullName:e.fullName(),displayName:o+e.name(),translatedDisplayName:o+e.displayName(),disable:!t&&e.isSystem()||!i&&!e.canBeSelected()})}}),""!==e&&a.unshift({name:e,fullName:"",displayName:e,translatedDisplayName:e,disable:!1}),a},e.exports=i},320:function(e,t,s){"use strict";function i(e){this.iAccountId=e,this.bNamespace=!1,this.iLevel=0,this.bIgnoreImapSubscription=y.IgnoreImapSubscription,this.bAllowTemplateFolders=y.AllowTemplateFolders,this.isTemplateStorage=r.observable(!1),this.bAllowAlwaysRefreshFolders=y.AllowAlwaysRefreshFolders,this.isAlwaysRefresh=r.observable(!1),this.sDelimiter="",this.bExists=!0,this.sUidNext="",this.sHash="",this.messageCount=r.observable(0),this.unseenMessageCount=r.observable(0),this.sRealUnseenMessageCount=0,this.hasExtendedInfo=r.observable(!1),this.fullName=r.observable(""),this.fullNameHash=r.observable(""),this.bSelectable=!0,this.subscribed=r.observable(!0),this.name=r.observable(""),this.nameForEdit=r.observable(""),this.subfolders=r.observableArray([]),this.subfoldersMessagesCount=r.observable(0),this.type=r.observable(Enums.FolderTypes.User),this.bVirtual=!1,this.selected=r.observable(!1),this.expanded=r.observable(!1),this.recivedAnim=r.observable(!1).extend({autoResetToFalse:500}),this.edited=r.observable(!1),this.oMessages={},this.oUids={},this.aResponseHandlers=[],this.aRequestedUids=[],this.aRequestedThreadUids=[],this.requestedLists=[],this.hasChanges=r.observable(!1),this.relevantInformationLastMoment=null}var o=s(2),n=s(1),r=s(44),a=s(49),l=s(185),h=s(181),u=s(315),c=s(186),d=s(182),p=s(195),m=s(221),g=s(192),f=s(201),b=s(318),v=s(314),E=null,y=s(313),A=s(321),S=s(328);i.prototype.requireMailCache=function(){null===E&&(E=s(316))},i.prototype.setLevel=function(e){this.iLevel=e},i.prototype.getMessageByUid=function(e){return this.oMessages[e]},i.prototype.getFlaggedMessageUids=function(){var e=[];return o.each(this.oMessages,function(t){t.flagged()&&e.push(t.uid())}),e},i.prototype.setMessageUnflaggedByUid=function(e){var t=this.oMessages[e];t&&t.flagged(!1)},i.prototype.hideThreadMessages=function(e){o.each(e.threadUids(),function(e){var t=this.oMessages[e];t&&(t.deleted()||(t.threadShowAnimation(!1),t.threadHideAnimation(!0),setTimeout(function(){t.threadHideAnimation(!1)},1e3)))},this)},i.prototype.getThreadMessages=function(e){var t=[],s=[],i=[],n=0,r=null,a=50;return o.each(e.threadUids(),function(o){if(n<e.threadCountForLoad()){var l=this.oMessages[o];l?l.deleted()||(l.markAsThreadPart(a,e.uid()),t.push(l),i.push(l.uid()),n++,r=l):(s.push(o),i.push(o),n++)}else i.push(o)},this),e.threadLoading()||this.loadThreadMessages(s),e.changeThreadUids(i,t.length),r&&t.length<e.threadUids().length&&r.showNextLoadingLink(o.bind(e.increaseThreadCountForLoad,e)),this.addThreadUidsToUidLists(e.uid(),e.threadUids()),t},i.prototype.computeThreadData=function(e){var t=0,s=!1,i=[],r=[],a=e.oFrom.getFirstEmail();o.each(e.threadUids(),function(e){var o=this.oMessages[e],h="";o&&!o.deleted()&&(o.seen()||t++,o.flagged()&&(s=!0),h=o.oFrom.getFirstEmail(),h!==a&&-1===n.inArray(h,r)&&(r.push(h),h===v.getEmail()?i.push(l.i18n("MAILWEBCLIENT/LABEL_ME_SENDER")):i.push(o.oFrom.getFirstDisplay())))},this),e.threadUnreadCount(t),e.partialFlagged(s)},i.prototype.addThreadUidsToUidLists=function(e,t){o.each(this.oUids,function(s){o.each(s,function(s){s.addThreadUids(e,t)})})},i.prototype.loadThreadMessages=function(e){if(e.length>0){var t={Folder:this.fullName(),Uids:e};u.send("GetMessagesByUids",t,this.onGetMessagesByUidsResponse,this)}},i.prototype.getThreadCheckedUidsFromList=function(e){var t=this,s=[];return o.each(e,function(e){e.threadCount()>0&&!e.threadOpened()&&o.each(e.threadUids(),function(e){var i=t.oMessages[e];i&&!i.deleted()&&i.checked()&&s.push(e)})}),s},i.prototype.parseAndCacheMessage=function(e,t,s){var i=""+e.Uid,o=!this.oMessages[i],n=o?new A:this.oMessages[i];return n.parse(e,this.iAccountId,t,s),this.type()===Enums.FolderTypes.Inbox&&o&&n.flagged()&&(this.requireMailCache(),E.increaseStarredCount()),this.oMessages[n.uid()]=n,n},i.prototype.onGetMessagesByUidsResponse=function(e,t){var s=e.Result;s&&"Collection/MessageCollection"===s["@Object"]&&(o.each(s["@Collection"],function(e){this.parseAndCacheMessage(e,!0,!0)},this),this.requireMailCache(),E.showOpenedThreads(this.fullName()))},i.prototype.addRequestedUids=function(e){this.aRequestedUids=o.union(this.aRequestedUids,e)},i.prototype.hasUidBeenRequested=function(e){return o.indexOf(this.aRequestedUids,e)!==-1},i.prototype.addRequestedThreadUids=function(e){this.aRequestedThreadUids=o.union(this.aRequestedThreadUids,e)},i.prototype.hasThreadUidBeenRequested=function(e){return o.indexOf(this.aRequestedThreadUids,e)!==-1},i.prototype.hasListBeenRequested=function(e){var t=o.where(this.requestedLists,e),s=t.length>0;return s||this.requestedLists.push(e),s},i.prototype.markMessageReplied=function(e,t){var s=this.oMessages[e];if(s)switch(t){case Enums.ReplyType.Reply:case Enums.ReplyType.ReplyAll:s.answered(!0);break;case Enums.ReplyType.Forward:case Enums.ReplyType.ForwardAsAttach:s.forwarded(!0)}},i.prototype.removeAllMessages=function(){var e=null;this.oMessages={},this.oUids={},this.messageCount(0),this.unseenMessageCount(0),this.sRealUnseenMessageCount=0,e=this.getUidList("",""),e.resultCount(0)},i.prototype.removeAllMessageListsFromCacheIfHasChanges=function(){this.hasChanges()&&(this.oUids={},this.requestedLists=[],this.aRequestedThreadUids=[],this.hasChanges(!1))},i.prototype.removeFlaggedMessageListsFromCache=function(){o.each(this.oUids,function(e,t){delete this.oUids[t][Enums.FolderFilter.Flagged]},this)},i.prototype.removeUnseenMessageListsFromCache=function(){o.each(this.oUids,function(e,t){delete this.oUids[t][Enums.FolderFilter.Unseen]},this)},i.prototype.setRelevantInformation=function(e,t,s,i,o){var n=this.hasExtendedInfo()&&(this.sHash!==t||this.sRealUnseenMessageCount!==i);return o||(this.sUidNext=e),this.sHash=t,this.hasExtendedInfo()&&o||(this.messageCount(s),this.unseenMessageCount(i),0===i&&this.unseenMessageCount.valueHasMutated()),this.sRealUnseenMessageCount=i,this.hasExtendedInfo(!0),n&&this.markHasChanges(),this.relevantInformationLastMoment=a(),n},i.prototype.increaseCountIfHasNotInfo=function(){this.hasExtendedInfo()||this.messageCount(this.messageCount()+1)},i.prototype.markHasChanges=function(){this.hasChanges(!0)},i.prototype.addMessagesCountsDiff=function(e,t){var s=this.messageCount()+e,i=this.unseenMessageCount()+t;s<0&&(s=0),this.messageCount(s),i<0&&(i=0),i>s&&(i=s),this.unseenMessageCount(i)},i.prototype.markDeletedByUids=function(e){var t=0,s=0;return o.each(e,function(e){var i=this.oMessages[e];i&&(t++,i.seen()||s++,i.deleted(!0))},this),this.addMessagesCountsDiff(-t,-s),{MinusDiff:t,UnseenMinusDiff:s}},i.prototype.revertDeleted=function(e){var t=0,s=0;return o.each(e,function(e){var i=this.oMessages[e];i&&i.deleted()&&(t++,i.seen()||s++,i.deleted(!1))},this),this.addMessagesCountsDiff(t,s),{PlusDiff:t,UnseenPlusDiff:s}},i.prototype.commitDeleted=function(e){o.each(e,o.bind(function(e){delete this.oMessages[e]},this)),o.each(this.oUids,function(t){o.each(t,function(t){t.deleteUids(e)})})},i.prototype.getUidList=function(e,t){var s=null;return void 0===this.oUids[e]&&(this.oUids[e]={}),void 0===this.oUids[e][t]&&(s=new S,s.search(e),s.filters(t),this.oUids[e][t]=s),this.oUids[e][t]},i.prototype.initStarredFolder=function(e,t){this.bVirtual=!0,this.setLevel(e),this.fullName(t),this.name(l.i18n("MAILWEBCLIENT/LABEL_FOLDER_STARRED")),this.type(Enums.FolderTypes.Starred),this.initSubscriptions(""),this.initComputedFields(!0)},i.prototype.parse=function(e,t,s){var i="",n=Enums.FolderTypes.User,r=m.getData("folderAccordion")||[];return"Object/Folder"===e["@Object"]?(i=h.pString(e.Name),this.name(i),this.nameForEdit(i),this.fullName(h.pString(e.FullNameRaw)),this.fullNameHash(h.pString(e.FullNameHash)),this.sDelimiter=e.Delimiter,n=h.pInt(e.Type),y.AllowTemplateFolders||n!==Enums.FolderTypes.Template||(n=Enums.FolderTypes.User),(y.AllowSpamFolder||n!==Enums.FolderTypes.Spam)&&this.type(n),this.isTemplateStorage(this.type()===Enums.FolderTypes.Template),this.bNamespace=s===this.fullName(),this.isAlwaysRefresh(y.AllowAlwaysRefreshFolders&&!!e.AlwaysRefresh),this.subscribed(!!y.IgnoreImapSubscription||e.IsSubscribed),this.bSelectable=e.IsSelectable,this.bExists=e.Exists,e.Extended&&this.setRelevantInformation(""+e.Extended.UidNext,e.Extended.Hash,e.Extended.MessageCount,e.Extended.MessageUnseenCount,!1),o.find(r,function(e){return e===this.name()},this)&&this.expanded(!0),this.initSubscriptions(t),this.initComputedFields(),d.broadcastEvent("MailWebclient::ParseFolder::after",this),e.SubFolders):null},i.prototype.initSubscriptions=function(e){this.requireMailCache(),this.unseenMessageCount.subscribe(function(){o.delay(o.bind(function(){E.countMessages(this)},this),1e3)},this),this.subscribed.subscribe(function(){if(e){var t=E.folderList().getFolderByFullName(e);t&&E.countMessages(t)}},this),this.edited.subscribe(function(e){e===!1&&this.nameForEdit(this.name())},this),this.hasChanges.subscribe(function(){this.requestedLists=[]},this)},i.prototype.initComputedFields=function(){this.routingHash=r.computed(function(){return this.bVirtual?p.buildHashFromArray(b.getMailbox(this.fullName(),1,"","",Enums.FolderFilter.Flagged)):p.buildHashFromArray(b.getMailbox(this.fullName()))},this),this.isSystem=r.computed(function(){return this.type()!==Enums.FolderTypes.User},this),this.withoutThreads=r.computed(function(){return this.type()===Enums.FolderTypes.Drafts||this.type()===Enums.FolderTypes.Spam||this.type()===Enums.FolderTypes.Trash},this),this.enableEmptyFolder=r.computed(function(){return(this.type()===Enums.FolderTypes.Spam||this.type()===Enums.FolderTypes.Trash)&&this.messageCount()>0},this),this.virtualEmpty=r.computed(function(){return this.bVirtual&&0===this.messageCount()},this),this.hasSubscribedSubfolders=r.computed(function(){return o.any(this.subfolders(),function(e){return e.subscribed()})},this),this.canExpand=r.computed(function(){return!this.bNamespace&&this.hasSubscribedSubfolders()},this),this.unseenMessagesCountToShow=r.computed(function(){return!d.isMobile()&&this.canExpand()?this.unseenMessageCount()+this.subfoldersMessagesCount():this.unseenMessageCount()},this),this.showUnseenMessagesCount=r.computed(function(){return this.unseenMessagesCountToShow()>0&&this.type()!==Enums.FolderTypes.Drafts},this),this.showMessagesCount=r.computed(function(){return this.messageCount()>0&&(this.type()===Enums.FolderTypes.Drafts||y.AllowShowMessagesCountInFolderList&&y.showMessagesCountInFolderList())},this),this.visible=r.computed(function(){return this.subscribed()||this.isSystem()||this.hasSubscribedSubfolders()},this),this.canBeSelected=r.computed(function(){return this.bExists&&this.bSelectable&&this.subscribed()},this),this.canSubscribe=r.computed(function(){return!y.IgnoreImapSubscription&&!this.isSystem()&&this.bExists&&this.bSelectable},this),this.canDelete=r.computed(function(){return!this.isSystem()&&this.hasExtendedInfo()&&0===this.messageCount()&&0===this.subfolders().length},this),this.canRename=this.canSubscribe,this.visibleTemplateTrigger=r.computed(function(){return y.AllowTemplateFolders&&(this.bSelectable&&!this.isSystem()||this.isTemplateStorage())},this),this.templateButtonHint=r.computed(function(){return this.visibleTemplateTrigger()?this.isTemplateStorage()?l.i18n("MAILWEBCLIENT/ACTION_TURN_TEMPLATE_FOLDER_OFF"):l.i18n("MAILWEBCLIENT/ACTION_TURN_TEMPLATE_FOLDER_ON"):""},this),this.alwaysRefreshButtonHint=r.computed(function(){return y.AllowAlwaysRefreshFolders?this.isAlwaysRefresh()?l.i18n("MAILWEBCLIENT/ACTION_TURN_ALWAYS_REFRESH_OFF"):l.i18n("MAILWEBCLIENT/ACTION_TURN_ALWAYS_REFRESH_ON"):""},this),this.subscribeButtonHint=r.computed(function(){return this.canSubscribe()?this.subscribed()?l.i18n("MAILWEBCLIENT/ACTION_HIDE_FOLDER"):l.i18n("MAILWEBCLIENT/ACTION_SHOW_FOLDER"):""},this),this.deleteButtonHint=r.computed(function(){return this.canDelete()?l.i18n("MAILWEBCLIENT/ACTION_DELETE_FOLDER"):""},this),this.usedAs=r.computed(function(){switch(this.type()){case Enums.FolderTypes.Inbox:return l.i18n("MAILWEBCLIENT/LABEL_USED_AS_INBOX");case Enums.FolderTypes.Sent:return l.i18n("MAILWEBCLIENT/LABEL_USED_AS_SENT");case Enums.FolderTypes.Drafts:return l.i18n("MAILWEBCLIENT/LABEL_USED_AS_DRAFTS");case Enums.FolderTypes.Trash:return l.i18n("MAILWEBCLIENT/LABEL_USED_AS_TRASH");case Enums.FolderTypes.Spam:return l.i18n("MAILWEBCLIENT/LABEL_USED_AS_SPAM")}return""},this),this.displayName=r.computed(function(){switch(this.type()){case Enums.FolderTypes.Inbox:return l.i18n("MAILWEBCLIENT/LABEL_FOLDER_INBOX");case Enums.FolderTypes.Sent:return l.i18n("MAILWEBCLIENT/LABEL_FOLDER_SENT");case Enums.FolderTypes.Drafts:return l.i18n("MAILWEBCLIENT/LABEL_FOLDER_DRAFTS");case Enums.FolderTypes.Trash:return l.i18n("MAILWEBCLIENT/LABEL_FOLDER_TRASH");case Enums.FolderTypes.Spam:return l.i18n("MAILWEBCLIENT/LABEL_FOLDER_SPAM")}return this.name()},this)},i.prototype.onGetMessageResponse=function(e,t){var s=e.Result,i=t.Parameters,o=null,n=s?""+s.Uid:""+i.Uid,r=this.oMessages[n],a=!!r&&r.selected(),h=!1;s?r=this.parseAndCacheMessage(s,!1,!1):(a&&(c.showErrorByCode(e,l.i18n("COREWEBCLIENT/ERROR_UNKNOWN")),p.replaceHashWithoutMessageUid(n)),
  r=null,h=!0),o=this.aResponseHandlers[n],o&&(o.handler.call(o.context,r,n,h?e:null),delete this.aResponseHandlers[n])},i.prototype.getCompletelyFilledMessage=function(e,t,s){var i=this.oMessages[e],o={AccountID:i?i.accountId():0,Folder:this.fullName(),Uid:e,MessageBodyTruncationThreshold:y.MessageBodyTruncationThreshold};e.length>0&&(i&&i.completelyFilled()&&!i.truncated()?t&&s&&t.call(s,i,e):(t&&s&&(this.aResponseHandlers[e]={handler:t,context:s}),u.send("GetMessage",o,this.onGetMessageResponse,this)))},i.prototype.showExternalPictures=function(e){var t=this.oMessages[e];void 0!==t&&t.showExternalPictures()},i.prototype.alwaysShowExternalPicturesForSender=function(e){o.each(this.oMessages,function(t){var s=t.oFrom.aCollection;s.length>0&&s[0].sEmail===e&&t.alwaysShowExternalPicturesForSender()},this)},i.prototype.executeGroupOperation=function(e,t,s){var i=0;o.each(this.oMessages,function(n){t.length>0?o.each(t,function(t){n&&n.uid()===t&&n[e]()!==s&&(n[e](s),i++)}):n[e](s)}),0===t.length&&(i=s?this.unseenMessageCount():this.messageCount()-this.unseenMessageCount()),"seen"===e&&i>0&&(s?this.addMessagesCountsDiff(0,-i):this.addMessagesCountsDiff(0,i),this.markHasChanges())},i.prototype.emptyFolder=function(){var e=l.i18n("MAILWEBCLIENT/CONFIRM_EMPTY_FOLDER"),t=o.bind(this.clearFolder,this);this.enableEmptyFolder()&&g.showPopup(f,[e,t])},i.prototype.clearFolder=function(e){this.enableEmptyFolder()&&e&&(u.send("ClearFolder",{Folder:this.fullName()}),this.removeAllMessages(),this.requireMailCache(),E.onClearFolder(this))},i.prototype.onAccordion=function(e,t){var s=!this.expanded(),i=m.getData("folderAccordion")||[];s?i.push(this.name()):i=o.reject(i,function(e){return e===this.name()},this),m.setData("folderAccordion",i),this.expanded(s),this.requireMailCache(),E.countMessages(this),t&&t.stopPropagation()},i.prototype.executeUnseenFilter=function(){var e=!1;return this.unseenMessagesCountToShow()>this.unseenMessageCount()&&this.onAccordion(),!(this.unseenMessageCount()>0)||(this.requireMailCache(),E.waitForUnseenMessages(!0),e=p.setHash(b.getMailbox(this.fullName(),1,"","",Enums.FolderFilter.Unseen)),e&&E.changeCurrentMessageList(this.fullName(),1,"",Enums.FolderFilter.Unseen),!1)},i.prototype.onDeleteClick=function(){var e=l.i18n("MAILWEBCLIENT/CONFIRM_DELETE_FOLDER"),t=o.bind(this.deleteAfterConfirm,this);this.canDelete()?g.showPopup(f,[e,t]):d.broadcastEvent("MailWebclient::AttemptDeleteNonemptyFolder")},i.prototype.deleteAfterConfirm=function(e){if(e){var t=E.editedFolderList(),s=this.fullName(),i=function(e){return s===e.fullName()||(e.subfolders.remove(i),!1)};t.collection.remove(i),u.send("DeleteFolder",{AccountID:v.editedId(),Folder:this.fullName()},function(e){e.Result||(c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_DELETE_FOLDER")),E.getFolderList(v.editedId()))},this)}},i.prototype.onSubscribeClick=function(){if(this.canSubscribe()){var e={AccountID:v.editedId(),Folder:this.fullName(),SetAction:!this.subscribed()};this.subscribed(!this.subscribed()),u.send("SubscribeFolder",e,function(e){e.Result||(this.subscribed()?c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_SUBSCRIBE_FOLDER")):c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_UNSUBSCRIBE_FOLDER")),E.getFolderList(v.editedId()))},this)}},i.prototype.afterMove=function(e){o.each(e,function(e){"CAccountFoldersPaneView"===e.constructor.name&&e.afterMove()})},i.prototype.cancelNameEdit=function(){this.edited(!1)},i.prototype.applyNameEdit=function(){if(this.name()!==this.nameForEdit()){var e={AccountID:v.editedId(),PrevFolderFullNameRaw:this.fullName(),NewFolderNameInUtf8:this.nameForEdit()};u.send("RenameFolder",e,o.bind(this.onResponseFolderRename,this),this),this.name(this.nameForEdit())}this.edited(!1)},i.prototype.onResponseFolderRename=function(e,t){if(e&&e.Result){if(e&&e.Result&&e.Result.FullName){var s=E.editedFolderList();s.renameFolder(this.fullName(),e.Result.FullName,e.Result.FullNameHash)}}else c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_RENAME_FOLDER")),E.getFolderList(v.editedId())},i.prototype.triggerTemplateState=function(){if(this.visibleTemplateTrigger()){this.isTemplateStorage()?(this.type(Enums.FolderTypes.User),this.isTemplateStorage(!1)):(this.type(Enums.FolderTypes.Template),this.isTemplateStorage(!0)),E.changeTemplateFolder(this.fullName(),this.isTemplateStorage());var e={FolderFullName:this.fullName(),SetTemplate:this.isTemplateStorage()};u.send("SetTemplateFolderType",e,this.onSetTemplateFolderType,this)}},i.prototype.onSetTemplateFolderType=function(e){e.Result||(c.showErrorByCode(e,l.i18n("MAILWEBCLIENT/ERROR_SETUP_SPECIAL_FOLDERS")),E.getFolderList(v.editedId()))},i.prototype.triggerAlwaysRefreshState=function(){if(y.AllowAlwaysRefreshFolders){this.isAlwaysRefresh(!this.isAlwaysRefresh());var e={AccountID:this.iAccountId,FolderFullName:this.fullName(),AlwaysRefresh:this.isAlwaysRefresh()};u.send("SetAlwaysRefreshFolder",e,this.onSetAlwaysRefreshFolder,this)}},i.prototype.onSetAlwaysRefreshFolder=function(e){e.Result||(c.showErrorByCode(e),E.getFolderList(v.editedId()))},e.exports=i},321:function(e,t,s){"use strict";function i(){this.accountId=r.observable(g.currentId()),this.folder=r.observable(""),this.uid=r.observable(""),this.sUniq="",this.subject=r.observable(""),this.emptySubject=r.computed(function(){return""===n.trim(this.subject())},this),this.subjectForDisplay=r.computed(function(){return this.emptySubject()?l.i18n("MAILWEBCLIENT/LABEL_NO_SUBJECT"):this.subject()},this),this.messageId=r.observable(""),this.size=r.observable(0),this.friendlySize=r.computed(function(){return l.getFriendlySize(this.size())},this),this.textSize=r.observable(0),this.oDateModel=new p,this.fullDate=r.observable(""),this.oFrom=new d,this.fullFrom=r.observable(""),this.oTo=new d,this.to=r.observable(""),this.fromOrToText=r.observable(""),this.oCc=new d,this.cc=r.observable(""),this.oBcc=new d,this.bcc=r.observable(""),this.oReplyTo=new d,this.seen=r.observable(!1),this.flagged=r.observable(!1),this.partialFlagged=r.observable(!1),this.answered=r.observable(!1),this.forwarded=r.observable(!1),this.hasAttachments=r.observable(!1),this.hasIcalAttachment=r.observable(!1),this.hasVcardAttachment=r.observable(!1),this.folderObject=r.computed(function(){return this.requireMailCache(),f.getFolderByFullName(this.accountId(),this.folder())},this),this.threadsAllowed=r.computed(function(){var e=g.getAccount(this.accountId()),t=this.folderObject(),s=t&&(t.type()===Enums.FolderTypes.Drafts||t.type()===Enums.FolderTypes.Spam||t.type()===Enums.FolderTypes.Trash);return e&&e.threadingIsAvailable()&&!s},this),this.otherSendersAllowed=r.computed(function(){var e=this.folderObject();return e&&e.type()!==Enums.FolderTypes.Drafts&&e.type()!==Enums.FolderTypes.Sent},this),this.threadPart=r.observable(!1),this.threadPart.subscribe(function(){this.threadPart()&&this.partialFlagged(!1)},this),this.threadParentUid=r.observable(""),this.threadUids=r.observableArray([]),this.threadCount=r.computed(function(){return this.threadUids().length},this),this.threadUnreadCount=r.observable(0),this.threadOpened=r.observable(!1),this.threadLoading=r.observable(!1),this.threadLoadingVisible=r.computed(function(){return this.threadsAllowed()&&this.threadOpened()&&this.threadLoading()},this),this.threadCountVisible=r.computed(function(){return this.threadsAllowed()&&this.threadCount()>0&&!this.threadLoading()},this),this.threadCountHint=r.computed(function(){return this.threadCount()>0?this.threadOpened()?l.i18n("MAILWEBCLIENT/ACTION_FOLD_THREAD"):this.threadUnreadCount()>0?l.i18n("MAILWEBCLIENT/ACTION_UNFOLD_THREAD_WITH_UNREAD",{},null,this.threadUnreadCount()):l.i18n("MAILWEBCLIENT/ACTION_UNFOLD_THREAD"):""},this),this.threadCountForLoad=r.observable(5),this.threadNextLoadingVisible=r.observable(!1),this.threadNextLoadingLinkVisible=r.observable(!1),this.threadFunctionLoadNext=null,this.threadShowAnimation=r.observable(!1),this.threadHideAnimation=r.observable(!1),this.importance=r.observable(Enums.Importance.Normal),this.draftInfo=r.observableArray([]),this.hash=r.observable(""),this.sDownloadAsEmlUrl="",this.completelyFilled=r.observable(!1),this.checked=r.observable(!1),this.checked.subscribe(function(e){if(this.requireMailCache(),!this.threadOpened()&&f.useThreadingInCurrentList()){var t=f.folderList().getFolderByFullName(this.folder());o.each(this.threadUids(),function(s){var i=t.oMessages[s];i&&i.checked(e)})}},this),this.selected=r.observable(!1),this.deleted=r.observable(!1),this.truncated=r.observable(!1),this.inReplyTo=r.observable(""),this.references=r.observable(""),this.readingConfirmationAddressee=r.observable(""),this.sensitivity=r.observable(Enums.Sensitivity.Nothing),this.isPlain=r.observable(!1),this.text=r.observable(""),this.textBodyForNewWindow=r.observable(""),this.$text=null,this.rtl=r.observable(!1),this.hasExternals=r.observable(!1),this.isExternalsShown=r.observable(!1),this.isExternalsAlwaysShown=r.observable(!1),this.foundCids=r.observableArray([]),this.attachments=r.observableArray([]),this.safety=r.observable(!1),this.sourceHeaders=r.observable(""),this.date=r.observable(""),this.textRaw=r.observable(""),this.domMessageForPrint=r.observable(null),this.Custom={}}var o=s(2),n=s(1),r=s(44),a=s(49),l=(s(322),s(185)),h=s(181),u=s(179),c=(s(315),s(188)),d=s(323),p=s(265),m=s(325),g=s(314),f=null,b=(s(313),s(326)),v=s(182);i.prototype.requireMailCache=function(){null===f&&(f=s(316))},i.prototype.viewMessage=function(e){var t=this.getDomText(u.getAppPath()),s="";this.textBodyForNewWindow(t.html()),s=n(this.domMessageForPrint()).html(),e&&(n(e.document.body).html(s),e.focus(),o.each(this.attachments(),function(t){var s=n(e.document.body).find("[data-hash='download-"+t.hash()+"']");t.hasAction("download")?s.on("click",o.bind(t.executeAction,t,"download")):s.hide(),s=n(e.document.body).find("[data-hash='view-"+t.hash()+"']"),t.hasAction("view")?s.on("click",o.bind(t.executeAction,t,"view")):s.hide()},this))},i.prototype.fillFromOrToText=function(){this.requireMailCache();var e=f.getFolderByFullName(this.accountId(),this.folder()),t=g.getAccount(this.accountId());e.type()===Enums.FolderTypes.Drafts||e.type()===Enums.FolderTypes.Sent?this.fromOrToText(this.oTo.getDisplay(l.i18n("MAILWEBCLIENT/LABEL_ME_RECIPIENT"),t.email())):this.fromOrToText(this.oFrom.getDisplay(l.i18n("MAILWEBCLIENT/LABEL_ME_SENDER"),t.email()))},i.prototype.changeThreadUids=function(e,t){this.threadUids(e),this.threadLoading(t<Math.min(this.threadUids().length,this.threadCountForLoad()))},i.prototype.showNextLoadingLink=function(e){this.threadNextLoadingLinkVisible()&&(this.threadNextLoadingVisible(!0),this.threadFunctionLoadNext=e)},i.prototype.increaseThreadCountForLoad=function(){this.threadCountForLoad(this.threadCountForLoad()+5),this.requireMailCache(),f.showOpenedThreads(this.folder())},i.prototype.loadNextMessages=function(){this.threadFunctionLoadNext&&(this.threadFunctionLoadNext(),this.threadNextLoadingLinkVisible(!1),this.threadFunctionLoadNext=null)},i.prototype.markAsThreadPart=function(e,t){var s=this;this.threadPart(!0),this.threadParentUid(t),this.threadUids([]),this.threadNextLoadingVisible(!1),this.threadNextLoadingLinkVisible(!0),this.threadFunctionLoadNext=null,this.threadHideAnimation(!1),setTimeout(function(){s.threadShowAnimation(!0)},e)},i.prototype.parse=function(e,t,s,i){var n="",r="";i&&this.threadPart(s),this.threadPart()||this.threadParentUid(""),"Object/MessageListItem"===e["@Object"]&&(this.seen(!!e.IsSeen),this.flagged(!!e.IsFlagged),this.answered(!!e.IsAnswered),this.forwarded(!!e.IsForwarded),e.Custom&&(this.Custom=e.Custom)),"Object/Message"!==e["@Object"]&&"Object/MessageListItem"!==e["@Object"]||(this.Custom.Sensitivity=e.Sensitivity,this.accountId(t),this.folder(e.Folder),this.uid(h.pString(e.Uid)),this.sUniq=this.accountId()+this.folder()+this.uid(),this.subject(h.pString(e.Subject)),this.messageId(h.pString(e.MessageId)),this.size(e.Size),this.textSize(e.TextSize),this.oDateModel.parse(e.TimeStampInUTC),this.oFrom.parse(e.From),this.oTo.parse(e.To),this.fillFromOrToText(),this.oCc.parse(e.Cc),this.oBcc.parse(e.Bcc),this.oReplyTo.parse(e.ReplyTo),this.fullDate(this.oDateModel.getFullDate()),this.fullFrom(this.oFrom.getFull()),this.to(this.oTo.getFull()),this.cc(this.oCc.getFull()),this.bcc(this.oBcc.getFull()),this.hasAttachments(!!e.HasAttachments),this.hasIcalAttachment(!!e.HasIcalAttachment),this.hasVcardAttachment(!!e.HasVcardAttachment),"Object/MessageListItem"===e["@Object"]&&i&&this.threadUids(o.map(e.Threads,function(e){return""+e},this)),this.importance(h.pInt(e.Importance)),Enums.has("Importance",this.importance())||this.importance(Enums.Importance.Normal),this.sensitivity(h.pInt(e.Sensitivity)),Enums.has("Sensitivity",this.sensitivity())||this.sensitivity(Enums.Sensitivity.Nothing),o.isArray(e.DraftInfo)&&this.draftInfo(e.DraftInfo),this.hash(h.pString(e.Hash)),this.sDownloadAsEmlUrl=h.pString(e.DownloadAsEmlUrl),"Object/Message"===e["@Object"]&&(this.truncated(e.Truncated),this.inReplyTo(e.InReplyTo),this.references(e.References),this.readingConfirmationAddressee(h.pString(e.ReadingConfirmationAddressee)),n=h.pString(e.Html),r=h.pString(e.Plain),""!==n?(this.textRaw(e.HtmlRaw),this.text(n),this.isPlain(!1)):(this.textRaw(e.PlainRaw),this.text(""!==r?"<div>"+r+"</div>":""),this.isPlain(!0)),this.$text=null,this.isExternalsShown(!1),this.rtl(e.Rtl),this.hasExternals(!!e.HasExternals),this.foundCids(e.FoundedCIDs),this.parseAttachments(e.Attachments,t),this.safety(e.Safety),this.sourceHeaders(e.Headers),this.aExtend=e.Extend,this.completelyFilled(!0),v.broadcastEvent("MailWebclient::ParseMessage::after",{msg:this})),this.updateMomentDate())},i.prototype.updateMomentDate=function(){this.date(this.oDateModel.getShortDate(a().clone().subtract(1,"days").format("L")===a.unix(this.oDateModel.getTimeStampInUTC()).format("L")))},i.prototype.getDomText=function(e,t){var s=this.$text;return e=e||"",null!==this.$text&&""===e||(this.completelyFilled()?(this.$text=n(this.text()),this.showInlinePictures(e),this.safety()===!0&&this.alwaysShowExternalPicturesForSender(),t&&this.isExternalsShown()&&this.showExternalPictures(),s=this.$text):s=n("")),s.clone()},i.prototype.getConvertedHtml=function(e,t){var s=this.getDomText(e,t);return s.length>0?s.wrap("<p>").parent().html():""},i.prototype.parseAttachments=function(e,t){var s=e?e["@Collection"]:[];this.attachments([]),h.isNonEmptyArray(s)&&this.attachments(o.map(s,function(e){var t=new b;return t.setMessageData(this.folder(),this.uid()),t.parse(e,this.folder(),this.uid()),t},this))},i.prototype.parseAddressArray=function(e){var t=[];return o.isArray(e)&&(t=o.map(e,function(e){var t=new CAddressModel;return t.parse(e),t})),t},i.prototype.showInlinePictures=function(e){var t=o.map(this.attachments(),function(e){return{CID:e.cid(),ContentLocation:e.contentLocation(),ViewLink:e.getActionUrl("view")}});m.showInlinePictures(this.$text,t,this.foundCids(),e)},i.prototype.showExternalPictures=function(){m.showExternalPictures(this.$text),this.isExternalsShown(!0)},i.prototype.alwaysShowExternalPicturesForSender=function(){this.completelyFilled()&&(this.isExternalsAlwaysShown(!0),this.isExternalsShown()||this.showExternalPictures())},i.prototype.openThread=function(){if(this.threadCountVisible()){var e=this.folder();this.threadOpened(!this.threadOpened()),this.requireMailCache(),this.threadOpened()?f.showOpenedThreads(e):(f.hideThreads(this),setTimeout(function(){f.showOpenedThreads(e)},500))}},i.prototype.getAttachmentsHashes=function(){var e=o.filter(this.attachments(),function(e){return!e.linked()}),t=o.map(e,function(e){return e.hash()});return t},i.prototype.onSaveAttachmentsToFilesResponse=function(e,t){var s=t.Parameters,i=0,n=s.Attachments.length;e.Result&&o.each(s.Attachments,function(t){void 0!==e.Result[t]&&i++}),0===i?c.showError(l.i18n("MAILWEBCLIENT/ERROR_CANT_SAVE_ATTACHMENTS_TO_FILES")):i<n?c.showError(l.i18n("MAILWEBCLIENT/ERROR_SOME_ATTACHMENTS_WERE_NOT_SAVED",{SAVED_COUNT:i,TOTAL_COUNT:n})):c.showReport(l.i18n("MAILWEBCLIENT/REPORT_ATTACHMENTS_SAVED_TO_FILES"))},i.prototype.downloadAllAttachmentsSeparately=function(){o.each(this.attachments(),function(e){e.linked()||e.executeAction("download")})},i.prototype.toJSON=function(){return{uid:this.uid(),accountId:this.accountId(),to:this.to(),subject:this.subject(),threadPart:this.threadPart(),threadUids:this.threadUids(),threadOpened:this.threadOpened()}},e.exports=i},322:function(e,t,s){"use strict";var i=s(185),o=s(192),n=s(193),r=s(43),a={};a.getDownloadLink=function(e,t,s){return t.length>0?"?/Download/"+e+"/DownloadFile/"+t+"/"+(s?"0/"+s:""):""},a.getIframeWrappwer=function(e,t){return"?/Raw/Iframe/"+e+"/"+window.encodeURIComponent(t)+"/"},a.thumbQueue=function(){var e={},t={},s=2;return function(i,o,n){o&&n?!(i in t)||t[i]>0?(i in t||(t[i]=s,e[i]=[]),t[i]--,n(o)):e[i].push({imageSrc:o,imageSrcObserver:n,messageUid:i}):e[i]&&e[i].length&&(e[i][0].imageSrcObserver(e[i][0].imageSrc),e[i].shift())}}(),a.showErrorIfAttachmentSizeLimit=function(e,t){var s=i.i18n("COREWEBCLIENT/ERROR_UPLOAD_SIZE_DETAILED",{FILENAME:e,MAXSIZE:i.getFriendlySize(r.AttachmentSizeLimit)});return r.AttachmentSizeLimit>0&&t>r.AttachmentSizeLimit&&(o.showPopup(n,[s]),!0)},e.exports=a},323:function(e,t,s){"use strict";function i(){this.aCollection=[]}var o=s(2),n=s(324);i.prototype.parse=function(e){var t=e?e["@Collection"]:[];this.aCollection=[],o.isArray(t)&&(this.aCollection=o.map(t,function(e){var t=new n;return t.parse(e),t}))},i.prototype.addCollection=function(e){o.each(e,function(e){var t=o.find(this.aCollection,function(t){return e.sEmail===t.sEmail});t||this.aCollection.push(e)},this)},i.prototype.excludeCollection=function(e){o.each(e,function(e){this.aCollection=o.filter(this.aCollection,function(t){return e.sEmail!==t.sEmail})},this)},i.prototype.getFirstEmail=function(){return this.aCollection.length>0?this.aCollection[0].getEmail():""},i.prototype.getFirstName=function(){return this.aCollection.length>0?this.aCollection[0].getName():""},i.prototype.getFirstDisplay=function(){return this.aCollection.length>0?this.aCollection[0].getDisplay():""},i.prototype.getDisplay=function(e,t){var s=o.map(this.aCollection,function(s){return e&&t===s.sEmail?e:s.getDisplay(e)});return s.join(", ")},i.prototype.getFull=function(){var e=o.map(this.aCollection,function(e){return e.getFull()});return e.join(", ")},i.prototype.getEmails=function(){var e=o.map(this.aCollection,function(e){return e.getEmail()});return e},e.exports=i},324:function(e,t,s){"use strict";function i(){this.sName="",this.sEmail="",this.sDisplay="",this.sFull="",this.loaded=o.observable(!1),this.found=o.observable(!1)}var o=s(44),n=s(205),r=s(181);i.prototype.parse=function(e){null!==e&&(this.sName=r.pString(e.DisplayName),this.sEmail=r.pString(e.Email),this.sDisplay=this.sName.length>0?this.sName:this.sEmail,this.sFull=n.getFullEmail(this.sName,this.sEmail))},i.prototype.getEmail=function(){return this.sEmail},i.prototype.getName=function(){return this.sName},i.prototype.getDisplay=function(){return this.sDisplay},i.prototype.getFull=function(){return this.sFull},e.exports=i},325:function(e,t,s){"use strict";var i=s(2),o=s(1),n=s(181),r={};r.showInlinePictures=function(e,t,s,n){var r=function(e){return i.find(t,function(t){return t.CID===e})},a=function(e){return i.find(t,function(t){return t.ContentLocation===e})};"string"!=typeof n&&(n=""),s.length>0&&(o("[data-x-src-cid]",e).each(function(){var e=o(this).attr("data-x-src-cid"),t=r(e);t&&t.ViewLink.length>0&&o(this).attr("src",n+t.ViewLink)}),o("[data-x-style-cid]",e).each(function(){var e="",t=o(this).attr("data-x-style-cid-name"),s=o(this).attr("data-x-style-cid"),i=r(s);i&&i.ViewLink.length>0&&""!==t&&(e=o.trim(o(this).attr("style")),e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",o(this).attr("style",e+t+": url('"+i.ViewLink+"')"))})),o("[data-x-src-location]",e).each(function(){var e=o(this).attr("data-x-src-location"),t=a(e);t||(t=r(e)),t&&t.ViewLink.length>0&&o(this).attr("src",n+t.ViewLink)})},r.showExternalPictures=function(e){o("[data-x-src]",e).each(function(){o(this).attr("src",o(this).attr("data-x-src")).removeAttr("data-x-src")}),o("[data-x-style-url]",e).each(function(){var e=o.trim(o(this).attr("style"));e=""===e?"":";"===e.substr(-1)?e+" ":e+"; ",o(this).attr("style",e+o(this).attr("data-x-style-url")).removeAttr("data-x-style-url")})},r.joinReplyPrefixesInSubject=function(e,t,s){var r=[t.toUpperCase()],a=[s.toUpperCase()],l=i.union(r,a).join("|"),h="",u=e.split(":"),c=[],d="";return i.each(u,function(e){if(0===d.length){var h=o.trim(e.toUpperCase()),u=i.indexOf(r,h)!==-1,p=i.indexOf(a,h)!==-1,m=1,g=c.length>0?c[c.length-1]:null;if(!u&&!p){var f=new window.RegExp("^\\s?("+l+")\\s?[\\[\\(]([\\d]+)[\\]\\)]$","gi").exec(h);f&&3===f.length&&(u=i.indexOf(r,f[1].toUpperCase())!==-1,p=i.indexOf(a,f[1].toUpperCase())!==-1,m=n.pInt(f[2]))}u?g&&g.prefix===t?g.count+=m:c.push({prefix:t,count:m}):p?g&&g.prefix===s?g.count+=m:c.push({prefix:s,count:m}):d=e}else d+=":"+e}),i.each(c,function(e){h+=1===e.count?e.prefix+": ":e.prefix+"["+e.count+"]: "}),h+=o.trim(d)},e.exports=r},326:function(e,t,s){"use strict";function i(){this.folderName=r.observable(""),this.messageUid=r.observable(""),this.cid=r.observable(""),this.contentLocation=r.observable(""),this.inline=r.observable(!1),this.linked=r.observable(!1),this.mimePartIndex=r.observable(""),this.messagePart=r.observable(null),c.call(this),this.content=r.observable(""),this.isMessageType=r.computed(function(){return this.mimeType(),this.mimePartIndex(),"message/rfc822"===this.mimeType()},this)}var o=s(2),n=s(1),r=s(44),a=s(185),l=s(181),h=s(182),u=s(200),c=s(327),d=s(315);o.extendOwn(i.prototype,c.prototype),i.prototype.getNewInstance=function(){return new i},i.prototype.getCopy=function(){var e=new i;return e.copyProperties(this),e},i.prototype.copyProperties=function(e){this.fileName(e.fileName()),this.tempName(e.tempName()),this.size(e.size()),this.hash(e.hash()),this.mimeType(e.mimeType()),this.cid(e.cid()),this.contentLocation(e.contentLocation()),this.inline(e.inline()),this.linked(e.linked()),this.thumbnailSrc(e.thumbnailSrc()),this.thumbnailLoaded(e.thumbnailLoaded()),this.statusText(e.statusText()),this.uploaded(e.uploaded()),this.oActionsData=e.oActionsData,this.actions(e.actions()),this.thumbUrlInQueue(e.thumbUrlInQueue())},i.prototype.additionalParse=function(e){this.content(l.pString(e.Content)),this.mimePartIndex(l.pString(e.MimePartIndex)),this.cid(l.pString(e.CID)),this.contentLocation(l.pString(e.ContentLocation)),this.inline(!!e.IsInline),this.linked(!!e.IsLinked),h.broadcastEvent("MailWebclient::ParseFile::after",this)},i.prototype.setMessageData=function(e,t){this.folderName(e),this.messageUid(t)},i.prototype.onGetMessageResponse=function(e,t){var i=t.Parameters,e=e.Result,o=s(321),n=new o;e&&this.oNewWindow&&(n.parse(e,i.AccountID,!1,!0),this.messagePart(n),this.messagePart().viewMessage(this.oNewWindow),this.oNewWindow=void 0)},i.prototype.viewFile=function(){this.isMessageType()?this.viewMessageFile():this.viewCommonFile()},i.prototype.viewMessageFile=function(){var e=null,t='<div style="margin: 30px; text-align: center; font: normal 14px Tahoma;">'+a.i18n("COREWEBCLIENT/INFO_LOADING")+"</div>";e=u.open("",this.fileName()),e&&(this.messagePart()?this.messagePart().viewMessage(e):(n(e.document.body).html(t),this.oNewWindow=e,d.send("GetMessage",{Folder:this.folderName(),Uid:this.messageUid(),Rfc822MimeIndex:this.mimePartIndex()},this.onGetMessageResponse,this)),e.focus())},i.prototype.fillDataAfterUploadComplete=function(e,t){this.cid(l.pString(t)),e&&e.Result&&e.Result.Attachment&&(this.tempName(l.pString(e.Result.Attachment.TempName)),this.mimeType(l.pString(e.Result.Attachment.MimeType)),this.size(l.pInt(e.Result.Attachment.Size)),this.hash(l.pString(e.Result.Attachment.Hash)),this.parseActions(e.Result.Attachment))},i.prototype.parseFromUpload=function(e,t,s){this.setMessageData(t,s),this.fileName(l.pString(e.Name)),this.tempName(e.TempName?l.pString(e.TempName):this.fileName()),this.mimeType(l.pString(e.MimeType)),this.size(l.pInt(e.Size)),this.hash(l.pString(e.Hash)),this.parseActions(e),this.uploadUid(this.hash()),this.uploaded(!0),this.uploadStarted(!1)},i.prototype.parseActions=function(e){this.thumbUrlInQueue(""!==l.pString(e.ThumbnailUrl)?l.pString(e.ThumbnailUrl)+"/"+Math.random():""),this.commonParseActions(e),this.isMessageType()?""!==this.folderName()&&""!==this.messageUid()?(this.hasAction("view")||this.actions.unshift("view"),this.otherTemplates.push({name:"MailWebclient_PrintMessageView",data:this.messagePart})):this.actions(o.without(this.actions(),"view")):this.commonExcludeActions()},i.prototype.errorFromUpload=function(){this.uploaded(!0),this.uploadError(!0),this.uploadStarted(!1),this.statusText(a.i18n("COREWEBCLIENT/ERROR_UPLOAD_UNKNOWN"))},e.exports=i},327:function(e,t,s){"use strict";function i(){this.id=r.observable(""),this.index=r.observable(0),this.fileName=r.observable(""),this.tempName=r.observable(""),this.displayName=r.observable(""),this.extension=r.observable(""),this.fileName.subscribe(function(e){this.id(e),this.displayName(e),this.extension(d.getFileExtension(e))},this),this.size=r.observable(0),this.friendlySize=r.computed(function(){return this.size()>0?h.getFriendlySize(this.size()):""},this),this.hash=r.observable(""),this.thumbUrlInQueue=r.observable(""),this.thumbUrlInQueueSubscribtion=this.thumbUrlInQueue.subscribe(function(){this.getInThumbQueue()},this),this.thumbnailSrc=r.observable(""),this.thumbnailLoaded=r.observable(!1),this.thumbnailSessionUid=r.observable(""),this.mimeType=r.observable(""),this.uploadUid=r.observable(""),this.uploaded=r.observable(!1),this.uploadError=r.observable(!1),this.downloading=r.observable(!1),this.isViewMimeType=r.computed(function(){return-1!==n.inArray(this.mimeType(),m)},this),this.bHasHtmlEmbed=!1,this.otherTemplates=r.observableArray([]),this.visibleCancelButton=r.observable(!0),this.statusText=r.observable(""),this.statusTooltip=r.computed(function(){return this.uploadError()?this.statusText():""},this),this.progressPercent=r.observable(0),this.visibleProgress=r.observable(!1),this.uploadStarted=r.observable(!1),this.uploadStarted.subscribe(function(){this.uploadStarted()?(this.uploaded(!1),this.visibleProgress(!0),this.progressPercent(20)):(this.progressPercent(100),this.visibleProgress(!1),this.uploaded(!0))},this),this.downloading.subscribe(function(){this.downloading()?this.visibleProgress(!0):(this.visibleProgress(!1),this.progressPercent(0))},this),this.allowDrag=r.observable(!1),this.allowUpload=r.observable(!1),this.allowPublicLink=r.observable(!1),this.bIsSecure=r.observable(!1),this.isShared=r.observable(!1),this.sHeaderText="",this.oActionsData={view:{Text:h.i18n("COREWEBCLIENT/ACTION_VIEW_FILE"),Handler:o.bind(function(){this.viewFile()},this)},download:{Text:h.i18n("COREWEBCLIENT/ACTION_DOWNLOAD_FILE"),Handler:o.bind(function(){this.downloadFile()},this),Tooltip:r.computed(function(){var e=h.i18n("COREWEBCLIENT/INFO_CLICK_TO_DOWNLOAD_FILE",{FILENAME:this.fileName(),SIZE:this.friendlySize()});return""===this.friendlySize()&&(e=e.replace(" ()","")),e},this)}},this.allowActions=r.observable(!0),this.iconAction=r.observable("download"),this.cssClasses=r.computed(function(){return this.getCommonClasses().join(" ")},this),this.actions=r.observableArray([]),this.firstAction=r.computed(function(){return this.actions().length>1?this.actions()[0]:""},this),this.secondAction=r.computed(function(){return 1===this.actions().length?this.actions()[0]:this.actions().length>1?this.actions()[1]:""},this),this.subFiles=r.observableArray([]),this.subFilesExpanded=r.observable(!1)}var o=s(2),n=s(1),r=s(44),a=s(182),l=s(322),h=s(185),u=s(181),c=s(179),d=s(217),p=s(200),m=["image/jpeg","image/png","image/gif","text/html","text/plain","text/css","text/rfc822-headers","message/delivery-status","application/x-httpd-php","application/javascript"],g=[];n("html").hasClass("pdf")&&(m.push("application/pdf"),m.push("application/x-pdf")),i.prototype.addAction=function(e,t,s){t?this.actions.unshift(e):this.actions.push(e),this.actions(o.compact(this.actions())),s&&(this.oActionsData[e]=s)},i.prototype.removeAction=function(e){this.actions(o.without(this.actions(),e))},i.prototype.getMainAction=function(){return this.actions()[0]},i.prototype.hasAction=function(e){return o.indexOf(this.actions(),e)!==-1},i.prototype.getActionText=function(e){return this.hasAction(e)&&this.oActionsData[e]&&("string"==typeof this.oActionsData[e].Text||o.isFunction(this.oActionsData[e].Text))?o.isFunction(this.oActionsData[e].Text)?this.oActionsData[e].Text():this.oActionsData[e].Text:""},i.prototype.getActionUrl=function(e){return this.hasAction(e)&&this.oActionsData[e]?this.oActionsData[e].Url||"":""},i.prototype.executeAction=function(e){this.hasAction(e)&&this.oActionsData[e]&&o.isFunction(this.oActionsData[e].Handler)&&this.oActionsData[e].Handler()},i.prototype.getTooltip=function(e){var t=this.hasAction(e)&&this.oActionsData[e]?this.oActionsData[e].Tooltip:"";return"string"==typeof t?t:o.isFunction(t)?t():""},i.prototype.getCommonClasses=function(){var e=[];return(this.allowUpload()&&!this.uploaded()||this.downloading())&&e.push("incomplete"),this.uploadError()?e.push("fail"):e.push("success"),e},i.prototype.parse=function(e){this.fileName(u.pString(e.FileName)),this.tempName(u.pString(e.TempName)),""===this.tempName()&&this.tempName(this.fileName()),this.mimeType(u.pString(e.MimeType)),this.size(e.EstimatedSize?u.pInt(e.EstimatedSize):u.pInt(e.SizeInBytes)),this.hash(u.pString(e.Hash)),this.parseActions(e),this.uploadUid(this.hash()),this.uploaded(!0),n.isFunction(this.additionalParse)&&this.additionalParse(e)},i.prototype.parseActions=function(e){this.thumbUrlInQueue(""!==u.pString(e.ThumbnailUrl)?u.pString(e.ThumbnailUrl)+"/"+Math.random():""),this.commonParseActions(e),this.commonExcludeActions()},i.prototype.commonExcludeActions=function(){this.isViewSupported()||this.actions(o.without(this.actions(),"view"))},i.prototype.commonParseActions=function(e){o.each(e.Actions,function(e,t){this.oActionsData[t]||(this.oActionsData[t]={}),this.oActionsData[t].Url=u.pString(e.url),this.actions.push(t)},this)},i.addViewExtensions=function(e){o.isArray(e)&&(g=o.union(g,e))},i.prototype.isViewSupported=function(){return-1!==n.inArray(this.mimeType(),m)||-1!==n.inArray(this.extension(),g)},i.prototype.getInThumbQueue=function(){""===this.thumbUrlInQueue()||this.linked&&(!this.linked||this.linked())||(this.thumbnailSessionUid(""+Date.now()),l.thumbQueue(this.thumbnailSessionUid(),this.thumbUrlInQueue(),this.thumbnailSrc))},i.prototype.downloadFile=function(){var e=this.getActionUrl("download"),t={File:this,CancelDownload:!1};e.length>0&&"#"!==e&&(a.broadcastEvent("AbstractFileModel::FileDownload::before",t),t.CancelDownload||(o.isFunction(t.CustomDownloadHandler)?t.CustomDownloadHandler():c.downloadByUrl(e)))},i.prototype.viewFile=function(e,t){d.calmEvent(t),this.viewCommonFile()},i.prototype.viewCommonFile=function(e){var t=null,s=null;u.isNonEmptyString(e)||(e=c.getAppPath()+this.getActionUrl("view")),e.length>0&&"#"!==e&&(s={sUrl:e,index:this.index(),bBreakView:!1},a.broadcastEvent("AbstractFileModel::FileView::before",s),s.bBreakView||(t=p.open(e,e,!1),t&&t.focus()))},i.prototype.eventDragStart=function(e,t){var s=t.originalEvent||t;return e&&s&&s.dataTransfer&&s.dataTransfer.setData&&s.dataTransfer.setData("DownloadURL",this.generateTransferDownloadUrl()),!0},i.prototype.generateTransferDownloadUrl=function(){var e=this.getActionUrl("download");return"http"!==e.substr(0,4)&&(e=c.getAppPath()+e),this.mimeType()+":"+this.fileName()+":"+e},i.prototype.onUploadSelect=function(e,t,s){s||(this.fileName(u.pString(t.FileName)),this.mimeType(u.pString(t.Type)),this.size(u.pInt(t.Size))),this.uploadUid(e),this.uploaded(!1),this.statusText(""),this.progressPercent(0),this.visibleProgress(!1)},i.prototype.onUploadStart=function(){
  this.visibleProgress(!0)},i.prototype.onUploadProgress=function(e,t){t>0&&(this.progressPercent(Math.ceil(e/t*100)),this.visibleProgress(!0))},i.prototype.onDownloadProgress=function(e,t){t>0&&(this.progressPercent(Math.ceil(e/t*100)),this.visibleProgress(this.progressPercent()<100))},i.prototype.onUploadComplete=function(e,t,s){var i=!(t&&s&&!s.ErrorCode&&s.Result&&!s.Result.Error),o=s&&s.ErrorCode&&s.ErrorCode===Enums.Errors.CanNotUploadFileLimit?h.i18n("COREWEBCLIENT/ERROR_UPLOAD_SIZE"):h.i18n("COREWEBCLIENT/ERROR_UPLOAD_UNKNOWN");this.progressPercent(0),this.visibleProgress(!1),this.uploaded(!0),this.uploadError(i),this.statusText(i?o:h.i18n("COREWEBCLIENT/REPORT_UPLOAD_COMPLETE")),i||(this.fillDataAfterUploadComplete(s,e),setTimeout(function(e){return function(){e.statusText("")}}(this),3e3))},i.prototype.fillDataAfterUploadComplete=function(e,t){},i.prototype.onImageLoad=function(e,t){""===this.thumbUrlInQueue()||this.thumbnailLoaded()||(this.thumbnailLoaded(!0),l.thumbQueue(this.thumbnailSessionUid()))},i.prototype.stopDownloading=function(){this.downloading(!1)},i.prototype.startDownloading=function(){this.downloading(!0)},e.exports=i},328:function(e,t,s){"use strict";function i(){this.resultCount=n.observable(-1),this.search=n.observable(""),this.filters=n.observable(""),this.collection=n.observableArray([]),this.threadUids={}}var o=s(2),n=s(44),r=s(313);i.prototype.addThreadUids=function(e,t){-1!==o.indexOf(this.collection(),e)&&(this.threadUids[e]=t)},i.prototype.setUidsAndCount=function(e){"Collection/MessageCollection"===e["@Object"]&&(o.each(e.Uids,function(t,s){this.collection()[s+e.Offset]=""+t},this),this.resultCount(e.MessageResultCount))},i.prototype.getUidsForOffset=function(e,t){for(var s=0,i=this.collection().length,o="",n=0,a=[],l=null;s<i;s++)s>=e&&n<r.MailsPerPage&&(o=this.collection()[s],l=t[o],(l&&!l.deleted()||void 0===o)&&(n++,void 0!==o&&a.push(o)));return a},i.prototype.deleteUids=function(e){for(var t=0,s=this.collection().length,i="",n=[],r=0;t<s;t++)i=this.collection()[t],o.indexOf(e,i)===-1?n.push(i):r++;this.collection(n),this.resultCount(this.resultCount()-r)},e.exports=i},329:function(e,t,s){"use strict";var i=s(2),o=s(182),n=s(43),r=s(314),a=s(315),l=s(313),h=s(316),u={},c=!1,d=!1;u.prefetchFetchersIdentities=function(){return!(o.isNewTab()||c||!l.AllowFetchers&&!l.AllowIdentities)&&(r.populateFetchersIdentities(),c=!0,!0)},u.prefetchAccountFilters=function(){var e=r.getCurrent();e&&!e.filters()&&l.AllowFilters&&e.requestFilters()},u.prefetchStarredMessageList=function(){var e=h.folderList(),t=e?e.inboxFolder():null,s=null,i=!1;return t&&(s=h.requestMessageList(t.fullName(),1,"",Enums.FolderFilter.Flagged,!1,!1),i=!!s&&!!s.RequestStarted),d||(d=i),i},u.prefetchUnseenMessageList=function(){var e=h.folderList(),t=e?e.inboxFolder():null,s=null;return t&&t.hasChanges()&&(s=h.requestMessageList(t.fullName(),1,"",Enums.FolderFilter.Unseen,!1,!1)),s&&s.RequestStarted},u.prefetchNextPage=function(e){var t=h.uidList(),s=i.indexOf(t.collection(),e),o=Math.ceil(s/l.MailsPerPage)+1;this.startPagePrefetch(o-1)},u.prefetchPrevPage=function(e){var t=h.uidList(),s=i.indexOf(t.collection(),e),o=Math.ceil((s+1)/l.MailsPerPage)+1;this.startPagePrefetch(o)},u.startPagePrefetch=function(e){var t=h.folderList().currentFolder(),s=h.uidList(),i=(e-1)*l.MailsPerPage,o=e>0&&i<s.resultCount(),n=null,r=null;return t&&!t.hasChanges()&&o&&(n={folder:t.fullName(),page:e,search:s.search()},t.hasListBeenRequested(n)||(r=h.requestMessageList(n.folder,n.page,n.search,"",!1,!1))),r&&r.RequestStarted},u.startOtherFoldersPrefetch=function(){var e=h.folderList(),t=e.currentFolderFullName(),s=h.getNamesOfFoldersToRefresh(),o=e?[e.inboxFolderFullName(),e.sentFolderFullName(),e.draftsFolderFullName(),e.spamFolderFullName()]:[],n=s.length<5?this.getOtherFolderNames(5-s.length):[],r=i.uniq(i.compact(i.union(o,s,n))),a=!1;return i.each(r,i.bind(function(s){a||t===s||(a=this.startFolderPrefetch(e.getFolderByFullName(s)))},this)),a},u.getOtherFolderNames=function(e){var t=h.folderList().inboxFolder(),s=t?t.subfolders():[],o=i.filter(h.folderList().collection(),function(e){return!e.isSystem()},this),n=i.first(i.union(s,o),e);return i.map(n,function(e){return e.fullName()})},u.startFolderPrefetch=function(e){var t=1,s="",i={folder:e?e.fullName():"",page:t,search:s},o=null;return e&&!e.hasListBeenRequested(i)&&(o=h.requestMessageList(i.folder,i.page,i.search,"",!1,!1)),!!o&&o.RequestStarted},u.startThreadListPrefetch=function(){var e=[],t=h.getCurrentFolder();return i.each(h.messages(),function(s){s.threadCount()>0&&i.each(s.threadUids(),function(s){var i=t.oMessages[s];i||t.hasThreadUidBeenRequested(s)||e.push(s)})},this),e.length>0&&(e=e.slice(0,l.MailsPerPage),t.addRequestedThreadUids(e),t.loadThreadMessages(e),!0)},u.startMessagesPrefetch=function(){var e=h.currentAccountId(),t=h.getCurrentFolder(),s=0,o=l.MaxMessagesBodiesSizeToPrefetch,n=[],r=null,u=2048,c=function(e){var r=!e.deleted()&&!e.completelyFilled(),a=!i.find(n,function(t){return t===e.uid()},this),h=!t.hasUidBeenRequested(e.uid()),c=e.textSize()<l.MessageBodyTruncationThreshold?e.textSize():l.MessageBodyTruncationThreshold;s<o&&r&&a&&h&&(n.push(e.uid()),s+=c+u)};return!!(t&&t.selected()&&(i.each(h.messages(),c),i.each(t.oMessages,c),n.length>0))&&(t.addRequestedUids(n),r={AccountID:e,Folder:t.fullName(),Uids:n,MessageBodyTruncationThreshold:l.MessageBodyTruncationThreshold},a.send("GetMessagesBodies",r,this.onGetMessagesBodiesResponse,this),!0)},u.onGetMessagesBodiesResponse=function(e,t){var s=t.Parameters,o=h.getFolderByFullName(s.AccountID,s.Folder);i.isArray(e.Result)&&i.each(e.Result,function(e){o.parseAndCacheMessage(e,!1,!1)})},u.prefetchAccountQuota=function(){var e=r.getCurrent(),t=e&&!e.quotaRecieved();return!(!n.ShowQuotaBar||!t)&&(e.updateQuotaParams(),!0)},e.exports={startMin:function(){var e=!1;return e=u.prefetchFetchersIdentities(),e||(e=u.prefetchAccountFilters()),d||e||(e=u.prefetchStarredMessageList()),e||(e=u.prefetchAccountQuota()),e},startAll:function(){var e=!1;return e=u.prefetchFetchersIdentities(),e||(e=u.prefetchAccountFilters()),e||(e=u.startMessagesPrefetch()),e||(e=u.startThreadListPrefetch()),d||e||(e=u.prefetchStarredMessageList()),e||(e=u.startPagePrefetch(h.page()+1)),e||(e=u.startPagePrefetch(h.page()-1)),e||(e=u.prefetchUnseenMessageList()),e||(e=u.prefetchAccountQuota()),e||(e=u.startOtherFoldersPrefetch()),e},prefetchStarredMessageList:function(){u.prefetchStarredMessageList()},startFolderPrefetch:function(e){u.startFolderPrefetch(e)},prefetchNextPage:function(e){u.prefetchNextPage(e)},prefetchPrevPage:function(e){u.prefetchPrevPage(e)}}},330:function(e,t,s){"use strict";var i=s(182),o=s(i.isMobile()||i.isNewTab()?331:332);e.exports=o},331:function(e,t,s){"use strict";var i=s(195),o=s(318),n={};n.composeMessage=function(){i.setHash(o.getCompose())},n.composeMessageFromDrafts=function(e,t){var s=o.getComposeFromMessage("drafts",e,t);i.setHash(s)},n.composeMessageAsReplyOrForward=function(e,t,s){var n=o.getComposeFromMessage(e,t,s);i.setHash(n)},n.composeMessageToAddresses=function(e){var t=o.getComposeWithToField(e);i.setHash(t)},n.composeMessageWithEml=function(e){var t=o.getComposeWithEmlObject(e.folder(),e.uid(),e);t.shift(),t.shift(),i.goDirectly(o.getCompose(),t)},n.composeMessageWithAttachments=function(e){var t=o.getComposeWithObject("attachments",e);t.shift(),t.shift(),i.goDirectly(o.getCompose(),t)},e.exports=n},332:function(e,t,s){"use strict";function i(){return s(333)}var o=s(192),n=s(318),r={};r.composeMessage=function(){o.showPopup(i())},r.composeMessageFromDrafts=function(e,t){var s=n.getComposeFromMessage("drafts",e,t);s.shift(),o.showPopup(i(),[s])},r.composeMessageAsReplyOrForward=function(e,t,s){var r=n.getComposeFromMessage(e,t,s);r.shift(),o.showPopup(i(),[r])},r.composeMessageToAddresses=function(e){var t=n.getComposeWithToField(e);t.shift(),o.showPopup(i(),[t])},r.composeMessageWithEml=function(e){var t=n.getComposeWithEmlObject(e.folder(),e.uid(),e);t.shift(),o.showPopup(i(),[t])},r.composeMessageWithAttachments=function(e){var t=n.getComposeWithObject("attachments",e);t.shift(),o.showPopup(i(),[t])},r.closeComposePopup=function(){o.showPopup(i(),[["close"]])},e.exports=r},333:function(e,t,s){"use strict";function i(){u.call(this),d.call(this),this.minimized=r.observable(!1),this.fPreventBackspace=function(e){var t=e.which===n.ui.keyCode.BACKSPACE,s="INPUT"===e.target.tagName||"TEXTAREA"===e.target.tagName,i="DIV"===e.target.tagName&&"true"===n(e.target).attr("contenteditable");!t||s||i||(e.preventDefault(),e.stopPropagation())},this.minimized.subscribe(function(){this.minimized()?this.preventBackspaceOff():this.shown()&&this.preventBackspaceOn()},this),this.minimizedTitle=r.computed(function(){return this.subject()||a.i18n("MAILWEBCLIENT/HEADING_MINIMIZED_NEW_MESSAGE")},this)}var o=s(2),n=s(1),r=s(44),a=s(185),l=s(180),h=s(192),u=s(194),c=s(334),d=s(335);o.extendOwn(i.prototype,u.prototype),o.extendOwn(i.prototype,d.prototype),i.prototype.PopupTemplate="MailWebclient_ComposePopup",i.prototype.preventBackspaceOn=function(){n(document).on("keydown",this.fPreventBackspace)},i.prototype.preventBackspaceOff=function(){n(document).off("keydown",this.fPreventBackspace)},i.prototype.onClose=function(){this.preventBackspaceOff()},i.prototype.onOpen=function(e){if(e=e||[],1===e.length&&"close"===e[0])this.closePopup();else{var t=3===e.length&&"drafts"===e[0]&&e[2]===this.draftUid(),s=this.minimized();this.maximize(),this.shown()||s?(e.length>0&&!t?this.hasUnsavedChanges()?(this.disableAutosave(!0),h.showPopup(c,[o.bind(function(t){switch(t){case Enums.AnotherMessageComposedAnswer.Discard:this.onRoute(e);break;case Enums.AnotherMessageComposedAnswer.SaveAsDraft:this.hasUnsavedChanges()&&this.executeSave(!0,!1),this.onRoute(e);break;case Enums.AnotherMessageComposedAnswer.Cancel:}this.disableAutosave(!1)},this)])):this.onRoute(e):s||this.onRoute(e),this.oHtmlEditor.clearUndoRedo()):this.onRoute(e),this.preventBackspaceOn()}},i.prototype.minimize=function(){this.minimized(!0),this.$popupDom.addClass("minimized")},i.prototype.maximize=function(){this.minimized(!1),this.$popupDom.removeClass("minimized")},i.prototype.saveAndClose=function(){this.hasUnsavedChanges()&&this.saveCommand(),this.closePopup()},i.prototype.cancelPopup=function(){this.hasUnsavedChanges()?this.minimize():this.closePopup()},i.prototype.onEscHandler=function(e){var t=this.oHtmlEditor.hasOpenedPopup(),s=!l.ie&&e.target&&"input"===e.target.tagName.toLowerCase()&&"file"===e.target.type.toLowerCase();s&&e.target.blur(),!h.hasOnlyOneOpenedPopup()||t||s||this.minimize(),t&&this.oHtmlEditor.closeAllPopups()},e.exports=new i},334:function(e,t,s){"use strict";function i(){r.call(this),this.fConfirmCallback=null,this.shown=!1}var o=s(2),n=s(1),r=s(194);o.extendOwn(i.prototype,r.prototype),i.prototype.PopupTemplate="MailWebclient_ConfirmAnotherMessageComposedPopup",i.prototype.onOpen=function(e){this.fConfirmCallback=n.isFunction(e)?e:null,this.shown=!0},i.prototype.onClose=function(){this.shown=!1},i.prototype.onDiscardClick=function(){this.shown&&this.fConfirmCallback&&this.fConfirmCallback(Enums.AnotherMessageComposedAnswer.Discard),this.closePopup()},i.prototype.onSaveAsDraftClick=function(){this.shown&&this.fConfirmCallback&&this.fConfirmCallback(Enums.AnotherMessageComposedAnswer.SaveAsDraft),this.closePopup()},i.prototype.cancelPopup=function(){this.fConfirmCallback&&this.fConfirmCallback(Enums.AnotherMessageComposedAnswer.Cancel),this.closePopup()},i.prototype.onEnterHandler=function(){this.onSaveAsDraftClick()},e.exports=new i},335:function(e,t,s){"use strict";function i(){y.call(this,"MailWebclient"),this.browserTitle=r.computed(function(){return T.getEmail()+" - "+h.i18n("MAILWEBCLIENT/HEADING_COMPOSE_BROWSER_TAB")});var e=this;this.toAddrDom=r.observable(),this.toAddrDom.subscribe(function(){this.initInputosaurus(this.toAddrDom,this.toAddr,this.lockToAddr,"to")},this),this.ccAddrDom=r.observable(),this.ccAddrDom.subscribe(function(){this.initInputosaurus(this.ccAddrDom,this.ccAddr,this.lockCcAddr,"cc")},this),this.bccAddrDom=r.observable(),this.bccAddrDom.subscribe(function(){this.initInputosaurus(this.bccAddrDom,this.bccAddr,this.lockBccAddr,"bcc")},this),this.folderList=N.folderList,this.folderList.subscribe(function(){this.getMessageOnRoute()},this),this.bNewTab=d.isNewTab(),this.bDemo=v.IsDemo,this.sending=r.observable(!1),this.saving=r.observable(!1),this.oHtmlEditor=new O(!1,this),this.visibleBcc=r.observable(!1),this.visibleBcc.subscribe(function(){B.toggleClass("screen-compose-bcc",this.visibleCc()),o.defer(o.bind(function(){n(this.bccAddrDom()).inputosaurus("resizeInput")},this))},this),this.visibleCc=r.observable(!1),this.visibleCc.subscribe(function(){B.toggleClass("screen-compose-cc",this.visibleCc()),o.defer(o.bind(function(){n(this.ccAddrDom()).inputosaurus("resizeInput")},this))},this),this.sendReadingConfirmation=r.observable(!1).extend({reversible:!0}),this.composeUploaderButton=r.observable(null),this.composeUploaderButton.subscribe(function(){this.initUploader()},this),this.composeUploaderDropPlace=r.observable(null),this.composeUploaderBodyDragOver=r.observable(!1),this.composeUploaderDragOver=r.observable(!1),this.allowDragNDrop=r.observable(!1),this.uploaderBodyDragOver=r.computed(function(){return this.allowDragNDrop()&&this.composeUploaderBodyDragOver()},this),this.uploaderDragOver=r.computed(function(){return this.allowDragNDrop()&&this.composeUploaderDragOver()},this),this.selectedImportance=r.observable(Enums.Importance.Normal).extend({reversible:!0}),this.senderAccountId=R.senderAccountId,this.senderList=R.senderList,this.visibleFrom=r.computed(function(){return this.senderList().length>1},this),this.selectedSender=R.selectedSender,this.selectedFetcherOrIdentity=R.selectedFetcherOrIdentity,this.selectedFetcherOrIdentity.subscribe(function(){this.oHtmlEditor.isEditing()||this.oHtmlEditor.clearUndoRedo()},this),this.signature=r.observable(""),this.prevSignature=r.observable(null),r.computed(function(){var e=F.getClearSignature(this.senderAccountId(),this.selectedFetcherOrIdentity());null===this.prevSignature()?(this.prevSignature(e),this.signature(e)):(this.prevSignature(this.signature()),this.signature(e),this.oHtmlEditor.changeSignatureContent(this.signature(),this.prevSignature()))},this),this.lockToAddr=r.observable(!1),this.toAddr=r.observable("").extend({reversible:!0}),this.toAddr.subscribe(function(){this.lockToAddr()||(n(this.toAddrDom()).val(this.toAddr()),n(this.toAddrDom()).inputosaurus("refresh"))},this),this.lockCcAddr=r.observable(!1),this.ccAddr=r.observable("").extend({reversible:!0}),this.ccAddr.subscribe(function(){this.lockCcAddr()||(n(this.ccAddrDom()).val(this.ccAddr()),n(this.ccAddrDom()).inputosaurus("refresh"))},this),this.lockBccAddr=r.observable(!1),this.bccAddr=r.observable("").extend({reversible:!0}),this.bccAddr.subscribe(function(){this.lockBccAddr()||(n(this.bccAddrDom()).val(this.bccAddr()),n(this.bccAddrDom()).inputosaurus("refresh"))},this),this.recipientEmails=r.computed(function(){var e=[this.toAddr(),this.ccAddr(),this.bccAddr()].join(",").split(","),t=[];return o.each(e,function(e){var s=n.trim(e),i=null;""!==s&&(i=a.getEmailParts(s),i.email&&t.push(i.email))}),t},this),this.subject=r.observable("").extend({reversible:!0}),this.plainText=r.observable(!1),this.textBody=r.observable(""),this.textBody.subscribe(function(){this.oHtmlEditor.setText(this.textBody(),this.plainText()),this.oHtmlEditor.commit()},this),this.focusedField=r.observable(),this.oHtmlEditor.textFocused.subscribe(function(){this.oHtmlEditor.textFocused()&&this.focusedField("text")},this),this.subjectFocused=r.observable(!1),this.subjectFocused.subscribe(function(){this.subjectFocused()&&this.focusedField("subject")},this),this.templateUid=r.observable(""),this.templateFolderName=r.observable(N.getTemplateFolder()),this.draftUid=r.observable(""),this.draftUid.subscribe(function(){N.editedDraftUid(this.draftUid())},this),this.draftInfo=r.observableArray([]),this.routeType=r.observable(""),this.routeParams=r.observableArray([]),this.inReplyTo=r.observable(""),this.references=r.observable(""),this.bUploadStatus=!1,this.iUploadAttachmentsTimer=0,this.messageUploadAttachmentsStarted=r.observable(!1),this.messageUploadAttachmentsStarted.subscribe(function(t){window.clearTimeout(e.iUploadAttachmentsTimer),t?e.iUploadAttachmentsTimer=window.setTimeout(function(){e.bUploadStatus=!0,b.showLoading(h.i18n("MAILWEBCLIENT/INFO_ATTACHMENTS_LOADING"))},4e3):e.bUploadStatus?e.iUploadAttachmentsTimer=window.setTimeout(function(){e.bUploadStatus=!1,b.hideLoading()},1e3):b.hideLoading()},this),this.attachments=r.observableArray([]),this.attachmentsChanged=r.observable(!1),this.attachments.subscribe(function(){this.attachmentsChanged(!0)},this),this.notUploadedAttachments=r.computed(function(){return o.filter(this.attachments(),function(e){return!e.uploaded()})},this),this.allAttachmentsUploaded=r.computed(function(){return 0===this.notUploadedAttachments().length&&!this.messageUploadAttachmentsStarted()},this),this.notInlineAttachments=r.computed(function(){return o.filter(this.attachments(),function(e){return!e.linked()})},this),this.notInlineAttachments.subscribe(function(){B.toggleClass("screen-compose-attachments",this.notInlineAttachments().length>0)},this),this.allowStartSending=r.computed(function(){return!this.saving()},this),this.allowStartSending.subscribe(function(){this.allowStartSending()&&this.requiresPostponedSending()&&(F.sendPostponedMail(this.draftUid()),this.requiresPostponedSending(!1))},this),this.requiresPostponedSending=r.observable(!1),this.oJua=null,this.isDraftsCleared=r.observable(!1),this.backToListOnSendOrSave=r.observable(!1),this.composeShown=r.computed(function(){return!!this.opened&&this.opened()||!!this.shown&&this.shown()},this),this.toolbarControllers=r.observableArray([]),this.disableHeadersEdit=r.computed(function(){var e=!1;return o.each(this.toolbarControllers(),function(t){e=e||!!t.disableHeadersEdit&&t.disableHeadersEdit()}),e},this),r.computed(function(){var e=!1;o.each(this.toolbarControllers(),function(t){e=e||!!t.disableBodyEdit&&t.disableBodyEdit()}),this.oHtmlEditor.setDisableEdit(e)},this),this.draftFolderIsAvailable=r.computed(function(){return!!N.folderList().draftsFolder()},this),this.disableAutosave=r.observable(!1),D.AllowAutosaveInDrafts&&D.AutoSaveIntervalSeconds>0&&(this.iAutosaveInterval=-1,r.computed(function(){var e=this.draftFolderIsAvailable()&&this.composeShown()&&!this.sending()&&!this.saving()&&!this.disableAutosave()&&!N.disableComposeAutosave();o.each(this.toolbarControllers(),function(t){e=e&&!(t.disableAutosave&&t.disableAutosave())}),window.clearInterval(this.iAutosaveInterval),e&&(this.iAutosaveInterval=window.setInterval(o.bind(this.executeSave,this,!0),1e3*D.AutoSaveIntervalSeconds))},this)),this.backToListCommand=c.createCommand(this,this.executeBackToList),this.sendCommand=c.createCommand(this,this.executeSend,this.isEnableSending),this.saveCommand=c.createCommand(this,this.executeSaveCommand,this.isEnableSaving),this.visibleSaveTemplateControl=r.observable(!1),this.saveTemplateCommand=c.createCommand(this,this.executeTemplateSaveCommand,this.isEnableSaving),this.messageFields=r.observable(null),this.bottomPanel=r.observable(null),this.sHotkeysHintsViewTemplate=p.mobileDevice?"":"MailWebclient_Compose_HotkeysHintsView",this.sPopupButtonsViewTemplate=d.isNewTab()?"":"MailWebclient_Compose_PopupButtonsView",this.aHotkeys=[{value:"Ctrl+Enter",action:h.i18n("MAILWEBCLIENT/LABEL_SEND_HOTKEY"),visible:r.observable(!0)},{value:"Ctrl+S",action:h.i18n("MAILWEBCLIENT/LABEL_SAVE_HOTKEY"),visible:this.draftFolderIsAvailable},{value:"Ctrl+Z",action:h.i18n("MAILWEBCLIENT/LABEL_UNDO_HOTKEY"),visible:r.observable(!0)},{value:"Ctrl+Y",action:h.i18n("MAILWEBCLIENT/LABEL_REDO_HOTKEY"),visible:r.observable(!0)},{value:"Ctrl+K",action:h.i18n("MAILWEBCLIENT/LABEL_LINK_HOTKEY"),visible:r.observable(!0)},{value:"Ctrl+B",action:h.i18n("MAILWEBCLIENT/LABEL_BOLD_HOTKEY"),visible:r.observable(!0)},{value:"Ctrl+I",action:h.i18n("MAILWEBCLIENT/LABEL_ITALIC_HOTKEY"),visible:r.observable(!0)},{value:"Ctrl+U",action:h.i18n("MAILWEBCLIENT/LABEL_UNDERLINE_HOTKEY"),visible:r.observable(!0)}],this.bAllowFiles=!!I,this.ignoreHasUnsavedChanges=r.observable(!1),this.changedInPreviousWindow=r.observable(!1),this.hasUnsavedChanges=r.computed(function(){return!this.ignoreHasUnsavedChanges()&&this.isChanged()&&this.isEnableSaving()},this),this.saveAndCloseTooltip=r.computed(function(){return this.draftFolderIsAvailable()&&this.hasUnsavedChanges()?h.i18n("MAILWEBCLIENT/ACTION_SAVE_CLOSE"):h.i18n("MAILWEBCLIENT/ACTION_CLOSE")},this),this.splitterDom=r.observable(),this.headersCompressed=r.observable(!1),this.allowCcBccSwitchers=r.computed(function(){return!this.disableHeadersEdit()&&!this.headersCompressed()},this),this.registerOwnToolbarControllers(),d.broadcastEvent("MailWebclient::ConstructView::after",{Name:this.ViewConstructorName,View:this})}var o=s(2),n=s(1),r=s(44),a=s(205),l=s(322),h=s(185),u=s(181),c=s(217),d=s(182),p=s(180),m=s(278),g=s(42),f=s(195),b=s(188),v=s(43),E=s(200),y=s(198),A=s(192),S=s(193),I=g.run("FilesWebclient","getSelectFilesPopup"),C=s(318),F=s(336),T=s(314),L=s(191),w=s(315),N=s(316),M=s(337),R=s(339),D=s(313),P=s(321),U=s(326),O=s(340),x=d.isNewTab()&&window.opener&&window.opener.MainTabMailMethods,B=n("html");o.extendOwn(i.prototype,y.prototype),i.prototype.ViewTemplate=d.isNewTab()?"MailWebclient_ComposeScreenView":"MailWebclient_ComposeView",i.prototype.ViewConstructorName="CComposeView",i.prototype.isEnableSending=function(){var e=0===this.toAddr().length&&0===this.ccAddr().length&&0===this.bccAddr().length,t=this.folderList()&&0!==this.folderList().iAccountId;return t&&!this.sending()&&!e&&this.allAttachmentsUploaded()},i.prototype.isEnableSaving=function(){var e=this.folderList()&&0!==this.folderList().iAccountId;return this.composeShown()&&e&&!this.sending()&&!this.saving()},i.prototype.initInputosaurus=function(e,t,s,i){e()&&n(e()).length>0&&n(e()).inputosaurus({width:"auto",parseOnBlur:!0,autoCompleteSource:g.run("ContactsWebclient","getSuggestionsAutocompleteCallback",["all"])||function(){},autoCompleteDeleteItem:g.run("ContactsWebclient","getSuggestionsAutocompleteDeleteHandler")||function(){},autoCompleteAppendTo:n(e()).closest("td"),change:o.bind(function(e){s(!0),this.setRecipient(t,e.target.value),s(!1)},this),copy:o.bind(function(e){this.inputosaurusBuffer=e},this),paste:o.bind(function(){var e=this.inputosaurusBuffer||"";return this.inputosaurusBuffer="",e},this),focus:o.bind(this.focusedField,this,i),mobileDevice:p.mobileDevice})},i.prototype.changeHeadersCompressed=function(){this.headersCompressed(!this.headersCompressed())},i.prototype.onBind=function(){g.run("SessionTimeoutWeblient","registerFunction",[o.bind(this.executeSave,this,!1)]),d.isMobile()||this.hotKeysBind()},i.prototype.hotKeysBind=function(){(this.$popupDom||this.$viewDom).on("keydown",n.proxy(function(e){if(e&&e.ctrlKey&&!e.altKey&&!e.shiftKey){var t=e.keyCode,s=this.composeShown()&&(!this.minimized||!this.minimized())&&e&&e.ctrlKey;s&&t===Enums.Key.s?(e.preventDefault(),e.returnValue=!1,this.isEnableSaving()&&this.saveCommand()):s&&t===Enums.Key.Enter&&""!==this.toAddr()&&this.sendCommand()}},this))},i.prototype.getMessageOnRoute=function(){var e=C.parseCompose(this.routeParams());""!==this.routeType()&&e.MessageFolderName&&e.MessageUid&&N.getMessage(e.MessageFolderName,e.MessageUid,this.onMessageResponse,this)},i.prototype.onShow=function(){var e=this.focusedField();n(this.splitterDom()).trigger("resize"),n(this.bottomPanel()).trigger("resize"),this.oHtmlEditor.isInitialized()||(this.oHtmlEditor.init(this.textBody(),this.plainText(),"7"),this.oHtmlEditor.commit()),this.initUploader(),this.backToListOnSendOrSave(!1),this.focusedField(e),B.addClass("screen-compose"),this.oJua&&this.oJua.setDragAndDropEnabledStatus(!0),this.visibleSaveTemplateControl(N.getCurrentTemplateFolders().length>0)},i.prototype.reset=function(){this.plainText(!1),this.bUploadStatus=!1,window.clearTimeout(this.iUploadAttachmentsTimer),this.messageUploadAttachmentsStarted(!1),this.templateUid(""),this.templateFolderName(N.getTemplateFolder()),this.draftUid(""),this.draftInfo.removeAll(),this.setDataFromMessage(new P),this.isDraftsCleared(!1),this.ignoreHasUnsavedChanges(!1)},i.prototype.onRoute=function(e){var t=C.parseCompose(e);switch(T.changeCurrentAccountByHash(t.AccountHash),this.reset(),this.routeType(t.RouteType),this.routeType()){case Enums.ReplyType.ForwardAsAttach:this.routeParams(e),this.fillDefault(t);case Enums.ReplyType.Reply:case Enums.ReplyType.ReplyAll:case Enums.ReplyType.Resend:case Enums.ReplyType.Forward:case"drafts":this.routeParams(e),0!==this.folderList().iAccountId&&this.getMessageOnRoute();break;default:this.routeParams(e),this.fillDefault(t)}},i.prototype.fillDefault=function(e){var t=F.getSignatureText(this.senderAccountId(),this.selectedFetcherOrIdentity(),!0),s=x?x.getComposedMessage(window.name):null,i=e.ToAddr;s?(this.setMessageDataInNewTab(s),this.changedInPreviousWindow()&&o.defer(o.bind(this.executeSave,this,!0))):""!==t&&this.textBody("<br /><br />"+t+"<br />"),i&&(this.setRecipient(this.toAddr,i.to),i.hasMailto&&(this.subject(i.subject),this.setRecipient(this.ccAddr,i.cc),this.setRecipient(this.bccAddr,i.bcc),""!==i.body&&this.textBody("<div>"+i.body+"</div>"))),this.routeType()===Enums.ReplyType.ForwardAsAttach&&e.Object&&this.addMessageAsAttachment(e.Object),"attachments"===this.routeType()&&e.Object&&this.addAttachments(e.Object),o.defer(o.bind(function(){this.focusAfterFilling()},this)),this.visibleCc(""!==this.ccAddr()),this.visibleBcc(""!==this.bccAddr()),this.commit(!0)},i.prototype.focusToAddr=function(){n(this.toAddrDom()).inputosaurus("focus")},i.prototype.focusCcAddr=function(){n(this.ccAddrDom()).inputosaurus("focus")},i.prototype.focusBccAddr=function(){n(this.bccAddrDom()).inputosaurus("focus")},i.prototype.focusAfterFilling=function(){switch(this.focusedField()){case"to":this.focusToAddr();break;case"cc":this.visibleCc(!0),this.focusCcAddr();break;case"bcc":this.visibleBcc(!0),this.focusBccAddr();break;case"subject":this.subjectFocused(!0);break;case"text":this.oHtmlEditor.setFocus();break;default:0===this.toAddr().length?this.focusToAddr():0===this.subject().length?this.subjectFocused(!0):this.oHtmlEditor.setFocus()}},i.prototype.onHide=function(){!o.isFunction(this.closePopup)&&this.hasUnsavedChanges()&&this.executeSave(!0),this.headersCompressed(!1),this.routeParams([]),this.subjectFocused(!1),this.focusedField(""),this.messageUploadAttachmentsStarted(!1),B.removeClass("screen-compose").removeClass("screen-compose-cc").removeClass("screen-compose-bcc").removeClass("screen-compose-attachments"),this.oJua&&this.oJua.setDragAndDropEnabledStatus(!1)},i.prototype.setRecipient=function(e,t){e()===t?e.valueHasMutated():e(t)},i.prototype.onMessageResponse=function(e){var t=null;if(null===e)this.setDataFromMessage(new P);else{switch(this.routeType()){case Enums.ReplyType.Reply:case Enums.ReplyType.ReplyAll:R.setFetcherOrIdentityByReplyMessage(e),t=F.getReplyDataFromMessage(e,this.routeType(),this.senderAccountId(),this.selectedFetcherOrIdentity(),!0),this.draftInfo(t.DraftInfo),this.draftUid(t.DraftUid),this.setRecipient(this.toAddr,t.To),this.setRecipient(this.ccAddr,t.Cc),this.setRecipient(this.bccAddr,t.Bcc),this.subject(t.Subject),this.textBody(t.Text),this.attachments(t.Attachments),this.inReplyTo(t.InReplyTo),this.references(t.References);break;case Enums.ReplyType.ForwardAsAttach:t=F.getReplyDataFromMessage(e,this.routeType(),this.senderAccountId(),this.selectedFetcherOrIdentity(),!0),this.draftInfo(t.DraftInfo),this.draftUid(t.DraftUid),this.inReplyTo(t.InReplyTo),this.references(t.References);break;case Enums.ReplyType.Forward:R.setFetcherOrIdentityByReplyMessage(e),t=F.getReplyDataFromMessage(e,this.routeType(),this.senderAccountId(),this.selectedFetcherOrIdentity(),!0),this.draftInfo(t.DraftInfo),this.draftUid(t.DraftUid),this.setRecipient(this.toAddr,t.To),this.setRecipient(this.ccAddr,t.Cc),this.subject(t.Subject),this.textBody(t.Text),this.attachments(t.Attachments),this.inReplyTo(t.InReplyTo),this.references(t.References);break;case Enums.ReplyType.Resend:this.setDataFromMessage(e);break;case"drafts":-1!==n.inArray(e.folder(),N.getCurrentTemplateFolders())?(this.templateUid(e.uid()),this.templateFolderName(e.folder())):this.draftUid(e.uid()),this.setDataFromMessage(e)}this.routeType()!==Enums.ReplyType.ForwardAsAttach&&this.attachments().length>0&&this.requestAttachmentsTempName(),this.routeType("")}this.visibleCc(""!==this.ccAddr()),this.visibleBcc(""!==this.bccAddr()),this.commit(!0),o.defer(o.bind(function(){this.focusAfterFilling()},this))},i.prototype.setDataFromMessage=function(e){var t="",s=F.getFirstFetcherOrIdentityByRecipientsOrDefault(e.oFrom.aCollection,e.accountId());R.changeSenderAccountId(e.accountId(),s),t=e.isPlain()?e.textRaw():e.getConvertedHtml(),this.draftInfo(e.draftInfo()),this.inReplyTo(e.inReplyTo()),this.references(e.references()),this.setRecipient(this.toAddr,e.oTo.getFull()),this.setRecipient(this.ccAddr,e.oCc.getFull()),this.setRecipient(this.bccAddr,e.oBcc.getFull()),this.subject(e.subject()),this.attachments(e.attachments()),this.plainText(e.isPlain()),this.textBody(t),this.selectedImportance(e.importance()),this.sendReadingConfirmation(""!==e.readingConfirmationAddressee()),o.each(this.toolbarControllers(),function(t){o.isFunction(t.doAfterPopulatingMessage)&&t.doAfterPopulatingMessage({bDraft:!!e.folderObject()&&e.folderObject().type()===Enums.FolderTypes.Drafts,bPlain:e.isPlain(),sRawText:e.textRaw(),iSensitivity:e.sensitivity()})})},i.prototype.onDataAsAttachmentUpload=function(e,t){var s=t.Parameters,i=e.Result,n=s.Hash,r=o.find(this.attachments(),function(e){return e.hash()===n});this.messageUploadAttachmentsStarted(!1),r&&(i&&i.Attachment?r.parseFromUpload(i.Attachment):r.errorFromUpload())},i.prototype.addAttachments=function(e){o.each(e,o.bind(function(e){var t=new U;t.parseFromUpload(e),this.attachments.push(t)},this))},i.prototype.addFilesAsAttachment=function(e){var t=null,s=[];o.each(e,function(e){t=new U,t.fileName(e.fileName()),t.hash(e.hash()),t.thumbUrlInQueue(e.thumbUrlInQueue()),t.uploadStarted(!0),this.attachments.push(t),s.push(e.hash())},this),s.length>0&&(this.messageUploadAttachmentsStarted(!0),L.send("Files","GetFilesForUpload",{Hashes:s},this.onFilesUpload,this))},i.prototype.onFilesUpload=function(e,t){var s=t.Parameters,i=e.Result,n=s.Hashes;this.messageUploadAttachmentsStarted(!1),o.isArray(i)?o.each(i,function(e){var t=o.find(this.attachments(),function(t){return t.hash()===e.Hash});t&&(t.parseFromUpload(e),t.hash(e.NewHash))},this):o.each(n,function(e){var t=o.find(this.attachments(),function(t){return t.hash()===e});t&&t.errorFromUpload()},this)},i.prototype.addMessageAsAttachment=function(e){var t=new U,s=null;e&&(t.fileName(e.subject()+".eml"),t.uploadStarted(!0),this.attachments.push(t),s={MessageFolder:e.folder(),MessageUid:e.uid(),FileName:t.fileName()},this.messageUploadAttachmentsStarted(!0),w.send("SaveMessageAsTempFile",s,this.onSaveMessageAsTempFile,this))},i.prototype.onSaveMessageAsTempFile=function(e,t){var s=e.Result,i=t.Parameters.FileName,n=null;this.messageUploadAttachmentsStarted(!1),s?(n=o.find(this.attachments(),function(e){return e.fileName()===i&&e.uploadStarted()}),n&&n.parseFromUpload(s,t.Parameters.MessageFolder,t.Parameters.MessageUid)):(n=o.find(this.attachments(),function(e){return e.fileName()===i&&e.uploadStarted()}),n&&n.errorFromUpload())},i.prototype.onContactVCardUpload=function(e,t){var s=t.Parameters,i=e.Result,n=null;this.messageUploadAttachmentsStarted(!1),i?(n=o.find(this.attachments(),function(e){return e.fileName()===i.Name&&e.uploadStarted()}),n&&n.parseFromUpload(i)):(n=o.find(this.attachments(),function(e){return e.fileName()===s.Name&&e.uploadStarted();
  }),n&&n.errorFromUpload())},i.prototype.requestAttachmentsTempName=function(){var e=o.map(this.attachments(),function(e){return e.uploadUid(e.hash()),e.uploadStarted(!0),e.hash()});e.length>0&&(this.messageUploadAttachmentsStarted(!0),w.send("SaveAttachmentsAsTempFiles",{Attachments:e},this.onMessageUploadAttachmentsResponse,this))},i.prototype.onMessageUploadAttachmentsResponse=function(e,t){var s=t.Parameters.Attachments;this.messageUploadAttachmentsStarted(!1),e.Result?o.each(e.Result,o.bind(this.setAttachTepmNameByHash,this)):(o.each(s,function(e){var t=o.find(this.attachments(),function(t){return t.hash()===e});t&&t.errorFromUpload()},this),b.showError(h.i18n("MAILWEBCLIENT/ERROR_UPLOAD_FORWARD_ATTACHMENTS")))},i.prototype.setAttachTepmNameByHash=function(e,t){o.each(this.attachments(),function(s){s.hash()===e&&(s.tempName(t),s.uploadStarted(!1))})},i.prototype.setMessageDataInNewTab=function(e){this.templateUid(e.templateUid),this.templateFolderName(e.templateFolderName),this.draftInfo(e.draftInfo),this.draftUid(e.draftUid),this.inReplyTo(e.inReplyTo),this.references(e.references),this.setRecipient(this.toAddr,e.toAddr),this.setRecipient(this.ccAddr,e.ccAddr),this.setRecipient(this.bccAddr,e.bccAddr),this.subject(e.subject),this.attachments(o.map(e.attachments,function(e){var t=new U;return t.parse(e),t},this)),this.plainText(e.plainText),this.textBody(e.textBody),this.selectedImportance(e.selectedImportance),this.sendReadingConfirmation(e.sendReadingConfirmation),this.changedInPreviousWindow(e.changedInPreviousWindow),o.each(this.toolbarControllers(),function(t){o.isFunction(t.doAfterApplyingMainTabParameters)&&t.doAfterApplyingMainTabParameters(e)}),R.changeSenderAccountId(e.senderAccountId,e.selectedFetcherOrIdentity),this.focusedField(e.focusedField)},i.prototype.commit=function(e){this.toAddr.commit(),this.ccAddr.commit(),this.bccAddr.commit(),this.subject.commit(),this.selectedImportance.commit(),this.sendReadingConfirmation.commit(),o.each(this.toolbarControllers(),function(e){o.isFunction(e.commit)&&e.commit()}),this.oHtmlEditor.commit(),this.attachmentsChanged(!1),e||this.changedInPreviousWindow(!1)},i.prototype.isChanged=function(){var e=this.toAddr.changed(),t=this.ccAddr.changed(),s=this.bccAddr.changed(),i=this.subject.changed(),n=this.selectedImportance.changed(),r=this.sendReadingConfirmation.changed(),a=!1,l=this.oHtmlEditor.textChanged(),h=this.attachmentsChanged(),u=this.changedInPreviousWindow();return o.each(this.toolbarControllers(),function(e){o.isFunction(e.isChanged)&&(a=a||e.isChanged())}),e||t||s||i||n||r||a||l||h||u},i.prototype.executeBackToList=function(){d.isNewTab()?window.close():this.shown&&this.shown()&&f.setPreviousHash(),this.backToListOnSendOrSave(!1)},i.prototype.onFileUploadSelect=function(e,t){var s;return!l.showErrorIfAttachmentSizeLimit(t.FileName,u.pInt(t.Size))&&(s=new U,s.onUploadSelect(e,t),this.attachments.push(s),!0)},i.prototype.getAttachmentByUid=function(e){return o.find(this.attachments(),function(t){return t.uploadUid()===e})},i.prototype.onFileUploadStart=function(e){var t=this.getAttachmentByUid(e);t&&t.onUploadStart()},i.prototype.onFileUploadProgress=function(e,t,s){var i=this.getAttachmentByUid(e);i&&i.onUploadProgress(t,s)},i.prototype.onFileUploadComplete=function(e,t,s){var i=this.getAttachmentByUid(e);i&&i.onUploadComplete(e,t,s)},i.prototype.onFileRemove=function(e){var t=this.getAttachmentByUid(e);this.oJua&&this.oJua.cancel(e),this.attachments.remove(t)},i.prototype.initUploader=function(){this.composeShown()&&this.composeUploaderButton()&&null===this.oJua&&(this.oJua=new m({action:"?/Api/",name:"jua-uploader",queueSize:2,clickElement:this.composeUploaderButton(),hiddenElementsPosition:v.IsRTL?"right":"left",dragAndDropElement:this.composeUploaderDropPlace(),disableAjaxUpload:!1,disableFolderDragAndDrop:!1,disableDragAndDrop:!1,hidden:o.extendOwn({Module:D.ServerModuleName,Method:"UploadAttachment",Parameters:function(){return JSON.stringify({AccountID:N.currentAccountId()})}},d.getCommonRequestParameters())}),this.oJua.on("onDragEnter",o.bind(this.composeUploaderDragOver,this,!0)).on("onDragLeave",o.bind(this.composeUploaderDragOver,this,!1)).on("onBodyDragEnter",o.bind(this.composeUploaderBodyDragOver,this,!0)).on("onBodyDragLeave",o.bind(this.composeUploaderBodyDragOver,this,!1)).on("onProgress",o.bind(this.onFileUploadProgress,this)).on("onSelect",o.bind(this.onFileUploadSelect,this)).on("onStart",o.bind(this.onFileUploadStart,this)).on("onComplete",o.bind(this.onFileUploadComplete,this)),this.allowDragNDrop(this.oJua.isDragAndDropSupported()))},i.prototype.getSendSaveParameters=function(e,t){var s=F.convertAttachmentsForSending(this.attachments()),i=null;return o.each(this.oHtmlEditor.getUploadedImagesData(),function(e){s[e.TempName]=[e.Name,e.CID,"1","1"]}),i={AccountID:this.senderAccountId(),FetcherID:this.selectedFetcherOrIdentity()&&this.selectedFetcherOrIdentity().FETCHER?this.selectedFetcherOrIdentity().id():"",IdentityID:this.selectedFetcherOrIdentity()&&!this.selectedFetcherOrIdentity().FETCHER?this.selectedFetcherOrIdentity().id():"",DraftInfo:this.draftInfo(),DraftUid:this.draftUid(),To:this.toAddr(),Cc:this.ccAddr(),Bcc:this.bccAddr(),Subject:this.subject(),Text:this.plainText()?this.oHtmlEditor.getPlainText():this.oHtmlEditor.getText(e),IsHtml:!this.plainText(),Importance:this.selectedImportance(),SendReadingConfirmation:this.sendReadingConfirmation(),Attachments:s,InReplyTo:this.inReplyTo(),References:this.references()},o.each(this.toolbarControllers(),function(e){o.isFunction(e.doAfterPreparingSendMessageParameters)&&e.doAfterPreparingSendMessageParameters(i)}),""!==this.templateFolderName()&&t&&(i.DraftFolder=this.templateFolderName(),i.DraftUid=this.templateUid()),i},i.prototype.onSendOrSaveMessageResponse=function(e,t){var s=F.onSendOrSaveMessageResponse(e,t,this.requiresPostponedSending()),n=t.Parameters;switch(this.commit(),s.Method){case"SaveMessage":s.Result&&t.DraftUid===this.templateUid()&&t.DraftFolder===this.templateFolderName()?(this.templateUid(u.pString(s.NewUid)),this instanceof i&&f.replaceHashDirectly(C.getComposeFromMessage("drafts",n.DraftFolder,this.templateUid()))):s.Result&&n.DraftUid===this.draftUid()&&(this.draftUid(u.pString(s.NewUid)),this instanceof i&&f.replaceHashDirectly(C.getComposeFromMessage("drafts",n.DraftFolder,this.draftUid()))),this.saving(!1);break;case"SendMessage":s.Result&&this.backToListOnSendOrSave()&&(o.isFunction(this.closePopup)?this.closePopup():this.executeBackToList()),this.sending(!1)}},i.prototype.verifyDataForSending=function(){var e=a.getIncorrectEmailsFromAddressString(this.toAddr()),t=a.getIncorrectEmailsFromAddressString(this.ccAddr()),s=a.getIncorrectEmailsFromAddressString(this.bccAddr()),i=o.union(e,t,s),n=o.map(i,function(e){return h.encodeHtml(e)}),r=h.i18n("MAILWEBCLIENT/ERROR_INPUT_CORRECT_EMAILS")+n.join(", ");return!(i.length>0)||(A.showPopup(S,[r]),!1)},i.prototype.executeSend=function(e){var t=!1,s=o.bind(function(){this.sending(!0),this.requiresPostponedSending(!this.allowStartSending()),F.send("SendMessage",this.getSendSaveParameters(!0),!0,this.onSendOrSaveMessageResponse,this,this.requiresPostponedSending()),this.backToListOnSendOrSave(!0)},this);this.isEnableSending()&&this.verifyDataForSending()&&(o.each(this.toolbarControllers(),function(e){o.isFunction(e.doBeforeSend)&&(t=t||e.doBeforeSend(s))}),t||s())},i.prototype.executeSaveCommand=function(){this.draftFolderIsAvailable()&&this.executeSave(!1)},i.prototype.executeTemplateSaveCommand=function(){this.executeSave(!1,!0,!0)},i.prototype.executeSave=function(e,t,s){e=!!e,t=void 0===t||t,s=!!s;var i=t?this.onSendOrSaveMessageResponse:F.onSendOrSaveMessageResponse,n=t?this:F,r=o.bind(function(o){o&&(this.saving(t),F.send("SaveMessage",this.getSendSaveParameters(!1,s),!e,i,n))},this),a=!1;this.isEnableSaving()&&(e&&!this.isChanged()||(e||o.each(this.toolbarControllers(),function(e){o.isFunction(e.doBeforeSave)&&(a=a||e.doBeforeSave(r))},this),a||r(!0)),this.backToListOnSendOrSave(!0))},i.prototype.changeBccVisibility=function(){this.visibleBcc(!this.visibleBcc()),this.visibleBcc()?this.focusBccAddr():this.focusToAddr()},i.prototype.changeCcVisibility=function(){this.visibleCc(!this.visibleCc()),this.visibleCc()?this.focusCcAddr():this.focusToAddr()},i.prototype.getMessageDataForNewTab=function(){var e=o.map(this.attachments(),function(e){return{"@Object":"Object/Aurora\\Modules\\Mail\\Classes\\Attachment",FileName:e.fileName(),TempName:e.tempName(),MimeType:e.mimeType(),MimePartIndex:e.mimePartIndex(),EstimatedSize:e.size(),CID:e.cid(),ContentLocation:e.contentLocation(),IsInline:e.inline(),IsLinked:e.linked(),Hash:e.hash()}}),t=null;return t={accountId:this.senderAccountId(),templateUid:this.templateUid(),templateFolderName:this.templateFolderName(),draftInfo:this.draftInfo(),draftUid:this.draftUid(),inReplyTo:this.inReplyTo(),references:this.references(),senderAccountId:this.senderAccountId(),selectedFetcherOrIdentity:this.selectedFetcherOrIdentity(),toAddr:this.toAddr(),ccAddr:this.ccAddr(),bccAddr:this.bccAddr(),subject:this.subject(),attachments:e,plainText:this.plainText(),textBody:this.plainText()?this.oHtmlEditor.getPlainText():this.oHtmlEditor.getText(),selectedImportance:this.selectedImportance(),sendReadingConfirmation:this.sendReadingConfirmation(),changedInPreviousWindow:this.isChanged(),focusedField:this.focusedField()},o.each(this.toolbarControllers(),function(e){o.isFunction(e.doAfterPreparingMainTabParameters)&&e.doAfterPreparingMainTabParameters(t)}),t},i.prototype.openInNewWindow=function(){var e="id"+Math.random(),t={},s=null,i=f.buildHashFromArray(C.getCompose());this.ignoreHasUnsavedChanges(!0),t=this.getMessageDataForNewTab(),this.draftUid().length>0&&!this.isChanged()?(i=f.buildHashFromArray(C.getComposeFromMessage("drafts",N.folderList().draftsFolderFullName(),this.draftUid(),!0)),s=E.openTab("?message-newtab"+i)):this.templateUid().length>0&&!this.isChanged()?(i=f.buildHashFromArray(C.getComposeFromMessage("drafts",this.templateFolderName(),this.templateUid(),!0)),s=E.openTab("?message-newtab"+i)):this.isChanged()?(M.passComposedMessage(e,t),s=E.openTab("?message-newtab"+i,e)):(this.routeParams().length>0&&(i=f.buildHashFromArray(o.union([D.HashModuleName+"-compose"],this.routeParams()))),s=E.openTab("?message-newtab"+i)),this.commit(),o.isFunction(this.closePopup)?this.closePopup():this.executeBackToList()},i.prototype.onShowFilesPopupClick=function(){this.bAllowFiles&&A.showPopup(I,[o.bind(this.addFilesAsAttachment,this)])},i.prototype.registerOwnToolbarControllers=function(){this.registerToolbarController({ViewTemplate:"MailWebclient_Compose_BackButtonView",sId:"back",bOnlyMobile:!0,backToListCommand:this.backToListCommand}),this.registerToolbarController({ViewTemplate:"MailWebclient_Compose_SendButtonView",sId:"send",bAllowMobile:!0,sendCommand:this.sendCommand}),this.registerToolbarController({ViewTemplate:"MailWebclient_Compose_SaveButtonView",sId:"save",bAllowMobile:!0,visible:this.draftFolderIsAvailable,saveCommand:this.saveCommand}),this.registerToolbarController({ViewTemplate:"MailWebclient_Compose_SaveTemplateButtonView",sId:"save-template",bAllowMobile:!1,visible:this.visibleSaveTemplateControl,saveTemplateCommand:this.saveTemplateCommand}),this.registerToolbarController({ViewTemplate:"MailWebclient_Compose_ImportanceDropdownView",sId:"importance",selectedImportance:this.selectedImportance}),this.registerToolbarController({ViewTemplate:"MailWebclient_Compose_ConfirmationCheckboxView",sId:"confirmation",sendReadingConfirmation:this.sendReadingConfirmation})},i.prototype.registerToolbarController=function(e){var t=d.isMobile()?e.bAllowMobile:!e.bOnlyMobile,s=D.ComposeToolbarOrder.length;t&&(this.toolbarControllers.push(e),this.toolbarControllers(o.sortBy(this.toolbarControllers(),function(e){var t=o.indexOf(D.ComposeToolbarOrder,e.sId);return t!==-1?t:s})),o.isFunction(e.assignComposeExtInterface)&&e.assignComposeExtInterface(this.getExtInterface()))},i.prototype.getExtInterface=function(){return{isHtml:o.bind(function(){return!this.plainText()},this),hasAttachments:o.bind(function(){return this.notInlineAttachments().length>0},this),getPlainText:o.bind(this.oHtmlEditor.getPlainText,this.oHtmlEditor),getFromEmail:o.bind(function(){return T.getEmail(this.senderAccountId())},this),getRecipientEmails:o.bind(function(){return this.recipientEmails()},this),saveSilently:o.bind(this.executeSave,this,!0),setPlainTextMode:o.bind(this.plainText,this,!0),setPlainText:o.bind(function(e){this.textBody(e)},this),setHtmlTextMode:o.bind(this.plainText,this,!1),setHtmlText:o.bind(function(e){this.textBody(e)},this),undoHtml:o.bind(this.oHtmlEditor.undoAndClearRedo,this.oHtmlEditor)}},e.exports=i},336:function(e,t,s){(function(t){"use strict";function i(e,t,s,i){var o=r.i18n("MAILWEBCLIENT/TEXT_REPLY_MESSAGE",{DATE:e.oDateModel.getDate(),TIME:e.oDateModel.getTime(),SENDER:r.encodeHtml(e.oFrom.getFull())}),n="<br /><br />"+this.getSignatureText(t,s,i)+'<br /><br /><div data-anchor="reply-title">'+o+"</div><blockquote>"+e.getConvertedHtml()+"</blockquote>";return n}function o(e,t,s){var i=new p,o=n.union(e.oTo.aCollection,e.oCc.aCollection,e.oBcc.aCollection),r=n.find(g.collection(),function(e){return e.id()===t},this),a=new d,l=new d;return a.sEmail=r.email(),l.sEmail=s?s.email():"",i.addCollection(o),i.excludeCollection(n.union(e.oFrom.aCollection,[a,l])),i.getFull()}var n=s(2),r=s(185),a=s(181),l=s(186),h=s(182),u=s(195),c=s(188),d=s(324),p=s(323),m=s(325),g=s(314),f=s(315),b=s(316),v=s(313),E=h.isNewTab()&&window.opener&&window.opener.MainTabMailMethods,y={sReplyText:"",sReplyDraftUid:"",oPostponedMailData:null};y.setReplyData=function(e,t){this.sReplyText=e,this.sReplyDraftUid=t},y.send=function(e,t,s,i,o,n){var l=t.AccountID,h=g.getAccount(l),d=b.oFolderListItems[l],p="",m=d?d.sentFolderFullName():"",v=d?d.draftsFolderFullName():"",y=h?h.email():"",A=t.To.indexOf(y)>-1||t.Cc.indexOf(y)>-1||t.Bcc.indexOf(y)>-1;switch(h.bSaveRepliesToCurrFolder&&!A&&a.isNonEmptyArray(t.DraftInfo,3)&&(m=t.DraftInfo[2]),t.Method=e,t.ShowReport=s,e){case"SendMessage":p=r.i18n("COREWEBCLIENT/INFO_SENDING"),t.SentFolder=m,""!==t.DraftUid&&(t.DraftFolder=v,E?(E.removeOneMessageFromCacheForFolder(t.AccountID,t.DraftFolder,t.DraftUid),E.replaceHashWithoutMessageUid(t.DraftUid)):(b.removeOneMessageFromCacheForFolder(t.AccountID,t.DraftFolder,t.DraftUid),u.replaceHashWithoutMessageUid(t.DraftUid)));break;case"SaveMessage":p=r.i18n("MAILWEBCLIENT/INFO_SAVING"),void 0===t.DraftFolder&&(t.DraftFolder=v),b.savingDraftUid(t.DraftUid),E?(E.startMessagesLoadingWhenDraftSaving(t.AccountID,t.DraftFolder),E.replaceHashWithoutMessageUid(t.DraftUid)):(b.startMessagesLoadingWhenDraftSaving(t.AccountID,t.DraftFolder),u.replaceHashWithoutMessageUid(t.DraftUid))}s&&c.showLoading(p),n?this.postponedMailData={Parameters:t,SendMessageResponseHandler:i,SendMessageResponseContext:o}:f.send(e,t,i,o)},y.sendPostponedMail=function(e){var t=this.postponedMailData,s=t.Parameters,i=s.AccountID,o=b.oFolderListItems[i],n=o?o.draftsFolderFullName():"";""!==e&&(s.DraftUid=e,s.DraftFolder=n,E?(E.removeOneMessageFromCacheForFolder(s.AccountID,s.DraftFolder,s.DraftUid),E.replaceHashWithoutMessageUid(s.DraftUid)):(b.removeOneMessageFromCacheForFolder(s.AccountID,s.DraftFolder,s.DraftUid),u.replaceHashWithoutMessageUid(s.DraftUid))),this.postponedMailData&&(f.send(s.Method,s,t.SendMessageResponseHandler,t.SendMessageResponseContext),this.postponedMailData=null)},y.sendReplyMessage=function(e,t,s,i,o,n){var r=null,a=b.currentMessage(),l=[],h=null;a&&(l=a.oTo.aCollection.concat(a.oCc.aCollection),h=this.getFirstFetcherOrIdentityByRecipientsOrDefault(l,a.accountId()),r=this.getReplyDataFromMessage(a,Enums.ReplyType.ReplyAll,a.accountId(),h,!1,t,s),r.AccountID=a.accountId(),h&&(r.FetcherID=h&&h.FETCHER?h.id():"",r.IdentityID=h&&!h.FETCHER?h.id():""),r.Bcc="",r.Importance=Enums.Importance.Normal,r.SendReadingConfirmation=!1,r.IsQuickReply=!0,r.IsHtml=!0,r.Attachments=this.convertAttachmentsForSending(r.Attachments),this.send(e,r,!1,i,o,n))},y.convertAttachmentsForSending=function(e){var t={};return n.each(e,function(e){t[e.tempName()]=[e.fileName(),e.linked()?e.cid():"",e.inline()?"1":"0",e.linked()?"1":"0",e.contentLocation()]}),t},y.onSendOrSaveMessageResponse=function(e,s,i){var o,a,h,u=s.Parameters,d=!!e.Result;switch(i||c.hideLoading(),s.Method){case"SaveMessage":b.savingDraftUid(""),d?(u.ShowReport&&!i&&(-1!==t.inArray(s.Parameters.DraftFolder,b.getCurrentTemplateFolders())?c.showReport(r.i18n("MAILWEBCLIENT/REPORT_TEMPLATE_SAVED")):c.showReport(r.i18n("MAILWEBCLIENT/REPORT_MESSAGE_SAVED"))),e.Result.NewUid||(v.AllowAutosaveInDrafts=!1)):u.ShowReport&&(-1!==t.inArray(s.Parameters.DraftFolder,b.getCurrentTemplateFolders())?l.showErrorByCode(e,r.i18n("MAILWEBCLIENT/ERROR_TEMPLATE_SAVING")):l.showErrorByCode(e,r.i18n("MAILWEBCLIENT/ERROR_MESSAGE_SAVING")));break;case"SendMessage":d?(u.IsQuickReply?c.showReport(r.i18n("MAILWEBCLIENT/REPORT_MESSAGE_SENT")):E?E.showReport(r.i18n("MAILWEBCLIENT/REPORT_MESSAGE_SENT")):c.showReport(r.i18n("MAILWEBCLIENT/REPORT_MESSAGE_SENT")),n.isArray(u.DraftInfo)&&3===u.DraftInfo.length&&(h=u.DraftInfo[0],a=u.DraftInfo[1],o=u.DraftInfo[2],b.markMessageReplied(u.AccountID,o,a,h))):l.showErrorByCode(e,r.i18n("MAILWEBCLIENT/ERROR_MESSAGE_SENDING")),u.SentFolder&&(E?E.removeMessagesFromCacheForFolder(u.AccountID,u.SentFolder):b.removeMessagesFromCacheForFolder(u.AccountID,u.SentFolder))}return u.DraftFolder&&!i&&(E?E.removeMessagesFromCacheForFolder(u.AccountID,u.DraftFolder):b.removeMessagesFromCacheForFolder(u.AccountID,u.DraftFolder)),{Method:s.Method,Result:d,NewUid:e.Result?e.Result.NewUid:""}},y.getReplyDataFromMessage=function(e,t,s,r,a,l,h){var u={DraftInfo:[],DraftUid:"",To:"",Cc:"",Bcc:"",Subject:"",Attachments:[],InReplyTo:e.messageId(),References:this.getReplyReferences(e)},c=[],d=e.oReplyTo.getFull(),p=e.oTo.getFull();switch((""===d||e.oFrom.getFirstEmail()===e.oReplyTo.getFirstEmail()&&""===e.oReplyTo.getFirstName())&&(d=e.oFrom.getFull()),l&&""!==l||(l=this.sReplyText,this.sReplyText=""),"forward"===t?u.Text=l+this.getForwardMessageBody(e,s,r):"resend"===t?(u.Text=e.getConvertedHtml(),u.Cc=e.cc(),u.Bcc=e.bcc()):u.Text=l+i.call(this,e,s,r,a),h?u.DraftUid=h:(u.DraftUid=this.sReplyDraftUid,this.sReplyDraftUid=""),t){case Enums.ReplyType.Reply:u.DraftInfo=[Enums.ReplyType.Reply,e.uid(),e.folder()],u.To=d,u.Subject=this.getReplySubject(e.subject(),!0),c=n.filter(e.attachments(),function(e){return e.linked()});break;case Enums.ReplyType.ReplyAll:u.DraftInfo=[Enums.ReplyType.ReplyAll,e.uid(),e.folder()],u.To=d,u.Cc=o(e,s,r),u.Subject=this.getReplySubject(e.subject(),!0),c=n.filter(e.attachments(),function(e){return e.linked()});break;case Enums.ReplyType.Resend:u.DraftInfo=[Enums.ReplyType.Resend,e.uid(),e.folder(),e.cc(),e.bcc()],u.To=p,u.Subject=e.subject(),c=e.attachments();break;case Enums.ReplyType.ForwardAsAttach:case Enums.ReplyType.Forward:u.DraftInfo=[Enums.ReplyType.Forward,e.uid(),e.folder()],u.Subject=this.getReplySubject(e.subject(),!1),c=e.attachments()}return n.each(c,function(e){if(e.getCopy){var t=e.getCopy();u.Attachments.push(t)}}),u},y.getReplyReferences=function(e){var t=e.references(),s=e.messageId(),i=t.indexOf(s);return i===-1&&(t+=" "+s),t},y.getClearSignature=function(e,t){var s=g.getAccount(e),i="";return t&&t.accountId()===e&&t.useSignature()?i=t.signature():s&&s.useSignature()&&(i=s.signature()),i},y.getSignatureText=function(e,t,s){var i=this.getClearSignature(e,t);return s?'<div data-anchor="signature">'+i+"</div>":"<div>"+i+"</div>"},y.getFirstFetcherOrIdentityByRecipientsOrDefault=function(e,t){var s=g.getAccount(t),i=this.getAccountFetchersIdentitiesList(s),o=[],r=null;return n.each(e,function(e){if(!r)switch(o=n.filter(i,function(t){return e.sEmail===t.email}),o.length){case 0:break;case 1:r=o[0];break;default:r=n.find(o,function(t){return e.sEmail===t.email&&e.sName===t.name}),r||(r=n.find(o,function(e){return e.isDefault}),r||(r=o[0]))}}),r||(r=n.find(i,function(e){return e.isDefault})),r&&r.result},y.getAccountFetchersIdentitiesList=function(e){var t=[];return e&&(n.each(e.fetchers(),function(e){t.push({email:e.email(),name:e.userName(),isDefault:!1,result:e})}),n.each(e.identities(),function(e){t.push({email:e.email(),name:e.friendlyName(),isDefault:e.isDefault(),result:e})})),t},y.getForwardMessageBody=function(e,t,s){var i=r.encodeHtml(e.oCc.getFull()),o=""!==i?r.i18n("MAILWEBCLIENT/TEXT_FORWARD_MESSAGE_CCPART",{CCADDR:i}):"",n=r.i18n("MAILWEBCLIENT/TEXT_FORWARD_MESSAGE",{FROMADDR:r.encodeHtml(e.oFrom.getFull()),TOADDR:r.encodeHtml(e.oTo.getFull()),CCPART:o,FULLDATE:e.oDateModel.getFullDate(),SUBJECT:r.encodeHtml(e.subject())}),a="<br /><br />"+this.getSignatureText(t,s,!0)+'<br /><br /><div data-anchor="reply-title">'+n+"</div><br /><br />"+e.getConvertedHtml();return a},y.hasReplyAllCcAddrs=function(e){var t=e.accountId(),s=e.oTo.aCollection.concat(e.oCc.aCollection),i=this.getFirstFetcherOrIdentityByRecipientsOrDefault(s,e.accountId()),n=o(e,t,i);return""!==n},y.getReplySubject=function(e,t){var s=r.i18n("MAILWEBCLIENT/TEXT_REPLY_PREFIX"),i=r.i18n("MAILWEBCLIENT/TEXT_FORWARD_PREFIX"),o=t?s:i,n=o+": "+e;return v.JoinReplyPrefixes&&(n=m.joinReplyPrefixesInSubject(n,s,i)),n},y.getHtmlFromText=function(e){return e.replace(/&/g,"&amp;").replace(/>/g,"&gt;").replace(/</g,"&lt;").replace(/\r/g,"").replace(/\n/g,"<br />")},e.exports=y}).call(t,s(1))},337:function(e,t,s){"use strict";var i=s(182),o=s(188),n=s(195),r=s(338),a=s(314),l=s(316),h=[],u=[];if(i.isNewTab()){var c={getEditedDraftUid:function(){return l.editedDraftUid()}};window.SlaveTabMailMethods=c,e.exports={}}else{var d={showReport:function(e){o.showReport(e)},getAccountList:function(){return a},getFolderListItems:function(){return l.oFolderListItems},getUidList:function(){return l.uidList()},getComposedMessageAccountId:function(e){var t=h[e];return t?t.accountId:0},getComposedMessage:function(e){var t=h[e];return delete h[e],t},removeOneMessageFromCacheForFolder:function(e,t,s){l.removeOneMessageFromCacheForFolder(e,t,s)},replaceHashWithoutMessageUid:function(e){n.replaceHashWithoutMessageUid(e)},startMessagesLoadingWhenDraftSaving:function(e,t){l.startMessagesLoadingWhenDraftSaving(e,t)},removeMessagesFromCacheForFolder:function(e,t){l.removeMessagesFromCacheForFolder(e,t)},searchMessagesInCurrentFolder:function(e){l.searchMessagesInCurrentFolder(e)},getReplyData:function(e){var t=u[e];return delete u[e],t},deleteMessage:function(e,t){r.deleteMessages([e],t)}};window.MainTabMailMethods=d,e.exports={passReplyData:function(e,t){u[e]=t},passComposedMessage:function(e,t){h[e]=t}}}},338:function(e,t,s){"use strict";var i=s(1),o=s(185),n=s(179),r=s(221),a=s(43),l=s(192),h=s(201),u=s(316),c={};c.deleteMessages=function(e,t){i.isFunction(t)||(t=function(){});var s=u.folderList(),n=s.currentFolderFullName(),r=s.trashFolder(),a=r&&n===r.fullName(),c=s.spamFolder(),d=c&&n===c.fullName(),p=function(s){s&&(u.deleteMessages(e),t())};d?(u.deleteMessages(e),t()):a?l.showPopup(h,[o.i18n("MAILWEBCLIENT/CONFIRM_DELETE_MESSAGES_PLURAL",{},null,e.length),p,"",o.i18n("COREWEBCLIENT/ACTION_DELETE")]):r?(u.moveMessagesToFolder(r.fullName(),e),t()):r||l.showPopup(h,[o.i18n("MAILWEBCLIENT/CONFIRM_MESSAGES_DELETE_NO_TRASH_FOLDER"),p])},c.registerMailto=function(e){!window.navigator||!i.isFunction(window.navigator.registerProtocolHandler)||e&&r.getData("MailtoAsked")===!0||(window.navigator.registerProtocolHandler("mailto",n.getAppPath()+"#mail/compose/to/%s",""!==a.SiteName?a.SiteName:"WebMail"),r.setData("MailtoAsked",!0))},e.exports=c},339:function(e,t,s){"use strict";function i(){this.senderList=n.observableArray([]),this.senderAccountId=n.observable(l.currentId()),this.selectedFetcherOrIdentity=n.observable(null),this.lockSelectedSender=n.observable(!1),this.selectedSender=n.observable(""),this.selectedSender.subscribe(function(){if(!this.lockSelectedSender()){var e=l.getAccount(this.senderAccountId()),t=this.selectedSender(),s=null;r.isNonEmptyString(t)&&(0===t.indexOf("fetcher")?(t=t.replace("fetcher",""),s=o.find(e.fetchers(),function(e){return e.id()===r.pInt(t)})):s=o.find(e.identities(),function(e){return e.id()===r.pInt(t)})),s&&this.selectedFetcherOrIdentity(s)}},this)}var o=s(2),n=s(44),r=s(181),a=s(336),l=s(314);i.prototype.changeSelectedSender=function(e){if(e){var t=r.pString(e.id());e.FETCHER&&(t="fetcher"+t),o.find(this.senderList(),function(e){return e.id===t})&&(this.lockSelectedSender(!0),this.selectedSender(t),this.selectedFetcherOrIdentity(e),this.lockSelectedSender(!1))}},i.prototype.changeSenderAccountId=function(e,t){var s=!1;this.senderAccountId()!==e&&(l.hasAccountWithId(e)?(this.senderAccountId(e),s=!0):l.hasAccountWithId(this.senderAccountId())||(this.senderAccountId(l.currentId()),s=!0)),(s||0===this.senderList().length)&&(this.fillSenderList(t),s=!0),!s&&t&&this.changeSelectedSender(t)},i.prototype.fillSenderList=function(e){var t=[],s=l.getAccount(this.senderAccountId());s&&(o.isArray(s.identities())&&o.each(s.identities(),function(e){t.push({fullEmail:e.fullEmail(),id:r.pString(e.id())})},this),s.identitiesSubscribtion&&s.identitiesSubscribtion.dispose(),s.identitiesSubscribtion=s.identities.subscribe(function(){this.fillSenderList(e),this.changeSelectedSender(s.getDefaultIdentity())},this),o.each(s.fetchers(),function(e){var s=e.fullEmail();e.isEnabled()&&e.isOutgoingEnabled()&&s.length>0&&t.push({fullEmail:s,id:"fetcher"+e.id()})},this),s.fetchersSubscribtion&&s.fetchersSubscribtion.dispose(),s.fetchersSubscribtion=s.fetchers.subscribe(function(){this.fillSenderList(e)},this)),this.senderList(t),this.changeSelectedSender(e)},i.prototype.setFetcherOrIdentityByReplyMessage=function(e){var t=e.oTo.aCollection.concat(e.oCc.aCollection),s=a.getFirstFetcherOrIdentityByRecipientsOrDefault(t,e.accountId());s&&this.changeSelectedSender(s)},e.exports=new i},340:function(e,t,s){"use strict";function i(e,t){this.oParent=t,this.creaId="creaId"+(""+Math.random()).replace(".",""),this.textFocused=r.observable(!1),this.workareaDom=r.observable(),this.uploaderAreaDom=r.observable(),this.editorUploaderBodyDragOver=r.observable(!1),this.htmlEditorDom=r.observable(),this.toolbarDom=r.observable(),this.colorPickerDropdownDom=r.observable(),this.insertLinkDropdownDom=r.observable(),this.insertImageDropdownDom=r.observable(),this.isFWBold=r.observable(!1),this.isFSItalic=r.observable(!1),this.isTDUnderline=r.observable(!1),this.isTDStrikeThrough=r.observable(!1),this.isEnumeration=r.observable(!1),this.isBullets=r.observable(!1),this.isEnable=r.observable(!0),this.isEnable.subscribe(function(){this.oCrea&&this.oCrea.setEditable(this.isEnable())},this),this.bInsertImageAsBase64=e,this.bAllowFileUpload=!(e&&void 0===window.File),this.bAllowInsertImage=E.AllowInsertImage,this.lockFontSubscribing=r.observable(!1),this.bAllowImageDragAndDrop=!c.ie10AndAbove,this.aFonts=["Arial","Arial Black","Courier New","Tahoma","Times New Roman","Verdana"],this.sDefaultFont=E.DefaultFontName,this.correctFontFromSettings(),this.selectedFont=r.observable(""),this.selectedFont.subscribe(function(){!this.oCrea||this.lockFontSubscribing()||this.inactive()||this.oCrea.fontName(this.selectedFont())},this),this.iDefaultSize=E.DefaultFontSize,this.selectedSize=r.observable(0),this.selectedSize.subscribe(function(){!this.oCrea||this.lockFontSubscribing()||this.inactive()||this.oCrea.fontSize(this.selectedSize())},this),this.visibleInsertLinkPopup=r.observable(!1),this.linkForInsert=r.observable(""),this.linkFocused=r.observable(!1),this.visibleLinkPopup=r.observable(!1),this.linkPopupDom=r.observable(null),this.linkHrefDom=r.observable(null),this.linkHref=r.observable(""),this.visibleLinkHref=r.observable(!1),this.visibleImagePopup=r.observable(!1),this.visibleImagePopup.subscribe(function(){this.onImageOut()},this),this.imagePopupTop=r.observable(0),this.imagePopupLeft=r.observable(0),this.imageSelected=r.observable(!1),this.tooltipText=r.observable(""),this.tooltipPopupTop=r.observable(0),this.tooltipPopupLeft=r.observable(0),this.visibleInsertImagePopup=r.observable(!1),this.imageUploaderButton=r.observable(null),this.aUploadedImagesData=[],this.imagePathFromWeb=r.observable(""),this.visibleFontColorPopup=r.observable(!1),this.oFontColorPickerView=new y(l.i18n("MAILWEBCLIENT/LABEL_TEXT_COLOR"),this.setTextColorFromPopup,this),this.oBackColorPickerView=new y(l.i18n("MAILWEBCLIENT/LABEL_BACKGROUND_COLOR"),this.setBackColorFromPopup,this),this.inactive=r.observable(!1),this.sPlaceholderText="",this.bAllowChangeInputDirection=p.IsRTL||E.AllowChangeInputDirection,this.disableEdit=r.observable(!1),this.textChanged=r.observable(!1)}var o=s(2),n=s(1),r=s(44),a=s(205),l=s(185),h=s(181),u=s(182),c=s(180),d=s(278),p=s(43),m=s(192),g=s(193),f=s(326),b=s(341),v=s(316),E=s(313),y=s(342);i.prototype.ViewTemplate="MailWebclient_HtmlEditorView",i.prototype.setInactive=function(e){this.inactive(e),this.inactive()?this.setPlaceholder():this.removePlaceholder()},i.prototype.setPlaceholder=function(){var e=this.removeAllTags(this.getText());""!==e&&"&nbsp;"!==e||(this.setText("<span>"+this.sPlaceholderText+"</span>"),this.oCrea&&this.oCrea.setBlur())},i.prototype.removePlaceholder=function(){var e=this.oCrea?this.removeAllTags(this.oCrea.getText(!1)):"";e===this.sPlaceholderText&&(this.setText(""),this.oCrea&&this.oCrea.setFocus(!0))},i.prototype.hasOpenedPopup=function(){return this.visibleInsertLinkPopup()||this.visibleLinkPopup()||this.visibleImagePopup()||this.visibleInsertImagePopup()||this.visibleFontColorPopup()},i.prototype.setDisableEdit=function(e){this.disableEdit(!!e)},i.prototype.correctFontFromSettings=function(){var e=this.sDefaultFont,t=!1;o.each(this.aFonts,function(s){s.toLowerCase()===e.toLowerCase()&&(e=s,t=!0)}),t?this.sDefaultFont=e:this.aFonts.push(e)},i.prototype.showLinkPopup=function(e){var t=n(this.workareaDom()),s=t.closest(".panel.compose"),i=t.position(),o=e.position(),r=e.height(),a=Math.round(o.left+i.left),l=Math.round(o.top+r+i.top);this.linkHref(e.attr("href")||e.text()),n(this.linkPopupDom()).css({left:a,top:l}),n(this.linkHrefDom()).css({left:a,top:l}),c.firefox||1!==s.length||n(this.linkPopupDom()).css({"max-width":s.width()-a-40+"px","white-space":"pre-line","word-wrap":"break-word"}),this.visibleLinkPopup(!0)},i.prototype.hideLinkPopup=function(){this.visibleLinkPopup(!1)},i.prototype.showChangeLink=function(){this.visibleLinkHref(!0),this.hideLinkPopup()},i.prototype.changeLink=function(){this.oCrea.changeLink(this.linkHref()),this.hideChangeLink()},i.prototype.hideChangeLink=function(){this.visibleLinkHref(!1)},i.prototype.showImagePopup=function(e,t){var s=n(this.workareaDom()),i=s.position(),o=s.offset();this.imagePopupLeft(Math.round(t.pageX+i.left-o.left)),this.imagePopupTop(Math.round(t.pageY+i.top-o.top)),this.visibleImagePopup(!0)},i.prototype.hideImagePopup=function(){this.visibleImagePopup(!1)},i.prototype.resizeImage=function(e){var t={width:"auto",height:"auto"};switch(e){case Enums.HtmlEditorImageSizes.Small:t.width="300px";break;case Enums.HtmlEditorImageSizes.Medium:t.width="600px";break;case Enums.HtmlEditorImageSizes.Large:t.width="1200px";break;case Enums.HtmlEditorImageSizes.Original:t.width="auto"}this.oCrea.changeCurrentImage(t),this.visibleImagePopup(!1)},i.prototype.onImageOver=function(e){if("IMG"===e.target.nodeName&&!this.visibleImagePopup()){this.imageSelected(!0),this.tooltipText(l.i18n("MAILWEBCLIENT/ACTION_CLICK_TO_EDIT_IMAGE"));var t=this,s=n(this.workareaDom());s.bind("mousemove.image",function(e){var i=s.position(),o=s.offset();t.tooltipPopupTop(Math.round(e.pageY+i.top-o.top)),t.tooltipPopupLeft(Math.round(e.pageX+i.left-o.left))})}return!0},i.prototype.onImageOut=function(e){if(this.imageSelected()){this.imageSelected(!1);var t=n(this.workareaDom());t.unbind("mousemove.image")}return!0},i.prototype.commit=function(){this.textChanged(!1)},i.prototype.init=function(e,t,s,i){
  this.sPlaceholderText=i||"",this.oCrea?(this.oCrea.$container=n("#"+this.oCrea.oOptions.creaId),0===this.oCrea.$container.children().length&&this.oCrea.start(this.isEnable())):(n(document.body).on("click",o.bind(function(e){var t=n(e.target).parents("span.dropdown_helper");0===t.length&&this.closeAllPopups(!0)},this)),this.initEditorUploader(),this.oCrea=new b({creaId:this.creaId,fontNameArray:this.aFonts,defaultFontName:this.sDefaultFont,defaultFontSize:this.iDefaultSize,isRtl:p.IsRTL,enableDrop:!1,onChange:o.bind(this.textChanged,this,!0),onCursorMove:o.bind(this.setFontValuesFromText,this),onFocus:o.bind(this.onCreaFocus,this),onBlur:o.bind(this.onCreaBlur,this),onUrlIn:o.bind(this.showLinkPopup,this),onUrlOut:o.bind(this.hideLinkPopup,this),onImageSelect:o.bind(this.showImagePopup,this),onImageBlur:o.bind(this.hideImagePopup,this),onItemOver:c.mobileDevice||u.isMobile()?null:o.bind(this.onImageOver,this),onItemOut:c.mobileDevice||u.isMobile()?null:o.bind(this.onImageOut,this),openInsertLinkDialog:o.bind(this.insertLink,this),onUrlClicked:!0}),this.oCrea.start(this.isEnable())),this.oCrea.setTabIndex(s),this.clearUndoRedo(),this.setText(e,t),this.setFontValuesFromText(),this.aUploadedImagesData=[],this.selectedFont(this.sDefaultFont),this.selectedSize(this.iDefaultSize)},i.prototype.isInitialized=function(){return!!this.oCrea},i.prototype.setFocus=function(){this.oCrea&&this.oCrea.setFocus(!1)},i.prototype.changeSignatureContent=function(e,t){this.oCrea&&this.oCrea.changeSignatureContent(e,t)},i.prototype.setFontValuesFromText=function(){this.lockFontSubscribing(!0),this.isFWBold(this.oCrea.getIsBold()),this.isFSItalic(this.oCrea.getIsItalic()),this.isTDUnderline(this.oCrea.getIsUnderline()),this.isTDStrikeThrough(this.oCrea.getIsStrikeThrough()),this.isEnumeration(this.oCrea.getIsEnumeration()),this.isBullets(this.oCrea.getIsBullets()),this.selectedFont(this.oCrea.getFontName()),this.selectedSize(""+this.oCrea.getFontSizeInNumber()),this.lockFontSubscribing(!1)},i.prototype.isUndoAvailable=function(){return!!this.oCrea&&this.oCrea.isUndoAvailable()},i.prototype.getPlainText=function(){return this.oCrea?this.oCrea.getPlainText():""},i.prototype.getText=function(e){var t=this.oCrea?this.oCrea.getText(e):"";return""!==this.sPlaceholderText&&this.removeAllTags(t)===this.sPlaceholderText?"":t},i.prototype.setText=function(e,t){this.oCrea&&(t?this.oCrea.setPlainText(e):this.oCrea.setText(e),this.inactive()&&""===e&&this.setPlaceholder())},i.prototype.undoAndClearRedo=function(){this.oCrea&&(this.oCrea.undo(),this.oCrea.clearRedo())},i.prototype.clearUndoRedo=function(){this.oCrea&&this.oCrea.clearUndoRedo()},i.prototype.isEditing=function(){return!!this.oCrea&&this.oCrea.bEditing},i.prototype.removeAllTags=function(e){return e.replace(/<style>.*<\/style>/g,"").replace(/<[^>]*>/g,"")},i.prototype.onCreaFocus=function(){this.oCrea&&(this.closeAllPopups(),this.textFocused(!0))},i.prototype.onCreaBlur=function(){this.oCrea&&this.textFocused(!1)},i.prototype.onEscHandler=function(){m.hasOpenedMaximizedPopups()||this.closeAllPopups()},i.prototype.closeAllPopups=function(e){e=!!e,e||this.visibleLinkPopup(!1),this.visibleInsertLinkPopup(!1),this.visibleImagePopup(!1),this.visibleInsertImagePopup(!1),this.visibleFontColorPopup(!1)},i.prototype.insertHtml=function(e){this.oCrea&&(this.oCrea.isFocused()||this.oCrea.setFocus(!0),this.oCrea.insertHtml(e,!1))},i.prototype.insertLink=function(e,t){this.inactive()||this.visibleInsertLinkPopup()||(t.stopPropagation(),this.linkForInsert(this.oCrea.getSelectedText()),this.closeAllPopups(),this.visibleInsertLinkPopup(!0),this.linkFocused(!0))},i.prototype.insertLinkFromPopup=function(e,t){this.linkForInsert().length>0&&(a.isCorrectEmail(this.linkForInsert())?this.oCrea.insertEmailLink(this.linkForInsert()):this.oCrea.insertLink(this.linkForInsert())),this.closeInsertLinkPopup(e,t)},i.prototype.closeInsertLinkPopup=function(e,t){this.visibleInsertLinkPopup(!1),t&&t.stopPropagation()},i.prototype.textColor=function(e,t){this.inactive()||(this.closeAllPopups(),this.visibleFontColorPopup()||(t.stopPropagation(),this.visibleFontColorPopup(!0),this.oFontColorPickerView.onShow(),this.oBackColorPickerView.onShow()))},i.prototype.colorToHex=function(e){if("#"===e.substr(0,1))return e;for(var t=/(.*?)rgb\((\d+), (\d+), (\d+)\)/.exec(e),s=h.pInt(t[2]),i=h.pInt(t[3]),o=h.pInt(t[4]),n=o|i<<8|s<<16,r=n.toString(16);r.length<6;)r="0"+r;return t[1]+"#"+r},i.prototype.setTextColorFromPopup=function(e){this.oCrea.textColor(this.colorToHex(e)),this.closeAllPopups()},i.prototype.setBackColorFromPopup=function(e){this.oCrea.backgroundColor(this.colorToHex(e)),this.closeAllPopups()},i.prototype.insertImage=function(e,t){return this.inactive()||!E.AllowInsertImage||this.visibleInsertImagePopup()||(t.stopPropagation(),this.imagePathFromWeb(""),this.closeAllPopups(),this.visibleInsertImagePopup(!0),this.initUploader()),!0},i.prototype.insertWebImageFromPopup=function(e,t){E.AllowInsertImage&&this.imagePathFromWeb().length>0&&this.oCrea.insertImage(this.imagePathFromWeb()),this.closeInsertImagePopup(e,t)},i.prototype.insertComputerImageFromPopup=function(e,t){var s=new f,i="",o=!1;s.parse(t),i=s.getActionUrl("view"),E.AllowInsertImage&&i.length>0&&(o=this.oCrea.insertImage(i),o&&(n(this.oCrea.$editableArea).find('img[src="'+i+'"]').attr("data-x-src-cid",e),t.CID=e,this.aUploadedImagesData.push(t))),this.closeInsertImagePopup()},i.prototype.getUploadedImagesData=function(){return this.aUploadedImagesData},i.prototype.closeInsertImagePopup=function(e,t){this.visibleInsertImagePopup(!1),t&&t.stopPropagation()},i.prototype.initUploader=function(){this.imageUploaderButton()&&!this.oJua&&(this.oJua=new d({action:"?/Api/",name:"jua-uploader",queueSize:2,clickElement:this.imageUploaderButton(),hiddenElementsPosition:p.IsRTL?"right":"left",disableMultiple:!0,disableAjaxUpload:!1,disableDragAndDrop:!0,hidden:o.extendOwn({Module:E.ServerModuleName,Method:"UploadAttachment",Parameters:function(){return JSON.stringify({AccountID:v.currentAccountId()})}},u.getCommonRequestParameters())}),this.bInsertImageAsBase64?this.oJua.on("onSelect",o.bind(this.onEditorDrop,this)):this.oJua.on("onSelect",o.bind(this.onFileUploadSelect,this)).on("onComplete",o.bind(this.onFileUploadComplete,this)))},i.prototype.initEditorUploader=function(){if(E.AllowInsertImage&&this.uploaderAreaDom()&&!this.editorUploader){var e=null,t=null;this.oParent&&this.oParent.composeUploaderDragOver&&this.oParent.onFileUploadProgress&&this.oParent.onFileUploadStart&&this.oParent.onFileUploadComplete?(e=o.bind(function(){this.editorUploaderBodyDragOver(!0),this.oParent.composeUploaderDragOver(!0)},this),t=o.bind(function(){this.editorUploaderBodyDragOver(!1),this.oParent.composeUploaderDragOver(!1)},this),this.editorUploader=new d({action:"?/Api/",name:"jua-uploader",queueSize:1,dragAndDropElement:this.bAllowImageDragAndDrop?this.uploaderAreaDom():null,disableMultiple:!0,disableAjaxUpload:!1,disableDragAndDrop:!this.bAllowImageDragAndDrop,hidden:o.extendOwn({Module:E.ServerModuleName,Method:"UploadAttachment",Parameters:function(){return JSON.stringify({AccountID:v.currentAccountId()})}},u.getCommonRequestParameters())}),this.editorUploader.on("onDragEnter",o.bind(this.oParent.composeUploaderDragOver,this.oParent,!0)).on("onDragLeave",o.bind(this.oParent.composeUploaderDragOver,this.oParent,!1)).on("onBodyDragEnter",e).on("onBodyDragLeave",t).on("onProgress",o.bind(this.oParent.onFileUploadProgress,this.oParent)).on("onSelect",o.bind(this.onEditorDrop,this)).on("onStart",o.bind(this.oParent.onFileUploadStart,this.oParent)).on("onComplete",o.bind(this.oParent.onFileUploadComplete,this.oParent))):(e=o.bind(this.editorUploaderBodyDragOver,this,!0),t=o.bind(this.editorUploaderBodyDragOver,this,!1),this.editorUploader=new d({queueSize:1,dragAndDropElement:this.bAllowImageDragAndDrop?this.uploaderAreaDom():null,disableMultiple:!0,disableAjaxUpload:!1,disableDragAndDrop:!this.bAllowImageDragAndDrop}),this.editorUploader.on("onBodyDragEnter",e).on("onBodyDragLeave",t).on("onSelect",o.bind(this.onEditorDrop,this)))}},i.prototype.isDragAndDropSupported=function(){return!!this.editorUploader&&this.editorUploader.isDragAndDropSupported()},i.prototype.onEditorDrop=function(e,t){var s=null,i=null,o=this,n=!1,r=""+Math.random(),a="";if(t&&t.File&&"string"==typeof t.File.type)if(E.AllowInsertImage&&0===t.File.type.indexOf("image/"))i=t.File,E.ImageUploadSizeLimit>0&&i.size>E.ImageUploadSizeLimit?m.showPopup(g,[l.i18n("COREWEBCLIENT/ERROR_UPLOAD_SIZE")]):(s=new window.FileReader,n=this.oCrea.isFocused(),n||this.oCrea.setFocus(!0),a=i.name+"_"+r,this.oCrea.insertHtml('<img id="'+a+'" src="./static/styles/images/wait.gif" />',!0),n||this.oCrea.fixFirefoxCursorBug(),s.onload=function(e){o.oCrea.changeImageSource(a,e.target.result)},s.readAsDataURL(i));else{if(this.oParent&&this.oParent.onFileUploadSelect)return this.oParent.onFileUploadSelect(e,t),!0;c.ie10AndAbove||m.showPopup(g,[l.i18n("MAILWEBCLIENT/ERROR_NOT_IMAGE_CHOOSEN")])}return!1},i.prototype.isFileImage=function(e){if("string"==typeof e.Type)return-1!==e.Type.indexOf("image");var t=e.FileName.lastIndexOf("."),s=e.FileName.substr(t+1),i=["jpg","jpeg","gif","tif","tiff","png"];return-1!==n.inArray(s,i)},i.prototype.onFileUploadSelect=function(e,t){return this.isFileImage(t)?(this.closeInsertImagePopup(),!0):(m.showPopup(g,[l.i18n("MAILWEBCLIENT/ERROR_NOT_IMAGE_CHOOSEN")]),!1)},i.prototype.onFileUploadComplete=function(e,t,s){var i="";s&&s.Result?s.Result.Error?(i="size"===s.Result.Error?l.i18n("COREWEBCLIENT/ERROR_UPLOAD_SIZE"):l.i18n("COREWEBCLIENT/ERROR_UPLOAD_UNKNOWN"),m.showPopup(g,[i])):(this.oCrea.setFocus(!0),this.insertComputerImageFromPopup(e,s.Result.Attachment)):m.showPopup(g,[l.i18n("COREWEBCLIENT/ERROR_UPLOAD_UNKNOWN")])},i.prototype.undo=function(){return this.inactive()||this.oCrea.undo(),!1},i.prototype.redo=function(){return this.inactive()||this.oCrea.redo(),!1},i.prototype.bold=function(){return this.inactive()||(this.oCrea.bold(),this.isFWBold(!this.isFWBold())),!1},i.prototype.italic=function(){return this.inactive()||(this.oCrea.italic(),this.isFSItalic(!this.isFSItalic())),!1},i.prototype.underline=function(){return this.inactive()||(this.oCrea.underline(),this.isTDUnderline(!this.isTDUnderline())),!1},i.prototype.strikeThrough=function(){return this.inactive()||(this.oCrea.strikeThrough(),this.isTDStrikeThrough(!this.isTDStrikeThrough())),!1},i.prototype.numbering=function(){return this.inactive()||(this.oCrea.numbering(),this.isBullets(!1),this.isEnumeration(!this.isEnumeration())),!1},i.prototype.bullets=function(){return this.inactive()||(this.oCrea.bullets(),this.isEnumeration(!1),this.isBullets(!this.isBullets())),!1},i.prototype.removeFormat=function(){return this.inactive()||this.oCrea.removeFormat(),!1},i.prototype.setRtlDirection=function(){return this.inactive()||this.oCrea.setRtlDirection(),!1},i.prototype.setLtrDirection=function(){return this.inactive()||this.oCrea.setLtrDirection(),!1},e.exports=i},341:function(e,t,s){"use strict";function i(e){this.oOptions=o.extend({creaId:"creaId",fontNameArray:["Tahoma"],defaultFontName:"Tahoma",defaultFontSize:3,dropableArea:null,isRtl:!1,onChange:function(){},onCursorMove:function(){},onFocus:function(){},onBlur:function(){},onUrlIn:function(){},onUrlOut:function(){},onImageSelect:function(){},onImageBlur:function(){},onItemOver:null,onItemOut:null,openInsertLinkDialog:function(){},onUrlClicked:!1},void 0===e?{}:e)}var o=s(2),n=s(1),r=s(181),a=s(180);i.prototype.oOptions={},i.prototype.$container=null,i.prototype.$editableArea=null,i.prototype.aEditableAreaHtml=[],i.prototype.iUndoRedoPosition=0,i.prototype.bEditable=!1,i.prototype.bFocused=!1,i.prototype.bEditing=!1,i.prototype.aSizes=[{inNumber:1,inPixels:10},{inNumber:2,inPixels:13},{inNumber:3,inPixels:16},{inNumber:4,inPixels:18},{inNumber:5,inPixels:24},{inNumber:6,inPixels:32},{inNumber:7,inPixels:48}],i.prototype.bInUrl=!1,i.prototype.oCurrLink=null,i.prototype.oCurrImage=null,i.prototype.bInImage=!1,i.prototype.sBasicFontName="",i.prototype.sBasicFontSize="",i.prototype.sBasicDirection="",i.prototype.start=function(e){function t(e){var t=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/;return t.test(e)}function s(e){return!!e.match(/^[A-Z0-9\"!#\$%\^\{\}`~&'\+\-=_\.]+@[A-Z0-9\.\-]+$/i)}this.$container=n("#"+this.oOptions.creaId),this.$editableArea=n("<div></div>").addClass("crea-content-editable").prop("contentEditable","true").appendTo(this.$container);var i=this;this.$editableArea.on("focus",function(){i.bFocused=!0}),this.$editableArea.on("blur",function(){i.bFocused=!1}),this.$editableArea.on("click","img",function(e){var t=n(this);i.bInImage=!0,i.oCurrImage=t,i.oOptions.onImageSelect(t,e),e.stopPropagation()}),this.$editableArea.on("click",function(e){i.bInImage=!1,i.oCurrImage=null,i.oOptions.onImageBlur()}),null!==i.oOptions.onItemOver&&this.$editableArea.on("mouseover",function(e){i.oOptions.onItemOver(e)}),null!==i.oOptions.onItemOver&&this.$editableArea.on("mouseout",function(e){i.oOptions.onItemOut(e)}),this.$editableArea.on("cut paste",function(){i.bEditing=!0,i.editableSave(),o.defer(function(){i.editableSave()})}),this.$editableArea.on("paste",function(e){if(e=e.originalEvent||e,e.clipboardData){var o,n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("text/html");i.pasteImage(e)?e.preventDefault():t(n)?(e.preventDefault(),i.execCom("insertHTML",'<a href="'+n+'">'+n+"</a>")):s(n)?(e.preventDefault(),i.execCom("insertHTML",'<a href="mailto:'+n+'">'+n+"</a>")):""!==r&&(e.preventDefault(),o=r.split(/<!--StartFragment-->|<!--EndFragment-->/gi),3===o.length&&(r=o[1]),r=i.replacePToBr(r),i.execCom("insertHTML",r))}}),this.$editableArea.on("keydown",function(e){var o=e.keyCode||e.which||e.charCode||0,n=e.ctrlKey||e.metaKey,r=e.altKey,a=e.shiftKey,l="";if(i.bEditing=!0,a&&n&&o===Enums.Key.z||n&&o===Enums.Key.y)e.preventDefault(),i.editableRedo();else if(n&&!r&&o===Enums.Key.z)e.preventDefault(),i.editableUndo();else if(!n||o!==Enums.Key.k&&o!==Enums.Key.b&&o!==Enums.Key.i&&o!==Enums.Key.u)r||a||n||o!==Enums.Key.Del&&o!==Enums.Key.Backspace||i.editableSave();else switch(e.preventDefault(),o){case Enums.Key.k:l=i.getSelectedText(),t(l)?i.insertLink(l):s(l)?i.insertLink("mailto:"+l):i.oOptions.openInsertLinkDialog();break;case Enums.Key.b:i.bold();break;case Enums.Key.i:i.italic();break;case Enums.Key.u:i.underline()}}),this.$editableArea.on("keyup",function(e){var t=e.keyCode||e.which||e.charCode||0,s=e.ctrlKey||e.metaKey,o=e.altKey,n=e.shiftKey;o||n||s||(t===Enums.Key.Space||t===Enums.Key.Enter||t===Enums.Key.Del||t===Enums.Key.Backspace?i.editableSave():i.oOptions.onChange())}),this.initContentEditable(),this.setEditable(e)},i.prototype.clearUndoRedo=function(){this.aEditableAreaHtml=[],this.iUndoRedoPosition=0,this.bEditing=!1},i.prototype.isUndoAvailable=function(){return this.iUndoRedoPosition>0},i.prototype.clearRedo=function(){this.aEditableAreaHtml=this.aEditableAreaHtml.slice(0,this.iUndoRedoPosition+1)},i.prototype.editableSave=function(){var e=this.$editableArea.html(),t=o.last(this.aEditableAreaHtml),s=t?t[0]:"";e!==s&&(this.clearRedo(),this.aEditableAreaHtml.push([e,this.getCaretPos(this.$editableArea[0])]),this.iUndoRedoPosition=this.aEditableAreaHtml.length-1,this.oOptions.onChange())},i.prototype.editableUndo=function(){var e=this.$editableArea.html(),t=this.aEditableAreaHtml[this.iUndoRedoPosition],s=t?t[0]:"";e!==s&&this.editableSave(),this.iUndoRedoPosition>0&&(this.iUndoRedoPosition--,this.$editableArea.html(this.aEditableAreaHtml[this.iUndoRedoPosition]),this.setCaretPos(this.$editableArea[0],this.aEditableAreaHtml[this.iUndoRedoPosition][1]))},i.prototype.editableRedo=function(){this.iUndoRedoPosition<this.aEditableAreaHtml.length-1&&(this.iUndoRedoPosition++,this.$editableArea.html(this.aEditableAreaHtml[this.iUndoRedoPosition]),this.setCaretPos(this.$editableArea[0],this.aEditableAreaHtml[this.iUndoRedoPosition]?this.aEditableAreaHtml[this.iUndoRedoPosition][1]:{}))},i.prototype.getCaretPos=function(e){var t=null,s={},i={},o=0,n={};return window.getSelection&&document.createRange?(t=window.getSelection(),t.rangeCount>0&&(s=t.getRangeAt(0),i=s.cloneRange(),i.selectNodeContents(e),i.setEnd(s.startContainer,s.startOffset),o=(""+i).length,n={start:o,end:o+(""+s).length})):document.selection&&document.body.createTextRange&&(s=document.selection.createRange(),i=document.body.createTextRange(),i.moveToElementText(e),"function"==typeof i.setEndPoint&&i.setEndPoint("EndToStart",s),o=i.text.length,n={start:o,end:o+s.text.length}),n},i.prototype.setCaretPos=function(e,t){if(window.getSelection&&document.createRange){var s=[e],i={},o={},n=!1,r=!1,a=0,l=0,h=0,u=document.createRange();for(u.setStart(e,0),u.collapse(!0),i=s.pop();!r&&i;){if(3===i.nodeType)l=a+i.length,!n&&t.start>=a&&t.start<=l&&(u.setStart(i,t.start-a),n=!0),n&&t.end>=a&&t.end<=l&&(u.setEnd(i,t.end-a),r=!0),a=l;else for(h=i.childNodes.length;h--;)s.push(i.childNodes[h]);i=s.pop()}o=window.getSelection(),o.removeAllRanges(),o.addRange(u)}else if(document.selection&&document.body.createTextRange){var c=document.body.createTextRange();c.moveToElementText(e),c.collapse(!0),c.moveEnd("character",t.end),c.moveStart("character",t.start),c.select()}},i.prototype.setTabIndex=function(e){e&&this.$editableArea.attr("tabindex",e)},i.prototype.initContentEditable=function(){this.$editableArea.bind({mousemove:o.bind(this.storeSelectionPosition,this),mouseup:o.bind(this.onCursorMove,this),keydown:o.bind(this.onButtonPressed,this),keyup:o.bind(this.onCursorMove,this),click:o.bind(this.onClickWith,this),focus:this.oOptions.onFocus,blur:this.oOptions.onBlur}),window.File&&window.FileReader&&window.FileList&&this.oOptions.enableDrop&&this.$editableArea.bind({dragover:o.bind(this.onDragOver,this),dragleave:o.bind(this.onDragLeave,this),drop:o.bind(this.onFileSelect,this)});var e=this,t=o.debounce(function(){e.oCurrLink=null,e.bInUrl=!1,e.oOptions.onUrlOut()},300);n("html, body").on("scroll",t)},i.prototype.onCursorMove=function(e){var t=-1;window.event?t=window.event.keyCode:e&&(t=e.which),13===t&&this.breakQuotes(e),17===t&&this.$editableArea.find("a").css("cursor","inherit"),8===t&&this.uniteWithNextQuote(e),46===t&&a.chrome&&this.uniteWithPrevQuote(e),this.storeSelectionPosition(),this.oOptions.onCursorMove()},i.prototype.onClickWith=function(e){e.ctrlKey&&"A"===e.target.nodeName&&window.open(e.target.href,"_blank"),this.checkAnchorNode()},i.prototype.onButtonPressed=function(e){var t=-1;window.event?t=window.event.keyCode:e&&(t=e.which),17===t&&this.$editableArea.find("a").css("cursor","pointer")},i.prototype.onFileSelect=function(e){if(e=(e&&e.originalEvent?e.originalEvent:e)||window.event){e.stopPropagation(),e.preventDefault();var t=null,s=null,i=e.files||(e.dataTransfer?e.dataTransfer.files:null),o=this;i&&1===i.length&&this.checkIsImage(i[0])&&(s=i[0],t=new window.FileReader,t.onload=function(){return function(e){o.insertImage(e.target.result)}}(),t.readAsDataURL(s))}},i.prototype.onDragLeave=function(){this.$editableArea.removeClass("editorDragOver")},i.prototype.onDragOver=function(e){e.stopPropagation(),e.preventDefault(),this.$editableArea.addClass("editorDragOver")},i.prototype.pasteImage=function(e){var t=e.clipboardData&&e.clipboardData.items,s=this,i=!1;return window.File&&window.FileReader&&window.FileList&&t&&o.each(t,function(e){if(s.checkIsImage(e)&&e.getAsFile){var t=null,o=e.getAsFile();o&&(t=new window.FileReader,t.onload=function(){return function(e){s.insertImage(e.target.result)}}(),t.readAsDataURL(o),i=!0)}}),i},i.prototype.checkIsImage=function(e){return e&&e.type&&0===e.type.indexOf("image/")},i.prototype.setPlainText=function(e){"string"!=typeof e&&(e=""),this.$editableArea&&(this.editableSave(),this.$editableArea.empty().text(e).css("white-space","pre"),this.editableSave())},i.prototype.setText=function(e){if("string"!=typeof e&&(e=""),this.$editableArea){0===e.length&&(e="<br />");var t=n(e),s=n(e),i=s.children(),o=i.first(),r=1===s.length&&"font-wrapper"===s.data("crea"),a=1===s.length&&1===i.length&&"body"===s.data("xDivType")&&"font-wrapper"===o.data("crea");r?(this.setBasicStyles(s.css("font-family"),s.css("font-size"),s.css("direction")),t=s.contents()):a?(this.setBasicStyles(o.css("font-family"),o.css("font-size"),o.css("direction")),t=o.contents()):this.setBasicStyles(this.oOptions.defaultFontName,this.convertFontSizeToPixels(this.oOptions.defaultFontSize),this.oOptions.isRtl?"rtl":"ltr"),this.$editableArea.empty().append(t).css("white-space","normal"),this.clearUndoRedo(),this.editableSave()}},i.prototype.setBasicStyles=function(e,t,s){this.sBasicFontName=e,this.sBasicFontSize=t,this.sBasicDirection=s,this.$editableArea.css({"font-family":this.getFontNameWithFamily(this.sBasicFontName),"font-size":this.sBasicFontSize,direction:this.sBasicDirection})},i.prototype.replacePToBr=function(e){return e.replace(/<\/p>/gi,"<br />").replace(/<p [^>]*>/gi,"").replace(/<p>/gi,"")},i.prototype.getPlainText=function(){var e="";return this.$editableArea&&(e=this.$editableArea.html().replace(/([^>]{1})<div>/gi,"$1\n").replace(/<style[^>]*>[^<]*<\/style>/gi,"\n").replace(/<br *\/{0,1}>/gi,"\n").replace(/<\/p>/gi,"\n").replace(/<\/div>/gi,"\n").replace(/<a [^>]*href="([^"]*?)"[^>]*>(.*?)<\/a>/gi,"$2 ($1)").replace(/<[^>]*>/g,"").replace(/&nbsp;/g," ").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"')),e},i.prototype.getText=function(e){var t=null,s="";return this.$editableArea&&this.$editableArea.length>0&&(e&&(t=this.$editableArea.find('div[data-anchor="signature"]'),t.removeAttr("data-anchor")),s=this.$editableArea.html(),s=this.replacePToBr(s),s='<div data-crea="font-wrapper" style="font-family: '+this.sBasicFontName+"; font-size: "+this.sBasicFontSize+"; direction: "+this.sBasicDirection+'">'+s+"</div>"),s},i.prototype.changeSignatureContent=function(e,t){var s,i,o,r,a,l,h,u=this.$editableArea.find('div[data-anchor="signature"]'),c=n(e).closest('div[data-crea="font-wrapper"]'),d=n(t).closest('div[data-crea="font-wrapper"]');if(u.length>0)o=u.html(),""===t?u.html(o+e):o.indexOf(t)!==-1?u.html(o.replace(t,e)):o.indexOf(e)!==-1||(s=0===c.length||0===d.length?t:d.html(),i=0===c.length||0===d.length?e:c.html(),o.indexOf(s)!==-1?u.html(o.replace(s,e)):o.indexOf(i)!==-1||u.html(o+e));else{l=t;try{r=this.$editableArea.find('*:contains("'+l+'")')}catch(e){r=n("")}if(0===r.length&&d.length>0){l=d.html();try{r=this.$editableArea.find('*:contains("'+l+'")')}catch(e){r=n("")}}r.length>0&&(r=n(r[0]),a=r.closest("blockquote")),a&&0===a.length?r.html(r.html().replace(l,e)):(u=this.$editableArea.find('div[data-anchor="reply-title"]'),h=u.length>0?n(u[0]).closest("blockquote"):u,(0===u.length||h.length>0)&&(u=this.$editableArea.find("blockquote")),u.length>0?n(u[0]).before(n('<br /><div data-anchor="signature">'+e+"</div><br />")):this.$editableArea.append(n('<br /><div data-anchor="signature">'+e+"</div><br />")))}this.editableSave()},i.prototype.isFocused=function(){return this.bFocused},i.prototype.setFocus=function(e){var t=this.$editableArea.contents(),s=3,i=null,r="";this.$editableArea.focus(),e&&o.isArray(this.aRanges)&&this.aRanges.length>0?this.restoreSelectionPosition():t.length>0&&(t[0].nodeType===s?i=n(t[0]):(i=n(document.createTextNode("")),n(t[0]).before(i)),r=i.text(),this.setCursorPosition(i[0],r.length))},i.prototype.setBlur=function(){this.$editableArea.blur()},i.prototype.setEditable=function(e){e?this.enableContentEditable():this.disableContentEditable()},i.prototype.disableContentEditable=function(){this.bEditable=!1,this.$editableArea.prop("contentEditable","false")},i.prototype.enableContentEditable=function(){this.$editableArea.prop("contentEditable","true"),setTimeout(o.bind(function(){this.bEditable=!0},this),0)},i.prototype.fixFirefoxCursorBug=function(){a.firefox&&(this.disableContentEditable(),setTimeout(o.bind(function(){this.enableContentEditable()},this),0))},i.prototype.setRtlDirection=function(){this.setBasicStyles(this.sBasicFontName,this.sBasicFontSize,"rtl")},i.prototype.setLtrDirection=function(){this.setBasicStyles(this.sBasicFontName,this.sBasicFontSize,"ltr")},i.prototype.pasteHtmlAtCaret=function(e){var t,s;if(window.getSelection){if(t=window.getSelection(),t.getRangeAt&&t.rangeCount){s=t.getRangeAt(0),s.deleteContents();var i=document.createElement("div");i.innerHTML=e;for(var o,n,r=document.createDocumentFragment();o=i.firstChild;)n=r.appendChild(o);s.insertNode(r),n&&(s=s.cloneRange(),s.setStartAfter(n),s.collapse(!0),t.removeAllRanges(),t.addRange(s))}}else document.selection&&"Control"!==document.selection.type&&(s=document.selection.createRange(),s&&s.pasteHTML&&s.pasteHTML(e))},i.prototype.execCom=function(e,t,s){var i,o=!1;return this.bEditable&&(this.editableSave(),a.opera&&this.restoreSelectionPosition(),"insertHTML"===e&&a.ie?this.pasteHtmlAtCaret(t):o=void 0===t?window.document.execCommand(e):window.document.execCommand(e,!1,t),a.chrome&&(this.storeSelectionPosition(),"insertHTML"===e&&this.aRanges.length>0&&(i=this.aRanges[0],i.setEnd(i.startContainer,i.startOffset),this.restoreSelectionPosition())),s||this.editableSave()),o},i.prototype.insertHtml=function(e,t){this.execCom("insertHTML",e,t)},i.prototype.changeImageSource=function(e,t){this.$editableArea.find('img[id="'+e+'"]').attr("src",t),this.editableSave()},i.prototype.insertEmailLink=function(e){this.restoreSelectionPosition(),""===this.getSelectedText()?this.execCom("insertHTML",'<a href="mailto:'+e+'">'+e+"</a>"):this.insertLink("mailto:"+e)},i.prototype.insertLink=function(e){if(e=this.normaliseURL(e),this.restoreSelectionPosition(e),""===this.getSelectedText()&&a.ie)this.execCom("insertHTML",'<a href="'+e+'">'+e+"</a>");else{var t=a.ie8AndBelow?"CreateLink":"createlink";this.execCom(t,e)}this.changeFocusLink(e)},i.prototype.removeLink=function(){var e=a.ie8AndBelow?"Unlink":"unlink";this.execCom(e)},i.prototype.insertImage=function(e){var t=a.ie8AndBelow?"InsertImage":"insertimage";return this.isFocused()?this.restoreSelectionPosition():this.setFocus(!0),this.execCom(t,e)},i.prototype.numbering=function(){this.execCom("InsertOrderedList")},i.prototype.bullets=function(){this.execCom("InsertUnorderedList")},i.prototype.horizontalLine=function(){this.execCom("InsertHorizontalRule")},i.prototype.getFontNameWithFamily=function(e){var t="";switch(e){case"Arial":case"Arial Black":case"Tahoma":case"Verdana":t=", sans-serif";break;case"Courier New":t=", monospace";break;case"Times New Roman":t=", serif"}return e+t},i.prototype.fontName=function(e){var t=!this.aRanges;this.setFocus(!0),this.execCom("FontName",this.getFontNameWithFamily(e)),t&&this.setBasicStyles(e,this.sBasicFontSize,this.sBasicDirection)},i.prototype.fontSize=function(e){var t=!this.aRanges;this.setFocus(!0),this.execCom("FontSize",e),t&&this.setBasicStyles(this.sBasicFontName,this.convertFontSizeToPixels(e),this.sBasicDirection)},i.prototype.bold=function(){this.execCom("Bold"),this.$editableArea.focus()},i.prototype.italic=function(){this.execCom("Italic"),this.$editableArea.focus()},i.prototype.underline=function(){this.execCom("Underline"),this.$editableArea.focus()},i.prototype.strikeThrough=function(){this.execCom("StrikeThrough"),this.$editableArea.focus()},i.prototype.undo=function(){this.editableUndo()},i.prototype.redo=function(){this.editableRedo()},i.prototype.alignLeft=function(){this.execCom("JustifyLeft")},i.prototype.center=function(){this.execCom("JustifyCenter")},i.prototype.alignRight=function(){this.execCom("JustifyRight")},i.prototype.justify=function(){this.execCom("JustifyFull")},i.prototype.textColor=function(e){this.execCom("ForeColor",e),this.$editableArea.focus()},i.prototype.backgroundColor=function(e){var t=a.ie?"BackColor":"hilitecolor";this.execCom(t,e),this.$editableArea.focus()},i.prototype.removeFormat=function(){this.execCom("removeformat"),this.$editableArea.focus()},i.prototype.getFontName=function(){if(this.bEditable){var e=window.document.queryCommandValue("FontName"),t=this.sBasicFontName,s="";"string"==typeof e&&(e=e.replace(/'/g,""),n.each(this.oOptions.fontNameArray,function(t,i){(e.indexOf(i)>-1||e.indexOf(i.toLowerCase())>-1)&&(s=i)}),""!==s&&(t=s))}return t},i.prototype.getIsBold=function(){if(this.bEditable)var e=window.document.queryCommandState("bold");return e},i.prototype.getIsItalic=function(){if(this.bEditable)var e=window.document.queryCommandState("italic");return e},i.prototype.getIsUnderline=function(){if(this.bEditable)var e=window.document.queryCommandState("underline");return e},i.prototype.getIsEnumeration=function(){if(this.bEditable)var e=window.document.queryCommandState("insertOrderedList");return e},i.prototype.getIsBullets=function(){if(this.bEditable)var e=window.document.queryCommandState("insertUnorderedList");return e},i.prototype.getIsStrikeThrough=function(){if(this.bEditable)var e=window.document.queryCommandState("StrikeThrough");return e},i.prototype.convertFontSizeToPixels=function(e){var t=0;return n.each(this.aSizes,function(s,i){0===t&&e<=i.inNumber&&(t=i.inPixels)}),t+"px"},i.prototype.convertFontSizeToNumber=function(e){var t=r.pInt(e),s=0;return t>0&&n.each(this.aSizes,function(e,i){0===s&&t<=i.inPixels&&(s=i.inNumber)}),s},i.prototype.getFontSizeInNumber=function(){var e="",t=0;return this.bEditable&&(e=window.document.queryCommandValue("FontSize"),t=r.pInt(e)),(isNaN(t)||t<=0)&&(t=this.convertFontSizeToNumber(this.sBasicFontSize)),t},i.prototype.changeLink=function(e){var t=this.normaliseURL(e),s=n(this.oCurrLink);this.oCurrLink&&(s.attr("href")===s.text()&&s.text(t),"A"===this.oCurrLink.tagName?s.attr("href",t):s.parent().attr("href",t),this.oCurrLink=null,this.bInUrl=!1)},i.prototype.removeCurrentLink=function(){if(this.oCurrLink&&document.createRange&&window.getSelection){var e=document.createRange(),t=window.getSelection();e.selectNodeContents(this.oCurrLink),t.removeAllRanges(),t.addRange(e),this.removeLink(),this.oCurrLink=null,this.bInUrl=!1,this.oOptions.onUrlOut()}},i.prototype.changeFocusLink=function(e){var t=null,s=null;a.firefox&&window.getSelection&&(t=window.getSelection(),s=t.focusNode?t.focusNode.parentElement:null,s&&"A"===s.tagName&&n(s).attr("href",e))},i.prototype.removeCurrentImage=function(){this.oCurrImage&&(this.oCurrImage.remove(),this.oCurrImage=null,this.bInImage=!1,this.oOptions.onImageBlur()),this.setFocus(!0)},i.prototype.changeCurrentImage=function(e){if(this.oCurrImage&&void 0!==e){var t=this.oCurrImage;n.each(e,function(e,s){t.css(e,s)})}this.setFocus(!0)},i.prototype.showImageTooltip=function(e){if(this.oCurrImage&&void 0!==e){var t=this.oCurrImage;n.each(e,function(e,s){t.css(e,s)})}},i.prototype.normaliseURL=function(e){return e.search(/^https?:\/\/|^mailto:|^tel:/g)!==-1?e:"http://"+e},i.prototype.getSelectedText=function(){var e="",t=null;return window.getSelection&&(t=window.getSelection(),t.rangeCount>0&&(e=""+t.getRangeAt(0))),e},i.prototype.storeSelectionPosition=function(){var e=this.getSelectionRanges();o.isArray(e)&&e.length>0&&(this.aRanges=e)},i.prototype.editableIsActive=function(){return!(!n(document.activeElement).hasClass("crea-content-editable")&&!n(document.activeElement).children().first().hasClass("crea-content-editable"))},i.prototype.getSelectionRanges=function(){var e=[];if(window.getSelection&&this.editableIsActive())for(var t=window.getSelection(),s=null,i=0,o=t.rangeCount;i<o;i++)s=t.getRangeAt(i),e.push(s);return e},i.prototype.checkAnchorNode=function(){if(window.getSelection&&this.editableIsActive()){var e=window.getSelection(),t=null;e.anchorNode&&(e.anchorNode.parentElement||e.anchorNode.parentNode)&&(t=e.anchorNode.parentElement||e.anchorNode.parentNode,"A"===t.tagName||"A"===t.parentNode.tagName||"A"===t.parentElement.tagName?this.bInUrl&&t===this.oCurrLink?this.bInUrl&&t===this.oCurrLink&&(this.oCurrLink=null,this.bInUrl=!1,this.oOptions.onUrlOut()):(this.oCurrLink=t,this.bInUrl=!0,
  this.oOptions.onUrlIn(n(t))):this.bInUrl&&(this.oCurrLink=null,this.bInUrl=!1,this.oOptions.onUrlOut()))}},i.prototype.restoreSelectionPosition=function(e){var t="",s=null,i=null,n=null;t=this.setSelectionRanges(this.aRanges),window.getSelection&&o.isArray(this.aRanges)&&(e=void 0!==e?e:"",a.firefox&&""===t&&""!==e&&(window.getSelection&&window.getSelection().getRangeAt?(s=window.getSelection(),s.getRangeAt&&s.rangeCount>0&&(i=s.getRangeAt(0),n=i.createContextualFragment(e),i.insertNode(n))):document.selection&&document.selection.createRange&&document.selection.createRange().pasteHTML(e)))},i.prototype.setSelectionRanges=function(e){var t=null,s=null,i=0,n=0,r="";if(window.getSelection&&o.isArray(e))for(n=e.length,t=window.getSelection(),a.ie10AndAbove||t.removeAllRanges();i<n;i++)s=e[i],s&&(t.addRange(s),r+=""+s);return r},i.prototype.uniteWithNextQuote=function(){var e=window.getSelection?window.getSelection():null,t=e?e.focusNode:null,s=t?this.getLastBlockQuote(t):null,i=s?n(s).next():null,o=i&&i.length>0&&"BLOCKQUOTE"===i[0].tagName?i[0]:null,r=[],a=0,l=0,h=null;if(s&&o){for(n("<br />").appendTo(s),r=n(o).contents(),l=r.length,a=0;a<l;a++)h=r[a],n(h).appendTo(s);n(o).remove()}},i.prototype.uniteWithPrevQuote=function(){var e=window.getSelection?window.getSelection():null,t=e?e.focusNode:null,s=t?this.getLastBlockQuote(t):null;this.getPrevAndUnite(s),this.getPrevAndUnite(s)},i.prototype.getPrevAndUnite=function(e){var t=e?n(e).prev():null,s=t&&t.length>0&&"BLOCKQUOTE"===t[0].tagName?t[0]:null,i=[],o=0,r=0,a=null;if(e&&s){for(n("<br />").prependTo(e),i=n(s).contents(),r=i.length,o=r-1;o>0;o--)a=i[o],n(a).prependTo(e);n(s).remove()}},i.prototype.getLastBlockQuote=function(e){for(var t=e,s=null;t&&t.parentNode;)"BLOCKQUOTE"===t.tagName&&(s=t),t=t.parentNode;return s},i.prototype.breakQuotes=function(e){var t=window.getSelection?window.getSelection():null,s=t?t.focusNode:null,i=s?this.getLastBlockQuote(s):null;s&&i&&this.breakBlocks(s,i,t.focusOffset)},i.prototype.setCursorPosition=function(e,t){if(document.createRange&&window.getSelection){var s=document.createRange(),i=window.getSelection();i.removeAllRanges(),s.setStart(e,t),s.setEnd(e,t),s.collapse(!0),i.addRange(s),this.aRanges=[s]}},i.prototype.cloneNode=function(e){var t=null,s="";try{t=n(e).clone()}catch(i){s=e.tagName,t=n("<"+s+"></"+s+">")}return t},i.prototype.breakBlocks=function(e,t,s){for(var i=e,o=null,r=[],a=0,l=0,h=null,u=!0,c=null,d=null,p=null,m=null,g=!1,f=!0,b=null;f&&i.parentNode;){for(p=c,m=d,c=this.cloneNode(i).empty(),d=this.cloneNode(i).empty(),r=n(i).contents(),l=r.length,u=!0,null===o&&(o=r[s]),0===l&&(c=null),a=0;a<l;a++)h=r[a],h===o?(null===p?a===s&&"BR"===h.tagName||n(h).appendTo(d):(p.html().length>0&&p.appendTo(c),m.appendTo(d)),u=!1):u?n(h).appendTo(c):n(h).appendTo(d);g=t===i,g&&(f=!1),o=i,i=i.parentNode}null!==c&&null!==d&&(c.insertBefore(n(t)),b=n("<span>&nbsp;</span>").insertBefore(n(t)),n("<br>").insertBefore(n(t)),d.insertBefore(n(t)),n(t).remove(),this.setCursorPosition(b[0],0))},e.exports=i},342:function(e,t,s){"use strict";function i(e,t,s){this.aGreyColors=["rgb(0, 0, 0)","rgb(68, 68, 68)","rgb(102, 102, 102)","rgb(153, 153, 153)","rgb(204, 204, 204)","rgb(238, 238, 238)","rgb(243, 243, 243)","rgb(255, 255, 255)"],this.aBrightColors=["rgb(255, 0, 0)","rgb(255, 153, 0)","rgb(255, 255, 0)","rgb(0, 255, 0)","rgb(0, 255, 255)","rgb(0, 0, 255)","rgb(153, 0, 255)","rgb(255, 0, 255)"],this.aColorLines=[["rgb(244, 204, 204)","rgb(252, 229, 205)","rgb(255, 242, 204)","rgb(217, 234, 211)","rgb(208, 224, 227)","rgb(207, 226, 243)","rgb(217, 210, 233)","rgb(234, 209, 220)"],["rgb(234, 153, 153)","rgb(249, 203, 156)","rgb(255, 229, 153)","rgb(182, 215, 168)","rgb(162, 196, 201)","rgb(159, 197, 232)","rgb(180, 167, 214)","rgb(213, 166, 189)"],["rgb(224, 102, 102)","rgb(246, 178, 107)","rgb(255, 217, 102)","rgb(147, 196, 125)","rgb(118, 165, 175)","rgb(111, 168, 220)","rgb(142, 124, 195)","rgb(194, 123, 160)"],["rgb(204, 0, 0)","rgb(230, 145, 56)","rgb(241, 194, 50)","rgb(106, 168, 79)","rgb(69, 129, 142)","rgb(61, 133, 198)","rgb(103, 78, 167)","rgb(166, 77, 121)"],["rgb(153, 0, 0)","rgb(180, 95, 6)","rgb(191, 144, 0)","rgb(56, 118, 29)","rgb(19, 79, 92)","rgb(11, 83, 148)","rgb(53, 28, 117)","rgb(116, 27, 71)"],["rgb(102, 0, 0)","rgb(120, 63, 4)","rgb(127, 96, 0)","rgb(39, 78, 19)","rgb(12, 52, 61)","rgb(7, 55, 99)","rgb(32, 18, 77)","rgb(76, 17, 48)"]],this.caption=e,this.pickHandler=t,this.pickContext=s,this.colorPickerDom=n.observable(null)}var o=s(2),n=s(44),r=s(1);i.prototype.ViewTemplate="MailWebclient_ColorPickerView",i.prototype.onShow=function(){r(this.colorPickerDom()).find("span.color-item").on("click",o.bind(function(e){e.stopPropagation(),this.setColorFromPopup(r(e.target).data("color"))},this))},i.prototype.setColorFromPopup=function(e){this.pickHandler.call(this.pickContext,e)},e.exports=i},343:function(e,t,s){"use strict";function i(e){d=s(182),u=s(315),this.id=n.observable(l.pInt(e.AccountID)),this.email=n.observable(l.pString(e.Email)),this.friendlyName=n.observable(l.pString(e.FriendlyName)),this.incomingLogin=n.observable(l.pString(e.IncomingLogin)),this.signature=n.observable(l.pString(e.Signature)),this.useSignature=n.observable(!!e.UseSignature),this.serverId=n.observable(l.pInt(e.ServerId)),this.oServer=new b(e.Server),this.useToAuthorize=n.observable(!!e.UseToAuthorize),this.canBeUsedToAuthorize=n.observable(!!e.CanBeUsedToAuthorize),this.useThreading=n.observable(!!e.UseThreading),this.useThreading.subscribe(function(){this.requireCache(),E.clearMessagesCache(this.id())},this),this.bSaveRepliesToCurrFolder=!!e.SaveRepliesToCurrFolder,this.isCurrent=n.observable(!1),this.isEdited=n.observable(!1),this.hash=n.computed(function(){return h.getHash(this.id()+this.email())},this),this.passwordSpecified=n.observable(!0),this.fetchers=n.observableArray([]),this.identities=n.observable(null),this.autoresponder=n.observable(null),this.forward=n.observable(null),this.filters=n.observable(null),this.quota=n.observable(0),this.usedSpace=n.observable(0),this.quotaRecieved=n.observable(!1),this.fullEmail=n.computed(function(){return r.getFullEmail(this.friendlyName(),this.email())},this),this.bDefault=y.AllowDefaultAccountForUser&&this.email()===d.getUserPublicId(),this.aExtend=l.pObject(e.Extend)}var o=s(2),n=s(44),r=s(205),a=s(185),l=s(181),h=s(217),u=null,c=s(186),d=null,p=s(43),m=s(192),g=s(201),f=s(344),b=s(346),v=null,E=null,y=s(313);i.prototype.threadingIsAvailable=function(){return this.oServer.bEnableThreading&&this.useThreading()},i.prototype.updateFromServer=function(e){this.email(l.pString(e.Email)),this.friendlyName(l.pString(e.FriendlyName)),this.incomingLogin(l.pString(e.IncomingLogin)),this.serverId(l.pInt(e.ServerId)),this.oServer=new b(e.Server),this.useToAuthorize(!!e.UseToAuthorize),this.useThreading(!!e.UseThreading),this.bSaveRepliesToCurrFolder=!!e.SaveRepliesToCurrFolder},i.prototype.requireAccounts=function(){null===v&&(v=s(314))},i.prototype.requireCache=function(){null===E&&(E=s(316))},i.prototype.onGetQuotaResponse=function(e,t){o.isArray(e.Result)&&1<e.Result.length&&(this.quota(l.pInt(e.Result[1])),this.usedSpace(l.pInt(e.Result[0])),this.requireCache(),E.quotaChangeTrigger(!E.quotaChangeTrigger())),this.quotaRecieved(!0)},i.prototype.updateQuotaParams=function(){p.ShowQuotaBar&&u.send("GetQuota",{AccountID:this.id()},this.onGetQuotaResponse,this)},i.prototype.updateFriendlyName=function(e){this.friendlyName(e)},i.prototype.changeAccount=function(){this.requireAccounts(),v.changeCurrentAccount(this.id(),!0)},i.prototype.getDefaultIdentity=function(){return o.find(this.identities()||[],function(e){return e.isDefault()})},i.prototype.getFetchersIdentitiesEmails=function(){var e=this.identities()||[],t=[];return o.each(this.fetchers(),function(e){t.push(e.email())}),o.each(e,function(e){t.push(e.email())}),t},i.prototype.remove=function(){var e=o.bind(this.confirmedRemove,this);this.bDefault||m.showPopup(g,[a.i18n("MAILWEBCLIENT/CONFIRM_REMOVE_ACCOUNT"),e,this.email()])},i.prototype.confirmedRemove=function(e){e&&u.send("DeleteAccount",{AccountID:this.id()},this.onAccountDeleteResponse,this)},i.prototype.onAccountDeleteResponse=function(e,t){if(e.Result){var i=s(330);o.isFunction(i.closeComposePopup)&&i.closeComposePopup(),this.requireAccounts(),v.deleteAccount(this.id())}else c.showErrorByCode(e,a.i18n("MAILWEBCLIENT/ERROR_REMOVE_ACCOUNT"))},i.prototype.requestFilters=function(){u.send("GetFilters",{AccountID:this.id()},this.onGetFiltersResponse,this)},i.prototype.onGetFiltersResponse=function(e,t){var s=new f;e.Result&&s.parse(this.id(),e.Result),this.filters(s)},e.exports=i},344:function(e,t,s){"use strict";function i(){this.iAccountId=0,this.collection=n.observableArray([])}var o=s(2),n=s(44),r=s(345);i.prototype.parse=function(e,t){var s=0,i=t.length,n=null;if(this.iAccountId=e,o.isArray(t))for(i=t.length;s<i;s++)n=new r(e),n.parse(t[s]),this.collection.push(n)},e.exports=i},345:function(e,t,s){"use strict";function i(e){this.iAccountId=e,this.enable=o.observable(!0).extend({reversible:!0}),this.field=o.observable("").extend({reversible:!0}),this.condition=o.observable("").extend({reversible:!0}),this.filter=o.observable("").extend({reversible:!0}),this.action=o.observable("").extend({reversible:!0}),this.folder=o.observable("").extend({reversible:!0})}var o=s(44),n=s(181);i.prototype.parse=function(e){this.enable(!!e.Enable),this.field(n.pInt(e.Field)),this.condition(n.pInt(e.Condition)),this.filter(n.pString(e.Filter)),this.action(n.pInt(e.Action)),this.folder(n.pString(e.FolderFullName)),this.commit()},i.prototype.revert=function(){this.enable.revert(),this.field.revert(),this.condition.revert(),this.filter.revert(),this.action.revert(),this.folder.revert()},i.prototype.commit=function(){this.enable.commit(),this.field.commit(),this.condition.commit(),this.filter.commit(),this.action.commit(),this.folder.commit()},i.prototype.toString=function(){var e=[this.enable(),this.field(),this.condition(),this.filter(),this.action(),this.folder()];return e.join(":")},e.exports=i},346:function(e,t,s){"use strict";function i(e){this.iId=e?o.pInt(e.EntityId)||o.pInt(e.ServerId):0,this.iTenantId=e?o.pInt(e.TenantId):0,this.sName=e?o.pString(e.Name):"",this.sIncomingServer=e?o.pString(e.IncomingServer):"",this.iIncomingPort=e?o.pInt(e.IncomingPort):143,this.bIncomingUseSsl=!!e&&!!e.IncomingUseSsl,this.sOutgoingServer=e?o.pString(e.OutgoingServer):"",this.iOutgoingPort=e?o.pInt(e.OutgoingPort):25,this.bOutgoingUseSsl=!!e&&!!e.OutgoingUseSsl,this.sDomains=e?o.pString(e.Domains):"",this.sSmtpAuthType=e?o.pString(e.SmtpAuthType):window.Enums.SmtpAuthType.UseUserCredentials,this.sSmtpLogin=e?o.pString(e.SmtpLogin):"",this.sSmtpPassword=e?o.pString(e.SmtpPassword):"",this.bEnableSieve=!!e&&!!e.EnableSieve,this.iSievePort=e&&e.SievePort?o.pInt(e.SievePort):4190,this.bEnableThreading=!!e&&!!e.EnableThreading,this.bUseFullEmailAddressAsLogin=!e||!!e.UseFullEmailAddressAsLogin,this.bSetExternalAccessServers=o.pBool(e&&e.SetExternalAccessServers,!1),this.sExternalAccessImapServer=o.pString(e&&e.ExternalAccessImapServer,""),this.iExternalAccessImapPort=o.pInt(e&&e.ExternalAccessImapPort,143),this.sExternalAccessSmtpServer=o.pString(e&&e.ExternalAccessSmtpServer,""),this.iExternalAccessSmtpPort=o.pInt(e&&e.ExternalAccessSmtpPort,25),this.bAllowToDelete=o.pBool(e&&e.AllowToDelete,!0),this.bAllowEditDomains=o.pBool(e&&e.AllowEditDomains,!0)}var o=s(181);e.exports=i},347:function(e,t,s){"use strict";function i(){this.FETCHER=!0,this.id=o.observable(0),this.accountId=o.observable(0),this.hash=o.computed(function(){return a.getHash(this.accountId()+"fetcher"+this.id())},this),this.isEnabled=o.observable(!1),this.isLocked=o.observable(!1).extend({autoResetToFalse:1e3}),this.email=o.observable(""),this.userName=o.observable(""),this.folder=o.observable(""),this.useSignature=o.observable(!1),this.signature=o.observable(""),this.incomingServer=o.observable(""),this.incomingPort=o.observable(0),this.incomingUseSsl=o.observable(!1),this.incomingLogin=o.observable(""),this.leaveMessagesOnServer=o.observable(""),this.isOutgoingEnabled=o.observable(!1),this.outgoingServer=o.observable(""),this.outgoingPort=o.observable(0),this.outgoingUseSsl=o.observable(!1),this.outgoingUseAuth=o.observable(!1),this.iCheckIntervalMinutes=0,this.fullEmail=o.computed(function(){return n.getFullEmail(this.userName(),this.email())},this)}var o=s(44),n=s(205),r=s(181),a=s(217);i.prototype.parse=function(e){this.id(r.pInt(e.EntityId)),this.accountId(r.pInt(e.IdAccount)),this.isEnabled(!!e.IsEnabled),this.isLocked(!!e.IsLocked),this.email(r.pString(e.Email)),this.userName(r.pString(e.Name)),this.folder(r.pString(e.Folder)),this.useSignature(!!e.UseSignature),this.signature(r.pString(e.Signature)),this.incomingServer(r.pString(e.IncomingServer)),this.incomingPort(r.pInt(e.IncomingPort)),this.incomingUseSsl(!!e.IncomingUseSsl),this.incomingLogin(r.pString(e.IncomingLogin)),this.leaveMessagesOnServer(!!e.LeaveMessagesOnServer),this.isOutgoingEnabled(!!e.IsOutgoingEnabled),this.outgoingServer(r.pString(e.OutgoingServer)),this.outgoingPort(r.pInt(e.OutgoingPort)),this.outgoingUseSsl(!!e.OutgoingUseSsl),this.outgoingUseAuth(!!e.OutgoingUseAuth),this.iCheckIntervalMinutes=r.pInt(e.CheckInterval,0)},e.exports=i},348:function(e,t,s){"use strict";function i(){this.bAccountPart=!1,this.isDefault=o.observable(!1),this.email=o.observable(""),this.friendlyName=o.observable(""),this.fullEmail=o.computed(function(){return n.getFullEmail(this.friendlyName(),this.email())},this),this.accountId=o.observable(-1),this.id=o.observable(-1),this.signature=o.observable(""),this.useSignature=o.observable(!1),this.hash=o.computed(function(){return a.getHash(this.accountId()+"identity"+this.id())},this)}var o=s(44),n=s(205),r=s(181),a=s(217);i.prototype.parse=function(e){"Object/Aurora\\Modules\\Mail\\Classes\\Identity"===e["@Object"]&&(this.bAccountPart=!!e.AccountPart,this.isDefault(!!e.Default),this.email(r.pString(e.Email)),this.friendlyName(r.pString(e.FriendlyName)),this.accountId(r.pInt(e.IdAccount)),this.id(r.pInt(e.EntityId)),this.signature(r.pString(e.Signature)),this.useSignature(!!e.UseSignature))},e.exports=i},355:function(e,t,s){"use strict";function i(e,t){this.servers=r.observableArray([]),this.serversRetrieved=r.observable(!1),this.serverOptions=r.observableArray([{Name:a.i18n("MAILWEBCLIENT/LABEL_CONFIGURE_SERVER_MANUALLY"),Id:0}]),this.selectedServerId=r.observable(0),this.oLastEditableServer=new m,this.iEditedServerId=0,this.selectedServerId.subscribe(function(){var e=this.selectedServerId(),t=o.find(this.servers(),function(t){return t.iId===e});t?(this.oIncoming.isEnabled()&&(this.oLastEditableServer=new m(this.getParametersForSave())),this.setExternalAccessServers(t.bSetExternalAccessServers),this.externalAccessImapServer(t.sExternalAccessImapServer),this.externalAccessImapPort(t.iExternalAccessImapPort),this.externalAccessSmtpServer(t.sExternalAccessSmtpServer),this.externalAccessSmtpPort(t.iExternalAccessSmtpPort),this.tenantId(t.iTenantId),this.name(t.sName),this.oIncoming.set(t.sIncomingServer,t.iIncomingPort,t.bIncomingUseSsl),this.oIncoming.isEnabled(this.bAdminEdit),this.oOutgoing.set(t.sOutgoingServer,t.iOutgoingPort,t.bOutgoingUseSsl),this.oOutgoing.isEnabled(this.bAdminEdit),this.outgoingUseAuth(t.sSmtpAuthType===window.Enums.SmtpAuthType.UseUserCredentials),this.outgoingUseAuth.enable(this.bAdminEdit),this.domains(t.sDomains),this.smtpAuthType(t.sSmtpAuthType),this.smtpLogin(t.sSmtpLogin),this.smtpPassword(t.sSmtpPassword),this.enableSieve(t.bEnableSieve),this.sievePort(t.iSievePort),this.enableThreading(t.bEnableThreading),this.useFullEmailAddressAsLogin(t.bUseFullEmailAddressAsLogin)):(this.setExternalAccessServers(this.oLastEditableServer.bSetExternalAccessServers),this.externalAccessImapServer(this.oLastEditableServer.sExternalAccessImapServer),this.externalAccessImapPort(this.oLastEditableServer.iExternalAccessImapPort),this.externalAccessSmtpServer(this.oLastEditableServer.sExternalAccessSmtpServer),this.externalAccessSmtpPort(this.oLastEditableServer.iExternalAccessSmtpPort),this.tenantId(0),this.name(this.oLastEditableServer.sName),this.oIncoming.set(this.oLastEditableServer.sIncomingServer,this.oLastEditableServer.iIncomingPort,this.oLastEditableServer.bIncomingUseSsl),this.oIncoming.isEnabled(!0),this.oOutgoing.set(this.oLastEditableServer.sOutgoingServer,this.oLastEditableServer.iOutgoingPort,this.oLastEditableServer.bOutgoingUseSsl),this.oOutgoing.isEnabled(!0),this.outgoingUseAuth(this.oLastEditableServer.sSmtpAuthType===window.Enums.SmtpAuthType.UseUserCredentials),this.outgoingUseAuth.enable(!0),this.domains(""),this.smtpAuthType(window.Enums.SmtpAuthType.UseUserCredentials),this.smtpLogin(""),this.smtpPassword(""),this.enableSieve(!1),this.sievePort(4190),this.enableThreading(!0),this.useFullEmailAddressAsLogin(!0)),this.setCurrentValues()},this),this.tenantId=r.observable(0),this.name=r.observable(""),this.name.focused=r.observable(!1),this.bAdminEdit=t,this.oIncoming=new g(143,993,e+"_incoming",a.i18n("MAILWEBCLIENT/LABEL_IMAP_SERVER"),t?this.name:null),this.oOutgoing=new g(25,465,e+"_outgoing",a.i18n("MAILWEBCLIENT/LABEL_SMTP_SERVER"),this.oIncoming.server),this.outgoingUseAuth=r.observable(!0),this.outgoingUseAuth.enable=r.observable(!0),this.domains=r.observable(""),this.bAllowEditDomains=p.AllowEditDomainsInServer,this.name.focused.subscribe(function(){this.bAllowEditDomains&&!this.name.focused()&&""===this.domains()&&this.domains(this.name())},this),this.smtpAuthType=r.observable(window.Enums.SmtpAuthType.UseUserCredentials),this.smtpLogin=r.observable(""),this.smtpPassword=r.observable(""),this.enableSieve=r.observable(!1),this.sievePort=r.observable(4190),this.enableThreading=r.observable(!0),this.useFullEmailAddressAsLogin=r.observable(!0),this.currentValues=r.observable(""),this.aRequiredFields=[this.oIncoming.server,this.oIncoming.port,this.oOutgoing.server,this.oOutgoing.port],t&&this.aRequiredFields.unshift(this.name),this.setExternalAccessServers=r.observable(!1),this.externalAccessImapServer=r.observable(this.oIncoming.server()),this.externalAccessImapPort=r.observable(this.oIncoming.port()),this.externalAccessSmtpServer=r.observable(this.oOutgoing.server()),this.externalAccessSmtpPort=r.observable(this.oOutgoing.port()),r.computed(function(){this.setExternalAccessServers()||(this.externalAccessImapServer(this.oIncoming.server()),this.externalAccessImapPort(this.oIncoming.port()),this.externalAccessSmtpServer(this.oOutgoing.server()),this.externalAccessSmtpPort(this.oOutgoing.port()))},this)}var o=s(2),n=s(1),r=s(44),a=s(185),l=s(181),h=s(256),u=s(186),c=s(182),d=s(315),p=s(313),m=s(346),g=s(356);i.prototype.ViewTemplate="MailWebclient_Settings_ServerPairPropertiesView",i.prototype.serverInit=function(e){this.setServer(e?new m:this.oLastEditableServer)},i.prototype.fullInit=function(){this.setServer(this.oLastEditableServer),this.serversRetrieved()||this.requestServers()},i.prototype.setServer=function(e){this.oLastEditableServer=e,this.setServerId(e.iId)},i.prototype.setServerId=function(e){if(this.serversRetrieved()){var t=0===this.selectedServerId();this.selectedServerId(0),this.selectedServerId(e),t&&0===e&&this.selectedServerId.valueHasMutated()}else this.iEditedServerId=e},i.prototype.requestServers=function(){var e=o.isFunction(c.getTenantId)?c.getTenantId():0;this.serversRetrieved(!1),d.send("GetServers",{TenantId:e},function(e){if(o.isArray(e.Result)){var t=[{Name:a.i18n("MAILWEBCLIENT/LABEL_CONFIGURE_SERVER_MANUALLY"),Id:0}];o.each(e.Result,function(e){t.push({Name:e.Name,Id:l.pInt(e.EntityId)})}),this.servers(o.map(e.Result,function(e){return new m(e)})),this.serverOptions(t),this.serversRetrieved(!0),this.iEditedServerId&&(this.setServerId(this.iEditedServerId),this.iEditedServerId=0)}else u.showErrorByCode(e)},this)},i.prototype.clear=function(){this.oIncoming.clear(),this.oOutgoing.clear(),this.outgoingUseAuth(!0)},i.prototype.setCurrentValues=function(){var e=this.bAdminEdit?[this.selectedServerId(),this.name()]:[],t=[this.oIncoming.port(),this.oIncoming.server(),this.oIncoming.ssl(),this.oOutgoing.port(),this.oOutgoing.server(),this.oOutgoing.ssl(),this.outgoingUseAuth(),this.domains(),this.smtpAuthType(),this.smtpLogin(),this.smtpPassword(),this.enableSieve(),this.sievePort(),this.enableThreading(),this.useFullEmailAddressAsLogin(),this.setExternalAccessServers(),this.externalAccessImapServer(),this.externalAccessImapPort(),this.externalAccessSmtpServer(),this.externalAccessSmtpPort()];this.currentValues(e.concat(t).join(":"))},i.prototype.getCurrentValues=function(){return this.setCurrentValues(),[this.currentValues()]},i.prototype.getSmtpAuthType=function(){return this.bAdminEdit||this.smtpAuthType()===window.Enums.SmtpAuthType.UseSpecifiedCredentials?this.smtpAuthType():this.outgoingUseAuth()?window.Enums.SmtpAuthType.UseUserCredentials:window.Enums.SmtpAuthType.NoAuthentication},i.prototype.getParametersForSave=function(){var e=this.selectedServerId(),t=this.oLastEditableServer.iId,s=this.getSmtpAuthType(),i={};return 0!==e||o.find(this.servers(),function(e){return t===e.iId})||(e=t),i={ServerId:e,Name:this.bAdminEdit?this.name():this.oIncoming.server(),IncomingServer:this.oIncoming.server(),IncomingPort:this.oIncoming.getIntPort(),IncomingUseSsl:this.oIncoming.ssl(),OutgoingServer:this.oOutgoing.server(),OutgoingPort:this.oOutgoing.getIntPort(),OutgoingUseSsl:this.oOutgoing.ssl(),Domains:this.domains(),SmtpAuthType:s,SmtpLogin:s===window.Enums.SmtpAuthType.UseSpecifiedCredentials?n.trim(this.smtpLogin()):"",SmtpPassword:s===window.Enums.SmtpAuthType.UseSpecifiedCredentials?n.trim(this.smtpPassword()):"",EnableSieve:this.enableSieve(),SievePort:this.sievePort(),EnableThreading:this.enableThreading(),UseFullEmailAddressAsLogin:this.useFullEmailAddressAsLogin(),SetExternalAccessServers:this.setExternalAccessServers()},this.setExternalAccessServers()&&(i.ExternalAccessImapServer=this.externalAccessImapServer(),i.ExternalAccessImapPort=this.externalAccessImapPort(),i.ExternalAccessSmtpServer=this.externalAccessSmtpServer(),i.ExternalAccessSmtpPort=this.externalAccessSmtpPort()),i},i.prototype.validateBeforeSave=function(){return h.checkIfFieldsEmpty(this.aRequiredFields,a.i18n("MAILWEBCLIENT/ERROR_REQUIRED_FIELDS_EMPTY"))},i.prototype.onDomainsClick=function(){this.bAllowEditDomains||(n(".tabsbar .item.admin.domain").removeClass("recivedAnim"),setTimeout(function(){n(".tabsbar .item.admin.domain").addClass("recivedAnim")}))},e.exports=i},356:function(e,t,s){"use strict";function i(e,t,s,i,r){this.server=n.observable(""),this.server.focused=n.observable(!1),this.label=i,this.defaultPort=n.observable(e),this.defaultSslPort=n.observable(t),this.port=n.observable(e),this.port.focused=n.observable(!1),this.ssl=n.observable(!1),this.isEnabled=n.observable(!0),this.id=s,o.isFunction(r)&&r.focused.subscribe(function(){r.focused()||""!==this.server()||this.server(r())},this),this.ssl.subscribe(function(){var e=a.pInt(this.port());this.ssl()?e===this.defaultPort()&&this.port(this.defaultSslPort()):e===this.defaultSslPort()&&this.port(this.defaultPort())},this)}var o=s(1),n=s(44),r=s(2),a=s(181);i.prototype.set=function(e,t,s){this.server(e),this.ssl(s),this.port(t)},i.prototype.clear=function(){this.server(""),this.ssl(!1),this.port(this.defaultPort())},i.prototype.getIntPort=function(){return a.pInt(this.port())},i.prototype.parentSave=function(e,t){e.focused&&e.focused(!1);var s=r.find(t,function(e){return r.isFunction(e.save)});s&&s.save()},e.exports=i},380:function(e,t,s){"use strict";function i(){c.call(this,f.ServerModuleName),this.visible=n.observable(!0),this.oServerPairPropertiesView=new g("server_edit",!0),this.tenants=h.run("AdminPanelWebclient","getTenantsObservable"),this.tenantOptions=n.computed(function(){return o.union([{Name:"system-wide",Id:0}],this.tenants())},this),this.selectedTenantId=n.observable(this.getSelectedTenantId()),this.servers=this.oServerPairPropertiesView.servers,this.servers.subscribe(function(){o.each(this.servers(),function(e){if(0!==e.iTenantId&&f.EnableMultiTenant){var t=o.find(this.tenants(),function(t){return t.Id===e.iTenantId});e.sTenantHint=t?" "+r.i18n("MAILWEBCLIENT/LABEL_HINT_SERVERS_TENANTNAME",{TENANTNAME:t.Name}):""}else e.sTenantHint=""}.bind(this)),this.editedServer()||this.routeServerList(),this.serversRetrieved()||this.revert()},this),this.serversRetrieved=this.oServerPairPropertiesView.serversRetrieved,this.createMode=n.observable(!1),this.editedServerId=n.observable(0),this.editedServer=n.computed(function(){return o.find(this.servers(),o.bind(function(e){return e.iId===this.editedServerId()},this))},this),this.updateSavedState(),this.oServerPairPropertiesView.currentValues.subscribe(function(){this.updateSavedState()},this)}var o=s(2),n=s(44),r=s(185),a=s(181),l=s(186),h=s(42),u=s(188),c=h.run("AdminPanelWebclient","getAbstractSettingsFormViewClass"),d=s(192),p=s(201),m=s(315),g=s(355),f=s(313);o.extendOwn(i.prototype,c.prototype),i.prototype.ViewTemplate="MailWebclient_Settings_ServersAdminSettingsPaneView",i.prototype.getSelectedTenantId=function(){if(this.tenants().length<2)return 0;var e=h.run("AdminPanelWebclient","getKoSelectedTenantId");return o.isFunction(e)?e():0},i.prototype.routeCreateServer=function(){h.run("AdminPanelWebclient","setAddHash",[["create"]])},i.prototype.routeEditServer=function(e){h.run("AdminPanelWebclient","setAddHash",[[e]])},i.prototype.routeServerList=function(){h.run("AdminPanelWebclient","setAddHash",[[]])},i.prototype.onRouteChild=function(e){var t=a.isNonEmptyArray(e)&&"create"===e[0],s=!t&&a.isNonEmptyArray(e)?a.pInt(e[0]):0;this.createMode(t),this.editedServerId(s),this.oServerPairPropertiesView.serverInit(t),this.revert()},i.prototype.onShow=function(){this.selectedTenantId(this.getSelectedTenantId()),this.oServerPairPropertiesView.requestServers()},i.prototype.deleteServer=function(e){var t=o.bind(function(t){t&&m.send("DeleteServer",{ServerId:e,TenantId:s.iTenantId},function(e){e.Result||l.showErrorByCode(e,r.i18n("MAILWEBCLIENT/ERROR_DELETE_MAIL_SERVER")),this.oServerPairPropertiesView.requestServers()},this)},this),s=o.find(this.servers(),o.bind(function(t){return t.iId===e},this));s&&s.bAllowToDelete&&d.showPopup(p,[r.i18n("MAILWEBCLIENT/CONFIRM_REMOVE_SERVER"),t,s.sName])},i.prototype.save=function(){if(this.oServerPairPropertiesView.validateBeforeSave()){var e=this.createMode()?"CreateServer":"UpdateServer";this.isSaving(!0),m.send(e,this.getParametersForSave(),function(e){this.isSaving(!1),this.oServerPairPropertiesView.requestServers(),this.createMode()?this.routeServerList():e.Result?u.showReport(r.i18n("COREWEBCLIENT/REPORT_SETTINGS_UPDATE_SUCCESS")):l.showErrorByCode(e,r.i18n("COREWEBCLIENT/ERROR_SAVING_SETTINGS_FAILED"))},this)}},i.prototype.getCurrentValues=function(){return this.oServerPairPropertiesView.getCurrentValues()},i.prototype.revertGlobalValues=function(){this.oServerPairPropertiesView.setServerId(this.editedServerId())},i.prototype.getParametersForSave=function(){var e=this.oServerPairPropertiesView.getParametersForSave();return this.createMode()?e.TenantId=this.selectedTenantId():e.TenantId=this.editedServer().iTenantId,e},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i},381:function(e,t,s){"use strict";function i(){l.call(this,u.ServerModuleName),this.bAllowHorizontalLayout=u.AllowHorizontalLayout,this.aLayoutValues=[{text:r.i18n("MAILWEBCLIENT/LABEL_VERT_SPLIT_LAYOUT"),value:!1},{text:r.i18n("MAILWEBCLIENT/LABEL_HORIZ_SPLIT_LAYOUT"),value:!0}],this.bAllowMultiAccounts=u.AllowMultiAccounts,this.autocreateMailAccountOnNewUserFirstLogin=n.observable(u.AutocreateMailAccountOnNewUserFirstLogin),this.allowAddAccounts=n.observable(u.AllowAddAccounts),this.horizontalLayoutByDefault=n.observable(u.HorizontalLayoutByDefault)}var o=s(2),n=s(44),r=s(185),a=(s(181),s(180),s(42)),l=(s(43),a.run("AdminPanelWebclient","getAbstractSettingsFormViewClass")),h=s(338),u=s(313);o.extendOwn(i.prototype,l.prototype),i.prototype.ViewTemplate="MailWebclient_Settings_MailAdminSettingsFormView",i.prototype.registerMailto=function(){h.registerMailto()},i.prototype.getCurrentValues=function(){return[this.autocreateMailAccountOnNewUserFirstLogin,this.allowAddAccounts,this.horizontalLayoutByDefault()]},i.prototype.revertGlobalValues=function(){this.autocreateMailAccountOnNewUserFirstLogin(u.AutocreateMailAccountOnNewUserFirstLogin),this.allowAddAccounts(u.AllowAddAccounts),this.horizontalLayoutByDefault(u.HorizontalLayoutByDefault)},i.prototype.getParametersForSave=function(){return{AutocreateMailAccountOnNewUserFirstLogin:this.autocreateMailAccountOnNewUserFirstLogin(),AllowAddAccounts:this.allowAddAccounts(),HorizontalLayoutByDefault:this.horizontalLayoutByDefault()}},i.prototype.applySavedValues=function(e){u.updateAdmin(e.AutocreateMailAccountOnNewUserFirstLogin,e.AllowAddAccounts,e.HorizontalLayoutByDefault)},i.prototype.setAccessLevel=function(e,t){this.visible(""===e)},e.exports=new i}});