AnonSec Shell
Server IP : 85.193.89.191  /  Your IP : 3.17.75.190
Web Server : Apache
System : Linux 956367-cx40159.tmweb.ru 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64
User : bitrix ( 600)
PHP Version : 8.1.27
Disable Function : NONE
MySQL : OFF  |  cURL : OFF  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/bitrix/www/bitrix/js/calendar/planner/dist/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/bitrix/www/bitrix/js/calendar/planner/dist/planner.bundle.min.js
this.BX=this.BX||{};(function(e,t,i,s,a,n){"use strict";let r=e=>e,o,l,h,c,d;class m extends t.EventEmitter{constructor(e={}){super();this.DOM={};this.selectMode=false;this.currentDateFrom=new Date;this.currentDateTo=new Date;this.currentFullDay=false;this.useAnimation=true;this.beforeBeginChange=false;this.setEventNamespace("BX.Calendar.Planner.Selector");this.getPosByDate=e.getPosByDate;this.getDateByPos=e.getDateByPos;this.getPosDateMap=e.getPosDateMap;this.getTimelineWidth=e.getTimelineWidth;this.getScaleInfo=e.getScaleInfo;this.solidStatus=e.solidStatus;this.eventDragAndDrop=new a.EventDragAndDrop(e.getDateByPos,e.getPosByDate,e.getEvents);this.useAnimation=e.useAnimation!==false;this.render()}render(){this.DOM.timeNodes={};this.DOM.timeWrap=s.Tag.render(o||(o=r`
			<div></div>
		`));this.DOM.wrap=s.Tag.render(l||(l=r`
			<div class="calendar-planner-timeline-selector" data-bx-planner-meta="selector">
				<span data-bx-planner-meta="selector-resize-left" class="calendar-planner-timeline-drag-left"></span>
				<span class="calendar-planner-timeline-selector-grip"></span>
				<span data-bx-planner-meta="selector-resize-right" class="calendar-planner-timeline-drag-right"></span>
				${0}
				<div class="calendar-planner-timeline-selector-background"></div>
				${0}
			</div>
		`),this.DOM.timeWrap,this.renderMoreButton());this.DOM.wrap.ondrag=BX.False;this.DOM.wrap.ondragstart=BX.False;this.DOM.titleNode=s.Tag.render(h||(h=r`<div class="calendar-planner-selector-notice" style="display: none"></div>`))}renderMoreButton(){this.DOM.moreButton=s.Tag.render(c||(c=r`
			<div class="calendar-planner-timeline-selector-more-button" style="display: none;"></div>
		`));return this.DOM.moreButton}shake(){const e="calendar-planner-selector-shake";s.Dom.addClass(this.DOM.wrap,e);clearTimeout(this.shakeTimeout);this.shakeTimeout=setTimeout((()=>s.Dom.removeClass(this.DOM.wrap,e)),400)}clearTimeNodes(){for(const e in this.DOM.timeNodes){this.destroyTimeNode(e)}}showTimeNode(e,t,i,a=false){this.destroyTimeNode(e);const n=a?"--warning":"";this.DOM.timeNodes[e]=s.Tag.render(d||(d=r`
			<div class="calendar-planner-timeline-side-notice --left ${0}" style="top: ${0}px" title="${0}">${0}</div>
		`),n,e,i,t);this.DOM.timeWrap.append(this.DOM.timeNodes[e])}destroyTimeNode(e){if(s.Type.isElementNode(this.DOM.timeNodes[e])){this.DOM.timeNodes[e].remove();this.DOM.timeNodes[e]=null}}getWrap(){return this.DOM.wrap}getTitleNode(){return this.DOM.titleNode}update(e={}){if(!s.Type.isPlainObject(e)){e={}}e.updateScaleType=!!e.updateScaleType;e.updateScaleLimits=!!e.updateScaleLimits;e.animation=!!e.animation;let t=s.Type.isDate(e.from)?e.from:BX.parseDate(e.from)||this.currentDateFrom;let i=s.Type.isDate(e.to)?e.to:BX.parseDate(e.to)||this.currentDateTo;this.fullDayMode=e.fullDay!==undefined?e.fullDay:this.currentFullDay;if(s.Type.isDate(t)&&s.Type.isDate(i)){this.currentFullDay=this.fullDayMode;if(this.fullDayMode){t.setHours(0,0,0,0);const e=Math.ceil((i.getTime()-t.getTime()+1)/(1e3*3600*24));i=new Date(t.getTime()+(e-1)*24*3600*1e3);i.setHours(23,55,0,0)}this.boundaryFrom=t;this.currentDateFrom=t;this.currentDateTo=i;this.show(t,i,{animation:e.animation,focus:e.focus})}const a=this.currentDateTo.getTime()<this.getScaleInfo().scaleDateFrom.getTime();const n=this.currentDateFrom.getTime()>this.getScaleInfo().scaleDateTo.getTime();if(a||n){this.DOM.wrap.style.display="none"}}show(e,t,i){const a=i.animation&&this.useAnimation!==false;const n=i.focus===true;const r=i.alignCenter!==false;this.DOM.wrap.style.display="block";if(s.Type.isDate(e)&&s.Type.isDate(t)){let i=this.getPosByDate(e),s=this.getPosByDate(t);this.DOM.wrap.style.width=s-i+"px";if(a&&this.DOM.wrap.style.left&&!this.currentFullDay){this.transit({toX:i,focus:n})}else{this.DOM.wrap.style.left=i+"px";this.DOM.wrap.style.width=s-i+"px";if(n){this.focus(true,200,r)}this.checkStatus(i,true)}}}hide(){this.DOM.wrap.style.display="none"}startMove(){document.addEventListener("pointermove",this.preventDefault,{passive:false});this.selectorIsDraged=true;this.selectorStartLeft=parseInt(this.DOM.wrap.style.left);this.selectorStartScrollLeft=this.DOM.timelineWrap.scrollLeft;this.eventDragAndDrop.onDragStart(this.currentDateTo.getTime()-this.currentDateFrom.getTime(),this.selectorStartLeft);s.Dom.addClass(document.body,"calendar-planner-unselectable");this.beforeBeginChange=true}move(e){if(this.selectorIsDraged){let t=this.selectorStartLeft+e;t-=this.selectorStartScrollLeft-this.DOM.timelineWrap.scrollLeft;t=this.checkPosition(t);if(!this.getDateByPos(t)||!this.getDateByPos(t+parseInt(this.DOM.wrap.style.width))){return}let i=this.eventDragAndDrop.getDragBoundary(t);const s=i.from.getTime()!==this.boundaryFrom.getTime();if(s&&this.beforeBeginChange){this.emit("onBeginChange");this.beforeBeginChange=false}i=this.getAutoScrollBoundary(i,s);i=this.getConstrainedBoundary(i);this.setBoundary(i)}}getAutoScrollBoundary(e,t){const i=e.position-this.DOM.timelineWrap.scrollLeft;const s=this.getPosByDate(this.getScaleInfo().scaleDateFrom);const a=i+e.size;const n=this.DOM.timelineFixedWrap.offsetWidth;if(a>n){this.scrollSpeed=this.getSpeed(a,n);e.position=n+this.DOM.timelineWrap.scrollLeft-e.size;this.setAutoScrollInterval(e,1)}else if(i<s){this.scrollSpeed=this.getSpeed(i,s);e.position=s+this.DOM.timelineWrap.scrollLeft;this.setAutoScrollInterval(e,-1)}else{this.stopAutoScroll(t)}return e}getSpeed(e,t){return Math.floor(Math.sqrt(Math.abs(e-t)))+1}setAutoScrollInterval(e,t){if(!this.scrollInterval){this.scrollInterval=setInterval((()=>{if(!this.getDateByPos(e.position+this.scrollSpeed*t)||!this.getDateByPos(e.position+e.size+this.scrollSpeed*t)){this.stopAutoScroll();return}this.DOM.timelineWrap.scrollLeft+=this.scrollSpeed*t;e.position+=this.scrollSpeed*t;e.from=this.getDateByPos(e.position);e.to=this.getDateByPos(e.position+e.size);this.eventDragAndDrop.setFinalTimeInterval(e.from,e.to);this.setBoundary(e)}),13)}}stopAutoScroll(e=true){clearInterval(this.scrollInterval);this.scrollInterval=false;if(e||!this.beforeBeginChange){this.emit("onStopAutoScroll")}}setBoundary(e){if(e.wasMagnetized){this.DOM.wrap.style.transition="left .05s, width .1s"}else{this.DOM.wrap.style.transition="width .1s"}this.DOM.wrap.style.width=e.size+"px";this.DOM.wrap.style.left=e.position+"px";this.showTitle(e.from,e.to);this.checkStatus(e.position,true);this.boundaryFrom=e.from}getConstrainedBoundary(e){if(e.wasMagnetized||this.fullDayMode){return e}let t=new Date(e.from.getTime());let i=new Date(e.to.getTime());const s=i.getTime()-t.getTime();let a=e.position;let n=e.size;let r=false;if(t.getHours()<this.getScaleInfo().shownTimeFrom){t.setHours(this.getScaleInfo().shownTimeFrom,0,0,0);i=new Date(t.getTime()+s);r=true;a=this.getPosByDate(t);n=this.getPosByDate(i)-a}if(i.getHours()>this.getScaleInfo().shownTimeTo||i.getHours()===this.getScaleInfo().shownTimeTo&&i.getMinutes()>0){i.setHours(this.getScaleInfo().shownTimeTo,0,0,0);t=new Date(i.getTime()-s);r=true;a=this.getPosByDate(t);n=this.getPosByDate(i)-a}return{from:t,to:i,position:a,size:n,wasMagnetized:r}}endMove(){document.removeEventListener("pointermove",this.preventDefault,{passive:false});this.stopAutoScroll();if(this.selectorIsDraged){this.selectorIsDraged=false;const e=this.getPosByDate(this.eventDragAndDrop.getFinalFrom());const t=this.getPosByDate(this.eventDragAndDrop.getFinalTo());const i=this.getConstrainedBoundary({from:this.eventDragAndDrop.getFinalFrom(),to:this.eventDragAndDrop.getFinalTo(),position:e,size:t-e});this.DOM.wrap.style.left=i.position+"px";this.DOM.wrap.style.width=i.size+"px";this.DOM.wrap.style.transition="none";this.checkStatus(e,true);this.hideTitle();this.setValue()}this.selectorIsDraged=false}startResize(){document.addEventListener("pointermove",this.preventDefault,{passive:false});this.selectorIsResized=true;this.selectorStartLeft=parseInt(this.DOM.wrap.style.left);this.selectorStartWidth=parseInt(this.DOM.wrap.style.width);this.selectorStartScrollLeft=this.DOM.timelineWrap.scrollLeft;this.beforeBeginChange=true}resize(e){if(this.selectorIsResized){let t,s,a=this.selectorStartWidth+e;a-=this.selectorStartScrollLeft-this.DOM.timelineWrap.scrollLeft;let n=Math.min(this.selectorStartLeft+a,this.getTimelineWidth());if(n<this.selectorStartLeft){n=this.selectorStartLeft}t=this.getDateByPos(n,true);if(this.fullDayMode){if(t.getTime()-this.currentDateFrom.getTime()<i.Util.getDayLength()){t=new Date(this.currentDateFrom.getTime()+i.Util.getDayLength())}s=parseInt(t.getHours())+Math.round(t.getMinutes()/60*10)/10;t.setHours(0,0,0,0);if(s>12){t=new Date(t.getTime()+i.Util.getDayLength());t.setHours(0,0,0,0)}n=this.getPosByDate(t)}else if(this.getScaleInfo().shownTimeFrom!==0||this.getScaleInfo().shownTimeTo!==24){let e=this.getDateByPos(this.selectorStartLeft);if(t&&e&&e.getDate()!==t.getDate()){t=new Date(e.getTime());t.setHours(this.getScaleInfo().shownTimeTo,0,0,0);n=this.getPosByDate(t)}}if(this.getPosDateMap()[n]){this.selectorRoundedRightPos=n}else{let e=m.roundPos(n);if(this.getPosDateMap()[e]){this.selectorRoundedRightPos=e}}if(this.selectorRoundedRightPos<this.selectorStartLeft){this.selectorRoundedRightPos=this.selectorStartLeft}if(!this.fullDayMode&&this.selectorRoundedRightPos-this.DOM.timelineWrap.scrollLeft>this.DOM.timelineFixedWrap.offsetWidth){this.selectorRoundedRightPos=this.DOM.timelineWrap.scrollLeft+this.DOM.timelineFixedWrap.offsetWidth}a=this.selectorRoundedRightPos-this.selectorStartLeft;this.DOM.wrap.style.width=a+"px";this.showTitle(this.getDateByPos(this.selectorStartLeft),this.getDateByPos(this.selectorRoundedRightPos));this.checkStatus(this.selectorStartLeft,true);if(this.beforeBeginChange){this.emit("onBeginChange");this.beforeBeginChange=false}}}endResize(){document.removeEventListener("pointermove",this.preventDefault,{passive:false});if(this.selectorIsResized){this.selectorIsResized=false;let e=parseInt(this.DOM.wrap.style.left);let t=e+parseInt(this.DOM.wrap.style.width);const i=this.getDateByPos(e);const s=this.getDateByPos(t);e=this.getPosByDate(i);t=this.getPosByDate(s);this.DOM.wrap.style.width=t-e+"px";this.checkStatus(e,true);this.hideTitle();this.setValue()}this.selectorIsResized=false}preventDefault(e){e.preventDefault()}isDragged(){return this.selectorIsResized||this.selectorIsDraged}checkStatus(e,i){if(this.solidStatus){s.Dom.removeClass(this.DOM.wrap,"calendar-planner-timeline-selector-warning");s.Dom.removeClass(this.mainContWrap,"calendar-planner-selector-warning");s.Dom.addClass(this.DOM.wrap,"solid")}else{if(!e){e=m.roundPos(this.DOM.wrap.style.left)}let s,a;if(i===true||!this.currentDateFrom){let t=parseInt(this.DOM.wrap.style.width),i=e,n=i+t;if(!i&&!n&&!t&&this.lastFromDate){s=this.lastFromDate;a=this.lastToDate}else{s=this.getDateByPos(i);a=this.getDateByPos(n,true);this.lastFromDate=s;this.lastToDate=a}}else{s=this.currentDateFrom;a=this.currentDateTo}this.emit("doCheckStatus",new t.BaseEvent({data:{dateFrom:s,dateTo:a}}))}}setSelectorStatus(e){this.selectorIsFree=e;if(this.selectorIsFree){s.Dom.removeClass(this.DOM.wrap,"calendar-planner-timeline-selector-warning")}else{s.Dom.addClass(this.DOM.wrap,"calendar-planner-timeline-selector-warning")}}setValue(e=null,i=null){if(!e){e=parseInt(this.DOM.wrap.style.left)}e=Math.max(0,e);const s=parseInt(this.DOM.wrap.style.width);if(e+s>parseInt(this.getTimelineWidth())){e=parseInt(this.getTimelineWidth())-s}const a=this.getDateByPos(e);let n;if(i){n=new Date(a.getTime()+i)}else{n=this.getDateByPos(e+s,true)}if(a&&n){if(this.fullDayMode){const e=Math.ceil((n.getTime()-a.getTime())/(1e3*3600*24));n=new Date(a.getTime()+(e-1)*24*3600*1e3);n.setHours(23,55,0,0)}if(!this.fullDayMode&&a.getDate()!==n.getDate()&&n.getHours()!==0&&n.getMinutes()!==0){const e=this.currentDateTo.getTime()-this.currentDateFrom.getTime();n=new Date(a.getTime()+e)}this.currentDateFrom=a;this.currentDateTo=n;this.currentFullDay=this.fullDayMode;this.boundaryFrom=this.currentDateFrom;this.emit("onChange",new t.BaseEvent({data:{dateFrom:a,dateTo:n,fullDay:this.fullDayMode}}))}}checkPosition(e,t,s){let a=this.getScaleInfo();if(!this.fullDayMode&&a.shownTimeFrom===0&&a.shownTimeTo===24){return e}e=e||parseInt(this.DOM.wrap.style.left);t=t||parseInt(this.DOM.wrap.style.width);s=s||e+t;if(s>parseInt(this.getTimelineWidth())){e=parseInt(this.getTimelineWidth())-t}else{let n=this.getDateByPos(e),r=this.getDateByPos(s,true),o,l,h=parseInt(a.shownTimeFrom),c=parseInt(a.shownTimeTo);if(n&&r){if(this.fullDayMode){if(n.getHours()>12){n=new Date(n.getTime()+i.Util.getDayLength())}n.setHours(0,0,0,0);e=this.getPosByDate(n)}else if(n.getDay()!==r.getDay()){o=parseInt(n.getHours())+Math.round(n.getMinutes()/60*10)/10;l=parseInt(r.getHours())+Math.round(r.getMinutes()/60*10)/10;if(Math.abs(c-o)>Math.abs(h-l)){n.setHours(a.shownTimeTo,0,0,0);e=this.getPosByDate(n)-t}else{r.setHours(a.shownTimeFrom,0,0,0);e=this.getPosByDate(r)}}}}return Math.max(e,0)}transit(e={}){var t,i;this.DOM.wrap.style.display="block";let a;if(s.Type.isDate(e.leftDate)&&s.Type.isDate(e.rightDate)){if(this.fullDayMode){const t=Math.ceil((this.currentDateTo.getTime()-this.currentDateFrom.getTime())/(1e3*3600*24));e.leftDate.setHours(0,0,0,0);e.rightDate=new Date(e.leftDate.getTime()+(t-1)*24*3600*1e3);e.rightDate.setHours(23,55,0,0)}a=e.rightDate.getTime()-e.leftDate.getTime();const t=this.getPosByDate(e.leftDate);const i=this.getPosByDate(e.rightDate);e.toX=t;this.DOM.wrap.style.width=i-t+"px"}let n=(t=e.fromX)!=null?t:parseInt(this.DOM.wrap.style.left),r=m.roundPos((i=e.toX)!=null?i:n),o=e.triggerChangeEvents!==false,l=!!e.focus;if(n!==r){if(this.animation){this.animation.stop()}this.emit("onStartTransit");this.animation=new BX.easing({duration:300,start:{left:n},finish:{left:r},transition:BX.easing.makeEaseOut(BX.easing.transitions.quart),step:e=>{this.DOM.wrap.style.left=e.left+"px"},complete:()=>{this.animation=null;let e=parseInt(this.DOM.wrap.style.left),t=this.checkPosition(e);if(t!==e){this.DOM.wrap.style.left=t+"px"}if(o){this.setValue(t,a)}if(l){this.focus(true,300)}setTimeout((()=>{this.show(this.currentDateFrom,this.currentDateTo,{animation:false,focus:l,alignCenter:false})}),200);this.checkStatus(t)}});this.animation.animate()}else{if(o){this.setValue(false,a)}if(l===true){this.focus(true,300)}this.checkStatus()}}showTitle(e,t){let s=new Date(e.getTime()),a=new Date(t.getTime()),n=this.getTitleNode(),r=this.DOM.wrap;if(this.fullDayMode){a=new Date(a.getTime()-5*60*1e3);if(a.getDate()===s.getDate()){n.innerHTML=BX.date.format("d F, D",s.getTime()/1e3)}else{n.innerHTML=BX.date.format("d F",s.getTime()/1e3)+" - "+BX.date.format("d F",a.getTime()/1e3)}}else{n.removeAttribute("style");n.innerHTML=i.Util.formatTime(s)+" - "+i.Util.formatTime(a)}r.appendChild(n);if(n===this.selectorTitle){if(n.style.display==="none"||this.selectorHideTimeout){this.selectorHideTimeout=clearTimeout(this.selectorHideTimeout);this.selectorTitle.style.display="";this.selectorTitle.style.opacity=0;new BX.easing({duration:400,start:{opacity:0},finish:{opacity:100},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:e=>{this.selectorTitle.style.opacity=e.opacity/100},complete:()=>{this.selectorTitle.removeAttribute("style")}}).animate()}}else{n.removeAttribute("style")}}hideTitle(e={}){if(!s.Type.isPlainObject(e))e={};let t=e.selectorIndex===undefined?"selectorHideTimeout":"selectorHideTimeout_"+e.selectorIndex,i=e.selectorTitle||this.getTitleNode();if(this[t])this[t]=clearTimeout(this[t]);if(e.timeout!==false){this[t]=setTimeout((()=>{e.timeout=false;this.hideTitle(e)}),700)}else{i.style.display="";i.style.opacity=1;new BX.easing({duration:400,start:{opacity:100},finish:{opacity:0},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:e=>{i.style.opacity=e.opacity/100},complete:()=>{i.removeAttribute("style");i.style.display="none"}}).animate()}}static roundPos(e){return Math.round(parseFloat(e))}focus(e=true,t=300,i){i=i===true;if(this.focusTimeout){this.focusTimeout=!!clearTimeout(this.focusTimeout)}if(this.useAnimation===false){e=false}if(t){this.focusTimeout=setTimeout((()=>{this.focus(e,false,i)}),t)}else{const t=10,s=parseInt(this.DOM.wrap.style.left),a=parseInt(this.DOM.wrap.style.width),n=parseInt(this.DOM.timelineWrap.offsetWidth),r=parseInt(this.DOM.timelineWrap.scrollLeft),o=r+n;let l=r;if(s<r+t||s>o-t||i){if(a<=n){l=Math.max(Math.round(s-(n-a)/2),t)}else{l=Math.max(Math.round(s-t),t)}}if(l!==r){if(e===false){this.DOM.timelineWrap.scrollLeft=l}else{new BX.easing({duration:300,start:{scrollLeft:this.DOM.timelineWrap.scrollLeft},finish:{scrollLeft:l},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:e=>{this.DOM.timelineWrap.scrollLeft=e.scrollLeft},complete:()=>{}}).animate()}}}}getDuration(){let e=Math.round((this.currentDateTo-this.currentDateFrom)/1e3)*1e3;if(this.fullDayMode){e+=i.Util.getDayLength()}return e}getDateFrom(){return this.currentDateFrom}getDateTo(){return this.currentDateTo}}let p=e=>e,u,D,f,T,g,y,M,O,w,S,W,v,L,C,B,E,F,b,P,N,x,I,A,H,_,R,k,z,U,$,X,V,Y,j,q,K,Z,G,J,Q,ee,te,ie,se,ae,ne,re,oe,le,he,ce,de,me,pe;class ue extends t.EventEmitter{constructor(e={}){super();this.DOM={};this.config={};this.entryStatusMap={h:"user-status-h",y:"user-status-y",q:"user-status-q",n:"user-status-n",tzAll:"user-status-different-timezone"};this.scaleTypes=["15min","30min","1hour","2hour","1day"];this.savedScaleType=null;this.SCALE_OFFSET_BEFORE=0;this.SCALE_OFFSET_AFTER=13;this.EXPAND_OFFSET=3;this.EXPAND_DELAY=2e3;this.REBUILD_DELAY=100;this.maxTimelineSize=300;this.initialMinEntryRows=3;this.MIN_ENTRY_ROWS=this.initialMinEntryRows;this.MAX_ENTRY_ROWS=300;this.width=700;this.height=84;this.minWidth=700;this.minHeight=84;this.workTime=[8,18];this.warningHoursFrom=9;this.warningHoursTo=18;this.scrollStep=10;this.shown=false;this.built=false;this.locked=false;this.shownScaleTimeFrom=24;this.shownScaleTimeTo=0;this.timelineCellWidthOrig=false;this.proposeTimeLimit=14;this.expandTimelineDelay=600;this.limitScaleSizeMode=false;this.useAnimation=true;this.checkTimeCache={};this.entriesIndex=new Map;this.solidStatus=false;this.setEventNamespace("BX.Calendar.Planner");this.config=e;this.id=e.id;this.dayOfWeekMonthFormat=e.dayOfWeekMonthFormat||"d F, l";this.userId=parseInt(e.userId||s.Loc.getMessage("USER_ID"));this.DOM.wrap=e.wrap;this.SCALE_TIME_FORMAT=BX.isAmPmMode()?"g a":"G";this.userTimezone=i.Util.getUserSettings().timezoneName;this.currentTimezone=s.Type.isStringFilled(e.entryTimezone)?e.entryTimezone:this.userTimezone;this.expandTimelineDebounce=s.Runtime.debounce(this.expandTimeline,this.EXPAND_DELAY,this);this.showMoreUsersBind=this.showMoreUsers.bind(this);this.hideMoreUsersBind=this.hideMoreUsers.bind(this);this.setConfig(e)}show(){if(this.currentFromDate&&this.currentToDate){const e=this.currentFromDate.getHours();const t=this.currentToDate.getHours()+Math.ceil(this.currentToDate.getMinutes()/60);this.extendScaleTimeLimits(e,t)}if(this.currentFromDate&&this.currentToDate){this.updateScaleLimitsFromEntry(this.currentFromDate,this.currentToDate)}if(this.hideAnimation){this.hideAnimation.stop();this.hideAnimation=null}if(!this.isBuilt()){this.build();this.bindEventHandlers()}else{this.resizePlannerWidth(this.width)}this.buildTimeline();this.DOM.wrap.style.display="";if(this.adjustWidth){this.resizePlannerWidth(this.DOM.timelineInnerWrap.offsetWidth)}this.selector.update({from:this.currentFromDate,to:this.currentToDate,animation:false});if(this.currentFromDate&&this.currentToDate&&this.currentFromDate.getTime()>=this.scaleDateFrom.getTime()&&this.currentToDate.getTime()<=this.scaleDateTo.getTime()){this.selector.focus(false,0,true)}if(this.readonly){s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-readonly")}else{s.Dom.removeClass(this.DOM.mainWrap,"calendar-planner-readonly")}if(this.compactMode){s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-compact")}else{s.Dom.removeClass(this.DOM.mainWrap,"calendar-planner-compact")}this.DOM.entriesOuterWrap.style.display=this.compactMode?"none":"";{if(parseInt(this.DOM.wrap.style.height)<this.height){this.DOM.wrap.style.height=this.height+"px"}this.adjustHeight()}this.shown=true}setConfig(e){var t,a,n,r;this.todayLocMessage=s.Loc.getMessage("EC_PLANNER_TODAY");this.setScaleType(e.scaleType);if(e.showTimelineDayTitle!==undefined){this.showTimelineDayTitle=!!e.showTimelineDayTitle}else if(this.showTimelineDayTitle===undefined){this.showTimelineDayTitle=true}if(e.compactMode!==undefined){this.compactMode=!!e.compactMode}else if(this.compactMode===undefined){this.compactMode=false}if(e.readonly!==undefined){this.readonly=!!e.readonly}else if(this.readonly===undefined){this.readonly=false}if(this.compactMode){let e=50;if(this.showTimelineDayTitle&&!this.isOneDayScale())e+=20;this.height=this.minHeight=e}if(s.Type.isInteger(e.SCALE_OFFSET_BEFORE)){this.SCALE_OFFSET_BEFORE=parseInt(e.SCALE_OFFSET_BEFORE)}if(s.Type.isInteger(e.SCALE_OFFSET_AFTER)){this.SCALE_OFFSET_AFTER=parseInt(e.SCALE_OFFSET_AFTER)}if(s.Type.isInteger(e.maxTimelineSize)){this.maxTimelineSize=parseInt(e.maxTimelineSize)}if(s.Type.isInteger(e.minEntryRows)){this.MIN_ENTRY_ROWS=parseInt(e.minEntryRows)}if(s.Type.isInteger(e.maxEntryRows)){this.MAX_ENTRY_ROWS=parseInt(e.maxEntryRows)}if(s.Type.isInteger(e.width)){this.width=parseInt(e.width)}if(s.Type.isInteger(e.height)){this.height=parseInt(e.height)}if(s.Type.isInteger(e.minWidth)){this.minWidth=parseInt(e.minWidth)}if(s.Type.isInteger(e.minHeight)){this.minHeight=parseInt(e.minHeight)}this.width=Math.max(this.minWidth,this.width);this.height=Math.max(this.minHeight,this.height);if(s.Type.isArray(e.workTime)){this.workTime=e.workTime}this.extendScaleTime(this.workTime[0],this.workTime[1]);this.weekHolidays=e.weekHolidays||this.weekHolidays||[];this.yearHolidays=e.yearHolidays||this.yearHolidays||[];this.accuracy=e.accuracy||this.accuracy||300;this.clickSelectorScaleAccuracy=e.clickSelectorScaleAccuracy||this.accuracy;this.selectorAccuracy=parseInt(e.selectorAccuracy)||this.selectorAccuracy||300;this.entriesListWidth=parseInt(e.entriesListWidth)||this.entriesListWidth||200;this.timelineCellWidth=e.timelineCellWidth||this.timelineCellWidth||40;this.solidStatus=e.solidStatus===true;this.showEntiesHeader=e.showEntiesHeader===undefined?true:!!e.showEntiesHeader;this.showEntryName=e.showEntryName===undefined?true:!!e.showEntryName;if(this.isOneDayScale()&&this.timelineCellWidth<100){this.timelineCellWidthOrig=this.timelineCellWidth;this.timelineCellWidth=100}else if(this.timelineCellWidthOrig&&!this.isOneDayScale()){this.timelineCellWidth=this.timelineCellWidthOrig;this.timelineCellWidthOrig=false}if(this.allowAdjustCellWidth===undefined||e.allowAdjustCellWidth!==undefined){this.allowAdjustCellWidth=this.readonly&&this.compactMode&&e.allowAdjustCellWidth!==false}if(e.locked!==undefined){this.locked=e.locked}this.adjustCellWidth();this.setScaleLimits(e.scaleDateFrom,e.scaleDateTo);const o=(t=(a=i.Util.config)==null?void 0:a.work_time_start)!=null?t:9;const l=(n=(r=i.Util.config)==null?void 0:r.work_time_end)!=null?n:18;const h=(new Date).toDateString();const c=new Date(`${h} ${`${o}`.replace(".",":")}:00`);const d=new Date(`${h} ${`${l}`.replace(".",":")}:00`);this.warningHoursFrom=this.getDateHours(c);this.warningHoursTo=this.getDateHours(d)}updateScaleLimitsFromEntry(e,t){if(e.getTime()>this.scaleDateTo.getTime()||t.getTime()<this.scaleDateFrom.getTime()){this.setScaleLimits(new Date(e.getTime()),new Date(t.getTime()+i.Util.getDayLength()*this.SCALE_OFFSET_AFTER))}}setScaleLimits(e,t){if(e!==undefined){this.scaleDateFrom=s.Type.isDate(e)?e:i.Util.parseDate(e)}if(!s.Type.isDate(this.scaleDateFrom)){if(this.compactMode&&this.readonly){this.scaleDateFrom=new Date}else{this.scaleDateFrom=new Date((new Date).getTime()-i.Util.getDayLength()*this.SCALE_OFFSET_BEFORE)}}this.scaleDateFrom.setHours(this.isOneDayScale()?0:this.shownScaleTimeFrom,0,0,0);if(t!==undefined){this.scaleDateTo=BX.type.isString(t)?i.Util.parseDate(t):t}if(!s.Type.isDate(this.scaleDateTo)){if(this.compactMode&&this.readonly){this.scaleDateTo=new Date}else{this.scaleDateTo=new Date((new Date).getTime()+i.Util.getDayLength()*this.SCALE_OFFSET_AFTER)}}this.scaleDateTo.setHours(this.isOneDayScale()?0:this.shownScaleTimeTo,0,0,0)}extendScaleTimeLimits(e,t){if(e!==false&&!isNaN(parseInt(e))){this.shownScaleTimeFrom=Math.min(parseInt(e),this.shownScaleTimeFrom,23);this.shownScaleTimeFrom=Math.max(this.shownScaleTimeFrom,0);if(this.scaleDateFrom){this.scaleDateFrom.setHours(this.shownScaleTimeFrom,0,0,0)}}if(t!==false&&!isNaN(parseInt(t))){this.shownScaleTimeTo=Math.max(parseInt(t),this.shownScaleTimeTo,1);this.shownScaleTimeTo=Math.min(this.shownScaleTimeTo,24);if(this.scaleDateTo){this.scaleDateTo.setHours(this.shownScaleTimeTo,0,0,0)}}if(this.shownScaleTimeFrom%2!==0){this.shownScaleTimeFrom--}if(this.shownScaleTimeTo%2!==0){this.shownScaleTimeTo++}}SetLoadedDataLimits(e,t){if(e){this.loadedDataFrom=e.getTime?e:i.Util.parseDate(e)}if(t){this.loadedDataTo=t.getTime?t:i.Util.parseDate(t)}}extendScaleTime(e,t){const i=this.shownScaleTimeFrom;const s=this.shownScaleTimeTo;this.extendScaleTimeLimits(e,t);if(e===false&&t!==false){setTimeout((()=>{this.extendTimelineToRight(s,this.shownScaleTimeTo)}),200)}if(e!==false&&t===false){setTimeout((()=>{this.extendTimelineToLeft(this.shownScaleTimeFrom,i)}),200)}if(e!==false&&t!==false){this.rebuildDebounce()}}adjustCellWidth(){if(this.allowAdjustCellWidth){this.timelineCellWidth=Math.round(this.width/((this.shownScaleTimeTo-this.shownScaleTimeFrom)*3600/this.scaleSize))}}build(){this.DOM.wrap.style.width=this.width+"px";this.DOM.wrap.append(this.render());if(this.isLocked()){this.lock()}this.built=true;window.plannerr=this}render(){this.selector=this.createSelector();this.DOM.mainWrap=s.Tag.render(u||(u=p`
			<div
				class="calendar-planner-main-container calendar-planner-main-container-resource"
				style="
					min-height: ${0}px;
					height: ${0}px;
					width: ${0}px;
				"
			>
				${0}
				${0}
				${0}
				${0}
				${0}
				${0}
			</div>
		`),this.minHeight,this.height,this.width,this.renderEntriesOuterWrap(),this.renderTimelineFixedWrap(),this.renderSelectorPopup(),this.renderTimezoneNoticeCount(),this.selector.getTitleNode(),this.renderSettingsButton());this.selector.DOM.timelineFixedWrap=this.DOM.timelineFixedWrap;this.selector.DOM.timelineWrap=this.DOM.timelineVerticalConstraint;if(!this.showEntryName){this.DOM.entriesOuterWrap.style.width="55px";s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-entry-icons-only")}if(this.readonly){s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-readonly")}if(this.compactMode){s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-compact")}return this.DOM.mainWrap}createSelector(){const e=new m({getPosByDate:this.getPosByDate.bind(this),getDateByPos:this.getDateByPos.bind(this),getEvents:this.getAllEvents.bind(this),getPosDateMap:()=>this.posDateMap,useAnimation:this.useAnimation,solidStatus:this.solidStatus,getScaleInfo:()=>({scale:this.scaleType,shownTimeFrom:this.shownScaleTimeFrom,shownTimeTo:this.shownScaleTimeTo,scaleDateFrom:this.scaleDateFrom,scaleDateTo:this.scaleDateTo}),getTimelineWidth:()=>parseInt(this.DOM.timelineInnerWrap.style.width)});e.subscribe("onChange",this.handleSelectorChanges.bind(this));e.subscribe("doCheckStatus",this.doCheckSelectorStatus.bind(this));e.subscribe("onBeginChange",this.onBeginChangeHandler.bind(this));e.subscribe("onStopAutoScroll",this.onStopAutoScrollHandler.bind(this));e.subscribe("onStartTransit",this.hideTimezoneNotice.bind(this));return e}renderEntriesOuterWrap(){this.DOM.entriesOuterWrap=s.Tag.render(D||(D=p`
			<div
				class="calendar-planner-user-container"
				style="
					width: ${0}px;
					height: ${0}px;
				"
			>
				${0}
				${0}
			</div>
		`),this.entriesListWidth,this.height,this.renderEntriesListHeader(),this.renderEntriesListWrap());i.Util.preventSelection(this.DOM.entriesOuterWrap);if(this.compactMode){this.DOM.entriesOuterWrap.style.display="none"}if(this.isOneDayScale()){s.Dom.addClass(this.DOM.entriesOuterWrap,"calendar-planner-no-daytitle")}else{s.Dom.removeClass(this.DOM.entriesOuterWrap,"calendar-planner-no-daytitle")}return this.DOM.entriesOuterWrap}renderEntriesListHeader(){if(!this.showEntiesHeader){return""}return s.Tag.render(f||(f=p`
			<div class="calendar-planner-header">
				<div class="calendar-planner-general-info">
					<div class="calendar-planner-users-header">
						<span class="calendar-planner-users-item">
							${0}
							${0}
						</span>
					</div>
				</div>
			</div>
		`),s.Loc.getMessage("EC_PL_ATTENDEES_TITLE")+" ",this.renderEntriesListTitleCounter())}renderEntriesListTitleCounter(){this.entriesListTitleCounter=s.Tag.render(T||(T=p`
			<span></span>
		`));return this.entriesListTitleCounter}renderEntriesListWrap(){this.DOM.entrieListWrap=s.Tag.render(g||(g=p`
			<div
				class="calendar-planner-user-container-inner"
				style="
					width: ${0}px;
				"
			></div>
		`),this.entriesListWidth-25);return this.DOM.entrieListWrap}renderTimelineFixedWrap(){this.DOM.timelineFixedWrap=s.Tag.render(y||(y=p`
			<div class="calendar-planner-timeline-wrapper" style="height: ${0}px;">
				${0}
			</div>
		`),this.height,this.renderTimelineVerticalConstraint());return this.DOM.timelineFixedWrap}renderTimelineVerticalConstraint(){this.DOM.timelineVerticalConstraint=s.Tag.render(M||(M=p`
			<div class="calendar-planner-timeline-constraint">
				${0}
			</div>
		`),this.renderTimelineInnerWrap());if(this.isTodayButtonEnabled()){this.DOM.timelineVerticalConstraint.addEventListener("scroll",this.onScrollHandler.bind(this))}return this.DOM.timelineVerticalConstraint}renderTimelineInnerWrap(){this.DOM.timelineInnerWrap=s.Tag.render(O||(O=p`
			<div class="calendar-planner-timeline-inner-wrapper" data-bx-planner-meta="timeline">
				${0}
				${0}
			</div>
		`),this.renderTimelineScaleWrap(),this.renderTimelineDataWrap());return this.DOM.timelineInnerWrap}renderTimelineScaleWrap(){this.DOM.timelineScaleWrap=s.Tag.render(w||(w=p`
			<div class="calendar-planner-time"></div>
		`));i.Util.preventSelection(this.DOM.timelineScaleWrap);return this.DOM.timelineScaleWrap}renderTimelineDataWrap(){this.DOM.timelineDataWrap=s.Tag.render(S||(S=p`
			<div class="calendar-planner-timeline-container" style="height: ${0}px">
				${0}
				${0}
			</div>
		`),this.height,this.renderTimelineAccessibilityWrap(),this.selector.getWrap());return this.DOM.timelineDataWrap}renderTimelineAccessibilityWrap(){this.DOM.accessibilityWrap=s.Tag.render(W||(W=p`
			<div class="calendar-planner-acc-wrap"></div>
		`));return this.DOM.accessibilityWrap}renderSettingsButton(){if(this.compactMode){return""}this.DOM.settingsButton=s.Tag.render(v||(v=p`
			<div class="calendar-planner-settings-icon-container" title="${0}">
				<span class="calendar-planner-settings-title">
					${0}
				</span>
				<span class="calendar-planner-settings-icon"></span>
			</div>
		`),s.Loc.getMessage("EC_PL_SETTINGS_SCALE"),s.Loc.getMessage("EC_PL_SETTINGS_SCALE"));s.Event.bind(this.DOM.settingsButton,"click",(()=>this.showSettingsPopup()));return this.DOM.settingsButton}renderSelectorPopup(){this.DOM.selectorPopup=s.Tag.render(L||(L=p`
			<div class="calendar-planner-selector-notice-popup" style="display: none;">
				${0}
			</div>
		`),s.Loc.getMessage("EC_PLANNER_TIMEZONE_NOTICE"));s.Event.bind(this.DOM.selectorPopup,"click",(()=>this.hideSelectorPopup()));this.doShowTimezoneNoticePopup=true;return this.DOM.selectorPopup}renderTimezoneNoticeCount(){this.DOM.timezoneNoticeCount=s.Tag.render(C||(C=p`
			<div class="calendar-planner-timezone-count-notice" style="display: none;">
				${0}
			</div>
		`),this.renderTimezoneNoticeText(1));return this.DOM.timezoneNoticeCount}renderTimezoneNoticeText(e,t=false){const i=t?"--warning":"";return s.Loc.getMessage("EC_PLANNER_TIMEZONE_NOTICE_TEXT",{"#CLASS#":`calendar-planner-timezone-count-notice-text ${i}`,"#COUNT#":e})}renderVacationNode(){const e=s.Tag.render(B||(B=p`
			<div class="calendar-planner-timeline-side-notice --vacation" style="display: none;">
				${0}
			</div>
		`),s.Loc.getMessage("EC_PLANNER_IN_VACATION"));s.Event.bind(e,"mouseenter",this.showHintPopup.bind(this,e));s.Event.bind(e,"mouseleave",this.hideHintPopup.bind(this,e));return e}showHintPopup(e){e.hintPopup=s.Tag.render(E||(E=p`
			<div class="calendar-planner-selector-notice-popup --hint">
				${0}
			</div>
		`),e.dataHint);s.Event.bind(this.DOM.selectorPopup,"click",(()=>this.hideHintPopup(e)));this.DOM.entrieListWrap.style.zIndex="";this.DOM.entrieListWrap.style.overflow="";this.DOM.entrieListWrap.style.clipPath="";e.append(e.hintPopup)}hideHintPopup(e){e.hintPopup.remove()}buildTimeline(e){if(this.isBuilt()&&(this.lastTimelineKey!==this.getTimelineShownKey()||e===true)){s.Dom.clean(this.DOM.timelineScaleWrap);this.scaleData=this.getScaleData();let e,t,i=this.DOM.timelineScaleWrap;this.futureDayTitles=[];this.todayButtonPivotDay=undefined;for(let a=0;a<this.scaleData.length;a++){if(this.showTimelineDayTitle&&!this.isOneDayScale()){if(this.scaleDayTitles[this.scaleData[a].daystamp]){i=this.scaleDayTitles[this.scaleData[a].daystamp]}else{const n=new Date(this.scaleData[a].timestamp);n.setHours(0,0,0,0);const r=new Date;r.setHours(0,0,0,0);e=this.DOM.timelineScaleWrap.appendChild(s.Tag.render(F||(F=p`
							<div class="calendar-planner-time-day-outer"></div>
						`)));let o="calendar-planner-time-day-title";if(n.getTime()<r.getTime()){o+=" calendar-planner-time-day-past"}t=e.appendChild(s.Tag.render(b||(b=p`
							<div class="${0}">
								<span>${0}</span>
								<div class="calendar-planner-time-day-border"></div>
							</div>
						`),o,BX.date.format(this.dayOfWeekMonthFormat,this.scaleData[a].timestamp/1e3)));if(n.getTime()>r.getTime()){this.futureDayTitles.push(t.querySelector("span"))}if(n.getTime()===r.getTime()&&this.isTodayButtonEnabled()){this.todayTitleButton=t.firstElementChild.appendChild(s.Tag.render(P||(P=p`
								<div class="calendar-planner-today-button"></div>
							`)));this.todayTitleButton.innerHTML=this.todayLocMessage;this.todayTitleButton.addEventListener("click",this.todayButtonClickHandler.bind(this));this.todayButtonPivotDay=e}i=e.appendChild(s.Tag.render(N||(N=p`
							<div class="calendar-planner-time-day"></div>
						`)));this.scaleDayTitles[this.scaleData[a].daystamp]=i}}let n="calendar-planner-time-hour-item"+(this.scaleData[a].dayStart?" calendar-planner-day-start":"");if((this.scaleType==="15min"||this.scaleType==="30min")&&this.scaleData[a].title!==""){n+=" calendar-planner-time-hour-bold"}this.scaleData[a].cell=i.appendChild(BX.create("DIV",{props:{className:n},style:{width:this.timelineCellWidth+"px",minWidth:this.timelineCellWidth+"px"},html:this.scaleData[a].title?"<i>"+this.scaleData[a].title+"</i>":""}));if(!this.isOneDayScale()&&this.scaleData[a+1]&&this.scaleData[a+1].dayStart){i.appendChild(s.Tag.render(x||(x=p`
						<div class="calendar-planner-timeline-border"></div>
					`)))}}let a=this.mapDatePos();this.posDateMap=a.posDateMap;const n=this.DOM.timelineScaleWrap.offsetWidth;this.DOM.timelineInnerWrap.style.width=n+"px";this.DOM.entrieListWrap.style.top=parseInt(this.DOM.timelineDataWrap.offsetTop)+10+"px";this.lastTimelineKey=this.getTimelineShownKey();this.checkRebuildTimeout(n);this.buildTodayButtonWrap();this.scrollLeft=this.DOM.timelineVerticalConstraint.scrollLeft}}buildTodayButtonWrap(){if(!this.isTodayButtonEnabled()){return}if(this.todayButton){this.todayButton.remove()}if(this.todayRightButton){this.todayRightButton.remove()}if(this.DOM.todayButtonContainer){this.DOM.todayButtonContainer.remove()}if(this.isOneDayScale()){return}const e=this.DOM.entriesOuterWrap.appendChild(s.Tag.render(I||(I=p`
			<div class="calendar-planner-today-button">${0}</div>
		`),this.todayLocMessage));this.todayButtonWidth=e.offsetWidth;e.innerHTML=this.todayLocMessage+" &rarr;";this.todayButtonRightWidth=e.offsetWidth;e.innerHTML=this.todayLocMessage+" &larr;";this.todayButtonLeftWidth=e.offsetWidth;const t=BX.pos(e).top-BX.pos(this.DOM.timelineScaleWrap).top;e.remove();let i=0;if(this.todayButtonPivotDay){i=this.todayButtonPivotDay.offsetLeft+this.todayButtonPivotDay.offsetWidth-10-this.todayButtonWidth+1}const a=this.DOM.timelineScaleWrap.offsetWidth-i;this.DOM.todayButtonContainer=this.DOM.timelineScaleWrap.appendChild(s.Tag.render(A||(A=p`
			<div class="calendar-planner-today-button-container" style="width: ${0}px; left: ${0}px; top: ${0}px;"></div>
		`),a,i,t));this.todayButton=this.DOM.todayButtonContainer.appendChild(s.Tag.render(H||(H=p`
			<div class="calendar-planner-today-button" style="width: ${0}px; direction: rtl;">${0}</div>
		`),this.todayButtonWidth,this.todayLocMessage));this.todayRightButton=this.DOM.timelineVerticalConstraint.appendChild(s.Tag.render(_||(_=p`
			<div class="calendar-planner-today-button" style="right: 0; top: 5px; position: absolute;">${0}</div>
		`),this.todayLocMessage));this.todayButton.addEventListener("click",this.todayButtonClickHandler.bind(this));this.todayRightButton.addEventListener("click",this.todayButtonClickHandler.bind(this));this.updateTodayButtonVisibility(false);if(this.isLocked()&&this.DOM.todayButtonContainer){s.Dom.addClass(this.DOM.todayButtonContainer,"--lock")}}getTimelineShownKey(){return"tm_"+this.scaleDateFrom.getTime()+"_"+this.scaleDateTo.getTime()}checkRebuildTimeout(e,t=300){if(!this._checkRebuildTimeoutCount){this._checkRebuildTimeoutCount=0}if(this.rebuildTimeout){this.rebuildTimeout=!!clearTimeout(this.rebuildTimeout)}if(this._checkRebuildTimeoutCount<=10&&s.Type.isElementNode(this.DOM.timelineScaleWrap)&&s.Dom.isShown(this.DOM.timelineScaleWrap)){this._checkRebuildTimeoutCount++;this.rebuildTimeout=setTimeout((()=>{if(e!==this.DOM.timelineScaleWrap.offsetWidth){if(this.rebuildTimeout){this.rebuildTimeout=!!clearTimeout(this.rebuildTimeout)}this.rebuild();if(this.selector){this.selector.focus(true,300)}}else{this.checkRebuildTimeout(e,t)}}),t)}else{delete this._checkRebuildTimeoutCount}}rebuildDebounce(e){s.Runtime.debounce(this.rebuild,this.REBUILD_DELAY,this)(e)}extendTimelineToLeft(e,t){this.extendTimeline(e,t)}extendTimelineToRight(e,t){this.extendTimeline(e,t,true)}extendTimeline(e,t,i=false){if(!this.DOM.timelineScaleWrap){return}const s=!i;const a=this.DOM.timelineScaleWrap.querySelectorAll(".calendar-planner-time-day");const n=a.length;const r=this.scaleData.length/n;const o=t-e;let l=0;const h=[];let c=i?r-1:0;for(const t of a){const a=s?t.children[0]:t.querySelector(".calendar-planner-timeline-border");if(s){this.scaleData[c].dayStart=false}const n=this.scaleData[c].daystamp;let d,m;if(s){d=this.scaleData[c].timestamp/1e3;m=d-3600*o;if(new Date(m*1e3).getHours()!==e){return}}else{m=this.scaleData[c].timestamp/1e3+this.scaleSize;d=m+3600*o;if(new Date(m*1e3).getHours()!==e){return}}for(let e=m,r=0;e<d;e+=this.scaleSize,r++){const o=BX.date.format("i",e)==="00"?BX.date.format(this.SCALE_TIME_FORMAT,e):"";if(e<this.currentFromDate.getTime()/1e3-(s?3600*12:0)){l++}let d="expand-width-no-animation";if(s&&e>this.currentFromDate.getTime()/1e3-3600*12&&e<this.currentFromDate.getTime()/1e3+3600*12||i&&e>this.currentFromDate.getTime()/1e3&&e<this.currentFromDate.getTime()/1e3+3600*24){d="expand-width-0-40"}const m=BX.create("DIV",{props:{className:"calendar-planner-time-hour-item"+" "+d},style:{width:this.timelineCellWidth+"px",minWidth:this.timelineCellWidth+"px"},html:"<i>"+o+"</i>"});h.push(m);t.insertBefore(m,a);const p={daystamp:n,timestamp:e*1e3,value:e*1e3,title:o,dayStart:s&&r===0,cell:m};this.scaleData.splice(r+c+(i?1:0),0,p)}if(s){a.classList.remove("calendar-planner-day-start");t.children[0].classList.add("calendar-planner-day-start")}c+=r+o*3600/this.scaleSize}const d=this.DOM.timelineVerticalConstraint.scrollLeft;this.DOM.timelineVerticalConstraint.scrollLeft=d+l*this.timelineCellWidth;const m=new Date(this.currentFromDate.getTime());m.setHours(0,0,0,0);if(i){m.setDate(m.getDate()+1)}const p=this.getVisibleEvents();const u=this.getEventsAfter(p,m);this.update(this.entries,this.accessibility);new BX.easing({duration:200,start:{},finish:{},transition:BX.easing.makeEaseOut(BX.easing.transitions.linear),step:()=>{this.buildTodayButtonWrap();this.selector.update();for(const e of u){e.node.style.left=this.getPosByDate(new Date(e.fromTimestamp))+"px"}},complete:()=>{for(const e of h){e.classList.remove("expand-width-no-animation");e.classList.remove("expand-width-0-40")}this.updateTimelineAfterExtend()}}).animate()}updateTimelineAfterExtend(){let e=this.mapDatePos();this.posDateMap=e.posDateMap;const t=this.DOM.timelineScaleWrap.offsetWidth;this.DOM.timelineInnerWrap.style.width=t+"px";this.DOM.entrieListWrap.style.top=parseInt(this.DOM.timelineDataWrap.offsetTop)+10+"px";this.lastTimelineKey=this.getTimelineShownKey();this.update(this.entries,this.accessibility);this.adjustHeight();this.resizePlannerWidth(this.width);this.selector.update();this.clearCacheTime();this.buildTodayButtonWrap()}rebuild(e={}){if(this.isBuilt()){this.buildTimeline(true);this.update(this.entries,this.accessibility);this.resizePlannerWidth(this.width);if(e.updateSelector!==false){this.selector.update(e.selectorParams);if(e.dontFocus!==true){this.selector.focus(false,0,true)}}this.clearCacheTime()}}getScaleData(){this.scaleData=[];this.scaleDayTitles={};let e,t,i,s,a,n,r=false,o=this.isOneDayScale()?0:this.shownScaleTimeFrom,l=this.isOneDayScale()?0:this.shownScaleTimeTo;this.scaleDateFrom.setHours(o,0,0,0);this.scaleDateTo.setHours(l,0,0,0);t=this.scaleDateFrom.getTime();i=this.scaleDateTo.getTime();for(e=t;e<i;e+=this.scaleSize*1e3){s=parseFloat(BX.date.format("H.i",e/1e3));if(this.isOneDayScale())n=BX.date.format("d F, D",e/1e3);else n=BX.date.format("i",e/1e3)==="00"?BX.date.format(this.SCALE_TIME_FORMAT,e/1e3):"";if(this.isOneDayScale()||s>=o&&s<l){a=BX.date.format("d.m.Y",e/1e3);this.scaleData.push({daystamp:a,timestamp:e,value:e,title:n,dayStart:r!==a});r=a}}return this.scaleData}isOneDayScale(){return this.scaleType==="1day"}prepareAccessibilityItem(e){const t=i.Util.getTimeZoneOffset(this.userTimezone);const s=i.Util.getTimeZoneOffset(this.currentTimezone);const a=(t-s)*60*1e3;return ue.prepareAccessibilityItem(e,a)}static prepareAccessibilityItem(e,t=0){if(!s.Type.isDate(e.from)){e.from=i.Util.parseDate(e.dateFrom)}if(!s.Type.isDate(e.to)){e.to=i.Util.parseDate(e.dateTo)}if(!s.Type.isDate(e.from)||!s.Type.isDate(e.to)){return false}let a=new Date(e.from.getTime());let n=new Date(e.to.getTime());a.setSeconds(0,0);n.setSeconds(0,0);if(!e.isFullDay){a=new Date(a.getTime()+t);n=new Date(n.getTime()+t)}const r=a.getTime();const o=n.getTime();const l=new Date(n.getTime());const h=o;const c=e.name||e.title;const d=e.isVacation?"hr":"event";e.fromTimestamp=r;e.toTimestamp=o;e.toTimestampReal=o;return{from:a,to:n,fromTimestamp:r,toTimestamp:o,toReal:l,toTimestampReal:h,name:c,type:d}}addAccessibilityItem(e,t){let s,a,n=false,r=e.fromTimestamp,o=e.toTimestampReal||e.toTimestamp,l=this.isOneDayScale()?0:this.shownScaleTimeFrom,h=this.isOneDayScale()?24:this.shownScaleTimeTo,c=new Date(r),d=new Date(o);s=parseInt(c.getHours())+c.getMinutes()/60;a=parseInt(d.getHours())+d.getMinutes()/60;if(s>h){c=new Date(c.getTime()+i.Util.getDayLength()-1);c.setHours(l,0,0,0);if(c.getTime()>=d.getTime()){n=true}}if(!n&&s<l){c.setHours(l,0,0,0);if(c.getTime()>=d.getTime()){n=true}}if(!n&&a>h){d.setHours(h,0,0,0);if(c.getTime()>=d.getTime()){n=true}}if(!n&&a<l){d=new Date(d.getTime()-i.Util.getDayLength()+1);d.setHours(h,0,0,0);if(c.getTime()>=d.getTime()){n=true}}if(!n&&c.getTime()<this.scaleDateTo){let i=this.getPosByDate(c),s=Math.min(this.getPosByDate(d),this.DOM.timelineScaleWrap.offsetWidth);e.node=t.appendChild(BX.create("DIV",{props:{className:"calendar-planner-acc-entry"},style:{left:i+"px",width:Math.max(s-i,3)+"px"}}));if(e.name){e.node.title=e.name}}}displayEntryRow(e,t=[]){let i;if(e.type==="moreLink"){i=this.DOM.entrieListWrap.appendChild(s.Tag.render(R||(R=p`
				<div class="calendar-planner-user"></div>
			`)));this.DOM.statusNodeAll=this.getStatusNode("tzAll");if(!e.hasDifferentTimezone||this.readonly){this.DOM.statusNodeAll.style.display="none"}if(this.showEntryName){this.DOM.showMoreUsersLink=i.appendChild(s.Tag.render(k||(k=p`
					<div class="calendar-planner-all-users" title="${0}">
						${0}
						${0}
					</div>
				`),e.title||"",e.name,this.DOM.statusNodeAll))}else{this.DOM.showMoreUsersLink=i.appendChild(s.Tag.render(z||(z=p`
					<div class="calendar-planner-users-more" title="${0}">
						<span class="calendar-planner-users-more-btn">
							${0}
						</span>
					</div>
				`),e.name||"",this.DOM.statusNodeAll))}s.Event.bind(this.DOM.showMoreUsersLink,"click",this.showMoreUsersBind);s.Event.bind(this.selector.DOM.moreButton,"click",this.showMoreUsersBind);this.selector.DOM.moreButton.style.display=""}else if(e.type==="lastUsers"){i=this.DOM.entrieListWrap.appendChild(s.Tag.render(U||(U=p`	
				<div class="calendar-planner-user"></div>
			`)));if(this.showEntryName){this.DOM.showMoreUsersLink=i.appendChild(s.Tag.render($||($=p`
					<div class="calendar-planner-all-users calendar-planner-last-users" title="${0}">
						${0}
					</div>
				`),e.title||"",e.name))}else{this.DOM.showMoreUsersLink=i.appendChild(s.Tag.render(X||(X=p`
					<div class="calendar-planner-users-more" title="${0}">
						<span class="calendar-planner-users-last-btn"></span>
					</div>
				`),e.title||e.name))}}else if(e.id&&e.type==="user"){i=this.DOM.entrieListWrap.appendChild(BX.create("DIV",{attrs:{"data-bx-planner-entry":e.uid,className:"calendar-planner-user"+(e.emailUser?" calendar-planner-email-user":"")}}));e.vacationNode=this.renderVacationNode();if(e.timezoneName){e.statusNode=this.getStatusNode(e.status,e.timezoneName);i.append(e.statusNode)}if(!this.showEntryName){i.append(e.vacationNode)}if(!this.hasCorrectStatus(e)&&e.statusNode){e.statusNode.style.display="none"}i.appendChild(ue.getEntryAvatarNode(e));if(this.showEntryName){i.append(s.Tag.render(V||(V=p`
					<span class="calendar-planner-user-name">
						<span
							class="calendar-planner-entry-name"
							bx-tooltip-user-id="${0}"
							bx-tooltip-classname="calendar-planner-user-tooltip"
						>
							${0}
						</span>
						${0}
					</span>
				`),e.id,s.Text.encode(e.name),e.vacationNode))}}else if(e.id&&e.type==="room"){i=this.DOM.entrieListWrap.appendChild(s.Tag.render(Y||(Y=p`
				<div class="calendar-planner-user"></div>
			`)));if(this.showEntryName){i.appendChild(s.Tag.render(j||(j=p`
					<span class="calendar-planner-user-name"></span>
				`))).appendChild(s.Tag.render(q||(q=p`
					<span class="calendar-planner-entry-name" style="width: ${0}px;">
						${0}
					</span>
				`),this.entriesListWidth-20,s.Text.encode(e.name)))}else{i.appendChild(s.Tag.render(K||(K=p`
					<div class="calendar-planner-location-image-icon" title="${0}"></div>
				`),s.Text.encode(e.name)))}}else if(e.type==="resource"){if(!this.entriesResourceListWrap||!BX.isNodeInDom(this.entriesResourceListWrap)){this.entriesResourceListWrap=this.DOM.entrieListWrap.appendChild(s.Tag.render(Z||(Z=p`
					<div class="calendar-planner-container-resource">
						<div class="calendar-planner-resource-header">
							<span class="calendar-planner-users-item">${0}</span>
						</div>
					</div>
				`),s.Loc.getMessage("EC_PL_RESOURCE_TITLE")))}i=this.entriesResourceListWrap.appendChild(s.Tag.render(G||(G=p`
				<div class="calendar-planner-user" data-bx-planner-entry="${0}"></div>
			`),e.uid));if(this.showEntryName){i.appendChild(s.Tag.render(J||(J=p`
					<span class="calendar-planner-user-name"></span>
				`))).appendChild(s.Tag.render(Q||(Q=p`
					<span class="calendar-planner-entry-name" style="width: ${0}px;">
						${0}
					<span>
				`),this.entriesListWidth-20,s.Text.encode(e.name)))}else{i.appendChild(s.Tag.render(ee||(ee=p`
					<div class="calendar-planner-location-image-icon" title="${0}"></div>
				`),s.Text.encode(e.name)))}}else{i=this.DOM.entrieListWrap.appendChild(s.Tag.render(te||(te=p`
				<div class="calendar-planner-user"></div>
			`)));i.appendChild(s.Tag.render(ie||(ie=p`
				<div class="calendar-planner-all-users">${0}</div>
			`),s.Text.encode(e.name)))}let a=i.offsetTop+13;let n=this.DOM.accessibilityWrap.appendChild(s.Tag.render(se||(se=p`
			<div class="calendar-planner-timeline-space" style="top:${0}px" data-bx-planner-entry="${0}"></div>
		`),a,e.uid||0));this.entriesDataRowMap.set(e.uid,n);t.forEach((e=>this.addAccessibilityItem(e,n)))}hasCorrectStatus(e){return e.status&&this.entryStatusMap[e.status]}getStatusNode(e,t=""){const a="EC_PL_STATUS_"+e.toUpperCase();const n=s.Loc.hasMessage(a)?s.Loc.getMessage(a):i.Util.getFormattedTimezone(t);return s.Tag.render(ae||(ae=p`
			<span
				class="calendar-planner-user-status-icon ${0}"
				title="${0}"
			></span>
		`),this.entryStatusMap[e],n)}static getEntryAvatarNode(e){let t;const i=e.avatar;if(!i||i==="/bitrix/images/1.gif"){let i="ui-icon-common-user";if(e.emailUser){i="ui-icon-common-user-mail"}if(e.sharingUser){i+=" ui-icon-common-user-sharing"}t=s.Tag.render(ne||(ne=p`<div bx-tooltip-user-id="${0}" bx-tooltip-classname="calendar-planner-user-tooltip" title="${0}" class="ui-icon calendar-planner-user-image-icon ${0}"><i></i></div>`),e.id,s.Text.encode(e.name),i)}else{t=s.Tag.render(re||(re=p`<div bx-tooltip-user-id="${0}" bx-tooltip-classname="calendar-planner-user-tooltip" title="${0}" class="ui-icon calendar-planner-user-image-icon"><i style="background-image: url('${0}')"></i></div>`),e.id,s.Text.encode(e.name),encodeURI(e.avatar))}return t}selectEntryRow(e){if(BX.type.isPlainObject(e)){let t=parseInt(e.dataRowWrap.offsetTop);if(!e.selectWrap||!BX.isParentForNode(this.selectedEntriesWrap,e.selectWrap)){e.selectWrap=this.selectedEntriesWrap.appendChild(s.Tag.render(oe||(oe=p`
					<div class="calendar-planner-timeline-selected"></div>
				`)))}e.selectWrap.style.display="";e.selectWrap.style.top=t+36+"px";e.selectWrap.style.width=parseInt(this.DOM.mainWrap.offsetWidth)+5+"px";s.Dom.addClass(e.selectorControlWrap,"active");e.selected=true;this.clearCacheTime()}}isEntrySelected(e){return e&&e.selected}deSelectEntryRow(e){if(BX.type.isPlainObject(e)){if(e.selectWrap){e.selectWrap.style.display="none"}if(e.selectorControlWrap){s.Dom.removeClass(e.selectorControlWrap,"active")}e.selected=false;this.clearCacheTime()}}static getEntryUniqueId(e){return["user","room"].includes(e.type)?e.id:e.type+"-"+e.id}getEntryByUniqueId(e){if(BX.type.isArray(this.entries)){return this.entries.find((function(t){return t.uid==e}))}return null}bindEventHandlers(){s.Event.bind(this.DOM.wrap,"click",this.handleClick.bind(this));s.Event.bind(this.DOM.wrap,"contextmenu",this.handleClick.bind(this));s.Event.bind(this.DOM.wrap,"mousedown",this.handleMousedown.bind(this));s.Event.bind(document,"mousemove",this.handleMousemove.bind(this));s.Event.bind(document,"mouseup",this.handleMouseup.bind(this));s.Event.bind(this.DOM.timelineFixedWrap,"onwheel"in document?"wheel":"mousewheel",this.mouseWheelTimelineHandler.bind(this))}handleClick(e){if(!e){e=window.event}e.preventDefault();const t=e.which===3;if(t||e.target.className==="calendar-planner-today-button"){return}this.clickMousePos=this.getMousePos(e);let i=e.target||e.srcElement,s=5;if(!this.readonly){let e=this.findTarget(i,"timeline"),t=this.findTarget(i,"selector");if(e&&!t&&Math.abs(this.clickMousePos.x-this.mouseDownMousePos.x)<s&&Math.abs(this.clickMousePos.y-this.mouseDownMousePos.y)<s){const e=this.clickMousePos.x-BX.pos(this.DOM.timelineFixedWrap).left+this.DOM.timelineVerticalConstraint.scrollLeft;const t=this.mapDatePos(this.clickSelectorScaleAccuracy);let i=this.getDateByPos(e,false,t.posDateMap);if(!i){return}const s=this.currentToDate-this.currentFromDate;let a=new Date(i.getTime()+s);this.currentFromDate=i;this.currentToDate=a;this.selector.transit({toX:this.getPosByDate(i),leftDate:this.currentFromDate,rightDate:this.currentToDate})}}}handleMousedown(e){if(!e){e=window.event}let t=e.target||e.srcElement;if(this.selector.DOM.timeWrap.contains(t)){return}this.mouseDownMousePos=this.getMousePos(e);this.mouseDown=true;if(!this.readonly){let e=this.findTarget(t,"selector");this.startMousePos=this.mouseDownMousePos;if(e){if(this.findTarget(t,"selector-resize-right")){this.selector.startResize()}else{this.selector.startMove()}}else if(this.findTarget(t,"timeline")){this.startScrollTimeline()}}if(this.shouldShakeSelector(t)){this.showSelectorPopup(s.Loc.getMessage("EC_PLANNER_CANT_DRAG_SHARED_EVENT"));this.selector.shake()}}shouldShakeSelector(e){const t=this.findTarget(e,"selector");const i=e!==this.selector.DOM.moreButton;return this.readonly&&!this.solidStatus&&t&&i}handleMouseup(){if(this.selector.isDragged()){this.selector.endMove();this.selector.endResize()}if(this.timelineIsDraged){this.endScrollTimeline()}if(this.shown&&!this.readonly&&this.mouseDown){this.checkTimelineScroll()}this.mouseDown=false;s.Dom.removeClass(document.body,"calendar-planner-unselectable")}handleMousemove(e){let t;if(this.selector.isDragged()){t=this.getMousePos(e);this.selector.move(t.x-this.startMousePos.x);this.selector.resize(t.x-this.startMousePos.x)}if(this.timelineIsDraged){t=this.getMousePos(e);this.scrollTimeline(t.x-this.startMousePos.x)}}mouseWheelTimelineHandler(e){e=e||window.event;if(this.shown&&!this.readonly){if(s.Browser.isMac()){this.checkTimelineScroll()}else{const t=e.deltaY||e.detail||e.wheelDelta;if(Math.abs(t)>0){this.DOM.timelineVerticalConstraint.scrollLeft=Math.max(this.DOM.timelineVerticalConstraint.scrollLeft+Math.round(t/3),0);this.checkTimelineScroll();return BX.PreventDefault(e)}}}}onScrollHandler(){this.scrollLeft=this.DOM.timelineVerticalConstraint.scrollLeft;this.updateTodayButtonVisibility();this.updateWorkTimeNotice()}updateTodayButtonVisibility(e=true){if(!this.isTodayButtonEnabled()||this.isOneDayScale()){return}this.todayButton.style.transition=e?"":"none";const t=new Date;t.setHours(this.shownScaleTimeFrom,0,0,0);let i=this.DOM.entriesOuterWrap;if(this.todayTitleButton){i=this.todayTitleButton.parentElement}const s=t.getTime()<this.scaleDateTo.getTime()&&BX.pos(i).left+30<BX.pos(this.DOM.entriesOuterWrap).right;if(s&&this.todayButton.style.display!==""){this.todayButton.style.display="";this.setFutureDayTitlesOffset(false)}if(!s&&this.todayButton.style.display!=="none"){this.todayButton.style.display="none";this.setFutureDayTitlesOffset(false)}const a=BX.pos(this.todayTitleButton).right+(this.todayButtonLeftWidth-this.todayButtonWidth)<BX.pos(this.DOM.entriesOuterWrap).right;if(a&&this.todayButton.innerHTML===this.todayLocMessage){this.todayButton.innerHTML=this.todayLocMessage+" &larr;";this.todayButton.style.width=this.todayButtonLeftWidth+"px";this.setFutureDayTitlesOffset(e)}if(!a&&this.todayButton.innerHTML!==this.todayLocMessage){this.todayButton.innerHTML=this.todayLocMessage;this.todayButton.style.width=this.todayButtonWidth+"px";this.setFutureDayTitlesOffset(e)}const n=t.getTime()>this.scaleDateTo.getTime();const r=n||BX.pos(i).right>BX.pos(this.DOM.timelineVerticalConstraint).right;if(r&&this.todayRightButton.style.display!==""){this.todayRightButton.style.display=""}if(!r&&this.todayRightButton.style.display!=="none"){this.todayRightButton.style.display="none"}if(this.todayTitleButton){if(BX.pos(this.todayTitleButton).right<BX.pos(this.DOM.timelineVerticalConstraint).right){this.todayTitleButton.style.position="sticky"}if(BX.pos(this.todayTitleButton).right>BX.pos(this.DOM.timelineVerticalConstraint).right){this.todayTitleButton.style.position=""}}const o=BX.pos(i).left>BX.pos(this.DOM.timelineVerticalConstraint).right||n;if(o&&this.todayRightButton.innerHTML===this.todayLocMessage){this.todayRightButton.innerHTML=this.todayLocMessage+" &rarr;";this.todayRightButton.style.width=this.todayButtonRightWidth+"px"}if(!o&&this.todayRightButton.innerHTML!==this.todayLocMessage){this.todayRightButton.innerHTML=this.todayLocMessage;this.todayRightButton.style.width=this.todayButtonWidth+"px"}}setFutureDayTitlesOffset(e=true){const t=this.todayButton.style.display==="none"?"":parseInt(this.todayButton.style.width)+4+"px";for(const i of this.futureDayTitles){i.style.transition=e?"":"none";i.style.left=t}}todayButtonClickHandler(){if(!this.isTodayButtonEnabled()){return}if(this.todayButtonPivotDay){const e=new Date;e.setHours(this.shownScaleTimeFrom,0,0,0);new BX.easing({duration:300,start:{scrollLeft:this.DOM.timelineVerticalConstraint.scrollLeft},finish:{scrollLeft:this.getPosByDate(e)},transition:BX.easing.makeEaseOut(BX.easing.transitions.quad),step:e=>{this.DOM.timelineVerticalConstraint.scrollLeft=e.scrollLeft},complete:()=>{}}).animate()}else{this.scaleDateFrom=new Date;this.scaleDateFrom.setHours(this.shownScaleTimeFrom,0,0,0);this.scaleDateTo=new Date((new Date).getTime()+i.Util.getDayLength()*this.SCALE_OFFSET_AFTER);this.scaleDateTo.setHours(this.shownScaleTimeTo,0,0,0);this.rebuild();this.DOM.timelineVerticalConstraint.scrollLeft=0;this.emit("onExpandTimeline",new t.BaseEvent({data:{reload:true,dateFrom:this.scaleDateFrom,dateTo:this.scaleDateTo}}))}}isTodayButtonEnabled(){return!this.readonly&&!this.compactMode}checkTimelineScroll(){const e=this.scrollStep;const t=this.DOM.timelineVerticalConstraint.scrollWidth-this.DOM.timelineFixedWrap.offsetWidth-this.scrollStep;if(this.DOM.timelineFixedWrap.offsetWidth>0){const i=new Date;i.setHours(this.scaleDateFrom.getHours(),0,0,0);if(this.DOM.timelineVerticalConstraint.scrollLeft<=e&&this.scaleDateFrom.getTime()>i.getTime()){this.expandTimelineDirection="past"}if(this.DOM.timelineVerticalConstraint.scrollLeft>=t){this.expandTimelineDirection="future"}if(this.expandTimelineDirection){if(!this.isLoaderShown()){this.showLoader()}this.expandTimelineDebounce()}}}startScrollTimeline(){this.timelineIsDraged=true;this.timelineStartScrollLeft=this.DOM.timelineVerticalConstraint.scrollLeft}scrollTimeline(e){this.DOM.timelineVerticalConstraint.scrollLeft=Math.max(this.timelineStartScrollLeft-e,0)}endScrollTimeline(){this.timelineIsDraged=false}findTarget(e,t,i){if(!i)i=this.DOM.mainWrap;let s=e&&e.getAttribute?e.getAttribute("data-bx-planner-meta"):null;if(s!==t){if(e){e=BX.findParent(e,(function(e){return e.getAttribute&&e.getAttribute("data-bx-planner-meta")===t}),i)}else{e=null}}return e}getMousePos(e){if(!e)e=window.event;let t=0,i=0;if(e.pageX||e.pageY){t=e.pageX;i=e.pageY}else if(e.clientX||e.clientY){t=e.clientX+(document.documentElement.scrollLeft||document.body.scrollLeft)-document.documentElement.clientLeft;i=e.clientY+(document.documentElement.scrollTop||document.body.scrollTop)-document.documentElement.clientTop}return{x:t,y:i}}setScaleType(e){if(!this.scaleTypes.includes(e)){e="1hour"}this.scaleType=e;this.scaleSize=ue.getScaleSize(e);if(this.isOneDayScale()&&this.timelineCellWidth<100){this.timelineCellWidthOrig=this.timelineCellWidth;this.timelineCellWidth=100}else if(!this.isOneDayScale()&&this.timelineCellWidthOrig){this.timelineCellWidth=this.timelineCellWidthOrig;this.timelineCellWidthOrig=false}if(this.isOneDayScale()){s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-fulldaymode");if(this.DOM.entriesOuterWrap){s.Dom.addClass(this.DOM.entriesOuterWrap,"calendar-planner-no-daytitle")}}else{s.Dom.removeClass(this.DOM.mainWrap,"calendar-planner-fulldaymode");if(this.DOM.entriesOuterWrap){s.Dom.removeClass(this.DOM.entriesOuterWrap,"calendar-planner-no-daytitle")}}}static getScaleSize(e){let t=3600,i={"15min":Math.round(t/4),"30min":Math.round(t/2),"1hour":t,"2hour":t*2,"1day":t*24};return i[e]||t}mapDatePos(e){if(!e){e=this.accuracy}let t={};let i={};let s,a,n,r,o,l,h;this.substeps=Math.round(this.scaleSize/e);this.posAccuracy=this.timelineCellWidth/this.substeps;e=e*1e3;let c=this.scaleData[1].timestamp-this.scaleData[0].timestamp;for(s=0;s<this.scaleData.length;s++){n=this.scaleData[s].timestamp;r=parseInt(this.scaleData[s].cell.offsetLeft);h=parseInt(this.scaleData[s].cell.offsetWidth);if(!t[n]){t[n]=r}i[r]=n;for(a=1;a<=h;a++){o=n+Math.round(a*c/h/e)*e;l=r+a;if(!t[n]){t[o]=l}i[l]=o;if(a===h&&(!this.scaleData[s+1]||this.scaleData[s+1].dayStart)){t[l+"_end"]=o}}if(s+1<this.scaleData.length&&this.scaleData[s+1].dayStart){const e=r+h;const t=parseInt(this.scaleData[s+1].cell.offsetLeft);const a=n+c;for(let s=e;s<t;s++){i[s]=a}}}return{datePosMap:t,posDateMap:i}}getPosByDate(e){let t=0;if(e&&typeof e!=="object"){e=i.Util.parseDate(e)}if(e&&typeof e==="object"){let i=0;const s=e.getTime();for(let e=0;e<this.scaleData.length;e++){if(s>=this.scaleData[e].timestamp){i=e}else{break}}if(this.scaleData[i]&&this.scaleData[i].cell){t=this.scaleData[i].cell.offsetLeft;const e=this.scaleData[i].cell.offsetWidth;const a=Math.round((s-this.scaleData[i].timestamp)/1e3);if(a>0){t+=Math.round(a*10/this.scaleSize*e)/10}}}return t}getDateByPos(e,t,i){if(!i){i=this.posDateMap}let s,a=t&&i[e+"_end"]?i[e+"_end"]:i[e];if(!a){e=Math.round(e);a=t&&i[e+"_end"]?i[e+"_end"]:i[e]}if(a){s=new Date(a)}return s}showMoreUsers(){this.MIN_ENTRY_ROWS=this.MAX_ENTRY_ROWS;this.rebuild({dontFocus:true});s.Dom.addClass(this.selector.DOM.moreButton,"--close");s.Event.unbind(this.selector.DOM.moreButton,"click",this.showMoreUsersBind);s.Event.bind(this.selector.DOM.moreButton,"click",this.hideMoreUsersBind)}hideMoreUsers(){this.MIN_ENTRY_ROWS=this.initialMinEntryRows;this.rebuild({dontFocus:true});s.Dom.removeClass(this.selector.DOM.moreButton,"--close");s.Event.unbind(this.selector.DOM.moreButton,"click",this.hideMoreUsersBind);s.Event.bind(this.selector.DOM.moreButton,"click",this.showMoreUsersBind)}adjustHeight(){let e=this.DOM.entrieListWrap.offsetHeight+this.DOM.entrieListWrap.offsetTop+30,t=parseInt(this.DOM.wrap.style.height)||this.height;if(this.compactMode&&t<e||!this.compactMode){this.resizePlannerHeight(e,Math.abs(e-t)>10)}}resizePlannerHeight(e,t=false){if(t){const t=300;const i=parseInt(this.DOM.entrieListWrap.style.top);this.updateHeightTransition(t);this.DOM.entrieListWrap.style.zIndex="10";this.DOM.entrieListWrap.style.overflow="hidden";this.DOM.entrieListWrap.style.clipPath=`inset(0 0 calc(100% - ${this.height-i}px))`;setTimeout((()=>{this.updateHeight(e);this.DOM.entrieListWrap.style.clipPath=`inset(0 0 calc(100% - ${e-i}px))`;setTimeout((()=>{this.updateHeightTransition(0);this.DOM.entrieListWrap.style.zIndex="";this.DOM.entrieListWrap.style.overflow="";this.DOM.entrieListWrap.style.clipPath=""}),t)}),0)}else{this.updateHeight(e)}this.height=e;let i=this.DOM.entrieListWrap.offsetHeight+3;this.DOM.timelineDataWrap.style.height=i+"px";if(this.DOM.proposeTimeButton&&this.DOM.proposeTimeButton.style.display!=="none"){this.DOM.proposeTimeButton.style.top=this.DOM.timelineDataWrap.offsetTop+i/2-16+"px"}}updateHeightTransition(e){this.DOM.wrap.style.transition=`height ${e}ms ease`;this.DOM.mainWrap.style.transition=`height ${e}ms ease`;this.DOM.timelineFixedWrap.style.transition=`height ${e}ms ease`;this.DOM.entriesOuterWrap.style.transition=`height ${e}ms ease`;this.DOM.entrieListWrap.style.transition=`clip-path ${e}ms ease`}updateHeight(e){this.DOM.wrap.style.height=e+"px";this.DOM.mainWrap.style.height=e+"px";this.DOM.timelineFixedWrap.style.height=e+"px";this.DOM.entriesOuterWrap.style.height=e+"px"}resizePlannerWidth(e,t){if(!t&&this.DOM.wrap&&this.DOM.mainWrap){this.DOM.wrap.style.width=e+"px";let t=this.compactMode?0:this.entriesListWidth;if(!this.showEntryName){t=55}this.DOM.mainWrap.style.width=e+"px";this.DOM.entriesOuterWrap.style.width=t+"px"}}expandTimeline(e,s){let a;let n;const r=this.scaleDateFrom;const o=this.scaleDateTo;if(!e){e=this.scaleDateFrom}if(!s){s=this.scaleDateTo}if(this.expandTimelineDirection==="past"){n=this.DOM.timelineVerticalConstraint.scrollLeft;this.scaleDateFrom=new Date(e.getTime()-i.Util.getDayLength()*this.EXPAND_OFFSET);const t=new Date;t.setHours(this.scaleDateFrom.getHours(),0,0,0);if(this.scaleDateFrom.getTime()<t){this.scaleDateFrom=t}a=(this.scaleDateTo.getTime()-this.scaleDateFrom.getTime())/i.Util.getDayLength();if(a>this.maxTimelineSize){this.scaleDateTo=new Date(this.scaleDateFrom.getTime()+i.Util.getDayLength()*this.maxTimelineSize);this.loadedDataFrom=this.scaleDateFrom;this.loadedDataTo=this.scaleDateTo;this.limitScaleSizeMode=true}}else if(this.expandTimelineDirection==="future"){let e=this.scaleDateTo;n=this.DOM.timelineVerticalConstraint.scrollLeft;this.scaleDateTo=new Date(s.getTime()+i.Util.getDayLength()*this.EXPAND_OFFSET);a=(this.scaleDateTo.getTime()-this.scaleDateFrom.getTime())/i.Util.getDayLength();if(a>this.maxTimelineSize){this.scaleDateFrom=new Date(this.scaleDateTo.getTime()-i.Util.getDayLength()*this.maxTimelineSize);this.loadedDataFrom=this.scaleDateFrom;this.loadedDataTo=this.scaleDateTo;n=this.getPosByDate(e)-this.DOM.timelineFixedWrap.offsetWidth;setTimeout((()=>{this.DOM.timelineVerticalConstraint.scrollLeft=this.getPosByDate(e)-this.DOM.timelineFixedWrap.offsetWidth}),10);this.limitScaleSizeMode=true}}else{this.scaleDateFrom=new Date(e.getTime()-i.Util.getDayLength()*this.SCALE_OFFSET_BEFORE);this.scaleDateTo=new Date(s.getTime()+i.Util.getDayLength()*this.SCALE_OFFSET_AFTER)}const l=this.scaleDateFrom.getTime()<r.getTime()||this.scaleDateTo.getTime()>o.getTime();this.hideLoader();this.emit("onExpandTimeline",new t.BaseEvent({data:{reload:l,dateFrom:this.scaleDateFrom,dateTo:this.scaleDateTo}}));const h=this.DOM.timelineInnerWrap.offsetWidth;this.rebuild({updateSelector:true});if(this.expandTimelineDirection==="past"){const e=this.DOM.timelineInnerWrap.offsetWidth-h;this.DOM.timelineVerticalConstraint.scrollLeft=n+e}else if(n!==undefined){this.DOM.timelineVerticalConstraint.scrollLeft=n}this.expandTimelineDirection=null}getVisibleEvents(){const e=[];const t=this.DOM.timelineVerticalConstraint.scrollLeft;const i=t+this.DOM.timelineFixedWrap.offsetWidth;for(const s in this.accessibility){for(const a of this.accessibility[s]){const s=this.getPosByDate(new Date(a.fromTimestamp));const n=this.getPosByDate(new Date(a.toTimestamp));if(this.doSegmentsIntersect(s,n,t,i)&&a.node){e.push(a)}}}return e}getEventsAfter(e,t){const i=[];for(const s of e){if(s.fromTimestamp>=t){i.push(s)}}return i}updateTimezone(e){const t=i.Util.getTimeZoneOffset(this.currentTimezone);const s=i.Util.getTimeZoneOffset(e);this.currentTimezone=e;if(t===s){return}if(this.isBuilt()){this.update(this.entries,this.accessibility)}}update(e=[],a={}){var n;s.Dom.clean(this.DOM.entrieListWrap);s.Dom.clean(this.DOM.accessibilityWrap);this.entriesDataRowMap=new Map;if(!s.Type.isArray(e)){return}if(((n=this.entries)==null?void 0:n.length)!==e.length){this.doShowTimezoneNoticePopup=true}this.entries=e;this.accessibility=[];this.preparedAccessibility=[];this.allEvents=[];const r=i.Util.getTimeZoneOffset(this.currentTimezone);this.entries.forEach((e=>{this.accessibility[e.id]=a[e.id];this.preparedAccessibility[e.id]=a[e.id].map((e=>this.prepareAccessibilityItem(e)));this.allEvents.push(...this.preparedAccessibility[e.id]);e.timezoneOffset=i.Util.getTimeZoneOffset(e.timezoneName);e.timezoneNameFormatted=i.Util.getFormattedTimezone(e.timezoneName);e.offset=r-e.timezoneOffset}));const o=parseInt(this.userId);e.sort(((e,t)=>{if(t.status==="h"||parseInt(t.id)===o&&e.status!=="h"){return 1}if(e.status==="h"||parseInt(e.id)===o&&t.status!=="h"){return-1}if(parseInt(e.id)<parseInt(t.id)){return-1}return 1}));if(this.selectedEntriesWrap){s.Dom.clean(this.selectedEntriesWrap);if(this.selector&&this.selector.controlWrap){s.Dom.clean(this.selector.controlWrap)}}const l=[];const h=[];let c=0;let d=[];let m=0;if(e.length<=this.initialMinEntryRows+1){this.selector.DOM.moreButton.style.display="none"}else{this.selector.DOM.moreButton.style.display=""}e.forEach(((t,i)=>{t.uid=ue.getEntryUniqueId(t);const s=this.preparedAccessibility[t.uid];this.entriesIndex.set(t.uid,t);if(t.type==="user"){c++}if(i<this.MIN_ENTRY_ROWS||e.length===this.MIN_ENTRY_ROWS+1){m++;this.displayEntryRow(t,s)}else{d.push(t);h.push(t.name);l.push(...s)}}));if(this.entriesListTitleCounter){this.entriesListTitleCounter.innerHTML=c>this.MAX_ENTRY_ROWS?"("+c+")":""}this.emit("onDisplayAttendees",new t.BaseEvent({data:{usersCount:c}}));if(d.length>0){if(m===this.MAX_ENTRY_ROWS){this.displayEntryRow({name:s.Loc.getMessage("EC_PL_ATTENDEES_LAST")+" ("+d.length+")",type:"lastUsers",title:h.join(", ")},l)}else{this.displayEntryRow({name:s.Loc.getMessage("EC_PL_ATTENDEES_SHOW_MORE")+" ("+d.length+")",type:"moreLink",hasDifferentTimezone:d.filter((e=>e.offset!==0)).length>0},l)}}this.clearCacheTime();const p=this.checkTimePeriod(this.currentFromDate,this.currentToDate)===true;this.updateSelectorFromStatus(p);i.Util.extendPlannerWatches({entries:e,userId:this.userId});this.adjustHeight();this.updateWorkTimeNotice()}updateSelector(e,t,s,a={}){if(this.shown&&this.selector){this.setFullDayMode(s);if(!this.isOneDayScale()){if(i.Util.formatDate(e)!==i.Util.formatDate(t)){this.extendScaleTime(0,24)}else{let i=parseInt(e.getHours())+Math.floor(e.getMinutes()/60);let s=parseInt(t.getHours())+Math.ceil(t.getMinutes()/60);let a=2;if(i<=this.shownScaleTimeFrom){this.extendScaleTime(i-a,false)}if(s>=this.shownScaleTimeTo){this.extendScaleTime(false,s+a)}}}if(this.isNeedToExpandTimeline(e,t)){this.expandTimelineDirection=false;this.expandTimeline(e,t)}this.currentFromDate=e;this.currentToDate=t;if(!this.selector){return}if(e.getTime()<this.scaleDateFrom.getTime()){this.selector.update({from:e,to:t,fullDay:s,focus:a.focus!==false});return}this.selector.update({from:e,to:t,fullDay:s});if(a.focus!==false){this.selector.focus(true,300)}this.updateWorkTimeNotice()}}isNeedToExpandTimeline(e,t){return t.getTime()>this.scaleDateTo.getTime()||e.getTime()<this.scaleDateFrom.getTime()}handleSelectorChanges(e){if(e instanceof t.BaseEvent){let i=e.getData();this.emit("onDateChange",new t.BaseEvent({data:i}));this.currentFromDate=i.dateFrom;this.currentToDate=i.dateTo;if(this.currentToDate.getHours()<this.shownScaleTimeFrom&&!(this.currentToDate.getHours()===0&&this.currentToDate.getMinutes()===0)){this.extendScaleTime(this.currentToDate.getHours(),false)}this.updateWorkTimeNotice()}}onStopAutoScrollHandler(){this.hideWorkTimeNotice()}onBeginChangeHandler(){this.hideWorkTimeNotice()}updateWorkTimeNotice(){var e;if(!this.isWorkTimeNoticeEnabled()){return}const t=(e=this.selector.boundaryFrom)!=null?e:this.currentFromDate;this.updateVacationNotice(t);this.updateTimezoneNotice(t)}hideWorkTimeNotice(){this.hideVacationNotice();this.hideTimezoneNotice()}updateVacationNotice(e){for(const t of this.entries.filter((e=>s.Type.isDomNode(e.vacationNode)))){const a=this.accessibility[t.id].filter((t=>{const i=t.from.getTime();const s=t.to.getTime();return t.isVacation&&i<e.getTime()&&e.getTime()<s}));if(a.length>0){const e=Math.max(...a.map((e=>e.to)));t.vacationNode.dataHint=s.Loc.getMessage("EC_PLANNER_IN_VACATION_UNTIL",{"#UNTIL#":i.Util.formatDate(e)});t.vacationNode.style.display=""}else{t.vacationNode.style.display="none"}}}hideVacationNotice(){for(const e of this.entries.filter((e=>s.Type.isDomNode(e.vacationNode)))){e.vacationNode.style.display="none"}}updateTimezoneNotice(e){if(!this.isSelectorVisible()){this.hideTimezoneNotice();return}const t=this.entries.filter((e=>this.isInternalUser(e)&&e.offset!==0));const a=t.filter((t=>{const i=new Date(e.getTime()+t.offset*60*1e3);const s=this.getDateHours(i);return s<this.warningHoursFrom||s>=this.warningHoursTo}));if(s.Type.isDomNode(this.DOM.statusNodeAll)){s.Dom.removeClass(this.DOM.statusNodeAll,"--warning")}this.selector.clearTimeNodes();for(const a of t){const t=this.entriesDataRowMap.get(a.uid);const n=new Date(e.getTime()+a.offset*60*1e3);const r=this.getDateHours(n);const o=r<this.warningHoursFrom||r>=this.warningHoursTo;if(s.Type.isDomNode(t)){const e=parseInt(t.style.top);this.selector.showTimeNode(e,i.Util.formatTime(n),a.timezoneNameFormatted,o)}this.showEntryStatusTimezone(a,o)}const n=a.length>0;if(n){s.Dom.addClass(this.selector.DOM.moreButton,"--warning")}else{s.Dom.removeClass(this.selector.DOM.moreButton,"--warning")}if(t.length>0){this.showTimezoneNotice(t.length,n)}else{this.hideTimezoneNotice()}}isInternalUser(e){return e.type==="user"&&!e.sharingUser&&!e.emailUser}getDateHours(e){return e.getHours()+e.getMinutes()/60}isSelectorVisible(){const e=this.DOM.timelineVerticalConstraint.scrollLeft;const t=e+this.DOM.timelineFixedWrap.offsetWidth;const i=this.selector.getWrap();const s=i.offsetLeft;const a=i.offsetLeft+i.offsetWidth;return this.doSegmentsIntersect(s,a,e,t)}showTimezoneNotice(e,t){this.showTimezoneNoticeCount(e,t);if(t){this.showTimezoneNoticePopup()}else{this.hideTimezoneNoticePopup()}}hideTimezoneNotice(){this.selector.clearTimeNodes();this.hideTimezoneNoticeCount();this.hideTimezoneNoticePopup()}showTimezoneNoticeCount(e,t){this.DOM.timezoneNoticeCount.innerHTML=this.renderTimezoneNoticeText(e,t);const i=this.getSelectorOffset();this.DOM.timezoneNoticeCount.style.left=`${i}px`;this.DOM.timezoneNoticeCount.style.display="block";this.DOM.wrap.style.marginBottom=`${20}px`}hideTimezoneNoticeCount(){this.DOM.timezoneNoticeCount.style.display="none"}showTimezoneNoticePopup(){if(!this.doShowTimezoneNoticePopup||this.isTimezoneNoticePopupShown){return}this.showSelectorPopup(s.Loc.getMessage("EC_PLANNER_TIMEZONE_NOTICE"))}hideTimezoneNoticePopup(){if(this.DOM.selectorPopup.style.display!=="none"){this.doShowTimezoneNoticePopup=false;this.isTimezoneNoticePopupShown=true}this.hideSelectorPopup()}showSelectorPopup(e){if(this.DOM.selectorPopup.style.display==="block"&&this.DOM.selectorPopup.innerText!==e){this.DOM.selectorPopup.style.transition="color 200ms ease";this.DOM.selectorPopup.style.color="#ffffff00";setTimeout((()=>{this.DOM.selectorPopup.innerText=e;this.DOM.selectorPopup.style.color=""}),200)}else{this.DOM.selectorPopup.style.transition="none";this.DOM.selectorPopup.innerText=e;this.DOM.selectorPopup.style.color=""}const t=this.getSelectorOffset();this.DOM.selectorPopup.style.left=`${t}px`;this.DOM.selectorPopup.style.display="block";clearTimeout(this.selectorPopupTimeout);this.selectorPopupTimeout=setTimeout((()=>this.hideTimezoneNoticePopup()),3e3)}hideSelectorPopup(){this.DOM.selectorPopup.style.display="none"}getSelectorOffset(){const e=this.scrollLeft;const t=this.selector.getWrap();const i=parseInt(t.style.width)/2+parseInt(t.style.left);const s=parseInt(this.DOM.entriesOuterWrap.style.width);return i-e+s}showEntryStatusTimezone(e,t){if(!s.Type.isDomNode(e.statusNode)||!this.DOM.wrap.contains(e.statusNode)){if(s.Type.isDomNode(this.DOM.statusNodeAll)){this.DOM.statusNodeAll.style.display=""}if(t){s.Dom.addClass(this.DOM.statusNodeAll,"--warning")}return}e.statusNode.style.display="";s.Dom.addClass(e.statusNode,"user-status-different-timezone");if(t){s.Dom.addClass(e.statusNode,"--warning")}else{s.Dom.removeClass(e.statusNode,"--warning")}}isWorkTimeNoticeEnabled(){return!this.solidStatus&&s.Type.isArrayFilled(this.entries)}getAllEvents(){return this.allEvents}doCheckSelectorStatus(e){if(e instanceof t.BaseEvent){const t=e.getData();this.clearCacheTime();const i=this.checkTimePeriod(t.dateFrom,t.dateTo)===true;this.updateSelectorFromStatus(i)}}updateSelectorFromStatus(e){this.selector.setSelectorStatus(e);if(this.selector.isDragged()){this.hideProposeControl()}if(e){s.Dom.removeClass(this.DOM.mainWrap,"calendar-planner-selector-warning");this.hideProposeControl()}else{s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-selector-warning");if(!this.selector.isDragged()){this.showProposeControl()}}}proposeTime(e={}){if(!s.Type.isPlainObject(e)){e={}}let a=Math.round(this.selector.getDateFrom().getTime()/(this.accuracy*1e3))*this.accuracy*1e3,n=new Date(a),r=this.selector.getDuration();n.setSeconds(0,0);a=n.getTime();const o=[...this.allEvents];o.sort((function(e,t){return e.fromTimestamp-t.fromTimestamp}));let l=a;while(true){let s=new Date(l);let a=new Date(l+r);if(!this.isOneDayScale()){let e=parseInt(s.getHours()+s.getMinutes()/60);let t=parseInt(a.getHours()+a.getMinutes()/60);if(t===0){t=24}if(e<=this.shownScaleTimeFrom){s.setHours(this.shownScaleTimeFrom,0,0,0);l=s.getTime();a=new Date(l+r)}if(t>this.shownScaleTimeTo){s=new Date(l+i.Util.getDayLength()-1e3);s.setHours(this.shownScaleTimeFrom,0,0,0);l=s.getTime();a=new Date(l+r)}}if(this.fullDayMode){s.setHours(0,0,0,0);a.setHours(0,0,0,0)}const n=this.checkTimePeriod(s,a,o);if(n===true){if(a.getTime()>this.scaleDateTo.getTime()){if(a.getTime()-this.scaleDateTo.getTime()>this.proposeTimeLimit*i.Util.getDayLength()||e.checkedFuture===true){ue.showNoResultNotification()}else if(e.checkedFuture!==true){this.scaleDateTo=new Date(this.scaleDateTo.getTime()+i.Util.getDayLength()*this.proposeTimeLimit);this.expandTimeline(this.scaleDateFrom,this.scaleDateTo)}}else{if(this.fullDayMode)a=new Date(a.getTime()-i.Util.getDayLength());this.currentFromDate=s;this.currentToDate=a;this.selector.update({from:s,to:a,updateScaleType:false,updateScaleLimits:true,animation:true,focus:true});this.emit("onDateChange",new t.BaseEvent({data:{dateFrom:s,dateTo:a,fullDay:this.fullDayMode}}))}break}else if(n&&n.toTimestampReal){l=n.toTimestampReal;if(this.fullDayMode){let e=new Date(l+i.Util.getDayLength()-1e3);e.setHours(0,0,0,0);l=e.getTime()}}}}checkTimePeriod(e,t,i){if(!this.currentFromDate){return true}const a=new Date;a.setHours(this.shownScaleTimeFrom,0,0,0);if(this.fullDayMode){a.setHours(0,0,0,0)}if(e&&e.getTime()<a.getTime()){return true}let n=true;let r;if(!s.Type.isDate(e)||!s.Type.isDate(t)){return n}let o=e.getTime();let l=t.getTime();const h=o+"_"+l;const c=3*60*1e3;if(s.Type.isArray(i)){for(let e=0;e<i.length;e++){let t=i[e];if(t.fromTimestamp+c<=l&&(t.toTimestampReal||t.toTimestamp)-c>=o){n=t;break}}}else if(s.Type.isArray(this.entries)){let e=this.selectorAccuracy*1e3,t;if(this.checkTimeCache[h]!==undefined){n=this.checkTimeCache[h]}else{for(t in this.accessibility){if(this.accessibility.hasOwnProperty(t)){r=this.entries.find((function(e){return e.id===t.toString()}));if(!r){continue}if(s.Type.isArray(this.accessibility[t])){for(let i=0;i<this.accessibility[t].length;i++){let s=this.accessibility[t][i];if(s.fromTimestamp+e<=l&&(s.toTimestampReal||s.toTimestamp)-e>=o){n=s;break}}}}}this.checkTimeCache[h]=n}}return n}clearCacheTime(){this.checkTimeCache={}}showSettingsPopup(){let e=s.Tag.render(le||(le=p`<div class="calendar-planner-settings-popup"></div>`));let t=e.appendChild(s.Tag.render(he||(he=p`
			<div class="calendar-planner-settings-row">
				<i>${0}:</i>
			</div>
		`),s.Loc.getMessage("EC_PL_SETTINGS_SCALE")));let i=t.appendChild(s.Tag.render(ce||(ce=p`
			<span class="calendar-planner-option-container"></span>
		`)));if(this.fullDayMode){t.title=s.Loc.getMessage("EC_PL_SETTINGS_SCALE_READONLY_TITLE");s.Dom.addClass(t,"calendar-planner-option-container-disabled")}this.scaleTypes.forEach((e=>{i.appendChild(s.Tag.render(de||(de=p`<span class="calendar-planner-option-tab ${0}" data-bx-planner-scale="${0}">${0}</span>`),e===this.scaleType?" calendar-planner-option-tab-active":"",e,s.Loc.getMessage("EC_PL_SETTINGS_SCALE_"+e.toUpperCase())))}));let a=n.PopupWindowManager.create(this.id+"-settings-popup",this.DOM.settingsButton,{autoHide:true,closeByEsc:true,offsetTop:-1,offsetLeft:7,lightShadow:true,content:e,zIndex:4e3,angle:{postion:"top"},cacheable:false});a.show(true);s.Event.bind(i,"click",(e=>{if(!this.fullDayMode){let t=e.target||e.srcElement,i=t&&t.getAttribute&&t.getAttribute("data-bx-planner-scale");if(i){this.changeScaleType(i);a.close()}}}))}changeScaleType(e){if(e!==this.scaleType){this.setScaleType(e);this.rebuild()}}setFullDayMode(e){if(e!==this.fullDayMode){this.fullDayMode=e;if(e&&!this.isOneDayScale()){this.savedScaleType=this.scaleType;this.changeScaleType("1day")}else if(!e&&this.isOneDayScale()&&this.savedScaleType){this.changeScaleType(this.savedScaleType);this.savedScaleType=null}}}static showNoResultNotification(){alert(s.Loc.getMessage("EC_PL_PROPOSE_NO_RESULT"))}showProposeControl(){if(!this.DOM.proposeTimeButton){this.DOM.proposeTimeButton=this.DOM.mainWrap.appendChild(s.Tag.render(me||(me=p`
				<div class="calendar-planner-time-arrow-right">
					<span class="calendar-planner-time-arrow-right-text">
						${0}
					</span>
					<span class="calendar-planner-time-arrow-right-item"></span>
				</div>
			`),s.Loc.getMessage("EC_PL_PROPOSE")));s.Event.bind(this.DOM.proposeTimeButton,"click",this.proposeTime.bind(this));if(this.isLocked()){s.Dom.addClass(this.DOM.proposeTimeButton,"--lock")}}this.DOM.proposeTimeButton.style.display="block";this.DOM.proposeTimeButton.style.top=this.DOM.timelineDataWrap.offsetTop+this.DOM.timelineDataWrap.offsetHeight/2-16+"px"}hideProposeControl(){if(this.DOM.proposeTimeButton){this.DOM.proposeTimeButton.style.display="none"}}mouseMoveHandler(e){let t,i,a,n,r,o=this.DOM.mainWrap,l=e.target||e.srcElement;a=l.getAttribute("data-bx-planner-entry");if(!a){n=BX.findParent(l,(function(e){if(e==o||e.getAttribute&&e.getAttribute("data-bx-planner-entry")){return true}}),o);if(n){a=l.getAttribute("data-bx-planner-entry")}else{s.Dom.removeClass(this.hoverRow,"show");i=this.selector.controlWrap.querySelectorAll(".calendar-planner-selector-control-row.hover");for(t=0;t<i.length;t++){s.Dom.removeClass(i[t],"hover")}r=this.getEntryByUniqueId(this.howerEntryId);if(r&&r.selectWrap){r.selectWrap.style.opacity=1}}}if(a){if(this.howerEntryId!==a){this.howerEntryId=a;let e=this.getEntryByUniqueId(a);if(e){let a=parseInt(e.dataRowWrap.offsetTop);s.Dom.addClass(this.hoverRow,"show");this.hoverRow.style.top=a+36+"px";this.hoverRow.style.width=parseInt(this.DOM.mainWrap.offsetWidth)+5+"px";if(e.selectorControlWrap){i=this.selector.controlWrap.querySelectorAll(".calendar-planner-selector-control-row.hover");for(t=0;t<i.length;t++){s.Dom.removeClass(i[t],"hover")}s.Dom.addClass(e.selectorControlWrap,"hover")}}}}}showLoader(){this.hideLoader();this.DOM.loader=this.DOM.mainWrap.appendChild(i.Util.getLoader(50));s.Dom.addClass(this.DOM.loader,"calendar-planner-main-loader");this.loaderShown=true}hideLoader(){if(s.Type.isDomNode(this.DOM.loader)){s.Dom.remove(this.DOM.loader)}this.loaderShown=false}isLoaderShown(){return this.loaderShown}isShown(){return this.shown}isBuilt(){return this.built}isLocked(){return this.locked}lock(){if(!this.DOM.lockScreen){this.DOM.lockScreen=s.Tag.render(pe||(pe=p`
				<div class="calendar-planner-timeline-locker">
					<div class="calendar-planner-timeline-locker-container">
						<div class="calendar-planner-timeline-locker-top">
							<div class="calendar-planner-timeline-locker-icon"></div>
							<div class="calendar-planner-timeline-text">${0}</div>
						</div>
						<div class="calendar-planner-timeline-locker-button">
							<a href="javascript:void(0)" onclick="top.BX.UI.InfoHelper.show('limit_crm_calender_planner');" class="ui-btn ui-btn-sm ui-btn-light-border ui-btn-round">${0}</a>
						</div>
					</div>
				</div>
			`),s.Loc.getMessage("EC_PL_LOCKED_TITLE"),s.Loc.getMessage("EC_PL_UNLOCK_FEATURE"))}s.Dom.addClass(this.DOM.timelineFixedWrap,"--lock");this.DOM.timelineFixedWrap.appendChild(this.DOM.lockScreen)}doSegmentsIntersect(e,t,i,s){return e>=i&&e<=s||t>=i&&t<=s||e<=i&&t>=s}setReadonly(){this.readonly=true;s.Dom.addClass(this.DOM.mainWrap,"calendar-planner-readonly")}}e.Planner=ue})(this.BX.Calendar=this.BX.Calendar||{},BX.Event,BX.Calendar,BX,BX.Calendar.Ui.Tools,BX.Main);
//# sourceMappingURL=planner.bundle.map.js

Anon7 - 2022
AnonSec Team