forked from GRA0007/modern-cal-embed
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ical.min.js
2 lines (2 loc) · 79.5 KB
/
ical.min.js
1
2
"object"==typeof module?ICAL=module.exports:"object"!=typeof ICAL&&(this.ICAL={}),ICAL.foldLength=75,ICAL.newLineChar="\r\n",ICAL.helpers={updateTimezones:function(t){var e,r,n,i,a,s;if(!t||"vcalendar"!==t.name)return t;for(e=t.getAllSubcomponents(),r=[],n={},a=0;a<e.length;a++)"vtimezone"===e[a].name?n[s=e[a].getFirstProperty("tzid").getFirstValue()]=e[a]:r=r.concat(e[a].getAllProperties());for(i={},a=0;a<r.length;a++)(s=r[a].getParameter("tzid"))&&(i[s]=!0);for(a in n)n.hasOwnProperty(a)&&!i[a]&&t.removeSubcomponent(n[a]);for(a in i)i.hasOwnProperty(a)&&!n[a]&&ICAL.TimezoneService.has(a)&&t.addSubcomponent(ICAL.TimezoneService.get(a).component);return t},isStrictlyNaN:function(t){return"number"==typeof t&&isNaN(t)},strictParseInt:function(t){var e=parseInt(t,10);if(ICAL.helpers.isStrictlyNaN(e))throw new Error('Could not extract integer from "'+t+'"');return e},formatClassType:function(t,e){if(void 0!==t)return t instanceof e?t:new e(t)},unescapedIndexOf:function(t,e,r){for(;-1!==(r=t.indexOf(e,r));){if(!(0<r&&"\\"===t[r-1]))return r;r+=1}return-1},binsearchInsert:function(t,e,r){if(!t.length)return 0;for(var n,i,a=0,s=t.length-1;a<=s;)if((i=r(e,t[n=a+Math.floor((s-a)/2)]))<0)s=n-1;else{if(!(0<i))break;a=n+1}return i<0?n:0<i?n+1:n},dumpn:function(){ICAL.debug&&("undefined"!=typeof console&&"log"in console?ICAL.helpers.dumpn=function(t){console.log(t)}:ICAL.helpers.dumpn=function(t){dump(t+"\n")},ICAL.helpers.dumpn(arguments[0]))},clone:function(t,e){if(t&&"object"==typeof t){if(t instanceof Date)return new Date(t.getTime());if("clone"in t)return t.clone();if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)r.push(e?ICAL.helpers.clone(t[n],!0):t[n]);return r}var i={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(i[a]=e?ICAL.helpers.clone(t[a],!0):t[a]);return i}return t},foldline:function(t){for(var e="",r=t||"";r.length;)e+=ICAL.newLineChar+" "+r.substr(0,ICAL.foldLength),r=r.substr(ICAL.foldLength);return e.substr(ICAL.newLineChar.length+1)},pad2:function(t){switch("string"!=typeof t&&("number"==typeof t&&(t=parseInt(t)),t=String(t)),t.length){case 0:return"00";case 1:return"0"+t;default:return t}},trunc:function(t){return t<0?Math.ceil(t):Math.floor(t)},inherits:function(t,e,r){function n(){}n.prototype=t.prototype,e.prototype=new n,r&&ICAL.helpers.extend(r,e.prototype)},extend:function(t,e){for(var r in t){var n=Object.getOwnPropertyDescriptor(t,r);n&&!Object.getOwnPropertyDescriptor(e,r)&&Object.defineProperty(e,r,n)}return e}},ICAL.design=function(){"use strict";var t=/\\\\|\\,|\\[Nn]/g,e=/\\|,|\n/g;function r(r,n){return{matches:/.*/,fromICAL:function(t,e){return function(t,e,r){if(-1===t.indexOf("\\"))return t;r&&(e=new RegExp(e.source+"|\\\\"+r));return t.replace(e,f)}(t,r,e)},toICAL:function(t,e){var r=n;return e&&(r=new RegExp(r.source+"|"+e)),t.replace(r,function(t){switch(t){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case"\n":return"\\n";default:return t}})}}}var n={defaultType:"text"},i={defaultType:"text",multiValue:","},a={defaultType:"text",structuredValue:";"},s={defaultType:"integer"},o={defaultType:"date-time",allowedTypes:["date-time","date"]},u={defaultType:"date-time"},h={defaultType:"uri"},c={defaultType:"utc-offset"},l={defaultType:"recur"},d={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function f(t){switch(t){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return"\n";default:return t}}var m={categories:i,url:h,version:n,uid:n},p={boolean:{values:["TRUE","FALSE"],fromICAL:function(t){switch(t){case"TRUE":return!0;case"FALSE":default:return!1}},toICAL:function(t){return t?"TRUE":"FALSE"}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(t){var e=parseFloat(t);return ICAL.helpers.isStrictlyNaN(e)?0:e},toICAL:function(t){return String(t)}},integer:{fromICAL:function(t){var e=parseInt(t);return ICAL.helpers.isStrictlyNaN(e)?0:e},toICAL:function(t){return String(t)}},"utc-offset":{toICAL:function(t){return t.length<7?t.substr(0,3)+t.substr(4,2):t.substr(0,3)+t.substr(4,2)+t.substr(7,2)},fromICAL:function(t){return t.length<6?t.substr(0,3)+":"+t.substr(3,2):t.substr(0,3)+":"+t.substr(3,2)+":"+t.substr(5,2)},decorate:function(t){return ICAL.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}},y=ICAL.helpers.extend(p,{text:r(/\\\\|\\;|\\,|\\[Nn]/g,/\\|;|,|\n/g),uri:{},binary:{decorate:function(t){return ICAL.Binary.fromString(t)},undecorate:function(t){return t.toString()}},"cal-address":{},date:{decorate:function(t,e){return D.strict?ICAL.Time.fromDateString(t,e):ICAL.Time.fromString(t,e)},undecorate:function(t){return t.toString()},fromICAL:function(t){return!D.strict&&15<=t.length?y["date-time"].fromICAL(t):t.substr(0,4)+"-"+t.substr(4,2)+"-"+t.substr(6,2)},toICAL:function(t){var e=t.length;return 10==e?t.substr(0,4)+t.substr(5,2)+t.substr(8,2):19<=e?y["date-time"].toICAL(t):t}},"date-time":{fromICAL:function(t){if(D.strict||8!=t.length){var e=t.substr(0,4)+"-"+t.substr(4,2)+"-"+t.substr(6,2)+"T"+t.substr(9,2)+":"+t.substr(11,2)+":"+t.substr(13,2);return t[15]&&"Z"===t[15]&&(e+="Z"),e}return y.date.fromICAL(t)},toICAL:function(t){var e=t.length;if(10!=e||D.strict){if(19<=e){var r=t.substr(0,4)+t.substr(5,2)+t.substr(8,5)+t.substr(14,2)+t.substr(17,2);return t[19]&&"Z"===t[19]&&(r+="Z"),r}return t}return y.date.toICAL(t)},decorate:function(t,e){return D.strict?ICAL.Time.fromDateTimeString(t,e):ICAL.Time.fromString(t,e)},undecorate:function(t){return t.toString()}},duration:{decorate:function(t){return ICAL.Duration.fromString(t)},undecorate:function(t){return t.toString()}},period:{fromICAL:function(t){var e=t.split("/");return e[0]=y["date-time"].fromICAL(e[0]),ICAL.Duration.isValueString(e[1])||(e[1]=y["date-time"].fromICAL(e[1])),e},toICAL:function(t){return D.strict||10!=t[0].length?t[0]=y["date-time"].toICAL(t[0]):t[0]=y.date.toICAL(t[0]),ICAL.Duration.isValueString(t[1])||(D.strict||10!=t[1].length?t[1]=y["date-time"].toICAL(t[1]):t[1]=y.date.toICAL(t[1])),t.join("/")},decorate:function(t,e){return ICAL.Period.fromJSON(t,e,!D.strict)},undecorate:function(t){return t.toJSON()}},recur:{fromICAL:function(t){return ICAL.Recur._stringToData(t,!0)},toICAL:function(t){var e="";for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){var n=t[r];"until"==r?n=10<n.length?y["date-time"].toICAL(n):y.date.toICAL(n):"wkst"==r?"number"==typeof n&&(n=ICAL.Recur.numericDayToIcalDay(n)):Array.isArray(n)&&(n=n.join(",")),e+=r.toUpperCase()+"="+n+";"}return e.substr(0,e.length-1)},decorate:function(t){return ICAL.Recur.fromData(t)},undecorate:function(t){return t.toJSON()}},time:{fromICAL:function(t){if(t.length<6)return t;var e=t.substr(0,2)+":"+t.substr(2,2)+":"+t.substr(4,2);return"Z"===t[6]&&(e+="Z"),e},toICAL:function(t){if(t.length<8)return t;var e=t.substr(0,2)+t.substr(3,2)+t.substr(6,2);return"Z"===t[8]&&(e+="Z"),e}}}),A=ICAL.helpers.extend(m,{action:n,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:n,class:n,comment:n,completed:u,contact:n,created:u,description:n,dtend:o,dtstamp:u,dtstart:o,due:o,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:l,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":u,location:n,method:n,organizer:{defaultType:"cal-address"},"percent-complete":s,priority:s,prodid:n,"related-to":n,repeat:s,rdate:{defaultType:"date-time",allowedTypes:["date-time","date","period"],multiValue:",",detectType:function(t){return-1!==t.indexOf("/")?"period":-1===t.indexOf("T")?"date":"date-time"}},"recurrence-id":o,resources:i,"request-status":a,rrule:l,sequence:s,status:n,summary:n,transp:n,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:c,tzoffsetto:c,tzurl:h,tzid:n,tzname:n}),C=ICAL.helpers.extend(p,{text:r(t,e),uri:r(t,e),date:{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString(t,"date")},undecorate:function(t){return t.toString()},fromICAL:function(t){return 8==t.length?y.date.fromICAL(t):"-"==t[0]&&6==t.length?t.substr(0,4)+"-"+t.substr(4):t},toICAL:function(t){return 10==t.length?y.date.toICAL(t):"-"==t[0]&&7==t.length?t.substr(0,4)+t.substr(5):t}},time:{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString("T"+t,"time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=C.time._splitZone(t,!0),r=e[0],n=e[1];return 6==n.length?n=n.substr(0,2)+":"+n.substr(2,2)+":"+n.substr(4,2):4==n.length&&"-"!=n[0]?n=n.substr(0,2)+":"+n.substr(2,2):5==n.length&&(n=n.substr(0,3)+":"+n.substr(3,2)),5!=r.length||"-"!=r[0]&&"+"!=r[0]||(r=r.substr(0,3)+":"+r.substr(3)),n+r},toICAL:function(t){var e=C.time._splitZone(t),r=e[0],n=e[1];return 8==n.length?n=n.substr(0,2)+n.substr(3,2)+n.substr(6,2):5==n.length&&"-"!=n[0]?n=n.substr(0,2)+n.substr(3,2):6==n.length&&(n=n.substr(0,3)+n.substr(4,2)),6!=r.length||"-"!=r[0]&&"+"!=r[0]||(r=r.substr(0,3)+r.substr(4)),n+r},_splitZone:function(t,e){var r,n,i=t.length-1,a=t.length-(e?5:6),s=t[a];return n="Z"==t[i]?(r=t[i],t.substr(0,i)):6<t.length&&("-"==s||"+"==s)?(r=t.substr(a),t.substr(0,a)):(r="",t),[r,n]}},"date-time":{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString(t,"date-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){return C["date-and-or-time"].fromICAL(t)},toICAL:function(t){return C["date-and-or-time"].toICAL(t)}},"date-and-or-time":{decorate:function(t){return ICAL.VCardTime.fromDateAndOrTimeString(t,"date-and-or-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=t.split("T");return(e[0]?C.date.fromICAL(e[0]):"")+(e[1]?"T"+C.time.fromICAL(e[1]):"")},toICAL:function(t){var e=t.split("T");return C.date.toICAL(e[0])+(e[1]?"T"+C.time.toICAL(e[1]):"")}},timestamp:y["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/}}),I=ICAL.helpers.extend(m,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:d,bday:d,caladruri:h,caluri:h,clientpidmap:a,email:n,fburl:h,fn:n,gender:a,geo:h,impp:h,key:h,kind:n,lang:{defaultType:"language-tag"},logo:h,member:h,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:i,note:n,org:{defaultType:"text",structuredValue:";"},photo:h,related:h,rev:{defaultType:"timestamp"},role:n,sound:h,source:h,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:n,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:n}),T=ICAL.helpers.extend(p,{binary:y.binary,date:C.date,"date-time":C["date-time"],"phone-number":{},uri:y.uri,text:y.text,time:y.time,vcard:y.text,"utc-offset":{toICAL:function(t){return t.substr(0,7)},fromICAL:function(t){return t.substr(0,7)},decorate:function(t){return ICAL.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}}),L=ICAL.helpers.extend(m,{fn:n,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:i,photo:{defaultType:"binary",allowedTypes:["binary","uri"]},bday:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},adr:{defaultType:"text",structuredValue:";",multiValue:","},label:n,tel:{defaultType:"phone-number"},email:n,mailer:n,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:n,role:n,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:a,note:i,prodid:n,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},"sort-string":n,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:n,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),_={value:y,param:{cutype:{values:["INDIVIDUAL","GROUP","RESOURCE","ROOM","UNKNOWN"],allowXName:!0,allowIanaToken:!0},"delegated-from":{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},"delegated-to":{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},encoding:{values:["8BIT","BASE64"]},fbtype:{values:["FREE","BUSY","BUSY-UNAVAILABLE","BUSY-TENTATIVE"],allowXName:!0,allowIanaToken:!0},member:{valueType:"cal-address",multiValue:",",multiValueSeparateDQuote:!0},partstat:{values:["NEEDS-ACTION","ACCEPTED","DECLINED","TENTATIVE","DELEGATED","COMPLETED","IN-PROCESS"],allowXName:!0,allowIanaToken:!0},range:{values:["THISLANDFUTURE"]},related:{values:["START","END"]},reltype:{values:["PARENT","CHILD","SIBLING"],allowXName:!0,allowIanaToken:!0},role:{values:["REQ-PARTICIPANT","CHAIR","OPT-PARTICIPANT","NON-PARTICIPANT"],allowXName:!0,allowIanaToken:!0},rsvp:{values:["TRUE","FALSE"]},"sent-by":{valueType:"cal-address"},tzid:{matches:/^\//},value:{values:["binary","boolean","cal-address","date","date-time","duration","float","integer","period","recur","text","time","uri","utc-offset"],allowXName:!0,allowIanaToken:!0}},property:A},v={value:C,param:{type:{valueType:"text",multiValue:","},value:{values:["text","uri","date","time","date-time","date-and-or-time","timestamp","boolean","integer","float","utc-offset","language-tag"],allowXName:!0,allowIanaToken:!0}},property:I},g={value:T,param:{type:{valueType:"text",multiValue:","},value:{values:["text","uri","date","date-time","phone-number","time","boolean","integer","float","utc-offset","vcard","binary"],allowXName:!0,allowIanaToken:!0}},property:L},D={strict:!0,defaultSet:_,defaultType:"unknown",components:{vcard:v,vcard3:g,vevent:_,vtodo:_,vjournal:_,valarm:_,vtimezone:_,daylight:_,standard:_},icalendar:_,vcard:v,vcard3:g,getDesignSet:function(t){return t&&t in D.components?D.components[t]:D.defaultSet}};return D}(),ICAL.stringify=function(){"use strict";var l="\r\n",m="unknown",p=ICAL.design,e=ICAL.helpers;function y(t){"string"==typeof t[0]&&(t=[t]);for(var e=0,r=t.length,n="";e<r;e++)n+=y.component(t[e])+l;return n}y.component=function(t,e){var r=t[0].toUpperCase(),n="BEGIN:"+r+l,i=t[1],a=0,s=i.length,o=t[0];for("vcard"===o&&0<t[1].length&&("version"!==t[1][0][0]||"4.0"!==t[1][0][3])&&(o="vcard3"),e=e||p.getDesignSet(o);a<s;a++)n+=y.property(i[a],e)+l;for(var u=t[2]||[],h=0,c=u.length;h<c;h++)n+=y.component(u[h],e)+l;return n+="END:"+r},y.property=function(t,e,r){var n,i=t[0].toUpperCase(),a=t[0],s=t[1],o=i;for(n in s){var u=s[n];if(s.hasOwnProperty(n))u=(l=n in e.param&&e.param[n].multiValue)&&Array.isArray(u)?(e.param[n].multiValueSeparateDQuote&&(l='"'+l+'"'),u=u.map(y._rfc6868Unescape),y.multiValue(u,l,"unknown",null,e)):y._rfc6868Unescape(u),o+=";"+n.toUpperCase(),o+="="+y.propertyValue(u)}if(3===t.length)return o+":";var h,c=t[2],l=!1,d=!1,f=!1;return a in(e=e||p.defaultSet).property?("multiValue"in(h=e.property[a])&&(l=h.multiValue),"structuredValue"in h&&Array.isArray(t[3])&&(d=h.structuredValue),"defaultType"in h?c===h.defaultType&&(f=!0):c===m&&(f=!0)):c===m&&(f=!0),f||(o+=";VALUE="+c.toUpperCase()),o+=":",o+=l&&d?y.multiValue(t[3],d,c,l,e,d):l?y.multiValue(t.slice(3),l,c,null,e,!1):d?y.multiValue(t[3],d,c,null,e,d):y.value(t[3],c,e,!1),r?o:ICAL.helpers.foldline(o)},y.propertyValue=function(t){return-1===e.unescapedIndexOf(t,",")&&-1===e.unescapedIndexOf(t,":")&&-1===e.unescapedIndexOf(t,";")?t:'"'+t+'"'},y.multiValue=function(t,e,r,n,i,a){for(var s="",o=t.length,u=0;u<o;u++)n&&Array.isArray(t[u])?s+=y.multiValue(t[u],n,r,null,i,a):s+=y.value(t[u],r,i,a),u!==o-1&&(s+=e);return s},y.value=function(t,e,r,n){return e in r.value&&"toICAL"in r.value[e]?r.value[e].toICAL(t,n):t},y._rfc6868Unescape=function(t){return t.replace(/[\n^"]/g,function(t){return r[t]})};var r={'"':"^'","\n":"^n","^":"^^"};return y}(),ICAL.parse=function(){"use strict";var u=/[^ \t]/,y=ICAL.design,A=ICAL.helpers;function C(t){this.message=t,this.name="ParserError";try{throw new Error}catch(t){if(t.stack){var e=t.stack.split("\n");e.shift(),this.stack=e.join("\n")}}}function I(t){var r={},e=r.component=[];if(r.stack=[e],I._eachLine(t,function(t,e){I._handleContentLine(e,r)}),1<r.stack.length)throw new C("invalid ical body. component began but did not end");return r=null,1==e.length?e[0]:e}C.prototype=Error.prototype,I.property=function(t,e){var r={component:[[],[]],designSet:e||y.defaultSet};return I._handleContentLine(t,r),r.component[1][0]},I.component=function(t){return I(t)},I.ParserError=C,I._handleContentLine=function(t,e){var r,n,i,a,s,o,u=t.indexOf(":"),h=t.indexOf(";"),c={};if(-1!==h&&-1!==u&&u<h&&(h=-1),-1!==h){if(i=t.substring(0,h).toLowerCase(),-1==(s=I._parseParameters(t.substring(h),0,e.designSet))[2])throw new C("Invalid parameters in '"+t+"'");if(c=s[0],r=s[1].length+s[2]+h,-1===(n=t.substring(r).indexOf(":")))throw new C("Missing parameter value in '"+t+"'");a=t.substring(r+n+1)}else{if(-1===u)throw new C('invalid line (no token ";" or ":") "'+t+'"');if(i=t.substring(0,u).toLowerCase(),a=t.substring(u+1),"begin"===i){var l=[a.toLowerCase(),[],[]];return 1===e.stack.length?e.component.push(l):e.component[2].push(l),e.stack.push(e.component),e.component=l,void(e.designSet||(e.designSet=y.getDesignSet(e.component[0])))}if("end"===i)return void(e.component=e.stack.pop())}var d,f,m=!1,p=!1;i in e.designSet.property&&("multiValue"in(d=e.designSet.property[i])&&(m=d.multiValue),"structuredValue"in d&&(p=d.structuredValue),a&&"detectType"in d&&(o=d.detectType(a))),o=o||("value"in c?c.value.toLowerCase():d?d.defaultType:"unknown"),delete c.value,m&&p?f=[i,c,o,a=I._parseMultiValue(a,p,o,[],m,e.designSet,p)]:m?I._parseMultiValue(a,m,o,f=[i,c,o],null,e.designSet,!1):f=p?[i,c,o,a=I._parseMultiValue(a,p,o,[],null,e.designSet,p)]:[i,c,o,a=I._parseValue(a,o,e.designSet,!1)],"vcard"!==e.component[0]||0!==e.component[1].length||"version"===i&&"4.0"===a||(e.designSet=y.getDesignSet("vcard3")),e.component[1].push(f)},I._parseValue=function(t,e,r,n){return e in r.value&&"fromICAL"in r.value[e]?r.value[e].fromICAL(t,n):t},I._parseParameters=function(t,e,r){for(var n,i,a,s,o,u,h=e,c=0,l={},d=-1;!1!==c&&-1!==(c=A.unescapedIndexOf(t,"=",c+1));){if(0==(n=t.substr(h+1,c-h-1)).length)throw new C("Empty parameter name in '"+t+"'");if(o=u=!1,s=(i=n.toLowerCase())in r.param&&r.param[i].valueType?r.param[i].valueType:"text",i in r.param&&(o=r.param[i].multiValue,r.param[i].multiValueSeparateDQuote&&(u=I._rfc6868Escape('"'+o+'"'))),'"'===t[c+1]){if(d=c+2,c=A.unescapedIndexOf(t,'"',d),o&&-1!=c)for(var f=!0;f;)t[c+1]==o&&'"'==t[c+2]?c=A.unescapedIndexOf(t,'"',c+3):f=!1;if(-1===c)throw new C('invalid line (no matching double quote) "'+t+'"');a=t.substr(d,c-d),-1===(h=A.unescapedIndexOf(t,";",c))&&(c=!1)}else{d=c+1;var m=A.unescapedIndexOf(t,";",d),p=A.unescapedIndexOf(t,":",d);c=-1!==p&&p<m?(m=p,!1):-1===m?(m=-1===p?t.length:p,!1):h=m,a=t.substr(d,m-d)}if(a=I._rfc6868Escape(a),o)a=I._parseMultiValue(a,u||o,s,[],null,r);else a=I._parseValue(a,s,r);o&&i in l?Array.isArray(l[i])?l[i].push(a):l[i]=[l[i],a]:l[i]=a}return[l,a,d]},I._rfc6868Escape=function(t){return t.replace(/\^['n^]/g,function(t){return e[t]})};var e={"^'":'"',"^n":"\n","^^":"^"};return I._parseMultiValue=function(t,e,r,n,i,a,s){var o,u=0,h=0;if(0===e.length)return t;for(;-1!==(u=A.unescapedIndexOf(t,e,h));)o=t.substr(h,u-h),o=i?I._parseMultiValue(o,i,r,[],null,a,s):I._parseValue(o,r,a,s),n.push(o),h=u+e.length;return o=t.substr(h),o=i?I._parseMultiValue(o,i,r,[],null,a,s):I._parseValue(o,r,a,s),n.push(o),1==n.length?n[0]:n},I._eachLine=function(t,e){for(var r,n,i,a=t.length,s=t.search(u),o=s;i=1<(o=t.indexOf("\n",s)+1)&&"\r"===t[o-2]?2:1,0===o&&(o=a,i=0)," "===(n=t[s])||"\t"===n?r+=t.substr(s+1,o-s-(i+1)):(r&&e(null,r),r=t.substr(s,o-s-i)),(s=o)!==a;);(r=r.trim()).length&&e(null,r)},I}(),ICAL.Component=function(){"use strict";function r(t,e){"string"==typeof t&&(t=[t,[],[]]),this.jCal=t,this.parent=e||null}return r.prototype={_hydratedPropertyCount:0,_hydratedComponentCount:0,get name(){return this.jCal[0]},get _designSet(){return this.parent&&this.parent._designSet||ICAL.design.getDesignSet(this.name)},_hydrateComponent:function(t){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[t])return this._components[t];var e=new r(this.jCal[2][t],this);return this._hydratedComponentCount++,this._components[t]=e},_hydrateProperty:function(t){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[t])return this._properties[t];var e=new ICAL.Property(this.jCal[1][t],this);return this._hydratedPropertyCount++,this._properties[t]=e},getFirstSubcomponent:function(t){if(t)for(var e=0,r=this.jCal[2],n=r.length;e<n;e++){if(r[e][0]===t)return this._hydrateComponent(e)}else if(this.jCal[2].length)return this._hydrateComponent(0);return null},getAllSubcomponents:function(t){var e=this.jCal[2].length,r=0;if(t){for(var n=this.jCal[2],i=[];r<e;r++)t===n[r][0]&&i.push(this._hydrateComponent(r));return i}if(!this._components||this._hydratedComponentCount!==e)for(;r<e;r++)this._hydrateComponent(r);return this._components||[]},hasProperty:function(t){for(var e=this.jCal[1],r=e.length,n=0;n<r;n++)if(e[n][0]===t)return!0;return!1},getFirstProperty:function(t){if(t)for(var e=0,r=this.jCal[1],n=r.length;e<n;e++){if(r[e][0]===t)return this._hydrateProperty(e)}else if(this.jCal[1].length)return this._hydrateProperty(0);return null},getFirstPropertyValue:function(t){var e=this.getFirstProperty(t);return e?e.getFirstValue():null},getAllProperties:function(t){var e=this.jCal[1].length,r=0;if(t){for(var n=this.jCal[1],i=[];r<e;r++)t===n[r][0]&&i.push(this._hydrateProperty(r));return i}if(!this._properties||this._hydratedPropertyCount!==e)for(;r<e;r++)this._hydrateProperty(r);return this._properties||[]},_removeObjectByIndex:function(t,e,r){if((e=e||[])[r]){var n=e[r];"parent"in n&&(n.parent=null)}e.splice(r,1),this.jCal[t].splice(r,1)},_removeObject:function(t,e,r){var n=0,i=this.jCal[t],a=i.length,s=this[e];if("string"==typeof r){for(;n<a;n++)if(i[n][0]===r)return this._removeObjectByIndex(t,s,n),!0}else if(s)for(;n<a;n++)if(s[n]&&s[n]===r)return this._removeObjectByIndex(t,s,n),!0;return!1},_removeAllObjects:function(t,e,r){for(var n=this[e],i=this.jCal[t],a=i.length-1;0<=a;a--)r&&i[a][0]!==r||this._removeObjectByIndex(t,n,a)},addSubcomponent:function(t){this._components||(this._components=[],this._hydratedComponentCount=0),t.parent&&t.parent.removeSubcomponent(t);var e=this.jCal[2].push(t.jCal);return this._components[e-1]=t,this._hydratedComponentCount++,t.parent=this,t},removeSubcomponent:function(t){var e=this._removeObject(2,"_components",t);return e&&this._hydratedComponentCount--,e},removeAllSubcomponents:function(t){var e=this._removeAllObjects(2,"_components",t);return this._hydratedComponentCount=0,e},addProperty:function(t){if(!(t instanceof ICAL.Property))throw new TypeError("must instance of ICAL.Property");this._properties||(this._properties=[],this._hydratedPropertyCount=0),t.parent&&t.parent.removeProperty(t);var e=this.jCal[1].push(t.jCal);return this._properties[e-1]=t,this._hydratedPropertyCount++,t.parent=this,t},addPropertyWithValue:function(t,e){var r=new ICAL.Property(t);return r.setValue(e),this.addProperty(r),r},updatePropertyWithValue:function(t,e){var r=this.getFirstProperty(t);return r?r.setValue(e):r=this.addPropertyWithValue(t,e),r},removeProperty:function(t){var e=this._removeObject(1,"_properties",t);return e&&this._hydratedPropertyCount--,e},removeAllProperties:function(t){var e=this._removeAllObjects(1,"_properties",t);return this._hydratedPropertyCount=0,e},toJSON:function(){return this.jCal},toString:function(){return ICAL.stringify.component(this.jCal,this._designSet)}},r.fromString=function(t){return new r(ICAL.parse.component(t))},r}(),ICAL.Property=function(){"use strict";var n=ICAL.design;function r(t,e){this._parent=e||null,"string"==typeof t?(this.jCal=[t,{},n.defaultType],this.jCal[2]=this.getDefaultType()):this.jCal=t,this._updateType()}return r.prototype={get type(){return this.jCal[2]},get name(){return this.jCal[0]},get parent(){return this._parent},set parent(t){var e=!this._parent||t&&t._designSet!=this._parent._designSet;return this._parent=t,this.type==n.defaultType&&e&&(this.jCal[2]=this.getDefaultType(),this._updateType()),t},get _designSet(){return this.parent?this.parent._designSet:n.defaultSet},_updateType:function(){var t=this._designSet;if(this.type in t.value){t.value[this.type];"decorate"in t.value[this.type]?this.isDecorated=!0:this.isDecorated=!1,this.name in t.property&&(this.isMultiValue="multiValue"in t.property[this.name],this.isStructuredValue="structuredValue"in t.property[this.name])}},_hydrateValue:function(t){return this._values&&this._values[t]?this._values[t]:this.jCal.length<=3+t?null:this.isDecorated?(this._values||(this._values=[]),this._values[t]=this._decorate(this.jCal[3+t])):this.jCal[3+t]},_decorate:function(t){return this._designSet.value[this.type].decorate(t,this)},_undecorate:function(t){return this._designSet.value[this.type].undecorate(t,this)},_setDecoratedValue:function(t,e){this._values||(this._values=[]),"object"==typeof t&&"icaltype"in t?(this.jCal[3+e]=this._undecorate(t),this._values[e]=t):(this.jCal[3+e]=t,this._values[e]=this._decorate(t))},getParameter:function(t){return t in this.jCal[1]?this.jCal[1][t]:void 0},getFirstParameter:function(t){var e=this.getParameter(t);return Array.isArray(e)?e[0]:e},setParameter:function(t,e){var r=t.toLowerCase();"string"==typeof e&&r in this._designSet.param&&"multiValue"in this._designSet.param[r]&&(e=[e]),this.jCal[1][t]=e},removeParameter:function(t){delete this.jCal[1][t]},getDefaultType:function(){var t=this.jCal[0],e=this._designSet;if(t in e.property){var r=e.property[t];if("defaultType"in r)return r.defaultType}return n.defaultType},resetType:function(t){this.removeAllValues(),this.jCal[2]=t,this._updateType()},getFirstValue:function(){return this._hydrateValue(0)},getValues:function(){var t=this.jCal.length-3;if(t<1)return[];for(var e=0,r=[];e<t;e++)r[e]=this._hydrateValue(e);return r},removeAllValues:function(){this._values&&(this._values.length=0),this.jCal.length=3},setValues:function(t){if(!this.isMultiValue)throw new Error(this.name+": does not not support mulitValue.\noverride isMultiValue");var e=t.length,r=0;if(this.removeAllValues(),0<e&&"object"==typeof t[0]&&"icaltype"in t[0]&&this.resetType(t[0].icaltype),this.isDecorated)for(;r<e;r++)this._setDecoratedValue(t[r],r);else for(;r<e;r++)this.jCal[3+r]=t[r]},setValue:function(t){this.removeAllValues(),"object"==typeof t&&"icaltype"in t&&this.resetType(t.icaltype),this.isDecorated?this._setDecoratedValue(t,0):this.jCal[3]=t},toJSON:function(){return this.jCal},toICALString:function(){return ICAL.stringify.property(this.jCal,this._designSet,!0)}},r.fromString=function(t,e){return new r(ICAL.parse.property(t,e))},r}(),ICAL.UtcOffset=function(){function r(t){this.fromData(t)}return r.prototype={hours:0,minutes:0,factor:1,icaltype:"utc-offset",clone:function(){return ICAL.UtcOffset.fromSeconds(this.toSeconds())},fromData:function(t){if(t)for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);this._normalize()},fromSeconds:function(t){var e=Math.abs(t);return this.factor=t<0?-1:1,this.hours=ICAL.helpers.trunc(e/3600),e-=3600*this.hours,this.minutes=ICAL.helpers.trunc(e/60),this},toSeconds:function(){return this.factor*(60*this.minutes+3600*this.hours)},compare:function(t){var e=this.toSeconds(),r=t.toSeconds();return(r<e)-(e<r)},_normalize:function(){for(var t=this.toSeconds(),e=this.factor;t<-43200;)t+=97200;for(;50400<t;)t-=97200;this.fromSeconds(t),0==t&&(this.factor=e)},toICALString:function(){return ICAL.design.icalendar.value["utc-offset"].toICAL(this.toString())},toString:function(){return(1==this.factor?"+":"-")+ICAL.helpers.pad2(this.hours)+":"+ICAL.helpers.pad2(this.minutes)}},r.fromString=function(t){var e={};return e.factor="+"===t[0]?1:-1,e.hours=ICAL.helpers.strictParseInt(t.substr(1,2)),e.minutes=ICAL.helpers.strictParseInt(t.substr(4,2)),new ICAL.UtcOffset(e)},r.fromSeconds=function(t){var e=new r;return e.fromSeconds(t),e},r}(),ICAL.Binary=function(){function e(t){this.value=t}return e.prototype={icaltype:"binary",decodeValue:function(){return this._b64_decode(this.value)},setEncodedValue:function(t){this.value=this._b64_encode(t)},_b64_encode:function(t){var e,r,n,i,a,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,u=0,h="",c=[];if(!t)return t;for(;e=(a=t.charCodeAt(o++)<<16|t.charCodeAt(o++)<<8|t.charCodeAt(o++))>>18&63,r=a>>12&63,n=a>>6&63,i=63&a,c[u++]=s.charAt(e)+s.charAt(r)+s.charAt(n)+s.charAt(i),o<t.length;);h=c.join("");var l=t.length%3;return(l?h.slice(0,l-3):h)+"===".slice(l||3)},_b64_decode:function(t){var e,r,n,i,a,s,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,h=0,c=[];if(!t)return t;for(t+="";e=(s=o.indexOf(t.charAt(u++))<<18|o.indexOf(t.charAt(u++))<<12|(i=o.indexOf(t.charAt(u++)))<<6|(a=o.indexOf(t.charAt(u++))))>>16&255,r=s>>8&255,n=255&s,c[h++]=64==i?String.fromCharCode(e):64==a?String.fromCharCode(e,r):String.fromCharCode(e,r,n),u<t.length;);return c.join("")},toString:function(){return this.value}},e.fromString=function(t){return new e(t)},e}(),ICAL.Period=function(t){if(this.wrappedJSObject=this,t&&"start"in t){if(t.start&&!(t.start instanceof ICAL.Time))throw new TypeError(".start must be an instance of ICAL.Time");this.start=t.start}if(t&&t.end&&t.duration)throw new Error("cannot accept both end and duration");if(t&&"end"in t){if(t.end&&!(t.end instanceof ICAL.Time))throw new TypeError(".end must be an instance of ICAL.Time");this.end=t.end}if(t&&"duration"in t){if(t.duration&&!(t.duration instanceof ICAL.Duration))throw new TypeError(".duration must be an instance of ICAL.Duration");this.duration=t.duration}},ICAL.Period.prototype={start:null,end:null,duration:null,icalclass:"icalperiod",icaltype:"period",clone:function(){return ICAL.Period.fromData({start:this.start?this.start.clone():null,end:this.end?this.end.clone():null,duration:this.duration?this.duration.clone():null})},getDuration:function(){return this.duration?this.duration:this.end.subtractDate(this.start)},getEnd:function(){if(this.end)return this.end;var t=this.start.clone();return t.addDuration(this.duration),t},toString:function(){return this.start+"/"+(this.end||this.duration)},toJSON:function(){return[this.start.toString(),(this.end||this.duration).toString()]},toICALString:function(){return this.start.toICALString()+"/"+(this.end||this.duration).toICALString()}},ICAL.Period.fromString=function(t,e){var r=t.split("/");if(2!==r.length)throw new Error('Invalid string value: "'+t+'" must contain a "/" char.');var n={start:ICAL.Time.fromDateTimeString(r[0],e)},i=r[1];return ICAL.Duration.isValueString(i)?n.duration=ICAL.Duration.fromString(i):n.end=ICAL.Time.fromDateTimeString(i,e),new ICAL.Period(n)},ICAL.Period.fromData=function(t){return new ICAL.Period(t)},ICAL.Period.fromJSON=function(t,e,r){function n(t,e){return r?ICAL.Time.fromString(t,e):ICAL.Time.fromDateTimeString(t,e)}return ICAL.Duration.isValueString(t[1])?ICAL.Period.fromData({start:n(t[0],e),duration:ICAL.Duration.fromString(t[1])}):ICAL.Period.fromData({start:n(t[0],e),end:n(t[1],e)})},function(){var s=/([PDWHMTS]{1,1})/;function o(t,e,r){var n;switch(t){case"P":r.isNegative=!(!e||"-"!==e);break;case"D":n="days";break;case"W":n="weeks";break;case"H":n="hours";break;case"M":n="minutes";break;case"S":n="seconds";break;default:return 0}if(n){if(!e&&0!==e)throw new Error('invalid duration value: Missing number before "'+t+'"');var i=parseInt(e,10);if(ICAL.helpers.isStrictlyNaN(i))throw new Error('invalid duration value: Invalid number "'+e+'" before "'+t+'"');r[n]=i}return 1}ICAL.Duration=function(t){(this.wrappedJSObject=this).fromData(t)},ICAL.Duration.prototype={weeks:0,days:0,hours:0,minutes:0,seconds:0,isNegative:!1,icalclass:"icalduration",icaltype:"duration",clone:function(){return ICAL.Duration.fromData(this)},toSeconds:function(){var t=this.seconds+60*this.minutes+3600*this.hours+86400*this.days+604800*this.weeks;return this.isNegative?-t:t},fromSeconds:function(t){var e=Math.abs(t);return this.isNegative=t<0,this.days=ICAL.helpers.trunc(e/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,e-=86400*(this.days+7*this.weeks),this.hours=ICAL.helpers.trunc(e/3600),e-=3600*this.hours,this.minutes=ICAL.helpers.trunc(e/60),e-=60*this.minutes,this.seconds=e,this},fromData:function(t){var e=["weeks","days","hours","minutes","seconds","isNegative"];for(var r in e)if(e.hasOwnProperty(r)){var n=e[r];this[n]=t&&n in t?t[n]:0}},reset:function(){this.isNegative=!1,this.weeks=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0},compare:function(t){var e=this.toSeconds(),r=t.toSeconds();return(r<e)-(e<r)},normalize:function(){this.fromSeconds(this.toSeconds())},toString:function(){if(0==this.toSeconds())return"PT0S";var t="";return this.isNegative&&(t+="-"),t+="P",this.weeks&&(t+=this.weeks+"W"),this.days&&(t+=this.days+"D"),(this.hours||this.minutes||this.seconds)&&(t+="T",this.hours&&(t+=this.hours+"H"),this.minutes&&(t+=this.minutes+"M"),this.seconds&&(t+=this.seconds+"S")),t},toICALString:function(){return this.toString()}},ICAL.Duration.fromSeconds=function(t){return(new ICAL.Duration).fromSeconds(t)},ICAL.Duration.isValueString=function(t){return"P"===t[0]||"P"===t[1]},ICAL.Duration.fromString=function(t){for(var e=0,r=Object.create(null),n=0;-1!==(e=t.search(s));){var i=t[e],a=t.substr(0,e);t=t.substr(e+1),n+=o(i,a,r)}if(n<2)throw new Error('invalid duration value: Not enough duration components in "'+t+'"');return new ICAL.Duration(r)},ICAL.Duration.fromData=function(t){return new ICAL.Duration(t)}}(),function(){var i=["tzid","location","tznames","latitude","longitude"];ICAL.Timezone=function(t){(this.wrappedJSObject=this).fromData(t)},ICAL.Timezone.prototype={tzid:"",location:"",tznames:"",latitude:0,longitude:0,component:null,expandedUntilYear:0,icalclass:"icaltimezone",fromData:function(t){if(this.expandedUntilYear=0,this.changes=[],t instanceof ICAL.Component)this.component=t;else{if(t&&"component"in t)if("string"==typeof t.component){var e=ICAL.parse(t.component);this.component=new ICAL.Component(e)}else t.component instanceof ICAL.Component?this.component=t.component:this.component=null;for(var r in i)if(i.hasOwnProperty(r)){var n=i[r];t&&n in t&&(this[n]=t[n])}}return this.component instanceof ICAL.Component&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this},utcOffset:function(t){if(this==ICAL.Timezone.utcTimezone||this==ICAL.Timezone.localTimezone)return 0;if(this._ensureCoverage(t.year),!this.changes.length)return 0;for(var e={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},r=this._findNearbyChange(e),n=-1,i=1;;){var a=ICAL.helpers.clone(this.changes[r],!0);if(a.utcOffset<a.prevUtcOffset?ICAL.Timezone.adjust_change(a,0,0,0,a.utcOffset):ICAL.Timezone.adjust_change(a,0,0,0,a.prevUtcOffset),0<=ICAL.Timezone._compare_change_fn(e,a)?n=r:i=-1,-1==i&&-1!=n)break;if((r+=i)<0)return 0;if(r>=this.changes.length)break}var s=this.changes[n];if(s.utcOffset-s.prevUtcOffset<0&&0<n){var o=ICAL.helpers.clone(s,!0);if(ICAL.Timezone.adjust_change(o,0,0,0,o.prevUtcOffset),ICAL.Timezone._compare_change_fn(e,o)<0){var u=this.changes[n-1];0!=s.is_daylight&&0==u.is_daylight&&(s=u)}}return s.utcOffset},_findNearbyChange:function(t){var e=ICAL.helpers.binsearchInsert(this.changes,t,ICAL.Timezone._compare_change_fn);return e>=this.changes.length?this.changes.length-1:e},_ensureCoverage:function(t){if(-1==ICAL.Timezone._minimumExpansionYear){var e=ICAL.Time.now();ICAL.Timezone._minimumExpansionYear=e.year}var r=t;if(r<ICAL.Timezone._minimumExpansionYear&&(r=ICAL.Timezone._minimumExpansionYear),(r+=ICAL.Timezone.EXTRA_COVERAGE)>ICAL.Timezone.MAX_YEAR&&(r=ICAL.Timezone.MAX_YEAR),!this.changes.length||this.expandedUntilYear<t){for(var n=this.component.getAllSubcomponents(),i=n.length,a=0;a<i;a++)this._expandComponent(n[a],r,this.changes);this.changes.sort(ICAL.Timezone._compare_change_fn),this.expandedUntilYear=r}},_expandComponent:function(e,t,r){if(!e.hasProperty("dtstart")||!e.hasProperty("tzoffsetto")||!e.hasProperty("tzoffsetfrom"))return null;var n,i=e.getFirstProperty("dtstart").getFirstValue();function a(t){return t.factor*(3600*t.hours+60*t.minutes)}function s(){var t={};return t.is_daylight="daylight"==e.name,t.utcOffset=a(e.getFirstProperty("tzoffsetto").getFirstValue()),t.prevUtcOffset=a(e.getFirstProperty("tzoffsetfrom").getFirstValue()),t}if(e.hasProperty("rrule")||e.hasProperty("rdate")){var o=e.getAllProperties("rdate");for(var u in o)if(o.hasOwnProperty(u)){var h=o[u].getFirstValue();(n=s()).year=h.year,n.month=h.month,n.day=h.day,h.isDate?(n.hour=i.hour,n.minute=i.minute,n.second=i.second,i.zone!=ICAL.Timezone.utcTimezone&&ICAL.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset)):(n.hour=h.hour,n.minute=h.minute,n.second=h.second,h.zone!=ICAL.Timezone.utcTimezone&&ICAL.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset)),r.push(n)}var c=e.getFirstProperty("rrule");if(c){c=c.getFirstValue(),n=s(),c.until&&c.until.zone==ICAL.Timezone.utcTimezone&&(c.until.adjust(0,0,0,n.prevUtcOffset),c.until.zone=ICAL.Timezone.localTimezone);for(var l,d=c.iterator(i);(l=d.next())&&(n=s(),!(l.year>t)&&l);)n.year=l.year,n.month=l.month,n.day=l.day,n.hour=l.hour,n.minute=l.minute,n.second=l.second,n.isDate=l.isDate,ICAL.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset),r.push(n)}}else(n=s()).year=i.year,n.month=i.month,n.day=i.day,n.hour=i.hour,n.minute=i.minute,n.second=i.second,ICAL.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset),r.push(n);return r},toString:function(){return this.tznames?this.tznames:this.tzid}},ICAL.Timezone._compare_change_fn=function(t,e){return t.year<e.year?-1:t.year>e.year?1:t.month<e.month?-1:t.month>e.month?1:t.day<e.day?-1:t.day>e.day?1:t.hour<e.hour?-1:t.hour>e.hour?1:t.minute<e.minute?-1:t.minute>e.minute?1:t.second<e.second?-1:t.second>e.second?1:0},ICAL.Timezone.convert_time=function(t,e,r){if(t.isDate||e.tzid==r.tzid||e==ICAL.Timezone.localTimezone||r==ICAL.Timezone.localTimezone)return t.zone=r,t;var n=e.utcOffset(t);return t.adjust(0,0,0,-n),n=r.utcOffset(t),t.adjust(0,0,0,n),null},ICAL.Timezone.fromData=function(t){return(new ICAL.Timezone).fromData(t)},ICAL.Timezone.utcTimezone=ICAL.Timezone.fromData({tzid:"UTC"}),ICAL.Timezone.localTimezone=ICAL.Timezone.fromData({tzid:"floating"}),ICAL.Timezone.adjust_change=function(t,e,r,n,i){return ICAL.Time.prototype.adjust.call(t,e,r,n,i,t)},ICAL.Timezone._minimumExpansionYear=-1,ICAL.Timezone.MAX_YEAR=2035,ICAL.Timezone.EXTRA_COVERAGE=5}(),ICAL.TimezoneService=function(){var r,t={get count(){return Object.keys(r).length},reset:function(){r=Object.create(null);var t=ICAL.Timezone.utcTimezone;r.Z=t,r.UTC=t,r.GMT=t},has:function(t){return!!r[t]},get:function(t){return r[t]},register:function(t,e){if(t instanceof ICAL.Component&&"vtimezone"===t.name&&(t=(e=new ICAL.Timezone(t)).tzid),!(e instanceof ICAL.Timezone))throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component");r[t]=e},remove:function(t){return delete r[t]}};return t.reset(),t}(),function(){function t(e){Object.defineProperty(ICAL.Time.prototype,e,{get:function(){return this._pendingNormalization&&(this._normalize(),this._pendingNormalization=!1),this._time[e]},set:function(t){return"isDate"===e&&t&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[e]=t}})}ICAL.Time=function(t,e){var r=(this.wrappedJSObject=this)._time=Object.create(null);r.year=0,r.month=1,r.day=1,r.hour=0,r.minute=0,r.second=0,r.isDate=!1,this.fromData(t,e)},ICAL.Time._dowCache={},ICAL.Time._wnCache={},ICAL.Time.prototype={icalclass:"icaltime",_cachedUnixTime:null,get icaltype(){return this.isDate?"date":"date-time"},zone:null,_pendingNormalization:!1,clone:function(){return new ICAL.Time(this._time,this.zone)},reset:function(){this.fromData(ICAL.Time.epochTime),this.zone=ICAL.Timezone.utcTimezone},resetTo:function(t,e,r,n,i,a,s){this.fromData({year:t,month:e,day:r,hour:n,minute:i,second:a,zone:s})},fromJSDate:function(t,e){return t?e?(this.zone=ICAL.Timezone.utcTimezone,this.year=t.getUTCFullYear(),this.month=t.getUTCMonth()+1,this.day=t.getUTCDate(),this.hour=t.getUTCHours(),this.minute=t.getUTCMinutes(),this.second=t.getUTCSeconds()):(this.zone=ICAL.Timezone.localTimezone,this.year=t.getFullYear(),this.month=t.getMonth()+1,this.day=t.getDate(),this.hour=t.getHours(),this.minute=t.getMinutes(),this.second=t.getSeconds()):this.reset(),this._cachedUnixTime=null,this},fromData:function(t,e){if(t)for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if("icaltype"===r)continue;this[r]=t[r]}if(e&&(this.zone=e),!t||"isDate"in t?t&&"isDate"in t&&(this.isDate=t.isDate):this.isDate=!("hour"in t),t&&"timezone"in t){var n=ICAL.TimezoneService.get(t.timezone);this.zone=n||ICAL.Timezone.localTimezone}return t&&"zone"in t&&(this.zone=t.zone),this.zone||(this.zone=ICAL.Timezone.localTimezone),this._cachedUnixTime=null,this},dayOfWeek:function(t){var e=t||ICAL.Time.SUNDAY,r=(this.year<<12)+(this.month<<8)+(this.day<<3)+e;if(r in ICAL.Time._dowCache)return ICAL.Time._dowCache[r];var n=this.day,i=this.month+(this.month<3?12:0),a=this.year-(this.month<3?1:0),s=n+a+ICAL.helpers.trunc(26*(i+1)/10)+ICAL.helpers.trunc(a/4);return s=((s+=6*ICAL.helpers.trunc(a/100)+ICAL.helpers.trunc(a/400))+7-e)%7+1,ICAL.Time._dowCache[r]=s},dayOfYear:function(){var t=ICAL.Time.isLeapYear(this.year)?1:0;return ICAL.Time.daysInYearPassedMonth[t][this.month-1]+this.day},startOfWeek:function(t){var e=t||ICAL.Time.SUNDAY,r=this.clone();return r.day-=(this.dayOfWeek()+7-e)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r},endOfWeek:function(t){var e=t||ICAL.Time.SUNDAY,r=this.clone();return r.day+=(7-this.dayOfWeek()+e-ICAL.Time.SUNDAY)%7,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r},startOfMonth:function(){var t=this.clone();return t.day=1,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},endOfMonth:function(){var t=this.clone();return t.day=ICAL.Time.daysInMonth(t.month,t.year),t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},startOfYear:function(){var t=this.clone();return t.day=1,t.month=1,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},endOfYear:function(){var t=this.clone();return t.day=31,t.month=12,t.isDate=!0,t.hour=0,t.minute=0,t.second=0,t},startDoyWeek:function(t){var e=t||ICAL.Time.SUNDAY,r=this.dayOfWeek()-e;return r<0&&(r+=7),this.dayOfYear()-r},getDominicalLetter:function(){return ICAL.Time.getDominicalLetter(this.year)},nthWeekDay:function(t,e){var r,n=ICAL.Time.daysInMonth(this.month,this.year),i=e,a=0,s=this.clone();if(0<=i){s.day=1,0!=i&&i--,a=s.day;var o=t-s.dayOfWeek();o<0&&(o+=7),a+=o,a-=t,r=t}else{s.day=n,i++,(r=s.dayOfWeek()-t)<0&&(r+=7),r=n-r}return a+(r+=7*i)},isNthWeekDay:function(t,e){var r=this.dayOfWeek();return 0===e&&r===t||this.nthWeekDay(t,e)===this.day},weekNumber:function(t){var e,r=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(r in ICAL.Time._wnCache)return ICAL.Time._wnCache[r];var n=this.clone();n.isDate=!0;var i=this.year;12==n.month&&25<n.day?(e=ICAL.Time.weekOneStarts(i+1,t),n.compare(e)<0?e=ICAL.Time.weekOneStarts(i,t):i++):(e=ICAL.Time.weekOneStarts(i,t),n.compare(e)<0&&(e=ICAL.Time.weekOneStarts(--i,t)));var a=n.subtractDate(e).toSeconds()/86400,s=ICAL.helpers.trunc(a/7)+1;return ICAL.Time._wnCache[r]=s},addDuration:function(t){var e=t.isNegative?-1:1,r=this.second,n=this.minute,i=this.hour,a=this.day;r+=e*t.seconds,n+=e*t.minutes,i+=e*t.hours,a+=e*t.days,a+=7*e*t.weeks,this.second=r,this.minute=n,this.hour=i,this.day=a,this._cachedUnixTime=null},subtractDate:function(t){var e=this.toUnixTime()+this.utcOffset(),r=t.toUnixTime()+t.utcOffset();return ICAL.Duration.fromSeconds(e-r)},subtractDateTz:function(t){var e=this.toUnixTime(),r=t.toUnixTime();return ICAL.Duration.fromSeconds(e-r)},compare:function(t){var e=this.toUnixTime(),r=t.toUnixTime();return r<e?1:e<r?-1:0},compareDateOnlyTz:function(t,e){function r(t){return ICAL.Time._cmp_attr(n,i,t)}var n=this.convertToZone(e),i=t.convertToZone(e),a=0;return 0!=(a=r("year"))||0!=(a=r("month"))||(a=r("day")),a},convertToZone:function(t){var e=this.clone(),r=this.zone.tzid==t.tzid;return this.isDate||r||ICAL.Timezone.convert_time(e,this.zone,t),e.zone=t,e},utcOffset:function(){return this.zone==ICAL.Timezone.localTimezone||this.zone==ICAL.Timezone.utcTimezone?0:this.zone.utcOffset(this)},toICALString:function(){var t=this.toString();return 10<t.length?ICAL.design.icalendar.value["date-time"].toICAL(t):ICAL.design.icalendar.value.date.toICAL(t)},toString:function(){var t=this.year+"-"+ICAL.helpers.pad2(this.month)+"-"+ICAL.helpers.pad2(this.day);return this.isDate||(t+="T"+ICAL.helpers.pad2(this.hour)+":"+ICAL.helpers.pad2(this.minute)+":"+ICAL.helpers.pad2(this.second),this.zone===ICAL.Timezone.utcTimezone&&(t+="Z")),t},toJSDate:function(){return this.zone==ICAL.Timezone.localTimezone?this.isDate?new Date(this.year,this.month-1,this.day):new Date(this.year,this.month-1,this.day,this.hour,this.minute,this.second,0):new Date(1e3*this.toUnixTime())},_normalize:function(){this._time.isDate;return this._time.isDate&&(this._time.hour=0,this._time.minute=0,this._time.second=0),this.adjust(0,0,0,0),this},adjust:function(t,e,r,n,i){var a,s,o,u,h,c,l,d=0,f=0,m=i||this._time;if(m.isDate||(o=m.second+n,m.second=o%60,a=ICAL.helpers.trunc(o/60),m.second<0&&(m.second+=60,a--),u=m.minute+r+a,m.minute=u%60,s=ICAL.helpers.trunc(u/60),m.minute<0&&(m.minute+=60,s--),h=m.hour+e+s,m.hour=h%24,d=ICAL.helpers.trunc(h/24),m.hour<0&&(m.hour+=24,d--)),12<m.month?f=ICAL.helpers.trunc((m.month-1)/12):m.month<1&&(f=ICAL.helpers.trunc(m.month/12)-1),m.year+=f,m.month-=12*f,0<(c=m.day+t+d))for(;!(c<=(l=ICAL.Time.daysInMonth(m.month,m.year)));)m.month++,12<m.month&&(m.year++,m.month=1),c-=l;else for(;c<=0;)1==m.month?(m.year--,m.month=12):m.month--,c+=ICAL.Time.daysInMonth(m.month,m.year);return m.day=c,this._cachedUnixTime=null,this},fromUnixTime:function(t){this.zone=ICAL.Timezone.utcTimezone;var e=ICAL.Time.epochTime.clone();e.adjust(0,0,0,t),this.year=e.year,this.month=e.month,this.day=e.day,this.hour=e.hour,this.minute=e.minute,this.second=Math.floor(e.second),this._cachedUnixTime=null},toUnixTime:function(){if(null!==this._cachedUnixTime)return this._cachedUnixTime;var t=this.utcOffset(),e=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second-t);return this._cachedUnixTime=e/1e3,this._cachedUnixTime},toJSON:function(){for(var t,e=["year","month","day","hour","minute","second","isDate"],r=Object.create(null),n=0,i=e.length;n<i;n++)r[t=e[n]]=this[t];return this.zone&&(r.timezone=this.zone.tzid),r}},"defineProperty"in Object&&(t("year"),t("month"),t("day"),t("hour"),t("minute"),t("second"),t("isDate")),ICAL.Time.daysInMonth=function(t,e){var r=30;return t<1||12<t||(r=[0,31,28,31,30,31,30,31,31,30,31,30,31][t],2==t&&(r+=ICAL.Time.isLeapYear(e))),r},ICAL.Time.isLeapYear=function(t){return t<=1752?t%4==0:t%4==0&&t%100!=0||t%400==0},ICAL.Time.fromDayOfYear=function(t,e){var r=e,n=t,i=new ICAL.Time;i.auto_normalize=!1;var a=ICAL.Time.isLeapYear(r)?1:0;if(n<1)return r--,a=ICAL.Time.isLeapYear(r)?1:0,n+=ICAL.Time.daysInYearPassedMonth[a][12],ICAL.Time.fromDayOfYear(n,r);if(n>ICAL.Time.daysInYearPassedMonth[a][12])return a=ICAL.Time.isLeapYear(r)?1:0,n-=ICAL.Time.daysInYearPassedMonth[a][12],r++,ICAL.Time.fromDayOfYear(n,r);i.year=r,i.isDate=!0;for(var s=11;0<=s;s--)if(n>ICAL.Time.daysInYearPassedMonth[a][s]){i.month=s+1,i.day=n-ICAL.Time.daysInYearPassedMonth[a][s];break}return i.auto_normalize=!0,i},ICAL.Time.fromStringv2=function(t){return new ICAL.Time({year:parseInt(t.substr(0,4),10),month:parseInt(t.substr(5,2),10),day:parseInt(t.substr(8,2),10),isDate:!0})},ICAL.Time.fromDateString=function(t){return new ICAL.Time({year:ICAL.helpers.strictParseInt(t.substr(0,4)),month:ICAL.helpers.strictParseInt(t.substr(5,2)),day:ICAL.helpers.strictParseInt(t.substr(8,2)),isDate:!0})},ICAL.Time.fromDateTimeString=function(t,e){if(t.length<19)throw new Error('invalid date-time value: "'+t+'"');var r;return t[19]&&"Z"===t[19]?r="Z":e&&(r=e.getParameter("tzid")),new ICAL.Time({year:ICAL.helpers.strictParseInt(t.substr(0,4)),month:ICAL.helpers.strictParseInt(t.substr(5,2)),day:ICAL.helpers.strictParseInt(t.substr(8,2)),hour:ICAL.helpers.strictParseInt(t.substr(11,2)),minute:ICAL.helpers.strictParseInt(t.substr(14,2)),second:ICAL.helpers.strictParseInt(t.substr(17,2)),timezone:r})},ICAL.Time.fromString=function(t,e){return 10<t.length?ICAL.Time.fromDateTimeString(t,e):ICAL.Time.fromDateString(t)},ICAL.Time.fromJSDate=function(t,e){return(new ICAL.Time).fromJSDate(t,e)},ICAL.Time.fromData=function(t,e){return(new ICAL.Time).fromData(t,e)},ICAL.Time.now=function(){return ICAL.Time.fromJSDate(new Date,!1)},ICAL.Time.weekOneStarts=function(t,e){var r=ICAL.Time.fromData({year:t,month:1,day:1,isDate:!0}),n=r.dayOfWeek(),i=e||ICAL.Time.DEFAULT_WEEK_START;return n>ICAL.Time.THURSDAY&&(r.day+=7),i>ICAL.Time.THURSDAY&&(r.day-=7),r.day-=n-i,r},ICAL.Time.getDominicalLetter=function(t){var e="GFEDCBA",r=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return ICAL.Time.isLeapYear(t)?e[(6+r)%7]+e[r]:e[r]},ICAL.Time.epochTime=ICAL.Time.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}),ICAL.Time._cmp_attr=function(t,e,r){return t[r]>e[r]?1:t[r]<e[r]?-1:0},ICAL.Time.daysInYearPassedMonth=[[0,31,59,90,120,151,181,212,243,273,304,334,365],[0,31,60,91,121,152,182,213,244,274,305,335,366]],ICAL.Time.SUNDAY=1,ICAL.Time.MONDAY=2,ICAL.Time.TUESDAY=3,ICAL.Time.WEDNESDAY=4,ICAL.Time.THURSDAY=5,ICAL.Time.FRIDAY=6,ICAL.Time.SATURDAY=7,ICAL.Time.DEFAULT_WEEK_START=ICAL.Time.MONDAY}(),ICAL.VCardTime=function(t,e,r){var n=(this.wrappedJSObject=this)._time=Object.create(null);n.year=null,n.month=null,n.day=null,n.hour=null,n.minute=null,n.second=null,this.icaltype=r||"date-and-or-time",this.fromData(t,e)},ICAL.helpers.inherits(ICAL.Time,ICAL.VCardTime,{icalclass:"vcardtime",icaltype:"date-and-or-time",zone:null,clone:function(){return new ICAL.VCardTime(this._time,this.zone,this.icaltype)},_normalize:function(){return this},utcOffset:function(){return this.zone instanceof ICAL.UtcOffset?this.zone.toSeconds():ICAL.Time.prototype.utcOffset.apply(this,arguments)},toICALString:function(){return ICAL.design.vcard.value[this.icaltype].toICAL(this.toString())},toString:function(){var t,e=ICAL.helpers.pad2,r=this.year,n=this.month,i=this.day,a=this.hour,s=this.minute,o=this.second,u=null!==n,h=null!==i,c=null!==a,l=null!==s,d=null!==o,f=(null!==r?e(r)+(u||h?"-":""):u||h?"--":"")+(u?e(n):"")+(h?"-"+e(i):""),m=(c?e(a):"-")+(c&&l?":":"")+(l?e(s):"")+(c||l?"":"-")+(l&&d?":":"")+(d?e(o):"");switch(t=this.zone===ICAL.Timezone.utcTimezone?"Z":this.zone instanceof ICAL.UtcOffset?this.zone.toString():this.zone===ICAL.Timezone.localTimezone?"":this.zone instanceof ICAL.Timezone?ICAL.UtcOffset.fromSeconds(this.zone.utcOffset(this)).toString():"",this.icaltype){case"time":return m+t;case"date-and-or-time":case"date-time":return f+("--"==m?"":"T"+m+t);case"date":return f}return null}}),ICAL.VCardTime.fromDateAndOrTimeString=function(t,e){function r(t,e,r){return t?ICAL.helpers.strictParseInt(t.substr(e,r)):null}var n=t.split("T"),i=n[0],a=n[1],s=a?ICAL.design.vcard.value.time._splitZone(a):[],o=s[0],u=s[1],h=(ICAL.helpers.strictParseInt,i?i.length:0),c=u?u.length:0,l=i&&"-"==i[0]&&"-"==i[1],d=u&&"-"==u[0],f={year:l?null:r(i,0,4),month:!l||4!=h&&7!=h?7==h?r(i,5,2):10==h?r(i,5,2):null:r(i,2,2),day:5==h?r(i,3,2):7==h&&l?r(i,5,2):10==h?r(i,8,2):null,hour:d?null:r(u,0,2),minute:d&&3==c?r(u,1,2):4<c?r(u,d?1:3,2):null,second:4==c?r(u,2,2):6==c?r(u,4,2):8==c?r(u,6,2):null};return o="Z"==o?ICAL.Timezone.utcTimezone:o&&":"==o[3]?ICAL.UtcOffset.fromString(o):null,new ICAL.VCardTime(f,o,e)},function(){var n={SU:ICAL.Time.SUNDAY,MO:ICAL.Time.MONDAY,TU:ICAL.Time.TUESDAY,WE:ICAL.Time.WEDNESDAY,TH:ICAL.Time.THURSDAY,FR:ICAL.Time.FRIDAY,SA:ICAL.Time.SATURDAY},i={};for(var t in n)n.hasOwnProperty(t)&&(i[n[t]]=t);function e(t,e,r,n){var i=n;if("+"===n[0]&&(i=n.substr(1)),i=ICAL.helpers.strictParseInt(i),void 0!==e&&n<e)throw new Error(t+': invalid value "'+n+'" must be > '+e);if(void 0!==r&&r<n)throw new Error(t+': invalid value "'+n+'" must be < '+e);return i}ICAL.Recur=function(t){(this.wrappedJSObject=this).parts={},t&&"object"==typeof t&&this.fromData(t)},ICAL.Recur.prototype={parts:null,interval:1,wkst:ICAL.Time.MONDAY,until:null,count:null,freq:null,icalclass:"icalrecur",icaltype:"recur",iterator:function(t){return new ICAL.RecurIterator({rule:this,dtstart:t})},clone:function(){return new ICAL.Recur(this.toJSON())},isFinite:function(){return!(!this.count&&!this.until)},isByCount:function(){return!(!this.count||this.until)},addComponent:function(t,e){var r=t.toUpperCase();r in this.parts?this.parts[r].push(e):this.parts[r]=[e]},setComponent:function(t,e){this.parts[t.toUpperCase()]=e.slice()},getComponent:function(t){var e=t.toUpperCase();return e in this.parts?this.parts[e].slice():[]},getNextOccurrence:function(t,e){for(var r,n=this.iterator(t);(r=n.next())&&r.compare(e)<=0;);return r&&e.zone&&(r.zone=e.zone),r},fromData:function(t){for(var e in t){var r=e.toUpperCase();r in p?Array.isArray(t[e])?this.parts[r]=t[e]:this.parts[r]=[t[e]]:this[e]=t[e]}this.interval&&"number"!=typeof this.interval&&m.INTERVAL(this.interval,this),this.wkst&&"number"!=typeof this.wkst&&(this.wkst=ICAL.Recur.icalDayToNumericDay(this.wkst)),!this.until||this.until instanceof ICAL.Time||(this.until=ICAL.Time.fromString(this.until))},toJSON:function(){var t=Object.create(null);for(var e in t.freq=this.freq,this.count&&(t.count=this.count),1<this.interval&&(t.interval=this.interval),this.parts)if(this.parts.hasOwnProperty(e)){var r=this.parts[e];Array.isArray(r)&&1==r.length?t[e.toLowerCase()]=r[0]:t[e.toLowerCase()]=ICAL.helpers.clone(this.parts[e])}return this.until&&(t.until=this.until.toString()),"wkst"in this&&this.wkst!==ICAL.Time.DEFAULT_WEEK_START&&(t.wkst=ICAL.Recur.numericDayToIcalDay(this.wkst)),t},toString:function(){var t="FREQ="+this.freq;for(var e in this.count&&(t+=";COUNT="+this.count),1<this.interval&&(t+=";INTERVAL="+this.interval),this.parts)this.parts.hasOwnProperty(e)&&(t+=";"+e+"="+this.parts[e]);return this.until&&(t+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==ICAL.Time.DEFAULT_WEEK_START&&(t+=";WKST="+ICAL.Recur.numericDayToIcalDay(this.wkst)),t}},ICAL.Recur.icalDayToNumericDay=function(t,e){var r=e||ICAL.Time.SUNDAY;return(n[t]-r+7)%7+1},ICAL.Recur.numericDayToIcalDay=function(t,e){var r=t+(e||ICAL.Time.SUNDAY)-ICAL.Time.SUNDAY;return 7<r&&(r-=7),i[r]};var a=/^(SU|MO|TU|WE|TH|FR|SA)$/,r=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,s=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],m={FREQ:function(t,e,r){if(-1===s.indexOf(t))throw new Error('invalid frequency "'+t+'" expected: "'+s.join(", ")+'"');e.freq=t},COUNT:function(t,e,r){e.count=ICAL.helpers.strictParseInt(t)},INTERVAL:function(t,e,r){e.interval=ICAL.helpers.strictParseInt(t),e.interval<1&&(e.interval=1)},UNTIL:function(t,e,r){10<t.length?e.until=ICAL.design.icalendar.value["date-time"].fromICAL(t):e.until=ICAL.design.icalendar.value.date.fromICAL(t),r||(e.until=ICAL.Time.fromString(e.until))},WKST:function(t,e,r){if(!a.test(t))throw new Error('invalid WKST value "'+t+'"');e.wkst=ICAL.Recur.icalDayToNumericDay(t)}},p={BYSECOND:e.bind(this,"BYSECOND",0,60),BYMINUTE:e.bind(this,"BYMINUTE",0,59),BYHOUR:e.bind(this,"BYHOUR",0,23),BYDAY:function(t){if(r.test(t))return t;throw new Error('invalid BYDAY value "'+t+'"')},BYMONTHDAY:e.bind(this,"BYMONTHDAY",-31,31),BYYEARDAY:e.bind(this,"BYYEARDAY",-366,366),BYWEEKNO:e.bind(this,"BYWEEKNO",-53,53),BYMONTH:e.bind(this,"BYMONTH",0,12),BYSETPOS:e.bind(this,"BYSETPOS",-366,366)};ICAL.Recur.fromString=function(t){var e=ICAL.Recur._stringToData(t,!1);return new ICAL.Recur(e)},ICAL.Recur.fromData=function(t){return new ICAL.Recur(t)},ICAL.Recur._stringToData=function(t,e){for(var r=Object.create(null),n=t.split(";"),i=n.length,a=0;a<i;a++){var s=n[a].split("="),o=s[0].toUpperCase(),u=s[0].toLowerCase(),h=e?u:o,c=s[1];if(o in p){for(var l=c.split(","),d=0,f=l.length;d<f;d++)l[d]=p[o](l[d]);r[h]=1==l.length?l[0]:l}else o in m?m[o](c,r,e):r[u]=c}return r}}(),ICAL.RecurIterator=function(){function o(t){this.fromData(t)}return o.prototype={completed:!1,rule:null,dtstart:null,last:null,occurrence_number:0,by_indices:null,initialized:!1,by_data:null,days:null,days_index:0,fromData:function(t){if(this.rule=ICAL.helpers.formatClassType(t.rule,ICAL.Recur),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=ICAL.helpers.formatClassType(t.dtstart,ICAL.Time),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");t.by_data?this.by_data=t.by_data:this.by_data=ICAL.helpers.clone(this.rule.parts,!0),t.occurrence_number&&(this.occurrence_number=t.occurrence_number),this.days=t.days||[],t.last&&(this.last=ICAL.helpers.formatClassType(t.last,ICAL.Time)),this.by_indices=t.by_indices,this.by_indices||(this.by_indices={BYSECOND:0,BYMINUTE:0,BYHOUR:0,BYDAY:0,BYMONTH:0,BYWEEKNO:0,BYMONTHDAY:0}),this.initialized=t.initialized||!1,this.initialized||this.init()},init:function(){this.initialized=!0,this.last=this.dtstart.clone();var t=this.by_data;if("BYDAY"in t&&this.sort_byday_rules(t.BYDAY),"BYYEARDAY"in t&&("BYMONTH"in t||"BYWEEKNO"in t||"BYMONTHDAY"in t||"BYDAY"in t))throw new Error("Invalid BYYEARDAY rule");if("BYWEEKNO"in t&&"BYMONTHDAY"in t)throw new Error("BYWEEKNO does not fit to BYMONTHDAY");if("MONTHLY"==this.rule.freq&&("BYYEARDAY"in t||"BYWEEKNO"in t))throw new Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear");if("WEEKLY"==this.rule.freq&&("BYYEARDAY"in t||"BYMONTHDAY"in t))throw new Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear");if("YEARLY"!=this.rule.freq&&"BYYEARDAY"in t)throw new Error("BYYEARDAY may only appear in YEARLY rules");if(this.last.second=this.setup_defaults("BYSECOND","SECONDLY",this.dtstart.second),this.last.minute=this.setup_defaults("BYMINUTE","MINUTELY",this.dtstart.minute),this.last.hour=this.setup_defaults("BYHOUR","HOURLY",this.dtstart.hour),this.last.day=this.setup_defaults("BYMONTHDAY","DAILY",this.dtstart.day),this.last.month=this.setup_defaults("BYMONTH","MONTHLY",this.dtstart.month),"WEEKLY"==this.rule.freq)if("BYDAY"in t){var e=(u=this.ruleDayOfWeek(t.BYDAY[0],this.rule.wkst))[0],r=(h=u[1])-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<h&&0<=r||r<0)&&(this.last.day+=r)}else{var n=ICAL.Recur.numericDayToIcalDay(this.dtstart.dayOfWeek());t.BYDAY=[n]}if("YEARLY"==this.rule.freq){for(;this.expand_year_days(this.last.year),!(0<this.days.length);)this.increment_year(this.rule.interval);this._nextByYearDay()}if("MONTHLY"==this.rule.freq&&this.has_by_data("BYDAY")){var i=null,a=this.last.clone(),s=ICAL.Time.daysInMonth(this.last.month,this.last.year);for(var o in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(o)){this.last=a.clone();e=(u=this.ruleDayOfWeek(this.by_data.BYDAY[o]))[0];var u,h=u[1],c=this.last.nthWeekDay(h,e);if(6<=e||e<=-6)throw new Error("Malformed values in BYDAY part");if(s<c||c<=0){if(i&&i.month==a.month)continue;for(;s<c||c<=0;)this.increment_month(),s=ICAL.Time.daysInMonth(this.last.month,this.last.year),c=this.last.nthWeekDay(h,e)}this.last.day=c,(!i||this.last.compare(i)<0)&&(i=this.last.clone())}if(this.last=i.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>s||0==this.last.day)throw new Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")&&this.last.day<0){s=ICAL.Time.daysInMonth(this.last.month,this.last.year);this.last.day=s+this.last.day+1}},next:function(){var t,e=this.last?this.last.clone():null;if(this.rule.count&&this.occurrence_number>=this.rule.count||this.rule.until&&0<this.last.compare(this.rule.until))return this.completed=!0,null;if(0==this.occurrence_number&&0<=this.last.compare(this.dtstart))return this.occurrence_number++,this.last;do{switch(t=1,this.rule.freq){case"SECONDLY":this.next_second();break;case"MINUTELY":this.next_minute();break;case"HOURLY":this.next_hour();break;case"DAILY":this.next_day();break;case"WEEKLY":this.next_week();break;case"MONTHLY":t=this.next_month();break;case"YEARLY":this.next_year();break;default:return null}}while(!this.check_contracting_rules()||this.last.compare(this.dtstart)<0||!t);if(0==this.last.compare(e))throw new Error("Same occurrence found twice, protecting you from death by recursion");return this.rule.until&&0<this.last.compare(this.rule.until)?(this.completed=!0,null):(this.occurrence_number++,this.last)},next_second:function(){return this.next_generic("BYSECOND","SECONDLY","second","minute")},increment_second:function(t){return this.increment_generic(t,"second",60,"minute")},next_minute:function(){return this.next_generic("BYMINUTE","MINUTELY","minute","hour","next_second")},increment_minute:function(t){return this.increment_generic(t,"minute",60,"hour")},next_hour:function(){return this.next_generic("BYHOUR","HOURLY","hour","monthday","next_minute")},increment_hour:function(t){this.increment_generic(t,"hour",24,"monthday")},next_day:function(){this.by_data;var t="DAILY"==this.rule.freq;return 0==this.next_hour()||(t?this.increment_monthday(this.rule.interval):this.increment_monthday(1)),0},next_week:function(){var t=0;if(0==this.next_weekday_by_week())return t;if(this.has_by_data("BYWEEKNO")){++this.by_indices.BYWEEKNO;this.by_indices.BYWEEKNO==this.by_data.BYWEEKNO.length&&(this.by_indices.BYWEEKNO=0,t=1),this.last.month=1,this.last.day=1;var e=this.by_data.BYWEEKNO[this.by_indices.BYWEEKNO];this.last.day+=7*e,t&&this.increment_year(1)}else this.increment_monthday(7*this.rule.interval);return t},normalizeByMonthDayRules:function(t,e,r){for(var n,i=ICAL.Time.daysInMonth(e,t),a=[],s=0,o=r.length;s<o;s++)if(n=r[s],!(Math.abs(n)>i)){if(n<0)n=i+(n+1);else if(0===n)continue;-1===a.indexOf(n)&&a.push(n)}return a.sort(function(t,e){return t-e})},_byDayAndMonthDay:function(t){var e,r,n,i,a=this.by_data.BYDAY,s=0,o=a.length,u=0,h=this,c=this.last.day;function l(){for(i=ICAL.Time.daysInMonth(h.last.month,h.last.year),e=h.normalizeByMonthDayRules(h.last.year,h.last.month,h.by_data.BYMONTHDAY),n=e.length;e[s]<=c&&(!t||e[s]!=c)&&s<n-1;)s++}function d(){c=0,h.increment_month(),s=0,l()}l(),t&&(c-=1);for(var f=48;!u&&f;)if(f--,i<(r=c+1))d();else{var m=e[s++];if(r<=m){c=m;for(var p=0;p<o;p++){var y=this.ruleDayOfWeek(a[p]),A=y[0],C=y[1];if(this.last.day=c,this.last.isNthWeekDay(C,A)){u=1;break}}u||s!==n||d()}else d()}if(f<=0)throw new Error("Malformed values in BYDAY combined with BYMONTHDAY parts");return u},next_month:function(){this.rule.freq;var t=1;if(0==this.next_hour())return t;if(this.has_by_data("BYDAY")&&this.has_by_data("BYMONTHDAY"))t=this._byDayAndMonthDay();else if(this.has_by_data("BYDAY")){var e=ICAL.Time.daysInMonth(this.last.month,this.last.year),r=0,n=0;if(this.has_by_data("BYSETPOS")){for(var i=this.last.day,a=1;a<=e;a++)this.last.day=a,this.is_day_in_byday(this.last)&&(n++,a<=i&&r++);this.last.day=i}t=0;for(a=this.last.day+1;a<=e;a++)if(this.last.day=a,this.is_day_in_byday(this.last)&&(!this.has_by_data("BYSETPOS")||this.check_set_position(++r)||this.check_set_position(r-n-1))){t=1;break}e<a&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?this.has_by_data("BYSETPOS")&&!this.check_set_position(1)||(t=1):t=0)}else if(this.has_by_data("BYMONTHDAY")){this.by_indices.BYMONTHDAY++,this.by_indices.BYMONTHDAY>=this.by_data.BYMONTHDAY.length&&(this.by_indices.BYMONTHDAY=0,this.increment_month());e=ICAL.Time.daysInMonth(this.last.month,this.last.year);(a=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY])<0&&(a=e+a+1),e<a?(this.last.day=1,t=this.is_day_in_byday(this.last)):this.last.day=a}else{this.increment_month();e=ICAL.Time.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>e?t=0:this.last.day=this.by_data.BYMONTHDAY[0]}return t},next_weekday_by_week:function(){var t=0;if(0==this.next_hour())return t;if(!this.has_by_data("BYDAY"))return 1;for(;;){var e=new ICAL.Time;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,t=1);var r=this.by_data.BYDAY[this.by_indices.BYDAY],n=this.ruleDayOfWeek(r)[1];(n-=this.rule.wkst)<0&&(n+=7),e.year=this.last.year,e.month=this.last.month,e.day=this.last.day;var i=e.startDoyWeek(this.rule.wkst);if(!(n+i<1)||t){var a=ICAL.Time.fromDayOfYear(i+n,this.last.year);return this.last.year=a.year,this.last.month=a.month,this.last.day=a.day,t}}},next_year:function(){if(0==this.next_hour())return 0;if(++this.days_index==this.days.length)for(this.days_index=0;this.increment_year(this.rule.interval),this.expand_year_days(this.last.year),0==this.days.length;);return this._nextByYearDay(),1},_nextByYearDay:function(){var t=this.days[this.days_index],e=this.last.year;t<1&&(t+=1,e+=1);var r=ICAL.Time.fromDayOfYear(t,e);this.last.day=r.day,this.last.month=r.month},ruleDayOfWeek:function(t,e){var r=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);return r?[parseInt(r[1]||0,10),t=ICAL.Recur.icalDayToNumericDay(r[2],e)]:[0,0]},next_generic:function(t,e,r,n,i){var a=t in this.by_data,s=this.rule.freq==e,o=0;if(i&&0==this[i]())return o;if(a){this.by_indices[t]++;this.by_indices[t];var u=this.by_data[t];this.by_indices[t]==u.length&&(this.by_indices[t]=0,o=1),this.last[r]=u[this.by_indices[t]]}else s&&this["increment_"+r](this.rule.interval);return a&&o&&s&&this["increment_"+n](1),o},increment_monthday:function(t){for(var e=0;e<t;e++){var r=ICAL.Time.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>r&&(this.last.day-=r,this.increment_month())}},increment_month:function(){if(this.last.day=1,this.has_by_data("BYMONTH"))this.by_indices.BYMONTH++,this.by_indices.BYMONTH==this.by_data.BYMONTH.length&&(this.by_indices.BYMONTH=0,this.increment_year(1)),this.last.month=this.by_data.BYMONTH[this.by_indices.BYMONTH];else{"MONTHLY"==this.rule.freq?this.last.month+=this.rule.interval:this.last.month++,this.last.month--;var t=ICAL.helpers.trunc(this.last.month/12);this.last.month%=12,this.last.month++,0!=t&&this.increment_year(t)}},increment_year:function(t){this.last.year+=t},increment_generic:function(t,e,r,n){this.last[e]+=t;var i=ICAL.helpers.trunc(this.last[e]/r);this.last[e]%=r,0!=i&&this["increment_"+n](i)},has_by_data:function(t){return t in this.rule.parts},expand_year_days:function(t){var e=new ICAL.Time;this.days=[];var r={},n=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];for(var i in n)if(n.hasOwnProperty(i)){var a=n[i];a in this.rule.parts&&(r[a]=this.rule.parts[a])}if("BYMONTH"in r&&"BYWEEKNO"in r){var s=1,o={};e.year=t,e.isDate=!0;for(var u=0;u<this.by_data.BYMONTH.length;u++){var h=this.by_data.BYMONTH[u];e.month=h,e.day=1;var c=e.weekNumber(this.rule.wkst);e.day=ICAL.Time.daysInMonth(h,t);var l=e.weekNumber(this.rule.wkst);for(u=c;u<l;u++)o[u]=1}for(var d=0;d<this.by_data.BYWEEKNO.length&&s;d++){(U=this.by_data.BYWEEKNO[d])<52?s&=o[d]:s=0}s?delete r.BYMONTH:delete r.BYWEEKNO}var f=Object.keys(r).length;if(0==f){var m=this.dtstart.clone();m.year=this.last.year,this.days.push(m.dayOfYear())}else if(1==f&&"BYMONTH"in r){for(var p in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(p)){var y=this.dtstart.clone();y.year=t,y.month=this.by_data.BYMONTH[p],y.isDate=!0,this.days.push(y.dayOfYear())}}else if(1==f&&"BYMONTHDAY"in r){for(var A in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(A)){var C=this.dtstart.clone();if((L=this.by_data.BYMONTHDAY[A])<0)L=L+(T=ICAL.Time.daysInMonth(C.month,t))+1;C.day=L,C.year=t,C.isDate=!0,this.days.push(C.dayOfYear())}}else if(2==f&&"BYMONTHDAY"in r&&"BYMONTH"in r){for(var p in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(p)){var I=this.by_data.BYMONTH[p],T=ICAL.Time.daysInMonth(I,t);for(var A in this.by_data.BYMONTHDAY){var L;if(this.by_data.BYMONTHDAY.hasOwnProperty(A))(L=this.by_data.BYMONTHDAY[A])<0&&(L=L+T+1),e.day=L,e.month=I,e.year=t,e.isDate=!0,this.days.push(e.dayOfYear())}}}else if(1==f&&"BYWEEKNO"in r);else if(2==f&&"BYWEEKNO"in r&&"BYMONTHDAY"in r);else if(1==f&&"BYDAY"in r)this.days=this.days.concat(this.expand_by_day(t));else if(2==f&&"BYDAY"in r&&"BYMONTH"in r){for(var p in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(p)){h=this.by_data.BYMONTH[p],T=ICAL.Time.daysInMonth(h,t);e.year=t,e.month=this.by_data.BYMONTH[p],e.day=1,e.isDate=!0;var _=e.dayOfWeek(),v=e.dayOfYear()-1;e.day=T;var g=e.dayOfWeek();if(this.has_by_data("BYSETPOS")){for(var D=[],Y=1;Y<=T;Y++)e.day=Y,this.is_day_in_byday(e)&&D.push(Y);for(var b=0;b<D.length;b++)(this.check_set_position(b+1)||this.check_set_position(b-D.length))&&this.days.push(v+D[b])}else for(var O in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(O)){var S,w=this.by_data.BYDAY[O],E=this.ruleDayOfWeek(w),N=E[0],x=E[1],z=(x+7-_)%7+1,B=T-(g+7-x)%7;if(0==N)for(Y=z;Y<=T;Y+=7)this.days.push(v+Y);else 0<N?(S=z+7*(N-1))<=T&&this.days.push(v+S):0<(S=B+7*(N+1))&&this.days.push(v+S)}}this.days.sort(function(t,e){return t-e})}else if(2==f&&"BYDAY"in r&&"BYMONTHDAY"in r){var P=this.expand_by_day(t);for(var M in P)if(P.hasOwnProperty(M)){Y=P[M];var k=ICAL.Time.fromDayOfYear(Y,t);0<=this.by_data.BYMONTHDAY.indexOf(k.day)&&this.days.push(Y)}}else if(3==f&&"BYDAY"in r&&"BYMONTHDAY"in r&&"BYMONTH"in r){P=this.expand_by_day(t);for(var M in P)if(P.hasOwnProperty(M)){Y=P[M],k=ICAL.Time.fromDayOfYear(Y,t);0<=this.by_data.BYMONTH.indexOf(k.month)&&0<=this.by_data.BYMONTHDAY.indexOf(k.day)&&this.days.push(Y)}}else if(2==f&&"BYDAY"in r&&"BYWEEKNO"in r){P=this.expand_by_day(t);for(var M in P)if(P.hasOwnProperty(M)){Y=P[M];var U=(k=ICAL.Time.fromDayOfYear(Y,t)).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(U)&&this.days.push(Y)}}else 3==f&&"BYDAY"in r&&"BYWEEKNO"in r&&"BYMONTHDAY"in r||(this.days=1==f&&"BYYEARDAY"in r?this.days.concat(this.by_data.BYYEARDAY):[]);return 0},expand_by_day:function(t){var e=[],r=this.last.clone();r.year=t,r.month=1,r.day=1,r.isDate=!0;var n=r.dayOfWeek();r.month=12,r.day=31,r.isDate=!0;var i=r.dayOfWeek(),a=r.dayOfYear();for(var s in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(s)){var o=this.by_data.BYDAY[s],u=this.ruleDayOfWeek(o),h=u[0],c=u[1];if(0==h)for(var l=(c+7-n)%7+1;l<=a;l+=7)e.push(l);else if(0<h){var d;d=n<=c?c-n+1:c-n+8,e.push(d+7*(h-1))}else{var f;h=-h,f=c<=i?a-i+c:a-i+c-7,e.push(f-7*(h-1))}}return e},is_day_in_byday:function(t){for(var e in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(e)){var r=this.by_data.BYDAY[e],n=this.ruleDayOfWeek(r),i=n[0],a=n[1],s=t.dayOfWeek();if(0==i&&a==s||t.nthWeekDay(a,i)==t.day)return 1}return 0},check_set_position:function(t){return!!this.has_by_data("BYSETPOS")&&-1!==this.by_data.BYSETPOS.indexOf(t)},sort_byday_rules:function(t){for(var e=0;e<t.length;e++)for(var r=0;r<e;r++){var n=this.ruleDayOfWeek(t[r],this.rule.wkst)[1];if(this.ruleDayOfWeek(t[e],this.rule.wkst)[1]<n){var i=t[e];t[e]=t[r],t[r]=i}}},check_contract_restriction:function(t,e){var r=o._indexMap[t],n=o._expandMap[this.rule.freq][r],i=!1;if(t in this.by_data&&n==o.CONTRACT){var a=this.by_data[t];for(var s in a)if(a.hasOwnProperty(s)&&a[s]==e){i=!0;break}}else i=!0;return i},check_contracting_rules:function(){var t=this.last.dayOfWeek(),e=this.last.weekNumber(this.rule.wkst),r=this.last.dayOfYear();return this.check_contract_restriction("BYSECOND",this.last.second)&&this.check_contract_restriction("BYMINUTE",this.last.minute)&&this.check_contract_restriction("BYHOUR",this.last.hour)&&this.check_contract_restriction("BYDAY",ICAL.Recur.numericDayToIcalDay(t))&&this.check_contract_restriction("BYWEEKNO",e)&&this.check_contract_restriction("BYMONTHDAY",this.last.day)&&this.check_contract_restriction("BYMONTH",this.last.month)&&this.check_contract_restriction("BYYEARDAY",r)},setup_defaults:function(t,e,r){var n=o._indexMap[t];return o._expandMap[this.rule.freq][n]!=o.CONTRACT&&(t in this.by_data||(this.by_data[t]=[r]),this.rule.freq!=e)?this.by_data[t][0]:r},toJSON:function(){var t=Object.create(null);return t.initialized=this.initialized,t.rule=this.rule.toJSON(),t.dtstart=this.dtstart.toJSON(),t.by_data=this.by_data,t.days=this.days,t.last=this.last.toJSON(),t.by_indices=this.by_indices,t.occurrence_number=this.occurrence_number,t}},o._indexMap={BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8},o._expandMap={SECONDLY:[1,1,1,1,1,1,1,1],MINUTELY:[2,1,1,1,1,1,1,1],HOURLY:[2,2,1,1,1,1,1,1],DAILY:[2,2,2,1,1,1,1,1],WEEKLY:[2,2,2,2,3,3,1,1],MONTHLY:[2,2,2,2,2,3,3,1],YEARLY:[2,2,2,2,2,2,2,2]},o.UNKNOWN=0,o.CONTRACT=1,o.EXPAND=2,o.ILLEGAL=3,o}(),ICAL.RecurExpansion=function(){function r(t){return ICAL.helpers.formatClassType(t,ICAL.Time)}function u(t,e){return t.compare(e)}function t(t){this.ruleDates=[],this.exDates=[],this.fromData(t)}return t.prototype={complete:!1,ruleIterators:null,ruleDates:null,exDates:null,ruleDateInc:0,exDateInc:0,exDate:null,ruleDate:null,dtstart:null,last:null,fromData:function(t){var e=ICAL.helpers.formatClassType(t.dtstart,ICAL.Time);if(!e)throw new Error(".dtstart (ICAL.Time) must be given");if(this.dtstart=e,t.component)this._init(t.component);else{if(this.last=r(t.last)||e.clone(),!t.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=t.ruleIterators.map(function(t){return ICAL.helpers.formatClassType(t,ICAL.RecurIterator)}),this.ruleDateInc=t.ruleDateInc,this.exDateInc=t.exDateInc,t.ruleDates&&(this.ruleDates=t.ruleDates.map(r),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.exDates&&(this.exDates=t.exDates.map(r),this.exDate=this.exDates[this.exDateInc]),void 0!==t.complete&&(this.complete=t.complete)}},next:function(){for(var t,e,r,n=0;;){if(500<n++)throw new Error("max tries have occured, rule may be impossible to forfill.");if(e=this.ruleDate,t=this._nextRecurrenceIter(this.last),!e&&!t){this.complete=!0;break}if((!e||t&&0<e.compare(t.last))&&(e=t.last.clone(),t.next()),this.ruleDate===e&&this._nextRuleDay(),this.last=e,!this.exDate||((r=this.exDate.compare(this.last))<0&&this._nextExDay(),0!==r))return this.last;this._nextExDay()}},toJSON:function(){function t(t){return t.toJSON()}var e=Object.create(null);return e.ruleIterators=this.ruleIterators.map(t),this.ruleDates&&(e.ruleDates=this.ruleDates.map(t)),this.exDates&&(e.exDates=this.exDates.map(t)),e.ruleDateInc=this.ruleDateInc,e.exDateInc=this.exDateInc,e.last=this.last.toJSON(),e.dtstart=this.dtstart.toJSON(),e.complete=this.complete,e},_extractDates:function(t,e){function r(t){n=ICAL.helpers.binsearchInsert(i,t,u),i.splice(n,0,t)}for(var n,i=[],a=t.getAllProperties(e),s=a.length,o=0;o<s;o++)a[o].getValues().forEach(r);return i},_init:function(t){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!function(t){return t.hasProperty("rdate")||t.hasProperty("rrule")||t.hasProperty("recurrence-id")}(t))return this.ruleDate=this.last.clone(),void(this.complete=!0);if(t.hasProperty("rdate")&&(this.ruleDates=this._extractDates(t,"rdate"),this.ruleDates[0]&&this.ruleDates[0].compare(this.dtstart)<0?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=ICAL.helpers.binsearchInsert(this.ruleDates,this.last,u),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.hasProperty("rrule"))for(var e,r=t.getAllProperties("rrule"),n=0,i=r.length;n<i;n++)e=r[n].getFirstValue().iterator(this.dtstart),this.ruleIterators.push(e),e.next();t.hasProperty("exdate")&&(this.exDates=this._extractDates(t,"exdate"),this.exDateInc=ICAL.helpers.binsearchInsert(this.exDates,this.last,u),this.exDate=this.exDates[this.exDateInc])},_nextExDay:function(){this.exDate=this.exDates[++this.exDateInc]},_nextRuleDay:function(){this.ruleDate=this.ruleDates[++this.ruleDateInc]},_nextRecurrenceIter:function(){var t=this.ruleIterators;if(0===t.length)return null;for(var e,r,n,i=t.length,a=0;a<i;a++)r=(e=t[a]).last,e.completed?(i--,0!==a&&a--,t.splice(a,1)):(!n||0<n.last.compare(r))&&(n=e);return n}},t}(),ICAL.Event=function(){function t(t,e){t instanceof ICAL.Component||(e=t,t=null),this.component=t||new ICAL.Component("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],e&&e.strictExceptions&&(this.strictExceptions=e.strictExceptions),e&&e.exceptions?e.exceptions.forEach(this.relateException,this):this.component.parent&&!this.isRecurrenceException()&&this.component.parent.getAllSubcomponents("vevent").forEach(function(t){t.hasProperty("recurrence-id")&&this.relateException(t)},this)}function i(t,e){return t[0]>e[0]?1:e[0]>t[0]?-1:0}return t.prototype={THISANDFUTURE:"THISANDFUTURE",exceptions:null,strictExceptions:!1,relateException:function(t){if(this.isRecurrenceException())throw new Error("cannot relate exception to exceptions");if(t instanceof ICAL.Component&&(t=new ICAL.Event(t)),this.strictExceptions&&t.uid!==this.uid)throw new Error("attempted to relate unrelated exception");var e=t.recurrenceId.toString();if((this.exceptions[e]=t).modifiesFuture()){var r=[t.recurrenceId.toUnixTime(),e],n=ICAL.helpers.binsearchInsert(this.rangeExceptions,r,i);this.rangeExceptions.splice(n,0,r)}},modifiesFuture:function(){return!!this.component.hasProperty("recurrence-id")&&this.component.getFirstProperty("recurrence-id").getParameter("range")===this.THISANDFUTURE},findRangeException:function(t){if(!this.rangeExceptions.length)return null;var e=t.toUnixTime(),r=ICAL.helpers.binsearchInsert(this.rangeExceptions,[e],i);if(--r<0)return null;var n=this.rangeExceptions[r];return e<n[0]?null:n[1]},getOccurrenceDetails:function(t){var e,r=t.toString(),n=t.convertToZone(ICAL.Timezone.utcTimezone).toString(),i={recurrenceId:t};if(r in this.exceptions)e=i.item=this.exceptions[r],i.startDate=e.startDate,i.endDate=e.endDate,i.item=e;else if(n in this.exceptions)e=this.exceptions[n],i.startDate=e.startDate,i.endDate=e.endDate,i.item=e;else{var a,s=this.findRangeException(t);if(s){var o=this.exceptions[s];i.item=o;var u=this._rangeExceptionCache[s];if(!u){var h=o.recurrenceId.clone(),c=o.startDate.clone();h.zone=c.zone,u=c.subtractDate(h),this._rangeExceptionCache[s]=u}var l=t.clone();l.zone=o.startDate.zone,l.addDuration(u),(a=l.clone()).addDuration(o.duration),i.startDate=l,i.endDate=a}else(a=t.clone()).addDuration(this.duration),i.endDate=a,i.startDate=t,i.item=this}return i},iterator:function(t){return new ICAL.RecurExpansion({component:this.component,dtstart:t||this.startDate})},isRecurring:function(){var t=this.component;return t.hasProperty("rrule")||t.hasProperty("rdate")},isRecurrenceException:function(){return this.component.hasProperty("recurrence-id")},getRecurrenceTypes:function(){for(var t=this.component.getAllProperties("rrule"),e=0,r=t.length,n=Object.create(null);e<r;e++){n[t[e].getFirstValue().freq]=!0}return n},get uid(){return this._firstProp("uid")},set uid(t){this._setProp("uid",t)},get startDate(){return this._firstProp("dtstart")},set startDate(t){this._setTime("dtstart",t)},get endDate(){var t=this._firstProp("dtend");if(!t){var e=this._firstProp("duration");t=this.startDate.clone(),e?t.addDuration(e):t.isDate&&(t.day+=1)}return t},set endDate(t){this.component.hasProperty("duration")&&this.component.removeProperty("duration"),this._setTime("dtend",t)},get duration(){var t=this._firstProp("duration");return t||this.endDate.subtractDateTz(this.startDate)},set duration(t){this.component.hasProperty("dtend")&&this.component.removeProperty("dtend"),this._setProp("duration",t)},get location(){return this._firstProp("location")},set location(t){return this._setProp("location",t)},get attendees(){return this.component.getAllProperties("attendee")},get summary(){return this._firstProp("summary")},set summary(t){this._setProp("summary",t)},get description(){return this._firstProp("description")},set description(t){this._setProp("description",t)},get organizer(){return this._firstProp("organizer")},set organizer(t){this._setProp("organizer",t)},get sequence(){return this._firstProp("sequence")},set sequence(t){this._setProp("sequence",t)},get recurrenceId(){return this._firstProp("recurrence-id")},set recurrenceId(t){this._setTime("recurrence-id",t)},_setTime:function(t,e){var r=this.component.getFirstProperty(t);r||(r=new ICAL.Property(t),this.component.addProperty(r)),e.zone===ICAL.Timezone.localTimezone||e.zone===ICAL.Timezone.utcTimezone?r.removeParameter("tzid"):r.setParameter("tzid",e.zone.tzid),r.setValue(e)},_setProp:function(t,e){this.component.updatePropertyWithValue(t,e)},_firstProp:function(t){return this.component.getFirstPropertyValue(t)},toString:function(){return this.component.toString()}},t}(),ICAL.ComponentParser=function(){function t(t){var e;for(e in void 0===t&&(t={}),t)t.hasOwnProperty(e)&&(this[e]=t[e])}return t.prototype={parseEvent:!0,parseTimezone:!0,oncomplete:function(){},onerror:function(t){},ontimezone:function(t){},onevent:function(t){},process:function(t){"string"==typeof t&&(t=ICAL.parse(t)),t instanceof ICAL.Component||(t=new ICAL.Component(t));for(var e,r=t.getAllSubcomponents(),n=0,i=r.length;n<i;n++)switch((e=r[n]).name){case"vtimezone":if(this.parseTimezone){var a=e.getFirstPropertyValue("tzid");a&&this.ontimezone(new ICAL.Timezone({tzid:a,component:e}))}break;case"vevent":this.parseEvent&&this.onevent(new ICAL.Event(e));break;default:continue}this.oncomplete()}},t}();
//# sourceMappingURL=ical.min.js.map