"use strict";var ScheduleList=[],SCHEDULE_CATEGORY=["milestone","task"];function ScheduleInfo(){this.id=null,this.calendarId=null,this.title=null,this.body=null,this.isAllday=!1,this.start=null,this.end=null,this.category="",this.dueDateClass="",this.color=null,this.bgColor=null,this.dragBgColor=null,this.borderColor=null,this.customStyle="",this.isFocused=!1,this.isPending=!1,this.isVisible=!0,this.isReadOnly=!1,this.goingDuration=0,this.comingDuration=0,this.recurrenceRule="",this.raw={memo:"",hasToOrCc:!1,hasRecurrenceRule:!1,location:null,class:"public",creator:{name:"",avatar:"",company:"",email:"",phone:""}}}function generateTime(e,a,n){var o=moment(a.getTime()),i=moment(n.getTime()),t=i.diff(o,"days");e.isAllday=chance.bool({likelihood:30}),e.isAllday?e.category="allday":chance.bool({likelihood:30})?(e.category=SCHEDULE_CATEGORY[chance.integer({min:0,max:1})],e.category===SCHEDULE_CATEGORY[1]&&(e.dueDateClass="morning")):e.category="time",o.add(chance.integer({min:0,max:t}),"days"),o.hours(chance.integer({min:0,max:23})),o.minutes(chance.bool()?0:30),e.start=o.toDate(),i=moment(o),e.isAllday&&i.add(chance.integer({min:0,max:3}),"days"),e.end=i.add(chance.integer({min:1,max:4}),"hour").toDate(),!e.isAllday&&chance.bool({likelihood:20})&&(e.goingDuration=chance.integer({min:30,max:120}),e.comingDuration=chance.integer({min:30,max:120}),chance.bool({likelihood:50})&&(e.end=e.start))}function generateNames(){for(var e=[],a=0,n=chance.integer({min:1,max:10});a<n;a+=1)e.push(chance.name({nationality:"en"}));return e}function generateRandomSchedule(e,a,n){var o=new ScheduleInfo;if(o.id=chance.guid(),o.calendarId=e.id,o.title=chance.name({nationalty:"en"}),o.body=chance.bool({likelihood:20})?chance.sentence({words:10}):"",o.isReadOnly=chance.bool({likelihood:20}),generateTime(o,a,n),o.isPrivate=chance.bool({likelihood:10}),o.location=chance.address(),o.attendees=chance.bool({likelihood:70})?generateNames():[],o.recurrenceRule=chance.bool({likelihood:20})?"repeated events":"",o.color=e.color,o.bgColor=e.bgColor,o.dragBgColor=e.dragBgColor,o.borderColor=e.borderColor,"milestone"===o.category&&(o.color=o.bgColor,o.bgColor="transparent",o.dragBgColor="transparent",o.borderColor="transparent"),o.raw.memo=chance.sentence(),o.raw.creator.name=chance.name(),o.raw.creator.avatar=chance.avatar(),o.raw.creator.company=chance.company(),o.raw.creator.email=chance.email(),o.raw.creator.phone=chance.phone(),chance.bool({likelihood:20})){var i=chance.minute();o.goingDuration=i,o.comingDuration=i}ScheduleList.push(o)}function generateSchedule(o,i,t){ScheduleList=[],CalendarList.forEach(function(e){var a=0,n=1;for("month"===o?n=1:"day"===o&&(n=2);a<n;a+=1)generateRandomSchedule(e,i,t)})}