radiomanifest-oldstyle.bundle.js 86 KB

1
  1. !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.radiomanifest=e():t.radiomanifest=e()}(self,(function(){return(()=>{var t={664:(t,e,r)=>{const n=r(350),i=r(728);class s{constructor(t,e){this.calendar=t,this.radio=e}getEvents(){return this.calendar.getAllSubcomponents("vevent")}getNowEvent(t){var e=this.getEvents().filter((function(e){return function(t,e){return void 0===e&&(e=n.Time.now()),t.isRecurring()?function(t,e){for(var r,n,i=t.iterator(t.startDate);(r=i.next())&&((n=r.clone()).addDuration(t.duration),!(n>e)););return e<n&&e>r}(t,e):e<t.endDate&&e>event.startDate}(new n.Event(e),t)}));return 0===e.length?null:(e.length>1&&console.log("More than one event right now?!"),e[0])}getNowShow(t){var e=this.getNowEvent(t);if(null===e)return null;if(void 0!==this.radio){const t=s.veventGetShowID(e);var r=this.radio.getShowByName(t);return null==r?new i.RadioShow(s.veventGetSummary(e)):r}return new i.RadioShow(s.veventGetSummary(e))}getNextEvent(t){}getNextShow(t){}static veventGetSummary(t){return t.getFirstProperty("summary").getFirstValue()}static veventGetShowID(t){return s.veventGetSummary(t)}}function a(t){var e=n.parse(t),r=new n.Component(e);return new s(r)}t.exports={get:async function(t){if(t.scheduleURL){let e=null;try{e=await fetch(t.scheduleURL)}catch(t){}if(null!==e)try{return text=await e.text(),a(text)}catch(t){throw console.error("Error while parsing schedule",t),t}}},parse:a,RadioSchedule:s}},350:t=>{var e,r,n,i;(e=t.exports).foldLength=75,e.newLineChar="\r\n",e.helpers={updateTimezones:function(t){var r,n,i,s,a,o;if(!t||"vcalendar"!==t.name)return t;for(r=t.getAllSubcomponents(),n=[],i={},a=0;a<r.length;a++)"vtimezone"===r[a].name?i[o=r[a].getFirstProperty("tzid").getFirstValue()]=r[a]:n=n.concat(r[a].getAllProperties());for(s={},a=0;a<n.length;a++)(o=n[a].getParameter("tzid"))&&(s[o]=!0);for(a in i)i.hasOwnProperty(a)&&!s[a]&&t.removeSubcomponent(i[a]);for(a in s)s.hasOwnProperty(a)&&!i[a]&&e.TimezoneService.has(a)&&t.addSubcomponent(e.TimezoneService.get(a).component);return t},isStrictlyNaN:function(t){return"number"==typeof t&&isNaN(t)},strictParseInt:function(t){var r=parseInt(t,10);if(e.helpers.isStrictlyNaN(r))throw new Error('Could not extract integer from "'+t+'"');return r},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(!(r>0&&"\\"===t[r-1]))return r;r+=1}return-1},binsearchInsert:function(t,e,r){if(!t.length)return 0;for(var n,i,s=0,a=t.length-1;s<=a;)if((i=r(e,t[n=s+Math.floor((a-s)/2)]))<0)a=n-1;else{if(!(i>0))break;s=n+1}return i<0?n:i>0?n+1:n},dumpn:function(){e.debug&&("undefined"!=typeof console&&"log"in console?e.helpers.dumpn=function(t){console.log(t)}:e.helpers.dumpn=function(t){dump(t+"\n")},e.helpers.dumpn(arguments[0]))},clone:function(t,r){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 n=[],i=0;i<t.length;i++)n.push(r?e.helpers.clone(t[i],!0):t[i]);return n}var s={};for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(s[a]=r?e.helpers.clone(t[a],!0):t[a]);return s}return t},foldline:function(t){for(var r="",n=t||"",i=0,s=0;n.length;){var a=n.codePointAt(i);a<128?++s:s+=a<2048?2:a<65536?3:4,s<e.foldLength+1?i+=a>65535?2:1:(r+=e.newLineChar+" "+n.substring(0,i),n=n.substring(i),i=s=0)}return r.substr(e.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,r,n){function i(){}i.prototype=t.prototype,r.prototype=new i,n&&e.helpers.extend(n,r.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}},e.design=function(){"use strict";var t=/\\\\|\\,|\\[Nn]/g,r=/\\|,|\n/g;function n(t,e){return{matches:/.*/,fromICAL:function(e,r){return function(t,e,r){return-1===t.indexOf("\\")?t:(r&&(e=new RegExp(e.source+"|\\\\"+r)),t.replace(e,m))}(e,t,r)},toICAL:function(t,r){var n=e;return r&&(n=new RegExp(n.source+"|"+r)),t.replace(n,(function(t){switch(t){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case"\n":return"\\n";default:return t}}))}}}var i={defaultType:"text"},s={defaultType:"text",multiValue:","},a={defaultType:"text",structuredValue:";"},o={defaultType:"integer"},u={defaultType:"date-time",allowedTypes:["date-time","date"]},h={defaultType:"date-time"},c={defaultType:"uri"},l={defaultType:"utc-offset"},d={defaultType:"recur"},f={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function m(t){switch(t){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return"\n";default:return t}}var p={categories:s,url:c,version:i,uid:i},y={boolean:{values:["TRUE","FALSE"],fromICAL:function(t){return"TRUE"===t},toICAL:function(t){return t?"TRUE":"FALSE"}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(t){var r=parseFloat(t);return e.helpers.isStrictlyNaN(r)?0:r},toICAL:function(t){return String(t)}},integer:{fromICAL:function(t){var r=parseInt(t);return e.helpers.isStrictlyNaN(r)?0:r},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 e.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}},T=e.helpers.extend(y,{text:n(/\\\\|\\;|\\,|\\[Nn]/g,/\\|;|,|\n/g),uri:{},binary:{decorate:function(t){return e.Binary.fromString(t)},undecorate:function(t){return t.toString()}},"cal-address":{},date:{decorate:function(t,r){return A.strict?e.Time.fromDateString(t,r):e.Time.fromString(t,r)},undecorate:function(t){return t.toString()},fromICAL:function(t){return!A.strict&&t.length>=15?T["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):e>=19?T["date-time"].toICAL(t):t}},"date-time":{fromICAL:function(t){if(A.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 T.date.fromICAL(t)},toICAL:function(t){var e=t.length;if(10!=e||A.strict){if(e>=19){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 T.date.toICAL(t)},decorate:function(t,r){return A.strict?e.Time.fromDateTimeString(t,r):e.Time.fromString(t,r)},undecorate:function(t){return t.toString()}},duration:{decorate:function(t){return e.Duration.fromString(t)},undecorate:function(t){return t.toString()}},period:{fromICAL:function(t){var r=t.split("/");return r[0]=T["date-time"].fromICAL(r[0]),e.Duration.isValueString(r[1])||(r[1]=T["date-time"].fromICAL(r[1])),r},toICAL:function(t){return A.strict||10!=t[0].length?t[0]=T["date-time"].toICAL(t[0]):t[0]=T.date.toICAL(t[0]),e.Duration.isValueString(t[1])||(A.strict||10!=t[1].length?t[1]=T["date-time"].toICAL(t[1]):t[1]=T.date.toICAL(t[1])),t.join("/")},decorate:function(t,r){return e.Period.fromJSON(t,r,!A.strict)},undecorate:function(t){return t.toJSON()}},recur:{fromICAL:function(t){return e.Recur._stringToData(t,!0)},toICAL:function(t){var r="";for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var i=t[n];"until"==n?i=i.length>10?T["date-time"].toICAL(i):T.date.toICAL(i):"wkst"==n?"number"==typeof i&&(i=e.Recur.numericDayToIcalDay(i)):Array.isArray(i)&&(i=i.join(",")),r+=n.toUpperCase()+"="+i+";"}return r.substr(0,r.length-1)},decorate:function(t){return e.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}}}),v=e.helpers.extend(p,{action:i,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:i,class:i,comment:i,completed:h,contact:i,created:h,description:i,dtend:u,dtstamp:h,dtstart:u,due:u,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:d,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":h,location:i,method:i,organizer:{defaultType:"cal-address"},"percent-complete":o,priority:o,prodid:i,"related-to":i,repeat:o,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":u,resources:s,"request-status":a,rrule:d,sequence:o,status:i,summary:i,transp:i,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:l,tzoffsetto:l,tzurl:c,tzid:i,tzname:i}),g=e.helpers.extend(y,{text:n(t,r),uri:n(t,r),date:{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString(t,"date")},undecorate:function(t){return t.toString()},fromICAL:function(t){return 8==t.length?T.date.fromICAL(t):"-"==t[0]&&6==t.length?t.substr(0,4)+"-"+t.substr(4):t},toICAL:function(t){return 10==t.length?T.date.toICAL(t):"-"==t[0]&&7==t.length?t.substr(0,4)+t.substr(5):t}},time:{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString("T"+t,"time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=g.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=g.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,s=t.length-(e?5:6),a=t[s];return"Z"==t[i]?(r=t[i],n=t.substr(0,i)):t.length>6&&("-"==a||"+"==a)?(r=t.substr(s),n=t.substr(0,s)):(r="",n=t),[r,n]}},"date-time":{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString(t,"date-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){return g["date-and-or-time"].fromICAL(t)},toICAL:function(t){return g["date-and-or-time"].toICAL(t)}},"date-and-or-time":{decorate:function(t){return e.VCardTime.fromDateAndOrTimeString(t,"date-and-or-time")},undecorate:function(t){return t.toString()},fromICAL:function(t){var e=t.split("T");return(e[0]?g.date.fromICAL(e[0]):"")+(e[1]?"T"+g.time.fromICAL(e[1]):"")},toICAL:function(t){var e=t.split("T");return g.date.toICAL(e[0])+(e[1]?"T"+g.time.toICAL(e[1]):"")}},timestamp:T["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/}}),_=e.helpers.extend(p,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:f,bday:f,caladruri:c,caluri:c,clientpidmap:a,email:i,fburl:c,fn:i,gender:a,geo:c,impp:c,key:c,kind:i,lang:{defaultType:"language-tag"},logo:c,member:c,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:s,note:i,org:{defaultType:"text",structuredValue:";"},photo:c,related:c,rev:{defaultType:"timestamp"},role:i,sound:c,source:c,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:i,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:i}),D=e.helpers.extend(y,{binary:T.binary,date:g.date,"date-time":g["date-time"],"phone-number":{},uri:T.uri,text:T.text,time:T.time,vcard:T.text,"utc-offset":{toICAL:function(t){return t.substr(0,7)},fromICAL:function(t){return t.substr(0,7)},decorate:function(t){return e.UtcOffset.fromString(t)},undecorate:function(t){return t.toString()}}}),b=e.helpers.extend(p,{fn:i,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:s,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:i,tel:{defaultType:"phone-number"},email:i,mailer:i,tz:{defaultType:"utc-offset",allowedTypes:["utc-offset","text"]},geo:{defaultType:"float",structuredValue:";"},title:i,role:i,logo:{defaultType:"binary",allowedTypes:["binary","uri"]},agent:{defaultType:"vcard",allowedTypes:["vcard","text","uri"]},org:a,note:s,prodid:i,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(t){return-1===t.indexOf("T")?"date":"date-time"}},"sort-string":i,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:i,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),Y={value:T,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:["THISANDFUTURE"]},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:v},O={value:g,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:_},w={value:D,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:b},A={strict:!0,defaultSet:Y,defaultType:"unknown",components:{vcard:O,vcard3:w,vevent:Y,vtodo:Y,vjournal:Y,valarm:Y,vtimezone:Y,daylight:Y,standard:Y},icalendar:Y,vcard:O,vcard3:w,getDesignSet:function(t){return t&&t in A.components?A.components[t]:A.defaultSet}};return A}(),e.stringify=function(){"use strict";var t="\r\n",r="unknown",n=e.design,i=e.helpers;function s(e){"string"==typeof e[0]&&(e=[e]);for(var r=0,n=e.length,i="";r<n;r++)i+=s.component(e[r])+t;return i}s.component=function(e,r){var i=e[0].toUpperCase(),a="BEGIN:"+i+t,o=e[1],u=0,h=o.length,c=e[0];for("vcard"===c&&e[1].length>0&&("version"!==e[1][0][0]||"4.0"!==e[1][0][3])&&(c="vcard3"),r=r||n.getDesignSet(c);u<h;u++)a+=s.property(o[u],r)+t;for(var l=e[2]||[],d=0,f=l.length;d<f;d++)a+=s.component(l[d],r)+t;return a+"END:"+i},s.property=function(t,i,a){var o,u=t[0].toUpperCase(),h=t[0],c=t[1],l=u;for(o in c){var d=c[o];c.hasOwnProperty(o)&&((p=o in i.param&&i.param[o].multiValue)&&Array.isArray(d)?(i.param[o].multiValueSeparateDQuote&&(p='"'+p+'"'),d=d.map(s._rfc6868Unescape),d=s.multiValue(d,p,"unknown",null,i)):d=s._rfc6868Unescape(d),l+=";"+o.toUpperCase(),l+="="+s.propertyValue(d))}if(3===t.length)return l+":";var f,m=t[2];i||(i=n.defaultSet);var p=!1,y=!1,T=!1;return h in i.property?("multiValue"in(f=i.property[h])&&(p=f.multiValue),"structuredValue"in f&&Array.isArray(t[3])&&(y=f.structuredValue),"defaultType"in f?m===f.defaultType&&(T=!0):m===r&&(T=!0)):m===r&&(T=!0),T||(l+=";VALUE="+m.toUpperCase()),l+=":",l+=p&&y?s.multiValue(t[3],y,m,p,i,y):p?s.multiValue(t.slice(3),p,m,null,i,!1):y?s.multiValue(t[3],y,m,null,i,y):s.value(t[3],m,i,!1),a?l:e.helpers.foldline(l)},s.propertyValue=function(t){return-1===i.unescapedIndexOf(t,",")&&-1===i.unescapedIndexOf(t,":")&&-1===i.unescapedIndexOf(t,";")?t:'"'+t+'"'},s.multiValue=function(t,e,r,n,i,a){for(var o="",u=t.length,h=0;h<u;h++)n&&Array.isArray(t[h])?o+=s.multiValue(t[h],n,r,null,i,a):o+=s.value(t[h],r,i,a),h!==u-1&&(o+=e);return o},s.value=function(t,e,r,n){return e in r.value&&"toICAL"in r.value[e]?r.value[e].toICAL(t,n):t},s._rfc6868Unescape=function(t){return t.replace(/[\n^"]/g,(function(t){return a[t]}))};var a={'"':"^'","\n":"^n","^":"^^"};return s}(),e.parse=function(){"use strict";var t=/[^ \t]/,r=e.design,n=e.helpers;function i(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 s(t){var e={},r=e.component=[];if(e.stack=[r],s._eachLine(t,(function(t,r){s._handleContentLine(r,e)})),e.stack.length>1)throw new i("invalid ical body. component began but did not end");return e=null,1==r.length?r[0]:r}i.prototype=Error.prototype,s.property=function(t,e){var n={component:[[],[]],designSet:e||r.defaultSet};return s._handleContentLine(t,n),n.component[1][0]},s.component=function(t){return s(t)},s.ParserError=i,s._handleContentLine=function(t,e){var n,a,o,u,h,c,l=t.indexOf(":"),d=t.indexOf(";"),f={};if(-1!==d&&-1!==l&&d>l&&(d=-1),-1!==d){if(o=t.substring(0,d).toLowerCase(),-1==(h=s._parseParameters(t.substring(d),0,e.designSet))[2])throw new i("Invalid parameters in '"+t+"'");if(f=h[0],n=h[1].length+h[2]+d,-1===(a=t.substring(n).indexOf(":")))throw new i("Missing parameter value in '"+t+"'");u=t.substring(n+a+1)}else{if(-1===l)throw new i('invalid line (no token ";" or ":") "'+t+'"');if(o=t.substring(0,l).toLowerCase(),u=t.substring(l+1),"begin"===o){var m=[u.toLowerCase(),[],[]];return 1===e.stack.length?e.component.push(m):e.component[2].push(m),e.stack.push(e.component),e.component=m,void(e.designSet||(e.designSet=r.getDesignSet(e.component[0])))}if("end"===o)return void(e.component=e.stack.pop())}var p,y,T=!1,v=!1;o in e.designSet.property&&("multiValue"in(p=e.designSet.property[o])&&(T=p.multiValue),"structuredValue"in p&&(v=p.structuredValue),u&&"detectType"in p&&(c=p.detectType(u))),c||(c="value"in f?f.value.toLowerCase():p?p.defaultType:"unknown"),delete f.value,T&&v?y=[o,f,c,u=s._parseMultiValue(u,v,c,[],T,e.designSet,v)]:T?(y=[o,f,c],s._parseMultiValue(u,T,c,y,null,e.designSet,!1)):y=v?[o,f,c,u=s._parseMultiValue(u,v,c,[],null,e.designSet,v)]:[o,f,c,u=s._parseValue(u,c,e.designSet,!1)],"vcard"!==e.component[0]||0!==e.component[1].length||"version"===o&&"4.0"===u||(e.designSet=r.getDesignSet("vcard3")),e.component[1].push(y)},s._parseValue=function(t,e,r,n){return e in r.value&&"fromICAL"in r.value[e]?r.value[e].fromICAL(t,n):t},s._parseParameters=function(t,e,r){for(var a,o,u,h,c,l,d=e,f=0,m={},p=-1;!1!==f&&-1!==(f=n.unescapedIndexOf(t,"=",f+1));){if(0==(a=t.substr(d+1,f-d-1)).length)throw new i("Empty parameter name in '"+t+"'");if(l=!1,c=!1,h=(o=a.toLowerCase())in r.param&&r.param[o].valueType?r.param[o].valueType:"text",o in r.param&&(c=r.param[o].multiValue,r.param[o].multiValueSeparateDQuote&&(l=s._rfc6868Escape('"'+c+'"'))),'"'===t[f+1]){if(p=f+2,f=n.unescapedIndexOf(t,'"',p),c&&-1!=f)for(var y=!0;y;)t[f+1]==c&&'"'==t[f+2]?f=n.unescapedIndexOf(t,'"',f+3):y=!1;if(-1===f)throw new i('invalid line (no matching double quote) "'+t+'"');u=t.substr(p,f-p),-1===(d=n.unescapedIndexOf(t,";",f))&&(f=!1)}else{p=f+1;var T=n.unescapedIndexOf(t,";",p),v=n.unescapedIndexOf(t,":",p);-1!==v&&T>v?(T=v,f=!1):-1===T?(T=-1===v?t.length:v,f=!1):(d=T,f=T),u=t.substr(p,T-p)}if(u=s._rfc6868Escape(u),c){var g=l||c;u=s._parseMultiValue(u,g,h,[],null,r)}else u=s._parseValue(u,h,r);c&&o in m?Array.isArray(m[o])?m[o].push(u):m[o]=[m[o],u]:m[o]=u}return[m,u,p]},s._rfc6868Escape=function(t){return t.replace(/\^['n^]/g,(function(t){return a[t]}))};var a={"^'":'"',"^n":"\n","^^":"^"};return s._parseMultiValue=function(t,e,r,i,a,o,u){var h,c=0,l=0;if(0===e.length)return t;for(;-1!==(c=n.unescapedIndexOf(t,e,l));)h=t.substr(l,c-l),h=a?s._parseMultiValue(h,a,r,[],null,o,u):s._parseValue(h,r,o,u),i.push(h),l=c+e.length;return h=t.substr(l),h=a?s._parseMultiValue(h,a,r,[],null,o,u):s._parseValue(h,r,o,u),i.push(h),1==i.length?i[0]:i},s._eachLine=function(e,r){var n,i,s,a=e.length,o=e.search(t),u=o;do{s=(u=e.indexOf("\n",o)+1)>1&&"\r"===e[u-2]?2:1,0===u&&(u=a,s=0)," "===(i=e[o])||"\t"===i?n+=e.substr(o+1,u-o-(s+1)):(n&&r(null,n),n=e.substr(o,u-o-s)),o=u}while(u!==a);(n=n.trim()).length&&r(null,n)},s}(),e.Component=function(){"use strict";function t(t,e){"string"==typeof t&&(t=[t,[],[]]),this.jCal=t,this.parent=e||null}return t.prototype={_hydratedPropertyCount:0,_hydratedComponentCount:0,get name(){return this.jCal[0]},get _designSet(){return this.parent&&this.parent._designSet||e.design.getDesignSet(this.name)},_hydrateComponent:function(e){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[e])return this._components[e];var r=new t(this.jCal[2][e],this);return this._hydratedComponentCount++,this._components[e]=r},_hydrateProperty:function(t){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[t])return this._properties[t];var r=new e.Property(this.jCal[1][t],this);return this._hydratedPropertyCount++,this._properties[t]=r},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],s=i.length,a=this[e];if("string"==typeof r){for(;n<s;n++)if(i[n][0]===r)return this._removeObjectByIndex(t,a,n),!0}else if(a)for(;n<s;n++)if(a[n]&&a[n]===r)return this._removeObjectByIndex(t,a,n),!0;return!1},_removeAllObjects:function(t,e,r){for(var n=this[e],i=this.jCal[t],s=i.length-1;s>=0;s--)r&&i[s][0]!==r||this._removeObjectByIndex(t,n,s)},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 e.Property))throw new TypeError("must instance of ICAL.Property");this._properties||(this._properties=[],this._hydratedPropertyCount=0),t.parent&&t.parent.removeProperty(t);var r=this.jCal[1].push(t.jCal);return this._properties[r-1]=t,this._hydratedPropertyCount++,t.parent=this,t},addPropertyWithValue:function(t,r){var n=new e.Property(t);return n.setValue(r),this.addProperty(n),n},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 e.stringify.component(this.jCal,this._designSet)}},t.fromString=function(r){return new t(e.parse.component(r))},t}(),e.Property=function(){"use strict";var t=e.design;function r(e,r){this._parent=r||null,"string"==typeof e?(this.jCal=[e,{},t.defaultType],this.jCal[2]=this.getDefaultType()):this.jCal=e,this._updateType()}return r.prototype={get type(){return this.jCal[2]},get name(){return this.jCal[0]},get parent(){return this._parent},set parent(e){var r=!this._parent||e&&e._designSet!=this._parent._designSet;return this._parent=e,this.type==t.defaultType&&r&&(this.jCal[2]=this.getDefaultType(),this._updateType()),e},get _designSet(){return this.parent?this.parent._designSet:t.defaultSet},_updateType:function(){var t=this._designSet;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 e=this.jCal[0],r=this._designSet;if(e in r.property){var n=r.property[e];if("defaultType"in n)return n.defaultType}return t.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(),e>0&&"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 e.stringify.property(this.jCal,this._designSet,!0)}},r.fromString=function(t,n){return new r(e.parse.property(t,n))},r}(),e.UtcOffset=function(){function t(t){this.fromData(t)}return t.prototype={hours:0,minutes:0,factor:1,icaltype:"utc-offset",clone:function(){return e.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 r=Math.abs(t);return this.factor=t<0?-1:1,this.hours=e.helpers.trunc(r/3600),r-=3600*this.hours,this.minutes=e.helpers.trunc(r/60),this},toSeconds:function(){return this.factor*(60*this.minutes+3600*this.hours)},compare:function(t){var e=this.toSeconds(),r=t.toSeconds();return(e>r)-(r>e)},_normalize:function(){for(var t=this.toSeconds(),e=this.factor;t<-43200;)t+=97200;for(;t>50400;)t-=97200;this.fromSeconds(t),0==t&&(this.factor=e)},toICALString:function(){return e.design.icalendar.value["utc-offset"].toICAL(this.toString())},toString:function(){return(1==this.factor?"+":"-")+e.helpers.pad2(this.hours)+":"+e.helpers.pad2(this.minutes)}},t.fromString=function(t){var r={};return r.factor="+"===t[0]?1:-1,r.hours=e.helpers.strictParseInt(t.substr(1,2)),r.minutes=e.helpers.strictParseInt(t.substr(4,2)),new e.UtcOffset(r)},t.fromSeconds=function(e){var r=new t;return r.fromSeconds(e),r},t}(),e.Binary=function(){function t(t){this.value=t}return t.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,s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=0,u=0,h="",c=[];if(!t)return t;do{e=(s=t.charCodeAt(o++)<<16|t.charCodeAt(o++)<<8|t.charCodeAt(o++))>>18&63,r=s>>12&63,n=s>>6&63,i=63&s,c[u++]=a.charAt(e)+a.charAt(r)+a.charAt(n)+a.charAt(i)}while(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,s,a,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=0,h=0,c=[];if(!t)return t;t+="";do{e=(a=o.indexOf(t.charAt(u++))<<18|o.indexOf(t.charAt(u++))<<12|(i=o.indexOf(t.charAt(u++)))<<6|(s=o.indexOf(t.charAt(u++))))>>16&255,r=a>>8&255,n=255&a,c[h++]=64==i?String.fromCharCode(e):64==s?String.fromCharCode(e,r):String.fromCharCode(e,r,n)}while(u<t.length);return c.join("")},toString:function(){return this.value}},t.fromString=function(e){return new t(e)},t}(),e.Period=function(t){if(this.wrappedJSObject=this,t&&"start"in t){if(t.start&&!(t.start instanceof e.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 e.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 e.Duration))throw new TypeError(".duration must be an instance of ICAL.Duration");this.duration=t.duration}},e.Period.prototype={start:null,end:null,duration:null,icalclass:"icalperiod",icaltype:"period",clone:function(){return e.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()}},e.Period.fromString=function(t,r){var n=t.split("/");if(2!==n.length)throw new Error('Invalid string value: "'+t+'" must contain a "/" char.');var i={start:e.Time.fromDateTimeString(n[0],r)},s=n[1];return e.Duration.isValueString(s)?i.duration=e.Duration.fromString(s):i.end=e.Time.fromDateTimeString(s,r),new e.Period(i)},e.Period.fromData=function(t){return new e.Period(t)},e.Period.fromJSON=function(t,r,n){function i(t,r){return n?e.Time.fromString(t,r):e.Time.fromDateTimeString(t,r)}return e.Duration.isValueString(t[1])?e.Period.fromData({start:i(t[0],r),duration:e.Duration.fromString(t[1])}):e.Period.fromData({start:i(t[0],r),end:i(t[1],r)})},function(){var t=/([PDWHMTS]{1,1})/;function r(t,r,n){var i;switch(t){case"P":n.isNegative=!(!r||"-"!==r);break;case"D":i="days";break;case"W":i="weeks";break;case"H":i="hours";break;case"M":i="minutes";break;case"S":i="seconds";break;default:return 0}if(i){if(!r&&0!==r)throw new Error('invalid duration value: Missing number before "'+t+'"');var s=parseInt(r,10);if(e.helpers.isStrictlyNaN(s))throw new Error('invalid duration value: Invalid number "'+r+'" before "'+t+'"');n[i]=s}return 1}e.Duration=function(t){this.wrappedJSObject=this,this.fromData(t)},e.Duration.prototype={weeks:0,days:0,hours:0,minutes:0,seconds:0,isNegative:!1,icalclass:"icalduration",icaltype:"duration",clone:function(){return e.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 r=Math.abs(t);return this.isNegative=t<0,this.days=e.helpers.trunc(r/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,r-=86400*(this.days+7*this.weeks),this.hours=e.helpers.trunc(r/3600),r-=3600*this.hours,this.minutes=e.helpers.trunc(r/60),r-=60*this.minutes,this.seconds=r,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(e>r)-(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()}},e.Duration.fromSeconds=function(t){return(new e.Duration).fromSeconds(t)},e.Duration.isValueString=function(t){return"P"===t[0]||"P"===t[1]},e.Duration.fromString=function(n){for(var i=0,s=Object.create(null),a=0;-1!==(i=n.search(t));){var o=n[i],u=n.substr(0,i);n=n.substr(i+1),a+=r(o,u,s)}if(a<2)throw new Error('invalid duration value: Not enough duration components in "'+n+'"');return new e.Duration(s)},e.Duration.fromData=function(t){return new e.Duration(t)}}(),r=["tzid","location","tznames","latitude","longitude"],e.Timezone=function(t){this.wrappedJSObject=this,this.fromData(t)},e.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 e.Component)this.component=t;else{if(t&&"component"in t)if("string"==typeof t.component){var n=e.parse(t.component);this.component=new e.Component(n)}else t.component instanceof e.Component?this.component=t.component:this.component=null;for(var i in r)if(r.hasOwnProperty(i)){var s=r[i];t&&s in t&&(this[s]=t[s])}}return this.component instanceof e.Component&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this},utcOffset:function(t){if(this==e.Timezone.utcTimezone||this==e.Timezone.localTimezone)return 0;if(this._ensureCoverage(t.year),!this.changes.length)return 0;for(var r={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},n=this._findNearbyChange(r),i=-1,s=1;;){var a=e.helpers.clone(this.changes[n],!0);if(a.utcOffset<a.prevUtcOffset?e.Timezone.adjust_change(a,0,0,0,a.utcOffset):e.Timezone.adjust_change(a,0,0,0,a.prevUtcOffset),e.Timezone._compare_change_fn(r,a)>=0?i=n:s=-1,-1==s&&-1!=i)break;if((n+=s)<0)return 0;if(n>=this.changes.length)break}var o=this.changes[i];if(o.utcOffset-o.prevUtcOffset<0&&i>0){var u=e.helpers.clone(o,!0);if(e.Timezone.adjust_change(u,0,0,0,u.prevUtcOffset),e.Timezone._compare_change_fn(r,u)<0){var h=this.changes[i-1];0!=o.is_daylight&&0==h.is_daylight&&(o=h)}}return o.utcOffset},_findNearbyChange:function(t){var r=e.helpers.binsearchInsert(this.changes,t,e.Timezone._compare_change_fn);return r>=this.changes.length?this.changes.length-1:r},_ensureCoverage:function(t){if(-1==e.Timezone._minimumExpansionYear){var r=e.Time.now();e.Timezone._minimumExpansionYear=r.year}var n=t;if(n<e.Timezone._minimumExpansionYear&&(n=e.Timezone._minimumExpansionYear),(n+=e.Timezone.EXTRA_COVERAGE)>e.Timezone.MAX_YEAR&&(n=e.Timezone.MAX_YEAR),!this.changes.length||this.expandedUntilYear<t){for(var i=this.component.getAllSubcomponents(),s=i.length,a=0;a<s;a++)this._expandComponent(i[a],n,this.changes);this.changes.sort(e.Timezone._compare_change_fn),this.expandedUntilYear=n}},_expandComponent:function(t,r,n){if(!t.hasProperty("dtstart")||!t.hasProperty("tzoffsetto")||!t.hasProperty("tzoffsetfrom"))return null;var i,s=t.getFirstProperty("dtstart").getFirstValue();function a(t){return t.factor*(3600*t.hours+60*t.minutes)}function o(){var e={};return e.is_daylight="daylight"==t.name,e.utcOffset=a(t.getFirstProperty("tzoffsetto").getFirstValue()),e.prevUtcOffset=a(t.getFirstProperty("tzoffsetfrom").getFirstValue()),e}if(t.hasProperty("rrule")||t.hasProperty("rdate")){var u=t.getAllProperties("rdate");for(var h in u)if(u.hasOwnProperty(h)){var c=u[h].getFirstValue();(i=o()).year=c.year,i.month=c.month,i.day=c.day,c.isDate?(i.hour=s.hour,i.minute=s.minute,i.second=s.second,s.zone!=e.Timezone.utcTimezone&&e.Timezone.adjust_change(i,0,0,0,-i.prevUtcOffset)):(i.hour=c.hour,i.minute=c.minute,i.second=c.second,c.zone!=e.Timezone.utcTimezone&&e.Timezone.adjust_change(i,0,0,0,-i.prevUtcOffset)),n.push(i)}var l=t.getFirstProperty("rrule");if(l){l=l.getFirstValue(),i=o(),l.until&&l.until.zone==e.Timezone.utcTimezone&&(l.until.adjust(0,0,0,i.prevUtcOffset),l.until.zone=e.Timezone.localTimezone);for(var d,f=l.iterator(s);(d=f.next())&&(i=o(),!(d.year>r)&&d);)i.year=d.year,i.month=d.month,i.day=d.day,i.hour=d.hour,i.minute=d.minute,i.second=d.second,i.isDate=d.isDate,e.Timezone.adjust_change(i,0,0,0,-i.prevUtcOffset),n.push(i)}}else(i=o()).year=s.year,i.month=s.month,i.day=s.day,i.hour=s.hour,i.minute=s.minute,i.second=s.second,e.Timezone.adjust_change(i,0,0,0,-i.prevUtcOffset),n.push(i);return n},toString:function(){return this.tznames?this.tznames:this.tzid}},e.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},e.Timezone.convert_time=function(t,r,n){if(t.isDate||r.tzid==n.tzid||r==e.Timezone.localTimezone||n==e.Timezone.localTimezone)return t.zone=n,t;var i=r.utcOffset(t);return t.adjust(0,0,0,-i),i=n.utcOffset(t),t.adjust(0,0,0,i),null},e.Timezone.fromData=function(t){return(new e.Timezone).fromData(t)},e.Timezone.utcTimezone=e.Timezone.fromData({tzid:"UTC"}),e.Timezone.localTimezone=e.Timezone.fromData({tzid:"floating"}),e.Timezone.adjust_change=function(t,r,n,i,s){return e.Time.prototype.adjust.call(t,r,n,i,s,t)},e.Timezone._minimumExpansionYear=-1,e.Timezone.MAX_YEAR=2035,e.Timezone.EXTRA_COVERAGE=5,e.TimezoneService=((i={get count(){return Object.keys(n).length},reset:function(){n=Object.create(null);var t=e.Timezone.utcTimezone;n.Z=t,n.UTC=t,n.GMT=t},has:function(t){return!!n[t]},get:function(t){return n[t]},register:function(t,r){if(t instanceof e.Component&&"vtimezone"===t.name&&(t=(r=new e.Timezone(t)).tzid),!(r instanceof e.Timezone))throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component");n[t]=r},remove:function(t){return delete n[t]}}).reset(),i),e.Time=function(t,e){this.wrappedJSObject=this;var r=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)},e.Time._dowCache={},e.Time._wnCache={},e.Time.prototype={icalclass:"icaltime",_cachedUnixTime:null,get icaltype(){return this.isDate?"date":"date-time"},zone:null,_pendingNormalization:!1,clone:function(){return new e.Time(this._time,this.zone)},reset:function(){this.fromData(e.Time.epochTime),this.zone=e.Timezone.utcTimezone},resetTo:function(t,e,r,n,i,s,a){this.fromData({year:t,month:e,day:r,hour:n,minute:i,second:s,zone:a})},fromJSDate:function(t,r){return t?r?(this.zone=e.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=e.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,r){if(t)for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){if("icaltype"===n)continue;this[n]=t[n]}if(r&&(this.zone=r),t&&!("isDate"in t)?this.isDate=!("hour"in t):t&&"isDate"in t&&(this.isDate=t.isDate),t&&"timezone"in t){var i=e.TimezoneService.get(t.timezone);this.zone=i||e.Timezone.localTimezone}return t&&"zone"in t&&(this.zone=t.zone),this.zone||(this.zone=e.Timezone.localTimezone),this._cachedUnixTime=null,this},dayOfWeek:function(t){var r=t||e.Time.SUNDAY,n=(this.year<<12)+(this.month<<8)+(this.day<<3)+r;if(n in e.Time._dowCache)return e.Time._dowCache[n];var i=this.day,s=this.month+(this.month<3?12:0),a=this.year-(this.month<3?1:0),o=i+a+e.helpers.trunc(26*(s+1)/10)+e.helpers.trunc(a/4);return o=((o+=6*e.helpers.trunc(a/100)+e.helpers.trunc(a/400))+7-r)%7+1,e.Time._dowCache[n]=o,o},dayOfYear:function(){var t=e.Time.isLeapYear(this.year)?1:0;return e.Time.daysInYearPassedMonth[t][this.month-1]+this.day},startOfWeek:function(t){var r=t||e.Time.SUNDAY,n=this.clone();return n.day-=(this.dayOfWeek()+7-r)%7,n.isDate=!0,n.hour=0,n.minute=0,n.second=0,n},endOfWeek:function(t){var r=t||e.Time.SUNDAY,n=this.clone();return n.day+=(7-this.dayOfWeek()+r-e.Time.SUNDAY)%7,n.isDate=!0,n.hour=0,n.minute=0,n.second=0,n},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=e.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 r=t||e.Time.SUNDAY,n=this.dayOfWeek()-r;return n<0&&(n+=7),this.dayOfYear()-n},getDominicalLetter:function(){return e.Time.getDominicalLetter(this.year)},nthWeekDay:function(t,r){var n,i=e.Time.daysInMonth(this.month,this.year),s=r,a=0,o=this.clone();if(s>=0){o.day=1,0!=s&&s--,a=o.day;var u=t-o.dayOfWeek();u<0&&(u+=7),a+=u,a-=t,n=t}else o.day=i,s++,(n=o.dayOfWeek()-t)<0&&(n+=7),n=i-n;return a+(n+7*s)},isNthWeekDay:function(t,e){var r=this.dayOfWeek();return 0===e&&r===t||this.nthWeekDay(t,e)===this.day},weekNumber:function(t){var r,n=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(n in e.Time._wnCache)return e.Time._wnCache[n];var i=this.clone();i.isDate=!0;var s=this.year;12==i.month&&i.day>25?(r=e.Time.weekOneStarts(s+1,t),i.compare(r)<0?r=e.Time.weekOneStarts(s,t):s++):(r=e.Time.weekOneStarts(s,t),i.compare(r)<0&&(r=e.Time.weekOneStarts(--s,t)));var a=i.subtractDate(r).toSeconds()/86400,o=e.helpers.trunc(a/7)+1;return e.Time._wnCache[n]=o,o},addDuration:function(t){var e=t.isNegative?-1:1,r=this.second,n=this.minute,i=this.hour,s=this.day;r+=e*t.seconds,n+=e*t.minutes,i+=e*t.hours,s+=e*t.days,s+=7*e*t.weeks,this.second=r,this.minute=n,this.hour=i,this.day=s,this._cachedUnixTime=null},subtractDate:function(t){var r=this.toUnixTime()+this.utcOffset(),n=t.toUnixTime()+t.utcOffset();return e.Duration.fromSeconds(r-n)},subtractDateTz:function(t){var r=this.toUnixTime(),n=t.toUnixTime();return e.Duration.fromSeconds(r-n)},compare:function(t){var e=this.toUnixTime(),r=t.toUnixTime();return e>r?1:r>e?-1:0},compareDateOnlyTz:function(t,r){function n(t){return e.Time._cmp_attr(i,s,t)}var i=this.convertToZone(r),s=t.convertToZone(r),a=0;return 0!=(a=n("year"))||0!=(a=n("month"))||(a=n("day")),a},convertToZone:function(t){var r=this.clone(),n=this.zone.tzid==t.tzid;return this.isDate||n||e.Timezone.convert_time(r,this.zone,t),r.zone=t,r},utcOffset:function(){return this.zone==e.Timezone.localTimezone||this.zone==e.Timezone.utcTimezone?0:this.zone.utcOffset(this)},toICALString:function(){var t=this.toString();return t.length>10?e.design.icalendar.value["date-time"].toICAL(t):e.design.icalendar.value.date.toICAL(t)},toString:function(){var t=this.year+"-"+e.helpers.pad2(this.month)+"-"+e.helpers.pad2(this.day);return this.isDate||(t+="T"+e.helpers.pad2(this.hour)+":"+e.helpers.pad2(this.minute)+":"+e.helpers.pad2(this.second),this.zone===e.Timezone.utcTimezone&&(t+="Z")),t},toJSDate:function(){return this.zone==e.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(){return this._time.isDate,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,r,n,i,s){var a,o,u,h,c,l,d,f=0,m=0,p=s||this._time;if(p.isDate||(u=p.second+i,p.second=u%60,a=e.helpers.trunc(u/60),p.second<0&&(p.second+=60,a--),h=p.minute+n+a,p.minute=h%60,o=e.helpers.trunc(h/60),p.minute<0&&(p.minute+=60,o--),c=p.hour+r+o,p.hour=c%24,f=e.helpers.trunc(c/24),p.hour<0&&(p.hour+=24,f--)),p.month>12?m=e.helpers.trunc((p.month-1)/12):p.month<1&&(m=e.helpers.trunc(p.month/12)-1),p.year+=m,p.month-=12*m,(l=p.day+t+f)>0)for(;!(l<=(d=e.Time.daysInMonth(p.month,p.year)));)p.month++,p.month>12&&(p.year++,p.month=1),l-=d;else for(;l<=0;)1==p.month?(p.year--,p.month=12):p.month--,l+=e.Time.daysInMonth(p.month,p.year);return p.day=l,this._cachedUnixTime=null,this},fromUnixTime:function(t){this.zone=e.Timezone.utcTimezone;var r=e.Time.epochTime.clone();r.adjust(0,0,0,t),this.year=r.year,this.month=r.month,this.day=r.day,this.hour=r.hour,this.minute=r.minute,this.second=Math.floor(r.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}},function(){function t(t){Object.defineProperty(e.Time.prototype,t,{get:function(){return this._pendingNormalization&&(this._normalize(),this._pendingNormalization=!1),this._time[t]},set:function(e){return"isDate"===t&&e&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[t]=e,e}})}"defineProperty"in Object&&(t("year"),t("month"),t("day"),t("hour"),t("minute"),t("second"),t("isDate"))}(),e.Time.daysInMonth=function(t,r){var n=30;return t<1||t>12||(n=[0,31,28,31,30,31,30,31,31,30,31,30,31][t],2==t&&(n+=e.Time.isLeapYear(r))),n},e.Time.isLeapYear=function(t){return t<=1752?t%4==0:t%4==0&&t%100!=0||t%400==0},e.Time.fromDayOfYear=function(t,r){var n=r,i=t,s=new e.Time;s.auto_normalize=!1;var a=e.Time.isLeapYear(n)?1:0;if(i<1)return n--,a=e.Time.isLeapYear(n)?1:0,i+=e.Time.daysInYearPassedMonth[a][12],e.Time.fromDayOfYear(i,n);if(i>e.Time.daysInYearPassedMonth[a][12])return a=e.Time.isLeapYear(n)?1:0,i-=e.Time.daysInYearPassedMonth[a][12],n++,e.Time.fromDayOfYear(i,n);s.year=n,s.isDate=!0;for(var o=11;o>=0;o--)if(i>e.Time.daysInYearPassedMonth[a][o]){s.month=o+1,s.day=i-e.Time.daysInYearPassedMonth[a][o];break}return s.auto_normalize=!0,s},e.Time.fromStringv2=function(t){return new e.Time({year:parseInt(t.substr(0,4),10),month:parseInt(t.substr(5,2),10),day:parseInt(t.substr(8,2),10),isDate:!0})},e.Time.fromDateString=function(t){return new e.Time({year:e.helpers.strictParseInt(t.substr(0,4)),month:e.helpers.strictParseInt(t.substr(5,2)),day:e.helpers.strictParseInt(t.substr(8,2)),isDate:!0})},e.Time.fromDateTimeString=function(t,r){if(t.length<19)throw new Error('invalid date-time value: "'+t+'"');var n;return t[19]&&"Z"===t[19]?n="Z":r&&(n=r.getParameter("tzid")),new e.Time({year:e.helpers.strictParseInt(t.substr(0,4)),month:e.helpers.strictParseInt(t.substr(5,2)),day:e.helpers.strictParseInt(t.substr(8,2)),hour:e.helpers.strictParseInt(t.substr(11,2)),minute:e.helpers.strictParseInt(t.substr(14,2)),second:e.helpers.strictParseInt(t.substr(17,2)),timezone:n})},e.Time.fromString=function(t,r){return t.length>10?e.Time.fromDateTimeString(t,r):e.Time.fromDateString(t)},e.Time.fromJSDate=function(t,r){return(new e.Time).fromJSDate(t,r)},e.Time.fromData=function(t,r){return(new e.Time).fromData(t,r)},e.Time.now=function(){return e.Time.fromJSDate(new Date,!1)},e.Time.weekOneStarts=function(t,r){var n=e.Time.fromData({year:t,month:1,day:1,isDate:!0}),i=n.dayOfWeek(),s=r||e.Time.DEFAULT_WEEK_START;return i>e.Time.THURSDAY&&(n.day+=7),s>e.Time.THURSDAY&&(n.day-=7),n.day-=i-s,n},e.Time.getDominicalLetter=function(t){var r="GFEDCBA",n=(t+(t/4|0)+(t/400|0)-(t/100|0)-1)%7;return e.Time.isLeapYear(t)?r[(n+6)%7]+r[n]:r[n]},e.Time.epochTime=e.Time.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}),e.Time._cmp_attr=function(t,e,r){return t[r]>e[r]?1:t[r]<e[r]?-1:0},e.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]],e.Time.SUNDAY=1,e.Time.MONDAY=2,e.Time.TUESDAY=3,e.Time.WEDNESDAY=4,e.Time.THURSDAY=5,e.Time.FRIDAY=6,e.Time.SATURDAY=7,e.Time.DEFAULT_WEEK_START=e.Time.MONDAY,e.VCardTime=function(t,e,r){this.wrappedJSObject=this;var n=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)},e.helpers.inherits(e.Time,e.VCardTime,{icalclass:"vcardtime",icaltype:"date-and-or-time",zone:null,clone:function(){return new e.VCardTime(this._time,this.zone,this.icaltype)},_normalize:function(){return this},utcOffset:function(){return this.zone instanceof e.UtcOffset?this.zone.toSeconds():e.Time.prototype.utcOffset.apply(this,arguments)},toICALString:function(){return e.design.vcard.value[this.icaltype].toICAL(this.toString())},toString:function(){var t,r=e.helpers.pad2,n=this.year,i=this.month,s=this.day,a=this.hour,o=this.minute,u=this.second,h=null!==i,c=null!==s,l=null!==a,d=null!==o,f=null!==u,m=(null!==n?r(n)+(h||c?"-":""):h||c?"--":"")+(h?r(i):"")+(c?"-"+r(s):""),p=(l?r(a):"-")+(l&&d?":":"")+(d?r(o):"")+(l||d?"":"-")+(d&&f?":":"")+(f?r(u):"");switch(t=this.zone===e.Timezone.utcTimezone?"Z":this.zone instanceof e.UtcOffset?this.zone.toString():this.zone===e.Timezone.localTimezone?"":this.zone instanceof e.Timezone?e.UtcOffset.fromSeconds(this.zone.utcOffset(this)).toString():"",this.icaltype){case"time":return p+t;case"date-and-or-time":case"date-time":return m+("--"==p?"":"T"+p+t);case"date":return m}return null}}),e.VCardTime.fromDateAndOrTimeString=function(t,r){function n(t,r,n){return t?e.helpers.strictParseInt(t.substr(r,n)):null}var i=t.split("T"),s=i[0],a=i[1],o=a?e.design.vcard.value.time._splitZone(a):[],u=o[0],h=o[1],c=(e.helpers.strictParseInt,s?s.length:0),l=h?h.length:0,d=s&&"-"==s[0]&&"-"==s[1],f=h&&"-"==h[0],m={year:d?null:n(s,0,4),month:!d||4!=c&&7!=c?7==c||10==c?n(s,5,2):null:n(s,2,2),day:5==c?n(s,3,2):7==c&&d?n(s,5,2):10==c?n(s,8,2):null,hour:f?null:n(h,0,2),minute:f&&3==l?n(h,1,2):l>4?n(h,f?1:3,2):null,second:4==l?n(h,2,2):6==l?n(h,4,2):8==l?n(h,6,2):null};return u="Z"==u?e.Timezone.utcTimezone:u&&":"==u[3]?e.UtcOffset.fromString(u):null,new e.VCardTime(m,u,r)},function(){var t={SU:e.Time.SUNDAY,MO:e.Time.MONDAY,TU:e.Time.TUESDAY,WE:e.Time.WEDNESDAY,TH:e.Time.THURSDAY,FR:e.Time.FRIDAY,SA:e.Time.SATURDAY},r={};for(var n in t)t.hasOwnProperty(n)&&(r[t[n]]=n);function i(t,r,n,i){var s=i;if("+"===i[0]&&(s=i.substr(1)),s=e.helpers.strictParseInt(s),void 0!==r&&i<r)throw new Error(t+': invalid value "'+i+'" must be > '+r);if(void 0!==n&&i>n)throw new Error(t+': invalid value "'+i+'" must be < '+r);return s}e.Recur=function(t){this.wrappedJSObject=this,this.parts={},t&&"object"==typeof t&&this.fromData(t)},e.Recur.prototype={parts:null,interval:1,wkst:e.Time.MONDAY,until:null,count:null,freq:null,icalclass:"icalrecur",icaltype:"recur",iterator:function(t){return new e.RecurIterator({rule:this,dtstart:t})},clone:function(){return new e.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){var r,n=this.iterator(t);do{r=n.next()}while(r&&r.compare(e)<=0);return r&&e.zone&&(r.zone=e.zone),r},fromData:function(t){for(var r in t){var n=r.toUpperCase();n in h?Array.isArray(t[r])?this.parts[n]=t[r]:this.parts[n]=[t[r]]:this[r]=t[r]}this.interval&&"number"!=typeof this.interval&&u.INTERVAL(this.interval,this),this.wkst&&"number"!=typeof this.wkst&&(this.wkst=e.Recur.icalDayToNumericDay(this.wkst)),!this.until||this.until instanceof e.Time||(this.until=e.Time.fromString(this.until))},toJSON:function(){var t=Object.create(null);for(var r in t.freq=this.freq,this.count&&(t.count=this.count),this.interval>1&&(t.interval=this.interval),this.parts)if(this.parts.hasOwnProperty(r)){var n=this.parts[r];Array.isArray(n)&&1==n.length?t[r.toLowerCase()]=n[0]:t[r.toLowerCase()]=e.helpers.clone(this.parts[r])}return this.until&&(t.until=this.until.toString()),"wkst"in this&&this.wkst!==e.Time.DEFAULT_WEEK_START&&(t.wkst=e.Recur.numericDayToIcalDay(this.wkst)),t},toString:function(){var t="FREQ="+this.freq;for(var r in this.count&&(t+=";COUNT="+this.count),this.interval>1&&(t+=";INTERVAL="+this.interval),this.parts)this.parts.hasOwnProperty(r)&&(t+=";"+r+"="+this.parts[r]);return this.until&&(t+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==e.Time.DEFAULT_WEEK_START&&(t+=";WKST="+e.Recur.numericDayToIcalDay(this.wkst)),t}},e.Recur.icalDayToNumericDay=function(r,n){var i=n||e.Time.SUNDAY;return(t[r]-i+7)%7+1},e.Recur.numericDayToIcalDay=function(t,n){var i=t+(n||e.Time.SUNDAY)-e.Time.SUNDAY;return i>7&&(i-=7),r[i]};var s=/^(SU|MO|TU|WE|TH|FR|SA)$/,a=/^([+-])?(5[0-3]|[1-4][0-9]|[1-9])?(SU|MO|TU|WE|TH|FR|SA)$/,o=["SECONDLY","MINUTELY","HOURLY","DAILY","WEEKLY","MONTHLY","YEARLY"],u={FREQ:function(t,e,r){if(-1===o.indexOf(t))throw new Error('invalid frequency "'+t+'" expected: "'+o.join(", ")+'"');e.freq=t},COUNT:function(t,r,n){r.count=e.helpers.strictParseInt(t)},INTERVAL:function(t,r,n){r.interval=e.helpers.strictParseInt(t),r.interval<1&&(r.interval=1)},UNTIL:function(t,r,n){t.length>10?r.until=e.design.icalendar.value["date-time"].fromICAL(t):r.until=e.design.icalendar.value.date.fromICAL(t),n||(r.until=e.Time.fromString(r.until))},WKST:function(t,r,n){if(!s.test(t))throw new Error('invalid WKST value "'+t+'"');r.wkst=e.Recur.icalDayToNumericDay(t)}},h={BYSECOND:i.bind(this,"BYSECOND",0,60),BYMINUTE:i.bind(this,"BYMINUTE",0,59),BYHOUR:i.bind(this,"BYHOUR",0,23),BYDAY:function(t){if(a.test(t))return t;throw new Error('invalid BYDAY value "'+t+'"')},BYMONTHDAY:i.bind(this,"BYMONTHDAY",-31,31),BYYEARDAY:i.bind(this,"BYYEARDAY",-366,366),BYWEEKNO:i.bind(this,"BYWEEKNO",-53,53),BYMONTH:i.bind(this,"BYMONTH",1,12),BYSETPOS:i.bind(this,"BYSETPOS",-366,366)};e.Recur.fromString=function(t){var r=e.Recur._stringToData(t,!1);return new e.Recur(r)},e.Recur.fromData=function(t){return new e.Recur(t)},e.Recur._stringToData=function(t,e){for(var r=Object.create(null),n=t.split(";"),i=n.length,s=0;s<i;s++){var a=n[s].split("="),o=a[0].toUpperCase(),c=a[0].toLowerCase(),l=e?c:o,d=a[1];if(o in h){for(var f=d.split(","),m=0,p=f.length;m<p;m++)f[m]=h[o](f[m]);r[l]=1==f.length?f[0]:f}else o in u?u[o](d,r,e):r[c]=d}return r}}(),e.RecurIterator=function(){function t(t){this.fromData(t)}return t.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=e.helpers.formatClassType(t.rule,e.Recur),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=e.helpers.formatClassType(t.dtstart,e.Time),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");t.by_data?this.by_data=t.by_data:this.by_data=e.helpers.clone(this.rule.parts,!0),t.occurrence_number&&(this.occurrence_number=t.occurrence_number),this.days=t.days||[],t.last&&(this.last=e.helpers.formatClassType(t.last,e.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 r=(h=this.ruleDayOfWeek(t.BYDAY[0],this.rule.wkst))[0],n=(c=h[1])-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<c&&n>=0||n<0)&&(this.last.day+=n)}else{var i=e.Recur.numericDayToIcalDay(this.dtstart.dayOfWeek());t.BYDAY=[i]}if("YEARLY"==this.rule.freq){for(;this.expand_year_days(this.last.year),!(this.days.length>0);)this.increment_year(this.rule.interval);this._nextByYearDay()}if("MONTHLY"==this.rule.freq&&this.has_by_data("BYDAY")){var s=null,a=this.last.clone(),o=e.Time.daysInMonth(this.last.month,this.last.year);for(var u in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(u)){this.last=a.clone(),r=(h=this.ruleDayOfWeek(this.by_data.BYDAY[u]))[0];var h,c=h[1],l=this.last.nthWeekDay(c,r);if(r>=6||r<=-6)throw new Error("Malformed values in BYDAY part");if(l>o||l<=0){if(s&&s.month==a.month)continue;for(;l>o||l<=0;)this.increment_month(),o=e.Time.daysInMonth(this.last.month,this.last.year),l=this.last.nthWeekDay(c,r)}this.last.day=l,(!s||this.last.compare(s)<0)&&(s=this.last.clone())}if(this.last=s.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>o||0==this.last.day)throw new Error("Malformed values in BYDAY part")}else this.has_by_data("BYMONTHDAY")&&this.last.day<0&&(o=e.Time.daysInMonth(this.last.month,this.last.year),this.last.day=o+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&&this.last.compare(this.rule.until)>0)return this.completed=!0,null;if(0==this.occurrence_number&&this.last.compare(this.dtstart)>=0)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&&this.last.compare(this.rule.until)>0?(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,r,n){for(var i,s=e.Time.daysInMonth(r,t),a=[],o=0,u=n.length;o<u;o++)if(i=n[o],!(Math.abs(i)>s)){if(i<0)i=s+(i+1);else if(0===i)continue;-1===a.indexOf(i)&&a.push(i)}return a.sort((function(t,e){return t-e}))},_byDayAndMonthDay:function(t){var r,n,i,s,a=this.by_data.BYDAY,o=0,u=a.length,h=0,c=this,l=this.last.day;function d(){for(s=e.Time.daysInMonth(c.last.month,c.last.year),r=c.normalizeByMonthDayRules(c.last.year,c.last.month,c.by_data.BYMONTHDAY),i=r.length;r[o]<=l&&(!t||r[o]!=l)&&o<i-1;)o++}function f(){l=0,c.increment_month(),o=0,d()}d(),t&&(l-=1);for(var m=48;!h&&m;)if(m--,(n=l+1)>s)f();else{var p=r[o++];if(p>=n){l=p;for(var y=0;y<u;y++){var T=this.ruleDayOfWeek(a[y]),v=T[0],g=T[1];if(this.last.day=l,this.last.isNthWeekDay(g,v)){h=1;break}}h||o!==i||f()}else f()}if(m<=0)throw new Error("Malformed values in BYDAY combined with BYMONTHDAY parts");return h},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 r=e.Time.daysInMonth(this.last.month,this.last.year),n=0,i=0;if(this.has_by_data("BYSETPOS")){for(var s=this.last.day,a=1;a<=r;a++)this.last.day=a,this.is_day_in_byday(this.last)&&(i++,a<=s&&n++);this.last.day=s}for(t=0,a=this.last.day+1;a<=r;a++)if(this.last.day=a,this.is_day_in_byday(this.last)&&(!this.has_by_data("BYSETPOS")||this.check_set_position(++n)||this.check_set_position(n-i-1))){t=1;break}a>r&&(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 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()),r=e.Time.daysInMonth(this.last.month,this.last.year),(a=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY])<0&&(a=r+a+1),a>r?(this.last.day=1,t=this.is_day_in_byday(this.last)):this.last.day=a):(this.increment_month(),r=e.Time.daysInMonth(this.last.month,this.last.year),this.by_data.BYMONTHDAY[0]>r?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 r=new e.Time;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,t=1);var n=this.by_data.BYDAY[this.by_indices.BYDAY],i=this.ruleDayOfWeek(n)[1];(i-=this.rule.wkst)<0&&(i+=7),r.year=this.last.year,r.month=this.last.month,r.day=this.last.day;var s=r.startDoyWeek(this.rule.wkst);if(!(i+s<1)||t){var a=e.Time.fromDayOfYear(s+i,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){this.days_index=0;do{this.increment_year(this.rule.interval),this.expand_year_days(this.last.year)}while(0==this.days.length)}return this._nextByYearDay(),1},_nextByYearDay:function(){var t=this.days[this.days_index],r=this.last.year;t<1&&(t+=1,r+=1);var n=e.Time.fromDayOfYear(t,r);this.last.day=n.day,this.last.month=n.month},ruleDayOfWeek:function(t,r){var n=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);return n?[parseInt(n[1]||0,10),t=e.Recur.icalDayToNumericDay(n[2],r)]:[0,0]},next_generic:function(t,e,r,n,i){var s=t in this.by_data,a=this.rule.freq==e,o=0;if(i&&0==this[i]())return o;if(s){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 a&&this["increment_"+r](this.rule.interval);return s&&o&&a&&this["increment_"+n](1),o},increment_monthday:function(t){for(var r=0;r<t;r++){var n=e.Time.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>n&&(this.last.day-=n,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=e.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,r,n,i){this.last[r]+=t;var s=e.helpers.trunc(this.last[r]/n);this.last[r]%=n,0!=s&&this["increment_"+i](s)},has_by_data:function(t){return t in this.rule.parts},expand_year_days:function(t){var r=new e.Time;this.days=[];var n={},i=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];for(var s in i)if(i.hasOwnProperty(s)){var a=i[s];a in this.rule.parts&&(n[a]=this.rule.parts[a])}if("BYMONTH"in n&&"BYWEEKNO"in n){var o=1,u={};r.year=t,r.isDate=!0;for(var h=0;h<this.by_data.BYMONTH.length;h++){var c=this.by_data.BYMONTH[h];r.month=c,r.day=1;var l=r.weekNumber(this.rule.wkst);r.day=e.Time.daysInMonth(c,t);var d=r.weekNumber(this.rule.wkst);for(h=l;h<d;h++)u[h]=1}for(var f=0;f<this.by_data.BYWEEKNO.length&&o;f++)(U=this.by_data.BYWEEKNO[f])<52?o&=u[f]:o=0;o?delete n.BYMONTH:delete n.BYWEEKNO}var m=Object.keys(n).length;if(0==m){var p=this.dtstart.clone();p.year=this.last.year,this.days.push(p.dayOfYear())}else if(1==m&&"BYMONTH"in n){for(var y in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(y)){var T=this.dtstart.clone();T.year=t,T.month=this.by_data.BYMONTH[y],T.isDate=!0,this.days.push(T.dayOfYear())}}else if(1==m&&"BYMONTHDAY"in n){for(var v in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(v)){var g=this.dtstart.clone();(b=this.by_data.BYMONTHDAY[v])<0&&(b=b+(D=e.Time.daysInMonth(g.month,t))+1),g.day=b,g.year=t,g.isDate=!0,this.days.push(g.dayOfYear())}}else if(2==m&&"BYMONTHDAY"in n&&"BYMONTH"in n){for(var y in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(y)){var _=this.by_data.BYMONTH[y],D=e.Time.daysInMonth(_,t);for(var v in this.by_data.BYMONTHDAY){var b;this.by_data.BYMONTHDAY.hasOwnProperty(v)&&((b=this.by_data.BYMONTHDAY[v])<0&&(b=b+D+1),r.day=b,r.month=_,r.year=t,r.isDate=!0,this.days.push(r.dayOfYear()))}}}else if(1==m&&"BYWEEKNO"in n);else if(2==m&&"BYWEEKNO"in n&&"BYMONTHDAY"in n);else if(1==m&&"BYDAY"in n)this.days=this.days.concat(this.expand_by_day(t));else if(2==m&&"BYDAY"in n&&"BYMONTH"in n){for(var y in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(y)){c=this.by_data.BYMONTH[y],D=e.Time.daysInMonth(c,t),r.year=t,r.month=this.by_data.BYMONTH[y],r.day=1,r.isDate=!0;var Y=r.dayOfWeek(),O=r.dayOfYear()-1;r.day=D;var w=r.dayOfWeek();if(this.has_by_data("BYSETPOS")){for(var A=[],S=1;S<=D;S++)r.day=S,this.is_day_in_byday(r)&&A.push(S);for(var E=0;E<A.length;E++)(this.check_set_position(E+1)||this.check_set_position(E-A.length))&&this.days.push(O+A[E])}else for(var C in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(C)){var N,x=this.by_data.BYDAY[C],I=this.ruleDayOfWeek(x),P=I[0],z=I[1],B=(z+7-Y)%7+1,L=D-(w+7-z)%7;if(0==P)for(S=B;S<=D;S+=7)this.days.push(O+S);else P>0?(N=B+7*(P-1))<=D&&this.days.push(O+N):(N=L+7*(P+1))>0&&this.days.push(O+N)}}this.days.sort((function(t,e){return t-e}))}else if(2==m&&"BYDAY"in n&&"BYMONTHDAY"in n){var M=this.expand_by_day(t);for(var R in M)if(M.hasOwnProperty(R)){S=M[R];var k=e.Time.fromDayOfYear(S,t);this.by_data.BYMONTHDAY.indexOf(k.day)>=0&&this.days.push(S)}}else if(3==m&&"BYDAY"in n&&"BYMONTHDAY"in n&&"BYMONTH"in n)for(var R in M=this.expand_by_day(t))M.hasOwnProperty(R)&&(S=M[R],k=e.Time.fromDayOfYear(S,t),this.by_data.BYMONTH.indexOf(k.month)>=0&&this.by_data.BYMONTHDAY.indexOf(k.day)>=0&&this.days.push(S));else if(2==m&&"BYDAY"in n&&"BYWEEKNO"in n){for(var R in M=this.expand_by_day(t))if(M.hasOwnProperty(R)){S=M[R];var U=(k=e.Time.fromDayOfYear(S,t)).weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(U)&&this.days.push(S)}}else 3==m&&"BYDAY"in n&&"BYWEEKNO"in n&&"BYMONTHDAY"in n||(this.days=1==m&&"BYYEARDAY"in n?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(),s=r.dayOfYear();for(var a in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(a)){var o=this.by_data.BYDAY[a],u=this.ruleDayOfWeek(o),h=u[0],c=u[1];if(0==h)for(var l=(c+7-n)%7+1;l<=s;l+=7)e.push(l);else if(h>0){var d;d=c>=n?c-n+1:c-n+8,e.push(d+7*(h-1))}else{var f;h=-h,f=c<=i?s-i+c:s-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],s=n[1],a=t.dayOfWeek();if(0==i&&s==a||t.nthWeekDay(s,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++)if(this.ruleDayOfWeek(t[r],this.rule.wkst)[1]>this.ruleDayOfWeek(t[e],this.rule.wkst)[1]){var n=t[e];t[e]=t[r],t[r]=n}},check_contract_restriction:function(e,r){var n=t._indexMap[e],i=t._expandMap[this.rule.freq][n],s=!1;if(e in this.by_data&&i==t.CONTRACT){var a=this.by_data[e];for(var o in a)if(a.hasOwnProperty(o)&&a[o]==r){s=!0;break}}else s=!0;return s},check_contracting_rules:function(){var t=this.last.dayOfWeek(),r=this.last.weekNumber(this.rule.wkst),n=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",e.Recur.numericDayToIcalDay(t))&&this.check_contract_restriction("BYWEEKNO",r)&&this.check_contract_restriction("BYMONTHDAY",this.last.day)&&this.check_contract_restriction("BYMONTH",this.last.month)&&this.check_contract_restriction("BYYEARDAY",n)},setup_defaults:function(e,r,n){var i=t._indexMap[e];return t._expandMap[this.rule.freq][i]!=t.CONTRACT&&(e in this.by_data||(this.by_data[e]=[n]),this.rule.freq!=r)?this.by_data[e][0]:n},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}},t._indexMap={BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8},t._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]},t.UNKNOWN=0,t.CONTRACT=1,t.EXPAND=2,t.ILLEGAL=3,t}(),e.RecurExpansion=function(){function t(t){return e.helpers.formatClassType(t,e.Time)}function r(t,e){return t.compare(e)}function n(t){this.ruleDates=[],this.exDates=[],this.fromData(t)}return n.prototype={complete:!1,ruleIterators:null,ruleDates:null,exDates:null,ruleDateInc:0,exDateInc:0,exDate:null,ruleDate:null,dtstart:null,last:null,fromData:function(r){var n=e.helpers.formatClassType(r.dtstart,e.Time);if(!n)throw new Error(".dtstart (ICAL.Time) must be given");if(this.dtstart=n,r.component)this._init(r.component);else{if(this.last=t(r.last)||n.clone(),!r.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=r.ruleIterators.map((function(t){return e.helpers.formatClassType(t,e.RecurIterator)})),this.ruleDateInc=r.ruleDateInc,this.exDateInc=r.exDateInc,r.ruleDates&&(this.ruleDates=r.ruleDates.map(t),this.ruleDate=this.ruleDates[this.ruleDateInc]),r.exDates&&(this.exDates=r.exDates.map(t),this.exDate=this.exDates[this.exDateInc]),void 0!==r.complete&&(this.complete=r.complete)}},next:function(){for(var t,e,r,n=0;;){if(n++>500)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&&e.compare(t.last)>0)&&(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,n){function i(t){s=e.helpers.binsearchInsert(a,t,r),a.splice(s,0,t)}for(var s,a=[],o=t.getAllProperties(n),u=o.length,h=0;h<u;h++)o[h].getValues().forEach(i);return a},_init:function(t){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!((n=t).hasProperty("rdate")||n.hasProperty("rrule")||n.hasProperty("recurrence-id")))return this.ruleDate=this.last.clone(),void(this.complete=!0);var n;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=e.helpers.binsearchInsert(this.ruleDates,this.last,r),this.ruleDate=this.ruleDates[this.ruleDateInc]),t.hasProperty("rrule"))for(var i,s=t.getAllProperties("rrule"),a=0,o=s.length;a<o;a++)i=s[a].getFirstValue().iterator(this.dtstart),this.ruleIterators.push(i),i.next();t.hasProperty("exdate")&&(this.exDates=this._extractDates(t,"exdate"),this.exDateInc=e.helpers.binsearchInsert(this.exDates,this.last,r),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,s=0;s<i;s++)r=(e=t[s]).last,e.completed?(i--,0!==s&&s--,t.splice(s,1)):(!n||n.last.compare(r)>0)&&(n=e);return n}},n}(),e.Event=function(){function t(t,r){t instanceof e.Component||(r=t,t=null),this.component=t||new e.Component("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],r&&r.strictExceptions&&(this.strictExceptions=r.strictExceptions),r&&r.exceptions?r.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 r(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 e.Component&&(t=new e.Event(t)),this.strictExceptions&&t.uid!==this.uid)throw new Error("attempted to relate unrelated exception");var n=t.recurrenceId.toString();if(this.exceptions[n]=t,t.modifiesFuture()){var i=[t.recurrenceId.toUnixTime(),n],s=e.helpers.binsearchInsert(this.rangeExceptions,i,r);this.rangeExceptions.splice(s,0,i)}},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 n=t.toUnixTime(),i=e.helpers.binsearchInsert(this.rangeExceptions,[n],r);if((i-=1)<0)return null;var s=this.rangeExceptions[i];return n<s[0]?null:s[1]},getOccurrenceDetails:function(t){var r,n=t.toString(),i=t.convertToZone(e.Timezone.utcTimezone).toString(),s={recurrenceId:t};if(n in this.exceptions)r=s.item=this.exceptions[n],s.startDate=r.startDate,s.endDate=r.endDate,s.item=r;else if(i in this.exceptions)r=this.exceptions[i],s.startDate=r.startDate,s.endDate=r.endDate,s.item=r;else{var a,o=this.findRangeException(t);if(o){var u=this.exceptions[o];s.item=u;var h=this._rangeExceptionCache[o];if(!h){var c=u.recurrenceId.clone(),l=u.startDate.clone();c.zone=l.zone,h=l.subtractDate(c),this._rangeExceptionCache[o]=h}var d=t.clone();d.zone=u.startDate.zone,d.addDuration(h),(a=d.clone()).addDuration(u.duration),s.startDate=d,s.endDate=a}else(a=t.clone()).addDuration(this.duration),s.endDate=a,s.startDate=t,s.item=this}return s},iterator:function(t){return new e.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(){return this._firstProp("duration")||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 color(){return this._firstProp("color")},set color(t){this._setProp("color",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,r){var n=this.component.getFirstProperty(t);n||(n=new e.Property(t),this.component.addProperty(n)),r.zone===e.Timezone.localTimezone||r.zone===e.Timezone.utcTimezone?n.removeParameter("tzid"):n.setParameter("tzid",r.zone.tzid),n.setValue(r)},_setProp:function(t,e){this.component.updatePropertyWithValue(t,e)},_firstProp:function(t){return this.component.getFirstPropertyValue(t)},toString:function(){return this.component.toString()}},t}(),e.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=e.parse(t)),t instanceof e.Component||(t=new e.Component(t));for(var r,n=t.getAllSubcomponents(),i=0,s=n.length;i<s;i++)switch((r=n[i]).name){case"vtimezone":if(this.parseTimezone){var a=r.getFirstPropertyValue("tzid");a&&this.ontimezone(new e.Timezone({tzid:a,component:r}))}break;case"vevent":this.parseEvent&&this.onevent(new e.Event(r));break;default:continue}this.oncomplete()}},t}()},204:(t,e,r)=>{t.exports=self.fetch||(self.fetch=r(869).default||r(869))},869:(t,e,r)=>{"use strict";function n(t,e){return e=e||{},new Promise((function(r,n){var i=new XMLHttpRequest,s=[],a=[],o={},u=function(){return{ok:2==(i.status/100|0),statusText:i.statusText,status:i.status,url:i.responseURL,text:function(){return Promise.resolve(i.responseText)},json:function(){return Promise.resolve(i.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([i.response]))},clone:u,headers:{keys:function(){return s},entries:function(){return a},get:function(t){return o[t.toLowerCase()]},has:function(t){return t.toLowerCase()in o}}}};for(var h in i.open(e.method||"get",t,!0),i.onload=function(){i.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,(function(t,e,r){s.push(e=e.toLowerCase()),a.push([e,r]),o[e]=o[e]?o[e]+","+r:r})),r(u())},i.onerror=n,i.withCredentials="include"==e.credentials,e.headers)i.setRequestHeader(h,e.headers[h]);i.send(e.body||null)}))}r.r(e),r.d(e,{default:()=>n})},255:(t,e,r)=>{const n=r(204),i=r(728),s=r(664);class a{constructor(t,e,r,n){this.streaming=new o(t),this.scheduleURL=e,this.showsURL=r,this.feed=n,this.name="",this.description="",this.logo=null,this.shows=[],this.schedule=null}getStreaming(){return this.streaming}setName(t){this.name=t}getName(){return this.name}setDescription(t){this.description=t}getDescription(){return this.description}setLogo(t){this.logo=t}getLogo(){return this.logo}getShows(){return this.shows}getShowByName(t){return void 0===this.shows?null:this.shows.find((e=>e.name===t))}getSchedule(){return this.schedule}getShowAtTime(t){return void 0===this.schedule||null===this.schedule?null:this.getSchedule().getNowShow(t)}static fromDOM(t){const e=t.cloneNode(!0);let r=e.evaluate("/radio-manifest/streaming/source",e,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null);const n=[];for(let t=0;t<r.snapshotLength;t++){const e=r.snapshotItem(t);if(e.hasAttribute("priority")){if(parseInt(e.getAttribute("priority"),10)<0)continue}else e.setAttribute("priority","0");n.push(e)}r=e.evaluate("/radio-manifest/schedule",e);const i=r.iterateNext();let s=null;null!==i&&(s=i.getAttribute("src")),r=t.evaluate("/radio-manifest/shows",t);const o=r.iterateNext();let u=null;null!==o&&(u=o.getAttribute("src")),r=t.evaluate("/radio-manifest/feed",t);const h=r.iterateNext();let c=null;return null!==h&&(c=h.getAttribute("src")),new a(n,s,u,c)}}class o{constructor(t){this.sources=t.sort(((t,e)=>this.getPriority(t)<this.getPriority(t)))}getOptions(){return this.sources.map((function(t){return t.getAttribute("name")}))}getPriority(t){return parseInt((r="priority","1",(e=t).hasAttribute(r)?e.getAttribute(r):"1"));var e,r}getTopPrioritySources(){var t=this.getPriority(this.sources[0]);return this.sources.filter((e=>parseInt(e.getAttribute("priority"),10)===t))}getSource(t){if(void 0===t)return this.getTopPrioritySources()[0];const e=this.sources.find((function(e){return e.getAttribute("name")===t}));return void 0===e?e:e.getAttribute("src")}async pickURLs(){var t=this.getTopPrioritySources(),e=[];for(let r of t){let t=r.getAttribute("src"),i=await n(t);e.unshift(...u(await i.text()))}return e}async pickURL(){return(await this.pickURLs())[0]}}function u(t){return t.split("\n").filter((t=>{if(t.startsWith("#"))return!1;try{return new URL(t),!0}catch{return!1}}))}t.exports={get:async function(t,e){let r=await n(function(t){return t+"/radiomanifest.xml"}(t)),o=await r.text();const u=(new DOMParser).parseFromString(o,"text/xml"),h=a.fromDOM(u);try{h.shows=await i.get(h)}catch(t){console.error("Error while fetching shows file",t)}try{h.schedule=await s.get(h),void 0!==h.schedule&&(h.schedule.radio=h)}catch(t){console.error("Error while fetching shows file",t)}r=null;try{r=await n(function(t){return t+"/streaminfo.json"}(t))}catch(t){}if(null!==r)try{o=await r.text();const t=JSON.parse(o),e=t["icy-name"];void 0!==e&&h.setName(e);const n=t["icy-description"];void 0!==n&&h.setDescription(n);const i=t["icy-logo"];void 0!==n&&h.setLogo(i)}catch(t){if(!(t instanceof SyntaxError))throw console.error("Error",t),t}return h},objs:{Radio:a,RadioStreaming:o},parsers:{M3U:u,radioManifest:a.fromDOM,shows:i.parse}}},728:t=>{class e{constructor(t,e,r,n,i,s){this.name=t,this.description=e,this.website=r,this.feed=n,this.schedule=i,this.radio_calendar=s}getName(){return this.name}getWebsite(){return this.website}getFeed(){return this.feed}getSchedule(){return this.schedule}}function r(t){const r=t.cloneNode(!0),i=r.evaluate("//bookmark",r,n,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null),s=[];for(let t=0;t<i.snapshotLength;t++){const a=i.snapshotItem(t);let o=r.evaluate("./info/metadata/show:name",a,n,XPathResult.STRING_TYPE).stringValue;""===o&&(o=r.evaluate("./title",a,n,XPathResult.STRING_TYPE).stringValue);let u=r.evaluate("./info/metadata/show:website",a,n,XPathResult.STRING_TYPE).stringValue;""===u&&(u=getAttribute(a,"href",null));const h=r.evaluate("./info/metadata/show:feed",a,n,XPathResult.STRING_TYPE).stringValue,c=r.evaluate("./info/metadata/show:schedule",a,n,XPathResult.STRING_TYPE).stringValue;let l=r.evaluate("./info/metadata/show:description",a,n,XPathResult.STRING_TYPE).stringValue;""===l&&(l=r.evaluate("./desc",a,n,XPathResult.STRING_TYPE).stringValue);const d=new e(o,l||null,u||null,h||null,c||null);s.push(d)}return s}function n(t){return{show:"https://radiomanifest.degenerazione.xyz/shows/"}[t]||null}t.exports={get:async function(t){if(t.showsURL){let e=null;try{e=await fetch(t.showsURL)}catch(t){}if(null!==e)try{text=await e.text();return r((new DOMParser).parseFromString(text,"text/xml"))}catch(t){throw console.error("Error while parsing shows file",t),t}}},parse:r,RadioShow:e}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={exports:{}};return t[n](s,s.exports,r),s.exports}return r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(255)})()}));