text: /*!
   * OpenUI5
   * (c) Copyright 2009-2019 SAP SE or an SAP affiliate company.
   * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
   */
  sap.ui.define(["./SinglePlanningCalendarUtilities","sap/ui/core/Control","sap/ui/core/LocaleData","sap/ui/core/Locale","sap/ui/core/InvisibleText","sap/ui/core/format/DateFormat","sap/ui/core/date/UniversalDate","sap/ui/core/dnd/DragInfo","sap/ui/core/dnd/DropInfo","sap/ui/core/dnd/DragDropInfo","sap/ui/unified/library","sap/ui/unified/CalendarAppointment","sap/ui/unified/calendar/DatesRow","sap/ui/unified/calendar/CalendarDate","sap/ui/unified/calendar/CalendarUtils","sap/ui/events/KeyCodes","./SinglePlanningCalendarGridRenderer","sap/ui/Device","sap/ui/core/delegate/ItemNavigation","sap/ui/thirdparty/jquery","./PlanningCalendarLegend"],function(t,e,a,i,n,r,o,s,l,p,g,d,u,c,h,m,f,D,_,C,v){"use strict";var A=69,y=48,S=34,M=25,H=36e5/2,R=60*1e3,P=864e5,T=7,b=0,w=24;var I=e.extend("sap.m.SinglePlanningCalendarGrid",{metadata:{library:"sap.m",properties:{startDate:{type:"object",group:"Data"},startHour:{type:"int",group:"Data",defaultValue:0},endHour:{type:"int",group:"Data",defaultValue:24},fullDay:{type:"boolean",group:"Data",defaultValue:true},enableAppointmentsDragAndDrop:{type:"boolean",group:"Misc",defaultValue:false},enableAppointmentsResize:{type:"boolean",group:"Misc",defaultValue:false},enableAppointmentsCreate:{type:"boolean",group:"Misc",defaultValue:false}},aggregations:{appointments:{type:"sap.ui.unified.CalendarAppointment",multiple:true,singularName:"appointment",dnd:{draggable:true}},specialDates:{type:"sap.ui.unified.DateTypeRange",multiple:true,singularName:"specialDate"},_columnHeaders:{type:"sap.ui.unified.calendar.DatesRow",multiple:false,visibility:"hidden"},_intervalPlaceholders:{type:"sap.m.SinglePlanningCalendarGrid._internal.IntervalPlaceholder",multiple:true,visibility:"hidden",dnd:{droppable:true}},_blockersPlaceholders:{type:"sap.m.SinglePlanningCalendarGrid._internal.IntervalPlaceholder",multiple:true,visibility:"hidden",dnd:{droppable:true}}},dnd:true,associations:{ariaLabelledBy:{type:"sap.ui.core.Control",multiple:true,singularName:"ariaLabelledBy"},legend:{type:"sap.m.PlanningCalendarLegend",multiple:false}},events:{appointmentSelect:{parameters:{appointment:{type:"sap.ui.unified.CalendarAppointment"},appointments:{type:"sap.ui.unified.CalendarAppointment[]"}}},appointmentDrop:{parameters:{appointment:{type:"sap.ui.unified.CalendarAppointment"},startDate:{type:"object"},endDate:{type:"object"},copy:{type:"boolean"}}},appointmentResize:{parameters:{appointment:{type:"sap.ui.unified.CalendarAppointment"},startDate:{type:"object"},endDate:{type:"object"}}},appointmentCreate:{parameters:{startDate:{type:"object"},endDate:{type:"object"}}},cellPress:{parameters:{startDate:{type:"object"},endDate:{type:"object"}}}}}});I.prototype.init=function(){var t=new Date,e=new u(this.getId()+"-columnHeaders",{showDayNamesLine:false,showWeekNumbers:false,startDate:t}).addStyleClass("sapMSinglePCColumnHeader"),a=(60-t.getSeconds())*1e3,i=this._getCoreLocaleData().getTimePattern("medium");this.setAggregation("_columnHeaders",e);this.setStartDate(t);this._setColumns(7);this._configureBlockersDragAndDrop();this._configureAppointmentsDragAndDrop();this._configureAppointmentsResize();this._configureAppointmentsCreate();this._oUnifiedRB=sap.ui.getCore().getLibraryResourceBundle("sap.ui.unified");this._oFormatStartEndInfoAria=r.getDateTimeInstance({pattern:"EEEE dd/MM/YYYY 'at' "+i});this._oFormatAriaFullDayCell=r.getDateTimeInstance({pattern:"EEEE dd/MM/YYYY"});this._sLegendId=undefined;setTimeout(this._updateRowHeaderAndNowMarker.bind(this),a)};I.prototype.exit=function(){if(this._oItemNavigation){this.removeDelegate(this._oItemNavigation);this._oItemNavigation.destroy();delete this._oItemNavigation}};I.prototype.onBeforeRendering=function(){var t=this._createAppointmentsMap(this.getAppointments()),e=this.getStartDate(),a=c.fromLocalJSDate(e),i=this._getColumns();this._oVisibleAppointments=this._calculateVisibleAppointments(t.appointments,this.getStartDate(),i);this._oAppointmentsToRender=this._calculateAppointmentsLevelsAndWidth(this._oVisibleAppointments);this._aVisibleBlockers=this._calculateVisibleBlockers(t.blockers,a,i);this._oBlockersToRender=this._calculateBlockersLevelsAndWidth(this._aVisibleBlockers);if(this._iOldColumns!==i||this._oOldStartDate!==e){this._createBlockersDndPlaceholders(e,i);this._createAppointmentsDndPlaceholders(e,i)}};I.prototype.onmousedown=function(t){var e=t.target.classList;this._isResizeHandleBottomMouseDownTarget=e.contains("sapMSinglePCAppResizeHandleBottom");this._isResizeHandleTopMouseDownTarget=e.contains("sapMSinglePCAppResizeHandleTop")};I.prototype._isResizingPerformed=function(){return this._isResizeHandleBottomMouseDownTarget||this._isResizeHandleTopMouseDownTarget};I.prototype._configureBlockersDragAndDrop=function(){this.addDragDropConfig(new p({sourceAggregation:"appointments",targetAggregation:"_blockersPlaceholders",dragStart:function(t){if(!this.getEnableAppointmentsDragAndDrop()){t.preventDefault();return false}var e=function(){var t=C(".sapMSinglePCOverlay");setTimeout(function(){t.addClass("sapMSinglePCOverlayDragging")});C(document).one("dragend",function(){t.removeClass("sapMSinglePCOverlayDragging")})};e()}.bind(this),dragEnter:function(t){var e=t.getParameter("dragSession"),a=e.getDragControl(),i=e.getDropControl(),n=this.isAllDayAppointment(a.getStartDate(),a.getEndDate()),r=function(){var t=C(e.getIndicator()),r=a.$().outerHeight(),o=a.$().outerWidth(),s=i.$().closest(".sapMSinglePCBlockersColumns").get(0).getBoundingClientRect(),l=i.getDomRef().getBoundingClientRect(),p=l.left+o-(s.left+s.width);if(n){t.css("min-height",r);t.css("min-width",Math.min(o,o-p))}else{t.css("min-height",e.getDropControl().$().outerHeight());t.css("min-width",e.getDropControl().$().outerWidth())}};if(!e.getIndicator()){setTimeout(r,0)}else{r()}}.bind(this),drop:function(t){var e=t.getParameter("dragSession"),a=e.getDragControl(),i=e.getDropControl(),n=i.getDate().getJSDate(),r,o=t.getParameter("browserEvent"),s=o.metaKey||o.ctrlKey,l=this.isAllDayAppointment(a.getStartDate(),a.getEndDate());r=new Date(n);if(l){r.setMilliseconds(a.getEndDate().getTime()-a.getStartDate().getTime())}this.$().find(".sapMSinglePCOverlay").removeClass("sapMSinglePCOverlayDragging");if(l&&a.getStartDate().getTime()===n.getTime()){return}this.fireAppointmentDrop({appointment:a,startDate:n,endDate:r,copy:s})}.bind(this)}))};I.prototype._configureAppointmentsDragAndDrop=function(){this.addDragDropConfig(new p({sourceAggregation:"appointments",targetAggregation:"_intervalPlaceholders",dragStart:function(t){if(!this.getEnableAppointmentsDragAndDrop()||this._isResizingPerformed()){t.preventDefault();return false}var e=function(){var t=C(".sapMSinglePCOverlay");setTimeout(function(){t.addClass("sapMSinglePCOverlayDragging")});C(document).one("dragend",function(){t.removeClass("sapMSinglePCOverlayDragging")})};e()}.bind(this),dragEnter:function(t){var e=t.getParameter("dragSession"),a=e.getDragControl(),i=e.getDropControl(),n=this.isAllDayAppointment(a.getStartDate(),a.getEndDate()),r=function(){var t=C(e.getIndicator()),r=a.$().outerHeight(),o=i.$().closest(".sapMSinglePCColumn").get(0).getBoundingClientRect(),s=e.getDropControl().getDomRef().getBoundingClientRect(),l=s.top+r-(o.top+o.height);if(n){t.css("min-height",2*e.getDropControl().$().outerHeight())}else{t.css("min-height",Math.min(r,r-l))}};if(!e.getIndicator()){setTimeout(r,0)}else{r()}}.bind(this),drop:function(t){var e=t.getParameter("dragSession"),a=e.getDragControl(),i=e.getDropControl(),n=i.getDate().getJSDate(),r,o=t.getParameter("browserEvent"),s=o.metaKey||o.ctrlKey,l=this.isAllDayAppointment(a.getStartDate(),a.getEndDate());r=new Date(n);if(l){r.setHours(r.getHours()+1)}else{r.setMilliseconds(a.getEndDate().getTime()-a.getStartDate().getTime())}this.$().find(".sapMSinglePCOverlay").removeClass("sapMSinglePCOverlayDragging");if(!l&&a.getStartDate().getTime()===n.getTime()){return}this.fireAppointmentDrop({appointment:a,startDate:n,endDate:r,copy:s})}.bind(this)}))};I.prototype._configureAppointmentsResize=function(){var t=new p({sourceAggregation:"appointments",targetAggregation:"_intervalPlaceholders",dragStart:function(t){if(!this.getEnableAppointmentsResize()||!this._isResizingPerformed()){t.preventDefault();return}var e=t.getParameter("dragSession"),a=this.$().find(".sapMSinglePCOverlay"),i=C(e.getIndicator()),n=e.getDragControl().$();if(this._isResizeHandleBottomMouseDownTarget){e.setData("bottomHandle","true")}if(this._isResizeHandleTopMouseDownTarget){e.setData("topHandle","true")}i.addClass("sapUiDnDIndicatorHide");setTimeout(function(){a.addClass("sapMSinglePCOverlayDragging")},0);C(document).one("dragend",function(){var t=e.getComplexData("appointmentStartingBoundaries");a.removeClass("sapMSinglePCOverlayDragging");i.removeClass("sapUiDnDIndicatorHide");n.css({top:t.top,height:t.height,"z-index":"auto",opacity:1})});if(!D.browser.msie&&!D.browser.edge){t.getParameter("browserEvent").dataTransfer.setDragImage(E(),0,0)}}.bind(this),dragEnter:function(t){var e=t.getParameter("dragSession"),a=e.getDragControl().$().get(0),i=e.getDropControl().getDomRef(),n=e.getComplexData("appointmentStartingBoundaries"),r=function(){var t=C(e.getIndicator());t.addClass("sapUiDnDIndicatorHide")},o,s,l,p,g;if(!n){n={top:a.offsetTop,bottom:a.offsetTop+a.getBoundingClientRect().height,height:a.getBoundingClientRect().height};e.setComplexData("appointmentStartingBoundaries",n)}p=e.getData("bottomHandle")?n.top:n.bottom;o=Math.min(p,i.offsetTop);s=Math.max(p,i.offsetTop+i.getBoundingClientRect().height);l=s-o;g={top:o,height:l,"z-index":1,opacity:.8};e.getDragControl().$().css(g);if(!e.getIndicator()){setTimeout(r,0)}else{r()}},drop:function(t){var e=t.getParameter("dragSession"),a=e.getDragControl(),i=this.indexOfAggregation("_intervalPlaceholders",e.getDropControl()),n=e.getComplexData("appointmentStartingBoundaries"),r;r=this._calcResizeNewHoursAppPos(a.getStartDate(),a.getEndDate(),i,e.getData("bottomHandle"));this.$().find(".sapMSinglePCOverlay").removeClass("sapMSinglePCOverlayDragging");C(e.getIndicator()).removeClass("sapUiDnDIndicatorHide");a.$().css({top:n.top,height:n.height,"z-index":"auto",opacity:1});if(a.getEndDate().getTime()===r.endDate.getTime()&&a.getStartDate().getTime()===r.startDate.getTime()){return}this.fireAppointmentResize({appointment:a,startDate:r.startDate,endDate:r.endDate})}.bind(this)});this.addDragDropConfig(t)};I.prototype._configureAppointmentsCreate=function(){this.addDragDropConfig(new p({targetAggregation:"_intervalPlaceholders",dragStart:function(t){if(!this.getEnableAppointmentsCreate()){t.preventDefault();return}var e=this.$().find(".sapMSinglePCOverlay");setTimeout(function(){e.addClass("sapMSinglePCOverlayDragging")});C(document).one("dragend",function(){e.removeClass("sapMSinglePCOverlayDragging");C(".sapUiAppCreate").remove();C(".sapUiDnDDragging").removeClass("sapUiDnDDragging")});if(!D.browser.msie&&!D.browser.edge){t.getParameter("browserEvent").dataTransfer.setDragImage(E(),0,0)}}.bind(this),dragEnter:function(t){var e=t.getParameter("dragSession"),a=e.getDropControl(),i=a.getDomRef(),n=i.offsetHeight,r=i.offsetTop,o=r,s=i.getBoundingClientRect().left,l=s,p=a.$().parents(".sapMSinglePCColumn").get(0),g=C(".sapUiAppCreate");if(!g.get(0)){g=C("<div></div>").addClass("sapUiCalendarApp sapUiCalendarAppType01 sapUiAppCreate");g.appendTo(p)}C(".sapUiDnDDragging").removeClass("sapUiDnDDragging");if(!e.getComplexData("startingRectsDropArea")){e.setComplexData("startingRectsDropArea",{top:r,left:s});e.setComplexData("startingDropDate",a.getDate())}else{o=e.getComplexData("startingRectsDropArea").top;l=e.getComplexData("startingRectsDropArea").left}if(s!==l){t.preventDefault();return false}a.$().closest(".sapMSinglePCColumn").find(".sapMSinglePCAppointments").addClass("sapUiDnDDragging");g.css({top:Math.min(o,r)+2,height:Math.abs(o-r)+n-4,left:3,right:3,"z-index":2});e.setIndicatorConfig({display:"none"})},drop:function(t){var e=t.getParameter("dragSession"),a=e.getDropControl(),i=30*60*1e3,n=e.getComplexData("startingDropDate").getTime(),r=a.getDate().getJSDate().getTime(),o=Math.min(n,r),s=Math.max(n,r)+i;this.fireAppointmentCreate({startDate:new Date(o),endDate:new Date(s)});C(".sapUiAppCreate").remove();C(".sapUiDnDDragging").removeClass("sapUiDnDDragging")}.bind(this)}))};I.prototype._calcResizeNewHoursAppPos=function(t,e,a,i){var n=new Date(this.getStartDate().getFullYear(),this.getStartDate().getMonth(),this.getStartDate().getDate()),r=30*60*1e3,o=n.getTime()+a*r,s=o+r,l=i?t.getTime():e.getTime(),p=Math.min(l,o),g=Math.max(l,s);return{startDate:new Date(p),endDate:new Date(g)}};I.prototype._adjustAppointmentsHeightforCompact=function(t,e,a){var i,n,r,o,s,l,p,g,d=this._getRowHeight(),u=this;if(this._oAppointmentsToRender[t]){this._oAppointmentsToRender[t].oAppointmentsList.getIterator().forEach(function(c){i=c.getData();n=C("div[data-sap-day='"+t+"'].sapMSinglePCColumn #"+i.getId());r=i.getStartDate();o=i.getEndDate();p=e.getTime()>r.getTime();g=a.getTime()<o.getTime();s=p?0:u._calculateTopPosition(r);l=g?0:u._calculateBottomPosition(o);n.css("top",s);n.css("bottom",l);n.find(".sapUiCalendarApp").css("min-height",d/2-3)})}};I.prototype._adjustBlockersHeightforCompact=function(){var t=this._getBlockersToRender().iMaxlevel,e=(t+1)*this._getBlockerRowHeight(),a=this._getColumns()===1?e+T:e,i=this._getBlockerRowHeight();if(t>0){a=a+3}this.$().find(".sapMSinglePCBlockersColumns").css("height",a);this._oBlockersToRender.oBlockersList.getIterator().forEach(function(t){t.getData().$().css("top",i*t.level+1)})};I.prototype._adjustBlockersHeightforCozy=function(){var t=this._getBlockersToRender()&&this._getBlockersToRender().iMaxlevel,e;if(this._getColumns()===1){e=(t+1)*this._getBlockerRowHeight();this.$().find(".sapMSinglePCBlockersColumns").css("height",e+T)}};I.prototype.onAfterRendering=function(){var t=this._getColumns(),e=this.getStartDate(),a=this._getRowHeight();if(a===y){for(var i=0;i<t;i++){var n=new c(e.getFullYear(),e.getMonth(),e.getDate()+i),r=this._getDateFormatter().format(n.toLocalJSDate()),s=new o(n.getYear(),n.getMonth(),n.getDate(),this._getVisibleStartHour()),l=new o(n.getYear(),n.getMonth(),n.getDate(),this._getVisibleEndHour(),59,59);this._adjustAppointmentsHeightforCompact(r,s,l)}this._adjustBlockersHeightforCompact()}else{this._adjustBlockersHeightforCozy()}this._updateRowHeaderAndNowMarker();L.call(this)};I.prototype._appFocusHandler=function(t,e){var a=sap.ui.getCore().byId(t.target.id);if(a&&a.isA("sap.ui.unified.CalendarAppointment")){this.fireAppointmentSelect({appointment:undefined,appointments:this._toggleAppointmentSelection(undefined,true)});this._focusCellWithKeyboard(a,e);t.preventDefault()}};I.prototype._cellFocusHandler=function(t,e){var a=t.target,i=this._getDateFormatter(),n;if(a.classList.contains("sapMSinglePCRow")||a.classList.contains("sapMSinglePCBlockersColumn")){n=i.parse(a.getAttribute("data-sap-start-date"));if(this._isBorderReached(n,e)){this.fireEvent("borderReached",{startDate:n,next:e===m.ARROW_RIGHT,fullDay:a.classList.contains("sapMSinglePCBlockersColumn")})}}};I.prototype.onsapup=function(t){this._appFocusHandler(t,m.ARROW_UP)};I.prototype.onsapdown=function(t){this._appFocusHandler(t,m.ARROW_DOWN)};I.prototype.onsapright=function(t){this._appFocusHandler(t,m.ARROW_RIGHT);this._cellFocusHandler(t,m.ARROW_RIGHT)};I.prototype.onsapleft=function(t){this._appFocusHandler(t,m.ARROW_LEFT);this._cellFocusHandler(t,m.ARROW_LEFT)};I.prototype.setStartDate=function(t){this._oOldStartDate=this.getStartDate();this.getAggregation("_columnHeaders").setStartDate(t);return this.setProperty("startDate",t)};I.prototype.applyFocusInfo=function(t){var e=this._getVisibleBlockers(),a=this._getVisibleAppointments(),i=Object.keys(a),n,r,o;for(r=0;r<e.length;++r){if(e[r].getId()===t.id){e[r].focus();return this}}for(r=0;r<i.length;++r){n=a[i[r]];for(o=0;o<n.length;++o){if(n[o].getId()===t.id){n[o].focus();return this}}}return this};I.prototype.getSelectedAppointments=function(){return this.getAppointments().filter(function(t){return t.getSelected()})};I.prototype._toggleAppointmentSelection=function(t,e){var a=[],i,n,r;if(e){i=this.getAppointments();for(r=0,n=i.length;r<n;r++){if((!t||i[r].getId()!==t.getId())&&i[r].getSelected()){i[r].setProperty("selected",false,true);a.push(i[r]);C("[data-sap-ui="+i[r].getId()+"]").attr("aria-selected","false").find(".sapUiCalendarApp").removeClass("sapUiCalendarAppSel")}}}if(t){t.setProperty("selected",!t.getSelected(),true);a.push(t);C("[data-sap-ui="+t.getId()+"]").attr("aria-selected",t.getSelected()).find(".sapUiCalendarApp").toggleClass("sapUiCalendarAppSel",t.getSelected())}return a};I.prototype._isBorderReached=function(t,e){var a=c.fromLocalJSDate(this.getStartDate()),i=new c(a.getYear(),a.getMonth(),a.getDate()+this._getColumns()-1),n=c.fromLocalJSDate(t),r=e===m.ARROW_LEFT&&n.isSame(a),o=e===m.ARROW_RIGHT&&n.isSame(i);return r||o};I.prototype._focusCellWithKeyboard=function(t,e){var a=this.isAllDayAppointment(t.getStartDate(),t.getEndDate()),i=this._getDateFormatter(),n=new Date(t.getStartDate().getFullYear(),t.getStartDate().getMonth(),t.getStartDate().getDate(),t.getStartDate().getHours()),r=new Date(this.getStartDate().getFullYear(),this.getStartDate().getMonth(),this.getStartDate().getDate(),this.getStartDate().getHours());if(n<r){n=r}if(this._isBorderReached(n,e)){this.fireEvent("borderReached",{startDate:n,next:e===m.ARROW_RIGHT,fullDay:a});return}switch(e){case m.ARROW_UP:if(!a){n.setHours(n.getHours()-1)}break;case m.ARROW_DOWN:if(!a){n.setHours(n.getHours()+1)}break;case m.ARROW_LEFT:n.setDate(n.getDate()-1);break;case m.ARROW_RIGHT:n.setDate(n.getDate()+1);break;default:}if(a&&e!==m.ARROW_DOWN){C("[data-sap-start-date='"+i.format(n)+"'].sapMSinglePCBlockersColumn").focus()}else{C("[data-sap-start-date='"+i.format(n)+"'].sapMSinglePCRow").focus()}};I.prototype.ontap=function(t){this._fireSelectionEvent(t)};I.prototype.onkeydown=function(t){if(t.which===m.SPACE||t.which===m.ENTER){this._fireSelectionEvent(t);t.preventDefault()}};I.prototype._fireSelectionEvent=function(t){var e=t.srcControl,a=t.target;if(t.target.classList.contains("sapMSinglePCRow")||t.target.classList.contains("sapMSinglePCBlockersColumn")){this.fireEvent("cellPress",{startDate:this._getDateFormatter().parse(a.getAttribute("data-sap-start-date")),endDate:this._getDateFormatter().parse(a.getAttribute("data-sap-end-date"))});this.fireAppointmentSelect({appointment:undefined,appointments:this._toggleAppointmentSelection(undefined,true)})}else if(e&&e.isA("sap.ui.unified.CalendarAppointment")){this.fireAppointmentSelect({appointment:e,appointments:this._toggleAppointmentSelection(e,!(t.ctrlKey||t.metaKey))})}};I.prototype._getVisibleStartHour=function(){return this.getFullDay()||!this.getStartHour()?b:this.getStartHour()};I.prototype._getVisibleEndHour=function(){return(this.getFullDay()||!this.getEndHour()?w:this.getEndHour())-1};I.prototype._isVisibleHour=function(t){var e=this.getStartHour(),a=this.getEndHour();if(!this.getStartHour()){e=b}if(!this.getEndHour()){a=w}return e<=t&&t<a};I.prototype._shouldHideRowHeader=function(t){var e=(new Date).getHours(),a=h._areCurrentMinutesLessThan(15)&&e===t,i=h._areCurrentMinutesMoreThan(45)&&e===t-1;return a||i};I.prototype._parseDateStringAndHours=function(t,e){var a=this._getDateFormatter().parse(t);if(e){a.setHours(e)}return a};I.prototype._getDateFormatter=function(){if(!(this._oDateFormat instanceof r)){this._oDateFormat=r.getDateTimeInstance({pattern:"YYYYMMdd-HHmm"})}return this._oDateFormat};I.prototype._formatTimeAsString=function(t){var e=this._getHoursPattern()+":mm",a=r.getDateTimeInstance({pattern:e},new i(this._getCoreLocaleId()));return a.format(t)};I.prototype._addAMPM=function(t){var e=this._getAMPMFormat();return" "+e.format(t)};I.prototype._calculateTopPosition=function(t){var e=t.getHours()-this._getVisibleStartHour(),a=t.getMinutes(),i=this._getRowHeight();return Math.floor(i*e+i/60*a)};I.prototype._calculateBottomPosition=function(t){var e=this._getVisibleEndHour()+1-t.getHours(),a=t.getMinutes(),i=this._getRowHeight();return Math.floor(i*e-i/60*a)};I.prototype._updateRowHeaderAndNowMarker=function(){var t=new Date;this._updateNowMarker(t);this._updateRowHeaders(t);setTimeout(this._updateRowHeaderAndNowMarker.bind(this),R)};I.prototype._updateNowMarker=function(t){var e=this.$("nowMarker"),a=this.$("nowMarkerText"),i=this.$("nowMarkerAMPM"),n=!this._isVisibleHour(t.getHours());e.toggleClass("sapMSinglePCNowMarkerHidden",n);e.css("top",this._calculateTopPosition(t)+"px");a.text(this._formatTimeAsString(t));i.text(this._addAMPM(t));a.append(i)};I.prototype._updateRowHeaders=function(t){var e=this.$(),a=t.getHours(),i=a+1;e.find(".sapMSinglePCRowHeader").removeClass("sapMSinglePCRowHeaderHidden");if(this._shouldHideRowHeader(a)){e.find(".sapMSinglePCRowHeader"+a).addClass("sapMSinglePCRowHeaderHidden")}else if(this._shouldHideRowHeader(i)){e.find(".sapMSinglePCRowHeader"+i).addClass("sapMSinglePCRowHeaderHidden")}};I.prototype._createAppointmentsMap=function(t){var e=this;return t.reduce(function(t,a){var i=a.getStartDate(),n=a.getEndDate(),r,o,s;if(!i||!n){return t}if(!e.isAllDayAppointment(i,n)){r=c.fromLocalJSDate(i);o=c.fromLocalJSDate(n);while(r.isSameOrBefore(o)){s=e._getDateFormatter().format(r.toLocalJSDate());if(!t.appointments[s]){t.appointments[s]=[]}t.appointments[s].push(a);r.setDate(r.getDate()+1)}}else{t.blockers.push(a)}return t},{appointments:{},blockers:[]})};I.prototype._calculateVisibleAppointments=function(t,e,a){var i={},n,r,o;for(var s=0;s<a;s++){n=new c(e.getFullYear(),e.getMonth(),e.getDate()+s);r=this._getDateFormatter().format(n.toLocalJSDate());o=this._isAppointmentFitInVisibleHours(n);if(t[r]){i[r]=t[r].filter(o,this).sort(this._sortAppointmentsByStartHourCallBack)}}return i};I.prototype._isAppointmentFitInVisibleHours=function(t){return function(e){var a=e.getStartDate().getTime(),i=e.getEndDate().getTime(),n=new o(t.getYear(),t.getMonth(),t.getDate(),this._getVisibleStartHour()).getTime(),r=new o(t.getYear(),t.getMonth(),t.getDate(),this._getVisibleEndHour(),59,59).getTime();var s=a<n&&i>r,l=a>=n&&a<r,p=i>n&&i<=r;return s||l||p}};I.prototype._calculateAppointmentsLevelsAndWidth=function(e){var a=this;return Object.keys(e).reduce(function(i,n){var r=0,o=new t.list,s=e[n];s.forEach(function(e){var a=new t.node(e),i=e.getStartDate().getTime();if(o.getSize()===0){o.add(a);return}o.getIterator().forEach(function(t){var e=true,n=t.getData(),o=n.getStartDate().getTime(),s=n.getEndDate().getTime(),l=s-o;if(l<H){s=s+(H-l)}if(i>=o&&i<s){a.level++;r=Math.max(r,a.level)}if(t.next&&t.next.level===a.level){e=false}if(i>=s&&e){this.interrupt()}});o.insertAfterLevel(a.level,a)});i[n]={oAppointmentsList:a._calculateAppointmentsWidth(o),iMaxLevel:r};return i},{})};I.prototype._calculateAppointmentsWidth=function(e){e.getIterator().forEach(function(a){var i=a.getData(),n=a.level,r=a.level,o=i.getStartDate().getTime(),s=i.getEndDate().getTime(),l=s-o;if(l<H){s=s+(H-l)}new t.iterator(e).forEach(function(t){var e=t.getData(),i=t.level,l=e.getStartDate().getTime(),p=e.getEndDate().getTime(),g=p-l;if(g<H){p=p+(H-g)}if(r>=i){return}if(o>=l&&o<p||s>l&&s<p||o<=l&&s>=p){a.width=i-r;this.interrupt();return}if(n<i){n=i;a.width++}})});return e};I.prototype._calculateVisibleBlockers=function(t,e,a){var i=new c(e.getYear(),e.getMonth(),e.getDate()+a-1),n=this._isBlockerVisible(e,i);return t.filter(n).sort(this._sortAppointmentsByStartHourCallBack)};I.prototype._isBlockerVisible=function(t,e){return function(a){var i=c.fromLocalJSDate(a.getStartDate()),n=c.fromLocalJSDate(a.getEndDate());var r=i.isBefore(t)&&n.isAfter(e),o=h._isBetween(i,t,e,true),s=h._isBetween(n,t,e,true);return r||o||s}};I.prototype._calculateBlockersLevelsAndWidth=function(e){var a=0,i=new t.list;e.forEach(function(e){var n=new t.node(e),r=c.fromLocalJSDate(e.getStartDate()),o=c.fromLocalJSDate(e.getEndDate());n.width=h._daysBetween(o,r);if(i.getSize()===0){i.add(n);return}i.getIterator().forEach(function(t){var e=true,i=t.getData(),o=c.fromLocalJSDate(i.getStartDate()),s=c.fromLocalJSDate(i.getEndDate());if(r.isSameOrAfter(o)&&r.isSameOrBefore(s)){n.level++;a=Math.max(a,n.level)}if(t.next&&t.next.level===n.level){e=false}if(r.isSameOrAfter(s)&&e){this.interrupt()}});i.insertAfterLevel(n.level,n)},this);return{oBlockersList:i,iMaxlevel:a}};I.prototype._sortAppointmentsByStartHourCallBack=function(t,e){return t.getStartDate().getTime()-e.getStartDate().getTime()||e.getEndDate().getTime()-t.getEndDate().getTime()};I.prototype._getVisibleAppointments=function(){return this._oVisibleAppointments};I.prototype._getAppointmentsToRender=function(){return this._oAppointmentsToRender};I.prototype._getVisibleBlockers=function(){return this._aVisibleBlockers};I.prototype._getBlockersToRender=function(){return this._oBlockersToRender};I.prototype._setColumns=function(t){this._iOldColumns=this._iColumns;this._iColumns=t;this.getAggregation("_columnHeaders").setDays(t);this.invalidate();return this};I.prototype._getColumns=function(){return this._iColumns};I.prototype._getRowHeight=function(){return this._isCompact()?y:A};I.prototype._getBlockerRowHeight=function(){return this._isCompact()?M:S};I.prototype._isCompact=function(){var t=this.getDomRef();while(t&&t.classList){if(t.classList.contains("sapUiSizeCompact")){return true}t=t.parentNode}return false};I.prototype._getCoreLocaleId=function(){if(!this._sLocale){this._sLocale=sap.ui.getCore().getConfiguration().getFormatSettings().getFormatLocale().toString()}return this._sLocale};I.prototype._getCoreLocaleData=function(){var t,e;if(!this._oLocaleData){t=this._getCoreLocaleId();e=new i(t);this._oLocaleData=a.getInstance(e)}return this._oLocaleData};I.prototype._hasAMPM=function(){var t=this._getCoreLocaleData();return t.getTimePattern("short").search("a")>=0};I.prototype._getHoursFormat=function(){var t=this._getCoreLocaleId();if(!this._oHoursFormat||this._oHoursFormat.oLocale.toString()!==t){var e=new i(t),a=this._getHoursPattern();this._oHoursFormat=r.getTimeInstance({pattern:a},e)}return this._oHoursFormat};I.prototype._getHoursPattern=function(){return this._hasAMPM()?"h":"H"};I.prototype._getAMPMFormat=function(){var t=this._getCoreLocaleId(),e=new i(t);if(!this._oAMPMFormat||this._oAMPMFormat.oLocale.toString()!==t){this._oAMPMFormat=r.getTimeInstance({pattern:"a"},e)}return this._oAMPMFormat};I.prototype._getColumnHeaders=function(){return this.getAggregation("_columnHeaders")};I.prototype._getAppointmentAnnouncementInfo=function(t){var e=this._oUnifiedRB.getText("CALENDAR_START_TIME"),a=this._oUnifiedRB.getText("CALENDAR_END_TIME"),i=this._oFormatStartEndInfoAria.format(t.getStartDate()),n=this._oFormatStartEndInfoAria.format(t.getEndDate()),r=e+": "+i+"; "+a+": "+n;return r+"; "+v.findLegendItemForItem(sap.ui.getCore().byId(this._sLegendId),t)};I.prototype.enhanceAccessibilityState=function(t,e){if(t.getId()===this._getColumnHeaders().getId()){e.labelledby=n.getStaticId("sap.m","PLANNINGCALENDAR_DAYS")}};I.prototype._getCellStartEndInfo=function(t,e){var a=this._oUnifiedRB.getText("CALENDAR_START_TIME"),i=this._oUnifiedRB.getText("CALENDAR_END_TIME"),n=!e;if(n){return a+": "+this._oFormatAriaFullDayCell.format(t)+"; "}return a+": "+this._oFormatStartEndInfoAria.format(t)+"; "+i+": "+this._oFormatStartEndInfoAria.format(e)};I.prototype.isAllDayAppointment=function(t,e){var a=t.getHours()===0,i=t.getMinutes()===0,n=t.getSeconds()===0,r=t.getMilliseconds()===0,o=a&&i&&n&&r,s=false;if(o){s=this._isEndTime0000(t,e)}return s};I.prototype._isEndTime0000=function(t,e){return(e.getTime()-t.getTime())%P===0};I.prototype._createBlockersDndPlaceholders=function(t,e){this.destroyAggregation("_blockersPlaceholders");for(var a=0;a<e;a++){var i=new o(t.getFullYear(),t.getMonth(),t.getDate()+a);var n=new B({date:i});this.addAggregation("_blockersPlaceholders",n,true)}};I.prototype._createAppointmentsDndPlaceholders=function(t,e){var a=this._getVisibleStartHour(),i=this._getVisibleEndHour();this._dndPlaceholdersMap={};this.destroyAggregation("_intervalPlaceholders");for(var n=0;n<e;n++){var r=new c(t.getFullYear(),t.getMonth(),t.getDate()+n);if(!this._dndPlaceholdersMap[r]){this._dndPlaceholdersMap[r]=[]}for(var s=a;s<=i;s++){var l=this._dndPlaceholdersMap[r],p=r.getYear(),g=r.getMonth(),d=r.getDate();l.push(this._createAppointmentsDndPlaceHolder(new o(p,g,d,s)));l.push(this._createAppointmentsDndPlaceHolder(new o(p,g,d,s,30)))}}};I.prototype._createAppointmentsDndPlaceHolder=function(t){var e=new B({date:t});this.addAggregation("_intervalPlaceholders",e,true);return e};function E(){var t=C("<span></span>").addClass("sapUiCalAppResizeGhost");t.appendTo(document.body);setTimeout(function(){t.remove()},0);return t.get(0)}var B=e.extend("sap.m.SinglePlanningCalendarGrid._internal.IntervalPlaceholder",{metadata:{properties:{date:{type:"object",group:"Data"}}},renderer:function(t,e){t.write("<div");t.writeControlData(e);t.addClass("sapMSinglePCPlaceholder");t.writeClasses();t.write("></div>")}});function L(){var t=this.getDomRef(),e=this.$().find(".sapMSinglePCBlockersColumn").toArray();this._aGridCells=Array.prototype.concat(e);for(var a=0;a<=this._getVisibleEndHour();++a){e=this.$().find("div[data-sap-hour='"+a+"']").toArray();this._aGridCells=this._aGridCells.concat(e)}if(!this._oItemNavigation){this._oItemNavigation=new _;this.addDelegate(this._oItemNavigation)}this._oItemNavigation.setRootDomRef(t);this._oItemNavigation.setItemDomRefs(this._aGridCells);this._oItemNavigation.setCycling(false);this._oItemNavigation.setDisabledModifiers({sapnext:["alt","meta"],sapprevious:["alt","meta"],saphome:["alt","meta"],sapend:["meta"]});this._oItemNavigation.setTableMode(true,true).setColumns(this._getColumns());this._oItemNavigation.setPageSize(this._aGridCells.length)}return I});