@bigbinary/neeto-atoms 1.0.7 → 1.0.8

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 (302) hide show
  1. package/dist/ColorPicker-BPvxDGDM.js +276 -0
  2. package/dist/ColorPicker-BPvxDGDM.js.map +1 -0
  3. package/dist/{DataTable-Y4POx0WN.js → DataTable-BKe9K5XP.js} +136 -136
  4. package/dist/DataTable-BKe9K5XP.js.map +1 -0
  5. package/dist/cjs/ColorPicker-DN8aynGh.js +282 -0
  6. package/dist/cjs/ColorPicker-DN8aynGh.js.map +1 -0
  7. package/dist/cjs/{DataTable-DJw2SZ7b.js → DataTable-BQt_mXDX.js} +136 -136
  8. package/dist/cjs/DataTable-BQt_mXDX.js.map +1 -0
  9. package/dist/cjs/components/Accordion.js +49 -0
  10. package/dist/cjs/components/Accordion.js.map +1 -0
  11. package/dist/cjs/components/Alert.js +101 -0
  12. package/dist/cjs/components/Alert.js.map +1 -0
  13. package/dist/cjs/components/Badge.js +71 -0
  14. package/dist/cjs/components/Badge.js.map +1 -0
  15. package/dist/cjs/components/Button.js +121 -0
  16. package/dist/cjs/components/Button.js.map +1 -0
  17. package/dist/cjs/components/Checkbox.js +44 -0
  18. package/dist/cjs/components/Checkbox.js.map +1 -0
  19. package/dist/cjs/components/ColorPicker.js +34 -0
  20. package/dist/cjs/components/ColorPicker.js.map +1 -0
  21. package/dist/cjs/components/DataTable.js +3 -3
  22. package/dist/cjs/components/Dialog.js +88 -0
  23. package/dist/cjs/components/Dialog.js.map +1 -0
  24. package/dist/cjs/components/DropdownMenu.js +180 -0
  25. package/dist/cjs/components/DropdownMenu.js.map +1 -0
  26. package/dist/cjs/components/Input.js +167 -0
  27. package/dist/cjs/components/Input.js.map +1 -0
  28. package/dist/cjs/components/MultiSelect.js +13 -0
  29. package/dist/cjs/components/MultiSelect.js.map +1 -0
  30. package/dist/cjs/components/MultiSelectCombobox.js +3 -0
  31. package/dist/cjs/components/MultiSelectCombobox.js.map +1 -0
  32. package/dist/cjs/components/MultiSelectDropdown.js +37 -0
  33. package/dist/cjs/components/MultiSelectDropdown.js.map +1 -0
  34. package/dist/cjs/components/OptionItem.js +34 -0
  35. package/dist/cjs/components/OptionItem.js.map +1 -0
  36. package/dist/cjs/components/Popover.js +123 -0
  37. package/dist/cjs/components/Popover.js.map +1 -0
  38. package/dist/cjs/components/RadioGroup.js +63 -0
  39. package/dist/cjs/components/RadioGroup.js.map +1 -0
  40. package/dist/cjs/components/Select.js +3 -0
  41. package/dist/cjs/components/Select.js.map +1 -0
  42. package/dist/cjs/components/SelectFieldWrapper.js +33 -0
  43. package/dist/cjs/components/SelectFieldWrapper.js.map +1 -0
  44. package/dist/cjs/components/SelectOptions.js +43 -0
  45. package/dist/cjs/components/SelectOptions.js.map +1 -0
  46. package/dist/cjs/components/SelectTriggerContent.js +43 -0
  47. package/dist/cjs/components/SelectTriggerContent.js.map +1 -0
  48. package/dist/cjs/components/Sheet.js +90 -0
  49. package/dist/cjs/components/Sheet.js.map +1 -0
  50. package/dist/cjs/components/Switch.js +35 -0
  51. package/dist/cjs/components/Switch.js.map +1 -0
  52. package/dist/cjs/components/Tabs.js +74 -0
  53. package/dist/cjs/components/Tabs.js.map +1 -0
  54. package/dist/cjs/components/Textarea.js +89 -0
  55. package/dist/cjs/components/Textarea.js.map +1 -0
  56. package/dist/cjs/components/Toastr.js +133 -0
  57. package/dist/cjs/components/Toastr.js.map +1 -0
  58. package/dist/cjs/components/Tooltip.js +109 -0
  59. package/dist/cjs/components/Tooltip.js.map +1 -0
  60. package/dist/cjs/{primitives → components}/Typography.js +6 -6
  61. package/dist/cjs/components/Typography.js.map +1 -0
  62. package/dist/cjs/components/shared.js +8 -0
  63. package/dist/cjs/components/shared.js.map +1 -0
  64. package/dist/cjs/{dialog-DzNWLbJ6.js → dialog-CF2GBHOG.js} +2 -2
  65. package/dist/cjs/{dialog-DzNWLbJ6.js.map → dialog-CF2GBHOG.js.map} +1 -1
  66. package/dist/cjs/{index-DAds6mf_.js → index-BLGrl3PF.js} +31 -31
  67. package/dist/cjs/{index-DAds6mf_.js.map → index-BLGrl3PF.js.map} +1 -1
  68. package/dist/cjs/{index-BqCr1H3u.js → index-BiGm7NEA.js} +11 -11
  69. package/dist/cjs/{index-BqCr1H3u.js.map → index-BiGm7NEA.js.map} +1 -1
  70. package/dist/cjs/{index-CGet1HH4.js → index-PdtYHwPi.js} +66 -66
  71. package/dist/cjs/{index-CGet1HH4.js.map → index-PdtYHwPi.js.map} +1 -1
  72. package/dist/cjs/index-Vlwnyfvs.js +1145 -0
  73. package/dist/cjs/index-Vlwnyfvs.js.map +1 -0
  74. package/dist/cjs/{index-DR7GJU4J.js → index-hQmfI1O7.js} +17 -17
  75. package/dist/cjs/{index-DR7GJU4J.js.map → index-hQmfI1O7.js.map} +1 -1
  76. package/dist/cjs/index.js +463 -26
  77. package/dist/cjs/index.js.map +1 -1
  78. package/dist/cjs/primitives/Accordion.js +16 -16
  79. package/dist/cjs/primitives/Accordion.js.map +1 -1
  80. package/dist/cjs/primitives/AlertDialog.js +1 -1
  81. package/dist/cjs/primitives/Badge.js +58 -6
  82. package/dist/cjs/primitives/Badge.js.map +1 -1
  83. package/dist/cjs/primitives/Chart.js +137 -137
  84. package/dist/cjs/primitives/Chart.js.map +1 -1
  85. package/dist/cjs/primitives/Collapsible.js +1 -1
  86. package/dist/cjs/primitives/Combobox.js +4 -4
  87. package/dist/cjs/primitives/Combobox.js.map +1 -1
  88. package/dist/cjs/primitives/Command.js +2 -2
  89. package/dist/cjs/primitives/ContextMenu.js +2 -2
  90. package/dist/cjs/primitives/Dialog.js +10 -6
  91. package/dist/cjs/primitives/Dialog.js.map +1 -1
  92. package/dist/cjs/primitives/Drawer.js +1 -1
  93. package/dist/cjs/primitives/DropdownMenu.js +38 -38
  94. package/dist/cjs/primitives/DropdownMenu.js.map +1 -1
  95. package/dist/cjs/primitives/HoverCard.js +16 -16
  96. package/dist/cjs/primitives/Menubar.js +2 -2
  97. package/dist/cjs/primitives/Popover.js +13 -13
  98. package/dist/cjs/primitives/RadioGroup.js +27 -26
  99. package/dist/cjs/primitives/RadioGroup.js.map +1 -1
  100. package/dist/cjs/primitives/Select.js +77 -77
  101. package/dist/cjs/primitives/Sheet.js +10 -6
  102. package/dist/cjs/primitives/Sheet.js.map +1 -1
  103. package/dist/cjs/primitives/Sidebar.js +3 -3
  104. package/dist/cjs/primitives/Sonner.js +12 -1138
  105. package/dist/cjs/primitives/Sonner.js.map +1 -1
  106. package/dist/cjs/primitives/Switch.js +4 -8
  107. package/dist/cjs/primitives/Switch.js.map +1 -1
  108. package/dist/cjs/primitives/Tabs.js +11 -11
  109. package/dist/cjs/primitives/ToggleGroup.js +1 -1
  110. package/dist/cjs/primitives/Tooltip.js +1 -1
  111. package/dist/cjs/primitives/index.js +9 -11
  112. package/dist/cjs/primitives/index.js.map +1 -1
  113. package/dist/cjs/renderIcon-fLF3odqg.js +26 -0
  114. package/dist/cjs/renderIcon-fLF3odqg.js.map +1 -0
  115. package/dist/cjs/{sheet-nHSYZxAA.js → sheet-CkCrHmVA.js} +2 -2
  116. package/dist/cjs/{sheet-nHSYZxAA.js.map → sheet-CkCrHmVA.js.map} +1 -1
  117. package/dist/cjs/{tooltip-CRkOMh1b.js → tooltip-C-568jEL.js} +17 -17
  118. package/dist/cjs/{tooltip-CRkOMh1b.js.map → tooltip-C-568jEL.js.map} +1 -1
  119. package/dist/cjs/useCreatableItems-BTHtd7uo.js +100 -0
  120. package/dist/cjs/useCreatableItems-BTHtd7uo.js.map +1 -0
  121. package/dist/cjs/{reselect-CeyIIDM-.js → with-selector-u4xTSzCv.js} +111 -111
  122. package/dist/cjs/with-selector-u4xTSzCv.js.map +1 -0
  123. package/dist/components/Accordion.d.ts +18 -0
  124. package/dist/components/Accordion.js +43 -0
  125. package/dist/components/Accordion.js.map +1 -0
  126. package/dist/components/Alert.d.ts +51 -0
  127. package/dist/components/Alert.js +99 -0
  128. package/dist/components/Alert.js.map +1 -0
  129. package/dist/components/Badge.d.ts +29 -0
  130. package/dist/components/Badge.js +69 -0
  131. package/dist/components/Badge.js.map +1 -0
  132. package/dist/components/Button.d.ts +47 -0
  133. package/dist/components/Button.js +119 -0
  134. package/dist/components/Button.js.map +1 -0
  135. package/dist/components/Checkbox.d.ts +16 -0
  136. package/dist/components/Checkbox.js +42 -0
  137. package/dist/components/Checkbox.js.map +1 -0
  138. package/dist/components/ColorPicker/ColorPicker.d.ts +4 -0
  139. package/dist/components/ColorPicker/Palette.d.ts +12 -0
  140. package/dist/components/ColorPicker/Target.d.ts +15 -0
  141. package/dist/components/ColorPicker/constants.d.ts +10 -0
  142. package/dist/components/ColorPicker/hooks/useEyeDropper.d.ts +15 -0
  143. package/dist/components/ColorPicker/hooks/useRecentlyUsedColors.d.ts +11 -0
  144. package/dist/components/ColorPicker/index.d.ts +2 -0
  145. package/dist/components/ColorPicker/types.d.ts +42 -0
  146. package/dist/components/ColorPicker/utils.d.ts +31 -0
  147. package/dist/components/ColorPicker.js +28 -0
  148. package/dist/components/ColorPicker.js.map +1 -0
  149. package/dist/components/DataTable.js +2 -2
  150. package/dist/components/Dialog.d.ts +56 -0
  151. package/dist/components/Dialog.js +86 -0
  152. package/dist/components/Dialog.js.map +1 -0
  153. package/dist/components/DropdownMenu/Divider.d.ts +3 -0
  154. package/dist/components/DropdownMenu/DropdownBase.d.ts +3 -0
  155. package/dist/components/DropdownMenu/Label.d.ts +7 -0
  156. package/dist/components/DropdownMenu/Menu.d.ts +7 -0
  157. package/dist/components/DropdownMenu/MenuItem.d.ts +10 -0
  158. package/dist/components/DropdownMenu/MenuItemButton.d.ts +4 -0
  159. package/dist/components/DropdownMenu/SplitTrigger.d.ts +13 -0
  160. package/dist/components/DropdownMenu/SubMenu.d.ts +10 -0
  161. package/dist/components/DropdownMenu/TriggerButton.d.ts +10 -0
  162. package/dist/components/DropdownMenu/constants.d.ts +7 -0
  163. package/dist/components/DropdownMenu/index.d.ts +16 -0
  164. package/dist/components/DropdownMenu/types.d.ts +88 -0
  165. package/dist/components/DropdownMenu.js +178 -0
  166. package/dist/components/DropdownMenu.js.map +1 -0
  167. package/dist/components/Input.d.ts +39 -0
  168. package/dist/components/Input.js +165 -0
  169. package/dist/components/Input.js.map +1 -0
  170. package/dist/components/MultiSelect.constants.d.ts +5 -0
  171. package/dist/components/MultiSelect.d.ts +4 -0
  172. package/dist/components/MultiSelect.js +4 -0
  173. package/dist/components/MultiSelect.js.map +1 -0
  174. package/dist/components/MultiSelect.types.d.ts +121 -0
  175. package/dist/components/MultiSelect.utils.d.ts +18 -0
  176. package/dist/components/MultiSelectCombobox.d.ts +3 -0
  177. package/dist/components/MultiSelectCombobox.js +2 -0
  178. package/dist/components/MultiSelectCombobox.js.map +1 -0
  179. package/dist/components/MultiSelectCombobox.types.d.ts +52 -0
  180. package/dist/components/MultiSelectDropdown.d.ts +9 -0
  181. package/dist/components/MultiSelectDropdown.js +35 -0
  182. package/dist/components/MultiSelectDropdown.js.map +1 -0
  183. package/dist/components/OptionItem.d.ts +9 -0
  184. package/dist/components/OptionItem.js +32 -0
  185. package/dist/components/OptionItem.js.map +1 -0
  186. package/dist/components/Popover.d.ts +47 -0
  187. package/dist/components/Popover.js +117 -0
  188. package/dist/components/Popover.js.map +1 -0
  189. package/dist/components/RadioGroup.d.ts +32 -0
  190. package/dist/components/RadioGroup.js +61 -0
  191. package/dist/components/RadioGroup.js.map +1 -0
  192. package/dist/components/Select.constants.d.ts +5 -0
  193. package/dist/components/Select.d.ts +4 -0
  194. package/dist/components/Select.js +2 -0
  195. package/dist/components/Select.js.map +1 -0
  196. package/dist/components/Select.types.d.ts +58 -0
  197. package/dist/components/SelectFieldWrapper.d.ts +18 -0
  198. package/dist/components/SelectFieldWrapper.js +31 -0
  199. package/dist/components/SelectFieldWrapper.js.map +1 -0
  200. package/dist/components/SelectOptions.d.ts +2 -0
  201. package/dist/components/SelectOptions.js +41 -0
  202. package/dist/components/SelectOptions.js.map +1 -0
  203. package/dist/components/SelectTriggerContent.d.ts +18 -0
  204. package/dist/components/SelectTriggerContent.js +41 -0
  205. package/dist/components/SelectTriggerContent.js.map +1 -0
  206. package/dist/components/Sheet.d.ts +54 -0
  207. package/dist/components/Sheet.js +88 -0
  208. package/dist/components/Sheet.js.map +1 -0
  209. package/dist/components/Switch.d.ts +18 -0
  210. package/dist/components/Switch.js +33 -0
  211. package/dist/components/Switch.js.map +1 -0
  212. package/dist/components/Tabs.d.ts +20 -0
  213. package/dist/components/Tabs.js +72 -0
  214. package/dist/components/Tabs.js.map +1 -0
  215. package/dist/components/Textarea.d.ts +36 -0
  216. package/dist/components/Textarea.js +87 -0
  217. package/dist/components/Textarea.js.map +1 -0
  218. package/dist/components/Toastr.d.ts +30 -0
  219. package/dist/components/Toastr.js +131 -0
  220. package/dist/components/Toastr.js.map +1 -0
  221. package/dist/components/Tooltip.d.ts +29 -0
  222. package/dist/components/Tooltip.js +103 -0
  223. package/dist/components/Tooltip.js.map +1 -0
  224. package/dist/{primitives → components}/Typography.d.ts +2 -2
  225. package/dist/{primitives → components}/Typography.js +6 -6
  226. package/dist/components/Typography.js.map +1 -0
  227. package/dist/components/shared.js +6 -0
  228. package/dist/components/shared.js.map +1 -0
  229. package/dist/components/shared.types.d.ts +16 -0
  230. package/dist/{dialog-C97DOTvO.js → dialog-Civ9r6wD.js} +3 -3
  231. package/dist/{dialog-C97DOTvO.js.map → dialog-Civ9r6wD.js.map} +1 -1
  232. package/dist/hooks/useAsyncOptions.d.ts +13 -0
  233. package/dist/hooks/useCreatableItems.d.ts +30 -0
  234. package/dist/hooks/useLazyLoadSentinel.d.ts +6 -0
  235. package/dist/hooks/useMultiSelectOptions.d.ts +15 -0
  236. package/dist/hooks/useMultiSelectState.d.ts +37 -0
  237. package/dist/hooks/useSelectState.d.ts +27 -0
  238. package/dist/{index-PF0ms7Xn.js → index-9HvIbmnI.js} +3 -3
  239. package/dist/{index-PF0ms7Xn.js.map → index-9HvIbmnI.js.map} +1 -1
  240. package/dist/index-D_roZz8G.js +1137 -0
  241. package/dist/index-D_roZz8G.js.map +1 -0
  242. package/dist/{index-BwxI_qgh.js → index-KzJfsx-e.js} +3 -3
  243. package/dist/{index-BwxI_qgh.js.map → index-KzJfsx-e.js.map} +1 -1
  244. package/dist/index.css +25 -1
  245. package/dist/index.d.ts +40 -0
  246. package/dist/index.js +440 -24
  247. package/dist/index.js.map +1 -1
  248. package/dist/{input-group-CDBpz6Pb.js → input-group-ytECR3Hw.js} +2 -2
  249. package/dist/{input-group-CDBpz6Pb.js.map → input-group-ytECR3Hw.js.map} +1 -1
  250. package/dist/lib/renderIcon.d.ts +5 -0
  251. package/dist/primitives/Accordion.js +1 -1
  252. package/dist/primitives/AlertDialog.js +1 -1
  253. package/dist/primitives/Badge.d.ts +13 -3
  254. package/dist/primitives/Badge.js +54 -2
  255. package/dist/primitives/Badge.js.map +1 -1
  256. package/dist/primitives/Chart.js +1 -1
  257. package/dist/primitives/Combobox.js +3 -3
  258. package/dist/primitives/Command.js +3 -3
  259. package/dist/primitives/ContextMenu.js +1 -1
  260. package/dist/primitives/Dialog.d.ts +11 -3
  261. package/dist/primitives/Dialog.js +11 -7
  262. package/dist/primitives/Dialog.js.map +1 -1
  263. package/dist/primitives/Drawer.js +1 -1
  264. package/dist/primitives/DropdownMenu.js +2 -2
  265. package/dist/primitives/InputGroup.js +1 -1
  266. package/dist/primitives/Menubar.js +1 -1
  267. package/dist/primitives/RadioGroup.d.ts +8 -3
  268. package/dist/primitives/RadioGroup.js +9 -8
  269. package/dist/primitives/RadioGroup.js.map +1 -1
  270. package/dist/primitives/Select.js +3 -3
  271. package/dist/primitives/Sheet.d.ts +12 -3
  272. package/dist/primitives/Sheet.js +11 -7
  273. package/dist/primitives/Sheet.js.map +1 -1
  274. package/dist/primitives/Sidebar.js +3 -3
  275. package/dist/primitives/Sonner.js +11 -1135
  276. package/dist/primitives/Sonner.js.map +1 -1
  277. package/dist/primitives/Switch.d.ts +6 -3
  278. package/dist/primitives/Switch.js +4 -8
  279. package/dist/primitives/Switch.js.map +1 -1
  280. package/dist/primitives/Tooltip.js +1 -1
  281. package/dist/primitives/index.d.ts +0 -1
  282. package/dist/primitives/index.js +8 -8
  283. package/dist/renderIcon-tlvMyboj.js +20 -0
  284. package/dist/renderIcon-tlvMyboj.js.map +1 -0
  285. package/dist/shadcn/components/typography.d.ts +4 -4
  286. package/dist/{sheet-D1ngftfX.js → sheet-COcn22fC.js} +3 -3
  287. package/dist/{sheet-D1ngftfX.js.map → sheet-COcn22fC.js.map} +1 -1
  288. package/dist/{tooltip-D5soNrAP.js → tooltip-DzjIJacP.js} +3 -3
  289. package/dist/{tooltip-D5soNrAP.js.map → tooltip-DzjIJacP.js.map} +1 -1
  290. package/dist/useCreatableItems-B0seQA1_.js +89 -0
  291. package/dist/useCreatableItems-B0seQA1_.js.map +1 -0
  292. package/dist/utils/fieldIds.d.ts +2 -0
  293. package/dist/utils/hyphenize.d.ts +1 -0
  294. package/dist/{reselect-CABQm5hA.js → with-selector--fY1NrB9.js} +111 -111
  295. package/dist/with-selector--fY1NrB9.js.map +1 -0
  296. package/package.json +2 -1
  297. package/dist/DataTable-Y4POx0WN.js.map +0 -1
  298. package/dist/cjs/DataTable-DJw2SZ7b.js.map +0 -1
  299. package/dist/cjs/primitives/Typography.js.map +0 -1
  300. package/dist/cjs/reselect-CeyIIDM-.js.map +0 -1
  301. package/dist/primitives/Typography.js.map +0 -1
  302. package/dist/reselect-CABQm5hA.js.map +0 -1
