@nylas/react 1.1.5 → 1.1.7

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 (227) hide show
  1. package/dist/{add-circle-icon_2.entry-31acee1d.cjs → add-circle-icon_2.entry-5814b516.cjs} +1 -1
  2. package/dist/{add-circle-icon_2.entry-1e899552.js → add-circle-icon_2.entry-5db67b5b.js} +1 -1
  3. package/dist/add-circle-icon_2.entry-95b23b9d.js +25 -0
  4. package/dist/add-circle-icon_2.entry-ae11c837.cjs +1 -0
  5. package/dist/{archive-icon.entry-e932c9e6.cjs → archive-icon.entry-10ebbf9a.cjs} +1 -1
  6. package/dist/archive-icon.entry-2ead8ef0.cjs +1 -0
  7. package/dist/{archive-icon.entry-b5f307e8.js → archive-icon.entry-769e863b.js} +1 -1
  8. package/dist/archive-icon.entry-b28d195c.js +15 -0
  9. package/dist/{arrow-icon.entry-e35a6cad.cjs → arrow-icon.entry-024d613a.cjs} +1 -1
  10. package/dist/{arrow-icon.entry-aae2e22d.js → arrow-icon.entry-1ebd553a.js} +1 -1
  11. package/dist/arrow-icon.entry-8de38831.cjs +1 -0
  12. package/dist/arrow-icon.entry-e29d7a6c.js +15 -0
  13. package/dist/{bold-icon.entry-d5d86b3f.js → bold-icon.entry-17c78a12.js} +1 -1
  14. package/dist/bold-icon.entry-316f5e61.js +15 -0
  15. package/dist/{bold-icon.entry-1e3c9b1f.cjs → bold-icon.entry-8bc27b72.cjs} +1 -1
  16. package/dist/bold-icon.entry-caf96585.cjs +1 -0
  17. package/dist/{button-component_2.entry-5284316e.js → button-component_2.entry-1095ad9f.js} +1 -1
  18. package/dist/button-component_2.entry-531a725d.js +26 -0
  19. package/dist/{button-component_2.entry-a86f8dca.cjs → button-component_2.entry-5cd0adf0.cjs} +1 -1
  20. package/dist/button-component_2.entry-64a41161.cjs +1 -0
  21. package/dist/{calendar-agenda-fill-icon_54.entry-5672c589.js → calendar-agenda-fill-icon_54.entry-6b2114d5.js} +309 -294
  22. package/dist/calendar-agenda-fill-icon_54.entry-84e72636.js +5656 -0
  23. package/dist/calendar-agenda-fill-icon_54.entry-abb96e20.cjs +10 -0
  24. package/dist/calendar-agenda-fill-icon_54.entry-f5577fdb.cjs +10 -0
  25. package/dist/{calendar-cancel-icon.entry-e9792eaa.cjs → calendar-cancel-icon.entry-4c58ea10.cjs} +1 -1
  26. package/dist/{calendar-cancel-icon.entry-7f81de9d.js → calendar-cancel-icon.entry-d27593a5.js} +1 -1
  27. package/dist/calendar-cancel-icon.entry-f11e5aaa.cjs +1 -0
  28. package/dist/calendar-cancel-icon.entry-f1a6f9bc.js +15 -0
  29. package/dist/{calendar-check-icon_2.entry-84db1700.js → calendar-check-icon_2.entry-38e1140b.js} +1 -1
  30. package/dist/{calendar-check-icon_2.entry-ad055b37.cjs → calendar-check-icon_2.entry-4a35f416.cjs} +1 -1
  31. package/dist/calendar-check-icon_2.entry-52187599.cjs +1 -0
  32. package/dist/calendar-check-icon_2.entry-7f17a3a6.js +25 -0
  33. package/dist/{calendar-icon.entry-019f7feb.cjs → calendar-icon.entry-002ee369.cjs} +1 -1
  34. package/dist/calendar-icon.entry-3c5c97d4.cjs +1 -0
  35. package/dist/{calendar-icon.entry-45db1630.js → calendar-icon.entry-4543de86.js} +1 -1
  36. package/dist/calendar-icon.entry-b76e26e6.js +15 -0
  37. package/dist/{checkbox-component_2.entry-8325ff88.cjs → checkbox-component_2.entry-ad4ab088.cjs} +1 -1
  38. package/dist/checkbox-component_2.entry-b24885e9.cjs +1 -0
  39. package/dist/{checkbox-component_2.entry-84a053ff.js → checkbox-component_2.entry-cf15106d.js} +1 -1
  40. package/dist/checkbox-component_2.entry-e4a3dd2d.js +79 -0
  41. package/dist/{chevron-icon_3.entry-0edde2a6.cjs → chevron-icon_3.entry-582df6f7.cjs} +1 -1
  42. package/dist/chevron-icon_3.entry-59d8b408.cjs +1 -0
  43. package/dist/{chevron-icon_3.entry-ec894a13.js → chevron-icon_3.entry-5e60a853.js} +1 -1
  44. package/dist/chevron-icon_3.entry-cab72db3.js +143 -0
  45. package/dist/{clock-icon_4.entry-935fe48d.cjs → clock-icon_4.entry-8348282a.cjs} +1 -1
  46. package/dist/{clock-icon_4.entry-8ec9c29b.js → clock-icon_4.entry-d03310ae.js} +1 -1
  47. package/dist/clock-icon_4.entry-f6b9f85d.js +45 -0
  48. package/dist/clock-icon_4.entry-fcbc39b0.cjs +1 -0
  49. package/dist/{copy-icon.entry-d9405510.js → copy-icon.entry-3ea78e28.js} +1 -1
  50. package/dist/copy-icon.entry-430beab4.js +15 -0
  51. package/dist/{copy-icon.entry-5a2030da.cjs → copy-icon.entry-5337f980.cjs} +1 -1
  52. package/dist/copy-icon.entry-74a59fc5.cjs +1 -0
  53. package/dist/{delete-icon.entry-1b0a3ba4.js → delete-icon.entry-480ac215.js} +1 -1
  54. package/dist/{delete-icon.entry-3f3d1ffb.cjs → delete-icon.entry-87b2daaa.cjs} +1 -1
  55. package/dist/delete-icon.entry-9c1af040.js +15 -0
  56. package/dist/delete-icon.entry-e320cde1.cjs +1 -0
  57. package/dist/{document-refresh-icon.entry-fab58d33.js → document-refresh-icon.entry-665a7947.js} +1 -1
  58. package/dist/{document-refresh-icon.entry-59a18097.cjs → document-refresh-icon.entry-6be2b468.cjs} +1 -1
  59. package/dist/document-refresh-icon.entry-930ee2b7.js +15 -0
  60. package/dist/document-refresh-icon.entry-fcde4ff6.cjs +1 -0
  61. package/dist/{feedbackSync-b56b29ed-7a1f1f75.js → feedbackSync-b56b29ed-36483932.js} +1 -1
  62. package/dist/{feedbackSync-b56b29ed-b6f352f3.cjs → feedbackSync-b56b29ed-599103b9.cjs} +1 -1
  63. package/dist/feedbackSync-b56b29ed-7a7c650e.cjs +448 -0
  64. package/dist/feedbackSync-b56b29ed-9e38fdb6.js +6035 -0
  65. package/dist/{folder-icon.entry-e85383b6.cjs → folder-icon.entry-89f0974f.cjs} +1 -1
  66. package/dist/folder-icon.entry-977e50eb.cjs +1 -0
  67. package/dist/{folder-icon.entry-b5a123d0.js → folder-icon.entry-9bf864d7.js} +1 -1
  68. package/dist/folder-icon.entry-b80d8fd7.js +15 -0
  69. package/dist/{forward-icon.entry-88ab1a85.js → forward-icon.entry-2b0167a7.js} +1 -1
  70. package/dist/{forward-icon.entry-7c8ed4c3.cjs → forward-icon.entry-699c55d9.cjs} +1 -1
  71. package/dist/forward-icon.entry-c4c20f31.cjs +1 -0
  72. package/dist/forward-icon.entry-eb64aa16.js +15 -0
  73. package/dist/{globe-icon.entry-b1253516.cjs → globe-icon.entry-3d08a9c4.cjs} +1 -1
  74. package/dist/{globe-icon.entry-6fb414ca.js → globe-icon.entry-5d962e7a.js} +1 -1
  75. package/dist/globe-icon.entry-5ef1dc42.cjs +1 -0
  76. package/dist/globe-icon.entry-667987bd.js +15 -0
  77. package/dist/{google-logo-icon_4.entry-ae09d065.cjs → google-logo-icon_4.entry-12f1492f.cjs} +1 -1
  78. package/dist/google-logo-icon_4.entry-bd4d2237.cjs +1 -0
  79. package/dist/{google-logo-icon_4.entry-fe627741.js → google-logo-icon_4.entry-ec724f2e.js} +101 -101
  80. package/dist/google-logo-icon_4.entry-fc38681e.js +729 -0
  81. package/dist/{inbox-icon.entry-cec35da1.js → inbox-icon.entry-2020fa96.js} +1 -1
  82. package/dist/{inbox-icon.entry-7dce836e.cjs → inbox-icon.entry-45414f66.cjs} +1 -1
  83. package/dist/inbox-icon.entry-49353988.js +15 -0
  84. package/dist/inbox-icon.entry-b556231f.cjs +1 -0
  85. package/dist/index-290b2932.cjs +81 -0
  86. package/dist/{index-3fd31877.js → index-2b208d5d.js} +50 -50
  87. package/dist/{index-bd6fdc8c.cjs → index-bf124f70.cjs} +2 -2
  88. package/dist/index-fb096a02.js +13011 -0
  89. package/dist/{index.es-c7ca1bad-0a324dca.cjs → index.es-c7ca1bad-67a99f41.cjs} +1 -1
  90. package/dist/{index.es-c7ca1bad-b895d84b.js → index.es-c7ca1bad-70899f2a.js} +1 -1
  91. package/dist/index.es-c7ca1bad-b7a3e6bd.cjs +7 -0
  92. package/dist/index.es-c7ca1bad-cb3a99a7.js +3129 -0
  93. package/dist/{info-icon_2.entry-1dab6311.cjs → info-icon_2.entry-237205a0.cjs} +1 -1
  94. package/dist/{info-icon_2.entry-f7e6b4aa.js → info-icon_2.entry-b98a2882.js} +1 -1
  95. package/dist/info-icon_2.entry-caf64c28.cjs +1 -0
  96. package/dist/info-icon_2.entry-d935e5c2.js +34 -0
  97. package/dist/{input-color-picker.entry-30cda4e2.js → input-color-picker.entry-684413c1.js} +1 -1
  98. package/dist/input-color-picker.entry-752534de.js +48 -0
  99. package/dist/{input-color-picker.entry-b6e53c29.cjs → input-color-picker.entry-8fe3482d.cjs} +1 -1
  100. package/dist/input-color-picker.entry-f856fce3.cjs +1 -0
  101. package/dist/{input-component.entry-7a04bc8b.js → input-component.entry-00b97287.js} +1 -1
  102. package/dist/input-component.entry-4400f98e.js +70 -0
  103. package/dist/{input-component.entry-1f1f8e00.cjs → input-component.entry-bcd13373.cjs} +1 -1
  104. package/dist/input-component.entry-d486907a.cjs +1 -0
  105. package/dist/{input-dropdown.entry-abf134a8.js → input-dropdown.entry-3c39e23a.js} +1 -1
  106. package/dist/{input-dropdown.entry-5e5b67be.cjs → input-dropdown.entry-b26475c4.cjs} +1 -1
  107. package/dist/input-dropdown.entry-bea3c690.js +134 -0
  108. package/dist/input-dropdown.entry-d3d4e50e.cjs +1 -0
  109. package/dist/{italic-icon.entry-c793243b.cjs → italic-icon.entry-14081a02.cjs} +1 -1
  110. package/dist/{italic-icon.entry-4631c594.js → italic-icon.entry-2199bb17.js} +1 -1
  111. package/dist/italic-icon.entry-63726952.cjs +1 -0
  112. package/dist/italic-icon.entry-a3c87e5e.js +15 -0
  113. package/dist/{multi-select-dropdown.entry-9a93da56.js → multi-select-dropdown.entry-2141b848.js} +1 -1
  114. package/dist/{multi-select-dropdown.entry-2b8728d5.cjs → multi-select-dropdown.entry-7b66d2ae.cjs} +1 -1
  115. package/dist/multi-select-dropdown.entry-8a2c4b42.cjs +1 -0
  116. package/dist/multi-select-dropdown.entry-cdd97d65.js +95 -0
  117. package/dist/nylas-booked-event-card_12.entry-20c254bb.cjs +1 -0
  118. package/dist/nylas-booked-event-card_12.entry-2d88375a.js +1237 -0
  119. package/dist/nylas-booked-event-card_12.entry-90a0b6c7.cjs +1 -0
  120. package/dist/nylas-booked-event-card_12.entry-bbd7cfb0.js +1237 -0
  121. package/dist/{nylas-form-card.entry-af179b96.cjs → nylas-form-card.entry-1e9225b0.cjs} +1 -1
  122. package/dist/{nylas-form-card.entry-862519b4.js → nylas-form-card.entry-a8a44a3b.js} +2 -2
  123. package/dist/nylas-form-card.entry-d6287d76.cjs +1 -0
  124. package/dist/nylas-form-card.entry-fadd7718.js +57 -0
  125. package/dist/{nylas-if-state.entry-8803a762.js → nylas-if-state.entry-32b11afa.js} +2 -2
  126. package/dist/{nylas-if-state.entry-c1c1282d.cjs → nylas-if-state.entry-473230a6.cjs} +1 -1
  127. package/dist/nylas-if-state.entry-8be8107e.js +94 -0
  128. package/dist/nylas-if-state.entry-9c341f13.cjs +1 -0
  129. package/dist/{nylas-login.entry-65f8f046.cjs → nylas-login.entry-995b6f99.cjs} +1 -1
  130. package/dist/nylas-login.entry-b9c2fb27.cjs +1 -0
  131. package/dist/{nylas-login.entry-3e12f747.js → nylas-login.entry-d663205c.js} +2 -2
  132. package/dist/nylas-login.entry-e3a9c5c1.js +73 -0
  133. package/dist/{nylas-provider.entry-9626b113.cjs → nylas-provider.entry-050f20bd.cjs} +1 -1
  134. package/dist/nylas-provider.entry-5b54f2cc.cjs +1 -0
  135. package/dist/{nylas-provider.entry-e3501bd1.js → nylas-provider.entry-c24474c3.js} +4 -4
  136. package/dist/nylas-provider.entry-ca3e06ce.js +264 -0
  137. package/dist/{nylas-scheduler-editor.entry-17cd1514.cjs → nylas-scheduler-editor.entry-3b834bb1.cjs} +1 -1
  138. package/dist/{nylas-scheduler-editor.entry-6df45b05.js → nylas-scheduler-editor.entry-5c0a5fb4.js} +3 -3
  139. package/dist/nylas-scheduler-editor.entry-b86f49a1.js +1447 -0
  140. package/dist/nylas-scheduler-editor.entry-d52db29e.cjs +2 -0
  141. package/dist/{nylas-scheduling.entry-08051ba3.js → nylas-scheduling.entry-04c3951e.js} +73 -73
  142. package/dist/nylas-scheduling.entry-a5c4b050.js +412 -0
  143. package/dist/{nylas-scheduling.entry-b1fafd91.cjs → nylas-scheduling.entry-d549c5c3.cjs} +1 -1
  144. package/dist/nylas-scheduling.entry-ed12a4f6.cjs +1 -0
  145. package/dist/{nylas-time-window-picker.entry-4989d421.cjs → nylas-time-window-picker.entry-337d03c1.cjs} +1 -1
  146. package/dist/nylas-time-window-picker.entry-4aefade8.cjs +1 -0
  147. package/dist/{nylas-time-window-picker.entry-bdc8c6ea.js → nylas-time-window-picker.entry-678a7dbf.js} +1 -1
  148. package/dist/nylas-time-window-picker.entry-ecc3ee10.js +316 -0
  149. package/dist/{person-icon.entry-fb7efa8f.cjs → person-icon.entry-3fee5bc4.cjs} +1 -1
  150. package/dist/{person-icon.entry-d62a16b4.js → person-icon.entry-902b2c0d.js} +1 -1
  151. package/dist/person-icon.entry-9680bc2b.js +15 -0
  152. package/dist/person-icon.entry-dede7140.cjs +1 -0
  153. package/dist/{play-icon.entry-01b95392.js → play-icon.entry-1078da37.js} +1 -1
  154. package/dist/{play-icon.entry-f485a2c8.cjs → play-icon.entry-a7f648f7.cjs} +1 -1
  155. package/dist/play-icon.entry-c8f3a5d8.cjs +1 -0
  156. package/dist/play-icon.entry-dacc3aa6.js +15 -0
  157. package/dist/react.cjs +1 -1
  158. package/dist/react.js +1 -1
  159. package/dist/{refresh-icon.entry-5f997e86.cjs → refresh-icon.entry-06f9d181.cjs} +1 -1
  160. package/dist/{refresh-icon.entry-1ff4b39f.js → refresh-icon.entry-5399f64b.js} +1 -1
  161. package/dist/refresh-icon.entry-555a38ec.cjs +1 -0
  162. package/dist/refresh-icon.entry-d4dcfc3a.js +15 -0
  163. package/dist/{register-component-3444af44-854971ad.js → register-component-3444af44-3d6e535a.js} +1 -1
  164. package/dist/register-component-3444af44-4a273c0a.js +109 -0
  165. package/dist/{register-component-3444af44-9053e8c3.cjs → register-component-3444af44-6d269634.cjs} +1 -1
  166. package/dist/register-component-3444af44-d3e7252a.cjs +1 -0
  167. package/dist/{reply-all-icon.entry-1dad6514.cjs → reply-all-icon.entry-70ffe5be.cjs} +1 -1
  168. package/dist/{reply-all-icon.entry-cbafb8a0.js → reply-all-icon.entry-a3a20f76.js} +1 -1
  169. package/dist/reply-all-icon.entry-bb2a88ad.js +15 -0
  170. package/dist/reply-all-icon.entry-f8a32be1.cjs +1 -0
  171. package/dist/{reply-icon.entry-a43bc252.js → reply-icon.entry-302ed745.js} +1 -1
  172. package/dist/reply-icon.entry-423fb307.js +15 -0
  173. package/dist/{reply-icon.entry-162d9945.cjs → reply-icon.entry-a08c0e57.cjs} +1 -1
  174. package/dist/reply-icon.entry-d2da8972.cjs +1 -0
  175. package/dist/{scheduler-config-store-ed4a8dfd-eeaeaa50.cjs → scheduler-config-store-ed4a8dfd-34c4c119.cjs} +1 -1
  176. package/dist/scheduler-config-store-ed4a8dfd-474f6252.cjs +1 -0
  177. package/dist/{scheduler-config-store-ed4a8dfd-22db9285.js → scheduler-config-store-ed4a8dfd-81687f55.js} +1 -1
  178. package/dist/scheduler-config-store-ed4a8dfd-fe2b9d18.js +26 -0
  179. package/dist/{scheduler-store-d4784b24-9a5f5734.js → scheduler-store-2e7db190-c648278f.js} +27 -25
  180. package/dist/scheduler-store-2e7db190-fb6a20a1.cjs +1 -0
  181. package/dist/scheduler-store-5fbba021-09da63cf.cjs +1 -0
  182. package/dist/scheduler-store-5fbba021-6298edf3.js +484 -0
  183. package/dist/{sent-icon.entry-a05486d5.js → sent-icon.entry-4d7b65ba.js} +1 -1
  184. package/dist/{sent-icon.entry-a1aec7e9.cjs → sent-icon.entry-6396b793.cjs} +1 -1
  185. package/dist/sent-icon.entry-6ed4170a.js +15 -0
  186. package/dist/sent-icon.entry-db89fd38.cjs +1 -0
  187. package/dist/{spam-icon.entry-473f11af.js → spam-icon.entry-45e7b83b.js} +1 -1
  188. package/dist/spam-icon.entry-81073952.js +15 -0
  189. package/dist/{spam-icon.entry-b481a04b.cjs → spam-icon.entry-8648a315.cjs} +1 -1
  190. package/dist/spam-icon.entry-cf05a2a7.cjs +1 -0
  191. package/dist/{star-icon.entry-6b1fe3cf.cjs → star-icon.entry-1c416cef.cjs} +1 -1
  192. package/dist/{star-icon.entry-12fdc345.js → star-icon.entry-61c36332.js} +1 -1
  193. package/dist/star-icon.entry-8279e6a9.cjs +1 -0
  194. package/dist/star-icon.entry-bb26cc4e.js +15 -0
  195. package/dist/{stop-icon.entry-4bd609f7.js → stop-icon.entry-089ac3ba.js} +1 -1
  196. package/dist/{stop-icon.entry-72481153.cjs → stop-icon.entry-d68aa652.cjs} +1 -1
  197. package/dist/stop-icon.entry-f62d063b.js +15 -0
  198. package/dist/stop-icon.entry-f88a5a2a.cjs +1 -0
  199. package/dist/{textarea-component.entry-f330a755.cjs → textarea-component.entry-502c8659.cjs} +1 -1
  200. package/dist/{textarea-component.entry-47e1b2e6.js → textarea-component.entry-8f5d835f.js} +1 -1
  201. package/dist/textarea-component.entry-d4a682fa.js +37 -0
  202. package/dist/textarea-component.entry-e06ee834.cjs +1 -0
  203. package/dist/{time-period-selector.entry-c7611563.cjs → time-period-selector.entry-001a1c59.cjs} +1 -1
  204. package/dist/{time-period-selector.entry-a4899368.js → time-period-selector.entry-7da7d316.js} +1 -1
  205. package/dist/time-period-selector.entry-837b9be3.js +80 -0
  206. package/dist/time-period-selector.entry-c5b6d0c9.cjs +1 -0
  207. package/dist/{translate-icon.entry-40dfa8c9.cjs → translate-icon.entry-4ee80d22.cjs} +1 -1
  208. package/dist/{translate-icon.entry-4517838d.js → translate-icon.entry-5166d376.js} +1 -1
  209. package/dist/translate-icon.entry-c1a623d8.cjs +1 -0
  210. package/dist/translate-icon.entry-e5cfae44.js +15 -0
  211. package/dist/{trash-fill-icon.entry-86ca3055.cjs → trash-fill-icon.entry-2f814465.cjs} +1 -1
  212. package/dist/{trash-fill-icon.entry-d7e960eb.js → trash-fill-icon.entry-49844a82.js} +1 -1
  213. package/dist/trash-fill-icon.entry-85e0e841.js +15 -0
  214. package/dist/trash-fill-icon.entry-def90241.cjs +1 -0
  215. package/dist/{underline-icon.entry-352970f5.js → underline-icon.entry-181f1d7e.js} +1 -1
  216. package/dist/{underline-icon.entry-f16d4943.cjs → underline-icon.entry-4ba93e7b.cjs} +1 -1
  217. package/dist/underline-icon.entry-72dadbdf.cjs +1 -0
  218. package/dist/underline-icon.entry-f7a75755.js +15 -0
  219. package/dist/{warning-icon.entry-63987dad.js → warning-icon.entry-2406b765.js} +1 -1
  220. package/dist/{warning-icon.entry-79ef75b2.cjs → warning-icon.entry-44ac5566.cjs} +1 -1
  221. package/dist/warning-icon.entry-5b6aeb2b.cjs +1 -0
  222. package/dist/warning-icon.entry-ef601856.js +15 -0
  223. package/package.json +2 -2
  224. package/dist/calendar-agenda-fill-icon_54.entry-702b29cc.cjs +0 -10
  225. package/dist/nylas-booked-event-card_12.entry-8d502a3c.cjs +0 -1
  226. package/dist/nylas-booked-event-card_12.entry-f13f3f54.js +0 -1144
  227. package/dist/scheduler-store-d4784b24-aed474e8.cjs +0 -1
