@nylas/web-elements 1.0.0-prealpha1

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 (879) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/_commonjsHelpers-0a7b82d9.js +23 -0
  3. package/dist/cjs/_commonjsHelpers-0a7b82d9.js.map +1 -0
  4. package/dist/cjs/app-globals-d58ac016.js +11 -0
  5. package/dist/cjs/app-globals-d58ac016.js.map +1 -0
  6. package/dist/cjs/archive-icon_7.cjs.entry.js +120 -0
  7. package/dist/cjs/archive-icon_7.cjs.entry.js.map +1 -0
  8. package/dist/cjs/arrow-icon.cjs.entry.js +24 -0
  9. package/dist/cjs/arrow-icon.cjs.entry.js.map +1 -0
  10. package/dist/cjs/bold-icon_3.cjs.entry.js +56 -0
  11. package/dist/cjs/bold-icon_3.cjs.entry.js.map +1 -0
  12. package/dist/cjs/calendar-cancel-icon.cjs.entry.js +24 -0
  13. package/dist/cjs/calendar-cancel-icon.cjs.entry.js.map +1 -0
  14. package/dist/cjs/calendar-check-icon_3.cjs.entry.js +56 -0
  15. package/dist/cjs/calendar-check-icon_3.cjs.entry.js.map +1 -0
  16. package/dist/cjs/calendar-icon.cjs.entry.js +24 -0
  17. package/dist/cjs/calendar-icon.cjs.entry.js.map +1 -0
  18. package/dist/cjs/chevron-icon.cjs.entry.js +24 -0
  19. package/dist/cjs/chevron-icon.cjs.entry.js.map +1 -0
  20. package/dist/cjs/close-icon_2.cjs.entry.js +40 -0
  21. package/dist/cjs/close-icon_2.cjs.entry.js.map +1 -0
  22. package/dist/cjs/document-refresh-icon.cjs.entry.js +24 -0
  23. package/dist/cjs/document-refresh-icon.cjs.entry.js.map +1 -0
  24. package/dist/cjs/duration-18b22d1b.js +84 -0
  25. package/dist/cjs/duration-18b22d1b.js.map +1 -0
  26. package/dist/cjs/elements-b06c817b.js +21585 -0
  27. package/dist/cjs/elements-b06c817b.js.map +1 -0
  28. package/dist/cjs/flow-d922fbd4.js +891 -0
  29. package/dist/cjs/flow-d922fbd4.js.map +1 -0
  30. package/dist/cjs/focus-visible-857fc8f9.js +327 -0
  31. package/dist/cjs/focus-visible-857fc8f9.js.map +1 -0
  32. package/dist/cjs/forward-icon_6.cjs.entry.js +2216 -0
  33. package/dist/cjs/forward-icon_6.cjs.entry.js.map +1 -0
  34. package/dist/cjs/globe-icon.cjs.entry.js +24 -0
  35. package/dist/cjs/globe-icon.cjs.entry.js.map +1 -0
  36. package/dist/cjs/index-34e64e2d.js +2173 -0
  37. package/dist/cjs/index-34e64e2d.js.map +1 -0
  38. package/dist/cjs/index-e869130c.js +198 -0
  39. package/dist/cjs/index-e869130c.js.map +1 -0
  40. package/dist/cjs/index.cjs.js +12 -0
  41. package/dist/cjs/index.cjs.js.map +1 -0
  42. package/dist/cjs/index.es-e78884f5.js +3217 -0
  43. package/dist/cjs/index.es-e78884f5.js.map +1 -0
  44. package/dist/cjs/loader.cjs.js +17 -0
  45. package/dist/cjs/loader.cjs.js.map +1 -0
  46. package/dist/cjs/loading-icon.cjs.entry.js +24 -0
  47. package/dist/cjs/loading-icon.cjs.entry.js.map +1 -0
  48. package/dist/cjs/mailbox-store-0b1636fa.js +529 -0
  49. package/dist/cjs/mailbox-store-0b1636fa.js.map +1 -0
  50. package/dist/cjs/nylas-booked-event-card_9.cjs.entry.js +8127 -0
  51. package/dist/cjs/nylas-booked-event-card_9.cjs.entry.js.map +1 -0
  52. package/dist/cjs/nylas-if-state_3.cjs.entry.js +409 -0
  53. package/dist/cjs/nylas-if-state_3.cjs.entry.js.map +1 -0
  54. package/dist/cjs/nylas-list-folders.cjs.entry.js +120 -0
  55. package/dist/cjs/nylas-list-folders.cjs.entry.js.map +1 -0
  56. package/dist/cjs/nylas-list-threads.cjs.entry.js +89 -0
  57. package/dist/cjs/nylas-list-threads.cjs.entry.js.map +1 -0
  58. package/dist/cjs/nylas-mailbox-pagination.cjs.entry.js +140 -0
  59. package/dist/cjs/nylas-mailbox-pagination.cjs.entry.js.map +1 -0
  60. package/dist/cjs/nylas-mailbox-toolbar-button.cjs.entry.js +100 -0
  61. package/dist/cjs/nylas-mailbox-toolbar-button.cjs.entry.js.map +1 -0
  62. package/dist/cjs/nylas-open-hours-picker.cjs.entry.js +333 -0
  63. package/dist/cjs/nylas-open-hours-picker.cjs.entry.js.map +1 -0
  64. package/dist/cjs/nylas-provider.cjs.entry.js +184 -0
  65. package/dist/cjs/nylas-provider.cjs.entry.js.map +1 -0
  66. package/dist/cjs/nylas-scheduler.cjs.entry.js +242 -0
  67. package/dist/cjs/nylas-scheduler.cjs.entry.js.map +1 -0
  68. package/dist/cjs/nylas-threads-refresh.cjs.entry.js +118 -0
  69. package/dist/cjs/nylas-threads-refresh.cjs.entry.js.map +1 -0
  70. package/dist/cjs/nylas-threads-search.cjs.entry.js +84 -0
  71. package/dist/cjs/nylas-threads-search.cjs.entry.js.map +1 -0
  72. package/dist/cjs/nylas-view-thread.cjs.entry.js +234 -0
  73. package/dist/cjs/nylas-view-thread.cjs.entry.js.map +1 -0
  74. package/dist/cjs/nylas-web-elements.cjs.js +27 -0
  75. package/dist/cjs/nylas-web-elements.cjs.js.map +1 -0
  76. package/dist/cjs/play-icon_2.cjs.entry.js +40 -0
  77. package/dist/cjs/play-icon_2.cjs.entry.js.map +1 -0
  78. package/dist/cjs/property-d934a711.js +47 -0
  79. package/dist/cjs/property-d934a711.js.map +1 -0
  80. package/dist/cjs/refresh-icon.cjs.entry.js +24 -0
  81. package/dist/cjs/refresh-icon.cjs.entry.js.map +1 -0
  82. package/dist/cjs/register-component-f76b61a6.js +140 -0
  83. package/dist/cjs/register-component-f76b61a6.js.map +1 -0
  84. package/dist/cjs/scheduler-store-e9822441.js +254 -0
  85. package/dist/cjs/scheduler-store-e9822441.js.map +1 -0
  86. package/dist/cjs/translate-icon.cjs.entry.js +24 -0
  87. package/dist/cjs/translate-icon.cjs.entry.js.map +1 -0
  88. package/dist/cjs/utils-f91d4c73.js +161 -0
  89. package/dist/cjs/utils-f91d4c73.js.map +1 -0
  90. package/dist/collection/assets/icons/chevron.svg +3 -0
  91. package/dist/collection/collection-manifest.json +66 -0
  92. package/dist/collection/common/abstract-provider.js +231 -0
  93. package/dist/collection/common/abstract-provider.js.map +1 -0
  94. package/dist/collection/common/component-types.js +2 -0
  95. package/dist/collection/common/component-types.js.map +1 -0
  96. package/dist/collection/common/constants.js +12 -0
  97. package/dist/collection/common/constants.js.map +1 -0
  98. package/dist/collection/common/global.js +4 -0
  99. package/dist/collection/common/global.js.map +1 -0
  100. package/dist/collection/common/icons/archive.js +63 -0
  101. package/dist/collection/common/icons/archive.js.map +1 -0
  102. package/dist/collection/common/icons/arrow.js +63 -0
  103. package/dist/collection/common/icons/arrow.js.map +1 -0
  104. package/dist/collection/common/icons/bold.js +63 -0
  105. package/dist/collection/common/icons/bold.js.map +1 -0
  106. package/dist/collection/common/icons/calendar-cancel.js +63 -0
  107. package/dist/collection/common/icons/calendar-cancel.js.map +1 -0
  108. package/dist/collection/common/icons/calendar-check.js +63 -0
  109. package/dist/collection/common/icons/calendar-check.js.map +1 -0
  110. package/dist/collection/common/icons/calendar.js +63 -0
  111. package/dist/collection/common/icons/calendar.js.map +1 -0
  112. package/dist/collection/common/icons/checkmark-circle.js +63 -0
  113. package/dist/collection/common/icons/checkmark-circle.js.map +1 -0
  114. package/dist/collection/common/icons/chevron.js +63 -0
  115. package/dist/collection/common/icons/chevron.js.map +1 -0
  116. package/dist/collection/common/icons/close.js +63 -0
  117. package/dist/collection/common/icons/close.js.map +1 -0
  118. package/dist/collection/common/icons/document-refresh.js +63 -0
  119. package/dist/collection/common/icons/document-refresh.js.map +1 -0
  120. package/dist/collection/common/icons/folder.js +63 -0
  121. package/dist/collection/common/icons/folder.js.map +1 -0
  122. package/dist/collection/common/icons/forward.js +63 -0
  123. package/dist/collection/common/icons/forward.js.map +1 -0
  124. package/dist/collection/common/icons/globe.js +63 -0
  125. package/dist/collection/common/icons/globe.js.map +1 -0
  126. package/dist/collection/common/icons/icon.css +3 -0
  127. package/dist/collection/common/icons/inbox.js +63 -0
  128. package/dist/collection/common/icons/inbox.js.map +1 -0
  129. package/dist/collection/common/icons/italic.js +63 -0
  130. package/dist/collection/common/icons/italic.js.map +1 -0
  131. package/dist/collection/common/icons/loading.css +33 -0
  132. package/dist/collection/common/icons/loading.js +63 -0
  133. package/dist/collection/common/icons/loading.js.map +1 -0
  134. package/dist/collection/common/icons/nylas-logo.js +63 -0
  135. package/dist/collection/common/icons/nylas-logo.js.map +1 -0
  136. package/dist/collection/common/icons/people.js +63 -0
  137. package/dist/collection/common/icons/people.js.map +1 -0
  138. package/dist/collection/common/icons/play.js +63 -0
  139. package/dist/collection/common/icons/play.js.map +1 -0
  140. package/dist/collection/common/icons/refresh.js +63 -0
  141. package/dist/collection/common/icons/refresh.js.map +1 -0
  142. package/dist/collection/common/icons/reply-all.js +63 -0
  143. package/dist/collection/common/icons/reply-all.js.map +1 -0
  144. package/dist/collection/common/icons/reply.js +63 -0
  145. package/dist/collection/common/icons/reply.js.map +1 -0
  146. package/dist/collection/common/icons/sent.js +63 -0
  147. package/dist/collection/common/icons/sent.js.map +1 -0
  148. package/dist/collection/common/icons/spam.js +63 -0
  149. package/dist/collection/common/icons/spam.js.map +1 -0
  150. package/dist/collection/common/icons/star.js +63 -0
  151. package/dist/collection/common/icons/star.js.map +1 -0
  152. package/dist/collection/common/icons/stop.js +63 -0
  153. package/dist/collection/common/icons/stop.js.map +1 -0
  154. package/dist/collection/common/icons/translate.js +63 -0
  155. package/dist/collection/common/icons/translate.js.map +1 -0
  156. package/dist/collection/common/icons/trash.js +63 -0
  157. package/dist/collection/common/icons/trash.js.map +1 -0
  158. package/dist/collection/common/icons/underline.js +63 -0
  159. package/dist/collection/common/icons/underline.js.map +1 -0
  160. package/dist/collection/common/icons/warning.js +63 -0
  161. package/dist/collection/common/icons/warning.js.map +1 -0
  162. package/dist/collection/common/mocks/threads.js +57 -0
  163. package/dist/collection/common/mocks/threads.js.map +1 -0
  164. package/dist/collection/common/nylas-theme/index.js +4 -0
  165. package/dist/collection/common/nylas-theme/index.js.map +1 -0
  166. package/dist/collection/common/register-component.js +134 -0
  167. package/dist/collection/common/register-component.js.map +1 -0
  168. package/dist/collection/common/types.js +2 -0
  169. package/dist/collection/common/types.js.map +1 -0
  170. package/dist/collection/components/mailbox/nylas-composer/nylas-composer.css +89 -0
  171. package/dist/collection/components/mailbox/nylas-composer/nylas-composer.js +241 -0
  172. package/dist/collection/components/mailbox/nylas-composer/nylas-composer.js.map +1 -0
  173. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.e2e.js +10 -0
  174. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.e2e.js.map +1 -0
  175. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.spec-disabled.js +12 -0
  176. package/dist/collection/components/mailbox/nylas-composer/test/nylas-composer.spec-disabled.js.map +1 -0
  177. package/dist/collection/components/mailbox/nylas-list-folders/nylas-list-folders.css +37 -0
  178. package/dist/collection/components/mailbox/nylas-list-folders/nylas-list-folders.js +193 -0
  179. package/dist/collection/components/mailbox/nylas-list-folders/nylas-list-folders.js.map +1 -0
  180. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.e2e.js +10 -0
  181. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.e2e.js.map +1 -0
  182. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.spec.js +12 -0
  183. package/dist/collection/components/mailbox/nylas-list-folders/test/nylas-list-folders.spec.js.map +1 -0
  184. package/dist/collection/components/mailbox/nylas-list-threads/nylas-list-threads.css +156 -0
  185. package/dist/collection/components/mailbox/nylas-list-threads/nylas-list-threads.js +218 -0
  186. package/dist/collection/components/mailbox/nylas-list-threads/nylas-list-threads.js.map +1 -0
  187. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.e2e.js +22 -0
  188. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.e2e.js.map +1 -0
  189. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.spec.js +25 -0
  190. package/dist/collection/components/mailbox/nylas-list-threads/test/nylas-list-threads.spec.js.map +1 -0
  191. package/dist/collection/components/mailbox/nylas-mailbox/nylas-mailbox.css +3 -0
  192. package/dist/collection/components/mailbox/nylas-mailbox/nylas-mailbox.js +474 -0
  193. package/dist/collection/components/mailbox/nylas-mailbox/nylas-mailbox.js.map +1 -0
  194. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.e2e.js +16 -0
  195. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.e2e.js.map +1 -0
  196. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.spec.js +32 -0
  197. package/dist/collection/components/mailbox/nylas-mailbox/test/nylas-mailbox.spec.js.map +1 -0
  198. package/dist/collection/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.css +55 -0
  199. package/dist/collection/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.js +371 -0
  200. package/dist/collection/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.js.map +1 -0
  201. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.e2e.js +10 -0
  202. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.e2e.js.map +1 -0
  203. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.spec.js +12 -0
  204. package/dist/collection/components/mailbox/nylas-mailbox-pagination/test/nylas-mailbox-pagination.spec.js.map +1 -0
  205. package/dist/collection/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.css +18 -0
  206. package/dist/collection/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.js +182 -0
  207. package/dist/collection/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.js.map +1 -0
  208. package/dist/collection/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.css +61 -0
  209. package/dist/collection/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.js +329 -0
  210. package/dist/collection/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.js.map +1 -0
  211. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.e2e.js +10 -0
  212. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.e2e.js.map +1 -0
  213. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.spec.js +12 -0
  214. package/dist/collection/components/mailbox/nylas-summarize-message-button/test/nylas-summarize-message-button.spec.js.map +1 -0
  215. package/dist/collection/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.css +53 -0
  216. package/dist/collection/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.js +172 -0
  217. package/dist/collection/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.js.map +1 -0
  218. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.e2e.js +10 -0
  219. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.e2e.js.map +1 -0
  220. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.spec.js +12 -0
  221. package/dist/collection/components/mailbox/nylas-threads-refresh/test/nylas-threads-refresh.spec.js.map +1 -0
  222. package/dist/collection/components/mailbox/nylas-threads-search/nylas-threads-search.css +8 -0
  223. package/dist/collection/components/mailbox/nylas-threads-search/nylas-threads-search.js +130 -0
  224. package/dist/collection/components/mailbox/nylas-threads-search/nylas-threads-search.js.map +1 -0
  225. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.e2e.js +10 -0
  226. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.e2e.js.map +1 -0
  227. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.spec.js +12 -0
  228. package/dist/collection/components/mailbox/nylas-threads-search/test/nylas-threads-search.spec.js.map +1 -0
  229. package/dist/collection/components/mailbox/nylas-view-email/nylas-view-email.css +43 -0
  230. package/dist/collection/components/mailbox/nylas-view-email/nylas-view-email.js +282 -0
  231. package/dist/collection/components/mailbox/nylas-view-email/nylas-view-email.js.map +1 -0
  232. package/dist/collection/components/mailbox/nylas-view-thread/nylas-view-thread.css +243 -0
  233. package/dist/collection/components/mailbox/nylas-view-thread/nylas-view-thread.js +342 -0
  234. package/dist/collection/components/mailbox/nylas-view-thread/nylas-view-thread.js.map +1 -0
  235. package/dist/collection/components/mailbox/nylas-view-thread/view-thread-message.js +25 -0
  236. package/dist/collection/components/mailbox/nylas-view-thread/view-thread-message.js.map +1 -0
  237. package/dist/collection/components/nylas-if-state/nylas-if-state.css +84 -0
  238. package/dist/collection/components/nylas-if-state/nylas-if-state.js +241 -0
  239. package/dist/collection/components/nylas-if-state/nylas-if-state.js.map +1 -0
  240. package/dist/collection/components/nylas-if-state/test/nylas-if-state.e2e.js +10 -0
  241. package/dist/collection/components/nylas-if-state/test/nylas-if-state.e2e.js.map +1 -0
  242. package/dist/collection/components/nylas-if-state/test/nylas-if-state.spec.js +12 -0
  243. package/dist/collection/components/nylas-if-state/test/nylas-if-state.spec.js.map +1 -0
  244. package/dist/collection/components/nylas-login/nylas-login.css +94 -0
  245. package/dist/collection/components/nylas-login/nylas-login.js +289 -0
  246. package/dist/collection/components/nylas-login/nylas-login.js.map +1 -0
  247. package/dist/collection/components/nylas-login/test/nylas-login.e2e.js +10 -0
  248. package/dist/collection/components/nylas-login/test/nylas-login.e2e.js.map +1 -0
  249. package/dist/collection/components/nylas-login/test/nylas-login.spec.js +12 -0
  250. package/dist/collection/components/nylas-login/test/nylas-login.spec.js.map +1 -0
  251. package/dist/collection/components/nylas-provider/nylas-provider.css +3 -0
  252. package/dist/collection/components/nylas-provider/nylas-provider.js +423 -0
  253. package/dist/collection/components/nylas-provider/nylas-provider.js.map +1 -0
  254. package/dist/collection/components/nylas-provider/test/nylas-provider.e2e.js +10 -0
  255. package/dist/collection/components/nylas-provider/test/nylas-provider.e2e.js.map +1 -0
  256. package/dist/collection/components/nylas-provider/test/nylas-provider.spec.js +32 -0
  257. package/dist/collection/components/nylas-provider/test/nylas-provider.spec.js.map +1 -0
  258. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.css +155 -0
  259. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js +178 -0
  260. package/dist/collection/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.js.map +1 -0
  261. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.css +129 -0
  262. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js +323 -0
  263. package/dist/collection/components/scheduler/nylas-booking-form/nylas-booking-form.js.map +1 -0
  264. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.css +78 -0
  265. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js +107 -0
  266. package/dist/collection/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.js.map +1 -0
  267. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.css +150 -0
  268. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js +213 -0
  269. package/dist/collection/components/scheduler/nylas-date-picker/nylas-date-picker.js.map +1 -0
  270. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.css +72 -0
  271. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.js +147 -0
  272. package/dist/collection/components/scheduler/nylas-locale-switch/nylas-locale-switch.js.map +1 -0
  273. package/dist/collection/components/scheduler/nylas-notification/nylas-notification.css +63 -0
  274. package/dist/collection/components/scheduler/nylas-notification/nylas-notification.js +132 -0
  275. package/dist/collection/components/scheduler/nylas-notification/nylas-notification.js.map +1 -0
  276. package/dist/collection/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.css +105 -0
  277. package/dist/collection/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.js +460 -0
  278. package/dist/collection/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.js.map +1 -0
  279. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.e2e.js +10 -0
  280. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.e2e.js.map +1 -0
  281. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.spec.js +12 -0
  282. package/dist/collection/components/scheduler/nylas-open-hours-picker/test/nylas-open-hours-picker.spec.js.map +1 -0
  283. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduler.css +182 -0
  284. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduler.js +533 -0
  285. package/dist/collection/components/scheduler/nylas-scheduler/nylas-scheduler.js.map +1 -0
  286. package/dist/collection/components/scheduler/nylas-scheduler/scheduler-view.js +6 -0
  287. package/dist/collection/components/scheduler/nylas-scheduler/scheduler-view.js.map +1 -0
  288. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.css +63 -0
  289. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js +150 -0
  290. package/dist/collection/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.js.map +1 -0
  291. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.css +115 -0
  292. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js +311 -0
  293. package/dist/collection/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.js.map +1 -0
  294. package/dist/collection/connector/connector-interface.js +2 -0
  295. package/dist/collection/connector/connector-interface.js.map +1 -0
  296. package/dist/collection/connector/nylas-connector/index.js +78 -0
  297. package/dist/collection/connector/nylas-connector/index.js.map +1 -0
  298. package/dist/collection/connector/nylas-mailbox-connector/index.js +62 -0
  299. package/dist/collection/connector/nylas-mailbox-connector/index.js.map +1 -0
  300. package/dist/collection/connector/nylas-scheduler-connector/index.js +43 -0
  301. package/dist/collection/connector/nylas-scheduler-connector/index.js.map +1 -0
  302. package/dist/collection/connector/shared/api/auth.js +60 -0
  303. package/dist/collection/connector/shared/api/auth.js.map +1 -0
  304. package/dist/collection/connector/shared/api/folders.js +33 -0
  305. package/dist/collection/connector/shared/api/folders.js.map +1 -0
  306. package/dist/collection/connector/shared/api/messages.js +95 -0
  307. package/dist/collection/connector/shared/api/messages.js.map +1 -0
  308. package/dist/collection/connector/shared/api/scheduler.js +203 -0
  309. package/dist/collection/connector/shared/api/scheduler.js.map +1 -0
  310. package/dist/collection/connector/shared/api/threads.js +165 -0
  311. package/dist/collection/connector/shared/api/threads.js.map +1 -0
  312. package/dist/collection/index.js +4 -0
  313. package/dist/collection/index.js.map +1 -0
  314. package/dist/collection/routers/hash-router.js +109 -0
  315. package/dist/collection/routers/hash-router.js.map +1 -0
  316. package/dist/collection/routers/router-interface.js +2 -0
  317. package/dist/collection/routers/router-interface.js.map +1 -0
  318. package/dist/collection/stores/auth-store.js +18 -0
  319. package/dist/collection/stores/auth-store.js.map +1 -0
  320. package/dist/collection/stores/mailbox-store.js +42 -0
  321. package/dist/collection/stores/mailbox-store.js.map +1 -0
  322. package/dist/collection/stores/scheduler-store.js +44 -0
  323. package/dist/collection/stores/scheduler-store.js.map +1 -0
  324. package/dist/collection/utils/color-utils.js +161 -0
  325. package/dist/collection/utils/color-utils.js.map +1 -0
  326. package/dist/collection/utils/utils.js +157 -0
  327. package/dist/collection/utils/utils.js.map +1 -0
  328. package/dist/collection/utils/utils.spec.js +16 -0
  329. package/dist/collection/utils/utils.spec.js.map +1 -0
  330. package/dist/components/_commonjsHelpers.js +20 -0
  331. package/dist/components/_commonjsHelpers.js.map +1 -0
  332. package/dist/components/archive-icon.d.ts +11 -0
  333. package/dist/components/archive-icon.js +8 -0
  334. package/dist/components/archive-icon.js.map +1 -0
  335. package/dist/components/archive.js +37 -0
  336. package/dist/components/archive.js.map +1 -0
  337. package/dist/components/arrow-icon.d.ts +11 -0
  338. package/dist/components/arrow-icon.js +8 -0
  339. package/dist/components/arrow-icon.js.map +1 -0
  340. package/dist/components/arrow.js +37 -0
  341. package/dist/components/arrow.js.map +1 -0
  342. package/dist/components/assets/chevron.svg +3 -0
  343. package/dist/components/bold-icon.d.ts +11 -0
  344. package/dist/components/bold-icon.js +8 -0
  345. package/dist/components/bold-icon.js.map +1 -0
  346. package/dist/components/bold.js +37 -0
  347. package/dist/components/bold.js.map +1 -0
  348. package/dist/components/calendar-cancel-icon.d.ts +11 -0
  349. package/dist/components/calendar-cancel-icon.js +8 -0
  350. package/dist/components/calendar-cancel-icon.js.map +1 -0
  351. package/dist/components/calendar-cancel.js +37 -0
  352. package/dist/components/calendar-cancel.js.map +1 -0
  353. package/dist/components/calendar-check-icon.d.ts +11 -0
  354. package/dist/components/calendar-check-icon.js +8 -0
  355. package/dist/components/calendar-check-icon.js.map +1 -0
  356. package/dist/components/calendar-check.js +37 -0
  357. package/dist/components/calendar-check.js.map +1 -0
  358. package/dist/components/calendar-icon.d.ts +11 -0
  359. package/dist/components/calendar-icon.js +8 -0
  360. package/dist/components/calendar-icon.js.map +1 -0
  361. package/dist/components/calendar.js +37 -0
  362. package/dist/components/calendar.js.map +1 -0
  363. package/dist/components/checkmark-circle-icon.d.ts +11 -0
  364. package/dist/components/checkmark-circle-icon.js +8 -0
  365. package/dist/components/checkmark-circle-icon.js.map +1 -0
  366. package/dist/components/checkmark-circle.js +37 -0
  367. package/dist/components/checkmark-circle.js.map +1 -0
  368. package/dist/components/chevron-icon.d.ts +11 -0
  369. package/dist/components/chevron-icon.js +8 -0
  370. package/dist/components/chevron-icon.js.map +1 -0
  371. package/dist/components/chevron.js +37 -0
  372. package/dist/components/chevron.js.map +1 -0
  373. package/dist/components/close-icon.d.ts +11 -0
  374. package/dist/components/close-icon.js +8 -0
  375. package/dist/components/close-icon.js.map +1 -0
  376. package/dist/components/close.js +37 -0
  377. package/dist/components/close.js.map +1 -0
  378. package/dist/components/constants.js +7296 -0
  379. package/dist/components/constants.js.map +1 -0
  380. package/dist/components/define-element.js +40 -0
  381. package/dist/components/define-element.js.map +1 -0
  382. package/dist/components/document-refresh-icon.d.ts +11 -0
  383. package/dist/components/document-refresh-icon.js +40 -0
  384. package/dist/components/document-refresh-icon.js.map +1 -0
  385. package/dist/components/duration.js +78 -0
  386. package/dist/components/duration.js.map +1 -0
  387. package/dist/components/elements.js +21583 -0
  388. package/dist/components/elements.js.map +1 -0
  389. package/dist/components/flow.js +888 -0
  390. package/dist/components/flow.js.map +1 -0
  391. package/dist/components/focus-visible.js +325 -0
  392. package/dist/components/focus-visible.js.map +1 -0
  393. package/dist/components/folder-icon.d.ts +11 -0
  394. package/dist/components/folder-icon.js +8 -0
  395. package/dist/components/folder-icon.js.map +1 -0
  396. package/dist/components/folder.js +37 -0
  397. package/dist/components/folder.js.map +1 -0
  398. package/dist/components/forward-icon.d.ts +11 -0
  399. package/dist/components/forward-icon.js +8 -0
  400. package/dist/components/forward-icon.js.map +1 -0
  401. package/dist/components/forward.js +37 -0
  402. package/dist/components/forward.js.map +1 -0
  403. package/dist/components/globe-icon.d.ts +11 -0
  404. package/dist/components/globe-icon.js +8 -0
  405. package/dist/components/globe-icon.js.map +1 -0
  406. package/dist/components/globe.js +37 -0
  407. package/dist/components/globe.js.map +1 -0
  408. package/dist/components/inbox-icon.d.ts +11 -0
  409. package/dist/components/inbox-icon.js +8 -0
  410. package/dist/components/inbox-icon.js.map +1 -0
  411. package/dist/components/inbox.js +37 -0
  412. package/dist/components/inbox.js.map +1 -0
  413. package/dist/components/index.d.ts +33 -0
  414. package/dist/components/index.es.js +3211 -0
  415. package/dist/components/index.es.js.map +1 -0
  416. package/dist/components/index.js +16 -0
  417. package/dist/components/index.js.map +1 -0
  418. package/dist/components/index2.js +196 -0
  419. package/dist/components/index2.js.map +1 -0
  420. package/dist/components/italic-icon.d.ts +11 -0
  421. package/dist/components/italic-icon.js +8 -0
  422. package/dist/components/italic-icon.js.map +1 -0
  423. package/dist/components/italic.js +37 -0
  424. package/dist/components/italic.js.map +1 -0
  425. package/dist/components/loading-icon.d.ts +11 -0
  426. package/dist/components/loading-icon.js +8 -0
  427. package/dist/components/loading-icon.js.map +1 -0
  428. package/dist/components/loading.js +38 -0
  429. package/dist/components/loading.js.map +1 -0
  430. package/dist/components/mailbox-store.js +521 -0
  431. package/dist/components/mailbox-store.js.map +1 -0
  432. package/dist/components/nylas-booked-event-card.d.ts +11 -0
  433. package/dist/components/nylas-booked-event-card.js +8 -0
  434. package/dist/components/nylas-booked-event-card.js.map +1 -0
  435. package/dist/components/nylas-booked-event-card2.js +121 -0
  436. package/dist/components/nylas-booked-event-card2.js.map +1 -0
  437. package/dist/components/nylas-booking-form.d.ts +11 -0
  438. package/dist/components/nylas-booking-form.js +8 -0
  439. package/dist/components/nylas-booking-form.js.map +1 -0
  440. package/dist/components/nylas-booking-form2.js +224 -0
  441. package/dist/components/nylas-booking-form2.js.map +1 -0
  442. package/dist/components/nylas-cancelled-event-card.d.ts +11 -0
  443. package/dist/components/nylas-cancelled-event-card.js +8 -0
  444. package/dist/components/nylas-cancelled-event-card.js.map +1 -0
  445. package/dist/components/nylas-cancelled-event-card2.js +85 -0
  446. package/dist/components/nylas-cancelled-event-card2.js.map +1 -0
  447. package/dist/components/nylas-composer.d.ts +11 -0
  448. package/dist/components/nylas-composer.js +8 -0
  449. package/dist/components/nylas-composer.js.map +1 -0
  450. package/dist/components/nylas-composer2.js +186 -0
  451. package/dist/components/nylas-composer2.js.map +1 -0
  452. package/dist/components/nylas-date-picker.d.ts +11 -0
  453. package/dist/components/nylas-date-picker.js +8 -0
  454. package/dist/components/nylas-date-picker.js.map +1 -0
  455. package/dist/components/nylas-date-picker2.js +150 -0
  456. package/dist/components/nylas-date-picker2.js.map +1 -0
  457. package/dist/components/nylas-if-state.d.ts +11 -0
  458. package/dist/components/nylas-if-state.js +153 -0
  459. package/dist/components/nylas-if-state.js.map +1 -0
  460. package/dist/components/nylas-list-folders.d.ts +11 -0
  461. package/dist/components/nylas-list-folders.js +183 -0
  462. package/dist/components/nylas-list-folders.js.map +1 -0
  463. package/dist/components/nylas-list-threads.d.ts +11 -0
  464. package/dist/components/nylas-list-threads.js +109 -0
  465. package/dist/components/nylas-list-threads.js.map +1 -0
  466. package/dist/components/nylas-locale-switch.d.ts +11 -0
  467. package/dist/components/nylas-locale-switch.js +8 -0
  468. package/dist/components/nylas-locale-switch.js.map +1 -0
  469. package/dist/components/nylas-locale-switch2.js +103 -0
  470. package/dist/components/nylas-locale-switch2.js.map +1 -0
  471. package/dist/components/nylas-login.d.ts +11 -0
  472. package/dist/components/nylas-login.js +127 -0
  473. package/dist/components/nylas-login.js.map +1 -0
  474. package/dist/components/nylas-logo.d.ts +11 -0
  475. package/dist/components/nylas-logo.js +8 -0
  476. package/dist/components/nylas-logo.js.map +1 -0
  477. package/dist/components/nylas-logo2.js +37 -0
  478. package/dist/components/nylas-logo2.js.map +1 -0
  479. package/dist/components/nylas-mailbox-pagination.d.ts +11 -0
  480. package/dist/components/nylas-mailbox-pagination.js +175 -0
  481. package/dist/components/nylas-mailbox-pagination.js.map +1 -0
  482. package/dist/components/nylas-mailbox-toolbar-button.d.ts +11 -0
  483. package/dist/components/nylas-mailbox-toolbar-button.js +119 -0
  484. package/dist/components/nylas-mailbox-toolbar-button.js.map +1 -0
  485. package/dist/components/nylas-mailbox.d.ts +11 -0
  486. package/dist/components/nylas-mailbox.js +219 -0
  487. package/dist/components/nylas-mailbox.js.map +1 -0
  488. package/dist/components/nylas-notification.d.ts +11 -0
  489. package/dist/components/nylas-notification.js +8 -0
  490. package/dist/components/nylas-notification.js.map +1 -0
  491. package/dist/components/nylas-notification2.js +90 -0
  492. package/dist/components/nylas-notification2.js.map +1 -0
  493. package/dist/components/nylas-open-hours-picker.d.ts +11 -0
  494. package/dist/components/nylas-open-hours-picker.js +365 -0
  495. package/dist/components/nylas-open-hours-picker.js.map +1 -0
  496. package/dist/components/nylas-provider.d.ts +11 -0
  497. package/dist/components/nylas-provider.js +206 -0
  498. package/dist/components/nylas-provider.js.map +1 -0
  499. package/dist/components/nylas-scheduler.d.ts +11 -0
  500. package/dist/components/nylas-scheduler.js +392 -0
  501. package/dist/components/nylas-scheduler.js.map +1 -0
  502. package/dist/components/nylas-selected-event-card.d.ts +11 -0
  503. package/dist/components/nylas-selected-event-card.js +8 -0
  504. package/dist/components/nylas-selected-event-card.js.map +1 -0
  505. package/dist/components/nylas-selected-event-card2.js +110 -0
  506. package/dist/components/nylas-selected-event-card2.js.map +1 -0
  507. package/dist/components/nylas-summarize-message-button.d.ts +11 -0
  508. package/dist/components/nylas-summarize-message-button.js +8 -0
  509. package/dist/components/nylas-summarize-message-button.js.map +1 -0
  510. package/dist/components/nylas-summarize-message-button2.js +233 -0
  511. package/dist/components/nylas-summarize-message-button2.js.map +1 -0
  512. package/dist/components/nylas-threads-refresh.d.ts +11 -0
  513. package/dist/components/nylas-threads-refresh.js +149 -0
  514. package/dist/components/nylas-threads-refresh.js.map +1 -0
  515. package/dist/components/nylas-threads-search.d.ts +11 -0
  516. package/dist/components/nylas-threads-search.js +103 -0
  517. package/dist/components/nylas-threads-search.js.map +1 -0
  518. package/dist/components/nylas-timeslot-picker.d.ts +11 -0
  519. package/dist/components/nylas-timeslot-picker.js +8 -0
  520. package/dist/components/nylas-timeslot-picker.js.map +1 -0
  521. package/dist/components/nylas-timeslot-picker2.js +174 -0
  522. package/dist/components/nylas-timeslot-picker2.js.map +1 -0
  523. package/dist/components/nylas-view-email.d.ts +11 -0
  524. package/dist/components/nylas-view-email.js +8 -0
  525. package/dist/components/nylas-view-email.js.map +1 -0
  526. package/dist/components/nylas-view-email2.js +1859 -0
  527. package/dist/components/nylas-view-email2.js.map +1 -0
  528. package/dist/components/nylas-view-thread.d.ts +11 -0
  529. package/dist/components/nylas-view-thread.js +338 -0
  530. package/dist/components/nylas-view-thread.js.map +1 -0
  531. package/dist/components/people-icon.d.ts +11 -0
  532. package/dist/components/people-icon.js +8 -0
  533. package/dist/components/people-icon.js.map +1 -0
  534. package/dist/components/people.js +37 -0
  535. package/dist/components/people.js.map +1 -0
  536. package/dist/components/play-icon.d.ts +11 -0
  537. package/dist/components/play-icon.js +8 -0
  538. package/dist/components/play-icon.js.map +1 -0
  539. package/dist/components/play.js +37 -0
  540. package/dist/components/play.js.map +1 -0
  541. package/dist/components/property.js +36 -0
  542. package/dist/components/property.js.map +1 -0
  543. package/dist/components/refresh-icon.d.ts +11 -0
  544. package/dist/components/refresh-icon.js +8 -0
  545. package/dist/components/refresh-icon.js.map +1 -0
  546. package/dist/components/refresh.js +37 -0
  547. package/dist/components/refresh.js.map +1 -0
  548. package/dist/components/register-component.js +138 -0
  549. package/dist/components/register-component.js.map +1 -0
  550. package/dist/components/reply-all-icon.d.ts +11 -0
  551. package/dist/components/reply-all-icon.js +8 -0
  552. package/dist/components/reply-all-icon.js.map +1 -0
  553. package/dist/components/reply-all.js +37 -0
  554. package/dist/components/reply-all.js.map +1 -0
  555. package/dist/components/reply-icon.d.ts +11 -0
  556. package/dist/components/reply-icon.js +8 -0
  557. package/dist/components/reply-icon.js.map +1 -0
  558. package/dist/components/reply.js +37 -0
  559. package/dist/components/reply.js.map +1 -0
  560. package/dist/components/scheduler-store.js +251 -0
  561. package/dist/components/scheduler-store.js.map +1 -0
  562. package/dist/components/sent-icon.d.ts +11 -0
  563. package/dist/components/sent-icon.js +8 -0
  564. package/dist/components/sent-icon.js.map +1 -0
  565. package/dist/components/sent.js +37 -0
  566. package/dist/components/sent.js.map +1 -0
  567. package/dist/components/sp-icon-chevron-left.js +23 -0
  568. package/dist/components/sp-icon-chevron-left.js.map +1 -0
  569. package/dist/components/spam-icon.d.ts +11 -0
  570. package/dist/components/spam-icon.js +8 -0
  571. package/dist/components/spam-icon.js.map +1 -0
  572. package/dist/components/spam.js +37 -0
  573. package/dist/components/spam.js.map +1 -0
  574. package/dist/components/star-icon.d.ts +11 -0
  575. package/dist/components/star-icon.js +8 -0
  576. package/dist/components/star-icon.js.map +1 -0
  577. package/dist/components/star.js +37 -0
  578. package/dist/components/star.js.map +1 -0
  579. package/dist/components/stop-icon.d.ts +11 -0
  580. package/dist/components/stop-icon.js +8 -0
  581. package/dist/components/stop-icon.js.map +1 -0
  582. package/dist/components/stop.js +37 -0
  583. package/dist/components/stop.js.map +1 -0
  584. package/dist/components/translate-icon.d.ts +11 -0
  585. package/dist/components/translate-icon.js +8 -0
  586. package/dist/components/translate-icon.js.map +1 -0
  587. package/dist/components/translate.js +37 -0
  588. package/dist/components/translate.js.map +1 -0
  589. package/dist/components/trash-icon.d.ts +11 -0
  590. package/dist/components/trash-icon.js +8 -0
  591. package/dist/components/trash-icon.js.map +1 -0
  592. package/dist/components/trash.js +37 -0
  593. package/dist/components/trash.js.map +1 -0
  594. package/dist/components/underline-icon.d.ts +11 -0
  595. package/dist/components/underline-icon.js +8 -0
  596. package/dist/components/underline-icon.js.map +1 -0
  597. package/dist/components/underline.js +37 -0
  598. package/dist/components/underline.js.map +1 -0
  599. package/dist/components/utils.js +140 -0
  600. package/dist/components/utils.js.map +1 -0
  601. package/dist/components/warning-icon.d.ts +11 -0
  602. package/dist/components/warning-icon.js +8 -0
  603. package/dist/components/warning-icon.js.map +1 -0
  604. package/dist/components/warning.js +37 -0
  605. package/dist/components/warning.js.map +1 -0
  606. package/dist/esm/_commonjsHelpers-57e89916.js +20 -0
  607. package/dist/esm/_commonjsHelpers-57e89916.js.map +1 -0
  608. package/dist/esm/app-globals-47969cee.js +9 -0
  609. package/dist/esm/app-globals-47969cee.js.map +1 -0
  610. package/dist/esm/archive-icon_7.entry.js +110 -0
  611. package/dist/esm/archive-icon_7.entry.js.map +1 -0
  612. package/dist/esm/arrow-icon.entry.js +20 -0
  613. package/dist/esm/arrow-icon.entry.js.map +1 -0
  614. package/dist/esm/bold-icon_3.entry.js +50 -0
  615. package/dist/esm/bold-icon_3.entry.js.map +1 -0
  616. package/dist/esm/calendar-cancel-icon.entry.js +20 -0
  617. package/dist/esm/calendar-cancel-icon.entry.js.map +1 -0
  618. package/dist/esm/calendar-check-icon_3.entry.js +50 -0
  619. package/dist/esm/calendar-check-icon_3.entry.js.map +1 -0
  620. package/dist/esm/calendar-icon.entry.js +20 -0
  621. package/dist/esm/calendar-icon.entry.js.map +1 -0
  622. package/dist/esm/chevron-icon.entry.js +20 -0
  623. package/dist/esm/chevron-icon.entry.js.map +1 -0
  624. package/dist/esm/close-icon_2.entry.js +35 -0
  625. package/dist/esm/close-icon_2.entry.js.map +1 -0
  626. package/dist/esm/document-refresh-icon.entry.js +20 -0
  627. package/dist/esm/document-refresh-icon.entry.js.map +1 -0
  628. package/dist/esm/duration-bddc4a13.js +78 -0
  629. package/dist/esm/duration-bddc4a13.js.map +1 -0
  630. package/dist/esm/elements-60ebdb01.js +21583 -0
  631. package/dist/esm/elements-60ebdb01.js.map +1 -0
  632. package/dist/esm/flow-40ff9cea.js +888 -0
  633. package/dist/esm/flow-40ff9cea.js.map +1 -0
  634. package/dist/esm/focus-visible-e8093c16.js +325 -0
  635. package/dist/esm/focus-visible-e8093c16.js.map +1 -0
  636. package/dist/esm/forward-icon_6.entry.js +2207 -0
  637. package/dist/esm/forward-icon_6.entry.js.map +1 -0
  638. package/dist/esm/globe-icon.entry.js +20 -0
  639. package/dist/esm/globe-icon.entry.js.map +1 -0
  640. package/dist/esm/index-2b85580a.js +196 -0
  641. package/dist/esm/index-2b85580a.js.map +1 -0
  642. package/dist/esm/index-b2270b4a.js +2141 -0
  643. package/dist/esm/index-b2270b4a.js.map +1 -0
  644. package/dist/esm/index.es-6f3582a1.js +3211 -0
  645. package/dist/esm/index.es-6f3582a1.js.map +1 -0
  646. package/dist/esm/index.js +8 -0
  647. package/dist/esm/index.js.map +1 -0
  648. package/dist/esm/loader.js +13 -0
  649. package/dist/esm/loader.js.map +1 -0
  650. package/dist/esm/loading-icon.entry.js +20 -0
  651. package/dist/esm/loading-icon.entry.js.map +1 -0
  652. package/dist/esm/mailbox-store-0019772c.js +521 -0
  653. package/dist/esm/mailbox-store-0019772c.js.map +1 -0
  654. package/dist/esm/nylas-booked-event-card_9.entry.js +8115 -0
  655. package/dist/esm/nylas-booked-event-card_9.entry.js.map +1 -0
  656. package/dist/esm/nylas-if-state_3.entry.js +403 -0
  657. package/dist/esm/nylas-if-state_3.entry.js.map +1 -0
  658. package/dist/esm/nylas-list-folders.entry.js +116 -0
  659. package/dist/esm/nylas-list-folders.entry.js.map +1 -0
  660. package/dist/esm/nylas-list-threads.entry.js +85 -0
  661. package/dist/esm/nylas-list-threads.entry.js.map +1 -0
  662. package/dist/esm/nylas-mailbox-pagination.entry.js +136 -0
  663. package/dist/esm/nylas-mailbox-pagination.entry.js.map +1 -0
  664. package/dist/esm/nylas-mailbox-toolbar-button.entry.js +96 -0
  665. package/dist/esm/nylas-mailbox-toolbar-button.entry.js.map +1 -0
  666. package/dist/esm/nylas-open-hours-picker.entry.js +329 -0
  667. package/dist/esm/nylas-open-hours-picker.entry.js.map +1 -0
  668. package/dist/esm/nylas-provider.entry.js +180 -0
  669. package/dist/esm/nylas-provider.entry.js.map +1 -0
  670. package/dist/esm/nylas-scheduler.entry.js +238 -0
  671. package/dist/esm/nylas-scheduler.entry.js.map +1 -0
  672. package/dist/esm/nylas-threads-refresh.entry.js +114 -0
  673. package/dist/esm/nylas-threads-refresh.entry.js.map +1 -0
  674. package/dist/esm/nylas-threads-search.entry.js +80 -0
  675. package/dist/esm/nylas-threads-search.entry.js.map +1 -0
  676. package/dist/esm/nylas-view-thread.entry.js +230 -0
  677. package/dist/esm/nylas-view-thread.entry.js.map +1 -0
  678. package/dist/esm/nylas-web-elements.js +22 -0
  679. package/dist/esm/nylas-web-elements.js.map +1 -0
  680. package/dist/esm/play-icon_2.entry.js +35 -0
  681. package/dist/esm/play-icon_2.entry.js.map +1 -0
  682. package/dist/esm/polyfills/core-js.js +11 -0
  683. package/dist/esm/polyfills/dom.js +79 -0
  684. package/dist/esm/polyfills/es5-html-element.js +1 -0
  685. package/dist/esm/polyfills/index.js +34 -0
  686. package/dist/esm/polyfills/system.js +6 -0
  687. package/dist/esm/property-0065dde7.js +36 -0
  688. package/dist/esm/property-0065dde7.js.map +1 -0
  689. package/dist/esm/refresh-icon.entry.js +20 -0
  690. package/dist/esm/refresh-icon.entry.js.map +1 -0
  691. package/dist/esm/register-component-55376f31.js +138 -0
  692. package/dist/esm/register-component-55376f31.js.map +1 -0
  693. package/dist/esm/scheduler-store-5a39585a.js +251 -0
  694. package/dist/esm/scheduler-store-5a39585a.js.map +1 -0
  695. package/dist/esm/translate-icon.entry.js +20 -0
  696. package/dist/esm/translate-icon.entry.js.map +1 -0
  697. package/dist/esm/utils-5074a070.js +140 -0
  698. package/dist/esm/utils-5074a070.js.map +1 -0
  699. package/dist/index.cjs.js +1 -0
  700. package/dist/index.js +1 -0
  701. package/dist/nylas-web-elements/index.esm.js +2 -0
  702. package/dist/nylas-web-elements/index.esm.js.map +1 -0
  703. package/dist/nylas-web-elements/nylas-web-elements.css +239 -0
  704. package/dist/nylas-web-elements/nylas-web-elements.esm.js +2 -0
  705. package/dist/nylas-web-elements/nylas-web-elements.esm.js.map +1 -0
  706. package/dist/nylas-web-elements/p-06974d68.js +2 -0
  707. package/dist/nylas-web-elements/p-06974d68.js.map +1 -0
  708. package/dist/nylas-web-elements/p-113fe52e.entry.js +2 -0
  709. package/dist/nylas-web-elements/p-113fe52e.entry.js.map +1 -0
  710. package/dist/nylas-web-elements/p-16fb3c85.entry.js +2 -0
  711. package/dist/nylas-web-elements/p-16fb3c85.entry.js.map +1 -0
  712. package/dist/nylas-web-elements/p-24c42c37.entry.js +2 -0
  713. package/dist/nylas-web-elements/p-24c42c37.entry.js.map +1 -0
  714. package/dist/nylas-web-elements/p-2881b62f.js +16519 -0
  715. package/dist/nylas-web-elements/p-2881b62f.js.map +1 -0
  716. package/dist/nylas-web-elements/p-33da6cf1.entry.js +2 -0
  717. package/dist/nylas-web-elements/p-33da6cf1.entry.js.map +1 -0
  718. package/dist/nylas-web-elements/p-37f99b96.entry.js +2 -0
  719. package/dist/nylas-web-elements/p-37f99b96.entry.js.map +1 -0
  720. package/dist/nylas-web-elements/p-3bc3426e.entry.js +2 -0
  721. package/dist/nylas-web-elements/p-3bc3426e.entry.js.map +1 -0
  722. package/dist/nylas-web-elements/p-3c8822f1.entry.js +2 -0
  723. package/dist/nylas-web-elements/p-3c8822f1.entry.js.map +1 -0
  724. package/dist/nylas-web-elements/p-5770704d.js +2 -0
  725. package/dist/nylas-web-elements/p-5770704d.js.map +1 -0
  726. package/dist/nylas-web-elements/p-5862975b.js +2 -0
  727. package/dist/nylas-web-elements/p-5862975b.js.map +1 -0
  728. package/dist/nylas-web-elements/p-647cf7be.entry.js +2 -0
  729. package/dist/nylas-web-elements/p-647cf7be.entry.js.map +1 -0
  730. package/dist/nylas-web-elements/p-663edeb8.entry.js +2 -0
  731. package/dist/nylas-web-elements/p-663edeb8.entry.js.map +1 -0
  732. package/dist/nylas-web-elements/p-67c9158e.entry.js +2 -0
  733. package/dist/nylas-web-elements/p-67c9158e.entry.js.map +1 -0
  734. package/dist/nylas-web-elements/p-6ba7a037.js +2 -0
  735. package/dist/nylas-web-elements/p-6ba7a037.js.map +1 -0
  736. package/dist/nylas-web-elements/p-6da0b8f0.entry.js +2 -0
  737. package/dist/nylas-web-elements/p-6da0b8f0.entry.js.map +1 -0
  738. package/dist/nylas-web-elements/p-6df00ba0.js +27 -0
  739. package/dist/nylas-web-elements/p-6df00ba0.js.map +1 -0
  740. package/dist/nylas-web-elements/p-74141ef6.entry.js +2 -0
  741. package/dist/nylas-web-elements/p-74141ef6.entry.js.map +1 -0
  742. package/dist/nylas-web-elements/p-85d41197.entry.js +2 -0
  743. package/dist/nylas-web-elements/p-85d41197.entry.js.map +1 -0
  744. package/dist/nylas-web-elements/p-97518578.entry.js +2 -0
  745. package/dist/nylas-web-elements/p-97518578.entry.js.map +1 -0
  746. package/dist/nylas-web-elements/p-98ec4a7a.js +2 -0
  747. package/dist/nylas-web-elements/p-98ec4a7a.js.map +1 -0
  748. package/dist/nylas-web-elements/p-998d25d5.entry.js +2 -0
  749. package/dist/nylas-web-elements/p-998d25d5.entry.js.map +1 -0
  750. package/dist/nylas-web-elements/p-a7bfd3af.entry.js +77 -0
  751. package/dist/nylas-web-elements/p-a7bfd3af.entry.js.map +1 -0
  752. package/dist/nylas-web-elements/p-a95208c7.js +2 -0
  753. package/dist/nylas-web-elements/p-a95208c7.js.map +1 -0
  754. package/dist/nylas-web-elements/p-adacdaeb.entry.js +2 -0
  755. package/dist/nylas-web-elements/p-adacdaeb.entry.js.map +1 -0
  756. package/dist/nylas-web-elements/p-b7d4b7b5.entry.js +2 -0
  757. package/dist/nylas-web-elements/p-b7d4b7b5.entry.js.map +1 -0
  758. package/dist/nylas-web-elements/p-b85dfeac.entry.js +2 -0
  759. package/dist/nylas-web-elements/p-b85dfeac.entry.js.map +1 -0
  760. package/dist/nylas-web-elements/p-b96b37f1.entry.js +2 -0
  761. package/dist/nylas-web-elements/p-b96b37f1.entry.js.map +1 -0
  762. package/dist/nylas-web-elements/p-c2e69618.entry.js +2 -0
  763. package/dist/nylas-web-elements/p-c2e69618.entry.js.map +1 -0
  764. package/dist/nylas-web-elements/p-c440f148.entry.js +2 -0
  765. package/dist/nylas-web-elements/p-c440f148.entry.js.map +1 -0
  766. package/dist/nylas-web-elements/p-c66e27d0.js +3 -0
  767. package/dist/nylas-web-elements/p-c66e27d0.js.map +1 -0
  768. package/dist/nylas-web-elements/p-c685e944.entry.js +3 -0
  769. package/dist/nylas-web-elements/p-c685e944.entry.js.map +1 -0
  770. package/dist/nylas-web-elements/p-cb65c223.js +2 -0
  771. package/dist/nylas-web-elements/p-cb65c223.js.map +1 -0
  772. package/dist/nylas-web-elements/p-cc21d351.js +17 -0
  773. package/dist/nylas-web-elements/p-cc21d351.js.map +1 -0
  774. package/dist/nylas-web-elements/p-d4b1e3e4.entry.js +2 -0
  775. package/dist/nylas-web-elements/p-d4b1e3e4.entry.js.map +1 -0
  776. package/dist/nylas-web-elements/p-db24cc70.entry.js +2 -0
  777. package/dist/nylas-web-elements/p-db24cc70.entry.js.map +1 -0
  778. package/dist/nylas-web-elements/p-de1bcc4a.js +2 -0
  779. package/dist/nylas-web-elements/p-de1bcc4a.js.map +1 -0
  780. package/dist/nylas-web-elements/p-df9f71ea.js +2 -0
  781. package/dist/nylas-web-elements/p-df9f71ea.js.map +1 -0
  782. package/dist/nylas-web-elements/p-eeb0a591.js +2 -0
  783. package/dist/nylas-web-elements/p-eeb0a591.js.map +1 -0
  784. package/dist/nylas-web-elements/p-f029c1b7.entry.js +2 -0
  785. package/dist/nylas-web-elements/p-f029c1b7.entry.js.map +1 -0
  786. package/dist/nylas-web-elements/p-f9a4758a.entry.js +2 -0
  787. package/dist/nylas-web-elements/p-f9a4758a.entry.js.map +1 -0
  788. package/dist/types/common/abstract-provider.d.ts +52 -0
  789. package/dist/types/common/component-types.d.ts +22 -0
  790. package/dist/types/common/constants.d.ts +6 -0
  791. package/dist/types/common/global.d.ts +1 -0
  792. package/dist/types/common/icons/archive.d.ts +5 -0
  793. package/dist/types/common/icons/arrow.d.ts +5 -0
  794. package/dist/types/common/icons/bold.d.ts +5 -0
  795. package/dist/types/common/icons/calendar-cancel.d.ts +5 -0
  796. package/dist/types/common/icons/calendar-check.d.ts +5 -0
  797. package/dist/types/common/icons/calendar.d.ts +5 -0
  798. package/dist/types/common/icons/checkmark-circle.d.ts +5 -0
  799. package/dist/types/common/icons/chevron.d.ts +5 -0
  800. package/dist/types/common/icons/close.d.ts +5 -0
  801. package/dist/types/common/icons/document-refresh.d.ts +5 -0
  802. package/dist/types/common/icons/folder.d.ts +5 -0
  803. package/dist/types/common/icons/forward.d.ts +5 -0
  804. package/dist/types/common/icons/globe.d.ts +5 -0
  805. package/dist/types/common/icons/inbox.d.ts +5 -0
  806. package/dist/types/common/icons/italic.d.ts +5 -0
  807. package/dist/types/common/icons/loading.d.ts +5 -0
  808. package/dist/types/common/icons/nylas-logo.d.ts +5 -0
  809. package/dist/types/common/icons/people.d.ts +5 -0
  810. package/dist/types/common/icons/play.d.ts +5 -0
  811. package/dist/types/common/icons/refresh.d.ts +5 -0
  812. package/dist/types/common/icons/reply-all.d.ts +5 -0
  813. package/dist/types/common/icons/reply.d.ts +5 -0
  814. package/dist/types/common/icons/sent.d.ts +5 -0
  815. package/dist/types/common/icons/spam.d.ts +5 -0
  816. package/dist/types/common/icons/star.d.ts +5 -0
  817. package/dist/types/common/icons/stop.d.ts +5 -0
  818. package/dist/types/common/icons/translate.d.ts +5 -0
  819. package/dist/types/common/icons/trash.d.ts +5 -0
  820. package/dist/types/common/icons/underline.d.ts +5 -0
  821. package/dist/types/common/icons/warning.d.ts +5 -0
  822. package/dist/types/common/mocks/threads.d.ts +3 -0
  823. package/dist/types/common/nylas-theme/index.d.ts +27 -0
  824. package/dist/types/common/register-component.d.ts +29 -0
  825. package/dist/types/common/types.d.ts +108 -0
  826. package/dist/types/components/mailbox/nylas-composer/nylas-composer.d.ts +22 -0
  827. package/dist/types/components/mailbox/nylas-composer/test/nylas-composer.spec-disabled.d.ts +1 -0
  828. package/dist/types/components/mailbox/nylas-list-folders/nylas-list-folders.d.ts +19 -0
  829. package/dist/types/components/mailbox/nylas-list-threads/nylas-list-threads.d.ts +19 -0
  830. package/dist/types/components/mailbox/nylas-mailbox/nylas-mailbox.d.ts +35 -0
  831. package/dist/types/components/mailbox/nylas-mailbox-pagination/nylas-mailbox-pagination.d.ts +30 -0
  832. package/dist/types/components/mailbox/nylas-mailbox-toolbar-button/nylas-mailbox-toolbar-button.d.ts +26 -0
  833. package/dist/types/components/mailbox/nylas-summarize-message-button/nylas-summarize-message-button.d.ts +25 -0
  834. package/dist/types/components/mailbox/nylas-threads-refresh/nylas-threads-refresh.d.ts +23 -0
  835. package/dist/types/components/mailbox/nylas-threads-search/nylas-threads-search.d.ts +13 -0
  836. package/dist/types/components/mailbox/nylas-view-email/nylas-view-email.d.ts +25 -0
  837. package/dist/types/components/mailbox/nylas-view-thread/nylas-view-thread.d.ts +30 -0
  838. package/dist/types/components/mailbox/nylas-view-thread/view-thread-message.d.ts +12 -0
  839. package/dist/types/components/nylas-if-state/nylas-if-state.d.ts +22 -0
  840. package/dist/types/components/nylas-login/nylas-login.d.ts +26 -0
  841. package/dist/types/components/nylas-provider/nylas-provider.d.ts +35 -0
  842. package/dist/types/components/scheduler/nylas-booked-event-card/nylas-booked-event-card.d.ts +22 -0
  843. package/dist/types/components/scheduler/nylas-booking-form/nylas-booking-form.d.ts +33 -0
  844. package/dist/types/components/scheduler/nylas-cancelled-event-card/nylas-cancelled-event-card.d.ts +13 -0
  845. package/dist/types/components/scheduler/nylas-date-picker/nylas-date-picker.d.ts +19 -0
  846. package/dist/types/components/scheduler/nylas-locale-switch/nylas-locale-switch.d.ts +13 -0
  847. package/dist/types/components/scheduler/nylas-notification/nylas-notification.d.ts +13 -0
  848. package/dist/types/components/scheduler/nylas-open-hours-picker/nylas-open-hours-picker.d.ts +40 -0
  849. package/dist/types/components/scheduler/nylas-scheduler/nylas-scheduler.d.ts +41 -0
  850. package/dist/types/components/scheduler/nylas-scheduler/scheduler-view.d.ts +6 -0
  851. package/dist/types/components/scheduler/nylas-selected-event-card/nylas-selected-event-card.d.ts +15 -0
  852. package/dist/types/components/scheduler/nylas-timeslot-picker/nylas-timeslot-picker.d.ts +28 -0
  853. package/dist/types/components.d.ts +2123 -0
  854. package/dist/types/connector/connector-interface.d.ts +35 -0
  855. package/dist/types/connector/nylas-connector/index.d.ts +59 -0
  856. package/dist/types/connector/nylas-mailbox-connector/index.d.ts +52 -0
  857. package/dist/types/connector/nylas-scheduler-connector/index.d.ts +24 -0
  858. package/dist/types/connector/shared/api/auth.d.ts +13 -0
  859. package/dist/types/connector/shared/api/folders.d.ts +10 -0
  860. package/dist/types/connector/shared/api/messages.d.ts +13 -0
  861. package/dist/types/connector/shared/api/scheduler.d.ts +29 -0
  862. package/dist/types/connector/shared/api/threads.d.ts +20 -0
  863. package/dist/types/index.d.ts +4 -0
  864. package/dist/types/routers/hash-router.d.ts +21 -0
  865. package/dist/types/routers/router-interface.d.ts +16 -0
  866. package/dist/types/stencil-public-runtime.d.ts +1681 -0
  867. package/dist/types/stores/auth-store.d.ts +9 -0
  868. package/dist/types/stores/mailbox-store.d.ts +19 -0
  869. package/dist/types/stores/scheduler-store.d.ts +32 -0
  870. package/dist/types/utils/color-utils.d.ts +9 -0
  871. package/dist/types/utils/utils.d.ts +28 -0
  872. package/loader/cdn.js +3 -0
  873. package/loader/index.cjs.js +3 -0
  874. package/loader/index.d.ts +21 -0
  875. package/loader/index.es2017.js +3 -0
  876. package/loader/index.js +4 -0
  877. package/loader/package.json +11 -0
  878. package/package.json +69 -0
  879. package/readme.md +42 -0
