add-to-calendar-button 2.13.10 → 2.14.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ## Version 2
4
4
 
5
+ - v2.14 : Dropping atcb_decorate_data_recurrence export; various bug fixes
5
6
  - v2.13 : Hebrew language
6
7
  - v2.12 : ⚠️ Breaking: Date buttons now show the next possible date in multi-date and recurrence cases. Recurrence UNTIL support. Mitigating edge cases where ics files with unsupported time zones loaded into Google calendar. Always block background scroll on modals open
7
8
  - v2.11 : ⚠️ Breaking: When setting the dates objects and respective attributes on the root level, root values always override the dates object (except for name in the multi-date case)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: 3D
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Date
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Flat
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Neumorphism
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Round
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Simple
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Text
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * Style: Default
7
7
  *
8
- * Version: 2.13.10
8
+ * Version: 2.14.0
9
9
  * Creator: Jens Kuerschner (https://jekuer.com)
10
10
  * Project: https://github.com/add2cal/add-to-calendar-button
11
11
  * License: Elastic License 2.0 (ELv2) (https://github.com/add2cal/add-to-calendar-button/blob/main/LICENSE.txt)
@@ -342,7 +342,7 @@ if(typeof window !== "undefined"){ for(var k in tzlib_tmp_scope) window[k] = tzl
342
342
  * Add to Calendar Button
343
343
  * ++++++++++++++++++++++
344
344
  *
345
- * Version: 2.13.10
345
+ * Version: 2.14.0
346
346
  * Creator: Jens Kuerschner (https://jekuer.com)
347
347
  * Publisher: Calendarverse GmbH (https://add-to-calendar-pro.com)
348
348
  * Project: https://github.com/add2cal/add-to-calendar-button
@@ -350,7 +350,7 @@ if(typeof window !== "undefined"){ for(var k in tzlib_tmp_scope) window[k] = tzl
350
350
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
351
351
  *
352
352
  */
353
- const atcbVersion = '2.13.10';
353
+ const atcbVersion = '2.14.0';
354
354
  const atcbCssTemplate = {};
355
355
  const atcbIsBrowser = () => {
356
356
  if (typeof window === 'undefined') {
@@ -608,7 +608,6 @@ const atcbIcon = {
608
608
  async function atcb_decorate_data(data) {
609
609
  data = atcb_decorate_data_boolean(data);
610
610
  data = atcb_decorate_data_defaults(data);
611
- data = atcb_decorate_data_recurrence(data);
612
611
  data = atcb_decorate_data_options(data);
613
612
  data = atcb_decorate_data_style(data);
614
613
  data.sizes = atcb_decorate_sizes(data.size);
@@ -661,17 +660,10 @@ function atcb_decorate_data_defaults(data) {
661
660
  }
662
661
  return data;
663
662
  }
664
- function atcb_decorate_data_recurrence(data) {
665
- if (data.recurrence && data.recurrence !== '') {
666
- data = atcb_decorate_data_rrule(data);
667
- data = atcb_decorate_data_recurring_events(data);
668
- }
669
- return data;
670
- }
671
663
  function atcb_decorate_data_rrule(data) {
672
664
  data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
673
665
  if (/^RRULE:/i.test(data.recurrence)) {
674
- data.recurrence_simplyfied = false;
666
+ data.recurrence_simplified = false;
675
667
  const rruleParts = atcb_parseRRule(data.recurrence, false);
676
668
  data.recurrence_until = rruleParts.UNTIL;
677
669
  data.recurrence_count = rruleParts.COUNT;
@@ -681,7 +673,7 @@ function atcb_decorate_data_rrule(data) {
681
673
  data.recurrence_interval = rruleParts.INTERVAL;
682
674
  data.recurrence_frequency = rruleParts.FREQ;
683
675
  } else {
684
- data.recurrence_simplyfied = true;
676
+ data.recurrence_simplified = true;
685
677
  if (!data.recurrence_interval || data.recurrence_interval === '') {
686
678
  data.recurrence_interval = 1;
687
679
  }
@@ -713,11 +705,11 @@ function atcb_decorate_data_rrule(data) {
713
705
  return data;
714
706
  }
715
707
  function atcb_decorate_data_recurring_events(data) {
716
- const startDate = data.dates?.[0].startDate || data.startDate;
717
- const startTime = data.dates?.[0].startTime || data.startTime;
718
- const endDate = data.dates?.[0].endDate || data.endDate || startDate;
719
- const endTime = data.dates?.[0].endTime || data.endTime || '';
720
- const tzid = data.dates?.[0].timeZone || data.timeZone || 'UTC';
708
+ const startDate = data.dates[0].startDate;
709
+ const startTime = data.dates[0].startTime;
710
+ const endDate = data.dates[0].endDate || startDate;
711
+ const endTime = data.dates[0].endTime || '';
712
+ const tzid = data.dates[0].timeZone || 'UTC';
721
713
  const diff =
722
714
  (function () {
723
715
  if (endTime && endTime !== '' && startTime && startTime !== '') {
@@ -966,6 +958,12 @@ function atcb_decorate_data_dates(data) {
966
958
  if (!data.dates || !Array.isArray(data.dates)) {
967
959
  data.dates = [{ name: data.name }];
968
960
  }
961
+ if (data.recurrence && data.recurrence !== '') {
962
+ data = atcb_decorate_data_rrule(data);
963
+ data = atcb_move_root_values_into_dates(data, 0);
964
+ data = atcb_dates_cleanup(data, 0);
965
+ data = atcb_decorate_data_recurring_events(data);
966
+ }
969
967
  if (data.recurrence && data.recurrence !== '') {
970
968
  data.dates[0].recurrence = data.recurrence;
971
969
  }
@@ -1276,8 +1274,8 @@ async function atcb_validate(data) {
1276
1274
  await atcb_validate_options(data, msgPrefix);
1277
1275
  await atcb_validate_date_blocks(data, msgPrefix);
1278
1276
  await atcb_validate_rrule(data, msgPrefix);
1279
- if (data.recurrence_simplyfied) {
1280
- await atcb_validate_rrule_simplyfied(data, msgPrefix);
1277
+ if (data.recurrence_simplified) {
1278
+ await atcb_validate_rrule_simplified(data, msgPrefix);
1281
1279
  }
1282
1280
  return true;
1283
1281
  } catch (e) {
@@ -1481,7 +1479,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
1481
1479
  }
1482
1480
  return true;
1483
1481
  }
1484
- async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
1482
+ async function atcb_validate_rrule_simplified(data, msgPrefix) {
1485
1483
  if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
1486
1484
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1487
1485
  }
@@ -5180,7 +5178,7 @@ function atcb_translate(identifier, language) {
5180
5178
 
5181
5179
  let atcbInitialGlobalInit = false;
5182
5180
  let atcbBtnCount = 0;
5183
- const lightModeMutationObserver = [];
5181
+ const lightModeMutationObserver = new Map();
5184
5182
  const template = `<div class="atcb-initialized atcb-hidden"></div>`;
5185
5183
  if (atcbIsBrowser()) {
5186
5184
  class AddToCalendarButton extends HTMLElement {
@@ -5872,15 +5870,20 @@ function atcb_set_global_event_listener(host, data) {
5872
5870
  return;
5873
5871
  }
5874
5872
  if (data.lightMode == 'bodyScheme') {
5875
- lightModeMutationObserver[data.identifier] = new MutationObserver(function (mutationsList) {
5873
+ const existingObserver = lightModeMutationObserver.get(data.identifier);
5874
+ if (existingObserver) {
5875
+ existingObserver.disconnect();
5876
+ }
5877
+ const observer = new MutationObserver(function (mutationsList) {
5876
5878
  mutationsList.forEach((mutation) => {
5877
5879
  if (mutation.attributeName === 'class') {
5878
5880
  atcb_set_light_mode(host, data);
5879
5881
  }
5880
5882
  });
5881
5883
  });
5882
- lightModeMutationObserver[data.identifier].observe(document.documentElement, { attributes: true });
5883
- lightModeMutationObserver[data.identifier].observe(document.body, { attributes: true });
5884
+ observer.observe(document.documentElement, { attributes: true });
5885
+ observer.observe(document.body, { attributes: true });
5886
+ lightModeMutationObserver.set(data.identifier, observer);
5884
5887
  }
5885
5888
  if (!atcbInitialGlobalInit) {
5886
5889
  document.addEventListener('keyup', atcb_global_listener_keyup);
@@ -5974,8 +5977,10 @@ function atcb_global_listener_resize() {
5974
5977
  }
5975
5978
  }
5976
5979
  function atcb_unset_global_event_listener(identifier) {
5977
- if (typeof lightModeMutationObserver[`${identifier}`] !== 'undefined') {
5978
- lightModeMutationObserver[`${identifier}`].disconnect();
5980
+ const observer = lightModeMutationObserver.get(identifier);
5981
+ if (observer) {
5982
+ observer.disconnect();
5983
+ lightModeMutationObserver.delete(identifier);
5979
5984
  }
5980
5985
  }
5981
5986
 
@@ -342,7 +342,7 @@ if(typeof window !== "undefined"){ for(var k in tzlib_tmp_scope) window[k] = tzl
342
342
  * Add to Calendar Button
343
343
  * ++++++++++++++++++++++
344
344
  *
345
- * Version: 2.13.10
345
+ * Version: 2.14.0
346
346
  * Creator: Jens Kuerschner (https://jekuer.com)
347
347
  * Publisher: Calendarverse GmbH (https://add-to-calendar-pro.com)
348
348
  * Project: https://github.com/add2cal/add-to-calendar-button
@@ -350,7 +350,7 @@ if(typeof window !== "undefined"){ for(var k in tzlib_tmp_scope) window[k] = tzl
350
350
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
351
351
  *
352
352
  */
353
- const atcbVersion = '2.13.10';
353
+ const atcbVersion = '2.14.0';
354
354
  const atcbCssTemplate = {
355
355
  if (typeof window === 'undefined') {
356
356
  return false;
@@ -607,7 +607,6 @@ const atcbIcon = {
607
607
  async function atcb_decorate_data(data) {
608
608
  data = atcb_decorate_data_boolean(data);
609
609
  data = atcb_decorate_data_defaults(data);
610
- data = atcb_decorate_data_recurrence(data);
611
610
  data = atcb_decorate_data_options(data);
612
611
  data = atcb_decorate_data_style(data);
613
612
  data.sizes = atcb_decorate_sizes(data.size);
@@ -660,17 +659,10 @@ function atcb_decorate_data_defaults(data) {
660
659
  }
661
660
  return data;
662
661
  }
663
- function atcb_decorate_data_recurrence(data) {
664
- if (data.recurrence && data.recurrence !== '') {
665
- data = atcb_decorate_data_rrule(data);
666
- data = atcb_decorate_data_recurring_events(data);
667
- }
668
- return data;
669
- }
670
662
  function atcb_decorate_data_rrule(data) {
671
663
  data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
672
664
  if (/^RRULE:/i.test(data.recurrence)) {
673
- data.recurrence_simplyfied = false;
665
+ data.recurrence_simplified = false;
674
666
  const rruleParts = atcb_parseRRule(data.recurrence, false);
675
667
  data.recurrence_until = rruleParts.UNTIL;
676
668
  data.recurrence_count = rruleParts.COUNT;
@@ -680,7 +672,7 @@ function atcb_decorate_data_rrule(data) {
680
672
  data.recurrence_interval = rruleParts.INTERVAL;
681
673
  data.recurrence_frequency = rruleParts.FREQ;
682
674
  } else {
683
- data.recurrence_simplyfied = true;
675
+ data.recurrence_simplified = true;
684
676
  if (!data.recurrence_interval || data.recurrence_interval === '') {
685
677
  data.recurrence_interval = 1;
686
678
  }
@@ -712,11 +704,11 @@ function atcb_decorate_data_rrule(data) {
712
704
  return data;
713
705
  }
714
706
  function atcb_decorate_data_recurring_events(data) {
715
- const startDate = data.dates?.[0].startDate || data.startDate;
716
- const startTime = data.dates?.[0].startTime || data.startTime;
717
- const endDate = data.dates?.[0].endDate || data.endDate || startDate;
718
- const endTime = data.dates?.[0].endTime || data.endTime || '';
719
- const tzid = data.dates?.[0].timeZone || data.timeZone || 'UTC';
707
+ const startDate = data.dates[0].startDate;
708
+ const startTime = data.dates[0].startTime;
709
+ const endDate = data.dates[0].endDate || startDate;
710
+ const endTime = data.dates[0].endTime || '';
711
+ const tzid = data.dates[0].timeZone || 'UTC';
720
712
  const diff =
721
713
  (function () {
722
714
  if (endTime && endTime !== '' && startTime && startTime !== '') {
@@ -965,6 +957,12 @@ function atcb_decorate_data_dates(data) {
965
957
  if (!data.dates || !Array.isArray(data.dates)) {
966
958
  data.dates = [{ name: data.name }];
967
959
  }
960
+ if (data.recurrence && data.recurrence !== '') {
961
+ data = atcb_decorate_data_rrule(data);
962
+ data = atcb_move_root_values_into_dates(data, 0);
963
+ data = atcb_dates_cleanup(data, 0);
964
+ data = atcb_decorate_data_recurring_events(data);
965
+ }
968
966
  if (data.recurrence && data.recurrence !== '') {
969
967
  data.dates[0].recurrence = data.recurrence;
970
968
  }
@@ -1275,8 +1273,8 @@ async function atcb_validate(data) {
1275
1273
  await atcb_validate_options(data, msgPrefix);
1276
1274
  await atcb_validate_date_blocks(data, msgPrefix);
1277
1275
  await atcb_validate_rrule(data, msgPrefix);
1278
- if (data.recurrence_simplyfied) {
1279
- await atcb_validate_rrule_simplyfied(data, msgPrefix);
1276
+ if (data.recurrence_simplified) {
1277
+ await atcb_validate_rrule_simplified(data, msgPrefix);
1280
1278
  }
1281
1279
  return true;
1282
1280
  } catch (e) {
@@ -1480,7 +1478,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
1480
1478
  }
1481
1479
  return true;
1482
1480
  }
1483
- async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
1481
+ async function atcb_validate_rrule_simplified(data, msgPrefix) {
1484
1482
  if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
1485
1483
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1486
1484
  }
@@ -5179,7 +5177,7 @@ function atcb_translate(identifier, language) {
5179
5177
 
5180
5178
  let atcbInitialGlobalInit = false;
5181
5179
  let atcbBtnCount = 0;
5182
- const lightModeMutationObserver = [];
5180
+ const lightModeMutationObserver = new Map();
5183
5181
  const template = `<div class="atcb-initialized atcb-hidden"></div>`;
5184
5182
  if (atcbIsBrowser()) {
5185
5183
  class AddToCalendarButton extends HTMLElement {
@@ -5871,15 +5869,20 @@ function atcb_set_global_event_listener(host, data) {
5871
5869
  return;
5872
5870
  }
5873
5871
  if (data.lightMode == 'bodyScheme') {
5874
- lightModeMutationObserver[data.identifier] = new MutationObserver(function (mutationsList) {
5872
+ const existingObserver = lightModeMutationObserver.get(data.identifier);
5873
+ if (existingObserver) {
5874
+ existingObserver.disconnect();
5875
+ }
5876
+ const observer = new MutationObserver(function (mutationsList) {
5875
5877
  mutationsList.forEach((mutation) => {
5876
5878
  if (mutation.attributeName === 'class') {
5877
5879
  atcb_set_light_mode(host, data);
5878
5880
  }
5879
5881
  });
5880
5882
  });
5881
- lightModeMutationObserver[data.identifier].observe(document.documentElement, { attributes: true });
5882
- lightModeMutationObserver[data.identifier].observe(document.body, { attributes: true });
5883
+ observer.observe(document.documentElement, { attributes: true });
5884
+ observer.observe(document.body, { attributes: true });
5885
+ lightModeMutationObserver.set(data.identifier, observer);
5883
5886
  }
5884
5887
  if (!atcbInitialGlobalInit) {
5885
5888
  document.addEventListener('keyup', atcb_global_listener_keyup);
@@ -5973,8 +5976,10 @@ function atcb_global_listener_resize() {
5973
5976
  }
5974
5977
  }
5975
5978
  function atcb_unset_global_event_listener(identifier) {
5976
- if (typeof lightModeMutationObserver[`${identifier}`] !== 'undefined') {
5977
- lightModeMutationObserver[`${identifier}`].disconnect();
5979
+ const observer = lightModeMutationObserver.get(identifier);
5980
+ if (observer) {
5981
+ observer.disconnect();
5982
+ lightModeMutationObserver.delete(identifier);
5978
5983
  }
5979
5984
  }
5980
5985
 
@@ -342,7 +342,7 @@ if(typeof window !== "undefined"){ for(var k in tzlib_tmp_scope) window[k] = tzl
342
342
  * Add to Calendar Button
343
343
  * ++++++++++++++++++++++
344
344
  *
345
- * Version: 2.13.10
345
+ * Version: 2.14.0
346
346
  * Creator: Jens Kuerschner (https://jekuer.com)
347
347
  * Publisher: Calendarverse GmbH (https://add-to-calendar-pro.com)
348
348
  * Project: https://github.com/add2cal/add-to-calendar-button
@@ -350,7 +350,7 @@ if(typeof window !== "undefined"){ for(var k in tzlib_tmp_scope) window[k] = tzl
350
350
  * Note: DO NOT REMOVE THE COPYRIGHT NOTICE ABOVE!
351
351
  *
352
352
  */
353
- const atcbVersion = '2.13.10';
353
+ const atcbVersion = '2.14.0';
354
354
  const atcbCssTemplate = {};
355
355
  const atcbIsBrowser = () => {
356
356
  if (typeof window === 'undefined') {
@@ -608,7 +608,6 @@ const atcbIcon = {
608
608
  async function atcb_decorate_data(data) {
609
609
  data = atcb_decorate_data_boolean(data);
610
610
  data = atcb_decorate_data_defaults(data);
611
- data = atcb_decorate_data_recurrence(data);
612
611
  data = atcb_decorate_data_options(data);
613
612
  data = atcb_decorate_data_style(data);
614
613
  data.sizes = atcb_decorate_sizes(data.size);
@@ -661,17 +660,10 @@ function atcb_decorate_data_defaults(data) {
661
660
  }
662
661
  return data;
663
662
  }
664
- function atcb_decorate_data_recurrence(data) {
665
- if (data.recurrence && data.recurrence !== '') {
666
- data = atcb_decorate_data_rrule(data);
667
- data = atcb_decorate_data_recurring_events(data);
668
- }
669
- return data;
670
- }
671
663
  function atcb_decorate_data_rrule(data) {
672
664
  data.recurrence = data.recurrence.replace(/\s+/g, '').toUpperCase();
673
665
  if (/^RRULE:/i.test(data.recurrence)) {
674
- data.recurrence_simplyfied = false;
666
+ data.recurrence_simplified = false;
675
667
  const rruleParts = atcb_parseRRule(data.recurrence, false);
676
668
  data.recurrence_until = rruleParts.UNTIL;
677
669
  data.recurrence_count = rruleParts.COUNT;
@@ -681,7 +673,7 @@ function atcb_decorate_data_rrule(data) {
681
673
  data.recurrence_interval = rruleParts.INTERVAL;
682
674
  data.recurrence_frequency = rruleParts.FREQ;
683
675
  } else {
684
- data.recurrence_simplyfied = true;
676
+ data.recurrence_simplified = true;
685
677
  if (!data.recurrence_interval || data.recurrence_interval === '') {
686
678
  data.recurrence_interval = 1;
687
679
  }
@@ -713,11 +705,11 @@ function atcb_decorate_data_rrule(data) {
713
705
  return data;
714
706
  }
715
707
  function atcb_decorate_data_recurring_events(data) {
716
- const startDate = data.dates?.[0].startDate || data.startDate;
717
- const startTime = data.dates?.[0].startTime || data.startTime;
718
- const endDate = data.dates?.[0].endDate || data.endDate || startDate;
719
- const endTime = data.dates?.[0].endTime || data.endTime || '';
720
- const tzid = data.dates?.[0].timeZone || data.timeZone || 'UTC';
708
+ const startDate = data.dates[0].startDate;
709
+ const startTime = data.dates[0].startTime;
710
+ const endDate = data.dates[0].endDate || startDate;
711
+ const endTime = data.dates[0].endTime || '';
712
+ const tzid = data.dates[0].timeZone || 'UTC';
721
713
  const diff =
722
714
  (function () {
723
715
  if (endTime && endTime !== '' && startTime && startTime !== '') {
@@ -966,6 +958,12 @@ function atcb_decorate_data_dates(data) {
966
958
  if (!data.dates || !Array.isArray(data.dates)) {
967
959
  data.dates = [{ name: data.name }];
968
960
  }
961
+ if (data.recurrence && data.recurrence !== '') {
962
+ data = atcb_decorate_data_rrule(data);
963
+ data = atcb_move_root_values_into_dates(data, 0);
964
+ data = atcb_dates_cleanup(data, 0);
965
+ data = atcb_decorate_data_recurring_events(data);
966
+ }
969
967
  if (data.recurrence && data.recurrence !== '') {
970
968
  data.dates[0].recurrence = data.recurrence;
971
969
  }
@@ -1276,8 +1274,8 @@ async function atcb_validate(data) {
1276
1274
  await atcb_validate_options(data, msgPrefix);
1277
1275
  await atcb_validate_date_blocks(data, msgPrefix);
1278
1276
  await atcb_validate_rrule(data, msgPrefix);
1279
- if (data.recurrence_simplyfied) {
1280
- await atcb_validate_rrule_simplyfied(data, msgPrefix);
1277
+ if (data.recurrence_simplified) {
1278
+ await atcb_validate_rrule_simplified(data, msgPrefix);
1281
1279
  }
1282
1280
  return true;
1283
1281
  } catch (e) {
@@ -1481,7 +1479,7 @@ async function atcb_validate_rrule(data, msgPrefix) {
1481
1479
  }
1482
1480
  return true;
1483
1481
  }
1484
- async function atcb_validate_rrule_simplyfied(data, msgPrefix) {
1482
+ async function atcb_validate_rrule_simplified(data, msgPrefix) {
1485
1483
  if (data.recurrence_interval && (data.recurrence_interval < 1 || data.recurrence_interval % 1 !== 0)) {
1486
1484
  throw new Error(msgPrefix + ' failed: recurrence data (interval) misspelled');
1487
1485
  }
@@ -5905,7 +5903,7 @@ function atcb_translate(identifier, language) {
5905
5903
 
5906
5904
  let atcbInitialGlobalInit = false;
5907
5905
  let atcbBtnCount = 0;
5908
- const lightModeMutationObserver = [];
5906
+ const lightModeMutationObserver = new Map();
5909
5907
  const template = `<div class="atcb-initialized atcb-hidden"></div>`;
5910
5908
  if (atcbIsBrowser()) {
5911
5909
  class AddToCalendarButton extends HTMLElement {
@@ -6597,15 +6595,20 @@ function atcb_set_global_event_listener(host, data) {
6597
6595
  return;
6598
6596
  }
6599
6597
  if (data.lightMode == 'bodyScheme') {
6600
- lightModeMutationObserver[data.identifier] = new MutationObserver(function (mutationsList) {
6598
+ const existingObserver = lightModeMutationObserver.get(data.identifier);
6599
+ if (existingObserver) {
6600
+ existingObserver.disconnect();
6601
+ }
6602
+ const observer = new MutationObserver(function (mutationsList) {
6601
6603
  mutationsList.forEach((mutation) => {
6602
6604
  if (mutation.attributeName === 'class') {
6603
6605
  atcb_set_light_mode(host, data);
6604
6606
  }
6605
6607
  });
6606
6608
  });
6607
- lightModeMutationObserver[data.identifier].observe(document.documentElement, { attributes: true });
6608
- lightModeMutationObserver[data.identifier].observe(document.body, { attributes: true });
6609
+ observer.observe(document.documentElement, { attributes: true });
6610
+ observer.observe(document.body, { attributes: true });
6611
+ lightModeMutationObserver.set(data.identifier, observer);
6609
6612
  }
6610
6613
  if (!atcbInitialGlobalInit) {
6611
6614
  document.addEventListener('keyup', atcb_global_listener_keyup);
@@ -6699,8 +6702,10 @@ function atcb_global_listener_resize() {
6699
6702
  }
6700
6703
  }
6701
6704
  function atcb_unset_global_event_listener(identifier) {
6702
- if (typeof lightModeMutationObserver[`${identifier}`] !== 'undefined') {
6703
- lightModeMutationObserver[`${identifier}`].disconnect();
6705
+ const observer = lightModeMutationObserver.get(identifier);
6706
+ if (observer) {
6707
+ observer.disconnect();
6708
+ lightModeMutationObserver.delete(identifier);
6704
6709
  }
6705
6710
  }
6706
6711