@nylas/web-elements 2.2.0 → 2.2.2

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.
Files changed (202) hide show
  1. package/dist/nylas-web-elements/{abstract-provider-D75Ucvku.js → abstract-provider-9AZudYSI.js} +2 -2
  2. package/dist/nylas-web-elements/{abstract-provider-D75Ucvku.js.map → abstract-provider-9AZudYSI.js.map} +1 -1
  3. package/dist/nylas-web-elements/add-circle-icon.entry.js +1 -1
  4. package/dist/nylas-web-elements/archive-icon.entry.js +1 -1
  5. package/dist/nylas-web-elements/arrow-icon.entry.js +1 -1
  6. package/dist/nylas-web-elements/bold-icon.entry.js +1 -1
  7. package/dist/nylas-web-elements/button-component.entry.js +1 -1
  8. package/dist/nylas-web-elements/calendar-agenda-fill-icon.entry.js +1 -1
  9. package/dist/nylas-web-elements/calendar-agenda-icon.entry.js +1 -1
  10. package/dist/nylas-web-elements/calendar-cancel-icon.entry.js +1 -1
  11. package/dist/nylas-web-elements/calendar-check-icon.entry.js +1 -1
  12. package/dist/nylas-web-elements/calendar-icon.entry.js +1 -1
  13. package/dist/nylas-web-elements/calendar-info-icon.entry.js +1 -1
  14. package/dist/nylas-web-elements/calendar-patterns-icon.entry.js +1 -1
  15. package/dist/nylas-web-elements/checkbox-component.entry.esm.js.map +1 -1
  16. package/dist/nylas-web-elements/checkbox-component.entry.js +1 -1
  17. package/dist/nylas-web-elements/checkbox-component.entry.js.map +1 -1
  18. package/dist/nylas-web-elements/checkbox-group.entry.js +1 -1
  19. package/dist/nylas-web-elements/checkmark-circle-icon.entry.js +1 -1
  20. package/dist/nylas-web-elements/checkmark-icon.entry.js +1 -1
  21. package/dist/nylas-web-elements/chevron-icon.entry.js +1 -1
  22. package/dist/nylas-web-elements/clock-icon.entry.js +1 -1
  23. package/dist/nylas-web-elements/close-icon.entry.js +1 -1
  24. package/dist/nylas-web-elements/copy-icon.entry.js +1 -1
  25. package/dist/nylas-web-elements/{customParseFormat-Bk5PI6Cs.js → customParseFormat-BJNMxHY2.js} +2 -2
  26. package/dist/nylas-web-elements/{customParseFormat-Bk5PI6Cs.js.map → customParseFormat-BJNMxHY2.js.map} +1 -1
  27. package/dist/nylas-web-elements/delete-icon.entry.js +1 -1
  28. package/dist/nylas-web-elements/document-refresh-icon.entry.js +1 -1
  29. package/dist/nylas-web-elements/dragable-icon.entry.js +1 -1
  30. package/dist/nylas-web-elements/edit-icon.entry.js +1 -1
  31. package/dist/nylas-web-elements/envelope-fill-icon.entry.js +1 -1
  32. package/dist/nylas-web-elements/envelope-icon.entry.js +1 -1
  33. package/dist/nylas-web-elements/eye-icon.entry.js +1 -1
  34. package/dist/nylas-web-elements/feedback-icon.entry.js +1 -1
  35. package/dist/nylas-web-elements/flow-icon.entry.js +1 -1
  36. package/dist/nylas-web-elements/folder-icon.entry.js +1 -1
  37. package/dist/nylas-web-elements/forward-icon.entry.js +1 -1
  38. package/dist/nylas-web-elements/globe-icon.entry.js +1 -1
  39. package/dist/nylas-web-elements/google-logo-icon.entry.js +1 -1
  40. package/dist/nylas-web-elements/google-meet-icon.entry.js +1 -1
  41. package/dist/nylas-web-elements/inbox-icon.entry.js +1 -1
  42. package/dist/nylas-web-elements/{index-BVtainOy.js → index-BPPwIJj2.js} +2 -2
  43. package/dist/nylas-web-elements/{index-BVtainOy.js.map → index-BPPwIJj2.js.map} +1 -1
  44. package/dist/nylas-web-elements/{index-B-KMpdMZ.js → index-Cbn5rIwb.js} +2 -2
  45. package/dist/nylas-web-elements/index-Cbn5rIwb.js.map +1 -0
  46. package/dist/nylas-web-elements/index.esm.js +1 -1
  47. package/dist/nylas-web-elements/info-icon.entry.js +1 -1
  48. package/dist/nylas-web-elements/input-color-picker.entry.js +1 -1
  49. package/dist/nylas-web-elements/input-component.entry.esm.js.map +1 -1
  50. package/dist/nylas-web-elements/input-component.entry.js +1 -1
  51. package/dist/nylas-web-elements/input-component.entry.js.map +1 -1
  52. package/dist/nylas-web-elements/input-dropdown.entry.esm.js.map +1 -1
  53. package/dist/nylas-web-elements/input-dropdown.entry.js +1 -1
  54. package/dist/nylas-web-elements/input-dropdown.entry.js.map +1 -1
  55. package/dist/nylas-web-elements/input-image-url.entry.js +1 -1
  56. package/dist/nylas-web-elements/italic-icon.entry.js +1 -1
  57. package/dist/nylas-web-elements/loading-icon.entry.js +1 -1
  58. package/dist/nylas-web-elements/location-icon.entry.js +1 -1
  59. package/dist/nylas-web-elements/location-off-icon.entry.js +1 -1
  60. package/dist/nylas-web-elements/microsoft-logo-icon.entry.js +1 -1
  61. package/dist/nylas-web-elements/microsoft-teams-icon.entry.js +1 -1
  62. package/dist/nylas-web-elements/multi-select-dropdown.entry.esm.js.map +1 -1
  63. package/dist/nylas-web-elements/multi-select-dropdown.entry.js +1 -1
  64. package/dist/nylas-web-elements/multi-select-dropdown.entry.js.map +1 -1
  65. package/dist/nylas-web-elements/nylas-additional-participants.entry.js +1 -1
  66. package/dist/nylas-web-elements/{nylas-api-request-B1V2koVc.js → nylas-api-request-rYAjhY1J.js} +2 -2
  67. package/dist/nylas-web-elements/{nylas-api-request-B1V2koVc.js.map → nylas-api-request-rYAjhY1J.js.map} +1 -1
  68. package/dist/nylas-web-elements/nylas-availability-picker.entry.js +1 -1
  69. package/dist/nylas-web-elements/nylas-booked-event-card.entry.js +1 -1
  70. package/dist/nylas-web-elements/nylas-booking-calendar-picker.entry.js +1 -1
  71. package/dist/nylas-web-elements/nylas-booking-confirmation-redirect.entry.js +1 -1
  72. package/dist/nylas-web-elements/nylas-booking-confirmation-type.entry.js +1 -1
  73. package/dist/nylas-web-elements/nylas-booking-form-config.entry.js +2 -2
  74. package/dist/nylas-web-elements/nylas-booking-form.entry.js +1 -1
  75. package/dist/nylas-web-elements/nylas-buffer-time.entry.js +1 -1
  76. package/dist/nylas-web-elements/nylas-calendar-picker.entry.js +1 -1
  77. package/dist/nylas-web-elements/nylas-cancel-booking-form.entry.js +1 -1
  78. package/dist/nylas-web-elements/nylas-cancellation-policy.entry.esm.js.map +1 -1
  79. package/dist/nylas-web-elements/nylas-cancellation-policy.entry.js +1 -1
  80. package/dist/nylas-web-elements/nylas-cancellation-policy.entry.js.map +1 -1
  81. package/dist/nylas-web-elements/nylas-cancelled-event-card.entry.js +1 -1
  82. package/dist/nylas-web-elements/nylas-confirmation-email.entry.js +1 -1
  83. package/dist/nylas-web-elements/nylas-confirmed-event-card.entry.js +1 -1
  84. package/dist/nylas-web-elements/nylas-connected-calendars.entry.js +1 -1
  85. package/dist/nylas-web-elements/nylas-custom-booking-flow.entry.js +1 -1
  86. package/dist/nylas-web-elements/nylas-custom-event-slug.entry.js +1 -1
  87. package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.esm.js.map +1 -1
  88. package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.js +1 -1
  89. package/dist/nylas-web-elements/nylas-customize-booking-settings.entry.js.map +1 -1
  90. package/dist/nylas-web-elements/nylas-date-component.entry.js +1 -1
  91. package/dist/nylas-web-elements/nylas-date-picker.entry.js +1 -1
  92. package/dist/nylas-web-elements/nylas-date-picker.entry.js.map +1 -1
  93. package/dist/nylas-web-elements/nylas-disable-emails.entry.js +1 -1
  94. package/dist/nylas-web-elements/nylas-editor-tabs-group.entry.esm.js.map +1 -1
  95. package/dist/nylas-web-elements/nylas-editor-tabs-group.entry.js +1 -1
  96. package/dist/nylas-web-elements/nylas-editor-tabs-group.entry.js.map +1 -1
  97. package/dist/nylas-web-elements/nylas-editor-tabs.entry.esm.js.map +1 -1
  98. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js +1 -1
  99. package/dist/nylas-web-elements/nylas-editor-tabs.entry.js.map +1 -1
  100. package/dist/nylas-web-elements/nylas-event-calendar.entry.js +1 -1
  101. package/dist/nylas-web-elements/nylas-event-capacity.entry.js +1 -1
  102. package/dist/nylas-web-elements/nylas-event-description.entry.esm.js.map +1 -1
  103. package/dist/nylas-web-elements/nylas-event-description.entry.js +1 -1
  104. package/dist/nylas-web-elements/nylas-event-description.entry.js.map +1 -1
  105. package/dist/nylas-web-elements/nylas-event-duration.entry.esm.js.map +1 -1
  106. package/dist/nylas-web-elements/nylas-event-duration.entry.js +1 -1
  107. package/dist/nylas-web-elements/nylas-event-duration.entry.js.map +1 -1
  108. package/dist/nylas-web-elements/nylas-event-info.entry.js +1 -1
  109. package/dist/nylas-web-elements/nylas-event-limits.entry.esm.js.map +1 -1
  110. package/dist/nylas-web-elements/nylas-event-limits.entry.js +1 -1
  111. package/dist/nylas-web-elements/nylas-event-limits.entry.js.map +1 -1
  112. package/dist/nylas-web-elements/nylas-event-location.entry.esm.js.map +1 -1
  113. package/dist/nylas-web-elements/nylas-event-location.entry.js +1 -1
  114. package/dist/nylas-web-elements/nylas-event-location.entry.js.map +1 -1
  115. package/dist/nylas-web-elements/nylas-event-timeslot.entry.js +1 -1
  116. package/dist/nylas-web-elements/nylas-event-title.entry.esm.js.map +1 -1
  117. package/dist/nylas-web-elements/nylas-event-title.entry.js +1 -1
  118. package/dist/nylas-web-elements/nylas-event-title.entry.js.map +1 -1
  119. package/dist/nylas-web-elements/nylas-feedback-form.entry.js +1 -1
  120. package/dist/nylas-web-elements/nylas-form-card.entry.esm.js.map +1 -1
  121. package/dist/nylas-web-elements/nylas-form-card.entry.js +1 -1
  122. package/dist/nylas-web-elements/nylas-form-card.entry.js.map +1 -1
  123. package/dist/nylas-web-elements/nylas-limit-future-bookings.entry.js +1 -1
  124. package/dist/nylas-web-elements/nylas-list-configurations.entry.js +1 -1
  125. package/dist/nylas-web-elements/nylas-locale-switch.entry.js +1 -1
  126. package/dist/nylas-web-elements/nylas-logo.entry.js +1 -1
  127. package/dist/nylas-web-elements/nylas-min-booking-notice.entry.js +1 -1
  128. package/dist/nylas-web-elements/nylas-min-cancellation-notice.entry.js +1 -1
  129. package/dist/nylas-web-elements/nylas-notification.entry.js +1 -1
  130. package/dist/nylas-web-elements/nylas-notification.entry.js.map +1 -1
  131. package/dist/nylas-web-elements/nylas-organizer-confirmation-card.entry.js +1 -1
  132. package/dist/nylas-web-elements/nylas-page-name.entry.esm.js.map +1 -1
  133. package/dist/nylas-web-elements/nylas-page-name.entry.js +1 -1
  134. package/dist/nylas-web-elements/nylas-page-name.entry.js.map +1 -1
  135. package/dist/nylas-web-elements/nylas-page-styling.entry.js +1 -1
  136. package/dist/nylas-web-elements/nylas-participant-booking-calendars.entry.js +1 -1
  137. package/dist/nylas-web-elements/nylas-participants-custom-availability.entry.js +1 -1
  138. package/dist/nylas-web-elements/nylas-reminder-emails.entry.js +1 -1
  139. package/dist/nylas-web-elements/nylas-reminder-time.entry.js +1 -1
  140. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.esm.js.map +1 -1
  141. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js +3 -3
  142. package/dist/nylas-web-elements/nylas-scheduler-editor.entry.js.map +1 -1
  143. package/dist/nylas-web-elements/nylas-scheduling-method.entry.js +1 -1
  144. package/dist/nylas-web-elements/nylas-scheduling.entry.js +1 -1
  145. package/dist/nylas-web-elements/nylas-select-event-type.entry.js +1 -1
  146. package/dist/nylas-web-elements/nylas-selected-event-card.entry.js +1 -1
  147. package/dist/nylas-web-elements/nylas-specific-time-availability-picker.entry.js +1 -1
  148. package/dist/nylas-web-elements/nylas-time-window-picker.entry.esm.js.map +1 -1
  149. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js +1 -1
  150. package/dist/nylas-web-elements/nylas-time-window-picker.entry.js.map +1 -1
  151. package/dist/nylas-web-elements/nylas-timeslot-interval.entry.esm.js.map +1 -1
  152. package/dist/nylas-web-elements/nylas-timeslot-interval.entry.js +1 -1
  153. package/dist/nylas-web-elements/nylas-timeslot-interval.entry.js.map +1 -1
  154. package/dist/nylas-web-elements/nylas-timeslot-picker.entry.js +1 -1
  155. package/dist/nylas-web-elements/nylas-web-elements.esm.js +1 -1
  156. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -1
  157. package/dist/nylas-web-elements/paintbrush-fill-icon.entry.js +1 -1
  158. package/dist/nylas-web-elements/paintbrush-icon.entry.js +1 -1
  159. package/dist/nylas-web-elements/people-icon.entry.js +1 -1
  160. package/dist/nylas-web-elements/person-clipboard-icon.entry.js +1 -1
  161. package/dist/nylas-web-elements/person-icon.entry.js +1 -1
  162. package/dist/nylas-web-elements/play-icon.entry.js +1 -1
  163. package/dist/nylas-web-elements/plus-icon.entry.js +1 -1
  164. package/dist/nylas-web-elements/radio-button-group.entry.esm.js.map +1 -1
  165. package/dist/nylas-web-elements/radio-button-group.entry.js +1 -1
  166. package/dist/nylas-web-elements/radio-button-group.entry.js.map +1 -1
  167. package/dist/nylas-web-elements/refresh-icon.entry.js +1 -1
  168. package/dist/nylas-web-elements/{register-component-BHk70oxk.js → register-component-Blj8K64f.js} +2 -2
  169. package/dist/nylas-web-elements/{register-component-BHk70oxk.js.map → register-component-Blj8K64f.js.map} +1 -1
  170. package/dist/nylas-web-elements/reply-all-icon.entry.js +1 -1
  171. package/dist/nylas-web-elements/reply-icon.entry.js +1 -1
  172. package/dist/nylas-web-elements/search-icon.entry.js +1 -1
  173. package/dist/nylas-web-elements/select-dropdown.entry.esm.js.map +1 -1
  174. package/dist/nylas-web-elements/select-dropdown.entry.js +1 -1
  175. package/dist/nylas-web-elements/select-dropdown.entry.js.map +1 -1
  176. package/dist/nylas-web-elements/sent-icon.entry.js +1 -1
  177. package/dist/nylas-web-elements/spam-icon.entry.js +1 -1
  178. package/dist/nylas-web-elements/star-icon.entry.js +1 -1
  179. package/dist/nylas-web-elements/stop-icon.entry.js +1 -1
  180. package/dist/nylas-web-elements/textarea-component.entry.esm.js.map +1 -1
  181. package/dist/nylas-web-elements/textarea-component.entry.js +1 -1
  182. package/dist/nylas-web-elements/textarea-component.entry.js.map +1 -1
  183. package/dist/nylas-web-elements/time-period-selector.entry.js +1 -1
  184. package/dist/nylas-web-elements/toggle-switch.entry.js +1 -1
  185. package/dist/nylas-web-elements/tooltip-component.entry.js +1 -1
  186. package/dist/nylas-web-elements/translate-icon.entry.js +1 -1
  187. package/dist/nylas-web-elements/trash-fill-icon.entry.js +1 -1
  188. package/dist/nylas-web-elements/trash-icon.entry.js +1 -1
  189. package/dist/nylas-web-elements/underline-icon.entry.js +1 -1
  190. package/dist/nylas-web-elements/{utils-Bj5Y75fX.js → utils-DhmCcrVs.js} +3 -3
  191. package/dist/nylas-web-elements/{utils-Bj5Y75fX.js.map → utils-DhmCcrVs.js.map} +1 -1
  192. package/dist/nylas-web-elements/warning-icon.entry.js +1 -1
  193. package/dist/nylas-web-elements/zoom-icon.entry.js +1 -1
  194. package/dist/types/components/design-system/input-component/input-component.d.ts +1 -0
  195. package/dist/types/components/design-system/multi-select-dropdown/multi-select-dropdown.d.ts +1 -0
  196. package/dist/types/components/design-system/textarea-component/textarea-component.d.ts +1 -0
  197. package/dist/types/components/scheduler-editor/nylas-customize-booking-settings/nylas-customize-booking-settings.d.ts +1 -1
  198. package/dist/types/components/scheduler-editor/nylas-time-window-picker/nylas-time-window-picker.d.ts +1 -0
  199. package/dist/types/components.d.ts +4 -4
  200. package/package.json +3 -3
  201. package/readme.md +1 -1
  202. package/dist/nylas-web-elements/index-B-KMpdMZ.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import{h as e,F as t,r as n,a as r,d as i,e as a}from"./index-B-KMpdMZ.js";import{N as o}from"./abstract-provider-D75Ucvku.js";import{N as s}from"./nylas-api-request-B1V2koVc.js";import{d as c,u as l,t as u,a as f,g as d,b as h,c as p,i as y}from"./utils-Bj5Y75fX.js";import{X as v}from"./index.es-BRLyNGE1.js";import{c as g}from"./index-BVtainOy.js";import{C as m,L as b,a as w}from"./constants-DhnshuDN.js";c.extend(l);c.extend(u);class _{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.groupEventsCache=new Map;this.CACHE_DURATION=1*60*1e3;this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}async currentUser(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return null}return this.nylasApiRequest.currentUser()}async getCalendars(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching calendars: Nylas API Request is not initialized"})}const e=[];let t=null;const n=50;do{const[r,i]=await this.nylasApiRequest.request({method:"GET",path:`calendars?limit=${n}${t?`&page_token=${t}`:""}`});if(i){return f(null,{message:"Error fetching calendars: "+i.message})}if(v(r)){return f(null,{message:"Error fetching calendars: "+r.error?.message})}e.push(...r.data);t=r.next_cursor||null}while(t);this.nylasSchedulerConfigStore.state.calendars=e;return f(e)}async getConfigurationById(e,t=false){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching configuration: Nylas API Request is not initialized"})}if(!t){const t=this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e));if(t){this.nylasSchedulerConfigStore.state.selectedConfiguration=t;return f(t)}}const[n,r]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}`});if(r){return f(null,{message:"Error fetching configuration: "+r.message})}if(v(n)){return f(null,{message:"Error fetching configuration: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((t=>t.id===e?n.data:t))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data]}return f(n.data)}async getConfigurations(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching configurations: Nylas API Request is not initialized"})}const t=50;const[n,r]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations?limit=${t}${e?`&page_token=${e}`:""}`});if(r){return f(null,{message:"Error fetching configurations: "+r.message})}if(v(n)){return f(null,{message:"Error fetching configurations: "+n.error?.message})}this.nylasSchedulerConfigStore.state.configurations=n.data;this.nylasSchedulerConfigStore.state.listConfigurationsNextCursor=n.next_cursor||null;return f(n.data)}async getMasterEventById(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching master event: Nylas API Request is not initialized"})}const t=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const n=t?.event?.calendar_id;if(!n){console.warn("Calendar ID is not present");return f(null,{message:"Error fetching master event: Calendar ID is not present"})}const r=new URLSearchParams;r.append("calendar_id",n);const[i,a]=await this.nylasApiRequest.request({method:"GET",path:`events/${e}?${r.toString()}`});if(a){return f(null,{message:"Error fetching master event: "+a.message})}if(v(i)){return f(null,{message:"Error fetching master event: "+i.error?.message})}const o=this.nylasSchedulerConfigStore.state.masterGroupEvents;if(o[e]){this.nylasSchedulerConfigStore.state.masterGroupEvents[e]=i.data}else{this.nylasSchedulerConfigStore.state.masterGroupEvents={...o,[e]:i.data}}return f(i.data)}async createConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:e});if(n){return f(null,{message:"Error creating configuration: "+n.message})}if(v(t)){return f(null,{message:"Error creating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data];return f(t.data)}async updateConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error updating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${e.id}`,body:e});if(n){return f(null,{message:"Error updating configuration: "+n.message})}if(v(t)){return f(null,{message:"Error updating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((n=>n.id===e.id?t.data:n))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data]}return f(t.data)}async deleteConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error deleting configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${e}`});if(n){return f(null,{message:"Error deleting configuration: "+n.message})}if(v(t)){return f(null,{message:"Error deleting configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((t=>t.id!==e));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===e){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return f(t.data)}async createGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error creating group event: Nylas API Request is not initialized"})}const[n,r]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/group-events`,body:e});if(r){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error creating group event: "+r.message})}if(v(n)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error creating group event: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=n.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return f(n.data)}async getGroupEvents(e,t){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching group events: Nylas API Request is not initialized"})}const n=new URLSearchParams;n.append("show_all","true");const r=this.nylasSchedulerConfigStore.state.calendarViewDateRange;let i;let a;if(r){i=r.start_time;a=r.end_time}else{const e=d((new Date).toISOString(),"week");i=e.startTime.toString();a=e.endTime.toString()}const o=`${e}-${i}-${a}`;const s=this.groupEventsCache.get(o);if(s&&Date.now()-s.timestamp<this.CACHE_DURATION){this.nylasSchedulerConfigStore.state.groupEvents=s.data;return f(s.data)}n.append("start_time",i);n.append("end_time",a);const c=t?.group_booking?.calendar_id;if(c){n.append("calendar_id",c)}const[l,u]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}/group-events?${n.toString()}`});if(u){return f(null,{message:"Error fetching group events: "+u.message})}if(v(l)){return f(null,{message:"Error fetching group events: "+l.error?.message})}this.groupEventsCache.set(o,{data:l.data,timestamp:Date.now()});this.cleanupExpiredCache();this.nylasSchedulerConfigStore.state.groupEvents=l.data;return f(l.data)}cleanupExpiredCache(){const e=Date.now();for(const[t,n]of this.groupEventsCache.entries()){if(e-n.timestamp>this.CACHE_DURATION){this.groupEventsCache.delete(t)}}}async updateGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error updating group event: Nylas API Request is not initialized"})}const n=e.id;delete e.id;const[r,i]=await this.nylasApiRequest.request({method:"PATCH",path:`scheduling/configurations/${t}/group-events/${n}`,body:e});if(i){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error updating group event: "+i.message})}if(v(r)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error updating group event: "+r.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=r.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return f(r.data)}async updateGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const r=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const i=r?.event?.master_event_id;const a=r?.event?.id;const o=r?.event?.when?.start_time;const s=r?.group_event_info?.rrule?.[0];const l=s?s.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=o?c(o*1e3).subtract(1,"minute").format("YYYYMMDDTHHmmss[Z]"):"";if(t==="this"){return this.updateGroupEventById({...e,id:a,recurrence:i?undefined:e.recurrence},n)}else if(t==="future"&&i){const t=await this.createGroupEvent(e,n);const a={location:r?.event?.location,conferencing:r?.event?.conferencing,title:r?.event?.title,description:r?.event?.description,capacity:r?.group_event_info?.capacity,calendar_id:r?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:FREQ=DAILY;UNTIL=${u}`]};await this.updateGroupEventById({...a,id:i},n);return[a,t]}else if(t==="all"){const t=e?.when;const a=r?.event?.when;const o=this.nylasSchedulerConfigStore.state.masterGroupEvents?.[i];let s=o?.when;if(t?.start_time!==a?.start_time){s={...s,start_time:t?.start_time||s?.start_time}}if(t?.end_time!==a?.end_time){s={...s,end_time:t?.end_time||s?.end_time}}if(t?.start_timezone!==a?.start_timezone){s={...s,start_timezone:t?.start_timezone||s?.start_timezone}}if(t?.end_timezone!==a?.end_timezone){s={...s,end_timezone:t?.end_timezone||s?.end_timezone}}return this.updateGroupEventById({...e,when:s,id:i},n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const r=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const i=r?.event?.master_event_id;const a=r?.event?.id;const o=r?.event?.when?.start_time;const s=r?.group_event_info?.rrule?.[0];const l=s?s.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=o?c(o*1e3).format("YYYYMMDDTHHmmss[Z]"):"";const f={location:r?.event?.location,conferencing:r?.event?.conferencing,title:r?.event?.title,description:r?.event?.description,capacity:r?.group_event_info?.capacity,calendar_id:r?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:UNTIL=${u}`]};if(t==="this"&&a){return this.deleteGroupEventById(a,n)}else if(t==="future"&&i&&a){await this.deleteGroupEventById(a,n);return await this.updateGroupEventById({...f,id:i},n)}else if(t==="all"&&i){return this.deleteGroupEventById(i,n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error deleting group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const r=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(r){n.append("calendar_id",r)}const[i,a]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}/group-events/${e}?calendar_id=${r}`});if(a){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error deleting group event: "+a.message})}if(v(i)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error deleting group event: "+i.error?.message})}await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return f(i.data)}async importGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error importing group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const r=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(r){n.append("calendar_id",r)}const[i,a]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/import-group-events?${n.toString()}`,body:e});if(a){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error importing group event: "+a.message})}if(v(i)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error importing group event: "+i.error?.message})}if(i.data?.imported_events?.length>0){await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration)}this.nylasSchedulerConfigStore.state.isLoading=false;return f(i.data)}}class k{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}init(){h("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){if(this._schedulerConfigConnector){return this._schedulerConfigConnector}this._schedulerConfigConnector=new _({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore});return this._schedulerConfigConnector}resetStores(){h("NylasSchedulerConfigConnector resetStores");this.nylasSchedulerConfigStore.reset()}async logout(){h("NylasSchedulerConfigConnector logout");this.resetStores()}}function E(e={}){const t={selectedConfiguration:{},configurations:[],groupEvents:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],requiresSlug:false,masterGroupEvents:{},isLoading:false,...e};const n=g(t);function r(){n.set("selectedConfiguration",{...e["selectedConfiguration"]})}n.onChange("action",(async e=>{if(!e){r()}}));return{...n,resetSelectedConfiguration:r}}class C{get(e){return new Promise((t=>{const n=globalThis.window?.localStorage.getItem(e);if(!n){t(null)}else{t(JSON.parse(n))}}))}async remove(e){globalThis.window?.localStorage.removeItem(e);return new Promise((e=>{e(null)}))}set(e,t){globalThis.window?.localStorage.setItem(e,JSON.stringify(t));return new Promise((e=>{e(null)}))}}const x="pkce";const S="grant";const T="user";const R=e=>{if(typeof globalThis.btoa==="function"&&typeof TextEncoder!=="undefined"){const t=(new TextEncoder).encode(e);let n="";for(let e=0;e<t.length;e++){n+=String.fromCharCode(t[e])}return globalThis.btoa(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"utf8").toString("base64")}throw new Error("Base64 encoding is not supported in this environment")};const $=e=>{if(typeof globalThis.atob==="function"&&typeof TextDecoder!=="undefined"){const t=globalThis.atob(e);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){n[e]=t.charCodeAt(e)}return(new TextDecoder).decode(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"base64").toString("utf8")}throw new Error("Base64 decoding is not supported in this environment")};class O{Storage=new C;constructor(e){if(e){this.Storage=e;return}}setPKCE(e){const t=R(e);this.Storage.set(x,t)}async getPKCE(){try{const e=await this.Storage.get(x);if(e){return $(e)}}catch(e){return null}return null}removePKCE(){this.Storage.remove(x)}setGrant(e,t=false){const{grant_id:n}=e;this.Storage.set(`${S}${t?"-"+n:""}`,e)}removeGrant(e,t=false){this.Storage.remove(`${S}${t?"-"+e:""}`)}async getGrant(e,t=false){const n=await this.Storage.get(`${S}${t?"-"+e:""}`);if(n){return n}return null}async setUserToken(e){const t=await this.getUserTokens();if(t){const n=t.find((t=>t.sub===e.sub));if(!n){const n=[...t,e];this.Storage.set(T,n)}else{const n=t.map((t=>{if(t.sub===e.sub){t=e}return t}));this.Storage.set(T,n)}}else{this.Storage.set(T,[e])}}async getUserToken(e=""){const t=await this.Storage.get(T);if(t){if(e===""){return t[0]}const n=t.find((t=>t.sub===e));return n}return null}async getUserTokens(){const e=await this.Storage.get(T);if(e){return e}return null}removeUserTokens(){this.Storage.remove(T)}async removeUserToken(e){const t=await this.getUserTokens();const n=t?.filter((t=>t.sub!==e));this.Storage.set(T,n)}async clearSession(){const e=await this.getUserTokens();e?.forEach((e=>{this.removeGrant(e.sub)}));this.removePKCE();this.removeUserTokens()}}class j{databaseName="identity-db";storeName="identity";get(e){const t=this;return new Promise(((n,r)=>{t.openDatabase().then((function(i){const a=i.transaction(t.storeName,"readwrite");const o=a.objectStore(t.storeName);const s=o.get(e);s.onsuccess=()=>{n(s.result)};s.onerror=()=>{r(s.error)};a.oncomplete=()=>{i.close()}}))}))}async remove(e){const t=this;return new Promise(((n,r)=>{const i=indexedDB.open(this.databaseName);i.onupgradeneeded=function(e){const n=e.target.result;n.createObjectStore(t.storeName)};i.onerror=()=>{r(i.error)};i.onsuccess=t=>{const i=t.target.result;const a=i.transaction(this.storeName,"readwrite");const o=a.objectStore(this.storeName);const s=o.delete(e);s.onsuccess=()=>{n(null)};s.onerror=()=>{r(s.error)};a.oncomplete=()=>{i.close()}}}))}set(e,t){return new Promise(((n,r)=>{const i=indexedDB.open(this.databaseName);i.onerror=()=>{r(i.error)};i.onupgradeneeded=e=>{const t=e.target.result;t.createObjectStore(this.storeName)};i.onsuccess=i=>{const a=i.target.result;const o=a.transaction(this.storeName,"readwrite");const s=o.objectStore(this.storeName);const c=s.put(t,e);c.onsuccess=()=>{n(t)};c.onerror=()=>{r(c.error)};o.oncomplete=()=>{a.close()}}}))}openDatabase(){const e=this;return new Promise((function(t,n){const r=indexedDB.open(e.databaseName,2);r.onupgradeneeded=function(t){const n=t.target.result;n.createObjectStore(e.storeName)};r.onsuccess=function(e){t(e.target.result)};r.onerror=function(e){n(e.error)}}))}}var I;var P=new Uint8Array(16);function A(){if(!I){I=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!=="undefined"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto);if(!I){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return I(P)}var U=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function L(e){return typeof e==="string"&&U.test(e)}var q=[];for(var N=0;N<256;++N){q.push((N+256).toString(16).substr(1))}function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=(q[e[t+0]]+q[e[t+1]]+q[e[t+2]]+q[e[t+3]]+"-"+q[e[t+4]]+q[e[t+5]]+"-"+q[e[t+6]]+q[e[t+7]]+"-"+q[e[t+8]]+q[e[t+9]]+"-"+q[e[t+10]]+q[e[t+11]]+q[e[t+12]]+q[e[t+13]]+q[e[t+14]]+q[e[t+15]]).toLowerCase();if(!L(n)){throw TypeError("Stringified UUID is invalid")}return n}var z;var B;var F=0;var M=0;function G(e,t,n){var r=t&&n||0;var i=t||new Array(16);e=e||{};var a=e.node||z;var o=e.clockseq!==undefined?e.clockseq:B;if(a==null||o==null){var s=e.random||(e.rng||A)();if(a==null){a=z=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]}if(o==null){o=B=(s[6]<<8|s[7])&16383}}var c=e.msecs!==undefined?e.msecs:Date.now();var l=e.nsecs!==undefined?e.nsecs:M+1;var u=c-F+(l-M)/1e4;if(u<0&&e.clockseq===undefined){o=o+1&16383}if((u<0||c>F)&&e.nsecs===undefined){l=0}if(l>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}F=c;M=l;B=o;c+=122192928e5;var f=((c&268435455)*1e4+l)%4294967296;i[r++]=f>>>24&255;i[r++]=f>>>16&255;i[r++]=f>>>8&255;i[r++]=f&255;var d=c/4294967296*1e4&268435455;i[r++]=d>>>8&255;i[r++]=d&255;i[r++]=d>>>24&15|16;i[r++]=d>>>16&255;i[r++]=o>>>8|128;i[r++]=o&255;for(var h=0;h<6;++h){i[r+h]=a[h]}return t||D(i)}function H(e){if(!L(e)){throw TypeError("Invalid UUID")}var t;var n=new Uint8Array(16);n[0]=(t=parseInt(e.slice(0,8),16))>>>24;n[1]=t>>>16&255;n[2]=t>>>8&255;n[3]=t&255;n[4]=(t=parseInt(e.slice(9,13),16))>>>8;n[5]=t&255;n[6]=(t=parseInt(e.slice(14,18),16))>>>8;n[7]=t&255;n[8]=(t=parseInt(e.slice(19,23),16))>>>8;n[9]=t&255;n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255;n[11]=t/4294967296&255;n[12]=t>>>24&255;n[13]=t>>>16&255;n[14]=t>>>8&255;n[15]=t&255;return n}function Y(e){e=unescape(encodeURIComponent(e));var t=[];for(var n=0;n<e.length;++n){t.push(e.charCodeAt(n))}return t}var V="6ba7b810-9dad-11d1-80b4-00c04fd430c8";var J="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function K(e,t,n){function r(e,r,i,a){if(typeof e==="string"){e=Y(e)}if(typeof r==="string"){r=H(r)}if(r.length!==16){throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)")}var o=new Uint8Array(16+e.length);o.set(r);o.set(e,r.length);o=n(o);o[6]=o[6]&15|t;o[8]=o[8]&63|128;if(i){a=a||0;for(var s=0;s<16;++s){i[a+s]=o[s]}return i}return D(o)}try{r.name=e}catch(e){}r.DNS=V;r.URL=J;return r}function W(e){if(typeof e==="string"){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n){e[n]=t.charCodeAt(n)}}return X(Q(ee(e),e.length*8))}function X(e){var t=[];var n=e.length*32;var r="0123456789abcdef";for(var i=0;i<n;i+=8){var a=e[i>>5]>>>i%32&255;var o=parseInt(r.charAt(a>>>4&15)+r.charAt(a&15),16);t.push(o)}return t}function Z(e){return(e+64>>>9<<4)+14+1}function Q(e,t){e[t>>5]|=128<<t%32;e[Z(t)-1]=t;var n=1732584193;var r=-271733879;var i=-1732584194;var a=271733878;for(var o=0;o<e.length;o+=16){var s=n;var c=r;var l=i;var u=a;n=ie(n,r,i,a,e[o],7,-680876936);a=ie(a,n,r,i,e[o+1],12,-389564586);i=ie(i,a,n,r,e[o+2],17,606105819);r=ie(r,i,a,n,e[o+3],22,-1044525330);n=ie(n,r,i,a,e[o+4],7,-176418897);a=ie(a,n,r,i,e[o+5],12,1200080426);i=ie(i,a,n,r,e[o+6],17,-1473231341);r=ie(r,i,a,n,e[o+7],22,-45705983);n=ie(n,r,i,a,e[o+8],7,1770035416);a=ie(a,n,r,i,e[o+9],12,-1958414417);i=ie(i,a,n,r,e[o+10],17,-42063);r=ie(r,i,a,n,e[o+11],22,-1990404162);n=ie(n,r,i,a,e[o+12],7,1804603682);a=ie(a,n,r,i,e[o+13],12,-40341101);i=ie(i,a,n,r,e[o+14],17,-1502002290);r=ie(r,i,a,n,e[o+15],22,1236535329);n=ae(n,r,i,a,e[o+1],5,-165796510);a=ae(a,n,r,i,e[o+6],9,-1069501632);i=ae(i,a,n,r,e[o+11],14,643717713);r=ae(r,i,a,n,e[o],20,-373897302);n=ae(n,r,i,a,e[o+5],5,-701558691);a=ae(a,n,r,i,e[o+10],9,38016083);i=ae(i,a,n,r,e[o+15],14,-660478335);r=ae(r,i,a,n,e[o+4],20,-405537848);n=ae(n,r,i,a,e[o+9],5,568446438);a=ae(a,n,r,i,e[o+14],9,-1019803690);i=ae(i,a,n,r,e[o+3],14,-187363961);r=ae(r,i,a,n,e[o+8],20,1163531501);n=ae(n,r,i,a,e[o+13],5,-1444681467);a=ae(a,n,r,i,e[o+2],9,-51403784);i=ae(i,a,n,r,e[o+7],14,1735328473);r=ae(r,i,a,n,e[o+12],20,-1926607734);n=oe(n,r,i,a,e[o+5],4,-378558);a=oe(a,n,r,i,e[o+8],11,-2022574463);i=oe(i,a,n,r,e[o+11],16,1839030562);r=oe(r,i,a,n,e[o+14],23,-35309556);n=oe(n,r,i,a,e[o+1],4,-1530992060);a=oe(a,n,r,i,e[o+4],11,1272893353);i=oe(i,a,n,r,e[o+7],16,-155497632);r=oe(r,i,a,n,e[o+10],23,-1094730640);n=oe(n,r,i,a,e[o+13],4,681279174);a=oe(a,n,r,i,e[o],11,-358537222);i=oe(i,a,n,r,e[o+3],16,-722521979);r=oe(r,i,a,n,e[o+6],23,76029189);n=oe(n,r,i,a,e[o+9],4,-640364487);a=oe(a,n,r,i,e[o+12],11,-421815835);i=oe(i,a,n,r,e[o+15],16,530742520);r=oe(r,i,a,n,e[o+2],23,-995338651);n=se(n,r,i,a,e[o],6,-198630844);a=se(a,n,r,i,e[o+7],10,1126891415);i=se(i,a,n,r,e[o+14],15,-1416354905);r=se(r,i,a,n,e[o+5],21,-57434055);n=se(n,r,i,a,e[o+12],6,1700485571);a=se(a,n,r,i,e[o+3],10,-1894986606);i=se(i,a,n,r,e[o+10],15,-1051523);r=se(r,i,a,n,e[o+1],21,-2054922799);n=se(n,r,i,a,e[o+8],6,1873313359);a=se(a,n,r,i,e[o+15],10,-30611744);i=se(i,a,n,r,e[o+6],15,-1560198380);r=se(r,i,a,n,e[o+13],21,1309151649);n=se(n,r,i,a,e[o+4],6,-145523070);a=se(a,n,r,i,e[o+11],10,-1120210379);i=se(i,a,n,r,e[o+2],15,718787259);r=se(r,i,a,n,e[o+9],21,-343485551);n=te(n,s);r=te(r,c);i=te(i,l);a=te(a,u)}return[n,r,i,a]}function ee(e){if(e.length===0){return[]}var t=e.length*8;var n=new Uint32Array(Z(t));for(var r=0;r<t;r+=8){n[r>>5]|=(e[r/8]&255)<<r%32}return n}function te(e,t){var n=(e&65535)+(t&65535);var r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function ne(e,t){return e<<t|e>>>32-t}function re(e,t,n,r,i,a){return te(ne(te(te(t,e),te(r,a)),i),n)}function ie(e,t,n,r,i,a,o){return re(t&n|~t&r,e,t,i,a,o)}function ae(e,t,n,r,i,a,o){return re(t&r|n&~r,e,t,i,a,o)}function oe(e,t,n,r,i,a,o){return re(t^n^r,e,t,i,a,o)}function se(e,t,n,r,i,a,o){return re(n^(t|~r),e,t,i,a,o)}var ce=K("v3",48,W);function le(e,t,n){e=e||{};var r=e.random||(e.rng||A)();r[6]=r[6]&15|64;r[8]=r[8]&63|128;if(t){n=n||0;for(var i=0;i<16;++i){t[n+i]=r[i]}return t}return D(r)}function ue(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function fe(e,t){return e<<t|e>>>32-t}function de(e){var t=[1518500249,1859775393,2400959708,3395469782];var n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e==="string"){var r=unescape(encodeURIComponent(e));e=[];for(var i=0;i<r.length;++i){e.push(r.charCodeAt(i))}}else if(!Array.isArray(e)){e=Array.prototype.slice.call(e)}e.push(128);var a=e.length/4+2;var o=Math.ceil(a/16);var s=new Array(o);for(var c=0;c<o;++c){var l=new Uint32Array(16);for(var u=0;u<16;++u){l[u]=e[c*64+u*4]<<24|e[c*64+u*4+1]<<16|e[c*64+u*4+2]<<8|e[c*64+u*4+3]}s[c]=l}s[o-1][14]=(e.length-1)*8/Math.pow(2,32);s[o-1][14]=Math.floor(s[o-1][14]);s[o-1][15]=(e.length-1)*8&4294967295;for(var f=0;f<o;++f){var d=new Uint32Array(80);for(var h=0;h<16;++h){d[h]=s[f][h]}for(var p=16;p<80;++p){d[p]=fe(d[p-3]^d[p-8]^d[p-14]^d[p-16],1)}var y=n[0];var v=n[1];var g=n[2];var m=n[3];var b=n[4];for(var w=0;w<80;++w){var _=Math.floor(w/20);var k=fe(y,5)+ue(_,v,g,m)+b+t[_]+d[w]>>>0;b=m;m=g;g=fe(v,30)>>>0;v=y;y=k}n[0]=n[0]+y>>>0;n[1]=n[1]+v>>>0;n[2]=n[2]+g>>>0;n[3]=n[3]+m>>>0;n[4]=n[4]+b>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var he=K("v5",80,de);var pe="00000000-0000-0000-0000-000000000000";function ye(e){if(!L(e)){throw TypeError("Invalid UUID")}return parseInt(e.substr(14,1),16)}async function ve(e,t){const n=e.getReader();let r;while(!(r=await n.read()).done){t(r.value)}}function ge(e){let t;let n;let r;let i=false;return function a(o){if(t===undefined){t=o;n=0;r=-1}else{t=be(t,o)}const s=t.length;let c=0;while(n<s){if(i){if(t[n]===10){c=++n}i=false}let a=-1;for(;n<s&&a===-1;++n){switch(t[n]){case 58:if(r===-1){r=n-c}break;case 13:i=true;case 10:a=n;break}}if(a===-1){break}e(t.subarray(c,a),r);c=n;r=-1}if(c===s){t=undefined}else if(c!==0){t=t.subarray(c);n-=c}}}function me(e,t,n){let r=we();const i=new TextDecoder;return function a(o,s){if(o.length===0){n===null||n===void 0?void 0:n(r);r=we()}else if(s>0){const n=i.decode(o.subarray(0,s));const a=s+(o[s+1]===32?2:1);const c=i.decode(o.subarray(a));switch(n){case"data":r.data=r.data?r.data+"\n"+c:c;break;case"event":r.event=c;break;case"id":e(r.id=c);break;case"retry":const n=parseInt(c,10);if(!isNaN(n)){t(r.retry=n)}break}}}}function be(e,t){const n=new Uint8Array(e.length+t.length);n.set(e);n.set(t,e.length);return n}function we(){return{data:"",event:"",id:"",retry:undefined}}var _e=undefined&&undefined.__rest||function(e,t){var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0)n[r]=e[r];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++){if(t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i]))n[r[i]]=e[r[i]]}return n};const ke="text/event-stream";const Ee=1e3;const Ce="last-event-id";function xe(e,t){var{signal:n,headers:r,onopen:i,onmessage:a,onclose:o,onerror:s,openWhenHidden:c,fetch:l}=t,u=_e(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(((t,f)=>{const d=Object.assign({},r);if(!d.accept){d.accept=ke}let h;function p(){h.abort();if(!document.hidden){w()}}if(!c){document.addEventListener("visibilitychange",p)}let y=Ee;let v=0;function g(){document.removeEventListener("visibilitychange",p);window.clearTimeout(v);h.abort()}n===null||n===void 0?void 0:n.addEventListener("abort",(()=>{g();t()}));const m=l!==null&&l!==void 0?l:window.fetch;const b=i!==null&&i!==void 0?i:Se;async function w(){var n;h=new AbortController;try{const n=await m(e,Object.assign(Object.assign({},u),{headers:d,signal:h.signal}));await b(n);await ve(n.body,ge(me((e=>{if(e){d[Ce]=e}else{delete d[Ce]}}),(e=>{y=e}),a)));o===null||o===void 0?void 0:o();g();t()}catch(e){if(!h.signal.aborted){try{const t=(n=s===null||s===void 0?void 0:s(e))!==null&&n!==void 0?n:y;window.clearTimeout(v);v=window.setTimeout(w,t)}catch(e){g();f(e)}}}}w()}))}function Se(e){const t=e.headers.get("content-type");if(!(t===null||t===void 0?void 0:t.startsWith(ke))){throw new Error(`Expected content-type to be ${ke}, Actual: ${t}`)}}function Te(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Re(e){e=(e+"===").slice(0,e.length+e.length%4);return e.replace(/-/g,"+").replace(/_/g,"/")}function $e(){return Math.floor(Date.now()/1e3)}async function Oe(e){const t=(new TextEncoder).encode(e);const n=await crypto.subtle.digest("SHA-256",t);const r=Array.from(new Uint8Array(n));const i=r.map((e=>e.toString(16).padStart(2,"0"))).join("");return i}function je(e){this.message=e}je.prototype=new Error,je.prototype.name="InvalidCharacterError";var Ie="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new je("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,a=0,o="";r=t.charAt(a++);~r&&(n=i%4?64*n+r:r,i++%4)?o+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return o};function Pe(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Ie(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Ie(t)}}function Ae(e){this.message=e}function Ue(e,t){if("string"!=typeof e)throw new Ae("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(Pe(e.split(".")[n]))}catch(e){throw new Ae("Invalid token specified: "+e.message)}}Ae.prototype=new Error,Ae.prototype.name="InvalidTokenError";class Le{clientId;redirectUri;accessType="online";domain="http://api.nylas.com";versioned=false;Storage;hosted=false;multiAccount=false;loginId="";constructor(e){this.clientId=e.clientId;this.redirectUri=e.redirectUri;if(e.domain){this.domain=e.domain;const t=this.domain.substring(this.domain.length-3);if(t.includes("/v")){this.versioned=true}}if(e.multiAccount){this.multiAccount=e.multiAccount}if(e.sw){const e=new j;this.Storage=new O(e)}else{this.Storage=new O}if(e.accessType){this.accessType=e.accessType}if(e.loginId){this.loginId=e.loginId}if(e.hosted){this.hosted=e.hosted}if(e.disableInitCodeExchange!==true){this.codeExchange(null)}}async validateAccessToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{access_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?access_token=${n}`,{method:"GET"});const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}async validateIDToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{id_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?id_token=${n}`,{method:"GET"});if(e.status!==200){return false}const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}getDomain(){return this.domain}async auth(e){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){await this.hostedSetCodeChallenge()}const t=await this.generateAuthURL(e);if(e.popup){this.popUp(t);return}return t}async generateAuthURL(e){const t=await this.getCodeChallege();let n=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(t){n+=`&code_challenge=${t}&code_challenge_method=S256&options=rotate_refresh_token`}if(e.provider){n+=`&provider=${e.provider}`}if(e.loginHint){n+=`&login_hint=${e.loginHint}`;if(e.includeGrantScopes){n+=`&include_grant_scopes=${e.includeGrantScopes}`}}if(e.scope){n+=`&scope=${e.scope.join(" ")}`}if(e.prompt){n+=`&prompt=${e.prompt}`}if(e.metadata){n+=`&metadata=${e.metadata}`}if(e.state||this.loginId){n+=`&state=${this.loginId?this.loginId:e.state}`}return n}async generateReauthURL(e,t){if(!e){throw new Error("Grant ID is required")}const n=await this.Storage.getUserToken(e);const r=await this.getCodeChallege();let i=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(r){i+=`&code_challenge=${r}&code_challenge_method=S256&options=rotate_refresh_token`}if(n?.provider){i+=`&provider=${n.provider}`}if(n?.email){i+=`&login_hint=${n.email}`}if(t){i+=`&scope=${t.join(" ")}`}return i}async generateCodeChallenge(){const e=await this.Storage.getPKCE();if(e){return}const t=le();this.Storage.setPKCE(t);return}async hostedSetCodeChallenge(){if(!this.hosted){throw console.error("Method only used with hosted flag enabled")}const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){const e=await this.Storage.getPKCE();if(e){return}console.warn("Code challenge is recomended");return}this.Storage.setPKCE(t)}async getCodeChallege(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){console.warn("Code challenge is recomended");return""}return t}const e=await this.Storage.getPKCE();if(e){const t=await Oe(e);let n=btoa(unescape(encodeURIComponent(t)));n=Te(n);return n}return""}async isLoggedIn(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){return false}const e=await this.Storage.getUserTokens();if(e&&e.length>0){if(this.multiAccount){await this.generateCodeChallenge()}return true}await this.generateCodeChallenge();return false}isMultiAccount(){return this.multiAccount}async logout(){const e=await this.getProfile();await this.Storage.clearSession();const t={detail:e};window.dispatchEvent(new CustomEvent("onLogoutSuccess",t))}async getProfile(e=""){let t;if(e){t=await this.Storage.getUserToken(e)}else{t=await this.Storage.getUserToken()}if(t){return t}return null}async getProfiles(){const e=await this.Storage.getUserTokens();if(e){return e}return null}async removeProfile(e){await this.Storage.removeUserToken(e);await this.Storage.removeGrant(e);return null}async authIMAP(e){const t=await this.getCodeChallege();const n={imap_username:e.imap_username,imap_password:e.imap_password,imap_host:e.imap_host,imap_port:e.imap_port,type:e.type,smtp_host:e.smtp_host,smtp_port:e.smtp_port,provider:e.provider,redirect_uri:this.redirectUri,state:e.state,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e.smtp_username&&e.smtp_password){n.smtp_username=e.smtp_username;n.smtp_password=e.smtp_password}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const r=await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const i=await r.json();return i}async authEWS(e){const t=await this.getCodeChallege();const n={...e,provider:"ews",redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const r=await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const i=await r.json();return i}async detectEmail(e){const t=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${e}`,{method:"POST",headers:new Headers({"content-type":"application/json"})});const n=await t.json();return n}async applicationInfo(){const e=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});const t=await e.json();return t.data}async getAvailableProviders(){const e=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});if(e){const t=await e.json();const n=t.data;return n}return null}onLoginSuccess(e){window.addEventListener("onLoginSuccess",(t=>e(t)))}onLogoutSuccess(e){window.addEventListener("onLogoutSuccess",(t=>e(t)))}onLoginFail(e){window.addEventListener("onLoginFail",(t=>e(t)))}onTokenRefreshSuccess(e){window.addEventListener("onTokenRefreshSuccess",(t=>e(t)))}onTokenRefreshFail(e){window.addEventListener("onTokenRefreshFail",(t=>e(t)))}onSessionExpired(e){window.addEventListener("onSessionExpired",(t=>e(t)))}async codeExchange(e){let t=new URLSearchParams(globalThis.window?.location.search);if(e){t=new URLSearchParams(e)}const n=t.get("code");const r=t.get("state");const i=t.get("error");const a=t.get("error_description");const o=t.get("error_code");if(i&&a&&o){const e={detail:{error:i,error_description:a,error_code:o}};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}if(!n){console.warn("No code found");return false}if(window.opener&&window.name==="uas-popup"){console.warn("Popup window detected");return false}const s=await this.Storage.getPKCE();if(!s){console.warn("No code verifier found");return false}try{const e={client_id:this.clientId,redirect_uri:this.redirectUri,code:n,grant_type:"authorization_code",code_verifier:s};const t=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(e)});const i=await t.json();if(i){if(i.error){const e={detail:i};window.dispatchEvent(new CustomEvent("onLoginFail",e));return true}const e=await this.handleCodeExchangeResponse(i);if(!e.valid){const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginFail",t));return true}else{if(r){e.data.state=r}const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",t));window.history.pushState({},document.title,window.location.pathname)}}this.Storage.removePKCE();return true}catch(i){const e={detail:i};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}}async tokenExchange(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const n=t.refresh_token;try{const t={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:n,grant_type:"refresh_token"};const r=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(t)});const i=await r.json();if(i){if(i.error){const e={detail:i};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const t=$e();i.expires_in=t+i.expires_in;this.Storage.setGrant(i,this.multiAccount);const n=await this.validateIDToken(e);if(!n){const e={detail:i};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const r={detail:i};window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",r));return true}this.Storage.removePKCE()}catch(e){const t={detail:e};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return false}}async handleCodeExchangeResponse(e){const t=true;if(e.error){return{data:e,valid:false}}const n=$e();e.expires_in=n+e.expires_in;this.Storage.setGrant(e,this.multiAccount);const r=Ue(e.id_token);r.status="authenticated";this.Storage.setUserToken(r);const i=await this.validateIDToken(r.sub);if(!i){return{data:e,valid:false}}return{data:e,valid:t}}async popUp(e){const t=500;const n=600;const r=window.screenX+(window.outerWidth-t)/2;const i=window.screenY+(window.outerHeight-n)/2.5;const a=`uas-popup`;const o=e;const s=window.open(o,a,`width=${t},height=${n},left=${r},top=${i}`);if(!s){return}const c=setInterval((async()=>{if(s.closed){const e={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",e));c&&clearInterval(c);return}try{const e=s.location.href.split("?");if(!e[0]){return}const t=s.location.search;s.history.pushState({},document.title,window.location.pathname);if(e[0]===this.redirectUri&&e.length>1){const e=await this.codeExchange(t);s.close();if(e){location.reload()}c&&clearInterval(c);return}}catch(e){return}}),1e3)}async getAccessToken(e=""){const t=$e();const n=await this.Storage.getGrant(e,this.multiAccount);if(!n){return null}const{access_token:r,expires_in:i}=n;const a=r;if(a){if(i&&i>$e()){const e=i-t;if(e>30){return a}}}await this.tokenExchange(e);const o=await this.Storage.getGrant(e,this.multiAccount);return o.access_token}async sse(e,t){const n=t.headers||{};const r=n["Grant-ID"];let i="";if(this.multiAccount){if(!r){this.logout();throw new Error("Grant ID is required for multi account calls")}i=await this.getAccessToken(r)}else{i=await this.getAccessToken()}delete n["Grant-ID"];n["Authorization"]=`Bearer ${i}`;if(!n["content-type"]){n["content-type"]="application/json"}return xe(`${this.domain}/${e}`,{...t,headers:n})}async fetch(e,t,n=true,r){let i="";let a=1;if(this.multiAccount){if(!t.grant_id){this.logout();throw new Error("Grant ID is required for multi account calls")}const e=await this.getProfiles();a=e?e.length:1;i=await this.getAccessToken(t.grant_id)}else{i=await this.getAccessToken()}if(!i){throw new Error("Access token not found")}let o=t.headers;if(!Headers.prototype.isPrototypeOf(o)){o=new Headers({Authorization:`Bearer ${i}`,"content-type":"application/json"})}else{o.append("Authorization",`Bearer ${i}`);if(!o.has("content-type")){o.append("content-type","application/json")}}try{if(t?.body){t.body=JSON.stringify(t?.body)}const i=await fetch(`${r||this.domain}/${e}`,{...t,headers:o});if(!n){return i}const s=await(i?.json());const c=await this.isAuthenticatedResponse(i.status,s);if(!c){if(a>1){const e=await this.getProfile(t.grant_id);if(e){e.status="unauthorized";await this.Storage.setUserToken(e);const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}}else{const e=await this.Storage.getUserToken();const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}this.logout();return}return s}catch(e){throw e}}async fetchRequest(e,t,n,r=true,i,a){const o=await this.isLoggedIn();const s=new URL(e,i??this.domain);const c=new Headers;c.append("Accept","application/json");c.append("Content-Type","application/json");c.append("User-Agent","nylas-identity");if(o){const e=await this.getAccessToken();c.append("Authorization",`Bearer ${e}`)}const l=await fetch(s.toString(),{method:t||"GET",headers:c,mode:"cors",referrer:globalThis.window?.location.origin,body:n?JSON.stringify(n):undefined,...a||{}});if(!r){return l.body}const u=await l.json();return u}async isAuthenticatedResponse(e,t){if(e==401&&t?.error?.type=="token.unauthorized_access"){return false}return true}addAPIKey(e,t,n){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:true,iat:$e(),iss:"",email:t,provider:"virtual-calendar",status:"authenticated",name:t,sub:e});this.Storage.setGrant({grant_id:e,access_token:n,expires_in:2e9},this.multiAccount)}}var qe={exports:{}};var Ne={};
1
+ import{h as e,F as t,r as n,a as r,d as i,e as o}from"./index-Cbn5rIwb.js";import{N as a}from"./abstract-provider-9AZudYSI.js";import{N as s}from"./nylas-api-request-rYAjhY1J.js";import{d as c,u as l,t as u,a as f,g as d,b as h,c as p,i as y}from"./utils-DhmCcrVs.js";import{X as v}from"./index.es-BRLyNGE1.js";import{c as g}from"./index-BPPwIJj2.js";import{C as b,L as m,a as w}from"./constants-DhnshuDN.js";c.extend(l);c.extend(u);class _{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.groupEventsCache=new Map;this.CACHE_DURATION=1*60*1e3;this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}async currentUser(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return null}return this.nylasApiRequest.currentUser()}async getCalendars(){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching calendars: Nylas API Request is not initialized"})}const e=[];let t=null;const n=50;do{const[r,i]=await this.nylasApiRequest.request({method:"GET",path:`calendars?limit=${n}${t?`&page_token=${t}`:""}`});if(i){return f(null,{message:"Error fetching calendars: "+i.message})}if(v(r)){return f(null,{message:"Error fetching calendars: "+r.error?.message})}e.push(...r.data);t=r.next_cursor||null}while(t);this.nylasSchedulerConfigStore.state.calendars=e;return f(e)}async getConfigurationById(e,t=false){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching configuration: Nylas API Request is not initialized"})}if(!t){const t=this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e));if(t){this.nylasSchedulerConfigStore.state.selectedConfiguration=t;return f(t)}}const[n,r]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}`});if(r){return f(null,{message:"Error fetching configuration: "+r.message})}if(v(n)){return f(null,{message:"Error fetching configuration: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=n.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((t=>t.id===e?n.data:t))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,n.data]}return f(n.data)}async getConfigurations(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching configurations: Nylas API Request is not initialized"})}const t=50;const[n,r]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations?limit=${t}${e?`&page_token=${e}`:""}`});if(r){return f(null,{message:"Error fetching configurations: "+r.message})}if(v(n)){return f(null,{message:"Error fetching configurations: "+n.error?.message})}this.nylasSchedulerConfigStore.state.configurations=n.data;this.nylasSchedulerConfigStore.state.listConfigurationsNextCursor=n.next_cursor||null;return f(n.data)}async getMasterEventById(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching master event: Nylas API Request is not initialized"})}const t=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const n=t?.event?.calendar_id;if(!n){console.warn("Calendar ID is not present");return f(null,{message:"Error fetching master event: Calendar ID is not present"})}const r=new URLSearchParams;r.append("calendar_id",n);const[i,o]=await this.nylasApiRequest.request({method:"GET",path:`events/${e}?${r.toString()}`});if(o){return f(null,{message:"Error fetching master event: "+o.message})}if(v(i)){return f(null,{message:"Error fetching master event: "+i.error?.message})}const a=this.nylasSchedulerConfigStore.state.masterGroupEvents;if(a[e]){this.nylasSchedulerConfigStore.state.masterGroupEvents[e]=i.data}else{this.nylasSchedulerConfigStore.state.masterGroupEvents={...a,[e]:i.data}}return f(i.data)}async createConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error creating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations`,body:e});if(n){return f(null,{message:"Error creating configuration: "+n.message})}if(v(t)){return f(null,{message:"Error creating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data];return f(t.data)}async updateConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error updating configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"PUT",path:`scheduling/configurations/${e.id}`,body:e});if(n){return f(null,{message:"Error updating configuration: "+n.message})}if(v(t)){return f(null,{message:"Error updating configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.selectedConfiguration=t.data;if(this.nylasSchedulerConfigStore.state.configurations.find((t=>t.id===e.id))){this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.map((n=>n.id===e.id?t.data:n))}else{this.nylasSchedulerConfigStore.state.configurations=[...this.nylasSchedulerConfigStore.state.configurations,t.data]}return f(t.data)}async deleteConfiguration(e){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error deleting configuration: Nylas API Request is not initialized"})}const[t,n]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${e}`});if(n){return f(null,{message:"Error deleting configuration: "+n.message})}if(v(t)){return f(null,{message:"Error deleting configuration: "+t.error?.message})}this.nylasSchedulerConfigStore.state.configurations=this.nylasSchedulerConfigStore.state.configurations.filter((t=>t.id!==e));if(this.nylasSchedulerConfigStore.state.selectedConfiguration?.id===e){this.nylasSchedulerConfigStore.resetSelectedConfiguration()}return f(t.data)}async createGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error creating group event: Nylas API Request is not initialized"})}const[n,r]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/group-events`,body:e});if(r){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error creating group event: "+r.message})}if(v(n)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error creating group event: "+n.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=n.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return f(n.data)}async getGroupEvents(e,t){if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error fetching group events: Nylas API Request is not initialized"})}const n=new URLSearchParams;n.append("show_all","true");const r=this.nylasSchedulerConfigStore.state.calendarViewDateRange;let i;let o;if(r){i=r.start_time;o=r.end_time}else{const e=d((new Date).toISOString(),"week");i=e.startTime.toString();o=e.endTime.toString()}const a=`${e}-${i}-${o}`;const s=this.groupEventsCache.get(a);if(s&&Date.now()-s.timestamp<this.CACHE_DURATION){this.nylasSchedulerConfigStore.state.groupEvents=s.data;return f(s.data)}n.append("start_time",i);n.append("end_time",o);const c=t?.group_booking?.calendar_id;if(c){n.append("calendar_id",c)}const[l,u]=await this.nylasApiRequest.request({method:"GET",path:`scheduling/configurations/${e}/group-events?${n.toString()}`});if(u){return f(null,{message:"Error fetching group events: "+u.message})}if(v(l)){return f(null,{message:"Error fetching group events: "+l.error?.message})}this.groupEventsCache.set(a,{data:l.data,timestamp:Date.now()});this.cleanupExpiredCache();this.nylasSchedulerConfigStore.state.groupEvents=l.data;return f(l.data)}cleanupExpiredCache(){const e=Date.now();for(const[t,n]of this.groupEventsCache.entries()){if(e-n.timestamp>this.CACHE_DURATION){this.groupEventsCache.delete(t)}}}async updateGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error updating group event: Nylas API Request is not initialized"})}const n=e.id;delete e.id;const[r,i]=await this.nylasApiRequest.request({method:"PATCH",path:`scheduling/configurations/${t}/group-events/${n}`,body:e});if(i){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error updating group event: "+i.message})}if(v(r)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error updating group event: "+r.error?.message})}this.nylasSchedulerConfigStore.state.selectedGroupEvent=r.data;await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return f(r.data)}async updateGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const r=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const i=r?.event?.master_event_id;const o=r?.event?.id;const a=r?.event?.when?.start_time;const s=r?.group_event_info?.rrule?.[0];const l=s?s.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=a?c(a*1e3).subtract(1,"minute").format("YYYYMMDDTHHmmss[Z]"):"";if(t==="this"){return this.updateGroupEventById({...e,id:o,recurrence:i?undefined:e.recurrence},n)}else if(t==="future"&&i){const t=await this.createGroupEvent(e,n);const o={location:r?.event?.location,conferencing:r?.event?.conferencing,title:r?.event?.title,description:r?.event?.description,capacity:r?.group_event_info?.capacity,calendar_id:r?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:FREQ=DAILY;UNTIL=${u}`]};await this.updateGroupEventById({...o,id:i},n);return[o,t]}else if(t==="all"){const t=e?.when;const o=r?.event?.when;const a=this.nylasSchedulerConfigStore.state.masterGroupEvents?.[i];let s=a?.when;if(t?.start_time!==o?.start_time){s={...s,start_time:t?.start_time||s?.start_time}}if(t?.end_time!==o?.end_time){s={...s,end_time:t?.end_time||s?.end_time}}if(t?.start_timezone!==o?.start_timezone){s={...s,start_timezone:t?.start_timezone||s?.start_timezone}}if(t?.end_timezone!==o?.end_timezone){s={...s,end_timezone:t?.end_timezone||s?.end_timezone}}return this.updateGroupEventById({...e,when:s,id:i},n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEvent(e,t,n){this.nylasSchedulerConfigStore.state.isLoading=true;const r=this.nylasSchedulerConfigStore.state.selectedGroupEvent;const i=r?.event?.master_event_id;const o=r?.event?.id;const a=r?.event?.when?.start_time;const s=r?.group_event_info?.rrule?.[0];const l=s?s.split(";").filter((e=>!e.startsWith("UNTIL"))).join(";"):"";const u=a?c(a*1e3).format("YYYYMMDDTHHmmss[Z]"):"";const f={location:r?.event?.location,conferencing:r?.event?.conferencing,title:r?.event?.title,description:r?.event?.description,capacity:r?.group_event_info?.capacity,calendar_id:r?.event?.calendar_id,recurrence:l?[l+";UNTIL="+u]:[`RRULE:UNTIL=${u}`]};if(t==="this"&&o){return this.deleteGroupEventById(o,n)}else if(t==="future"&&i&&o){await this.deleteGroupEventById(o,n);return await this.updateGroupEventById({...f,id:i},n)}else if(t==="all"&&i){return this.deleteGroupEventById(i,n)}this.nylasSchedulerConfigStore.state.isLoading=false;throw new Error("Invalid option")}async deleteGroupEventById(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error deleting group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const r=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(r){n.append("calendar_id",r)}const[i,o]=await this.nylasApiRequest.request({method:"DELETE",path:`scheduling/configurations/${t}/group-events/${e}?calendar_id=${r}`});if(o){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error deleting group event: "+o.message})}if(v(i)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error deleting group event: "+i.error?.message})}await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration);this.nylasSchedulerConfigStore.state.isLoading=false;return f(i.data)}async importGroupEvent(e,t){this.nylasSchedulerConfigStore.state.isLoading=true;if(!this.nylasApiRequest){console.warn("Nylas API Request is not initialized");return f(null,{message:"Error importing group event: Nylas API Request is not initialized"})}const n=new URLSearchParams;const r=this.nylasSchedulerConfigStore.state.selectedConfiguration?.group_booking?.calendar_id;if(r){n.append("calendar_id",r)}const[i,o]=await this.nylasApiRequest.request({method:"POST",path:`scheduling/configurations/${t}/import-group-events?${n.toString()}`,body:e});if(o){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error importing group event: "+o.message})}if(v(i)){this.nylasSchedulerConfigStore.state.isLoading=false;return f(null,{message:"Error importing group event: "+i.error?.message})}if(i.data?.imported_events?.length>0){await this.getGroupEvents(t,this.nylasSchedulerConfigStore.state.selectedConfiguration)}this.nylasSchedulerConfigStore.state.isLoading=false;return f(i.data)}}class k{constructor({nylasApiRequest:e,nylasSchedulerConfigStore:t}){this.nylasApiRequest=e;this.nylasSchedulerConfigStore=t}init(){h("NylasSchedulerConfigConnector init")}get schedulerConfigStore(){return this.nylasSchedulerConfigStore}get schedulerConfig(){if(this._schedulerConfigConnector){return this._schedulerConfigConnector}this._schedulerConfigConnector=new _({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:this.nylasSchedulerConfigStore});return this._schedulerConfigConnector}resetStores(){h("NylasSchedulerConfigConnector resetStores");this.nylasSchedulerConfigStore.reset()}async logout(){h("NylasSchedulerConfigConnector logout");this.resetStores()}}function E(e={}){const t={selectedConfiguration:{},configurations:[],groupEvents:[],listConfigurationsNextCursor:null,calendars:[],currentUser:null,action:null,additionalParticipants:[],requiresSlug:false,masterGroupEvents:{},isLoading:false,...e};const n=g(t);function r(){n.set("selectedConfiguration",{...e["selectedConfiguration"]})}n.onChange("action",(async e=>{if(!e){r()}}));return{...n,resetSelectedConfiguration:r}}class C{get(e){return new Promise((t=>{const n=globalThis.window?.localStorage.getItem(e);if(!n){t(null)}else{t(JSON.parse(n))}}))}async remove(e){globalThis.window?.localStorage.removeItem(e);return new Promise((e=>{e(null)}))}set(e,t){globalThis.window?.localStorage.setItem(e,JSON.stringify(t));return new Promise((e=>{e(null)}))}}const x="pkce";const S="grant";const T="user";const R=e=>{if(typeof globalThis.btoa==="function"&&typeof TextEncoder!=="undefined"){const t=(new TextEncoder).encode(e);let n="";for(let e=0;e<t.length;e++){n+=String.fromCharCode(t[e])}return globalThis.btoa(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"utf8").toString("base64")}throw new Error("Base64 encoding is not supported in this environment")};const $=e=>{if(typeof globalThis.atob==="function"&&typeof TextDecoder!=="undefined"){const t=globalThis.atob(e);const n=new Uint8Array(t.length);for(let e=0;e<t.length;e++){n[e]=t.charCodeAt(e)}return(new TextDecoder).decode(n)}if(typeof globalThis.Buffer!=="undefined"){return globalThis.Buffer.from(e,"base64").toString("utf8")}throw new Error("Base64 decoding is not supported in this environment")};class j{Storage=new C;constructor(e){if(e){this.Storage=e;return}}setPKCE(e){const t=R(e);this.Storage.set(x,t)}async getPKCE(){try{const e=await this.Storage.get(x);if(e){return $(e)}}catch(e){return null}return null}removePKCE(){this.Storage.remove(x)}setGrant(e,t=false){const{grant_id:n}=e;this.Storage.set(`${S}${t?"-"+n:""}`,e)}removeGrant(e,t=false){this.Storage.remove(`${S}${t?"-"+e:""}`)}async getGrant(e,t=false){const n=await this.Storage.get(`${S}${t?"-"+e:""}`);if(n){return n}return null}async setUserToken(e){const t=await this.getUserTokens();if(t){const n=t.find((t=>t.sub===e.sub));if(!n){const n=[...t,e];this.Storage.set(T,n)}else{const n=t.map((t=>{if(t.sub===e.sub){t=e}return t}));this.Storage.set(T,n)}}else{this.Storage.set(T,[e])}}async getUserToken(e=""){const t=await this.Storage.get(T);if(t){if(e===""){return t[0]}const n=t.find((t=>t.sub===e));return n}return null}async getUserTokens(){const e=await this.Storage.get(T);if(e){return e}return null}removeUserTokens(){this.Storage.remove(T)}async removeUserToken(e){const t=await this.getUserTokens();const n=t?.filter((t=>t.sub!==e));this.Storage.set(T,n)}async clearSession(){const e=await this.getUserTokens();e?.forEach((e=>{this.removeGrant(e.sub)}));this.removePKCE();this.removeUserTokens()}}class O{databaseName="identity-db";storeName="identity";get(e){const t=this;return new Promise(((n,r)=>{t.openDatabase().then((function(i){const o=i.transaction(t.storeName,"readwrite");const a=o.objectStore(t.storeName);const s=a.get(e);s.onsuccess=()=>{n(s.result)};s.onerror=()=>{r(s.error)};o.oncomplete=()=>{i.close()}}))}))}async remove(e){const t=this;return new Promise(((n,r)=>{const i=indexedDB.open(this.databaseName);i.onupgradeneeded=function(e){const n=e.target.result;n.createObjectStore(t.storeName)};i.onerror=()=>{r(i.error)};i.onsuccess=t=>{const i=t.target.result;const o=i.transaction(this.storeName,"readwrite");const a=o.objectStore(this.storeName);const s=a.delete(e);s.onsuccess=()=>{n(null)};s.onerror=()=>{r(s.error)};o.oncomplete=()=>{i.close()}}}))}set(e,t){return new Promise(((n,r)=>{const i=indexedDB.open(this.databaseName);i.onerror=()=>{r(i.error)};i.onupgradeneeded=e=>{const t=e.target.result;t.createObjectStore(this.storeName)};i.onsuccess=i=>{const o=i.target.result;const a=o.transaction(this.storeName,"readwrite");const s=a.objectStore(this.storeName);const c=s.put(t,e);c.onsuccess=()=>{n(t)};c.onerror=()=>{r(c.error)};a.oncomplete=()=>{o.close()}}}))}openDatabase(){const e=this;return new Promise((function(t,n){const r=indexedDB.open(e.databaseName,2);r.onupgradeneeded=function(t){const n=t.target.result;n.createObjectStore(e.storeName)};r.onsuccess=function(e){t(e.target.result)};r.onerror=function(e){n(e.error)}}))}}var I;var P=new Uint8Array(16);function A(){if(!I){I=typeof crypto!=="undefined"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto!=="undefined"&&typeof msCrypto.getRandomValues==="function"&&msCrypto.getRandomValues.bind(msCrypto);if(!I){throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported")}}return I(P)}var U=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function L(e){return typeof e==="string"&&U.test(e)}var q=[];for(var N=0;N<256;++N){q.push((N+256).toString(16).substr(1))}function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:0;var n=(q[e[t+0]]+q[e[t+1]]+q[e[t+2]]+q[e[t+3]]+"-"+q[e[t+4]]+q[e[t+5]]+"-"+q[e[t+6]]+q[e[t+7]]+"-"+q[e[t+8]]+q[e[t+9]]+"-"+q[e[t+10]]+q[e[t+11]]+q[e[t+12]]+q[e[t+13]]+q[e[t+14]]+q[e[t+15]]).toLowerCase();if(!L(n)){throw TypeError("Stringified UUID is invalid")}return n}var z;var F;var B=0;var M=0;function G(e,t,n){var r=t&&n||0;var i=t||new Array(16);e=e||{};var o=e.node||z;var a=e.clockseq!==undefined?e.clockseq:F;if(o==null||a==null){var s=e.random||(e.rng||A)();if(o==null){o=z=[s[0]|1,s[1],s[2],s[3],s[4],s[5]]}if(a==null){a=F=(s[6]<<8|s[7])&16383}}var c=e.msecs!==undefined?e.msecs:Date.now();var l=e.nsecs!==undefined?e.nsecs:M+1;var u=c-B+(l-M)/1e4;if(u<0&&e.clockseq===undefined){a=a+1&16383}if((u<0||c>B)&&e.nsecs===undefined){l=0}if(l>=1e4){throw new Error("uuid.v1(): Can't create more than 10M uuids/sec")}B=c;M=l;F=a;c+=122192928e5;var f=((c&268435455)*1e4+l)%4294967296;i[r++]=f>>>24&255;i[r++]=f>>>16&255;i[r++]=f>>>8&255;i[r++]=f&255;var d=c/4294967296*1e4&268435455;i[r++]=d>>>8&255;i[r++]=d&255;i[r++]=d>>>24&15|16;i[r++]=d>>>16&255;i[r++]=a>>>8|128;i[r++]=a&255;for(var h=0;h<6;++h){i[r+h]=o[h]}return t||D(i)}function H(e){if(!L(e)){throw TypeError("Invalid UUID")}var t;var n=new Uint8Array(16);n[0]=(t=parseInt(e.slice(0,8),16))>>>24;n[1]=t>>>16&255;n[2]=t>>>8&255;n[3]=t&255;n[4]=(t=parseInt(e.slice(9,13),16))>>>8;n[5]=t&255;n[6]=(t=parseInt(e.slice(14,18),16))>>>8;n[7]=t&255;n[8]=(t=parseInt(e.slice(19,23),16))>>>8;n[9]=t&255;n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255;n[11]=t/4294967296&255;n[12]=t>>>24&255;n[13]=t>>>16&255;n[14]=t>>>8&255;n[15]=t&255;return n}function Y(e){e=unescape(encodeURIComponent(e));var t=[];for(var n=0;n<e.length;++n){t.push(e.charCodeAt(n))}return t}var V="6ba7b810-9dad-11d1-80b4-00c04fd430c8";var J="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function W(e,t,n){function r(e,r,i,o){if(typeof e==="string"){e=Y(e)}if(typeof r==="string"){r=H(r)}if(r.length!==16){throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)")}var a=new Uint8Array(16+e.length);a.set(r);a.set(e,r.length);a=n(a);a[6]=a[6]&15|t;a[8]=a[8]&63|128;if(i){o=o||0;for(var s=0;s<16;++s){i[o+s]=a[s]}return i}return D(a)}try{r.name=e}catch(e){}r.DNS=V;r.URL=J;return r}function K(e){if(typeof e==="string"){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n){e[n]=t.charCodeAt(n)}}return X(Q(ee(e),e.length*8))}function X(e){var t=[];var n=e.length*32;var r="0123456789abcdef";for(var i=0;i<n;i+=8){var o=e[i>>5]>>>i%32&255;var a=parseInt(r.charAt(o>>>4&15)+r.charAt(o&15),16);t.push(a)}return t}function Z(e){return(e+64>>>9<<4)+14+1}function Q(e,t){e[t>>5]|=128<<t%32;e[Z(t)-1]=t;var n=1732584193;var r=-271733879;var i=-1732584194;var o=271733878;for(var a=0;a<e.length;a+=16){var s=n;var c=r;var l=i;var u=o;n=ie(n,r,i,o,e[a],7,-680876936);o=ie(o,n,r,i,e[a+1],12,-389564586);i=ie(i,o,n,r,e[a+2],17,606105819);r=ie(r,i,o,n,e[a+3],22,-1044525330);n=ie(n,r,i,o,e[a+4],7,-176418897);o=ie(o,n,r,i,e[a+5],12,1200080426);i=ie(i,o,n,r,e[a+6],17,-1473231341);r=ie(r,i,o,n,e[a+7],22,-45705983);n=ie(n,r,i,o,e[a+8],7,1770035416);o=ie(o,n,r,i,e[a+9],12,-1958414417);i=ie(i,o,n,r,e[a+10],17,-42063);r=ie(r,i,o,n,e[a+11],22,-1990404162);n=ie(n,r,i,o,e[a+12],7,1804603682);o=ie(o,n,r,i,e[a+13],12,-40341101);i=ie(i,o,n,r,e[a+14],17,-1502002290);r=ie(r,i,o,n,e[a+15],22,1236535329);n=oe(n,r,i,o,e[a+1],5,-165796510);o=oe(o,n,r,i,e[a+6],9,-1069501632);i=oe(i,o,n,r,e[a+11],14,643717713);r=oe(r,i,o,n,e[a],20,-373897302);n=oe(n,r,i,o,e[a+5],5,-701558691);o=oe(o,n,r,i,e[a+10],9,38016083);i=oe(i,o,n,r,e[a+15],14,-660478335);r=oe(r,i,o,n,e[a+4],20,-405537848);n=oe(n,r,i,o,e[a+9],5,568446438);o=oe(o,n,r,i,e[a+14],9,-1019803690);i=oe(i,o,n,r,e[a+3],14,-187363961);r=oe(r,i,o,n,e[a+8],20,1163531501);n=oe(n,r,i,o,e[a+13],5,-1444681467);o=oe(o,n,r,i,e[a+2],9,-51403784);i=oe(i,o,n,r,e[a+7],14,1735328473);r=oe(r,i,o,n,e[a+12],20,-1926607734);n=ae(n,r,i,o,e[a+5],4,-378558);o=ae(o,n,r,i,e[a+8],11,-2022574463);i=ae(i,o,n,r,e[a+11],16,1839030562);r=ae(r,i,o,n,e[a+14],23,-35309556);n=ae(n,r,i,o,e[a+1],4,-1530992060);o=ae(o,n,r,i,e[a+4],11,1272893353);i=ae(i,o,n,r,e[a+7],16,-155497632);r=ae(r,i,o,n,e[a+10],23,-1094730640);n=ae(n,r,i,o,e[a+13],4,681279174);o=ae(o,n,r,i,e[a],11,-358537222);i=ae(i,o,n,r,e[a+3],16,-722521979);r=ae(r,i,o,n,e[a+6],23,76029189);n=ae(n,r,i,o,e[a+9],4,-640364487);o=ae(o,n,r,i,e[a+12],11,-421815835);i=ae(i,o,n,r,e[a+15],16,530742520);r=ae(r,i,o,n,e[a+2],23,-995338651);n=se(n,r,i,o,e[a],6,-198630844);o=se(o,n,r,i,e[a+7],10,1126891415);i=se(i,o,n,r,e[a+14],15,-1416354905);r=se(r,i,o,n,e[a+5],21,-57434055);n=se(n,r,i,o,e[a+12],6,1700485571);o=se(o,n,r,i,e[a+3],10,-1894986606);i=se(i,o,n,r,e[a+10],15,-1051523);r=se(r,i,o,n,e[a+1],21,-2054922799);n=se(n,r,i,o,e[a+8],6,1873313359);o=se(o,n,r,i,e[a+15],10,-30611744);i=se(i,o,n,r,e[a+6],15,-1560198380);r=se(r,i,o,n,e[a+13],21,1309151649);n=se(n,r,i,o,e[a+4],6,-145523070);o=se(o,n,r,i,e[a+11],10,-1120210379);i=se(i,o,n,r,e[a+2],15,718787259);r=se(r,i,o,n,e[a+9],21,-343485551);n=te(n,s);r=te(r,c);i=te(i,l);o=te(o,u)}return[n,r,i,o]}function ee(e){if(e.length===0){return[]}var t=e.length*8;var n=new Uint32Array(Z(t));for(var r=0;r<t;r+=8){n[r>>5]|=(e[r/8]&255)<<r%32}return n}function te(e,t){var n=(e&65535)+(t&65535);var r=(e>>16)+(t>>16)+(n>>16);return r<<16|n&65535}function ne(e,t){return e<<t|e>>>32-t}function re(e,t,n,r,i,o){return te(ne(te(te(t,e),te(r,o)),i),n)}function ie(e,t,n,r,i,o,a){return re(t&n|~t&r,e,t,i,o,a)}function oe(e,t,n,r,i,o,a){return re(t&r|n&~r,e,t,i,o,a)}function ae(e,t,n,r,i,o,a){return re(t^n^r,e,t,i,o,a)}function se(e,t,n,r,i,o,a){return re(n^(t|~r),e,t,i,o,a)}var ce=W("v3",48,K);function le(e,t,n){e=e||{};var r=e.random||(e.rng||A)();r[6]=r[6]&15|64;r[8]=r[8]&63|128;if(t){n=n||0;for(var i=0;i<16;++i){t[n+i]=r[i]}return t}return D(r)}function ue(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:return t^n^r;case 2:return t&n^t&r^n&r;case 3:return t^n^r}}function fe(e,t){return e<<t|e>>>32-t}function de(e){var t=[1518500249,1859775393,2400959708,3395469782];var n=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e==="string"){var r=unescape(encodeURIComponent(e));e=[];for(var i=0;i<r.length;++i){e.push(r.charCodeAt(i))}}else if(!Array.isArray(e)){e=Array.prototype.slice.call(e)}e.push(128);var o=e.length/4+2;var a=Math.ceil(o/16);var s=new Array(a);for(var c=0;c<a;++c){var l=new Uint32Array(16);for(var u=0;u<16;++u){l[u]=e[c*64+u*4]<<24|e[c*64+u*4+1]<<16|e[c*64+u*4+2]<<8|e[c*64+u*4+3]}s[c]=l}s[a-1][14]=(e.length-1)*8/Math.pow(2,32);s[a-1][14]=Math.floor(s[a-1][14]);s[a-1][15]=(e.length-1)*8&4294967295;for(var f=0;f<a;++f){var d=new Uint32Array(80);for(var h=0;h<16;++h){d[h]=s[f][h]}for(var p=16;p<80;++p){d[p]=fe(d[p-3]^d[p-8]^d[p-14]^d[p-16],1)}var y=n[0];var v=n[1];var g=n[2];var b=n[3];var m=n[4];for(var w=0;w<80;++w){var _=Math.floor(w/20);var k=fe(y,5)+ue(_,v,g,b)+m+t[_]+d[w]>>>0;m=b;b=g;g=fe(v,30)>>>0;v=y;y=k}n[0]=n[0]+y>>>0;n[1]=n[1]+v>>>0;n[2]=n[2]+g>>>0;n[3]=n[3]+b>>>0;n[4]=n[4]+m>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,n[0]&255,n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,n[1]&255,n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,n[2]&255,n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,n[3]&255,n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,n[4]&255]}var he=W("v5",80,de);var pe="00000000-0000-0000-0000-000000000000";function ye(e){if(!L(e)){throw TypeError("Invalid UUID")}return parseInt(e.substr(14,1),16)}async function ve(e,t){const n=e.getReader();let r;while(!(r=await n.read()).done){t(r.value)}}function ge(e){let t;let n;let r;let i=false;return function o(a){if(t===undefined){t=a;n=0;r=-1}else{t=me(t,a)}const s=t.length;let c=0;while(n<s){if(i){if(t[n]===10){c=++n}i=false}let o=-1;for(;n<s&&o===-1;++n){switch(t[n]){case 58:if(r===-1){r=n-c}break;case 13:i=true;case 10:o=n;break}}if(o===-1){break}e(t.subarray(c,o),r);c=n;r=-1}if(c===s){t=undefined}else if(c!==0){t=t.subarray(c);n-=c}}}function be(e,t,n){let r=we();const i=new TextDecoder;return function o(a,s){if(a.length===0){n===null||n===void 0?void 0:n(r);r=we()}else if(s>0){const n=i.decode(a.subarray(0,s));const o=s+(a[s+1]===32?2:1);const c=i.decode(a.subarray(o));switch(n){case"data":r.data=r.data?r.data+"\n"+c:c;break;case"event":r.event=c;break;case"id":e(r.id=c);break;case"retry":const n=parseInt(c,10);if(!isNaN(n)){t(r.retry=n)}break}}}}function me(e,t){const n=new Uint8Array(e.length+t.length);n.set(e);n.set(t,e.length);return n}function we(){return{data:"",event:"",id:"",retry:undefined}}var _e=undefined&&undefined.__rest||function(e,t){var n={};for(var r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0)n[r]=e[r];if(e!=null&&typeof Object.getOwnPropertySymbols==="function")for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++){if(t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i]))n[r[i]]=e[r[i]]}return n};const ke="text/event-stream";const Ee=1e3;const Ce="last-event-id";function xe(e,t){var{signal:n,headers:r,onopen:i,onmessage:o,onclose:a,onerror:s,openWhenHidden:c,fetch:l}=t,u=_e(t,["signal","headers","onopen","onmessage","onclose","onerror","openWhenHidden","fetch"]);return new Promise(((t,f)=>{const d=Object.assign({},r);if(!d.accept){d.accept=ke}let h;function p(){h.abort();if(!document.hidden){w()}}if(!c){document.addEventListener("visibilitychange",p)}let y=Ee;let v=0;function g(){document.removeEventListener("visibilitychange",p);window.clearTimeout(v);h.abort()}n===null||n===void 0?void 0:n.addEventListener("abort",(()=>{g();t()}));const b=l!==null&&l!==void 0?l:window.fetch;const m=i!==null&&i!==void 0?i:Se;async function w(){var n;h=new AbortController;try{const n=await b(e,Object.assign(Object.assign({},u),{headers:d,signal:h.signal}));await m(n);await ve(n.body,ge(be((e=>{if(e){d[Ce]=e}else{delete d[Ce]}}),(e=>{y=e}),o)));a===null||a===void 0?void 0:a();g();t()}catch(e){if(!h.signal.aborted){try{const t=(n=s===null||s===void 0?void 0:s(e))!==null&&n!==void 0?n:y;window.clearTimeout(v);v=window.setTimeout(w,t)}catch(e){g();f(e)}}}}w()}))}function Se(e){const t=e.headers.get("content-type");if(!(t===null||t===void 0?void 0:t.startsWith(ke))){throw new Error(`Expected content-type to be ${ke}, Actual: ${t}`)}}function Te(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Re(e){e=(e+"===").slice(0,e.length+e.length%4);return e.replace(/-/g,"+").replace(/_/g,"/")}function $e(){return Math.floor(Date.now()/1e3)}async function je(e){const t=(new TextEncoder).encode(e);const n=await crypto.subtle.digest("SHA-256",t);const r=Array.from(new Uint8Array(n));const i=r.map((e=>e.toString(16).padStart(2,"0"))).join("");return i}function Oe(e){this.message=e}Oe.prototype=new Error,Oe.prototype.name="InvalidCharacterError";var Ie="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new Oe("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,i=0,o=0,a="";r=t.charAt(o++);~r&&(n=i%4?64*n+r:r,i++%4)?a+=String.fromCharCode(255&n>>(-2*i&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return a};function Pe(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(Ie(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return Ie(t)}}function Ae(e){this.message=e}function Ue(e,t){if("string"!=typeof e)throw new Ae("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(Pe(e.split(".")[n]))}catch(e){throw new Ae("Invalid token specified: "+e.message)}}Ae.prototype=new Error,Ae.prototype.name="InvalidTokenError";class Le{clientId;redirectUri;accessType="online";domain="http://api.nylas.com";versioned=false;Storage;hosted=false;multiAccount=false;loginId="";constructor(e){this.clientId=e.clientId;this.redirectUri=e.redirectUri;if(e.domain){this.domain=e.domain;const t=this.domain.substring(this.domain.length-3);if(t.includes("/v")){this.versioned=true}}if(e.multiAccount){this.multiAccount=e.multiAccount}if(e.sw){const e=new O;this.Storage=new j(e)}else{this.Storage=new j}if(e.accessType){this.accessType=e.accessType}if(e.loginId){this.loginId=e.loginId}if(e.hosted){this.hosted=e.hosted}if(e.disableInitCodeExchange!==true){this.codeExchange(null)}}async validateAccessToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{access_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?access_token=${n}`,{method:"GET"});const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}async validateIDToken(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const{id_token:n}=t;try{const e=await fetch(`${this.domain}/connect/tokeninfo?id_token=${n}`,{method:"GET"});if(e.status!==200){return false}const t=await e.json();if(!t.data){return false}return true}catch(e){return false}}getDomain(){return this.domain}async auth(e){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){await this.hostedSetCodeChallenge()}const t=await this.generateAuthURL(e);if(e.popup){this.popUp(t);return}return t}async generateAuthURL(e){const t=await this.getCodeChallege();let n=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(t){n+=`&code_challenge=${t}&code_challenge_method=S256&options=rotate_refresh_token`}if(e.provider){n+=`&provider=${e.provider}`}if(e.loginHint){n+=`&login_hint=${e.loginHint}`;if(e.includeGrantScopes){n+=`&include_grant_scopes=${e.includeGrantScopes}`}}if(e.scope){n+=`&scope=${e.scope.join(" ")}`}if(e.prompt){n+=`&prompt=${e.prompt}`}if(e.metadata){n+=`&metadata=${e.metadata}`}if(e.state||this.loginId){n+=`&state=${this.loginId?this.loginId:e.state}`}return n}async generateReauthURL(e,t){if(!e){throw new Error("Grant ID is required")}const n=await this.Storage.getUserToken(e);const r=await this.getCodeChallege();let i=`${this.domain}/connect/auth?client_id=${this.clientId}&redirect_uri=${this.redirectUri}&access_type=${this.accessType}&response_type=code`;if(r){i+=`&code_challenge=${r}&code_challenge_method=S256&options=rotate_refresh_token`}if(n?.provider){i+=`&provider=${n.provider}`}if(n?.email){i+=`&login_hint=${n.email}`}if(t){i+=`&scope=${t.join(" ")}`}return i}async generateCodeChallenge(){const e=await this.Storage.getPKCE();if(e){return}const t=le();this.Storage.setPKCE(t);return}async hostedSetCodeChallenge(){if(!this.hosted){throw console.error("Method only used with hosted flag enabled")}const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){const e=await this.Storage.getPKCE();if(e){return}console.warn("Code challenge is recomended");return}this.Storage.setPKCE(t)}async getCodeChallege(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){const e=new URLSearchParams(globalThis.window?.location.search);const t=e.get("code_challenge");if(!t){console.warn("Code challenge is recomended");return""}return t}const e=await this.Storage.getPKCE();if(e){const t=await je(e);let n=btoa(unescape(encodeURIComponent(t)));n=Te(n);return n}return""}async isLoggedIn(){if(this.hosted&&(this.domain===globalThis.window?.location.origin||this.versioned&&this.domain.includes(globalThis.window?.location.origin))){return false}const e=await this.Storage.getUserTokens();if(e&&e.length>0){if(this.multiAccount){await this.generateCodeChallenge()}return true}await this.generateCodeChallenge();return false}isMultiAccount(){return this.multiAccount}async logout(){const e=await this.getProfile();await this.Storage.clearSession();const t={detail:e};window.dispatchEvent(new CustomEvent("onLogoutSuccess",t))}async getProfile(e=""){let t;if(e){t=await this.Storage.getUserToken(e)}else{t=await this.Storage.getUserToken()}if(t){return t}return null}async getProfiles(){const e=await this.Storage.getUserTokens();if(e){return e}return null}async removeProfile(e){await this.Storage.removeUserToken(e);await this.Storage.removeGrant(e);return null}async authIMAP(e){const t=await this.getCodeChallege();const n={imap_username:e.imap_username,imap_password:e.imap_password,imap_host:e.imap_host,imap_port:e.imap_port,type:e.type,smtp_host:e.smtp_host,smtp_port:e.smtp_port,provider:e.provider,redirect_uri:this.redirectUri,state:e.state,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(e.smtp_username&&e.smtp_password){n.smtp_username=e.smtp_username;n.smtp_password=e.smtp_password}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const r=await fetch(`${this.domain}/connect/login/imap`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const i=await r.json();return i}async authEWS(e){const t=await this.getCodeChallege();const n={...e,provider:"ews",redirect_uri:this.redirectUri,public_application_id:this.clientId,access_type:this.accessType};if(this.loginId){n.id=this.loginId}if(t!=""){n.code_challenge=t;n.code_challenge_method="S256"}const r=await fetch(`${this.domain}/connect/login/ews`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(n)});const i=await r.json();return i}async detectEmail(e){const t=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/providers/detect?client_id=${this.clientId}&email=${e}`,{method:"POST",headers:new Headers({"content-type":"application/json"})});const n=await t.json();return n}async applicationInfo(){const e=await fetch(`${this.versioned?this.domain:this.domain+"/connect"}/applications?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});const t=await e.json();return t.data}async getAvailableProviders(){const e=await fetch(`${this.domain}/connect/providers/find?client_id=${this.clientId}`,{method:"GET",headers:new Headers({"content-type":"application/json"})});if(e){const t=await e.json();const n=t.data;return n}return null}onLoginSuccess(e){window.addEventListener("onLoginSuccess",(t=>e(t)))}onLogoutSuccess(e){window.addEventListener("onLogoutSuccess",(t=>e(t)))}onLoginFail(e){window.addEventListener("onLoginFail",(t=>e(t)))}onTokenRefreshSuccess(e){window.addEventListener("onTokenRefreshSuccess",(t=>e(t)))}onTokenRefreshFail(e){window.addEventListener("onTokenRefreshFail",(t=>e(t)))}onSessionExpired(e){window.addEventListener("onSessionExpired",(t=>e(t)))}async codeExchange(e){let t=new URLSearchParams(globalThis.window?.location.search);if(e){t=new URLSearchParams(e)}const n=t.get("code");const r=t.get("state");const i=t.get("error");const o=t.get("error_description");const a=t.get("error_code");if(i&&o&&a){const e={detail:{error:i,error_description:o,error_code:a}};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}if(!n){console.warn("No code found");return false}if(window.opener&&window.name==="uas-popup"){console.warn("Popup window detected");return false}const s=await this.Storage.getPKCE();if(!s){console.warn("No code verifier found");return false}try{const e={client_id:this.clientId,redirect_uri:this.redirectUri,code:n,grant_type:"authorization_code",code_verifier:s};const t=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(e)});const i=await t.json();if(i){if(i.error){const e={detail:i};window.dispatchEvent(new CustomEvent("onLoginFail",e));return true}const e=await this.handleCodeExchangeResponse(i);if(!e.valid){const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginFail",t));return true}else{if(r){e.data.state=r}const t={detail:e.data};window.dispatchEvent(new CustomEvent("onLoginSuccess",t));window.history.pushState({},document.title,window.location.pathname)}}this.Storage.removePKCE();return true}catch(i){const e={detail:i};window.dispatchEvent(new CustomEvent("onLoginFail",e));window.history.pushState({},document.title,globalThis.window?.location.pathname);return false}}async tokenExchange(e=""){const t=await this.Storage.getGrant(e,this.multiAccount);if(!t){return false}const n=t.refresh_token;try{const t={client_id:this.clientId,redirect_uri:this.redirectUri,refresh_token:n,grant_type:"refresh_token"};const r=await fetch(`${this.domain}/connect/token`,{method:"POST",headers:new Headers({"content-type":"application/json"}),body:JSON.stringify(t)});const i=await r.json();if(i){if(i.error){const e={detail:i};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const t=$e();i.expires_in=t+i.expires_in;this.Storage.setGrant(i,this.multiAccount);const n=await this.validateIDToken(e);if(!n){const e={detail:i};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",e));return true}const r={detail:i};window.dispatchEvent(new CustomEvent("onTokenRefreshSuccess",r));return true}this.Storage.removePKCE()}catch(e){const t={detail:e};window.dispatchEvent(new CustomEvent("onTokenRefreshFail",t));return false}}async handleCodeExchangeResponse(e){const t=true;if(e.error){return{data:e,valid:false}}const n=$e();e.expires_in=n+e.expires_in;this.Storage.setGrant(e,this.multiAccount);const r=Ue(e.id_token);r.status="authenticated";this.Storage.setUserToken(r);const i=await this.validateIDToken(r.sub);if(!i){return{data:e,valid:false}}return{data:e,valid:t}}async popUp(e){const t=500;const n=600;const r=window.screenX+(window.outerWidth-t)/2;const i=window.screenY+(window.outerHeight-n)/2.5;const o=`uas-popup`;const a=e;const s=window.open(a,o,`width=${t},height=${n},left=${r},top=${i}`);if(!s){return}const c=setInterval((async()=>{if(s.closed){const e={detail:{error_description:"OAuth provider window closed"}};window.dispatchEvent(new CustomEvent("onLoginFail",e));c&&clearInterval(c);return}try{const e=s.location.href.split("?");if(!e[0]){return}const t=s.location.search;s.history.pushState({},document.title,window.location.pathname);if(e[0]===this.redirectUri&&e.length>1){const e=await this.codeExchange(t);s.close();if(e){location.reload()}c&&clearInterval(c);return}}catch(e){return}}),1e3)}async getAccessToken(e=""){const t=$e();const n=await this.Storage.getGrant(e,this.multiAccount);if(!n){return null}const{access_token:r,expires_in:i}=n;const o=r;if(o){if(i&&i>$e()){const e=i-t;if(e>30){return o}}}await this.tokenExchange(e);const a=await this.Storage.getGrant(e,this.multiAccount);return a.access_token}async sse(e,t){const n=t.headers||{};const r=n["Grant-ID"];let i="";if(this.multiAccount){if(!r){this.logout();throw new Error("Grant ID is required for multi account calls")}i=await this.getAccessToken(r)}else{i=await this.getAccessToken()}delete n["Grant-ID"];n["Authorization"]=`Bearer ${i}`;if(!n["content-type"]){n["content-type"]="application/json"}return xe(`${this.domain}/${e}`,{...t,headers:n})}async fetch(e,t,n=true,r){let i="";let o=1;if(this.multiAccount){if(!t.grant_id){this.logout();throw new Error("Grant ID is required for multi account calls")}const e=await this.getProfiles();o=e?e.length:1;i=await this.getAccessToken(t.grant_id)}else{i=await this.getAccessToken()}if(!i){throw new Error("Access token not found")}let a=t.headers;if(!Headers.prototype.isPrototypeOf(a)){a=new Headers({Authorization:`Bearer ${i}`,"content-type":"application/json"})}else{a.append("Authorization",`Bearer ${i}`);if(!a.has("content-type")){a.append("content-type","application/json")}}try{if(t?.body){t.body=JSON.stringify(t?.body)}const i=await fetch(`${r||this.domain}/${e}`,{...t,headers:a});if(!n){return i}const s=await(i?.json());const c=await this.isAuthenticatedResponse(i.status,s);if(!c){if(o>1){const e=await this.getProfile(t.grant_id);if(e){e.status="unauthorized";await this.Storage.setUserToken(e);const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}}else{const e=await this.Storage.getUserToken();const t={detail:{user:e}};window.dispatchEvent(new CustomEvent("onSessionExpired",t))}this.logout();return}return s}catch(e){throw e}}async fetchRequest(e,t,n,r=true,i,o){const a=await this.isLoggedIn();const s=new URL(e,i??this.domain);const c=new Headers;c.append("Accept","application/json");c.append("Content-Type","application/json");c.append("User-Agent","nylas-identity");if(a){const e=await this.getAccessToken();c.append("Authorization",`Bearer ${e}`)}const l=await fetch(s.toString(),{method:t||"GET",headers:c,mode:"cors",referrer:globalThis.window?.location.origin,body:n?JSON.stringify(n):undefined,...o||{}});if(!r){return l.body}const u=await l.json();return u}async isAuthenticatedResponse(e,t){if(e==401&&t?.error?.type=="token.unauthorized_access"){return false}return true}addAPIKey(e,t,n){this.Storage.setUserToken({aud:"https://api-staging.us.nylas.com/",exp:2e9,email_verified:true,iat:$e(),iss:"",email:t,provider:"virtual-calendar",status:"authenticated",name:t,sub:e});this.Storage.setGrant({grant_id:e,access_token:n,expires_in:2e9},this.multiAccount)}}var qe={exports:{}};var Ne={};
2
2
  /**
3
3
  * @license React
4
4
  * react.production.min.js
@@ -7,7 +7,7 @@ import{h as e,F as t,r as n,a as r,d as i,e as a}from"./index-B-KMpdMZ.js";impor
7
7
  *
8
8
  * This source code is licensed under the MIT license found in the
9
9
  * LICENSE file in the root directory of this source tree.
10
- */var De;function ze(){if(De)return Ne;De=1;"use strict";var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),a=Symbol.for("react.provider"),o=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),f=Symbol.iterator;function d(e){if(null===e||"object"!==typeof e)return null;e=f&&e[f]||e["@@iterator"];return"function"===typeof e?e:null}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p=Object.assign,y={};function v(e,t,n){this.props=e;this.context=t;this.refs=y;this.updater=n||h}v.prototype.isReactComponent={};v.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function g(){}g.prototype=v.prototype;function m(e,t,n){this.props=e;this.context=t;this.refs=y;this.updater=n||h}var b=m.prototype=new g;b.constructor=m;p(b,v.prototype);b.isPureReactComponent=!0;var w=Array.isArray,_=Object.prototype.hasOwnProperty,k={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function C(t,n,r){var i,a={},o=null,s=null;if(null!=n)for(i in void 0!==n.ref&&(s=n.ref),void 0!==n.key&&(o=""+n.key),n)_.call(n,i)&&!E.hasOwnProperty(i)&&(a[i]=n[i]);var c=arguments.length-2;if(1===c)a.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];a.children=l}if(t&&t.defaultProps)for(i in c=t.defaultProps,c)void 0===a[i]&&(a[i]=c[i]);return{$$typeof:e,type:t,key:o,ref:s,props:a,_owner:k.current}}function x(t,n){return{$$typeof:e,type:t.type,key:n,ref:t.ref,props:t.props,_owner:t._owner}}function S(t){return"object"===typeof t&&null!==t&&t.$$typeof===e}function T(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}var R=/\/+/g;function $(e,t){return"object"===typeof e&&null!==e&&null!=e.key?T(""+e.key):t.toString(36)}function O(n,r,i,a,o){var s=typeof n;if("undefined"===s||"boolean"===s)n=null;var c=!1;if(null===n)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(n.$$typeof){case e:case t:c=!0}}if(c)return c=n,o=o(c),n=""===a?"."+$(c,0):a,w(o)?(i="",null!=n&&(i=n.replace(R,"$&/")+"/"),O(o,r,i,"",(function(e){return e}))):null!=o&&(S(o)&&(o=x(o,i+(!o.key||c&&c.key===o.key?"":(""+o.key).replace(R,"$&/")+"/")+n)),r.push(o)),1;c=0;a=""===a?".":a+":";if(w(n))for(var l=0;l<n.length;l++){s=n[l];var u=a+$(s,l);c+=O(s,r,i,u,o)}else if(u=d(n),"function"===typeof u)for(n=u.call(n),l=0;!(s=n.next()).done;)s=s.value,u=a+$(s,l++),c+=O(s,r,i,u,o);else if("object"===s)throw r=String(n),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(n).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.");return c}function j(e,t,n){if(null==e)return e;var r=[],i=0;O(e,r,"","",(function(e){return t.call(n,e,i++)}));return r}function I(e){if(-1===e._status){var t=e._result;t=t();t.then((function(t){if(0===e._status||-1===e._status)e._status=1,e._result=t}),(function(t){if(0===e._status||-1===e._status)e._status=2,e._result=t}));-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var P={current:null},A={transition:null},U={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:A,ReactCurrentOwner:k};Ne.Children={map:j,forEach:function(e,t,n){j(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;j(e,(function(){t++}));return t},toArray:function(e){return j(e,(function(e){return e}))||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ne.Component=v;Ne.Fragment=n;Ne.Profiler=i;Ne.PureComponent=m;Ne.StrictMode=r;Ne.Suspense=c;Ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U;Ne.cloneElement=function(t,n,r){if(null===t||void 0===t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=p({},t.props),a=t.key,o=t.ref,s=t._owner;if(null!=n){void 0!==n.ref&&(o=n.ref,s=k.current);void 0!==n.key&&(a=""+n.key);if(t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(l in n)_.call(n,l)&&!E.hasOwnProperty(l)&&(i[l]=void 0===n[l]&&void 0!==c?c[l]:n[l])}var l=arguments.length-2;if(1===l)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:e,type:t.type,key:a,ref:o,props:i,_owner:s}};Ne.createContext=function(e){e={$$typeof:o,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};e.Provider={$$typeof:a,_context:e};return e.Consumer=e};Ne.createElement=C;Ne.createFactory=function(e){var t=C.bind(null,e);t.type=e;return t};Ne.createRef=function(){return{current:null}};Ne.forwardRef=function(e){return{$$typeof:s,render:e}};Ne.isValidElement=S;Ne.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:I}};Ne.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}};Ne.startTransition=function(e){var t=A.transition;A.transition={};try{e()}finally{A.transition=t}};Ne.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Ne.useCallback=function(e,t){return P.current.useCallback(e,t)};Ne.useContext=function(e){return P.current.useContext(e)};Ne.useDebugValue=function(){};Ne.useDeferredValue=function(e){return P.current.useDeferredValue(e)};Ne.useEffect=function(e,t){return P.current.useEffect(e,t)};Ne.useId=function(){return P.current.useId()};Ne.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)};Ne.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)};Ne.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)};Ne.useMemo=function(e,t){return P.current.useMemo(e,t)};Ne.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)};Ne.useRef=function(e){return P.current.useRef(e)};Ne.useState=function(e){return P.current.useState(e)};Ne.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)};Ne.useTransition=function(){return P.current.useTransition()};Ne.version="18.2.0";return Ne}var Be={exports:{}};
10
+ */var De;function ze(){if(De)return Ne;De=1;"use strict";var e=Symbol.for("react.element"),t=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.provider"),a=Symbol.for("react.context"),s=Symbol.for("react.forward_ref"),c=Symbol.for("react.suspense"),l=Symbol.for("react.memo"),u=Symbol.for("react.lazy"),f=Symbol.iterator;function d(e){if(null===e||"object"!==typeof e)return null;e=f&&e[f]||e["@@iterator"];return"function"===typeof e?e:null}var h={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},p=Object.assign,y={};function v(e,t,n){this.props=e;this.context=t;this.refs=y;this.updater=n||h}v.prototype.isReactComponent={};v.prototype.setState=function(e,t){if("object"!==typeof e&&"function"!==typeof e&&null!=e)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};v.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function g(){}g.prototype=v.prototype;function b(e,t,n){this.props=e;this.context=t;this.refs=y;this.updater=n||h}var m=b.prototype=new g;m.constructor=b;p(m,v.prototype);m.isPureReactComponent=!0;var w=Array.isArray,_=Object.prototype.hasOwnProperty,k={current:null},E={key:!0,ref:!0,__self:!0,__source:!0};function C(t,n,r){var i,o={},a=null,s=null;if(null!=n)for(i in void 0!==n.ref&&(s=n.ref),void 0!==n.key&&(a=""+n.key),n)_.call(n,i)&&!E.hasOwnProperty(i)&&(o[i]=n[i]);var c=arguments.length-2;if(1===c)o.children=r;else if(1<c){for(var l=Array(c),u=0;u<c;u++)l[u]=arguments[u+2];o.children=l}if(t&&t.defaultProps)for(i in c=t.defaultProps,c)void 0===o[i]&&(o[i]=c[i]);return{$$typeof:e,type:t,key:a,ref:s,props:o,_owner:k.current}}function x(t,n){return{$$typeof:e,type:t.type,key:n,ref:t.ref,props:t.props,_owner:t._owner}}function S(t){return"object"===typeof t&&null!==t&&t.$$typeof===e}function T(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,(function(e){return t[e]}))}var R=/\/+/g;function $(e,t){return"object"===typeof e&&null!==e&&null!=e.key?T(""+e.key):t.toString(36)}function j(n,r,i,o,a){var s=typeof n;if("undefined"===s||"boolean"===s)n=null;var c=!1;if(null===n)c=!0;else switch(s){case"string":case"number":c=!0;break;case"object":switch(n.$$typeof){case e:case t:c=!0}}if(c)return c=n,a=a(c),n=""===o?"."+$(c,0):o,w(a)?(i="",null!=n&&(i=n.replace(R,"$&/")+"/"),j(a,r,i,"",(function(e){return e}))):null!=a&&(S(a)&&(a=x(a,i+(!a.key||c&&c.key===a.key?"":(""+a.key).replace(R,"$&/")+"/")+n)),r.push(a)),1;c=0;o=""===o?".":o+":";if(w(n))for(var l=0;l<n.length;l++){s=n[l];var u=o+$(s,l);c+=j(s,r,i,u,a)}else if(u=d(n),"function"===typeof u)for(n=u.call(n),l=0;!(s=n.next()).done;)s=s.value,u=o+$(s,l++),c+=j(s,r,i,u,a);else if("object"===s)throw r=String(n),Error("Objects are not valid as a React child (found: "+("[object Object]"===r?"object with keys {"+Object.keys(n).join(", ")+"}":r)+"). If you meant to render a collection of children, use an array instead.");return c}function O(e,t,n){if(null==e)return e;var r=[],i=0;j(e,r,"","",(function(e){return t.call(n,e,i++)}));return r}function I(e){if(-1===e._status){var t=e._result;t=t();t.then((function(t){if(0===e._status||-1===e._status)e._status=1,e._result=t}),(function(t){if(0===e._status||-1===e._status)e._status=2,e._result=t}));-1===e._status&&(e._status=0,e._result=t)}if(1===e._status)return e._result.default;throw e._result}var P={current:null},A={transition:null},U={ReactCurrentDispatcher:P,ReactCurrentBatchConfig:A,ReactCurrentOwner:k};Ne.Children={map:O,forEach:function(e,t,n){O(e,(function(){t.apply(this,arguments)}),n)},count:function(e){var t=0;O(e,(function(){t++}));return t},toArray:function(e){return O(e,(function(e){return e}))||[]},only:function(e){if(!S(e))throw Error("React.Children.only expected to receive a single React element child.");return e}};Ne.Component=v;Ne.Fragment=n;Ne.Profiler=i;Ne.PureComponent=b;Ne.StrictMode=r;Ne.Suspense=c;Ne.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=U;Ne.cloneElement=function(t,n,r){if(null===t||void 0===t)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var i=p({},t.props),o=t.key,a=t.ref,s=t._owner;if(null!=n){void 0!==n.ref&&(a=n.ref,s=k.current);void 0!==n.key&&(o=""+n.key);if(t.type&&t.type.defaultProps)var c=t.type.defaultProps;for(l in n)_.call(n,l)&&!E.hasOwnProperty(l)&&(i[l]=void 0===n[l]&&void 0!==c?c[l]:n[l])}var l=arguments.length-2;if(1===l)i.children=r;else if(1<l){c=Array(l);for(var u=0;u<l;u++)c[u]=arguments[u+2];i.children=c}return{$$typeof:e,type:t.type,key:o,ref:a,props:i,_owner:s}};Ne.createContext=function(e){e={$$typeof:a,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};e.Provider={$$typeof:o,_context:e};return e.Consumer=e};Ne.createElement=C;Ne.createFactory=function(e){var t=C.bind(null,e);t.type=e;return t};Ne.createRef=function(){return{current:null}};Ne.forwardRef=function(e){return{$$typeof:s,render:e}};Ne.isValidElement=S;Ne.lazy=function(e){return{$$typeof:u,_payload:{_status:-1,_result:e},_init:I}};Ne.memo=function(e,t){return{$$typeof:l,type:e,compare:void 0===t?null:t}};Ne.startTransition=function(e){var t=A.transition;A.transition={};try{e()}finally{A.transition=t}};Ne.unstable_act=function(){throw Error("act(...) is not supported in production builds of React.")};Ne.useCallback=function(e,t){return P.current.useCallback(e,t)};Ne.useContext=function(e){return P.current.useContext(e)};Ne.useDebugValue=function(){};Ne.useDeferredValue=function(e){return P.current.useDeferredValue(e)};Ne.useEffect=function(e,t){return P.current.useEffect(e,t)};Ne.useId=function(){return P.current.useId()};Ne.useImperativeHandle=function(e,t,n){return P.current.useImperativeHandle(e,t,n)};Ne.useInsertionEffect=function(e,t){return P.current.useInsertionEffect(e,t)};Ne.useLayoutEffect=function(e,t){return P.current.useLayoutEffect(e,t)};Ne.useMemo=function(e,t){return P.current.useMemo(e,t)};Ne.useReducer=function(e,t,n){return P.current.useReducer(e,t,n)};Ne.useRef=function(e){return P.current.useRef(e)};Ne.useState=function(e){return P.current.useState(e)};Ne.useSyncExternalStore=function(e,t,n){return P.current.useSyncExternalStore(e,t,n)};Ne.useTransition=function(){return P.current.useTransition()};Ne.version="18.2.0";return Ne}var Fe={exports:{}};
11
11
  /**
12
12
  * @license React
13
13
  * react.development.js
@@ -16,5 +16,5 @@ import{h as e,F as t,r as n,a as r,d as i,e as a}from"./index-B-KMpdMZ.js";impor
16
16
  *
17
17
  * This source code is licensed under the MIT license found in the
18
18
  * LICENSE file in the root directory of this source tree.
19
- */var Fe=Be.exports;var Me;function Ge(){if(Me)return Be.exports;Me=1;(function(e,t){"use strict";if("development"!=="production"){(function(){"use strict";if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!=="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"){__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error)}var n="18.2.0";var r=Symbol.for("react.element");var i=Symbol.for("react.portal");var a=Symbol.for("react.fragment");var o=Symbol.for("react.strict_mode");var s=Symbol.for("react.profiler");var c=Symbol.for("react.provider");var l=Symbol.for("react.context");var u=Symbol.for("react.forward_ref");var f=Symbol.for("react.suspense");var d=Symbol.for("react.suspense_list");var h=Symbol.for("react.memo");var p=Symbol.for("react.lazy");var y=Symbol.for("react.offscreen");var v=Symbol.iterator;var g="@@iterator";function m(e){if(e===null||typeof e!=="object"){return null}var t=v&&e[v]||e[g];if(typeof t==="function"){return t}return null}var b={current:null};var w={transition:null};var _={current:null,isBatchingLegacy:false,didScheduleLegacyUpdate:false};var k={current:null};var E={};var C=null;function x(e){{C=e}}{E.setExtraStackFrame=function(e){{C=e}};E.getCurrentStack=null;E.getStackAddendum=function(){var e="";if(C){e+=C}var t=E.getCurrentStack;if(t){e+=t()||""}return e}}var S=false;var T=false;var R=false;var $=false;var O=false;var j={ReactCurrentDispatcher:b,ReactCurrentBatchConfig:w,ReactCurrentOwner:k};{j.ReactDebugCurrentFrame=E;j.ReactCurrentActQueue=_}function I(e){{{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}A("warn",e,n)}}}function P(e){{{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}A("error",e,n)}}}function A(e,t,n){{var r=j.ReactDebugCurrentFrame;var i=r.getStackAddendum();if(i!==""){t+="%s";n=n.concat([i])}var a=n.map((function(e){return String(e)}));a.unshift("Warning: "+t);Function.prototype.apply.call(console[e],console,a)}}var U={};function L(e,t){{var n=e.constructor;var r=n&&(n.displayName||n.name)||"ReactClass";var i=r+"."+t;if(U[i]){return}P("Can't call %s on a component that is not yet mounted. "+"This is a no-op, but it might indicate a bug in your application. "+"Instead, assign to `this.state` directly or define a `state = {};` "+"class property with the desired state in the %s component.",t,r);U[i]=true}}var q={isMounted:function(e){return false},enqueueForceUpdate:function(e,t,n){L(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){L(e,"replaceState")},enqueueSetState:function(e,t,n,r){L(e,"setState")}};var N=Object.assign;var D={};{Object.freeze(D)}function z(e,t,n){this.props=e;this.context=t;this.refs=D;this.updater=n||q}z.prototype.isReactComponent={};z.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null){throw new Error("setState(...): takes an object of state variables to update or a "+"function which returns an object of state variables.")}this.updater.enqueueSetState(this,e,t,"setState")};z.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};{var B={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in "+"componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see "+"https://github.com/facebook/react/issues/3236)."]};var F=function(e,t){Object.defineProperty(z.prototype,e,{get:function(){I("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1]);return undefined}})};for(var M in B){if(B.hasOwnProperty(M)){F(M,B[M])}}}function G(){}G.prototype=z.prototype;function H(e,t,n){this.props=e;this.context=t;this.refs=D;this.updater=n||q}var Y=H.prototype=new G;Y.constructor=H;N(Y,z.prototype);Y.isPureReactComponent=true;function V(){var e={current:null};{Object.seal(e)}return e}var J=Array.isArray;function K(e){return J(e)}function W(e){{var t=typeof Symbol==="function"&&Symbol.toStringTag;var n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function X(e){{try{Z(e);return false}catch(e){return true}}}function Z(e){return""+e}function Q(e){{if(X(e)){P("The provided key is an unsupported type %s."+" This value must be coerced to a string before before using it here.",W(e));return Z(e)}}}function ee(e,t,n){var r=e.displayName;if(r){return r}var i=t.displayName||t.name||"";return i!==""?n+"("+i+")":n}function te(e){return e.displayName||"Context"}function ne(e){if(e==null){return null}{if(typeof e.tag==="number"){P("Received an unexpected object in getComponentNameFromType(). "+"This is likely a bug in React. Please file an issue.")}}if(typeof e==="function"){return e.displayName||e.name||null}if(typeof e==="string"){return e}switch(e){case a:return"Fragment";case i:return"Portal";case s:return"Profiler";case o:return"StrictMode";case f:return"Suspense";case d:return"SuspenseList"}if(typeof e==="object"){switch(e.$$typeof){case l:var t=e;return te(t)+".Consumer";case c:var n=e;return te(n._context)+".Provider";case u:return ee(e,e.render,"ForwardRef");case h:var r=e.displayName||null;if(r!==null){return r}return ne(e.type)||"Memo";case p:{var y=e;var v=y._payload;var g=y._init;try{return ne(g(v))}catch(e){return null}}}}return null}var re=Object.prototype.hasOwnProperty;var ie={key:true,ref:true,__self:true,__source:true};var ae,oe,se;{se={}}function ce(e){{if(re.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning){return false}}}return e.ref!==undefined}function le(e){{if(re.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning){return false}}}return e.key!==undefined}function ue(e,t){var n=function(){{if(!ae){ae=true;P("%s: `key` is not a prop. Trying to access it will result "+"in `undefined` being returned. If you need to access the same "+"value within the child component, you should pass it as a different "+"prop. (https://reactjs.org/link/special-props)",t)}}};n.isReactWarning=true;Object.defineProperty(e,"key",{get:n,configurable:true})}function fe(e,t){var n=function(){{if(!oe){oe=true;P("%s: `ref` is not a prop. Trying to access it will result "+"in `undefined` being returned. If you need to access the same "+"value within the child component, you should pass it as a different "+"prop. (https://reactjs.org/link/special-props)",t)}}};n.isReactWarning=true;Object.defineProperty(e,"ref",{get:n,configurable:true})}function de(e){{if(typeof e.ref==="string"&&k.current&&e.__self&&k.current.stateNode!==e.__self){var t=ne(k.current.type);if(!se[t]){P('Component "%s" contains the string ref "%s". '+"Support for string refs will be removed in a future major release. "+"This case cannot be automatically converted to an arrow function. "+"We ask you to manually fix this case by using useRef() or createRef() instead. "+"Learn more about using refs safely here: "+"https://reactjs.org/link/strict-mode-string-ref",t,e.ref);se[t]=true}}}}var he=function(e,t,n,i,a,o,s){var c={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:o};{c._store={};Object.defineProperty(c._store,"validated",{configurable:false,enumerable:false,writable:true,value:false});Object.defineProperty(c,"_self",{configurable:false,enumerable:false,writable:false,value:i});Object.defineProperty(c,"_source",{configurable:false,enumerable:false,writable:false,value:a});if(Object.freeze){Object.freeze(c.props);Object.freeze(c)}}return c};function pe(e,t,n){var r;var i={};var a=null;var o=null;var s=null;var c=null;if(t!=null){if(ce(t)){o=t.ref;{de(t)}}if(le(t)){{Q(t.key)}a=""+t.key}s=t.__self===undefined?null:t.__self;c=t.__source===undefined?null:t.__source;for(r in t){if(re.call(t,r)&&!ie.hasOwnProperty(r)){i[r]=t[r]}}}var l=arguments.length-2;if(l===1){i.children=n}else if(l>1){var u=Array(l);for(var f=0;f<l;f++){u[f]=arguments[f+2]}{if(Object.freeze){Object.freeze(u)}}i.children=u}if(e&&e.defaultProps){var d=e.defaultProps;for(r in d){if(i[r]===undefined){i[r]=d[r]}}}{if(a||o){var h=typeof e==="function"?e.displayName||e.name||"Unknown":e;if(a){ue(i,h)}if(o){fe(i,h)}}}return he(e,a,o,s,c,k.current,i)}function ye(e,t){var n=he(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n}function ve(e,t,n){if(e===null||e===undefined){throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".")}var r;var i=N({},e.props);var a=e.key;var o=e.ref;var s=e._self;var c=e._source;var l=e._owner;if(t!=null){if(ce(t)){o=t.ref;l=k.current}if(le(t)){{Q(t.key)}a=""+t.key}var u;if(e.type&&e.type.defaultProps){u=e.type.defaultProps}for(r in t){if(re.call(t,r)&&!ie.hasOwnProperty(r)){if(t[r]===undefined&&u!==undefined){i[r]=u[r]}else{i[r]=t[r]}}}}var f=arguments.length-2;if(f===1){i.children=n}else if(f>1){var d=Array(f);for(var h=0;h<f;h++){d[h]=arguments[h+2]}i.children=d}return he(e.type,a,o,s,c,l,i)}function ge(e){return typeof e==="object"&&e!==null&&e.$$typeof===r}var me=".";var be=":";function we(e){var t=/[=:]/g;var n={"=":"=0",":":"=2"};var r=e.replace(t,(function(e){return n[e]}));return"$"+r}var _e=false;var ke=/\/+/g;function Ee(e){return e.replace(ke,"$&/")}function Ce(e,t){if(typeof e==="object"&&e!==null&&e.key!=null){{Q(e.key)}return we(""+e.key)}return t.toString(36)}function xe(e,t,n,a,o){var s=typeof e;if(s==="undefined"||s==="boolean"){e=null}var c=false;if(e===null){c=true}else{switch(s){case"string":case"number":c=true;break;case"object":switch(e.$$typeof){case r:case i:c=true}}}if(c){var l=e;var u=o(l);var f=a===""?me+Ce(l,0):a;if(K(u)){var d="";if(f!=null){d=Ee(f)+"/"}xe(u,t,d,"",(function(e){return e}))}else if(u!=null){if(ge(u)){{if(u.key&&(!l||l.key!==u.key)){Q(u.key)}}u=ye(u,n+(u.key&&(!l||l.key!==u.key)?Ee(""+u.key)+"/":"")+f)}t.push(u)}return 1}var h;var p;var y=0;var v=a===""?me:a+be;if(K(e)){for(var g=0;g<e.length;g++){h=e[g];p=v+Ce(h,g);y+=xe(h,t,n,p,o)}}else{var b=m(e);if(typeof b==="function"){var w=e;{if(b===w.entries){if(!_e){I("Using Maps as children is not supported. "+"Use an array of keyed ReactElements instead.")}_e=true}}var _=b.call(w);var k;var E=0;while(!(k=_.next()).done){h=k.value;p=v+Ce(h,E++);y+=xe(h,t,n,p,o)}}else if(s==="object"){var C=String(e);throw new Error("Objects are not valid as a React child (found: "+(C==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":C)+"). "+"If you meant to render a collection of children, use an array "+"instead.")}}return y}function Se(e,t,n){if(e==null){return e}var r=[];var i=0;xe(e,r,"","",(function(e){return t.call(n,e,i++)}));return r}function Te(e){var t=0;Se(e,(function(){t++}));return t}function Re(e,t,n){Se(e,(function(){t.apply(this,arguments)}),n)}function $e(e){return Se(e,(function(e){return e}))||[]}function Oe(e){if(!ge(e)){throw new Error("React.Children.only expected to receive a single React element child.")}return e}function je(e){var t={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:c,_context:t};var n=false;var r=false;var i=false;{var a={$$typeof:l,_context:t};Object.defineProperties(a,{Provider:{get:function(){if(!r){r=true;P("Rendering <Context.Consumer.Provider> is not supported and will be removed in "+"a future major release. Did you mean to render <Context.Provider> instead?")}return t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){if(!n){n=true;P("Rendering <Context.Consumer.Consumer> is not supported and will be removed in "+"a future major release. Did you mean to render <Context.Consumer> instead?")}return t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){if(!i){I("Setting `displayName` on Context.Consumer has no effect. "+"You should set it directly on the context with Context.displayName = '%s'.",e);i=true}}}});t.Consumer=a}{t._currentRenderer=null;t._currentRenderer2=null}return t}var Ie=-1;var Pe=0;var Ae=1;var Ue=2;function Le(e){if(e._status===Ie){var t=e._result;var n=t();n.then((function(t){if(e._status===Pe||e._status===Ie){var n=e;n._status=Ae;n._result=t}}),(function(t){if(e._status===Pe||e._status===Ie){var n=e;n._status=Ue;n._result=t}}));if(e._status===Ie){var r=e;r._status=Pe;r._result=n}}if(e._status===Ae){var i=e._result;{if(i===undefined){P("lazy: Expected the result of a dynamic imp"+"ort() call. "+"Instead received: %s\n\nYour code should look like: \n "+"const MyComponent = lazy(() => imp"+"ort('./MyComponent'))\n\n"+"Did you accidentally put curly braces around the import?",i)}}{if(!("default"in i)){P("lazy: Expected the result of a dynamic imp"+"ort() call. "+"Instead received: %s\n\nYour code should look like: \n "+"const MyComponent = lazy(() => imp"+"ort('./MyComponent'))",i)}}return i.default}else{throw e._result}}function qe(e){var t={_status:Ie,_result:e};var n={$$typeof:p,_payload:t,_init:Le};{var r;var i;Object.defineProperties(n,{defaultProps:{configurable:true,get:function(){return r},set:function(e){P("React.lazy(...): It is not supported to assign `defaultProps` to "+"a lazy component import. Either specify them where the component "+"is defined, or create a wrapping component around it.");r=e;Object.defineProperty(n,"defaultProps",{enumerable:true})}},propTypes:{configurable:true,get:function(){return i},set:function(e){P("React.lazy(...): It is not supported to assign `propTypes` to "+"a lazy component import. Either specify them where the component "+"is defined, or create a wrapping component around it.");i=e;Object.defineProperty(n,"propTypes",{enumerable:true})}}})}return n}function Ne(e){{if(e!=null&&e.$$typeof===h){P("forwardRef requires a render function but received a `memo` "+"component. Instead of forwardRef(memo(...)), use "+"memo(forwardRef(...)).")}else if(typeof e!=="function"){P("forwardRef requires a render function but was given %s.",e===null?"null":typeof e)}else{if(e.length!==0&&e.length!==2){P("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined.")}}if(e!=null){if(e.defaultProps!=null||e.propTypes!=null){P("forwardRef render functions do not support propTypes or defaultProps. "+"Did you accidentally pass a React component?")}}}var t={$$typeof:u,render:e};{var n;Object.defineProperty(t,"displayName",{enumerable:false,configurable:true,get:function(){return n},set:function(t){n=t;if(!e.name&&!e.displayName){e.displayName=t}}})}return t}var De;{De=Symbol.for("react.module.reference")}function ze(e){if(typeof e==="string"||typeof e==="function"){return true}if(e===a||e===s||O||e===o||e===f||e===d||$||e===y||S||T||R){return true}if(typeof e==="object"&&e!==null){if(e.$$typeof===p||e.$$typeof===h||e.$$typeof===c||e.$$typeof===l||e.$$typeof===u||e.$$typeof===De||e.getModuleId!==undefined){return true}}return false}function Be(e,t){{if(!ze(e)){P("memo: The first argument must be a component. Instead "+"received: %s",e===null?"null":typeof e)}}var n={$$typeof:h,type:e,compare:t===undefined?null:t};{var r;Object.defineProperty(n,"displayName",{enumerable:false,configurable:true,get:function(){return r},set:function(t){r=t;if(!e.name&&!e.displayName){e.displayName=t}}})}return n}function Fe(){var e=b.current;{if(e===null){P("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for"+" one of the following reasons:\n"+"1. You might have mismatching versions of React and the renderer (such as React DOM)\n"+"2. You might be breaking the Rules of Hooks\n"+"3. You might have more than one copy of React in the same app\n"+"See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.")}}return e}function Me(e){var t=Fe();{if(e._context!==undefined){var n=e._context;if(n.Consumer===e){P("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be "+"removed in a future major release. Did you mean to call useContext(Context) instead?")}else if(n.Provider===e){P("Calling useContext(Context.Provider) is not supported. "+"Did you mean to call useContext(Context) instead?")}}}return t.useContext(e)}function Ge(e){var t=Fe();return t.useState(e)}function He(e,t,n){var r=Fe();return r.useReducer(e,t,n)}function Ye(e){var t=Fe();return t.useRef(e)}function Ve(e,t){var n=Fe();return n.useEffect(e,t)}function Je(e,t){var n=Fe();return n.useInsertionEffect(e,t)}function Ke(e,t){var n=Fe();return n.useLayoutEffect(e,t)}function We(e,t){var n=Fe();return n.useCallback(e,t)}function Xe(e,t){var n=Fe();return n.useMemo(e,t)}function Ze(e,t,n){var r=Fe();return r.useImperativeHandle(e,t,n)}function Qe(e,t){{var n=Fe();return n.useDebugValue(e,t)}}function et(){var e=Fe();return e.useTransition()}function tt(e){var t=Fe();return t.useDeferredValue(e)}function nt(){var e=Fe();return e.useId()}function rt(e,t,n){var r=Fe();return r.useSyncExternalStore(e,t,n)}var it=0;var at;var ot;var st;var ct;var lt;var ut;var ft;function dt(){}dt.__reactDisabledLog=true;function ht(){{if(it===0){at=console.log;ot=console.info;st=console.warn;ct=console.error;lt=console.group;ut=console.groupCollapsed;ft=console.groupEnd;var e={configurable:true,enumerable:true,value:dt,writable:true};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}it++}}function pt(){{it--;if(it===0){var e={configurable:true,enumerable:true,writable:true};Object.defineProperties(console,{log:N({},e,{value:at}),info:N({},e,{value:ot}),warn:N({},e,{value:st}),error:N({},e,{value:ct}),group:N({},e,{value:lt}),groupCollapsed:N({},e,{value:ut}),groupEnd:N({},e,{value:ft})})}if(it<0){P("disabledDepth fell below zero. "+"This is a bug in React. Please file an issue.")}}}var yt=j.ReactCurrentDispatcher;var vt;function gt(e,t,n){{if(vt===undefined){try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);vt=r&&r[1]||""}}return"\n"+vt+e}}var mt=false;var bt;{var wt=typeof WeakMap==="function"?WeakMap:Map;bt=new wt}function _t(e,t){if(!e||mt){return""}{var n=bt.get(e);if(n!==undefined){return n}}var r;mt=true;var i=Error.prepareStackTrace;Error.prepareStackTrace=undefined;var a;{a=yt.current;yt.current=null;ht()}try{if(t){var o=function(){throw Error()};Object.defineProperty(o.prototype,"props",{set:function(){throw Error()}});if(typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(o,[])}catch(e){r=e}Reflect.construct(e,[],o)}else{try{o.call()}catch(e){r=e}e.call(o.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==="string"){var s=t.stack.split("\n");var c=r.stack.split("\n");var l=s.length-1;var u=c.length-1;while(l>=1&&u>=0&&s[l]!==c[u]){u--}for(;l>=1&&u>=0;l--,u--){if(s[l]!==c[u]){if(l!==1||u!==1){do{l--;u--;if(u<0||s[l]!==c[u]){var f="\n"+s[l].replace(" at new "," at ");if(e.displayName&&f.includes("<anonymous>")){f=f.replace("<anonymous>",e.displayName)}{if(typeof e==="function"){bt.set(e,f)}}return f}}while(l>=1&&u>=0)}break}}}}finally{mt=false;{yt.current=a;pt()}Error.prepareStackTrace=i}var d=e?e.displayName||e.name:"";var h=d?gt(d):"";{if(typeof e==="function"){bt.set(e,h)}}return h}function kt(e,t,n){{return _t(e,false)}}function Et(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Ct(e,t,n){if(e==null){return""}if(typeof e==="function"){{return _t(e,Et(e))}}if(typeof e==="string"){return gt(e)}switch(e){case f:return gt("Suspense");case d:return gt("SuspenseList")}if(typeof e==="object"){switch(e.$$typeof){case u:return kt(e.render);case h:return Ct(e.type,t,n);case p:{var r=e;var i=r._payload;var a=r._init;try{return Ct(a(i),t,n)}catch(e){}}}}return""}var xt={};var St=j.ReactDebugCurrentFrame;function Tt(e){{if(e){var t=e._owner;var n=Ct(e.type,e._source,t?t.type:null);St.setExtraStackFrame(n)}else{St.setExtraStackFrame(null)}}}function Rt(e,t,n,r,i){{var a=Function.call.bind(re);for(var o in e){if(a(e,o)){var s=void 0;try{if(typeof e[o]!=="function"){var c=Error((r||"React class")+": "+n+" type `"+o+"` is invalid; "+"it must be a function, usually from the `prop-types` package, but received `"+typeof e[o]+"`."+"This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");c.name="Invariant Violation";throw c}s=e[o](t,o,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}if(s&&!(s instanceof Error)){Tt(i);P("%s: type specification of %s"+" `%s` is invalid; the type checker "+"function must return `null` or an `Error` but returned a %s. "+"You may have forgotten to pass an argument to the type checker "+"creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and "+"shape all require an argument).",r||"React class",n,o,typeof s);Tt(null)}if(s instanceof Error&&!(s.message in xt)){xt[s.message]=true;Tt(i);P("Failed %s type: %s",n,s.message);Tt(null)}}}}}function $t(e){{if(e){var t=e._owner;var n=Ct(e.type,e._source,t?t.type:null);x(n)}else{x(null)}}}var Ot;{Ot=false}function jt(){if(k.current){var e=ne(k.current.type);if(e){return"\n\nCheck the render method of `"+e+"`."}}return""}function It(e){if(e!==undefined){var t=e.fileName.replace(/^.*[\\\/]/,"");var n=e.lineNumber;return"\n\nCheck your code at "+t+":"+n+"."}return""}function Pt(e){if(e!==null&&e!==undefined){return It(e.__source)}return""}var At={};function Ut(e){var t=jt();if(!t){var n=typeof e==="string"?e:e.displayName||e.name;if(n){t="\n\nCheck the top-level render call using <"+n+">."}}return t}function Lt(e,t){if(!e._store||e._store.validated||e.key!=null){return}e._store.validated=true;var n=Ut(t);if(At[n]){return}At[n]=true;var r="";if(e&&e._owner&&e._owner!==k.current){r=" It was passed a child from "+ne(e._owner.type)+"."}{$t(e);P('Each child in a list should have a unique "key" prop.'+"%s%s See https://reactjs.org/link/warning-keys for more information.",n,r);$t(null)}}function qt(e,t){if(typeof e!=="object"){return}if(K(e)){for(var n=0;n<e.length;n++){var r=e[n];if(ge(r)){Lt(r,t)}}}else if(ge(e)){if(e._store){e._store.validated=true}}else if(e){var i=m(e);if(typeof i==="function"){if(i!==e.entries){var a=i.call(e);var o;while(!(o=a.next()).done){if(ge(o.value)){Lt(o.value,t)}}}}}}function Nt(e){{var t=e.type;if(t===null||t===undefined||typeof t==="string"){return}var n;if(typeof t==="function"){n=t.propTypes}else if(typeof t==="object"&&(t.$$typeof===u||t.$$typeof===h)){n=t.propTypes}else{return}if(n){var r=ne(t);Rt(n,e.props,"prop",r,e)}else if(t.PropTypes!==undefined&&!Ot){Ot=true;var i=ne(t);P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}if(typeof t.getDefaultProps==="function"&&!t.getDefaultProps.isReactClassApproved){P("getDefaultProps is only used on classic React.createClass "+"definitions. Use a static property named `defaultProps` instead.")}}}function Dt(e){{var t=Object.keys(e.props);for(var n=0;n<t.length;n++){var r=t[n];if(r!=="children"&&r!=="key"){$t(e);P("Invalid prop `%s` supplied to `React.Fragment`. "+"React.Fragment can only have `key` and `children` props.",r);$t(null);break}}if(e.ref!==null){$t(e);P("Invalid attribute `ref` supplied to `React.Fragment`.");$t(null)}}}function zt(e,t,n){var i=ze(e);if(!i){var o="";if(e===undefined||typeof e==="object"&&e!==null&&Object.keys(e).length===0){o+=" You likely forgot to export your component from the file "+"it's defined in, or you might have mixed up default and named imports."}var s=Pt(t);if(s){o+=s}else{o+=jt()}var c;if(e===null){c="null"}else if(K(e)){c="array"}else if(e!==undefined&&e.$$typeof===r){c="<"+(ne(e.type)||"Unknown")+" />";o=" Did you accidentally export a JSX literal instead of a component?"}else{c=typeof e}{P("React.createElement: type is invalid -- expected a string (for "+"built-in components) or a class/function (for composite "+"components) but got: %s.%s",c,o)}}var l=pe.apply(this,arguments);if(l==null){return l}if(i){for(var u=2;u<arguments.length;u++){qt(arguments[u],e)}}if(e===a){Dt(l)}else{Nt(l)}return l}var Bt=false;function Ft(e){var t=zt.bind(null,e);t.type=e;{if(!Bt){Bt=true;I("React.createFactory() is deprecated and will be removed in "+"a future major release. Consider using JSX "+"or use React.createElement() directly instead.")}Object.defineProperty(t,"type",{enumerable:false,get:function(){I("Factory.type is deprecated. Access the class directly "+"before passing it to createFactory.");Object.defineProperty(this,"type",{value:e});return e}})}return t}function Mt(e,t,n){var r=ve.apply(this,arguments);for(var i=2;i<arguments.length;i++){qt(arguments[i],r.type)}Nt(r);return r}function Gt(e,t){var n=w.transition;w.transition={};var r=w.transition;{w.transition._updatedFibers=new Set}try{e()}finally{w.transition=n;{if(n===null&&r._updatedFibers){var i=r._updatedFibers.size;if(i>10){I("Detected a large number of updates inside startTransition. "+"If this is due to a subscription please re-write it to use React provided hooks. "+"Otherwise concurrent mode guarantees are off the table.")}r._updatedFibers.clear()}}}}var Ht=false;var Yt=null;function Vt(t){if(Yt===null){try{var n=("require"+Math.random()).slice(0,7);var r=e&&e[n];Yt=r.call(e,"timers").setImmediate}catch(e){Yt=function(e){{if(Ht===false){Ht=true;if(typeof MessageChannel==="undefined"){P("This browser does not have a MessageChannel implementation, "+"so enqueuing tasks via await act(async () => ...) will fail. "+"Please file an issue at https://github.com/facebook/react/issues "+"if you encounter this warning.")}}}var t=new MessageChannel;t.port1.onmessage=e;t.port2.postMessage(undefined)}}}return Yt(t)}var Jt=0;var Kt=false;function Wt(e){{var t=Jt;Jt++;if(_.current===null){_.current=[]}var n=_.isBatchingLegacy;var r;try{_.isBatchingLegacy=true;r=e();if(!n&&_.didScheduleLegacyUpdate){var i=_.current;if(i!==null){_.didScheduleLegacyUpdate=false;en(i)}}}catch(e){Xt(t);throw e}finally{_.isBatchingLegacy=n}if(r!==null&&typeof r==="object"&&typeof r.then==="function"){var a=r;var o=false;var s={then:function(e,n){o=true;a.then((function(r){Xt(t);if(Jt===0){Zt(r,e,n)}else{e(r)}}),(function(e){Xt(t);n(e)}))}};{if(!Kt&&typeof Promise!=="undefined"){Promise.resolve().then((function(){})).then((function(){if(!o){Kt=true;P("You called act(async () => ...) without await. "+"This could lead to unexpected testing behaviour, "+"interleaving multiple act calls and mixing their "+"scopes. "+"You should - await act(async () => ...);")}}))}}return s}else{var c=r;Xt(t);if(Jt===0){var l=_.current;if(l!==null){en(l);_.current=null}var u={then:function(e,t){if(_.current===null){_.current=[];Zt(c,e,t)}else{e(c)}}};return u}else{var f={then:function(e,t){e(c)}};return f}}}}function Xt(e){{if(e!==Jt-1){P("You seem to have overlapping act() calls, this is not supported. "+"Be sure to await previous act() calls before making a new one. ")}Jt=e}}function Zt(e,t,n){{var r=_.current;if(r!==null){try{en(r);Vt((function(){if(r.length===0){_.current=null;t(e)}else{Zt(e,t,n)}}))}catch(e){n(e)}}else{t(e)}}}var Qt=false;function en(e){{if(!Qt){Qt=true;var t=0;try{for(;t<e.length;t++){var n=e[t];do{n=n(true)}while(n!==null)}e.length=0}catch(n){e=e.slice(t+1);throw n}finally{Qt=false}}}}var tn=zt;var nn=Mt;var rn=Ft;var an={map:Se,forEach:Re,count:Te,toArray:$e,only:Oe};t.Children=an;t.Component=z;t.Fragment=a;t.Profiler=s;t.PureComponent=H;t.StrictMode=o;t.Suspense=f;t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=j;t.cloneElement=nn;t.createContext=je;t.createElement=tn;t.createFactory=rn;t.createRef=V;t.forwardRef=Ne;t.isValidElement=ge;t.lazy=qe;t.memo=Be;t.startTransition=Gt;t.unstable_act=Wt;t.useCallback=We;t.useContext=Me;t.useDebugValue=Qe;t.useDeferredValue=tt;t.useEffect=Ve;t.useId=nt;t.useImperativeHandle=Ze;t.useInsertionEffect=Je;t.useLayoutEffect=Ke;t.useMemo=Xe;t.useReducer=He;t.useRef=Ye;t.useState=Ge;t.useSyncExternalStore=rt;t.useTransition=et;t.version=n;if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!=="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"){__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}})()}})(Be,Be.exports);return Be.exports}var He=qe.exports;var Ye;function Ve(){if(Ye)return qe.exports;Ye=1;"use strict";if("development"==="production"){qe.exports=ze()}else{qe.exports=Ge()}return qe.exports}var Je=Ve();var Ke=p(Je);function We(e){const[t,n]=Je.useState(false);Je.useEffect((()=>{const t=async()=>{const t=await e.isLoggedIn();if(t){n(true)}else{n(false)}};t();e.onLoginSuccess((()=>{n(true)}));e.onLogoutSuccess((()=>{n(false)}))}));return{isLoggedIn:t}}const Xe=({authenticationUrl:t})=>e("div",{class:"login-required",part:"nse__login-required login-component"},e("div",{class:"card",part:"nse__login-required-card"},e("p",{part:"nse__login-required-text"},"Log into your account to use the Scheduler Editor."),e("button",{class:"google-button",part:"nse__login-required-google-button",onClick:async e=>{e.preventDefault();const n=await t("google");if(n){window.location.href=n}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},e("span",{class:"icon"},e("google-logo-icon",{width:"15",height:"15"})),"Continue with Google"),e("button",{class:"microsoft-button",part:"nse__login-required-microsoft-button",onClick:async e=>{e.preventDefault();const n=await t("microsoft");if(n){window.location.href=n}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},e("span",{class:"icon"},e("microsoft-logo-icon",{width:"15",height:"15"})),"Continue with Microsoft"),e("button",{class:"other-provider-button",part:"nse__login-required-other-provider-button",onClick:async e=>{e.preventDefault();const n=await t();if(n){window.location.href=n}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},"View all providers ",e("chevron-icon",{width:"17",height:"17"})),e("small",{class:"disclaimer-text",part:"nse__login-required-disclaimer-text"},"* You will be redirected to authenticate your account.")));function Ze({currentUser:n,calendars:r,selectedEventType:i}){const a=r?.find((e=>e.is_primary))||r?.[0];switch(i){case m.one_on_one:case m.max_availability:case m.max_fairness:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",null),e("nylas-event-duration",null),e("nylas-event-location",{userProvider:n.provider}))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:r,currentUser:n,defaultBookingCalendar:a?.id}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}case m.collective:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",null),e("nylas-event-duration",null),e("nylas-event-location",{userProvider:n.provider}))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:r,currentUser:n,defaultBookingCalendar:a?.id}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),e("nylas-additional-participants",{name:"participants",eventParticipants:[{name:n?.name||n?.email,email:n?.email||"",is_organizer:true}],exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}))}case m.group:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",{noTemplates:true}),e("nylas-event-description",{noTemplates:true,hideAutoPopulateButton:true}),e("nylas-event-location",{userProvider:n.provider}),e("nylas-event-timeslot",{name:"event-timeslot"}),e("nylas-event-capacity",null))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:r,currentUser:n,defaultBookingCalendar:a?.id}),e("nylas-additional-participants",{name:"participants",eventParticipants:[{name:n?.name||n?.email,email:n?.email||"",is_organizer:true}],exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}),e("nylas-page-name",{requirePageName:true,pageName:"Group events page"}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}}}const Qe=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}:host nylas-notification{position:absolute;top:0;right:0}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-content slot[name=login-required]{height:inherit}div.scheduler-editor-content--group{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content--group{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);min-width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer;color:var(--nylas-base-900)}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary);background-color:transparent}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){min-width:132px}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-select-event-type{height:inherit;width:calc(924px + 2rem)}@media screen and (max-width: 768px){nylas-select-event-type{width:auto}}nylas-editor-tabs,nylas-editor-tabs-group{width:auto;height:inherit}nylas-editor-tabs .row,nylas-editor-tabs-group .row{display:flex;gap:1rem}nylas-editor-tabs .composable,nylas-editor-tabs-group .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs],nylas-editor-tabs-group nylas-event-info div[slot=inputs],nylas-editor-tabs-group nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;color:var(--nylas-base-900);max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center;color:var(--nylas-base-900)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}@media screen and (max-width: 768px){.login-required{height:auto}}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}';const et=class{constructor(e){n(this,e);this.init=r(this,"init",7);this.loggedIn=r(this,"loggedIn",7);this.loggedOut=r(this,"loggedOut",7);this.schedulerConfigCloseClicked=r(this,"schedulerConfigCloseClicked",7);this.eventOverrides={};this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.requiresSlug=false;this.enableUserFeedback=true;this.nylasBranding=true;this.enableEventTypes={one_on_one:true,collective:true,max_fairness:true,max_availability:true,group:true};this.automaticComponentRegistration=true;this.selectedLanguage=this.defaultLanguage||b.en;this.langVersion=0;this.version="2.2.0"?"2.2.0":"unknown";this.handleSchedulerConfigCloseClicked=e=>{const t=this.schedulerConfigCloseClicked.emit(this.host);if("schedulerConfigCloseClicked"in this.eventOverrides){this.eventOverrides.schedulerConfigCloseClicked(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){localStorage.removeItem("grant");localStorage.removeItem("user");window.location.reload()}};this.authenticationUrl=async e=>{if(!this.nylasApiRequest){console.error(`[nylas-scheduler-editor] Nylas API Request is not initialized.`);return""}const t=await this.nylasApiRequest.authenticationUrl({provider:e});return t||""}}connectedCallback(){h(`[nylas-scheduler-editor] connectedCallback`)}async componentWillLoad(){h(`[nylas-scheduler-editor] componentWillLoad`);const e=this.additionalParticipants?.filter((e=>{const t=e.calendars?.length>0?e.calendars.filter((e=>e.id&&e.name)):[];if(e.name&&e.email&&t.length>0){return{name:e.name,email:e.email,calendars:t}}}));this.stores={schedulerConfig:E({...this.defaultSchedulerConfigState,additionalParticipants:e,conferenceProviders:this.conferenceProviders,requiresSlug:this.requiresSlug,selectedLanguage:this.defaultLanguage||b.en,nylasBranding:this.nylasBranding,experimentalFeatures:this.experimentalFeatures,enableEventTypes:this.enableEventTypes,themeConfig:this.themeConfig})};if(!this.nylasApiRequest&&this.nylasSessionsConfig){const e=new Le(this.nylasSessionsConfig);await e.isLoggedIn();e.onLoginSuccess((async()=>{const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){const t=this.loggedIn.emit(this.host);if("loggedIn"in this.eventOverrides){await this.eventOverrides.loggedIn(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){await this.loggedInHandler(e)}}}));e.onLoginFail((async()=>{this.stores?.schedulerConfig?.set("currentUser",null);const e=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides){await this.eventOverrides.loggedOut(e,this.nylasSchedulerConfigConnector);if(e.defaultPrevented){return}}}));this.nylasApiRequest=new s(e)}if(this.nylasApiRequest&&this.defaultAuthArgs){this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs)}this.baseProvider=new o(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new k({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const n=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(n,this.nylasSchedulerConfigConnector)}if(!n.defaultPrevented){const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){const t=this.loggedIn.emit(this.host);if("loggedIn"in this.eventOverrides){await this.eventOverrides.loggedIn(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){await this.loggedInHandler(e)}}else{this.stores?.schedulerConfig?.set("currentUser",null);const e=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides){await this.eventOverrides.loggedOut(e,this.nylasSchedulerConfigConnector);if(e.defaultPrevented){return}}}}this.stores?.schedulerConfig?.onChange("selectedConfiguration",(async e=>{if(e&&e.id){this.configurationId=e.id}}));this.baseProvider?.componentWillLoad(this.nylasSchedulerConfigConnector);this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){h(`[nylas-scheduler-editor] componentDidLoad`);await(this.baseProvider?.componentDidLoad());this.updateLocalization(this.localization);this.version="2.2.0"?"2.2.0":"unknown"}async componentDisconnected(){await(this.baseProvider?.componentDisconnected())}async configurationIdChanged(e){if(e){await(this.nylasSchedulerConfigConnector?.schedulerConfig?.getConfigurationById(e));this.stores?.schedulerConfig?.set("action","edit")}else{this.stores?.schedulerConfig?.set("selectedConfiguration",{});this.stores?.schedulerConfig?.set("action",null)}}updateLocalization(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in b)){return}y.addResourceBundle(t,"translation",e[t],false,true)}));this.langVersion++}updateNylasBranding(e){this.stores?.schedulerConfig?.set("nylasBranding",e)}updateExperimentalFeatures(e){this.stores?.schedulerConfig?.set("experimentalFeatures",e)}updateEnableEventTypes(e){this.stores?.schedulerConfig?.set("enableEventTypes",e)}themeConfigChanged(e){this.baseProvider?.getStore("schedulerConfig")?.set("themeConfig",e);this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}async store(){return this.stores?.schedulerConfig}async schedulerConnector(){return this.nylasSchedulerConfigConnector}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){this.selectedLanguage=b[n];y.changeLanguage(this.selectedLanguage);this.stores?.schedulerConfig?.set("selectedLanguage",this.selectedLanguage)}}async loggedInHandler(e){this.stores?.schedulerConfig?.set("currentUser",e);if(!this.nylasSchedulerConfigConnector){return}await(this.nylasSchedulerConfigConnector.schedulerConfig?.getCalendars());if(this.configurationId){const e=await(this.nylasSchedulerConfigConnector.schedulerConfig?.getConfigurationById(this.configurationId));if(e&&e[0]?.id){this.stores?.schedulerConfig?.set("action","edit")}}}render(){const t=this.host.querySelector('[slot="custom-page-style-inputs"]');const n=this.stores?.schedulerConfig?.state.selectedConfiguration?.id;const r=Object.keys(w).map((e=>({label:w[e],value:e})));const a=this.stores?.schedulerConfig?.state.selectedEventType===m.group||this.stores?.schedulerConfig?.state.selectedConfiguration?.type===m.group;return e(i,{key:"e30b7a47dec86afd5458df645005285f47449978"},e("div",{key:"a8e84c8768ab4593345903ac93b6e3e323a77638",class:"scheduler-editor-header",part:"nse__header"},e("h1",{key:"fc08ba51511ae6dfb16befab19e6437c479d6625",class:"scheduler-editor-title",part:"nse__title"},e("calendar-icon",{key:"379c5a808957ff9e004ac9350fd77c72ac9580fc",width:"18",height:"18"}),y.t("schedulerEditorTitle"),e("tooltip-component",{key:"ad1104403e429b0df1e661ee1ec3a73db07c2b3f"},e("info-icon",{key:"b8f8f6cb20fbd64ba856e17a67536b0ed1629174",slot:"tooltip-icon"}),e("span",{key:"81ab4fbdc178f04a6503ce4ac84c3a44f309e0e9",slot:"tooltip-content"},this.version))),e("div",{key:"fc533a24f90a14f45c07e0ed0672b5ba9901d572",class:{language:true},part:"nse__language"},e("select-dropdown",{key:"f48ce1fdc490301830d8df0ae5abe99893aa73f0",name:"language",searchPlaceholder:y.t("search"),options:r,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:r.find((e=>e.value==this.selectedLanguage)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{key:"f4aabc7d263dfa175dc2b6ffdae37fd39f657e16",slot:"select-icon"},e("translate-icon",{key:"e8a1e716b196303a7da7c1e81b5d32e3d6fec0c3",width:"20",height:"20"})))),e("button",{key:"45b9dbbf68aec90659593180285b5c65a3c76347",class:"scheduler-editor-close",title:"logout",onClick:e=>this.handleSchedulerConfigCloseClicked(e),part:"nse__close-button"},e("close-icon",{key:"dfc6c7bf82c0b2300cb622e13d7504d782b00f52",width:"18",height:"18"}))),e("div",{key:"7ca83ed41c8e4e74c15a4d4cfa200922a85fce6b",class:{"scheduler-editor-content":true,"scheduler-editor-content--group":a},part:"nse__content"},this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action===null&&e("div",{key:"87dfad72f364f2f81871e089ce3316cd2ac5c118",class:"list-configurations",part:"nse__list-configurations"},e("nylas-list-configurations",{key:"238bc14eec903d2705484a87b83aaf353694c47f",exportparts:"nlc__create-new-cta, actions__dropdown, actions__dropdown-button, actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete"})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create-select"&&e("nylas-select-event-type",{key:"4f37c308936e6280e65af98a8354e68e06e9747a"}),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&a&&e("nylas-editor-tabs-group",{key:"1d10c334c1a134db8acf51e116694d11363579e9",mode:"composable"},e(Ze,{key:"0e069d3905abb4093ea9eb1e5f4a31422997af51",selectedEventType:this.stores?.schedulerConfig?.state?.selectedEventType||m.one_on_one,currentUser:this.stores?.schedulerConfig?.state.currentUser,calendars:this.stores?.schedulerConfig?.state?.calendars,selectedConfiguration:this.stores?.schedulerConfig?.state?.selectedConfiguration})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&!a&&e("nylas-editor-tabs",{key:"07b42958868ed8ca4639ee53c26d94dbf1f11613",mode:"composable"},e(Ze,{key:"138ff837e96bb504e46463d7e29af5bec4514ee0",selectedEventType:this.stores?.schedulerConfig?.state?.selectedEventType||m.one_on_one,currentUser:this.stores?.schedulerConfig?.state.currentUser,calendars:this.stores?.schedulerConfig?.state?.calendars,selectedConfiguration:this.stores?.schedulerConfig?.state?.selectedConfiguration})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&a&&e("nylas-editor-tabs-group",{key:n,mode:this.mode},this.mode==="composable"&&e("slot",{key:"9314e2751b83a2c18f10e0531f6d229a6a5252d8"}),this.mode==="app"&&t&&e("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:n},e("slot",{key:"3296df29acc8a840fdec1e0d4abfd598af3399a5",name:"custom-page-style-inputs"}))),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&!a&&e("nylas-editor-tabs",{key:n,mode:this.mode},this.mode==="composable"&&e("slot",{key:"902d44bb1e6d967fbc26b31334e4f344567da6c4"}),this.mode==="app"&&t&&e("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:n},e("slot",{key:"389eccb304d8bc0d552190903a56c5cfc1862975",name:"custom-page-style-inputs"}))),!this.stores?.schedulerConfig?.state.currentUser&&e("slot",{key:"d8f7a15a9641f394ac70ba4e8190a3536c735d2f",name:"login-required"},e(Xe,{key:"26ac6ef199f636e7bb1ab657e19f2f1f58e7ed17",authenticationUrl:this.authenticationUrl}))))}get host(){return a(this)}static get watchers(){return{configurationId:["configurationIdChanged"],localization:["updateLocalization"],nylasBranding:["updateNylasBranding"],experimentalFeatures:["updateExperimentalFeatures"],enableEventTypes:["updateEnableEventTypes"],themeConfig:["themeConfigChanged"]}}};et.style=Qe;export{et as nylas_scheduler_editor};
19
+ */var Be=Fe.exports;var Me;function Ge(){if(Me)return Fe.exports;Me=1;(function(e,t){"use strict";if("development"!=="production"){(function(){"use strict";if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!=="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart==="function"){__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error)}var n="18.2.0";var r=Symbol.for("react.element");var i=Symbol.for("react.portal");var o=Symbol.for("react.fragment");var a=Symbol.for("react.strict_mode");var s=Symbol.for("react.profiler");var c=Symbol.for("react.provider");var l=Symbol.for("react.context");var u=Symbol.for("react.forward_ref");var f=Symbol.for("react.suspense");var d=Symbol.for("react.suspense_list");var h=Symbol.for("react.memo");var p=Symbol.for("react.lazy");var y=Symbol.for("react.offscreen");var v=Symbol.iterator;var g="@@iterator";function b(e){if(e===null||typeof e!=="object"){return null}var t=v&&e[v]||e[g];if(typeof t==="function"){return t}return null}var m={current:null};var w={transition:null};var _={current:null,isBatchingLegacy:false,didScheduleLegacyUpdate:false};var k={current:null};var E={};var C=null;function x(e){{C=e}}{E.setExtraStackFrame=function(e){{C=e}};E.getCurrentStack=null;E.getStackAddendum=function(){var e="";if(C){e+=C}var t=E.getCurrentStack;if(t){e+=t()||""}return e}}var S=false;var T=false;var R=false;var $=false;var j=false;var O={ReactCurrentDispatcher:m,ReactCurrentBatchConfig:w,ReactCurrentOwner:k};{O.ReactDebugCurrentFrame=E;O.ReactCurrentActQueue=_}function I(e){{{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}A("warn",e,n)}}}function P(e){{{for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++){n[r-1]=arguments[r]}A("error",e,n)}}}function A(e,t,n){{var r=O.ReactDebugCurrentFrame;var i=r.getStackAddendum();if(i!==""){t+="%s";n=n.concat([i])}var o=n.map((function(e){return String(e)}));o.unshift("Warning: "+t);Function.prototype.apply.call(console[e],console,o)}}var U={};function L(e,t){{var n=e.constructor;var r=n&&(n.displayName||n.name)||"ReactClass";var i=r+"."+t;if(U[i]){return}P("Can't call %s on a component that is not yet mounted. "+"This is a no-op, but it might indicate a bug in your application. "+"Instead, assign to `this.state` directly or define a `state = {};` "+"class property with the desired state in the %s component.",t,r);U[i]=true}}var q={isMounted:function(e){return false},enqueueForceUpdate:function(e,t,n){L(e,"forceUpdate")},enqueueReplaceState:function(e,t,n,r){L(e,"replaceState")},enqueueSetState:function(e,t,n,r){L(e,"setState")}};var N=Object.assign;var D={};{Object.freeze(D)}function z(e,t,n){this.props=e;this.context=t;this.refs=D;this.updater=n||q}z.prototype.isReactComponent={};z.prototype.setState=function(e,t){if(typeof e!=="object"&&typeof e!=="function"&&e!=null){throw new Error("setState(...): takes an object of state variables to update or a "+"function which returns an object of state variables.")}this.updater.enqueueSetState(this,e,t,"setState")};z.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};{var F={isMounted:["isMounted","Instead, make sure to clean up subscriptions and pending requests in "+"componentWillUnmount to prevent memory leaks."],replaceState:["replaceState","Refactor your code to use setState instead (see "+"https://github.com/facebook/react/issues/3236)."]};var B=function(e,t){Object.defineProperty(z.prototype,e,{get:function(){I("%s(...) is deprecated in plain JavaScript React classes. %s",t[0],t[1]);return undefined}})};for(var M in F){if(F.hasOwnProperty(M)){B(M,F[M])}}}function G(){}G.prototype=z.prototype;function H(e,t,n){this.props=e;this.context=t;this.refs=D;this.updater=n||q}var Y=H.prototype=new G;Y.constructor=H;N(Y,z.prototype);Y.isPureReactComponent=true;function V(){var e={current:null};{Object.seal(e)}return e}var J=Array.isArray;function W(e){return J(e)}function K(e){{var t=typeof Symbol==="function"&&Symbol.toStringTag;var n=t&&e[Symbol.toStringTag]||e.constructor.name||"Object";return n}}function X(e){{try{Z(e);return false}catch(e){return true}}}function Z(e){return""+e}function Q(e){{if(X(e)){P("The provided key is an unsupported type %s."+" This value must be coerced to a string before before using it here.",K(e));return Z(e)}}}function ee(e,t,n){var r=e.displayName;if(r){return r}var i=t.displayName||t.name||"";return i!==""?n+"("+i+")":n}function te(e){return e.displayName||"Context"}function ne(e){if(e==null){return null}{if(typeof e.tag==="number"){P("Received an unexpected object in getComponentNameFromType(). "+"This is likely a bug in React. Please file an issue.")}}if(typeof e==="function"){return e.displayName||e.name||null}if(typeof e==="string"){return e}switch(e){case o:return"Fragment";case i:return"Portal";case s:return"Profiler";case a:return"StrictMode";case f:return"Suspense";case d:return"SuspenseList"}if(typeof e==="object"){switch(e.$$typeof){case l:var t=e;return te(t)+".Consumer";case c:var n=e;return te(n._context)+".Provider";case u:return ee(e,e.render,"ForwardRef");case h:var r=e.displayName||null;if(r!==null){return r}return ne(e.type)||"Memo";case p:{var y=e;var v=y._payload;var g=y._init;try{return ne(g(v))}catch(e){return null}}}}return null}var re=Object.prototype.hasOwnProperty;var ie={key:true,ref:true,__self:true,__source:true};var oe,ae,se;{se={}}function ce(e){{if(re.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning){return false}}}return e.ref!==undefined}function le(e){{if(re.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning){return false}}}return e.key!==undefined}function ue(e,t){var n=function(){{if(!oe){oe=true;P("%s: `key` is not a prop. Trying to access it will result "+"in `undefined` being returned. If you need to access the same "+"value within the child component, you should pass it as a different "+"prop. (https://reactjs.org/link/special-props)",t)}}};n.isReactWarning=true;Object.defineProperty(e,"key",{get:n,configurable:true})}function fe(e,t){var n=function(){{if(!ae){ae=true;P("%s: `ref` is not a prop. Trying to access it will result "+"in `undefined` being returned. If you need to access the same "+"value within the child component, you should pass it as a different "+"prop. (https://reactjs.org/link/special-props)",t)}}};n.isReactWarning=true;Object.defineProperty(e,"ref",{get:n,configurable:true})}function de(e){{if(typeof e.ref==="string"&&k.current&&e.__self&&k.current.stateNode!==e.__self){var t=ne(k.current.type);if(!se[t]){P('Component "%s" contains the string ref "%s". '+"Support for string refs will be removed in a future major release. "+"This case cannot be automatically converted to an arrow function. "+"We ask you to manually fix this case by using useRef() or createRef() instead. "+"Learn more about using refs safely here: "+"https://reactjs.org/link/strict-mode-string-ref",t,e.ref);se[t]=true}}}}var he=function(e,t,n,i,o,a,s){var c={$$typeof:r,type:e,key:t,ref:n,props:s,_owner:a};{c._store={};Object.defineProperty(c._store,"validated",{configurable:false,enumerable:false,writable:true,value:false});Object.defineProperty(c,"_self",{configurable:false,enumerable:false,writable:false,value:i});Object.defineProperty(c,"_source",{configurable:false,enumerable:false,writable:false,value:o});if(Object.freeze){Object.freeze(c.props);Object.freeze(c)}}return c};function pe(e,t,n){var r;var i={};var o=null;var a=null;var s=null;var c=null;if(t!=null){if(ce(t)){a=t.ref;{de(t)}}if(le(t)){{Q(t.key)}o=""+t.key}s=t.__self===undefined?null:t.__self;c=t.__source===undefined?null:t.__source;for(r in t){if(re.call(t,r)&&!ie.hasOwnProperty(r)){i[r]=t[r]}}}var l=arguments.length-2;if(l===1){i.children=n}else if(l>1){var u=Array(l);for(var f=0;f<l;f++){u[f]=arguments[f+2]}{if(Object.freeze){Object.freeze(u)}}i.children=u}if(e&&e.defaultProps){var d=e.defaultProps;for(r in d){if(i[r]===undefined){i[r]=d[r]}}}{if(o||a){var h=typeof e==="function"?e.displayName||e.name||"Unknown":e;if(o){ue(i,h)}if(a){fe(i,h)}}}return he(e,o,a,s,c,k.current,i)}function ye(e,t){var n=he(e.type,t,e.ref,e._self,e._source,e._owner,e.props);return n}function ve(e,t,n){if(e===null||e===undefined){throw new Error("React.cloneElement(...): The argument must be a React element, but you passed "+e+".")}var r;var i=N({},e.props);var o=e.key;var a=e.ref;var s=e._self;var c=e._source;var l=e._owner;if(t!=null){if(ce(t)){a=t.ref;l=k.current}if(le(t)){{Q(t.key)}o=""+t.key}var u;if(e.type&&e.type.defaultProps){u=e.type.defaultProps}for(r in t){if(re.call(t,r)&&!ie.hasOwnProperty(r)){if(t[r]===undefined&&u!==undefined){i[r]=u[r]}else{i[r]=t[r]}}}}var f=arguments.length-2;if(f===1){i.children=n}else if(f>1){var d=Array(f);for(var h=0;h<f;h++){d[h]=arguments[h+2]}i.children=d}return he(e.type,o,a,s,c,l,i)}function ge(e){return typeof e==="object"&&e!==null&&e.$$typeof===r}var be=".";var me=":";function we(e){var t=/[=:]/g;var n={"=":"=0",":":"=2"};var r=e.replace(t,(function(e){return n[e]}));return"$"+r}var _e=false;var ke=/\/+/g;function Ee(e){return e.replace(ke,"$&/")}function Ce(e,t){if(typeof e==="object"&&e!==null&&e.key!=null){{Q(e.key)}return we(""+e.key)}return t.toString(36)}function xe(e,t,n,o,a){var s=typeof e;if(s==="undefined"||s==="boolean"){e=null}var c=false;if(e===null){c=true}else{switch(s){case"string":case"number":c=true;break;case"object":switch(e.$$typeof){case r:case i:c=true}}}if(c){var l=e;var u=a(l);var f=o===""?be+Ce(l,0):o;if(W(u)){var d="";if(f!=null){d=Ee(f)+"/"}xe(u,t,d,"",(function(e){return e}))}else if(u!=null){if(ge(u)){{if(u.key&&(!l||l.key!==u.key)){Q(u.key)}}u=ye(u,n+(u.key&&(!l||l.key!==u.key)?Ee(""+u.key)+"/":"")+f)}t.push(u)}return 1}var h;var p;var y=0;var v=o===""?be:o+me;if(W(e)){for(var g=0;g<e.length;g++){h=e[g];p=v+Ce(h,g);y+=xe(h,t,n,p,a)}}else{var m=b(e);if(typeof m==="function"){var w=e;{if(m===w.entries){if(!_e){I("Using Maps as children is not supported. "+"Use an array of keyed ReactElements instead.")}_e=true}}var _=m.call(w);var k;var E=0;while(!(k=_.next()).done){h=k.value;p=v+Ce(h,E++);y+=xe(h,t,n,p,a)}}else if(s==="object"){var C=String(e);throw new Error("Objects are not valid as a React child (found: "+(C==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":C)+"). "+"If you meant to render a collection of children, use an array "+"instead.")}}return y}function Se(e,t,n){if(e==null){return e}var r=[];var i=0;xe(e,r,"","",(function(e){return t.call(n,e,i++)}));return r}function Te(e){var t=0;Se(e,(function(){t++}));return t}function Re(e,t,n){Se(e,(function(){t.apply(this,arguments)}),n)}function $e(e){return Se(e,(function(e){return e}))||[]}function je(e){if(!ge(e)){throw new Error("React.Children.only expected to receive a single React element child.")}return e}function Oe(e){var t={$$typeof:l,_currentValue:e,_currentValue2:e,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null};t.Provider={$$typeof:c,_context:t};var n=false;var r=false;var i=false;{var o={$$typeof:l,_context:t};Object.defineProperties(o,{Provider:{get:function(){if(!r){r=true;P("Rendering <Context.Consumer.Provider> is not supported and will be removed in "+"a future major release. Did you mean to render <Context.Provider> instead?")}return t.Provider},set:function(e){t.Provider=e}},_currentValue:{get:function(){return t._currentValue},set:function(e){t._currentValue=e}},_currentValue2:{get:function(){return t._currentValue2},set:function(e){t._currentValue2=e}},_threadCount:{get:function(){return t._threadCount},set:function(e){t._threadCount=e}},Consumer:{get:function(){if(!n){n=true;P("Rendering <Context.Consumer.Consumer> is not supported and will be removed in "+"a future major release. Did you mean to render <Context.Consumer> instead?")}return t.Consumer}},displayName:{get:function(){return t.displayName},set:function(e){if(!i){I("Setting `displayName` on Context.Consumer has no effect. "+"You should set it directly on the context with Context.displayName = '%s'.",e);i=true}}}});t.Consumer=o}{t._currentRenderer=null;t._currentRenderer2=null}return t}var Ie=-1;var Pe=0;var Ae=1;var Ue=2;function Le(e){if(e._status===Ie){var t=e._result;var n=t();n.then((function(t){if(e._status===Pe||e._status===Ie){var n=e;n._status=Ae;n._result=t}}),(function(t){if(e._status===Pe||e._status===Ie){var n=e;n._status=Ue;n._result=t}}));if(e._status===Ie){var r=e;r._status=Pe;r._result=n}}if(e._status===Ae){var i=e._result;{if(i===undefined){P("lazy: Expected the result of a dynamic imp"+"ort() call. "+"Instead received: %s\n\nYour code should look like: \n "+"const MyComponent = lazy(() => imp"+"ort('./MyComponent'))\n\n"+"Did you accidentally put curly braces around the import?",i)}}{if(!("default"in i)){P("lazy: Expected the result of a dynamic imp"+"ort() call. "+"Instead received: %s\n\nYour code should look like: \n "+"const MyComponent = lazy(() => imp"+"ort('./MyComponent'))",i)}}return i.default}else{throw e._result}}function qe(e){var t={_status:Ie,_result:e};var n={$$typeof:p,_payload:t,_init:Le};{var r;var i;Object.defineProperties(n,{defaultProps:{configurable:true,get:function(){return r},set:function(e){P("React.lazy(...): It is not supported to assign `defaultProps` to "+"a lazy component import. Either specify them where the component "+"is defined, or create a wrapping component around it.");r=e;Object.defineProperty(n,"defaultProps",{enumerable:true})}},propTypes:{configurable:true,get:function(){return i},set:function(e){P("React.lazy(...): It is not supported to assign `propTypes` to "+"a lazy component import. Either specify them where the component "+"is defined, or create a wrapping component around it.");i=e;Object.defineProperty(n,"propTypes",{enumerable:true})}}})}return n}function Ne(e){{if(e!=null&&e.$$typeof===h){P("forwardRef requires a render function but received a `memo` "+"component. Instead of forwardRef(memo(...)), use "+"memo(forwardRef(...)).")}else if(typeof e!=="function"){P("forwardRef requires a render function but was given %s.",e===null?"null":typeof e)}else{if(e.length!==0&&e.length!==2){P("forwardRef render functions accept exactly two parameters: props and ref. %s",e.length===1?"Did you forget to use the ref parameter?":"Any additional parameter will be undefined.")}}if(e!=null){if(e.defaultProps!=null||e.propTypes!=null){P("forwardRef render functions do not support propTypes or defaultProps. "+"Did you accidentally pass a React component?")}}}var t={$$typeof:u,render:e};{var n;Object.defineProperty(t,"displayName",{enumerable:false,configurable:true,get:function(){return n},set:function(t){n=t;if(!e.name&&!e.displayName){e.displayName=t}}})}return t}var De;{De=Symbol.for("react.module.reference")}function ze(e){if(typeof e==="string"||typeof e==="function"){return true}if(e===o||e===s||j||e===a||e===f||e===d||$||e===y||S||T||R){return true}if(typeof e==="object"&&e!==null){if(e.$$typeof===p||e.$$typeof===h||e.$$typeof===c||e.$$typeof===l||e.$$typeof===u||e.$$typeof===De||e.getModuleId!==undefined){return true}}return false}function Fe(e,t){{if(!ze(e)){P("memo: The first argument must be a component. Instead "+"received: %s",e===null?"null":typeof e)}}var n={$$typeof:h,type:e,compare:t===undefined?null:t};{var r;Object.defineProperty(n,"displayName",{enumerable:false,configurable:true,get:function(){return r},set:function(t){r=t;if(!e.name&&!e.displayName){e.displayName=t}}})}return n}function Be(){var e=m.current;{if(e===null){P("Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for"+" one of the following reasons:\n"+"1. You might have mismatching versions of React and the renderer (such as React DOM)\n"+"2. You might be breaking the Rules of Hooks\n"+"3. You might have more than one copy of React in the same app\n"+"See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.")}}return e}function Me(e){var t=Be();{if(e._context!==undefined){var n=e._context;if(n.Consumer===e){P("Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be "+"removed in a future major release. Did you mean to call useContext(Context) instead?")}else if(n.Provider===e){P("Calling useContext(Context.Provider) is not supported. "+"Did you mean to call useContext(Context) instead?")}}}return t.useContext(e)}function Ge(e){var t=Be();return t.useState(e)}function He(e,t,n){var r=Be();return r.useReducer(e,t,n)}function Ye(e){var t=Be();return t.useRef(e)}function Ve(e,t){var n=Be();return n.useEffect(e,t)}function Je(e,t){var n=Be();return n.useInsertionEffect(e,t)}function We(e,t){var n=Be();return n.useLayoutEffect(e,t)}function Ke(e,t){var n=Be();return n.useCallback(e,t)}function Xe(e,t){var n=Be();return n.useMemo(e,t)}function Ze(e,t,n){var r=Be();return r.useImperativeHandle(e,t,n)}function Qe(e,t){{var n=Be();return n.useDebugValue(e,t)}}function et(){var e=Be();return e.useTransition()}function tt(e){var t=Be();return t.useDeferredValue(e)}function nt(){var e=Be();return e.useId()}function rt(e,t,n){var r=Be();return r.useSyncExternalStore(e,t,n)}var it=0;var ot;var at;var st;var ct;var lt;var ut;var ft;function dt(){}dt.__reactDisabledLog=true;function ht(){{if(it===0){ot=console.log;at=console.info;st=console.warn;ct=console.error;lt=console.group;ut=console.groupCollapsed;ft=console.groupEnd;var e={configurable:true,enumerable:true,value:dt,writable:true};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}it++}}function pt(){{it--;if(it===0){var e={configurable:true,enumerable:true,writable:true};Object.defineProperties(console,{log:N({},e,{value:ot}),info:N({},e,{value:at}),warn:N({},e,{value:st}),error:N({},e,{value:ct}),group:N({},e,{value:lt}),groupCollapsed:N({},e,{value:ut}),groupEnd:N({},e,{value:ft})})}if(it<0){P("disabledDepth fell below zero. "+"This is a bug in React. Please file an issue.")}}}var yt=O.ReactCurrentDispatcher;var vt;function gt(e,t,n){{if(vt===undefined){try{throw Error()}catch(e){var r=e.stack.trim().match(/\n( *(at )?)/);vt=r&&r[1]||""}}return"\n"+vt+e}}var bt=false;var mt;{var wt=typeof WeakMap==="function"?WeakMap:Map;mt=new wt}function _t(e,t){if(!e||bt){return""}{var n=mt.get(e);if(n!==undefined){return n}}var r;bt=true;var i=Error.prepareStackTrace;Error.prepareStackTrace=undefined;var o;{o=yt.current;yt.current=null;ht()}try{if(t){var a=function(){throw Error()};Object.defineProperty(a.prototype,"props",{set:function(){throw Error()}});if(typeof Reflect==="object"&&Reflect.construct){try{Reflect.construct(a,[])}catch(e){r=e}Reflect.construct(e,[],a)}else{try{a.call()}catch(e){r=e}e.call(a.prototype)}}else{try{throw Error()}catch(e){r=e}e()}}catch(t){if(t&&r&&typeof t.stack==="string"){var s=t.stack.split("\n");var c=r.stack.split("\n");var l=s.length-1;var u=c.length-1;while(l>=1&&u>=0&&s[l]!==c[u]){u--}for(;l>=1&&u>=0;l--,u--){if(s[l]!==c[u]){if(l!==1||u!==1){do{l--;u--;if(u<0||s[l]!==c[u]){var f="\n"+s[l].replace(" at new "," at ");if(e.displayName&&f.includes("<anonymous>")){f=f.replace("<anonymous>",e.displayName)}{if(typeof e==="function"){mt.set(e,f)}}return f}}while(l>=1&&u>=0)}break}}}}finally{bt=false;{yt.current=o;pt()}Error.prepareStackTrace=i}var d=e?e.displayName||e.name:"";var h=d?gt(d):"";{if(typeof e==="function"){mt.set(e,h)}}return h}function kt(e,t,n){{return _t(e,false)}}function Et(e){var t=e.prototype;return!!(t&&t.isReactComponent)}function Ct(e,t,n){if(e==null){return""}if(typeof e==="function"){{return _t(e,Et(e))}}if(typeof e==="string"){return gt(e)}switch(e){case f:return gt("Suspense");case d:return gt("SuspenseList")}if(typeof e==="object"){switch(e.$$typeof){case u:return kt(e.render);case h:return Ct(e.type,t,n);case p:{var r=e;var i=r._payload;var o=r._init;try{return Ct(o(i),t,n)}catch(e){}}}}return""}var xt={};var St=O.ReactDebugCurrentFrame;function Tt(e){{if(e){var t=e._owner;var n=Ct(e.type,e._source,t?t.type:null);St.setExtraStackFrame(n)}else{St.setExtraStackFrame(null)}}}function Rt(e,t,n,r,i){{var o=Function.call.bind(re);for(var a in e){if(o(e,a)){var s=void 0;try{if(typeof e[a]!=="function"){var c=Error((r||"React class")+": "+n+" type `"+a+"` is invalid; "+"it must be a function, usually from the `prop-types` package, but received `"+typeof e[a]+"`."+"This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");c.name="Invariant Violation";throw c}s=e[a](t,a,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(e){s=e}if(s&&!(s instanceof Error)){Tt(i);P("%s: type specification of %s"+" `%s` is invalid; the type checker "+"function must return `null` or an `Error` but returned a %s. "+"You may have forgotten to pass an argument to the type checker "+"creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and "+"shape all require an argument).",r||"React class",n,a,typeof s);Tt(null)}if(s instanceof Error&&!(s.message in xt)){xt[s.message]=true;Tt(i);P("Failed %s type: %s",n,s.message);Tt(null)}}}}}function $t(e){{if(e){var t=e._owner;var n=Ct(e.type,e._source,t?t.type:null);x(n)}else{x(null)}}}var jt;{jt=false}function Ot(){if(k.current){var e=ne(k.current.type);if(e){return"\n\nCheck the render method of `"+e+"`."}}return""}function It(e){if(e!==undefined){var t=e.fileName.replace(/^.*[\\\/]/,"");var n=e.lineNumber;return"\n\nCheck your code at "+t+":"+n+"."}return""}function Pt(e){if(e!==null&&e!==undefined){return It(e.__source)}return""}var At={};function Ut(e){var t=Ot();if(!t){var n=typeof e==="string"?e:e.displayName||e.name;if(n){t="\n\nCheck the top-level render call using <"+n+">."}}return t}function Lt(e,t){if(!e._store||e._store.validated||e.key!=null){return}e._store.validated=true;var n=Ut(t);if(At[n]){return}At[n]=true;var r="";if(e&&e._owner&&e._owner!==k.current){r=" It was passed a child from "+ne(e._owner.type)+"."}{$t(e);P('Each child in a list should have a unique "key" prop.'+"%s%s See https://reactjs.org/link/warning-keys for more information.",n,r);$t(null)}}function qt(e,t){if(typeof e!=="object"){return}if(W(e)){for(var n=0;n<e.length;n++){var r=e[n];if(ge(r)){Lt(r,t)}}}else if(ge(e)){if(e._store){e._store.validated=true}}else if(e){var i=b(e);if(typeof i==="function"){if(i!==e.entries){var o=i.call(e);var a;while(!(a=o.next()).done){if(ge(a.value)){Lt(a.value,t)}}}}}}function Nt(e){{var t=e.type;if(t===null||t===undefined||typeof t==="string"){return}var n;if(typeof t==="function"){n=t.propTypes}else if(typeof t==="object"&&(t.$$typeof===u||t.$$typeof===h)){n=t.propTypes}else{return}if(n){var r=ne(t);Rt(n,e.props,"prop",r,e)}else if(t.PropTypes!==undefined&&!jt){jt=true;var i=ne(t);P("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",i||"Unknown")}if(typeof t.getDefaultProps==="function"&&!t.getDefaultProps.isReactClassApproved){P("getDefaultProps is only used on classic React.createClass "+"definitions. Use a static property named `defaultProps` instead.")}}}function Dt(e){{var t=Object.keys(e.props);for(var n=0;n<t.length;n++){var r=t[n];if(r!=="children"&&r!=="key"){$t(e);P("Invalid prop `%s` supplied to `React.Fragment`. "+"React.Fragment can only have `key` and `children` props.",r);$t(null);break}}if(e.ref!==null){$t(e);P("Invalid attribute `ref` supplied to `React.Fragment`.");$t(null)}}}function zt(e,t,n){var i=ze(e);if(!i){var a="";if(e===undefined||typeof e==="object"&&e!==null&&Object.keys(e).length===0){a+=" You likely forgot to export your component from the file "+"it's defined in, or you might have mixed up default and named imports."}var s=Pt(t);if(s){a+=s}else{a+=Ot()}var c;if(e===null){c="null"}else if(W(e)){c="array"}else if(e!==undefined&&e.$$typeof===r){c="<"+(ne(e.type)||"Unknown")+" />";a=" Did you accidentally export a JSX literal instead of a component?"}else{c=typeof e}{P("React.createElement: type is invalid -- expected a string (for "+"built-in components) or a class/function (for composite "+"components) but got: %s.%s",c,a)}}var l=pe.apply(this,arguments);if(l==null){return l}if(i){for(var u=2;u<arguments.length;u++){qt(arguments[u],e)}}if(e===o){Dt(l)}else{Nt(l)}return l}var Ft=false;function Bt(e){var t=zt.bind(null,e);t.type=e;{if(!Ft){Ft=true;I("React.createFactory() is deprecated and will be removed in "+"a future major release. Consider using JSX "+"or use React.createElement() directly instead.")}Object.defineProperty(t,"type",{enumerable:false,get:function(){I("Factory.type is deprecated. Access the class directly "+"before passing it to createFactory.");Object.defineProperty(this,"type",{value:e});return e}})}return t}function Mt(e,t,n){var r=ve.apply(this,arguments);for(var i=2;i<arguments.length;i++){qt(arguments[i],r.type)}Nt(r);return r}function Gt(e,t){var n=w.transition;w.transition={};var r=w.transition;{w.transition._updatedFibers=new Set}try{e()}finally{w.transition=n;{if(n===null&&r._updatedFibers){var i=r._updatedFibers.size;if(i>10){I("Detected a large number of updates inside startTransition. "+"If this is due to a subscription please re-write it to use React provided hooks. "+"Otherwise concurrent mode guarantees are off the table.")}r._updatedFibers.clear()}}}}var Ht=false;var Yt=null;function Vt(t){if(Yt===null){try{var n=("require"+Math.random()).slice(0,7);var r=e&&e[n];Yt=r.call(e,"timers").setImmediate}catch(e){Yt=function(e){{if(Ht===false){Ht=true;if(typeof MessageChannel==="undefined"){P("This browser does not have a MessageChannel implementation, "+"so enqueuing tasks via await act(async () => ...) will fail. "+"Please file an issue at https://github.com/facebook/react/issues "+"if you encounter this warning.")}}}var t=new MessageChannel;t.port1.onmessage=e;t.port2.postMessage(undefined)}}}return Yt(t)}var Jt=0;var Wt=false;function Kt(e){{var t=Jt;Jt++;if(_.current===null){_.current=[]}var n=_.isBatchingLegacy;var r;try{_.isBatchingLegacy=true;r=e();if(!n&&_.didScheduleLegacyUpdate){var i=_.current;if(i!==null){_.didScheduleLegacyUpdate=false;en(i)}}}catch(e){Xt(t);throw e}finally{_.isBatchingLegacy=n}if(r!==null&&typeof r==="object"&&typeof r.then==="function"){var o=r;var a=false;var s={then:function(e,n){a=true;o.then((function(r){Xt(t);if(Jt===0){Zt(r,e,n)}else{e(r)}}),(function(e){Xt(t);n(e)}))}};{if(!Wt&&typeof Promise!=="undefined"){Promise.resolve().then((function(){})).then((function(){if(!a){Wt=true;P("You called act(async () => ...) without await. "+"This could lead to unexpected testing behaviour, "+"interleaving multiple act calls and mixing their "+"scopes. "+"You should - await act(async () => ...);")}}))}}return s}else{var c=r;Xt(t);if(Jt===0){var l=_.current;if(l!==null){en(l);_.current=null}var u={then:function(e,t){if(_.current===null){_.current=[];Zt(c,e,t)}else{e(c)}}};return u}else{var f={then:function(e,t){e(c)}};return f}}}}function Xt(e){{if(e!==Jt-1){P("You seem to have overlapping act() calls, this is not supported. "+"Be sure to await previous act() calls before making a new one. ")}Jt=e}}function Zt(e,t,n){{var r=_.current;if(r!==null){try{en(r);Vt((function(){if(r.length===0){_.current=null;t(e)}else{Zt(e,t,n)}}))}catch(e){n(e)}}else{t(e)}}}var Qt=false;function en(e){{if(!Qt){Qt=true;var t=0;try{for(;t<e.length;t++){var n=e[t];do{n=n(true)}while(n!==null)}e.length=0}catch(n){e=e.slice(t+1);throw n}finally{Qt=false}}}}var tn=zt;var nn=Mt;var rn=Bt;var on={map:Se,forEach:Re,count:Te,toArray:$e,only:je};t.Children=on;t.Component=z;t.Fragment=o;t.Profiler=s;t.PureComponent=H;t.StrictMode=a;t.Suspense=f;t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=O;t.cloneElement=nn;t.createContext=Oe;t.createElement=tn;t.createFactory=rn;t.createRef=V;t.forwardRef=Ne;t.isValidElement=ge;t.lazy=qe;t.memo=Fe;t.startTransition=Gt;t.unstable_act=Kt;t.useCallback=Ke;t.useContext=Me;t.useDebugValue=Qe;t.useDeferredValue=tt;t.useEffect=Ve;t.useId=nt;t.useImperativeHandle=Ze;t.useInsertionEffect=Je;t.useLayoutEffect=We;t.useMemo=Xe;t.useReducer=He;t.useRef=Ye;t.useState=Ge;t.useSyncExternalStore=rt;t.useTransition=et;t.version=n;if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__!=="undefined"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop==="function"){__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}})()}})(Fe,Fe.exports);return Fe.exports}var He=qe.exports;var Ye;function Ve(){if(Ye)return qe.exports;Ye=1;"use strict";if("development"==="production"){qe.exports=ze()}else{qe.exports=Ge()}return qe.exports}var Je=Ve();var We=p(Je);function Ke(e){const[t,n]=Je.useState(false);Je.useEffect((()=>{const t=async()=>{const t=await e.isLoggedIn();if(t){n(true)}else{n(false)}};t();e.onLoginSuccess((()=>{n(true)}));e.onLogoutSuccess((()=>{n(false)}))}));return{isLoggedIn:t}}const Xe=({authenticationUrl:t})=>e("div",{class:"login-required",part:"nse__login-required login-component"},e("div",{class:"card",part:"nse__login-required-card"},e("p",{part:"nse__login-required-text"},"Log into your account to use the Scheduler Editor."),e("button",{class:"google-button",part:"nse__login-required-google-button",onClick:async e=>{e.preventDefault();const n=await t("google");if(n){window.location.href=n}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},e("span",{class:"icon"},e("google-logo-icon",{width:"15",height:"15"})),"Continue with Google"),e("button",{class:"microsoft-button",part:"nse__login-required-microsoft-button",onClick:async e=>{e.preventDefault();const n=await t("microsoft");if(n){window.location.href=n}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},e("span",{class:"icon"},e("microsoft-logo-icon",{width:"15",height:"15"})),"Continue with Microsoft"),e("button",{class:"other-provider-button",part:"nse__login-required-other-provider-button",onClick:async e=>{e.preventDefault();const n=await t();if(n){window.location.href=n}else{console.error(`[nylas-scheduler-editor] Unable to get authentication URL.`)}}},"View all providers ",e("chevron-icon",{width:"17",height:"17"})),e("small",{class:"disclaimer-text",part:"nse__login-required-disclaimer-text"},"* You will be redirected to authenticate your account.")));function Ze({currentUser:n,calendars:r,selectedEventType:i}){const o=r?.find((e=>e.is_primary))||r?.[0];switch(i){case b.one_on_one:case b.max_availability:case b.max_fairness:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",null),e("nylas-event-duration",null),e("nylas-event-location",{userProvider:n.provider}))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:r,currentUser:n,defaultBookingCalendar:o?.id}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}case b.collective:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",null),e("nylas-event-duration",null),e("nylas-event-location",{userProvider:n.provider}))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:r,currentUser:n,defaultBookingCalendar:o?.id}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}),e("nylas-additional-participants",{name:"participants",eventParticipants:[{name:n?.name||n?.email,email:n?.email||"",is_organizer:true}],exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}))}case b.group:{return e(t,null,e("nylas-event-info",null,e("div",{slot:"inputs"},e("nylas-event-title",{noTemplates:true}),e("nylas-event-description",{noTemplates:true,hideAutoPopulateButton:true}),e("nylas-event-location",{userProvider:n.provider}),e("nylas-event-timeslot",{name:"event-timeslot"}),e("nylas-event-capacity",null))),e("nylas-booking-calendar-picker",{exportparts:"nbcp, nbcp__header, nbcp__dropdown, nbcp__dropdown-button, nbcp__dropdown-content",expressFlow:true,calendars:r,currentUser:n,defaultBookingCalendar:o?.id}),e("nylas-additional-participants",{name:"participants",eventParticipants:[{name:n?.name||n?.email,email:n?.email||"",is_organizer:true}],exportparts:"nadtnlpart, nadtnlpart__title, nadtnlpart__subtitle, nadtnlpart__content, nadtnlpart__input_group, nadtnlpart__input_wrapper, nadtnlpart__input, nadtnlpart__remove-participant"}),e("nylas-page-name",{requirePageName:true,pageName:"Group events page"}),e("nylas-custom-event-slug",{name:"custom-event-slug",exportparts:"nces, nces__body, nces__header, nces__drawer-toggle--container, nces__input-textfield"}))}}}const Qe=':host{display:flex;flex-direction:column;overflow:visible;border-radius:var(--nylas-border-radius-2x);width:fit-content;background:var(--nylas-base-0);position:relative;box-shadow:0px 0px 6px -2px rgba(0, 0, 0, 0.05), 0px 5px 15px -3px rgba(0, 0, 0, 0.1);--nylas-primary:#2563eb;--nylas-error:#cc4841;--nylas-error-50:#ffeae8;--nylas-error-100:#ffc5bf;--nylas-error-200:#fecaca;--nylas-error-pressed:#992222;--nylas-wraning:#f06c00;--nylas-success:#16a392;--nylas-info:#2b8fc2;--nylas-base-0:#ffffff;--nylas-base-25:#fcfcfd;--nylas-base-50:#f8f9fc;--nylas-base-100:#eaecf5;--nylas-base-200:#d5d9eb;--nylas-base-300:#b3b8d8;--nylas-base-400:#717bbc;--nylas-base-500:#4e5ba6;--nylas-base-600:#3e4784;--nylas-base-700:#263f72;--nylas-base-800:#293056;--nylas-base-900:#101323;--nylas-base-950:#0e101b;--nylas-color-blue-100:#e0e6f9;--nylas-border-radius:0.25rem;--nylas-border-radius-2x:0.5rem;--nylas-border-radius-3x:0.75rem;--nylas-font-family:"Inter", sans-serif;--nylas-color-black:#000000;--nylas-color-grey-900:#2c2c2c;--nylas-color-grey-800:#4b4b4b;--nylas-color-grey-700:#6e6e6e;--nylas-color-grey-600:#8e8e8e;--nylas-color-grey-500:#b3b3b3;--nylas-color-grey-400:#cacaca;--nylas-color-grey-300:#e1e1e1;--nylas-color-grey-200:#eaeaea;--nylas-color-grey-100:#f5f5f5;--nylas-color-grey-50:#fbfcfe;--nylas-color-white:#ffffff;--nylas-color-red-900:#992222;--nylas-color-red-700:#cc4841;--nylas-color-red-500:#ff786a;--nylas-color-red-300:#ffa79e;--nylas-color-red-100:#ffc5bf;--nylas-color-red-50:#ffeae8;--nylas-color-blue-900:#213571;--nylas-color-blue-700:#314fa9;--nylas-color-blue-500:#4169e1;--nylas-color-blue-300:#bdccf9;--nylas-color-blue-100:#e0e6f9;--nylas-color-blue-50:#f6f8fd;--nylas-color-yellow-900:#7c6506;--nylas-color-yellow-700:#c29f09;--nylas-color-yellow-500:#f7c90b;--nylas-color-yellow-300:#f9de70;--nylas-color-yellow-100:#fceba9;--nylas-color-yellow-50:#fdf4ce;--nylas-color-green-900:#0e6b60;--nylas-color-green-700:#16a392;--nylas-color-green-500:#17c3b2;--nylas-color-green-300:#74dbd1;--nylas-color-green-100:#a2e7e0;--nylas-color-green-50:#d1f3f0;--nylas-color-purple-900:#643554;--nylas-color-purple-700:#954f7d;--nylas-color-purple-500:#c769a7;--nylas-color-purple-300:#dda5ca;--nylas-color-purple-100:#e0bdd6;--nylas-color-purple-50:#e9dde5;--nylas-color-sky-900:#20698f;--nylas-color-sky-700:#2b8fc2;--nylas-color-sky-500:#6dceff;--nylas-color-sky-300:#8fdaff;--nylas-color-sky-100:#b8e7ff;--nylas-color-sky-50:#d9f2ff}:host nylas-notification{position:absolute;top:0;right:0}@media screen and (max-width: 768px){:host{width:-moz-available;width:-webkit-fill-available;width:fill-available;min-width:325px}}div.scheduler-editor-content{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content{height:auto}}div.scheduler-editor-content slot[name=login-required]{height:inherit}div.scheduler-editor-content--group{height:800px}@media screen and (max-width: 768px){div.scheduler-editor-content--group{height:auto}}div.scheduler-editor-header{display:grid;grid-template-columns:1fr auto auto;align-items:center;justify-content:space-between;padding:1rem;border-bottom:1px solid var(--nylas-base-200);color:var(--nylas-base-900);min-width:924px}@media screen and (max-width: 768px){div.scheduler-editor-header{width:auto;min-width:calc(325px - 1rem)}}div.scheduler-editor-header h1.scheduler-editor-title{display:flex;align-items:center;gap:0.5rem;margin:0;font-size:18px;line-height:24px;font-weight:600}div.scheduler-editor-header button{background:transparent;border:none;cursor:pointer;color:var(--nylas-base-900)}div.scheduler-editor-header button:hover,div.scheduler-editor-header button:active{color:var(--nylas-primary);background-color:transparent}div.scheduler-editor-header button:disabled{cursor:not-allowed}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button){border:none;padding:4px;margin-right:8px}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-button):hover{outline:none;color:var(--nylas-primary)}div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){min-width:132px}@media screen and (max-width: 768px){div.scheduler-editor-header div.language select-dropdown::part(sd_dropdown-content){width:-webkit-fill-available;width:fill-available;width:-moz-available}}nylas-select-event-type{height:inherit;width:calc(924px + 2rem)}@media screen and (max-width: 768px){nylas-select-event-type{width:auto}}nylas-editor-tabs,nylas-editor-tabs-group{width:auto;height:inherit}nylas-editor-tabs .row,nylas-editor-tabs-group .row{display:flex;gap:1rem}nylas-editor-tabs .composable,nylas-editor-tabs-group .composable{height:inherit;overflow:auto}nylas-editor-tabs nylas-event-info div[slot=inputs],nylas-editor-tabs nylas-event-limits div[slot=inputs],nylas-editor-tabs-group nylas-event-info div[slot=inputs],nylas-editor-tabs-group nylas-event-limits div[slot=inputs]{display:flex;flex-direction:column;gap:1rem}.card{display:flex;flex-direction:column;padding:2rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;color:var(--nylas-base-900);max-width:fit-content;align-self:center}.login-required{height:inherit;overflow-y:auto;display:flex;flex-direction:column;justify-content:center;padding:2rem 1rem;background-color:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}.login-required p{margin:0 0 1rem}.login-required .microsoft-button,.login-required .google-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;margin-bottom:1rem;background-color:var(--nylas-base-0);border:1px solid var(--nylas-base-200);border-radius:5px;justify-content:center;gap:0.5rem;align-items:center;color:var(--nylas-base-900)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .microsoft-button:hover,.login-required .google-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button{height:48px;border:1px solid var(--nylas-base-300);border-radius:var(--nylas-border-radius-2x);font-size:16px;line-height:24px;padding:0 1rem;background-color:var(--nylas-base-0);font-weight:600;cursor:pointer;display:flex;border:0;background-color:var(--nylas-base-0);height:48px;margin-bottom:1rem;font-size:0.95rem;justify-content:center;gap:0.25rem;align-items:center;color:var(--nylas-base-900)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .other-provider-button svg{transform:rotate(180deg)}.login-required .other-provider-button:hover{background-color:var(--nylas-base-25)}.login-required .disclaimer-text{font-size:0.75rem;color:var(--nylas-base-600);align-self:center}@media screen and (max-width: 768px){.login-required{height:auto}}.list-configurations{padding:2rem;height:inherit;background:var(--nylas-base-25);border-radius:var(--nylas-border-radius-2x)}.list-configurations nylas-list-configurations{height:inherit;display:flex;flex-direction:column}@media screen and (max-width: 768px){.list-configurations{height:auto;padding:2rem 1rem}}';const et=class{constructor(e){n(this,e);this.init=r(this,"init",7);this.loggedIn=r(this,"loggedIn",7);this.loggedOut=r(this,"loggedOut",7);this.schedulerConfigCloseClicked=r(this,"schedulerConfigCloseClicked",7);this.eventOverrides={};this.schedulerPreviewLink="";this.mode="app";this.hideEditorTabs=[];this.requiresSlug=false;this.enableUserFeedback=true;this.nylasBranding=true;this.enableEventTypes={one_on_one:true,collective:true,max_fairness:true,max_availability:true,group:true};this.automaticComponentRegistration=true;this.selectedLanguage=this.defaultLanguage||m.en;this.langVersion=0;this.version="2.2.2"?"2.2.2":"unknown";this.handleSchedulerConfigCloseClicked=e=>{const t=this.schedulerConfigCloseClicked.emit(this.host);if("schedulerConfigCloseClicked"in this.eventOverrides){this.eventOverrides.schedulerConfigCloseClicked(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){localStorage.removeItem("grant");localStorage.removeItem("user");window.location.reload()}};this.authenticationUrl=async e=>{if(!this.nylasApiRequest){console.error(`[nylas-scheduler-editor] Nylas API Request is not initialized.`);return""}const t=await this.nylasApiRequest.authenticationUrl({provider:e});return t||""}}connectedCallback(){h(`[nylas-scheduler-editor] connectedCallback`)}async componentWillLoad(){h(`[nylas-scheduler-editor] componentWillLoad`);const e=this.additionalParticipants?.filter((e=>{const t=e.calendars?.length>0?e.calendars.filter((e=>e.id&&e.name)):[];if(e.name&&e.email&&t.length>0){return{name:e.name,email:e.email,calendars:t}}}));this.stores={schedulerConfig:E({...this.defaultSchedulerConfigState,additionalParticipants:e,conferenceProviders:this.conferenceProviders,requiresSlug:this.requiresSlug,selectedLanguage:this.defaultLanguage||m.en,nylasBranding:this.nylasBranding,experimentalFeatures:this.experimentalFeatures,enableEventTypes:this.enableEventTypes,themeConfig:this.themeConfig})};if(!this.nylasApiRequest&&this.nylasSessionsConfig){const e=new Le(this.nylasSessionsConfig);await e.isLoggedIn();e.onLoginSuccess((async()=>{const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){const t=this.loggedIn.emit(this.host);if("loggedIn"in this.eventOverrides){await this.eventOverrides.loggedIn(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){await this.loggedInHandler(e)}}}));e.onLoginFail((async()=>{this.stores?.schedulerConfig?.set("currentUser",null);const e=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides){await this.eventOverrides.loggedOut(e,this.nylasSchedulerConfigConnector);if(e.defaultPrevented){return}}}));this.nylasApiRequest=new s(e)}if(this.nylasApiRequest&&this.defaultAuthArgs){this.nylasApiRequest.setDefaultAuthArgs(this.defaultAuthArgs)}this.baseProvider=new a(this.host,this.stores,this.automaticComponentRegistration,this.eventOverrides);const t=this.baseProvider.getStore("schedulerConfig");this.nylasSchedulerConfigConnector=new k({nylasApiRequest:this.nylasApiRequest,nylasSchedulerConfigStore:t});const n=this.init.emit(this.host);if("init"in this.eventOverrides){await this.eventOverrides.init(n,this.nylasSchedulerConfigConnector)}if(!n.defaultPrevented){const e=await(this.nylasSchedulerConfigConnector?.schedulerConfig?.currentUser());if(e){const t=this.loggedIn.emit(this.host);if("loggedIn"in this.eventOverrides){await this.eventOverrides.loggedIn(t,this.nylasSchedulerConfigConnector)}if(!t.defaultPrevented){await this.loggedInHandler(e)}}else{this.stores?.schedulerConfig?.set("currentUser",null);const e=this.loggedOut.emit(this.host);if("loggedOut"in this.eventOverrides){await this.eventOverrides.loggedOut(e,this.nylasSchedulerConfigConnector);if(e.defaultPrevented){return}}}}this.stores?.schedulerConfig?.onChange("selectedConfiguration",(async e=>{if(e&&e.id){this.configurationId=e.id}}));this.baseProvider?.componentWillLoad(this.nylasSchedulerConfigConnector);this.applyThemeConfig(this.themeConfig)}async componentDidLoad(){h(`[nylas-scheduler-editor] componentDidLoad`);await(this.baseProvider?.componentDidLoad());this.updateLocalization(this.localization);this.version="2.2.2"?"2.2.2":"unknown"}async componentDisconnected(){await(this.baseProvider?.componentDisconnected())}async configurationIdChanged(e){if(e){await(this.nylasSchedulerConfigConnector?.schedulerConfig?.getConfigurationById(e));this.stores?.schedulerConfig?.set("action","edit")}else{this.stores?.schedulerConfig?.set("selectedConfiguration",{});this.stores?.schedulerConfig?.set("action",null)}}updateLocalization(e){if(!e){return}Object.keys(e).forEach((t=>{if(!(t in m)){return}y.addResourceBundle(t,"translation",e[t],false,true)}));this.langVersion++}updateNylasBranding(e){this.stores?.schedulerConfig?.set("nylasBranding",e)}updateExperimentalFeatures(e){this.stores?.schedulerConfig?.set("experimentalFeatures",e)}updateEnableEventTypes(e){this.stores?.schedulerConfig?.set("enableEventTypes",e)}themeConfigChanged(e){this.baseProvider?.getStore("schedulerConfig")?.set("themeConfig",e);this.applyThemeConfig(e)}applyThemeConfig(e){if(e){for(const[t,n]of Object.entries(e)){this.host.style.setProperty(`${t}`,n)}}}async store(){return this.stores?.schedulerConfig}async schedulerConnector(){return this.nylasSchedulerConfigConnector}async registerComponentHandler(e){this.baseProvider?.registerComponent(e.detail)}async unregisterComponentHandler(e){this.baseProvider?.unregisterComponent(e.detail)}nylasFormDropdownChangedHandler(e){const{name:t,value:n}=e.detail;if(t==="language"){this.selectedLanguage=m[n];y.changeLanguage(this.selectedLanguage);this.stores?.schedulerConfig?.set("selectedLanguage",this.selectedLanguage)}}async loggedInHandler(e){this.stores?.schedulerConfig?.set("currentUser",e);if(!this.nylasSchedulerConfigConnector){return}await(this.nylasSchedulerConfigConnector.schedulerConfig?.getCalendars());if(this.configurationId){const e=await(this.nylasSchedulerConfigConnector.schedulerConfig?.getConfigurationById(this.configurationId));if(e&&e[0]?.id){this.stores?.schedulerConfig?.set("action","edit")}}}render(){const t=this.host.querySelector('[slot="custom-page-style-inputs"]');const n=this.stores?.schedulerConfig?.state.selectedConfiguration?.id;const r=Object.keys(w).map((e=>({label:w[e],value:e})));const o=this.stores?.schedulerConfig?.state.selectedEventType===b.group||this.stores?.schedulerConfig?.state.selectedConfiguration?.type===b.group;h(`[nylas-scheduler-editor] render mode: ${this.mode}`);return e(i,{key:"0ed6233ce777efc96d8c338dfca8dcdb58189a88"},e("div",{key:"f03ebd9354a5354a8b7bf96f8f4a893dbe0cdb51",class:"scheduler-editor-header",part:"nse__header"},e("h1",{key:"08f598da6f99df7dd9b8489399c778017290a5ab",class:"scheduler-editor-title",part:"nse__title"},e("calendar-icon",{key:"d45a288da25c8767d313acfdbc3d2d01455a8248",width:"18",height:"18"}),y.t("schedulerEditorTitle"),e("tooltip-component",{key:"114c54f5175e7ea7ff421fd4d85599c2edbcf362"},e("info-icon",{key:"fae29b3d0579b3b8f796d45290984b20a0e4f964",slot:"tooltip-icon"}),e("span",{key:"266835d0224159977f5284e946e5c76cd17ca9a1",slot:"tooltip-content"},this.version))),e("div",{key:"20bc2a98e03ed04509d40e09e7782a2e9f463a24",class:{language:true},part:"nse__language"},e("select-dropdown",{key:"5c380a4a14d9d4b5c4e4b9b3be8e3c929de9359d",name:"language",searchPlaceholder:y.t("search"),options:r,withChevron:false,themeConfig:this.themeConfig,defaultSelectedOption:r.find((e=>e.value==this.selectedLanguage)),exportparts:"sd_dropdown: nse__language-dropdown, sd_dropdown-button: nse__language-drop-button, sd_dropdown-content: nse__language-drop-content, sd_dropdown_label: nse__language-drop-label"},e("span",{key:"c8d33671643a63c8086e5665c86ae177a88770de",slot:"select-icon"},e("translate-icon",{key:"399127d7bdfa13f1028a3500c907eaa33ccf521f",width:"20",height:"20"})))),e("button",{key:"4b99c3c73f2155c50b8f264b7363ef38246637f9",class:"scheduler-editor-close",title:"logout",onClick:e=>this.handleSchedulerConfigCloseClicked(e),part:"nse__close-button"},e("close-icon",{key:"18f760f64c8233c9c76d431d5cef4b486c6def42",width:"18",height:"18"}))),e("div",{key:"b2d4601f7286f0a3af0d89bab6890f7a85155d47",class:{"scheduler-editor-content":true,"scheduler-editor-content--group":o},part:"nse__content"},this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action===null&&e("div",{key:"0b016e02499cde5ba5e20850440d5f743990fb23",class:"list-configurations",part:"nse__list-configurations"},e("nylas-list-configurations",{key:"adf9e242baef6ec09a7611aa9c5f58e7142f05f9",exportparts:"nlc__create-new-cta, actions__dropdown, actions__dropdown-button, actions__dropdown-content, actions-Copy, actions-Preview, actions-Delete"})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create-select"&&e("nylas-select-event-type",{key:"dcc2604843c2b7406feed6562c65f192a742436b"}),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&o&&e("nylas-editor-tabs-group",{key:"eb021702d5c5ceb1d693fa28c409bd2a41491630",mode:"composable"},e(Ze,{key:"5eea8e023765cda8bbe2ddeb1f5d9fc6c0189635",selectedEventType:this.stores?.schedulerConfig?.state?.selectedEventType||b.one_on_one,currentUser:this.stores?.schedulerConfig?.state.currentUser,calendars:this.stores?.schedulerConfig?.state?.calendars,selectedConfiguration:this.stores?.schedulerConfig?.state?.selectedConfiguration})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="create"&&!o&&e("nylas-editor-tabs",{key:"77a33fd49642b670c3aa7724d0bf5bd1c41f0b15",mode:"composable"},e(Ze,{key:"f606f2ecc273b01a09a9394390bf0961ba9d8915",selectedEventType:this.stores?.schedulerConfig?.state?.selectedEventType||b.one_on_one,currentUser:this.stores?.schedulerConfig?.state.currentUser,calendars:this.stores?.schedulerConfig?.state?.calendars,selectedConfiguration:this.stores?.schedulerConfig?.state?.selectedConfiguration})),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&o&&e("nylas-editor-tabs-group",{key:n,mode:this.mode},this.mode==="composable"&&e("slot",{key:"4bb66c5b1ae858d8cc96a15e8488f83a7bb53fb3"}),this.mode==="app"&&t&&e("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:n},e("slot",{key:"58bb10ddabb0f4206ddbc5984f1bd73135df7733",name:"custom-page-style-inputs"}))),this.stores?.schedulerConfig?.state.currentUser&&this.stores.schedulerConfig.state.action==="edit"&&!o&&e("nylas-editor-tabs",{key:n,mode:this.mode},this.mode==="composable"&&e("slot",{key:"0cf7476d6cebcdbc64b56b955373263ff55f0053"}),this.mode==="app"&&t&&e("div",{style:{display:"none"},slot:"custom-page-style-inputs",key:n},e("slot",{key:"b6992d02808bd35e742b52b817625a7dc9695b11",name:"custom-page-style-inputs"}))),!this.stores?.schedulerConfig?.state.currentUser&&e("slot",{key:"8946a6f4cb758864e18ed4313230ff23ba231027",name:"login-required"},e(Xe,{key:"308e0357ae236c2edc195a67e67a0d2685b3097d",authenticationUrl:this.authenticationUrl}))))}get host(){return o(this)}static get watchers(){return{configurationId:["configurationIdChanged"],localization:["updateLocalization"],nylasBranding:["updateNylasBranding"],experimentalFeatures:["updateExperimentalFeatures"],enableEventTypes:["updateEnableEventTypes"],themeConfig:["themeConfigChanged"]}}};et.style=Qe;export{et as nylas_scheduler_editor};
20
20
  //# sourceMappingURL=nylas-scheduler-editor.entry.js.map