@@ -0,0 +1,1859 @@
1
+ import { proxyCustomElement, HTMLElement as HTMLElement$1, h, Host, Fragment } from '@stencil/core/internal/client';
2
+ import { d as debug, n as detectIfMessageIsHTML, o as detectHTMLOrPlainText, p as parsePlainTextToHTML } from './utils.js';
3
+ import { c as commonjsGlobal } from './_commonjsHelpers.js';
4
+
5
+ function invertColor(color) {
6
+ if (!window.matchMedia('(prefers-color-scheme: dark)').matches) {
7
+ return color;
8
+ }
9
+ if (!color) {
10
+ return color;
11
+ }
12
+ if (color === 'transparent') {
13
+ return 'color';
14
+ }
15
+ if (color.startsWith('#')) {
16
+ return invertHexColor(color);
17
+ }
18
+ if (color.startsWith('rgb')) {
19
+ return invertRgbColor(color);
20
+ }
21
+ if (color.startsWith('hsl')) {
22
+ return invertHslColor(color);
23
+ }
24
+ if (isNamedColor(color)) {
25
+ return invertNamedColor(color);
26
+ }
27
+ return color;
28
+ }
29
+ function invertHexColor(hex) {
30
+ if (hex.length < 7) {
31
+ hex = '#' + hex[1] + hex[1] + hex[2] + hex[2] + hex[3] + hex[3];
32
+ }
33
+ const r = (255 - parseInt(hex.slice(1, 3), 16)).toString(16).padStart(2, '0');
34
+ const g = (255 - parseInt(hex.slice(3, 5), 16)).toString(16).padStart(2, '0');
35
+ const b = (255 - parseInt(hex.slice(5, 7), 16)).toString(16).padStart(2, '0');
36
+ return `#${r}${g}${b}`;
37
+ }
38
+ function invertRgbColor(rgb) {
39
+ const match = rgb.match(/\d+/g)?.map(Number);
40
+ if (!match) {
41
+ return rgb;
42
+ }
43
+ const [r, g, b] = match;
44
+ return `rgb(${255 - r}, ${255 - g}, ${255 - b})`;
45
+ }
46
+ function invertHslColor(hsl) {
47
+ const match = hsl.match(/\d+\.?\d*/g)?.map(Number);
48
+ if (!match) {
49
+ return hsl;
50
+ }
51
+ const [h, s, l] = match;
52
+ return `hsl(${h}, ${s}%, ${100 - l}%)`;
53
+ }
54
+ function isNamedColor(color) {
55
+ return /^[a-z]+$/i.test(color);
56
+ }
57
+ function invertNamedColor(color) {
58
+ return invertRgbColor(namedColorToRgb(color));
59
+ }
60
+ function namedColorToRgb(color) {
61
+ if (color.toLowerCase() === 'red') {
62
+ return 'rgb(255, 0, 0)';
63
+ }
64
+ return 'rgb(0, 0, 0)';
65
+ }
66
+ function transformElement(element) {
67
+ if (element instanceof HTMLStyleElement) {
68
+ let styleTextContent = element.textContent;
69
+ if (styleTextContent) {
70
+ styleTextContent = styleTextContent.replaceAll(/@media\s*\(prefers-color-scheme:\s*(dark|light)\)\s*\{([^}]+)\}/g, '');
71
+ const borderColor = styleTextContent.matchAll(/border-color:\s*([^;]+)/g);
72
+ if (borderColor) {
73
+ for (const match of borderColor) {
74
+ const [fullMatch, color] = match;
75
+ const escapedFullMatch = fullMatch.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
76
+ styleTextContent = styleTextContent.replaceAll(escapedFullMatch, fullMatch.replace(color, invertColor(color)));
77
+ }
78
+ }
79
+ const border = styleTextContent.matchAll(/border:\s*([^;]+)/g);
80
+ if (border) {
81
+ for (const match of border) {
82
+ const fullMatch = match[0].trim();
83
+ const escapedFullMatch = fullMatch.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
84
+ const [_width, _style, color] = match[1].split(' ');
85
+ styleTextContent = styleTextContent.replaceAll(escapedFullMatch, fullMatch.replace(color, invertColor(color)));
86
+ }
87
+ }
88
+ const backgroundColor = styleTextContent.matchAll(/background-color:\s*([^;]+)/g);
89
+ if (backgroundColor) {
90
+ for (const match of backgroundColor) {
91
+ const [fullMatch, color] = match;
92
+ const escapedFullMatch = fullMatch.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
93
+ styleTextContent = styleTextContent.replaceAll(escapedFullMatch, fullMatch.replace(color, invertColor(color)));
94
+ debug('backgroundColor', { fullMatch, replace: fullMatch.replace(color, invertColor(color)), color, invertColor: invertColor(color) });
95
+ }
96
+ }
97
+ const background = styleTextContent.matchAll(/background:\s*([^;]+)/g);
98
+ if (background) {
99
+ for (const match of background) {
100
+ const fullMatch = match[0].trim();
101
+ const escapedFullMatch = fullMatch.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
102
+ const [_width, _style, color] = match[1].split(' ');
103
+ styleTextContent = styleTextContent.replaceAll(escapedFullMatch, fullMatch.replace(color, invertColor(color)));
104
+ }
105
+ }
106
+ const color = styleTextContent.matchAll(/color:\s*([^;]+)/g);
107
+ if (color) {
108
+ for (const match of color) {
109
+ const [fullMatch, color] = match;
110
+ const escapedFullMatch = fullMatch.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
111
+ styleTextContent = styleTextContent.replaceAll(escapedFullMatch, fullMatch.replace(color, invertColor(color)));
112
+ }
113
+ }
114
+ element.textContent = styleTextContent;
115
+ }
116
+ }
117
+ if (element instanceof HTMLElement) {
118
+ const computedStyle = window.getComputedStyle(element);
119
+ const color = computedStyle.color || element.style.color;
120
+ const backgroundColor = computedStyle.backgroundColor || element.style.backgroundColor;
121
+ const borderColor = computedStyle.borderColor || element.style.borderColor;
122
+ if (color && !backgroundColor) {
123
+ element.style.color = '';
124
+ }
125
+ else if (color && backgroundColor) {
126
+ element.style.color = invertColor(color);
127
+ element.style.backgroundColor = invertColor(backgroundColor);
128
+ debug('element', element);
129
+ debug('computedStyle.color', color);
130
+ debug('computedStyle.backgroundColor', backgroundColor);
131
+ debug('invertColor(color)', invertColor(color));
132
+ debug('invertColor(backgroundColor)', invertColor(backgroundColor));
133
+ }
134
+ else if (!color && backgroundColor) {
135
+ element.style.backgroundColor = '';
136
+ }
137
+ if (borderColor) {
138
+ debug('borderColor', borderColor);
139
+ element.style.borderColor = invertColor(borderColor);
140
+ }
141
+ if (element.hasAttribute('bgcolor')) {
142
+ element.removeAttribute('bgcolor');
143
+ }
144
+ }
145
+ }
146
+ function processStyles(root) {
147
+ transformElement(root);
148
+ const elements = root.querySelectorAll('*');
149
+ elements.forEach(element => transformElement(element));
150
+ }
151
+
152
+ var purify = {exports: {}};
153
+
154
+ /*! @license DOMPurify 3.0.8 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.8/LICENSE */
155
+
156
+ (function (module, exports) {
157
+ (function (global, factory) {
158
+ module.exports = factory() ;
159
+ })(commonjsGlobal, (function () {
160
+ const {
161
+ entries,
162
+ setPrototypeOf,
163
+ isFrozen,
164
+ getPrototypeOf,
165
+ getOwnPropertyDescriptor
166
+ } = Object;
167
+ let {
168
+ freeze,
169
+ seal,
170
+ create
171
+ } = Object; // eslint-disable-line import/no-mutable-exports
172
+ let {
173
+ apply,
174
+ construct
175
+ } = typeof Reflect !== 'undefined' && Reflect;
176
+ if (!freeze) {
177
+ freeze = function freeze(x) {
178
+ return x;
179
+ };
180
+ }
181
+ if (!seal) {
182
+ seal = function seal(x) {
183
+ return x;
184
+ };
185
+ }
186
+ if (!apply) {
187
+ apply = function apply(fun, thisValue, args) {
188
+ return fun.apply(thisValue, args);
189
+ };
190
+ }
191
+ if (!construct) {
192
+ construct = function construct(Func, args) {
193
+ return new Func(...args);
194
+ };
195
+ }
196
+ const arrayForEach = unapply(Array.prototype.forEach);
197
+ const arrayPop = unapply(Array.prototype.pop);
198
+ const arrayPush = unapply(Array.prototype.push);
199
+ const stringToLowerCase = unapply(String.prototype.toLowerCase);
200
+ const stringToString = unapply(String.prototype.toString);
201
+ const stringMatch = unapply(String.prototype.match);
202
+ const stringReplace = unapply(String.prototype.replace);
203
+ const stringIndexOf = unapply(String.prototype.indexOf);
204
+ const stringTrim = unapply(String.prototype.trim);
205
+ const regExpTest = unapply(RegExp.prototype.test);
206
+ const typeErrorCreate = unconstruct(TypeError);
207
+
208
+ /**
209
+ * Creates a new function that calls the given function with a specified thisArg and arguments.
210
+ *
211
+ * @param {Function} func - The function to be wrapped and called.
212
+ * @returns {Function} A new function that calls the given function with a specified thisArg and arguments.
213
+ */
214
+ function unapply(func) {
215
+ return function (thisArg) {
216
+ for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
217
+ args[_key - 1] = arguments[_key];
218
+ }
219
+ return apply(func, thisArg, args);
220
+ };
221
+ }
222
+
223
+ /**
224
+ * Creates a new function that constructs an instance of the given constructor function with the provided arguments.
225
+ *
226
+ * @param {Function} func - The constructor function to be wrapped and called.
227
+ * @returns {Function} A new function that constructs an instance of the given constructor function with the provided arguments.
228
+ */
229
+ function unconstruct(func) {
230
+ return function () {
231
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
232
+ args[_key2] = arguments[_key2];
233
+ }
234
+ return construct(func, args);
235
+ };
236
+ }
237
+
238
+ /**
239
+ * Add properties to a lookup table
240
+ *
241
+ * @param {Object} set - The set to which elements will be added.
242
+ * @param {Array} array - The array containing elements to be added to the set.
243
+ * @param {Function} transformCaseFunc - An optional function to transform the case of each element before adding to the set.
244
+ * @returns {Object} The modified set with added elements.
245
+ */
246
+ function addToSet(set, array) {
247
+ let transformCaseFunc = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : stringToLowerCase;
248
+ if (setPrototypeOf) {
249
+ // Make 'in' and truthy checks like Boolean(set.constructor)
250
+ // independent of any properties defined on Object.prototype.
251
+ // Prevent prototype setters from intercepting set as a this value.
252
+ setPrototypeOf(set, null);
253
+ }
254
+ let l = array.length;
255
+ while (l--) {
256
+ let element = array[l];
257
+ if (typeof element === 'string') {
258
+ const lcElement = transformCaseFunc(element);
259
+ if (lcElement !== element) {
260
+ // Config presets (e.g. tags.js, attrs.js) are immutable.
261
+ if (!isFrozen(array)) {
262
+ array[l] = lcElement;
263
+ }
264
+ element = lcElement;
265
+ }
266
+ }
267
+ set[element] = true;
268
+ }
269
+ return set;
270
+ }
271
+
272
+ /**
273
+ * Clean up an array to harden against CSPP
274
+ *
275
+ * @param {Array} array - The array to be cleaned.
276
+ * @returns {Array} The cleaned version of the array
277
+ */
278
+ function cleanArray(array) {
279
+ for (let index = 0; index < array.length; index++) {
280
+ if (getOwnPropertyDescriptor(array, index) === undefined) {
281
+ array[index] = null;
282
+ }
283
+ }
284
+ return array;
285
+ }
286
+
287
+ /**
288
+ * Shallow clone an object
289
+ *
290
+ * @param {Object} object - The object to be cloned.
291
+ * @returns {Object} A new object that copies the original.
292
+ */
293
+ function clone(object) {
294
+ const newObject = create(null);
295
+ for (const [property, value] of entries(object)) {
296
+ if (getOwnPropertyDescriptor(object, property) !== undefined) {
297
+ if (Array.isArray(value)) {
298
+ newObject[property] = cleanArray(value);
299
+ } else if (value && typeof value === 'object' && value.constructor === Object) {
300
+ newObject[property] = clone(value);
301
+ } else {
302
+ newObject[property] = value;
303
+ }
304
+ }
305
+ }
306
+ return newObject;
307
+ }
308
+
309
+ /**
310
+ * This method automatically checks if the prop is function or getter and behaves accordingly.
311
+ *
312
+ * @param {Object} object - The object to look up the getter function in its prototype chain.
313
+ * @param {String} prop - The property name for which to find the getter function.
314
+ * @returns {Function} The getter function found in the prototype chain or a fallback function.
315
+ */
316
+ function lookupGetter(object, prop) {
317
+ while (object !== null) {
318
+ const desc = getOwnPropertyDescriptor(object, prop);
319
+ if (desc) {
320
+ if (desc.get) {
321
+ return unapply(desc.get);
322
+ }
323
+ if (typeof desc.value === 'function') {
324
+ return unapply(desc.value);
325
+ }
326
+ }
327
+ object = getPrototypeOf(object);
328
+ }
329
+ function fallbackValue(element) {
330
+ console.warn('fallback value for', element);
331
+ return null;
332
+ }
333
+ return fallbackValue;
334
+ }
335
+
336
+ const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']);
337
+
338
+ // SVG
339
+ const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
340
+ const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feDropShadow', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']);
341
+
342
+ // List of SVG elements that are disallowed by default.
343
+ // We still need to know them so that we can do namespace
344
+ // checks properly in case one wants to add them to
345
+ // allow-list.
346
+ const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
347
+ const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']);
348
+
349
+ // Similarly to SVG, we want to know all MathML elements,
350
+ // even those that we disallow by default.
351
+ const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
352
+ const text = freeze(['#text']);
353
+
354
+ const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
355
+ const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
356
+ const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
357
+ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
358
+
359
+ // eslint-disable-next-line unicorn/better-regex
360
+ const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
361
+ const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
362
+ const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
363
+ const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
364
+ const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
365
+ const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
366
+ );
367
+
368
+ const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
369
+ const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
370
+ );
371
+
372
+ const DOCTYPE_NAME = seal(/^html$/i);
373
+
374
+ var EXPRESSIONS = /*#__PURE__*/Object.freeze({
375
+ __proto__: null,
376
+ MUSTACHE_EXPR: MUSTACHE_EXPR,
377
+ ERB_EXPR: ERB_EXPR,
378
+ TMPLIT_EXPR: TMPLIT_EXPR,
379
+ DATA_ATTR: DATA_ATTR,
380
+ ARIA_ATTR: ARIA_ATTR,
381
+ IS_ALLOWED_URI: IS_ALLOWED_URI,
382
+ IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
383
+ ATTR_WHITESPACE: ATTR_WHITESPACE,
384
+ DOCTYPE_NAME: DOCTYPE_NAME
385
+ });
386
+
387
+ const getGlobal = function getGlobal() {
388
+ return typeof window === 'undefined' ? null : window;
389
+ };
390
+
391
+ /**
392
+ * Creates a no-op policy for internal use only.
393
+ * Don't export this function outside this module!
394
+ * @param {TrustedTypePolicyFactory} trustedTypes The policy factory.
395
+ * @param {HTMLScriptElement} purifyHostElement The Script element used to load DOMPurify (to determine policy name suffix).
396
+ * @return {TrustedTypePolicy} The policy created (or null, if Trusted Types
397
+ * are not supported or creating the policy failed).
398
+ */
399
+ const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, purifyHostElement) {
400
+ if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
401
+ return null;
402
+ }
403
+
404
+ // Allow the callers to control the unique policy name
405
+ // by adding a data-tt-policy-suffix to the script element with the DOMPurify.
406
+ // Policy creation with duplicate names throws in Trusted Types.
407
+ let suffix = null;
408
+ const ATTR_NAME = 'data-tt-policy-suffix';
409
+ if (purifyHostElement && purifyHostElement.hasAttribute(ATTR_NAME)) {
410
+ suffix = purifyHostElement.getAttribute(ATTR_NAME);
411
+ }
412
+ const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
413
+ try {
414
+ return trustedTypes.createPolicy(policyName, {
415
+ createHTML(html) {
416
+ return html;
417
+ },
418
+ createScriptURL(scriptUrl) {
419
+ return scriptUrl;
420
+ }
421
+ });
422
+ } catch (_) {
423
+ // Policy creation failed (most likely another DOMPurify script has
424
+ // already run). Skip creating the policy, as this will only cause errors
425
+ // if TT are enforced.
426
+ console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
427
+ return null;
428
+ }
429
+ };
430
+ function createDOMPurify() {
431
+ let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
432
+ const DOMPurify = root => createDOMPurify(root);
433
+
434
+ /**
435
+ * Version label, exposed for easier checks
436
+ * if DOMPurify is up to date or not
437
+ */
438
+ DOMPurify.version = '3.0.8';
439
+
440
+ /**
441
+ * Array of elements that DOMPurify removed during sanitation.
442
+ * Empty if nothing was removed.
443
+ */
444
+ DOMPurify.removed = [];
445
+ if (!window || !window.document || window.document.nodeType !== 9) {
446
+ // Not running in a browser, provide a factory function
447
+ // so that you can pass your own Window
448
+ DOMPurify.isSupported = false;
449
+ return DOMPurify;
450
+ }
451
+ let {
452
+ document
453
+ } = window;
454
+ const originalDocument = document;
455
+ const currentScript = originalDocument.currentScript;
456
+ const {
457
+ DocumentFragment,
458
+ HTMLTemplateElement,
459
+ Node,
460
+ Element,
461
+ NodeFilter,
462
+ NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
463
+ HTMLFormElement,
464
+ DOMParser,
465
+ trustedTypes
466
+ } = window;
467
+ const ElementPrototype = Element.prototype;
468
+ const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
469
+ const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
470
+ const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
471
+ const getParentNode = lookupGetter(ElementPrototype, 'parentNode');
472
+
473
+ // As per issue #47, the web-components registry is inherited by a
474
+ // new document created via createHTMLDocument. As per the spec
475
+ // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
476
+ // a new empty registry is used when creating a template contents owner
477
+ // document, so we use that as our parent document to ensure nothing
478
+ // is inherited.
479
+ if (typeof HTMLTemplateElement === 'function') {
480
+ const template = document.createElement('template');
481
+ if (template.content && template.content.ownerDocument) {
482
+ document = template.content.ownerDocument;
483
+ }
484
+ }
485
+ let trustedTypesPolicy;
486
+ let emptyHTML = '';
487
+ const {
488
+ implementation,
489
+ createNodeIterator,
490
+ createDocumentFragment,
491
+ getElementsByTagName
492
+ } = document;
493
+ const {
494
+ importNode
495
+ } = originalDocument;
496
+ let hooks = {};
497
+
498
+ /**
499
+ * Expose whether this browser supports running the full DOMPurify.
500
+ */
501
+ DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && implementation.createHTMLDocument !== undefined;
502
+ const {
503
+ MUSTACHE_EXPR,
504
+ ERB_EXPR,
505
+ TMPLIT_EXPR,
506
+ DATA_ATTR,
507
+ ARIA_ATTR,
508
+ IS_SCRIPT_OR_DATA,
509
+ ATTR_WHITESPACE
510
+ } = EXPRESSIONS;
511
+ let {
512
+ IS_ALLOWED_URI: IS_ALLOWED_URI$1
513
+ } = EXPRESSIONS;
514
+
515
+ /**
516
+ * We consider the elements and attributes below to be safe. Ideally
517
+ * don't add any new ones but feel free to remove unwanted ones.
518
+ */
519
+
520
+ /* allowed element names */
521
+ let ALLOWED_TAGS = null;
522
+ const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
523
+
524
+ /* Allowed attribute names */
525
+ let ALLOWED_ATTR = null;
526
+ const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
527
+
528
+ /*
529
+ * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
530
+ * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
531
+ * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
532
+ * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
533
+ */
534
+ let CUSTOM_ELEMENT_HANDLING = Object.seal(create(null, {
535
+ tagNameCheck: {
536
+ writable: true,
537
+ configurable: false,
538
+ enumerable: true,
539
+ value: null
540
+ },
541
+ attributeNameCheck: {
542
+ writable: true,
543
+ configurable: false,
544
+ enumerable: true,
545
+ value: null
546
+ },
547
+ allowCustomizedBuiltInElements: {
548
+ writable: true,
549
+ configurable: false,
550
+ enumerable: true,
551
+ value: false
552
+ }
553
+ }));
554
+
555
+ /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
556
+ let FORBID_TAGS = null;
557
+
558
+ /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
559
+ let FORBID_ATTR = null;
560
+
561
+ /* Decide if ARIA attributes are okay */
562
+ let ALLOW_ARIA_ATTR = true;
563
+
564
+ /* Decide if custom data attributes are okay */
565
+ let ALLOW_DATA_ATTR = true;
566
+
567
+ /* Decide if unknown protocols are okay */
568
+ let ALLOW_UNKNOWN_PROTOCOLS = false;
569
+
570
+ /* Decide if self-closing tags in attributes are allowed.
571
+ * Usually removed due to a mXSS issue in jQuery 3.0 */
572
+ let ALLOW_SELF_CLOSE_IN_ATTR = true;
573
+
574
+ /* Output should be safe for common template engines.
575
+ * This means, DOMPurify removes data attributes, mustaches and ERB
576
+ */
577
+ let SAFE_FOR_TEMPLATES = false;
578
+
579
+ /* Decide if document with <html>... should be returned */
580
+ let WHOLE_DOCUMENT = false;
581
+
582
+ /* Track whether config is already set on this instance of DOMPurify. */
583
+ let SET_CONFIG = false;
584
+
585
+ /* Decide if all elements (e.g. style, script) must be children of
586
+ * document.body. By default, browsers might move them to document.head */
587
+ let FORCE_BODY = false;
588
+
589
+ /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
590
+ * string (or a TrustedHTML object if Trusted Types are supported).
591
+ * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
592
+ */
593
+ let RETURN_DOM = false;
594
+
595
+ /* Decide if a DOM `DocumentFragment` should be returned, instead of a html
596
+ * string (or a TrustedHTML object if Trusted Types are supported) */
597
+ let RETURN_DOM_FRAGMENT = false;
598
+
599
+ /* Try to return a Trusted Type object instead of a string, return a string in
600
+ * case Trusted Types are not supported */
601
+ let RETURN_TRUSTED_TYPE = false;
602
+
603
+ /* Output should be free from DOM clobbering attacks?
604
+ * This sanitizes markups named with colliding, clobberable built-in DOM APIs.
605
+ */
606
+ let SANITIZE_DOM = true;
607
+
608
+ /* Achieve full DOM Clobbering protection by isolating the namespace of named
609
+ * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
610
+ *
611
+ * HTML/DOM spec rules that enable DOM Clobbering:
612
+ * - Named Access on Window (§7.3.3)
613
+ * - DOM Tree Accessors (§3.1.5)
614
+ * - Form Element Parent-Child Relations (§4.10.3)
615
+ * - Iframe srcdoc / Nested WindowProxies (§4.8.5)
616
+ * - HTMLCollection (§4.2.10.2)
617
+ *
618
+ * Namespace isolation is implemented by prefixing `id` and `name` attributes
619
+ * with a constant string, i.e., `user-content-`
620
+ */
621
+ let SANITIZE_NAMED_PROPS = false;
622
+ const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
623
+
624
+ /* Keep element content when removing element? */
625
+ let KEEP_CONTENT = true;
626
+
627
+ /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
628
+ * of importing it into a new Document and returning a sanitized copy */
629
+ let IN_PLACE = false;
630
+
631
+ /* Allow usage of profiles like html, svg and mathMl */
632
+ let USE_PROFILES = {};
633
+
634
+ /* Tags to ignore content of when KEEP_CONTENT is true */
635
+ let FORBID_CONTENTS = null;
636
+ const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
637
+
638
+ /* Tags that are safe for data: URIs */
639
+ let DATA_URI_TAGS = null;
640
+ const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
641
+
642
+ /* Attributes safe for values like "javascript:" */
643
+ let URI_SAFE_ATTRIBUTES = null;
644
+ const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
645
+ const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
646
+ const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
647
+ const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
648
+ /* Document namespace */
649
+ let NAMESPACE = HTML_NAMESPACE;
650
+ let IS_EMPTY_INPUT = false;
651
+
652
+ /* Allowed XHTML+XML namespaces */
653
+ let ALLOWED_NAMESPACES = null;
654
+ const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
655
+
656
+ /* Parsing of strict XHTML documents */
657
+ let PARSER_MEDIA_TYPE = null;
658
+ const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
659
+ const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
660
+ let transformCaseFunc = null;
661
+
662
+ /* Keep a reference to config to pass to hooks */
663
+ let CONFIG = null;
664
+
665
+ /* Ideally, do not touch anything below this line */
666
+ /* ______________________________________________ */
667
+
668
+ const formElement = document.createElement('form');
669
+ const isRegexOrFunction = function isRegexOrFunction(testValue) {
670
+ return testValue instanceof RegExp || testValue instanceof Function;
671
+ };
672
+
673
+ /**
674
+ * _parseConfig
675
+ *
676
+ * @param {Object} cfg optional config literal
677
+ */
678
+ // eslint-disable-next-line complexity
679
+ const _parseConfig = function _parseConfig() {
680
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
681
+ if (CONFIG && CONFIG === cfg) {
682
+ return;
683
+ }
684
+
685
+ /* Shield configuration object from tampering */
686
+ if (!cfg || typeof cfg !== 'object') {
687
+ cfg = {};
688
+ }
689
+
690
+ /* Shield configuration object from prototype pollution */
691
+ cfg = clone(cfg);
692
+ PARSER_MEDIA_TYPE =
693
+ // eslint-disable-next-line unicorn/prefer-includes
694
+ SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? DEFAULT_PARSER_MEDIA_TYPE : cfg.PARSER_MEDIA_TYPE;
695
+
696
+ // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
697
+ transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
698
+
699
+ /* Set configuration parameters */
700
+ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
701
+ ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
702
+ ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
703
+ URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES),
704
+ // eslint-disable-line indent
705
+ cfg.ADD_URI_SAFE_ATTR,
706
+ // eslint-disable-line indent
707
+ transformCaseFunc // eslint-disable-line indent
708
+ ) // eslint-disable-line indent
709
+ : DEFAULT_URI_SAFE_ATTRIBUTES;
710
+ DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS),
711
+ // eslint-disable-line indent
712
+ cfg.ADD_DATA_URI_TAGS,
713
+ // eslint-disable-line indent
714
+ transformCaseFunc // eslint-disable-line indent
715
+ ) // eslint-disable-line indent
716
+ : DEFAULT_DATA_URI_TAGS;
717
+ FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
718
+ FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
719
+ FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
720
+ USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
721
+ ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
722
+ ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
723
+ ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
724
+ ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
725
+ SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
726
+ WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
727
+ RETURN_DOM = cfg.RETURN_DOM || false; // Default false
728
+ RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
729
+ RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
730
+ FORCE_BODY = cfg.FORCE_BODY || false; // Default false
731
+ SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
732
+ SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
733
+ KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
734
+ IN_PLACE = cfg.IN_PLACE || false; // Default false
735
+ IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
736
+ NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
737
+ CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
738
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
739
+ CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
740
+ }
741
+ if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
742
+ CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
743
+ }
744
+ if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
745
+ CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
746
+ }
747
+ if (SAFE_FOR_TEMPLATES) {
748
+ ALLOW_DATA_ATTR = false;
749
+ }
750
+ if (RETURN_DOM_FRAGMENT) {
751
+ RETURN_DOM = true;
752
+ }
753
+
754
+ /* Parse profile info */
755
+ if (USE_PROFILES) {
756
+ ALLOWED_TAGS = addToSet({}, text);
757
+ ALLOWED_ATTR = [];
758
+ if (USE_PROFILES.html === true) {
759
+ addToSet(ALLOWED_TAGS, html$1);
760
+ addToSet(ALLOWED_ATTR, html);
761
+ }
762
+ if (USE_PROFILES.svg === true) {
763
+ addToSet(ALLOWED_TAGS, svg$1);
764
+ addToSet(ALLOWED_ATTR, svg);
765
+ addToSet(ALLOWED_ATTR, xml);
766
+ }
767
+ if (USE_PROFILES.svgFilters === true) {
768
+ addToSet(ALLOWED_TAGS, svgFilters);
769
+ addToSet(ALLOWED_ATTR, svg);
770
+ addToSet(ALLOWED_ATTR, xml);
771
+ }
772
+ if (USE_PROFILES.mathMl === true) {
773
+ addToSet(ALLOWED_TAGS, mathMl$1);
774
+ addToSet(ALLOWED_ATTR, mathMl);
775
+ addToSet(ALLOWED_ATTR, xml);
776
+ }
777
+ }
778
+
779
+ /* Merge configuration parameters */
780
+ if (cfg.ADD_TAGS) {
781
+ if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
782
+ ALLOWED_TAGS = clone(ALLOWED_TAGS);
783
+ }
784
+ addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
785
+ }
786
+ if (cfg.ADD_ATTR) {
787
+ if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
788
+ ALLOWED_ATTR = clone(ALLOWED_ATTR);
789
+ }
790
+ addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
791
+ }
792
+ if (cfg.ADD_URI_SAFE_ATTR) {
793
+ addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
794
+ }
795
+ if (cfg.FORBID_CONTENTS) {
796
+ if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
797
+ FORBID_CONTENTS = clone(FORBID_CONTENTS);
798
+ }
799
+ addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
800
+ }
801
+
802
+ /* Add #text in case KEEP_CONTENT is set to true */
803
+ if (KEEP_CONTENT) {
804
+ ALLOWED_TAGS['#text'] = true;
805
+ }
806
+
807
+ /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
808
+ if (WHOLE_DOCUMENT) {
809
+ addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
810
+ }
811
+
812
+ /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
813
+ if (ALLOWED_TAGS.table) {
814
+ addToSet(ALLOWED_TAGS, ['tbody']);
815
+ delete FORBID_TAGS.tbody;
816
+ }
817
+ if (cfg.TRUSTED_TYPES_POLICY) {
818
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createHTML !== 'function') {
819
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');
820
+ }
821
+ if (typeof cfg.TRUSTED_TYPES_POLICY.createScriptURL !== 'function') {
822
+ throw typeErrorCreate('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');
823
+ }
824
+
825
+ // Overwrite existing TrustedTypes policy.
826
+ trustedTypesPolicy = cfg.TRUSTED_TYPES_POLICY;
827
+
828
+ // Sign local variables required by `sanitize`.
829
+ emptyHTML = trustedTypesPolicy.createHTML('');
830
+ } else {
831
+ // Uninitialized policy, attempt to initialize the internal dompurify policy.
832
+ if (trustedTypesPolicy === undefined) {
833
+ trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, currentScript);
834
+ }
835
+
836
+ // If creating the internal policy succeeded sign internal variables.
837
+ if (trustedTypesPolicy !== null && typeof emptyHTML === 'string') {
838
+ emptyHTML = trustedTypesPolicy.createHTML('');
839
+ }
840
+ }
841
+
842
+ // Prevent further manipulation of configuration.
843
+ // Not available in IE8, Safari 5, etc.
844
+ if (freeze) {
845
+ freeze(cfg);
846
+ }
847
+ CONFIG = cfg;
848
+ };
849
+ const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
850
+ const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']);
851
+
852
+ // Certain elements are allowed in both SVG and HTML
853
+ // namespace. We need to specify them explicitly
854
+ // so that they don't get erroneously deleted from
855
+ // HTML namespace.
856
+ const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
857
+
858
+ /* Keep track of all possible SVG and MathML tags
859
+ * so that we can perform the namespace checks
860
+ * correctly. */
861
+ const ALL_SVG_TAGS = addToSet({}, [...svg$1, ...svgFilters, ...svgDisallowed]);
862
+ const ALL_MATHML_TAGS = addToSet({}, [...mathMl$1, ...mathMlDisallowed]);
863
+
864
+ /**
865
+ * @param {Element} element a DOM element whose namespace is being checked
866
+ * @returns {boolean} Return false if the element has a
867
+ * namespace that a spec-compliant parser would never
868
+ * return. Return true otherwise.
869
+ */
870
+ const _checkValidNamespace = function _checkValidNamespace(element) {
871
+ let parent = getParentNode(element);
872
+
873
+ // In JSDOM, if we're inside shadow DOM, then parentNode
874
+ // can be null. We just simulate parent in this case.
875
+ if (!parent || !parent.tagName) {
876
+ parent = {
877
+ namespaceURI: NAMESPACE,
878
+ tagName: 'template'
879
+ };
880
+ }
881
+ const tagName = stringToLowerCase(element.tagName);
882
+ const parentTagName = stringToLowerCase(parent.tagName);
883
+ if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
884
+ return false;
885
+ }
886
+ if (element.namespaceURI === SVG_NAMESPACE) {
887
+ // The only way to switch from HTML namespace to SVG
888
+ // is via <svg>. If it happens via any other tag, then
889
+ // it should be killed.
890
+ if (parent.namespaceURI === HTML_NAMESPACE) {
891
+ return tagName === 'svg';
892
+ }
893
+
894
+ // The only way to switch from MathML to SVG is via`
895
+ // svg if parent is either <annotation-xml> or MathML
896
+ // text integration points.
897
+ if (parent.namespaceURI === MATHML_NAMESPACE) {
898
+ return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
899
+ }
900
+
901
+ // We only allow elements that are defined in SVG
902
+ // spec. All others are disallowed in SVG namespace.
903
+ return Boolean(ALL_SVG_TAGS[tagName]);
904
+ }
905
+ if (element.namespaceURI === MATHML_NAMESPACE) {
906
+ // The only way to switch from HTML namespace to MathML
907
+ // is via <math>. If it happens via any other tag, then
908
+ // it should be killed.
909
+ if (parent.namespaceURI === HTML_NAMESPACE) {
910
+ return tagName === 'math';
911
+ }
912
+
913
+ // The only way to switch from SVG to MathML is via
914
+ // <math> and HTML integration points
915
+ if (parent.namespaceURI === SVG_NAMESPACE) {
916
+ return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
917
+ }
918
+
919
+ // We only allow elements that are defined in MathML
920
+ // spec. All others are disallowed in MathML namespace.
921
+ return Boolean(ALL_MATHML_TAGS[tagName]);
922
+ }
923
+ if (element.namespaceURI === HTML_NAMESPACE) {
924
+ // The only way to switch from SVG to HTML is via
925
+ // HTML integration points, and from MathML to HTML
926
+ // is via MathML text integration points
927
+ if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
928
+ return false;
929
+ }
930
+ if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
931
+ return false;
932
+ }
933
+
934
+ // We disallow tags that are specific for MathML
935
+ // or SVG and should never appear in HTML namespace
936
+ return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
937
+ }
938
+
939
+ // For XHTML and XML documents that support custom namespaces
940
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
941
+ return true;
942
+ }
943
+
944
+ // The code should never reach this place (this means
945
+ // that the element somehow got namespace that is not
946
+ // HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
947
+ // Return false just in case.
948
+ return false;
949
+ };
950
+
951
+ /**
952
+ * _forceRemove
953
+ *
954
+ * @param {Node} node a DOM node
955
+ */
956
+ const _forceRemove = function _forceRemove(node) {
957
+ arrayPush(DOMPurify.removed, {
958
+ element: node
959
+ });
960
+ try {
961
+ // eslint-disable-next-line unicorn/prefer-dom-node-remove
962
+ node.parentNode.removeChild(node);
963
+ } catch (_) {
964
+ node.remove();
965
+ }
966
+ };
967
+
968
+ /**
969
+ * _removeAttribute
970
+ *
971
+ * @param {String} name an Attribute name
972
+ * @param {Node} node a DOM node
973
+ */
974
+ const _removeAttribute = function _removeAttribute(name, node) {
975
+ try {
976
+ arrayPush(DOMPurify.removed, {
977
+ attribute: node.getAttributeNode(name),
978
+ from: node
979
+ });
980
+ } catch (_) {
981
+ arrayPush(DOMPurify.removed, {
982
+ attribute: null,
983
+ from: node
984
+ });
985
+ }
986
+ node.removeAttribute(name);
987
+
988
+ // We void attribute values for unremovable "is"" attributes
989
+ if (name === 'is' && !ALLOWED_ATTR[name]) {
990
+ if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
991
+ try {
992
+ _forceRemove(node);
993
+ } catch (_) {}
994
+ } else {
995
+ try {
996
+ node.setAttribute(name, '');
997
+ } catch (_) {}
998
+ }
999
+ }
1000
+ };
1001
+
1002
+ /**
1003
+ * _initDocument
1004
+ *
1005
+ * @param {String} dirty a string of dirty markup
1006
+ * @return {Document} a DOM, filled with the dirty markup
1007
+ */
1008
+ const _initDocument = function _initDocument(dirty) {
1009
+ /* Create a HTML document */
1010
+ let doc = null;
1011
+ let leadingWhitespace = null;
1012
+ if (FORCE_BODY) {
1013
+ dirty = '<remove></remove>' + dirty;
1014
+ } else {
1015
+ /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
1016
+ const matches = stringMatch(dirty, /^[\r\n\t ]+/);
1017
+ leadingWhitespace = matches && matches[0];
1018
+ }
1019
+ if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
1020
+ // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
1021
+ dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
1022
+ }
1023
+ const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
1024
+ /*
1025
+ * Use the DOMParser API by default, fallback later if needs be
1026
+ * DOMParser not work for svg when has multiple root element.
1027
+ */
1028
+ if (NAMESPACE === HTML_NAMESPACE) {
1029
+ try {
1030
+ doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
1031
+ } catch (_) {}
1032
+ }
1033
+
1034
+ /* Use createHTMLDocument in case DOMParser is not available */
1035
+ if (!doc || !doc.documentElement) {
1036
+ doc = implementation.createDocument(NAMESPACE, 'template', null);
1037
+ try {
1038
+ doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
1039
+ } catch (_) {
1040
+ // Syntax error if dirtyPayload is invalid xml
1041
+ }
1042
+ }
1043
+ const body = doc.body || doc.documentElement;
1044
+ if (dirty && leadingWhitespace) {
1045
+ body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
1046
+ }
1047
+
1048
+ /* Work on whole document or just its body */
1049
+ if (NAMESPACE === HTML_NAMESPACE) {
1050
+ return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
1051
+ }
1052
+ return WHOLE_DOCUMENT ? doc.documentElement : body;
1053
+ };
1054
+
1055
+ /**
1056
+ * Creates a NodeIterator object that you can use to traverse filtered lists of nodes or elements in a document.
1057
+ *
1058
+ * @param {Node} root The root element or node to start traversing on.
1059
+ * @return {NodeIterator} The created NodeIterator
1060
+ */
1061
+ const _createNodeIterator = function _createNodeIterator(root) {
1062
+ return createNodeIterator.call(root.ownerDocument || root, root,
1063
+ // eslint-disable-next-line no-bitwise
1064
+ NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null);
1065
+ };
1066
+
1067
+ /**
1068
+ * _isClobbered
1069
+ *
1070
+ * @param {Node} elm element to check for clobbering attacks
1071
+ * @return {Boolean} true if clobbered, false if safe
1072
+ */
1073
+ const _isClobbered = function _isClobbered(elm) {
1074
+ return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
1075
+ };
1076
+
1077
+ /**
1078
+ * Checks whether the given object is a DOM node.
1079
+ *
1080
+ * @param {Node} object object to check whether it's a DOM node
1081
+ * @return {Boolean} true is object is a DOM node
1082
+ */
1083
+ const _isNode = function _isNode(object) {
1084
+ return typeof Node === 'function' && object instanceof Node;
1085
+ };
1086
+
1087
+ /**
1088
+ * _executeHook
1089
+ * Execute user configurable hooks
1090
+ *
1091
+ * @param {String} entryPoint Name of the hook's entry point
1092
+ * @param {Node} currentNode node to work on with the hook
1093
+ * @param {Object} data additional hook parameters
1094
+ */
1095
+ const _executeHook = function _executeHook(entryPoint, currentNode, data) {
1096
+ if (!hooks[entryPoint]) {
1097
+ return;
1098
+ }
1099
+ arrayForEach(hooks[entryPoint], hook => {
1100
+ hook.call(DOMPurify, currentNode, data, CONFIG);
1101
+ });
1102
+ };
1103
+
1104
+ /**
1105
+ * _sanitizeElements
1106
+ *
1107
+ * @protect nodeName
1108
+ * @protect textContent
1109
+ * @protect removeChild
1110
+ *
1111
+ * @param {Node} currentNode to check for permission to exist
1112
+ * @return {Boolean} true if node was killed, false if left alive
1113
+ */
1114
+ const _sanitizeElements = function _sanitizeElements(currentNode) {
1115
+ let content = null;
1116
+
1117
+ /* Execute a hook if present */
1118
+ _executeHook('beforeSanitizeElements', currentNode, null);
1119
+
1120
+ /* Check if element is clobbered or can clobber */
1121
+ if (_isClobbered(currentNode)) {
1122
+ _forceRemove(currentNode);
1123
+ return true;
1124
+ }
1125
+
1126
+ /* Now let's check the element's type and name */
1127
+ const tagName = transformCaseFunc(currentNode.nodeName);
1128
+
1129
+ /* Execute a hook if present */
1130
+ _executeHook('uponSanitizeElement', currentNode, {
1131
+ tagName,
1132
+ allowedTags: ALLOWED_TAGS
1133
+ });
1134
+
1135
+ /* Detect mXSS attempts abusing namespace confusion */
1136
+ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
1137
+ _forceRemove(currentNode);
1138
+ return true;
1139
+ }
1140
+
1141
+ /* Remove element if anything forbids its presence */
1142
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1143
+ /* Check if we have a custom element to handle */
1144
+ if (!FORBID_TAGS[tagName] && _isBasicCustomElement(tagName)) {
1145
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) {
1146
+ return false;
1147
+ }
1148
+ if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) {
1149
+ return false;
1150
+ }
1151
+ }
1152
+
1153
+ /* Keep content except for bad-listed elements */
1154
+ if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
1155
+ const parentNode = getParentNode(currentNode) || currentNode.parentNode;
1156
+ const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
1157
+ if (childNodes && parentNode) {
1158
+ const childCount = childNodes.length;
1159
+ for (let i = childCount - 1; i >= 0; --i) {
1160
+ parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
1161
+ }
1162
+ }
1163
+ }
1164
+ _forceRemove(currentNode);
1165
+ return true;
1166
+ }
1167
+
1168
+ /* Check whether element has a valid namespace */
1169
+ if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
1170
+ _forceRemove(currentNode);
1171
+ return true;
1172
+ }
1173
+
1174
+ /* Make sure that older browsers don't get fallback-tag mXSS */
1175
+ if ((tagName === 'noscript' || tagName === 'noembed' || tagName === 'noframes') && regExpTest(/<\/no(script|embed|frames)/i, currentNode.innerHTML)) {
1176
+ _forceRemove(currentNode);
1177
+ return true;
1178
+ }
1179
+
1180
+ /* Sanitize element content to be template-safe */
1181
+ if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
1182
+ /* Get the element's text content */
1183
+ content = currentNode.textContent;
1184
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1185
+ content = stringReplace(content, expr, ' ');
1186
+ });
1187
+ if (currentNode.textContent !== content) {
1188
+ arrayPush(DOMPurify.removed, {
1189
+ element: currentNode.cloneNode()
1190
+ });
1191
+ currentNode.textContent = content;
1192
+ }
1193
+ }
1194
+
1195
+ /* Execute a hook if present */
1196
+ _executeHook('afterSanitizeElements', currentNode, null);
1197
+ return false;
1198
+ };
1199
+
1200
+ /**
1201
+ * _isValidAttribute
1202
+ *
1203
+ * @param {string} lcTag Lowercase tag name of containing element.
1204
+ * @param {string} lcName Lowercase attribute name.
1205
+ * @param {string} value Attribute value.
1206
+ * @return {Boolean} Returns true if `value` is valid, otherwise false.
1207
+ */
1208
+ // eslint-disable-next-line complexity
1209
+ const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
1210
+ /* Make sure attribute cannot clobber */
1211
+ if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
1212
+ return false;
1213
+ }
1214
+
1215
+ /* Allow valid data-* attributes: At least one character after "-"
1216
+ (https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
1217
+ XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
1218
+ We don't need to check the value; it's always URI safe. */
1219
+ if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
1220
+ if (
1221
+ // First condition does a very basic check if a) it's basically a valid custom element tagname AND
1222
+ // b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1223
+ // and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
1224
+ _isBasicCustomElement(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) ||
1225
+ // Alternative, second condition checks if it's an `is`-attribute, AND
1226
+ // the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
1227
+ lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
1228
+ return false;
1229
+ }
1230
+ /* Check value is safe. First, is attr inert? If so, is safe */
1231
+ } else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (value) {
1232
+ return false;
1233
+ } else ;
1234
+ return true;
1235
+ };
1236
+
1237
+ /**
1238
+ * _isBasicCustomElement
1239
+ * checks if at least one dash is included in tagName, and it's not the first char
1240
+ * for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
1241
+ *
1242
+ * @param {string} tagName name of the tag of the node to sanitize
1243
+ * @returns {boolean} Returns true if the tag name meets the basic criteria for a custom element, otherwise false.
1244
+ */
1245
+ const _isBasicCustomElement = function _isBasicCustomElement(tagName) {
1246
+ return tagName.indexOf('-') > 0;
1247
+ };
1248
+
1249
+ /**
1250
+ * _sanitizeAttributes
1251
+ *
1252
+ * @protect attributes
1253
+ * @protect nodeName
1254
+ * @protect removeAttribute
1255
+ * @protect setAttribute
1256
+ *
1257
+ * @param {Node} currentNode to sanitize
1258
+ */
1259
+ const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
1260
+ /* Execute a hook if present */
1261
+ _executeHook('beforeSanitizeAttributes', currentNode, null);
1262
+ const {
1263
+ attributes
1264
+ } = currentNode;
1265
+
1266
+ /* Check if we have attributes; if not we might have a text node */
1267
+ if (!attributes) {
1268
+ return;
1269
+ }
1270
+ const hookEvent = {
1271
+ attrName: '',
1272
+ attrValue: '',
1273
+ keepAttr: true,
1274
+ allowedAttributes: ALLOWED_ATTR
1275
+ };
1276
+ let l = attributes.length;
1277
+
1278
+ /* Go backwards over all attributes; safely remove bad ones */
1279
+ while (l--) {
1280
+ const attr = attributes[l];
1281
+ const {
1282
+ name,
1283
+ namespaceURI,
1284
+ value: attrValue
1285
+ } = attr;
1286
+ const lcName = transformCaseFunc(name);
1287
+ let value = name === 'value' ? attrValue : stringTrim(attrValue);
1288
+
1289
+ /* Execute a hook if present */
1290
+ hookEvent.attrName = lcName;
1291
+ hookEvent.attrValue = value;
1292
+ hookEvent.keepAttr = true;
1293
+ hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
1294
+ _executeHook('uponSanitizeAttribute', currentNode, hookEvent);
1295
+ value = hookEvent.attrValue;
1296
+ /* Did the hooks approve of the attribute? */
1297
+ if (hookEvent.forceKeepAttr) {
1298
+ continue;
1299
+ }
1300
+
1301
+ /* Remove attribute */
1302
+ _removeAttribute(name, currentNode);
1303
+
1304
+ /* Did the hooks approve of the attribute? */
1305
+ if (!hookEvent.keepAttr) {
1306
+ continue;
1307
+ }
1308
+
1309
+ /* Work around a security issue in jQuery 3.0 */
1310
+ if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
1311
+ _removeAttribute(name, currentNode);
1312
+ continue;
1313
+ }
1314
+
1315
+ /* Sanitize attribute content to be template-safe */
1316
+ if (SAFE_FOR_TEMPLATES) {
1317
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1318
+ value = stringReplace(value, expr, ' ');
1319
+ });
1320
+ }
1321
+
1322
+ /* Is `value` valid for this attribute? */
1323
+ const lcTag = transformCaseFunc(currentNode.nodeName);
1324
+ if (!_isValidAttribute(lcTag, lcName, value)) {
1325
+ continue;
1326
+ }
1327
+
1328
+ /* Full DOM Clobbering protection via namespace isolation,
1329
+ * Prefix id and name attributes with `user-content-`
1330
+ */
1331
+ if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
1332
+ // Remove the attribute with this value
1333
+ _removeAttribute(name, currentNode);
1334
+
1335
+ // Prefix the value and later re-create the attribute with the sanitized value
1336
+ value = SANITIZE_NAMED_PROPS_PREFIX + value;
1337
+ }
1338
+
1339
+ /* Handle attributes that require Trusted Types */
1340
+ if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
1341
+ if (namespaceURI) ; else {
1342
+ switch (trustedTypes.getAttributeType(lcTag, lcName)) {
1343
+ case 'TrustedHTML':
1344
+ {
1345
+ value = trustedTypesPolicy.createHTML(value);
1346
+ break;
1347
+ }
1348
+ case 'TrustedScriptURL':
1349
+ {
1350
+ value = trustedTypesPolicy.createScriptURL(value);
1351
+ break;
1352
+ }
1353
+ }
1354
+ }
1355
+ }
1356
+
1357
+ /* Handle invalid data-* attribute set by try-catching it */
1358
+ try {
1359
+ if (namespaceURI) {
1360
+ currentNode.setAttributeNS(namespaceURI, name, value);
1361
+ } else {
1362
+ /* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
1363
+ currentNode.setAttribute(name, value);
1364
+ }
1365
+ arrayPop(DOMPurify.removed);
1366
+ } catch (_) {}
1367
+ }
1368
+
1369
+ /* Execute a hook if present */
1370
+ _executeHook('afterSanitizeAttributes', currentNode, null);
1371
+ };
1372
+
1373
+ /**
1374
+ * _sanitizeShadowDOM
1375
+ *
1376
+ * @param {DocumentFragment} fragment to iterate over recursively
1377
+ */
1378
+ const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
1379
+ let shadowNode = null;
1380
+ const shadowIterator = _createNodeIterator(fragment);
1381
+
1382
+ /* Execute a hook if present */
1383
+ _executeHook('beforeSanitizeShadowDOM', fragment, null);
1384
+ while (shadowNode = shadowIterator.nextNode()) {
1385
+ /* Execute a hook if present */
1386
+ _executeHook('uponSanitizeShadowNode', shadowNode, null);
1387
+
1388
+ /* Sanitize tags and elements */
1389
+ if (_sanitizeElements(shadowNode)) {
1390
+ continue;
1391
+ }
1392
+
1393
+ /* Deep shadow DOM detected */
1394
+ if (shadowNode.content instanceof DocumentFragment) {
1395
+ _sanitizeShadowDOM(shadowNode.content);
1396
+ }
1397
+
1398
+ /* Check attributes, sanitize if necessary */
1399
+ _sanitizeAttributes(shadowNode);
1400
+ }
1401
+
1402
+ /* Execute a hook if present */
1403
+ _executeHook('afterSanitizeShadowDOM', fragment, null);
1404
+ };
1405
+
1406
+ /**
1407
+ * Sanitize
1408
+ * Public method providing core sanitation functionality
1409
+ *
1410
+ * @param {String|Node} dirty string or DOM node
1411
+ * @param {Object} cfg object
1412
+ */
1413
+ // eslint-disable-next-line complexity
1414
+ DOMPurify.sanitize = function (dirty) {
1415
+ let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1416
+ let body = null;
1417
+ let importedNode = null;
1418
+ let currentNode = null;
1419
+ let returnNode = null;
1420
+ /* Make sure we have a string to sanitize.
1421
+ DO NOT return early, as this will return the wrong type if
1422
+ the user has requested a DOM object rather than a string */
1423
+ IS_EMPTY_INPUT = !dirty;
1424
+ if (IS_EMPTY_INPUT) {
1425
+ dirty = '<!-->';
1426
+ }
1427
+
1428
+ /* Stringify, in case dirty is an object */
1429
+ if (typeof dirty !== 'string' && !_isNode(dirty)) {
1430
+ if (typeof dirty.toString === 'function') {
1431
+ dirty = dirty.toString();
1432
+ if (typeof dirty !== 'string') {
1433
+ throw typeErrorCreate('dirty is not a string, aborting');
1434
+ }
1435
+ } else {
1436
+ throw typeErrorCreate('toString is not a function');
1437
+ }
1438
+ }
1439
+
1440
+ /* Return dirty HTML if DOMPurify cannot run */
1441
+ if (!DOMPurify.isSupported) {
1442
+ return dirty;
1443
+ }
1444
+
1445
+ /* Assign config vars */
1446
+ if (!SET_CONFIG) {
1447
+ _parseConfig(cfg);
1448
+ }
1449
+
1450
+ /* Clean up removed elements */
1451
+ DOMPurify.removed = [];
1452
+
1453
+ /* Check if dirty is correctly typed for IN_PLACE */
1454
+ if (typeof dirty === 'string') {
1455
+ IN_PLACE = false;
1456
+ }
1457
+ if (IN_PLACE) {
1458
+ /* Do some early pre-sanitization to avoid unsafe root nodes */
1459
+ if (dirty.nodeName) {
1460
+ const tagName = transformCaseFunc(dirty.nodeName);
1461
+ if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
1462
+ throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
1463
+ }
1464
+ }
1465
+ } else if (dirty instanceof Node) {
1466
+ /* If dirty is a DOM element, append to an empty document to avoid
1467
+ elements being stripped by the parser */
1468
+ body = _initDocument('<!---->');
1469
+ importedNode = body.ownerDocument.importNode(dirty, true);
1470
+ if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
1471
+ /* Node is already a body, use as is */
1472
+ body = importedNode;
1473
+ } else if (importedNode.nodeName === 'HTML') {
1474
+ body = importedNode;
1475
+ } else {
1476
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1477
+ body.appendChild(importedNode);
1478
+ }
1479
+ } else {
1480
+ /* Exit directly if we have nothing to do */
1481
+ if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT &&
1482
+ // eslint-disable-next-line unicorn/prefer-includes
1483
+ dirty.indexOf('<') === -1) {
1484
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
1485
+ }
1486
+
1487
+ /* Initialize the document to work on */
1488
+ body = _initDocument(dirty);
1489
+
1490
+ /* Check we have a DOM node from the data */
1491
+ if (!body) {
1492
+ return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
1493
+ }
1494
+ }
1495
+
1496
+ /* Remove first element node (ours) if FORCE_BODY is set */
1497
+ if (body && FORCE_BODY) {
1498
+ _forceRemove(body.firstChild);
1499
+ }
1500
+
1501
+ /* Get node iterator */
1502
+ const nodeIterator = _createNodeIterator(IN_PLACE ? dirty : body);
1503
+
1504
+ /* Now start iterating over the created document */
1505
+ while (currentNode = nodeIterator.nextNode()) {
1506
+ /* Sanitize tags and elements */
1507
+ if (_sanitizeElements(currentNode)) {
1508
+ continue;
1509
+ }
1510
+
1511
+ /* Shadow DOM detected, sanitize it */
1512
+ if (currentNode.content instanceof DocumentFragment) {
1513
+ _sanitizeShadowDOM(currentNode.content);
1514
+ }
1515
+
1516
+ /* Check attributes, sanitize if necessary */
1517
+ _sanitizeAttributes(currentNode);
1518
+ }
1519
+
1520
+ /* If we sanitized `dirty` in-place, return it. */
1521
+ if (IN_PLACE) {
1522
+ return dirty;
1523
+ }
1524
+
1525
+ /* Return sanitized string or DOM */
1526
+ if (RETURN_DOM) {
1527
+ if (RETURN_DOM_FRAGMENT) {
1528
+ returnNode = createDocumentFragment.call(body.ownerDocument);
1529
+ while (body.firstChild) {
1530
+ // eslint-disable-next-line unicorn/prefer-dom-node-append
1531
+ returnNode.appendChild(body.firstChild);
1532
+ }
1533
+ } else {
1534
+ returnNode = body;
1535
+ }
1536
+ if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmode) {
1537
+ /*
1538
+ AdoptNode() is not used because internal state is not reset
1539
+ (e.g. the past names map of a HTMLFormElement), this is safe
1540
+ in theory but we would rather not risk another attack vector.
1541
+ The state that is cloned by importNode() is explicitly defined
1542
+ by the specs.
1543
+ */
1544
+ returnNode = importNode.call(originalDocument, returnNode, true);
1545
+ }
1546
+ return returnNode;
1547
+ }
1548
+ let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
1549
+
1550
+ /* Serialize doctype if allowed */
1551
+ if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
1552
+ serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
1553
+ }
1554
+
1555
+ /* Sanitize final string template-safe */
1556
+ if (SAFE_FOR_TEMPLATES) {
1557
+ arrayForEach([MUSTACHE_EXPR, ERB_EXPR, TMPLIT_EXPR], expr => {
1558
+ serializedHTML = stringReplace(serializedHTML, expr, ' ');
1559
+ });
1560
+ }
1561
+ return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
1562
+ };
1563
+
1564
+ /**
1565
+ * Public method to set the configuration once
1566
+ * setConfig
1567
+ *
1568
+ * @param {Object} cfg configuration object
1569
+ */
1570
+ DOMPurify.setConfig = function () {
1571
+ let cfg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1572
+ _parseConfig(cfg);
1573
+ SET_CONFIG = true;
1574
+ };
1575
+
1576
+ /**
1577
+ * Public method to remove the configuration
1578
+ * clearConfig
1579
+ *
1580
+ */
1581
+ DOMPurify.clearConfig = function () {
1582
+ CONFIG = null;
1583
+ SET_CONFIG = false;
1584
+ };
1585
+
1586
+ /**
1587
+ * Public method to check if an attribute value is valid.
1588
+ * Uses last set config, if any. Otherwise, uses config defaults.
1589
+ * isValidAttribute
1590
+ *
1591
+ * @param {String} tag Tag name of containing element.
1592
+ * @param {String} attr Attribute name.
1593
+ * @param {String} value Attribute value.
1594
+ * @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
1595
+ */
1596
+ DOMPurify.isValidAttribute = function (tag, attr, value) {
1597
+ /* Initialize shared config vars if necessary. */
1598
+ if (!CONFIG) {
1599
+ _parseConfig({});
1600
+ }
1601
+ const lcTag = transformCaseFunc(tag);
1602
+ const lcName = transformCaseFunc(attr);
1603
+ return _isValidAttribute(lcTag, lcName, value);
1604
+ };
1605
+
1606
+ /**
1607
+ * AddHook
1608
+ * Public method to add DOMPurify hooks
1609
+ *
1610
+ * @param {String} entryPoint entry point for the hook to add
1611
+ * @param {Function} hookFunction function to execute
1612
+ */
1613
+ DOMPurify.addHook = function (entryPoint, hookFunction) {
1614
+ if (typeof hookFunction !== 'function') {
1615
+ return;
1616
+ }
1617
+ hooks[entryPoint] = hooks[entryPoint] || [];
1618
+ arrayPush(hooks[entryPoint], hookFunction);
1619
+ };
1620
+
1621
+ /**
1622
+ * RemoveHook
1623
+ * Public method to remove a DOMPurify hook at a given entryPoint
1624
+ * (pops it from the stack of hooks if more are present)
1625
+ *
1626
+ * @param {String} entryPoint entry point for the hook to remove
1627
+ * @return {Function} removed(popped) hook
1628
+ */
1629
+ DOMPurify.removeHook = function (entryPoint) {
1630
+ if (hooks[entryPoint]) {
1631
+ return arrayPop(hooks[entryPoint]);
1632
+ }
1633
+ };
1634
+
1635
+ /**
1636
+ * RemoveHooks
1637
+ * Public method to remove all DOMPurify hooks at a given entryPoint
1638
+ *
1639
+ * @param {String} entryPoint entry point for the hooks to remove
1640
+ */
1641
+ DOMPurify.removeHooks = function (entryPoint) {
1642
+ if (hooks[entryPoint]) {
1643
+ hooks[entryPoint] = [];
1644
+ }
1645
+ };
1646
+
1647
+ /**
1648
+ * RemoveAllHooks
1649
+ * Public method to remove all DOMPurify hooks
1650
+ */
1651
+ DOMPurify.removeAllHooks = function () {
1652
+ hooks = {};
1653
+ };
1654
+ return DOMPurify;
1655
+ }
1656
+ var purify = createDOMPurify();
1657
+
1658
+ return purify;
1659
+
1660
+ }));
1661
+
1662
+ }(purify));
1663
+
1664
+ const DOMPurify = purify.exports;
1665
+
1666
+ const nylasViewEmailCss = ":host{display:inline-grid;overflow:hidden;width:100%}.view-email{width:100%}.view-email div.gmail_quote{display:none;color:var(--nylas-color-primary-400)}.view-email div.gmail_quote.show{display:block}.view-email blockquote{border-color:var(--nylas-color-primary-500) !important}.view-email .nylas-view-email-toggle-button{display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600);border:0;border-radius:2px;font-size:14px;font-weight:500;line-height:1.5;transition:all 0.2s ease-in-out}.view-email .nylas-view-email-toggle-button:hover{background-color:var(--nylas-color-primary-200);color:var(--nylas-color-primary-600)}";
1667
+ const NylasViewEmailStyle0 = nylasViewEmailCss;
1668
+
1669
+ DOMPurify.addHook('afterSanitizeAttributes', function (node) {
1670
+ if ('target' in node) {
1671
+ node.setAttribute('target', '_blank');
1672
+ node.setAttribute('rel', 'noopener');
1673
+ }
1674
+ });
1675
+ const NylasViewEmail = proxyCustomElement(class NylasViewEmail extends HTMLElement$1 {
1676
+ constructor() {
1677
+ super();
1678
+ this.__registerHost();
1679
+ this.__attachShadow();
1680
+ this.htmlElement = document.createElement('html');
1681
+ this.setBody = (body) => {
1682
+ this.state = 'loading';
1683
+ this.styles = [];
1684
+ this.hoistedFontURLs = new Map();
1685
+ this.sanitizedBody = '';
1686
+ document.querySelectorAll('.nylas-view-email-font').forEach(link => {
1687
+ link.remove();
1688
+ });
1689
+ const isHTML = this.message ? detectIfMessageIsHTML(this.message) : detectHTMLOrPlainText(body);
1690
+ if (!isHTML) {
1691
+ body = `<html><body>${parsePlainTextToHTML(body)}</body></html>`;
1692
+ }
1693
+ this.htmlElement.innerHTML = body;
1694
+ if (this.detectDarkMode) {
1695
+ processStyles(this.htmlElement);
1696
+ }
1697
+ this.htmlElement.querySelectorAll('link').forEach(link => {
1698
+ console.debug(`[nylas-view-email] Hoisting link: ${link.getAttribute('href')}`);
1699
+ if (link.getAttribute('rel') === 'stylesheet' && link.getAttribute('href')) {
1700
+ const href = link.getAttribute('href');
1701
+ if (href) {
1702
+ const url = new URL(href, window.location.href);
1703
+ if (url.protocol === 'https:' || url.protocol === 'http:') {
1704
+ this.hoistedFontURLs.set(url.href, url.href);
1705
+ }
1706
+ }
1707
+ }
1708
+ });
1709
+ this.htmlElement.querySelectorAll('style').forEach(style => {
1710
+ style.innerHTML.split('\n').forEach(line => {
1711
+ const match = line.match(/@import url\((.*)\)/);
1712
+ if (match) {
1713
+ const url = new URL(match[1], window.location.href);
1714
+ if (url.protocol === 'https:' || url.protocol === 'http:') {
1715
+ this.hoistedFontURLs.set(url.href, url.href);
1716
+ }
1717
+ }
1718
+ });
1719
+ style.innerHTML = style.innerHTML.replace('body', ':host');
1720
+ this.styles.push(style);
1721
+ style.remove();
1722
+ });
1723
+ this.htmlElement.querySelectorAll('a').forEach(a => {
1724
+ a.setAttribute('target', '_blank');
1725
+ });
1726
+ const gmailQuote = this.htmlElement.querySelector('.gmail_quote');
1727
+ if (gmailQuote) {
1728
+ const toggleButton = document.createElement('button');
1729
+ toggleButton.classList.add('nylas-view-email-toggle-button');
1730
+ toggleButton.setAttribute('aria-label', 'Show quoted text');
1731
+ toggleButton.innerText = '...';
1732
+ gmailQuote.parentElement?.insertBefore(toggleButton, gmailQuote);
1733
+ }
1734
+ this.sanitizedBody = DOMPurify.sanitize(this.htmlElement.innerHTML);
1735
+ this.hoistedFontURLs.forEach((url, _key) => {
1736
+ const link = document.createElement('link');
1737
+ link.setAttribute('rel', 'stylesheet');
1738
+ link.setAttribute('href', url);
1739
+ link.classList.add('nylas-view-email-font');
1740
+ document.head.appendChild(link);
1741
+ });
1742
+ this.state = 'ready';
1743
+ };
1744
+ this.handleMobileSize = () => {
1745
+ const vw = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0);
1746
+ if (vw <= 768) {
1747
+ const viewEmailReact = this.viewEmailElement?.getBoundingClientRect();
1748
+ if (viewEmailReact && this.viewEmailElement && this.parent) {
1749
+ if (viewEmailReact.width > vw) {
1750
+ const parentElement = this.parent;
1751
+ const parentReact = parentElement?.getBoundingClientRect();
1752
+ debug('Parent width:', parentReact?.width, 'Parent height:', parentReact?.height);
1753
+ debug('Parent client width:', parentElement.clientWidth, 'Parent client height:', parentElement.clientHeight);
1754
+ const scaleX = parentReact.width / viewEmailReact.width;
1755
+ const scaleY = parentReact.height / viewEmailReact.height;
1756
+ const scale = Math.min(scaleX, scaleY);
1757
+ debug('Scale:', scale);
1758
+ this.viewEmailElement.style.setProperty('transform', `scale(${scale})`);
1759
+ this.viewEmailElement.style.setProperty('transform-origin', `top left`);
1760
+ this.viewEmailElement.style.setProperty('height', `${viewEmailReact.height * scale}px`);
1761
+ }
1762
+ }
1763
+ }
1764
+ else {
1765
+ this.viewEmailElement?.style.removeProperty('transform');
1766
+ this.viewEmailElement?.style.removeProperty('transform-origin');
1767
+ this.viewEmailElement?.style.removeProperty('height');
1768
+ }
1769
+ };
1770
+ this.message = undefined;
1771
+ this.parent = undefined;
1772
+ this.attachments = [];
1773
+ this.detectDarkMode = true;
1774
+ this.state = 'loading';
1775
+ this.sanitizedBody = '';
1776
+ this.styles = [];
1777
+ this.viewEmailElement = undefined;
1778
+ this.hoistedFontURLs = new Map();
1779
+ }
1780
+ connectedCallback() { }
1781
+ disconnectedCallback() {
1782
+ debug(`[nylas-view-email] Component disconnected`);
1783
+ this.state = 'loading';
1784
+ this.styles = [];
1785
+ this.hoistedFontURLs = new Map();
1786
+ this.sanitizedBody = '';
1787
+ document.querySelectorAll('.nylas-view-email-font').forEach(link => {
1788
+ link.remove();
1789
+ });
1790
+ }
1791
+ async componentWillLoad() {
1792
+ debug(`[nylas-view-email] component loaded`);
1793
+ this.setBody(this.message?.body ?? '');
1794
+ }
1795
+ async componentDidLoad() {
1796
+ debug(`[nylas-view-thread] Component did load`);
1797
+ this.handleMobileSize();
1798
+ }
1799
+ async messageChanged() {
1800
+ debug(`[nylas-view-thread] Message changed`, { message: this.message });
1801
+ this.setBody(this.message?.body ?? '');
1802
+ }
1803
+ handleScroll() {
1804
+ this.handleMobileSize();
1805
+ }
1806
+ viewEmailElementChanged() {
1807
+ const toggleButton = this.viewEmailElement?.querySelectorAll('.nylas-view-email-toggle-button');
1808
+ if (toggleButton) {
1809
+ toggleButton.forEach(button => {
1810
+ button.addEventListener('click', () => {
1811
+ const gmailQuote = this.viewEmailElement?.querySelector('.gmail_quote');
1812
+ if (gmailQuote) {
1813
+ gmailQuote.classList.toggle('show');
1814
+ }
1815
+ });
1816
+ });
1817
+ }
1818
+ }
1819
+ render() {
1820
+ console.debug(`[nylas-view-email] render`, { hoistedFontURLs: this.hoistedFontURLs });
1821
+ return (h(Host, { key: 'c32409cd5bf30781d0d400103e9715bf48e13b23' }, this.state === 'loading' && h("div", null, "Loading..."), this.state === 'ready' && (h(Fragment, null, this.styles.map(style => (h("style", null, DOMPurify.sanitize(style.innerHTML)))), h("div", { class: 'view-email', part: "view-email", innerHTML: this.sanitizedBody, ref: el => (this.viewEmailElement = el) })))));
1822
+ }
1823
+ get host() { return this; }
1824
+ static get watchers() { return {
1825
+ "message": ["messageChanged"],
1826
+ "viewEmailElement": ["viewEmailElementChanged"]
1827
+ }; }
1828
+ static get style() { return NylasViewEmailStyle0; }
1829
+ }, [1, "nylas-view-email", {
1830
+ "message": [16],
1831
+ "parent": [16],
1832
+ "attachments": [16],
1833
+ "detectDarkMode": [4, "detect-dark-mode"],
1834
+ "state": [32],
1835
+ "sanitizedBody": [32],
1836
+ "styles": [32],
1837
+ "viewEmailElement": [32],
1838
+ "hoistedFontURLs": [32]
1839
+ }, [[9, "resize", "handleScroll"]], {
1840
+ "message": ["messageChanged"],
1841
+ "viewEmailElement": ["viewEmailElementChanged"]
1842
+ }]);
1843
+ function defineCustomElement() {
1844
+ if (typeof customElements === "undefined") {
1845
+ return;
1846
+ }
1847
+ const components = ["nylas-view-email"];
1848
+ components.forEach(tagName => { switch (tagName) {
1849
+ case "nylas-view-email":
1850
+ if (!customElements.get(tagName)) {
1851
+ customElements.define(tagName, NylasViewEmail);
1852
+ }
1853
+ break;
1854
+ } });
1855
+ }
1856
+
1857
+ export { NylasViewEmail as N, defineCustomElement as d };
1858
+
1859
+ //# sourceMappingURL=nylas-view-email2.js.map