ical-generator 11.1.4-develop.3 → 11.1.4-develop.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -18
- package/dist/index.d.mts +4 -18
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/tools.ts +11 -3
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ical-generator entrypoint
|
|
3
|
+
*/
|
|
2
4
|
export declare enum ICalAttendeeRole {
|
|
3
5
|
CHAIR = "CHAIR",
|
|
4
6
|
NON = "NON-PARTICIPANT",
|
|
@@ -324,8 +326,6 @@ declare class ICalAttendee {
|
|
|
324
326
|
value: string;
|
|
325
327
|
}[];
|
|
326
328
|
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region src/types.d.ts
|
|
329
329
|
export declare enum ICalEventRepeatingFreq {
|
|
330
330
|
DAILY = "DAILY",
|
|
331
331
|
HOURLY = "HOURLY",
|
|
@@ -503,8 +503,6 @@ interface ICalTZDateStub extends Date {
|
|
|
503
503
|
timeZone?: string;
|
|
504
504
|
withTimeZone(timezone?: null | string): ICalTZDateStub;
|
|
505
505
|
}
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region src/alarm.d.ts
|
|
508
506
|
export declare enum ICalAlarmType {
|
|
509
507
|
audio = "audio",
|
|
510
508
|
display = "display",
|
|
@@ -899,8 +897,6 @@ declare class ICalAlarm {
|
|
|
899
897
|
value: string;
|
|
900
898
|
}[];
|
|
901
899
|
}
|
|
902
|
-
//#endregion
|
|
903
|
-
//#region src/category.d.ts
|
|
904
900
|
interface ICalCategoryData {
|
|
905
901
|
name: string;
|
|
906
902
|
}
|
|
@@ -959,8 +955,6 @@ declare class ICalCategory {
|
|
|
959
955
|
*/
|
|
960
956
|
toString(): string;
|
|
961
957
|
}
|
|
962
|
-
//#endregion
|
|
963
|
-
//#region src/event.d.ts
|
|
964
958
|
export declare enum ICalEventBusyStatus {
|
|
965
959
|
BUSY = "BUSY",
|
|
966
960
|
FREE = "FREE",
|
|
@@ -2011,8 +2005,6 @@ declare class ICalEvent {
|
|
|
2011
2005
|
*/
|
|
2012
2006
|
private swapStartAndEndIfRequired;
|
|
2013
2007
|
}
|
|
2014
|
-
//#endregion
|
|
2015
|
-
//#region src/calendar.d.ts
|
|
2016
2008
|
export declare enum ICalCalendarMethod {
|
|
2017
2009
|
ADD = "ADD",
|
|
2018
2010
|
CANCEL = "CANCEL",
|
|
@@ -2510,8 +2502,6 @@ declare class ICalCalendar {
|
|
|
2510
2502
|
value: string;
|
|
2511
2503
|
}[];
|
|
2512
2504
|
}
|
|
2513
|
-
//#endregion
|
|
2514
|
-
//#region src/tools.d.ts
|
|
2515
2505
|
/**
|
|
2516
2506
|
* Escapes special characters in the given string. `inQuotes` selects the
|
|
2517
2507
|
* parameter value encoding (RFC 6868), otherwise the TEXT escaping of
|
|
@@ -2532,8 +2522,6 @@ export declare function formatDateTZ(timezone: null | string, property: string,
|
|
|
2532
2522
|
floating?: boolean | null;
|
|
2533
2523
|
timezone?: null | string;
|
|
2534
2524
|
}): string;
|
|
2535
|
-
//#endregion
|
|
2536
|
-
//#region src/index.d.ts
|
|
2537
2525
|
/**
|
|
2538
2526
|
* Create a new, empty calendar and returns it.
|
|
2539
2527
|
*
|
|
@@ -2568,6 +2556,4 @@ export declare function formatDateTZ(timezone: null | string, property: string,
|
|
|
2568
2556
|
* @param data Calendar data
|
|
2569
2557
|
*/
|
|
2570
2558
|
declare function ical(data?: ICalCalendarData): ICalCalendar;
|
|
2571
|
-
|
|
2572
|
-
export { ICalAlarm, type ICalAlarmBaseData, type ICalAlarmData, type ICalAlarmJSONData, type ICalAlarmRepeatData, type ICalAlarmTriggerAfterData, type ICalAlarmTriggerBeforeData, type ICalAlarmTriggerData, type ICalAlarmTypeValue, type ICalAttachment, ICalAttendee, type ICalAttendeeData, type ICalAttendeeJSONData, type ICalAttendeeScheduleAgent, ICalCalendar, type ICalCalendarData, type ICalCalendarJSONData, type ICalCalendarProdIdData, ICalCategory, type ICalCategoryData, type ICalCategoryJSONData, type ICalDateTimeValue, type ICalDayJsStub, type ICalDescription, ICalEvent, type ICalEventData, type ICalEventJSONData, type ICalEventJSONRepeatingData, type ICalEventTravelTime, type ICalGeo, type ICalLocation, type ICalLocationWithTitle, type ICalLocationWithoutTitle, type ICalLuxonDateTimeStub, type ICalMomentDurationStub, type ICalMomentStub, type ICalMomentTimezoneStub, type ICalOrganizer, type ICalRRuleStub, type ICalRepeatingOptions, type ICalTZDateStub, type ICalTemporalInstantStub, type ICalTemporalPlainDateStub, type ICalTemporalPlainDateTimeStub, type ICalTemporalZonedDateTimeStub, type ICalTimezone, ical as default };
|
|
2573
|
-
//# sourceMappingURL=index.d.cts.map
|
|
2559
|
+
export { ICalAlarm, type ICalAlarmBaseData, type ICalAlarmData, type ICalAlarmJSONData, type ICalAlarmRepeatData, type ICalAlarmTriggerAfterData, type ICalAlarmTriggerBeforeData, type ICalAlarmTriggerData, type ICalAlarmTypeValue, type ICalAttachment, ICalAttendee, type ICalAttendeeData, type ICalAttendeeJSONData, type ICalAttendeeScheduleAgent, ICalCalendar, type ICalCalendarData, type ICalCalendarJSONData, type ICalCalendarProdIdData, ICalCategory, type ICalCategoryData, type ICalCategoryJSONData, type ICalDateTimeValue, type ICalDayJsStub, type ICalDescription, ICalEvent, type ICalEventData, type ICalEventJSONData, type ICalEventJSONRepeatingData, type ICalEventTravelTime, type ICalGeo, type ICalLocation, type ICalLocationWithTitle, type ICalLocationWithoutTitle, type ICalLuxonDateTimeStub, type ICalMomentDurationStub, type ICalMomentStub, type ICalMomentTimezoneStub, type ICalOrganizer, type ICalRRuleStub, type ICalRepeatingOptions, type ICalTZDateStub, type ICalTemporalInstantStub, type ICalTemporalPlainDateStub, type ICalTemporalPlainDateTimeStub, type ICalTemporalZonedDateTimeStub, type ICalTimezone, ical as default };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ical-generator entrypoint
|
|
3
|
+
*/
|
|
2
4
|
export declare enum ICalAttendeeRole {
|
|
3
5
|
CHAIR = "CHAIR",
|
|
4
6
|
NON = "NON-PARTICIPANT",
|
|
@@ -324,8 +326,6 @@ declare class ICalAttendee {
|
|
|
324
326
|
value: string;
|
|
325
327
|
}[];
|
|
326
328
|
}
|
|
327
|
-
//#endregion
|
|
328
|
-
//#region src/types.d.ts
|
|
329
329
|
export declare enum ICalEventRepeatingFreq {
|
|
330
330
|
DAILY = "DAILY",
|
|
331
331
|
HOURLY = "HOURLY",
|
|
@@ -503,8 +503,6 @@ interface ICalTZDateStub extends Date {
|
|
|
503
503
|
timeZone?: string;
|
|
504
504
|
withTimeZone(timezone?: null | string): ICalTZDateStub;
|
|
505
505
|
}
|
|
506
|
-
//#endregion
|
|
507
|
-
//#region src/alarm.d.ts
|
|
508
506
|
export declare enum ICalAlarmType {
|
|
509
507
|
audio = "audio",
|
|
510
508
|
display = "display",
|
|
@@ -899,8 +897,6 @@ declare class ICalAlarm {
|
|
|
899
897
|
value: string;
|
|
900
898
|
}[];
|
|
901
899
|
}
|
|
902
|
-
//#endregion
|
|
903
|
-
//#region src/category.d.ts
|
|
904
900
|
interface ICalCategoryData {
|
|
905
901
|
name: string;
|
|
906
902
|
}
|
|
@@ -959,8 +955,6 @@ declare class ICalCategory {
|
|
|
959
955
|
*/
|
|
960
956
|
toString(): string;
|
|
961
957
|
}
|
|
962
|
-
//#endregion
|
|
963
|
-
//#region src/event.d.ts
|
|
964
958
|
export declare enum ICalEventBusyStatus {
|
|
965
959
|
BUSY = "BUSY",
|
|
966
960
|
FREE = "FREE",
|
|
@@ -2011,8 +2005,6 @@ declare class ICalEvent {
|
|
|
2011
2005
|
*/
|
|
2012
2006
|
private swapStartAndEndIfRequired;
|
|
2013
2007
|
}
|
|
2014
|
-
//#endregion
|
|
2015
|
-
//#region src/calendar.d.ts
|
|
2016
2008
|
export declare enum ICalCalendarMethod {
|
|
2017
2009
|
ADD = "ADD",
|
|
2018
2010
|
CANCEL = "CANCEL",
|
|
@@ -2510,8 +2502,6 @@ declare class ICalCalendar {
|
|
|
2510
2502
|
value: string;
|
|
2511
2503
|
}[];
|
|
2512
2504
|
}
|
|
2513
|
-
//#endregion
|
|
2514
|
-
//#region src/tools.d.ts
|
|
2515
2505
|
/**
|
|
2516
2506
|
* Escapes special characters in the given string. `inQuotes` selects the
|
|
2517
2507
|
* parameter value encoding (RFC 6868), otherwise the TEXT escaping of
|
|
@@ -2532,8 +2522,6 @@ export declare function formatDateTZ(timezone: null | string, property: string,
|
|
|
2532
2522
|
floating?: boolean | null;
|
|
2533
2523
|
timezone?: null | string;
|
|
2534
2524
|
}): string;
|
|
2535
|
-
//#endregion
|
|
2536
|
-
//#region src/index.d.ts
|
|
2537
2525
|
/**
|
|
2538
2526
|
* Create a new, empty calendar and returns it.
|
|
2539
2527
|
*
|
|
@@ -2568,6 +2556,4 @@ export declare function formatDateTZ(timezone: null | string, property: string,
|
|
|
2568
2556
|
* @param data Calendar data
|
|
2569
2557
|
*/
|
|
2570
2558
|
declare function ical(data?: ICalCalendarData): ICalCalendar;
|
|
2571
|
-
|
|
2572
|
-
export { ICalAlarm, type ICalAlarmBaseData, type ICalAlarmData, type ICalAlarmJSONData, type ICalAlarmRepeatData, type ICalAlarmTriggerAfterData, type ICalAlarmTriggerBeforeData, type ICalAlarmTriggerData, type ICalAlarmTypeValue, type ICalAttachment, ICalAttendee, type ICalAttendeeData, type ICalAttendeeJSONData, type ICalAttendeeScheduleAgent, ICalCalendar, type ICalCalendarData, type ICalCalendarJSONData, type ICalCalendarProdIdData, ICalCategory, type ICalCategoryData, type ICalCategoryJSONData, type ICalDateTimeValue, type ICalDayJsStub, type ICalDescription, ICalEvent, type ICalEventData, type ICalEventJSONData, type ICalEventJSONRepeatingData, type ICalEventTravelTime, type ICalGeo, type ICalLocation, type ICalLocationWithTitle, type ICalLocationWithoutTitle, type ICalLuxonDateTimeStub, type ICalMomentDurationStub, type ICalMomentStub, type ICalMomentTimezoneStub, type ICalOrganizer, type ICalRRuleStub, type ICalRepeatingOptions, type ICalTZDateStub, type ICalTemporalInstantStub, type ICalTemporalPlainDateStub, type ICalTemporalPlainDateTimeStub, type ICalTemporalZonedDateTimeStub, type ICalTimezone, ical as default };
|
|
2573
|
-
//# sourceMappingURL=index.d.mts.map
|
|
2559
|
+
export { ICalAlarm, type ICalAlarmBaseData, type ICalAlarmData, type ICalAlarmJSONData, type ICalAlarmRepeatData, type ICalAlarmTriggerAfterData, type ICalAlarmTriggerBeforeData, type ICalAlarmTriggerData, type ICalAlarmTypeValue, type ICalAttachment, ICalAttendee, type ICalAttendeeData, type ICalAttendeeJSONData, type ICalAttendeeScheduleAgent, ICalCalendar, type ICalCalendarData, type ICalCalendarJSONData, type ICalCalendarProdIdData, ICalCategory, type ICalCategoryData, type ICalCategoryJSONData, type ICalDateTimeValue, type ICalDayJsStub, type ICalDescription, ICalEvent, type ICalEventData, type ICalEventJSONData, type ICalEventJSONRepeatingData, type ICalEventTravelTime, type ICalGeo, type ICalLocation, type ICalLocationWithTitle, type ICalLocationWithoutTitle, type ICalLuxonDateTimeStub, type ICalMomentDurationStub, type ICalMomentStub, type ICalMomentTimezoneStub, type ICalOrganizer, type ICalRRuleStub, type ICalRepeatingOptions, type ICalTZDateStub, type ICalTemporalInstantStub, type ICalTemporalPlainDateStub, type ICalTemporalPlainDateTimeStub, type ICalTemporalZonedDateTimeStub, type ICalTimezone, ical as default };
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
let e=/* @__PURE__ */ function(e){return e.DAILY=`DAILY`,e.HOURLY=`HOURLY`,e.MINUTELY=`MINUTELY`,e.MONTHLY=`MONTHLY`,e.SECONDLY=`SECONDLY`,e.WEEKLY=`WEEKLY`,e.YEARLY=`YEARLY`,e}({}),t=/* @__PURE__ */ function(e){return e.AUTOMATIC=`AUTOMATIC`,e.DISABLED=`DISABLED`,e.ENABLED=`ENABLED`,e}({}),n=/* @__PURE__ */ function(e){return e.BICYCLE=`BICYCLE`,e.CAR=`CAR`,e.TRANSIT=`TRANSIT`,e.WALKING=`WALKING`,e}({}),r=/* @__PURE__ */ function(e){return e.FR=`FR`,e.MO=`MO`,e.SA=`SA`,e.SU=`SU`,e.TH=`TH`,e.TU=`TU`,e.WE=`WE`,e}({});function i(e,t,n){if(Array.isArray(t))e.x=t.map(e=>{if(Array.isArray(e))return e;if(typeof e.key!=`string`||typeof e.value!=`string`)throw Error(`Either key or value is not a string!`);if(e.key.substr(0,2)!==`X-`)throw Error("Key has to start with `X-`!");return[e.key,e.value]});else if(typeof t==`object`)e.x=Object.entries(t).map(([e,t])=>{if(typeof e!=`string`||typeof t!=`string`)throw Error(`Either key or value is not a string!`);if(e.substr(0,2)!==`X-`)throw Error("Key has to start with `X-`!");return[e,t]});else if(typeof t==`string`&&typeof n==`string`){if(t.substr(0,2)!==`X-`)throw Error("Key has to start with `X-`!");e.x.push([t,n])}else return e.x.map(e=>({key:e[0],value:e[1]}))}function a(e,t){if(e instanceof Date&&isNaN(e.getTime())||typeof e==`string`&&isNaN(new Date(e).getTime()))throw Error(`\`${t}\` has to be a valid date!`);if(e instanceof Date||typeof e==`string`||typeof e==`object`&&e&&(w(e)||C(e)||S(e)||x(e))||h(e)&&e.isValid===!0||(g(e)||m(e))&&e.isValid())return e;throw Error(`\`${t}\` has to be a valid date!`)}function o(e,t){let n=Object.values(e),r=String(t).toUpperCase();if(!r||!n.includes(r))throw Error(`Input must be one of the following: ${n.join(`, `)}`);return r}function s(e,t){let n=null;if(typeof t==`string`){let e=t.match(/^(.+) ?<([^>]+)>$/);e?n={email:e[2].trim(),name:e[1].trim()}:t.includes(`@`)&&(n={email:t.trim(),name:t.trim()})}else typeof t==`object`&&(n={email:t.email,mailto:t.mailto,name:t.name,sentBy:t.sentBy});if(!n&&typeof t==`string`)throw Error("`"+e+"` isn't formated correctly. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");if(!n)throw Error("`"+e+"` needs to be a valid formed string or an object. See https://sebbo2002.github.io/ical-generator/develop/reference/interfaces/ICalOrganizer.html");if(!n.name)throw Error("`"+e+".name` is empty!");if(!n.email)throw Error("`"+e+".email` is empty!");return n}function c(e,t){return t?l(e):String(e).replace(/[\\;,]/g,e=>`\\`+e).replace(/(?:\r\n|\r|\n)/g,`\\n`)}function l(e){return String(e).replace(/\^/g,`^^`).replace(/"/g,`^'`).replace(/(?:\r\n|\r|\n)/g,`^n`)}function u(e){return e.split(`\r
|
|
2
2
|
`).map(function(e){if(e.length<=74&&A(e))return e;let t=``,n=0;for(let r=0;r<e.length;r++){let i=e.charAt(r),a=e.charCodeAt(r),o;a<128?o=1:a<2048?o=2:a>=55296&&a<=56319?(i+=e.charAt(++r),o=4):o=3,n+=o,n>74&&(t+=`\r
|
|
3
3
|
`,n=o),t+=i}return t}).join(`\r
|
|
4
|
-
`)}function d(e,t,n,r){if(e?.startsWith(`/`)&&(e=e.substr(1)),typeof t==`string`||t instanceof Date){let i=T(t)?t.withTimeZone(e):new Date(t),a
|
|
4
|
+
`)}function d(e,t,n,r){if(e?.startsWith(`/`)&&(e=e.substr(1)),typeof t==`string`||t instanceof Date){let i=n&&!e&&T(t)&&!!t.timeZone,a=i?t:T(t)?t.withTimeZone(e):new Date(t),o=a.getUTCFullYear().toString().padStart(4,`0`)+String(a.getUTCMonth()+1).padStart(2,`0`)+a.getUTCDate().toString().padStart(2,`0`);return(e||i)&&(o=a.getFullYear().toString().padStart(4,`0`)+String(a.getMonth()+1).padStart(2,`0`)+a.getDate().toString().padStart(2,`0`)),n?o:e?(o+=`T`+a.getHours().toString().padStart(2,`0`)+a.getMinutes().toString().padStart(2,`0`)+a.getSeconds().toString().padStart(2,`0`),o):(o+=`T`+a.getUTCHours().toString().padStart(2,`0`)+a.getUTCMinutes().toString().padStart(2,`0`)+a.getUTCSeconds().toString().padStart(2,`0`)+(r?``:`Z`),o)}if(g(t)){let i=e?v(t)&&!t.tz()?t.clone().tz(e):t:r||n&&v(t)&&t.tz()?t:t.utc();return i.format(`YYYYMMDD`)+(n?``:`T`+i.format(`HHmmss`)+(r||e?``:`Z`))}if(h(t)){let i=e?t.setZone(e):r||n&&t.zone.type!==`system`?t:t.setZone(`utc`);return i.toFormat(`yyyyLLdd`)+(n?``:`T`+i.toFormat(`HHmmss`)+(r||e?``:`Z`))}if(w(t)){let i=t;return e&&(i=t.withTimeZone(e)),!e&&!n&&t.timeZoneId!==`UTC`&&(i=t.withTimeZone(`UTC`)),d(null,i.toPlainDateTime(),n,r||!!e)}if(C(t)){if(n)return t.year.toString().padStart(4,`0`)+t.month.toString().padStart(2,`0`)+t.day.toString().padStart(2,`0`);if(e){let i=t.toZonedDateTime(e);return d(e,i,n,r)}return t.year.toString().padStart(4,`0`)+t.month.toString().padStart(2,`0`)+t.day.toString().padStart(2,`0`)+`T`+t.hour.toString().padStart(2,`0`)+t.minute.toString().padStart(2,`0`)+t.second.toString().padStart(2,`0`)+(r||e?``:`Z`)}if(S(t))return t.year.toString().padStart(4,`0`)+t.month.toString().padStart(2,`0`)+t.day.toString().padStart(2,`0`)+(n?``:`T000000`+(r||e?``:`Z`));if(x(t)){let i=e||`UTC`,a=t.toZonedDateTimeISO(i);return d(e,a,n,r)}{let i=t;if(e)i=typeof t.tz==`function`?t.tz(e):t;else if(!r){if(typeof t.utc==`function`)i=t.utc();else throw Error(`Unable to convert dayjs object to UTC value: UTC plugin is not available!`)}return i.format(`YYYYMMDD`)+(n?``:`T`+i.format(`HHmmss`)+(r||e?``:`Z`))}}function f(e,t,n,r){let i=``,a=r?.floating||!1;return r?.timezone&&(i=`;TZID=`+r.timezone,a=!0),t+i+`:`+d(e,n,!1,a)}function p(e){let t=e.x.map(([e,t])=>e.toUpperCase()+`:`+c(t,!1)).join(`\r
|
|
5
5
|
`);return t.length?t+`\r
|
|
6
6
|
`:``}function m(e){return typeof e==`object`&&!!e&&!(e instanceof Date)&&!g(e)&&!h(e)&&!b(e)}function h(e){return typeof e==`object`&&!!e&&`toJSDate`in e&&typeof e.toJSDate==`function`&&!b(e)}function g(e){return e!=null&&e._isAMomentObject!=null&&!b(e)}function _(e){return typeof e==`object`&&!!e&&`asSeconds`in e&&typeof e.asSeconds==`function`}function v(e){return g(e)&&`tz`in e&&typeof e.tz==`function`}function y(e){return typeof e==`object`&&!!e&&`between`in e&&typeof e.between==`function`&&typeof e.toString==`function`}function b(e){return w(e)||C(e)||S(e)||x(e)}function x(e){return typeof e==`object`&&!!e&&!w(e)&&!C(e)&&!S(e)&&`toZonedDateTimeISO`in e&&typeof e.toZonedDateTimeISO==`function`&&!(`year`in e)&&!(`timeZoneId`in e)}function S(e){return typeof e==`object`&&!!e&&!w(e)&&!C(e)&&`toPlainDateTime`in e&&typeof e.toPlainDateTime==`function`&&`year`in e&&typeof e.year==`number`&&`month`in e&&typeof e.month==`number`&&`day`in e&&typeof e.day==`number`&&!(`hour`in e)&&!(`timeZoneId`in e)&&!(`epochSeconds`in e)}function C(e){return typeof e==`object`&&!!e&&!w(e)&&`toZonedDateTime`in e&&typeof e.toZonedDateTime==`function`&&`toPlainDate`in e&&typeof e.toPlainDate==`function`&&`year`in e&&typeof e.year==`number`&&`month`in e&&typeof e.month==`number`&&`day`in e&&typeof e.day==`number`&&`hour`in e&&typeof e.hour==`number`&&`minute`in e&&typeof e.minute==`number`&&`second`in e&&typeof e.second==`number`&&!(`timeZone`in e)}function w(e){return typeof e==`object`&&!!e&&`timeZoneId`in e&&typeof e.timeZoneId==`string`&&`toPlainDateTime`in e&&typeof e.toPlainDateTime==`function`&&`year`in e&&typeof e.year==`number`&&`month`in e&&typeof e.month==`number`&&`day`in e&&typeof e.day==`number`&&`hour`in e&&typeof e.hour==`number`&&`minute`in e&&typeof e.minute==`number`&&`second`in e&&typeof e.second==`number`}function T(e){return e instanceof Date&&`internal`in e&&e.internal instanceof Date&&`withTimeZone`in e&&typeof e.withTimeZone==`function`&&`tzComponents`in e&&typeof e.tzComponents==`function`}function E(e){let t=l(e);return/[,:;]/.test(t)?`"`+t+`"`:t}function D(e){if(typeof e==`string`||e instanceof Date)return new Date(e);if(w(e)){let t=e.toInstant();return new Date(t.epochMilliseconds)}return C(e)?new Date(Date.UTC(e.year,e.month-1,e.day,e.hour,e.minute,e.second)):S(e)?new Date(Date.UTC(e.year,e.month-1,e.day)):x(e)?new Date(e.epochMilliseconds):h(e)?e.toJSDate():e.toDate()}function O(e){let t=``;return e<0&&(t=`-`,e*=-1),t+=`P`,e>=86400&&(t+=Math.floor(e/86400)+`D`,e%=86400),!e&&t.length>1||(t+=`T`,e>=3600&&(t+=Math.floor(e/3600)+`H`,e%=3600),e>=60&&(t+=Math.floor(e/60)+`M`,e%=60),e>0?t+=e+`S`:t.length<=2&&(t+=`0S`)),t}function k(e){return e?typeof e==`string`?e:w(e)?k(e.withTimeZone(`UTC`).toPlainDateTime()):(b(e),e.toJSON()):null}function A(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!1;return!0}let j=/* @__PURE__ */ function(e){return e.CHAIR=`CHAIR`,e.NON=`NON-PARTICIPANT`,e.OPT=`OPT-PARTICIPANT`,e.REQ=`REQ-PARTICIPANT`,e}({}),M=/* @__PURE__ */ function(e){return e.CLIENT=`CLIENT`,e.NONE=`NONE`,e.SERVER=`SERVER`,e}({}),N=/* @__PURE__ */ function(e){return e.ACCEPTED=`ACCEPTED`,e.DECLINED=`DECLINED`,e.DELEGATED=`DELEGATED`,e.NEEDSACTION=`NEEDS-ACTION`,e.TENTATIVE=`TENTATIVE`,e}({}),P=/* @__PURE__ */ function(e){return e.GROUP=`GROUP`,e.INDIVIDUAL=`INDIVIDUAL`,e.RESOURCE=`RESOURCE`,e.ROOM=`ROOM`,e.UNKNOWN=`UNKNOWN`,e}({});var F=class e{data;parent;constructor(e,t){if(this.data={delegatedFrom:null,delegatedTo:null,email:``,mailto:null,name:null,role:`REQ-PARTICIPANT`,rsvp:null,scheduleAgent:null,sentBy:null,status:null,type:null,x:[]},this.parent=t,!this.parent)throw Error("`event` option required!");if(!e.email)throw Error("No value for `email` in ICalAttendee given!");e.name!==void 0&&this.name(e.name),e.email!==void 0&&this.email(e.email),e.mailto!==void 0&&this.mailto(e.mailto),e.sentBy!==void 0&&this.sentBy(e.sentBy),e.status!==void 0&&this.status(e.status),e.role!==void 0&&this.role(e.role),e.rsvp!==void 0&&this.rsvp(e.rsvp),e.type!==void 0&&this.type(e.type),e.delegatedTo!==void 0&&this.delegatedTo(e.delegatedTo),e.delegatedFrom!==void 0&&this.delegatedFrom(e.delegatedFrom),e.delegatesTo&&this.delegatesTo(e.delegatesTo),e.delegatesFrom&&this.delegatesFrom(e.delegatesFrom),e.scheduleAgent!==void 0&&this.scheduleAgent(e.scheduleAgent),e.x!==void 0&&this.x(e.x)}delegatedFrom(t){return t===void 0?this.data.delegatedFrom:(t?typeof t==`string`?this.data.delegatedFrom=new e(s(`delegatedFrom`,t),this.parent):t instanceof e?this.data.delegatedFrom=t:this.data.delegatedFrom=new e(t,this.parent):this.data.delegatedFrom=null,this)}delegatedTo(t){return t===void 0?this.data.delegatedTo:t?(typeof t==`string`?this.data.delegatedTo=new e(s(`delegatedTo`,t),this.parent):t instanceof e?this.data.delegatedTo=t:this.data.delegatedTo=new e(t,this.parent),this.data.status=`DELEGATED`,this):(this.data.delegatedTo=null,this.data.status===`DELEGATED`&&(this.data.status=null),this)}delegatesFrom(t){let n=t instanceof e?t:this.parent.createAttendee(t);return this.delegatedFrom(n),n.delegatedTo(this),n}delegatesTo(t){let n=t instanceof e?t:this.parent.createAttendee(t);return this.delegatedTo(n),n.delegatedFrom(this),n}email(e){return e?(this.data.email=e,this):this.data.email}mailto(e){return e===void 0?this.data.mailto:(this.data.mailto=e||null,this)}name(e){return e===void 0?this.data.name:(this.data.name=e||null,this)}role(e){return e===void 0?this.data.role:(this.data.role=o(j,e),this)}rsvp(e){return e===void 0?this.data.rsvp:e===null?(this.data.rsvp=null,this):(this.data.rsvp=!!e,this)}scheduleAgent(e){return e===void 0?this.data.scheduleAgent:e?typeof e==`string`&&e.toUpperCase().startsWith(`X-`)?(this.data.scheduleAgent=e,this):(this.data.scheduleAgent=o(M,e),this):(this.data.scheduleAgent=null,this)}sentBy(e){return e?(this.data.sentBy=e,this):this.data.sentBy}status(e){return e===void 0?this.data.status:e?(this.data.status=o(N,e),this):(this.data.status=null,this)}toJSON(){return Object.assign({},this.data,{delegatedFrom:this.data.delegatedFrom?.email()||null,delegatedTo:this.data.delegatedTo?.email()||null,x:this.x()})}toString(){let e=`ATTENDEE`;if(!this.data.email)throw Error("No value for `email` in ICalAttendee given!");return e+=`;ROLE=`+this.data.role,this.data.type&&(e+=`;CUTYPE=`+this.data.type),this.data.status&&(e+=`;PARTSTAT=`+this.data.status),this.data.rsvp!==null&&(e+=`;RSVP=`+this.data.rsvp.toString().toUpperCase()),this.data.sentBy!==null&&(e+=`;SENT-BY="mailto:`+l(this.data.sentBy)+`"`),this.data.delegatedTo&&(e+=`;DELEGATED-TO="`+l(this.data.delegatedTo.email())+`"`),this.data.delegatedFrom&&(e+=`;DELEGATED-FROM="`+l(this.data.delegatedFrom.email())+`"`),this.data.name&&(e+=`;CN="`+l(this.data.name)+`"`),this.data.email&&this.data.mailto&&(e+=`;EMAIL=`+E(this.data.email)),this.data.scheduleAgent&&(e+=`;SCHEDULE-AGENT=`+this.data.scheduleAgent),this.data.x.length&&(e+=`;`+this.data.x.map(([e,t])=>e.toUpperCase()+`=`+E(t)).join(`;`)),e+=`:MAILTO:`+c(this.data.mailto||this.data.email,!1)+`\r
|
|
7
7
|
`,e}type(e){return e===void 0?this.data.type:e?(this.data.type=o(P,e),this):(this.data.type=null,this)}x(e,t){if(e===void 0)return i(this.data);if(typeof e==`string`&&typeof t==`string`)i(this.data,e,t);else if(typeof e==`object`)i(this.data,e);else throw Error(`Either key or value is not a string!`);return this}};let I=/* @__PURE__ */ function(e){return e.audio=`audio`,e.display=`display`,e.email=`email`,e}({});const L={end:`END`,start:`START`};var R=class{data;event;constructor(e,t){if(this.data={attach:null,attendees:[],description:null,interval:null,relatesTo:null,repeat:null,summary:null,trigger:-600,type:`display`,x:[]},this.event=t,!t)throw Error("`event` option required!");e.type!==void 0&&this.type(e.type),`trigger`in e&&e.trigger!==void 0&&this.trigger(e.trigger),`triggerBefore`in e&&e.triggerBefore!==void 0&&this.triggerBefore(e.triggerBefore),`triggerAfter`in e&&e.triggerAfter!==void 0&&this.triggerAfter(e.triggerAfter),e.repeat&&this.repeat(e.repeat),e.attach!==void 0&&this.attach(e.attach),e.description!==void 0&&this.description(e.description),e.summary!==void 0&&this.summary(e.summary),e.attendees!==void 0&&this.attendees(e.attendees),e.x!==void 0&&this.x(e.x)}attach(e){if(e===void 0)return this.data.attach;if(!e)return this.data.attach=null,this;let t;if(typeof e==`string`)t={mime:null,uri:e};else if(typeof e==`object`)t={mime:e.mime||null,uri:e.uri};else throw Error("`attachment` needs to be a valid formed string or an object. See https://sebbo2002.github.io/ical-generator/develop/reference/classes/ICalAlarm.html#attach");if(!t.uri)throw Error("`attach.uri` is empty!");return this.data.attach={mime:t.mime,uri:t.uri},this}attendees(e){return e?(e.forEach(e=>this.createAttendee(e)),this):this.data.attendees}createAttendee(e){if(e instanceof F)return this.data.attendees.push(e),e;typeof e==`string`&&(e=s(`data`,e));let t=new F(e,this);return this.data.attendees.push(t),t}description(e){return e===void 0?this.data.description:e?(this.data.description=e,this):(this.data.description=null,this)}relatesTo(e){if(e===void 0)return this.data.relatesTo;if(!e)return this.data.relatesTo=null,this;if(!Object.values(L).includes(e))throw Error("`relatesTo` is not correct, must be either `START` or `END`!");return this.data.relatesTo=e,this}repeat(e){if(e===void 0)return this.data.repeat;if(!e)return this.data.repeat=null,this;if(typeof e!=`object`)throw Error("`repeat` is not correct, must be an object!");if(typeof e.times!=`number`||!isFinite(e.times))throw Error("`repeat.times` is not correct, must be numeric!");if(typeof e.interval!=`number`||!isFinite(e.interval))throw Error("`repeat.interval` is not correct, must be numeric!");return this.data.repeat=e,this}summary(e){return e===void 0?this.data.summary:e?(this.data.summary=e,this):(this.data.summary=null,this)}toJSON(){let e=this.trigger();return Object.assign({},this.data,{trigger:typeof e==`number`?e:k(e),x:this.x()})}toString(){let e=`BEGIN:VALARM\r
|