@@ -0,0 +1,1145 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var ReactDOM = require('react-dom');
5
+
6
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
+
8
+ var React__default = /*#__PURE__*/_interopDefault(React);
9
+ var ReactDOM__default = /*#__PURE__*/_interopDefault(ReactDOM);
10
+
11
+ function __insertCSS(code) {
12
+ if (typeof document == 'undefined') return
13
+ let head = document.head || document.getElementsByTagName('head')[0];
14
+ let style = document.createElement('style');
15
+ style.type = 'text/css';
16
+ head.appendChild(style)
17
+ ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
18
+ }
19
+
20
+ const getAsset = (type)=>{
21
+ switch(type){
22
+ case 'success':
23
+ return SuccessIcon;
24
+ case 'info':
25
+ return InfoIcon;
26
+ case 'warning':
27
+ return WarningIcon;
28
+ case 'error':
29
+ return ErrorIcon;
30
+ default:
31
+ return null;
32
+ }
33
+ };
34
+ const bars = Array(12).fill(0);
35
+ const Loader = ({ visible, className })=>{
36
+ return /*#__PURE__*/ React__default.default.createElement("div", {
37
+ className: [
38
+ 'sonner-loading-wrapper',
39
+ className
40
+ ].filter(Boolean).join(' '),
41
+ "data-visible": visible
42
+ }, /*#__PURE__*/ React__default.default.createElement("div", {
43
+ className: "sonner-spinner"
44
+ }, bars.map((_, i)=>/*#__PURE__*/ React__default.default.createElement("div", {
45
+ className: "sonner-loading-bar",
46
+ key: `spinner-bar-${i}`
47
+ }))));
48
+ };
49
+ const SuccessIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
50
+ xmlns: "http://www.w3.org/2000/svg",
51
+ viewBox: "0 0 20 20",
52
+ fill: "currentColor",
53
+ height: "20",
54
+ width: "20"
55
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
56
+ fillRule: "evenodd",
57
+ d: "M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",
58
+ clipRule: "evenodd"
59
+ }));
60
+ const WarningIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
61
+ xmlns: "http://www.w3.org/2000/svg",
62
+ viewBox: "0 0 24 24",
63
+ fill: "currentColor",
64
+ height: "20",
65
+ width: "20"
66
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
67
+ fillRule: "evenodd",
68
+ d: "M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",
69
+ clipRule: "evenodd"
70
+ }));
71
+ const InfoIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
72
+ xmlns: "http://www.w3.org/2000/svg",
73
+ viewBox: "0 0 20 20",
74
+ fill: "currentColor",
75
+ height: "20",
76
+ width: "20"
77
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
78
+ fillRule: "evenodd",
79
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",
80
+ clipRule: "evenodd"
81
+ }));
82
+ const ErrorIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
83
+ xmlns: "http://www.w3.org/2000/svg",
84
+ viewBox: "0 0 20 20",
85
+ fill: "currentColor",
86
+ height: "20",
87
+ width: "20"
88
+ }, /*#__PURE__*/ React__default.default.createElement("path", {
89
+ fillRule: "evenodd",
90
+ d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",
91
+ clipRule: "evenodd"
92
+ }));
93
+ const CloseIcon = /*#__PURE__*/ React__default.default.createElement("svg", {
94
+ xmlns: "http://www.w3.org/2000/svg",
95
+ width: "12",
96
+ height: "12",
97
+ viewBox: "0 0 24 24",
98
+ fill: "none",
99
+ stroke: "currentColor",
100
+ strokeWidth: "1.5",
101
+ strokeLinecap: "round",
102
+ strokeLinejoin: "round"
103
+ }, /*#__PURE__*/ React__default.default.createElement("line", {
104
+ x1: "18",
105
+ y1: "6",
106
+ x2: "6",
107
+ y2: "18"
108
+ }), /*#__PURE__*/ React__default.default.createElement("line", {
109
+ x1: "6",
110
+ y1: "6",
111
+ x2: "18",
112
+ y2: "18"
113
+ }));
114
+
115
+ const useIsDocumentHidden = ()=>{
116
+ const [isDocumentHidden, setIsDocumentHidden] = React__default.default.useState(document.hidden);
117
+ React__default.default.useEffect(()=>{
118
+ const callback = ()=>{
119
+ setIsDocumentHidden(document.hidden);
120
+ };
121
+ document.addEventListener('visibilitychange', callback);
122
+ return ()=>window.removeEventListener('visibilitychange', callback);
123
+ }, []);
124
+ return isDocumentHidden;
125
+ };
126
+
127
+ let toastsCounter = 1;
128
+ class Observer {
129
+ constructor(){
130
+ // We use arrow functions to maintain the correct `this` reference
131
+ this.subscribe = (subscriber)=>{
132
+ this.subscribers.push(subscriber);
133
+ return ()=>{
134
+ const index = this.subscribers.indexOf(subscriber);
135
+ this.subscribers.splice(index, 1);
136
+ };
137
+ };
138
+ this.publish = (data)=>{
139
+ this.subscribers.forEach((subscriber)=>subscriber(data));
140
+ };
141
+ this.addToast = (data)=>{
142
+ this.publish(data);
143
+ this.toasts = [
144
+ ...this.toasts,
145
+ data
146
+ ];
147
+ };
148
+ this.create = (data)=>{
149
+ var _data_id;
150
+ const { message, ...rest } = data;
151
+ const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
152
+ const alreadyExists = this.toasts.find((toast)=>{
153
+ return toast.id === id;
154
+ });
155
+ const dismissible = data.dismissible === undefined ? true : data.dismissible;
156
+ if (this.dismissedToasts.has(id)) {
157
+ this.dismissedToasts.delete(id);
158
+ }
159
+ if (alreadyExists) {
160
+ this.toasts = this.toasts.map((toast)=>{
161
+ if (toast.id === id) {
162
+ this.publish({
163
+ ...toast,
164
+ ...data,
165
+ id,
166
+ title: message
167
+ });
168
+ return {
169
+ ...toast,
170
+ ...data,
171
+ id,
172
+ dismissible,
173
+ title: message
174
+ };
175
+ }
176
+ return toast;
177
+ });
178
+ } else {
179
+ this.addToast({
180
+ title: message,
181
+ ...rest,
182
+ dismissible,
183
+ id
184
+ });
185
+ }
186
+ return id;
187
+ };
188
+ this.dismiss = (id)=>{
189
+ if (id) {
190
+ this.dismissedToasts.add(id);
191
+ requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
192
+ id,
193
+ dismiss: true
194
+ })));
195
+ } else {
196
+ this.toasts.forEach((toast)=>{
197
+ this.subscribers.forEach((subscriber)=>subscriber({
198
+ id: toast.id,
199
+ dismiss: true
200
+ }));
201
+ });
202
+ }
203
+ return id;
204
+ };
205
+ this.message = (message, data)=>{
206
+ return this.create({
207
+ ...data,
208
+ message
209
+ });
210
+ };
211
+ this.error = (message, data)=>{
212
+ return this.create({
213
+ ...data,
214
+ message,
215
+ type: 'error'
216
+ });
217
+ };
218
+ this.success = (message, data)=>{
219
+ return this.create({
220
+ ...data,
221
+ type: 'success',
222
+ message
223
+ });
224
+ };
225
+ this.info = (message, data)=>{
226
+ return this.create({
227
+ ...data,
228
+ type: 'info',
229
+ message
230
+ });
231
+ };
232
+ this.warning = (message, data)=>{
233
+ return this.create({
234
+ ...data,
235
+ type: 'warning',
236
+ message
237
+ });
238
+ };
239
+ this.loading = (message, data)=>{
240
+ return this.create({
241
+ ...data,
242
+ type: 'loading',
243
+ message
244
+ });
245
+ };
246
+ this.promise = (promise, data)=>{
247
+ if (!data) {
248
+ // Nothing to show
249
+ return;
250
+ }
251
+ let id = undefined;
252
+ if (data.loading !== undefined) {
253
+ id = this.create({
254
+ ...data,
255
+ promise,
256
+ type: 'loading',
257
+ message: data.loading,
258
+ description: typeof data.description !== 'function' ? data.description : undefined
259
+ });
260
+ }
261
+ const p = Promise.resolve(promise instanceof Function ? promise() : promise);
262
+ let shouldDismiss = id !== undefined;
263
+ let result;
264
+ const originalPromise = p.then(async (response)=>{
265
+ result = [
266
+ 'resolve',
267
+ response
268
+ ];
269
+ const isReactElementResponse = React__default.default.isValidElement(response);
270
+ if (isReactElementResponse) {
271
+ shouldDismiss = false;
272
+ this.create({
273
+ id,
274
+ type: 'default',
275
+ message: response
276
+ });
277
+ } else if (isHttpResponse(response) && !response.ok) {
278
+ shouldDismiss = false;
279
+ const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
280
+ const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
281
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
282
+ const toastSettings = isExtendedResult ? promiseData : {
283
+ message: promiseData
284
+ };
285
+ this.create({
286
+ id,
287
+ type: 'error',
288
+ description,
289
+ ...toastSettings
290
+ });
291
+ } else if (response instanceof Error) {
292
+ shouldDismiss = false;
293
+ const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
294
+ const description = typeof data.description === 'function' ? await data.description(response) : data.description;
295
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
296
+ const toastSettings = isExtendedResult ? promiseData : {
297
+ message: promiseData
298
+ };
299
+ this.create({
300
+ id,
301
+ type: 'error',
302
+ description,
303
+ ...toastSettings
304
+ });
305
+ } else if (data.success !== undefined) {
306
+ shouldDismiss = false;
307
+ const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
308
+ const description = typeof data.description === 'function' ? await data.description(response) : data.description;
309
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
310
+ const toastSettings = isExtendedResult ? promiseData : {
311
+ message: promiseData
312
+ };
313
+ this.create({
314
+ id,
315
+ type: 'success',
316
+ description,
317
+ ...toastSettings
318
+ });
319
+ }
320
+ }).catch(async (error)=>{
321
+ result = [
322
+ 'reject',
323
+ error
324
+ ];
325
+ if (data.error !== undefined) {
326
+ shouldDismiss = false;
327
+ const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
328
+ const description = typeof data.description === 'function' ? await data.description(error) : data.description;
329
+ const isExtendedResult = typeof promiseData === 'object' && !React__default.default.isValidElement(promiseData);
330
+ const toastSettings = isExtendedResult ? promiseData : {
331
+ message: promiseData
332
+ };
333
+ this.create({
334
+ id,
335
+ type: 'error',
336
+ description,
337
+ ...toastSettings
338
+ });
339
+ }
340
+ }).finally(()=>{
341
+ if (shouldDismiss) {
342
+ // Toast is still in load state (and will be indefinitely — dismiss it)
343
+ this.dismiss(id);
344
+ id = undefined;
345
+ }
346
+ data.finally == null ? void 0 : data.finally.call(data);
347
+ });
348
+ const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
349
+ if (typeof id !== 'string' && typeof id !== 'number') {
350
+ // cannot Object.assign on undefined
351
+ return {
352
+ unwrap
353
+ };
354
+ } else {
355
+ return Object.assign(id, {
356
+ unwrap
357
+ });
358
+ }
359
+ };
360
+ this.custom = (jsx, data)=>{
361
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
362
+ this.create({
363
+ jsx: jsx(id),
364
+ id,
365
+ ...data
366
+ });
367
+ return id;
368
+ };
369
+ this.getActiveToasts = ()=>{
370
+ return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
371
+ };
372
+ this.subscribers = [];
373
+ this.toasts = [];
374
+ this.dismissedToasts = new Set();
375
+ }
376
+ }
377
+ const ToastState = new Observer();
378
+ // bind this to the toast function
379
+ const toastFunction = (message, data)=>{
380
+ const id = (data == null ? void 0 : data.id) || toastsCounter++;
381
+ ToastState.addToast({
382
+ title: message,
383
+ ...data,
384
+ id
385
+ });
386
+ return id;
387
+ };
388
+ const isHttpResponse = (data)=>{
389
+ return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
390
+ };
391
+ const basicToast = toastFunction;
392
+ const getHistory = ()=>ToastState.toasts;
393
+ const getToasts = ()=>ToastState.getActiveToasts();
394
+ // We use `Object.assign` to maintain the correct types as we would lose them otherwise
395
+ const toast = Object.assign(basicToast, {
396
+ success: ToastState.success,
397
+ info: ToastState.info,
398
+ warning: ToastState.warning,
399
+ error: ToastState.error,
400
+ custom: ToastState.custom,
401
+ message: ToastState.message,
402
+ promise: ToastState.promise,
403
+ dismiss: ToastState.dismiss,
404
+ loading: ToastState.loading
405
+ }, {
406
+ getHistory,
407
+ getToasts
408
+ });
409
+
410
+ __insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
411
+
412
+ function isAction(action) {
413
+ return action.label !== undefined;
414
+ }
415
+
416
+ // Visible toasts amount
417
+ const VISIBLE_TOASTS_AMOUNT = 3;
418
+ // Viewport padding
419
+ const VIEWPORT_OFFSET = '24px';
420
+ // Mobile viewport padding
421
+ const MOBILE_VIEWPORT_OFFSET = '16px';
422
+ // Default lifetime of a toasts (in ms)
423
+ const TOAST_LIFETIME = 4000;
424
+ // Default toast width
425
+ const TOAST_WIDTH = 356;
426
+ // Default gap between toasts
427
+ const GAP = 14;
428
+ // Threshold to dismiss a toast
429
+ const SWIPE_THRESHOLD = 45;
430
+ // Equal to exit animation duration
431
+ const TIME_BEFORE_UNMOUNT = 200;
432
+ function cn(...classes) {
433
+ return classes.filter(Boolean).join(' ');
434
+ }
435
+ function getDefaultSwipeDirections(position) {
436
+ const [y, x] = position.split('-');
437
+ const directions = [];
438
+ if (y) {
439
+ directions.push(y);
440
+ }
441
+ if (x) {
442
+ directions.push(x);
443
+ }
444
+ return directions;
445
+ }
446
+ const Toast = (props)=>{
447
+ var _toast_classNames, _toast_classNames1, _toast_classNames2, _toast_classNames3, _toast_classNames4, _toast_classNames5, _toast_classNames6, _toast_classNames7, _toast_classNames8;
448
+ const { invert: ToasterInvert, toast, unstyled, interacting, setHeights, visibleToasts, heights, index, toasts, expanded, removeToast, defaultRichColors, closeButton: closeButtonFromToaster, style, cancelButtonStyle, actionButtonStyle, className = '', descriptionClassName = '', duration: durationFromToaster, position, gap, expandByDefault, classNames, icons, closeButtonAriaLabel = 'Close toast' } = props;
449
+ const [swipeDirection, setSwipeDirection] = React__default.default.useState(null);
450
+ const [swipeOutDirection, setSwipeOutDirection] = React__default.default.useState(null);
451
+ const [mounted, setMounted] = React__default.default.useState(false);
452
+ const [removed, setRemoved] = React__default.default.useState(false);
453
+ const [swiping, setSwiping] = React__default.default.useState(false);
454
+ const [swipeOut, setSwipeOut] = React__default.default.useState(false);
455
+ const [isSwiped, setIsSwiped] = React__default.default.useState(false);
456
+ const [offsetBeforeRemove, setOffsetBeforeRemove] = React__default.default.useState(0);
457
+ const [initialHeight, setInitialHeight] = React__default.default.useState(0);
458
+ const remainingTime = React__default.default.useRef(toast.duration || durationFromToaster || TOAST_LIFETIME);
459
+ const dragStartTime = React__default.default.useRef(null);
460
+ const toastRef = React__default.default.useRef(null);
461
+ const isFront = index === 0;
462
+ const isVisible = index + 1 <= visibleToasts;
463
+ const toastType = toast.type;
464
+ const dismissible = toast.dismissible !== false;
465
+ const toastClassname = toast.className || '';
466
+ const toastDescriptionClassname = toast.descriptionClassName || '';
467
+ // Height index is used to calculate the offset as it gets updated before the toast array, which means we can calculate the new layout faster.
468
+ const heightIndex = React__default.default.useMemo(()=>heights.findIndex((height)=>height.toastId === toast.id) || 0, [
469
+ heights,
470
+ toast.id
471
+ ]);
472
+ const closeButton = React__default.default.useMemo(()=>{
473
+ var _toast_closeButton;
474
+ return (_toast_closeButton = toast.closeButton) != null ? _toast_closeButton : closeButtonFromToaster;
475
+ }, [
476
+ toast.closeButton,
477
+ closeButtonFromToaster
478
+ ]);
479
+ const duration = React__default.default.useMemo(()=>toast.duration || durationFromToaster || TOAST_LIFETIME, [
480
+ toast.duration,
481
+ durationFromToaster
482
+ ]);
483
+ const closeTimerStartTimeRef = React__default.default.useRef(0);
484
+ const offset = React__default.default.useRef(0);
485
+ const lastCloseTimerStartTimeRef = React__default.default.useRef(0);
486
+ const pointerStartRef = React__default.default.useRef(null);
487
+ const [y, x] = position.split('-');
488
+ const toastsHeightBefore = React__default.default.useMemo(()=>{
489
+ return heights.reduce((prev, curr, reducerIndex)=>{
490
+ // Calculate offset up until current toast
491
+ if (reducerIndex >= heightIndex) {
492
+ return prev;
493
+ }
494
+ return prev + curr.height;
495
+ }, 0);
496
+ }, [
497
+ heights,
498
+ heightIndex
499
+ ]);
500
+ const isDocumentHidden = useIsDocumentHidden();
501
+ const invert = toast.invert || ToasterInvert;
502
+ const disabled = toastType === 'loading';
503
+ offset.current = React__default.default.useMemo(()=>heightIndex * gap + toastsHeightBefore, [
504
+ heightIndex,
505
+ toastsHeightBefore
506
+ ]);
507
+ React__default.default.useEffect(()=>{
508
+ remainingTime.current = duration;
509
+ }, [
510
+ duration
511
+ ]);
512
+ React__default.default.useEffect(()=>{
513
+ // Trigger enter animation without using CSS animation
514
+ setMounted(true);
515
+ }, []);
516
+ React__default.default.useEffect(()=>{
517
+ const toastNode = toastRef.current;
518
+ if (toastNode) {
519
+ const height = toastNode.getBoundingClientRect().height;
520
+ // Add toast height to heights array after the toast is mounted
521
+ setInitialHeight(height);
522
+ setHeights((h)=>[
523
+ {
524
+ toastId: toast.id,
525
+ height,
526
+ position: toast.position
527
+ },
528
+ ...h
529
+ ]);
530
+ return ()=>setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
531
+ }
532
+ }, [
533
+ setHeights,
534
+ toast.id
535
+ ]);
536
+ React__default.default.useLayoutEffect(()=>{
537
+ // Keep height up to date with the content in case it updates
538
+ if (!mounted) return;
539
+ const toastNode = toastRef.current;
540
+ const originalHeight = toastNode.style.height;
541
+ toastNode.style.height = 'auto';
542
+ const newHeight = toastNode.getBoundingClientRect().height;
543
+ toastNode.style.height = originalHeight;
544
+ setInitialHeight(newHeight);
545
+ setHeights((heights)=>{
546
+ const alreadyExists = heights.find((height)=>height.toastId === toast.id);
547
+ if (!alreadyExists) {
548
+ return [
549
+ {
550
+ toastId: toast.id,
551
+ height: newHeight,
552
+ position: toast.position
553
+ },
554
+ ...heights
555
+ ];
556
+ } else {
557
+ return heights.map((height)=>height.toastId === toast.id ? {
558
+ ...height,
559
+ height: newHeight
560
+ } : height);
561
+ }
562
+ });
563
+ }, [
564
+ mounted,
565
+ toast.title,
566
+ toast.description,
567
+ setHeights,
568
+ toast.id,
569
+ toast.jsx,
570
+ toast.action,
571
+ toast.cancel
572
+ ]);
573
+ const deleteToast = React__default.default.useCallback(()=>{
574
+ // Save the offset for the exit swipe animation
575
+ setRemoved(true);
576
+ setOffsetBeforeRemove(offset.current);
577
+ setHeights((h)=>h.filter((height)=>height.toastId !== toast.id));
578
+ setTimeout(()=>{
579
+ removeToast(toast);
580
+ }, TIME_BEFORE_UNMOUNT);
581
+ }, [
582
+ toast,
583
+ removeToast,
584
+ setHeights,
585
+ offset
586
+ ]);
587
+ React__default.default.useEffect(()=>{
588
+ if (toast.promise && toastType === 'loading' || toast.duration === Infinity || toast.type === 'loading') return;
589
+ let timeoutId;
590
+ // Pause the timer on each hover
591
+ const pauseTimer = ()=>{
592
+ if (lastCloseTimerStartTimeRef.current < closeTimerStartTimeRef.current) {
593
+ // Get the elapsed time since the timer started
594
+ const elapsedTime = new Date().getTime() - closeTimerStartTimeRef.current;
595
+ remainingTime.current = remainingTime.current - elapsedTime;
596
+ }
597
+ lastCloseTimerStartTimeRef.current = new Date().getTime();
598
+ };
599
+ const startTimer = ()=>{
600
+ // setTimeout(, Infinity) behaves as if the delay is 0.
601
+ // As a result, the toast would be closed immediately, giving the appearance that it was never rendered.
602
+ // See: https://github.com/denysdovhan/wtfjs?tab=readme-ov-file#an-infinite-timeout
603
+ if (remainingTime.current === Infinity) return;
604
+ closeTimerStartTimeRef.current = new Date().getTime();
605
+ // Let the toast know it has started
606
+ timeoutId = setTimeout(()=>{
607
+ toast.onAutoClose == null ? void 0 : toast.onAutoClose.call(toast, toast);
608
+ deleteToast();
609
+ }, remainingTime.current);
610
+ };
611
+ if (expanded || interacting || isDocumentHidden) {
612
+ pauseTimer();
613
+ } else {
614
+ startTimer();
615
+ }
616
+ return ()=>clearTimeout(timeoutId);
617
+ }, [
618
+ expanded,
619
+ interacting,
620
+ toast,
621
+ toastType,
622
+ isDocumentHidden,
623
+ deleteToast
624
+ ]);
625
+ React__default.default.useEffect(()=>{
626
+ if (toast.delete) {
627
+ deleteToast();
628
+ toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
629
+ }
630
+ }, [
631
+ deleteToast,
632
+ toast.delete
633
+ ]);
634
+ function getLoadingIcon() {
635
+ var _toast_classNames;
636
+ if (icons == null ? void 0 : icons.loading) {
637
+ var _toast_classNames1;
638
+ return /*#__PURE__*/ React__default.default.createElement("div", {
639
+ className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1.loader, 'sonner-loader'),
640
+ "data-visible": toastType === 'loading'
641
+ }, icons.loading);
642
+ }
643
+ return /*#__PURE__*/ React__default.default.createElement(Loader, {
644
+ className: cn(classNames == null ? void 0 : classNames.loader, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.loader),
645
+ visible: toastType === 'loading'
646
+ });
647
+ }
648
+ const icon = toast.icon || (icons == null ? void 0 : icons[toastType]) || getAsset(toastType);
649
+ var _toast_richColors, _icons_close;
650
+ return /*#__PURE__*/ React__default.default.createElement("li", {
651
+ tabIndex: 0,
652
+ ref: toastRef,
653
+ className: cn(className, toastClassname, classNames == null ? void 0 : classNames.toast, toast == null ? void 0 : (_toast_classNames = toast.classNames) == null ? void 0 : _toast_classNames.toast, classNames == null ? void 0 : classNames.default, classNames == null ? void 0 : classNames[toastType], toast == null ? void 0 : (_toast_classNames1 = toast.classNames) == null ? void 0 : _toast_classNames1[toastType]),
654
+ "data-sonner-toast": "",
655
+ "data-rich-colors": (_toast_richColors = toast.richColors) != null ? _toast_richColors : defaultRichColors,
656
+ "data-styled": !Boolean(toast.jsx || toast.unstyled || unstyled),
657
+ "data-mounted": mounted,
658
+ "data-promise": Boolean(toast.promise),
659
+ "data-swiped": isSwiped,
660
+ "data-removed": removed,
661
+ "data-visible": isVisible,
662
+ "data-y-position": y,
663
+ "data-x-position": x,
664
+ "data-index": index,
665
+ "data-front": isFront,
666
+ "data-swiping": swiping,
667
+ "data-dismissible": dismissible,
668
+ "data-type": toastType,
669
+ "data-invert": invert,
670
+ "data-swipe-out": swipeOut,
671
+ "data-swipe-direction": swipeOutDirection,
672
+ "data-expanded": Boolean(expanded || expandByDefault && mounted),
673
+ "data-testid": toast.testId,
674
+ style: {
675
+ '--index': index,
676
+ '--toasts-before': index,
677
+ '--z-index': toasts.length - index,
678
+ '--offset': `${removed ? offsetBeforeRemove : offset.current}px`,
679
+ '--initial-height': expandByDefault ? 'auto' : `${initialHeight}px`,
680
+ ...style,
681
+ ...toast.style
682
+ },
683
+ onDragEnd: ()=>{
684
+ setSwiping(false);
685
+ setSwipeDirection(null);
686
+ pointerStartRef.current = null;
687
+ },
688
+ onPointerDown: (event)=>{
689
+ if (event.button === 2) return; // Return early on right click
690
+ if (disabled || !dismissible) return;
691
+ dragStartTime.current = new Date();
692
+ setOffsetBeforeRemove(offset.current);
693
+ // Ensure we maintain correct pointer capture even when going outside of the toast (e.g. when swiping)
694
+ event.target.setPointerCapture(event.pointerId);
695
+ if (event.target.tagName === 'BUTTON') return;
696
+ setSwiping(true);
697
+ pointerStartRef.current = {
698
+ x: event.clientX,
699
+ y: event.clientY
700
+ };
701
+ },
702
+ onPointerUp: ()=>{
703
+ var _toastRef_current, _toastRef_current1, _dragStartTime_current;
704
+ if (swipeOut || !dismissible) return;
705
+ pointerStartRef.current = null;
706
+ const swipeAmountX = Number(((_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.getPropertyValue('--swipe-amount-x').replace('px', '')) || 0);
707
+ const swipeAmountY = Number(((_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.getPropertyValue('--swipe-amount-y').replace('px', '')) || 0);
708
+ const timeTaken = new Date().getTime() - ((_dragStartTime_current = dragStartTime.current) == null ? void 0 : _dragStartTime_current.getTime());
709
+ const swipeAmount = swipeDirection === 'x' ? swipeAmountX : swipeAmountY;
710
+ const velocity = Math.abs(swipeAmount) / timeTaken;
711
+ if (Math.abs(swipeAmount) >= SWIPE_THRESHOLD || velocity > 0.11) {
712
+ setOffsetBeforeRemove(offset.current);
713
+ toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
714
+ if (swipeDirection === 'x') {
715
+ setSwipeOutDirection(swipeAmountX > 0 ? 'right' : 'left');
716
+ } else {
717
+ setSwipeOutDirection(swipeAmountY > 0 ? 'down' : 'up');
718
+ }
719
+ deleteToast();
720
+ setSwipeOut(true);
721
+ return;
722
+ } else {
723
+ var _toastRef_current2, _toastRef_current3;
724
+ (_toastRef_current2 = toastRef.current) == null ? void 0 : _toastRef_current2.style.setProperty('--swipe-amount-x', `0px`);
725
+ (_toastRef_current3 = toastRef.current) == null ? void 0 : _toastRef_current3.style.setProperty('--swipe-amount-y', `0px`);
726
+ }
727
+ setIsSwiped(false);
728
+ setSwiping(false);
729
+ setSwipeDirection(null);
730
+ },
731
+ onPointerMove: (event)=>{
732
+ var _window_getSelection, // Apply transform using both x and y values
733
+ _toastRef_current, _toastRef_current1;
734
+ if (!pointerStartRef.current || !dismissible) return;
735
+ const isHighlighted = ((_window_getSelection = window.getSelection()) == null ? void 0 : _window_getSelection.toString().length) > 0;
736
+ if (isHighlighted) return;
737
+ const yDelta = event.clientY - pointerStartRef.current.y;
738
+ const xDelta = event.clientX - pointerStartRef.current.x;
739
+ var _props_swipeDirections;
740
+ const swipeDirections = (_props_swipeDirections = props.swipeDirections) != null ? _props_swipeDirections : getDefaultSwipeDirections(position);
741
+ // Determine swipe direction if not already locked
742
+ if (!swipeDirection && (Math.abs(xDelta) > 1 || Math.abs(yDelta) > 1)) {
743
+ setSwipeDirection(Math.abs(xDelta) > Math.abs(yDelta) ? 'x' : 'y');
744
+ }
745
+ let swipeAmount = {
746
+ x: 0,
747
+ y: 0
748
+ };
749
+ const getDampening = (delta)=>{
750
+ const factor = Math.abs(delta) / 20;
751
+ return 1 / (1.5 + factor);
752
+ };
753
+ // Only apply swipe in the locked direction
754
+ if (swipeDirection === 'y') {
755
+ // Handle vertical swipes
756
+ if (swipeDirections.includes('top') || swipeDirections.includes('bottom')) {
757
+ if (swipeDirections.includes('top') && yDelta < 0 || swipeDirections.includes('bottom') && yDelta > 0) {
758
+ swipeAmount.y = yDelta;
759
+ } else {
760
+ // Smoothly transition to dampened movement
761
+ const dampenedDelta = yDelta * getDampening(yDelta);
762
+ // Ensure we don't jump when transitioning to dampened movement
763
+ swipeAmount.y = Math.abs(dampenedDelta) < Math.abs(yDelta) ? dampenedDelta : yDelta;
764
+ }
765
+ }
766
+ } else if (swipeDirection === 'x') {
767
+ // Handle horizontal swipes
768
+ if (swipeDirections.includes('left') || swipeDirections.includes('right')) {
769
+ if (swipeDirections.includes('left') && xDelta < 0 || swipeDirections.includes('right') && xDelta > 0) {
770
+ swipeAmount.x = xDelta;
771
+ } else {
772
+ // Smoothly transition to dampened movement
773
+ const dampenedDelta = xDelta * getDampening(xDelta);
774
+ // Ensure we don't jump when transitioning to dampened movement
775
+ swipeAmount.x = Math.abs(dampenedDelta) < Math.abs(xDelta) ? dampenedDelta : xDelta;
776
+ }
777
+ }
778
+ }
779
+ if (Math.abs(swipeAmount.x) > 0 || Math.abs(swipeAmount.y) > 0) {
780
+ setIsSwiped(true);
781
+ }
782
+ (_toastRef_current = toastRef.current) == null ? void 0 : _toastRef_current.style.setProperty('--swipe-amount-x', `${swipeAmount.x}px`);
783
+ (_toastRef_current1 = toastRef.current) == null ? void 0 : _toastRef_current1.style.setProperty('--swipe-amount-y', `${swipeAmount.y}px`);
784
+ }
785
+ }, closeButton && !toast.jsx && toastType !== 'loading' ? /*#__PURE__*/ React__default.default.createElement("button", {
786
+ "aria-label": closeButtonAriaLabel,
787
+ "data-disabled": disabled,
788
+ "data-close-button": true,
789
+ onClick: disabled || !dismissible ? ()=>{} : ()=>{
790
+ deleteToast();
791
+ toast.onDismiss == null ? void 0 : toast.onDismiss.call(toast, toast);
792
+ },
793
+ className: cn(classNames == null ? void 0 : classNames.closeButton, toast == null ? void 0 : (_toast_classNames2 = toast.classNames) == null ? void 0 : _toast_classNames2.closeButton)
794
+ }, (_icons_close = icons == null ? void 0 : icons.close) != null ? _icons_close : CloseIcon) : null, (toastType || toast.icon || toast.promise) && toast.icon !== null && ((icons == null ? void 0 : icons[toastType]) !== null || toast.icon) ? /*#__PURE__*/ React__default.default.createElement("div", {
795
+ "data-icon": "",
796
+ className: cn(classNames == null ? void 0 : classNames.icon, toast == null ? void 0 : (_toast_classNames3 = toast.classNames) == null ? void 0 : _toast_classNames3.icon)
797
+ }, toast.promise || toast.type === 'loading' && !toast.icon ? toast.icon || getLoadingIcon() : null, toast.type !== 'loading' ? icon : null) : null, /*#__PURE__*/ React__default.default.createElement("div", {
798
+ "data-content": "",
799
+ className: cn(classNames == null ? void 0 : classNames.content, toast == null ? void 0 : (_toast_classNames4 = toast.classNames) == null ? void 0 : _toast_classNames4.content)
800
+ }, /*#__PURE__*/ React__default.default.createElement("div", {
801
+ "data-title": "",
802
+ className: cn(classNames == null ? void 0 : classNames.title, toast == null ? void 0 : (_toast_classNames5 = toast.classNames) == null ? void 0 : _toast_classNames5.title)
803
+ }, toast.jsx ? toast.jsx : typeof toast.title === 'function' ? toast.title() : toast.title), toast.description ? /*#__PURE__*/ React__default.default.createElement("div", {
804
+ "data-description": "",
805
+ className: cn(descriptionClassName, toastDescriptionClassname, classNames == null ? void 0 : classNames.description, toast == null ? void 0 : (_toast_classNames6 = toast.classNames) == null ? void 0 : _toast_classNames6.description)
806
+ }, typeof toast.description === 'function' ? toast.description() : toast.description) : null), /*#__PURE__*/ React__default.default.isValidElement(toast.cancel) ? toast.cancel : toast.cancel && isAction(toast.cancel) ? /*#__PURE__*/ React__default.default.createElement("button", {
807
+ "data-button": true,
808
+ "data-cancel": true,
809
+ style: toast.cancelButtonStyle || cancelButtonStyle,
810
+ onClick: (event)=>{
811
+ // We need to check twice because typescript
812
+ if (!isAction(toast.cancel)) return;
813
+ if (!dismissible) return;
814
+ toast.cancel.onClick == null ? void 0 : toast.cancel.onClick.call(toast.cancel, event);
815
+ deleteToast();
816
+ },
817
+ className: cn(classNames == null ? void 0 : classNames.cancelButton, toast == null ? void 0 : (_toast_classNames7 = toast.classNames) == null ? void 0 : _toast_classNames7.cancelButton)
818
+ }, toast.cancel.label) : null, /*#__PURE__*/ React__default.default.isValidElement(toast.action) ? toast.action : toast.action && isAction(toast.action) ? /*#__PURE__*/ React__default.default.createElement("button", {
819
+ "data-button": true,
820
+ "data-action": true,
821
+ style: toast.actionButtonStyle || actionButtonStyle,
822
+ onClick: (event)=>{
823
+ // We need to check twice because typescript
824
+ if (!isAction(toast.action)) return;
825
+ toast.action.onClick == null ? void 0 : toast.action.onClick.call(toast.action, event);
826
+ if (event.defaultPrevented) return;
827
+ deleteToast();
828
+ },
829
+ className: cn(classNames == null ? void 0 : classNames.actionButton, toast == null ? void 0 : (_toast_classNames8 = toast.classNames) == null ? void 0 : _toast_classNames8.actionButton)
830
+ }, toast.action.label) : null);
831
+ };
832
+ function getDocumentDirection() {
833
+ if (typeof window === 'undefined') return 'ltr';
834
+ if (typeof document === 'undefined') return 'ltr'; // For Fresh purpose
835
+ const dirAttribute = document.documentElement.getAttribute('dir');
836
+ if (dirAttribute === 'auto' || !dirAttribute) {
837
+ return window.getComputedStyle(document.documentElement).direction;
838
+ }
839
+ return dirAttribute;
840
+ }
841
+ function assignOffset(defaultOffset, mobileOffset) {
842
+ const styles = {};
843
+ [
844
+ defaultOffset,
845
+ mobileOffset
846
+ ].forEach((offset, index)=>{
847
+ const isMobile = index === 1;
848
+ const prefix = isMobile ? '--mobile-offset' : '--offset';
849
+ const defaultValue = isMobile ? MOBILE_VIEWPORT_OFFSET : VIEWPORT_OFFSET;
850
+ function assignAll(offset) {
851
+ [
852
+ 'top',
853
+ 'right',
854
+ 'bottom',
855
+ 'left'
856
+ ].forEach((key)=>{
857
+ styles[`${prefix}-${key}`] = typeof offset === 'number' ? `${offset}px` : offset;
858
+ });
859
+ }
860
+ if (typeof offset === 'number' || typeof offset === 'string') {
861
+ assignAll(offset);
862
+ } else if (typeof offset === 'object') {
863
+ [
864
+ 'top',
865
+ 'right',
866
+ 'bottom',
867
+ 'left'
868
+ ].forEach((key)=>{
869
+ if (offset[key] === undefined) {
870
+ styles[`${prefix}-${key}`] = defaultValue;
871
+ } else {
872
+ styles[`${prefix}-${key}`] = typeof offset[key] === 'number' ? `${offset[key]}px` : offset[key];
873
+ }
874
+ });
875
+ } else {
876
+ assignAll(defaultValue);
877
+ }
878
+ });
879
+ return styles;
880
+ }
881
+ const Toaster = /*#__PURE__*/ React__default.default.forwardRef(function Toaster(props, ref) {
882
+ const { id, invert, position = 'bottom-right', hotkey = [
883
+ 'altKey',
884
+ 'KeyT'
885
+ ], expand, closeButton, className, offset, mobileOffset, theme = 'light', richColors, duration, style, visibleToasts = VISIBLE_TOASTS_AMOUNT, toastOptions, dir = getDocumentDirection(), gap = GAP, icons, containerAriaLabel = 'Notifications' } = props;
886
+ const [toasts, setToasts] = React__default.default.useState([]);
887
+ const filteredToasts = React__default.default.useMemo(()=>{
888
+ if (id) {
889
+ return toasts.filter((toast)=>toast.toasterId === id);
890
+ }
891
+ return toasts.filter((toast)=>!toast.toasterId);
892
+ }, [
893
+ toasts,
894
+ id
895
+ ]);
896
+ const possiblePositions = React__default.default.useMemo(()=>{
897
+ return Array.from(new Set([
898
+ position
899
+ ].concat(filteredToasts.filter((toast)=>toast.position).map((toast)=>toast.position))));
900
+ }, [
901
+ filteredToasts,
902
+ position
903
+ ]);
904
+ const [heights, setHeights] = React__default.default.useState([]);
905
+ const [expanded, setExpanded] = React__default.default.useState(false);
906
+ const [interacting, setInteracting] = React__default.default.useState(false);
907
+ const [actualTheme, setActualTheme] = React__default.default.useState(theme !== 'system' ? theme : typeof window !== 'undefined' ? window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light' : 'light');
908
+ const listRef = React__default.default.useRef(null);
909
+ const hotkeyLabel = hotkey.join('+').replace(/Key/g, '').replace(/Digit/g, '');
910
+ const lastFocusedElementRef = React__default.default.useRef(null);
911
+ const isFocusWithinRef = React__default.default.useRef(false);
912
+ const removeToast = React__default.default.useCallback((toastToRemove)=>{
913
+ setToasts((toasts)=>{
914
+ var _toasts_find;
915
+ if (!((_toasts_find = toasts.find((toast)=>toast.id === toastToRemove.id)) == null ? void 0 : _toasts_find.delete)) {
916
+ ToastState.dismiss(toastToRemove.id);
917
+ }
918
+ return toasts.filter(({ id })=>id !== toastToRemove.id);
919
+ });
920
+ }, []);
921
+ React__default.default.useEffect(()=>{
922
+ return ToastState.subscribe((toast)=>{
923
+ if (toast.dismiss) {
924
+ // Prevent batching of other state updates
925
+ requestAnimationFrame(()=>{
926
+ setToasts((toasts)=>toasts.map((t)=>t.id === toast.id ? {
927
+ ...t,
928
+ delete: true
929
+ } : t));
930
+ });
931
+ return;
932
+ }
933
+ // Prevent batching, temp solution.
934
+ setTimeout(()=>{
935
+ ReactDOM__default.default.flushSync(()=>{
936
+ setToasts((toasts)=>{
937
+ const indexOfExistingToast = toasts.findIndex((t)=>t.id === toast.id);
938
+ // Update the toast if it already exists
939
+ if (indexOfExistingToast !== -1) {
940
+ return [
941
+ ...toasts.slice(0, indexOfExistingToast),
942
+ {
943
+ ...toasts[indexOfExistingToast],
944
+ ...toast
945
+ },
946
+ ...toasts.slice(indexOfExistingToast + 1)
947
+ ];
948
+ }
949
+ return [
950
+ toast,
951
+ ...toasts
952
+ ];
953
+ });
954
+ });
955
+ });
956
+ });
957
+ }, [
958
+ toasts
959
+ ]);
960
+ React__default.default.useEffect(()=>{
961
+ if (theme !== 'system') {
962
+ setActualTheme(theme);
963
+ return;
964
+ }
965
+ if (theme === 'system') {
966
+ // check if current preference is dark
967
+ if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
968
+ // it's currently dark
969
+ setActualTheme('dark');
970
+ } else {
971
+ // it's not dark
972
+ setActualTheme('light');
973
+ }
974
+ }
975
+ if (typeof window === 'undefined') return;
976
+ const darkMediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
977
+ try {
978
+ // Chrome & Firefox
979
+ darkMediaQuery.addEventListener('change', ({ matches })=>{
980
+ if (matches) {
981
+ setActualTheme('dark');
982
+ } else {
983
+ setActualTheme('light');
984
+ }
985
+ });
986
+ } catch (error) {
987
+ // Safari < 14
988
+ darkMediaQuery.addListener(({ matches })=>{
989
+ try {
990
+ if (matches) {
991
+ setActualTheme('dark');
992
+ } else {
993
+ setActualTheme('light');
994
+ }
995
+ } catch (e) {
996
+ console.error(e);
997
+ }
998
+ });
999
+ }
1000
+ }, [
1001
+ theme
1002
+ ]);
1003
+ React__default.default.useEffect(()=>{
1004
+ // Ensure expanded is always false when no toasts are present / only one left
1005
+ if (toasts.length <= 1) {
1006
+ setExpanded(false);
1007
+ }
1008
+ }, [
1009
+ toasts
1010
+ ]);
1011
+ React__default.default.useEffect(()=>{
1012
+ const handleKeyDown = (event)=>{
1013
+ var _listRef_current;
1014
+ const isHotkeyPressed = hotkey.every((key)=>event[key] || event.code === key);
1015
+ if (isHotkeyPressed) {
1016
+ var _listRef_current1;
1017
+ setExpanded(true);
1018
+ (_listRef_current1 = listRef.current) == null ? void 0 : _listRef_current1.focus();
1019
+ }
1020
+ if (event.code === 'Escape' && (document.activeElement === listRef.current || ((_listRef_current = listRef.current) == null ? void 0 : _listRef_current.contains(document.activeElement)))) {
1021
+ setExpanded(false);
1022
+ }
1023
+ };
1024
+ document.addEventListener('keydown', handleKeyDown);
1025
+ return ()=>document.removeEventListener('keydown', handleKeyDown);
1026
+ }, [
1027
+ hotkey
1028
+ ]);
1029
+ React__default.default.useEffect(()=>{
1030
+ if (listRef.current) {
1031
+ return ()=>{
1032
+ if (lastFocusedElementRef.current) {
1033
+ lastFocusedElementRef.current.focus({
1034
+ preventScroll: true
1035
+ });
1036
+ lastFocusedElementRef.current = null;
1037
+ isFocusWithinRef.current = false;
1038
+ }
1039
+ };
1040
+ }
1041
+ }, [
1042
+ listRef.current
1043
+ ]);
1044
+ return(// Remove item from normal navigation flow, only available via hotkey
1045
+ /*#__PURE__*/ React__default.default.createElement("section", {
1046
+ ref: ref,
1047
+ "aria-label": `${containerAriaLabel} ${hotkeyLabel}`,
1048
+ tabIndex: -1,
1049
+ "aria-live": "polite",
1050
+ "aria-relevant": "additions text",
1051
+ "aria-atomic": "false",
1052
+ suppressHydrationWarning: true
1053
+ }, possiblePositions.map((position, index)=>{
1054
+ var _heights_;
1055
+ const [y, x] = position.split('-');
1056
+ if (!filteredToasts.length) return null;
1057
+ return /*#__PURE__*/ React__default.default.createElement("ol", {
1058
+ key: position,
1059
+ dir: dir === 'auto' ? getDocumentDirection() : dir,
1060
+ tabIndex: -1,
1061
+ ref: listRef,
1062
+ className: className,
1063
+ "data-sonner-toaster": true,
1064
+ "data-sonner-theme": actualTheme,
1065
+ "data-y-position": y,
1066
+ "data-x-position": x,
1067
+ style: {
1068
+ '--front-toast-height': `${((_heights_ = heights[0]) == null ? void 0 : _heights_.height) || 0}px`,
1069
+ '--width': `${TOAST_WIDTH}px`,
1070
+ '--gap': `${gap}px`,
1071
+ ...style,
1072
+ ...assignOffset(offset, mobileOffset)
1073
+ },
1074
+ onBlur: (event)=>{
1075
+ if (isFocusWithinRef.current && !event.currentTarget.contains(event.relatedTarget)) {
1076
+ isFocusWithinRef.current = false;
1077
+ if (lastFocusedElementRef.current) {
1078
+ lastFocusedElementRef.current.focus({
1079
+ preventScroll: true
1080
+ });
1081
+ lastFocusedElementRef.current = null;
1082
+ }
1083
+ }
1084
+ },
1085
+ onFocus: (event)=>{
1086
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1087
+ if (isNotDismissible) return;
1088
+ if (!isFocusWithinRef.current) {
1089
+ isFocusWithinRef.current = true;
1090
+ lastFocusedElementRef.current = event.relatedTarget;
1091
+ }
1092
+ },
1093
+ onMouseEnter: ()=>setExpanded(true),
1094
+ onMouseMove: ()=>setExpanded(true),
1095
+ onMouseLeave: ()=>{
1096
+ // Avoid setting expanded to false when interacting with a toast, e.g. swiping
1097
+ if (!interacting) {
1098
+ setExpanded(false);
1099
+ }
1100
+ },
1101
+ onDragEnd: ()=>setExpanded(false),
1102
+ onPointerDown: (event)=>{
1103
+ const isNotDismissible = event.target instanceof HTMLElement && event.target.dataset.dismissible === 'false';
1104
+ if (isNotDismissible) return;
1105
+ setInteracting(true);
1106
+ },
1107
+ onPointerUp: ()=>setInteracting(false)
1108
+ }, filteredToasts.filter((toast)=>!toast.position && index === 0 || toast.position === position).map((toast, index)=>{
1109
+ var _toastOptions_duration, _toastOptions_closeButton;
1110
+ return /*#__PURE__*/ React__default.default.createElement(Toast, {
1111
+ key: toast.id,
1112
+ icons: icons,
1113
+ index: index,
1114
+ toast: toast,
1115
+ defaultRichColors: richColors,
1116
+ duration: (_toastOptions_duration = toastOptions == null ? void 0 : toastOptions.duration) != null ? _toastOptions_duration : duration,
1117
+ className: toastOptions == null ? void 0 : toastOptions.className,
1118
+ descriptionClassName: toastOptions == null ? void 0 : toastOptions.descriptionClassName,
1119
+ invert: invert,
1120
+ visibleToasts: visibleToasts,
1121
+ closeButton: (_toastOptions_closeButton = toastOptions == null ? void 0 : toastOptions.closeButton) != null ? _toastOptions_closeButton : closeButton,
1122
+ interacting: interacting,
1123
+ position: position,
1124
+ style: toastOptions == null ? void 0 : toastOptions.style,
1125
+ unstyled: toastOptions == null ? void 0 : toastOptions.unstyled,
1126
+ classNames: toastOptions == null ? void 0 : toastOptions.classNames,
1127
+ cancelButtonStyle: toastOptions == null ? void 0 : toastOptions.cancelButtonStyle,
1128
+ actionButtonStyle: toastOptions == null ? void 0 : toastOptions.actionButtonStyle,
1129
+ closeButtonAriaLabel: toastOptions == null ? void 0 : toastOptions.closeButtonAriaLabel,
1130
+ removeToast: removeToast,
1131
+ toasts: filteredToasts.filter((t)=>t.position == toast.position),
1132
+ heights: heights.filter((h)=>h.position == toast.position),
1133
+ setHeights: setHeights,
1134
+ expandByDefault: expand,
1135
+ gap: gap,
1136
+ expanded: expanded,
1137
+ swipeDirections: props.swipeDirections
1138
+ });
1139
+ }));
1140
+ })));
1141
+ });
1142
+
1143
+ exports.Toaster = Toaster;
1144
+ exports.toast = toast;
1145
+ //# sourceMappingURL=index-Vlwnyfvs.js.map