@@ -0,0 +1,3129 @@
1
+ import { l as nr, d as T, u as rr, m as hn } from "./index-2b208d5d.js";
2
+ class sr {
3
+ constructor(e, n, r = !0, s) {
4
+ this.automaticComponentRegistration = !0, this.registeredComponents = {}, this.propStateRegistrations = /* @__PURE__ */ new Map(), this.eventListenerRegistrations = /* @__PURE__ */ new Map(), this.host = e, this.stores = n, this.automaticComponentRegistration = r, this.eventOverrides = s, T(`[${this.hostTagName}] Initializing (abstract) provider.`, { eventOverrides: s }), this.registerComponent = this.registerComponent.bind(this), this.getStore = this.getStore.bind(this), Object.keys(this.stores).forEach((i) => {
5
+ this.propStateRegistrations.set(i, /* @__PURE__ */ new Map());
6
+ });
7
+ }
8
+ async componentWillLoad(e) {
9
+ T(`[${this.hostTagName}] Will load`), this.setupStoreListeners(), this.nylasConnector = e;
10
+ const n = Array.from(this.host.querySelectorAll("*")).filter((r) => r.tagName.toLowerCase().startsWith("nylas-"));
11
+ T(`[${this.hostTagName}] Found ${n.length} child component(s).`, { childComponents: n }), n.forEach((r) => {
12
+ const s = r;
13
+ if (!s) {
14
+ T(`[~${this.hostTagName}] Component ${s.tagName} does not have a name. Skipping.`);
15
+ return;
16
+ }
17
+ if (!s.registerNylasComponent) {
18
+ T(`[~${this.hostTagName}] Component ${s.tagName} is not a component that can be registered. Skipping.`, { component: s });
19
+ return;
20
+ }
21
+ const i = {
22
+ element: s,
23
+ name: s.tagName.toLowerCase(),
24
+ getStoresToProp: s.getStoresToProp,
25
+ storeToProps: s.storeToProps,
26
+ stateToProps: s.stateToProps,
27
+ authToProp: s.authToProp,
28
+ eventToProps: s.eventToProps,
29
+ connectorToProp: s.connectorToProp,
30
+ localPropsToProp: s.localPropsToProp
31
+ };
32
+ this.registerComponent(i);
33
+ });
34
+ }
35
+ async componentDidLoad() {
36
+ T(`[${this.hostTagName}] Did load`);
37
+ }
38
+ async componentDisconnected() {
39
+ Object.values(this.stores).forEach((e) => {
40
+ e.dispose();
41
+ });
42
+ }
43
+ async registerComponentHandler(e) {
44
+ if (e.stopPropagation(), !this.automaticComponentRegistration) {
45
+ T(`[${this.hostTagName}] Automatic component registration disabled. Skipping registration of ${e.detail.name}.`);
46
+ return;
47
+ }
48
+ this.registerComponent(e.detail);
49
+ }
50
+ async unregisterComponentHandler(e) {
51
+ if (e.stopPropagation(), !this.automaticComponentRegistration) {
52
+ T(`[${this.hostTagName}] Automatic component registration disabled. Skipping unregistration of ${e.detail.name}.`);
53
+ return;
54
+ }
55
+ this.unregisterComponent(e.detail);
56
+ }
57
+ registerComponent(e) {
58
+ T(`[${this.hostTagName}] Registering component ${e.name}.`);
59
+ const n = e.element.dataset.nylasId;
60
+ if (n && this.registeredComponents[n]) {
61
+ T(`[${this.hostTagName}] Component ${e.name} already registered. Skipping.`);
62
+ return;
63
+ }
64
+ const { stateToProps: r, getStoresToProp: s, eventToProps: i, storeToProps: o, connectorToProp: u, localPropsToProp: a, element: c } = e;
65
+ c.dataset.nylasId = rr(), this.registeredComponents[c.dataset.nylasId] = e;
66
+ const d = this.eventOverrides;
67
+ i == null || i.forEach((l, h) => {
68
+ var y;
69
+ const f = this.nylasConnector, m = async (g) => {
70
+ T(`[${this.hostTagName}] Handling "${e.name}" prop "${String(h)}" event.`, { event: g }), h in d && (T(`[${this.hostTagName}] Found event override for "${String(h)}" event. Calling override.`), await d[h](g, f)), g.defaultPrevented || await l(g, f);
71
+ }, p = e.element.dataset.nylasId;
72
+ p && !this.eventListenerRegistrations.has(p) && this.eventListenerRegistrations.set(p, []), p && ((y = this.eventListenerRegistrations.get(p)) == null || y.push([c, h, m])), T(`[${this.hostTagName}] Setting "${e.name}" event "${String(h)}" to automcially call NylasConnector method.`);
73
+ const v = hn(h.toString());
74
+ T(`[${this.hostTagName}] Adding event listener for "${v}" on "${c.tagName}"`), c.addEventListener(v, m);
75
+ }), r == null || r.forEach((l, h) => {
76
+ var y, g, b, k;
77
+ const [f, m] = h.split("."), v = this.getStore(f).state[m];
78
+ if (!c.dataset.nylasId) {
79
+ T(`[${this.hostTagName}] Component "${e.name}" not registered. Skipping.`, { component: e });
80
+ return;
81
+ }
82
+ this.propStateRegistrations.has(f) || this.propStateRegistrations.set(f, /* @__PURE__ */ new Map()), (y = this.propStateRegistrations.get(f)) != null && y.has(m) ? (k = (b = this.propStateRegistrations.get(f)) == null ? void 0 : b.get(m)) == null || k.push({
83
+ elementId: c.dataset.nylasId,
84
+ propKey: l
85
+ }) : (g = this.propStateRegistrations.get(f)) == null || g.set(m, [
86
+ {
87
+ elementId: c.dataset.nylasId,
88
+ propKey: l
89
+ }
90
+ ]), c[l.toString()] = v, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" value.`, { stateValue: v });
91
+ }), a == null || a.forEach((l, h) => {
92
+ const f = this.host[h];
93
+ c[l.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to the value of "${h}" value.`, { value: h, mappedPropValue: f });
94
+ }), s && (c[s == null ? void 0 : s.toString()] = this.getStore, T(`[${this.hostTagName}] Setting "${e.name}" prop "${s.toString()}" to "getStore" method.`)), o == null || o.forEach((l, h) => {
95
+ const f = this.getStore(h);
96
+ c[l.toString()] = f, T(`[${this.hostTagName}] Setting "${e.name}" prop "${l.toString()}" to "${h}" store.`, { store: f });
97
+ }), u && (c[u == null ? void 0 : u.toString()] = this.nylasConnector, T(`[${this.hostTagName}] Setting "${e.name}" prop "${u.toString()}" to "nylasConnector" value.`, { connectorToProp: u })), T(`[${this.hostTagName}] Component ${e.name} registered.`);
98
+ }
99
+ unregisterComponent(e) {
100
+ T(`[${this.hostTagName}] Unregistering component ${e.name}.`);
101
+ const n = e.element.dataset.nylasId;
102
+ if (!n) {
103
+ T(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);
104
+ return;
105
+ }
106
+ if (this.registeredComponents[n]) {
107
+ T(`[${this.hostTagName}] Component ${e.name} not registered. Skipping.`);
108
+ return;
109
+ }
110
+ this.propStateRegistrations.forEach((s, i) => {
111
+ s.forEach((o, u) => {
112
+ var d, l;
113
+ const a = (d = this.propStateRegistrations.get(i)) == null ? void 0 : d.get(u), c = a == null ? void 0 : a.filter((h) => h.elementId !== n);
114
+ c && ((l = this.propStateRegistrations.get(i)) == null || l.set(u, c));
115
+ });
116
+ });
117
+ const r = this.eventListenerRegistrations.get(n);
118
+ r == null || r.forEach(([s, i, o]) => {
119
+ const u = hn(i.toString());
120
+ T(`[${this.hostTagName}] Removing event listener for "${u}" on "${s.tagName}"`), s.removeEventListener(u, o);
121
+ }), delete this.registeredComponents[n];
122
+ }
123
+ getStore(e) {
124
+ const n = this.stores[e];
125
+ if (!n)
126
+ throw new Error(`[${this.hostTagName}] Store "${e.toString()}" not found.`);
127
+ return n;
128
+ }
129
+ async setupStoreListeners() {
130
+ const e = this;
131
+ Object.entries(this.stores).forEach(([n, r]) => {
132
+ T(`[${e.hostTagName}] Listening for changes in "${n}" store.`), r.use({
133
+ set(s, i, o) {
134
+ var c;
135
+ if (T(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" changed`, { newValue: i, oldValue: o }), i === o) {
136
+ T(`[${e.hostTagName}] Store "${n}" state "${s.toString()}" unchanged. Skipping.`);
137
+ return;
138
+ }
139
+ const u = e.registeredComponents;
140
+ if (!u) {
141
+ T(`[${e.hostTagName}] No registered components found. Skipping.`);
142
+ return;
143
+ }
144
+ const a = ((c = e.propStateRegistrations.get(n)) == null ? void 0 : c.get(s.toString())) || [];
145
+ T(`[${e.hostTagName}] Found ${a.length} prop(s) registered for "${s.toString()}" store.`, {
146
+ props: a,
147
+ propStateRegistrations: e.propStateRegistrations
148
+ }), a.forEach(({ elementId: d, propKey: l }) => {
149
+ const h = u[d];
150
+ if (!h) {
151
+ T(`[${e.hostTagName}] Component "${d}" not found. Skipping.`, { component: h });
152
+ return;
153
+ }
154
+ const m = e.getStore(n).state[s];
155
+ h.element[l.toString()] = m, T(`[${e.hostTagName}] Setting "${h.name}" prop "${l.toString()}" to "${s.toString()}" value.`, { stateValue: m });
156
+ });
157
+ }
158
+ });
159
+ });
160
+ }
161
+ get hostTagName() {
162
+ var e, n;
163
+ return ((n = (e = this.host) == null ? void 0 : e.tagName) == null ? void 0 : n.toLowerCase()) ?? "nylas-provider";
164
+ }
165
+ }
166
+ class ns extends sr {
167
+ }
168
+ var ir = Object.defineProperty, or = (t, e, n) => e in t ? ir(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n, Et = (t, e, n) => (or(t, typeof e != "symbol" ? e + "" : e, n), n), ar = /* @__PURE__ */ ((t) => (t.Error = "error", t.Warning = "warning", t.Info = "info", t.Success = "success", t))(ar || {});
169
+ const rs = (t) => t !== null && typeof t == "object" && "error" in t;
170
+ async function dn(t) {
171
+ const e = new TextEncoder().encode(t), n = await crypto.subtle.digest("SHA-256", e), r = Array.from(new Uint8Array(n)).map((s) => s.toString(16).padStart(2, "0")).join("");
172
+ return btoa(r).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
173
+ }
174
+ const K = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : nr, N = Object.keys, M = Array.isArray;
175
+ function U(t, e) {
176
+ return typeof e != "object" || N(e).forEach(function(n) {
177
+ t[n] = e[n];
178
+ }), t;
179
+ }
180
+ typeof Promise > "u" || K.Promise || (K.Promise = Promise);
181
+ const Be = Object.getPrototypeOf, ur = {}.hasOwnProperty;
182
+ function z(t, e) {
183
+ return ur.call(t, e);
184
+ }
185
+ function Pe(t, e) {
186
+ typeof e == "function" && (e = e(Be(t))), (typeof Reflect > "u" ? N : Reflect.ownKeys)(e).forEach((n) => {
187
+ ee(t, n, e[n]);
188
+ });
189
+ }
190
+ const Pn = Object.defineProperty;
191
+ function ee(t, e, n, r) {
192
+ Pn(t, e, U(n && z(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
193
+ }
194
+ function ke(t) {
195
+ return { from: function(e) {
196
+ return t.prototype = Object.create(e.prototype), ee(t.prototype, "constructor", t), { extend: Pe.bind(null, t.prototype) };
197
+ } };
198
+ }
199
+ const lr = Object.getOwnPropertyDescriptor;
200
+ function Jt(t, e) {
201
+ let n;
202
+ return lr(t, e) || (n = Be(t)) && Jt(n, e);
203
+ }
204
+ const cr = [].slice;
205
+ function ut(t, e, n) {
206
+ return cr.call(t, e, n);
207
+ }
208
+ function En(t, e) {
209
+ return e(t);
210
+ }
211
+ function Ie(t) {
212
+ if (!t)
213
+ throw new Error("Assertion Failed");
214
+ }
215
+ function Cn(t) {
216
+ K.setImmediate ? setImmediate(t) : setTimeout(t, 0);
217
+ }
218
+ function Tn(t, e) {
219
+ return t.reduce((n, r, s) => {
220
+ var i = e(r, s);
221
+ return i && (n[i[0]] = i[1]), n;
222
+ }, {});
223
+ }
224
+ function te(t, e) {
225
+ if (z(t, e))
226
+ return t[e];
227
+ if (!e)
228
+ return t;
229
+ if (typeof e != "string") {
230
+ for (var n = [], r = 0, s = e.length; r < s; ++r) {
231
+ var i = te(t, e[r]);
232
+ n.push(i);
233
+ }
234
+ return n;
235
+ }
236
+ var o = e.indexOf(".");
237
+ if (o !== -1) {
238
+ var u = t[e.substr(0, o)];
239
+ return u === void 0 ? void 0 : te(u, e.substr(o + 1));
240
+ }
241
+ }
242
+ function H(t, e, n) {
243
+ if (t && e !== void 0 && (!("isFrozen" in Object) || !Object.isFrozen(t)))
244
+ if (typeof e != "string" && "length" in e) {
245
+ Ie(typeof n != "string" && "length" in n);
246
+ for (var r = 0, s = e.length; r < s; ++r)
247
+ H(t, e[r], n[r]);
248
+ } else {
249
+ var i = e.indexOf(".");
250
+ if (i !== -1) {
251
+ var o = e.substr(0, i), u = e.substr(i + 1);
252
+ if (u === "")
253
+ n === void 0 ? M(t) && !isNaN(parseInt(o)) ? t.splice(o, 1) : delete t[o] : t[o] = n;
254
+ else {
255
+ var a = t[o];
256
+ a && z(t, o) || (a = t[o] = {}), H(a, u, n);
257
+ }
258
+ } else
259
+ n === void 0 ? M(t) && !isNaN(parseInt(e)) ? t.splice(e, 1) : delete t[e] : t[e] = n;
260
+ }
261
+ }
262
+ function An(t) {
263
+ var e = {};
264
+ for (var n in t)
265
+ z(t, n) && (e[n] = t[n]);
266
+ return e;
267
+ }
268
+ const hr = [].concat;
269
+ function On(t) {
270
+ return hr.apply([], t);
271
+ }
272
+ const In = "Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(On([8, 16, 32, 64].map((t) => ["Int", "Uint", "Float"].map((e) => e + t + "Array")))).filter((t) => K[t]), dr = In.map((t) => K[t]);
273
+ Tn(In, (t) => [t, !0]);
274
+ let se = null;
275
+ function We(t) {
276
+ se = typeof WeakMap < "u" && /* @__PURE__ */ new WeakMap();
277
+ const e = Ct(t);
278
+ return se = null, e;
279
+ }
280
+ function Ct(t) {
281
+ if (!t || typeof t != "object")
282
+ return t;
283
+ let e = se && se.get(t);
284
+ if (e)
285
+ return e;
286
+ if (M(t)) {
287
+ e = [], se && se.set(t, e);
288
+ for (var n = 0, r = t.length; n < r; ++n)
289
+ e.push(Ct(t[n]));
290
+ } else if (dr.indexOf(t.constructor) >= 0)
291
+ e = t;
292
+ else {
293
+ const i = Be(t);
294
+ for (var s in e = i === Object.prototype ? {} : Object.create(i), se && se.set(t, e), t)
295
+ z(t, s) && (e[s] = Ct(t[s]));
296
+ }
297
+ return e;
298
+ }
299
+ const { toString: fr } = {};
300
+ function Tt(t) {
301
+ return fr.call(t).slice(8, -1);
302
+ }
303
+ const At = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", pr = typeof At == "symbol" ? function(t) {
304
+ var e;
305
+ return t != null && (e = t[At]) && e.apply(t);
306
+ } : function() {
307
+ return null;
308
+ }, _e = {};
309
+ function J(t) {
310
+ var e, n, r, s;
311
+ if (arguments.length === 1) {
312
+ if (M(t))
313
+ return t.slice();
314
+ if (this === _e && typeof t == "string")
315
+ return [t];
316
+ if (s = pr(t)) {
317
+ for (n = []; !(r = s.next()).done; )
318
+ n.push(r.value);
319
+ return n;
320
+ }
321
+ if (t == null)
322
+ return [t];
323
+ if (typeof (e = t.length) == "number") {
324
+ for (n = new Array(e); e--; )
325
+ n[e] = t[e];
326
+ return n;
327
+ }
328
+ return [t];
329
+ }
330
+ for (e = arguments.length, n = new Array(e); e--; )
331
+ n[e] = arguments[e];
332
+ return n;
333
+ }
334
+ const Zt = typeof Symbol < "u" ? (t) => t[Symbol.toStringTag] === "AsyncFunction" : () => !1;
335
+ var G = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
336
+ function Kn(t, e) {
337
+ G = t, jn = e;
338
+ }
339
+ var jn = () => !0;
340
+ const mr = !new Error("").stack;
341
+ function Ee() {
342
+ if (mr)
343
+ try {
344
+ throw new Error();
345
+ } catch (t) {
346
+ return t;
347
+ }
348
+ return new Error();
349
+ }
350
+ function Ot(t, e) {
351
+ var n = t.stack;
352
+ return n ? (e = e || 0, n.indexOf(t.name) === 0 && (e += (t.name + t.message).split(`
353
+ `).length), n.split(`
354
+ `).slice(e).filter(jn).map((r) => `
355
+ ` + r).join("")) : "";
356
+ }
357
+ var Rn = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], en = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(Rn), gr = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
358
+ function xe(t, e) {
359
+ this._e = Ee(), this.name = t, this.message = e;
360
+ }
361
+ function $n(t, e) {
362
+ return t + ". Errors: " + Object.keys(e).map((n) => e[n].toString()).filter((n, r, s) => s.indexOf(n) === r).join(`
363
+ `);
364
+ }
365
+ function lt(t, e, n, r) {
366
+ this._e = Ee(), this.failures = e, this.failedKeys = r, this.successCount = n, this.message = $n(t, e);
367
+ }
368
+ function je(t, e) {
369
+ this._e = Ee(), this.name = "BulkError", this.failures = Object.keys(e).map((n) => e[n]), this.failuresByPos = e, this.message = $n(t, e);
370
+ }
371
+ ke(xe).from(Error).extend({ stack: { get: function() {
372
+ return this._stack || (this._stack = this.name + ": " + this.message + Ot(this._e, 2));
373
+ } }, toString: function() {
374
+ return this.name + ": " + this.message;
375
+ } }), ke(lt).from(xe), ke(je).from(xe);
376
+ var tn = en.reduce((t, e) => (t[e] = e + "Error", t), {});
377
+ const yr = xe;
378
+ var C = en.reduce((t, e) => {
379
+ var n = e + "Error";
380
+ function r(s, i) {
381
+ this._e = Ee(), this.name = n, s ? typeof s == "string" ? (this.message = `${s}${i ? `
382
+ ` + i : ""}`, this.inner = i || null) : typeof s == "object" && (this.message = `${s.name} ${s.message}`, this.inner = s) : (this.message = gr[e] || n, this.inner = null);
383
+ }
384
+ return ke(r).from(yr), t[e] = r, t;
385
+ }, {});
386
+ C.Syntax = SyntaxError, C.Type = TypeError, C.Range = RangeError;
387
+ var fn = Rn.reduce((t, e) => (t[e + "Error"] = C[e], t), {}), tt = en.reduce((t, e) => (["Syntax", "Type", "Range"].indexOf(e) === -1 && (t[e + "Error"] = C[e]), t), {});
388
+ function I() {
389
+ }
390
+ function Fe(t) {
391
+ return t;
392
+ }
393
+ function vr(t, e) {
394
+ return t == null || t === Fe ? e : function(n) {
395
+ return e(t(n));
396
+ };
397
+ }
398
+ function me(t, e) {
399
+ return function() {
400
+ t.apply(this, arguments), e.apply(this, arguments);
401
+ };
402
+ }
403
+ function br(t, e) {
404
+ return t === I ? e : function() {
405
+ var n = t.apply(this, arguments);
406
+ n !== void 0 && (arguments[0] = n);
407
+ var r = this.onsuccess, s = this.onerror;
408
+ this.onsuccess = null, this.onerror = null;
409
+ var i = e.apply(this, arguments);
410
+ return r && (this.onsuccess = this.onsuccess ? me(r, this.onsuccess) : r), s && (this.onerror = this.onerror ? me(s, this.onerror) : s), i !== void 0 ? i : n;
411
+ };
412
+ }
413
+ function wr(t, e) {
414
+ return t === I ? e : function() {
415
+ t.apply(this, arguments);
416
+ var n = this.onsuccess, r = this.onerror;
417
+ this.onsuccess = this.onerror = null, e.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? me(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? me(r, this.onerror) : r);
418
+ };
419
+ }
420
+ function _r(t, e) {
421
+ return t === I ? e : function(n) {
422
+ var r = t.apply(this, arguments);
423
+ U(n, r);
424
+ var s = this.onsuccess, i = this.onerror;
425
+ this.onsuccess = null, this.onerror = null;
426
+ var o = e.apply(this, arguments);
427
+ return s && (this.onsuccess = this.onsuccess ? me(s, this.onsuccess) : s), i && (this.onerror = this.onerror ? me(i, this.onerror) : i), r === void 0 ? o === void 0 ? void 0 : o : U(r, o);
428
+ };
429
+ }
430
+ function kr(t, e) {
431
+ return t === I ? e : function() {
432
+ return e.apply(this, arguments) !== !1 && t.apply(this, arguments);
433
+ };
434
+ }
435
+ function nn(t, e) {
436
+ return t === I ? e : function() {
437
+ var n = t.apply(this, arguments);
438
+ if (n && typeof n.then == "function") {
439
+ for (var r = this, s = arguments.length, i = new Array(s); s--; )
440
+ i[s] = arguments[s];
441
+ return n.then(function() {
442
+ return e.apply(r, i);
443
+ });
444
+ }
445
+ return e.apply(this, arguments);
446
+ };
447
+ }
448
+ tt.ModifyError = lt, tt.DexieError = xe, tt.BulkError = je;
449
+ var Me = {};
450
+ const Nn = 100, [It, ct, Kt] = typeof Promise > "u" ? [] : (() => {
451
+ let t = Promise.resolve();
452
+ if (typeof crypto > "u" || !crypto.subtle)
453
+ return [t, Be(t), t];
454
+ const e = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
455
+ return [e, Be(e), t];
456
+ })(), Dn = ct && ct.then, nt = It && It.constructor, rn = !!Kt;
457
+ var jt = !1, xr = Kt ? () => {
458
+ Kt.then(Ye);
459
+ } : K.setImmediate ? setImmediate.bind(null, Ye) : K.MutationObserver ? () => {
460
+ var t = document.createElement("div");
461
+ new MutationObserver(() => {
462
+ Ye(), t = null;
463
+ }).observe(t, { attributes: !0 }), t.setAttribute("i", "1");
464
+ } : () => {
465
+ setTimeout(Ye, 0);
466
+ }, Re = function(t, e) {
467
+ Ke.push([t, e]), ht && (xr(), ht = !1);
468
+ }, Rt = !0, ht = !0, de = [], rt = [], $t = null, Nt = Fe, Se = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: gn, pgp: !1, env: {}, finalize: function() {
469
+ this.unhandleds.forEach((t) => {
470
+ try {
471
+ gn(t[0], t[1]);
472
+ } catch {
473
+ }
474
+ });
475
+ } }, E = Se, Ke = [], fe = 0, st = [];
476
+ function S(t) {
477
+ if (typeof this != "object")
478
+ throw new TypeError("Promises must be constructed via new");
479
+ this._listeners = [], this.onuncatched = I, this._lib = !1;
480
+ var e = this._PSD = E;
481
+ if (G && (this._stackHolder = Ee(), this._prev = null, this._numPrev = 0), typeof t != "function") {
482
+ if (t !== Me)
483
+ throw new TypeError("Not a function");
484
+ return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Bt(this, this._value));
485
+ }
486
+ this._state = null, this._value = null, ++e.ref, Fn(this, t);
487
+ }
488
+ const Dt = { get: function() {
489
+ var t = E, e = dt;
490
+ function n(r, s) {
491
+ var i = !t.global && (t !== E || e !== dt);
492
+ const o = i && !ne();
493
+ var u = new S((a, c) => {
494
+ sn(this, new Bn(ft(r, t, i, o), ft(s, t, i, o), a, c, t));
495
+ });
496
+ return G && Ln(u, this), u;
497
+ }
498
+ return n.prototype = Me, n;
499
+ }, set: function(t) {
500
+ ee(this, "then", t && t.prototype === Me ? Dt : { get: function() {
501
+ return t;
502
+ }, set: Dt.set });
503
+ } };
504
+ function Bn(t, e, n, r, s) {
505
+ this.onFulfilled = typeof t == "function" ? t : null, this.onRejected = typeof e == "function" ? e : null, this.resolve = n, this.reject = r, this.psd = s;
506
+ }
507
+ function Fn(t, e) {
508
+ try {
509
+ e((n) => {
510
+ if (t._state === null) {
511
+ if (n === t)
512
+ throw new TypeError("A promise cannot be resolved with itself.");
513
+ var r = t._lib && ze();
514
+ n && typeof n.then == "function" ? Fn(t, (s, i) => {
515
+ n instanceof S ? n._then(s, i) : n.then(s, i);
516
+ }) : (t._state = !0, t._value = n, Mn(t)), r && He();
517
+ }
518
+ }, Bt.bind(null, t));
519
+ } catch (n) {
520
+ Bt(t, n);
521
+ }
522
+ }
523
+ function Bt(t, e) {
524
+ if (rt.push(e), t._state === null) {
525
+ var n = t._lib && ze();
526
+ e = Nt(e), t._state = !1, t._value = e, G && e !== null && typeof e == "object" && !e._promise && function(r, s, i) {
527
+ try {
528
+ r.apply(null, i);
529
+ } catch (o) {
530
+ s && s(o);
531
+ }
532
+ }(() => {
533
+ var r = Jt(e, "stack");
534
+ e._promise = t, ee(e, "stack", { get: () => jt ? r && (r.get ? r.get.apply(e) : r.value) : t.stack });
535
+ }), function(r) {
536
+ de.some((s) => s._value === r._value) || de.push(r);
537
+ }(t), Mn(t), n && He();
538
+ }
539
+ }
540
+ function Mn(t) {
541
+ var e = t._listeners;
542
+ t._listeners = [];
543
+ for (var n = 0, r = e.length; n < r; ++n)
544
+ sn(t, e[n]);
545
+ var s = t._PSD;
546
+ --s.ref || s.finalize(), fe === 0 && (++fe, Re(() => {
547
+ --fe == 0 && on();
548
+ }, []));
549
+ }
550
+ function sn(t, e) {
551
+ if (t._state !== null) {
552
+ var n = t._state ? e.onFulfilled : e.onRejected;
553
+ if (n === null)
554
+ return (t._state ? e.resolve : e.reject)(t._value);
555
+ ++e.psd.ref, ++fe, Re(Sr, [n, t, e]);
556
+ } else
557
+ t._listeners.push(e);
558
+ }
559
+ function Sr(t, e, n) {
560
+ try {
561
+ $t = e;
562
+ var r, s = e._value;
563
+ e._state ? r = t(s) : (rt.length && (rt = []), r = t(s), rt.indexOf(s) === -1 && function(i) {
564
+ for (var o = de.length; o; )
565
+ if (de[--o]._value === i._value)
566
+ return void de.splice(o, 1);
567
+ }(e)), n.resolve(r);
568
+ } catch (i) {
569
+ n.reject(i);
570
+ } finally {
571
+ $t = null, --fe == 0 && on(), --n.psd.ref || n.psd.finalize();
572
+ }
573
+ }
574
+ function qn(t, e, n) {
575
+ if (e.length === n)
576
+ return e;
577
+ var r = "";
578
+ if (t._state === !1) {
579
+ var s, i, o = t._value;
580
+ o != null ? (s = o.name || "Error", i = o.message || o, r = Ot(o, 0)) : (s = o, i = ""), e.push(s + (i ? ": " + i : "") + r);
581
+ }
582
+ return G && ((r = Ot(t._stackHolder, 2)) && e.indexOf(r) === -1 && e.push(r), t._prev && qn(t._prev, e, n)), e;
583
+ }
584
+ function Ln(t, e) {
585
+ var n = e ? e._numPrev + 1 : 0;
586
+ n < 100 && (t._prev = e, t._numPrev = n);
587
+ }
588
+ function Ye() {
589
+ ze() && He();
590
+ }
591
+ function ze() {
592
+ var t = Rt;
593
+ return Rt = !1, ht = !1, t;
594
+ }
595
+ function He() {
596
+ var t, e, n;
597
+ do
598
+ for (; Ke.length > 0; )
599
+ for (t = Ke, Ke = [], n = t.length, e = 0; e < n; ++e) {
600
+ var r = t[e];
601
+ r[0].apply(null, r[1]);
602
+ }
603
+ while (Ke.length > 0);
604
+ Rt = !0, ht = !0;
605
+ }
606
+ function on() {
607
+ var t = de;
608
+ de = [], t.forEach((r) => {
609
+ r._PSD.onunhandled.call(null, r._value, r);
610
+ });
611
+ for (var e = st.slice(0), n = e.length; n; )
612
+ e[--n]();
613
+ }
614
+ function Ge(t) {
615
+ return new S(Me, !1, t);
616
+ }
617
+ function j(t, e) {
618
+ var n = E;
619
+ return function() {
620
+ var r = ze(), s = E;
621
+ try {
622
+ return ae(n, !0), t.apply(this, arguments);
623
+ } catch (i) {
624
+ e && e(i);
625
+ } finally {
626
+ ae(s, !1), r && He();
627
+ }
628
+ };
629
+ }
630
+ Pe(S.prototype, { then: Dt, _then: function(t, e) {
631
+ sn(this, new Bn(null, null, t, e, E));
632
+ }, catch: function(t) {
633
+ if (arguments.length === 1)
634
+ return this.then(null, t);
635
+ var e = arguments[0], n = arguments[1];
636
+ return typeof e == "function" ? this.then(null, (r) => r instanceof e ? n(r) : Ge(r)) : this.then(null, (r) => r && r.name === e ? n(r) : Ge(r));
637
+ }, finally: function(t) {
638
+ return this.then((e) => (t(), e), (e) => (t(), Ge(e)));
639
+ }, stack: { get: function() {
640
+ if (this._stack)
641
+ return this._stack;
642
+ try {
643
+ jt = !0;
644
+ var t = qn(this, [], 20).join(`
645
+ From previous: `);
646
+ return this._state !== null && (this._stack = t), t;
647
+ } finally {
648
+ jt = !1;
649
+ }
650
+ } }, timeout: function(t, e) {
651
+ return t < 1 / 0 ? new S((n, r) => {
652
+ var s = setTimeout(() => r(new C.Timeout(e)), t);
653
+ this.then(n, r).finally(clearTimeout.bind(null, s));
654
+ }) : this;
655
+ } }), typeof Symbol < "u" && Symbol.toStringTag && ee(S.prototype, Symbol.toStringTag, "Dexie.Promise"), Se.env = Un(), Pe(S, { all: function() {
656
+ var t = J.apply(null, arguments).map(Xe);
657
+ return new S(function(e, n) {
658
+ t.length === 0 && e([]);
659
+ var r = t.length;
660
+ t.forEach((s, i) => S.resolve(s).then((o) => {
661
+ t[i] = o, --r || e(t);
662
+ }, n));
663
+ });
664
+ }, resolve: (t) => {
665
+ if (t instanceof S)
666
+ return t;
667
+ if (t && typeof t.then == "function")
668
+ return new S((n, r) => {
669
+ t.then(n, r);
670
+ });
671
+ var e = new S(Me, !0, t);
672
+ return Ln(e, $t), e;
673
+ }, reject: Ge, race: function() {
674
+ var t = J.apply(null, arguments).map(Xe);
675
+ return new S((e, n) => {
676
+ t.map((r) => S.resolve(r).then(e, n));
677
+ });
678
+ }, PSD: { get: () => E, set: (t) => E = t }, totalEchoes: { get: () => dt }, newPSD: oe, usePSD: Te, scheduler: { get: () => Re, set: (t) => {
679
+ Re = t;
680
+ } }, rejectionMapper: { get: () => Nt, set: (t) => {
681
+ Nt = t;
682
+ } }, follow: (t, e) => new S((n, r) => oe((s, i) => {
683
+ var o = E;
684
+ o.unhandleds = [], o.onunhandled = i, o.finalize = me(function() {
685
+ (function(u) {
686
+ function a() {
687
+ u(), st.splice(st.indexOf(a), 1);
688
+ }
689
+ st.push(a), ++fe, Re(() => {
690
+ --fe == 0 && on();
691
+ }, []);
692
+ })(() => {
693
+ this.unhandleds.length === 0 ? s() : i(this.unhandleds[0]);
694
+ });
695
+ }, o.finalize), t();
696
+ }, e, n, r)) }), nt && (nt.allSettled && ee(S, "allSettled", function() {
697
+ const t = J.apply(null, arguments).map(Xe);
698
+ return new S((e) => {
699
+ t.length === 0 && e([]);
700
+ let n = t.length;
701
+ const r = new Array(n);
702
+ t.forEach((s, i) => S.resolve(s).then((o) => r[i] = { status: "fulfilled", value: o }, (o) => r[i] = { status: "rejected", reason: o }).then(() => --n || e(r)));
703
+ });
704
+ }), nt.any && typeof AggregateError < "u" && ee(S, "any", function() {
705
+ const t = J.apply(null, arguments).map(Xe);
706
+ return new S((e, n) => {
707
+ t.length === 0 && n(new AggregateError([]));
708
+ let r = t.length;
709
+ const s = new Array(r);
710
+ t.forEach((i, o) => S.resolve(i).then((u) => e(u), (u) => {
711
+ s[o] = u, --r || n(new AggregateError(s));
712
+ }));
713
+ });
714
+ }));
715
+ const F = { awaits: 0, echoes: 0, id: 0 };
716
+ var Pr = 0, it = [], bt = 0, dt = 0, Er = 0;
717
+ function oe(t, e, n, r) {
718
+ var s = E, i = Object.create(s);
719
+ i.parent = s, i.ref = 0, i.global = !1, i.id = ++Er;
720
+ var o = Se.env;
721
+ i.env = rn ? { Promise: S, PromiseProp: { value: S, configurable: !0, writable: !0 }, all: S.all, race: S.race, allSettled: S.allSettled, any: S.any, resolve: S.resolve, reject: S.reject, nthen: pn(o.nthen, i), gthen: pn(o.gthen, i) } : {}, e && U(i, e), ++s.ref, i.finalize = function() {
722
+ --this.parent.ref || this.parent.finalize();
723
+ };
724
+ var u = Te(i, t, n, r);
725
+ return i.ref === 0 && i.finalize(), u;
726
+ }
727
+ function Ce() {
728
+ return F.id || (F.id = ++Pr), ++F.awaits, F.echoes += Nn, F.id;
729
+ }
730
+ function ne() {
731
+ return !!F.awaits && (--F.awaits == 0 && (F.id = 0), F.echoes = F.awaits * Nn, !0);
732
+ }
733
+ function Xe(t) {
734
+ return F.echoes && t && t.constructor === nt ? (Ce(), t.then((e) => (ne(), e), (e) => (ne(), D(e)))) : t;
735
+ }
736
+ function Cr(t) {
737
+ ++dt, F.echoes && --F.echoes != 0 || (F.echoes = F.id = 0), it.push(E), ae(t, !0);
738
+ }
739
+ function Tr() {
740
+ var t = it[it.length - 1];
741
+ it.pop(), ae(t, !1);
742
+ }
743
+ function ae(t, e) {
744
+ var n = E;
745
+ if ((e ? !F.echoes || bt++ && t === E : !bt || --bt && t === E) || Vn(e ? Cr.bind(null, t) : Tr), t !== E && (E = t, n === Se && (Se.env = Un()), rn)) {
746
+ var r = Se.env.Promise, s = t.env;
747
+ ct.then = s.nthen, r.prototype.then = s.gthen, (n.global || t.global) && (Object.defineProperty(K, "Promise", s.PromiseProp), r.all = s.all, r.race = s.race, r.resolve = s.resolve, r.reject = s.reject, s.allSettled && (r.allSettled = s.allSettled), s.any && (r.any = s.any));
748
+ }
749
+ }
750
+ function Un() {
751
+ var t = K.Promise;
752
+ return rn ? { Promise: t, PromiseProp: Object.getOwnPropertyDescriptor(K, "Promise"), all: t.all, race: t.race, allSettled: t.allSettled, any: t.any, resolve: t.resolve, reject: t.reject, nthen: ct.then, gthen: t.prototype.then } : {};
753
+ }
754
+ function Te(t, e, n, r, s) {
755
+ var i = E;
756
+ try {
757
+ return ae(t, !0), e(n, r, s);
758
+ } finally {
759
+ ae(i, !1);
760
+ }
761
+ }
762
+ function Vn(t) {
763
+ Dn.call(It, t);
764
+ }
765
+ function ft(t, e, n, r) {
766
+ return typeof t != "function" ? t : function() {
767
+ var s = E;
768
+ n && Ce(), ae(e, !0);
769
+ try {
770
+ return t.apply(this, arguments);
771
+ } finally {
772
+ ae(s, !1), r && Vn(ne);
773
+ }
774
+ };
775
+ }
776
+ function pn(t, e) {
777
+ return function(n, r) {
778
+ return t.call(this, ft(n, e), ft(r, e));
779
+ };
780
+ }
781
+ ("" + Dn).indexOf("[native code]") === -1 && (Ce = ne = I);
782
+ const mn = "unhandledrejection";
783
+ function gn(t, e) {
784
+ var n;
785
+ try {
786
+ n = e.onuncatched(t);
787
+ } catch {
788
+ }
789
+ if (n !== !1)
790
+ try {
791
+ var r, s = { promise: e, reason: t };
792
+ if (K.document && document.createEvent ? ((r = document.createEvent("Event")).initEvent(mn, !0, !0), U(r, s)) : K.CustomEvent && U(r = new CustomEvent(mn, { detail: s }), s), r && K.dispatchEvent && (dispatchEvent(r), !K.PromiseRejectionEvent && K.onunhandledrejection))
793
+ try {
794
+ K.onunhandledrejection(r);
795
+ } catch {
796
+ }
797
+ G && r && !r.defaultPrevented && console.warn(`Unhandled rejection: ${t.stack || t}`);
798
+ } catch {
799
+ }
800
+ }
801
+ var D = S.reject;
802
+ function Ft(t, e, n, r) {
803
+ if (t.idbdb && (t._state.openComplete || E.letThrough || t._vip)) {
804
+ var s = t._createTransaction(e, n, t._dbSchema);
805
+ try {
806
+ s.create(), t._state.PR1398_maxLoop = 3;
807
+ } catch (i) {
808
+ return i.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Ft(t, e, n, r))) : D(i);
809
+ }
810
+ return s._promise(e, (i, o) => oe(() => (E.trans = s, r(i, o, s)))).then((i) => s._completion.then(() => i));
811
+ }
812
+ if (t._state.openComplete)
813
+ return D(new C.DatabaseClosed(t._state.dbOpenError));
814
+ if (!t._state.isBeingOpened) {
815
+ if (!t._options.autoOpen)
816
+ return D(new C.DatabaseClosed());
817
+ t.open().catch(I);
818
+ }
819
+ return t._state.dbReadyPromise.then(() => Ft(t, e, n, r));
820
+ }
821
+ const yn = "3.2.4", he = String.fromCharCode(65535), Mt = -1 / 0, X = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Wn = "String expected.", $e = [], gt = typeof navigator < "u" && /(MSIE|Trident|Edge)/.test(navigator.userAgent), Ar = gt, Or = gt, zn = (t) => !/(dexie\.js|dexie\.min\.js)/.test(t), yt = "__dbnames", wt = "readonly", _t = "readwrite";
822
+ function ge(t, e) {
823
+ return t ? e ? function() {
824
+ return t.apply(this, arguments) && e.apply(this, arguments);
825
+ } : t : e;
826
+ }
827
+ const Hn = { type: 3, lower: -1 / 0, lowerOpen: !1, upper: [[]], upperOpen: !1 };
828
+ function Qe(t) {
829
+ return typeof t != "string" || /\./.test(t) ? (e) => e : (e) => (e[t] === void 0 && t in e && delete (e = We(e))[t], e);
830
+ }
831
+ class Ir {
832
+ _trans(e, n, r) {
833
+ const s = this._tx || E.trans, i = this.name;
834
+ function o(a, c, d) {
835
+ if (!d.schema[i])
836
+ throw new C.NotFound("Table " + i + " not part of transaction");
837
+ return n(d.idbtrans, d);
838
+ }
839
+ const u = ze();
840
+ try {
841
+ return s && s.db === this.db ? s === E.trans ? s._promise(e, o, r) : oe(() => s._promise(e, o, r), { trans: s, transless: E.transless || E }) : Ft(this.db, e, [this.name], o);
842
+ } finally {
843
+ u && He();
844
+ }
845
+ }
846
+ get(e, n) {
847
+ return e && e.constructor === Object ? this.where(e).first(n) : this._trans("readonly", (r) => this.core.get({ trans: r, key: e }).then((s) => this.hook.reading.fire(s))).then(n);
848
+ }
849
+ where(e) {
850
+ if (typeof e == "string")
851
+ return new this.db.WhereClause(this, e);
852
+ if (M(e))
853
+ return new this.db.WhereClause(this, `[${e.join("+")}]`);
854
+ const n = N(e);
855
+ if (n.length === 1)
856
+ return this.where(n[0]).equals(e[n[0]]);
857
+ const r = this.schema.indexes.concat(this.schema.primKey).filter((c) => c.compound && n.every((d) => c.keyPath.indexOf(d) >= 0) && c.keyPath.every((d) => n.indexOf(d) >= 0))[0];
858
+ if (r && this.db._maxKey !== he)
859
+ return this.where(r.name).equals(r.keyPath.map((c) => e[c]));
860
+ !r && G && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit of a compound index [${n.join("+")}]`);
861
+ const { idxByName: s } = this.schema, i = this.db._deps.indexedDB;
862
+ function o(c, d) {
863
+ try {
864
+ return i.cmp(c, d) === 0;
865
+ } catch {
866
+ return !1;
867
+ }
868
+ }
869
+ const [u, a] = n.reduce(([c, d], l) => {
870
+ const h = s[l], f = e[l];
871
+ return [c || h, c || !h ? ge(d, h && h.multi ? (m) => {
872
+ const p = te(m, l);
873
+ return M(p) && p.some((v) => o(f, v));
874
+ } : (m) => o(f, te(m, l))) : d];
875
+ }, [null, null]);
876
+ return u ? this.where(u.name).equals(e[u.keyPath]).filter(a) : r ? this.filter(a) : this.where(n).equals("");
877
+ }
878
+ filter(e) {
879
+ return this.toCollection().and(e);
880
+ }
881
+ count(e) {
882
+ return this.toCollection().count(e);
883
+ }
884
+ offset(e) {
885
+ return this.toCollection().offset(e);
886
+ }
887
+ limit(e) {
888
+ return this.toCollection().limit(e);
889
+ }
890
+ each(e) {
891
+ return this.toCollection().each(e);
892
+ }
893
+ toArray(e) {
894
+ return this.toCollection().toArray(e);
895
+ }
896
+ toCollection() {
897
+ return new this.db.Collection(new this.db.WhereClause(this));
898
+ }
899
+ orderBy(e) {
900
+ return new this.db.Collection(new this.db.WhereClause(this, M(e) ? `[${e.join("+")}]` : e));
901
+ }
902
+ reverse() {
903
+ return this.toCollection().reverse();
904
+ }
905
+ mapToClass(e) {
906
+ this.schema.mappedClass = e;
907
+ const n = (r) => {
908
+ if (!r)
909
+ return r;
910
+ const s = Object.create(e.prototype);
911
+ for (var i in r)
912
+ if (z(r, i))
913
+ try {
914
+ s[i] = r[i];
915
+ } catch {
916
+ }
917
+ return s;
918
+ };
919
+ return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = n, this.hook("reading", n), e;
920
+ }
921
+ defineClass() {
922
+ return this.mapToClass(function(e) {
923
+ U(this, e);
924
+ });
925
+ }
926
+ add(e, n) {
927
+ const { auto: r, keyPath: s } = this.schema.primKey;
928
+ let i = e;
929
+ return s && r && (i = Qe(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "add", keys: n != null ? [n] : null, values: [i] })).then((o) => o.numFailures ? S.reject(o.failures[0]) : o.lastResult).then((o) => {
930
+ if (s)
931
+ try {
932
+ H(e, s, o);
933
+ } catch {
934
+ }
935
+ return o;
936
+ });
937
+ }
938
+ update(e, n) {
939
+ if (typeof e != "object" || M(e))
940
+ return this.where(":id").equals(e).modify(n);
941
+ {
942
+ const r = te(e, this.schema.primKey.keyPath);
943
+ if (r === void 0)
944
+ return D(new C.InvalidArgument("Given object does not contain its primary key"));
945
+ try {
946
+ typeof n != "function" ? N(n).forEach((s) => {
947
+ H(e, s, n[s]);
948
+ }) : n(e, { value: e, primKey: r });
949
+ } catch {
950
+ }
951
+ return this.where(":id").equals(r).modify(n);
952
+ }
953
+ }
954
+ put(e, n) {
955
+ const { auto: r, keyPath: s } = this.schema.primKey;
956
+ let i = e;
957
+ return s && r && (i = Qe(s)(e)), this._trans("readwrite", (o) => this.core.mutate({ trans: o, type: "put", values: [i], keys: n != null ? [n] : null })).then((o) => o.numFailures ? S.reject(o.failures[0]) : o.lastResult).then((o) => {
958
+ if (s)
959
+ try {
960
+ H(e, s, o);
961
+ } catch {
962
+ }
963
+ return o;
964
+ });
965
+ }
966
+ delete(e) {
967
+ return this._trans("readwrite", (n) => this.core.mutate({ trans: n, type: "delete", keys: [e] })).then((n) => n.numFailures ? S.reject(n.failures[0]) : void 0);
968
+ }
969
+ clear() {
970
+ return this._trans("readwrite", (e) => this.core.mutate({ trans: e, type: "deleteRange", range: Hn })).then((e) => e.numFailures ? S.reject(e.failures[0]) : void 0);
971
+ }
972
+ bulkGet(e) {
973
+ return this._trans("readonly", (n) => this.core.getMany({ keys: e, trans: n }).then((r) => r.map((s) => this.hook.reading.fire(s))));
974
+ }
975
+ bulkAdd(e, n, r) {
976
+ const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
977
+ return this._trans("readwrite", (o) => {
978
+ const { auto: u, keyPath: a } = this.schema.primKey;
979
+ if (a && s)
980
+ throw new C.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
981
+ if (s && s.length !== e.length)
982
+ throw new C.InvalidArgument("Arguments objects and keys must have the same length");
983
+ const c = e.length;
984
+ let d = a && u ? e.map(Qe(a)) : e;
985
+ return this.core.mutate({ trans: o, type: "add", keys: s, values: d, wantResults: i }).then(({ numFailures: l, results: h, lastResult: f, failures: m }) => {
986
+ if (l === 0)
987
+ return i ? h : f;
988
+ throw new je(`${this.name}.bulkAdd(): ${l} of ${c} operations failed`, m);
989
+ });
990
+ });
991
+ }
992
+ bulkPut(e, n, r) {
993
+ const s = Array.isArray(n) ? n : void 0, i = (r = r || (s ? void 0 : n)) ? r.allKeys : void 0;
994
+ return this._trans("readwrite", (o) => {
995
+ const { auto: u, keyPath: a } = this.schema.primKey;
996
+ if (a && s)
997
+ throw new C.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
998
+ if (s && s.length !== e.length)
999
+ throw new C.InvalidArgument("Arguments objects and keys must have the same length");
1000
+ const c = e.length;
1001
+ let d = a && u ? e.map(Qe(a)) : e;
1002
+ return this.core.mutate({ trans: o, type: "put", keys: s, values: d, wantResults: i }).then(({ numFailures: l, results: h, lastResult: f, failures: m }) => {
1003
+ if (l === 0)
1004
+ return i ? h : f;
1005
+ throw new je(`${this.name}.bulkPut(): ${l} of ${c} operations failed`, m);
1006
+ });
1007
+ });
1008
+ }
1009
+ bulkDelete(e) {
1010
+ const n = e.length;
1011
+ return this._trans("readwrite", (r) => this.core.mutate({ trans: r, type: "delete", keys: e })).then(({ numFailures: r, lastResult: s, failures: i }) => {
1012
+ if (r === 0)
1013
+ return s;
1014
+ throw new je(`${this.name}.bulkDelete(): ${r} of ${n} operations failed`, i);
1015
+ });
1016
+ }
1017
+ }
1018
+ function Ne(t) {
1019
+ var e = {}, n = function(o, u) {
1020
+ if (u) {
1021
+ for (var a = arguments.length, c = new Array(a - 1); --a; )
1022
+ c[a - 1] = arguments[a];
1023
+ return e[o].subscribe.apply(null, c), t;
1024
+ }
1025
+ if (typeof o == "string")
1026
+ return e[o];
1027
+ };
1028
+ n.addEventType = i;
1029
+ for (var r = 1, s = arguments.length; r < s; ++r)
1030
+ i(arguments[r]);
1031
+ return n;
1032
+ function i(o, u, a) {
1033
+ if (typeof o != "object") {
1034
+ var c;
1035
+ u || (u = kr), a || (a = I);
1036
+ var d = { subscribers: [], fire: a, subscribe: function(l) {
1037
+ d.subscribers.indexOf(l) === -1 && (d.subscribers.push(l), d.fire = u(d.fire, l));
1038
+ }, unsubscribe: function(l) {
1039
+ d.subscribers = d.subscribers.filter(function(h) {
1040
+ return h !== l;
1041
+ }), d.fire = d.subscribers.reduce(u, a);
1042
+ } };
1043
+ return e[o] = n[o] = d, d;
1044
+ }
1045
+ N(c = o).forEach(function(l) {
1046
+ var h = c[l];
1047
+ if (M(h))
1048
+ i(l, c[l][0], c[l][1]);
1049
+ else {
1050
+ if (h !== "asap")
1051
+ throw new C.InvalidArgument("Invalid event config");
1052
+ var f = i(l, Fe, function() {
1053
+ for (var m = arguments.length, p = new Array(m); m--; )
1054
+ p[m] = arguments[m];
1055
+ f.subscribers.forEach(function(v) {
1056
+ Cn(function() {
1057
+ v.apply(null, p);
1058
+ });
1059
+ });
1060
+ });
1061
+ }
1062
+ });
1063
+ }
1064
+ }
1065
+ function Oe(t, e) {
1066
+ return ke(e).from({ prototype: t }), e;
1067
+ }
1068
+ function be(t, e) {
1069
+ return !(t.filter || t.algorithm || t.or) && (e ? t.justLimit : !t.replayFilter);
1070
+ }
1071
+ function kt(t, e) {
1072
+ t.filter = ge(t.filter, e);
1073
+ }
1074
+ function xt(t, e, n) {
1075
+ var r = t.replayFilter;
1076
+ t.replayFilter = r ? () => ge(r(), e()) : e, t.justLimit = n && !r;
1077
+ }
1078
+ function ot(t, e) {
1079
+ if (t.isPrimKey)
1080
+ return e.primaryKey;
1081
+ const n = e.getIndexByKeyPath(t.index);
1082
+ if (!n)
1083
+ throw new C.Schema("KeyPath " + t.index + " on object store " + e.name + " is not indexed");
1084
+ return n;
1085
+ }
1086
+ function vn(t, e, n) {
1087
+ const r = ot(t, e.schema);
1088
+ return e.openCursor({ trans: n, values: !t.keysOnly, reverse: t.dir === "prev", unique: !!t.unique, query: { index: r, range: t.range } });
1089
+ }
1090
+ function Je(t, e, n, r) {
1091
+ const s = t.replayFilter ? ge(t.filter, t.replayFilter()) : t.filter;
1092
+ if (t.or) {
1093
+ const i = {}, o = (u, a, c) => {
1094
+ if (!s || s(a, c, (h) => a.stop(h), (h) => a.fail(h))) {
1095
+ var d = a.primaryKey, l = "" + d;
1096
+ l === "[object ArrayBuffer]" && (l = "" + new Uint8Array(d)), z(i, l) || (i[l] = !0, e(u, a, c));
1097
+ }
1098
+ };
1099
+ return Promise.all([t.or._iterate(o, n), bn(vn(t, r, n), t.algorithm, o, !t.keysOnly && t.valueMapper)]);
1100
+ }
1101
+ return bn(vn(t, r, n), ge(t.algorithm, s), e, !t.keysOnly && t.valueMapper);
1102
+ }
1103
+ function bn(t, e, n, r) {
1104
+ var s = j(r ? (i, o, u) => n(r(i), o, u) : n);
1105
+ return t.then((i) => {
1106
+ if (i)
1107
+ return i.start(() => {
1108
+ var o = () => i.continue();
1109
+ e && !e(i, (u) => o = u, (u) => {
1110
+ i.stop(u), o = I;
1111
+ }, (u) => {
1112
+ i.fail(u), o = I;
1113
+ }) || s(i.value, i, (u) => o = u), o();
1114
+ });
1115
+ });
1116
+ }
1117
+ function L(t, e) {
1118
+ try {
1119
+ const n = wn(t), r = wn(e);
1120
+ if (n !== r)
1121
+ return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
1122
+ switch (n) {
1123
+ case "number":
1124
+ case "Date":
1125
+ case "string":
1126
+ return t > e ? 1 : t < e ? -1 : 0;
1127
+ case "binary":
1128
+ return function(s, i) {
1129
+ const o = s.length, u = i.length, a = o < u ? o : u;
1130
+ for (let c = 0; c < a; ++c)
1131
+ if (s[c] !== i[c])
1132
+ return s[c] < i[c] ? -1 : 1;
1133
+ return o === u ? 0 : o < u ? -1 : 1;
1134
+ }(_n(t), _n(e));
1135
+ case "Array":
1136
+ return function(s, i) {
1137
+ const o = s.length, u = i.length, a = o < u ? o : u;
1138
+ for (let c = 0; c < a; ++c) {
1139
+ const d = L(s[c], i[c]);
1140
+ if (d !== 0)
1141
+ return d;
1142
+ }
1143
+ return o === u ? 0 : o < u ? -1 : 1;
1144
+ }(t, e);
1145
+ }
1146
+ } catch {
1147
+ }
1148
+ return NaN;
1149
+ }
1150
+ function wn(t) {
1151
+ const e = typeof t;
1152
+ if (e !== "object")
1153
+ return e;
1154
+ if (ArrayBuffer.isView(t))
1155
+ return "binary";
1156
+ const n = Tt(t);
1157
+ return n === "ArrayBuffer" ? "binary" : n;
1158
+ }
1159
+ function _n(t) {
1160
+ return t instanceof Uint8Array ? t : ArrayBuffer.isView(t) ? new Uint8Array(t.buffer, t.byteOffset, t.byteLength) : new Uint8Array(t);
1161
+ }
1162
+ class Kr {
1163
+ _read(e, n) {
1164
+ var r = this._ctx;
1165
+ return r.error ? r.table._trans(null, D.bind(null, r.error)) : r.table._trans("readonly", e).then(n);
1166
+ }
1167
+ _write(e) {
1168
+ var n = this._ctx;
1169
+ return n.error ? n.table._trans(null, D.bind(null, n.error)) : n.table._trans("readwrite", e, "locked");
1170
+ }
1171
+ _addAlgorithm(e) {
1172
+ var n = this._ctx;
1173
+ n.algorithm = ge(n.algorithm, e);
1174
+ }
1175
+ _iterate(e, n) {
1176
+ return Je(this._ctx, e, n, this._ctx.table.core);
1177
+ }
1178
+ clone(e) {
1179
+ var n = Object.create(this.constructor.prototype), r = Object.create(this._ctx);
1180
+ return e && U(r, e), n._ctx = r, n;
1181
+ }
1182
+ raw() {
1183
+ return this._ctx.valueMapper = null, this;
1184
+ }
1185
+ each(e) {
1186
+ var n = this._ctx;
1187
+ return this._read((r) => Je(n, e, r, n.table.core));
1188
+ }
1189
+ count(e) {
1190
+ return this._read((n) => {
1191
+ const r = this._ctx, s = r.table.core;
1192
+ if (be(r, !0))
1193
+ return s.count({ trans: n, query: { index: ot(r, s.schema), range: r.range } }).then((o) => Math.min(o, r.limit));
1194
+ var i = 0;
1195
+ return Je(r, () => (++i, !1), n, s).then(() => i);
1196
+ }).then(e);
1197
+ }
1198
+ sortBy(e, n) {
1199
+ const r = e.split(".").reverse(), s = r[0], i = r.length - 1;
1200
+ function o(c, d) {
1201
+ return d ? o(c[r[d]], d - 1) : c[s];
1202
+ }
1203
+ var u = this._ctx.dir === "next" ? 1 : -1;
1204
+ function a(c, d) {
1205
+ var l = o(c, i), h = o(d, i);
1206
+ return l < h ? -u : l > h ? u : 0;
1207
+ }
1208
+ return this.toArray(function(c) {
1209
+ return c.sort(a);
1210
+ }).then(n);
1211
+ }
1212
+ toArray(e) {
1213
+ return this._read((n) => {
1214
+ var r = this._ctx;
1215
+ if (r.dir === "next" && be(r, !0) && r.limit > 0) {
1216
+ const { valueMapper: s } = r, i = ot(r, r.table.core.schema);
1217
+ return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: i, range: r.range } }).then(({ result: o }) => s ? o.map(s) : o);
1218
+ }
1219
+ {
1220
+ const s = [];
1221
+ return Je(r, (i) => s.push(i), n, r.table.core).then(() => s);
1222
+ }
1223
+ }, e);
1224
+ }
1225
+ offset(e) {
1226
+ var n = this._ctx;
1227
+ return e <= 0 || (n.offset += e, be(n) ? xt(n, () => {
1228
+ var r = e;
1229
+ return (s, i) => r === 0 || (r === 1 ? (--r, !1) : (i(() => {
1230
+ s.advance(r), r = 0;
1231
+ }), !1));
1232
+ }) : xt(n, () => {
1233
+ var r = e;
1234
+ return () => --r < 0;
1235
+ })), this;
1236
+ }
1237
+ limit(e) {
1238
+ return this._ctx.limit = Math.min(this._ctx.limit, e), xt(this._ctx, () => {
1239
+ var n = e;
1240
+ return function(r, s, i) {
1241
+ return --n <= 0 && s(i), n >= 0;
1242
+ };
1243
+ }, !0), this;
1244
+ }
1245
+ until(e, n) {
1246
+ return kt(this._ctx, function(r, s, i) {
1247
+ return !e(r.value) || (s(i), n);
1248
+ }), this;
1249
+ }
1250
+ first(e) {
1251
+ return this.limit(1).toArray(function(n) {
1252
+ return n[0];
1253
+ }).then(e);
1254
+ }
1255
+ last(e) {
1256
+ return this.reverse().first(e);
1257
+ }
1258
+ filter(e) {
1259
+ var n, r;
1260
+ return kt(this._ctx, function(s) {
1261
+ return e(s.value);
1262
+ }), n = this._ctx, r = e, n.isMatch = ge(n.isMatch, r), this;
1263
+ }
1264
+ and(e) {
1265
+ return this.filter(e);
1266
+ }
1267
+ or(e) {
1268
+ return new this.db.WhereClause(this._ctx.table, e, this);
1269
+ }
1270
+ reverse() {
1271
+ return this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev", this._ondirectionchange && this._ondirectionchange(this._ctx.dir), this;
1272
+ }
1273
+ desc() {
1274
+ return this.reverse();
1275
+ }
1276
+ eachKey(e) {
1277
+ var n = this._ctx;
1278
+ return n.keysOnly = !n.isMatch, this.each(function(r, s) {
1279
+ e(s.key, s);
1280
+ });
1281
+ }
1282
+ eachUniqueKey(e) {
1283
+ return this._ctx.unique = "unique", this.eachKey(e);
1284
+ }
1285
+ eachPrimaryKey(e) {
1286
+ var n = this._ctx;
1287
+ return n.keysOnly = !n.isMatch, this.each(function(r, s) {
1288
+ e(s.primaryKey, s);
1289
+ });
1290
+ }
1291
+ keys(e) {
1292
+ var n = this._ctx;
1293
+ n.keysOnly = !n.isMatch;
1294
+ var r = [];
1295
+ return this.each(function(s, i) {
1296
+ r.push(i.key);
1297
+ }).then(function() {
1298
+ return r;
1299
+ }).then(e);
1300
+ }
1301
+ primaryKeys(e) {
1302
+ var n = this._ctx;
1303
+ if (n.dir === "next" && be(n, !0) && n.limit > 0)
1304
+ return this._read((s) => {
1305
+ var i = ot(n, n.table.core.schema);
1306
+ return n.table.core.query({ trans: s, values: !1, limit: n.limit, query: { index: i, range: n.range } });
1307
+ }).then(({ result: s }) => s).then(e);
1308
+ n.keysOnly = !n.isMatch;
1309
+ var r = [];
1310
+ return this.each(function(s, i) {
1311
+ r.push(i.primaryKey);
1312
+ }).then(function() {
1313
+ return r;
1314
+ }).then(e);
1315
+ }
1316
+ uniqueKeys(e) {
1317
+ return this._ctx.unique = "unique", this.keys(e);
1318
+ }
1319
+ firstKey(e) {
1320
+ return this.limit(1).keys(function(n) {
1321
+ return n[0];
1322
+ }).then(e);
1323
+ }
1324
+ lastKey(e) {
1325
+ return this.reverse().firstKey(e);
1326
+ }
1327
+ distinct() {
1328
+ var e = this._ctx, n = e.index && e.table.schema.idxByName[e.index];
1329
+ if (!n || !n.multi)
1330
+ return this;
1331
+ var r = {};
1332
+ return kt(this._ctx, function(s) {
1333
+ var i = s.primaryKey.toString(), o = z(r, i);
1334
+ return r[i] = !0, !o;
1335
+ }), this;
1336
+ }
1337
+ modify(e) {
1338
+ var n = this._ctx;
1339
+ return this._write((r) => {
1340
+ var s;
1341
+ if (typeof e == "function")
1342
+ s = e;
1343
+ else {
1344
+ var i = N(e), o = i.length;
1345
+ s = function(p) {
1346
+ for (var v = !1, y = 0; y < o; ++y) {
1347
+ var g = i[y], b = e[g];
1348
+ te(p, g) !== b && (H(p, g, b), v = !0);
1349
+ }
1350
+ return v;
1351
+ };
1352
+ }
1353
+ const u = n.table.core, { outbound: a, extractKey: c } = u.schema.primaryKey, d = this.db._options.modifyChunkSize || 200, l = [];
1354
+ let h = 0;
1355
+ const f = [], m = (p, v) => {
1356
+ const { failures: y, numFailures: g } = v;
1357
+ h += p - g;
1358
+ for (let b of N(y))
1359
+ l.push(y[b]);
1360
+ };
1361
+ return this.clone().primaryKeys().then((p) => {
1362
+ const v = (y) => {
1363
+ const g = Math.min(d, p.length - y);
1364
+ return u.getMany({ trans: r, keys: p.slice(y, y + g), cache: "immutable" }).then((b) => {
1365
+ const k = [], P = [], x = a ? [] : null, w = [];
1366
+ for (let _ = 0; _ < g; ++_) {
1367
+ const R = b[_], O = { value: We(R), primKey: p[y + _] };
1368
+ s.call(O, O.value, O) !== !1 && (O.value == null ? w.push(p[y + _]) : a || L(c(R), c(O.value)) === 0 ? (P.push(O.value), a && x.push(p[y + _])) : (w.push(p[y + _]), k.push(O.value)));
1369
+ }
1370
+ const A = be(n) && n.limit === 1 / 0 && (typeof e != "function" || e === St) && { index: n.index, range: n.range };
1371
+ return Promise.resolve(k.length > 0 && u.mutate({ trans: r, type: "add", values: k }).then((_) => {
1372
+ for (let R in _.failures)
1373
+ w.splice(parseInt(R), 1);
1374
+ m(k.length, _);
1375
+ })).then(() => (P.length > 0 || A && typeof e == "object") && u.mutate({ trans: r, type: "put", keys: x, values: P, criteria: A, changeSpec: typeof e != "function" && e }).then((_) => m(P.length, _))).then(() => (w.length > 0 || A && e === St) && u.mutate({ trans: r, type: "delete", keys: w, criteria: A }).then((_) => m(w.length, _))).then(() => p.length > y + g && v(y + d));
1376
+ });
1377
+ };
1378
+ return v(0).then(() => {
1379
+ if (l.length > 0)
1380
+ throw new lt("Error modifying one or more objects", l, h, f);
1381
+ return p.length;
1382
+ });
1383
+ });
1384
+ });
1385
+ }
1386
+ delete() {
1387
+ var e = this._ctx, n = e.range;
1388
+ return be(e) && (e.isPrimKey && !Or || n.type === 3) ? this._write((r) => {
1389
+ const { primaryKey: s } = e.table.core.schema, i = n;
1390
+ return e.table.core.count({ trans: r, query: { index: s, range: i } }).then((o) => e.table.core.mutate({ trans: r, type: "deleteRange", range: i }).then(({ failures: u, lastResult: a, results: c, numFailures: d }) => {
1391
+ if (d)
1392
+ throw new lt("Could not delete some values", Object.keys(u).map((l) => u[l]), o - d);
1393
+ return o - d;
1394
+ }));
1395
+ }) : this.modify(St);
1396
+ }
1397
+ }
1398
+ const St = (t, e) => e.value = null;
1399
+ function jr(t, e) {
1400
+ return t < e ? -1 : t === e ? 0 : 1;
1401
+ }
1402
+ function Rr(t, e) {
1403
+ return t > e ? -1 : t === e ? 0 : 1;
1404
+ }
1405
+ function W(t, e, n) {
1406
+ var r = t instanceof Gn ? new t.Collection(t) : t;
1407
+ return r._ctx.error = n ? new n(e) : new TypeError(e), r;
1408
+ }
1409
+ function we(t) {
1410
+ return new t.Collection(t, () => Yn("")).limit(0);
1411
+ }
1412
+ function $r(t, e, n, r, s, i) {
1413
+ for (var o = Math.min(t.length, r.length), u = -1, a = 0; a < o; ++a) {
1414
+ var c = e[a];
1415
+ if (c !== r[a])
1416
+ return s(t[a], n[a]) < 0 ? t.substr(0, a) + n[a] + n.substr(a + 1) : s(t[a], r[a]) < 0 ? t.substr(0, a) + r[a] + n.substr(a + 1) : u >= 0 ? t.substr(0, u) + e[u] + n.substr(u + 1) : null;
1417
+ s(t[a], c) < 0 && (u = a);
1418
+ }
1419
+ return o < r.length && i === "next" ? t + n.substr(t.length) : o < t.length && i === "prev" ? t.substr(0, n.length) : u < 0 ? null : t.substr(0, u) + r[u] + n.substr(u + 1);
1420
+ }
1421
+ function Ze(t, e, n, r) {
1422
+ var s, i, o, u, a, c, d, l = n.length;
1423
+ if (!n.every((p) => typeof p == "string"))
1424
+ return W(t, Wn);
1425
+ function h(p) {
1426
+ s = function(y) {
1427
+ return y === "next" ? (g) => g.toUpperCase() : (g) => g.toLowerCase();
1428
+ }(p), i = function(y) {
1429
+ return y === "next" ? (g) => g.toLowerCase() : (g) => g.toUpperCase();
1430
+ }(p), o = p === "next" ? jr : Rr;
1431
+ var v = n.map(function(y) {
1432
+ return { lower: i(y), upper: s(y) };
1433
+ }).sort(function(y, g) {
1434
+ return o(y.lower, g.lower);
1435
+ });
1436
+ u = v.map(function(y) {
1437
+ return y.upper;
1438
+ }), a = v.map(function(y) {
1439
+ return y.lower;
1440
+ }), c = p, d = p === "next" ? "" : r;
1441
+ }
1442
+ h("next");
1443
+ var f = new t.Collection(t, () => re(u[0], a[l - 1] + r));
1444
+ f._ondirectionchange = function(p) {
1445
+ h(p);
1446
+ };
1447
+ var m = 0;
1448
+ return f._addAlgorithm(function(p, v, y) {
1449
+ var g = p.key;
1450
+ if (typeof g != "string")
1451
+ return !1;
1452
+ var b = i(g);
1453
+ if (e(b, a, m))
1454
+ return !0;
1455
+ for (var k = null, P = m; P < l; ++P) {
1456
+ var x = $r(g, b, u[P], a[P], o, c);
1457
+ x === null && k === null ? m = P + 1 : (k === null || o(k, x) > 0) && (k = x);
1458
+ }
1459
+ return v(k !== null ? function() {
1460
+ p.continue(k + d);
1461
+ } : y), !1;
1462
+ }), f;
1463
+ }
1464
+ function re(t, e, n, r) {
1465
+ return { type: 2, lower: t, upper: e, lowerOpen: n, upperOpen: r };
1466
+ }
1467
+ function Yn(t) {
1468
+ return { type: 1, lower: t, upper: t };
1469
+ }
1470
+ class Gn {
1471
+ get Collection() {
1472
+ return this._ctx.table.db.Collection;
1473
+ }
1474
+ between(e, n, r, s) {
1475
+ r = r !== !1, s = s === !0;
1476
+ try {
1477
+ return this._cmp(e, n) > 0 || this._cmp(e, n) === 0 && (r || s) && (!r || !s) ? we(this) : new this.Collection(this, () => re(e, n, !r, !s));
1478
+ } catch {
1479
+ return W(this, X);
1480
+ }
1481
+ }
1482
+ equals(e) {
1483
+ return e == null ? W(this, X) : new this.Collection(this, () => Yn(e));
1484
+ }
1485
+ above(e) {
1486
+ return e == null ? W(this, X) : new this.Collection(this, () => re(e, void 0, !0));
1487
+ }
1488
+ aboveOrEqual(e) {
1489
+ return e == null ? W(this, X) : new this.Collection(this, () => re(e, void 0, !1));
1490
+ }
1491
+ below(e) {
1492
+ return e == null ? W(this, X) : new this.Collection(this, () => re(void 0, e, !1, !0));
1493
+ }
1494
+ belowOrEqual(e) {
1495
+ return e == null ? W(this, X) : new this.Collection(this, () => re(void 0, e));
1496
+ }
1497
+ startsWith(e) {
1498
+ return typeof e != "string" ? W(this, Wn) : this.between(e, e + he, !0, !0);
1499
+ }
1500
+ startsWithIgnoreCase(e) {
1501
+ return e === "" ? this.startsWith(e) : Ze(this, (n, r) => n.indexOf(r[0]) === 0, [e], he);
1502
+ }
1503
+ equalsIgnoreCase(e) {
1504
+ return Ze(this, (n, r) => n === r[0], [e], "");
1505
+ }
1506
+ anyOfIgnoreCase() {
1507
+ var e = J.apply(_e, arguments);
1508
+ return e.length === 0 ? we(this) : Ze(this, (n, r) => r.indexOf(n) !== -1, e, "");
1509
+ }
1510
+ startsWithAnyOfIgnoreCase() {
1511
+ var e = J.apply(_e, arguments);
1512
+ return e.length === 0 ? we(this) : Ze(this, (n, r) => r.some((s) => n.indexOf(s) === 0), e, he);
1513
+ }
1514
+ anyOf() {
1515
+ const e = J.apply(_e, arguments);
1516
+ let n = this._cmp;
1517
+ try {
1518
+ e.sort(n);
1519
+ } catch {
1520
+ return W(this, X);
1521
+ }
1522
+ if (e.length === 0)
1523
+ return we(this);
1524
+ const r = new this.Collection(this, () => re(e[0], e[e.length - 1]));
1525
+ r._ondirectionchange = (i) => {
1526
+ n = i === "next" ? this._ascending : this._descending, e.sort(n);
1527
+ };
1528
+ let s = 0;
1529
+ return r._addAlgorithm((i, o, u) => {
1530
+ const a = i.key;
1531
+ for (; n(a, e[s]) > 0; )
1532
+ if (++s, s === e.length)
1533
+ return o(u), !1;
1534
+ return n(a, e[s]) === 0 || (o(() => {
1535
+ i.continue(e[s]);
1536
+ }), !1);
1537
+ }), r;
1538
+ }
1539
+ notEqual(e) {
1540
+ return this.inAnyRange([[Mt, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
1541
+ }
1542
+ noneOf() {
1543
+ const e = J.apply(_e, arguments);
1544
+ if (e.length === 0)
1545
+ return new this.Collection(this);
1546
+ try {
1547
+ e.sort(this._ascending);
1548
+ } catch {
1549
+ return W(this, X);
1550
+ }
1551
+ const n = e.reduce((r, s) => r ? r.concat([[r[r.length - 1][1], s]]) : [[Mt, s]], null);
1552
+ return n.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(n, { includeLowers: !1, includeUppers: !1 });
1553
+ }
1554
+ inAnyRange(e, n) {
1555
+ const r = this._cmp, s = this._ascending, i = this._descending, o = this._min, u = this._max;
1556
+ if (e.length === 0)
1557
+ return we(this);
1558
+ if (!e.every((g) => g[0] !== void 0 && g[1] !== void 0 && s(g[0], g[1]) <= 0))
1559
+ return W(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", C.InvalidArgument);
1560
+ const a = !n || n.includeLowers !== !1, c = n && n.includeUppers === !0;
1561
+ let d, l = s;
1562
+ function h(g, b) {
1563
+ return l(g[0], b[0]);
1564
+ }
1565
+ try {
1566
+ d = e.reduce(function(g, b) {
1567
+ let k = 0, P = g.length;
1568
+ for (; k < P; ++k) {
1569
+ const x = g[k];
1570
+ if (r(b[0], x[1]) < 0 && r(b[1], x[0]) > 0) {
1571
+ x[0] = o(x[0], b[0]), x[1] = u(x[1], b[1]);
1572
+ break;
1573
+ }
1574
+ }
1575
+ return k === P && g.push(b), g;
1576
+ }, []), d.sort(h);
1577
+ } catch {
1578
+ return W(this, X);
1579
+ }
1580
+ let f = 0;
1581
+ const m = c ? (g) => s(g, d[f][1]) > 0 : (g) => s(g, d[f][1]) >= 0, p = a ? (g) => i(g, d[f][0]) > 0 : (g) => i(g, d[f][0]) >= 0;
1582
+ let v = m;
1583
+ const y = new this.Collection(this, () => re(d[0][0], d[d.length - 1][1], !a, !c));
1584
+ return y._ondirectionchange = (g) => {
1585
+ g === "next" ? (v = m, l = s) : (v = p, l = i), d.sort(h);
1586
+ }, y._addAlgorithm((g, b, k) => {
1587
+ for (var P = g.key; v(P); )
1588
+ if (++f, f === d.length)
1589
+ return b(k), !1;
1590
+ return !!function(x) {
1591
+ return !m(x) && !p(x);
1592
+ }(P) || (this._cmp(P, d[f][1]) === 0 || this._cmp(P, d[f][0]) === 0 || b(() => {
1593
+ l === s ? g.continue(d[f][0]) : g.continue(d[f][1]);
1594
+ }), !1);
1595
+ }), y;
1596
+ }
1597
+ startsWithAnyOf() {
1598
+ const e = J.apply(_e, arguments);
1599
+ return e.every((n) => typeof n == "string") ? e.length === 0 ? we(this) : this.inAnyRange(e.map((n) => [n, n + he])) : W(this, "startsWithAnyOf() only works with strings");
1600
+ }
1601
+ }
1602
+ function Y(t) {
1603
+ return j(function(e) {
1604
+ return qe(e), t(e.target.error), !1;
1605
+ });
1606
+ }
1607
+ function qe(t) {
1608
+ t.stopPropagation && t.stopPropagation(), t.preventDefault && t.preventDefault();
1609
+ }
1610
+ const Le = "storagemutated", ie = "x-storagemutated-1", ue = Ne(null, Le);
1611
+ class Nr {
1612
+ _lock() {
1613
+ return Ie(!E.global), ++this._reculock, this._reculock !== 1 || E.global || (E.lockOwnerFor = this), this;
1614
+ }
1615
+ _unlock() {
1616
+ if (Ie(!E.global), --this._reculock == 0)
1617
+ for (E.global || (E.lockOwnerFor = null); this._blockedFuncs.length > 0 && !this._locked(); ) {
1618
+ var e = this._blockedFuncs.shift();
1619
+ try {
1620
+ Te(e[1], e[0]);
1621
+ } catch {
1622
+ }
1623
+ }
1624
+ return this;
1625
+ }
1626
+ _locked() {
1627
+ return this._reculock && E.lockOwnerFor !== this;
1628
+ }
1629
+ create(e) {
1630
+ if (!this.mode)
1631
+ return this;
1632
+ const n = this.db.idbdb, r = this.db._state.dbOpenError;
1633
+ if (Ie(!this.idbtrans), !e && !n)
1634
+ switch (r && r.name) {
1635
+ case "DatabaseClosedError":
1636
+ throw new C.DatabaseClosed(r);
1637
+ case "MissingAPIError":
1638
+ throw new C.MissingAPI(r.message, r);
1639
+ default:
1640
+ throw new C.OpenFailed(r);
1641
+ }
1642
+ if (!this.active)
1643
+ throw new C.TransactionInactive();
1644
+ return Ie(this._completion._state === null), (e = this.idbtrans = e || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }) : n.transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability }))).onerror = j((s) => {
1645
+ qe(s), this._reject(e.error);
1646
+ }), e.onabort = j((s) => {
1647
+ qe(s), this.active && this._reject(new C.Abort(e.error)), this.active = !1, this.on("abort").fire(s);
1648
+ }), e.oncomplete = j(() => {
1649
+ this.active = !1, this._resolve(), "mutatedParts" in e && ue.storagemutated.fire(e.mutatedParts);
1650
+ }), this;
1651
+ }
1652
+ _promise(e, n, r) {
1653
+ if (e === "readwrite" && this.mode !== "readwrite")
1654
+ return D(new C.ReadOnly("Transaction is readonly"));
1655
+ if (!this.active)
1656
+ return D(new C.TransactionInactive());
1657
+ if (this._locked())
1658
+ return new S((i, o) => {
1659
+ this._blockedFuncs.push([() => {
1660
+ this._promise(e, n, r).then(i, o);
1661
+ }, E]);
1662
+ });
1663
+ if (r)
1664
+ return oe(() => {
1665
+ var i = new S((o, u) => {
1666
+ this._lock();
1667
+ const a = n(o, u, this);
1668
+ a && a.then && a.then(o, u);
1669
+ });
1670
+ return i.finally(() => this._unlock()), i._lib = !0, i;
1671
+ });
1672
+ var s = new S((i, o) => {
1673
+ var u = n(i, o, this);
1674
+ u && u.then && u.then(i, o);
1675
+ });
1676
+ return s._lib = !0, s;
1677
+ }
1678
+ _root() {
1679
+ return this.parent ? this.parent._root() : this;
1680
+ }
1681
+ waitFor(e) {
1682
+ var n = this._root();
1683
+ const r = S.resolve(e);
1684
+ if (n._waitingFor)
1685
+ n._waitingFor = n._waitingFor.then(() => r);
1686
+ else {
1687
+ n._waitingFor = r, n._waitingQueue = [];
1688
+ var s = n.idbtrans.objectStore(n.storeNames[0]);
1689
+ (function o() {
1690
+ for (++n._spinCount; n._waitingQueue.length; )
1691
+ n._waitingQueue.shift()();
1692
+ n._waitingFor && (s.get(-1 / 0).onsuccess = o);
1693
+ })();
1694
+ }
1695
+ var i = n._waitingFor;
1696
+ return new S((o, u) => {
1697
+ r.then((a) => n._waitingQueue.push(j(o.bind(null, a))), (a) => n._waitingQueue.push(j(u.bind(null, a)))).finally(() => {
1698
+ n._waitingFor === i && (n._waitingFor = null);
1699
+ });
1700
+ });
1701
+ }
1702
+ abort() {
1703
+ this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new C.Abort()));
1704
+ }
1705
+ table(e) {
1706
+ const n = this._memoizedTables || (this._memoizedTables = {});
1707
+ if (z(n, e))
1708
+ return n[e];
1709
+ const r = this.schema[e];
1710
+ if (!r)
1711
+ throw new C.NotFound("Table " + e + " not part of transaction");
1712
+ const s = new this.db.Table(e, r, this);
1713
+ return s.core = this.db.core.table(e), n[e] = s, s;
1714
+ }
1715
+ }
1716
+ function qt(t, e, n, r, s, i, o) {
1717
+ return { name: t, keyPath: e, unique: n, multi: r, auto: s, compound: i, src: (n && !o ? "&" : "") + (r ? "*" : "") + (s ? "++" : "") + Xn(e) };
1718
+ }
1719
+ function Xn(t) {
1720
+ return typeof t == "string" ? t : t ? "[" + [].join.call(t, "+") + "]" : "";
1721
+ }
1722
+ function Qn(t, e, n) {
1723
+ return { name: t, primKey: e, indexes: n, mappedClass: null, idxByName: Tn(n, (r) => [r.name, r]) };
1724
+ }
1725
+ let Ue = (t) => {
1726
+ try {
1727
+ return t.only([[]]), Ue = () => [[]], [[]];
1728
+ } catch {
1729
+ return Ue = () => he, he;
1730
+ }
1731
+ };
1732
+ function Lt(t) {
1733
+ return t == null ? () => {
1734
+ } : typeof t == "string" ? function(e) {
1735
+ return e.split(".").length === 1 ? (n) => n[e] : (n) => te(n, e);
1736
+ }(t) : (e) => te(e, t);
1737
+ }
1738
+ function kn(t) {
1739
+ return [].slice.call(t);
1740
+ }
1741
+ let Dr = 0;
1742
+ function De(t) {
1743
+ return t == null ? ":id" : typeof t == "string" ? t : `[${t.join("+")}]`;
1744
+ }
1745
+ function Br(t, e, n) {
1746
+ function r(a) {
1747
+ if (a.type === 3)
1748
+ return null;
1749
+ if (a.type === 4)
1750
+ throw new Error("Cannot convert never type to IDBKeyRange");
1751
+ const { lower: c, upper: d, lowerOpen: l, upperOpen: h } = a;
1752
+ return c === void 0 ? d === void 0 ? null : e.upperBound(d, !!h) : d === void 0 ? e.lowerBound(c, !!l) : e.bound(c, d, !!l, !!h);
1753
+ }
1754
+ const { schema: s, hasGetAll: i } = function(a, c) {
1755
+ const d = kn(a.objectStoreNames);
1756
+ return { schema: { name: a.name, tables: d.map((l) => c.objectStore(l)).map((l) => {
1757
+ const { keyPath: h, autoIncrement: f } = l, m = M(h), p = h == null, v = {}, y = { name: l.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: p, compound: m, keyPath: h, autoIncrement: f, unique: !0, extractKey: Lt(h) }, indexes: kn(l.indexNames).map((g) => l.index(g)).map((g) => {
1758
+ const { name: b, unique: k, multiEntry: P, keyPath: x } = g, w = { name: b, compound: M(x), keyPath: x, unique: k, multiEntry: P, extractKey: Lt(x) };
1759
+ return v[De(x)] = w, w;
1760
+ }), getIndexByKeyPath: (g) => v[De(g)] };
1761
+ return v[":id"] = y.primaryKey, h != null && (v[De(h)] = y.primaryKey), y;
1762
+ }) }, hasGetAll: d.length > 0 && "getAll" in c.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) };
1763
+ }(t, n), o = s.tables.map((a) => function(c) {
1764
+ const d = c.name;
1765
+ return { name: d, schema: c, mutate: function({ trans: l, type: h, keys: f, values: m, range: p }) {
1766
+ return new Promise((v, y) => {
1767
+ v = j(v);
1768
+ const g = l.objectStore(d), b = g.keyPath == null, k = h === "put" || h === "add";
1769
+ if (!k && h !== "delete" && h !== "deleteRange")
1770
+ throw new Error("Invalid operation type: " + h);
1771
+ const { length: P } = f || m || { length: 1 };
1772
+ if (f && m && f.length !== m.length)
1773
+ throw new Error("Given keys array must have same length as given values array.");
1774
+ if (P === 0)
1775
+ return v({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
1776
+ let x;
1777
+ const w = [], A = [];
1778
+ let _ = 0;
1779
+ const R = (q) => {
1780
+ ++_, qe(q);
1781
+ };
1782
+ if (h === "deleteRange") {
1783
+ if (p.type === 4)
1784
+ return v({ numFailures: _, failures: A, results: [], lastResult: void 0 });
1785
+ p.type === 3 ? w.push(x = g.clear()) : w.push(x = g.delete(r(p)));
1786
+ } else {
1787
+ const [q, B] = k ? b ? [m, f] : [m, null] : [f, null];
1788
+ if (k)
1789
+ for (let $ = 0; $ < P; ++$)
1790
+ w.push(x = B && B[$] !== void 0 ? g[h](q[$], B[$]) : g[h](q[$])), x.onerror = R;
1791
+ else
1792
+ for (let $ = 0; $ < P; ++$)
1793
+ w.push(x = g[h](q[$])), x.onerror = R;
1794
+ }
1795
+ const O = (q) => {
1796
+ const B = q.target.result;
1797
+ w.forEach(($, ye) => $.error != null && (A[ye] = $.error)), v({ numFailures: _, failures: A, results: h === "delete" ? f : w.map(($) => $.result), lastResult: B });
1798
+ };
1799
+ x.onerror = (q) => {
1800
+ R(q), O(q);
1801
+ }, x.onsuccess = O;
1802
+ });
1803
+ }, getMany: ({ trans: l, keys: h }) => new Promise((f, m) => {
1804
+ f = j(f);
1805
+ const p = l.objectStore(d), v = h.length, y = new Array(v);
1806
+ let g, b = 0, k = 0;
1807
+ const P = (w) => {
1808
+ const A = w.target;
1809
+ y[A._pos] = A.result, ++k === b && f(y);
1810
+ }, x = Y(m);
1811
+ for (let w = 0; w < v; ++w)
1812
+ h[w] != null && (g = p.get(h[w]), g._pos = w, g.onsuccess = P, g.onerror = x, ++b);
1813
+ b === 0 && f(y);
1814
+ }), get: ({ trans: l, key: h }) => new Promise((f, m) => {
1815
+ f = j(f);
1816
+ const p = l.objectStore(d).get(h);
1817
+ p.onsuccess = (v) => f(v.target.result), p.onerror = Y(m);
1818
+ }), query: function(l) {
1819
+ return (h) => new Promise((f, m) => {
1820
+ f = j(f);
1821
+ const { trans: p, values: v, limit: y, query: g } = h, b = y === 1 / 0 ? void 0 : y, { index: k, range: P } = g, x = p.objectStore(d), w = k.isPrimaryKey ? x : x.index(k.name), A = r(P);
1822
+ if (y === 0)
1823
+ return f({ result: [] });
1824
+ if (l) {
1825
+ const _ = v ? w.getAll(A, b) : w.getAllKeys(A, b);
1826
+ _.onsuccess = (R) => f({ result: R.target.result }), _.onerror = Y(m);
1827
+ } else {
1828
+ let _ = 0;
1829
+ const R = v || !("openKeyCursor" in w) ? w.openCursor(A) : w.openKeyCursor(A), O = [];
1830
+ R.onsuccess = (q) => {
1831
+ const B = R.result;
1832
+ return B ? (O.push(v ? B.value : B.primaryKey), ++_ === y ? f({ result: O }) : void B.continue()) : f({ result: O });
1833
+ }, R.onerror = Y(m);
1834
+ }
1835
+ });
1836
+ }(i), openCursor: function({ trans: l, values: h, query: f, reverse: m, unique: p }) {
1837
+ return new Promise((v, y) => {
1838
+ v = j(v);
1839
+ const { index: g, range: b } = f, k = l.objectStore(d), P = g.isPrimaryKey ? k : k.index(g.name), x = m ? p ? "prevunique" : "prev" : p ? "nextunique" : "next", w = h || !("openKeyCursor" in P) ? P.openCursor(r(b), x) : P.openKeyCursor(r(b), x);
1840
+ w.onerror = Y(y), w.onsuccess = j((A) => {
1841
+ const _ = w.result;
1842
+ if (!_)
1843
+ return void v(null);
1844
+ _.___id = ++Dr, _.done = !1;
1845
+ const R = _.continue.bind(_);
1846
+ let O = _.continuePrimaryKey;
1847
+ O && (O = O.bind(_));
1848
+ const q = _.advance.bind(_), B = () => {
1849
+ throw new Error("Cursor not stopped");
1850
+ };
1851
+ _.trans = l, _.stop = _.continue = _.continuePrimaryKey = _.advance = () => {
1852
+ throw new Error("Cursor not started");
1853
+ }, _.fail = j(y), _.next = function() {
1854
+ let $ = 1;
1855
+ return this.start(() => $-- ? this.continue() : this.stop()).then(() => this);
1856
+ }, _.start = ($) => {
1857
+ const ye = new Promise((V, le) => {
1858
+ V = j(V), w.onerror = Y(le), _.fail = le, _.stop = (Ae) => {
1859
+ _.stop = _.continue = _.continuePrimaryKey = _.advance = B, V(Ae);
1860
+ };
1861
+ }), ve = () => {
1862
+ if (w.result)
1863
+ try {
1864
+ $();
1865
+ } catch (V) {
1866
+ _.fail(V);
1867
+ }
1868
+ else
1869
+ _.done = !0, _.start = () => {
1870
+ throw new Error("Cursor behind last entry");
1871
+ }, _.stop();
1872
+ };
1873
+ return w.onsuccess = j((V) => {
1874
+ w.onsuccess = ve, ve();
1875
+ }), _.continue = R, _.continuePrimaryKey = O, _.advance = q, ve(), ye;
1876
+ }, v(_);
1877
+ }, y);
1878
+ });
1879
+ }, count({ query: l, trans: h }) {
1880
+ const { index: f, range: m } = l;
1881
+ return new Promise((p, v) => {
1882
+ const y = h.objectStore(d), g = f.isPrimaryKey ? y : y.index(f.name), b = r(m), k = b ? g.count(b) : g.count();
1883
+ k.onsuccess = j((P) => p(P.target.result)), k.onerror = Y(v);
1884
+ });
1885
+ } };
1886
+ }(a)), u = {};
1887
+ return o.forEach((a) => u[a.name] = a), { stack: "dbcore", transaction: t.transaction.bind(t), table(a) {
1888
+ if (!u[a])
1889
+ throw new Error(`Table '${a}' not found`);
1890
+ return u[a];
1891
+ }, MIN_KEY: -1 / 0, MAX_KEY: Ue(e), schema: s };
1892
+ }
1893
+ function Ut({ _novip: t }, e) {
1894
+ const n = e.db, r = function(s, i, { IDBKeyRange: o, indexedDB: u }, a) {
1895
+ return { dbcore: function(c, d) {
1896
+ return d.reduce((l, { create: h }) => ({ ...l, ...h(l) }), c);
1897
+ }(Br(i, o, a), s.dbcore) };
1898
+ }(t._middlewares, n, t._deps, e);
1899
+ t.core = r.dbcore, t.tables.forEach((s) => {
1900
+ const i = s.name;
1901
+ t.core.schema.tables.some((o) => o.name === i) && (s.core = t.core.table(i), t[i] instanceof t.Table && (t[i].core = s.core));
1902
+ });
1903
+ }
1904
+ function pt({ _novip: t }, e, n, r) {
1905
+ n.forEach((s) => {
1906
+ const i = r[s];
1907
+ e.forEach((o) => {
1908
+ const u = Jt(o, s);
1909
+ (!u || "value" in u && u.value === void 0) && (o === t.Transaction.prototype || o instanceof t.Transaction ? ee(o, s, { get() {
1910
+ return this.table(s);
1911
+ }, set(a) {
1912
+ Pn(this, s, { value: a, writable: !0, configurable: !0, enumerable: !0 });
1913
+ } }) : o[s] = new t.Table(s, i));
1914
+ });
1915
+ });
1916
+ }
1917
+ function Vt({ _novip: t }, e) {
1918
+ e.forEach((n) => {
1919
+ for (let r in n)
1920
+ n[r] instanceof t.Table && delete n[r];
1921
+ });
1922
+ }
1923
+ function Fr(t, e) {
1924
+ return t._cfg.version - e._cfg.version;
1925
+ }
1926
+ function Mr(t, e, n, r) {
1927
+ const s = t._dbSchema, i = t._createTransaction("readwrite", t._storeNames, s);
1928
+ i.create(n), i._completion.catch(r);
1929
+ const o = i._reject.bind(i), u = E.transless || E;
1930
+ oe(() => {
1931
+ E.trans = i, E.transless = u, e === 0 ? (N(s).forEach((a) => {
1932
+ Pt(n, a, s[a].primKey, s[a].indexes);
1933
+ }), Ut(t, n), S.follow(() => t.on.populate.fire(i)).catch(o)) : function({ _novip: a }, c, d, l) {
1934
+ const h = [], f = a._versions;
1935
+ let m = a._dbSchema = zt(a, a.idbdb, l), p = !1;
1936
+ const v = f.filter((g) => g._cfg.version >= c);
1937
+ function y() {
1938
+ return h.length ? S.resolve(h.shift()(d.idbtrans)).then(y) : S.resolve();
1939
+ }
1940
+ return v.forEach((g) => {
1941
+ h.push(() => {
1942
+ const b = m, k = g._cfg.dbschema;
1943
+ Ht(a, b, l), Ht(a, k, l), m = a._dbSchema = k;
1944
+ const P = Jn(b, k);
1945
+ P.add.forEach((w) => {
1946
+ Pt(l, w[0], w[1].primKey, w[1].indexes);
1947
+ }), P.change.forEach((w) => {
1948
+ if (w.recreate)
1949
+ throw new C.Upgrade("Not yet support for changing primary key");
1950
+ {
1951
+ const A = l.objectStore(w.name);
1952
+ w.add.forEach((_) => Wt(A, _)), w.change.forEach((_) => {
1953
+ A.deleteIndex(_.name), Wt(A, _);
1954
+ }), w.del.forEach((_) => A.deleteIndex(_));
1955
+ }
1956
+ });
1957
+ const x = g._cfg.contentUpgrade;
1958
+ if (x && g._cfg.version > c) {
1959
+ Ut(a, l), d._memoizedTables = {}, p = !0;
1960
+ let w = An(k);
1961
+ P.del.forEach((O) => {
1962
+ w[O] = b[O];
1963
+ }), Vt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], N(w), w), d.schema = w;
1964
+ const A = Zt(x);
1965
+ let _;
1966
+ A && Ce();
1967
+ const R = S.follow(() => {
1968
+ if (_ = x(d), _ && A) {
1969
+ var O = ne.bind(null, null);
1970
+ _.then(O, O);
1971
+ }
1972
+ });
1973
+ return _ && typeof _.then == "function" ? S.resolve(_) : R.then(() => _);
1974
+ }
1975
+ }), h.push((b) => {
1976
+ (!p || !Ar) && function(k, P) {
1977
+ [].slice.call(P.db.objectStoreNames).forEach((x) => k[x] == null && P.db.deleteObjectStore(x));
1978
+ }(g._cfg.dbschema, b), Vt(a, [a.Transaction.prototype]), pt(a, [a.Transaction.prototype], a._storeNames, a._dbSchema), d.schema = a._dbSchema;
1979
+ });
1980
+ }), y().then(() => {
1981
+ var g, b;
1982
+ b = l, N(g = m).forEach((k) => {
1983
+ b.db.objectStoreNames.contains(k) || Pt(b, k, g[k].primKey, g[k].indexes);
1984
+ });
1985
+ });
1986
+ }(t, e, i, n).catch(o);
1987
+ });
1988
+ }
1989
+ function Jn(t, e) {
1990
+ const n = { del: [], add: [], change: [] };
1991
+ let r;
1992
+ for (r in t)
1993
+ e[r] || n.del.push(r);
1994
+ for (r in e) {
1995
+ const s = t[r], i = e[r];
1996
+ if (s) {
1997
+ const o = { name: r, def: i, recreate: !1, del: [], add: [], change: [] };
1998
+ if ("" + (s.primKey.keyPath || "") != "" + (i.primKey.keyPath || "") || s.primKey.auto !== i.primKey.auto && !gt)
1999
+ o.recreate = !0, n.change.push(o);
2000
+ else {
2001
+ const u = s.idxByName, a = i.idxByName;
2002
+ let c;
2003
+ for (c in u)
2004
+ a[c] || o.del.push(c);
2005
+ for (c in a) {
2006
+ const d = u[c], l = a[c];
2007
+ d ? d.src !== l.src && o.change.push(l) : o.add.push(l);
2008
+ }
2009
+ (o.del.length > 0 || o.add.length > 0 || o.change.length > 0) && n.change.push(o);
2010
+ }
2011
+ } else
2012
+ n.add.push([r, i]);
2013
+ }
2014
+ return n;
2015
+ }
2016
+ function Pt(t, e, n, r) {
2017
+ const s = t.db.createObjectStore(e, n.keyPath ? { keyPath: n.keyPath, autoIncrement: n.auto } : { autoIncrement: n.auto });
2018
+ return r.forEach((i) => Wt(s, i)), s;
2019
+ }
2020
+ function Wt(t, e) {
2021
+ t.createIndex(e.name, e.keyPath, { unique: e.unique, multiEntry: e.multi });
2022
+ }
2023
+ function zt(t, e, n) {
2024
+ const r = {};
2025
+ return ut(e.objectStoreNames, 0).forEach((s) => {
2026
+ const i = n.objectStore(s);
2027
+ let o = i.keyPath;
2028
+ const u = qt(Xn(o), o || "", !1, !1, !!i.autoIncrement, o && typeof o != "string", !0), a = [];
2029
+ for (let d = 0; d < i.indexNames.length; ++d) {
2030
+ const l = i.index(i.indexNames[d]);
2031
+ o = l.keyPath;
2032
+ var c = qt(l.name, o, !!l.unique, !!l.multiEntry, !1, o && typeof o != "string", !1);
2033
+ a.push(c);
2034
+ }
2035
+ r[s] = Qn(s, u, a);
2036
+ }), r;
2037
+ }
2038
+ function Ht({ _novip: t }, e, n) {
2039
+ const r = n.db.objectStoreNames;
2040
+ for (let s = 0; s < r.length; ++s) {
2041
+ const i = r[s], o = n.objectStore(i);
2042
+ t._hasGetAll = "getAll" in o;
2043
+ for (let u = 0; u < o.indexNames.length; ++u) {
2044
+ const a = o.indexNames[u], c = o.index(a).keyPath, d = typeof c == "string" ? c : "[" + ut(c).join("+") + "]";
2045
+ if (e[i]) {
2046
+ const l = e[i].idxByName[d];
2047
+ l && (l.name = a, delete e[i].idxByName[d], e[i].idxByName[a] = l);
2048
+ }
2049
+ }
2050
+ }
2051
+ typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && K.WorkerGlobalScope && K instanceof K.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (t._hasGetAll = !1);
2052
+ }
2053
+ class qr {
2054
+ _parseStoresSpec(e, n) {
2055
+ N(e).forEach((r) => {
2056
+ if (e[r] !== null) {
2057
+ var s = e[r].split(",").map((o, u) => {
2058
+ const a = (o = o.trim()).replace(/([&*]|\+\+)/g, ""), c = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
2059
+ return qt(a, c || null, /\&/.test(o), /\*/.test(o), /\+\+/.test(o), M(c), u === 0);
2060
+ }), i = s.shift();
2061
+ if (i.multi)
2062
+ throw new C.Schema("Primary key cannot be multi-valued");
2063
+ s.forEach((o) => {
2064
+ if (o.auto)
2065
+ throw new C.Schema("Only primary key can be marked as autoIncrement (++)");
2066
+ if (!o.keyPath)
2067
+ throw new C.Schema("Index must have a name and cannot be an empty string");
2068
+ }), n[r] = Qn(r, i, s);
2069
+ }
2070
+ });
2071
+ }
2072
+ stores(e) {
2073
+ const n = this.db;
2074
+ this._cfg.storesSource = this._cfg.storesSource ? U(this._cfg.storesSource, e) : e;
2075
+ const r = n._versions, s = {};
2076
+ let i = {};
2077
+ return r.forEach((o) => {
2078
+ U(s, o._cfg.storesSource), i = o._cfg.dbschema = {}, o._parseStoresSpec(s, i);
2079
+ }), n._dbSchema = i, Vt(n, [n._allTables, n, n.Transaction.prototype]), pt(n, [n._allTables, n, n.Transaction.prototype, this._cfg.tables], N(i), i), n._storeNames = N(i), this;
2080
+ }
2081
+ upgrade(e) {
2082
+ return this._cfg.contentUpgrade = nn(this._cfg.contentUpgrade || I, e), this;
2083
+ }
2084
+ }
2085
+ function an(t, e) {
2086
+ let n = t._dbNamesDB;
2087
+ return n || (n = t._dbNamesDB = new pe(yt, { addons: [], indexedDB: t, IDBKeyRange: e }), n.version(1).stores({ dbnames: "name" })), n.table("dbnames");
2088
+ }
2089
+ function un(t) {
2090
+ return t && typeof t.databases == "function";
2091
+ }
2092
+ function Yt(t) {
2093
+ return oe(function() {
2094
+ return E.letThrough = !0, t();
2095
+ });
2096
+ }
2097
+ function Lr() {
2098
+ var t;
2099
+ return !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
2100
+ var n = function() {
2101
+ return indexedDB.databases().finally(e);
2102
+ };
2103
+ t = setInterval(n, 100), n();
2104
+ }).finally(function() {
2105
+ return clearInterval(t);
2106
+ }) : Promise.resolve();
2107
+ }
2108
+ function Ur(t) {
2109
+ const e = t._state, { indexedDB: n } = t._deps;
2110
+ if (e.isBeingOpened || t.idbdb)
2111
+ return e.dbReadyPromise.then(() => e.dbOpenError ? D(e.dbOpenError) : t);
2112
+ G && (e.openCanceller._stackHolder = Ee()), e.isBeingOpened = !0, e.dbOpenError = null, e.openComplete = !1;
2113
+ const r = e.openCanceller;
2114
+ function s() {
2115
+ if (e.openCanceller !== r)
2116
+ throw new C.DatabaseClosed("db.open() was cancelled");
2117
+ }
2118
+ let i = e.dbReadyResolve, o = null, u = !1;
2119
+ return S.race([r, (typeof navigator > "u" ? S.resolve() : Lr()).then(() => new S((a, c) => {
2120
+ if (s(), !n)
2121
+ throw new C.MissingAPI();
2122
+ const d = t.name, l = e.autoSchema ? n.open(d) : n.open(d, Math.round(10 * t.verno));
2123
+ if (!l)
2124
+ throw new C.MissingAPI();
2125
+ l.onerror = Y(c), l.onblocked = j(t._fireOnBlocked), l.onupgradeneeded = j((h) => {
2126
+ if (o = l.transaction, e.autoSchema && !t._options.allowEmptyDB) {
2127
+ l.onerror = qe, o.abort(), l.result.close();
2128
+ const m = n.deleteDatabase(d);
2129
+ m.onsuccess = m.onerror = j(() => {
2130
+ c(new C.NoSuchDatabase(`Database ${d} doesnt exist`));
2131
+ });
2132
+ } else {
2133
+ o.onerror = Y(c);
2134
+ var f = h.oldVersion > Math.pow(2, 62) ? 0 : h.oldVersion;
2135
+ u = f < 1, t._novip.idbdb = l.result, Mr(t, f / 10, o, c);
2136
+ }
2137
+ }, c), l.onsuccess = j(() => {
2138
+ o = null;
2139
+ const h = t._novip.idbdb = l.result, f = ut(h.objectStoreNames);
2140
+ if (f.length > 0)
2141
+ try {
2142
+ const p = h.transaction((m = f).length === 1 ? m[0] : m, "readonly");
2143
+ e.autoSchema ? function({ _novip: v }, y, g) {
2144
+ v.verno = y.version / 10;
2145
+ const b = v._dbSchema = zt(0, y, g);
2146
+ v._storeNames = ut(y.objectStoreNames, 0), pt(v, [v._allTables], N(b), b);
2147
+ }(t, h, p) : (Ht(t, t._dbSchema, p), function(v, y) {
2148
+ const g = Jn(zt(0, v.idbdb, y), v._dbSchema);
2149
+ return !(g.add.length || g.change.some((b) => b.add.length || b.change.length));
2150
+ }(t, p) || console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Some queries may fail.")), Ut(t, p);
2151
+ } catch {
2152
+ }
2153
+ var m;
2154
+ $e.push(t), h.onversionchange = j((p) => {
2155
+ e.vcFired = !0, t.on("versionchange").fire(p);
2156
+ }), h.onclose = j((p) => {
2157
+ t.on("close").fire(p);
2158
+ }), u && function({ indexedDB: p, IDBKeyRange: v }, y) {
2159
+ !un(p) && y !== yt && an(p, v).put({ name: y }).catch(I);
2160
+ }(t._deps, d), a();
2161
+ }, c);
2162
+ }))]).then(() => (s(), e.onReadyBeingFired = [], S.resolve(Yt(() => t.on.ready.fire(t.vip))).then(function a() {
2163
+ if (e.onReadyBeingFired.length > 0) {
2164
+ let c = e.onReadyBeingFired.reduce(nn, I);
2165
+ return e.onReadyBeingFired = [], S.resolve(Yt(() => c(t.vip))).then(a);
2166
+ }
2167
+ }))).finally(() => {
2168
+ e.onReadyBeingFired = null, e.isBeingOpened = !1;
2169
+ }).then(() => t).catch((a) => {
2170
+ e.dbOpenError = a;
2171
+ try {
2172
+ o && o.abort();
2173
+ } catch {
2174
+ }
2175
+ return r === e.openCanceller && t._close(), D(a);
2176
+ }).finally(() => {
2177
+ e.openComplete = !0, i();
2178
+ });
2179
+ }
2180
+ function Gt(t) {
2181
+ var e = (i) => t.next(i), n = s(e), r = s((i) => t.throw(i));
2182
+ function s(i) {
2183
+ return (o) => {
2184
+ var u = i(o), a = u.value;
2185
+ return u.done ? a : a && typeof a.then == "function" ? a.then(n, r) : M(a) ? Promise.all(a).then(n, r) : n(a);
2186
+ };
2187
+ }
2188
+ return s(e)();
2189
+ }
2190
+ function Vr(t, e, n) {
2191
+ var r = arguments.length;
2192
+ if (r < 2)
2193
+ throw new C.InvalidArgument("Too few arguments");
2194
+ for (var s = new Array(r - 1); --r; )
2195
+ s[r - 1] = arguments[r];
2196
+ return n = s.pop(), [t, On(s), n];
2197
+ }
2198
+ function Zn(t, e, n, r, s) {
2199
+ return S.resolve().then(() => {
2200
+ const i = E.transless || E, o = t._createTransaction(e, n, t._dbSchema, r), u = { trans: o, transless: i };
2201
+ if (r)
2202
+ o.idbtrans = r.idbtrans;
2203
+ else
2204
+ try {
2205
+ o.create(), t._state.PR1398_maxLoop = 3;
2206
+ } catch (l) {
2207
+ return l.name === tn.InvalidState && t.isOpen() && --t._state.PR1398_maxLoop > 0 ? (console.warn("Dexie: Need to reopen db"), t._close(), t.open().then(() => Zn(t, e, n, null, s))) : D(l);
2208
+ }
2209
+ const a = Zt(s);
2210
+ let c;
2211
+ a && Ce();
2212
+ const d = S.follow(() => {
2213
+ if (c = s.call(o, o), c)
2214
+ if (a) {
2215
+ var l = ne.bind(null, null);
2216
+ c.then(l, l);
2217
+ } else
2218
+ typeof c.next == "function" && typeof c.throw == "function" && (c = Gt(c));
2219
+ }, u);
2220
+ return (c && typeof c.then == "function" ? S.resolve(c).then((l) => o.active ? l : D(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"))) : d.then(() => c)).then((l) => (r && o._resolve(), o._completion.then(() => l))).catch((l) => (o._reject(l), D(l)));
2221
+ });
2222
+ }
2223
+ function et(t, e, n) {
2224
+ const r = M(t) ? t.slice() : [t];
2225
+ for (let s = 0; s < n; ++s)
2226
+ r.push(e);
2227
+ return r;
2228
+ }
2229
+ const Wr = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(t) {
2230
+ return { ...t, table(e) {
2231
+ const n = t.table(e), { schema: r } = n, s = {}, i = [];
2232
+ function o(c, d, l) {
2233
+ const h = De(c), f = s[h] = s[h] || [], m = c == null ? 0 : typeof c == "string" ? 1 : c.length, p = d > 0, v = { ...l, isVirtual: p, keyTail: d, keyLength: m, extractKey: Lt(c), unique: !p && l.unique };
2234
+ return f.push(v), v.isPrimaryKey || i.push(v), m > 1 && o(m === 2 ? c[0] : c.slice(0, m - 1), d + 1, l), f.sort((y, g) => y.keyTail - g.keyTail), v;
2235
+ }
2236
+ const u = o(r.primaryKey.keyPath, 0, r.primaryKey);
2237
+ s[":id"] = [u];
2238
+ for (const c of r.indexes)
2239
+ o(c.keyPath, 0, c);
2240
+ function a(c) {
2241
+ const d = c.query.index;
2242
+ return d.isVirtual ? { ...c, query: { index: d, range: (l = c.query.range, h = d.keyTail, { type: l.type === 1 ? 2 : l.type, lower: et(l.lower, l.lowerOpen ? t.MAX_KEY : t.MIN_KEY, h), lowerOpen: !0, upper: et(l.upper, l.upperOpen ? t.MIN_KEY : t.MAX_KEY, h), upperOpen: !0 }) } } : c;
2243
+ var l, h;
2244
+ }
2245
+ return { ...n, schema: { ...r, primaryKey: u, indexes: i, getIndexByKeyPath: function(c) {
2246
+ const d = s[De(c)];
2247
+ return d && d[0];
2248
+ } }, count: (c) => n.count(a(c)), query: (c) => n.query(a(c)), openCursor(c) {
2249
+ const { keyTail: d, isVirtual: l, keyLength: h } = c.query.index;
2250
+ return l ? n.openCursor(a(c)).then((f) => f && function(m) {
2251
+ return Object.create(m, { continue: { value: function(p) {
2252
+ p != null ? m.continue(et(p, c.reverse ? t.MAX_KEY : t.MIN_KEY, d)) : c.unique ? m.continue(m.key.slice(0, h).concat(c.reverse ? t.MIN_KEY : t.MAX_KEY, d)) : m.continue();
2253
+ } }, continuePrimaryKey: { value(p, v) {
2254
+ m.continuePrimaryKey(et(p, t.MAX_KEY, d), v);
2255
+ } }, primaryKey: { get: () => m.primaryKey }, key: { get() {
2256
+ const p = m.key;
2257
+ return h === 1 ? p[0] : p.slice(0, h);
2258
+ } }, value: { get: () => m.value } });
2259
+ }(f)) : n.openCursor(c);
2260
+ } };
2261
+ } };
2262
+ } };
2263
+ function ln(t, e, n, r) {
2264
+ return n = n || {}, r = r || "", N(t).forEach((s) => {
2265
+ if (z(e, s)) {
2266
+ var i = t[s], o = e[s];
2267
+ if (typeof i == "object" && typeof o == "object" && i && o) {
2268
+ const u = Tt(i);
2269
+ u !== Tt(o) ? n[r + s] = e[s] : u === "Object" ? ln(i, o, n, r + s + ".") : i !== o && (n[r + s] = e[s]);
2270
+ } else
2271
+ i !== o && (n[r + s] = e[s]);
2272
+ } else
2273
+ n[r + s] = void 0;
2274
+ }), N(e).forEach((s) => {
2275
+ z(t, s) || (n[r + s] = e[s]);
2276
+ }), n;
2277
+ }
2278
+ const zr = { stack: "dbcore", name: "HooksMiddleware", level: 2, create: (t) => ({ ...t, table(e) {
2279
+ const n = t.table(e), { primaryKey: r } = n.schema;
2280
+ return { ...n, mutate(s) {
2281
+ const i = E.trans, { deleting: o, creating: u, updating: a } = i.table(e).hook;
2282
+ switch (s.type) {
2283
+ case "add":
2284
+ if (u.fire === I)
2285
+ break;
2286
+ return i._promise("readwrite", () => c(s), !0);
2287
+ case "put":
2288
+ if (u.fire === I && a.fire === I)
2289
+ break;
2290
+ return i._promise("readwrite", () => c(s), !0);
2291
+ case "delete":
2292
+ if (o.fire === I)
2293
+ break;
2294
+ return i._promise("readwrite", () => c(s), !0);
2295
+ case "deleteRange":
2296
+ if (o.fire === I)
2297
+ break;
2298
+ return i._promise("readwrite", () => function(l) {
2299
+ return d(l.trans, l.range, 1e4);
2300
+ }(s), !0);
2301
+ }
2302
+ return n.mutate(s);
2303
+ function c(l) {
2304
+ const h = E.trans, f = l.keys || function(m, p) {
2305
+ return p.type === "delete" ? p.keys : p.keys || p.values.map(m.extractKey);
2306
+ }(r, l);
2307
+ if (!f)
2308
+ throw new Error("Keys missing");
2309
+ return (l = l.type === "add" || l.type === "put" ? { ...l, keys: f } : { ...l }).type !== "delete" && (l.values = [...l.values]), l.keys && (l.keys = [...l.keys]), function(m, p, v) {
2310
+ return p.type === "add" ? Promise.resolve([]) : m.getMany({ trans: p.trans, keys: v, cache: "immutable" });
2311
+ }(n, l, f).then((m) => {
2312
+ const p = f.map((v, y) => {
2313
+ const g = m[y], b = { onerror: null, onsuccess: null };
2314
+ if (l.type === "delete")
2315
+ o.fire.call(b, v, g, h);
2316
+ else if (l.type === "add" || g === void 0) {
2317
+ const k = u.fire.call(b, v, l.values[y], h);
2318
+ v == null && k != null && (v = k, l.keys[y] = v, r.outbound || H(l.values[y], r.keyPath, v));
2319
+ } else {
2320
+ const k = ln(g, l.values[y]), P = a.fire.call(b, k, v, g, h);
2321
+ if (P) {
2322
+ const x = l.values[y];
2323
+ Object.keys(P).forEach((w) => {
2324
+ z(x, w) ? x[w] = P[w] : H(x, w, P[w]);
2325
+ });
2326
+ }
2327
+ }
2328
+ return b;
2329
+ });
2330
+ return n.mutate(l).then(({ failures: v, results: y, numFailures: g, lastResult: b }) => {
2331
+ for (let k = 0; k < f.length; ++k) {
2332
+ const P = y ? y[k] : f[k], x = p[k];
2333
+ P == null ? x.onerror && x.onerror(v[k]) : x.onsuccess && x.onsuccess(l.type === "put" && m[k] ? l.values[k] : P);
2334
+ }
2335
+ return { failures: v, results: y, numFailures: g, lastResult: b };
2336
+ }).catch((v) => (p.forEach((y) => y.onerror && y.onerror(v)), Promise.reject(v)));
2337
+ });
2338
+ }
2339
+ function d(l, h, f) {
2340
+ return n.query({ trans: l, values: !1, query: { index: r, range: h }, limit: f }).then(({ result: m }) => c({ type: "delete", keys: m, trans: l }).then((p) => p.numFailures > 0 ? Promise.reject(p.failures[0]) : m.length < f ? { failures: [], numFailures: 0, lastResult: void 0 } : d(l, { ...h, lower: m[m.length - 1], lowerOpen: !0 }, f)));
2341
+ }
2342
+ } };
2343
+ } }) };
2344
+ function er(t, e, n) {
2345
+ try {
2346
+ if (!e || e.keys.length < t.length)
2347
+ return null;
2348
+ const r = [];
2349
+ for (let s = 0, i = 0; s < e.keys.length && i < t.length; ++s)
2350
+ L(e.keys[s], t[i]) === 0 && (r.push(n ? We(e.values[s]) : e.values[s]), ++i);
2351
+ return r.length === t.length ? r : null;
2352
+ } catch {
2353
+ return null;
2354
+ }
2355
+ }
2356
+ const Hr = { stack: "dbcore", level: -1, create: (t) => ({ table: (e) => {
2357
+ const n = t.table(e);
2358
+ return { ...n, getMany: (r) => {
2359
+ if (!r.cache)
2360
+ return n.getMany(r);
2361
+ const s = er(r.keys, r.trans._cache, r.cache === "clone");
2362
+ return s ? S.resolve(s) : n.getMany(r).then((i) => (r.trans._cache = { keys: r.keys, values: r.cache === "clone" ? We(i) : i }, i));
2363
+ }, mutate: (r) => (r.type !== "add" && (r.trans._cache = null), n.mutate(r)) };
2364
+ } }) };
2365
+ function cn(t) {
2366
+ return !("from" in t);
2367
+ }
2368
+ const Q = function(t, e) {
2369
+ if (!this) {
2370
+ const n = new Q();
2371
+ return t && "d" in t && U(n, t), n;
2372
+ }
2373
+ U(this, arguments.length ? { d: 1, from: t, to: arguments.length > 1 ? e : t } : { d: 0 });
2374
+ };
2375
+ function Ve(t, e, n) {
2376
+ const r = L(e, n);
2377
+ if (isNaN(r))
2378
+ return;
2379
+ if (r > 0)
2380
+ throw RangeError();
2381
+ if (cn(t))
2382
+ return U(t, { from: e, to: n, d: 1 });
2383
+ const s = t.l, i = t.r;
2384
+ if (L(n, t.from) < 0)
2385
+ return s ? Ve(s, e, n) : t.l = { from: e, to: n, d: 1, l: null, r: null }, xn(t);
2386
+ if (L(e, t.to) > 0)
2387
+ return i ? Ve(i, e, n) : t.r = { from: e, to: n, d: 1, l: null, r: null }, xn(t);
2388
+ L(e, t.from) < 0 && (t.from = e, t.l = null, t.d = i ? i.d + 1 : 1), L(n, t.to) > 0 && (t.to = n, t.r = null, t.d = t.l ? t.l.d + 1 : 1);
2389
+ const o = !t.r;
2390
+ s && !t.l && mt(t, s), i && o && mt(t, i);
2391
+ }
2392
+ function mt(t, e) {
2393
+ cn(e) || function n(r, { from: s, to: i, l: o, r: u }) {
2394
+ Ve(r, s, i), o && n(r, o), u && n(r, u);
2395
+ }(t, e);
2396
+ }
2397
+ function Yr(t, e) {
2398
+ const n = Xt(e);
2399
+ let r = n.next();
2400
+ if (r.done)
2401
+ return !1;
2402
+ let s = r.value;
2403
+ const i = Xt(t);
2404
+ let o = i.next(s.from), u = o.value;
2405
+ for (; !r.done && !o.done; ) {
2406
+ if (L(u.from, s.to) <= 0 && L(u.to, s.from) >= 0)
2407
+ return !0;
2408
+ L(s.from, u.from) < 0 ? s = (r = n.next(u.from)).value : u = (o = i.next(s.from)).value;
2409
+ }
2410
+ return !1;
2411
+ }
2412
+ function Xt(t) {
2413
+ let e = cn(t) ? null : { s: 0, n: t };
2414
+ return { next(n) {
2415
+ const r = arguments.length > 0;
2416
+ for (; e; )
2417
+ switch (e.s) {
2418
+ case 0:
2419
+ if (e.s = 1, r)
2420
+ for (; e.n.l && L(n, e.n.from) < 0; )
2421
+ e = { up: e, n: e.n.l, s: 1 };
2422
+ else
2423
+ for (; e.n.l; )
2424
+ e = { up: e, n: e.n.l, s: 1 };
2425
+ case 1:
2426
+ if (e.s = 2, !r || L(n, e.n.to) <= 0)
2427
+ return { value: e.n, done: !1 };
2428
+ case 2:
2429
+ if (e.n.r) {
2430
+ e.s = 3, e = { up: e, n: e.n.r, s: 0 };
2431
+ continue;
2432
+ }
2433
+ case 3:
2434
+ e = e.up;
2435
+ }
2436
+ return { done: !0 };
2437
+ } };
2438
+ }
2439
+ function xn(t) {
2440
+ var e, n;
2441
+ const r = (((e = t.r) === null || e === void 0 ? void 0 : e.d) || 0) - (((n = t.l) === null || n === void 0 ? void 0 : n.d) || 0), s = r > 1 ? "r" : r < -1 ? "l" : "";
2442
+ if (s) {
2443
+ const i = s === "r" ? "l" : "r", o = { ...t }, u = t[s];
2444
+ t.from = u.from, t.to = u.to, t[s] = u[s], o[s] = u[i], t[i] = o, o.d = Sn(o);
2445
+ }
2446
+ t.d = Sn(t);
2447
+ }
2448
+ function Sn({ r: t, l: e }) {
2449
+ return (t ? e ? Math.max(t.d, e.d) : t.d : e ? e.d : 0) + 1;
2450
+ }
2451
+ Pe(Q.prototype, { add(t) {
2452
+ return mt(this, t), this;
2453
+ }, addKey(t) {
2454
+ return Ve(this, t, t), this;
2455
+ }, addKeys(t) {
2456
+ return t.forEach((e) => Ve(this, e, e)), this;
2457
+ }, [At]() {
2458
+ return Xt(this);
2459
+ } });
2460
+ const Gr = { stack: "dbcore", level: 0, create: (t) => {
2461
+ const e = t.schema.name, n = new Q(t.MIN_KEY, t.MAX_KEY);
2462
+ return { ...t, table: (r) => {
2463
+ const s = t.table(r), { schema: i } = s, { primaryKey: o } = i, { extractKey: u, outbound: a } = o, c = { ...s, mutate: (h) => {
2464
+ const f = h.trans, m = f.mutatedParts || (f.mutatedParts = {}), p = (x) => {
2465
+ const w = `idb://${e}/${r}/${x}`;
2466
+ return m[w] || (m[w] = new Q());
2467
+ }, v = p(""), y = p(":dels"), { type: g } = h;
2468
+ let [b, k] = h.type === "deleteRange" ? [h.range] : h.type === "delete" ? [h.keys] : h.values.length < 50 ? [[], h.values] : [];
2469
+ const P = h.trans._cache;
2470
+ return s.mutate(h).then((x) => {
2471
+ if (M(b)) {
2472
+ g !== "delete" && (b = x.results), v.addKeys(b);
2473
+ const w = er(b, P);
2474
+ w || g === "add" || y.addKeys(b), (w || k) && function(A, _, R, O) {
2475
+ function q(B) {
2476
+ const $ = A(B.name || "");
2477
+ function ye(V) {
2478
+ return V != null ? B.extractKey(V) : null;
2479
+ }
2480
+ const ve = (V) => B.multiEntry && M(V) ? V.forEach((le) => $.addKey(le)) : $.addKey(V);
2481
+ (R || O).forEach((V, le) => {
2482
+ const Ae = R && ye(R[le]), vt = O && ye(O[le]);
2483
+ L(Ae, vt) !== 0 && (Ae != null && ve(Ae), vt != null && ve(vt));
2484
+ });
2485
+ }
2486
+ _.indexes.forEach(q);
2487
+ }(p, i, w, k);
2488
+ } else if (b) {
2489
+ const w = { from: b.lower, to: b.upper };
2490
+ y.add(w), v.add(w);
2491
+ } else
2492
+ v.add(n), y.add(n), i.indexes.forEach((w) => p(w.name).add(n));
2493
+ return x;
2494
+ });
2495
+ } }, d = ({ query: { index: h, range: f } }) => {
2496
+ var m, p;
2497
+ return [h, new Q((m = f.lower) !== null && m !== void 0 ? m : t.MIN_KEY, (p = f.upper) !== null && p !== void 0 ? p : t.MAX_KEY)];
2498
+ }, l = { get: (h) => [o, new Q(h.key)], getMany: (h) => [o, new Q().addKeys(h.keys)], count: d, query: d, openCursor: d };
2499
+ return N(l).forEach((h) => {
2500
+ c[h] = function(f) {
2501
+ const { subscr: m } = E;
2502
+ if (m) {
2503
+ const p = (k) => {
2504
+ const P = `idb://${e}/${r}/${k}`;
2505
+ return m[P] || (m[P] = new Q());
2506
+ }, v = p(""), y = p(":dels"), [g, b] = l[h](f);
2507
+ if (p(g.name || "").add(b), !g.isPrimaryKey) {
2508
+ if (h !== "count") {
2509
+ const k = h === "query" && a && f.values && s.query({ ...f, values: !1 });
2510
+ return s[h].apply(this, arguments).then((P) => {
2511
+ if (h === "query") {
2512
+ if (a && f.values)
2513
+ return k.then(({ result: w }) => (v.addKeys(w), P));
2514
+ const x = f.values ? P.result.map(u) : P.result;
2515
+ f.values ? v.addKeys(x) : y.addKeys(x);
2516
+ } else if (h === "openCursor") {
2517
+ const x = P, w = f.values;
2518
+ return x && Object.create(x, { key: { get: () => (y.addKey(x.primaryKey), x.key) }, primaryKey: { get() {
2519
+ const A = x.primaryKey;
2520
+ return y.addKey(A), A;
2521
+ } }, value: { get: () => (w && v.addKey(x.primaryKey), x.value) } });
2522
+ }
2523
+ return P;
2524
+ });
2525
+ }
2526
+ y.add(n);
2527
+ }
2528
+ }
2529
+ return s[h].apply(this, arguments);
2530
+ };
2531
+ }), c;
2532
+ } };
2533
+ } };
2534
+ class pe {
2535
+ constructor(e, n) {
2536
+ this._middlewares = {}, this.verno = 0;
2537
+ const r = pe.dependencies;
2538
+ this._options = n = { addons: pe.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, ...n }, this._deps = { indexedDB: n.indexedDB, IDBKeyRange: n.IDBKeyRange };
2539
+ const { addons: s } = n;
2540
+ this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
2541
+ const i = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: I, dbReadyPromise: null, cancelOpen: I, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3 };
2542
+ var o;
2543
+ i.dbReadyPromise = new S((u) => {
2544
+ i.dbReadyResolve = u;
2545
+ }), i.openCanceller = new S((u, a) => {
2546
+ i.cancelOpen = a;
2547
+ }), this._state = i, this.name = e, this.on = Ne(this, "populate", "blocked", "versionchange", "close", { ready: [nn, I] }), this.on.ready.subscribe = En(this.on.ready.subscribe, (u) => (a, c) => {
2548
+ pe.vip(() => {
2549
+ const d = this._state;
2550
+ if (d.openComplete)
2551
+ d.dbOpenError || S.resolve().then(a), c && u(a);
2552
+ else if (d.onReadyBeingFired)
2553
+ d.onReadyBeingFired.push(a), c && u(a);
2554
+ else {
2555
+ u(a);
2556
+ const l = this;
2557
+ c || u(function h() {
2558
+ l.on.ready.unsubscribe(a), l.on.ready.unsubscribe(h);
2559
+ });
2560
+ }
2561
+ });
2562
+ }), this.Collection = (o = this, Oe(Kr.prototype, function(u, a) {
2563
+ this.db = o;
2564
+ let c = Hn, d = null;
2565
+ if (a)
2566
+ try {
2567
+ c = a();
2568
+ } catch (m) {
2569
+ d = m;
2570
+ }
2571
+ const l = u._ctx, h = l.table, f = h.hook.reading.fire;
2572
+ this._ctx = { table: h, index: l.index, isPrimKey: !l.index || h.schema.primKey.keyPath && l.index === h.schema.primKey.name, range: c, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: d, or: l.or, valueMapper: f !== Fe ? f : null };
2573
+ })), this.Table = function(u) {
2574
+ return Oe(Ir.prototype, function(a, c, d) {
2575
+ this.db = u, this._tx = d, this.name = a, this.schema = c, this.hook = u._allTables[a] ? u._allTables[a].hook : Ne(null, { creating: [br, I], reading: [vr, Fe], updating: [_r, I], deleting: [wr, I] });
2576
+ });
2577
+ }(this), this.Transaction = function(u) {
2578
+ return Oe(Nr.prototype, function(a, c, d, l, h) {
2579
+ this.db = u, this.mode = a, this.storeNames = c, this.schema = d, this.chromeTransactionDurability = l, this.idbtrans = null, this.on = Ne(this, "complete", "error", "abort"), this.parent = h || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new S((f, m) => {
2580
+ this._resolve = f, this._reject = m;
2581
+ }), this._completion.then(() => {
2582
+ this.active = !1, this.on.complete.fire();
2583
+ }, (f) => {
2584
+ var m = this.active;
2585
+ return this.active = !1, this.on.error.fire(f), this.parent ? this.parent._reject(f) : m && this.idbtrans && this.idbtrans.abort(), D(f);
2586
+ });
2587
+ });
2588
+ }(this), this.Version = function(u) {
2589
+ return Oe(qr.prototype, function(a) {
2590
+ this.db = u, this._cfg = { version: a, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
2591
+ });
2592
+ }(this), this.WhereClause = function(u) {
2593
+ return Oe(Gn.prototype, function(a, c, d) {
2594
+ this.db = u, this._ctx = { table: a, index: c === ":id" ? null : c, or: d };
2595
+ const l = u._deps.indexedDB;
2596
+ if (!l)
2597
+ throw new C.MissingAPI();
2598
+ this._cmp = this._ascending = l.cmp.bind(l), this._descending = (h, f) => l.cmp(f, h), this._max = (h, f) => l.cmp(h, f) > 0 ? h : f, this._min = (h, f) => l.cmp(h, f) < 0 ? h : f, this._IDBKeyRange = u._deps.IDBKeyRange;
2599
+ });
2600
+ }(this), this.on("versionchange", (u) => {
2601
+ u.newVersion > 0 ? console.warn(`Another connection wants to upgrade database '${this.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${this.name}'. Closing db now to resume the delete request.`), this.close();
2602
+ }), this.on("blocked", (u) => {
2603
+ !u.newVersion || u.newVersion < u.oldVersion ? console.warn(`Dexie.delete('${this.name}') was blocked`) : console.warn(`Upgrade '${this.name}' blocked by other connection holding version ${u.oldVersion / 10}`);
2604
+ }), this._maxKey = Ue(n.IDBKeyRange), this._createTransaction = (u, a, c, d) => new this.Transaction(u, a, c, this._options.chromeTransactionDurability, d), this._fireOnBlocked = (u) => {
2605
+ this.on("blocked").fire(u), $e.filter((a) => a.name === this.name && a !== this && !a._state.vcFired).map((a) => a.on("versionchange").fire(u));
2606
+ }, this.use(Wr), this.use(zr), this.use(Gr), this.use(Hr), this.vip = Object.create(this, { _vip: { value: !0 } }), s.forEach((u) => u(this));
2607
+ }
2608
+ version(e) {
2609
+ if (isNaN(e) || e < 0.1)
2610
+ throw new C.Type("Given version is not a positive number");
2611
+ if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened)
2612
+ throw new C.Schema("Cannot add version when database is open");
2613
+ this.verno = Math.max(this.verno, e);
2614
+ const n = this._versions;
2615
+ var r = n.filter((s) => s._cfg.version === e)[0];
2616
+ return r || (r = new this.Version(e), n.push(r), n.sort(Fr), r.stores({}), this._state.autoSchema = !1, r);
2617
+ }
2618
+ _whenReady(e) {
2619
+ return this.idbdb && (this._state.openComplete || E.letThrough || this._vip) ? e() : new S((n, r) => {
2620
+ if (this._state.openComplete)
2621
+ return r(new C.DatabaseClosed(this._state.dbOpenError));
2622
+ if (!this._state.isBeingOpened) {
2623
+ if (!this._options.autoOpen)
2624
+ return void r(new C.DatabaseClosed());
2625
+ this.open().catch(I);
2626
+ }
2627
+ this._state.dbReadyPromise.then(n, r);
2628
+ }).then(e);
2629
+ }
2630
+ use({ stack: e, create: n, level: r, name: s }) {
2631
+ s && this.unuse({ stack: e, name: s });
2632
+ const i = this._middlewares[e] || (this._middlewares[e] = []);
2633
+ return i.push({ stack: e, create: n, level: r ?? 10, name: s }), i.sort((o, u) => o.level - u.level), this;
2634
+ }
2635
+ unuse({ stack: e, name: n, create: r }) {
2636
+ return e && this._middlewares[e] && (this._middlewares[e] = this._middlewares[e].filter((s) => r ? s.create !== r : !!n && s.name !== n)), this;
2637
+ }
2638
+ open() {
2639
+ return Ur(this);
2640
+ }
2641
+ _close() {
2642
+ const e = this._state, n = $e.indexOf(this);
2643
+ if (n >= 0 && $e.splice(n, 1), this.idbdb) {
2644
+ try {
2645
+ this.idbdb.close();
2646
+ } catch {
2647
+ }
2648
+ this._novip.idbdb = null;
2649
+ }
2650
+ e.dbReadyPromise = new S((r) => {
2651
+ e.dbReadyResolve = r;
2652
+ }), e.openCanceller = new S((r, s) => {
2653
+ e.cancelOpen = s;
2654
+ });
2655
+ }
2656
+ close() {
2657
+ this._close();
2658
+ const e = this._state;
2659
+ this._options.autoOpen = !1, e.dbOpenError = new C.DatabaseClosed(), e.isBeingOpened && e.cancelOpen(e.dbOpenError);
2660
+ }
2661
+ delete() {
2662
+ const e = arguments.length > 0, n = this._state;
2663
+ return new S((r, s) => {
2664
+ const i = () => {
2665
+ this.close();
2666
+ var o = this._deps.indexedDB.deleteDatabase(this.name);
2667
+ o.onsuccess = j(() => {
2668
+ (function({ indexedDB: u, IDBKeyRange: a }, c) {
2669
+ !un(u) && c !== yt && an(u, a).delete(c).catch(I);
2670
+ })(this._deps, this.name), r();
2671
+ }), o.onerror = Y(s), o.onblocked = this._fireOnBlocked;
2672
+ };
2673
+ if (e)
2674
+ throw new C.InvalidArgument("Arguments not allowed in db.delete()");
2675
+ n.isBeingOpened ? n.dbReadyPromise.then(i) : i();
2676
+ });
2677
+ }
2678
+ backendDB() {
2679
+ return this.idbdb;
2680
+ }
2681
+ isOpen() {
2682
+ return this.idbdb !== null;
2683
+ }
2684
+ hasBeenClosed() {
2685
+ const e = this._state.dbOpenError;
2686
+ return e && e.name === "DatabaseClosed";
2687
+ }
2688
+ hasFailed() {
2689
+ return this._state.dbOpenError !== null;
2690
+ }
2691
+ dynamicallyOpened() {
2692
+ return this._state.autoSchema;
2693
+ }
2694
+ get tables() {
2695
+ return N(this._allTables).map((e) => this._allTables[e]);
2696
+ }
2697
+ transaction() {
2698
+ const e = Vr.apply(this, arguments);
2699
+ return this._transaction.apply(this, e);
2700
+ }
2701
+ _transaction(e, n, r) {
2702
+ let s = E.trans;
2703
+ s && s.db === this && e.indexOf("!") === -1 || (s = null);
2704
+ const i = e.indexOf("?") !== -1;
2705
+ let o, u;
2706
+ e = e.replace("!", "").replace("?", "");
2707
+ try {
2708
+ if (u = n.map((c) => {
2709
+ var d = c instanceof this.Table ? c.name : c;
2710
+ if (typeof d != "string")
2711
+ throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
2712
+ return d;
2713
+ }), e == "r" || e === wt)
2714
+ o = wt;
2715
+ else {
2716
+ if (e != "rw" && e != _t)
2717
+ throw new C.InvalidArgument("Invalid transaction mode: " + e);
2718
+ o = _t;
2719
+ }
2720
+ if (s) {
2721
+ if (s.mode === wt && o === _t) {
2722
+ if (!i)
2723
+ throw new C.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
2724
+ s = null;
2725
+ }
2726
+ s && u.forEach((c) => {
2727
+ if (s && s.storeNames.indexOf(c) === -1) {
2728
+ if (!i)
2729
+ throw new C.SubTransaction("Table " + c + " not included in parent transaction.");
2730
+ s = null;
2731
+ }
2732
+ }), i && s && !s.active && (s = null);
2733
+ }
2734
+ } catch (c) {
2735
+ return s ? s._promise(null, (d, l) => {
2736
+ l(c);
2737
+ }) : D(c);
2738
+ }
2739
+ const a = Zn.bind(null, this, o, u, s, r);
2740
+ return s ? s._promise(o, a, "lock") : E.trans ? Te(E.transless, () => this._whenReady(a)) : this._whenReady(a);
2741
+ }
2742
+ table(e) {
2743
+ if (!z(this._allTables, e))
2744
+ throw new C.InvalidTable(`Table ${e} does not exist`);
2745
+ return this._allTables[e];
2746
+ }
2747
+ }
2748
+ const Xr = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable";
2749
+ class Qr {
2750
+ constructor(e) {
2751
+ this._subscribe = e;
2752
+ }
2753
+ subscribe(e, n, r) {
2754
+ return this._subscribe(e && typeof e != "function" ? e : { next: e, error: n, complete: r });
2755
+ }
2756
+ [Xr]() {
2757
+ return this;
2758
+ }
2759
+ }
2760
+ function tr(t, e) {
2761
+ return N(e).forEach((n) => {
2762
+ mt(t[n] || (t[n] = new Q()), e[n]);
2763
+ }), t;
2764
+ }
2765
+ function Jr(t) {
2766
+ let e, n = !1;
2767
+ const r = new Qr((s) => {
2768
+ const i = Zt(t);
2769
+ let o = !1, u = {}, a = {};
2770
+ const c = { get closed() {
2771
+ return o;
2772
+ }, unsubscribe: () => {
2773
+ o = !0, ue.storagemutated.unsubscribe(f);
2774
+ } };
2775
+ s.start && s.start(c);
2776
+ let d = !1, l = !1;
2777
+ function h() {
2778
+ return N(a).some((p) => u[p] && Yr(u[p], a[p]));
2779
+ }
2780
+ const f = (p) => {
2781
+ tr(u, p), h() && m();
2782
+ }, m = () => {
2783
+ if (d || o)
2784
+ return;
2785
+ u = {};
2786
+ const p = {}, v = function(y) {
2787
+ i && Ce();
2788
+ const g = () => oe(t, { subscr: y, trans: null }), b = E.trans ? Te(E.transless, g) : g();
2789
+ return i && b.then(ne, ne), b;
2790
+ }(p);
2791
+ l || (ue(Le, f), l = !0), d = !0, Promise.resolve(v).then((y) => {
2792
+ n = !0, e = y, d = !1, o || (h() ? m() : (u = {}, a = p, s.next && s.next(y)));
2793
+ }, (y) => {
2794
+ d = !1, n = !1, s.error && s.error(y), c.unsubscribe();
2795
+ });
2796
+ };
2797
+ return m(), c;
2798
+ });
2799
+ return r.hasValue = () => n, r.getValue = () => e, r;
2800
+ }
2801
+ let Qt;
2802
+ try {
2803
+ Qt = { indexedDB: K.indexedDB || K.mozIndexedDB || K.webkitIndexedDB || K.msIndexedDB, IDBKeyRange: K.IDBKeyRange || K.webkitIDBKeyRange };
2804
+ } catch {
2805
+ Qt = { indexedDB: null, IDBKeyRange: null };
2806
+ }
2807
+ const ce = pe;
2808
+ function at(t) {
2809
+ let e = Z;
2810
+ try {
2811
+ Z = !0, ue.storagemutated.fire(t);
2812
+ } finally {
2813
+ Z = e;
2814
+ }
2815
+ }
2816
+ Pe(ce, { ...tt, delete: (t) => new ce(t, { addons: [] }).delete(), exists: (t) => new ce(t, { addons: [] }).open().then((e) => (e.close(), !0)).catch("NoSuchDatabaseError", () => !1), getDatabaseNames(t) {
2817
+ try {
2818
+ return function({ indexedDB: e, IDBKeyRange: n }) {
2819
+ return un(e) ? Promise.resolve(e.databases()).then((r) => r.map((s) => s.name).filter((s) => s !== yt)) : an(e, n).toCollection().primaryKeys();
2820
+ }(ce.dependencies).then(t);
2821
+ } catch {
2822
+ return D(new C.MissingAPI());
2823
+ }
2824
+ }, defineClass: () => function(t) {
2825
+ U(this, t);
2826
+ }, ignoreTransaction: (t) => E.trans ? Te(E.transless, t) : t(), vip: Yt, async: function(t) {
2827
+ return function() {
2828
+ try {
2829
+ var e = Gt(t.apply(this, arguments));
2830
+ return e && typeof e.then == "function" ? e : S.resolve(e);
2831
+ } catch (n) {
2832
+ return D(n);
2833
+ }
2834
+ };
2835
+ }, spawn: function(t, e, n) {
2836
+ try {
2837
+ var r = Gt(t.apply(n, e || []));
2838
+ return r && typeof r.then == "function" ? r : S.resolve(r);
2839
+ } catch (s) {
2840
+ return D(s);
2841
+ }
2842
+ }, currentTransaction: { get: () => E.trans || null }, waitFor: function(t, e) {
2843
+ const n = S.resolve(typeof t == "function" ? ce.ignoreTransaction(t) : t).timeout(e || 6e4);
2844
+ return E.trans ? E.trans.waitFor(n) : n;
2845
+ }, Promise: S, debug: { get: () => G, set: (t) => {
2846
+ Kn(t, t === "dexie" ? () => !0 : zn);
2847
+ } }, derive: ke, extend: U, props: Pe, override: En, Events: Ne, on: ue, liveQuery: Jr, extendObservabilitySet: tr, getByKeyPath: te, setByKeyPath: H, delByKeyPath: function(t, e) {
2848
+ typeof e == "string" ? H(t, e, void 0) : "length" in e && [].map.call(e, function(n) {
2849
+ H(t, n, void 0);
2850
+ });
2851
+ }, shallowClone: An, deepClone: We, getObjectDiff: ln, cmp: L, asap: Cn, minKey: Mt, addons: [], connections: $e, errnames: tn, dependencies: Qt, semVer: yn, version: yn.split(".").map((t) => parseInt(t)).reduce((t, e, n) => t + e / Math.pow(10, 2 * n)) }), ce.maxKey = Ue(ce.dependencies.IDBKeyRange), typeof dispatchEvent < "u" && typeof addEventListener < "u" && (ue(Le, (t) => {
2852
+ if (!Z) {
2853
+ let e;
2854
+ gt ? (e = document.createEvent("CustomEvent"), e.initCustomEvent(ie, !0, !0, t)) : e = new CustomEvent(ie, { detail: t }), Z = !0, dispatchEvent(e), Z = !1;
2855
+ }
2856
+ }), addEventListener(ie, ({ detail: t }) => {
2857
+ Z || at(t);
2858
+ }));
2859
+ let Z = !1;
2860
+ if (typeof BroadcastChannel < "u") {
2861
+ const t = new BroadcastChannel(ie);
2862
+ typeof t.unref == "function" && t.unref(), ue(Le, (e) => {
2863
+ Z || t.postMessage(e);
2864
+ }), t.onmessage = (e) => {
2865
+ e.data && at(e.data);
2866
+ };
2867
+ } else if (typeof self < "u" && typeof navigator < "u") {
2868
+ ue(Le, (e) => {
2869
+ try {
2870
+ Z || (typeof localStorage < "u" && localStorage.setItem(ie, JSON.stringify({ trig: Math.random(), changedParts: e })), typeof self.clients == "object" && [...self.clients.matchAll({ includeUncontrolled: !0 })].forEach((n) => n.postMessage({ type: ie, changedParts: e })));
2871
+ } catch {
2872
+ }
2873
+ }), typeof addEventListener < "u" && addEventListener("storage", (e) => {
2874
+ if (e.key === ie) {
2875
+ const n = JSON.parse(e.newValue);
2876
+ n && at(n.changedParts);
2877
+ }
2878
+ });
2879
+ const t = self.document && navigator.serviceWorker;
2880
+ t && t.addEventListener("message", function({ data: e }) {
2881
+ e && e.type === ie && at(e.changedParts);
2882
+ });
2883
+ }
2884
+ S.rejectionMapper = function(t, e) {
2885
+ if (!t || t instanceof xe || t instanceof TypeError || t instanceof SyntaxError || !t.name || !fn[t.name])
2886
+ return t;
2887
+ var n = new fn[t.name](e || t.message, t);
2888
+ return "stack" in t && ee(n, "stack", { get: function() {
2889
+ return this.inner.stack;
2890
+ } }), n;
2891
+ }, Kn(G, zn);
2892
+ class Zr extends pe {
2893
+ constructor() {
2894
+ super("NylasAuthDatabase"), Et(this, "grant"), Et(this, "pkce"), this.version(1).stores({
2895
+ grant: "++id,token",
2896
+ pkce: "++id,codeVerifier"
2897
+ }), this.grant = this.table("grant"), this.pkce = this.table("pkce");
2898
+ }
2899
+ }
2900
+ class es {
2901
+ constructor() {
2902
+ Et(this, "theDB"), this.theDB = new Zr();
2903
+ }
2904
+ async setCodeVerifier(e) {
2905
+ await this.theDB.pkce.put({ id: 1, codeVerifier: e }, 1);
2906
+ }
2907
+ async getCodeVerifier() {
2908
+ const [e] = await this.theDB.pkce.toArray();
2909
+ return e ? e.codeVerifier : null;
2910
+ }
2911
+ async getTokenInfo() {
2912
+ const e = await this.theDB.grant.get(1);
2913
+ return e ? e.token : null;
2914
+ }
2915
+ async setTokenInfo(e) {
2916
+ await this.theDB.grant.put({ id: 1, token: e }, 1);
2917
+ }
2918
+ async reset() {
2919
+ await this.theDB.grant.clear();
2920
+ }
2921
+ }
2922
+ function ss(t) {
2923
+ const e = "NylasAuth";
2924
+ if (!t)
2925
+ throw new Error("NylasAuth requires a config object");
2926
+ let n = null;
2927
+ if (t.storageType === "indexeddb" && (n = new es()), !n)
2928
+ throw new Error("NylasAuth requires a storage object");
2929
+ const r = [
2930
+ {
2931
+ type: "read-only",
2932
+ value: "https://www.googleapis.com/auth/gmail.readonly"
2933
+ },
2934
+ {
2935
+ type: "modify",
2936
+ value: "https://www.googleapis.com/auth/gmail.modify"
2937
+ },
2938
+ {
2939
+ type: "compose",
2940
+ value: "https://www.googleapis.com/auth/gmail.compose"
2941
+ },
2942
+ {
2943
+ type: "insert",
2944
+ value: "https://www.googleapis.com/auth/gmail.insert"
2945
+ },
2946
+ {
2947
+ type: "labels",
2948
+ value: "https://www.googleapis.com/auth/gmail.labels"
2949
+ },
2950
+ {
2951
+ type: "metadata",
2952
+ value: "https://www.googleapis.com/auth/gmail.metadata"
2953
+ },
2954
+ {
2955
+ type: "settings.basic",
2956
+ value: "https://www.googleapis.com/auth/gmail.settings.basic"
2957
+ },
2958
+ {
2959
+ type: "settings.sharing",
2960
+ value: "https://www.googleapis.com/auth/gmail.settings.sharing"
2961
+ }
2962
+ ], s = [
2963
+ {
2964
+ type: "read-only",
2965
+ value: "https://outlook.office.com/mail.read"
2966
+ },
2967
+ {
2968
+ type: "modify",
2969
+ value: "https://outlook.office.com/mail.readwrite"
2970
+ },
2971
+ {
2972
+ type: "send",
2973
+ value: "https://outlook.office.com/mail.send"
2974
+ },
2975
+ {
2976
+ type: "offline",
2977
+ value: "offline_access"
2978
+ }
2979
+ ];
2980
+ async function i(o, u, a, c = !0, d, l) {
2981
+ const h = await (n == null ? void 0 : n.getTokenInfo()), f = new URL(o, d ?? t.apiUri), m = new Headers();
2982
+ m.append("Accept", "application/json"), m.append("Content-Type", "application/json"), m.append("User-Agent", e), h && m.append("Authorization", `Bearer ${h.access_token}`);
2983
+ const p = await fetch(f.toString(), {
2984
+ method: u || "GET",
2985
+ headers: m,
2986
+ mode: "cors",
2987
+ referrer: location.origin,
2988
+ body: a ? JSON.stringify(a) : void 0,
2989
+ ...l || {}
2990
+ });
2991
+ return c ? await p.json() : p.body;
2992
+ }
2993
+ return {
2994
+ config: t,
2995
+ /**
2996
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
2997
+ * @param scopes The scopes that were used to generate the authorization code
2998
+ * @param email The email that was used to generate the authorization code
2999
+ * @param provider The provider that was used to generate the authorization code
3000
+ * @returns A promise that resolves to a URL string that can be used to redirect the user to the Nylas API to complete the authorization flow
3001
+ */
3002
+ async getHostedAuthRedirectURL(o = t.defaultScopes, u, a) {
3003
+ const c = await dn(Math.random().toString()), d = await dn(c);
3004
+ await (n == null ? void 0 : n.setCodeVerifier(c));
3005
+ const l = new URL(`${t.apiUri}/v3/connect/auth`);
3006
+ return l.searchParams.set("client_id", t.clientId), l.searchParams.set("response_type", "code"), l.searchParams.set("scope", o.join(" ")), l.searchParams.set("redirect_uri", t.redirectURI), l.searchParams.set("access_type", "offline"), l.searchParams.set("code_challenge", d), l.searchParams.set("code_challenge_method", "S256"), l.searchParams.set("options", "rotate_refresh_token"), a && l.searchParams.set("provider", a), u && l.searchParams.set("login_hint", u), l.toString();
3007
+ },
3008
+ /**
3009
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3010
+ * @param path A path to the Nylas API, e.g. `/v3/grants/methreads`
3011
+ * @param method GET, POST, PUT, DELETE, etc.
3012
+ * @param body A JSON object to send as the body of the request
3013
+ * @param domain The domain to use for the request, e.g. `api.us.nylas.com`
3014
+ * @param parseJSON Whether to parse the response as JSON or return the raw response (default: true)
3015
+ * @returns
3016
+ */
3017
+ nylasAPIRequest: i,
3018
+ /**
3019
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3020
+ * @param code The authorization code that was returned from the Nylas API
3021
+ * @returns A promise that resolves to a TokenExchangeResponse object
3022
+ */
3023
+ async exchangeAuthCodeForTokenInfo(o) {
3024
+ if (!o)
3025
+ return null;
3026
+ const u = await (n == null ? void 0 : n.getCodeVerifier()), a = await this.nylasAPIRequest("/v3/connect/token", "POST", {
3027
+ code: o,
3028
+ client_id: t.clientId,
3029
+ grant_type: "authorization_code",
3030
+ redirect_uri: t.redirectURI,
3031
+ code_verifier: u
3032
+ });
3033
+ return "error" in a || await (n == null ? void 0 : n.setTokenInfo(a)), a;
3034
+ },
3035
+ /**
3036
+ * This method will make a `application/octet-stream` request to the Nylas API to download a file.
3037
+ */
3038
+ async nylasDownloadFileRequest(o, u = "GET", a) {
3039
+ const c = await (n == null ? void 0 : n.getTokenInfo()), d = new URL(o, t.apiUri), l = new Headers();
3040
+ return l.append("Accept", "application/json"), l.append("Content-Type", "application/octet-stream"), l.append("User-Agent", e), c && l.append("Authorization", `Bearer ${c.access_token}`), (await fetch(d.toString(), {
3041
+ method: u,
3042
+ headers: l,
3043
+ mode: "cors",
3044
+ referrer: location.origin,
3045
+ body: a ? JSON.stringify(a) : void 0
3046
+ })).blob();
3047
+ },
3048
+ /**
3049
+ * This methid will clear the access token from the storage object
3050
+ */
3051
+ async logout() {
3052
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3053
+ o && await this.nylasAPIRequest(`/v3/connect/revoke?token=${o.access_token}`, "POST"), await (n == null ? void 0 : n.reset());
3054
+ },
3055
+ /**
3056
+ * This method will make a request to the Nylas API to exchange an authorization code for an access token.
3057
+ * @returns A promise that resolves to a boolean indicating whether the user is authenticated
3058
+ */
3059
+ async isAuthenticated() {
3060
+ return !!await (n == null ? void 0 : n.getTokenInfo());
3061
+ },
3062
+ /**
3063
+ * This method will return information about the current access token.
3064
+ * @returns A promise with the token info
3065
+ */
3066
+ async getTokenInfo() {
3067
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3068
+ if (!o)
3069
+ return null;
3070
+ const { access_token: u, ...a } = o;
3071
+ return a;
3072
+ },
3073
+ /**
3074
+ * This method will make a request to the Nylas API to validate if the current access token is valid.
3075
+ * @returns A promise that resolves to a boolean indicating whether the current access token is valid
3076
+ */
3077
+ async isAccessTokenValid() {
3078
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3079
+ return o ? "data" in await this.nylasAPIRequest(`/v3/connect/tokeninfo?id_token=${o.id_token}`, "GET") : !1;
3080
+ },
3081
+ /**
3082
+ * This method will make a request to the Nylas API to refresh the current access token.
3083
+ * @returns A promise that resolves to a TokenExchangeResponse object
3084
+ */
3085
+ async refreshAccessToken() {
3086
+ const o = await (n == null ? void 0 : n.getTokenInfo());
3087
+ if (!o)
3088
+ return null;
3089
+ const u = await this.nylasAPIRequest("/v3/connect/token", "POST", {
3090
+ client_id: t.clientId,
3091
+ grant_type: "refresh_token",
3092
+ refresh_token: o.refresh_token
3093
+ });
3094
+ return "error" in u || await (n == null ? void 0 : n.setTokenInfo(u)), u;
3095
+ },
3096
+ /**
3097
+ * This method will return true if the current access token has the given scope
3098
+ * based on the type of scope (e.g. 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing')
3099
+ * @param type Either 'read-only', 'modify', 'compose', 'insert', 'labels', 'metadata', 'settings.basic', or 'settings.sharing'
3100
+ */
3101
+ async hasScopeByType(o = "email", u) {
3102
+ const a = await (n == null ? void 0 : n.getTokenInfo());
3103
+ if (!a)
3104
+ return !1;
3105
+ const c = a.scope.toLowerCase().split(" ");
3106
+ let d = [];
3107
+ const l = Array.isArray(u) ? u : [u];
3108
+ return o === "email" && (d = [...s, ...r].filter((h) => l.includes(h.type))), d.every((h) => c.includes(h.value));
3109
+ },
3110
+ /**
3111
+ * A helper method to check if the current access token has a given scope.
3112
+ * @param scope The scope(s) to check for in the current access token (e.g. https://www.googleapis.com/auth/gmail.modify)
3113
+ * @returns boolean indicating whether the current access token has the given scope
3114
+ */
3115
+ async hasScope(o) {
3116
+ const u = await (n == null ? void 0 : n.getTokenInfo());
3117
+ if (!u)
3118
+ return !1;
3119
+ const a = u.scope.toLowerCase().split(" ");
3120
+ return (Array.isArray(o) ? o : [o]).some((c) => a.includes(c.toLowerCase()));
3121
+ }
3122
+ };
3123
+ }
3124
+ export {
3125
+ ns as N,
3126
+ rs as X,
3127
+ ss as e,
3128
+ ar as n
3129
+ };