mirror of
https://github.com/formax68/memoChron.git
synced 2026-07-22 05:45:44 +00:00
42 lines
97 KiB
JavaScript
42 lines
97 KiB
JavaScript
/*
|
|
THIS IS A GENERATED/BUNDLED FILE BY ESBUILD
|
|
if you want to view the source, please visit the github repository of this plugin
|
|
*/
|
|
|
|
var ut=Object.create;var J=Object.defineProperty;var ht=Object.getOwnPropertyDescriptor;var lt=Object.getOwnPropertyNames;var ct=Object.getPrototypeOf,ft=Object.prototype.hasOwnProperty;var dt=(u,r)=>()=>(r||u((r={exports:{}}).exports,r),r.exports),mt=(u,r)=>{for(var t in r)J(u,t,{get:r[t],enumerable:!0})},tt=(u,r,t,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let e of lt(r))!ft.call(u,e)&&e!==t&&J(u,e,{get:()=>r[e],enumerable:!(i=ht(r,e))||i.enumerable});return u};var pt=(u,r,t)=>(t=u!=null?ut(ct(u)):{},tt(r||!u||!u.__esModule?J(t,"default",{value:u,enumerable:!0}):t,u)),yt=u=>tt(J({},"__esModule",{value:!0}),u);var et=dt((Tt,Q)=>{var s;(function(){typeof Q=="object"?s=Q.exports:typeof HTMLScriptElement!="undefined"&&"noModule"in HTMLScriptElement.prototype?window.ICAL=s={}:typeof s!="object"&&(s={})})();s.foldLength=75;s.newLineChar=`\r
|
|
`;s.helpers={updateTimezones:function(u){var r,t,i,e,n,a;if(!u||u.name!=="vcalendar")return u;for(r=u.getAllSubcomponents(),t=[],i={},n=0;n<r.length;n++)r[n].name==="vtimezone"?(a=r[n].getFirstProperty("tzid").getFirstValue(),i[a]=r[n]):t=t.concat(r[n].getAllProperties());for(e={},n=0;n<t.length;n++)(a=t[n].getParameter("tzid"))&&(e[a]=!0);for(n in i)i.hasOwnProperty(n)&&!e[n]&&u.removeSubcomponent(i[n]);for(n in e)e.hasOwnProperty(n)&&!i[n]&&s.TimezoneService.has(n)&&u.addSubcomponent(s.TimezoneService.get(n).component);return u},isStrictlyNaN:function(u){return typeof u=="number"&&isNaN(u)},strictParseInt:function(u){var r=parseInt(u,10);if(s.helpers.isStrictlyNaN(r))throw new Error('Could not extract integer from "'+u+'"');return r},formatClassType:function(r,t){if(typeof r!="undefined")return r instanceof t?r:new t(r)},unescapedIndexOf:function(u,r,t){for(;(t=u.indexOf(r,t))!==-1;)if(t>0&&u[t-1]==="\\")t+=1;else return t;return-1},binsearchInsert:function(u,r,t){if(!u.length)return 0;for(var i=0,e=u.length-1,n,a;i<=e;)if(n=i+Math.floor((e-i)/2),a=t(r,u[n]),a<0)e=n-1;else if(a>0)i=n+1;else break;return a<0?n:a>0?n+1:n},dumpn:function(){s.debug&&(typeof console!="undefined"&&"log"in console?s.helpers.dumpn=function(r){console.log(r)}:s.helpers.dumpn=function(r){dump(r+`
|
|
`)},s.helpers.dumpn(arguments[0]))},clone:function(u,r){if(!u||typeof u!="object")return u;if(u instanceof Date)return new Date(u.getTime());if("clone"in u)return u.clone();if(Array.isArray(u)){for(var t=[],i=0;i<u.length;i++)t.push(r?s.helpers.clone(u[i],!0):u[i]);return t}else{var e={};for(var n in u)Object.prototype.hasOwnProperty.call(u,n)&&(r?e[n]=s.helpers.clone(u[n],!0):e[n]=u[n]);return e}},foldline:function(r){for(var t="",i=r||"",e=0,n=0;i.length;){var a=i.codePointAt(e);a<128?++n:a<2048?n+=2:a<65536?n+=3:n+=4,n<s.foldLength+1?e+=a>65535?2:1:(t+=s.newLineChar+" "+i.substring(0,e),i=i.substring(e),e=n=0)}return t.substr(s.newLineChar.length+1)},pad2:function(r){typeof r!="string"&&(typeof r=="number"&&(r=parseInt(r)),r=String(r));var t=r.length;switch(t){case 0:return"00";case 1:return"0"+r;default:return r}},trunc:function(r){return r<0?Math.ceil(r):Math.floor(r)},inherits:function(u,r,t){function i(){}i.prototype=u.prototype,r.prototype=new i,t&&s.helpers.extend(t,r.prototype)},extend:function(u,r){for(var t in u){var i=Object.getOwnPropertyDescriptor(u,t);i&&!Object.getOwnPropertyDescriptor(r,t)&&Object.defineProperty(r,t,i)}return r}};s.design=function(){"use strict";var u=/\\\\|\\;|\\,|\\[Nn]/g,r=/\\|;|,|\n/g,t=/\\\\|\\,|\\[Nn]/g,i=/\\|,|\n/g;function e(l,T){var b={matches:/.*/,fromICAL:function(E,R){return g(E,l,R)},toICAL:function(E,R){var M=T;return R&&(M=new RegExp(M.source+"|"+R)),E.replace(M,function(F){switch(F){case"\\":return"\\\\";case";":return"\\;";case",":return"\\,";case`
|
|
`:return"\\n";default:return F}})}};return b}var n={defaultType:"text"},a={defaultType:"text",multiValue:","},o={defaultType:"text",structuredValue:";"},h={defaultType:"integer"},p={defaultType:"date-time",allowedTypes:["date-time","date"]},c={defaultType:"date-time"},d={defaultType:"uri"},f={defaultType:"utc-offset"},m={defaultType:"recur"},v={defaultType:"date-and-or-time",allowedTypes:["date-time","date","text"]};function y(l){switch(l){case"\\\\":return"\\";case"\\;":return";";case"\\,":return",";case"\\n":case"\\N":return`
|
|
`;default:return l}}function g(l,T,b){return l.indexOf("\\")===-1?l:(b&&(T=new RegExp(T.source+"|\\\\"+b)),l.replace(T,y))}var w={categories:a,url:d,version:n,uid:n},_={boolean:{values:["TRUE","FALSE"],fromICAL:function(l){switch(l){case"TRUE":return!0;case"FALSE":return!1;default:return!1}},toICAL:function(l){return l?"TRUE":"FALSE"}},float:{matches:/^[+-]?\d+\.\d+$/,fromICAL:function(l){var T=parseFloat(l);return s.helpers.isStrictlyNaN(T)?0:T},toICAL:function(l){return String(l)}},integer:{fromICAL:function(l){var T=parseInt(l);return s.helpers.isStrictlyNaN(T)?0:T},toICAL:function(l){return String(l)}},"utc-offset":{toICAL:function(l){return l.length<7?l.substr(0,3)+l.substr(4,2):l.substr(0,3)+l.substr(4,2)+l.substr(7,2)},fromICAL:function(l){return l.length<6?l.substr(0,3)+":"+l.substr(3,2):l.substr(0,3)+":"+l.substr(3,2)+":"+l.substr(5,2)},decorate:function(l){return s.UtcOffset.fromString(l)},undecorate:function(l){return l.toString()}}},Y={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}},D=s.helpers.extend(_,{text:e(u,r),uri:{},binary:{decorate:function(l){return s.Binary.fromString(l)},undecorate:function(l){return l.toString()}},"cal-address":{},date:{decorate:function(l,T){return P.strict?s.Time.fromDateString(l,T):s.Time.fromString(l,T)},undecorate:function(l){return l.toString()},fromICAL:function(l){return!P.strict&&l.length>=15?D["date-time"].fromICAL(l):l.substr(0,4)+"-"+l.substr(4,2)+"-"+l.substr(6,2)},toICAL:function(l){var T=l.length;return T==10?l.substr(0,4)+l.substr(5,2)+l.substr(8,2):T>=19?D["date-time"].toICAL(l):l}},"date-time":{fromICAL:function(l){if(!P.strict&&l.length==8)return D.date.fromICAL(l);var T=l.substr(0,4)+"-"+l.substr(4,2)+"-"+l.substr(6,2)+"T"+l.substr(9,2)+":"+l.substr(11,2)+":"+l.substr(13,2);return l[15]&&l[15]==="Z"&&(T+="Z"),T},toICAL:function(l){var T=l.length;if(T==10&&!P.strict)return D.date.toICAL(l);if(T>=19){var b=l.substr(0,4)+l.substr(5,2)+l.substr(8,5)+l.substr(14,2)+l.substr(17,2);return l[19]&&l[19]==="Z"&&(b+="Z"),b}else return l},decorate:function(l,T){return P.strict?s.Time.fromDateTimeString(l,T):s.Time.fromString(l,T)},undecorate:function(l){return l.toString()}},duration:{decorate:function(l){return s.Duration.fromString(l)},undecorate:function(l){return l.toString()}},period:{fromICAL:function(l){var T=l.split("/");return T[0]=D["date-time"].fromICAL(T[0]),s.Duration.isValueString(T[1])||(T[1]=D["date-time"].fromICAL(T[1])),T},toICAL:function(l){return!P.strict&&l[0].length==10?l[0]=D.date.toICAL(l[0]):l[0]=D["date-time"].toICAL(l[0]),s.Duration.isValueString(l[1])||(!P.strict&&l[1].length==10?l[1]=D.date.toICAL(l[1]):l[1]=D["date-time"].toICAL(l[1])),l.join("/")},decorate:function(l,T){return s.Period.fromJSON(l,T,!P.strict)},undecorate:function(l){return l.toJSON()}},recur:{fromICAL:function(l){return s.Recur._stringToData(l,!0)},toICAL:function(l){var T="";for(var b in l)if(Object.prototype.hasOwnProperty.call(l,b)){var E=l[b];b=="until"?E.length>10?E=D["date-time"].toICAL(E):E=D.date.toICAL(E):b=="wkst"?typeof E=="number"&&(E=s.Recur.numericDayToIcalDay(E)):Array.isArray(E)&&(E=E.join(",")),T+=b.toUpperCase()+"="+E+";"}return T.substr(0,T.length-1)},decorate:function(T){return s.Recur.fromData(T)},undecorate:function(l){return l.toJSON()}},time:{fromICAL:function(l){if(l.length<6)return l;var T=l.substr(0,2)+":"+l.substr(2,2)+":"+l.substr(4,2);return l[6]==="Z"&&(T+="Z"),T},toICAL:function(l){if(l.length<8)return l;var T=l.substr(0,2)+l.substr(3,2)+l.substr(6,2);return l[8]==="Z"&&(T+="Z"),T}}}),O=s.helpers.extend(w,{action:n,attach:{defaultType:"uri"},attendee:{defaultType:"cal-address"},calscale:n,class:n,comment:n,completed:c,contact:n,created:c,description:n,dtend:p,dtstamp:c,dtstart:p,due:p,duration:{defaultType:"duration"},exdate:{defaultType:"date-time",allowedTypes:["date-time","date"],multiValue:","},exrule:m,freebusy:{defaultType:"period",multiValue:","},geo:{defaultType:"float",structuredValue:";"},"last-modified":c,location:n,method:n,organizer:{defaultType:"cal-address"},"percent-complete":h,priority:h,prodid:n,"related-to":n,repeat:h,rdate:{defaultType:"date-time",allowedTypes:["date-time","date","period"],multiValue:",",detectType:function(l){return l.indexOf("/")!==-1?"period":l.indexOf("T")===-1?"date":"date-time"}},"recurrence-id":p,resources:a,"request-status":o,rrule:m,sequence:h,status:n,summary:n,transp:n,trigger:{defaultType:"duration",allowedTypes:["duration","date-time"]},tzoffsetfrom:f,tzoffsetto:f,tzurl:d,tzid:n,tzname:n}),A=s.helpers.extend(_,{text:e(t,i),uri:e(t,i),date:{decorate:function(l){return s.VCardTime.fromDateAndOrTimeString(l,"date")},undecorate:function(l){return l.toString()},fromICAL:function(l){return l.length==8?D.date.fromICAL(l):l[0]=="-"&&l.length==6?l.substr(0,4)+"-"+l.substr(4):l},toICAL:function(l){return l.length==10?D.date.toICAL(l):l[0]=="-"&&l.length==7?l.substr(0,4)+l.substr(5):l}},time:{decorate:function(l){return s.VCardTime.fromDateAndOrTimeString("T"+l,"time")},undecorate:function(l){return l.toString()},fromICAL:function(l){var T=A.time._splitZone(l,!0),b=T[0],E=T[1];return E.length==6?E=E.substr(0,2)+":"+E.substr(2,2)+":"+E.substr(4,2):E.length==4&&E[0]!="-"?E=E.substr(0,2)+":"+E.substr(2,2):E.length==5&&(E=E.substr(0,3)+":"+E.substr(3,2)),b.length==5&&(b[0]=="-"||b[0]=="+")&&(b=b.substr(0,3)+":"+b.substr(3)),E+b},toICAL:function(l){var T=A.time._splitZone(l),b=T[0],E=T[1];return E.length==8?E=E.substr(0,2)+E.substr(3,2)+E.substr(6,2):E.length==5&&E[0]!="-"?E=E.substr(0,2)+E.substr(3,2):E.length==6&&(E=E.substr(0,3)+E.substr(4,2)),b.length==6&&(b[0]=="-"||b[0]=="+")&&(b=b.substr(0,3)+b.substr(4)),E+b},_splitZone:function(l,T){var b=l.length-1,E=l.length-(T?5:6),R=l[E],M,F;return l[b]=="Z"?(M=l[b],F=l.substr(0,b)):l.length>6&&(R=="-"||R=="+")?(M=l.substr(E),F=l.substr(0,E)):(M="",F=l),[M,F]}},"date-time":{decorate:function(l){return s.VCardTime.fromDateAndOrTimeString(l,"date-time")},undecorate:function(l){return l.toString()},fromICAL:function(l){return A["date-and-or-time"].fromICAL(l)},toICAL:function(l){return A["date-and-or-time"].toICAL(l)}},"date-and-or-time":{decorate:function(l){return s.VCardTime.fromDateAndOrTimeString(l,"date-and-or-time")},undecorate:function(l){return l.toString()},fromICAL:function(l){var T=l.split("T");return(T[0]?A.date.fromICAL(T[0]):"")+(T[1]?"T"+A.time.fromICAL(T[1]):"")},toICAL:function(l){var T=l.split("T");return A.date.toICAL(T[0])+(T[1]?"T"+A.time.toICAL(T[1]):"")}},timestamp:D["date-time"],"language-tag":{matches:/^[a-zA-Z0-9-]+$/}}),S={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}},N=s.helpers.extend(w,{adr:{defaultType:"text",structuredValue:";",multiValue:","},anniversary:v,bday:v,caladruri:d,caluri:d,clientpidmap:o,email:n,fburl:d,fn:n,gender:o,geo:d,impp:d,key:d,kind:n,lang:{defaultType:"language-tag"},logo:d,member:d,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:a,note:n,org:{defaultType:"text",structuredValue:";"},photo:d,related:d,rev:{defaultType:"timestamp"},role:n,sound:d,source:d,tel:{defaultType:"uri",allowedTypes:["uri","text"]},title:n,tz:{defaultType:"text",allowedTypes:["text","utc-offset","uri"]},xml:n}),L=s.helpers.extend(_,{binary:D.binary,date:A.date,"date-time":A["date-time"],"phone-number":{},uri:D.uri,text:D.text,time:D.time,vcard:D.text,"utc-offset":{toICAL:function(l){return l.substr(0,7)},fromICAL:function(l){return l.substr(0,7)},decorate:function(l){return s.UtcOffset.fromString(l)},undecorate:function(l){return l.toString()}}}),x={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}},B=s.helpers.extend(w,{fn:n,n:{defaultType:"text",structuredValue:";",multiValue:","},nickname:a,photo:{defaultType:"binary",allowedTypes:["binary","uri"]},bday:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(l){return l.indexOf("T")===-1?"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:o,note:a,prodid:n,rev:{defaultType:"date-time",allowedTypes:["date-time","date"],detectType:function(l){return l.indexOf("T")===-1?"date":"date-time"}},"sort-string":n,sound:{defaultType:"binary",allowedTypes:["binary","uri"]},class:n,key:{defaultType:"binary",allowedTypes:["binary","text"]}}),I={value:D,param:Y,property:O},U={value:A,param:S,property:N},C={value:L,param:x,property:B},P={strict:!0,defaultSet:I,defaultType:"unknown",components:{vcard:U,vcard3:C,vevent:I,vtodo:I,vjournal:I,valarm:I,vtimezone:I,daylight:I,standard:I},icalendar:I,vcard:U,vcard3:C,getDesignSet:function(l){var T=l&&l in P.components;return T?P.components[l]:P.defaultSet}};return P}();s.stringify=function(){"use strict";var u=`\r
|
|
`,r="unknown",t=s.design,i=s.helpers;function e(a){typeof a[0]=="string"&&(a=[a]);for(var o=0,h=a.length,p="";o<h;o++)p+=e.component(a[o])+u;return p}e.component=function(a,o){var h=a[0].toUpperCase(),p="BEGIN:"+h+u,c=a[1],d=0,f=c.length,m=a[0];for(m==="vcard"&&a[1].length>0&&!(a[1][0][0]==="version"&&a[1][0][3]==="4.0")&&(m="vcard3"),o=o||t.getDesignSet(m);d<f;d++)p+=e.property(c[d],o)+u;for(var v=a[2]||[],y=0,g=v.length;y<g;y++)p+=e.component(v[y],o)+u;return p+="END:"+h,p},e.property=function(a,o,h){var p=a[0].toUpperCase(),c=a[0],d=a[1],f=p,m;for(m in d){var v=d[m];if(d.hasOwnProperty(m)){var w=m in o.param&&o.param[m].multiValue;w&&Array.isArray(v)?(o.param[m].multiValueSeparateDQuote&&(w='"'+w+'"'),v=v.map(e._rfc6868Unescape),v=e.multiValue(v,w,"unknown",null,o)):v=e._rfc6868Unescape(v),f+=";"+m.toUpperCase(),f+="="+e.propertyValue(v)}}if(a.length===3)return f+":";var y=a[2];o||(o=t.defaultSet);var g,w=!1,_=!1,Y=!1;return c in o.property?(g=o.property[c],"multiValue"in g&&(w=g.multiValue),"structuredValue"in g&&Array.isArray(a[3])&&(_=g.structuredValue),"defaultType"in g?y===g.defaultType&&(Y=!0):y===r&&(Y=!0)):y===r&&(Y=!0),Y||(f+=";VALUE="+y.toUpperCase()),f+=":",w&&_?f+=e.multiValue(a[3],_,y,w,o,_):w?f+=e.multiValue(a.slice(3),w,y,null,o,!1):_?f+=e.multiValue(a[3],_,y,null,o,_):f+=e.value(a[3],y,o,!1),h?f:s.helpers.foldline(f)},e.propertyValue=function(a){return i.unescapedIndexOf(a,",")===-1&&i.unescapedIndexOf(a,":")===-1&&i.unescapedIndexOf(a,";")===-1?a:'"'+a+'"'},e.multiValue=function(a,o,h,p,c,d){for(var f="",m=a.length,v=0;v<m;v++)p&&Array.isArray(a[v])?f+=e.multiValue(a[v],p,h,null,c,d):f+=e.value(a[v],h,c,d),v!==m-1&&(f+=o);return f},e.value=function(a,o,h,p){return o in h.value&&"toICAL"in h.value[o]?h.value[o].toICAL(a,p):a},e._rfc6868Unescape=function(a){return a.replace(/[\n^"]/g,function(o){return n[o]})};var n={'"':"^'","\n":"^n","^":"^^"};return e}();s.parse=function(){"use strict";var u=/[^ \t]/,r=",",t=":",i=";",e="=",n="unknown",a="text",o=s.design,h=s.helpers;function p(f){this.message=f,this.name="ParserError";try{throw new Error}catch(v){if(v.stack){var m=v.stack.split(`
|
|
`);m.shift(),this.stack=m.join(`
|
|
`)}}}p.prototype=Error.prototype;function c(f){var m={},v=m.component=[];if(m.stack=[v],c._eachLine(f,function(y,g){c._handleContentLine(g,m)}),m.stack.length>1)throw new p("invalid ical body. component began but did not end");return m=null,v.length==1?v[0]:v}c.property=function(f,m){var v={component:[[],[]],designSet:m||o.defaultSet};return c._handleContentLine(f,v),v.component[1][0]},c.component=function(f){return c(f)},c.ParserError=p,c._handleContentLine=function(f,m){var v=f.indexOf(t),y=f.indexOf(i),g,w,_,Y,D={};y!==-1&&v!==-1&&y>v&&(y=-1);var O;if(y!==-1){if(_=f.substring(0,y).toLowerCase(),O=c._parseParameters(f.substring(y),0,m.designSet),O[2]==-1)throw new p("Invalid parameters in '"+f+"'");if(D=O[0],g=O[1].length+O[2]+y,(w=f.substring(g).indexOf(t))!==-1)Y=f.substring(g+w+1);else throw new p("Missing parameter value in '"+f+"'")}else if(v!==-1){if(_=f.substring(0,v).toLowerCase(),Y=f.substring(v+1),_==="begin"){var A=[Y.toLowerCase(),[],[]];m.stack.length===1?m.component.push(A):m.component[2].push(A),m.stack.push(m.component),m.component=A,m.designSet||(m.designSet=o.getDesignSet(m.component[0]));return}else if(_==="end"){m.component=m.stack.pop();return}}else throw new p('invalid line (no token ";" or ":") "'+f+'"');var S,N=!1,L=!1,x;_ in m.designSet.property&&(x=m.designSet.property[_],"multiValue"in x&&(N=x.multiValue),"structuredValue"in x&&(L=x.structuredValue),Y&&"detectType"in x&&(S=x.detectType(Y))),S||("value"in D?S=D.value.toLowerCase():x?S=x.defaultType:S=n),delete D.value;var B;N&&L?(Y=c._parseMultiValue(Y,L,S,[],N,m.designSet,L),B=[_,D,S,Y]):N?(B=[_,D,S],c._parseMultiValue(Y,N,S,B,null,m.designSet,!1)):L?(Y=c._parseMultiValue(Y,L,S,[],null,m.designSet,L),B=[_,D,S,Y]):(Y=c._parseValue(Y,S,m.designSet,!1),B=[_,D,S,Y]),m.component[0]==="vcard"&&m.component[1].length===0&&!(_==="version"&&Y==="4.0")&&(m.designSet=o.getDesignSet("vcard3")),m.component[1].push(B)},c._parseValue=function(f,m,v,y){return m in v.value&&"fromICAL"in v.value[m]?v.value[m].fromICAL(f,y):f},c._parseParameters=function(f,m,v){for(var y=m,g=0,w=e,_={},Y,D,O,A=-1,S,N,L;g!==!1&&(g=h.unescapedIndexOf(f,w,g+1))!==-1;){if(Y=f.substr(y+1,g-y-1),Y.length==0)throw new p("Empty parameter name in '"+f+"'");D=Y.toLowerCase(),L=!1,N=!1,D in v.param&&v.param[D].valueType?S=v.param[D].valueType:S=a,D in v.param&&(N=v.param[D].multiValue,v.param[D].multiValueSeparateDQuote&&(L=c._rfc6868Escape('"'+N+'"')));var x=f[g+1];if(x==='"'){if(A=g+2,g=h.unescapedIndexOf(f,'"',A),N&&g!=-1)for(var B=!0;B;)f[g+1]==N&&f[g+2]=='"'?g=h.unescapedIndexOf(f,'"',g+3):B=!1;if(g===-1)throw new p('invalid line (no matching double quote) "'+f+'"');O=f.substr(A,g-A),y=h.unescapedIndexOf(f,i,g),y===-1&&(g=!1)}else{A=g+1;var I=h.unescapedIndexOf(f,i,A),U=h.unescapedIndexOf(f,t,A);U!==-1&&I>U?(I=U,g=!1):I===-1?(U===-1?I=f.length:I=U,g=!1):(y=I,g=I),O=f.substr(A,I-A)}if(O=c._rfc6868Escape(O),N){var C=L||N;O=c._parseMultiValue(O,C,S,[],null,v)}else O=c._parseValue(O,S,v);N&&D in _?Array.isArray(_[D])?_[D].push(O):_[D]=[_[D],O]:_[D]=O}return[_,O,A]},c._rfc6868Escape=function(f){return f.replace(/\^['n^]/g,function(m){return d[m]})};var d={"^'":'"',"^n":`
|
|
`,"^^":"^"};return c._parseMultiValue=function(f,m,v,y,g,w,_){var Y=0,D=0,O;if(m.length===0)return f;for(;(Y=h.unescapedIndexOf(f,m,D))!==-1;)O=f.substr(D,Y-D),g?O=c._parseMultiValue(O,g,v,[],null,w,_):O=c._parseValue(O,v,w,_),y.push(O),D=Y+m.length;return O=f.substr(D),g?O=c._parseMultiValue(O,g,v,[],null,w,_):O=c._parseValue(O,v,w,_),y.push(O),y.length==1?y[0]:y},c._eachLine=function(f,m){var v=f.length,y=f.search(u),g=y,w,_,Y;do g=f.indexOf(`
|
|
`,y)+1,g>1&&f[g-2]==="\r"?Y=2:Y=1,g===0&&(g=v,Y=0),_=f[y],_===" "||_===" "?w+=f.substr(y+1,g-y-(Y+1)):(w&&m(null,w),w=f.substr(y,g-y-Y)),y=g;while(g!==v);w=w.trim(),w.length&&m(null,w)},c}();s.Component=function(){"use strict";var u=1,r=2,t=0;function i(e,n){typeof e=="string"&&(e=[e,[],[]]),this.jCal=e,this.parent=n||null}return i.prototype={_hydratedPropertyCount:0,_hydratedComponentCount:0,get name(){return this.jCal[t]},get _designSet(){var e=this.parent&&this.parent._designSet;return e||s.design.getDesignSet(this.name)},_hydrateComponent:function(e){if(this._components||(this._components=[],this._hydratedComponentCount=0),this._components[e])return this._components[e];var n=new i(this.jCal[r][e],this);return this._hydratedComponentCount++,this._components[e]=n},_hydrateProperty:function(e){if(this._properties||(this._properties=[],this._hydratedPropertyCount=0),this._properties[e])return this._properties[e];var n=new s.Property(this.jCal[u][e],this);return this._hydratedPropertyCount++,this._properties[e]=n},getFirstSubcomponent:function(e){if(e){for(var n=0,a=this.jCal[r],o=a.length;n<o;n++)if(a[n][t]===e){var h=this._hydrateComponent(n);return h}}else if(this.jCal[r].length)return this._hydrateComponent(0);return null},getAllSubcomponents:function(e){var n=this.jCal[r].length,a=0;if(e){for(var o=this.jCal[r],h=[];a<n;a++)e===o[a][t]&&h.push(this._hydrateComponent(a));return h}else{if(!this._components||this._hydratedComponentCount!==n)for(;a<n;a++)this._hydrateComponent(a);return this._components||[]}},hasProperty:function(e){for(var n=this.jCal[u],a=n.length,o=0;o<a;o++)if(n[o][t]===e)return!0;return!1},getFirstProperty:function(e){if(e){for(var n=0,a=this.jCal[u],o=a.length;n<o;n++)if(a[n][t]===e){var h=this._hydrateProperty(n);return h}}else if(this.jCal[u].length)return this._hydrateProperty(0);return null},getFirstPropertyValue:function(e){var n=this.getFirstProperty(e);return n?n.getFirstValue():null},getAllProperties:function(e){var n=this.jCal[u].length,a=0;if(e){for(var o=this.jCal[u],h=[];a<n;a++)e===o[a][t]&&h.push(this._hydrateProperty(a));return h}else{if(!this._properties||this._hydratedPropertyCount!==n)for(;a<n;a++)this._hydrateProperty(a);return this._properties||[]}},_removeObjectByIndex:function(e,n,a){if(n=n||[],n[a]){var o=n[a];"parent"in o&&(o.parent=null)}n.splice(a,1),this.jCal[e].splice(a,1)},_removeObject:function(e,n,a){var o=0,h=this.jCal[e],p=h.length,c=this[n];if(typeof a=="string"){for(;o<p;o++)if(h[o][t]===a)return this._removeObjectByIndex(e,c,o),!0}else if(c){for(;o<p;o++)if(c[o]&&c[o]===a)return this._removeObjectByIndex(e,c,o),!0}return!1},_removeAllObjects:function(e,n,a){for(var o=this[n],h=this.jCal[e],p=h.length-1;p>=0;p--)(!a||h[p][t]===a)&&this._removeObjectByIndex(e,o,p)},addSubcomponent:function(e){this._components||(this._components=[],this._hydratedComponentCount=0),e.parent&&e.parent.removeSubcomponent(e);var n=this.jCal[r].push(e.jCal);return this._components[n-1]=e,this._hydratedComponentCount++,e.parent=this,e},removeSubcomponent:function(e){var n=this._removeObject(r,"_components",e);return n&&this._hydratedComponentCount--,n},removeAllSubcomponents:function(e){var n=this._removeAllObjects(r,"_components",e);return this._hydratedComponentCount=0,n},addProperty:function(e){if(!(e instanceof s.Property))throw new TypeError("must instance of ICAL.Property");this._properties||(this._properties=[],this._hydratedPropertyCount=0),e.parent&&e.parent.removeProperty(e);var n=this.jCal[u].push(e.jCal);return this._properties[n-1]=e,this._hydratedPropertyCount++,e.parent=this,e},addPropertyWithValue:function(e,n){var a=new s.Property(e);return a.setValue(n),this.addProperty(a),a},updatePropertyWithValue:function(e,n){var a=this.getFirstProperty(e);return a?a.setValue(n):a=this.addPropertyWithValue(e,n),a},removeProperty:function(e){var n=this._removeObject(u,"_properties",e);return n&&this._hydratedPropertyCount--,n},removeAllProperties:function(e){var n=this._removeAllObjects(u,"_properties",e);return this._hydratedPropertyCount=0,n},toJSON:function(){return this.jCal},toString:function(){return s.stringify.component(this.jCal,this._designSet)}},i.fromString=function(e){return new i(s.parse.component(e))},i}();s.Property=function(){"use strict";var u=0,r=1,t=2,i=3,e=s.design;function n(a,o){this._parent=o||null,typeof a=="string"?(this.jCal=[a,{},e.defaultType],this.jCal[t]=this.getDefaultType()):this.jCal=a,this._updateType()}return n.prototype={get type(){return this.jCal[t]},get name(){return this.jCal[u]},get parent(){return this._parent},set parent(a){var o=!this._parent||a&&a._designSet!=this._parent._designSet;return this._parent=a,this.type==e.defaultType&&o&&(this.jCal[t]=this.getDefaultType(),this._updateType()),a},get _designSet(){return this.parent?this.parent._designSet:e.defaultSet},_updateType:function(){var a=this._designSet;if(this.type in a.value){var o=a.value[this.type];"decorate"in a.value[this.type]?this.isDecorated=!0:this.isDecorated=!1,this.name in a.property&&(this.isMultiValue="multiValue"in a.property[this.name],this.isStructuredValue="structuredValue"in a.property[this.name])}},_hydrateValue:function(a){return this._values&&this._values[a]?this._values[a]:this.jCal.length<=i+a?null:this.isDecorated?(this._values||(this._values=[]),this._values[a]=this._decorate(this.jCal[i+a])):this.jCal[i+a]},_decorate:function(a){return this._designSet.value[this.type].decorate(a,this)},_undecorate:function(a){return this._designSet.value[this.type].undecorate(a,this)},_setDecoratedValue:function(a,o){this._values||(this._values=[]),typeof a=="object"&&"icaltype"in a?(this.jCal[i+o]=this._undecorate(a),this._values[o]=a):(this.jCal[i+o]=a,this._values[o]=this._decorate(a))},getParameter:function(a){if(a in this.jCal[r])return this.jCal[r][a]},getFirstParameter:function(a){var o=this.getParameter(a);return Array.isArray(o)?o[0]:o},setParameter:function(a,o){var h=a.toLowerCase();typeof o=="string"&&h in this._designSet.param&&"multiValue"in this._designSet.param[h]&&(o=[o]),this.jCal[r][a]=o},removeParameter:function(a){delete this.jCal[r][a]},getDefaultType:function(){var a=this.jCal[u],o=this._designSet;if(a in o.property){var h=o.property[a];if("defaultType"in h)return h.defaultType}return e.defaultType},resetType:function(a){this.removeAllValues(),this.jCal[t]=a,this._updateType()},getFirstValue:function(){return this._hydrateValue(0)},getValues:function(){var a=this.jCal.length-i;if(a<1)return[];for(var o=0,h=[];o<a;o++)h[o]=this._hydrateValue(o);return h},removeAllValues:function(){this._values&&(this._values.length=0),this.jCal.length=3},setValues:function(a){if(!this.isMultiValue)throw new Error(this.name+`: does not not support mulitValue.
|
|
override isMultiValue`);var o=a.length,h=0;if(this.removeAllValues(),o>0&&typeof a[0]=="object"&&"icaltype"in a[0]&&this.resetType(a[0].icaltype),this.isDecorated)for(;h<o;h++)this._setDecoratedValue(a[h],h);else for(;h<o;h++)this.jCal[i+h]=a[h]},setValue:function(a){this.removeAllValues(),typeof a=="object"&&"icaltype"in a&&this.resetType(a.icaltype),this.isDecorated?this._setDecoratedValue(a,0):this.jCal[i]=a},toJSON:function(){return this.jCal},toICALString:function(){return s.stringify.property(this.jCal,this._designSet,!0)}},n.fromString=function(a,o){return new n(s.parse.property(a,o))},n}();s.UtcOffset=function(){function u(r){this.fromData(r)}return u.prototype={hours:0,minutes:0,factor:1,icaltype:"utc-offset",clone:function(){return s.UtcOffset.fromSeconds(this.toSeconds())},fromData:function(r){if(r)for(var t in r)r.hasOwnProperty(t)&&(this[t]=r[t]);this._normalize()},fromSeconds:function(r){var t=Math.abs(r);return this.factor=r<0?-1:1,this.hours=s.helpers.trunc(t/3600),t-=this.hours*3600,this.minutes=s.helpers.trunc(t/60),this},toSeconds:function(){return this.factor*(60*this.minutes+3600*this.hours)},compare:function(t){var i=this.toSeconds(),e=t.toSeconds();return(i>e)-(e>i)},_normalize:function(){for(var r=this.toSeconds(),t=this.factor;r<-43200;)r+=97200;for(;r>50400;)r-=97200;this.fromSeconds(r),r==0&&(this.factor=t)},toICALString:function(){return s.design.icalendar.value["utc-offset"].toICAL(this.toString())},toString:function(){return(this.factor==1?"+":"-")+s.helpers.pad2(this.hours)+":"+s.helpers.pad2(this.minutes)}},u.fromString=function(r){var t={};return t.factor=r[0]==="+"?1:-1,t.hours=s.helpers.strictParseInt(r.substr(1,2)),t.minutes=s.helpers.strictParseInt(r.substr(4,2)),new s.UtcOffset(t)},u.fromSeconds=function(r){var t=new u;return t.fromSeconds(r),t},u}();s.Binary=function(){function u(r){this.value=r}return u.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 i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e,n,a,o,h,p,c,d,f=0,m=0,v="",y=[];if(!t)return t;do e=t.charCodeAt(f++),n=t.charCodeAt(f++),a=t.charCodeAt(f++),d=e<<16|n<<8|a,o=d>>18&63,h=d>>12&63,p=d>>6&63,c=d&63,y[m++]=i.charAt(o)+i.charAt(h)+i.charAt(p)+i.charAt(c);while(f<t.length);v=y.join("");var g=t.length%3;return(g?v.slice(0,g-3):v)+"===".slice(g||3)},_b64_decode:function(t){var i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e,n,a,o,h,p,c,d,f=0,m=0,v="",y=[];if(!t)return t;t+="";do o=i.indexOf(t.charAt(f++)),h=i.indexOf(t.charAt(f++)),p=i.indexOf(t.charAt(f++)),c=i.indexOf(t.charAt(f++)),d=o<<18|h<<12|p<<6|c,e=d>>16&255,n=d>>8&255,a=d&255,p==64?y[m++]=String.fromCharCode(e):c==64?y[m++]=String.fromCharCode(e,n):y[m++]=String.fromCharCode(e,n,a);while(f<t.length);return v=y.join(""),v},toString:function(){return this.value}},u.fromString=function(r){return new u(r)},u}();(function(){s.Period=function(r){if(this.wrappedJSObject=this,r&&"start"in r){if(r.start&&!(r.start instanceof s.Time))throw new TypeError(".start must be an instance of ICAL.Time");this.start=r.start}if(r&&r.end&&r.duration)throw new Error("cannot accept both end and duration");if(r&&"end"in r){if(r.end&&!(r.end instanceof s.Time))throw new TypeError(".end must be an instance of ICAL.Time");this.end=r.end}if(r&&"duration"in r){if(r.duration&&!(r.duration instanceof s.Duration))throw new TypeError(".duration must be an instance of ICAL.Duration");this.duration=r.duration}},s.Period.prototype={start:null,end:null,duration:null,icalclass:"icalperiod",icaltype:"period",clone:function(){return s.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 u=this.start.clone();return u.addDuration(this.duration),u},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()}},s.Period.fromString=function(r,t){var i=r.split("/");if(i.length!==2)throw new Error('Invalid string value: "'+r+'" must contain a "/" char.');var e={start:s.Time.fromDateTimeString(i[0],t)},n=i[1];return s.Duration.isValueString(n)?e.duration=s.Duration.fromString(n):e.end=s.Time.fromDateTimeString(n,t),new s.Period(e)},s.Period.fromData=function(r){return new s.Period(r)},s.Period.fromJSON=function(u,r,t){function i(e,n){return t?s.Time.fromString(e,n):s.Time.fromDateTimeString(e,n)}return s.Duration.isValueString(u[1])?s.Period.fromData({start:i(u[0],r),duration:s.Duration.fromString(u[1])}):s.Period.fromData({start:i(u[0],r),end:i(u[1],r)})}})();(function(){var u=/([PDWHMTS]{1,1})/;s.Duration=function(i){this.wrappedJSObject=this,this.fromData(i)},s.Duration.prototype={weeks:0,days:0,hours:0,minutes:0,seconds:0,isNegative:!1,icalclass:"icalduration",icaltype:"duration",clone:function(){return s.Duration.fromData(this)},toSeconds:function(){var i=this.seconds+60*this.minutes+3600*this.hours+86400*this.days+604800*this.weeks;return this.isNegative?-i:i},fromSeconds:function(i){var e=Math.abs(i);return this.isNegative=i<0,this.days=s.helpers.trunc(e/86400),this.days%7==0?(this.weeks=this.days/7,this.days=0):this.weeks=0,e-=(this.days+7*this.weeks)*86400,this.hours=s.helpers.trunc(e/3600),e-=this.hours*3600,this.minutes=s.helpers.trunc(e/60),e-=this.minutes*60,this.seconds=e,this},fromData:function(i){var e=["weeks","days","hours","minutes","seconds","isNegative"];for(var n in e)if(e.hasOwnProperty(n)){var a=e[n];i&&a in i?this[a]=i[a]:this[a]=0}},reset:function(){this.isNegative=!1,this.weeks=0,this.days=0,this.hours=0,this.minutes=0,this.seconds=0},compare:function(i){var e=this.toSeconds(),n=i.toSeconds();return(e>n)-(e<n)},normalize:function(){this.fromSeconds(this.toSeconds())},toString:function(){if(this.toSeconds()==0)return"PT0S";var i="";return this.isNegative&&(i+="-"),i+="P",this.weeks&&(i+=this.weeks+"W"),this.days&&(i+=this.days+"D"),(this.hours||this.minutes||this.seconds)&&(i+="T",this.hours&&(i+=this.hours+"H"),this.minutes&&(i+=this.minutes+"M"),this.seconds&&(i+=this.seconds+"S")),i},toICALString:function(){return this.toString()}},s.Duration.fromSeconds=function(i){return new s.Duration().fromSeconds(i)};function r(t,i,e){var n;switch(t){case"P":i&&i==="-"?e.isNegative=!0:e.isNegative=!1;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(!i&&i!==0)throw new Error('invalid duration value: Missing number before "'+t+'"');var a=parseInt(i,10);if(s.helpers.isStrictlyNaN(a))throw new Error('invalid duration value: Invalid number "'+i+'" before "'+t+'"');e[n]=a}return 1}s.Duration.isValueString=function(t){return t[0]==="P"||t[1]==="P"},s.Duration.fromString=function(i){for(var e=0,n=Object.create(null),a=0;(e=i.search(u))!==-1;){var o=i[e],h=i.substr(0,e);i=i.substr(e+1),a+=r(o,h,n)}if(a<2)throw new Error('invalid duration value: Not enough duration components in "'+i+'"');return new s.Duration(n)},s.Duration.fromData=function(i){return new s.Duration(i)}})();(function(){var u=["tzid","location","tznames","latitude","longitude"];s.Timezone=function(t){this.wrappedJSObject=this,this.fromData(t)},s.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 s.Component)this.component=t;else{if(t&&"component"in t)if(typeof t.component=="string"){var i=s.parse(t.component);this.component=new s.Component(i)}else t.component instanceof s.Component?this.component=t.component:this.component=null;for(var e in u)if(u.hasOwnProperty(e)){var n=u[e];t&&n in t&&(this[n]=t[n])}}return this.component instanceof s.Component&&!this.tzid&&(this.tzid=this.component.getFirstPropertyValue("tzid")),this},utcOffset:function(t){if(this==s.Timezone.utcTimezone||this==s.Timezone.localTimezone||(this._ensureCoverage(t.year),!this.changes.length))return 0;for(var i={year:t.year,month:t.month,day:t.day,hour:t.hour,minute:t.minute,second:t.second},e=this._findNearbyChange(i),n=-1,a=1;;){var o=s.helpers.clone(this.changes[e],!0);o.utcOffset<o.prevUtcOffset?s.Timezone.adjust_change(o,0,0,0,o.utcOffset):s.Timezone.adjust_change(o,0,0,0,o.prevUtcOffset);var h=s.Timezone._compare_change_fn(i,o);if(h>=0?n=e:a=-1,a==-1&&n!=-1)break;if(e+=a,e<0)return 0;if(e>=this.changes.length)break}var p=this.changes[n],c=p.utcOffset-p.prevUtcOffset;if(c<0&&n>0){var d=s.helpers.clone(p,!0);if(s.Timezone.adjust_change(d,0,0,0,d.prevUtcOffset),s.Timezone._compare_change_fn(i,d)<0){var f=this.changes[n-1],m=!1;p.is_daylight!=m&&f.is_daylight==m&&(p=f)}}return p.utcOffset},_findNearbyChange:function(t){var i=s.helpers.binsearchInsert(this.changes,t,s.Timezone._compare_change_fn);return i>=this.changes.length?this.changes.length-1:i},_ensureCoverage:function(r){if(s.Timezone._minimumExpansionYear==-1){var t=s.Time.now();s.Timezone._minimumExpansionYear=t.year}var i=r;if(i<s.Timezone._minimumExpansionYear&&(i=s.Timezone._minimumExpansionYear),i+=s.Timezone.EXTRA_COVERAGE,i>s.Timezone.MAX_YEAR&&(i=s.Timezone.MAX_YEAR),!this.changes.length||this.expandedUntilYear<r){for(var e=this.component.getAllSubcomponents(),n=e.length,a=0;a<n;a++)this._expandComponent(e[a],i,this.changes);this.changes.sort(s.Timezone._compare_change_fn),this.expandedUntilYear=i}},_expandComponent:function(r,t,i){if(!r.hasProperty("dtstart")||!r.hasProperty("tzoffsetto")||!r.hasProperty("tzoffsetfrom"))return null;var e=r.getFirstProperty("dtstart").getFirstValue(),n;function a(y){return y.factor*(y.hours*3600+y.minutes*60)}function o(){var y={};return y.is_daylight=r.name=="daylight",y.utcOffset=a(r.getFirstProperty("tzoffsetto").getFirstValue()),y.prevUtcOffset=a(r.getFirstProperty("tzoffsetfrom").getFirstValue()),y}if(!r.hasProperty("rrule")&&!r.hasProperty("rdate"))n=o(),n.year=e.year,n.month=e.month,n.day=e.day,n.hour=e.hour,n.minute=e.minute,n.second=e.second,s.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset),i.push(n);else{var h=r.getAllProperties("rdate");for(var p in h)if(h.hasOwnProperty(p)){var c=h[p],d=c.getFirstValue();n=o(),n.year=d.year,n.month=d.month,n.day=d.day,d.isDate?(n.hour=e.hour,n.minute=e.minute,n.second=e.second,e.zone!=s.Timezone.utcTimezone&&s.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset)):(n.hour=d.hour,n.minute=d.minute,n.second=d.second,d.zone!=s.Timezone.utcTimezone&&s.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset)),i.push(n)}var f=r.getFirstProperty("rrule");if(f){f=f.getFirstValue(),n=o(),f.until&&f.until.zone==s.Timezone.utcTimezone&&(f.until.adjust(0,0,0,n.prevUtcOffset),f.until.zone=s.Timezone.localTimezone);for(var m=f.iterator(e),v;(v=m.next())&&(n=o(),!(v.year>t||!v));)n.year=v.year,n.month=v.month,n.day=v.day,n.hour=v.hour,n.minute=v.minute,n.second=v.second,n.isDate=v.isDate,s.Timezone.adjust_change(n,0,0,0,-n.prevUtcOffset),i.push(n)}}return i},toString:function(){return this.tznames?this.tznames:this.tzid}},s.Timezone._compare_change_fn=function(t,i){return t.year<i.year?-1:t.year>i.year?1:t.month<i.month?-1:t.month>i.month?1:t.day<i.day?-1:t.day>i.day?1:t.hour<i.hour?-1:t.hour>i.hour?1:t.minute<i.minute?-1:t.minute>i.minute?1:t.second<i.second?-1:t.second>i.second?1:0},s.Timezone.convert_time=function(t,i,e){if(t.isDate||i.tzid==e.tzid||i==s.Timezone.localTimezone||e==s.Timezone.localTimezone)return t.zone=e,t;var n=i.utcOffset(t);return t.adjust(0,0,0,-n),n=e.utcOffset(t),t.adjust(0,0,0,n),null},s.Timezone.fromData=function(t){var i=new s.Timezone;return i.fromData(t)},s.Timezone.utcTimezone=s.Timezone.fromData({tzid:"UTC"}),s.Timezone.localTimezone=s.Timezone.fromData({tzid:"floating"}),s.Timezone.adjust_change=function(t,i,e,n,a){return s.Time.prototype.adjust.call(t,i,e,n,a,t)},s.Timezone._minimumExpansionYear=-1,s.Timezone.MAX_YEAR=2035,s.Timezone.EXTRA_COVERAGE=5})();s.TimezoneService=function(){var u,r={get count(){return Object.keys(u).length},reset:function(){u=Object.create(null);var t=s.Timezone.utcTimezone;u.Z=t,u.UTC=t,u.GMT=t},has:function(t){return!!u[t]},get:function(t){return u[t]},register:function(t,i){if(t instanceof s.Component&&t.name==="vtimezone"&&(i=new s.Timezone(t),t=i.tzid),i instanceof s.Timezone)u[t]=i;else throw new TypeError("timezone must be ICAL.Timezone or ICAL.Component")},remove:function(t){return delete u[t]}};return r.reset(),r}();(function(){s.Time=function(r,t){this.wrappedJSObject=this;var i=this._time=Object.create(null);i.year=0,i.month=1,i.day=1,i.hour=0,i.minute=0,i.second=0,i.isDate=!1,this.fromData(r,t)},s.Time._dowCache={},s.Time._wnCache={},s.Time.prototype={icalclass:"icaltime",_cachedUnixTime:null,get icaltype(){return this.isDate?"date":"date-time"},zone:null,_pendingNormalization:!1,clone:function(){return new s.Time(this._time,this.zone)},reset:function(){this.fromData(s.Time.epochTime),this.zone=s.Timezone.utcTimezone},resetTo:function(r,t,i,e,n,a,o){this.fromData({year:r,month:t,day:i,hour:e,minute:n,second:a,zone:o})},fromJSDate:function(r,t){return r?t?(this.zone=s.Timezone.utcTimezone,this.year=r.getUTCFullYear(),this.month=r.getUTCMonth()+1,this.day=r.getUTCDate(),this.hour=r.getUTCHours(),this.minute=r.getUTCMinutes(),this.second=r.getUTCSeconds()):(this.zone=s.Timezone.localTimezone,this.year=r.getFullYear(),this.month=r.getMonth()+1,this.day=r.getDate(),this.hour=r.getHours(),this.minute=r.getMinutes(),this.second=r.getSeconds()):this.reset(),this._cachedUnixTime=null,this},fromData:function(r,t){if(r){for(var i in r)if(Object.prototype.hasOwnProperty.call(r,i)){if(i==="icaltype")continue;this[i]=r[i]}}if(t&&(this.zone=t),r&&!("isDate"in r)?this.isDate=!("hour"in r):r&&"isDate"in r&&(this.isDate=r.isDate),r&&"timezone"in r){var e=s.TimezoneService.get(r.timezone);this.zone=e||s.Timezone.localTimezone}return r&&"zone"in r&&(this.zone=r.zone),this.zone||(this.zone=s.Timezone.localTimezone),this._cachedUnixTime=null,this},dayOfWeek:function(r){var t=r||s.Time.SUNDAY,i=(this.year<<12)+(this.month<<8)+(this.day<<3)+t;if(i in s.Time._dowCache)return s.Time._dowCache[i];var e=this.day,n=this.month+(this.month<3?12:0),a=this.year-(this.month<3?1:0),o=e+a+s.helpers.trunc((n+1)*26/10)+s.helpers.trunc(a/4);return o+=s.helpers.trunc(a/100)*6+s.helpers.trunc(a/400),o=(o+7-t)%7+1,s.Time._dowCache[i]=o,o},dayOfYear:function(){var r=s.Time.isLeapYear(this.year)?1:0,t=s.Time.daysInYearPassedMonth;return t[r][this.month-1]+this.day},startOfWeek:function(r){var t=r||s.Time.SUNDAY,i=this.clone();return i.day-=(this.dayOfWeek()+7-t)%7,i.isDate=!0,i.hour=0,i.minute=0,i.second=0,i},endOfWeek:function(r){var t=r||s.Time.SUNDAY,i=this.clone();return i.day+=(7-this.dayOfWeek()+t-s.Time.SUNDAY)%7,i.isDate=!0,i.hour=0,i.minute=0,i.second=0,i},startOfMonth:function(){var r=this.clone();return r.day=1,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r},endOfMonth:function(){var r=this.clone();return r.day=s.Time.daysInMonth(r.month,r.year),r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r},startOfYear:function(){var r=this.clone();return r.day=1,r.month=1,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r},endOfYear:function(){var r=this.clone();return r.day=31,r.month=12,r.isDate=!0,r.hour=0,r.minute=0,r.second=0,r},startDoyWeek:function(r){var t=r||s.Time.SUNDAY,i=this.dayOfWeek()-t;return i<0&&(i+=7),this.dayOfYear()-i},getDominicalLetter:function(){return s.Time.getDominicalLetter(this.year)},nthWeekDay:function(r,t){var i=s.Time.daysInMonth(this.month,this.year),e,n=t,a=0,o=this.clone();if(n>=0){o.day=1,n!=0&&n--,a=o.day;var h=o.dayOfWeek(),p=r-h;p<0&&(p+=7),a+=p,a-=r,e=r}else{o.day=i;var c=o.dayOfWeek();n++,e=c-r,e<0&&(e+=7),e=i-e}return e+=n*7,a+e},isNthWeekDay:function(u,r){var t=this.dayOfWeek();if(r===0&&t===u)return!0;var i=this.nthWeekDay(u,r);return i===this.day},weekNumber:function(r){var t=(this.year<<12)+(this.month<<8)+(this.day<<3)+r;if(t in s.Time._wnCache)return s.Time._wnCache[t];var i,e=this.clone();e.isDate=!0;var n=this.year;e.month==12&&e.day>25?(i=s.Time.weekOneStarts(n+1,r),e.compare(i)<0?i=s.Time.weekOneStarts(n,r):n++):(i=s.Time.weekOneStarts(n,r),e.compare(i)<0&&(i=s.Time.weekOneStarts(--n,r)));var a=e.subtractDate(i).toSeconds()/86400,o=s.helpers.trunc(a/7)+1;return s.Time._wnCache[t]=o,o},addDuration:function(r){var t=r.isNegative?-1:1,i=this.second,e=this.minute,n=this.hour,a=this.day;i+=t*r.seconds,e+=t*r.minutes,n+=t*r.hours,a+=t*r.days,a+=t*7*r.weeks,this.second=i,this.minute=e,this.hour=n,this.day=a,this._cachedUnixTime=null},subtractDate:function(r){var t=this.toUnixTime()+this.utcOffset(),i=r.toUnixTime()+r.utcOffset();return s.Duration.fromSeconds(t-i)},subtractDateTz:function(r){var t=this.toUnixTime(),i=r.toUnixTime();return s.Duration.fromSeconds(t-i)},compare:function(r){var t=this.toUnixTime(),i=r.toUnixTime();return t>i?1:i>t?-1:0},compareDateOnlyTz:function(r,t){function i(o){return s.Time._cmp_attr(e,n,o)}var e=this.convertToZone(t),n=r.convertToZone(t),a=0;return(a=i("year"))!=0||(a=i("month"))!=0||(a=i("day"))!=0,a},convertToZone:function(r){var t=this.clone(),i=this.zone.tzid==r.tzid;return!this.isDate&&!i&&s.Timezone.convert_time(t,this.zone,r),t.zone=r,t},utcOffset:function(){return this.zone==s.Timezone.localTimezone||this.zone==s.Timezone.utcTimezone?0:this.zone.utcOffset(this)},toICALString:function(){var u=this.toString();return u.length>10?s.design.icalendar.value["date-time"].toICAL(u):s.design.icalendar.value.date.toICAL(u)},toString:function(){var r=this.year+"-"+s.helpers.pad2(this.month)+"-"+s.helpers.pad2(this.day);return this.isDate||(r+="T"+s.helpers.pad2(this.hour)+":"+s.helpers.pad2(this.minute)+":"+s.helpers.pad2(this.second),this.zone===s.Timezone.utcTimezone&&(r+="Z")),r},toJSDate:function(){return this.zone==s.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(this.toUnixTime()*1e3)},_normalize:function(){var r=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(r,t,i,e,n){var a,o,h=0,p=0,c,d,f,m,v,y=n||this._time;if(y.isDate||(c=y.second+e,y.second=c%60,a=s.helpers.trunc(c/60),y.second<0&&(y.second+=60,a--),d=y.minute+i+a,y.minute=d%60,o=s.helpers.trunc(d/60),y.minute<0&&(y.minute+=60,o--),f=y.hour+t+o,y.hour=f%24,h=s.helpers.trunc(f/24),y.hour<0&&(y.hour+=24,h--)),y.month>12?p=s.helpers.trunc((y.month-1)/12):y.month<1&&(p=s.helpers.trunc(y.month/12)-1),y.year+=p,y.month-=12*p,m=y.day+r+h,m>0)for(;v=s.Time.daysInMonth(y.month,y.year),!(m<=v);)y.month++,y.month>12&&(y.year++,y.month=1),m-=v;else for(;m<=0;)y.month==1?(y.year--,y.month=12):y.month--,m+=s.Time.daysInMonth(y.month,y.year);return y.day=m,this._cachedUnixTime=null,this},fromUnixTime:function(r){this.zone=s.Timezone.utcTimezone;var t=s.Time.epochTime.clone();t.adjust(0,0,0,r),this.year=t.year,this.month=t.month,this.day=t.day,this.hour=t.hour,this.minute=t.minute,this.second=Math.floor(t.second),this._cachedUnixTime=null},toUnixTime:function(){if(this._cachedUnixTime!==null)return this._cachedUnixTime;var r=this.utcOffset(),t=Date.UTC(this.year,this.month-1,this.day,this.hour,this.minute,this.second-r);return this._cachedUnixTime=t/1e3,this._cachedUnixTime},toJSON:function(){for(var u=["year","month","day","hour","minute","second","isDate"],r=Object.create(null),t=0,i=u.length,e;t<i;t++)e=u[t],r[e]=this[e];return this.zone&&(r.timezone=this.zone.tzid),r}},function(){function r(t){Object.defineProperty(s.Time.prototype,t,{get:function(){return this._pendingNormalization&&(this._normalize(),this._pendingNormalization=!1),this._time[t]},set:function(e){return t==="isDate"&&e&&!this._time.isDate&&this.adjust(0,0,0,0),this._cachedUnixTime=null,this._pendingNormalization=!0,this._time[t]=e,e}})}"defineProperty"in Object&&(r("year"),r("month"),r("day"),r("hour"),r("minute"),r("second"),r("isDate"))}(),s.Time.daysInMonth=function(r,t){var i=[0,31,28,31,30,31,30,31,31,30,31,30,31],e=30;return r<1||r>12||(e=i[r],r==2&&(e+=s.Time.isLeapYear(t))),e},s.Time.isLeapYear=function(r){return r<=1752?r%4==0:r%4==0&&r%100!=0||r%400==0},s.Time.fromDayOfYear=function(r,t){var i=t,e=r,n=new s.Time;n.auto_normalize=!1;var a=s.Time.isLeapYear(i)?1:0;if(e<1)return i--,a=s.Time.isLeapYear(i)?1:0,e+=s.Time.daysInYearPassedMonth[a][12],s.Time.fromDayOfYear(e,i);if(e>s.Time.daysInYearPassedMonth[a][12])return a=s.Time.isLeapYear(i)?1:0,e-=s.Time.daysInYearPassedMonth[a][12],i++,s.Time.fromDayOfYear(e,i);n.year=i,n.isDate=!0;for(var o=11;o>=0;o--)if(e>s.Time.daysInYearPassedMonth[a][o]){n.month=o+1,n.day=e-s.Time.daysInYearPassedMonth[a][o];break}return n.auto_normalize=!0,n},s.Time.fromStringv2=function(r){return new s.Time({year:parseInt(r.substr(0,4),10),month:parseInt(r.substr(5,2),10),day:parseInt(r.substr(8,2),10),isDate:!0})},s.Time.fromDateString=function(u){return new s.Time({year:s.helpers.strictParseInt(u.substr(0,4)),month:s.helpers.strictParseInt(u.substr(5,2)),day:s.helpers.strictParseInt(u.substr(8,2)),isDate:!0})},s.Time.fromDateTimeString=function(u,r){if(u.length<19)throw new Error('invalid date-time value: "'+u+'"');var t;u[19]&&u[19]==="Z"?t="Z":r&&(t=r.getParameter("tzid"));var i=new s.Time({year:s.helpers.strictParseInt(u.substr(0,4)),month:s.helpers.strictParseInt(u.substr(5,2)),day:s.helpers.strictParseInt(u.substr(8,2)),hour:s.helpers.strictParseInt(u.substr(11,2)),minute:s.helpers.strictParseInt(u.substr(14,2)),second:s.helpers.strictParseInt(u.substr(17,2)),timezone:t});return i},s.Time.fromString=function(r,t){return r.length>10?s.Time.fromDateTimeString(r,t):s.Time.fromDateString(r)},s.Time.fromJSDate=function(r,t){var i=new s.Time;return i.fromJSDate(r,t)},s.Time.fromData=function(r,t){var i=new s.Time;return i.fromData(r,t)},s.Time.now=function(){return s.Time.fromJSDate(new Date,!1)},s.Time.weekOneStarts=function(r,t){var i=s.Time.fromData({year:r,month:1,day:1,isDate:!0}),e=i.dayOfWeek(),n=t||s.Time.DEFAULT_WEEK_START;return e>s.Time.THURSDAY&&(i.day+=7),n>s.Time.THURSDAY&&(i.day-=7),i.day-=e-n,i},s.Time.getDominicalLetter=function(u){var r="GFEDCBA",t=(u+(u/4|0)+(u/400|0)-(u/100|0)-1)%7,i=s.Time.isLeapYear(u);return i?r[(t+6)%7]+r[t]:r[t]},s.Time.epochTime=s.Time.fromData({year:1970,month:1,day:1,hour:0,minute:0,second:0,isDate:!1,timezone:"Z"}),s.Time._cmp_attr=function(r,t,i){return r[i]>t[i]?1:r[i]<t[i]?-1:0},s.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]],s.Time.SUNDAY=1,s.Time.MONDAY=2,s.Time.TUESDAY=3,s.Time.WEDNESDAY=4,s.Time.THURSDAY=5,s.Time.FRIDAY=6,s.Time.SATURDAY=7,s.Time.DEFAULT_WEEK_START=s.Time.MONDAY})();(function(){s.VCardTime=function(u,r,t){this.wrappedJSObject=this;var i=this._time=Object.create(null);i.year=null,i.month=null,i.day=null,i.hour=null,i.minute=null,i.second=null,this.icaltype=t||"date-and-or-time",this.fromData(u,r)},s.helpers.inherits(s.Time,s.VCardTime,{icalclass:"vcardtime",icaltype:"date-and-or-time",zone:null,clone:function(){return new s.VCardTime(this._time,this.zone,this.icaltype)},_normalize:function(){return this},utcOffset:function(){return this.zone instanceof s.UtcOffset?this.zone.toSeconds():s.Time.prototype.utcOffset.apply(this,arguments)},toICALString:function(){return s.design.vcard.value[this.icaltype].toICAL(this.toString())},toString:function(){var r=s.helpers.pad2,t=this.year,i=this.month,e=this.day,n=this.hour,a=this.minute,o=this.second,h=t!==null,p=i!==null,c=e!==null,d=n!==null,f=a!==null,m=o!==null,v=(h?r(t)+(p||c?"-":""):p||c?"--":"")+(p?r(i):"")+(c?"-"+r(e):""),y=(d?r(n):"-")+(d&&f?":":"")+(f?r(a):"")+(!d&&!f?"-":"")+(f&&m?":":"")+(m?r(o):""),g;if(this.zone===s.Timezone.utcTimezone)g="Z";else if(this.zone instanceof s.UtcOffset)g=this.zone.toString();else if(this.zone===s.Timezone.localTimezone)g="";else if(this.zone instanceof s.Timezone){var w=s.UtcOffset.fromSeconds(this.zone.utcOffset(this));g=w.toString()}else g="";switch(this.icaltype){case"time":return y+g;case"date-and-or-time":case"date-time":return v+(y=="--"?"":"T"+y+g);case"date":return v}return null}}),s.VCardTime.fromDateAndOrTimeString=function(u,r){function t(y,g,w){return y?s.helpers.strictParseInt(y.substr(g,w)):null}var i=u.split("T"),e=i[0],n=i[1],a=n?s.design.vcard.value.time._splitZone(n):[],o=a[0],h=a[1],p=s.helpers.strictParseInt,c=e?e.length:0,d=h?h.length:0,f=e&&e[0]=="-"&&e[1]=="-",m=h&&h[0]=="-",v={year:f?null:t(e,0,4),month:f&&(c==4||c==7)?t(e,2,2):c==7||c==10?t(e,5,2):null,day:c==5?t(e,3,2):c==7&&f?t(e,5,2):c==10?t(e,8,2):null,hour:m?null:t(h,0,2),minute:m&&d==3?t(h,1,2):d>4?m?t(h,1,2):t(h,3,2):null,second:d==4?t(h,2,2):d==6?t(h,4,2):d==8?t(h,6,2):null};return o=="Z"?o=s.Timezone.utcTimezone:o&&o[3]==":"?o=s.UtcOffset.fromString(o):o=null,new s.VCardTime(v,o,r)}})();(function(){var u={SU:s.Time.SUNDAY,MO:s.Time.MONDAY,TU:s.Time.TUESDAY,WE:s.Time.WEDNESDAY,TH:s.Time.THURSDAY,FR:s.Time.FRIDAY,SA:s.Time.SATURDAY},r={};for(var t in u)u.hasOwnProperty(t)&&(r[u[t]]=t);var i=["BYSECOND","BYMINUTE","BYHOUR","BYDAY","BYMONTHDAY","BYYEARDAY","BYWEEKNO","BYMONTH","BYSETPOS"];s.Recur=function(d){this.wrappedJSObject=this,this.parts={},d&&typeof d=="object"&&this.fromData(d)},s.Recur.prototype={parts:null,interval:1,wkst:s.Time.MONDAY,until:null,count:null,freq:null,icalclass:"icalrecur",icaltype:"recur",iterator:function(c){return new s.RecurIterator({rule:this,dtstart:c})},clone:function(){return new s.Recur(this.toJSON())},isFinite:function(){return!!(this.count||this.until)},isByCount:function(){return!!(this.count&&!this.until)},addComponent:function(d,f){var m=d.toUpperCase();m in this.parts?this.parts[m].push(f):this.parts[m]=[f]},setComponent:function(d,f){this.parts[d.toUpperCase()]=f.slice()},getComponent:function(d){var f=d.toUpperCase();return f in this.parts?this.parts[f].slice():[]},getNextOccurrence:function(d,f){var m=this.iterator(d),v,y;do v=m.next();while(v&&v.compare(f)<=0);return v&&f.zone&&(v.zone=f.zone),v},fromData:function(c){for(var d in c){var f=d.toUpperCase();f in p?Array.isArray(c[d])?this.parts[f]=c[d]:this.parts[f]=[c[d]]:this[d]=c[d]}this.interval&&typeof this.interval!="number"&&h.INTERVAL(this.interval,this),this.wkst&&typeof this.wkst!="number"&&(this.wkst=s.Recur.icalDayToNumericDay(this.wkst)),this.until&&!(this.until instanceof s.Time)&&(this.until=s.Time.fromString(this.until))},toJSON:function(){var c=Object.create(null);c.freq=this.freq,this.count&&(c.count=this.count),this.interval>1&&(c.interval=this.interval);for(var d in this.parts)if(this.parts.hasOwnProperty(d)){var f=this.parts[d];Array.isArray(f)&&f.length==1?c[d.toLowerCase()]=f[0]:c[d.toLowerCase()]=s.helpers.clone(this.parts[d])}return this.until&&(c.until=this.until.toString()),"wkst"in this&&this.wkst!==s.Time.DEFAULT_WEEK_START&&(c.wkst=s.Recur.numericDayToIcalDay(this.wkst)),c},toString:function(){var d="FREQ="+this.freq;this.count&&(d+=";COUNT="+this.count),this.interval>1&&(d+=";INTERVAL="+this.interval);for(var f in this.parts)this.parts.hasOwnProperty(f)&&(d+=";"+f+"="+this.parts[f]);return this.until&&(d+=";UNTIL="+this.until.toICALString()),"wkst"in this&&this.wkst!==s.Time.DEFAULT_WEEK_START&&(d+=";WKST="+s.Recur.numericDayToIcalDay(this.wkst)),d}};function e(c,d,f,m){var v=m;if(m[0]==="+"&&(v=m.substr(1)),v=s.helpers.strictParseInt(v),d!==void 0&&m<d)throw new Error(c+': invalid value "'+m+'" must be > '+d);if(f!==void 0&&m>f)throw new Error(c+': invalid value "'+m+'" must be < '+d);return v}s.Recur.icalDayToNumericDay=function(d,f){var m=f||s.Time.SUNDAY;return(u[d]-m+7)%7+1},s.Recur.numericDayToIcalDay=function(d,f){var m=f||s.Time.SUNDAY,v=d+m-s.Time.SUNDAY;return v>7&&(v-=7),r[v]};var n=/^(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"],h={FREQ:function(c,d,f){if(o.indexOf(c)!==-1)d.freq=c;else throw new Error('invalid frequency "'+c+'" expected: "'+o.join(", ")+'"')},COUNT:function(c,d,f){d.count=s.helpers.strictParseInt(c)},INTERVAL:function(c,d,f){d.interval=s.helpers.strictParseInt(c),d.interval<1&&(d.interval=1)},UNTIL:function(c,d,f){c.length>10?d.until=s.design.icalendar.value["date-time"].fromICAL(c):d.until=s.design.icalendar.value.date.fromICAL(c),f||(d.until=s.Time.fromString(d.until))},WKST:function(c,d,f){if(n.test(c))d.wkst=s.Recur.icalDayToNumericDay(c);else throw new Error('invalid WKST value "'+c+'"')}},p={BYSECOND:e.bind(this,"BYSECOND",0,60),BYMINUTE:e.bind(this,"BYMINUTE",0,59),BYHOUR:e.bind(this,"BYHOUR",0,23),BYDAY:function(c){if(a.test(c))return c;throw new Error('invalid BYDAY value "'+c+'"')},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",1,12),BYSETPOS:e.bind(this,"BYSETPOS",-366,366)};s.Recur.fromString=function(c){var d=s.Recur._stringToData(c,!1);return new s.Recur(d)},s.Recur.fromData=function(c){return new s.Recur(c)},s.Recur._stringToData=function(c,d){for(var f=Object.create(null),m=c.split(";"),v=m.length,y=0;y<v;y++){var g=m[y].split("="),w=g[0].toUpperCase(),_=g[0].toLowerCase(),Y=d?_:w,D=g[1];if(w in p){for(var O=D.split(","),A=0,S=O.length;A<S;A++)O[A]=p[w](O[A]);f[Y]=O.length==1?O[0]:O}else w in h?h[w](D,f,d):f[_]=D}return f}})();s.RecurIterator=function(){function u(r){this.fromData(r)}return u.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(r){if(this.rule=s.helpers.formatClassType(r.rule,s.Recur),!this.rule)throw new Error("iterator requires a (ICAL.Recur) rule");if(this.dtstart=s.helpers.formatClassType(r.dtstart,s.Time),!this.dtstart)throw new Error("iterator requires a (ICAL.Time) dtstart");r.by_data?this.by_data=r.by_data:this.by_data=s.helpers.clone(this.rule.parts,!0),r.occurrence_number&&(this.occurrence_number=r.occurrence_number),this.days=r.days||[],r.last&&(this.last=s.helpers.formatClassType(r.last,s.Time)),this.by_indices=r.by_indices,this.by_indices||(this.by_indices={BYSECOND:0,BYMINUTE:0,BYHOUR:0,BYDAY:0,BYMONTH:0,BYWEEKNO:0,BYMONTHDAY:0}),this.initialized=r.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(this.rule.freq=="MONTHLY"&&("BYYEARDAY"in t||"BYWEEKNO"in t))throw new Error("For MONTHLY recurrences neither BYYEARDAY nor BYWEEKNO may appear");if(this.rule.freq=="WEEKLY"&&("BYYEARDAY"in t||"BYMONTHDAY"in t))throw new Error("For WEEKLY recurrences neither BYMONTHDAY nor BYYEARDAY may appear");if(this.rule.freq!="YEARLY"&&"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),this.rule.freq=="WEEKLY")if("BYDAY"in t){var i=this.ruleDayOfWeek(t.BYDAY[0],this.rule.wkst),e=i[0],n=i[1],a=n-this.last.dayOfWeek(this.rule.wkst);(this.last.dayOfWeek(this.rule.wkst)<n&&a>=0||a<0)&&(this.last.day+=a)}else{var o=s.Recur.numericDayToIcalDay(this.dtstart.dayOfWeek());t.BYDAY=[o]}if(this.rule.freq=="YEARLY"){for(;this.expand_year_days(this.last.year),!(this.days.length>0);)this.increment_year(this.rule.interval);this._nextByYearDay()}if(this.rule.freq=="MONTHLY"&&this.has_by_data("BYDAY")){var h=null,p=this.last.clone(),c=s.Time.daysInMonth(this.last.month,this.last.year);for(var d in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(d)){this.last=p.clone();var i=this.ruleDayOfWeek(this.by_data.BYDAY[d]),e=i[0],n=i[1],f=this.last.nthWeekDay(n,e);if(e>=6||e<=-6)throw new Error("Malformed values in BYDAY part");if(f>c||f<=0){if(h&&h.month==p.month)continue;for(;f>c||f<=0;)this.increment_month(),c=s.Time.daysInMonth(this.last.month,this.last.year),f=this.last.nthWeekDay(n,e)}this.last.day=f,(!h||this.last.compare(h)<0)&&(h=this.last.clone())}if(this.last=h.clone(),this.has_by_data("BYMONTHDAY")&&this._byDayAndMonthDay(!0),this.last.day>c||this.last.day==0)throw new Error("Malformed values in BYDAY part")}else if(this.has_by_data("BYMONTHDAY")&&this.last.day<0){var c=s.Time.daysInMonth(this.last.month,this.last.year);this.last.day=c+this.last.day+1}},next:function(){var t=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(this.occurrence_number==0&&this.last.compare(this.dtstart)>=0)return this.occurrence_number++,this.last;var i;do switch(i=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":i=this.next_month();break;case"YEARLY":this.next_year();break;default:return null}while(!this.check_contracting_rules()||this.last.compare(this.dtstart)<0||!i);if(this.last.compare(t)==0)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(){var t="BYDAY"in this.by_data,i=this.rule.freq=="DAILY";return this.next_hour()==0||(i?this.increment_monthday(this.rule.interval):this.increment_monthday(1)),0},next_week:function(){var t=0;if(this.next_weekday_by_week()==0)return t;if(this.has_by_data("BYWEEKNO")){var i=++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(r,t,i){for(var e=s.Time.daysInMonth(t,r),n=[],a=0,o=i.length,h;a<o;a++)if(h=i[a],!(Math.abs(h)>e)){if(h<0)h=e+(h+1);else if(h===0)continue;n.indexOf(h)===-1&&n.push(h)}return n.sort(function(p,c){return p-c})},_byDayAndMonthDay:function(r){var t,i=this.by_data.BYDAY,e,n=0,a,o=i.length,h=0,p,c=this,d=this.last.day;function f(){for(p=s.Time.daysInMonth(c.last.month,c.last.year),t=c.normalizeByMonthDayRules(c.last.year,c.last.month,c.by_data.BYMONTHDAY),a=t.length;t[n]<=d&&!(r&&t[n]==d)&&n<a-1;)n++}function m(){d=0,c.increment_month(),n=0,f()}f(),r&&(d-=1);for(var v=48;!h&&v;){if(v--,e=d+1,e>p){m();continue}var y=t[n++];if(y>=e)d=y;else{m();continue}for(var g=0;g<o;g++){var w=this.ruleDayOfWeek(i[g]),_=w[0],Y=w[1];if(this.last.day=d,this.last.isNthWeekDay(Y,_)){h=1;break}}if(!h&&n===a){m();continue}}if(v<=0)throw new Error("Malformed values in BYDAY combined with BYMONTHDAY parts");return h},next_month:function(){var t=this.rule.freq=="MONTHLY",i=1;if(this.next_hour()==0)return i;if(this.has_by_data("BYDAY")&&this.has_by_data("BYMONTHDAY"))i=this._byDayAndMonthDay();else if(this.has_by_data("BYDAY")){var e=s.Time.daysInMonth(this.last.month,this.last.year),n=0,a=0;if(this.has_by_data("BYSETPOS")){for(var o=this.last.day,h=1;h<=e;h++)this.last.day=h,this.is_day_in_byday(this.last)&&(a++,h<=o&&n++);this.last.day=o}i=0;for(var h=this.last.day+1;h<=e;h++)if(this.last.day=h,this.is_day_in_byday(this.last)&&(!this.has_by_data("BYSETPOS")||this.check_set_position(++n)||this.check_set_position(n-a-1))){i=1;break}h>e&&(this.last.day=1,this.increment_month(),this.is_day_in_byday(this.last)?(!this.has_by_data("BYSETPOS")||this.check_set_position(1))&&(i=1):i=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());var e=s.Time.daysInMonth(this.last.month,this.last.year),h=this.by_data.BYMONTHDAY[this.by_indices.BYMONTHDAY];h<0&&(h=e+h+1),h>e?(this.last.day=1,i=this.is_day_in_byday(this.last)):this.last.day=h}else{this.increment_month();var e=s.Time.daysInMonth(this.last.month,this.last.year);this.by_data.BYMONTHDAY[0]>e?i=0:this.last.day=this.by_data.BYMONTHDAY[0]}return i},next_weekday_by_week:function(){var t=0;if(this.next_hour()==0)return t;if(!this.has_by_data("BYDAY"))return 1;for(;;){var i=new s.Time;this.by_indices.BYDAY++,this.by_indices.BYDAY==Object.keys(this.by_data.BYDAY).length&&(this.by_indices.BYDAY=0,t=1);var e=this.by_data.BYDAY[this.by_indices.BYDAY],n=this.ruleDayOfWeek(e),a=n[1];a-=this.rule.wkst,a<0&&(a+=7),i.year=this.last.year,i.month=this.last.month,i.day=this.last.day;var o=i.startDoyWeek(this.rule.wkst);if(!(a+o<1&&!t)){var h=s.Time.fromDayOfYear(o+a,this.last.year);return this.last.year=h.year,this.last.month=h.month,this.last.day=h.day,t}}},next_year:function(){if(this.next_hour()==0)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(this.days.length==0)}return this._nextByYearDay(),1},_nextByYearDay:function(){var t=this.days[this.days_index],i=this.last.year;t<1&&(t+=1,i+=1);var e=s.Time.fromDayOfYear(t,i);this.last.day=e.day,this.last.month=e.month},ruleDayOfWeek:function(t,i){var e=t.match(/([+-]?[0-9])?(MO|TU|WE|TH|FR|SA|SU)/);if(e){var n=parseInt(e[1]||0,10);return t=s.Recur.icalDayToNumericDay(e[2],i),[n,t]}else return[0,0]},next_generic:function(t,i,e,n,a){var o=t in this.by_data,h=this.rule.freq==i,p=0;if(a&&this[a]()==0)return p;if(o){this.by_indices[t]++;var c=this.by_indices[t],d=this.by_data[t];this.by_indices[t]==d.length&&(this.by_indices[t]=0,p=1),this.last[e]=d[this.by_indices[t]]}else h&&this["increment_"+e](this.rule.interval);return o&&p&&h&&this["increment_"+n](1),p},increment_monthday:function(t){for(var i=0;i<t;i++){var e=s.Time.daysInMonth(this.last.month,this.last.year);this.last.day++,this.last.day>e&&(this.last.day-=e,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{this.rule.freq=="MONTHLY"?this.last.month+=this.rule.interval:this.last.month++,this.last.month--;var t=s.helpers.trunc(this.last.month/12);this.last.month%=12,this.last.month++,t!=0&&this.increment_year(t)}},increment_year:function(t){this.last.year+=t},increment_generic:function(t,i,e,n){this.last[i]+=t;var a=s.helpers.trunc(this.last[i]/e);this.last[i]%=e,a!=0&&this["increment_"+n](a)},has_by_data:function(t){return t in this.rule.parts},expand_year_days:function(t){var i=new s.Time;this.days=[];var e={},n=["BYDAY","BYWEEKNO","BYMONTHDAY","BYMONTH","BYYEARDAY"];for(var a in n)if(n.hasOwnProperty(a)){var o=n[a];o in this.rule.parts&&(e[o]=this.rule.parts[o])}if("BYMONTH"in e&&"BYWEEKNO"in e){var h=1,p={};i.year=t,i.isDate=!0;for(var c=0;c<this.by_data.BYMONTH.length;c++){var d=this.by_data.BYMONTH[c];i.month=d,i.day=1;var f=i.weekNumber(this.rule.wkst);i.day=s.Time.daysInMonth(d,t);var m=i.weekNumber(this.rule.wkst);for(c=f;c<m;c++)p[c]=1}for(var v=0;v<this.by_data.BYWEEKNO.length&&h;v++){var y=this.by_data.BYWEEKNO[v];y<52?h&=p[v]:h=0}h?delete e.BYMONTH:delete e.BYWEEKNO}var g=Object.keys(e).length;if(g==0){var w=this.dtstart.clone();w.year=this.last.year,this.days.push(w.dayOfYear())}else if(g==1&&"BYMONTH"in e){for(var _ in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(_)){var Y=this.dtstart.clone();Y.year=t,Y.month=this.by_data.BYMONTH[_],Y.isDate=!0,this.days.push(Y.dayOfYear())}}else if(g==1&&"BYMONTHDAY"in e){for(var D in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(D)){var O=this.dtstart.clone(),A=this.by_data.BYMONTHDAY[D];if(A<0){var S=s.Time.daysInMonth(O.month,t);A=A+S+1}O.day=A,O.year=t,O.isDate=!0,this.days.push(O.dayOfYear())}}else if(g==2&&"BYMONTHDAY"in e&&"BYMONTH"in e){for(var _ in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(_)){var N=this.by_data.BYMONTH[_],S=s.Time.daysInMonth(N,t);for(var D in this.by_data.BYMONTHDAY)if(this.by_data.BYMONTHDAY.hasOwnProperty(D)){var A=this.by_data.BYMONTHDAY[D];A<0&&(A=A+S+1),i.day=A,i.month=N,i.year=t,i.isDate=!0,this.days.push(i.dayOfYear())}}}else if(!(g==1&&"BYWEEKNO"in e)){if(!(g==2&&"BYWEEKNO"in e&&"BYMONTHDAY"in e))if(g==1&&"BYDAY"in e)this.days=this.days.concat(this.expand_by_day(t));else if(g==2&&"BYDAY"in e&&"BYMONTH"in e){for(var _ in this.by_data.BYMONTH)if(this.by_data.BYMONTH.hasOwnProperty(_)){var d=this.by_data.BYMONTH[_],S=s.Time.daysInMonth(d,t);i.year=t,i.month=this.by_data.BYMONTH[_],i.day=1,i.isDate=!0;var L=i.dayOfWeek(),x=i.dayOfYear()-1;i.day=S;var B=i.dayOfWeek();if(this.has_by_data("BYSETPOS")){for(var I=0,U=[],C=1;C<=S;C++)i.day=C,this.is_day_in_byday(i)&&U.push(C);for(var P=0;P<U.length;P++)(this.check_set_position(P+1)||this.check_set_position(P-U.length))&&this.days.push(x+U[P])}else for(var l in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(l)){var T=this.by_data.BYDAY[l],b=this.ruleDayOfWeek(T),E=b[0],R=b[1],M,F=(R+7-L)%7+1,st=S-(B+7-R)%7;if(E==0)for(var C=F;C<=S;C+=7)this.days.push(x+C);else E>0?(M=F+(E-1)*7,M<=S&&this.days.push(x+M)):(M=st+(E+1)*7,M>0&&this.days.push(x+M))}}this.days.sort(function(at,ot){return at-ot})}else if(g==2&&"BYDAY"in e&&"BYMONTHDAY"in e){var k=this.expand_by_day(t);for(var W in k)if(k.hasOwnProperty(W)){var C=k[W],j=s.Time.fromDayOfYear(C,t);this.by_data.BYMONTHDAY.indexOf(j.day)>=0&&this.days.push(C)}}else if(g==3&&"BYDAY"in e&&"BYMONTHDAY"in e&&"BYMONTH"in e){var k=this.expand_by_day(t);for(var W in k)if(k.hasOwnProperty(W)){var C=k[W],j=s.Time.fromDayOfYear(C,t);this.by_data.BYMONTH.indexOf(j.month)>=0&&this.by_data.BYMONTHDAY.indexOf(j.day)>=0&&this.days.push(C)}}else if(g==2&&"BYDAY"in e&&"BYWEEKNO"in e){var k=this.expand_by_day(t);for(var W in k)if(k.hasOwnProperty(W)){var C=k[W],j=s.Time.fromDayOfYear(C,t),y=j.weekNumber(this.rule.wkst);this.by_data.BYWEEKNO.indexOf(y)&&this.days.push(C)}}else g==3&&"BYDAY"in e&&"BYWEEKNO"in e&&"BYMONTHDAY"in e||(g==1&&"BYYEARDAY"in e?this.days=this.days.concat(this.by_data.BYYEARDAY):this.days=[])}return 0},expand_by_day:function(t){var i=[],e=this.last.clone();e.year=t,e.month=1,e.day=1,e.isDate=!0;var n=e.dayOfWeek();e.month=12,e.day=31,e.isDate=!0;var a=e.dayOfWeek(),o=e.dayOfYear();for(var h in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(h)){var p=this.by_data.BYDAY[h],c=this.ruleDayOfWeek(p),d=c[0],f=c[1];if(d==0)for(var m=(f+7-n)%7+1,v=m;v<=o;v+=7)i.push(v);else if(d>0){var y;f>=n?y=f-n+1:y=f-n+8,i.push(y+(d-1)*7)}else{var g;d=-d,f<=a?g=o-a+f:g=o-a+f-7,i.push(g-(d-1)*7)}}return i},is_day_in_byday:function(t){for(var i in this.by_data.BYDAY)if(this.by_data.BYDAY.hasOwnProperty(i)){var e=this.by_data.BYDAY[i],n=this.ruleDayOfWeek(e),a=n[0],o=n[1],h=t.dayOfWeek();if(a==0&&o==h||t.nthWeekDay(o,a)==t.day)return 1}return 0},check_set_position:function(t){if(this.has_by_data("BYSETPOS")){var i=this.by_data.BYSETPOS.indexOf(t);return i!==-1}return!1},sort_byday_rules:function(t){for(var i=0;i<t.length;i++)for(var e=0;e<i;e++){var n=this.ruleDayOfWeek(t[e],this.rule.wkst)[1],a=this.ruleDayOfWeek(t[i],this.rule.wkst)[1];if(n>a){var o=t[i];t[i]=t[e],t[e]=o}}},check_contract_restriction:function(t,i){var e=u._indexMap[t],n=u._expandMap[this.rule.freq][e],a=!1;if(t in this.by_data&&n==u.CONTRACT){var o=this.by_data[t];for(var h in o)if(o.hasOwnProperty(h)&&o[h]==i){a=!0;break}}else a=!0;return a},check_contracting_rules:function(){var t=this.last.dayOfWeek(),i=this.last.weekNumber(this.rule.wkst),e=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",s.Recur.numericDayToIcalDay(t))&&this.check_contract_restriction("BYWEEKNO",i)&&this.check_contract_restriction("BYMONTHDAY",this.last.day)&&this.check_contract_restriction("BYMONTH",this.last.month)&&this.check_contract_restriction("BYYEARDAY",e)},setup_defaults:function(t,i,e){var n=u._indexMap[t],a=u._expandMap[this.rule.freq][n];return a!=u.CONTRACT&&(t in this.by_data||(this.by_data[t]=[e]),this.rule.freq!=i)?this.by_data[t][0]:e},toJSON:function(){var r=Object.create(null);return r.initialized=this.initialized,r.rule=this.rule.toJSON(),r.dtstart=this.dtstart.toJSON(),r.by_data=this.by_data,r.days=this.days,r.last=this.last.toJSON(),r.by_indices=this.by_indices,r.occurrence_number=this.occurrence_number,r}},u._indexMap={BYSECOND:0,BYMINUTE:1,BYHOUR:2,BYDAY:3,BYMONTHDAY:4,BYYEARDAY:5,BYWEEKNO:6,BYMONTH:7,BYSETPOS:8},u._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]},u.UNKNOWN=0,u.CONTRACT=1,u.EXPAND=2,u.ILLEGAL=3,u}();s.RecurExpansion=function(){function u(e){return s.helpers.formatClassType(e,s.Time)}function r(e,n){return e.compare(n)}function t(e){return e.hasProperty("rdate")||e.hasProperty("rrule")||e.hasProperty("recurrence-id")}function i(e){this.ruleDates=[],this.exDates=[],this.fromData(e)}return i.prototype={complete:!1,ruleIterators:null,ruleDates:null,exDates:null,ruleDateInc:0,exDateInc:0,exDate:null,ruleDate:null,dtstart:null,last:null,fromData:function(e){var n=s.helpers.formatClassType(e.dtstart,s.Time);if(n)this.dtstart=n;else throw new Error(".dtstart (ICAL.Time) must be given");if(e.component)this._init(e.component);else{if(this.last=u(e.last)||n.clone(),!e.ruleIterators)throw new Error(".ruleIterators or .component must be given");this.ruleIterators=e.ruleIterators.map(function(a){return s.helpers.formatClassType(a,s.RecurIterator)}),this.ruleDateInc=e.ruleDateInc,this.exDateInc=e.exDateInc,e.ruleDates&&(this.ruleDates=e.ruleDates.map(u),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.exDates&&(this.exDates=e.exDates.map(u),this.exDate=this.exDates[this.exDateInc]),typeof e.complete!="undefined"&&(this.complete=e.complete)}},next:function(){for(var e,n,a,o,h=500,p=0;;){if(p++>h)throw new Error("max tries have occured, rule may be impossible to forfill.");if(a=this.ruleDate,e=this._nextRecurrenceIter(this.last),!a&&!e){this.complete=!0;break}if((!a||e&&a.compare(e.last)>0)&&(a=e.last.clone(),e.next()),this.ruleDate===a&&this._nextRuleDay(),this.last=a,this.exDate&&(o=this.exDate.compare(this.last),o<0&&this._nextExDay(),o===0)){this._nextExDay();continue}return this.last}},toJSON:function(){function e(a){return a.toJSON()}var n=Object.create(null);return n.ruleIterators=this.ruleIterators.map(e),this.ruleDates&&(n.ruleDates=this.ruleDates.map(e)),this.exDates&&(n.exDates=this.exDates.map(e)),n.ruleDateInc=this.ruleDateInc,n.exDateInc=this.exDateInc,n.last=this.last.toJSON(),n.dtstart=this.dtstart.toJSON(),n.complete=this.complete,n},_extractDates:function(e,n){function a(m){f=s.helpers.binsearchInsert(o,m,r),o.splice(f,0,m)}for(var o=[],h=e.getAllProperties(n),p=h.length,c=0,d,f;c<p;c++)h[c].getValues().forEach(a);return o},_init:function(e){if(this.ruleIterators=[],this.last=this.dtstart.clone(),!t(e)){this.ruleDate=this.last.clone(),this.complete=!0;return}if(e.hasProperty("rdate")&&(this.ruleDates=this._extractDates(e,"rdate"),this.ruleDates[0]&&this.ruleDates[0].compare(this.dtstart)<0?(this.ruleDateInc=0,this.last=this.ruleDates[0].clone()):this.ruleDateInc=s.helpers.binsearchInsert(this.ruleDates,this.last,r),this.ruleDate=this.ruleDates[this.ruleDateInc]),e.hasProperty("rrule"))for(var n=e.getAllProperties("rrule"),a=0,o=n.length,h,p;a<o;a++)h=n[a].getFirstValue(),p=h.iterator(this.dtstart),this.ruleIterators.push(p),p.next();e.hasProperty("exdate")&&(this.exDates=this._extractDates(e,"exdate"),this.exDateInc=s.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 e=this.ruleIterators;if(e.length===0)return null;for(var n=e.length,a,o,h=0,p;h<n;h++){if(a=e[h],o=a.last,a.completed){n--,h!==0&&h--,e.splice(h,1);continue}(!p||p.last.compare(o)>0)&&(p=a)}return p}},i}();s.Event=function(){function u(t,i){t instanceof s.Component||(i=t,t=null),t?this.component=t:this.component=new s.Component("vevent"),this._rangeExceptionCache=Object.create(null),this.exceptions=Object.create(null),this.rangeExceptions=[],i&&i.strictExceptions&&(this.strictExceptions=i.strictExceptions),i&&i.exceptions?i.exceptions.forEach(this.relateException,this):this.component.parent&&!this.isRecurrenceException()&&this.component.parent.getAllSubcomponents("vevent").forEach(function(e){e.hasProperty("recurrence-id")&&this.relateException(e)},this)}u.prototype={THISANDFUTURE:"THISANDFUTURE",exceptions:null,strictExceptions:!1,relateException:function(t){if(this.isRecurrenceException())throw new Error("cannot relate exception to exceptions");if(t instanceof s.Component&&(t=new s.Event(t)),this.strictExceptions&&t.uid!==this.uid)throw new Error("attempted to relate unrelated exception");var i=t.recurrenceId.toString();if(this.exceptions[i]=t,t.modifiesFuture()){var e=[t.recurrenceId.toUnixTime(),i],n=s.helpers.binsearchInsert(this.rangeExceptions,e,r);this.rangeExceptions.splice(n,0,e)}},modifiesFuture:function(){if(!this.component.hasProperty("recurrence-id"))return!1;var t=this.component.getFirstProperty("recurrence-id").getParameter("range");return t===this.THISANDFUTURE},findRangeException:function(t){if(!this.rangeExceptions.length)return null;var i=t.toUnixTime(),e=s.helpers.binsearchInsert(this.rangeExceptions,[i],r);if(e-=1,e<0)return null;var n=this.rangeExceptions[e];return i<n[0]?null:n[1]},getOccurrenceDetails:function(t){var i=t.toString(),e=t.convertToZone(s.Timezone.utcTimezone).toString(),n,a={recurrenceId:t};if(i in this.exceptions)n=a.item=this.exceptions[i],a.startDate=n.startDate,a.endDate=n.endDate,a.item=n;else if(e in this.exceptions)n=this.exceptions[e],a.startDate=n.startDate,a.endDate=n.endDate,a.item=n;else{var o=this.findRangeException(t),h;if(o){var p=this.exceptions[o];a.item=p;var c=this._rangeExceptionCache[o];if(!c){var d=p.recurrenceId.clone(),f=p.startDate.clone();d.zone=f.zone,c=f.subtractDate(d),this._rangeExceptionCache[o]=c}var m=t.clone();m.zone=p.startDate.zone,m.addDuration(c),h=m.clone(),h.addDuration(p.duration),a.startDate=m,a.endDate=h}else h=t.clone(),h.addDuration(this.duration),a.endDate=h,a.startDate=t,a.item=this}return a},iterator:function(t){return new s.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"),i=0,e=t.length,n=Object.create(null);i<e;i++){var a=t[i].getFirstValue();n[a.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 i=this._firstProp("duration");t=this.startDate.clone(),i?t.addDuration(i):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 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,i){var e=this.component.getFirstProperty(t);e||(e=new s.Property(t),this.component.addProperty(e)),i.zone===s.Timezone.localTimezone||i.zone===s.Timezone.utcTimezone?e.removeParameter("tzid"):e.setParameter("tzid",i.zone.tzid),e.setValue(i)},_setProp:function(t,i){this.component.updatePropertyWithValue(t,i)},_firstProp:function(t){return this.component.getFirstPropertyValue(t)},toString:function(){return this.component.toString()}};function r(t,i){return t[0]>i[0]?1:i[0]>t[0]?-1:0}return u}();s.ComponentParser=function(){function u(r){typeof r=="undefined"&&(r={});var t;for(t in r)r.hasOwnProperty(t)&&(this[t]=r[t])}return u.prototype={parseEvent:!0,parseTimezone:!0,oncomplete:function(){},onerror:function(r){},ontimezone:function(r){},onevent:function(r){},process:function(r){typeof r=="string"&&(r=s.parse(r)),r instanceof s.Component||(r=new s.Component(r));for(var t=r.getAllSubcomponents(),i=0,e=t.length,n;i<e;i++)switch(n=t[i],n.name){case"vtimezone":if(this.parseTimezone){var a=n.getFirstPropertyValue("tzid");a&&this.ontimezone(new s.Timezone({tzid:a,component:n}))}break;case"vevent":this.parseEvent&&this.onevent(new s.Event(n));break;default:continue}this.oncomplete()}},u}()});var vt={};mt(vt,{default:()=>G});module.exports=yt(vt);var nt=require("obsidian");var rt=require("obsidian"),V=pt(et()),q=class{constructor(r){this.events=[];this.lastFetch=0;this.refreshMinutes=r}async fetchCalendars(r){let t=Date.now(),i=r.filter(n=>n.enabled);if(i.length===0)return this.events=[],console.warn("No enabled calendar sources to fetch."),[];if(!(this.events.length===0||t-this.lastFetch>=this.refreshMinutes*60*1e3||this.events.some(n=>!i.find(a=>a.name===n.source))||i.some(n=>!this.events.find(a=>a.source===n.name))))return this.events;try{let n=i.map(o=>this.fetchCalendar(o)),a=await Promise.all(n);return this.events=a.flat(),this.lastFetch=t,this.events}catch(n){throw console.error("Error fetching calendars:",n),n}}async fetchCalendar(r){try{let t=await(0,rt.requestUrl)({url:r.url,method:"GET"}),i=(0,V.parse)(t.text),n=new V.Component(i).getAllSubcomponents("vevent"),a=[],o=new Date;o.setMonth(o.getMonth()-1),o.setHours(0,0,0,0);let h=new Date;h.setMonth(h.getMonth()+2),h.setHours(23,59,59,999);for(let p of n){let c=new V.Event(p);if(p.hasProperty("rrule")){let d=c.iterator(),f;for(;f=d.next();){let m=f.clone(),v=c.duration;if(m.addDuration(v),f.toJSDate()<=h&&m.toJSDate()>=o&&a.push({id:`${c.uid}-${f.toUnixTime()}`,title:c.summary,start:f.toJSDate(),end:m.toJSDate(),description:c.description,location:c.location,source:r.name}),f.toJSDate()>h)break}}else a.push({id:c.uid,title:c.summary,start:c.startDate.toJSDate(),end:c.endDate.toJSDate(),description:c.description,location:c.location,source:r.name})}return a}catch(t){return console.error(`Error fetching calendar ${r.name}:`,t),[]}}getEventsForDate(r){let t=new Date(r);t.setHours(0,0,0,0);let i=new Date(r);return i.setHours(23,59,59,999),this.events.filter(e=>{let n=e.start.toDateString()===r.toDateString(),a=e.end.toDateString()===r.toDateString(),o=e.start<i&&e.end>t;return n||a||o}).sort((e,n)=>e.start.getTime()-n.start.getTime())}};var H=require("obsidian"),Z=class{constructor(r,t){this.app=r;this.settings=t}async updateExistingNote(r,t){let i=await this.app.vault.read(r),e=i.indexOf("## \u{1F4DD} Notes");if(e===-1){await this.app.vault.modify(r,this.generateNoteContent(t));return}let n=i.slice(e+11).trim(),a=this.generateNoteContent(t),o=a.indexOf("## \u{1F4DD} Notes");if(o===-1){await this.app.vault.modify(r,a);return}let h=a.slice(0,o+11)+`
|
|
`+(n?`
|
|
`+n:"");await this.app.vault.modify(r,h)}async createEventNote(r){let{vault:t}=this.app,{noteLocation:i,noteTitleFormat:e}=this.settings,n=(0,H.normalizePath)(i),a=this.formatTitle(e,r),o=(0,H.normalizePath)(`${n}/${a}.md`);try{n!=="/"&&await this.ensureFolderExists(n);let h=t.getAbstractFileByPath(o);if(h instanceof H.TFile)return h;let p=this.generateNoteContent(r);return await t.create(o,p)}catch(h){throw console.error("Error creating note:",h),h}}async getAllFolders(){let r=new Set(["/"]),t=i=>{r.add(i.path),i.children.forEach(e=>{e instanceof H.TFolder&&t(e)})};return this.app.vault.getAllLoadedFiles().forEach(i=>{i instanceof H.TFolder&&t(i)}),Array.from(r).sort((i,e)=>i.localeCompare(e))}generateNoteContent(r){let t=this.formatDate(r.start),i=r.start.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),e=r.end.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"}),n=this.getTagsForEvent(r),a=n.length>0?`tags:
|
|
`+n.map(f=>` - ${f}`).join(`
|
|
`):"",o="";if(r.location){let f=r.location.startsWith("http://")||r.location.startsWith("https://")||r.location.startsWith("www."),m=r.location.toLowerCase().includes("zoom")||r.location.toLowerCase().includes("meet.")||r.location.toLowerCase().includes("teams")||r.location.toLowerCase().includes("webex");o=`${f?"\u{1F517}":m?"\u{1F4BB}":"\u{1F4CD}"} ${r.location}`}let p=`---
|
|
${["type: meeting",`date: "${t}"`,a].filter(f=>f).join(`
|
|
`)}
|
|
---`,c=this.cleanTeamsDescription(r.description||""),d=this.settings.noteTemplate;return d=d.replace(/{{event_title}}/g,r.title).replace(/{{date}}/g,t).replace(/{{start_time}}/g,i).replace(/{{end_time}}/g,e).replace(/{{source}}/g,r.source).replace(/{{location}}/g,o).replace(/{{description}}/g,c),p+`
|
|
`+d}getTagsForEvent(r){let t=[...this.settings.defaultTags||[]],i=this.settings.calendarUrls.find(e=>e.name===r.source);return i!=null&&i.tags&&t.push(...i.tags),[...new Set(t)]}formatTitle(r,t){let i=t.start.toISOString().split("T")[0];return r.replace(/{{event_title}}/g,this.sanitizeFileName(t.title)).replace(/{{date}}/g,i).replace(/{{source}}/g,this.sanitizeFileName(t.source))}formatDate(r){switch(this.settings.noteDateFormat){case"ISO":return r.toISOString().split("T")[0];case"US":return r.toLocaleDateString("en-US",{month:"2-digit",day:"2-digit",year:"numeric"});case"UK":return r.toLocaleDateString("en-GB",{day:"2-digit",month:"2-digit",year:"numeric"});case"Long":return r.toLocaleDateString("en-US",{month:"long",day:"numeric",year:"numeric"});default:return r.toISOString().split("T")[0]}}cleanTeamsDescription(r){let t=r.indexOf("________________");return t!==-1?r.substring(0,t).trim():r.trim()}async ensureFolderExists(r){let{vault:t}=this.app,i=r.split("/").filter(n=>n.length),e="";for(let n of i){e=e?`${e}/${n}`:n;let a=t.getAbstractFileByPath(e);if(a){if(!(a instanceof H.TFolder))throw new Error(`Cannot create folder '${e}' because a file with that name already exists`)}else try{await t.createFolder(e)}catch(o){if(!o.message.includes("already exists"))throw o}}}sanitizeFileName(r){return r.replace(/[\\/:*?"<>|]/g,"-")}};var K=require("obsidian"),X=class extends K.ItemView{constructor(t,i){super(t);this.selectedDate=null;this.currentMonthDays=new Map;this.plugin=i,this.currentDate=new Date}getViewType(){return"memochron-calendar"}getDisplayText(){return"MemoChron Calendar"}getIcon(){return"calendar-range"}async onOpen(){let t=this.containerEl.children[1];t.empty();let e=t.createEl("div",{cls:"memochron-controls"}).createEl("div",{cls:"memochron-nav"}),n=e.createEl("span",{cls:"memochron-title"}),a=e.createEl("div",{cls:"memochron-nav-buttons"}),o=a.createEl("button",{text:"<"}),h=a.createEl("button",{text:"Today"}),p=a.createEl("button",{text:">"});o.onclick=()=>this.navigate(-1),h.onclick=()=>this.goToday(),p.onclick=()=>this.navigate(1),this.calendar=t.createEl("div",{cls:"memochron-calendar"}),this.agenda=t.createEl("div",{cls:"memochron-agenda"}),await this.goToday()}async navigate(t){this.currentDate.setMonth(this.currentDate.getMonth()+t),await this.refreshEvents()}async goToday(){let t=new Date;(this.currentDate.getMonth()!==t.getMonth()||this.currentDate.getFullYear()!==t.getFullYear())&&(this.currentDate=t,await this.refreshEvents()),this.selectDate(t)}async selectDate(t){if(this.selectedDate){let n=this.selectedDate.toDateString(),a=this.currentMonthDays.get(n);a&&a.removeClass("selected")}this.selectedDate=t;let i=t.toDateString(),e=this.currentMonthDays.get(i);e&&e.addClass("selected"),await this.showDayAgenda(t)}async refreshEvents(){await this.plugin.calendarService.fetchCalendars(this.plugin.settings.calendarUrls),this.renderMonth(),this.selectedDate&&this.showDayAgenda(this.selectedDate)}renderMonth(){this.calendar.empty(),this.currentMonthDays.clear();let t=this.currentDate.getFullYear(),i=this.currentDate.getMonth(),e=this.containerEl.querySelector(".memochron-title");e&&(e.textContent=new Date(t,i).toLocaleString("default",{month:"long",year:"numeric"}));let n=this.calendar.createEl("div",{cls:"memochron-calendar-grid"}),a=["Su","Mo","Tu","We","Th","Fr","Sa"],o=this.plugin.settings.firstDayOfWeek;[...a.slice(o),...a.slice(0,o)].forEach(y=>{n.createEl("div",{cls:"memochron-weekday",text:y})});let p=new Date(t,i,1),d=new Date(t,i+1,0).getDate(),f=p.getDay()-o;f<0&&(f+=7);for(let y=0;y<f;y++)n.createEl("div",{cls:"memochron-day empty"});let v=new Date().toDateString();for(let y=1;y<=d;y++){let g=new Date(t,i,y),w=g.toDateString(),_=n.createEl("div",{cls:"memochron-day"});this.currentMonthDays.set(w,_),this.selectedDate&&w===this.selectedDate.toDateString()&&_.addClass("selected"),w===v&&_.addClass("today");let Y=_.createEl("div",{cls:"memochron-day-header",text:String(y)});if(this.plugin.calendarService.getEventsForDate(g).length>0){_.addClass("has-events");let O=_.createEl("div",{cls:"memochron-event-dot",text:"\u2022"})}_.onclick=()=>this.selectDate(g)}}async showDayAgenda(t){this.agenda.empty();let i=this.agenda.createEl("h3",{text:t.toLocaleDateString("default",{weekday:"long",month:"long",day:"numeric"})}),e=this.plugin.calendarService.getEventsForDate(t);if(e.length===0){this.agenda.createEl("p",{text:"No events scheduled"});return}let n=this.agenda.createEl("div",{cls:"memochron-agenda-list"}),a=new Date;e.forEach(o=>{let h=n.createEl("div",{cls:"memochron-agenda-event"});if(o.end<a&&h.addClass("past-event"),h.createEl("div",{cls:"memochron-event-time",text:`${o.start.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})} - ${o.end.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}`}),h.createEl("div",{cls:"memochron-event-title",text:o.title}),o.location){let p=o.location.startsWith("http://")||o.location.startsWith("https://")||o.location.startsWith("www."),c=o.location.toLowerCase().includes("zoom")||o.location.toLowerCase().includes("meet.")||o.location.toLowerCase().includes("teams")||o.location.toLowerCase().includes("webex"),d=p?"\u{1F517}":c?"\u{1F4BB}":"\u{1F4CD}";h.createEl("div",{cls:"memochron-event-location",text:`${d} ${o.location}`})}h.addEventListener("click",async p=>{p.stopPropagation();try{await this.showEventDetails(o)}catch(c){console.error("Failed to create note:",c),new K.Notice("Failed to create note. Check the console for details.")}})})}async showEventDetails(t){try{if(!this.plugin.settings.noteLocation){new K.Notice("Please set a note location in settings first");return}let i=await this.plugin.noteService.createEventNote(t);if(!i)throw new Error("Failed to create or update note");let e=this.app.workspace.getLeaf("tab");e?await e.openFile(i):new K.Notice("Could not open the note in a new tab")}catch(i){throw console.error("Error showing event details:",i),i}}};var z=require("obsidian"),$=class extends z.PluginSettingTab{constructor(t,i){super(t,i);this.plugin=i}display(){let{containerEl:t}=this;t.empty(),t.createEl("h2",{text:"MemoChron Settings"}),new z.Setting(t).setName("Calendar Sources").setDesc("Add and manage your iCalendar URLs").addButton(o=>o.setButtonText("Add Calendar").onClick(async()=>{this.plugin.settings.calendarUrls.push({url:"",name:"New Calendar",enabled:!0,tags:[]}),await this.plugin.saveSettings(),this.display()}));let i=t.createEl("div",{cls:"memochron-calendar-list"});this.plugin.settings.calendarUrls.forEach((o,h)=>{let p=new z.Setting(i).addText(c=>c.setPlaceholder("Calendar URL").setValue(o.url).onChange(async d=>{this.plugin.settings.calendarUrls[h].url=d,await this.plugin.saveSettings()})).addText(c=>c.setPlaceholder("Calendar name").setValue(o.name).onChange(async d=>{this.plugin.settings.calendarUrls[h].name=d,await this.plugin.saveSettings()})).addText(c=>{var d;return c.setPlaceholder("Tags (comma-separated)").setValue(((d=o.tags)==null?void 0:d.join(", "))||"").onChange(async f=>{this.plugin.settings.calendarUrls[h].tags=f.split(",").map(m=>m.trim()).filter(m=>m.length>0),await this.plugin.saveSettings()})}).addToggle(c=>c.setValue(o.enabled).onChange(async d=>{this.plugin.settings.calendarUrls[h].enabled=d,await this.plugin.saveSettings(),await this.plugin.refreshCalendarView()})).addButton(c=>c.setButtonText("Remove").onClick(async()=>{this.plugin.settings.calendarUrls.splice(h,1),await this.plugin.saveSettings(),await this.plugin.refreshCalendarView(),this.display()}))}),t.createEl("h3",{text:"Note Settings"});let e=new z.Setting(t).setName("Note Location").setDesc("Where to save new event notes"),n=new z.TextComponent(e.controlEl);n.setPlaceholder("calendar-notes/").setValue(this.plugin.settings.noteLocation);let a=e.controlEl.createDiv({cls:"suggestion-container"});a.style.display="none",this.setupPathSuggestions(n,a,async()=>await this.plugin.noteService.getAllFolders(),async o=>{this.plugin.settings.noteLocation=o,await this.plugin.saveSettings()}),new z.Setting(t).setName("Note Title Format").setDesc("Format for new note titles. Available variables: {{event_title}}, {{date}}, {{source}}").addText(o=>o.setPlaceholder("{{event_title}} - {{date}}").setValue(this.plugin.settings.noteTitleFormat).onChange(async h=>{this.plugin.settings.noteTitleFormat=h,await this.plugin.saveSettings()})),new z.Setting(t).setName("Note Date Format").setDesc("Choose how dates appear in event notes").addDropdown(o=>o.addOption("ISO","ISO (YYYY-MM-DD)").addOption("US","US (MM/DD/YYYY)").addOption("UK","UK (DD/MM/YYYY)").addOption("Long","Long (Month DD, YYYY)").setValue(this.plugin.settings.noteDateFormat).onChange(async h=>{this.plugin.settings.noteDateFormat=h,await this.plugin.saveSettings()})),new z.Setting(t).setName("Default Frontmatter").setDesc("YAML frontmatter to add at the top of each event note").addTextArea(o=>{o.setPlaceholder(`---
|
|
type: event
|
|
date: {{date}}
|
|
---`).setValue(this.plugin.settings.defaultFrontmatter).onChange(async h=>{this.plugin.settings.defaultFrontmatter=h,await this.plugin.saveSettings()}),o.inputEl.rows=4,o.inputEl.cols=50}),new z.Setting(t).setName("Note Template").setDesc("Template for the note content. Available variables: {{event_title}}, {{date}}, {{start_time}}, {{end_time}}, {{source}}, {{location}}, {{description}}").addTextArea(o=>{o.setValue(this.plugin.settings.noteTemplate).onChange(async h=>{this.plugin.settings.noteTemplate=h,await this.plugin.saveSettings()}),o.inputEl.rows=10,o.inputEl.cols=50}),new z.Setting(t).setName("Default Tags").setDesc("Default tags for all event notes (comma-separated)").addText(o=>o.setPlaceholder("event, meeting").setValue(this.plugin.settings.defaultTags.join(", ")).onChange(async h=>{this.plugin.settings.defaultTags=h.split(",").map(p=>p.trim()).filter(p=>p.length>0),await this.plugin.saveSettings()})),t.createEl("h3",{text:"View Settings"}),new z.Setting(t).setName("First Day of Week").setDesc("Choose which day the week starts on").addDropdown(o=>o.addOption("0","Sunday").addOption("1","Monday").addOption("2","Tuesday").addOption("3","Wednesday").addOption("4","Thursday").addOption("5","Friday").addOption("6","Saturday").setValue(String(this.plugin.settings.firstDayOfWeek)).onChange(async h=>{this.plugin.settings.firstDayOfWeek=parseInt(h),await this.plugin.saveSettings(),await this.plugin.refreshCalendarView()})),new z.Setting(t).setName("Refresh Interval").setDesc("How often to refresh calendar data (in minutes)").addText(o=>o.setValue(String(this.plugin.settings.refreshInterval)).onChange(async h=>{let p=parseInt(h);!isNaN(p)&&p>0&&(this.plugin.settings.refreshInterval=p,await this.plugin.saveSettings())}))}setupPathSuggestions(t,i,e,n){t.inputEl.addEventListener("focus",async()=>{let a=await e();this.showSuggestions(t,i,a,t.getValue(),n)}),t.inputEl.addEventListener("input",async()=>{let a=await e();this.showSuggestions(t,i,a,t.getValue(),n)}),t.inputEl.addEventListener("blur",()=>{setTimeout(()=>{i.style.display="none"},200)})}showSuggestions(t,i,e,n,a){i.empty();let o=e.filter(p=>p.toLowerCase().includes(n.toLowerCase()));if(o.length===0){i.style.display="none";return}i.style.display="block";let h=i.createEl("ul",{cls:"suggestion-list"});o.slice(0,5).forEach(p=>{h.createEl("li",{text:p}).addEventListener("mousedown",async d=>{d.preventDefault(),t.setValue(p),await a(p),i.style.display="none"})})}};var it={calendarUrls:[],noteLocation:"/",noteTitleFormat:"{{date}} - {{event_title}}",refreshInterval:30,noteDateFormat:"ISO",defaultFrontmatter:`---
|
|
type: event
|
|
date: {{date}}
|
|
---`,defaultTags:["event","meeting"],noteTemplate:`# {{event_title}}
|
|
|
|
## \u{1F4DD} Event Details
|
|
\u{1F4C5} {{date}}
|
|
\u23F0 {{start_time}} - {{end_time}}
|
|
\u{1F4C6} {{source}}
|
|
{{location}}
|
|
|
|
## \u{1F4CB} Description
|
|
{{description}}
|
|
|
|
## \u{1F4DD} Notes
|
|
`,firstDayOfWeek:1};var G=class extends nt.Plugin{async onload(){await this.loadSettings(),this.calendarService=new q(this.settings.refreshInterval),this.noteService=new Z(this.app,this.settings),this.registerView("memochron-calendar",t=>this.calendarView=new X(t,this)),this.addSettingTab(new $(this.app,this)),this.app.workspace.onLayoutReady(()=>{this.activateView()}),this.setupAutoRefresh()}onunload(){this.refreshTimer&&window.clearInterval(this.refreshTimer)}async loadSettings(){this.settings=Object.assign({},it,await this.loadData())}async saveSettings(){await this.saveData(this.settings),this.calendarService&&this.setupAutoRefresh()}async activateView(){if(this.app.workspace.getLeavesOfType("memochron-calendar").length===0){let i=this.app.workspace.getRightLeaf(!1);i&&await i.setViewState({type:"memochron-calendar",active:!0})}await this.refreshCalendarView()}async refreshCalendarView(){this.calendarView&&await this.calendarView.refreshEvents()}setupAutoRefresh(){this.refreshTimer&&window.clearInterval(this.refreshTimer),this.refreshTimer=window.setInterval(()=>this.refreshCalendarView(),this.settings.refreshInterval*60*1e3)}};
|