add-to-calendar-button 2.6.19 → 2.6.21

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.
@@ -1,4 +1,3 @@
1
- // eslint-disable-next-line @typescript-eslint/no-var-requires
2
1
  const tzlibActions = require('timezones-ical-library');
3
2
  /*!
4
3
  * @preserve
@@ -7,15 +6,15 @@ const tzlibActions = require('timezones-ical-library');
7
6
  * Add to Calendar Button
8
7
  * ++++++++++++++++++++++
9
8
  *
10
- * Version: 2.6.19
9
+ * Version: 2.6.21
11
10
  * Creator: Jens Kuerschner (https://jekuer.com)
12
11
  * Project: https://github.com/add2cal/add-to-calendar-button
13
12
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
14
13
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
15
14
  *
16
15
  */
17
- const atcbVersion = '2.6.19';
18
- const atcbCssTemplate = {
16
+ const atcbVersion = '2.6.21';
17
+ const atcbCssTemplate = {
19
18
  if (typeof window === 'undefined') {
20
19
  return false;
21
20
  } else {
@@ -57,7 +56,7 @@ const atcbIsAndroid = atcbIsBrowser()
57
56
  };*/
58
57
  const atcbIsSafari = atcbIsBrowser()
59
58
  ? () => {
60
- if (/^((?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
59
+ if (/^(?:(?!chrome|android|crios|fxios).)*safari/i.test(navigator.userAgent)) {
61
60
  return true;
62
61
  } else {
63
62
  return false;
@@ -75,7 +74,7 @@ const atcbIsMobile = () => {
75
74
  };
76
75
  const atcbIsWebView = atcbIsBrowser()
77
76
  ? () => {
78
- if (/(; ?wv|(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari))/i.test(navigator.userAgent)) {
77
+ if (/; ?wv|(?:iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(navigator.userAgent)) {
79
78
  return true;
80
79
  } else {
81
80
  return false;
@@ -86,7 +85,7 @@ const atcbIsWebView = atcbIsBrowser()
86
85
  };
87
86
  const atcbIsProblematicWebView = atcbIsBrowser()
88
87
  ? () => {
89
- if (/(Instagram)/i.test(navigator.userAgent)) {
88
+ if (/Instagram/i.test(navigator.userAgent)) {
90
89
  return true;
91
90
  } else {
92
91
  return false;
@@ -305,7 +304,7 @@ function atcb_decorate_data_timezone(tz = null) {
305
304
  function atcb_decorate_data_rrule(data) {
306
305
  if (data.recurrence && data.recurrence !== '') {
307
306
  data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
308
- if (!/^(RRULE:[\w=;,:+-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
307
+ if (!/^(?:RRULE:[\w=;,:+\-/\\]+|daily|weekly|monthly|yearly)$/im.test(data.recurrence)) {
309
308
  data.recurrence = '!wrong rrule format!';
310
309
  } else {
311
310
  if (/^RRULE:/i.test(data.recurrence)) {
@@ -548,8 +547,7 @@ function atcb_decorate_data_description(data, i) {
548
547
  description = cleanDescription(description);
549
548
  if (data.customVar) {
550
549
  for (const key in data.customVar) {
551
- const sanitizedKey = key.replace(/[^a-zA-Z0-9\-_.]/g, '');
552
- // eslint-disable-next-line security/detect-non-literal-regexp
550
+ const sanitizedKey = key.replace(/[^\w\-.]/g, '');
553
551
  description = description.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
554
552
  }
555
553
  }
@@ -608,10 +606,8 @@ function atcb_decorate_data_extend(data) {
608
606
  }
609
607
  if (data.customVar) {
610
608
  for (const key in data.customVar) {
611
- const sanitizedKey = key.replace(/[^a-zA-Z0-9\-_.]/g, '');
612
- // eslint-disable-next-line security/detect-non-literal-regexp
609
+ const sanitizedKey = key.replace(/[^\w\-.]/g, '');
613
610
  data.dates[`${i}`].name = data.dates[`${i}`].name.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
614
- // eslint-disable-next-line security/detect-non-literal-regexp
615
611
  data.dates[`${i}`].location = data.dates[`${i}`].location.replace(new RegExp(`%%${sanitizedKey}%%`, 'g'), data.customVar[`${key}`]);
616
612
  }
617
613
  }
@@ -630,7 +626,7 @@ function atcb_date_cleanup(dateTimeData) {
630
626
  }
631
627
  const endpoints = ['start', 'end'];
632
628
  endpoints.forEach(function (point) {
633
- if (!/^(\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2}|)Z?|today(?:\+\d{1,4}|))$/i.test(dateTimeData[point + 'Date'])) {
629
+ if (!/^(?:\d{4}-\d{2}-\d{2}T?(?:\d{2}:\d{2})?Z?|today(?:\+\d{1,4})?)$/i.test(dateTimeData[point + 'Date'])) {
634
630
  dateTimeData[point + 'Date'] = 'badly-formed';
635
631
  } else {
636
632
  dateTimeData[point + 'Date'] = atcb_date_calculation(dateTimeData[point + 'Date']);
@@ -835,7 +831,7 @@ async function atcb_validate_buttonStyle(data, msgPrefix) {
835
831
  if (!availableStyles.includes(data.buttonStyle)) {
836
832
  throw new Error(msgPrefix + ' failed: provided buttonStyle invalid');
837
833
  }
838
- if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css($|\?)/.test(data.customCss))) {
834
+ if (data.customCss && data.customCss !== '' && (!atcb_secure_url(data.customCss, false) || !/\.css(?:$|\?)/.test(data.customCss))) {
839
835
  throw new Error(msgPrefix + ' failed: customCss provided, but no valid url');
840
836
  }
841
837
  if ((!data.customCss || data.customCss === '') && data.buttonStyle === 'custom') {
@@ -914,7 +910,7 @@ async function atcb_validate_availability(data, msgPrefix, i, msgSuffix) {
914
910
  async function atcb_validate_organizer(data, msgPrefix, i, msgSuffix) {
915
911
  if (data.dates[`${i}`].organizer && data.dates[`${i}`].organizer !== '') {
916
912
  const organizerParts = data.dates[`${i}`].organizer.split('|');
917
- if (organizerParts.length !== 2 || organizerParts[0].length > 50 || organizerParts[1].length > 80 || !atcb_validEmail(organizerParts[1])) {
913
+ if (organizerParts.length !== 2 || organizerParts[0].length > 50 || organizerParts[1].length > 100 || !atcb_validEmail(organizerParts[1])) {
918
914
  throw new Error(msgPrefix + ' failed: organizer needs to match the schema "NAME|EMAIL" with a valid email address' + msgSuffix);
919
915
  }
920
916
  }
@@ -929,14 +925,14 @@ async function atcb_validate_attendee(data, msgPrefix, i, msgSuffix) {
929
925
  if (attendeeParts.length === 1 && atcb_validEmail(attendeeParts[0])) {
930
926
  return true;
931
927
  }
932
- if (attendeeParts.length !== 2 || attendeeParts[0].length > 50 || attendeeParts[1].length > 80 || !atcb_validEmail(attendeeParts[1])) {
928
+ if (attendeeParts.length !== 2 || attendeeParts[0].length > 50 || attendeeParts[1].length > 100 || !atcb_validEmail(attendeeParts[1])) {
933
929
  throw new Error(msgPrefix + ' failed: attendee needs to be a valid email address or match the schema "NAME|EMAIL" with EMAIL being a valid email address' + msgSuffix);
934
930
  }
935
931
  }
936
932
  return true;
937
933
  }
938
934
  async function atcb_validate_uid(data, msgPrefix, i, msgSuffix) {
939
- if (!/^(\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
935
+ if (!/^(?:\w|-){1,254}$/.test(data.dates[`${i}`].uid)) {
940
936
  if (data.debug) {
941
937
  console.warn(msgPrefix + ': UID not valid. May only contain alpha, digits, and dashes; and be less than 255 characters. Falling back to an automated value!' + msgSuffix);
942
938
  }
@@ -1005,7 +1001,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
1005
1001
  if (data.recurrence && data.recurrence !== '' && data.dates.length > 1) {
1006
1002
  throw new Error(msgPrefix + ' failed: RRULE and multi-date set at the same time');
1007
1003
  }
1008
- if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+-/\\]+$/i.test(data.recurrence)) {
1004
+ if (data.recurrence && data.recurrence !== '' && !/^RRULE:[\w=;,:+\-/\\]+$/i.test(data.recurrence)) {
1009
1005
  throw new Error(msgPrefix + ' failed: RRULE data misspelled');
1010
1006
  }
1011
1007
  return true;
@@ -1014,22 +1010,22 @@ async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
1014
1010
  if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
1015
1011
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1016
1012
  }
1017
- if (data.recurrence_until && data.recurrence_until !== '' && !/^(\d|-|:)+$/i.test(data.recurrence_until)) {
1013
+ if (data.recurrence_until && data.recurrence_until !== '' && !/^[\d\-:]+$/.test(data.recurrence_until)) {
1018
1014
  throw new Error(msgPrefix + ' failed: recurrence data (until) misspelled');
1019
1015
  }
1020
1016
  if (data.recurrence_count && (data.recurrence_count < 1 || data.recurrence_count % 1 !== 0)) {
1021
1017
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1022
1018
  }
1023
- if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^(\d|,)+$/.test(data.recurrence_byMonth)) {
1019
+ if (data.recurrence_byMonth && data.recurrence_byMonth !== '' && !/^[\d,]+$/.test(data.recurrence_byMonth)) {
1024
1020
  throw new Error(msgPrefix + ' failed: recurrence data (byMonth) misspelled');
1025
1021
  }
1026
- if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^(\d|,)+$/.test(data.recurrence_byMonthDay)) {
1022
+ if (data.recurrence_byMonthDay && data.recurrence_byMonthDay !== '' && !/^[\d,]+$/.test(data.recurrence_byMonthDay)) {
1027
1023
  throw new Error(msgPrefix + ' failed: recurrence data (byMonthDay) misspelled');
1028
1024
  }
1029
- if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(\d|-|MO|TU|WE|TH|FR|SA|SU|,)+$/im.test(data.recurrence_byDay)) {
1025
+ if (data.recurrence_byDay && data.recurrence_byDay !== '' && !/^(?:[\d,-]|MO|TU|WE|TH|FR|SA|SU)+$/im.test(data.recurrence_byDay)) {
1030
1026
  throw new Error(msgPrefix + ' failed: recurrence data (byDay) misspelled');
1031
1027
  }
1032
- if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
1028
+ if (data.recurrence_weekstart && data.recurrence_weekstart !== '' && !/^(?:MO|TU|WE|TH|FR|SA|SU)$/im.test(data.recurrence_weekstart)) {
1033
1029
  throw new Error(msgPrefix + ' failed: recurrence data (weekstart) misspelled');
1034
1030
  }
1035
1031
  return true;
@@ -1470,7 +1466,7 @@ async function atcb_generate_rsvp_form(host, data, hostEl, keyboardTrigger = fal
1470
1466
  } else {
1471
1467
  rsvpData.fields = rsvpData.fields.map((field) => {
1472
1468
  if (field.name === 'email') {
1473
- return { ...field, required: true, type: 'email', default: attendee !== '' && attendee || field.default };
1469
+ return { ...field, required: true, type: 'email', default: attendee !== '' ? attendee : field.default };
1474
1470
  }
1475
1471
  return field;
1476
1472
  });
@@ -2236,24 +2232,36 @@ function atcb_generate_bg_overlay(host, trigger = '', modal = false, darken = tr
2236
2232
  }
2237
2233
  return bgOverlay;
2238
2234
  }
2239
- function atcb_create_atcbl(host, atList = true, returnEl = false) {
2235
+ /*!
2236
+ * @preserve
2237
+ * PER LICENSE AGREEMENT, YOU ARE NOT ALLOWED TO REMOVE OR CHANGE THIS FUNCTION!
2238
+ */
2239
+ function atcb_create_atcbl(host, atList = true, returnEl = false, licenseNoteOnly = false) {
2240
2240
  const atcbL = document.createElement('div');
2241
2241
  atcbL.id = 'atcb-reference';
2242
- setTimeout(() => {
2243
- const svg =
2244
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52.916 2.8305"><path d="M51.446 1.2565c.0708-.2518.293-.4511.5555-.4783.2211-.042.4641.0128.622.18.2474.2472.3045.6146.2916.9503v.8594h-.8307l-.0027-1.0447c-.0079-.1547-.1075-.343-.2868-.3238-.2049.0128-.3115.2421-.295.4257v.9428h-.823l-.0027-1.0435c-.0076-.1569-.1131-.3412-.2918-.3252-.2069.008-.311.2351-.2939.4188v.9499h-.8307V.8237h.8307v.4019c.0906-.2264.2876-.4188.5368-.449.2878-.0533.6071.0705.7509.3331.0279.0465.0509.0959.0699.1468zm-3.9843.5228c-.0102.1874.107.3914.3024.424.1869.0419.3799-.0941.4215-.2776.0535-.1967-.0023-.4493-.2015-.5411-.1767-.0892-.4107.0032-.483.1865-.0297.0649-.0391.1374-.0392.2082zm-.7691 0c.0037-.2984.1395-.5957.3792-.7774.3035-.2327.7168-.2798 1.0829-.2005.3299.0729.6352.3018.7481.6275.1337.3797.0441.8526-.2795 1.1099-.3184.2561-.7624.3092-1.152.2184-.3379-.0788-.6426-.3312-.7369-.6717a1.092 1.092 0 0 1-.0417-.3063zm-.2351-.3308c-.1638-.0482-.3406-.0889-.5104-.0492s-.2742.2154-.2664.3837c-.0082.1705.0998.3468.2712.3876.1657.0389.3389.0016.4979-.0492l.0769.5499c-.2369.1272-.5165.1434-.7791.1149-.3236-.0401-.6353-.2311-.7805-.529-.1237-.2511-.139-.5539-.0485-.8181.108-.3075.3782-.5432.6902-.6287.2064-.058.4286-.0585.6371-.0119.1027.0253.198.0732.2884.1269l-.0769.523zm-2.6877.9806c-.003-.1221.066-.2371.1643-.3062.1303-.0934.3092-.1186.4572-.0533.132.054.2426.1752.2607.3197s-.0575.2836-.1746.3603c-.1633.1093-.3947.1063-.5517-.0135-.0951-.0715-.1577-.187-.1559-.307zm-3.046-1.0111c-.0091-.4276.1794-.8577.5181-1.1231.3714-.2958.8865-.3488 1.3384-.2477.4065.0946.7695.3811.9242.7731.2302.553.1173 1.2562-.3406 1.6606-.4021.3563-.9997.4264-1.5018.273-.4407-.1312-.7876-.5106-.8926-.9564a1.565 1.565 0 0 1-.0458-.3795zm1.4499.6961c.2631.014.4813-.2093.5326-.4557.0785-.3033.0224-.6834-.2491-.8753-.2182-.159-.5514-.1019-.704.1211-.1692.2437-.1902.5756-.088.8501.0775.2087.2816.3661.5085.3597zm-1.631.6458c-.1978.0602-.4078.0938-.6123.0464-.2697-.0443-.5044-.2371-.6009-.4927-.0701-.1852-.1026-.3819-.154-.5728h-.1846v1.0268h-.8614V.0601l1.3192.0034c.3398.0217.7177.1323.9118.434.152.2456.127.584-.0389.8163-.0979.1284-.2387.2162-.3846.2807.0316.1513.0475.3167.1461.4418.1193.1187.3064.1031.4596.0812v.6422zm-.871-1.8651c.0103-.138-.1243-.231-.25-.2384-.1427-.0193-.2871-.0088-.4307-.0115v.5422c.1905-.0038.3947.0138.5678-.0796a.234.234 0 0 0 .1128-.2126zM35.573.0603l1.1424.0047c.3439.0209.7218.1098.9446.3944.2252.2934.2163.7545-.0512 1.0195-.279.2859-.698.3701-1.0838.362-.0329.0105-.1126-.0258-.102.0281v.8987h-.8499V.0603zm1.0192 1.2345c.1672.0054.3805-.0562.4233-.2409.0425-.1434-.0225-.3102-.1619-.3724-.1328-.0705-.2859-.0537-.4306-.0559v.6615c.0561.0073.1128.0073.1692.0077zm-2.5176.2226h1.0576v.4653h-1.0576zM32.3311.8234h.8307v.4019q.0942-.2384.25-.348.1577-.1115.3615-.1115l.1154.6442q-.375 0-.5519.0808-.175.0788-.175.2538v1.023h-.8307zm-1.2257 1.5791c-.0937.2116-.2986.3716-.5319.3897-.3887.0533-.7844-.1743-.9578-.5217-.2044-.381-.1519-.892.1543-1.2049.2461-.2614.6627-.389.9973-.2285.1574.0799.2779.2236.3381.3886V.7662h.8268v2.0017h-.8268v-.3653zm0-.6345c-.0052-.2449-.2747-.4425-.5088-.3585-.217.0615-.3402.3271-.243.5316.0896.2161.3875.3078.5783.1678.1106-.0747.179-.2073.1735-.3408zM27.7118.7662c.2401-.008.4923.1021.6064.3222.0351.0816.045.0806.0397.0023V.1721l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.412-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3309.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM24.139.8233h.7922v.4019c.1006-.2169.2949-.397.5347-.4408.2696-.0572.58.0085.76.2293.2045.2403.2438.5692.2358.8734v.8802h-.8268l-.0022-1.1213c-.004-.1252-.0677-.2748-.2066-.2939-.2045-.0306-.3739.1457-.4412.3226-.0292.0785-.0098.1646-.0154.2467v.8459h-.8306V.8233zm-1.0416 1.4236c.2011-.0002.3981-.0574.5807-.1384l.0961.5288c-.3198.1421-.6806.1894-1.027.145-.3369-.0473-.6587-.2545-.8007-.5699-.1588-.3469-.1132-.7886.1413-1.0788.2741-.3191.7406-.4335 1.1413-.3308.2768.0734.5008.3019.5751.5779.0429.146.0624.3015.043.453l-1.1806.1538c.0368.134.158.2311.2944.2482.0449.0082.0907.0114.1363.0114zm.1461-.7557c-.0268-.1234-.1257-.237-.2578-.244-.143-.0241-.2868.0725-.325.2111-.0103.0527-.0737.2029.0271.1552l.5558-.1223zm-1.4939 1.1721c-.2463.1208-.5356.1686-.805.1092-.227-.0527-.3993-.2481-.4518-.4712-.0545-.2125-.0296-.4333-.0353-.6502V.1714l.8307-.1231.0011 1.9292c.002.1378.1537.1938.2711.1813.0651.0169.1819-.1.162.0152l.0274.4893zm-2.5115-.2609c-.0937.2116-.2986.3716-.5319.3897-.3887.0533-.7844-.1743-.9578-.5217-.2044-.381-.1519-.892.1543-1.2049.2461-.2614.6627-.389.9973-.2285.1574.0799.2779.2236.3381.3886V.7661h.8268v2.0017h-.8268v-.3653zm0-.6345c-.0052-.2449-.2747-.4425-.5088-.3585-.217.0615-.3402.3271-.243.5316.0896.2161.3875.3078.5783.1678.1106-.0747.179-.2073.1735-.3408zm-2.3726.35c.1696.0054.3334-.0479.4884-.1115l.1077.6249c-.5137.3026-1.2229.2625-1.6732-.1399-.2959-.2444-.4693-.6191-.4819-1.0009-.0323-.4791.181-.9792.5853-1.2496.4565-.3128 1.0898-.3142 1.5659-.0438l-.1038.6115c-.2721-.1029-.5957-.168-.8667-.0274-.2291.1239-.3077.4039-.2984.6481-.0043.2465.1061.5161.3427.6212.1037.0495.2198.0676.3339.0676zm-2.923-.6005h1.0576v.4653h-1.0576zm-1.7829.2619c-.0102.1874.107.3914.3024.424.1869.0419.3799-.0941.4215-.2776.0535-.1967-.0023-.4493-.2015-.5411-.1767-.0892-.4107.0032-.4831.1865-.0297.0649-.0391.1374-.0392.2082zm-.7691 0c.0037-.2984.1395-.5957.3792-.7774.3035-.2327.7168-.2798 1.0829-.2005.33.0729.6352.3018.7481.6275.1337.3797.0441.8526-.2795 1.1099-.3184.2561-.7624.3092-1.152.2184-.3379-.0788-.6426-.3312-.7369-.6717a1.092 1.092 0 0 1-.0417-.3063zm-.1976.8841c-.2463.1208-.5356.1686-.805.1092-.227-.0527-.3993-.2481-.4518-.4712-.0557-.2169-.0286-.4422-.0334-.6635l.0019-.3551h-.25V.7943h.3115l.3653-.7461h.4v.7461h.4538v.4884h-.4538l.0011.6943c.0034.1365.1541.1943.2715.1818.0768.006.1848-.0959.1624.0301l.0265.4744zm-2.7861-1.146h1.0575v.4653H8.4068zM6.5412.7662c.2401-.008.4923.1021.6064.3223.0351.0816.045.0806.0397.0023V.172l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.412-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3308.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM3.7956.7662c.2401-.008.4923.1021.6064.3222.0351.0816.045.0806.0397.0023V.172l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.4119-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3308.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM.7498.0603h1.196l.7845 2.7074h-.9268l-.1038-.5192H.9997l-.1115.5192h-.8883zm.8576 1.7037L1.3497.5795 1.0843 1.764z"/></svg>';
2245
- atcbL.innerHTML = '<a href="https://add-to-calendar-pro.com" target="_blank" rel="noopener">' + svg + '</a>';
2246
- }, 500);
2247
- if (atList) {
2248
- host.querySelector('.atcb-initialized .atcb-list-wrapper').append(atcbL);
2249
- } else if (returnEl) {
2250
- return atcbL;
2251
- } else {
2252
- if (window.innerHeight > 1000 || window.innerWidth > 1000) {
2253
- host.append(atcbL);
2254
- atcbL.classList.add('fixed-ref');
2242
+ if (!licenseNoteOnly) {
2243
+ setTimeout(() => {
2244
+ const svg =
2245
+ '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52.916 2.8305"><path d="M51.446 1.2565c.0708-.2518.293-.4511.5555-.4783.2211-.042.4641.0128.622.18.2474.2472.3045.6146.2916.9503v.8594h-.8307l-.0027-1.0447c-.0079-.1547-.1075-.343-.2868-.3238-.2049.0128-.3115.2421-.295.4257v.9428h-.823l-.0027-1.0435c-.0076-.1569-.1131-.3412-.2918-.3252-.2069.008-.311.2351-.2939.4188v.9499h-.8307V.8237h.8307v.4019c.0906-.2264.2876-.4188.5368-.449.2878-.0533.6071.0705.7509.3331.0279.0465.0509.0959.0699.1468zm-3.9843.5228c-.0102.1874.107.3914.3024.424.1869.0419.3799-.0941.4215-.2776.0535-.1967-.0023-.4493-.2015-.5411-.1767-.0892-.4107.0032-.483.1865-.0297.0649-.0391.1374-.0392.2082zm-.7691 0c.0037-.2984.1395-.5957.3792-.7774.3035-.2327.7168-.2798 1.0829-.2005.3299.0729.6352.3018.7481.6275.1337.3797.0441.8526-.2795 1.1099-.3184.2561-.7624.3092-1.152.2184-.3379-.0788-.6426-.3312-.7369-.6717a1.092 1.092 0 0 1-.0417-.3063zm-.2351-.3308c-.1638-.0482-.3406-.0889-.5104-.0492s-.2742.2154-.2664.3837c-.0082.1705.0998.3468.2712.3876.1657.0389.3389.0016.4979-.0492l.0769.5499c-.2369.1272-.5165.1434-.7791.1149-.3236-.0401-.6353-.2311-.7805-.529-.1237-.2511-.139-.5539-.0485-.8181.108-.3075.3782-.5432.6902-.6287.2064-.058.4286-.0585.6371-.0119.1027.0253.198.0732.2884.1269l-.0769.523zm-2.6877.9806c-.003-.1221.066-.2371.1643-.3062.1303-.0934.3092-.1186.4572-.0533.132.054.2426.1752.2607.3197s-.0575.2836-.1746.3603c-.1633.1093-.3947.1063-.5517-.0135-.0951-.0715-.1577-.187-.1559-.307zm-3.046-1.0111c-.0091-.4276.1794-.8577.5181-1.1231.3714-.2958.8865-.3488 1.3384-.2477.4065.0946.7695.3811.9242.7731.2302.553.1173 1.2562-.3406 1.6606-.4021.3563-.9997.4264-1.5018.273-.4407-.1312-.7876-.5106-.8926-.9564a1.565 1.565 0 0 1-.0458-.3795zm1.4499.6961c.2631.014.4813-.2093.5326-.4557.0785-.3033.0224-.6834-.2491-.8753-.2182-.159-.5514-.1019-.704.1211-.1692.2437-.1902.5756-.088.8501.0775.2087.2816.3661.5085.3597zm-1.631.6458c-.1978.0602-.4078.0938-.6123.0464-.2697-.0443-.5044-.2371-.6009-.4927-.0701-.1852-.1026-.3819-.154-.5728h-.1846v1.0268h-.8614V.0601l1.3192.0034c.3398.0217.7177.1323.9118.434.152.2456.127.584-.0389.8163-.0979.1284-.2387.2162-.3846.2807.0316.1513.0475.3167.1461.4418.1193.1187.3064.1031.4596.0812v.6422zm-.871-1.8651c.0103-.138-.1243-.231-.25-.2384-.1427-.0193-.2871-.0088-.4307-.0115v.5422c.1905-.0038.3947.0138.5678-.0796a.234.234 0 0 0 .1128-.2126zM35.573.0603l1.1424.0047c.3439.0209.7218.1098.9446.3944.2252.2934.2163.7545-.0512 1.0195-.279.2859-.698.3701-1.0838.362-.0329.0105-.1126-.0258-.102.0281v.8987h-.8499V.0603zm1.0192 1.2345c.1672.0054.3805-.0562.4233-.2409.0425-.1434-.0225-.3102-.1619-.3724-.1328-.0705-.2859-.0537-.4306-.0559v.6615c.0561.0073.1128.0073.1692.0077zm-2.5176.2226h1.0576v.4653h-1.0576zM32.3311.8234h.8307v.4019q.0942-.2384.25-.348.1577-.1115.3615-.1115l.1154.6442q-.375 0-.5519.0808-.175.0788-.175.2538v1.023h-.8307zm-1.2257 1.5791c-.0937.2116-.2986.3716-.5319.3897-.3887.0533-.7844-.1743-.9578-.5217-.2044-.381-.1519-.892.1543-1.2049.2461-.2614.6627-.389.9973-.2285.1574.0799.2779.2236.3381.3886V.7662h.8268v2.0017h-.8268v-.3653zm0-.6345c-.0052-.2449-.2747-.4425-.5088-.3585-.217.0615-.3402.3271-.243.5316.0896.2161.3875.3078.5783.1678.1106-.0747.179-.2073.1735-.3408zM27.7118.7662c.2401-.008.4923.1021.6064.3222.0351.0816.045.0806.0397.0023V.1721l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.412-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3309.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM24.139.8233h.7922v.4019c.1006-.2169.2949-.397.5347-.4408.2696-.0572.58.0085.76.2293.2045.2403.2438.5692.2358.8734v.8802h-.8268l-.0022-1.1213c-.004-.1252-.0677-.2748-.2066-.2939-.2045-.0306-.3739.1457-.4412.3226-.0292.0785-.0098.1646-.0154.2467v.8459h-.8306V.8233zm-1.0416 1.4236c.2011-.0002.3981-.0574.5807-.1384l.0961.5288c-.3198.1421-.6806.1894-1.027.145-.3369-.0473-.6587-.2545-.8007-.5699-.1588-.3469-.1132-.7886.1413-1.0788.2741-.3191.7406-.4335 1.1413-.3308.2768.0734.5008.3019.5751.5779.0429.146.0624.3015.043.453l-1.1806.1538c.0368.134.158.2311.2944.2482.0449.0082.0907.0114.1363.0114zm.1461-.7557c-.0268-.1234-.1257-.237-.2578-.244-.143-.0241-.2868.0725-.325.2111-.0103.0527-.0737.2029.0271.1552l.5558-.1223zm-1.4939 1.1721c-.2463.1208-.5356.1686-.805.1092-.227-.0527-.3993-.2481-.4518-.4712-.0545-.2125-.0296-.4333-.0353-.6502V.1714l.8307-.1231.0011 1.9292c.002.1378.1537.1938.2711.1813.0651.0169.1819-.1.162.0152l.0274.4893zm-2.5115-.2609c-.0937.2116-.2986.3716-.5319.3897-.3887.0533-.7844-.1743-.9578-.5217-.2044-.381-.1519-.892.1543-1.2049.2461-.2614.6627-.389.9973-.2285.1574.0799.2779.2236.3381.3886V.7661h.8268v2.0017h-.8268v-.3653zm0-.6345c-.0052-.2449-.2747-.4425-.5088-.3585-.217.0615-.3402.3271-.243.5316.0896.2161.3875.3078.5783.1678.1106-.0747.179-.2073.1735-.3408zm-2.3726.35c.1696.0054.3334-.0479.4884-.1115l.1077.6249c-.5137.3026-1.2229.2625-1.6732-.1399-.2959-.2444-.4693-.6191-.4819-1.0009-.0323-.4791.181-.9792.5853-1.2496.4565-.3128 1.0898-.3142 1.5659-.0438l-.1038.6115c-.2721-.1029-.5957-.168-.8667-.0274-.2291.1239-.3077.4039-.2984.6481-.0043.2465.1061.5161.3427.6212.1037.0495.2198.0676.3339.0676zm-2.923-.6005h1.0576v.4653h-1.0576zm-1.7829.2619c-.0102.1874.107.3914.3024.424.1869.0419.3799-.0941.4215-.2776.0535-.1967-.0023-.4493-.2015-.5411-.1767-.0892-.4107.0032-.4831.1865-.0297.0649-.0391.1374-.0392.2082zm-.7691 0c.0037-.2984.1395-.5957.3792-.7774.3035-.2327.7168-.2798 1.0829-.2005.33.0729.6352.3018.7481.6275.1337.3797.0441.8526-.2795 1.1099-.3184.2561-.7624.3092-1.152.2184-.3379-.0788-.6426-.3312-.7369-.6717a1.092 1.092 0 0 1-.0417-.3063zm-.1976.8841c-.2463.1208-.5356.1686-.805.1092-.227-.0527-.3993-.2481-.4518-.4712-.0557-.2169-.0286-.4422-.0334-.6635l.0019-.3551h-.25V.7943h.3115l.3653-.7461h.4v.7461h.4538v.4884h-.4538l.0011.6943c.0034.1365.1541.1943.2715.1818.0768.006.1848-.0959.1624.0301l.0265.4744zm-2.7861-1.146h1.0575v.4653H8.4068zM6.5412.7662c.2401-.008.4923.1021.6064.3223.0351.0816.045.0806.0397.0023V.172l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.412-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3308.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM3.7956.7662c.2401-.008.4923.1021.6064.3222.0351.0816.045.0806.0397.0023V.172l.8307-.1231v2.7189h-.8307v-.3653c-.0907.2158-.3003.3744-.5356.39-.3605.0507-.7279-.1432-.9123-.4525-.2569-.3983-.1992-.9693.1456-1.2985.173-.1702.4119-.2772.6563-.2754zm.6461 1.0018c-.0048-.2526-.2909-.4519-.5276-.3518-.2324.0782-.3308.3933-.1843.5898.1239.1938.425.2285.5871.0636.0811-.0768.1287-.1897.1248-.3015zM.7498.0603h1.196l.7845 2.7074h-.9268l-.1038-.5192H.9997l-.1115.5192h-.8883zm.8576 1.7037L1.3497.5795 1.0843 1.764z"/></svg>';
2246
+ atcbL.innerHTML = '<a href="https://add-to-calendar-pro.com" target="_blank" rel="noopener">' + svg + '</a>';
2247
+ }, 500);
2248
+ if (atList) {
2249
+ host.querySelector('.atcb-initialized .atcb-list-wrapper').append(atcbL);
2250
+ } else if (returnEl) {
2251
+ return atcbL;
2252
+ } else {
2253
+ if (window.innerHeight > 1000 || window.innerWidth > 1000) {
2254
+ host.append(atcbL);
2255
+ atcbL.classList.add('fixed-ref');
2256
+ }
2255
2257
  }
2258
+ } else {
2259
+ atcbL.innerHTML = 'Using the <a href="https://add-to-calendar-pro.com" target="_blank" rel="noopener referrer">Add to Calendar Button</a>, licensed under the Elastic License 2.0 (ELv2).';
2260
+ atcbL.setAttribute('style', 'display:none !important');
2261
+ atcbL.classList.add('atcb-attribution');
2262
+ host.append(atcbL);
2256
2263
  }
2264
+ if (returnEl) return null;
2257
2265
  }
2258
2266
  async function atcb_create_modal(mainHost, data, icon = '', headline, content = '', buttons = [], subEvents = [], keyboardTrigger = false, goto = {}, closable = true) {
2259
2267
  atcbStates['active'] = data.identifier;
@@ -2927,7 +2935,7 @@ function atcb_subscribe_ical(data, fileUrl) {
2927
2935
  function atcb_subscribe_google(data, fileUrl) {
2928
2936
  const baseUrl = 'https://calendar.google.com/calendar/r?cid=';
2929
2937
  const baseUrlApp = 'calendar.google.com/calendar?cid=';
2930
- const fileUrlRegex = /^(https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
2938
+ const fileUrlRegex = /^(?:https?:\/\/|webcal:\/\/|\/\/)calendar\.google\.com\//;
2931
2939
  const newFileUrl = (function () {
2932
2940
  if (fileUrlRegex.test(fileUrl)) {
2933
2941
  return fileUrl.replace(/^(.)*\?cid=/, '');
@@ -2962,7 +2970,7 @@ function atcb_generate_google(data, date, subEvent = 'all') {
2962
2970
  urlParts.push('https://calendar.google.com/calendar/render?action=TEMPLATE');
2963
2971
  const formattedDate = atcb_generate_time(date, 'clean', 'google');
2964
2972
  urlParts.push('dates=' + encodeURIComponent(formattedDate.start) + '%2F' + encodeURIComponent(formattedDate.end));
2965
- if (date.timeZone && date.timeZone !== '' && !/(GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|WET)/i.test(date.timeZone) && !formattedDate.allday) {
2973
+ if (date.timeZone && date.timeZone !== '' && !/GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|MET|MST|PST8PDT|WET/i.test(date.timeZone) && !formattedDate.allday) {
2966
2974
  urlParts.push('ctz=' + date.timeZone);
2967
2975
  }
2968
2976
  if (date.name && date.name !== '') {
@@ -3113,7 +3121,6 @@ function atcb_open_cal_url(data, type, url, subscribe = false, subEvent = null,
3113
3121
  return;
3114
3122
  }
3115
3123
  }
3116
- // eslint-disable-next-line security/detect-non-literal-fs-filename
3117
3124
  const newTab = window.open(url, target);
3118
3125
  if (newTab) {
3119
3126
  newTab.focus();
@@ -3335,7 +3342,7 @@ function atcb_generate_time(data, style = 'delimiters', targetCal = 'general', a
3335
3342
  }
3336
3343
  return durationHours + ':' + ('0' + durationMinutes).slice(-2);
3337
3344
  })();
3338
- if (targetCal == 'ical' || (targetCal == 'google' && !/(GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|EST5EDT|MET|MST|MST7MDT|PST8PDT|WET)/i.test(data.timeZone))) {
3345
+ if (targetCal == 'ical' || (targetCal == 'google' && !/GMT[+|-]\d{1,2}|Etc\/U|Etc\/Zulu|CET|CST6CDT|EET|EST|MET|MST|PST8PDT|WET/i.test(data.timeZone))) {
3339
3346
  return {
3340
3347
  start: atcb_format_datetime(newStartDate, 'clean', true, true),
3341
3348
  end: atcb_format_datetime(newEndDate, 'clean', true, true),
@@ -3657,7 +3664,7 @@ function atcb_secure_url(url, throwError = true) {
3657
3664
  }
3658
3665
  }
3659
3666
  function atcb_validEmail(email) {
3660
- if (!/^.{0,70}@.{1,30}\.[a-zA-Z]{2,9}$/.test(email)) {
3667
+ if (!/^.{0,70}@.{1,30}\.[a-z]{2,9}$/i.test(email)) {
3661
3668
  return false;
3662
3669
  }
3663
3670
  return true;
@@ -3675,9 +3682,9 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
3675
3682
  content = content.replace(/\{url\}(.+?)\{\/url\}/gi, (match, p1) => {
3676
3683
  return p1.split('|')[0];
3677
3684
  });
3678
- content = content.replace(/\[(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\]/gi, '');
3679
- content = content.replace(/\{(|\/)(hr|p|b|strong|u|i|em|li|ul|ol|h\d)\}/gi, '');
3680
- content = content.replace(/&[#a-zA-Z0-9]{1,9};/gi, '');
3685
+ content = content.replace(/\[\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\]/gi, '');
3686
+ content = content.replace(/\{\/?(hr|[pbui]|strong|em|li|ul|ol|h\d)\}/gi, '');
3687
+ content = content.replace(/&[#a-z0-9]{1,9};/gi, '');
3681
3688
  } else {
3682
3689
  content = content.replace(/\[url\]((?:(?!\[\/url\]).)*)\[\/url\]/gi, function (match, p1) {
3683
3690
  return atcb_parse_url_code(p1);
@@ -3685,8 +3692,8 @@ function atcb_rewrite_html_elements(content, clear = false, iCalBreaks = false)
3685
3692
  content = content.replace(/\{url\}((?:(?!\[\/url\]).)*)\{\/url\}/gi, function (match, p1) {
3686
3693
  return atcb_parse_url_code(p1);
3687
3694
  });
3688
- content = content.replace(/\[(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
3689
- content = content.replace(/\{(\/|)(br|hr|p|b|strong|u|i|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
3695
+ content = content.replace(/\[(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\]/gi, '<$1$2$3>');
3696
+ content = content.replace(/\{(\/)?(br|hr|[pbui]|strong|em|li|ul|ol|h\d)(\s?\/?)\}/gi, '<$1$2$3>');
3690
3697
  }
3691
3698
  return content;
3692
3699
  }
@@ -4896,7 +4903,7 @@ if (atcbIsBrowser()) {
4896
4903
  this.data.identifier = this.identifier;
4897
4904
  } else {
4898
4905
  if (this.data.identifier && this.data.identifier !== '') {
4899
- if (!/^[\w\-_]+$/.test(this.data.identifier)) {
4906
+ if (!/^[\w-]+$/.test(this.data.identifier)) {
4900
4907
  this.data.identifier = '';
4901
4908
  if (this.debug) {
4902
4909
  let prefix = 'Add to Calendar Button';
@@ -4915,7 +4922,6 @@ if (atcbIsBrowser()) {
4915
4922
  this.identifier = this.data.identifier;
4916
4923
  }
4917
4924
  this.setAttribute('atcb-button-id', this.data.identifier);
4918
- this.classList.add('add-to-calendar');
4919
4925
  try {
4920
4926
  this.setAttribute('style', 'visibility:visible;opacity:1;position:relative;outline:none !important;');
4921
4927
  await atcb_build_button(this.shadowRoot, this.data);
@@ -5010,6 +5016,7 @@ function atcb_read_attributes(el, params = atcbWcParams) {
5010
5016
  }
5011
5017
  async function atcb_build_button(host, data) {
5012
5018
  try {
5019
+ host.host.classList.add('add-to-calendar');
5013
5020
  data = await atcb_decorate_data(data);
5014
5021
  await atcb_validate(data);
5015
5022
  const rootObj = host.querySelector('.atcb-initialized');
@@ -5034,6 +5041,9 @@ async function atcb_build_button(host, data) {
5034
5041
  }
5035
5042
  }
5036
5043
  atcb_log_event('initialization', data.identifier, data.identifier);
5044
+ if (!data.proKey && data.hideBranding && !document.getElementById('atcb-reference')) {
5045
+ atcb_create_atcbl(document.body, false, false, true);
5046
+ }
5037
5047
  return true;
5038
5048
  } catch (e) {
5039
5049
  throw new Error(e.message);
@@ -5091,7 +5101,7 @@ async function atcb_load_css(host, rootObj = null, data) {
5091
5101
  const cssGlobalContent = document.createElement('style');
5092
5102
  cssGlobalContent.id = 'atcb-global-style';
5093
5103
  const scrollBarWidth = window.innerWidth - document.documentElement.clientWidth;
5094
- cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}';
5104
+ cssGlobalContent.innerText = '.atcb-modal-no-scroll{overflow-y:hidden !important;-webkit-overflow-scrolling:touch;} body.atcb-modal-no-scroll{padding-right:' + scrollBarWidth + 'px;}.atcb-attribution{display:none;}';
5095
5105
  if (nonceVal) {
5096
5106
  cssGlobalContent.setAttribute('nonce', nonceVal);
5097
5107
  }
@@ -5240,7 +5250,7 @@ async function atcb_action(inputData, triggerElement, keyboardTrigger = false) {
5240
5250
  if (triggerElement.id && triggerElement.id !== '') {
5241
5251
  data.identifier = triggerElement.id;
5242
5252
  } else {
5243
- if (data.identifier && data.identifier != '' && /^[\w\-_]+$/.test(data.identifier)) {
5253
+ if (data.identifier && data.identifier != '' && /^[\w-]+$/.test(data.identifier)) {
5244
5254
  data.identifier = 'atcb-btn-' + data.identifier;
5245
5255
  } else {
5246
5256
  data.identifier = 'atcb-btn-custom';