text: (function(e){function t(e){this.calendar=e}t.prototype={show:function(e){this.params=e;this.entryTime=e.entryTime;this.attendees=[];this.attendeesCodesList=false;this.attendeesIndex={};this.attendeesCodes={};this.allowInvite=true;this.notify=true;this.secondSlideIsOpened=false;this.checkDataBeforeCloseMode=true;this.displayed=false;if(this.calendar.ownerUser){this.attendees.push(this.calendar.ownerUser);this.attendeesIndex[this.calendar.ownerUser.id]=true;this.attendeesCodes["U"+this.calendar.ownerUser.id]="users"}this.attendees.push(this.calendar.currentUser);this.attendeesIndex[this.calendar.currentUser.id]=true;this.attendeesCodes["U"+this.calendar.currentUser.id]="users";this.initiateAttendees=[];this.attendees.forEach(function(e){this.initiateAttendees.push(e.id)},this);var t,i,a=-152,n=390,s=420,l=8,r=BX.pos(e.entryNode),o=BX.GetWindowSize();if(r.right+n+l<o.innerWidth){t="left";i=r.width+l}else{t="right";i=-n-l}if(o.scrollTop+o.innerHeight-(r.bottom+s+a)<-35){t=false}var d=new BX.PopupWindow(this.calendar.id+"-simple-add-popup",e.bindNode||e.entryNode,{offsetTop:a,offsetLeft:i,closeIcon:true,width:n,titleBar:true,draggable:true,resizable:false,lightShadow:true,content:this.createContent(),overlay:{opacity:1},buttons:[new BX.PopupWindowButton({text:BX.message("JS_CORE_WINDOW_SAVE")+" (ENTER)",className:"popup-window-button-accept",events:{click:BX.delegate(this.save,this)}}),new BX.PopupWindowButton({text:BX.message("JS_CORE_WINDOW_CANCEL"),events:{click:BX.delegate(this.close,this)}})]});if(t!==false){d.setAngle({offset:130,position:t})}BX.addClass(d.titleBar,"calendar-add-popup-titlebar");BX.removeClass(d.popupContainer,"popup-window-with-titlebar");BX.removeClass(d.closeIcon,"popup-window-titlebar-close-icon");d.show(true);this.popup=d;if(d.overlay&&d.overlay.element){this.overlay=d.overlay.element;BX.addClass(d.overlay.element,"calendar-popup-overlay");setTimeout(BX.delegate(function(){BX.addClass(d.overlay.element,"calendar-popup-overlay-dark");d.overlay=null},this),1)}this.popupButtonsContainer=d.buttonsContainer;BX.addClass(d.contentContainer,"calendar-add-popup-wrap");d.popupContainer.style.minHeight=d.popupContainer.offsetHeight-20+"px";this.nameField.input.focus();this.nameField.input.select();BX.bind(document,"keydown",BX.proxy(this.keyHandler,this));BX.addCustomEvent(d,"onPopupClose",BX.proxy(this.close,this));BX.bind(this.overlay,"click",BX.proxy(this.close,this));this.calendar.disableKeyHandler();setTimeout(BX.delegate(function(){this.calendar.disableKeyHandler()},this),100);this.displayed=true},save:function(t){t=t||{};if(t.checkBusyUsers!==false&&this.calendar.util.isMeetingsEnabled()){var i=this.getBusyUserList();if(i&&i.length>0){if(!this.busyUsersDialog)this.busyUsersDialog=new e.BXEventCalendar.BusyUsersDialog(this.calendar);this.busyUsersDialog.show({users:i,saveCallback:BX.delegate(function(){var e,a=[];for(e=0;e<i.length;e++){a.push(i[e].id)}this.excludeUsers=a.join(",");t.checkBusyUsers=false;this.save(t)},this)});return}}if(this.params.section.id){var a=this.calendar.sectionController.getSection(this.params.section.id);if(a){a.show()}}this.calendar.entryController.saveEntry(this.getPopupData());if(BX.type.isFunction(this.params.saveCallback)){this.params.saveCallback()}this.checkDataBeforeCloseMode=false;this.close()},close:function(){if(!this.popup||!this.popup.isShown()){return}if(this.checkDataBeforeCloseMode&&!this.checkBeforeClose()&&!confirm(BX.message("EC_SAVE_ENTRY_CONFIRM"))){return}this.calendar.enableKeyHandler();if(this.popup){BX.removeCustomEvent(this.popup,"onPopupClose",BX.proxy(this.close,this));this.popup.destroy()}if(this.overlay){BX.removeClass(this.overlay,"calendar-popup-overlay-dark");setTimeout(BX.delegate(function(){BX.remove(this.overlay)},this),300)}BX.removeCustomEvent("OnDestinationAddNewItem",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.clearSecondSlideHeight,this));BX.removeCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.onCalendarPlannerSelectorChanged,this));if(this.plannerId){BX.onCustomEvent("OnCalendarPlannerDoUninstall",[{plannerId:this.plannerId}])}if(BX.type.isFunction(this.params.closeCallback)){this.params.closeCallback()}BX.unbind(document,"keydown",BX.proxy(this.keyHandler,this));BX.unbind(this.overlay,"click",BX.proxy(this.close,this));this.displayed=false},isShown:function(){return this.displayed},couldBeClosedByEsc:function(){return!(this.dateTimeField.fromTime&&this.dateTimeField.fromTime.shown||this.dateTimeField.toTime&&this.dateTimeField.toTime.shown||this.secondSlideIsOpened||this.reminderField&&this.reminderField.reminder&&this.reminderField.reminder.reminderMenu||this.sectionSelector&&this.sectionSelector.sectionMenu||this.locationSelector&&this.locationSelector.selectContol&&this.locationSelector.selectContol.popupMenu||BX.PopupWindowManager.getCurrentPopup())},getPopupData:function(){var e=[];this.attendees.forEach(function(t){e.push(t.id)});var t=BX.Calendar.Util.parseTime(this.dateTimeField.fromTimeInput.value),i=BX.Calendar.Util.parseTime(this.dateTimeField.toTimeInput.value),a=new Date(this.entryTime.from.getTime()),n=new Date(this.entryTime.from.getTime());a.setHours(t.h,t.m,0);n.setHours(i.h,i.m,0);if(!this.attendeesCodesList&&this.attendeesCodes){this.attendeesCodesList=[];for(var s in this.attendeesCodes){if(this.attendeesCodes.hasOwnProperty(s)){this.attendeesCodesList.push(s)}}}return{name:this.nameField.input.value,from:a,to:n,dateFrom:this.calendar.util.formatDateTime(a),dateTo:this.calendar.util.formatDateTime(n),defaultTz:this.timezoneField&&this.timezoneField.select?this.timezoneField.select.value:this.calendar.util.getUserOption("timezoneName"),section:this.params.section.id,location:this.locationSelector.getTextValue(),locationValue:this.locationSelector.getValue(),remind:this.reminderValues||false,attendees:e,attendeesCodes:this.attendeesCodes,attendeesCodesList:this.attendeesCodesList,meetingNotify:this.notify,allowInvite:this.allowInvite,excludeUsers:this.excludeUsers||""}},getEntry:function(){var e=this.getPopupData();var t={ID:null,NAME:e.name,dateFrom:e.from,dateTo:e.to,TZ_FROM:e.defaultTz,TZ_TO:e.defaultTz,SECT_ID:parseInt(e.section),LOCATION:e.location,ATTENDEES_CODES:e.attendeesCodesList,remind:e.remind};return new BX.Calendar.Entry({data:t})},createContent:function(){this.mainSlide=BX.create("DIV",{props:{className:"calendar-add-popup-main-slide"}});this.secondSlide=false;this.nameField=this.createField("string-select",this.mainSlide);this.nameField.input=this.nameField.innerWrap.appendChild(BX.create("INPUT",{props:{className:"calendar-field calendar-field-string"},attrs:{value:this.params.entryName,placeholder:BX.message("EC_ENTRY_NAME"),type:"text"},events:{keyup:BX.proxy(this.entryNameChanged,this),blur:BX.proxy(this.entryNameChanged,this),change:BX.proxy(this.entryNameChanged,this)}}));this.createSectionSelector();this.createDateTimeField();this.createReminderField();this.createlocationField();if(this.calendar.util.isMeetingsEnabled()){this.createPlannerField()}this.fullFormField=this.createField("container-text",this.mainSlide);this.fullFormField.link=this.fullFormField.innerWrap.appendChild(BX.create("SPAN",{props:{className:"calendar-text-link"},text:BX.message("EC_FULL_FORM_LABEL"),events:{click:function(){this.checkDataBeforeCloseMode=false;if(BX.type.isFunction(this.params.fullFormCallback)){this.params.fullFormCallback()}}.bind(this)}}));this.mainSlide.appendChild(BX.create("HR",{props:{className:"calendar-filed-separator"}}));this.sliderContainer=BX.create("DIV",{props:{className:"calendar-add-popup-slider-container"},children:[this.mainSlide]});return this.sliderContainer},prepareSecondSlide:function(e){this.closeSecondSlideCallback=e.closeCallback||null;if(this.secondSlide){BX.cleanNode(this.secondSlide)}else{this.secondSlide=this.sliderContainer.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-second-slide"}}))}this.backButton=this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-second-slide-header"}})).appendChild(BX.create("SPAN",{props:{className:"calendar-add-popup-second-slide-back-btn"},html:BX.message("EC_SIMPLE_FORM_BACK")}));BX.bind(this.backButton,"click",BX.proxy(this.closeSecondSlide,this));BX.bind(document,"keyup",BX.proxy(this.secondSlideEscHandler,this));this.popupButtonsContainer.style.display="none";this.resizeSecondSlide();setTimeout(BX.delegate(function(){BX.addClass(this.popup.contentContainer,"calendar-add-popup-wrap-second-tab-active")},this),0);this.secondSlideIsOpened=true},secondSlideEscHandler:function(e){if(e.keyCode===this.calendar.util.KEY_CODES["escape"]){this.closeSecondSlide()}},closeSecondSlide:function(){if(this.closeSecondSlideCallback){this.closeSecondSlideCallback()}BX.unbind(document,"keyup",BX.proxy(this.secondSlideEscHandler,this));BX.removeClass(this.popup.contentContainer,"calendar-add-popup-wrap-second-tab-active");this.popupButtonsContainer.style.display="";this.clearSecondSlideHeight();if(this.resizeTimeout){this.resizeTimeout=clearTimeout(this.resizeTimeout)}BX.cleanNode(this.secondSlide);this.secondSlideIsOpened=false},resizeSecondSlide:function(){if(this.secondSlide){var e=this.secondSlide.scrollHeight;if(e!=parseInt(this.popup.contentContainer.style.minHeight)){this.secondSlide.style.minHeight=e+"px";this.sliderContainer.style.minHeight=e+"px"}this.resizeTimeout=setTimeout(BX.proxy(this.resizeSecondSlide,this),100)}},clearSecondSlideHeight:function(){if(this.secondSlide)this.secondSlide.style.minHeight="";if(this.sliderContainer)this.sliderContainer.style.minHeight=""},createField:function(e,t){if(!e)e="string";var i=BX.create("DIV",{props:{className:"calendar-field-container calendar-field-container-"+e}}),a=i.appendChild(BX.create("DIV",{props:{className:"calendar-field-block"}}));if(t)t.appendChild(i);return{outerWrap:i,innerWrap:a}},createSectionSelector:function(){this.sectionSelector=new e.BXEventCalendar.SectionSelector({outerWrap:this.nameField.innerWrap,sectionList:this.calendar.sectionController.getSectionListForEdit(),sectionGroupList:this.calendar.sectionController.getSectionGroupList(),mode:"compact",getCurrentSection:BX.delegate(function(){return this.params.section},this),selectCallback:BX.delegate(function(e){if(e){this.params.section=this.calendar.sectionController.getSection(e.id);if(BX.type.isFunction(this.params.changeSectionCallback)){this.params.changeSectionCallback(e)}}},this)})},createDateTimeField:function(){var t=this;this.initiateTimeFrom=this.calendar.util.formatTime(this.entryTime.from.getHours(),this.entryTime.from.getMinutes());this.initiateTimeTo=this.calendar.util.formatTime(this.entryTime.to.getHours(),this.entryTime.to.getMinutes());this.dateTimeField={outerWrap:this.mainSlide.appendChild(BX.create("DIV",{props:{className:"calendar-field-container calendar-field-container-datetime"}}))};this.dateTimeField.dateWrap=this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-prefix"},text:this.calendar.util.formatDateUsable(this.entryTime.from,false)}));this.dateTimeField.fromTimeInputWrap=this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-left"}}));this.dateTimeField.fromTimeInput=this.dateTimeField.fromTimeInputWrap.appendChild(BX.create("INPUT",{attrs:{value:this.initiateTimeFrom,placeholder:BX.message("EC_TIME_FROM_PLACEHOLDER"),type:"text"},props:{className:"calendar-field calendar-field-datetime-menu"}}));this._fromDateValue=this.entryTime.from;this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-between"}}));this.dateTimeField.toTimeInputWrap=this.dateTimeField.outerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-field-block calendar-field-block-right"}}));this.dateTimeField.toTimeInput=this.dateTimeField.toTimeInputWrap.appendChild(BX.create("INPUT",{attrs:{value:this.initiateTimeTo,placeholder:BX.message("EC_TIME_TO_PLACEHOLDER"),type:"text"},props:{className:"calendar-field calendar-field-datetime-menu"}}));this.dateTimeField.fromTime=new e.BXEventCalendar.SelectInput({input:this.dateTimeField.fromTimeInput,value:this.calendar.util.adaptTimeValue(t.calendar.util.parseTime(t.dateTimeField.fromTimeInput.value)),values:this.calendar.util.getSimpleTimeList(),onChangeCallback:BX.proxy(function(){var e=this.calendar.util.parseTime(this.dateTimeField.fromTimeInput.value),t=this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value),i=new Date(this.entryTime.from.getTime()),a=new Date(this.entryTime.from.getTime());i.setHours(e.h,e.m,0);a.setHours(t.h,t.m,0);if(this._fromDateValue){this.entryTime.to=new Date(i.getTime()+(a.getTime()-this._fromDateValue.getTime()||36e5));this.dateTimeField.toTimeInput.value=this.calendar.util.formatTime(this.entryTime.to.getHours(),this.entryTime.to.getMinutes())}this.entryTime.from=i;this._fromDateValue=i;if(this.params.timeNode){this.params.timeNode.innerHTML=this.calendar.util.formatTime(e.h,e.m)}if(BX.type.isFunction(this.params.changeTimeCallback)){this.params.changeTimeCallback(e,t)}},this)});this.dateTimeField.toTime=new e.BXEventCalendar.SelectInput({input:this.dateTimeField.toTimeInput,value:this.calendar.util.adaptTimeValue(this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value)),values:this.calendar.util.getSimpleTimeList()});if(!this.calendar.util.getUserOption("timezoneName")){this.timezoneField=this.createField("container-string",this.mainSlide);this.timezoneField.innerWrap.appendChild(BX.create("LABEL",{props:{className:"calendar-timezone-label"},text:BX.message("EC_ASK_TZ")}));this.timezoneField.select=this.timezoneField.innerWrap.appendChild(BX.create("SELECT",{props:{className:"calendar-field calendar-field-select"},events:{change:function(){t.calendar.util.setUserOption("timezoneName",t.timezoneField.select.value)}}}));var i,a=this.calendar.util.getTimezoneList();for(i in a){if(a.hasOwnProperty(i))this.timezoneField.select.options.add(new Option(a[i].title,i,false,false))}this.timezoneField.select.value=this.calendar.util.getUserOption("timezoneDefaultName")||"";this.timezoneField.innerWrap.appendChild(BX.create("SPAN",{props:{title:BX.message("EC_EVENT_TZ_DEF_HINT"),className:"calendar-event-quest"},html:"?"}));BX.addClass(this.timezoneField.innerWrap,"calendar-field-timezone")}},setDateTimeValues:function(e,t){if(e&&t&&this.dateTimeField&&this.dateTimeField.dateWrap){this.dateTimeField.dateWrap.innerHTML=this.calendar.util.formatDateUsable(e);this.dateTimeField.fromTimeInput.value=this.calendar.util.formatTime(e.getHours(),e.getMinutes());this.dateTimeField.toTimeInput.value=this.calendar.util.formatTime(t.getHours(),t.getMinutes());this.entryTime.from=e;this.entryTime.to=t;this._fromDateValue=e;if(this.params.timeNode)this.params.timeNode.innerHTML=this.dateTimeField.fromTimeInput.value}},createReminderField:function(){var e=this;this.reminderValues=[];this.reminderField=this.createField("container-text",this.mainSlide);this.reminderField.innerCont=this.reminderField.innerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-text"},text:BX.message("EC_REMIND_LABEL")+":"}));this.reminderField.reminder=new BX.Calendar.Controls.Reminder({wrap:this.reminderField.innerCont,selectedValues:[this.calendar.util.getUserOption("defaultReminder",15)],changeCallack:function(t){e.reminderValues=t}})},createlocationField:function(){this.locationField={outerWrap:this.mainSlide.appendChild(BX.create("DIV",{props:{className:"calendar-field-container calendar-field-container-select"}}))};this.locationSelector=new e.BXEventCalendar.LocationSelector(this.calendar.id+"-simple-slider-location",{value:this.entry?this.entry.location:"",wrapNode:this.locationField.outerWrap,getControlContentCallback:BX.delegate(function(){this.prepareSecondSlide({closeCallback:BX.proxy(this.locationSelector.saveValues,this.locationSelector)});this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-title-text"},text:BX.message("EC_MEETING_ROOM_LIST_TITLE")}));return this.secondSlide},this)},this.calendar)},createPlannerField:function(){this.plannerField=this.createField("container-members",this.mainSlide);this.plannerField.innerWrapAttendeesWrap=this.plannerField.innerWrap.appendChild(BX.create("DIV",{props:{className:"calendar-members-selected"},html:"<span>"+BX.message("EC_ATTENDEES_LABEL")+":</span>"}));this.plannerField.currentAttendeesWrap=this.plannerField.innerWrapAttendeesWrap.appendChild(BX.create("SPAN",{props:{className:"calendar-attendees-list"}}));this.showAttendees();this.plannerField.plannerLink=this.plannerField.innerWrapAttendeesWrap.appendChild(BX.create("SPAN",{props:{className:"calendar-members-change-link"},html:BX.message("EC_ATTENDEES_EDIT"),events:{click:BX.delegate(this.showPlannerSlide,this)}}))},showAttendees:function(){BX.cleanNode(this.plannerField.currentAttendeesWrap);var e,t,i=3,a=this.attendees.length,n=5;if(a>0){if(a>n){a=i}for(e=0;e<a;e++){t=this.attendees[e]||{};this.plannerField.currentAttendeesWrap.appendChild(BX.create("div",{attrs:{id:"simple_popup_"+t.id,"bx-tooltip-user-id":t.id},props:{className:"ui-icon ui-icon-common-user calendar-member"},children:[BX.create("i",{style:{backgroundImage:"url("+t.smallAvatar||""+")"}})]}))}if(a<this.attendees.length){this.plannerField.currentAttendeesWrap.appendChild(BX.create("SPAN",{text:BX.message("EC_ATTENDEES_MORE").replace("#COUNT#",this.attendees.length-a)}))}}},showPlannerSlide:function(){this.prepareSecondSlide({closeCallback:BX.proxy(this.hidePlannerSlide,this)});this.attendeesSelector=new e.BXEventCalendar.DestinationSelector(this.calendar.id+"-simple-popup-destination",{wrapNode:this.secondSlide,itemsSelected:this.attendeesCodes||this.calendar.util.getSocnetDestinationConfig("itemsSelected"),calendar:this.calendar});this.loader=BX.adjust(this.calendar.util.getLoader(),{style:{height:"180px"}});this.secondSlide.appendChild(this.loader);this.initPlannerControl();this.meetingOptionsWrap=this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-meeting-options-wrap"},style:{display:"none"}}));this.notifyField=this.createField("container-checkbox",this.meetingOptionsWrap);this.notifyField.label=this.notifyField.innerWrap.appendChild(BX.create("LABEL",{props:{className:"calendar-field-checkbox-label"},html:BX.message("EC_NOTIFY_STATUS_LABEL")}));this.notifyField.checkbox=this.notifyField.label.appendChild(BX.create("INPUT",{attrs:{type:"checkbox"},props:{className:"calendar-field-checkbox"}}));this.notifyField.checkbox.checked=this.notify},hidePlannerSlide:function(){if(this.allowInviteField){this.allowInvite=!!this.allowInviteField.checkbox.checked}if(this.notifyField){this.notify=!!this.notifyField.checkbox.checked}this.destroyDestinationControls()},entryNameChanged:function(){var e=this.nameField.input.value||BX.message("EC_ENTRY_NAME");if(this.params.nameNode){this.params.nameNode.innerHTML=BX.util.htmlspecialchars(e)}if(BX.type.isFunction(this.params.changeNameCallback)){this.params.changeNameCallback(e)}},initPlannerControl:function(){this.plannerId=this.calendar.id+"-simple-planner";this.plannerShown=false;this.plannerWrap=this.secondSlide.appendChild(BX.create("DIV",{props:{className:"calendar-add-popup-planner-wrap"}}));BX.addCustomEvent("OnDestinationAddNewItem",BX.proxy(this.checkPlannerState,this));BX.addCustomEvent("OnDestinationUnselect",BX.proxy(this.checkPlannerState,this));BX.addCustomEvent("OnDestinationUnselect",BX.proxy(this.clearSecondSlideHeight,this));BX.addCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.onCalendarPlannerSelectorChanged,this));if(!this.requestPlanner){this.requestPlanner=true;BX.ajax.get(this.calendar.util.getActionUrl(),{action:"get_planner",sessid:BX.bitrix_sessid(),bx_event_calendar_request:"Y",reqId:Math.round(Math.random()*1e6),planner_id:this.plannerId},BX.delegate(function(e){if(this.loader)BX.remove(this.loader);e=BX.util.trim(e);this.plannerWrap.innerHTML=e;this.requestPlanner=false;this.checkPlannerState()},this))}},onCalendarPlannerSelectorChanged:function(e){if(this.calendar.util.getDayCode(this.entryTime.from)!==this.calendar.util.getDayCode(e.dateFrom)&&this.params.changeDateCallback){this.params.changeDateCallback(e.dateFrom);if(this.popup.angle){this.popup.setAngle(false)}}this.setDateTimeValues(e.dateFrom,e.dateTo)},destroyDestinationControls:function(){if(BX.SocNetLogDestination){if(BX.SocNetLogDestination.isOpenDialog())BX.SocNetLogDestination.closeDialog();if(BX.SocNetLogDestination.popupWindow)BX.SocNetLogDestination.popupWindow.close();BX.SocNetLogDestination.closeSearch()}BX.removeCustomEvent("OnDestinationAddNewItem",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.checkPlannerState,this));BX.removeCustomEvent("OnDestinationUnselect",BX.proxy(this.clearSecondSlideHeight,this));BX.removeCustomEvent("OnCalendarPlannerSelectorChanged",BX.proxy(this.onCalendarPlannerSelectorChanged,this))},plannerIsShown:function(){return this.plannerWrap&&BX.hasClass(this.plannerWrap,"calendar-add-popup-show-planner")},checkPlannerState:function(){var e={codes:this.attendeesSelector.getCodes(),from:this.calendar.util.formatDate(this.entryTime.from.getTime()-this.calendar.util.dayLength*3),to:this.calendar.util.formatDate(this.entryTime.from.getTime()+this.calendar.util.dayLength*10),location:this.locationSelector.getTextValue()};this.attendeesCodes=this.attendeesSelector.getAttendeesCodes();this.attendeesCodesList=this.attendeesSelector.getAttendeesCodesList(this.attendeesCodes);this.updatePlanner(e)},updatePlanner:function(e){if(!e)e={};this.plannerLoadedlocation=e.location||"";var t=this,i=0;this.calendar.request({data:{action:"update_planner",codes:e.codes||[],cur_event_id:i,date_from:e.dateFrom||e.from||"",date_to:e.dateTo||e.to||"",timezone:this.timezoneField&&this.timezoneField.select?this.timezoneField.select.value:this.calendar.util.getUserOption("timezoneName"),location:this.plannerLoadedlocation,entries:e.entrieIds||false,add_cur_user_to_list:"N"},handler:function(i){var a,n=[],s={},l=false,r=!!(e.entries||i.entries&&i.entries.length>0);for(a=0;a<i.entries.length;a++){if(i.entries[a].type==="user"){n.push({id:i.entries[a].id,name:i.entries[a].name,avatar:i.entries[a].avatar,smallAvatar:i.entries[a].smallAvatar||i.entries[a].avatar,url:i.entries[a].url});s[i.entries[a].id]=true;if(!t.attendeesIndex[i.entries[a].id])l=true}}if(!l){for(var o in t.attendeesIndex){if(t.attendeesIndex.hasOwnProperty(o)&&!s[o]){l=true;break}}}if(l){t.attendees=n;t.showAttendees()}if(r){var d={show:r&&!t.plannerIsShown()};if(e.entries){i.entries=e.entries;d.scaleFrom=e.from;d.scaleTo=e.to}d.loadedDataFrom=e.from;d.loadedDataTo=e.to;d.data={entries:i.entries,accessibility:i.accessibility};d.focusSelector=e.focusSelector==undefined?false:e.focusSelector;t.refreshPlannerState(d)}else if(!r&&t.plannerIsShown()){t.hidePlanner()}}})},refreshPlannerState:function(e){if(!e||typeof e!=="object")e={};this.plannerData=e.data;var t=this.calendar.util.getWorkTime(),i={changeFromFullDay:{scaleType:"1hour",timelineCellWidth:40},shownScaleTimeFrom:t.start,shownScaleTimeTo:t.end,width:this.plannerWrap.offsetWidth||400,minWidth:this.plannerWrap.offsetWidth||400,entriesListWidth:50,showEntiesHeader:false,showEntryName:false},a=this.plannerIsShown();if(e.focusSelector==undefined){e.focusSelector=true}if(!a&&!e.data){this.checkPlannerState()}else{if(e.show){BX.addClass(this.plannerWrap,"calendar-add-popup-show-planner");this.meetingOptionsWrap.style.display="";if(!a&&e.show){e.focusSelector=true}}var n=this.calendar.util.parseTime(this.dateTimeField.fromTimeInput.value),s=this.calendar.util.parseTime(this.dateTimeField.toTimeInput.value),l=new Date(this.entryTime.from.getTime()),r=new Date(this.entryTime.from.getTime());l.setHours(n.h,n.m,0);r.setHours(s.h,s.m,0);BX.onCustomEvent("OnCalendarPlannerDoUpdate",[{plannerId:this.plannerId,config:i,focusSelector:e.focusSelector,selector:{from:l,to:r,fullDay:false,animation:true,updateScaleLimits:true},data:e.data||false,loadedDataFrom:e.loadedDataFrom,loadedDataTo:e.loadedDataTo,show:!!e.show}])}},getBusyUserList:function(){var e,t=[];if(this.plannerData){for(e in this.plannerData.entries){if(this.plannerData.entries.hasOwnProperty(e)&&this.plannerData.entries[e].id&&this.plannerData.entries[e].status!=="h"&&parseInt(this.plannerData.entries[e].strictStatus)&&!this.plannerData.entries[e].currentStatus){t.push(this.plannerData.entries[e])}}}return t},hidePlanner:function(){this.meetingOptionsWrap.style.display="none";this.plannerWrap.style.opacity=0;this.plannerWrap.style.height=0;this.plannerWrap.style.overflow="hidden";BX.removeClass(this.plannerWrap,"calendar-add-popup-show-planner")},keyHandler:function(e){if(e.keyCode===this.calendar.util.KEY_CODES["enter"]){this.save()}else if(e.keyCode===this.calendar.util.KEY_CODES["escape"]&&this.couldBeClosedByEsc()){this.close()}},checkBeforeClose:function(){var e=this.getPopupData();return!(this.params.entryName!==e.name||e.location||this.initiateAttendees.join(",")!==e.attendees.join(",")||this.initiateTimeFrom!==this.dateTimeField.fromTimeInput.value||this.initiateTimeTo!==this.dateTimeField.toTimeInput.value)}};if(e.BXEventCalendar){e.BXEventCalendar.SimpleAddPopup=t}else{BX.addCustomEvent(e,"onBXEventCalendarInit",function(){e.BXEventCalendar.SimpleAddPopup=t})}})(window);
  //# sourceMappingURL=calendar-simple-popup.map.js