/*
 * Isomorphic SmartClient
 * Version v9.0p_2021-05-01 (2021-05-01)
 * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 *
 * licensing@smartclient.com
 *
 * http://smartclient.com/license
 */

if(window.isc&&window.isc.module_Core&&!window.isc.module_Calendar){isc.module_Calendar=1;isc._moduleStart=isc._Calendar_start=(isc.timestamp?isc.timestamp():new Date().getTime());if(isc._moduleEnd&&(!isc.Log||(isc.Log&&isc.Log.logIsDebugEnabled('loadTime')))){isc._pTM={message:'Calendar load/parse time: '+(isc._moduleStart-isc._moduleEnd)+'ms',category:'loadTime'};if(isc.Log&&isc.Log.logDebug)isc.Log.logDebug(isc._pTM.message,'loadTime');else if(isc._preLog)isc._preLog[isc._preLog.length]=isc._pTM;else isc._preLog=[isc._pTM]}isc.definingFramework=true;if(window.isc&&isc.version!="v9.0p_2021-05-01/LGPL Deployment"){isc.logWarn("SmartClient module version mismatch detected: This application is loading the core module from SmartClient version '"+isc.version+"' and additional modules from 'v9.0p_2021-05-01/LGPL Deployment'. Mixing resources from different SmartClient packages is not supported and may lead to unpredictable behavior. If you are deploying resources from a single package you may need to clear your browser cache, or restart your browser."+(isc.Browser.isSGWT?" SmartGWT developers may also need to clear the gwt-unitCache and run a GWT Compile.":""))}
isc.ClassFactory.defineClass("Calendar","Canvas","DataBoundComponent");isc.A=isc.Calendar.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.defaultWidth="100%";isc.A.defaultHeight="100%";isc.A.year=new Date().getFullYear();isc.A.month=new Date().getMonth();isc.A.baseStyle="calendar";isc.A.dayHeaderBaseStyle="calMonthDayHeader";isc.A.dayBodyBaseStyle="calMonthDayBody";isc.A.otherDayHeaderBaseStyle="calMonthOtherDayHeader";isc.A.otherDayBodyBaseStyle="calMonthOtherDayBody";isc.A.otherDayBlankStyle="calMonthOtherDayBlank";isc.A.minimumDayHeight=80;isc.A.selectedCellStyle="calendarCellSelected";isc.A.eventWindowStyle="eventWindow";isc.A.calMonthEventLinkStyle="calMonthEventLink";isc.A.workdayBaseStyle="calendarWorkday";isc.A.workdayStart="9:00am";isc.A.workdayEnd="5:00pm";isc.A.showWorkday=false;isc.A.workdays=[1,2,3,4,5];isc.A.scrollToWorkday=false;isc.A.nameField="name";isc.A.descriptionField="description";isc.A.startDateField="startDate";isc.A.endDateField="endDate";isc.A.leadingDateField="leadingDate";isc.A.trailingDateField="trailingDate";isc.A.labelColumnWidth=60;isc.A.timelineEventPadding=0;isc.A.eventDragGap=10;isc.A.laneNameField="lane";isc.A.eventWindowStyleField="eventWindowStyle";isc.A.canEditField="canEdit";isc.A.canRemoveField="canRemove";isc.A.canDragEventField="canDrag";isc.A.weekEventBorderOverlap=false;isc.A.eventSnapGap=30;isc.A.showQuickEventDialog=true;isc.A.canCreateEvents=true;isc.A.canEditEvents=true;isc.A.canRemoveEvents=true;isc.A.canDragEvents=true;isc.A.showDateChooser=false;isc.A.disableWeekends=true;isc.A.showWeekends=true;isc.A.showDayHeaders=true;isc.A.showOtherDays=true;isc.A.eventAutoArrange=true;isc.A.eventOverlap=true;isc.A.eventOverlapPercent=10;isc.A.showTimelineView=false;isc.A.renderEventsOnDemand=true;isc.A.timelineGranularity="day";isc.A.timelineUnitsPerColumn=1;isc.A.canResizeTimelineEvents=false;isc.A.defaultTimelineColumnSpan=20;isc.A.weekPrefix="Week";isc.A.showEventDescriptions=true;isc.A.allowEventOverlap=true;isc.A.sizeEventsToGrid=true;isc.A.dayViewTitle="Day";isc.A.weekViewTitle="Week";isc.A.monthViewTitle="Month";isc.A.timelineViewTitle="Timeline";isc.A.eventNameFieldTitle="Event Name";isc.A.eventStartDateFieldTitle="From";isc.A.eventEndDateFieldTitle="To";isc.A.eventDescriptionFieldTitle="Description";isc.A.eventLaneFieldTitle="Lane";isc.A.saveButtonTitle="Save Event";isc.A.detailsButtonTitle="Edit Details";isc.A.cancelButtonTitle="Cancel";isc.A.previousButtonHoverText="Previous";isc.A.nextButtonHoverText="Next";isc.A.addEventButtonHoverText="Add an event";isc.A.datePickerHoverText="Choose a date";isc.A.invalidDateMessage="From must be before To";isc.A.dayViewConstructor="DaySchedule";isc.A.weekViewConstructor="WeekSchedule";isc.A.monthViewConstructor="MonthSchedule";isc.A.timelineViewConstructor="TimelineView";isc.A.mainViewDefaults={_constructor:isc.TabSet,defaultWidth:"80%",defaultHeight:"100%",tabBarAlign:"right",selectedTab:1};isc.A.dateChooserConstructor="DateChooser";isc.A.eventDialogConstructor="Window";isc.A.eventDialogDefaults={showHeaderIcon:false,showMinimizeButton:false,showMaximumButton:false,canDragReposition:true,overflow:"visible",bodyProperties:{overflow:"visible"},width:400,height:100};isc.A.eventEditorConstructor="DynamicForm";isc.A.eventEditorDefaults={padding:4,numCols:4,showInlineErrors:false,width:460,titleWidth:60};isc.A.eventEditorLayoutConstructor="Window";isc.A.eventEditorLayoutDefaults={showHeaderIcon:false,showShadow:false,showMinimizeButton:false,showMaximumButton:false,canDragReposition:false};isc.A.addEventButtonConstructor="ImgButton";isc.A.addEventButtonDefaults={title:"",src:"[SKINIMG]actions/add.png",showRollOver:false,showDown:false,showFocused:false,width:16,height:16};isc.A.datePickerButtonConstructor="ImgButton";isc.A.datePickerButtonDefaults={title:"",src:"[SKIN]/controls/date_control.gif",width:16,height:16,showRollOver:false,showFocused:false};isc.A.showControlsBar=true;isc.A.controlsBarConstructor="HLayout";isc.A.controlsBarDefaults={defaultLayoutAlign:"center",height:25,membersMargin:5};isc.A.previousButtonConstructor="ImgButton";isc.A.previousButtonDefaults={title:"",src:"[SKINIMG]actions/back.png",showFocused:false,width:16,height:16,click:function(){this.creator.previous()},showRollOver:false,showDown:false};isc.A.nextButtonConstructor="ImgButton";isc.A.nextButtonDefaults={title:"",src:"[SKINIMG]actions/forward.png",showFocused:false,width:16,height:16,click:function(){this.creator.next()},showRollOver:false,showDown:false};isc.A.dateLabelConstructor="Label";isc.A.dateLabelDefaults={wrap:false,width:5,height:20,contents:"-"};isc.A.DAY="day";isc.A.WEEK="week";isc.A.MONTH="month";isc.A.TIMELINE="timeline";isc.A.rowHeight=isc.ListGrid.getInstanceProperty("cellHeight");isc.A.dateFormatter=null;isc.A.timeFormatter="toShortPaddedTime";isc.A.eventsOverlapGridLines=true;isc.A.$81i=/^\d{4}.\d\d?.\d\d?$/;isc.A.$81j=/^\d\d?.\d\d.\d{4}?$/;isc.A.newEventEditorWindowTitle="New Event";isc.A.gridProps={getPrintHTML:function(_1,_2){_1=isc.addProperties({},_1);this.body.printChildrenAbsolutelyPositioned=true;var _3=this.creator,_4=_3.getCurrentViewName(),_5=_3.isTimeline(),_6=this.$53i,_7=_4=="day",_8=_4=="month";if(_8)return;var _9=this.getFields(),_10=this.getData(),_11=isc.StringBuffer.create(),_12=0,_13=null,_14=this;if(_5){_13=_9.map(function(_30){return _14.getFieldWidth(_30)});if(this.frozenFields)_12+=this.frozenBody.$26a.sum()}else{_12=this.body.$26a.sum();if(this.frozenBody)_12+=this.frozenBody.$26a.sum()}
var _15="<TR",_16="</TR>",_17=">",_18=" HEIGHT=",_19=" VALIGN=";var _20=40;_11.append("<TABLE WIDTH=",_12," style='position: absolute; top:",_20,"px;'>");if(this.showHeader){_11.append(this.getPrintHeaders(0,this.fields.length))}
_20+=this.getHeaderHeight();_11.append("<TABLE  WIDTH=",_12," role='presentation' border='' class:'",this.baseStyle,"' ","style='borderSpacing:0px; position: absolute; top:",_20,"px; z-index: -1' cellpadding='0' cellspacing='0'>");for(var i=0;i<_10.length;i++){_11.append(_15,_18,this.getRowHeight(i),_17);for(var j=0;j<_9.length;j++){var _23=this.getCellValue(_10[i],i,j);_11.append("<TD padding=0 class='",this.getCellStyle(_10[i],i,j),"' ","style='margin: 0px; padding: 0px; ","width:",this.getFieldWidth(j)+(j==0?2:4),"px' ","border-width: 0px 1px 1px 0px; ","border-bottom: 1px solid #ABABAB; border-right: 1px solid #ABABAB; ","border-top: none; border-left: none;'>");_11.append(this.getCellValue(_10[i],i,j)||"&nbsp;");_11.append("</TD>")}
_11.append(_16)}
var _24=[];if(_3.isTimeline()){_24=this.getVisibleEvents();for(var i=0;i<_24.length;i++){var _25=_24.get(i),_26=_3.getEventWindowID(_25),_27=window[_26],_28=isc.addProperties({},_1,{i:i});if(_27){_11.append(_27.getPrintHTML(_1,_2))}}}else{_24=this.body.children;for(var i=0;i<_24.length;i++){if(!isc.isAn.EventWindow(_24[i]))continue;_11.append(_24[i].getPrintHTML(_1,_2))}}
_11.append("</TR>");_11.append("</TABLE>");_11.append("</TABLE>");var _29=_11.toString();return _29},getPrintHeaders:function(_1,_2){var _3=(this.isRTL()?isc.Canvas.LEFT:isc.Canvas.RIGHT),_4=this.printHeaderStyle||this.headerBaseStyle,_5;if(this.headerSpans){var _6=[],_7=1;for(var i=_1;i<_2;i++){var _9=this.getField(i);_6[i]=[_9];var _10=this.spanMap[_9.name];while(_10!=null){_6[i].add(_10);_10=_10.parentSpan}
_7=Math.max(_6[i].length,_7)}
_5=[];for(var i=_7-1;i>=0;i--){_5[_5.length]="<TR>";var _11=null,_12=null;for(var _13=_1;_13<_2;_13++){var _14=1,_15=1;var _16=(i==0);var _17=_6[_13][i];if(_17=="spanned"){continue}
var _18,_19=_13,_20=[];_15=0;while(_19<_2){var _21=null,_22=false;for(var _23=0;(i-_23)>=0;_23++){_21=_6[_19][i-_23];if(_21!=null){if(_17==null){_17=_21;_18=_23;if(i-_23==0){_16=true}}
if(_17==_21){_20[_15]=_23;_18=Math.min(_23,_18)}else{_22=true}
break}}
if(_22){break}
_19++;_15++}
if(_18!=null){_14=_18+1}
for(var _24=0;_24<_20.length;_24++)
{var _25=_6[_24+_13],_23=_20[_24];for(var _26=0;_26<=_23;_26++){if(_24==0&&_26==0){_25[i-_26]=_17}else if(_26<=_18){_25[i-_26]="spanned"}else{_25[i-_26]=null}}}
if(_17==null){this.logWarn("Error in getPrintHeaders() - unable to generate print header HTML from this component's specified headerSpans")}
var _27="center",_28;if(_16){_27=_17.align||_3;_28=this.getHeaderButtonTitle(_17.masterIndex)}else{_28=_17.title}
var _29=_5.length;_5[_5.length]="<TD class='";_5[_5.length]=_4;_5[_5.length]="' align='";_5[_5.length]="center";_5[_5.length]="' rowSpan='";_5[_5.length]=_14;_5[_5.length]="' colSpan='";_5[_5.length]=_15;_5[_5.length]="' width=";_5[_5.length]=this.getFieldWidth(_17);_5[_5.length]=">";_5[_5.length]=_28;_5[_5.length]="</TD>"}
_5[_5.length]="</TR>"}}else{var _5=["<TR>"];var _30=["<TD CLASS=",_4," ALIGN="].join("");if(this.frozenBody){for(var _31=0;_31<this.frozenFields.length;_31++){var _9=this.frozenBody.fields[_31];if(!_9)continue;var _27=_9.align||_3;var _32=this.getFieldWidth(_31);_5.addList([_30,_27," width="+_32+">",this.getHeaderButtonTitle(_9.masterIndex),"</TD>"])}}
for(var _31=_1;_31<_2;_31++){var _9=this.body.fields[_31];if(!_9)continue;var _27=_9.align||_3;var _32=this.getFieldWidth(_31);_5.addList([_30,_27," width="+_32+">",this.getHeaderButtonTitle(_9.masterIndex),"</TD>"])}
_5[_5.length]="</TR>"}
return _5.join(isc.emptyString)}};isc.B.push(isc.A.scrollToTime=function isc_Calendar_scrollToTime(_1){var _2=this.getSelectedView(),_3=_2.getRowHeight(1),_4=0;_1=isc.Time.parseInput(_1);if(isc.isA.Date(_1)){var _5=_1.getHours()*2;if(_1.getMinutes()>=30)_5++;var _6=_2.getRowHeight(null,0)*_5;_2.body.scrollTo(0,_6);_2.redraw()}},isc.A.setHeaderLevels=function isc_Calendar_setHeaderLevels(_1){this.headerLevels=_1;if(this.timelineView)this.timelineView.rebuild()},isc.A.getWorkdayStart=function isc_Calendar_getWorkdayStart(_1){return this.workdayStart},isc.A.getWorkdayEnd=function isc_Calendar_getWorkdayEnd(_1){return this.workdayEnd},isc.A.getVisibleStartDate=function isc_Calendar_getVisibleStartDate(){var _1=this.getSelectedView();if(!_1||isc.isAn.emptyString(_1))return null;if(_1==this.dayView)return this.chosenDate;if(_1==this.monthView)return this.getCellDate(0,0);return this.getCellDate(0,1)},isc.A.getVisibleEndDate=function isc_Calendar_getVisibleEndDate(){var _1=this.getSelectedView();if(_1==this.dayView)return this.chosenDate;return this.getCellDate(_1.getData().length-1,_1.getFields().length-1)},isc.A.getPeriodStartDate=function isc_Calendar_getPeriodStartDate(){var _1=this.getSelectedView(),_2=this.chosenDate;if(_1==this.dayView){return _2}else if(_1==this.weekView){return isc.DateUtil.getStartOf(_2,isc.DateUtil.getTimeUnitKey("week"))}else if(_1==this.monthView){return isc.DateUtil.getStartOf(_2,isc.DateUtil.getTimeUnitKey("month"))}},isc.A.getPeriodEndDate=function isc_Calendar_getPeriodEndDate(){var _1=this.getSelectedView(),_2=this.chosenDate;if(_1==this.dayView){return _2}else if(_1==this.weekView){return isc.DateUtil.getEndOf(_2,isc.DateUtil.getTimeUnitKey("week"))}else if(_1==this.monthView){return isc.DateUtil.getEndOf(_2,isc.DateUtil.getTimeUnitKey("month"))}},isc.A.setLanes=function isc_Calendar_setLanes(_1){if(!_1)return;this.lanes=_1;if(this.timelineView)this.timelineView.setLanes(this.lanes)},isc.A.addLane=function isc_Calendar_addLane(_1,_2){var _3=this.timelineView;if(!_3)return;if(!this.lanes)this.lanes=[];if(_2==null)_2=this.lanes.length;this.lanes.add(_1,_2);_3.setLanes(this.lanes)},isc.A.removeLane=function isc_Calendar_removeLane(_1){var _2=this.timelineView;if(!_2||!this.lanes)return;if(isc.isA.String(_1))_1=this.lanes.find("name",_1);if(_1){this.lanes.remove(_1);_2.setLanes(this.lanes)}},isc.A.initWidget=function isc_Calendar_initWidget(){if(!this.chosenDate)this.chosenDate=new Date();this.year=this.chosenDate.getFullYear();this.month=this.chosenDate.getMonth();if(this.firstDayOfWeek==null)
this.firstDayOfWeek=Number(isc.DateChooser.getInstanceProperty("firstDayOfWeek"));if(this.timelineSnapGap!=null){this.snapGap=this.timelineSnapGap;delete this.timelineSnapGap}
if(this.timelineStartDate!=null){this.startDate=this.timelineStartDate.duplicate();delete this.timelineStartDate}
if(this.timelineEndDate!=null){this.endDate=this.timelineEndDate.duplicate();delete this.timelineEndDate}
if(this.timelineLabelFields!=null){this.laneFields=this.timelineLabelFields;this.timelineLabelFields=null}
if(this.eventTypeData!=null){this.lanes=isc.clone(this.eventTypeData);this.eventTypeData=null}
if(this.eventTypeField!=null){this.laneNameField=this.eventTypeField;delete this.eventTypeField}
if(this.showDescription!=null){this.showEventDescriptions=this.showDescription;delete this.showDescription}
if(this.canEditEventType!=null){this.canEditLane=this.canEditEventType;delete this.canEditEventType}
if(this.canDeleteEvents!=null){this.canRemoveEvents=this.canDeleteEvents;delete this.canDeleteEvents}
if(this.overlapSortSpecifiers&&!isc.isAn.Array(this.overlapSortSpecifiers)){this.overlapSortSpecifiers=[this.overlapSortSpecifiers]}
if(!this.data)this.data=this.getDefaultData();this.previousButtonDefaults.prompt=this.previousButtonHoverText;this.nextButtonDefaults.prompt=this.nextButtonHoverText;this.datePickerButtonDefaults.prompt=this.datePickerHoverText;this.addEventButtonDefaults.prompt=this.addEventButtonHoverText;this.$529();this.createChildren();this.$53a();if(!this.initialCriteria&&this.autoFetchData)this.initialCriteria=this.getNewCriteria();this.setData(null);this.invokeSuper(isc.Calendar,"initWidget")},isc.A.autoDetectFieldNames=function isc_Calendar_autoDetectFieldNames(){this.dataSource=isc.DS.getDataSource(this.dataSource);var _1=this.dataSource,_2=isc.getValues(_1.getFields()),_3=1024000,_4;if(this.fieldIsMissing(this.nameField,_1)){this.nameField=_1.getTitleField()}
if(this.fieldIsMissing(this.descriptionField,_1)){_2.sortByProperties(["length"],[false]);_4={length:0};for(var i=0;i<_2.length;i++){var _6=_2.get(i);if(!_6.type||_6.type=="text"||_6.type=="string"){if(_6.length>255&&_6.length<_3){this.descriptionField=_6.name;break}else if(_6.length&&_6.length<_3&&_6.length>_4.length){_4=_6}else if(!_6.length){if(!_4)_4=_6}}}
if(this.fieldIsMissing(this.descriptionField,_1)&&_4)
this.descriptionField=_4.name}
if(this.fieldIsMissing(this.startDateField,_1)){_4=null;for(var i=0;i<_2.length;i++){var _6=_2.get(i);if((_6.type=="date"||_6.type=="datetime")){if(_6.name.toLowerCase().indexOf("start")>=0||_6.name.toLowerCase().indexOf("begin")>=0)
{this.startDateField=_6.name;break}else _4=_6}}
if(this.fieldIsMissing(this.startDateField,_1)&&_4)
this.startDateField=_4.name}
if(this.fieldIsMissing(this.endDateField,_1)){_4=null;for(var i=0;i<_2.length;i++){var _6=_2.get(i);if((_6.type=="date"||_6.type=="datetime")){if(_6.name.toLowerCase().indexOf("end")>=0||_6.name.toLowerCase().indexOf("stop")>=0)
{this.endDateField=_6.name;break}else if(_6.name!=this.startDateField)
_4=_6}}
if(this.fieldIsMissing(this.endDateField,_1)&&_4)
this.endDateField=_4.name}},isc.A.fieldIsMissing=function isc_Calendar_fieldIsMissing(_1,_2){return(!_1||_1==""||(_2&&!_2.getField(_1)))},isc.A.getDefaultData=function isc_Calendar_getDefaultData(){return[]},isc.A.setData=function isc_Calendar_setData(_1){if(this.data==_1)return;if(this.data){this.ignore(this.data,"dataChanged");if(this.data.$31k&&isc.isA.Function(this.data.destroy))
this.data.destroy()}
if(_1)this.data=_1;if(!this.data)return;this.observe(this.data,"dataChanged","observer.dataChanged()");if(this.hasData()){this.dataChanged()}},isc.A.getData=function isc_Calendar_getData(){return this.data},isc.A.hasData=function isc_Calendar_hasData(){if(!this.data||(isc.ResultSet&&isc.isA.ResultSet(this.data)&&!this.data.lengthIsKnown()))
{return false}else{return true}},isc.A.dataChanged=function isc_Calendar_dataChanged(){if(this.destroying||this.destroyed)return;if(this.$53e){this.logDebug('dataChanged, ignoring','calendar');this.$53e=false}else{this.logDebug('dataChanged, refreshing','calendar');this.refreshSelectedView()}},isc.A.destroy=function isc_Calendar_destroy(){if(this.data)this.ignore(this.data,"dataChanged");this.Super("destroy",arguments)},isc.A.refreshSelectedView=function isc_Calendar_refreshSelectedView(){if(this.dayViewSelected()){this.dayView.refreshEvents();if(this.monthView)this.monthView.refreshEvents()}else if(this.weekViewSelected()){this.weekView.refreshEvents();if(this.monthView)this.monthView.refreshEvents()}else if(this.monthViewSelected()){this.monthView.refreshEvents()}else if(this.timelineViewSelected()){this.timelineView.refreshEvents()}},isc.A.getSelectedView=function isc_Calendar_getSelectedView(){if(this.dayViewSelected()){return this.dayView}else if(this.weekViewSelected()){return this.weekView}else if(this.monthViewSelected()){return this.monthView}else if(this.timelineViewSelected()){return this.timelineView}},isc.A.setRowHeight=function isc_Calendar_setRowHeight(_1){this.rowHeight=_1;if(this.dayView){this.dayView.setCellHeight(this.rowHeight);this.dayView.refreshEvents()}
if(this.weekView){this.weekView.setCellHeight(this.rowHeight);this.weekView.refreshEvents()}},isc.A.getCurrentViewName=function isc_Calendar_getCurrentViewName(){var _1=this.getSelectedView();return _1!=null?_1.viewName:null},isc.A.setCurrentViewName=function isc_Calendar_setCurrentViewName(_1){var _2=this.mainView.tabs.find("viewName",_1);if(_2)this.mainView.selectTab(_2);return _1},isc.A.getEventWindowID=function isc_Calendar_getEventWindowID(_1){if(!_1)return null;var _2=this.getDataSource();if(_2&&_2.getPrimaryKeyFieldNames().length>0){var _3=_2.getPrimaryKeyFields();var _4="";for(var _5 in _3){_4+=_1[_5]}
return this.$65c[_4]}else{return _1.$65d}},isc.A.setEventWindowID=function isc_Calendar_setEventWindowID(_1,_2){if(!this.$65c)this.$65c=[];var _3=this.getDataSource();if(_3&&_3.getPrimaryKeyFieldNames().length>0){var _4=_3.getPrimaryKeyFields();var _5="";for(var _6 in _4){_5+=_1[_6]}
this.$65c[_5]=_2}else{_1.$65d=_2}},isc.A.clearTimeSelection=function isc_Calendar_clearTimeSelection(){if(this.dayView)this.dayView.clearSelection();if(this.weekView)this.weekView.clearSelection()},isc.A.getDayDiff=function isc_Calendar_getDayDiff(_1,_2,_3){return Math.abs(isc.Date.$1094(_1,_2,_3,false))},isc.A.getEventStartCol=function isc_Calendar_getEventStartCol(_1,_2){var _3=_2||this.$64i(_1);var _4=this.getSelectedView().getEventColumn(_3.getLeft()+1);return _4},isc.A.getEventEndCol=function isc_Calendar_getEventEndCol(_1,_2){var _3=_2||this.$64i(_1);var _4=this.getSelectedView().getEventColumn(_3.getLeft()+_3.getVisibleWidth()+1);return _4},isc.A.getEventLeft=function isc_Calendar_getEventLeft(_1,_2){var _3=this.getSelectedView();var _4=(_3.showLabelColumn&&_3.labelColumnPosition=="left");var _5=_4?_3.labelColumnWidth:0;var _6=_3.getColumnWidth(_3.isLabelCol&&_3.isLabelCol(0)?1:0);if(_3.$53i){var _7=this.getDayDiff(_1[this.startDateField],this.chosenWeekStart,(this.showWeekends==false));_5=(_7*_6)+(_4?_3.labelColumnWidth:0)}
if(this.logIsDebugEnabled("calendar")){this.logDebug('calendar.getEventLeft() = '+_5+' for:'+isc.Log.echoFull(_1),'calendar')}
return _5},isc.A.setShowWeekends=function isc_Calendar_setShowWeekends(_1){this.showWeekends=_1;if(isc.isA.TabSet(this.mainView)){var _2=this.mainView.getSelectedTabNumber();this.mainView.removeTabs(this.mainView.tabs);if(this.dayView)this.dayView.destroy();if(this.weekView)this.weekView.destroy();if(this.monthView)this.monthView.destroy();var _3=this.$653();this.mainView.addTabs(_3);this.mainView.selectTab(_2)}else{var _4=this.children[0].members[1];var _5=_4.members[1];var _6=this.$653()[0].pane;_4.removeMember(_5);_5.destroy();_4.addMember(_6)}
this.$53a();this.setDateLabel()},isc.A.canEditEvent=function isc_Calendar_canEditEvent(_1){if(!_1)return false;else if(_1[this.canEditField]!=null)return _1[this.canEditField];else return this.canEditEvents},isc.A.canRemoveEvent=function isc_Calendar_canRemoveEvent(_1){if(!_1)return false;else if(_1[this.canRemoveField]!=null)return _1[this.canRemoveField];else return this.canRemoveEvents&&this.canEditEvent(_1)},isc.A.getDateEditingStyle=function isc_Calendar_getDateEditingStyle(){if(!this.timelineViewSelected()){return"time"}
var _1=this.dateEditingStyle;if(!_1){if(this.dataSource)_1=this.getDataSource().getField(this.startDateField).type;if(!_1){switch(this.timelineGranularity){case"hour":_1="datetime";break;case"millisecond","second","minute":_1="time";break;default:_1="date";break}}}
return _1},isc.A.addEvent=function isc_Calendar_addEvent(_1,_2,_3,_4,_5,_6,_7){if(_6==null)_6=true;if(!isc.isAn.Object(_5))_5={};var _8;if(isc.isA.Date(_1)){_8={};_8[this.startDateField]=_1;_8[this.endDateField]=_2;_8[this.nameField]=_3;_8[this.descriptionField]=_4;if(_7)_8[this.laneNameField]=_7;isc.addProperties(_8,_5)}else if(isc.isAn.Object(_1)){_8=_1}else{isc.logWarn('addEvent error: startDate parameter must be either a Date or an event record (Object)');return}
var _9=this;if(_6)this.$53e=true;if(this.dataSource){isc.DataSource.get(this.dataSource).addData(_8,function(_10,_11,_12){_9.processSaveResponse(_10,_11,_12)},{componentId:this.ID,willHandleError:true});return}else{this.$53e=true;this.data.add(_8);this.processSaveResponse({status:0},[_8],{operationType:"add"})}},isc.A.removeEvent=function isc_Calendar_removeEvent(_1,_2){if(_2==null)_2=true;var _3=_1[this.startDateField],_4=_1[this.endDateField];var _5=this;var _6=function(){if(_5.$53b(_3,_4)){_5.dayView.removeEvent(_1)}
if(_5.$53c(_3,_4)){_5.weekView.removeEvent(_1)}
if(_5.$53d(_3,_4)){_5.monthView.refreshEvents()}
if(_5.$664(_3,_4)){_5.timelineView.refreshEvents()}
if(_5.eventAutoArrange){if(_5.dayView)_5.dayView.refreshEvents();if(_5.weekView)_5.weekView.refreshEvents()}
if(_5.eventRemoved)_5.eventRemoved(_1)}
if(_2)this.$53e=true;if(this.dataSource){isc.DataSource.get(this.dataSource).removeData(_1,_6,{componentId:this.ID,oldValues:_1});return}else{this.data.remove(_1);_6()}},isc.A.updateEvent=function isc_Calendar_updateEvent(_1,_2,_3,_4,_5,_6,_7,_8){if(_7==null)_7=true;if(!isc.isAn.Object(_6))_6={};var _9=_1[this.startDateField];var _10=_1[this.endDateField];var _11=this;if(_7)this.$53e=true;if(this.dataSource){var _12,_13=isc.DataSource.get(this.dataSource);var _14={};_14[this.startDateField]=_2.duplicate();_14[this.endDateField]=_3.duplicate();_14[this.descriptionField]=_5;_14[this.nameField]=_4;if(_8)_14[this.laneNameField]=_8;var _15=isc.addProperties({},_1,_14,_6);_13.updateData(_15,function(_17,_18,_19){_11.processSaveResponse(_17,_18,_19,_1)},{oldValues:_1,componentId:this.ID,willHandleError:true});return}else{var _16=isc.addProperties({},_1);_1[this.startDateField]=_2.duplicate();_1[this.endDateField]=_3.duplicate();_1[this.descriptionField]=_5;_1[this.nameField]=_4;if(_8)_1[this.laneNameField]=_8;if(_1.$646)_1.$646.visited=false;;isc.addProperties(_1,_6);this.processSaveResponse({status:0},[_1],{operationType:"update"},_16)}},isc.A.processSaveResponse=function isc_Calendar_processSaveResponse(_1,_2,_3,_4){var _5=isc.isAn.Array(_2)?_2[0]:_2;if(!_5||isc.isA.String(_5))_5=_4;var _6=_3?_3.operationType:null,_7=_6=="update",_8=_6=="add",_9=this.$1115,_10=this.$1116,_11=_7&&_4?_4[this.startDateField]:null,_12=_7&&_4?_4[this.endDateField]:null;delete this.$1115;delete this.$1116;if(_1&&_1.status<0){var _13=_1?_1.errors:null;if(_9){if(_13)this.eventDialog.items[0].setErrors(_13,true);this.eventDialog.show()}else if(_10){this.eventEditorLayout.show();if(_13)this.eventEditor.setErrors(_13,true)}
if(!_13)isc.RPCManager.$a0(_1,_3)
return}
var _14=_5[this.startDateField],_15=_5[this.endDateField];if(this.$53b(_14,_15)||(_7&&this.$53b(_11,_12)))
{if(_7){this.dayView.refreshEvents()}else if(_8)this.dayView.addEvent(_5)}
if(this.$53c(_14,_15)){if(_7)this.weekView.updateEventWindow(_5);else if(_8)this.weekView.addEvent(_5)}
if(this.$53d(_14,_15)){this.monthView.refreshEvents()}
if(this.$664(_14,_15)){if(_7)this.timelineView.updateEventWindow(_5);else if(_8)this.timelineView.refreshEvents()}
if(_7&&this.eventChanged)this.eventChanged(_5);if(_8&&this.eventAdded)this.eventAdded(_5)},isc.A.eventsAreSame=function isc_Calendar_eventsAreSame(_1,_2){if(this.dataSource){var _3=isc.DataSource.get(this.dataSource),_4=_3.getPrimaryKeyFieldNames(),_5=true;for(var i=0;i<_4.length;i++){var _7=_4[i];if(_1[_7]!=_2[_7]){_5=false;break}}
return _5}else{return(_1===_2)}},isc.A.getEventTitle=function isc_Calendar_getEventTitle(_1){return _1[this.nameField]},isc.A.getEventHoverHTML=function isc_Calendar_getEventHoverHTML(_1,_2){var _3=this;var _4=_1[_3.startDateField],_5=_4.toShortDate(this.dateFormatter,false),_6=isc.Time.toTime(_4,this.timeFormatter,true),_7=_1[_3.endDateField],_8=_7.toShortDate(this.dateFormatter,false),_9=isc.Time.toTime(_7,this.timeFormatter,true),_10=_1[_3.nameField],_11=_1[_3.descriptionField],_12=_5+"&nbsp;"+_6+"&nbsp;-&nbsp;"+_9;if(this.isTimeline()){if(_4.getDate()!=_7.getDate()){_12=_5+"&nbsp;"+_6+"&nbsp;-&nbsp;"+_8+"&nbsp;"+_9}}
_12+=(_10||_11?"</br></br>":"")+(_10?_10+"</br></br>":"")+(_11?_11:"");return _12},isc.A.$53b=function isc_Calendar__shouldRefreshDay(_1,_2){if(!this.dayView)return false;var _3=new Date(this.year,this.month,this.chosenDate.getDate(),0,0);var _4=new Date(this.year,this.month,this.chosenDate.getDate(),23,59);if(this.dayView.body&&_3.getTime()<=_1.getTime()&&_4.getTime()>=_1.getTime()){return true}else return false},isc.A.$53c=function isc_Calendar__shouldRefreshWeek(_1,_2){if(!this.weekView)return false;var _3=this.chosenWeekEnd.duplicate();_3.setMinutes(_3.getMinutes()+1);if(this.weekView.body&&this.chosenWeekStart.getTime()<=_1.getTime()&&_3.getTime()>=_2.getTime()){return true}else return false},isc.A.$53d=function isc_Calendar__shouldRefreshMonth(_1,_2){if(!this.monthView)return false;var _3=new Date(this.year,this.month,-7);var _4=new Date(this.year,this.month,37);if(_3.getTime()<=_1.getTime()&&_4.getTime()>=_2.getTime()){return true}else return false},isc.A.$664=function isc_Calendar__shouldRefreshTimelineView(_1,_2){if(this.showTimelineView)return true;else return false},isc.A.$53f=function isc_Calendar__getNewEventWindow(_1,_2){var _3=this.canEditEvent(_1),_4=this.canRemoveEvent(_1),_5=_1[this.eventWindowStyleField]||this.eventWindowStyle;var _6=_2.poolEventWindows?_2.getPooledEventWindow():null;if(_6){_6.setProperties({className:_5,baseStyle:_5,headerStyle:_5+"Header",bodyStyle:_5+"Body",headerLabelProperties:{styleName:_5+"Header"},canDragReposition:_3,canDragResize:_3,_redrawWithParent:false,showCloseButton:_4,event:_1,descriptionText:_1[this.descriptionField]});if(_6.header)_6.header.setStyleName(_5+"Header");if(_6.headerLabel)_6.headerLabel.setStyleName(_5+"Header");if(_6.body)_6.body.setStyleName(_5+"Body")}else{var _6=this.createAutoChild("eventWindow",{calendar:this,className:_5,baseStyle:_5,canDragReposition:_3,canDragResize:_3,_redrawWithParent:false,showCloseButton:_4,event:_1,descriptionText:_1[this.descriptionField]},isc.EventWindow)}
return _6},isc.A.$53g=function isc_Calendar__getEventsInRange(_1,_2){var _3=[],_4=Date.getWeekendDays(),_5=this.data.getLength();for(var i=0;i<_5;i++){var _7=this.data.get(i);if(!_7||!_7[this.startDateField])return[];if(_7[this.startDateField].getTime()>=_1.getTime()&&_7[this.startDateField].getTime()<=_2.getTime()&&(this.showWeekends||!_4.contains(_7[this.startDateField].getDay()))){_3.add(_7)}}
return _3},isc.A.$64h=function isc_Calendar__getEventsTouchingRange(_1,_2,_3,_4){var _5=[],_6=Date.getWeekendDays(),_7=_1.getTime(),_8=this.getDayEnd(_1),_9=_2.getTime(),_10=_7,_11=_9,_12=false,_13=this.data.getLength(),_14=_1.getDay();_4=_4||[];var _15=(Date.compareDates(_1,_2)<0)?_8:_2;while(!_12){for(var i=0;i<_13;i++){var _17=this.data.get(i),_18=_17[this.startDateField],_19=_17[this.endDateField];if(_4.contains(_17)){continue}
if(!_18)return[];if((_19.getHours()==0&&_19.getMinutes()==0)||_19<_18){_19.setHours(23);_19.setMinutes(59);_19.setSeconds(59)}
var _20=_18.getTime(),_21=_18.getDay(),_22=_19.getTime(),_23=_19.getDay();var _24=(_20>=_7&&_20<_9&&_21==_14);var _25=(_22>_7&&_22<=_9&&_23==_14);var _26=(_20<=_7)&&(_22>=_9)&&(_21==_14);if((_24||_25||_26)&&(this.showWeekends||!_6.contains(_18.getDay())))
{_5.add(_17);if(_3){if(_18.getTime()<_10){_10=_18.getTime()}
if(_19.getTime()>_11){_11=_19.getTime()}}}}
if(!_3||(_10==_7&&_11==_9)){_12=true}else{_7=_10;_9=_11;_5.clear()}}
return _5},isc.A.$64i=function isc_Calendar__findEventWindow(_1,_2){var _3=(this.isTimeline()?this.timelineView:_2?this.weekView:this.dayView);if(!_3.body||!_3.body.children)return;var _4=_3.body.children;if(this.dataSource)this.$53s=isc.DataSource.get(this.dataSource).getLocalPrimaryKeyFields();for(var i=0;i<_4.length;i++){if(isc.isAn.EventWindow(_4[i])&&_3.areSame(_4[i].event,_1)&&_4[i].$53i==_2){return _4[i]}}
return false},isc.A.$64j=function isc_Calendar__prepareAutoArrangeOffsets(_1,_2){var _3=[],_4=60/this.eventSnapGap,_5=24*_4,_6=[new Array(_5),new Array(_5),new Array(_5),new Array(_5),new Array(_5),new Array(_5),new Array(_5)];for(var i=0;i<_5;i++){_3.add({usedCol:[0,0,0,0,0,0,0],assignedCol:[0,0,0,0,0,0,0],exactTime:[0,0,0,0,0,0,0]})}
var _8=_1.getLength();for(var i=0;i<_8;i++){var _9=_1.get(i);var _10=_9[this.startDateField],_11=_9[this.endDateField],_12=this.getEventLength(_10,_11),_13=_10.getDay();var _14=_10.getHours(),_15=_10.getMinutes(),_16=_15%this.eventSnapGap;if(_16){_15=_15-_16}
if(_14==24)_14=0;var _17=_11.getDay(),_18=_11.getHours(),_19=_11.getMinutes(),_20=_19%this.eventSnapGap;if(_17>_13){_18=24;_19=0;_20=0}
if(_20){_19=_19+(this.eventSnapGap-_20);if(_19==60){_19=0;_18++}}
var _21=(_14*_4)+Math.round(_15/this.eventSnapGap),_22=(_18*_4)+Math.round(_19/this.eventSnapGap);_9.$64k=0;_9.$64l=0;_9.$85h=_21;_9.$85i=_22;for(var _23=_21;_23<_22;_23++){var _24=_3[_23];var _25=_3[_23].usedCol[_13];var _26=_3[_23].assignedCol[_13];var _27=_3[_23].exactTime[_13];if(_6[_13][_23]==null)_6[_13][_23]=0;if(_23==_21){var _28=_26!=0;_9.$64k=_26;if(this.eventOverlap){if(!this.eventOverlapIdenticalStartTimes){_9.$64m=_27==0}else{_9.$64m=true}
_27=1}
_26++;if(_26>_6[_13][_23]){_6[_13][_23]=_26}
if(!_28&&_25!=0){_9.$64l=_25;_26=_25+1}else{if(_26<=_25){_9.$64l=_25;_26=_25+1}else{_9.$64l=_6[_13][_23]}}}else{if(_28){if(_26==0){if(_25==0){_25=_9.$64k}}else{if(_25==0){if(_9.$64k>_26){_25=_9.$64k}else{_26=_9.$64k+1}}else if(_26<_25){_26=_25+1}}}else{if(_26+1<_25){_26++}else{_26=_25+1}}}
_3[_23].usedCol[_13]=_25;_3[_23].assignedCol[_13]=_26;_3[_23].exactTime[_13]=_27}}
return _6});isc.evalBoundary;isc.B.push(isc.A.getDayEnd=function isc_Calendar_getDayEnd(_1){return new Date(_1.getFullYear(),_1.getMonth(),_1.getDate(),23,59,59)},isc.A.isTimeline=function isc_Calendar_isTimeline(){var _1=this.getCurrentViewName()=="timeline";return _1},isc.A.$64n=function isc_Calendar__renderEventRange(_1,_2,_3,_4){var _5=(this.isTimeline()?this.timelineView:_1?this.weekView:this.dayView);if(!_5||!_5.isDrawn())return;var _6=_5.getRowHeight(1),_7=_5.getColumnWidth(_5.isLabelCol(0)?1:0);var _8=_2,_9=_3;if(Date.compareDates(_8,_9)<0){_9=this.getDayEnd(_8)}
var _10=this.$64h(_8,_9,true,_4);if(!_10||_10.length==0)return;_10.sortByProperties([this.startDateField,this.endDateField],[true,false]);var _11=this.$64j(_10,_5);for(var i=0;i<_11.length;i++){for(var j=0;j<_11[i].length;j++){if(_11[i][j]==0)_11[i][j]=1}}
_10.unsort();_10.sortByProperties(["$64k"],[true]);var _14={min:_10.getProperty("$85h").min(),max:_10.getProperty("$85i").max()}
var _15=_10.getLength();for(var i=0;i<_15;i++){var _16=_10.get(i),_17=_16[this.startDateField],_18=_16[this.endDateField];var _19=_17.getDay();var _20=_11[_19];var _21=_20.max(_14.min,_14.max);if(_21==null){var _22=Math.max(_14.min,_14.max);if(_22!=null&&_20[_22]!=null){_21=_20[_22]}}
var _23=_7/Math.max(1,_21);if(_16.$64l==0)_16.$64l=1;var _24=this.getEventLeft(_16,_1);_24+=(_16.$64k*_23);var _25=(_16.$64l-_16.$64k)*_23;if(this.eventOverlap&&_16.$64m){if(_16.$64k>0){_24-=_23*(this.eventOverlapPercent/100);_25+=_23*(this.eventOverlapPercent/100)}}
var _26=_18.getHours(),_27=_18.getMinutes();if(_26==0&&(_27==0||_18.getDate()!=_17.getDate())){_26=24;_27=0}
var _28=(_26-_17.getHours())*(_6*2)
if(this.weekEventBorderOverlap&&_5.$53i)_25+=1;if(_17.getMinutes()>0){_28-=this.$54g(_17.getMinutes(),_6)}
if(_27>0){_28+=this.$54g(_27,_6)}
var _29=_17.getHours()*(_6*2);if(_17.getMinutes()>0){_29+=this.$54g(_17.getMinutes(),_6)}
var _30=this.$64i(_16,_1);if(this.eventsOverlapGridLines){_24-=1;_25+=1;_29-=1;_28+=1}
if(_16.$64l==_21||_21==0){_25-=this.eventDragGap}
if(_30){_30.renderEvent(_29,_24,_25,_28)}}},isc.A.getTimeSlotsTouchedByEventRange=function isc_Calendar_getTimeSlotsTouchedByEventRange(_1){var _2=this.$64h(_1[this.startDateField],_1[this.endDateField],true);var _3=_2.getProperty("$85h").min();var _4=_2.getProperty("$85i").max();return{min:_3,max:_4}},isc.A.$529=function isc_Calendar__setChosenWeek(){var _1=this.chosenWeekStart=new Date(this.year,this.month,this.chosenDate.getDate()
-this.chosenDate.getDay()+this.firstDayOfWeek);if(Date.compareDates(this.chosenDate,_1)==1){this.chosenWeekStart.setDate(this.chosenWeekStart.getDate()-7)}
this.chosenWeekEnd=new Date(_1.getFullYear(),_1.getMonth(),_1.getDate()+6,23,59);if(Date.compareDates(this.chosenDate,this.chosenWeekEnd)==-1){this.chosenWeekStart.setDate(this.chosenWeekStart.getDate()+7);this.chosenWeekEnd.setDate(this.chosenWeekEnd.getDate()+7)}},isc.A.setChosenDate=function isc_Calendar_setChosenDate(_1,_2){this.year=_1.getFullYear();this.month=_1.getMonth();this.$53h=this.chosenDate.duplicate();this.chosenDate=_1;this.$529();if(this.$53h.getFullYear()!=this.year||this.$53h.getMonth()!=this.month){if(this.monthView)this.monthView.refreshEvents()}
var _3=new Date(this.$53h.getFullYear(),this.$53h.getMonth(),this.$53h.getDate()-this.$53h.getDay());var _4=new Date(_3.getFullYear(),_3.getMonth(),_3.getDate()+6);var _5=this.chosenDate.getTime();if(_5<_3.getTime()||_5>_4.getTime()){if(this.weekView){this.weekView.refreshEvents();this.$53a()}}
if(_5!=this.$53h.getTime()){if(this.dayView){this.dayView.refreshStyle();this.dayView.refreshEvents()}}
if(this.timelineView&&!_2){this.timelineView.setTimelineRange(this.chosenDate,null,null,null,true)}else{var _6=this.getSelectedView();if(this.scrollToWorkday&&_6.scrollToWorkdayStart){_6.scrollToWorkdayStart()}else _6.redraw()}
this.setDateLabel();this.dateChanged()},isc.A.dateIsWorkday=function isc_Calendar_dateIsWorkday(_1){if(!_1||!this.workdays)return false;return this.workdays.contains(_1.getDay())},isc.A.adjustCriteria=function isc_Calendar_adjustCriteria(_1){return _1},isc.A.getNewCriteria=function isc_Calendar_getNewCriteria(){var _1={},_2;if(this.fetchMode=="timeline"){_2=this.timelineView;var _3={_constructor:"AdvancedCriteria",operator:"and",criteria:[{fieldName:this.startDateField,operator:"greaterThan",value:_2.startDate},{fieldName:this.endDateField,operator:"lessThan",value:_2.endDate}]};_1=this.adjustCriteria(_3)}
return _1},isc.A.$53a=function isc_Calendar__setWeekTitles(){if(!this.weekView)return;var _1=this.chosenWeekStart.duplicate();var _2=Date.getShortDayNames();var _3=Date.getWeekendDays();for(var i=1;i<8;i++){if(this.weekView.getFieldNum("day"+i)>=0){var _5=_1.toShortDate(this.dateFormatter,false);if(_5.match(this.$81i)!=null)_5=_5.substring(5);else if(_5.match(this.$81j))_5=_5.substring(0,_5.length-5)
var _6=_2[_1.getDay()]+" "+_5;var _7={title:_6,align:"right",$654:_1.getDay(),$658:_1.getDate(),$659:_1.getMonth(),$66a:_1.getFullYear()}
this.weekView.setFieldProperties("day"+i,_7);if(this.weekView.header)this.weekView.header.markForRedraw()}
_1.setDate(_1.getDate()+1)}},isc.A.next=function isc_Calendar_next(){var _1;if(this.dayViewSelected()){_1=new Date(this.year,this.month,this.chosenDate.getDate()+1);if(!this.showWeekends){var _2=Date.getWeekendDays();for(var i=0;i<_2.length;i++){if(_2.contains(_1.getDay()))_1.setDate(_1.getDate()+1)}}}else if(this.weekViewSelected()){_1=new Date(this.year,this.month,this.chosenDate.getDate()+7)}else if(this.monthViewSelected()){_1=new Date(this.year,this.month+1,1)}else if(this.timelineViewSelected()){_1=this.chosenDate.duplicate();this.timelineView.nextOrPrev(true);return}
this.dateChooser.setData(_1);this.setChosenDate(_1)},isc.A.previous=function isc_Calendar_previous(){if(this.dayViewSelected()){var _1=new Date(this.year,this.month,this.chosenDate.getDate()-1);if(!this.showWeekends){var _2=Date.getWeekendDays();for(var i=0;i<_2.length;i++){if(_2.contains(_1.getDay()))_1.setDate(_1.getDate()-1)}}}else if(this.weekViewSelected()){var _1=new Date(this.year,this.month,this.chosenDate.getDate()-7)}else if(this.monthViewSelected()){var _1=new Date(this.year,this.month-1,1)}else if(this.timelineViewSelected()){_1=this.chosenDate.duplicate();this.timelineView.nextOrPrev(false);return}
this.dateChooser.setData(_1);this.setChosenDate(_1)},isc.A.dataArrived=function isc_Calendar_dataArrived(){return true},isc.A.draw=function isc_Calendar_draw(_1,_2,_3,_4){this.invokeSuper(isc.Calendar,"draw",_1,_2,_3,_4);if(isc.ResultSet&&isc.isA.ResultSet(this.data)&&this.dataSource){this.observe(this.data,"dataArrived","observer.dataArrived(arguments[0], arguments[1])")}
if(this.mainView.isA("TabSet")){if(this.showControlsBar!=false){this.mainView.addChild(this.controlsBar);this.controlsBar.moveAbove(this.mainView.tabBar)}}},isc.A.$653=function isc_Calendar__getTabs(){var _1=[];if(this.showDayView!=false){this.dayView=this.createAutoChild("dayView",{baseStyle:this.baseStyle,viewName:"day",cellHeight:this.rowHeight});_1.add({title:this.dayViewTitle,pane:this.dayView,viewName:"day"})}
if(this.showWeekView!=false){this.weekView=this.createAutoChild("weekView",{$53i:true,baseStyle:this.baseStyle,viewName:"week",cellHeight:this.rowHeight});_1.add({title:this.weekViewTitle,pane:this.weekView,viewName:"week"})}
if(this.showMonthView!=false){this.monthView=this.createAutoChild("monthView",{baseStyle:this.baseStyle,viewName:"month",bodyConstructor:"MonthScheduleBody"});_1.add({title:this.monthViewTitle,pane:this.monthView,viewName:"month"})}
if(this.showTimelineView!=false){this.timelineView=this.createAutoChild("timelineView",{baseStyle:this.baseStyle,viewName:"timeline"});_1.add({title:this.timelineViewTitle,pane:this.timelineView,viewName:"timeline"})}
return _1},isc.A.$655=function isc_Calendar__createTabSet(_1){if(_1.length>1){this.mainView=this.createAutoChild("mainView",{tabs:_1,tabSelected:function(_3,_4,_5,_6){this.creator.$567=_4.viewName;this.creator.setDateLabel();this.creator.currentViewChanged(_4.viewName)}});if(this.currentViewName){var _2=_1.find("viewName",this.currentViewName);if(_2)this.mainView.selectTab(_2)}}else{this.mainView=_1[0].pane}},isc.A.getLaneMap=function isc_Calendar_getLaneMap(){if(!this.isTimeline())return{};var _1=this.timelineView.data,_2={};for(var i=0;i<_1.length;i++){var _4=_1[i].name||_1[i][this.laneNameField],_5=_1[i].title||_4;_2[_4]=_5}
return _2},isc.A.createChildren=function isc_Calendar_createChildren(){var _1=this.$653();this.$655(_1);var _2=20;if(this.showControlsBar!=false){this.dateLabel=this.createAutoChild("dateLabel");this.addEventButton=this.createAutoChild("addEventButton",{click:function(){var _3=this.creator;var _4=_3.getCurrentViewName();_3.eventDialog.event=null;_3.eventDialog.isNewEvent=true;_3.eventDialog.items[0].createFields();var _5=new Date(),_6=null,_7=_3.chosenDate.duplicate();if(_4=="day"){_5=_7}else if(_4=="week"){if(_3.chosenWeekStart.getTime()>_5.getTime()){_5=_3.chosenWeekStart.duplicate()}
if(!this.showWeekends){var _8=Date.getWeekendDays();for(var i=0;i<_8.length;i++){if(_8.contains(_5.getDay()))_5.setDate(_5.getDate()+1)}}
_5.setMinutes(0);if(_5.getHours()>22){_5.setDate(_5.getDate()+1);_5.setHours(0)}
else _5.setHours(_5.getHours()+1)}else if(_4=="month"){_7.setDate(1);if(_7.getTime()>_5.getTime())_5=_7}else if(_3.isTimeline()){var _10=_3.timelineView,_11=_10.getVisibleDateRange();_5=_11[0];_6=_5.duplicate();_6=_10.addUnits(_6,1,_3.timelineGranularity)}
_3.eventDialog.setDate(_5,_6);_3.eventDialog.setPageLeft(_3.getPageLeft());_3.eventDialog.setPageTop(this.getPageTop()+this.getVisibleHeight());_3.eventDialog.show()}});this.datePickerButton=this.createAutoChild("datePickerButton",{click:function(){var _3=this.creator;if(this.$54x){this.$54x.setData(_3.chosenDate);this.$54x.draw()}else{this.$54x=isc.DateChooser.create({calendar:this.creator,autoDraw:false,showCancelButton:true,autoClose:true,disableWeekends:this.creator.disableWeekends,firstDayOfWeek:this.creator.firstDayOfWeek,showWeekends:this.creator.showWeekends,dateClick:function(_43,_44,_45){var _12=new Date(_43,_44,_45);this.setData(_12);this.calendar.dateChooser.dateClick(_43,_44,_45);this.close()}});this.$54x.setData(_3.chosenDate);_3.addChild(this.$54x);this.$54x.placeNextTo(this,"bottom",true)}}});this.previousButton=this.createAutoChild("previousButton",{});this.nextButton=this.createAutoChild("nextButton",{})}
var _13=[];if(this.showPreviousButton!=false)_13.add(this.previousButton);if(this.showDateLabel!=false)_13.add(this.dateLabel);if(this.showDatePickerButton!=false)_13.add(this.datePickerButton);if(this.canCreateEvents&&this.showAddEventButton!=false)_13.add(this.addEventButton);if(this.showNextButton!=false)_13.add(this.nextButton);if(this.showControlsBar!=false){this.controlsBar=this.createAutoChild("controlsBar",{members:_13})}
var _3=this;this.dateChooser=this.createAutoChild("dateChooser",{disableWeekends:this.disableWeekends,showWeekends:this.showWeekends,chosenDate:this.chosenDate,month:this.month,year:this.year,dateClick:function(_43,_44,_45){var _12=new Date(_43,_44,_45);this.setData(_12);this.creator.setChosenDate(_12)},showPrevYear:function(){this.year--;this.dateClick(this.year,this.month,this.chosenDate.getDate())},showNextYear:function(){this.year++;this.dateClick(this.year,this.month,this.chosenDate.getDate())},showPrevMonth:function(){if(--this.month==-1){this.month=11;this.year--}
this.dateClick(this.year,this.month,1)},showNextMonth:function(){if(++this.month==12){this.month=0;this.year++}
this.dateClick(this.year,this.month,1)}});this.eventDialog=this.createAutoChild("eventDialog",{items:[isc.DynamicForm.create({autoDraw:false,padding:4,calendar:this,saveOnEnter:true,useAllDataSourceFields:true,numCols:2,colWidths:[80,"*"],$642:[_3.nameField,_3.laneNameField],getCustomValues:function(){if(!this.calendar.eventDialogFields)return;var _14=this.$642;var _15=this.calendar.eventDialogFields;var _16={}
for(var i=0;i<_15.length;i++){var _17=_15[i];if(_17.name&&!_14.contains(_17.name)){_16[_17.name]=this.getValue(_17.name)}}
return _16},setCustomValues:function(_43){if(!this.calendar.eventDialogFields)return;var _14=this.$642;var _15=this.calendar.eventDialogFields;for(var i=0;i<_15.length;i++){var _17=_15[i];if(_17.name&&!_14.contains(_17.name)){this.setValue(_17.name,_43[_17.name])}}},createFields:function(_43){var _3=this.calendar,_18=_3.eventDialog.isNewEvent,_19=!_18?"staticText":"text",_20=!_18?"staticText":"select";var _21=[{name:_3.nameField,title:_3.eventNameFieldTitle,type:_19,width:250},{name:_3.laneNameField,title:_3.eventLaneFieldTitle,type:_20,width:150,valueMap:_3.getLaneMap(),showIf:_3.isTimeline()?"true":"false"},{name:"save",title:_3.saveButtonTitle,type:"SubmitItem",endRow:false},{name:"details",title:_3.detailsButtonTitle,type:"button",startRow:false,click:function(_38,_44){var _3=_38.calendar,_22=_3.eventDialog.isNewEvent,_23=_3.eventDialog.event,_24=_38.getValue(_3.nameField),_25=_38.getValue(_3.laneNameField);if(_22){_23[_3.nameField]=_24;if(_25)_23[_3.laneNameField]=_25}
_38.calendar.$53j(_23,_22)}}];if(!_18)_21.removeAt(2);var _26=isc.DataSource.create({addGlobalId:false,fields:_21});this.setDataSource(_26);this.setFields(isc.shallowClone(this.calendar.eventDialogFields))},submit:function(){var _3=this.calendar,_18=_3.eventDialog.isNewEvent,_27=_18?_3.eventDialog.event:null,_28=_3.eventDialog.currentStart,_29=_3.eventDialog.currentEnd,_30;if(!this.validate())return;if(_3.isTimeline()){_30=this.getItem(_3.laneNameField).getValue()}
_3.$1115=true;if(!_18){_3.updateEvent(_27,_28,_29,this.getItem(_3.nameField).getValue(),_27[_3.descriptionField],this.getCustomValues(),true,_30)}else{_3.addEvent(_28,_29,this.getItem(_3.nameField).getValue(),"",this.getCustomValues(),true,_30)}
_3.eventDialog.hide()}})],setDate:function(_43,_44){if(!_44){if(_43.getHours()==23&&_43.getMinutes()==30){_44=new Date(_43.getFullYear(),_43.getMonth(),_43.getDate()+1)}else{_44=new Date(_43.getFullYear(),_43.getMonth(),_43.getDate(),_43.getHours()+1,_43.getMinutes())}}
this.setTitle(this.creator.$53k(_43,_44));this.currentStart=_43;this.currentEnd=_44;this.items[0].getItem(this.creator.nameField).setValue("")},setLane:function(_30){var _3=this.creator;if(isc.isA.Number(_30))_30=_3.lanes[_30].name;this.items[0].getItem(_3.laneNameField).setValue(_30)},setEvent:function(_23){this.event=_23;var _31=this.items[0],_3=this.creator;if(_3.eventDialogFields){_31.clearErrors(true);_31.setCustomValues(_23)}
this.setDate(_23[_3.startDateField],_23[_3.endDateField]);_31.setValues(_23)},closeClick:function(){this.Super('closeClick');if(this.creator.dayView)this.creator.dayView.clearSelection();if(this.creator.weekView)this.creator.weekView.clearSelection()},show:function(){if(this.creator.showQuickEventDialog){if(!this.isDrawn())this.draw();this.Super('show');this.items[0].getItem(this.creator.nameField).focusInItem()}else{this.creator.showEventEditor(this.event)}},hide:function(){this.Super('hide');this.moveTo(0,0)}});this.eventEditor=this.createAutoChild("eventEditor",{useAllDataSourceFields:true,titleWidth:80,initWidget:function(){this.invokeSuper(isc.DynamicForm,"initWidget",arguments);this.timeFormat=this.creator.timeFormat;var _21=[],_3=this.creator,_32=_3.getDateEditingStyle();this.$642.addList([_3.nameField,_3.descriptionField,_3.startDateField,_3.endDateField]);if(_3.isTimeline()&&_3.canEditLane){var _33=_3.getLaneMap(),_34={name:_3.laneNameField,title:_3.eventLaneFieldTitle,type:"select",valueMap:_33,endRow:true};_21.add(_34)}
if(_32=="date"||_32=="datetime"){_21.addList([{name:_3.startDateField,title:_3.eventStartDateFieldTitle,type:_32,endRow:true},{name:_3.endDateField,title:_3.eventEndDateFieldTitle,type:_32,endRow:true},{name:"invalidDate",type:"blurb",colSpan:4,visible:false,defaultValue:_3.invalidDateMessage,cellStyle:this.errorStyle||"formCellError",endRow:true}])}else if(_32=="time"){_21.addList([{name:"startHours",title:_3.eventStartDateFieldTitle,type:"integer",width:60,editorType:"select",valueMap:this.getTimeValues("hours")},{name:"startMinutes",showTitle:false,type:"integer",width:60,editorType:"select",valueMap:this.getTimeValues("minutes")},{name:"startAMPM",showTitle:false,type:"select",width:60,valueMap:this.getTimeValues(),endRow:true},{name:"invalidDate",type:"blurb",colSpan:4,visible:false,defaultValue:_3.invalidDateMessage,cellStyle:this.errorStyle||"formCellError",endRow:true},{name:"endHours",title:_3.eventEndDateFieldTitle,type:"integer",width:60,editorType:"select",valueMap:this.getTimeValues("hours")},{name:"endMinutes",showTitle:false,type:"integer",width:60,editorType:"select",valueMap:this.getTimeValues("minutes")},{name:"endAMPM",showTitle:false,type:"select",width:60,valueMap:this.getTimeValues(),endRow:true}]);this.setColWidths([this.titleWidth,60,60,"*"])}
_21.addList([{name:_3.nameField,title:_3.eventNameFieldTitle,type:"text",colSpan:"*",width:"*"},{name:_3.descriptionField,title:_3.eventDescriptionFieldTitle,type:"textArea",colSpan:"*",width:"*",height:50}]);var _35=isc.DataSource.create({addGlobalId:false,fields:_21});this.setDataSource(_35);this.setFields(isc.shallowClone(this.creator.eventEditorFields))},getTimeValues:function(_43,_44){if(!_44)_44=0;var _36={};if(_43=="hours"){for(var i=_44;i<12;i++){_36[(i+1)+""]=(i+1)}}else if(_43=="minutes"){for(var i=0;i<60;i++){var _37=i<10?"0"+i:""+i;_36[i+""]=_37}}else{_36["am"]="am";_36["pm"]="pm"}
return _36},$642:["startHours","startMinutes","startAMPM","endHours","endMinutes","endAMPM"],getCustomValues:function(){if(!this.creator.eventEditorFields)return;var _3=this.creator,_14=this.$642;var _15=this.creator.eventEditorFields;var _16={}
for(var i=0;i<_15.length;i++){var _17=_15[i];if(_17.name&&!_14.contains(_17.name)){_16[_17.name]=this.getValue(_17.name)}}
return _16},setCustomValues:function(_43){if(!this.creator.eventEditorFields)return;var _14=this.$642;var _15=this.creator.eventEditorFields;for(var i=0;i<_15.length;i++){var _17=_15[i];if(_17.name&&!_14.contains(_17.name)){this.setValue(_17.name,_43[_17.name])}}}});this.eventEditorLayout=this.createAutoChild("eventEditorLayout",{items:[this.eventEditor,isc.HLayout.create({membersMargin:10,layoutMargin:10,autoDraw:false,members:[isc.IButton.create({autoDraw:false,title:this.saveButtonTitle,calendar:this,click:function(){this.calendar.addEventOrUpdateEventFields()}}),isc.IButton.create({autoDraw:false,title:this.cancelButtonTitle,calendar:this,click:function(){this.calendar.eventEditorLayout.hide()}})]})],setDate:function(_43,_44,_45,_30){if(!_45)_45="";if(!_44){_44=new Date(_43.getFullYear(),_43.getMonth(),_43.getDate(),_43.getHours()+1,_43.getMinutes())}
var _3=this.creator;this.setTitle(_3.$53k(_43,_44));this.currentStart=_43;this.currentEnd=_44;var _32=_3.getDateEditingStyle(),_38=this.items[0];if(_32=="date"||_32=="datetime"){_38.setValue(_3.startDateField,_43.duplicate());_38.setValue(_3.endDateField,_44.duplicate())}else if(_32=="time"){_38.setValue("startHours",this.getHours(_43.getHours()));_38.setValue("endHours",this.getHours(_44.getHours()));_38.setValue("startMinutes",_43.getMinutes());_38.setValue("endMinutes",_44.getMinutes());if(!_3.twentyFourHourTime){_38.setValue("startAMPM",this.getAMPM(_43.getHours()));_38.setValue("endAMPM",this.getAMPM(_44.getHours()))}}
_38.setValue(_3.nameField,_45);_38.setValue(_3.descriptionField,"");_38.setValue(_3.laneNameField,_30)},getHours:function(_43){if(this.creator.twentyFourHourTime)return _43;else return this.creator.$53n(_43)},getAMPM:function(_43){if(_43<12)return"am";else return"pm"},setEvent:function(_23){var _38=this.items[0],_3=this.creator,_39=_38.getItem(_3.laneNameField);this.event=_23;if(_3.eventEditorFields){_38.clearErrors(true);_38.setCustomValues(_23)}
if(_39){_39.setValue(_23[_3.laneNameField])}
this.setDate(_23[_3.startDateField],_23[_3.endDateField]);_38.setValue(_3.nameField,_23[_3.nameField]);_38.setValue(_3.descriptionField,_23[_3.descriptionField]);if(_38.getItem(_3.laneNameField))_38.setValue(_3.laneNamefield,_23[_3.laneNameField]);this.originalStart=isc.clone(this.currentStart);this.originalEnd=isc.clone(this.currentEnd)},hide:function(){this.Super('hide');if(this.creator.dayView)this.creator.dayView.clearSelection();if(this.creator.weekView)this.creator.weekView.clearSelection();this.creator.eventEditor.hideItem("invalidDate")},sizeMe:function(){this.setWidth(this.creator.mainView.getVisibleWidth());this.setHeight(this.creator.mainView.getVisibleHeight());this.setLeft(this.creator.mainView.getLeft())}});if(!this.children)this.children=[];var _40=[];var _41=[];_41.add(this.dateChooser);if(this.showDateChooser){_40.add(isc.VLayout.create({autoDraw:false,width:"20%",membersMargin:10,layoutTopMargin:10,members:_41}))}
if(this.mainView.isA("TabSet")){_40.add(this.mainView)}else{if(this.showControlsBar!=false){var _42=isc.HLayout.create({autoDraw:false,height:this.controlsBar.getVisibleHeight(),width:"100%"});_42.addMember(isc.LayoutSpacer.create({autoDraw:false,width:"*"}));_42.addMember(this.controlsBar);_42.addMember(isc.LayoutSpacer.create({autoDraw:false,width:"*"}));_40.add(isc.VLayout.create({autoDraw:false,members:[_42,this.mainView]}))}else{_40.add(this.mainView)}}
this.children.add(isc.HLayout.create({autoDraw:false,width:"100%",height:"100%",members:_40}));this.eventEditorLayout.hide();this.setDateLabel()},isc.A.addEventOrUpdateEventFields=function isc_Calendar_addEventOrUpdateEventFields(){var _1=this,_2=_1.eventEditorLayout.isNewEvent,_3=_1.eventEditorLayout.event,_4=_1.eventEditor,_5=_1.getDateEditingStyle();if(_5=="date"||_5=="datetime"){var _6=_4.getValue(_1.startDateField),_7=_4.getValue(_1.endDateField),_8;if(_7<_6){_4.showItem("invalidDate");return false}
if(!_4.validate())return false;_1.eventEditorLayout.currentStart=_6;_1.eventEditorLayout.currentEnd=_7;_1.eventEditorLayout.hide();if(_1.isTimeline()&&_1.canEditLane){_8=_4.getValue(_1.laneNameField)}
_1.$1116=true;if(!_2){_1.updateEvent(_3,_6,_7,_4.getValue(_1.nameField),_4.getValue(_1.descriptionField),_4.getCustomValues(),true,_8)}else{_1.addEvent(_6,_7,_4.getValue(_1.nameField),_4.getValue(_1.descriptionField),_4.getCustomValues(),true,_8)}}else if(_5=="time"){var _9=_4.getValue("startHours"),_10=_4.getValue("endHours"),_11=_4.getValue("startMinutes"),_12=_4.getValue("endMinutes"),_13,_14;if(!_1.twentyFourHourTime){_13=_4.getValue("startAMPM");_14=_4.getValue("endAMPM");_9=_1.$534(_9,_13);_10=_1.$534(_10,_14);if(_10==0)_10=24}
if(!(_9<_10||(_9==_10&&_11<_12))){_4.showItem("invalidDate");return false}
if(!_4.validate())return false;_1.eventEditorLayout.hide();var _15=_1.eventEditorLayout.currentStart,_16=_1.eventEditorLayout.currentEnd;if(_16.getDate()>_15.getDate()){if(_10==24)_10=0;else{_16.setDate(_15.getDate())}}
_15.setHours(_9);_15.setMinutes(_11);_16.setHours(_10);_16.setMinutes(_12);_1.$1116=true;if(!_2){var _17=_1.eventEditorLayout.originalStart,_18=_1.eventEditorLayout.originalEnd;_1.updateEvent(_3,_15,_16,_4.getValue(_1.nameField),_4.getValue(_1.descriptionField),_4.getCustomValues(),true);if(_1.eventAutoArrange){_1.$64n(_1.weekViewSelected(),_17,_18)}}else{_1.addEvent(_15,_16,_4.getValue(_1.nameField),_4.getValue(_1.descriptionField),_4.getCustomValues(),true)}}
return true},isc.A.setDateLabel=function isc_Calendar_setDateLabel(){if(!this.dateLabel)return;var _1="",_2=this.chosenDate,_3=null,_4=this.getCurrentViewName();if(_4=="day"){}else if(_4=="week"){var _5=this.$656();_2=_5[0];_3=_5[1]}else if(_4=="month"){_2=isc.DateUtil.getStartOf(_2,"M");_3=isc.DateUtil.getEndOf(_2,"M")}else if(_4=="timeline"){var _6=this.timelineView;_2=_6.startDate;_3=_6.endDate}
_1=this.getDateLabelText(_4,_2,_3);this.dateLabel.setContents(_1)},isc.A.getDateLabelText=function isc_Calendar_getDateLabelText(_1,_2,_3){var _4="";if(_1=="day"){_4="<b>"+Date.getFormattedDateRangeString(_2)+"</b>"}else if(_1=="week"){_4="<b>"+Date.getFormattedDateRangeString(_2,_3)+"</b>"}else if(_1=="month"){_4="<b>"+_2.getShortMonthName()+" "+_2.getFullYear()+"</b>"}else if(_1=="timeline"){var _5=this.timelineView;_4="<b>"+_5.formatDateForDisplay(_2)+"</b> through <b>"+_5.formatDateForDisplay(_3)+"</b>"}
return _4});isc.evalBoundary;isc.B.push(isc.A.$656=function isc_Calendar__getWeekRange(){var _1=this.chosenWeekStart.duplicate();var _2=this.chosenWeekEnd.duplicate();if(!this.showWeekends){var _3=Date.getWeekendDays();var _4=7-_3.length;while(_3.contains(_1.getDay())){_1.setDate(_1.getDate()+1)}
var _5=0,_6=_1.duplicate();for(var i=0;i<_4;i++){if(_3.contains(_6.getDay()))_5++;_6.setDate(_6.getDate()+1)}
_2=_1.duplicate();_2.setDate(_2.getDate()+(_4-1)+_5)}
return[_1,_2]},isc.A.dayViewSelected=function isc_Calendar_dayViewSelected(){if(this.mainView&&!this.mainView.isA("TabSet"))return this.mainView.viewName=="day";else return this.$567=="day"},isc.A.weekViewSelected=function isc_Calendar_weekViewSelected(){if(this.mainView&&!this.mainView.isA("TabSet"))return this.mainView.viewName=="week";else return this.$567=="week"},isc.A.monthViewSelected=function isc_Calendar_monthViewSelected(){if(this.mainView&&!this.mainView.isA("TabSet"))return this.mainView.viewName=="month";else return this.$567=="month"},isc.A.timelineViewSelected=function isc_Calendar_timelineViewSelected(){if(this.mainView&&!this.mainView.isA("TabSet"))return this.mainView.viewName=="timeline";else return this.$567=="timeline"},isc.A.showEventDialog=function isc_Calendar_showEventDialog(_1){if(!_1){this.logWarn("showEventDialog called with no event - returning.");return}
this.$53l(_1,false)},isc.A.showNewEventDialog=function isc_Calendar_showNewEventDialog(_1){_1=_1||{};this.$53l(_1,true)},isc.A.$53l=function isc_Calendar__showEventDialog(_1,_2){var _3=_1[this.startDateField]||new Date();var _4=_1[this.endDateField];var _5=this.getSelectedView(),_6=_5==this.monthView?null:this.$64i(_1,_5==this.weekView),_7,_8;if(!_6){if(this.eventEditorLayout){this.eventEditorLayout.event=_1;this.eventEditorLayout.isNewEvent=_2}
this.eventDialog.eventWindow=null;this.eventDialog.event=_1;this.eventDialog.isNewEvent=_2;this.eventDialog.items[0].createFields();var _9=_3,_10=_4;_1[this.startDateField]=_9;if(this.monthViewSelected()){var _11=new Date();_11=_11.getHours();if(_11>22)_11-=1;_9.setHours(_11);_1[this.startDateField]=_9}
if(this.isTimeline()){var _12=this.timelineView;_7=_12.getEventLaneIndex(_1);_8=_12.getEventColumn(_12.getDateLeftOffset(_9));_10=_4||this.getDateFromPoint(_12.getDateLeftOffset(_9)+_12.getColumnWidth(_8));this.eventDialog.setLane(_7)}else{var _13=this.getSelectedView();if(_13==this.monthView){_7=_13.getEventRow();_8=_13.getEventColumn();_10=_4||this.getCellDate(_7,_8)}else{_7=_3.getHours()*2;_8=_13.getEventColumn(this.getEventLeft(_1));_10=_4||this.getCellDate(_7+2,_8)}}
_1[this.endDateField]=_10;this.eventDialog.setEvent(_1)}else{if(this.isTimeline()){var _12=this.timelineView;_7=_12.getEventLaneIndex(_1);_8=_12.getEventColumn(_12.getDateLeftOffset(_3))}else if(this.dayViewSelected()||this.weekViewSelected()){var _13=this.getSelectedView();_7=_3.getHours()*2;_8=_13.getEventColumn(this.getEventLeft(_1)+1)}
this.eventDialog.eventWindow=_6;this.eventDialog.isNewEvent=false;this.eventDialog.items[0].createFields();this.eventDialog.setEvent(_6.event)}
this.eventDialog.moveTo(0,-10000);this.eventDialog.show();var _14=this.getSelectedView().getCellPageRect(_7,_8);this.eventDialog.placeNear(_14[0],_14[1]);isc.Timer.setTimeout(this.ID+".eventDialog.bringToFront()")},isc.A.showEventEditor=function isc_Calendar_showEventEditor(_1){if(_1)this.$53j(_1);else this.showNewEventEditor(null)},isc.A.showNewEventEditor=function isc_Calendar_showNewEventEditor(_1){this.$53j(_1,true)},isc.A.$53j=function isc_Calendar__showEventEditor(_1,_2){if(!this.eventEditorLayout.isDrawn())this.eventEditorLayout.draw();this.eventEditorLayout.setWidth(this.mainView.getVisibleWidth());this.eventEditorLayout.setHeight(this.mainView.getVisibleHeight());this.eventEditorLayout.setPageLeft(this.mainView.getPageLeft());this.eventEditorLayout.setPageTop(this.getPageTop());this.eventEditorLayout.isNewEvent=_2;if(_1){this.eventEditorLayout.setEvent(_1)}else{this.eventEditor.clearValues();this.eventEditorLayout.setTitle(this.newEventEditorWindowTitle);if(this.eventDialog&&this.eventDialog.isVisible()){if(this.eventEditorFields){this.eventEditorLayout.items[0].setCustomValues(this.eventDialog.items[0].getCustomValues())}
var _3=this.eventDialog.items[0].getValue(this.nameField);var _4=this.eventDialog.items[0].getItem(this.laneNameField);var _5=_4?_4.getValue():null;var _6=new Date();this.eventEditorLayout.setDate(_6,this.eventDialog.currentEnd,_3,_5)}}
this.eventDialog.hide();this.eventEditorLayout.show()},isc.A.$53k=function isc_Calendar__getEventDialogTitle(_1,_2){var _3=Date.getShortDayNames(),_4=Date.getShortMonthNames(),_5=isc.Time.toTime(_1,this.timeFormatter,true),_6=isc.Time.toTime(_2,this.timeFormatter,true),_7;if(this.isTimeline()){var _8=_1.getDay()!=_2.getDay();if(_8){_7=_3[_1.getDay()]+", "+_4[_1.getMonth()]+" "+_1.getDate()+", "+_5+" - "+_3[_2.getDay()]+", "+_4[_2.getMonth()]+" "+_2.getDate()+", "+_6;return _7}}
var _9=_5+" - "+_6;return _3[_1.getDay()]+", "+_4[_1.getMonth()]+" "+_1.getDate()+", "+_9},isc.A.$53n=function isc_Calendar__to12HrNotation(_1){if(_1==0)return 12;else if(_1<13)return _1;else return _1-12},isc.A.$534=function isc_Calendar__to24HourNotation(_1,_2){_1=parseInt(_1);if(_2.toLowerCase()=="am"&&_1==12){return 0}else if(_2.toLowerCase()=="pm"&&_1<12){return _1+12}else{return _1}},isc.A.$116j=function isc_Calendar__getCellCSSText(_1,_2,_3,_4){var _5=this,_6=_5.getCellDate(_3,_4),_7=_5.getDateCSSText(_6,_3,_4,_1);if(_7)return _7;var _8=isc.Date.compareLogicalDates(_6,new Date());if((_8!==false&&_8==0)&&_5.todayBackgroundColor){return"background-color:"+_5.todayBackgroundColor+";"}
return null},isc.A.getDateCSSText=function isc_Calendar_getDateCSSText(_1,_2,_3,_4){return null},isc.A.getDateStyle=function isc_Calendar_getDateStyle(_1,_2,_3,_4){return null},isc.A.getCellDate=function isc_Calendar_getCellDate(_1,_2){var _3;if(this.dayViewSelected()){_3=this.chosenDate.duplicate()}else if(this.weekViewSelected()){var _4=this.weekView.getField(_2);if(!_4.$66a)return;_3=new Date(_4.$66a,_4.$659,_4.$658)}else if(this.monthViewSelected()){if(_2>=this.monthView.getFields().length)
_2=this.monthView.getFields().length-1;var _5=this.monthView.data.get(_1);var _6=this.monthView.getField(_2).$66b;if(_5&&_5["date"+_6]!=null){_3=_5["date"+_6].duplicate();_3.setHours(0);_3.setMinutes(0);_3.setSeconds(0)}
return _3}else if(this.timelineViewSelected()){var _7=this.timelineView,_8=_7.getFieldBody(_2),_9=_7.getLocalFieldNum(_2),_10=_8.getField(_9);if(!_10||!_10.date)return null;return _10.date}else{return}
if(this.dayViewSelected()||this.weekViewSelected()){var _11,_12=_1,_13=0;if(_1%2==1){_12=_1-1;_13=30}
_3.setHours(_12/2,_13)}
return _3},isc.A.getDateFromPoint=function isc_Calendar_getDateFromPoint(_1,_2,_3){var _4=this.getSelectedView();if(_1==null&&_2==null){_1=_4.body.getOffsetX();_2=_4.body.getOffsetY()}
if(_3==null)_3=true;var _5=_4.getEventColumn(_1),_6=_4.getEventRow(_2),_7;if(this.dayViewSelected()||this.weekViewSelected()){_7=this.getCellDate(_6,_5);var _8=_4.getRowSize(1);var _9=Math.floor((_2-(_8*_6))*(30/_8));var _10=_7.getMinutes()+_9;if(_3){_10=_10-(_10%this.eventSnapGap);_7.setMinutes(_10)}else{var _11,_12=_6,_13=0;if(_6%2==1){_12=_6-1;_13=30}
_7.setHours(_12/2,_13!=0?_13:null)}}else if(this.monthViewSelected()){_7=this.getCellDate(_6,_5)}else if(this.timelineViewSelected()){_7=_4.getDateFromPoint(_1,null,_3)}else{return}
return _7},isc.A.$54g=function isc_Calendar__getMinutePixels(_1,_2,_3){if(_3=="timeline"){var _4=_2;return Math.round(_4/60)*_1}else{return Math.round((_2/30)*_1)}},isc.A.monthViewEventClick=function isc_Calendar_monthViewEventClick(_1,_2,_3){var _4=this.monthView.getEvents(_1,_2);var _5=_4[_3];if(this.eventClick(_5,"month"))this.showEventEditor(_5)},isc.A.currentViewChanged=function isc_Calendar_currentViewChanged(_1){},isc.A.getDayBodyHTML=function isc_Calendar_getDayBodyHTML(_1,_2,_3,_4,_5){var _6=_1.getDay();var _7=_2,_8=15,_9=this.monthView.data?this.monthView.data[1]:null,_10=this.monthView.getRowHeight(_9,1);var _11="";for(var i=0;i<_7.length;i++){var _13=isc.Time.toTime(_7[i][this.startDateField],this.timeFormatter,true)+" ";if(this.canEditEvent(_7[i])){var _14="<a href='javascript:"+this.ID+".monthViewEventClick("+_4+","+_5+","+i+");' class='"+this.calMonthEventLinkStyle+"'>";_11+=_14+_13+_7[i][this.nameField]+"</a><br/>"}else{_11+=_13+_7[i][this.nameField]+"<br/>"}
if((i+3)*_8>_10)break}
if(i<_7.length-1){_11+="+ "+(_7.length-1-i)+" more..."}
return _11},isc.A.getMonthViewHoverHTML=function isc_Calendar_getMonthViewHoverHTML(_1,_2){if(_2!=null){var _3="";for(var i=0;i<_2.length;i++){var _5=this.creator||this;var _6=isc.Time.toTime(_2[i][_5.startDateField],_5.timeFormatter,true);_3+=_6+" "+_2[i][_5.nameField]+"<br/>"}
return _3}},isc.A.getDayHeaderHTML=function isc_Calendar_getDayHeaderHTML(_1,_2,_3,_4,_5){return _1.getDate()},isc.A.dayBodyClick=function isc_Calendar_dayBodyClick(_1,_2,_3,_4,_5){return true},isc.A.dayHeaderClick=function isc_Calendar_dayHeaderClick(_1,_2,_3,_4,_5){return true},isc.A.eventClick=function isc_Calendar_eventClick(_1,_2){return true},isc.A.eventRemoveClick=function isc_Calendar_eventRemoveClick(_1,_2){return true},isc.A.eventMoved=function isc_Calendar_eventMoved(_1,_2){return true},isc.A.eventResized=function isc_Calendar_eventResized(){return true},isc.A.timelineEventMoved=function isc_Calendar_timelineEventMoved(_1,_2,_3,_4){return true},isc.A.timelineEventResized=function isc_Calendar_timelineEventResized(_1,_2,_3){return true},isc.A.getValidSnapDate=function isc_Calendar_getValidSnapDate(_1,_2){if(this.isTimeline()){}else{var _3=this.eventSnapGap;var _4=((_1.getHours()*60)+_1.getMinutes())%_3;var _5=(_2.getHours()*60)+_2.getMinutes();var _6=Math.round((_5-_4)/_3);var _7=(_6*_3)+_4;var _8=Math.floor(_7/60),_9=_7%60;_2.setHours(_8);_2.setMinutes(_9)}
return _2},isc.A.selectTab=function isc_Calendar_selectTab(_1){if(this.mainView&&this.mainView.isA("TabSet")&&this.mainView.tabs.getLength()>_1){this.mainView.selectTab(_1);this.refreshSelectedView();return true}else{return false}},isc.A.parentResized=function isc_Calendar_parentResized(){this.Super('parentResized',arguments);if(this.eventEditorLayout.isVisible())this.eventEditorLayout.sizeMe()},isc.A.dateChanged=function isc_Calendar_dateChanged(){return true},isc.A.getActiveDay=function isc_Calendar_getActiveDay(){var _1=this.getActiveTime();if(_1)return _1.getDay()},isc.A.getActiveTime=function isc_Calendar_getActiveTime(){var _1=this.ns.EH,_2=this.getSelectedView();var _3=_2.getEventColumn();var _4=_2.getEventRow();return this.getCellDate(_4,_3)},isc.A.setTimelineRange=function isc_Calendar_setTimelineRange(_1,_2,_3,_4,_5){if(this.timelineView)this.timelineView.setTimelineRange(_1,_2,_3,_4);if(_5)this.fireCallback(_5)},isc.A.getEventLength=function isc_Calendar_getEventLength(_1,_2){var _3=(_2.getTime()-_1.getTime())/(1000*60);return _3});isc.B._maxIndex=isc.C+114;isc.ClassFactory.defineClass("DaySchedule","ListGrid");isc.DaySchedule.changeDefaults("bodyProperties",{childrenSnapToGrid:true,snapToCells:true,redrawOnResize:true});isc.A=isc.DaySchedule.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.autoDraw=false;isc.A.canSort=false;isc.A.canResizeFields=false;isc.A.canReorderFields=false;isc.A.showHeader=false;isc.A.showHeaderContextMenu=false;isc.A.showAllRecords=true;isc.A.fixedRecordHeights=true;isc.A.labelColumnWidth=60;isc.A.labelColumnAlign="right";isc.A.showLabelColumn=true;isc.A.labelColumnPosition="left";isc.A.labelColumnBaseStyle="labelColumn";isc.A.showRollOver=true;isc.A.useCellRollOvers=true;isc.A.canAutoFitFields=false;isc.A.canSelectCells=true;isc.A.poolEventWindows=true;isc.B.push(isc.A.initWidget=function isc_DaySchedule_initWidget(){this.fields=[];var _1=this.creator;this.addProperties(_1.gridProps)
if(_1.labelColumnWidth&&_1.labelColumnWidth!=this.labelColumnWidth){this.labelColumnWidth=_1.labelColumnWidth}
this.eventDragGap=_1.eventDragGap;var _2={width:this.labelColumnWidth,name:"label",title:" ",cellAlign:"right",formatCellValue:function(_10,_11,_12,_13,_14){if(_12%2==0){var _3=(_12/2);var _4=isc.Time.parseInput(_3);return isc.Time.toTime(_4,_14.creator.timeFormatter,true)}
else{return""}}}
if(this.showLabelColumn&&this.labelColumnPosition=="left"){this.fields.add(_2)}
this.fields.add({name:"day1",align:"center"});if(this.$53i){var _5=8;for(var i=2;i<_5;i++){this.fields.add({name:"day"+i,align:"center"})}
this.showHeader=true}
if(this.$53i&&!this.creator.showWeekends){var _7=this.showLabelColumn&&this.labelColumnPosition=="left"?1:0;var _8=Date.getWeekendDays();for(var i=_7;i<this.fields.length;i++){var _9=((i-_7)+this.creator.firstDayOfWeek)%7;if(_8.contains(_9)){this.fields[i].showIf="return false;"}}}
if(this.showLabelColumn&&this.labelColumnPosition=="right"){this.fields.add(_2)}
this.data=isc.DaySchedule.$53o;this.Super("initWidget")},isc.A.draw=function isc_DaySchedule_draw(_1,_2,_3,_4){this.invokeSuper(isc.DaySchedule,"draw",_1,_2,_3,_4);this.logDebug('draw','calendar');this.refreshEvents();this.setSnapGap();if(this.creator.scrollToWorkday)this.scrollToWorkdayStart()},isc.A.setSnapGap=function isc_DaySchedule_setSnapGap(){var _1=this.creator.eventSnapGap;this.body.snapVGap=Math.round((_1/30)*this.body.getRowSize(0));this.body.snapHGap=null},isc.A.scrollToWorkdayStart=function isc_DaySchedule_scrollToWorkdayStart(){var _1;if(this.$53i){var _2=this.getWorkdayRange();_1=_2.start}else{_1=isc.Time.parseInput(this.creator.getWorkdayStart(this.creator.chosenDate))}
var _3=_1.getHours()*2;if(_1.getMinutes()>=30)_3++;var _4=this.getRowHeight(null,0)*_3;this.body.scrollTo(0,_4);this.redraw()},isc.A.getWorkdayRange=function isc_DaySchedule_getWorkdayRange(){var _1=this.getFields(),_2={start:isc.Time.parseInput("23:59"),end:isc.Time.parseInput("00:01")},_3=this.creator;if(this.$53i){for(var i=0;i<_1.length;i++){var _5=this.getDateFromCol(i);if(isc.isA.Date(_5)){var _6=isc.Time.parseInput(_3.getWorkdayStart(_5));if(isc.Date.compareDates(_2.start,_6)<0){_2.start=_6}
var _6=isc.Time.parseInput(_3.getWorkdayEnd(_5));if(isc.Date.compareDates(_2.end,_6)>0){_2.end=_6}}}}else{_2.start=isc.Time.parseInput(_3.getWorkdayStart(_3.chosenDate));_2.end=isc.Time.parseInput(_3.getWorkdayEnd(_3.chosenDate))}
return _2},isc.A.getRowHeight=function isc_DaySchedule_getRowHeight(_1,_2){if(this.creator.scrollToWorkday){var _3=this.getWorkdayRange(),_4=_3.end.getHours()-_3.start.getHours();if(_4<=0)return this.cellHeight;var _5=Math.floor(this.body.getViewportHeight()/(_4*2));return _5<this.cellHeight?this.cellHeight:_5}else{return this.cellHeight}},isc.A.getDayFromCol=function isc_DaySchedule_getDayFromCol(_1){var _2=this.fields.get(_1).$654;return _2},isc.A.getDateFromCol=function isc_DaySchedule_getDateFromCol(_1){var _2=this.fields.get(_1);if(_2.$66a==null||_2.$659==null||_2.$658==null)return null;var _3=new Date(_2.$66a,_2.$659,_2.$658);return _3},isc.A.isLabelCol=function isc_DaySchedule_isLabelCol(_1){if(_1==0&&this.showLabelColumn&&this.labelColumnPosition=="left"){return true}else if(_1==this.fields.length-1&&this.showLabelColumn&&this.labelColumnPosition=="right"){return true}else{return false}},isc.A.colDisabled=function isc_DaySchedule_colDisabled(_1){var _2=this.$53i?this.getDayFromCol(_1):this.creator.chosenDate.getDay();if(this.creator.disableWeekends&&Date.getWeekendDays().contains(_2)){return true}else{return false}},isc.A.refreshStyle=function isc_DaySchedule_refreshStyle(){if(!this.body)return;if(this.$53i){this.markForRedraw();return}
for(var i=0;i<this.data.length;i++){this.body.refreshCellStyle(i,1)}},isc.A.headerClick=function isc_DaySchedule_headerClick(_1,_2){if(this.isLabelCol(_1))return true;var _3=this.getField(_1);var _4=this.creator;_4.dateChooser.dateClick(_3.$66a,_3.$659,_3.$658);_4.selectTab(0);return true},isc.A.getCellAlign=function isc_DaySchedule_getCellAlign(_1,_2,_3){return this.labelColumnAlign},isc.A.cellMouseDown=function isc_DaySchedule_cellMouseDown(_1,_2,_3){if(this.isLabelCol(_3)||this.colDisabled(_3))return true;var _4=this.creator.getCellDate(this.getEventRow(),this.getEventColumn());if(this.creator.backgroundMouseDown&&this.creator.backgroundMouseDown(_4)==false)return;if(!this.creator.canCreateEvents)return true;this.clearSelection();this.$53q={};this.$53q.colNum=_3;this.$53q.startRowNum=_2;this.$53q.endRowNum=_2;this.$53r=true;this.refreshCellStyle(_2,_3)},isc.A.cellOver=function isc_DaySchedule_cellOver(_1,_2,_3){if(this.$53r&&this.$53q){var _4;if(this.$53q.startRowNum<this.$53q.endRowNum){if(_2>this.$53q.endRowNum){_4=_2}else{_4=this.$53q.endRowNum}
this.$53q.endRowNum=_2}else{if(_2<this.$53q.endRowNum){_4=_2}else{_4=this.$53q.endRowNum}
this.$53q.endRowNum=_2}
var _5=6;var _3=this.$53q.colNum;for(var i=_4-_5;i<_4+_5;i++){if(i>=0&&i<=47)this.refreshCellStyle(i,_3)}}},isc.A.cellMouseUp=function isc_DaySchedule_cellMouseUp(_1,_2,_3){if(!this.$53q)return true;this.$53r=false;var _4,_5,_6;if(this.$53q.startRowNum>this.$53q.endRowNum){_4=this.$53q.endRowNum;_5=this.$53q.startRowNum}else{_5=this.$53q.endRowNum;_4=this.$53q.startRowNum}
_6=_5-_4+1;var _7=this.creator.getCellDate(_4,_3);var _8=this.creator.getCellDate(_4+_6,_3);if(_6==1&&this.creator.backgroundClick){if(this.creator.backgroundClick(_7,_8)==false){this.clearSelection();return}}
if(this.creator.backgroundMouseUp){if(this.creator.backgroundMouseUp(_7,_8)==false){this.clearSelection();return}}
var _9={};_9[this.creator.startDateField]=_7;_9[this.creator.endDateField]=_8;this.creator.showNewEventDialog(_9)},isc.A.getCellStyle=function isc_DaySchedule_getCellStyle(_1,_2,_3){var _4=this.getBaseStyle(_1,_2,_3);if(this.isLabelCol(_3))return _4;if(this.colDisabled(_3))return _4+"Disabled";if(!this.$53i&&this.alternateRecordStyles&&_2%2!=0)return _4+"Dark";if(this.$53q&&this.$53q.colNum==_3){var _5=this.$53q.startRowNum,_6=this.$53q.endRowNum;if(_2>=_5&&_2<=_6||_2>=_6&&_2<=_5){return this.creator.selectedCellStyle}else{return _4}}else{return _4}},isc.A.getBaseStyle=function isc_DaySchedule_getBaseStyle(_1,_2,_3){var _4=this.creator,_5=_4.getCellDate(_2,_3),_6=_5?_4.getDateStyle(_5,_2,_3,this):null;if(_6){return _6}
if(this.isLabelCol(_3))return this.labelColumnBaseStyle;if(!this.creator.showWorkday)return this.baseStyle;var _7=this.$53i?this.getDayFromCol(_3):this.creator.chosenDate.getDay();var _8=this.$53i?this.getDateFromCol(_3):this.creator.chosenDate.duplicate(),_9=_8.duplicate(),_10=_8.duplicate(),_11=isc.Time.parseInput(this.creator.getWorkdayStart(_10)),_12=isc.Time.parseInput(this.creator.getWorkdayEnd(_10));_8.setHours(_11.getHours());_8.setMinutes(_11.getMinutes());_9.setHours(_12.getHours());_9.setMinutes(_12.getMinutes());_10.setHours(Math.floor(_2/2));if(_2%2==1)_10.setMinutes(30);else _10.setMinutes(0);if(this.$53i){_10.setFullYear(_8.getFullYear());_10.setMonth(_8.getMonth());_10.setDate(_8.getDate())}
var _13=this.creator.dateIsWorkday(_10);_10=_10.getTime();if(_13&&_8.getTime()<=_10&&_10<_9.getTime()){return this.creator.workdayBaseStyle}else{return this.baseStyle}},isc.A.clearSelection=function isc_DaySchedule_clearSelection(){if(this.$53q){var _1,_2,_3=this.$53q.colNum;if(this.$53q.startRowNum<this.$53q.endRowNum){_1=this.$53q.startRowNum;_2=this.$53q.endRowNum}else{_1=this.$53q.endRowNum;_2=this.$53q.startRowNum}
this.$53q=null;for(var i=_1;i<_2+1;i++){this.refreshCellStyle(i,_3)}}},isc.A.refreshEvents=function isc_DaySchedule_refreshEvents(){if(!this.body||!this.creator.hasData())return;this.logDebug('refreshEvents:'+this.viewName,"calendar");this.clearEvents();var _1,_2,_3=this.creator;if(this.$53i){_1=_3.chosenWeekStart;_2=_3.chosenWeekEnd}else{_1=new Date(_3.year,_3.month,_3.chosenDate.getDate(),0,0);_2=new Date(_3.year,_3.month,_3.chosenDate.getDate(),23,59)}
var _4=_3.$53g(_1,_2);for(var i=0;i<_4.length;i++){this.addEvent(_4[i])}
if(_3.eventsRendered&&isc.isA.Function(_3.eventsRendered))
_3.eventsRendered()},isc.A.sizeEventWindow=function isc_DaySchedule_sizeEventWindow(_1){var _2=this.creator,_3=_1.event;if(Array.isLoading(_3))return;if(!_1.$53v){if(_2.eventAutoArrange){_2.$64n(_1.$53i,_3[_2.startDateField],_3[_2.endDateField])}else{var _4=(_1.$53i?_2.weekView:_2.dayView);var _5=_4.getRowHeight(1),_6=_4.getColumnWidth(_4.isLabelCol(0)?1:0);var _7=_3[_2.endDateField].getHours()==0?24:_3[_2.endDateField].getHours();var _8=false;if(_3[_2.endDateField].getDate()>_3[_2.startDateField].getDate()){_8=true;_7=24}
var _9=(_7-_3[_2.startDateField].getHours())*(_5*2),_10=_6;if(_2.weekEventBorderOverlap&&_1.$53i)_10+=1;if(_3[_2.startDateField].getMinutes()>0){_9-=_2.$54g(_3[_2.startDateField].getMinutes(),_5)}
if(_3[_2.endDateField].getMinutes()>0&&!_8){_9+=_2.$54g(_3[_2.endDateField].getMinutes(),_5)}
var _11=_3[_2.startDateField].getHours()*(_5*2);if(_3[_2.startDateField].getMinutes()>0){_11+=_2.$54g(_3[_2.startDateField].getMinutes(),_5)}
var _12=_2.getEventLeft(_3,_1.$53i);_1.renderEvent(_11,_12,_10,_9)}}else{_1.$53v=false}},isc.A.poolEventWindow=function isc_DaySchedule_poolEventWindow(_1){if(this.body){if(!this.body.$1234)this.body.$1234=[];this.body.$1234.add(_1);return true}else return false},isc.A.getPooledEventWindow=function isc_DaySchedule_getPooledEventWindow(){if(!this.body)return;if(!this.body.$1234)this.body.$1234=[];var _1=this.body.$1234,_2;if(_1.length>0){_2=_1[_1.length-1];_1.removeAt(_1.length-1)}
return _2},isc.A.destroy=function isc_DaySchedule_destroy(){this.clearEvents(true);if(this.body)this.body.$1234=null;this.Super("destroy",arguments)},isc.A.clearEvents=function isc_DaySchedule_clearEvents(_1){if(!this.body||!this.body.children)return;var _2=this.body.children,_3=[],_4=_2.length-1;for(var i=_4;i>=0;i--){if(isc.isAn.EventWindow(_2[i])){_3.add(_2[i]);this.body.removeChild(_2[i])}}
if(_3.length>0){for(var i=0;i<_3.length;i++){var _6=_3[i];if(_6){if(!this.poolEventWindows||_1){_6.destroy();_6=null}else{this.poolEventWindow(_6)}}}}},isc.A.addEvent=function isc_DaySchedule_addEvent(_1){this.clearSelection();var _2=this.creator.$53f(_1,this);_2.$643=this;if(this.$53i)_2.$53i=true;if(this.body)this.body.addChild(_2);this.sizeEventWindow(_2)},isc.A.removeEvent=function isc_DaySchedule_removeEvent(_1){var _2=this.body.children||[];for(var i=0;i<_2.length;i++){if(isc.isAn.EventWindow(_2[i])&&_2[i].event===_1){var _4=_2[i];_4.parentElement.removeChild(_4);if(this.poolEventWindows)this.poolEventWindow(_4);else _4.destroy();return true}}
return false},isc.A.updateEventWindow=function isc_DaySchedule_updateEventWindow(_1){if(!this.body||!this.body.children)return;var _2=this.body.children,_3=this.creator;if(_3.dataSource)_3.$53s=_3.getDataSource().getLocalPrimaryKeyFields();for(var i=0;i<_2.length;i++){if(isc.isAn.EventWindow(_2[i])&&this.areSame(_2[i].event,_1)){_2[i].event=_1;this.sizeEventWindow(_2[i]);_2[i].setDescriptionText(_1[_3.descriptionField]);return true}}
return false},isc.A.areSame=function isc_DaySchedule_areSame(_1,_2){var _3=this.creator;if(_3.dataSource){var _4=_3.$53s,_5=true;for(var _6 in _4){if(_1[_6]!=_2[_6]){_5=false;break}}
return _5}else{return(_1===_2)}});isc.B._maxIndex=isc.C+29;isc.ClassFactory.defineClass("WeekSchedule","DaySchedule");isc.ClassFactory.defineClass("MonthSchedule","ListGrid");isc.ClassFactory.defineClass("MonthScheduleBody","GridBody");isc.MonthSchedule.changeDefaults("headerButtonProperties",{showRollOver:false,showDown:false,cursor:"default"});isc.MonthSchedule.changeDefaults("bodyProperties",{redrawOnResize:true});isc.A=isc.MonthSchedule.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.autoDraw=false;isc.A.leaveScrollbarGap=false;isc.A.showAllRecords=true;isc.A.fixedRecordHeights=true;isc.A.showHeader=true;isc.A.showHeaderContextMenu=false;isc.A.canSort=false;isc.A.canResizeFields=false;isc.A.canReorderFields=false;isc.A.canAutoFitFields=false;isc.A.canHover=true;isc.A.showHover=true;isc.A.hoverWrap=false;isc.A.showRollOver=true;isc.A.useCellRollOvers=true;isc.A.canSelectCells=true;isc.A.dayHeaderHeight=20;isc.A.alternateRecordStyles=false;isc.A.cellHeight=1;isc.A.enforceVClipping=true;isc.B.push(isc.A.initWidget=function isc_MonthSchedule_initWidget(){var _1=this.creator;if(_1.data)this.data=this.getDayArray();this.fields=[{name:"day1",align:"center"},{name:"day2",align:"center"},{name:"day3",align:"center"},{name:"day4",align:"center"},{name:"day5",align:"center"},{name:"day6",align:"center"},{name:"day7",align:"center"}];this.firstDayOfWeek=_1.firstDayOfWeek;var _2=Date.getShortDayNames();var _3=Date.getWeekendDays();for(var i=0;i<7;i++){var _5=(i+this.firstDayOfWeek)%7;this.fields[i].title=_2[_5];this.fields[i].$654=_5;this.fields[i].$66b=i+1;if(!_1.showWeekends&&_3.contains(_5)){this.fields[i].showIf="return false;"}}
this.minimumDayHeight=_1.minimumDayHeight;this.Super("initWidget")},isc.A.getCellCSSText=function isc_MonthSchedule_getCellCSSText(_1,_2,_3){var _4=this.creator.$116j(this,_1,_2,_3);if(_4)return _4;return this.Super("getCellCSSText",arguments)},isc.A.getDayArray=function isc_MonthSchedule_getDayArray(){var _1=[],_2,_3,_4=new Date(this.creator.year,this.creator.month,1);while(_4.getDay()!=this.creator.firstDayOfWeek){this.incrementDate(_4,-1)}
if(!this.creator.showWeekends){var _5=Date.getWeekendDays();var _6=_4.duplicate();var _7=true;for(var i=0;i<=7-_5.length;i++){if(_6.getMonth()==this.creator.month){_7=false;break}
this.incrementDate(_6,1)}
if(_7)this.incrementDate(_4,7)}
_3=new Date(this.creator.year,this.creator.month,_4.getDate()+40);_2=this.creator.$53g(_4,_3);_2.sortByProperty("name",true,function(_9,_10,_11){return _9[_11.startDateField].getTime()},this.creator);this.$53t=0;for(var i=0;i<6;i++){if(this.creator.showDayHeaders)_1.add(this.getHeaderRowObject(_4));_1.add(this.getEventRowObject(_4,_2));this.incrementDate(_4,7);if(_4.getMonth()!=this.creator.month)break}
return _1},isc.A.getHeaderRowObject=function isc_MonthSchedule_getHeaderRowObject(_1){var _2={};var _3=_1.duplicate();for(var i=0;i<7;i++){_2["day"+(i+1)]=_3.getDate();_2["date"+(i+1)]=_3.duplicate();this.incrementDate(_3,1)}
return _2},isc.A.incrementDate=function isc_MonthSchedule_incrementDate(_1,_2){var _3=_1.getDate();_1.setDate(_3+_2);if(_1.getDate()==(_3+_2)-1){_1.setHours(_1.getHours()+1);_1.setDate(_3+_2)}
return _1},isc.A.getEventRowObject=function isc_MonthSchedule_getEventRowObject(_1,_2){var _3={};var _4=_1.duplicate();for(var i=0;i<7;i++){var _6=[];while(this.$53t<_2.length){var _7=_2[this.$53t];if(_7[this.creator.startDateField].getMonth()!=_4.getMonth()||_7[this.creator.startDateField].getDate()!=_4.getDate()){break}else{_6.add(_7);this.$53t+=1}}
_3["day"+(i+1)]=_4.getDate();_3["date"+(i+1)]=_4.duplicate();_3["event"+(i+1)]=_6;this.incrementDate(_4,1)}
return _3},isc.A.getEvents=function isc_MonthSchedule_getEvents(_1,_2){var _3=this.getDayFromCol(_2);var _4=this.fields.get(_2).$66b
var _5=this.data[_1]["event"+_4];return _5},isc.A.getEventCell=function isc_MonthSchedule_getEventCell(_1){var _2=this.data;for(var _3=0;_3<this.fields.length;_3++){var _4=this.fields[_3].$66b,_5="event"+_4;for(var _6=0;_6<_2.length;_6++){var _7=_2.get(_6)[_5];if(_7!=null&&_7.contains(_1)){return[_6,_3]}}}},isc.A.getDayFromCol=function isc_MonthSchedule_getDayFromCol(_1){var _2=this.fields.get(_1).$654;return _2},isc.A.colDisabled=function isc_MonthSchedule_colDisabled(_1){if(this.creator.disableWeekends&&Date.getWeekendDays().contains(this.getDayFromCol(_1))){return true}else{return false}},isc.A.refreshEvents=function isc_MonthSchedule_refreshEvents(){if(!this.creator.hasData())return;this.logDebug('refreshEvents: month','calendar');this.setData(this.getDayArray());var _1=this.creator;if(_1.eventsRendered&&isc.isA.Function(_1.eventsRendered))
_1.eventsRendered()},isc.A.rowIsHeader=function isc_MonthSchedule_rowIsHeader(_1){var _2=this.creator;if(!_2.showDayHeaders||(_2.showDayHeaders&&_1%2==1))return false;else return true},isc.A.formatCellValue=function isc_MonthSchedule_formatCellValue(_1,_2,_3,_4){var _5=this.creator,_6=this.fields.get(_4).$66b,_7=_2["event"+_6],_8=_2["date"+_6],_9=_8.getMonth()!=_5.chosenDate.getMonth();if(this.rowIsHeader(_3)){if(!_5.showOtherDays&&_9){return""}else{return _5.getDayHeaderHTML(_8,_7,_5,_3,_4)}}else{if(!_5.showOtherDays&&_9){return""}else{return _5.getDayBodyHTML(_8,_7,_5,_3,_4)}}},isc.A.getRowHeight=function isc_MonthSchedule_getRowHeight(_1,_2){var _3=this.creator.showDayHeaders;if(this.rowIsHeader(_2)){return this.dayHeaderHeight}else{var _4=_3?this.data.length/2:this.data.length,_5=_3?this.body.getViewportHeight()
-(this.dayHeaderHeight*_4):this.body.getViewportHeight(),_6=_3?this.minimumDayHeight-this.dayHeaderHeight:null;if(_5/_4<=_6){return _6}else{var _7=_5%_4,_8=0,_9=_3?(_2-1)/2:_2;if(_9<_7)_8=1;return(Math.floor(_5/_4)+_8)}}},isc.A.getCellAlign=function isc_MonthSchedule_getCellAlign(_1,_2,_3){if(this.rowIsHeader(_2))return"right"
else return"left"},isc.A.getCellVAlign=function isc_MonthSchedule_getCellVAlign(_1,_2,_3){if(!this.rowIsHeader(_2))return"top";else return"center"},isc.A.cellHoverHTML=function isc_MonthSchedule_cellHoverHTML(_1,_2,_3){var _4=this.fields.get(_3).$66b;var _5=_1["date"+_4];var _6=_1["event"+_4];if(!this.rowIsHeader(_2)&&_6!=null){var _7=this.creator;return _7.getMonthViewHoverHTML(_5,_6)}},isc.A.getBaseStyle=function isc_MonthSchedule_getBaseStyle(_1,_2,_3){var _4=this.creator,_5=this.fields.get(_3).$66b;var _6;if(this.rowIsHeader(_2)){if((_2==0&&_1["day"+_5]>7)||(_2==this.data.length-2&&_1["day"+_5]<7)){if(!_4.showOtherDays)return _4.otherDayBlankStyle;else _6=_4.otherDayHeaderBaseStyle}else _6=_4.dayHeaderBaseStyle}else{var _7=this.colDisabled(_3),_8=_4.showDayHeaders?1:0,_9=this.data.length-1;if((_2==_8&&this.data[_8]["day"+_5]>7)||(_2==_9&&this.data[_9]["day"+_5]<7)){if(!_4.showOtherDays)return _4.otherDayBlankStyle;else _6=_7?_4.otherDayBodyBaseStyle+"Disabled":_4.otherDayBodyBaseStyle}else _6=_7?_4.dayBodyBaseStyle+"Disabled":_4.dayBodyBaseStyle}
return _6},isc.A.cellClick=function isc_MonthSchedule_cellClick(_1,_2,_3){var _4=this.creator,_5,_6,_7=this.fields.get(_3).$66b,_8=_1["date"+_7],_9=_1["event"+_7],_10=_4.chosenDate.getMonth()!=_8.getMonth(),_11=false;if(this.rowIsHeader(_2)){if(!(!this.creator.showOtherDays&&_10)){_11=_4.dayHeaderClick(_8,_9,_4,_2,_3)}
if(_11){if(_2==0&&_1["day"+_7]>7){if(_4.month==0){_5=_4.year-1;_6=11}else{_5=_4.year;_6=_4.month-1}}else if(_2==this.data.length-2&&_1["day"+_7]<7){if(_4.month==11){_5=_4.year+1;_6=0}else{_5=_4.year;_6=_4.month+1}}else{_5=_4.year;_6=_4.month}
_4.dateChooser.dateClick(_5,_6,_1["day"+_7]);_4.selectTab(0)}}else{if(!this.colDisabled(_3)&&!(!_4.showOtherDays&&_10)){_11=_4.dayBodyClick(_8,_9,_4,_2,_3);if(_11&&_4.canCreateEvents){var _12=_4.getCellDate(_2,_3),_13=_4.getCellDate(_2,_3+1);var _14={};_14[_4.startDateField]=_12;_14[_4.endDateField]=_13;_4.showNewEventDialog(_14)}}}});isc.B._maxIndex=isc.C+19;isc.ClassFactory.defineClass("EventWindow","Window");isc.EventWindow.changeDefaults("resizerDefaults",{overflow:"hidden",height:6,snapTo:"B",canDragResize:true})
isc.EventWindow.changeDefaults("headerDefaults",{layoutMargin:0,layoutLeftMargin:3,layoutRightMargin:3})
isc.A=isc.EventWindow.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.autoDraw=false;isc.A.minHeight=5;isc.A.minWidth=5;isc.A.showHover=true;isc.A.canHover=true;isc.A.hoverWidth=200;isc.A.showHeaderIcon=false;isc.A.showMinimizeButton=false;isc.A.showMaximimumButton=false;isc.A.canDragResize=true;isc.A.canDragReposition=true;isc.A.resizeFrom=["B"];isc.A.showShadow=false;isc.A.showEdges=false;isc.A.showHeaderBackground=false;isc.A.useBackMask=false;isc.A.keepInParentRect=true;isc.A.headerProperties={height:14};isc.A.closeButtonProperties={height:10,width:10};isc.A.bodyColor=null;isc.A.showFooter=true;isc.A.baseStyle="eventWindow";isc.A.footerProperties={overflow:"hidden",defaultLayoutAlign:"center",height:7};isc.A.bodyConstructor=isc.HTMLFlow;isc.B.push(isc.A.initWidget=function isc_EventWindow_initWidget(){this.bodyStyle=this.baseStyle+"Body";this.headerStyle=this.baseStyle+"Header";this.headerLabelProperties={styleName:this.className+"Header"};if(this.calendar.showEventDescriptions!=false){this.bodyProperties=isc.addProperties({},this.bodyProperties,{contents:this.descriptionText,valign:"top",overflow:"hidden"})}
if(this.calendar.showEventBody==false){this.showBody=false;this.showTitle=false}
this.Super("initWidget",arguments)},isc.A.makeFooter=function isc_EventWindow_makeFooter(){if(!this.showFooter||this.canDragResize==false)return;this.resizer=this.createAutoChild("resizer",{dragTarget:this,styleName:this.baseStyle+"Resizer"});this.addChild(this.resizer);if(this.resizer)this.resizer.bringToFront()},isc.A.setDescriptionText=function isc_EventWindow_setDescriptionText(_1){if(this.calendar.getDescriptionText){_1=this.calendar.getDescriptionText(this.event)}
if(_1){if(this.body){this.descriptionText=_1;this.body.setContents(_1)}else{this.descriptionText=_1;if(this.$734){this.$734.setWidth("100%");this.$734.setContents(_1)}}}},isc.A.click=function isc_EventWindow_click(){if(this.$53u)return;if(this.$67e){this.$67e=null;return}
var _1=this.calendar;var _2=_1.eventClick(this.event,this.$53i?"week":"day");if(_2){if(!_1.canEditEvent(this.event))return;if(this.$53i)_1.weekView.clearSelection();else if(_1.dayView)_1.dayView.clearSelection();var _3=(this.$53i&&_1.weekView.isLabelCol(0)?1:0);var _4=this.$53i?this.event[_1.startDateField].getDay()-
_1.firstDayOfWeek+_3:_3;if(this.$53i&&_1.showWeekends==false)_4--;var _5=this.event[_1.startDateField].getHours()*2;_1.showEventDialog(this.event)}},isc.A.mouseDown=function isc_EventWindow_mouseDown(){this.calendar.eventDialog.hide();return isc.EH.STOP_BUBBLING},isc.A.renderEvent=function isc_EventWindow_renderEvent(_1,_2,_3,_4){var _5=this.calendar,_6=this.event;this.updateColors();if(isc.isA.Number(_3)&&isc.isA.Number(_4)){this.resizeTo(Math.round(_3),Math.round(_4))}
if(isc.isA.Number(_1)&&isc.isA.Number(_2)){this.moveTo(Math.round(_2),Math.round(_1))}
var _7=isc.Time.toTime(_6[_5.startDateField],this.calendar.timeFormatter,true);var _8=_7+" "+_6[_5.nameField];var _9=""
if(_6.headerTextColor)_9+="color:"+_6.headerTextColor+";";if(_6.headerBackgroundColor){_9+="background-color:"+_6.headerBackgroundColor+";";var _10=this.header.getMember(0);if(_10){_10.setBackgroundColor(_6.headerBackgroundColor)}}
if(_9!="")_8="<span style='"+_9+"'>"+_8+"</span>";this.setTitle(_8);this.bringToFront()},isc.A.updateColors=function isc_EventWindow_updateColors(){var _1=this.calendar,_2=this.event,_3=this.header,_4=_3?_3.getMember?_3.getMember(0):_3:null,_5=_4;if(!_2)return;if(_4&&_4.children&&_4.children[0]){var _6=_4.children[0].members;if(_6&&_6.length>0)_5=_6[0]}
if(_2.backgroundColor){this.setBackgroundColor(_2.backgroundColor);if(this.body)this.body.setBackgroundColor(_2.backgroundColor)}else{this.backgroundColor=null;if(this.isDrawn()&&this.getStyleHandle()){this.getStyleHandle().backgroundColor=null}
if(this.body){this.body.backgroundColor=null;if(this.body.isDrawn()&&this.body.getStyleHandle()){this.body.getStyleHandle().backgroundColor=null}}
if(_5){_5.backgroundColor=null;if(_5.isDrawn()&&_5.getStyleHandle()){_5.getStyleHandle().backgroundColor=null}}}
if(_2.textColor){this.setTextColor(_2.textColor);if(this.body){var _7="color:"+_2.textColor+";"
this.body.setTextColor(_2.textColor);this.body.setContents("<span style='"+_7+"'>"+_2[_1.descriptionField]||"</span>")}}else{this.setTextColor(null);if(this.isDrawn()&&this.getStyleHandle()){this.getStyleHandle().color=null}
if(this.body){this.body.setTextColor(null);this.body.setContents(_2[_1.descriptionField])}
if(_5){_5.setTextColor(null);_5.setContents(_2[_1.nameField])}}
if(this.header){var _8,_9;if(_1.showEventDescriptions==false){_8=_2.backgroundColor;_9=_2.textColor}else{_8=_2.headerBackgroundColor;_9=_2.headerTextColor}
if(_8){this.header.setBackgroundColor(_8);if(_5)_5.setBackgroundColor(_8)}else{this.header.backgroundColor=null;if(this.isDrawn()&&this.header.getStyleHandle()){this.header.getStyleHandle().backgroundColor=null}
if(_5){_5.backgroundColor=null;if(_5.getStyleHandle()){_5.getStyleHandle().backgroundColor=null}}}
if(_9){this.header.setTextColor(_9);var _7="color:"+_9+";",_10=_1.showEventDescriptions==false?this.header.$116k:_2[_1.nameField],_11="<span style='"+_7+"'>"+_10+"</span>";if(!_5){if(this.header.setContents)this.header.setContents(_11)}else{_5.setTextColor(_9);_5.setContents(_11)}}else{this.header.setTextColor(null);if(this.isDrawn()&&this.header.getStyleHandle()){this.header.getStyleHandle().color=null}
if(_5){_5.setTextColor(null);if(_5.isDrawn()&&_5.getStyleHandle()){_5.getStyleHandle().color=null}}}
this.markForRedraw()}},isc.A.getPrintHTML=function isc_EventWindow_getPrintHTML(_1,_2){var _3=isc.StringBuffer.create(),_4=this.calendar,_5=_4.isTimeline(),_6=this.parentElement,_7=_6.grid,_8=40+_7.getHeaderHeight(),_9=this.getTop(),_10=_6.getPageTop(),_11=(_9)+_8+1,_12=_6.$26a,_13=_7.getLeft()+_6.getLeft()+(_7.getEventLeft?_7.getEventLeft(this.event):_4.getEventLeft(this.event,_7.$53i)),_14=this.getVisibleWidth(),_15=this.getVisibleHeight()-2,i=(_1&&_1.i?_1.i:1);var _17=_4.getEventStartCol(this.event,this),_18=_4.getEventEndCol(this.event,this);if(_5){_13+=(14+((_17-1)*2));_14+=_18-_17}else{_13+=_7.$53i?6:8}
var _19=_5?this.baseStyle:this.body.className;_3.append("<div class='",_19,"' ","style='border: 1px solid grey; vertical-align: ",(_4.showEventDescriptions?"top":"middle"),"; ",(_5?"overflow:hidden; ":""),"position: absolute; ","left:",_13,"px; top:",_11,"px; width: ",_14,"px; height: ",_15,"px; ","z-index:",i+2,";'>");if(_4.showEventDescriptions){_3.append(this.title,"<br>",this.event[_4.descriptionField])}else{_3.append(this.title)}
_3.append("</div>");var _20=_3.toString();return _20},isc.A.getHoverHTML=function isc_EventWindow_getHoverHTML(){return this.calendar.getEventHoverHTML(this.event,this)},isc.A.closeClick=function isc_EventWindow_closeClick(){var _1=this.calendar;if(_1.eventRemoveClick(this.event)==false){this.$67e=true;return}
this.Super("closeClick",arguments);this.calendar.removeEvent(this.event,true);this.$53u=true},isc.A.parentResized=function isc_EventWindow_parentResized(){this.Super('parentResized',arguments);this.$643.sizeEventWindow(this)},isc.A.getEventLength=function isc_EventWindow_getEventLength(_1,_2){return this.calendar.getEventLength(_1||this.event[this.calendar.startDateField],_2||this.event[this.calendar.endDateField])},isc.A.dragRepositionStart=function isc_EventWindow_dragRepositionStart(){var _1=this.getTop()%this.parentElement.snapVGap;this.parentElement.VSnapOrigin=_1},isc.A.dragRepositionStop=function isc_EventWindow_dragRepositionStop(){var _1=this.calendar;var _2=this.event[_1.startDateField],_3=this.event[_1.endDateField];this.Super('dragRepositionStop',arguments);var _4=this.ns.EH,_5=this.parentElement.getEventColumn(),_6=Math.max(0,(_4.dragMoveTarget.getTop()-this.parentElement.getPageTop())+this.parentElement.getScrollTop()),_7=this.parentElement.getRowSize(1),_8=Math.max(Math.floor(_6/_7),0),_9=(this.$53i?_1.weekView:_1.dayView);if(_9.isLabelCol(_5)||_9.colDisabled(_5))return false;var _10=_1.getCellDate(_8,_5);var _11=Math.floor((_6-(_7*_8))*(30/_7));_10.setMinutes(_10.getMinutes()+_11);_10=_1.getValidSnapDate(this.event[_1.startDateField],_10);if(!_1.eventMoved(_10,this.event))return false;var _12=new Date(_10.getFullYear(),_10.getMonth(),_10.getDate(),_10.getHours(),_10.getMinutes());_12.setMinutes(_12.getMinutes()+this.getEventLength());_1.updateEvent(this.event,_10,_12,this.event[_1.nameField],this.event[_1.descriptionField],null,true);if(_1.eventAutoArrange){_1.$64n(this.$53i,_2,_3,[]);_4.dragMoveTarget.setPageRect(this.getPageLeft(),this.getPageTop())}
return false},isc.A.dragResizeStart=function isc_EventWindow_dragResizeStart(){var _1=(this.getTop()+this.getVisibleHeight())%this.parentElement.snapVGap;this.parentElement.VSnapOrigin=_1},isc.A.dragResizeStop=function isc_EventWindow_dragResizeStop(){var _1=this.calendar;var _2=this.event[_1.startDateField],_3=this.event[_1.endDateField];this.Super('dragResizeStop',arguments);var _4=this.ns.EH,_5=this.parentElement.getEventColumn(),_6=(_4.dragMoveTarget.getTop()-this.parentElement.getPageTop())+this.parentElement.getScrollTop()+_4.dragMoveTarget.getVisibleHeight(),_7=this.parentElement.getRowSize(1),_8=Math.floor(_6/_7);var _9=_1.getCellDate(_8,_5);var _10=Math.floor((_6-(_7*_8))*(30/_7));_9.setMinutes(_9.getMinutes()+_10);_9=_1.getValidSnapDate(this.event[_1.endDateField],_9);if(_4.dragMoveTarget.getVisibleHeight()<_7)return false;if(!_1.eventResized(_9,this.event))return false;_1.updateEvent(this.event,this.event[_1.startDateField],_9,this.event[_1.nameField],this.event[_1.descriptionField],null,true);if(_1.eventAutoArrange){_1.$64n(this.$53i,_2,_3,[]);_4.dragMoveTarget.setPageRect(this.getPageLeft(),this.getPageTop())}
this.$54h=false;return false});isc.B._maxIndex=isc.C+16;isc.ClassFactory.defineClass("TimelineWindow","EventWindow");isc.A=isc.TimelineWindow.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.showFooter=false;isc.A.resizeFrom=["L","R"];isc.A.dragAppearance="none";isc.B.push(isc.A.initWidget=function isc_TimelineWindow_initWidget(){if(this.calendar.showEventWindowHeader==false){this.showBody=false;this.showTitle=false}
this.Super("initWidget",arguments)},isc.A.draw=function isc_TimelineWindow_draw(_1,_2,_3,_4){this.invokeSuper(isc.TimelineWindow,"draw",_1,_2,_3,_4);if(this.calendar.showEventWindowHeader==false){var _5=isc.Canvas.create({autoDraw:false,width:"100%",height:0,top:0,contents:(this.descriptionText?this.descriptionText:" "),backgroundColor:this.event.backgroundColor,textColor:this.event.textColor});if(this.body)this.body.addMember(_5);else this.addMember(_5);_5.setHeight(0);_5.setTop(0);this.$734=_5}},isc.A.mouseUp=function isc_TimelineWindow_mouseUp(){return isc.EH.STOP_BUBBLING},isc.A.click=function isc_TimelineWindow_click(){var _1=this.calendar,_2=_1.timelineView,_3=_1.eventClick(this.event,"timeline");if(_3){if(!_1.canEditEvent(this.event))return;_1.showEventDialog(this.event)}else return isc.EH.STOP_BUBBLING},isc.A.checkForOverlap=function isc_TimelineWindow_checkForOverlap(_1,_2,_3,_4){var _5={},_6=this.calendar;_5[_6.startDateField]=_2.duplicate();_5[_6.endDateField]=_3.duplicate();_5[_6.laneNameField]=_4;var _7=_6.timelineView.findOverlappingEvents(_1,_5);if(_7.length==0){return false}else if(_7.length>1){return true}else{var _8=_7[0];var _9=_6.startDateField,_10=_6.endDateField;if((_6.equalDatesOverlap==false?_3>_8[_9]:_3>=_8[_9])&&_2<_8[_9])
{_3=_8[_9].duplicate();_2=_3.duplicate();_2.setMinutes(_2.getMinutes()-this.getEventLength());return[_2,_3]}else if((_6.equalDatesOverlap==false?_2<_8[_10]:_2<=_8[_10])&&_3>_8[_10])
{_2=_8[_10].duplicate();_3=_2.duplicate();_3.setMinutes(_3.getMinutes()+this.getEventLength());return[_2,_3]}else{return true}}},isc.A.destroyLines=function isc_TimelineWindow_destroyLines(){if(this.$645){if(this.$645[0])this.$645[0].destroy();if(this.$645[1])this.$645[1].destroy();if(this.$645[2])this.$645[2].destroy();if(this.$645[3])this.$645[3].destroy()}},isc.A.hideLines=function isc_TimelineWindow_hideLines(){if(this.$645){if(this.$645[0])this.$645[0].hide();if(this.$645[1])this.$645[1].hide();if(this.$645[2])this.$645[2].hide();if(this.$645[3])this.$645[3].hide()}},isc.A.showLines=function isc_TimelineWindow_showLines(){if(this.$645){if(this.$645[0])this.$645[0].show();if(this.$645[1])this.$645[1].show();if(this.$645[2])this.$645[2].show();if(this.$645[3])this.$645[3].show()}},isc.A.hide=function isc_TimelineWindow_hide(){this.invokeSuper(isc.TimelineWindow,"hide");this.hideLines()},isc.A.show=function isc_TimelineWindow_show(){this.invokeSuper(isc.TimelineWindow,"show");this.updateColors();this.showLines()},isc.A.parentResized=function isc_TimelineWindow_parentResized(){this.invokeSuper(isc.EventWindow,"parentResized")},isc.A.mouseDown=function isc_TimelineWindow_mouseDown(){if(this.dragTarget)this.dragTarget.eventWin=this});isc.B._maxIndex=isc.C+12;isc.ClassFactory.defineClass("TimelineView","ListGrid");isc.TimelineView.changeDefaults("bodyProperties",{childrenSnapToGrid:true,snapToCells:false,suppressVSnapOffset:true});isc.A=isc.TimelineView.getPrototype();isc.B=isc._allFuncs;isc.C=isc.B._maxIndex;isc.D=isc._funcClasses;isc.D[isc.C]=isc.A.Class;isc.A.canSort=false;isc.A.canResizeFields=false;isc.A.canAutoFitFields=false;isc.A.canReorderFields=false;isc.A.showHeaderContextMenu=false;isc.A.showAllRecords=true;isc.A.alternateRecordStyles=false;isc.A.showRollOver=true;isc.A.useCellRollOvers=true;isc.A.canSelectCells=true;isc.A.laneNameField="lane";isc.A.columnWidth=60;isc.A.laneHeight=60;isc.A.labelColumnWidth=75;isc.A.labelColumnBaseStyle="labelColumn";isc.A.eventPageSize=30;isc.A.trailIconSize=16;isc.A.leadIconSize=16;isc.A.scrollToToday=false;isc.A.lineImage="[SKINIMG]Stretchbar/hsplit_over_stretch.gif";isc.A.trailingEndPointImage="[SKINIMG]actions/prev.png";isc.A.leadingEndPointImage="[SKINIMG]actions/next.png";isc.A.headerSpanHeight=24;isc.A.headerProperties={inherentWidth:false};isc.A.timelineDragTargetDefaults={_constructor:"Canvas",border:"1px dashed red",width:1,height:1,dragAppearance:"target",dragTarget:this,visibility:"hidden",keepInParentRect:true,positionToEventWin:function(_1){var _2=this.eventWin,_3=_2.calendar,_4=_3.timelineView.getEventLeft(_2.event)+_3.timelineEventPadding,_5=_2.getTop(),_6=_2.getVisibleWidth(),_7=_2.getVisibleHeight();this.moveTo(_4,_5);this.resizeTo(_6,_7);if(_1){if(!this.isDrawn())this.draw();this.show();this.bringToFront()}},dragRepositionStart:function(){var _1=this.eventWin,_2=_1.calendar,_3=_1.parentElement,_4=_3.getEventRow(),_5=_3.getRowTop(_4),_6=_2.timelineView.getEventLeft(_1.event),_7=_3.getEventColumn(_6),_8=_3.getOffsetX()-_1.getLeft();_1.$8l=_4;_1.$962=_1.getTop()-_5;_1.$644=_7;_1.$936=_4;_1.$116y=_8;_1.$117y=_1.getVisibleWidth();this.positionToEventWin(true);return isc.EH.STOP_BUBBLING},dragRepositionMove:function(){var _1=this.eventWin,_2=_1.calendar,_3=_2.timelineView,_4=_1.parentElement,_5=_4.getEventRow(),_6=_4.getEventColumn(),_7=_4.getColumnLeft(_6);var _8=(_3.body.getOffsetX()-_1.$116y),_9=_8-((_8-_7)%_2.eventSnapGap),_10=_4.getRowTop(_5),_11=(_4.getTop()+_10+_1.$962),_12=_3.getDateFromPoint(_9),_13=_3.getDateLeftOffset(_12)+_2.timelineEventPadding,_14=_13+_1.getVisibleWidth();var _15=_4.getEventColumn(_14);if(_15<0){this.moveTo(_1.$117z,_11);return isc.EH.STOP_BUBBLING}
if(_5!=_1.$936){if(_2.canEditLane==false){_5=_1.$936}else{_1.$936=_5}}
if(_6!=_1.$937){_1.$937=_6}
_1.$117z=_13;this.moveTo(_13,_11);return isc.EH.STOP_BUBBLING},dragRepositionStop:function(){var _1=this.eventWin,_2=_1.calendar,_3=_2.timelineView,_4=_1.event;_1.parentElement.HSnapOrigin=0;var _5=(_2.canEditLane?_3.getEventRow():_1.$936),_6;if(_5!=_1.$8l&&_5>=0){if(_2.canEditLane){var _7=_2.lanes.get(_5);_6=_7.name||_7[_2.laneNameField]}else{_1.showLines();return false}}
if(_6)_4[_2.laneNameField]=_6;var _8=[_4[_2.startDateField].duplicate(),_4[_2.endDateField].duplicate()];if(_4[_2.leadingDateField]&&_4[_2.trailingDateField]){_8.add(_4[_2.leadingDateField].duplicate());_8.add(_4[_2.trailingDateField].duplicate())}
var _9=_1.ns.EH;var _10=_9.dragMoveTarget.getLeft()-_2.timelineEventPadding;var _11=_2.timelineView.getDateFromPoint(_10);var _12=_11.duplicate();_12.setMinutes(_12.getMinutes()+_1.getEventLength());_8[0]=_11;_8[1]=_12;var _13=Math.floor((_11.getTime()-_4[_2.startDateField].getTime())/(1000*60));if(_4[_2.leadingDateField])_8[2].setMinutes(_8[2].getMinutes()+_13);if(_4[_2.trailingDateField])_8[3].setMinutes(_8[3].getMinutes()+_13);var _14={}
if(_6)_14[_2.laneNameField]=_6;if(_4[_2.leadingDateField]&&_4[_2.trailingDateField]){_14[_2.leadingDateField]=_8[2];_14[_2.trailingDateField]=_8[3]}
if(_6==null)_6=_4[_2.laneNameField];if(_2.adjustEventTimes){var _15=_2.adjustEventTimes(_4,_1,_8[0],_8[1],_6);if(_15){_8[0]=_15[0].duplicate();_8[1]=_15[1].duplicate()}}
var _16=_1.checkForOverlap(_4,_8[0],_8[1],_6);if(_4.$646&&_4.$646.slotNum>0&&_16!=true){_4.$646.slotNum=null}
if(_2.allowEventOverlap==false){if(_16==true){if(_2.timelineEventOverlap){_2.timelineEventOverlap(false,_4,_1,_8[0],_8[1],_6)}
return false}else if(isc.isAn.Array(_16)){_8[0]=_16[0].duplicate();_8[1]=_16[1].duplicate();if(_2.timelineEventOverlap){_2.timelineEventOverlap(true,_4,_1,_8[0],_8[1],_6)}}}
this.hide();if(!_2.timelineEventMoved(_4,_8[0],_8[1],_6))return false;_2.updateEvent(_4,_8[0],_8[1],_4[_2.nameField],_4[_2.descriptionField],_14,true);return isc.EH.STOP_BUBBLING},dragResizeStart:function(){var _1=this.eventWin,_2=_1.calendar,_3=_1.parentElement,_4=_3.getEventRow(),_5=_3.getRowTop(_4),_6=_2.timelineView.getEventLeft(_1.event),_7=_3.getEventColumn(),_8=_3.getOffsetX()-_1.getLeft()-_2.timelineEventPadding,_9=_1.getVisibleWidth();_1.$8l=_4;_1.$644=_7;_1.$936=_4;_1.$116y=_8;_1.$1170=_8+_9;_1.$117z=_8;_1.$1171=_8+_9;_1.$1172=(_8<5);_1.$117y=_9;this.positionToEventWin(true);return isc.EH.STOP_BUBBLING},dragResizeMove:function(){var _1=this.eventWin,_2=_1.calendar,_3=_2.timelineView,_4=_1.parentElement,_5=_3.body.getOffsetX(),_6=_4.getEventRow(),_7=_4.getEventColumn(),_8=_4.getColumnLeft(_7);if((_5-_8)%_2.eventSnapGap!=0)return isc.EH.STOP_BUBBLING},dragResizeStop:function(){var _1=this.eventWin,_2=_1.calendar,_3=_1.event,_4,_5,_6=this.ns.EH,_7,_8=_6.dragMoveTarget.getLeft();var _9=this.eventWin.getLeft();if([_9,_9+1].contains(_8)){_4=_3[_2.startDateField].duplicate();var _10=(_8+_6.dragMoveTarget.getVisibleWidth());_5=_2.timelineView.getDateFromPoint(_10)}else{_4=_2.timelineView.getDateFromPoint(_8);_5=_3[_2.endDateField].duplicate()}
this.hide();if(!_2.timelineEventResized(_3,_4,_5))return false;_2.updateEvent(_3,_4,_5,_3[_2.nameField],_3[_2.descriptionField],null,true)}};isc.B.push(isc.A.initWidget=function isc_TimelineView_initWidget(){this.fields=[];var c=this.creator;this.addProperties(c.gridProps)
if(c.alternateLaneStyles){this.alternateRecordStyles=c.alternateLaneStyles}
if(c.canReorderLanes){this.canReorderRecords=c.canReorderLanes}
this.firstDayOfWeek=this.creator.firstDayOfWeek;if(c.laneNameField)this.laneNameField=c.laneNameField;if(c.renderEventsOnDemand)this.renderEventsOnDemand=c.renderEventsOnDemand;if(c.startDate)this.startDate=c.startDate.duplicate();if(c.endDate)this.endDate=c.endDate.duplicate();if(c.labelColumnWidth&&c.labelColumnWidth!=this.labelColumnWidth){this.labelColumnWidth=c.labelColumnWidth}
if(c.timelineEventPadding!=null)this.timelineEventPadding=c.timelineEventPadding;if(c.eventDragGap!=null)this.eventDragGap=c.eventDragGap;if(c.headerLevels)this.headerLevels=isc.shallowClone(c.headerLevels);this.$963=this.headerHeight;this.cellHeight=this.laneHeight;var _2=c.timelineGranularity,_3=isc.DateUtil.getTimeUnitKey(_2);if(!this.startDate){this.startDate=c.startDate=isc.DateUtil.getAbsoluteDate("-0"+_3,c.chosenDate)}
if(!this.endDate){this.endDate=c.endDate=isc.DateUtil.getAbsoluteDate("+"+c.defaultTimelineColumnSpan+_3,this.startDate)}else if(isc.Date.compareDates(this.startDate,this.endDate)==-1){var s=this.startDate;this.startDate=c.startDate=this.endDate;this.endDate=c.endDate=s;this.logWarn("Timeline startDate is later than endDate - switching the values.")}
this.Super("initWidget");this.rebuild();this.addAutoChild("timelineDragTarget")},isc.A.cellMouseDown=function isc_TimelineView_cellMouseDown(_1,_2,_3){if(this.isLabelCol(_3))return true;var _4=this.body.getOffsetX();var _5=this.getDateFromPoint(_4,null,true);if(this.creator.backgroundMouseDown&&this.creator.backgroundMouseDown(_5)==false)return;if(!this.creator.canCreateEvents)return true;this.clearSelection();if(this.creator.disableWeekends&&!this.creator.dateIsWorkday(_5)){return true}
this.$53q={};this.$53q.rowNum=_2;this.$53q.startColNum=_3-1;this.$53q.endColNum=_3-1;this.$53q.startDate=_5;this.$53q.startOffsetX=_4;this.$53r=true;this.refreshCellStyle(_2,_3-1)},isc.A.cellOver=function isc_TimelineView_cellOver(_1,_2,_3){_3-=1;if(this.$53r&&this.$53q){var _4;if(this.$53q.startColNum<this.$53q.endColNum){if(_3>this.$53q.endColNum){_4=_3}else{_4=this.$53q.endColNum}
this.$53q.endColNum=_3}else{if(_3<this.$53q.endColNum){_4=_3}else{_4=this.$53q.endColNum}
this.$53q.endColNum=_3}
var _5=1;var _2=this.$53q.rowNum;for(var i=_4-_5;i<_4+_5;i++){this.refreshCellStyle(_2,i)}}},isc.A.cellMouseUp=function isc_TimelineView_cellMouseUp(_1,_2,_3){if(!this.$53q)return true;var _4=this.creator;var _5=this.body.getOffsetX();if(_5-this.$53q.startOffsetX<_4.eventSnapGap){_5=this.$53q.startOffsetX+this.columnWidth}
this.$53q.endDate=this.getDateFromPoint(_5,null,true);this.$53r=false;var _6,_7,_8;if(this.$53q.startColNum>this.$53q.endColNum){_6=this.$53q.endColNum;_7=this.$53q.startColNum}else{_7=this.$53q.endColNum;_6=this.$53q.startColNum}
_8=_7-_6+1;var _9=this.$53q.startDate||this.creator.getCellDate(_2,_6);var _10=this.$53q.endDate||this.creator.getCellDate(_2,_6+_8);if(_8==1&&this.creator.backgroundClick){if(this.creator.backgroundClick(_9,_10)==false){this.clearSelection();return}}
if(this.creator.backgroundMouseUp){if(this.creator.backgroundMouseUp(_9,_10)==false){this.clearSelection();return}}
var _11={};_11[_4.startDateField]=_9;_11[_4.endDateField]=_10;_11[_4.laneNameField]=this.data.get(_2)["name"];this.creator.showNewEventDialog(_11)},isc.A.clearSelection=function isc_TimelineView_clearSelection(){if(this.$53q){var _1,_2,_3=this.$53q.rowNum;if(this.$53q.startColNum<this.$53q.endColNum){_1=this.$53q.startColNum;_2=this.$53q.endColNum}else{_1=this.$53q.endColNum;_2=this.$53q.startColNum}
this.$53q=null;for(var i=_1;i<_2+1;i++){this.refreshCellStyle(_3,i)}}},isc.A.recordDrop=function isc_TimelineView_recordDrop(_1,_2,_3,_4){this.Super("recordDrop",arguments);this.$116v();this.markForRedraw()},isc.A.rebuild=function isc_TimelineView_rebuild(_1){var _2=this.calcFields();if(this.isDrawn())this.setFields(_2);else this.fields=_2;var _3=this.lanes||this.creator.lanes||[];this.setLanes(_3.duplicate());this.$730();if(_1){this.$116v()}},isc.A.$116v=function isc_TimelineView__refreshData(){if(this.creator.dataSource&&isc.ResultSet&&isc.isA.ResultSet(this.creator.data)){this.creator.data.invalidateCache();this.creator.filterData(this.creator.getNewCriteria())}else{this.creator.dataChanged()}},isc.A.setLanes=function isc_TimelineView_setLanes(_1){this.lanes=_1;this.setData(_1);this.$116v()},isc.A.$730=function isc_TimelineView__scrubDateRange(){var _1=this.creator.timelineGranularity;if(_1=="month"){this.startDate.setDate(1)}else if(_1=="week"){this.startDate=isc.DateUtil.getStartOf(this.startDate,"w",true)}else if(_1=="day"){this.startDate.setHours(0);this.startDate.setMinutes(0);this.startDate.setSeconds(0);this.startDate.setMilliseconds(0)}else if(_1=="hour"){this.startDate.setMinutes(0);this.startDate.setSeconds(0);this.startDate.setMilliseconds(0)}else if(_1=="minute"){this.startDate.setSeconds(0);this.startDate.setMilliseconds(0)}},isc.A.scrollTimelineTo=function isc_TimelineView_scrollTimelineTo(_1){this.bodies[1].scrollTo(_1)},isc.A.setLaneHeight=function isc_TimelineView_setLaneHeight(_1){this.laneHeight=_1;this.setCellHeight(_1);this.refreshEvents()},isc.A.getRowHeight=function isc_TimelineView_getRowHeight(_1,_2){return _1.height||this.Super("getRowHeight",arguments)},isc.A.setInnerColumnWidth=function isc_TimelineView_setInnerColumnWidth(_1){this.columnWidth=_1;this.setFields(this.calcFields());this.refreshEvents()},isc.A.setTimelineRange=function isc_TimelineView_setTimelineRange(_1,_2,_3,_4,_5){var _6=this.$116z||c.defaultTimelineColumnSpan;this.startDate=_1.duplicate();this.creator.startDate=_1.duplicate();if(_2){this.endDate=_2.duplicate()}else{var c=this.creator,_8=(_3||c.timelineGranularity).toLowerCase(),_9=isc.DateUtil.getTimeUnitKey(_8);this.endDate=isc.DateUtil.getAbsoluteDate("+"+_6+_9,this.startDate)}
this.creator.endDate=this.endDate.duplicate();if(_3)this.creator.timelineGranularity=_3;if(_4)this.creator.timelineUnitsPerColumn=_4;this.creator.dateChooser.setData(this.startDate);if(!_5)this.creator.setChosenDate(this.startDate,true);this.creator.setDateLabel();this.rebuild()},isc.A.addUnits=function isc_TimelineView_addUnits(_1,_2,_3){_3=_3||this.creator.timelineGranularity;if(_3=="century"){_1.setFullYear(_1.getFullYear()+(_2*100))}else if(_3=="decade"){_1.setFullYear(_1.getFullYear()+(_2*10))}else if(_3=="year"){_1.setFullYear(_1.getFullYear()+_2)}else if(_3=="quarter"){_1.setMonth(_1.getMonth()+(_2*3))}else if(_3=="month"){_1.setMonth(_1.getMonth()+_2)}else if(_3=="week"){_1.setDate(_1.getDate()+(_2*7))}else if(_3=="day"){_1.setDate(_1.getDate()+_2)}else if(_3=="hour"){_1.setHours(_1.getHours()+_2)}else if(_3=="minute"){_1.setMinutes(_1.getMinutes()+_2)}else if(_3=="second"){_1.setSeconds(_1.getSeconds()+_2)}else if(_3=="millisecond"){_1.setMilliseconds(_1.getMilliseconds()+_2)}
return _1},isc.A.getTimelineEventLeft=function isc_TimelineView_getTimelineEventLeft(_1){var _2=this.getTimelineEventColNum(_1);return this.getColumnLeft(_2)},isc.A.getTimelineEventColNum=function isc_TimelineView_getTimelineEventColNum(_1){var _2=this.getFields(),_3=_1[this.creator.startDateField];for(var i=0;i<_2.length;i++){var _5=_2[i];if(_5.date&&_5.date>_3){return i-1}}
return null},isc.A.getTimelineEventTop=function isc_TimelineView_getTimelineEventTop(_1){var _2=this.getTimelineEventRowNum(_1);return this.getRowTop(_2)},isc.A.getTimelineEventRowNum=function isc_TimelineView_getTimelineEventRowNum(_1){var _2=this.data.find("name",_1[this.creator.laneNameField]);if(!_2)_2=this.data.find(this.creator.laneNameField,_1[this.creator.laneNameField]);return this.getRecordIndex(_2)},isc.A.calcFields=function isc_TimelineView_calcFields(){var _1=[],c=this.creator;if(this.creator.laneFields){var _3=this.creator.laneFields;_3.setProperty("frozen",true);_3.setProperty("isLaneField",true);for(var i=0;i<_3.length;i++){if(_3[i].width==null)_3[i].width=this.labelColumnWidth;_1.add(_3[i])}}else{var _5={width:this.labelColumnWidth,name:"title",title:" ",showTitle:false,frozen:true,isLaneField:true}
_1.add(_5)}
if(!c.headerLevels&&!this.headerLevels){c.headerLevels=[{unit:c.timelineGranularity}]}
if(c.headerLevels){this.headerLevels=isc.shallowClone(c.headerLevels)}
if(this.headerLevels){this.fieldHeaderLevel=this.headerLevels[this.headerLevels.length-1];this.headerLevels.remove(this.fieldHeaderLevel);c.timelineGranularity=this.fieldHeaderLevel.unit}
this.adjustTimelineForHeaders();var _6=this.startDate.duplicate(),_7=this.endDate.duplicate(),_8=c.timelineUnitsPerColumn,_9=0,_10=this.fieldHeaderLevel,_11=_10&&_10.titles?_10.titles:[];if(_10.headerWidth)this.columnWidth=_10.headerWidth;while(_6.getTime()<=_7.getTime()){var _12={},_13=this.getInnerFieldTitle(_10,_9,_6);_12=isc.addProperties(_12,{name:"f"+_9,title:_13,width:_10.headerWidth||this.columnWidth,date:_6.duplicate()},this.getFieldProperties(_6));_1.add(_12);_6=this.addUnits(_6,_8);_9++}
this.buildHeaderSpans(_1,this.headerLevels,this.startDate,this.endDate);this.$116z=_9-1;return _1},isc.A.adjustTimelineForHeaders=function isc_TimelineView_adjustTimelineForHeaders(){var _1=this.creator,_2=this.fieldHeaderLevel?this.fieldHeaderLevel.unit:_1.timelineGranularity,_3=_1.startDate,_4=_1.endDate;var _5=isc.DateUtil.getTimeUnitKey(_2);_1.startDate=this.startDate=isc.DateUtil.getStartOf(_3,_5);_1.endDate=this.endDate=isc.DateUtil.getEndOf(_4,_5)},isc.A.buildHeaderSpans=function isc_TimelineView_buildHeaderSpans(_1,_2,_3,_4){var _5=_3.duplicate(),c=this.creator,_7=[];if(_2&&_2.length>0){var _8=this.getHeaderSpans(_3,_4,_2,0,_1);this.headerHeight=this.$963+this.headerSpanHeight}
if(_8&&_8.length>0)this.headerSpans=_8},isc.A.getHeaderSpans=function isc_TimelineView_getHeaderSpans(_1,_2,_3,_4,_5){var _6=_1.duplicate(),c=this.creator,_8=_3[_4],_9=_8.unit,_10=_4>0?_3[_4-1].unit:_9,_11=c.timelineUnitsPerColumn,_12=_8.titles||[],_13=[],_14=0;if(_4>0){if(isc.DateUtil.compareTimeUnits(_9,_10)>0){isc.logWarn("The order of the specified HeaderLevels is incorrect - '"+_9+"' is of a larger granularity than '"+_10+"'")}}
var _15=isc.DateUtil;while(_6<=_2){_15.dateAdd(_6,"mn",1,1);var _16=this.addUnits(_6.duplicate(),_11,_9);var _17={unit:_9,startDate:_6,endDate:_16,fields:[]};this.setSpanDates(_17,_6);_16=_17.endDate;var _18=this.getHeaderLevelTitle(_8,_14,_6,_16);_17.title=_18;for(var i=0;i<_5.length;i++){var _20=_5[i];if(_20.isLaneField||_20.date<_17.startDate)continue;if(_20.date>=_17.endDate)break;_17.fields.add(_20.name)}
if(_4<_3.length-1){_17.spans=this.getHeaderSpans(_17.startDate,_17.endDate,_3,_4+1,_5);if(_8.titles&&_8.titles.length!=_17.spans.length){isc.logWarn("The titles array provided for the "+_8.unit+" levelHeader has a length mismatch: expected "+_17.spans.length+" but "+_8.titles.length+" are present.  Some titles  may be auto-generated according to TimeUnit.")}}
_13.add(isc.clone(_17));_6=_16.duplicate();_14++}
return _13},isc.A.getHeaderLevelTitle=function isc_TimelineView_getHeaderLevelTitle(_1,_2,_3,_4){var _5=_1.unit,_6=_1.titles?_1.titles[_2]:null;if(!_6){if(_5=="century"||_5=="decade"){_6=_3.getFullYear()+" - "+_4.getFullYear()}else if(_5=="year"){_6=_3.getFullYear()}else if(_5=="quarter"){_6=_3.getShortMonthName()+" - "+_4.getShortMonthName()}else if(_5=="month"){_6=_3.getShortMonthName()}else if(_5=="week"){_6=this.creator.weekPrefix+" "+_4.getWeek(this.firstDayOfWeek)}else if(_5=="day"){_6=_3.getShortDayName()}else{if(_5=="hour")_6=_3.getHours();if(_5=="minute")_6=_3.getMinutes();if(_5=="second")_6=_3.getSeconds();if(_5=="millisecond")_6=_3.getMilliseconds();if(_5=="hour")_6=_3.getHours()}
if(isc.isA.Function(_1.titleFormatter)){_6=_1.titleFormatter(_1,_3,_4,_6,this.creator)}}
return _6},isc.A.setSpanDates=function isc_TimelineView_setSpanDates(_1,_2){var _3=isc.DateUtil.getTimeUnitKey(_1.unit);_1.startDate=isc.DateUtil.getStartOf(_2,_3,null,this.firstDayOfWeek);_1.endDate=isc.DateUtil.getEndOf(_1.startDate,_3,null,this.firstDayOfWeek)},isc.A.getFieldProperties=function isc_TimelineView_getFieldProperties(_1){return null},isc.A.getInnerFieldTitle=function isc_TimelineView_getInnerFieldTitle(_1,_2,_3,_4){var _5=_1.unit,_6=_1.titles?_1.titles[_2]:null;if(!_6){if(_5=="year"){_6=_3.getFullYear()}else if(_5=="month"){_6=_3.getShortMonthName()}else if(_5=="week"){_6=this.creator.weekPrefix+" "+_3.getWeek(this.firstDayOfWeek)}else if(_5=="day"){_6=(_3.getMonth()+1)+"/"+_3.getDate()}else{var _7=_3.getMinutes().toString();if(_7.length==1)_7="0"+_7;_6=_3.getHours()+":"+_7}
if(isc.isA.Function(_1.titleFormatter)){_6=_1.titleFormatter(_1,_3,_4,_6,this.creator)}}
return _6},isc.A.draw=function isc_TimelineView_draw(_1,_2,_3,_4){this.invokeSuper(isc.TimelineView,"draw",_1,_2,_3,_4);var _5=this.creator.eventSnapGap;if(_5){this.body.snapHGap=Math.round((_5/60)*this.columnWidth)}else{this.body.snapHGap=this.columnWidth}
this.body.snapVGap=this.laneHeight;if(this.scrollToToday!=false){var _6=new Date();_6.setDate(_6.getDate()-this.scrollToToday);var _7=this.creator.getDayDiff(this.startDate,_6);var _8=_7*this.columnWidth;this.bodies[1].scrollTo(_8,0)}
this.logDebug('draw','calendar');this.body.addChild(this.timelineDragTarget);this.timelineDragTarget.timelineView=this;this.refreshEvents()},isc.A.getBaseStyle=function isc_TimelineView_getBaseStyle(){var _1;if(this.creator.getDateStyle)_1=this.creator.getDateStyle();if(!_1)_1=this.Super("getBaseStyle",arguments);return _1},isc.A.getCellCSSText=function isc_TimelineView_getCellCSSText(_1,_2,_3){var _4=this.creator.$116j(this,_1,_2,_3);if(_4)return _4;return this.Super("getCellCSSText",arguments)},isc.A.formatDateForDisplay=function isc_TimelineView_formatDateForDisplay(_1){return _1.getShortMonthName()+" "+_1.getDate()+", "+_1.getFullYear()},isc.A.getLabelColCount=function isc_TimelineView_getLabelColCount(){if(this.creator.laneFields){return this.creator.laneFields.length}else{return 1}},isc.A.isLabelCol=function isc_TimelineView_isLabelCol(_1){if(_1<this.getLabelColCount())return true;else return false},isc.A.getCellStyle=function isc_TimelineView_getCellStyle(_1,_2,_3){var _4=this.getBaseStyle(_1,_2,_3);if(this.isLabelCol(_3))return _4;if(this.alternateRecordStyles&&_2%2!=0)return _4+"Dark";return _4},isc.A.getBaseStyle=function isc_TimelineView_getBaseStyle(_1,_2,_3){if(this.isLabelCol(_3))return this.labelColumnBaseStyle;else{return this.baseStyle}},isc.A.slideRange=function isc_TimelineView_slideRange(_1){var c=this.creator,_3=c.timelineGranularity.toLowerCase(),_4=isc.DateUtil.getTimeUnitKey(_3),_5=c.timelineUnitsPerColumn,_6=this.startDate.duplicate(),_7=this.endDate.duplicate(),_8=_1?1:-1,_9=c.columnsPerPage||(this.getFields().length-this.getLabelColCount());_6=isc.DateUtil.dateAdd(_6,_4,_9,_8,false);_6=isc.DateUtil.getStartOf(_6,_4,false);_7=isc.DateUtil.dateAdd(_7,_4,_9,_8,false);_7=isc.DateUtil.getEndOf(_7,_4,false);this.setTimelineRange(_6,_7,_3,_5,false)},isc.A.nextOrPrev=function isc_TimelineView_nextOrPrev(_1){this.slideRange(_1)},isc.A.refreshEvents=function isc_TimelineView_refreshEvents(){if(!this.body||!this.creator.hasData())return;var _1=this.startDate,_2=this.endDate,_3=this.creator;this.forceDataSort();var _4=_3.data.getRange(0,_3.data.getLength());this.logDebug('refreshing events','calendar');this.tagDataForOverlap(_4);this.refreshVisibleEvents()},isc.A.getVisibleEvents=function isc_TimelineView_getVisibleEvents(){var _1=this.getVisibleDateRange();var _2=this.getVisibleRowRange();var _3=this.creator;var _4=_3.data;var _5=[];for(var i=0;i<_4.getLength();i++){var _7=_4.get(i);if(!_7){isc.logWarn('getVisibleEvents: potentially invalid index: '+i);break}
if(isc.Date.compareDates(_7[_3.endDateField],this.startDate)>=0)continue;if(isc.Date.compareDates(_7[_3.startDateField],this.endDate)<=0)continue;var _8=_7[_3.laneNameField];var _9={laneName:_8};if(_7[_3.leadingDateField]&&_7[_3.trailingDateField]){_9[_3.leadingDateField]=_1[0];_9[_3.trailingDateField]=_1[1]}else{_9[_3.startDateField]=_1[0];_9[_3.endDateField]=_1[1]}
var _10=this.data.findIndex("name",_8);if(_10<0)_10=this.data.findIndex(_3.laneNameField,_8);if(this.eventsOverlap(_9,_7,(_3.canEditLane==true))&&_2[0]<=_10&&_10<=_2[1]){_5.add(_7)}}
return _5},isc.A.findOverlappingEvents=function isc_TimelineView_findOverlappingEvents(_1,_2,_3){var _4=this.creator;var _5=_4.data;var _6=[];for(var i=0;i<_5.getLength();i++){var _8=_5.get(i);if(!_8){isc.logWarn('getVisibleEvents: potentially invalid index: '+i);break}
if(!_3&&_4.eventsAreSame(_8,_1)){continue}
var _9={};if(_8[_4.leadingDateField]&&_8[_4.trailingDateField]){_9[_4.leadingDateField]=_2[_4.leadingDateField];_9[_4.trailingDateField]=_2[_4.trailingDateField]}else{_9[_4.startDateField]=_2[_4.startDateField];_9[_4.endDateField]=_2[_4.endDateField]}
_9.laneName=_8[_4.laneNameField];if(_2[_4.laneNameField]==_8[_4.laneNameField]&&this.eventsOverlap(_9,_8,(_4.canEditLane==true))){_6.add(_8)}}
return _6},isc.A.updateOverlapRanges=function isc_TimelineView_updateOverlapRanges(_1){var _2=this.creator,_3=_1||_2.data,_4=this.overlapRanges=[],_5=_3.getLength();_3.setProperty("$122k",false);_3.setProperty("$646",null);for(var i=0;i<_5;i++){var _7=_3.get(i);if(_7.$122k)continue;_7.$122k=true;var _8={};_8[_2.startDateField]=_7[_2.startDateField];_8[_2.endDateField]=_7[_2.endDateField];_8.laneName=_8.lane=_7[this.laneNameField];_8.events=[];var _9=this.findOverlappingEvents(_7,_7,true);if(_9&&_9.length>0){_8.totalSlots=_9.length;var _10=_8.totalSlots;var _11=1;for(var j=0;j<_9.length;j++){var _13=_9[j];if(_13[_2.startDateField]<_8[_2.startDateField])
_8[_2.startDateField]=_13[_2.startDateField];if(_13[_2.endDateField]>_8[_2.endDateField])
_8[_2.endDateField]=_13[_2.endDateField];var _14=_13!=_7?this.findOverlappingEvents(_13,_13,true):[];if(_14&&_14.length>0){var _15=[];_14.map(function(_20){if(_20.$646)_15.add(_20.$646.totalSlots)});if(_15.max()!=_10){_10=Math.min(_15.max(),_10);_11++}}
var _16=_11;if(!_13.$646){_13.$122k=true;_13.$646={slotNum:_16,totalSlots:_11}}else{_13.$646.totalSlots=Math.max(_11,_13.$646.totalSlots);_13.$122l=true}}
_8.totalSlots=_11;_9.map(function(_20){if(_20.$122l)delete _20.$122l;else _20.$646.totalSlots=_11});_7.$646.totalSlots=_8.totalSlots;_8.events=_9;var _17=true;for(var k=0;k<_4.length;k++){if(_8.laneName!=_4[k].laneName)continue;var _19=this.eventsOverlap(_8,_4[k],true);if(_19){if(_8[_2.startDateField]<_4[k][_2.startDateField])
_4[k][_2.startDateField]=_8[_2.startDateField];if(_8[_2.endDateField]>_4[k][_2.endDateField])
_4[k][_2.endDateField]=_8[_2.endDateField];if(_8.totalSlots>_4[k].totalSlots){_4[k].totalSlots=_8.totalSlots;_7.$646.totalSlots=_8.totalSlots;_7.$646.slotCount=_8.totalSlots-_7.$646.slotNum}
_17=false;_4[k].events.addList(_9);_4[k].events=_4[k].events.getUniqueItems()}}}
if(_17)_4.add(_8)}
this.overlapRanges=_4;return _4},isc.A.forceDataSort=function isc_TimelineView_forceDataSort(_1){var _2=this.creator,_3=[{property:_2.laneNameField,direction:"ascending"}];if(_2.overlapSortSpecifiers){_3.addList(_2.overlapSortSpecifiers)}else{_3.add({property:_2.startDateField,direction:"ascending"})}
if(!_1){_1=_2.data;_2.$53e=true}
_1.setSort(_3)},isc.A.refreshVisibleEvents=function isc_TimelineView_refreshVisibleEvents(){this.forceDataSort();var _1=this.getVisibleEvents();var _2=_1.getLength();this.logDebug('refreshing visible events','calendar');for(var i=0;i<_2;i++){var _4=_1.get(i);if(_4.$646)_4.$646.visited=false;this.addEvent(_4,i)}
this.clearEvents(_2);var _5=this.creator;if(_5.eventsRendered&&isc.isA.Function(_5.eventsRendered))
_5.eventsRendered()},isc.A.tagDataForOverlap=function isc_TimelineView_tagDataForOverlap(_1,_2){if(_1.getLength()==0)return;var _3=this,_4=this.creator,_5=[],_6=0,_7=0,_8=0;var _9=[{property:_4.laneNameField,direction:"ascending"}];if(_4.overlapSortSpecifiers){_9.addList(_4.overlapSortSpecifiers)}else{_9.add({property:_4.startDateField,direction:"ascending"})}
this.forceDataSort();if(_4.eventAutoArrange==false)return;var _10=_1.get(0),_11=_10[_4.laneNameField];var _12=0,_13=[];if(_2){while(_12<_1.getLength()&&_1.get(_12)[_4.laneNameField]!=_2){_12++}}
_1.setProperty("$646",null);var _14=this.updateOverlapRanges();for(var j=0;j<_14.length;j++){var _16=_14[j];var _17=_16.events;_17.setSort(_9);var _18=[];var _19=1;for(var i=_12;i<_17.getLength();i++){var _21=_17.get(i);_21.$646={};var _22=1;if(_18.length>0){var _23=[];for(var k=0;k<_18.length;k++){var _25=_18[k],r=isc.addProperties({},_21,{laneName:_2});if(this.eventsOverlap(r,_25)){if(_25.$646.slotNum>=_22){_22=_25.$646.slotNum+1}
if(_25.$646.slotCount==null){_23.add(_25)}}}
if(_23.length){for(var k=0;k<_23.length;k++){var _27=_23[k];_27.$646.slotCount=_22-_27.$646.slotNum}}}
_21.$646.slotNum=_22;if(_22>_19)_19=_22;_18.add(_21)}
_17.map(function(_28){if(!_28.$646.slotCount){_28.$646.slotCount=(_19-_28.$646.slotNum)+1}
_28.$646.totalSlots=_19})}
return _13});isc.evalBoundary;isc.B.push(isc.A.nextAvailSlot=function isc_TimelineView_nextAvailSlot(_1,_2){var _3=[];for(var i=0;i<_2;i++){_3.add(false)}
for(var i=0;i<_1.length;i++){var _5=_1[i];if(!_5.$646)continue;if(_5.$646.slotNum)_3[_5.$646.slotNum-1]=true}
var _6=_3.indexOf(false)+1;return _6},isc.A.eventsOverlap=function isc_TimelineView_eventsOverlap(_1,_2,_3){var a=_1,b=_2;if(_3&&a.laneName!=b[this.creator.laneNameField])return false;var _6,_7,_8=this.creator;if(a[_8.leadingDateField]&&b[_8.leadingDateField])_6=_8.leadingDateField;else _6=_8.startDateField;if(a[_8.trailingDateField]&&b[_8.trailingDateField])_7=_8.trailingDateField;else _7=_8.endDateField;var _9=a[_6],_10=a[_7],_11=b[_6],_12=b[_7];if(_8.equalDatesOverlap&&_8.allowEventOverlap){if((_9<_11&&_10>=_11&&_10<=_12)||(_9<=_12&&_10>_12)||(_9<=_11&&_10>=_12)||(_9>=_11&&_10<=_12)){return true}else{return false}}else{if((_9<_11&&_10>_11&&_10<_12)||(_9<_12&&_10>_12)||(_9<=_11&&_10>=_12)||(_9>=_11&&_10<=_12)){return true}else{return false}}},isc.A.compareDates=function isc_TimelineView_compareDates(_1,_2,_3){if(_1.getFullYear()<_2.getFullYear()){return 1}else if(_1.getFullYear()>_2.getFullYear()){return-1}
if(_1.getMonth()<_2.getMonth()){return 1}else if(_1.getMonth()>_2.getMonth()){return-1}
if(_1.getDate()<_2.getDate()){return 1}else if(_1.getDate()>_2.getDate()){return-1}
return 0},isc.A.getDateFromPoint=function isc_TimelineView_getDateFromPoint(_1,_2,_3){var _4=this.startDate.duplicate();var _5=this.columnWidth;var _6=this.$731();var _7=0;if(_3){_1-=_1%this.creator.eventSnapGap}
_7+=Math.floor(_1/_5)*_6;if(!_2)_7+=((_1%_5)/_5)*_6;_4.setMinutes(_4.getMinutes()+_7);return _4},isc.A.$731=function isc_TimelineView__getMinsInACell(){var _1=this.creator.timelineUnitsPerColumn;var _2=this.creator.timelineGranularity;var _3=24*60;var _4;var _5=0;if(_2=="month"){_4=_1*(_3*30)}else if(_2=="week"){_4=_1*(_3*7)}else if(_2=="day"){_4=_1*_3}else if(_2=="hour"){_4=_1*60}else if(_2=="minute"){_4=_1}
return _4},isc.A.$732=function isc_TimelineView__getEventBreadth(_1){var _2=this.$731(),_3=_1.event,_4=this.creator,_5,_6;if(Array.isLoading(_3))return null;if(_3[_4.startDateField].getTime()<this.startDate.getTime()){_5=this.startDate.duplicate()}else{_5=_3[_4.startDateField]}
if(_3[_4.endDateField].getTime()>this.endDate.getTime()){_6=this.endDate.duplicate();_6.setMinutes(_6.getMinutes()+_2)}else{_6=_3[_4.endDateField].duplicate()}
var _7=_1.getEventLength(_5,_6);var _8=this.columnWidth;var _9=0;var _10=Math.floor(_7/_2);if(_4.sizeEventsToGrid){var _11=this.getTimelineEventColNum(_3);if(_11){var _12=this.getField(_11),_13=_12.date?_12.date.getTime()==_3[_4.startDateField].getTime():false,r=_7%_2;if(r!=0||!_13)_10+=1}}
var _15=Math.max(0,this.getEventStartCol(_3)+1);if(_15+_10+1>this.fields.length)_10--;_9+=Math.max(0,_10)*_8;if(_4.sizeEventsToGrid==false){var _16=Math.floor(((_7%_2)/_2)*_8)
_9+=_16}
return _9},isc.A.getEventStartCol=function isc_TimelineView_getEventStartCol(_1){var _2=(_1[this.creator.startDateField].getTime()-this.startDate.getTime())/(1000*60);_2=Math.round(_2);var _3=this.$731();return Math.floor(_2/_3)},isc.A.getDateLeftOffset=function isc_TimelineView_getDateLeftOffset(_1){var _2=(_1.getTime()-this.startDate.getTime())/(1000*60);_2=Math.round(_2);var _3=this.columnWidth;var _4=this.$731();var _5=0;_5+=Math.floor(_2/_4)*_3;if(this.creator.sizeEventsToGrid==false){_5+=Math.round(((_2%_4)/_4)*_3)}
if(_5<0)_5=0;return _5},isc.A.getEventLeft=function isc_TimelineView_getEventLeft(_1){return this.getDateLeftOffset(_1[this.creator.startDateField])},isc.A.getLaneHeight=function isc_TimelineView_getLaneHeight(_1){if(isc.isA.Number(_1))_1=this.getRecord(_1);return _1&&_1.height||this.cellHeight},isc.A.getEventLaneIndex=function isc_TimelineView_getEventLaneIndex(_1){var _2=this.data.findIndex("name",_1[this.laneNameField]);if(_2<0)_2=this.data.findIndex(this.laneNameField,_1[this.laneNameField]);return _2},isc.A.sizeEventWindow=function isc_TimelineView_sizeEventWindow(_1,_2){var _3=this.creator,_4=_1.event;var _5=this.data.findIndex("name",_4[this.laneNameField]);if(_5<0)_5=this.data.findIndex(this.laneNameField,_4[this.laneNameField]);var _6=this.getLaneHeight(_5);var _7=this.columnWidth;if(Array.isLoading(_4))return;_7=this.$732(_1);var _8=this.getEventLeft(_4);var _9=_3.getEventTitle(_4),_10="";if(_4.headerBackgroundColor)_10+="backgroundColor: "+_4.headerBackgroundColor+";";if(_4.headerTextColor)_10+="backgroundColor: "+_4.headerTextColor+";";if(_10!="")_9="<span style='"+_10+"'>"+_9+"<span>"
_1.setTitle(_9);if(_2)_1.hide();else _1.updateColors();var _11=this.getRowTop(_5);if(this.timelineEventPadding>0){_11+=this.timelineEventPadding;_8+=this.timelineEventPadding;_7-=(this.timelineEventPadding*2);_6-=(this.timelineEventPadding*2)}
if(_3.eventsOverlapGridLines){if(_8>0)_8-=1;_7+=1;_11-=1;_6+=1}
if(this.eventDragGap>0){_7-=this.eventDragGap}
if(_3.showEventDescriptions!=false){_1.setDescriptionText(_4[_3.descriptionField])}
this.adjustDimensionsForOverlap(_1,_8,_11,_7,_6);if(_2)_1.show();if(_4[_3.leadingDateField]&&_4[_3.trailingDateField]){if(_1.$645)this.addLeadingAndTrailingLines(_1);else this.delayCall("addLeadingAndTrailingLines",[_1])}},isc.A.adjustDimensionsForOverlap=function isc_TimelineView_adjustDimensionsForOverlap(_1,_2,_3,_4,_5){var _6=_1.event.$646;if(_6&&_6.totalSlots>0){var _7=Math.floor(_5/_6.totalSlots);_5=_7;if(_6.slotCount)_5*=_6.slotCount;if(_6.totalSlots>1){_5-=Math.floor(this.timelineEventPadding/(_6.totalSlots))}
_3=_3+Math.floor((_7*(_6.slotNum-1)));if(_6.slotNum>1)_3+=(this.timelineEventPadding*(_6.slotNum-1));if(_6.totalSlots>1&&this.creator.eventsOverlapGridLines)_5+=1}
_1.resizeTo(_4,_5);if(_1.$77n)_1.header.resizeTo(_4,_5);var _8=_1.moveTo(_2,_3)},isc.A.addLeadingAndTrailingLines=function isc_TimelineView_addLeadingAndTrailingLines(_1){var _2,_3,_4,_5;if(_1.$645){_2=_1.$645[0];_3=_1.$645[1];_4=_1.$645[2];_5=_1.$645[3]}else{_2=this.$65r();_3=this.$65s(_1,"lead");_4=this.$65r();_5=this.$65s(_1,"trail")}
var _6=this.$65t(_3,_2);var _7=this.$65t(_5,_4);if(!_1.$645){this.body.addChild(_2);this.body.addChild(_3);this.body.addChild(_4);this.body.addChild(_5);_1.$645=[_2,_3,_4,_5]}},isc.A.$65t=function isc_TimelineView__positionIcon(_1,_2){var _3=this.creator,_4=_1.$65e,_5=_4.event,_6=_1.type,_7=this.columnWidth,_8=_4.getVisibleHeight(),_9=_4.getTop(),_10=_4.getLeft();var _11,_12,_13=true;if(_6=="trail"){if(this.compareDates(_5[_3.trailingDateField],this.endDate)<0){_11=_3.getDayDiff(this.endDate,_5[_3.startDateField]);if(_11<1)_11=1;_12=_11*_7;_13=false}else{_11=_3.getDayDiff(_5[_3.trailingDateField],_5[_3.startDateField]);_12=(_11*_7)-(Math.round(_7/2))}}else{if(this.compareDates(this.startDate,_5[_3.leadingDateField])<0){_11=_3.getDayDiff(this.startDate,_5[_3.startDateField]);if(_11<1)_11=1;_12=_11*_7;_13=false}else{_11=_3.getDayDiff(_5[_3.leadingDateField],_5[_3.startDateField]);_12=(_11*_7)-(Math.round(_7/2))}}
var _14=(_6=="trail"?_10+_7:_10-_12);_2.moveTo(_14,_9+(Math.round(_8/2)));_2.setWidth(_12);var _15=0;if(_5.$646&&_5.$646.slotNum>0){_15=(_5.$646.slotNum-1)*_8}
var _16=(_6=="trail"?this.trailIconSize:this.leadIconSize);var _17;if(_13==false)_17=-50;else if(_6=="trail")_17=_10+_7+_12-Math.round(_16/2);else _17=_10-_12-Math.round(_16/2);_1.moveTo(_17,_9+Math.round(_8/2)-Math.round(_16/2));_1.$647=Math.round(_8/2)-Math.round(_16/2)+_15;_1.$648=Math.round(_7/2)-Math.round(_16/2),_1.$65f=_3.getDayDiff(_5[_3.startDateField],this.startDate);return _13},isc.A.$65s=function isc_TimelineView__makeIcon(_1,_2){var _3=(_2=="trail"?this.trailIconSize:this.leadIconSize);var _4=isc.Img.create({$65e:_1,type:_2,autoDraw:false,_redrawWithParent:false,src:(_2=="trail"?this.trailingEndPointImage:this.leadingEndPointImage),width:_3,height:_3,canDragReposition:(this.creator.canEditEvents==true),dragRepositionStart:function(){this.$8l=this.parentElement.getEventRow();this.$644=this.parentElement.getEventColumn();this.parentElement.VSnapOrigin=this.$647;this.parentElement.HSnapOrigin=this.$648},dragRepositionStop:function(){var _5=this.$65f,_6=this.$644,_7=this.parentElement.getEventColumn(),_8=_7-_6,_9=this.$65e.event,_10=this.$65e.calendar,_11=this.type=="trail"?_7-_5:_5-_7;if(_11<1)return false;var _12={};var _13=this.type=="trail"?_10.trailingDateField:_10.leadingDateField;var _14=_9[_13].duplicate();_14.setDate(_14.getDate()+_8);_12[_13]=_14;_10.updateEvent(_9,_9[_10.startDateField],_9[_10.endDateField],_9[_10.nameField],_9[_10.descriptionField],_12,true);return true}});return _4},isc.A.$65r=function isc_TimelineView__makeLine(){var _1=isc.Canvas.create({autoDraw:false,_redrawWithParent:false,height:2,overflow:"hidden",styleName:"eventLine"});return _1},isc.A.clearEvents=function isc_TimelineView_clearEvents(_1){if(!this.body||!this.body.children||!this.$65u)return;if(!_1)_1=0;for(var i=_1;i<this.$65u.length;i++){this.$65u[i].hide()}},isc.A.addEvent=function isc_TimelineView_addEvent(_1,_2){if(!this.$65u)this.$65u=[];var _3=false,_4=this.creator,_5=_4.canEditEvent(_1),_6=(_4.canDragEvents==true&&_1[_4.canDragEventField]!=false),_7;if(this.renderEventsOnDemand&&this.$65u[_2]){_7=this.$65u[_2];_4.setEventWindowID(_1,_7.ID);_7.event=_1;_7.VSnapOrigin=0;_3=true;_7.setStyleName(_1[_4.eventWindowStyleField]||_4.eventWindowStyle);_7.baseStyle=_1[_4.eventWindowStyleField]||_4.eventWindowStyle;if(_7.body){_7.bodyStyle=_7.baseStyle+"Body";_7.body.setStyleName(_7.bodyStyle)}
if(_7.header){var _8="Header";if(isc.isA.Label(_7.header))_8="Body";_7.headerStyle=_7.baseStyle+_8;_7.header.setStyleName(_7.headerStyle);var _9=_7.header.getMember?_7.header.getMember(0):null;if(_9)_9.setStyleName(_7.headerStyle);if(_7.headerLabel)_7.headerLabel.setStyleName(_7.headerStyle)}
_7.canDragReposition=_6&&_5;_7.canDragResize=_4.canResizeTimelineEvents&&_5}else{var _7=this.getNewEventWindow(_1);_7.$643=this;this.$65u.add(_7)}
this.sizeEventWindow(_7,_3);if(this.body&&(!_3||_7.parentElement!=this.body)){this.body.addChild(_7)}
if(!_7.isDrawn())_7.draw();if(_7.body)_7.body.show();_7.show();_7.setCanDragReposition(_4.canDragEvents,this.timelineDragTarget)},isc.A.removeEvent=function isc_TimelineView_removeEvent(_1){var _2=this.body.children;for(var i=0;i<_2.length;i++){if(isc.isAn.EventWindow(_2[i])&&_2[i].event===_1){var _4=_2[i];_4.parentElement.removeChild(_4);_4.destroy();return true}}
return false},isc.A.getNewEventWindow=function isc_TimelineView_getNewEventWindow(_1){var _2=this.creator,_3=_1[_2.eventWindowStyleField]||_2.eventWindowStyle,_4=isc.addProperties({},this.bodyProperties,{backgroundColor:_1.backgroundColor,textColor:_1.textColor,styleName:_3+"Body"}),_5=isc.addProperties({dragTarget:this.timelineDragTarget},this.headerProperties,{backgroundColor:_1.headerBackgroundColor,textColor:_1.headerTextColor,styleName:_3+"Header"}),_6=true;if(_2.showEventDescriptions==false){_6=false}
var _7=(_2.canDragEvents==true&&_1[_2.canDragEventField]!=false),_8=_2.canEditEvent(_1);if(_6)_5.headerHeight=14;var _9={calendar:_2,_redrawWithParent:false,styleName:_3,baseStyle:_3,canDragReposition:_7&&_8,canDragResize:_2.canResizeTimelineEvents&&_8,edgeMarginSize:10,showCloseButton:false,event:_1,descriptionText:_1[_2.descriptionField]||"",showHeader:_6,showBody:_6,dragTarget:this.timelineDragTarget,backgroundColor:_1.backgroundColor,textColor:_1.textColor,headerProperties:_5,bodyProperties:_4,headerStyle:_3+"Header",bodyStyle:_3+"Body"}
if(_1.backgroundColor){_9.backgroundColor=_1.backgroundColor}
var _10=isc.TimelineWindow.create(_9);if(!_6){var _11=isc.Label.create({autoDraw:false,styleName:_3,border:"0px",padding:3,height:"100%",width:"100%",backgroundColor:_1.backgroundColor,textColor:_1.textColor,setContents:function(_12){this.$116k=_12;this.Super("setContents",arguments)},canHover:true,showHover:true,eventWin:_10,getHoverHTML:function(){return _10.getHoverHTML()}});_10.addChild(_11);_10.header=_11;_10.$77n=true;_10.updateColors()}
_2.setEventWindowID(_1,_10.ID);return _10},isc.A.updateEventWindow=function isc_TimelineView_updateEventWindow(_1){if(!this.body||!this.body.children)return;var _2=this.creator,_3=_1[_2.laneNameField];var _4=this.tagDataForOverlap(_2.data.getRange(0,_2.data.getLength()),_3);if(this.renderEventsOnDemand){this.refreshVisibleEvents()}else{for(var i=0;i<_4.length;i++){var _1=_4.get(i),_6=_2.getEventWindowID(_1),_7=window[_6];if(_1.$646)_1.$646.visited=false;_7.event=_1;this.sizeEventWindow(_7)}}},isc.A.areSame=function isc_TimelineView_areSame(_1,_2){var _3=this.creator;if(_3.dataSource){var _4=_3.$53s,_5=true;for(var _6 in _4){if(_1[_6]!=_2[_6]){_5=false;break}}
return _5}else{return(_1===_2)}},isc.A.resized=function isc_TimelineView_resized(){this.Super('resized',arguments);if(this.isDrawn()&&this.creator.hasData()&&this.renderEventsOnDemand){this.refreshVisibleEvents()}},isc.A.scrolled=function isc_TimelineView_scrolled(){if(this.renderEventsOnDemand){if(this.$57s)isc.Timer.clear(this.$57s);this.$57s=isc.Timer.setTimeout(this.ID+".refreshVisibleEvents()")}},isc.A.getVisibleDateRange=function isc_TimelineView_getVisibleDateRange(){if(!this.renderEventsOnDemand){return[this.startDate.duplicate(),this.endDate.duplicate()]}
var _1=this.body.getScrollLeft();var _2=_1+this.body.getVisibleWidth();var _3=this.getDateFromPoint(_1,true);var _4=this.getDateFromPoint(_2);return[_3,_4]},isc.A.getVisibleRowRange=function isc_TimelineView_getVisibleRowRange(){if(!this.renderEventsOnDemand){return[0,this.data.getLength()]}
return this.getVisibleRows()});isc.B._maxIndex=isc.C+72;isc.Calendar.registerStringMethods({getDayBodyHTML:"date,events,calendar,rowNum,colNum",getDayHeaderHTML:"date,events,calendar,rowNum,colNum",dayBodyClick:"date,events,calendar,rowNum,colNum",dayHeaderClick:"date,events,calendar,rowNum,colNum",eventClick:"event,viewName",eventChanged:"event",eventMoved:"newDate,event",eventResized:"newDate,event",backgroundClick:"startDate,endDate",backgroundMouseDown:"startDate",backgroundMouseUp:"startDate,endDate"});isc.A=isc.DaySchedule;isc.A.$53o=[{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""},{label:"",day1:"",day2:"",day3:"",day4:"",day5:"",day6:"",day7:""}];isc.AutoTest.customizeCalendar();isc.ClassFactory.defineClass("Timeline","Calendar");isc.A=isc.Timeline.getPrototype();isc.A.showTimelineView=true;isc.A.showDayView=false;isc.A.showWeekView=false;isc.A.showMonthView=false;isc.A.showControlBar=false;isc.A.labelColumnWidth=75;isc.A.sizeEventsToGrid=false;isc.A.eventDragGap=0;isc._nonDebugModules=(isc._nonDebugModules!=null?isc._nonDebugModules:[]);isc._nonDebugModules.push('Calendar');isc.checkForDebugAndNonDebugModules();isc._moduleEnd=isc._Calendar_end=(isc.timestamp?isc.timestamp():new Date().getTime());if(isc.Log&&isc.Log.logIsInfoEnabled('loadTime'))isc.Log.logInfo('Calendar module init time: '+(isc._moduleEnd-isc._moduleStart)+'ms','loadTime');delete isc.definingFramework;}else{if(window.isc&&isc.Log&&isc.Log.logWarn)isc.Log.logWarn("Duplicate load of module 'Calendar'.");}
/*
 * Isomorphic SmartClient
 * Version v9.0p_2021-05-01 (2021-05-01)
 * Copyright(c) 1998 and beyond Isomorphic Software, Inc. All rights reserved.
 * "SmartClient" is a trademark of Isomorphic Software, Inc.
 *
 * licensing@smartclient.com
 *
 * http://smartclient.com/license
 */

