@helpdice/ui 1.7.5 → 1.7.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 (304) hide show
  1. package/dist/CurrencyInput/index.js +2981 -0
  2. package/dist/LinearProgress/index.d.ts +2 -0
  3. package/dist/{css-baseline → LinearProgress}/index.js +25 -317
  4. package/dist/LinearProgress/linear-progress.d.ts +9 -0
  5. package/dist/Loadable/index.js +570 -0
  6. package/dist/PhoneInput/index.js +2136 -314
  7. package/dist/Placeholder/index.js +2116 -254
  8. package/dist/auto-complete/index.js +2145 -652
  9. package/dist/avatar/index.js +2119 -333
  10. package/dist/badge/index.js +2117 -331
  11. package/dist/breadcrumbs/index.js +2126 -340
  12. package/dist/button/button.compact.d.ts +2 -0
  13. package/dist/button/index.js +2214 -342
  14. package/dist/button-dropdown/index.js +2120 -291
  15. package/dist/button-group/index.js +2117 -331
  16. package/dist/capacity/index.js +2117 -331
  17. package/dist/card/index.js +2127 -298
  18. package/dist/checkbox/index.js +2119 -290
  19. package/dist/code/index.js +2116 -297
  20. package/dist/collapse/index.js +2117 -475
  21. package/dist/description/index.js +2117 -331
  22. package/dist/display/index.js +2117 -331
  23. package/dist/divider/index.js +2118 -332
  24. package/dist/dot/index.js +2117 -331
  25. package/dist/drawer/index.js +2129 -439
  26. package/dist/fieldset/index.js +2121 -354
  27. package/dist/grid/index.js +2119 -333
  28. package/dist/image/index.js +2122 -336
  29. package/dist/index.d.ts +2 -14
  30. package/dist/index.js +3175 -1879
  31. package/dist/input/index.js +2125 -296
  32. package/dist/keyboard/index.js +2116 -297
  33. package/dist/link/index.js +2117 -331
  34. package/dist/list/index.js +2119 -333
  35. package/dist/loading/index.js +2117 -331
  36. package/dist/menu/index.js +77 -45
  37. package/dist/modal/index.js +2145 -452
  38. package/dist/note/index.js +2117 -331
  39. package/dist/page/index.js +2117 -331
  40. package/dist/pagination/index.js +2118 -351
  41. package/dist/popover/index.js +2123 -354
  42. package/dist/progress/index.js +2117 -331
  43. package/dist/radio/index.js +2120 -334
  44. package/dist/rating/index.js +2118 -332
  45. package/dist/row/index.js +2115 -296
  46. package/dist/select/index.js +2151 -688
  47. package/dist/slider/index.js +2123 -356
  48. package/dist/snippet/index.js +2118 -421
  49. package/dist/spacer/index.js +2115 -296
  50. package/dist/spinner/index.js +2117 -331
  51. package/dist/table/index.js +2341 -754
  52. package/dist/tabs/index.js +2123 -344
  53. package/dist/tag/index.js +2116 -254
  54. package/dist/text/index.js +2116 -297
  55. package/dist/textarea/index.js +2117 -288
  56. package/dist/toggle/index.js +2117 -331
  57. package/dist/tooltip/index.js +2120 -351
  58. package/dist/tree/index.js +2123 -459
  59. package/dist/use-input/index.js +2122 -24
  60. package/dist/use-modal/index.js +2122 -24
  61. package/dist/use-network-status/index.d.ts +2 -0
  62. package/dist/{use-current-state → use-network-status}/index.js +22 -15
  63. package/dist/use-network-status/use-netowork-status.d.ts +4 -0
  64. package/dist/use-scale/index.js +2115 -296
  65. package/dist/use-tabs/index.js +2122 -24
  66. package/dist/user/index.js +2123 -337
  67. package/esm/CurrencyInput/components/CurrencyInput.js +342 -0
  68. package/esm/CurrencyInput/components/CurrencyInputProps.js +1 -0
  69. package/esm/CurrencyInput/components/utils/addSeparators.js +7 -0
  70. package/esm/CurrencyInput/components/utils/cleanValue.js +69 -0
  71. package/esm/CurrencyInput/components/utils/escapeRegExp.js +8 -0
  72. package/esm/CurrencyInput/components/utils/fixedDecimalValue.js +29 -0
  73. package/esm/CurrencyInput/components/utils/formatValue.js +124 -0
  74. package/esm/CurrencyInput/components/utils/getLocaleConfig.js +47 -0
  75. package/esm/CurrencyInput/components/utils/getSuffix.js +10 -0
  76. package/esm/CurrencyInput/components/utils/index.js +8 -0
  77. package/esm/CurrencyInput/components/utils/isNumber.js +3 -0
  78. package/esm/CurrencyInput/components/utils/padTrimValue.js +27 -0
  79. package/esm/CurrencyInput/components/utils/parseAbbrValue.js +43 -0
  80. package/esm/CurrencyInput/components/utils/removeInvalidChars.js +10 -0
  81. package/esm/CurrencyInput/components/utils/removeSeparators.js +10 -0
  82. package/esm/CurrencyInput/components/utils/repositionCursor.js +35 -0
  83. package/esm/CurrencyInput/index.js +4 -0
  84. package/esm/LinearProgress/index.d.ts +2 -0
  85. package/esm/LinearProgress/index.js +2 -0
  86. package/esm/LinearProgress/linear-progress.d.ts +9 -0
  87. package/esm/LinearProgress/linear-progress.js +28 -0
  88. package/esm/Loadable/index.js +2 -0
  89. package/esm/PhoneInput/phone.js +22 -19
  90. package/esm/auto-complete/auto-complete-dropdown.js +1 -3
  91. package/esm/auto-complete/auto-complete-item.js +1 -3
  92. package/esm/auto-complete/auto-complete-searching.js +1 -1
  93. package/esm/auto-complete/auto-complete.js +1 -1
  94. package/esm/avatar/avatar-group.js +1 -2
  95. package/esm/avatar/avatar.js +1 -2
  96. package/esm/badge/badge.js +1 -2
  97. package/esm/breadcrumbs/breadcrumbs-item.js +1 -1
  98. package/esm/breadcrumbs/breadcrumbs-separator.js +1 -1
  99. package/esm/breadcrumbs/breadcrumbs.js +1 -1
  100. package/esm/button/button-icon.js +1 -1
  101. package/esm/button/button.compact.d.ts +2 -0
  102. package/esm/button/button.compact.js +94 -50
  103. package/esm/button/button.js +1 -2
  104. package/esm/button/utils.js +1 -1
  105. package/esm/button-dropdown/button-dropdown-item.js +1 -1
  106. package/esm/button-dropdown/button-dropdown.js +1 -2
  107. package/esm/button-group/button-group.js +1 -2
  108. package/esm/capacity/capacity.js +1 -2
  109. package/esm/card/card-content.js +1 -1
  110. package/esm/card/card-footer.js +1 -2
  111. package/esm/card/card.js +1 -2
  112. package/esm/carousal/Arrow.js +18 -0
  113. package/esm/carousal/Indicator.js +20 -0
  114. package/esm/carousal/Thumbs.js +302 -0
  115. package/esm/carousal/animations.js +162 -0
  116. package/esm/carousal/index.js +683 -0
  117. package/esm/carousal/types.js +1 -0
  118. package/esm/carousal/utils.js +49 -0
  119. package/esm/checkbox/checkbox-group.js +1 -1
  120. package/esm/checkbox/checkbox.icon.js +1 -1
  121. package/esm/checkbox/checkbox.js +1 -2
  122. package/esm/code/code.js +1 -1
  123. package/esm/collapse/collapse-group.js +1 -2
  124. package/esm/collapse/collapse.js +1 -4
  125. package/esm/description/description.js +1 -2
  126. package/esm/display/display.js +1 -2
  127. package/esm/divider/divider.js +1 -2
  128. package/esm/dot/dot.js +1 -2
  129. package/esm/drawer/drawer-wrapper.js +1 -3
  130. package/esm/drawer/drawer.js +1 -1
  131. package/esm/fieldset/fieldset-content.js +1 -1
  132. package/esm/fieldset/fieldset-footer.js +1 -1
  133. package/esm/fieldset/fieldset-group.js +1 -3
  134. package/esm/fieldset/fieldset-title.js +1 -1
  135. package/esm/fieldset/fieldset.js +1 -2
  136. package/esm/grid/basic-item.js +1 -2
  137. package/esm/grid/grid-container.js +1 -1
  138. package/esm/grid/grid.js +1 -1
  139. package/esm/image/image-browser.js +1 -2
  140. package/esm/image/image.js +1 -2
  141. package/esm/image/image.skeleton.js +1 -1
  142. package/esm/index.d.ts +2 -14
  143. package/esm/index.js +5 -9
  144. package/esm/input/input-block-label.js +1 -1
  145. package/esm/input/input-icon-clear.js +1 -2
  146. package/esm/input/input-label.js +1 -1
  147. package/esm/input/input.js +1 -2
  148. package/esm/keyboard/keyboard.js +1 -1
  149. package/esm/link/link.js +1 -2
  150. package/esm/list/list-item.js +1 -2
  151. package/esm/loading/loading.js +1 -2
  152. package/esm/modal/modal-action.js +1 -2
  153. package/esm/modal/modal-actions.js +1 -1
  154. package/esm/modal/modal-content.js +1 -1
  155. package/esm/modal/modal-subtitle.js +1 -1
  156. package/esm/modal/modal-title.js +1 -1
  157. package/esm/modal/modal-wrapper.js +1 -3
  158. package/esm/modal/modal.js +1 -1
  159. package/esm/note/note.js +1 -2
  160. package/esm/page/page-header.js +1 -1
  161. package/esm/page/page.js +1 -1
  162. package/esm/pagination/pagination-item.js +1 -2
  163. package/esm/pagination/pagination.js +1 -1
  164. package/esm/popover/popover-item.js +1 -2
  165. package/esm/popover/popover.js +1 -1
  166. package/esm/progress/progress.js +1 -2
  167. package/esm/radio/radio-description.js +1 -1
  168. package/esm/radio/radio-group.js +1 -1
  169. package/esm/radio/radio.js +1 -2
  170. package/esm/rating/rating.js +1 -2
  171. package/esm/row/row.js +1 -1
  172. package/esm/select/select-dropdown.js +1 -3
  173. package/esm/select/select-icon-clear.js +1 -1
  174. package/esm/select/select-multiple-value.js +1 -1
  175. package/esm/select/select-option.js +1 -3
  176. package/esm/select/select.js +9 -12
  177. package/esm/slider/slider-dot.js +1 -2
  178. package/esm/slider/slider-mark.js +1 -1
  179. package/esm/slider/slider.js +1 -3
  180. package/esm/snippet/snippet.js +1 -3
  181. package/esm/spinner/spinner.js +1 -2
  182. package/esm/table/table-body.js +1 -2
  183. package/esm/table/table-head.js +3 -2
  184. package/esm/tabs/tabs-item.js +1 -2
  185. package/esm/tabs/tabs.js +1 -3
  186. package/esm/tag/tag.js +1 -1
  187. package/esm/text/child.js +1 -1
  188. package/esm/textarea/textarea.js +1 -2
  189. package/esm/toggle/toggle.js +1 -2
  190. package/esm/tooltip/tooltip-content.js +1 -3
  191. package/esm/tooltip/tooltip-icon.js +1 -1
  192. package/esm/tooltip/tooltip.js +1 -1
  193. package/esm/tree/tree-file-icon.js +1 -1
  194. package/esm/tree/tree-file.js +1 -2
  195. package/esm/tree/tree-folder-icon.js +1 -1
  196. package/esm/tree/tree-folder.js +1 -3
  197. package/esm/tree/tree-status-icon.js +1 -1
  198. package/esm/tree/tree.js +1 -1
  199. package/esm/use-input/use-input.js +1 -1
  200. package/esm/use-modal/use-modal.js +1 -1
  201. package/esm/use-network-status/index.d.ts +2 -0
  202. package/esm/use-network-status/index.js +2 -0
  203. package/esm/use-network-status/use-netowork-status.d.ts +4 -0
  204. package/esm/use-network-status/use-netowork-status.js +29 -0
  205. package/esm/use-scale/with-scale.js +1 -1
  206. package/esm/use-tabs/use-tabs.js +1 -1
  207. package/esm/user/user.js +1 -2
  208. package/esm/utils/use-context-state/use-context-state.js +1 -1
  209. package/esm/utils/use-drag.js +1 -1
  210. package/package.json +12 -4
  211. package/dist/css-baseline/css-baseline.d.ts +0 -9
  212. package/dist/css-baseline/index.d.ts +0 -1
  213. package/dist/shared/backdrop.d.ts +0 -14
  214. package/dist/shared/css-transition.d.ts +0 -13
  215. package/dist/shared/dropdown.d.ts +0 -9
  216. package/dist/shared/ellipsis.d.ts +0 -6
  217. package/dist/shared/expand.d.ts +0 -7
  218. package/dist/shared/highlight.d.ts +0 -13
  219. package/dist/ui-provider/index.d.ts +0 -3
  220. package/dist/ui-provider/index.js +0 -2186
  221. package/dist/ui-provider/theme-provider.d.ts +0 -8
  222. package/dist/ui-provider/ui-provider.d.ts +0 -8
  223. package/dist/use-all-themes/all-themes-context.d.ts +0 -7
  224. package/dist/use-all-themes/index.d.ts +0 -3
  225. package/dist/use-all-themes/index.js +0 -311
  226. package/dist/use-classes/index.d.ts +0 -2
  227. package/dist/use-classes/index.js +0 -48
  228. package/dist/use-classes/use-classes.d.ts +0 -4
  229. package/dist/use-current-state/index.d.ts +0 -2
  230. package/dist/use-current-state/use-current-state.d.ts +0 -4
  231. package/dist/use-media-query/index.d.ts +0 -3
  232. package/dist/use-media-query/index.js +0 -444
  233. package/dist/use-media-query/use-media-query.d.ts +0 -12
  234. package/dist/use-theme/index.d.ts +0 -2
  235. package/dist/use-theme/index.js +0 -309
  236. package/dist/use-theme/theme-context.d.ts +0 -4
  237. package/dist/use-toasts/helpers.d.ts +0 -18
  238. package/dist/use-toasts/index.d.ts +0 -3
  239. package/dist/use-toasts/index.js +0 -204
  240. package/dist/use-toasts/toast-container.d.ts +0 -3
  241. package/dist/use-toasts/toast-item.d.ts +0 -8
  242. package/dist/use-toasts/use-toast.d.ts +0 -40
  243. package/dist/utils/use-current-state.d.ts +0 -2
  244. package/dist/utils/use-dom-observer.d.ts +0 -3
  245. package/dist/utils/use-hd-ui-context.d.ts +0 -16
  246. package/dist/utils/use-previous.d.ts +0 -2
  247. package/esm/captcha/index.js +0 -128
  248. package/esm/css-baseline/css-baseline.d.ts +0 -9
  249. package/esm/css-baseline/css-baseline.js +0 -23
  250. package/esm/css-baseline/index.d.ts +0 -1
  251. package/esm/css-baseline/index.js +0 -2
  252. package/esm/shared/backdrop.d.ts +0 -14
  253. package/esm/shared/backdrop.js +0 -66
  254. package/esm/shared/css-transition.d.ts +0 -13
  255. package/esm/shared/css-transition.js +0 -65
  256. package/esm/shared/dropdown.d.ts +0 -9
  257. package/esm/shared/dropdown.js +0 -99
  258. package/esm/shared/ellipsis.d.ts +0 -6
  259. package/esm/shared/ellipsis.js +0 -13
  260. package/esm/shared/expand.d.ts +0 -7
  261. package/esm/shared/expand.js +0 -86
  262. package/esm/shared/highlight.d.ts +0 -13
  263. package/esm/shared/highlight.js +0 -46
  264. package/esm/ui-provider/index.d.ts +0 -3
  265. package/esm/ui-provider/index.js +0 -4
  266. package/esm/ui-provider/theme-provider.d.ts +0 -8
  267. package/esm/ui-provider/theme-provider.js +0 -45
  268. package/esm/ui-provider/ui-provider.d.ts +0 -8
  269. package/esm/ui-provider/ui-provider.js +0 -55
  270. package/esm/use-all-themes/all-themes-context.d.ts +0 -7
  271. package/esm/use-all-themes/all-themes-context.js +0 -11
  272. package/esm/use-all-themes/index.d.ts +0 -3
  273. package/esm/use-all-themes/index.js +0 -2
  274. package/esm/use-classes/index.d.ts +0 -2
  275. package/esm/use-classes/index.js +0 -2
  276. package/esm/use-classes/use-classes.d.ts +0 -4
  277. package/esm/use-classes/use-classes.js +0 -34
  278. package/esm/use-current-state/index.d.ts +0 -2
  279. package/esm/use-current-state/index.js +0 -2
  280. package/esm/use-current-state/use-current-state.d.ts +0 -4
  281. package/esm/use-current-state/use-current-state.js +0 -23
  282. package/esm/use-media-query/index.d.ts +0 -3
  283. package/esm/use-media-query/index.js +0 -2
  284. package/esm/use-media-query/use-media-query.d.ts +0 -12
  285. package/esm/use-media-query/use-media-query.js +0 -81
  286. package/esm/use-theme/index.d.ts +0 -2
  287. package/esm/use-theme/index.js +0 -2
  288. package/esm/use-theme/theme-context.d.ts +0 -4
  289. package/esm/use-theme/theme-context.js +0 -9
  290. package/esm/use-toasts/helpers.d.ts +0 -18
  291. package/esm/use-toasts/helpers.js +0 -68
  292. package/esm/use-toasts/index.d.ts +0 -3
  293. package/esm/use-toasts/index.js +0 -2
  294. package/esm/use-toasts/toast-container.d.ts +0 -3
  295. package/esm/use-toasts/toast-container.js +0 -120
  296. package/esm/use-toasts/toast-item.d.ts +0 -8
  297. package/esm/use-toasts/toast-item.js +0 -45
  298. package/esm/use-toasts/use-toast.d.ts +0 -40
  299. package/esm/use-toasts/use-toast.js +0 -103
  300. package/esm/utils/use-current-state.d.ts +0 -2
  301. package/esm/utils/use-current-state.js +0 -2
  302. package/esm/utils/use-dom-observer.d.ts +0 -3
  303. package/esm/utils/use-hd-ui-context.d.ts +0 -16
  304. package/esm/utils/use-previous.d.ts +0 -2
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var React = require('react');
6
+ var require$$1 = require('react-dom');
6
7
 
7
8
  function _arrayLikeToArray(r, a) {
8
9
  (null == a || a > r.length) && (a = r.length);
@@ -57,14 +58,6 @@ function _createForOfIteratorHelper(r, e) {
57
58
  }
58
59
  };
59
60
  }
60
- function _defineProperty(e, r, t) {
61
- return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
62
- value: t,
63
- enumerable: true,
64
- configurable: true,
65
- writable: true
66
- }) : e[r] = t, e;
67
- }
68
61
  function _extends() {
69
62
  return _extends = Object.assign ? Object.assign.bind() : function (n) {
70
63
  for (var e = 1; e < arguments.length; e++) {
@@ -74,27 +67,6 @@ function _extends() {
74
67
  return n;
75
68
  }, _extends.apply(null, arguments);
76
69
  }
77
- function ownKeys(e, r) {
78
- var t = Object.keys(e);
79
- if (Object.getOwnPropertySymbols) {
80
- var o = Object.getOwnPropertySymbols(e);
81
- r && (o = o.filter(function (r) {
82
- return Object.getOwnPropertyDescriptor(e, r).enumerable;
83
- })), t.push.apply(t, o);
84
- }
85
- return t;
86
- }
87
- function _objectSpread2(e) {
88
- for (var r = 1; r < arguments.length; r++) {
89
- var t = null != arguments[r] ? arguments[r] : {};
90
- r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
91
- _defineProperty(e, r, t[r]);
92
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
93
- Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
94
- });
95
- }
96
- return e;
97
- }
98
70
  function _objectWithoutProperties(e, t) {
99
71
  if (null == e) return {};
100
72
  var o,
@@ -115,29 +87,6 @@ function _objectWithoutPropertiesLoose(r, e) {
115
87
  }
116
88
  return t;
117
89
  }
118
- function _toPrimitive(t, r) {
119
- if ("object" != typeof t || !t) return t;
120
- var e = t[Symbol.toPrimitive];
121
- if (void 0 !== e) {
122
- var i = e.call(t, r);
123
- if ("object" != typeof i) return i;
124
- throw new TypeError("@@toPrimitive must return a primitive value.");
125
- }
126
- return ("string" === r ? String : Number)(t);
127
- }
128
- function _toPropertyKey(t) {
129
- var i = _toPrimitive(t, "string");
130
- return "symbol" == typeof i ? i : i + "";
131
- }
132
- function _typeof(o) {
133
- "@babel/helpers - typeof";
134
-
135
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
136
- return typeof o;
137
- } : function (o) {
138
- return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
139
- }, _typeof(o);
140
- }
141
90
  function _unsupportedIterableToArray(r, a) {
142
91
  if (r) {
143
92
  if ("string" == typeof r) return _arrayLikeToArray(r, a);
@@ -689,254 +638,2124 @@ function requireStyle () {
689
638
  var styleExports = requireStyle();
690
639
  var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
691
640
 
692
- var defaultFont = {
693
- sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
694
- mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
695
- prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
696
- };
697
- var defaultBreakpoints = {
698
- xs: {
699
- min: '0',
700
- max: '650px'
701
- },
702
- sm: {
703
- min: '650px',
704
- max: '900px'
705
- },
706
- md: {
707
- min: '900px',
708
- max: '1280px'
709
- },
710
- lg: {
711
- min: '1280px',
712
- max: '1920px'
713
- },
714
- xl: {
715
- min: '1920px',
716
- max: '10000px'
717
- }
718
- };
719
- var defaultLayout = {
720
- gap: '16pt',
721
- gapNegative: '-16pt',
722
- gapHalf: '8pt',
723
- gapHalfNegative: '-8pt',
724
- gapQuarter: '4pt',
725
- gapQuarterNegative: '-4pt',
726
- pageMargin: '16pt',
727
- pageWidth: '750pt',
728
- pageWidthWithMargin: '782pt',
729
- breakpointMobile: defaultBreakpoints.xs.max,
730
- breakpointTablet: defaultBreakpoints.sm.max,
731
- radius: '6px',
732
- unit: '16px'
733
- };
641
+ var dist = {};
734
642
 
735
- var palette$1 = {
736
- accents_1: '#fafafa',
737
- accents_2: '#eaeaea',
738
- accents_3: '#999',
739
- accents_4: '#888',
740
- accents_5: '#666',
741
- accents_6: '#444',
742
- accents_7: '#333',
743
- accents_8: '#111',
744
- background: '#fff',
745
- foreground: '#000',
746
- selection: '#79ffe1',
747
- secondary: '#666',
748
- code: '#f81ce5',
749
- border: '#eaeaea',
750
- error: '#e00',
751
- errorLight: '#ff1a1a',
752
- errorLighter: '#f7d4d6',
753
- errorDark: '#c50000',
754
- success: '#0070f3',
755
- successLight: '#3291ff',
756
- successLighter: '#d3e5ff',
757
- successDark: '#0761d1',
758
- warning: '#f5a623',
759
- warningLight: '#f7b955',
760
- warningLighter: '#ffefcf',
761
- warningDark: '#ab570a',
762
- cyan: '#50e3c2',
763
- cyanLighter: '#aaffec',
764
- cyanLight: '#79ffe1',
765
- cyanDark: '#29bc9b',
766
- violet: '#7928ca',
767
- violetLighter: '#e3d7fc',
768
- violetLight: '#8a63d2',
769
- violetDark: '#4c2889',
770
- purple: '#f81ce5',
771
- alert: '#ff0080',
772
- magenta: '#eb367f',
773
- link: '#0070f3'
774
- };
775
- var expressiveness$1 = {
776
- linkStyle: 'none',
777
- linkHoverStyle: 'none',
778
- dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
779
- scrollerStart: 'rgba(255, 255, 255, 1)',
780
- scrollerEnd: 'rgba(255, 255, 255, 0)',
781
- shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
782
- shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
783
- shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
784
- portalOpacity: 0.25
785
- };
786
- var font$1 = defaultFont;
787
- var breakpoints$1 = defaultBreakpoints;
788
- var layout$1 = defaultLayout;
789
- var themes$1 = {
790
- type: 'light',
791
- font: font$1,
792
- layout: layout$1,
793
- palette: palette$1,
794
- breakpoints: breakpoints$1,
795
- expressiveness: expressiveness$1
796
- };
643
+ var hasRequiredDist;
797
644
 
798
- var palette = {
799
- accents_1: '#111',
800
- accents_2: '#333',
801
- accents_3: '#444',
802
- accents_4: '#666',
803
- accents_5: '#888',
804
- accents_6: '#999',
805
- accents_7: '#eaeaea',
806
- accents_8: '#fafafa',
807
- background: '#000',
808
- foreground: '#fff',
809
- selection: '#f81ce5',
810
- secondary: '#888',
811
- code: '#79ffe1',
812
- border: '#333',
813
- error: '#e00',
814
- errorLighter: '#f7d4d6',
815
- errorLight: '#ff1a1a',
816
- errorDark: '#c50000',
817
- success: '#0070f3',
818
- successLighter: '#d3e5ff',
819
- successLight: '#3291ff',
820
- successDark: '#0761d1',
821
- warning: '#f5a623',
822
- warningLighter: '#ffefcf',
823
- warningLight: '#f7b955',
824
- warningDark: '#ab570a',
825
- cyan: '#50e3c2',
826
- cyanLighter: '#aaffec',
827
- cyanLight: '#79ffe1',
828
- cyanDark: '#29bc9b',
829
- violet: '#7928ca',
830
- violetLighter: '#e3d7fc',
831
- violetLight: '#8a63d2',
832
- violetDark: '#4c2889',
833
- purple: '#f81ce5',
834
- alert: '#ff0080',
835
- magenta: '#eb367f',
836
- link: '#3291ff'
837
- };
838
- var expressiveness = {
839
- linkStyle: 'none',
840
- linkHoverStyle: 'none',
841
- dropdownBoxShadow: '0 0 0 1px #333',
842
- scrollerStart: 'rgba(255, 255, 255, 1)',
843
- scrollerEnd: 'rgba(255, 255, 255, 0)',
844
- shadowSmall: '0 0 0 1px #333',
845
- shadowMedium: '0 0 0 1px #333',
846
- shadowLarge: '0 0 0 1px #333',
847
- portalOpacity: 0.75
848
- };
849
- var font = defaultFont;
850
- var breakpoints = defaultBreakpoints;
851
- var layout = defaultLayout;
852
- var themes = {
853
- type: 'dark',
854
- font: font,
855
- layout: layout,
856
- palette: palette,
857
- breakpoints: breakpoints,
858
- expressiveness: expressiveness
859
- };
645
+ function requireDist () {
646
+ if (hasRequiredDist) return dist;
647
+ hasRequiredDist = 1;
860
648
 
861
- var isObject = function isObject(target) {
862
- return target && _typeof(target) === 'object';
863
- };
864
- var _deepDuplicable = function deepDuplicable(source, target) {
865
- if (!isObject(target) || !isObject(source)) return source;
866
- var sourceKeys = Object.keys(source);
867
- var result = {};
868
- for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
869
- var key = _sourceKeys[_i];
870
- var sourceValue = source[key];
871
- var targetValue = target[key];
872
- if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
873
- result[key] = targetValue.concat(sourceValue);
874
- } else if (isObject(sourceValue) && isObject(targetValue)) {
875
- result[key] = _deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
876
- } else if (targetValue) {
877
- result[key] = targetValue;
878
- } else {
879
- result[key] = sourceValue;
880
- }
881
- }
882
- return result;
883
- };
884
- var getPresets = function getPresets() {
885
- return [themes$1, themes];
886
- };
887
- var getPresetStaticTheme = function getPresetStaticTheme() {
888
- return themes$1;
889
- };
890
- var isAvailableThemeType = function isAvailableThemeType(type) {
891
- if (!type) return false;
892
- var presetThemes = getPresets();
893
- var hasType = presetThemes.find(function (theme) {
894
- return theme.type === type;
895
- });
896
- return !hasType;
897
- };
898
- var isPresetTheme = function isPresetTheme(themeOrType) {
899
- if (!themeOrType) return false;
900
- var isType = typeof themeOrType === 'string';
901
- var type = isType ? themeOrType : themeOrType.type;
902
- return !isAvailableThemeType(type);
903
- };
904
- var hasUserCustomTheme = function hasUserCustomTheme() {
905
- var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
906
- return !!themes.find(function (item) {
907
- return isAvailableThemeType(item.type);
908
- });
909
- };
910
- var create = function create(base, custom) {
911
- if (!isAvailableThemeType(custom.type)) {
912
- throw new Error('Duplicate or unavailable theme type');
913
- }
914
- return _deepDuplicable(base, custom);
915
- };
916
- var createFromDark = function createFromDark(custom) {
917
- return create(themes, custom);
918
- };
919
- var createFromLight = function createFromLight(custom) {
920
- return create(themes$1, custom);
921
- };
922
- var Themes = {
923
- isPresetTheme: isPresetTheme,
924
- isAvailableThemeType: isAvailableThemeType,
925
- hasUserCustomTheme: hasUserCustomTheme,
926
- getPresets: getPresets,
927
- getPresetStaticTheme: getPresetStaticTheme,
928
- create: create,
929
- createFromDark: createFromDark,
930
- createFromLight: createFromLight
931
- };
649
+ var React$1 = React;
650
+ var reactDom = require$$1;
932
651
 
933
- /* "use client" */
652
+ function _arrayLikeToArray(r, a) {
653
+ (null == a || a > r.length) && (a = r.length);
654
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
655
+ return n;
656
+ }
657
+ function _arrayWithHoles(r) {
658
+ if (Array.isArray(r)) return r;
659
+ }
660
+ function _arrayWithoutHoles(r) {
661
+ if (Array.isArray(r)) return _arrayLikeToArray(r);
662
+ }
663
+ function _defineProperty(e, r, t) {
664
+ return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
665
+ value: t,
666
+ enumerable: true,
667
+ configurable: true,
668
+ writable: true
669
+ }) : e[r] = t, e;
670
+ }
671
+ function _extends() {
672
+ return _extends = Object.assign ? Object.assign.bind() : function (n) {
673
+ for (var e = 1; e < arguments.length; e++) {
674
+ var t = arguments[e];
675
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
676
+ }
677
+ return n;
678
+ }, _extends.apply(null, arguments);
679
+ }
680
+ function _iterableToArray(r) {
681
+ if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
682
+ }
683
+ function _iterableToArrayLimit(r, l) {
684
+ var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
685
+ if (null != t) {
686
+ var e,
687
+ n,
688
+ i,
689
+ u,
690
+ a = [],
691
+ f = true,
692
+ o = false;
693
+ try {
694
+ if (i = (t = t.call(r)).next, 0 === l) {
695
+ if (Object(t) !== t) return;
696
+ f = !1;
697
+ } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
698
+ } catch (r) {
699
+ o = true, n = r;
700
+ } finally {
701
+ try {
702
+ if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
703
+ } finally {
704
+ if (o) throw n;
705
+ }
706
+ }
707
+ return a;
708
+ }
709
+ }
710
+ function _nonIterableRest() {
711
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
712
+ }
713
+ function _nonIterableSpread() {
714
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
715
+ }
716
+ function ownKeys(e, r) {
717
+ var t = Object.keys(e);
718
+ if (Object.getOwnPropertySymbols) {
719
+ var o = Object.getOwnPropertySymbols(e);
720
+ r && (o = o.filter(function (r) {
721
+ return Object.getOwnPropertyDescriptor(e, r).enumerable;
722
+ })), t.push.apply(t, o);
723
+ }
724
+ return t;
725
+ }
726
+ function _objectSpread2(e) {
727
+ for (var r = 1; r < arguments.length; r++) {
728
+ var t = null != arguments[r] ? arguments[r] : {};
729
+ r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
730
+ _defineProperty(e, r, t[r]);
731
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
732
+ Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
733
+ });
734
+ }
735
+ return e;
736
+ }
737
+ function _objectWithoutProperties(e, t) {
738
+ if (null == e) return {};
739
+ var o,
740
+ r,
741
+ i = _objectWithoutPropertiesLoose(e, t);
742
+ if (Object.getOwnPropertySymbols) {
743
+ var n = Object.getOwnPropertySymbols(e);
744
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
745
+ }
746
+ return i;
747
+ }
748
+ function _objectWithoutPropertiesLoose(r, e) {
749
+ if (null == r) return {};
750
+ var t = {};
751
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
752
+ if (-1 !== e.indexOf(n)) continue;
753
+ t[n] = r[n];
754
+ }
755
+ return t;
756
+ }
757
+ function _slicedToArray(r, e) {
758
+ return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
759
+ }
760
+ function _toConsumableArray(r) {
761
+ return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
762
+ }
763
+ function _toPrimitive(t, r) {
764
+ if ("object" != typeof t || !t) return t;
765
+ var e = t[Symbol.toPrimitive];
766
+ if (void 0 !== e) {
767
+ var i = e.call(t, r);
768
+ if ("object" != typeof i) return i;
769
+ throw new TypeError("@@toPrimitive must return a primitive value.");
770
+ }
771
+ return ("string" === r ? String : Number)(t);
772
+ }
773
+ function _toPropertyKey(t) {
774
+ var i = _toPrimitive(t, "string");
775
+ return "symbol" == typeof i ? i : i + "";
776
+ }
777
+ function _typeof(o) {
778
+ "@babel/helpers - typeof";
934
779
 
935
- var defaultTheme = Themes.getPresetStaticTheme();
936
- var ThemeContext = /*#__PURE__*/React.createContext(defaultTheme);
937
- var useTheme = function useTheme() {
938
- return React.useContext(ThemeContext);
939
- };
780
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
781
+ return typeof o;
782
+ } : function (o) {
783
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
784
+ }, _typeof(o);
785
+ }
786
+ function _unsupportedIterableToArray(r, a) {
787
+ if (r) {
788
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
789
+ var t = {}.toString.call(r).slice(8, -1);
790
+ return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
791
+ }
792
+ }
793
+
794
+ var defaultToastLayout = {
795
+ padding: '12px 16px',
796
+ margin: '8px 0',
797
+ width: '420px',
798
+ maxWidth: '90vw',
799
+ maxHeight: '75px',
800
+ placement: 'bottomRight'
801
+ };
802
+ var defaultParams = {
803
+ toasts: [],
804
+ toastLayout: defaultToastLayout,
805
+ updateToastLayout: function updateToastLayout(t) {
806
+ return t;
807
+ },
808
+ updateToasts: function updateToasts(t) {
809
+ return t;
810
+ },
811
+ lastUpdateToastId: null,
812
+ updateLastToastId: function updateLastToastId() {
813
+ return null;
814
+ }
815
+ };
816
+ var HUIContent = /*#__PURE__*/React$1.createContext(defaultParams);
817
+ var useHUIContext = function useHUIContext() {
818
+ return React$1.useContext(HUIContent);
819
+ };
820
+
821
+ var defaultFont = {
822
+ sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
823
+ mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
824
+ prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
825
+ };
826
+ var defaultBreakpoints = {
827
+ xs: {
828
+ min: '0',
829
+ max: '650px'
830
+ },
831
+ sm: {
832
+ min: '650px',
833
+ max: '900px'
834
+ },
835
+ md: {
836
+ min: '900px',
837
+ max: '1280px'
838
+ },
839
+ lg: {
840
+ min: '1280px',
841
+ max: '1920px'
842
+ },
843
+ xl: {
844
+ min: '1920px',
845
+ max: '10000px'
846
+ }
847
+ };
848
+ var defaultLayout = {
849
+ gap: '16pt',
850
+ gapNegative: '-16pt',
851
+ gapHalf: '8pt',
852
+ gapHalfNegative: '-8pt',
853
+ gapQuarter: '4pt',
854
+ gapQuarterNegative: '-4pt',
855
+ pageMargin: '16pt',
856
+ pageWidth: '750pt',
857
+ pageWidthWithMargin: '782pt',
858
+ breakpointMobile: defaultBreakpoints.xs.max,
859
+ breakpointTablet: defaultBreakpoints.sm.max,
860
+ radius: '6px',
861
+ unit: '16px'
862
+ };
863
+
864
+ var palette$1 = {
865
+ accents_1: '#fafafa',
866
+ accents_2: '#eaeaea',
867
+ accents_3: '#999',
868
+ accents_4: '#888',
869
+ accents_5: '#666',
870
+ accents_6: '#444',
871
+ accents_7: '#333',
872
+ accents_8: '#111',
873
+ background: '#fff',
874
+ foreground: '#000',
875
+ selection: '#79ffe1',
876
+ secondary: '#666',
877
+ code: '#f81ce5',
878
+ border: '#eaeaea',
879
+ error: '#e00',
880
+ errorLight: '#ff1a1a',
881
+ errorLighter: '#f7d4d6',
882
+ errorDark: '#c50000',
883
+ success: '#0070f3',
884
+ successLight: '#3291ff',
885
+ successLighter: '#d3e5ff',
886
+ successDark: '#0761d1',
887
+ warning: '#f5a623',
888
+ warningLight: '#f7b955',
889
+ warningLighter: '#ffefcf',
890
+ warningDark: '#ab570a',
891
+ cyan: '#50e3c2',
892
+ cyanLighter: '#aaffec',
893
+ cyanLight: '#79ffe1',
894
+ cyanDark: '#29bc9b',
895
+ violet: '#7928ca',
896
+ violetLighter: '#e3d7fc',
897
+ violetLight: '#8a63d2',
898
+ violetDark: '#4c2889',
899
+ purple: '#f81ce5',
900
+ alert: '#ff0080',
901
+ magenta: '#eb367f',
902
+ link: '#0070f3'
903
+ };
904
+ var expressiveness$1 = {
905
+ linkStyle: 'none',
906
+ linkHoverStyle: 'none',
907
+ dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
908
+ scrollerStart: 'rgba(255, 255, 255, 1)',
909
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
910
+ shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
911
+ shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
912
+ shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
913
+ portalOpacity: 0.25
914
+ };
915
+ var font$1 = defaultFont;
916
+ var breakpoints$1 = defaultBreakpoints;
917
+ var layout$1 = defaultLayout;
918
+ var themes$1 = {
919
+ type: 'light',
920
+ font: font$1,
921
+ layout: layout$1,
922
+ palette: palette$1,
923
+ breakpoints: breakpoints$1,
924
+ expressiveness: expressiveness$1
925
+ };
926
+
927
+ var palette = {
928
+ accents_1: '#111',
929
+ accents_2: '#333',
930
+ accents_3: '#444',
931
+ accents_4: '#666',
932
+ accents_5: '#888',
933
+ accents_6: '#999',
934
+ accents_7: '#eaeaea',
935
+ accents_8: '#fafafa',
936
+ background: '#000',
937
+ foreground: '#fff',
938
+ selection: '#f81ce5',
939
+ secondary: '#888',
940
+ code: '#79ffe1',
941
+ border: '#333',
942
+ error: '#e00',
943
+ errorLighter: '#f7d4d6',
944
+ errorLight: '#ff1a1a',
945
+ errorDark: '#c50000',
946
+ success: '#0070f3',
947
+ successLighter: '#d3e5ff',
948
+ successLight: '#3291ff',
949
+ successDark: '#0761d1',
950
+ warning: '#f5a623',
951
+ warningLighter: '#ffefcf',
952
+ warningLight: '#f7b955',
953
+ warningDark: '#ab570a',
954
+ cyan: '#50e3c2',
955
+ cyanLighter: '#aaffec',
956
+ cyanLight: '#79ffe1',
957
+ cyanDark: '#29bc9b',
958
+ violet: '#7928ca',
959
+ violetLighter: '#e3d7fc',
960
+ violetLight: '#8a63d2',
961
+ violetDark: '#4c2889',
962
+ purple: '#f81ce5',
963
+ alert: '#ff0080',
964
+ magenta: '#eb367f',
965
+ link: '#3291ff'
966
+ };
967
+ var expressiveness = {
968
+ linkStyle: 'none',
969
+ linkHoverStyle: 'none',
970
+ dropdownBoxShadow: '0 0 0 1px #333',
971
+ scrollerStart: 'rgba(255, 255, 255, 1)',
972
+ scrollerEnd: 'rgba(255, 255, 255, 0)',
973
+ shadowSmall: '0 0 0 1px #333',
974
+ shadowMedium: '0 0 0 1px #333',
975
+ shadowLarge: '0 0 0 1px #333',
976
+ portalOpacity: 0.75
977
+ };
978
+ var font = defaultFont;
979
+ var breakpoints = defaultBreakpoints;
980
+ var layout = defaultLayout;
981
+ var themes = {
982
+ type: 'dark',
983
+ font: font,
984
+ layout: layout,
985
+ palette: palette,
986
+ breakpoints: breakpoints,
987
+ expressiveness: expressiveness
988
+ };
989
+
990
+ var isObject = function isObject(target) {
991
+ return target && _typeof(target) === 'object';
992
+ };
993
+ var _deepDuplicable = function deepDuplicable(source, target) {
994
+ if (!isObject(target) || !isObject(source)) return source;
995
+ var sourceKeys = Object.keys(source);
996
+ var result = {};
997
+ for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
998
+ var key = _sourceKeys[_i];
999
+ var sourceValue = source[key];
1000
+ var targetValue = target[key];
1001
+ if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
1002
+ result[key] = targetValue.concat(sourceValue);
1003
+ } else if (isObject(sourceValue) && isObject(targetValue)) {
1004
+ result[key] = _deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
1005
+ } else if (targetValue) {
1006
+ result[key] = targetValue;
1007
+ } else {
1008
+ result[key] = sourceValue;
1009
+ }
1010
+ }
1011
+ return result;
1012
+ };
1013
+ var getPresets = function getPresets() {
1014
+ return [themes$1, themes];
1015
+ };
1016
+ var getPresetStaticTheme = function getPresetStaticTheme() {
1017
+ return themes$1;
1018
+ };
1019
+ var isAvailableThemeType = function isAvailableThemeType(type) {
1020
+ if (!type) return false;
1021
+ var presetThemes = getPresets();
1022
+ var hasType = presetThemes.find(function (theme) {
1023
+ return theme.type === type;
1024
+ });
1025
+ return !hasType;
1026
+ };
1027
+ var isPresetTheme = function isPresetTheme(themeOrType) {
1028
+ if (!themeOrType) return false;
1029
+ var isType = typeof themeOrType === 'string';
1030
+ var type = isType ? themeOrType : themeOrType.type;
1031
+ return !isAvailableThemeType(type);
1032
+ };
1033
+ var hasUserCustomTheme = function hasUserCustomTheme() {
1034
+ var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
1035
+ return !!themes.find(function (item) {
1036
+ return isAvailableThemeType(item.type);
1037
+ });
1038
+ };
1039
+ var create = function create(base, custom) {
1040
+ if (!isAvailableThemeType(custom.type)) {
1041
+ throw new Error('Duplicate or unavailable theme type');
1042
+ }
1043
+ return _deepDuplicable(base, custom);
1044
+ };
1045
+ var createFromDark = function createFromDark(custom) {
1046
+ return create(themes, custom);
1047
+ };
1048
+ var createFromLight = function createFromLight(custom) {
1049
+ return create(themes$1, custom);
1050
+ };
1051
+ var Themes = {
1052
+ isPresetTheme: isPresetTheme,
1053
+ isAvailableThemeType: isAvailableThemeType,
1054
+ hasUserCustomTheme: hasUserCustomTheme,
1055
+ getPresets: getPresets,
1056
+ getPresetStaticTheme: getPresetStaticTheme,
1057
+ create: create,
1058
+ createFromDark: createFromDark,
1059
+ createFromLight: createFromLight
1060
+ };
1061
+
1062
+ /* "use client" */
1063
+
1064
+ var defaultTheme = Themes.getPresetStaticTheme();
1065
+ var ThemeContext = /*#__PURE__*/React$1.createContext(defaultTheme);
1066
+ var useTheme = function useTheme() {
1067
+ return React$1.useContext(ThemeContext);
1068
+ };
1069
+
1070
+ /* "use client" */
1071
+
1072
+ var defaultAllThemesConfig = {
1073
+ themes: Themes.getPresets()
1074
+ };
1075
+ var AllThemesContext = /*#__PURE__*/React$1.createContext(defaultAllThemesConfig);
1076
+ var useAllThemes = function useAllThemes() {
1077
+ return React$1.useContext(AllThemesContext);
1078
+ };
1079
+
1080
+ var ThemeProvider = function ThemeProvider(_ref) {
1081
+ var children = _ref.children,
1082
+ themeType = _ref.themeType,
1083
+ _ref$themes = _ref.themes,
1084
+ themes = _ref$themes === void 0 ? [] : _ref$themes;
1085
+ var _React$useState = React$1.useState({
1086
+ themes: Themes.getPresets()
1087
+ }),
1088
+ _React$useState2 = _slicedToArray(_React$useState, 2),
1089
+ allThemes = _React$useState2[0],
1090
+ setAllThemes = _React$useState2[1];
1091
+ var currentTheme = React$1.useMemo(function () {
1092
+ var theme = allThemes.themes.find(function (item) {
1093
+ return item.type === themeType;
1094
+ });
1095
+ if (theme) return theme;
1096
+ return Themes.getPresetStaticTheme();
1097
+ }, [allThemes, themeType]);
1098
+ React$1.useEffect(function () {
1099
+ if (!(themes !== null && themes !== void 0 && themes.length)) return;
1100
+ setAllThemes(function (last) {
1101
+ var safeThemes = themes.filter(function (item) {
1102
+ return Themes.isAvailableThemeType(item.type);
1103
+ });
1104
+ var nextThemes = Themes.getPresets().concat(safeThemes);
1105
+ return _objectSpread2(_objectSpread2({}, last), {}, {
1106
+ themes: nextThemes
1107
+ });
1108
+ });
1109
+ }, [themes]);
1110
+ return /*#__PURE__*/React$1.createElement(AllThemesContext.Provider, {
1111
+ value: allThemes
1112
+ }, /*#__PURE__*/React$1.createElement(ThemeContext.Provider, {
1113
+ value: currentTheme
1114
+ }, children));
1115
+ };
1116
+
1117
+ var useCurrentState = function useCurrentState(initialState) {
1118
+ var _useState = React$1.useState(function () {
1119
+ return typeof initialState === 'function' ? initialState() : initialState;
1120
+ }),
1121
+ _useState2 = _slicedToArray(_useState, 2),
1122
+ state = _useState2[0],
1123
+ setState = _useState2[1];
1124
+ var ref = React$1.useRef(initialState);
1125
+ React$1.useEffect(function () {
1126
+ ref.current = state;
1127
+ }, [state]);
1128
+ var setValue = function setValue(val) {
1129
+ var result = typeof val === 'function' ? val(ref.current) : val;
1130
+ ref.current = result;
1131
+ setState(result);
1132
+ };
1133
+ return [state, setValue, ref];
1134
+ };
1135
+
1136
+ function getDefaultExportFromCjs (x) {
1137
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
1138
+ }
1139
+
1140
+ var index = {};
1141
+
1142
+ var hasRequiredIndex;
1143
+
1144
+ function requireIndex () {
1145
+ if (hasRequiredIndex) return index;
1146
+ hasRequiredIndex = 1;
1147
+ var React$1$1 = React$1;
1148
+
1149
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
1150
+
1151
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1$1);
1152
+
1153
+ /*
1154
+ Based on Glamor's sheet
1155
+ https://github.com/threepointone/glamor/blob/667b480d31b3721a905021b26e1290ce92ca2879/src/sheet.js
1156
+ */ function _defineProperties(target, props) {
1157
+ for(var i = 0; i < props.length; i++){
1158
+ var descriptor = props[i];
1159
+ descriptor.enumerable = descriptor.enumerable || false;
1160
+ descriptor.configurable = true;
1161
+ if ("value" in descriptor) descriptor.writable = true;
1162
+ Object.defineProperty(target, descriptor.key, descriptor);
1163
+ }
1164
+ }
1165
+ function _createClass(Constructor, protoProps, staticProps) {
1166
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
1167
+ return Constructor;
1168
+ }
1169
+ var isProd = typeof process !== "undefined" && process.env && process.env.NODE_ENV === "production";
1170
+ var isString = function(o) {
1171
+ return Object.prototype.toString.call(o) === "[object String]";
1172
+ };
1173
+ var StyleSheet = /*#__PURE__*/ function() {
1174
+ function StyleSheet(param) {
1175
+ var ref = param === void 0 ? {} : param, _name = ref.name, name = _name === void 0 ? "stylesheet" : _name, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? isProd : _optimizeForSpeed;
1176
+ invariant$1(isString(name), "`name` must be a string");
1177
+ this._name = name;
1178
+ this._deletedRulePlaceholder = "#" + name + "-deleted-rule____{}";
1179
+ invariant$1(typeof optimizeForSpeed === "boolean", "`optimizeForSpeed` must be a boolean");
1180
+ this._optimizeForSpeed = optimizeForSpeed;
1181
+ this._serverSheet = undefined;
1182
+ this._tags = [];
1183
+ this._injected = false;
1184
+ this._rulesCount = 0;
1185
+ var node = typeof window !== "undefined" && document.querySelector('meta[property="csp-nonce"]');
1186
+ this._nonce = node ? node.getAttribute("content") : null;
1187
+ }
1188
+ var _proto = StyleSheet.prototype;
1189
+ _proto.setOptimizeForSpeed = function setOptimizeForSpeed(bool) {
1190
+ invariant$1(typeof bool === "boolean", "`setOptimizeForSpeed` accepts a boolean");
1191
+ invariant$1(this._rulesCount === 0, "optimizeForSpeed cannot be when rules have already been inserted");
1192
+ this.flush();
1193
+ this._optimizeForSpeed = bool;
1194
+ this.inject();
1195
+ };
1196
+ _proto.isOptimizeForSpeed = function isOptimizeForSpeed() {
1197
+ return this._optimizeForSpeed;
1198
+ };
1199
+ _proto.inject = function inject() {
1200
+ var _this = this;
1201
+ invariant$1(!this._injected, "sheet already injected");
1202
+ this._injected = true;
1203
+ if (typeof window !== "undefined" && this._optimizeForSpeed) {
1204
+ this._tags[0] = this.makeStyleTag(this._name);
1205
+ this._optimizeForSpeed = "insertRule" in this.getSheet();
1206
+ if (!this._optimizeForSpeed) {
1207
+ if (!isProd) {
1208
+ console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode.");
1209
+ }
1210
+ this.flush();
1211
+ this._injected = true;
1212
+ }
1213
+ return;
1214
+ }
1215
+ this._serverSheet = {
1216
+ cssRules: [],
1217
+ insertRule: function(rule, index) {
1218
+ if (typeof index === "number") {
1219
+ _this._serverSheet.cssRules[index] = {
1220
+ cssText: rule
1221
+ };
1222
+ } else {
1223
+ _this._serverSheet.cssRules.push({
1224
+ cssText: rule
1225
+ });
1226
+ }
1227
+ return index;
1228
+ },
1229
+ deleteRule: function(index) {
1230
+ _this._serverSheet.cssRules[index] = null;
1231
+ }
1232
+ };
1233
+ };
1234
+ _proto.getSheetForTag = function getSheetForTag(tag) {
1235
+ if (tag.sheet) {
1236
+ return tag.sheet;
1237
+ }
1238
+ // this weirdness brought to you by firefox
1239
+ for(var i = 0; i < document.styleSheets.length; i++){
1240
+ if (document.styleSheets[i].ownerNode === tag) {
1241
+ return document.styleSheets[i];
1242
+ }
1243
+ }
1244
+ };
1245
+ _proto.getSheet = function getSheet() {
1246
+ return this.getSheetForTag(this._tags[this._tags.length - 1]);
1247
+ };
1248
+ _proto.insertRule = function insertRule(rule, index) {
1249
+ invariant$1(isString(rule), "`insertRule` accepts only strings");
1250
+ if (typeof window === "undefined") {
1251
+ if (typeof index !== "number") {
1252
+ index = this._serverSheet.cssRules.length;
1253
+ }
1254
+ this._serverSheet.insertRule(rule, index);
1255
+ return this._rulesCount++;
1256
+ }
1257
+ if (this._optimizeForSpeed) {
1258
+ var sheet = this.getSheet();
1259
+ if (typeof index !== "number") {
1260
+ index = sheet.cssRules.length;
1261
+ }
1262
+ // this weirdness for perf, and chrome's weird bug
1263
+ // https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
1264
+ try {
1265
+ sheet.insertRule(rule, index);
1266
+ } catch (error) {
1267
+ if (!isProd) {
1268
+ console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
1269
+ }
1270
+ return -1;
1271
+ }
1272
+ } else {
1273
+ var insertionPoint = this._tags[index];
1274
+ this._tags.push(this.makeStyleTag(this._name, rule, insertionPoint));
1275
+ }
1276
+ return this._rulesCount++;
1277
+ };
1278
+ _proto.replaceRule = function replaceRule(index, rule) {
1279
+ if (this._optimizeForSpeed || typeof window === "undefined") {
1280
+ var sheet = typeof window !== "undefined" ? this.getSheet() : this._serverSheet;
1281
+ if (!rule.trim()) {
1282
+ rule = this._deletedRulePlaceholder;
1283
+ }
1284
+ if (!sheet.cssRules[index]) {
1285
+ // @TBD Should we throw an error?
1286
+ return index;
1287
+ }
1288
+ sheet.deleteRule(index);
1289
+ try {
1290
+ sheet.insertRule(rule, index);
1291
+ } catch (error) {
1292
+ if (!isProd) {
1293
+ console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
1294
+ }
1295
+ // In order to preserve the indices we insert a deleteRulePlaceholder
1296
+ sheet.insertRule(this._deletedRulePlaceholder, index);
1297
+ }
1298
+ } else {
1299
+ var tag = this._tags[index];
1300
+ invariant$1(tag, "old rule at index `" + index + "` not found");
1301
+ tag.textContent = rule;
1302
+ }
1303
+ return index;
1304
+ };
1305
+ _proto.deleteRule = function deleteRule(index) {
1306
+ if (typeof window === "undefined") {
1307
+ this._serverSheet.deleteRule(index);
1308
+ return;
1309
+ }
1310
+ if (this._optimizeForSpeed) {
1311
+ this.replaceRule(index, "");
1312
+ } else {
1313
+ var tag = this._tags[index];
1314
+ invariant$1(tag, "rule at index `" + index + "` not found");
1315
+ tag.parentNode.removeChild(tag);
1316
+ this._tags[index] = null;
1317
+ }
1318
+ };
1319
+ _proto.flush = function flush() {
1320
+ this._injected = false;
1321
+ this._rulesCount = 0;
1322
+ if (typeof window !== "undefined") {
1323
+ this._tags.forEach(function(tag) {
1324
+ return tag && tag.parentNode.removeChild(tag);
1325
+ });
1326
+ this._tags = [];
1327
+ } else {
1328
+ // simpler on server
1329
+ this._serverSheet.cssRules = [];
1330
+ }
1331
+ };
1332
+ _proto.cssRules = function cssRules() {
1333
+ var _this = this;
1334
+ if (typeof window === "undefined") {
1335
+ return this._serverSheet.cssRules;
1336
+ }
1337
+ return this._tags.reduce(function(rules, tag) {
1338
+ if (tag) {
1339
+ rules = rules.concat(Array.prototype.map.call(_this.getSheetForTag(tag).cssRules, function(rule) {
1340
+ return rule.cssText === _this._deletedRulePlaceholder ? null : rule;
1341
+ }));
1342
+ } else {
1343
+ rules.push(null);
1344
+ }
1345
+ return rules;
1346
+ }, []);
1347
+ };
1348
+ _proto.makeStyleTag = function makeStyleTag(name, cssString, relativeToTag) {
1349
+ if (cssString) {
1350
+ invariant$1(isString(cssString), "makeStyleTag accepts only strings as second parameter");
1351
+ }
1352
+ var tag = document.createElement("style");
1353
+ if (this._nonce) tag.setAttribute("nonce", this._nonce);
1354
+ tag.type = "text/css";
1355
+ tag.setAttribute("data-" + name, "");
1356
+ if (cssString) {
1357
+ tag.appendChild(document.createTextNode(cssString));
1358
+ }
1359
+ var head = document.head || document.getElementsByTagName("head")[0];
1360
+ if (relativeToTag) {
1361
+ head.insertBefore(tag, relativeToTag);
1362
+ } else {
1363
+ head.appendChild(tag);
1364
+ }
1365
+ return tag;
1366
+ };
1367
+ _createClass(StyleSheet, [
1368
+ {
1369
+ key: "length",
1370
+ get: function get() {
1371
+ return this._rulesCount;
1372
+ }
1373
+ }
1374
+ ]);
1375
+ return StyleSheet;
1376
+ }();
1377
+ function invariant$1(condition, message) {
1378
+ if (!condition) {
1379
+ throw new Error("StyleSheet: " + message + ".");
1380
+ }
1381
+ }
1382
+
1383
+ function hash(str) {
1384
+ var _$hash = 5381, i = str.length;
1385
+ while(i){
1386
+ _$hash = _$hash * 33 ^ str.charCodeAt(--i);
1387
+ }
1388
+ /* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
1389
+ * integers. Since we want the results to be always positive, convert the
1390
+ * signed int to an unsigned by doing an unsigned bitshift. */ return _$hash >>> 0;
1391
+ }
1392
+ var stringHash = hash;
1393
+
1394
+ var sanitize = function(rule) {
1395
+ return rule.replace(/\/style/gi, "\\/style");
1396
+ };
1397
+ var cache = {};
1398
+ /**
1399
+ * computeId
1400
+ *
1401
+ * Compute and memoize a jsx id from a basedId and optionally props.
1402
+ */ function computeId(baseId, props) {
1403
+ if (!props) {
1404
+ return "jsx-" + baseId;
1405
+ }
1406
+ var propsToString = String(props);
1407
+ var key = baseId + propsToString;
1408
+ if (!cache[key]) {
1409
+ cache[key] = "jsx-" + stringHash(baseId + "-" + propsToString);
1410
+ }
1411
+ return cache[key];
1412
+ }
1413
+ /**
1414
+ * computeSelector
1415
+ *
1416
+ * Compute and memoize dynamic selectors.
1417
+ */ function computeSelector(id, css) {
1418
+ var selectoPlaceholderRegexp = /__jsx-style-dynamic-selector/g;
1419
+ // Sanitize SSR-ed CSS.
1420
+ // Client side code doesn't need to be sanitized since we use
1421
+ // document.createTextNode (dev) and the CSSOM api sheet.insertRule (prod).
1422
+ if (typeof window === "undefined") {
1423
+ css = sanitize(css);
1424
+ }
1425
+ var idcss = id + css;
1426
+ if (!cache[idcss]) {
1427
+ cache[idcss] = css.replace(selectoPlaceholderRegexp, id);
1428
+ }
1429
+ return cache[idcss];
1430
+ }
1431
+
1432
+ function mapRulesToStyle(cssRules, options) {
1433
+ if (options === void 0) options = {};
1434
+ return cssRules.map(function(args) {
1435
+ var id = args[0];
1436
+ var css = args[1];
1437
+ return /*#__PURE__*/ React__default["default"].createElement("style", {
1438
+ id: "__" + id,
1439
+ // Avoid warnings upon render with a key
1440
+ key: "__" + id,
1441
+ nonce: options.nonce ? options.nonce : undefined,
1442
+ dangerouslySetInnerHTML: {
1443
+ __html: css
1444
+ }
1445
+ });
1446
+ });
1447
+ }
1448
+ var StyleSheetRegistry = /*#__PURE__*/ function() {
1449
+ function StyleSheetRegistry(param) {
1450
+ var ref = param === void 0 ? {} : param, _styleSheet = ref.styleSheet, styleSheet = _styleSheet === void 0 ? null : _styleSheet, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? false : _optimizeForSpeed;
1451
+ this._sheet = styleSheet || new StyleSheet({
1452
+ name: "styled-jsx",
1453
+ optimizeForSpeed: optimizeForSpeed
1454
+ });
1455
+ this._sheet.inject();
1456
+ if (styleSheet && typeof optimizeForSpeed === "boolean") {
1457
+ this._sheet.setOptimizeForSpeed(optimizeForSpeed);
1458
+ this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
1459
+ }
1460
+ this._fromServer = undefined;
1461
+ this._indices = {};
1462
+ this._instancesCounts = {};
1463
+ }
1464
+ var _proto = StyleSheetRegistry.prototype;
1465
+ _proto.add = function add(props) {
1466
+ var _this = this;
1467
+ if (undefined === this._optimizeForSpeed) {
1468
+ this._optimizeForSpeed = Array.isArray(props.children);
1469
+ this._sheet.setOptimizeForSpeed(this._optimizeForSpeed);
1470
+ this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
1471
+ }
1472
+ if (typeof window !== "undefined" && !this._fromServer) {
1473
+ this._fromServer = this.selectFromServer();
1474
+ this._instancesCounts = Object.keys(this._fromServer).reduce(function(acc, tagName) {
1475
+ acc[tagName] = 0;
1476
+ return acc;
1477
+ }, {});
1478
+ }
1479
+ var ref = this.getIdAndRules(props), styleId = ref.styleId, rules = ref.rules;
1480
+ // Deduping: just increase the instances count.
1481
+ if (styleId in this._instancesCounts) {
1482
+ this._instancesCounts[styleId] += 1;
1483
+ return;
1484
+ }
1485
+ var indices = rules.map(function(rule) {
1486
+ return _this._sheet.insertRule(rule);
1487
+ })// Filter out invalid rules
1488
+ .filter(function(index) {
1489
+ return index !== -1;
1490
+ });
1491
+ this._indices[styleId] = indices;
1492
+ this._instancesCounts[styleId] = 1;
1493
+ };
1494
+ _proto.remove = function remove(props) {
1495
+ var _this = this;
1496
+ var styleId = this.getIdAndRules(props).styleId;
1497
+ invariant(styleId in this._instancesCounts, "styleId: `" + styleId + "` not found");
1498
+ this._instancesCounts[styleId] -= 1;
1499
+ if (this._instancesCounts[styleId] < 1) {
1500
+ var tagFromServer = this._fromServer && this._fromServer[styleId];
1501
+ if (tagFromServer) {
1502
+ tagFromServer.parentNode.removeChild(tagFromServer);
1503
+ delete this._fromServer[styleId];
1504
+ } else {
1505
+ this._indices[styleId].forEach(function(index) {
1506
+ return _this._sheet.deleteRule(index);
1507
+ });
1508
+ delete this._indices[styleId];
1509
+ }
1510
+ delete this._instancesCounts[styleId];
1511
+ }
1512
+ };
1513
+ _proto.update = function update(props, nextProps) {
1514
+ this.add(nextProps);
1515
+ this.remove(props);
1516
+ };
1517
+ _proto.flush = function flush() {
1518
+ this._sheet.flush();
1519
+ this._sheet.inject();
1520
+ this._fromServer = undefined;
1521
+ this._indices = {};
1522
+ this._instancesCounts = {};
1523
+ };
1524
+ _proto.cssRules = function cssRules() {
1525
+ var _this = this;
1526
+ var fromServer = this._fromServer ? Object.keys(this._fromServer).map(function(styleId) {
1527
+ return [
1528
+ styleId,
1529
+ _this._fromServer[styleId]
1530
+ ];
1531
+ }) : [];
1532
+ var cssRules = this._sheet.cssRules();
1533
+ return fromServer.concat(Object.keys(this._indices).map(function(styleId) {
1534
+ return [
1535
+ styleId,
1536
+ _this._indices[styleId].map(function(index) {
1537
+ return cssRules[index].cssText;
1538
+ }).join(_this._optimizeForSpeed ? "" : "\n")
1539
+ ];
1540
+ })// filter out empty rules
1541
+ .filter(function(rule) {
1542
+ return Boolean(rule[1]);
1543
+ }));
1544
+ };
1545
+ _proto.styles = function styles(options) {
1546
+ return mapRulesToStyle(this.cssRules(), options);
1547
+ };
1548
+ _proto.getIdAndRules = function getIdAndRules(props) {
1549
+ var css = props.children, dynamic = props.dynamic, id = props.id;
1550
+ if (dynamic) {
1551
+ var styleId = computeId(id, dynamic);
1552
+ return {
1553
+ styleId: styleId,
1554
+ rules: Array.isArray(css) ? css.map(function(rule) {
1555
+ return computeSelector(styleId, rule);
1556
+ }) : [
1557
+ computeSelector(styleId, css)
1558
+ ]
1559
+ };
1560
+ }
1561
+ return {
1562
+ styleId: computeId(id),
1563
+ rules: Array.isArray(css) ? css : [
1564
+ css
1565
+ ]
1566
+ };
1567
+ };
1568
+ /**
1569
+ * selectFromServer
1570
+ *
1571
+ * Collects style tags from the document with id __jsx-XXX
1572
+ */ _proto.selectFromServer = function selectFromServer() {
1573
+ var elements = Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));
1574
+ return elements.reduce(function(acc, element) {
1575
+ var id = element.id.slice(2);
1576
+ acc[id] = element;
1577
+ return acc;
1578
+ }, {});
1579
+ };
1580
+ return StyleSheetRegistry;
1581
+ }();
1582
+ function invariant(condition, message) {
1583
+ if (!condition) {
1584
+ throw new Error("StyleSheetRegistry: " + message + ".");
1585
+ }
1586
+ }
1587
+ var StyleSheetContext = /*#__PURE__*/ React$1$1.createContext(null);
1588
+ StyleSheetContext.displayName = "StyleSheetContext";
1589
+ function createStyleRegistry() {
1590
+ return new StyleSheetRegistry();
1591
+ }
1592
+ function StyleRegistry(param) {
1593
+ var configuredRegistry = param.registry, children = param.children;
1594
+ var rootRegistry = React$1$1.useContext(StyleSheetContext);
1595
+ var ref = React$1$1.useState(function() {
1596
+ return rootRegistry || configuredRegistry || createStyleRegistry();
1597
+ }), registry = ref[0];
1598
+ return /*#__PURE__*/ React__default["default"].createElement(StyleSheetContext.Provider, {
1599
+ value: registry
1600
+ }, children);
1601
+ }
1602
+ function useStyleRegistry() {
1603
+ return React$1$1.useContext(StyleSheetContext);
1604
+ }
1605
+
1606
+ // Opt-into the new `useInsertionEffect` API in React 18, fallback to `useLayoutEffect`.
1607
+ // https://github.com/reactwg/react-18/discussions/110
1608
+ var useInsertionEffect = React__default["default"].useInsertionEffect || React$1$1.useLayoutEffect;
1609
+ var defaultRegistry = typeof window !== "undefined" ? createStyleRegistry() : undefined;
1610
+ function JSXStyle(props) {
1611
+ var registry = defaultRegistry ? defaultRegistry : useStyleRegistry();
1612
+ var insertionEffectCalled = React$1$1.useRef(false);
1613
+ // `registry` might not exist while server-side rendering
1614
+ if (!registry) {
1615
+ return null;
1616
+ }
1617
+ if (typeof window === "undefined") {
1618
+ registry.add(props);
1619
+ return null;
1620
+ }
1621
+ useInsertionEffect(function() {
1622
+ // ReactDOM removes all DOM during hydration in certain cases
1623
+ if (!document.head) {
1624
+ return;
1625
+ }
1626
+ registry.add(props);
1627
+ insertionEffectCalled.current = true;
1628
+ return function() {
1629
+ insertionEffectCalled.current = false;
1630
+ registry.remove(props);
1631
+ };
1632
+ }, [
1633
+ props.id,
1634
+ String(props.dynamic)
1635
+ ]);
1636
+ React$1$1.useLayoutEffect(function() {
1637
+ if (!document.head || insertionEffectCalled.current) {
1638
+ return;
1639
+ }
1640
+ registry.add(props);
1641
+ return function() {
1642
+ registry.remove(props);
1643
+ };
1644
+ // props.children can be string[], will be striped since id is identical
1645
+ }, [
1646
+ props.id,
1647
+ String(props.dynamic)
1648
+ ]);
1649
+ return null;
1650
+ }
1651
+ JSXStyle.dynamic = function(info) {
1652
+ return info.map(function(tagInfo) {
1653
+ var baseId = tagInfo[0];
1654
+ var props = tagInfo[1];
1655
+ return computeId(baseId, props);
1656
+ }).join(" ");
1657
+ };
1658
+
1659
+ index.StyleRegistry = StyleRegistry;
1660
+ index.createStyleRegistry = createStyleRegistry;
1661
+ index.style = JSXStyle;
1662
+ index.useStyleRegistry = useStyleRegistry;
1663
+ return index;
1664
+ }
1665
+
1666
+ var style;
1667
+ var hasRequiredStyle;
1668
+
1669
+ function requireStyle () {
1670
+ if (hasRequiredStyle) return style;
1671
+ hasRequiredStyle = 1;
1672
+ style = requireIndex().style;
1673
+ return style;
1674
+ }
1675
+
1676
+ var styleExports = requireStyle();
1677
+ var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
1678
+
1679
+ /* "use client" */
1680
+
1681
+ var getId = function getId() {
1682
+ return Math.random().toString(32).slice(2, 10);
1683
+ };
1684
+ var isBrowser = function isBrowser() {
1685
+ return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
1686
+ };
1687
+
1688
+ var useSSR = function useSSR() {
1689
+ var _useState = React$1.useState(false),
1690
+ _useState2 = _slicedToArray(_useState, 2),
1691
+ browser = _useState2[0],
1692
+ setBrowser = _useState2[1];
1693
+ React$1.useEffect(function () {
1694
+ setBrowser(isBrowser());
1695
+ }, []);
1696
+ return {
1697
+ isBrowser: browser,
1698
+ isServer: !browser
1699
+ };
1700
+ };
1701
+
1702
+ var createElement = function createElement(id) {
1703
+ var el = document.createElement('div');
1704
+ el.setAttribute('id', id);
1705
+ return el;
1706
+ };
1707
+ var usePortal = function usePortal() {
1708
+ var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
1709
+ var getContainer = arguments.length > 1 ? arguments[1] : undefined;
1710
+ var id = "helpdice-ui-".concat(selectId);
1711
+ var _useSSR = useSSR(),
1712
+ isBrowser = _useSSR.isBrowser;
1713
+ var _useState = React$1.useState(isBrowser ? createElement(id) : null),
1714
+ _useState2 = _slicedToArray(_useState, 2),
1715
+ elSnapshot = _useState2[0],
1716
+ setElSnapshot = _useState2[1];
1717
+ React$1.useEffect(function () {
1718
+ var customContainer = getContainer ? getContainer() : null;
1719
+ var parentElement = customContainer || document.body;
1720
+ var hasElement = parentElement.querySelector("#".concat(id));
1721
+ var el = hasElement || createElement(id);
1722
+ if (!hasElement) {
1723
+ parentElement.appendChild(el);
1724
+ }
1725
+ setElSnapshot(el);
1726
+ }, []);
1727
+ return elSnapshot;
1728
+ };
1729
+
1730
+ var _excluded$2 = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
1731
+ var CssTransition = function CssTransition(_ref) {
1732
+ var children = _ref.children,
1733
+ _ref$className = _ref.className,
1734
+ className = _ref$className === void 0 ? '' : _ref$className,
1735
+ _ref$visible = _ref.visible,
1736
+ visible = _ref$visible === void 0 ? false : _ref$visible,
1737
+ _ref$enterTime = _ref.enterTime,
1738
+ enterTime = _ref$enterTime === void 0 ? 60 : _ref$enterTime,
1739
+ _ref$leaveTime = _ref.leaveTime,
1740
+ leaveTime = _ref$leaveTime === void 0 ? 60 : _ref$leaveTime,
1741
+ _ref$clearTime = _ref.clearTime,
1742
+ clearTime = _ref$clearTime === void 0 ? 60 : _ref$clearTime,
1743
+ _ref$name = _ref.name,
1744
+ name = _ref$name === void 0 ? 'transition' : _ref$name,
1745
+ props = _objectWithoutProperties(_ref, _excluded$2);
1746
+ var _useState = React$1.useState(''),
1747
+ _useState2 = _slicedToArray(_useState, 2),
1748
+ classes = _useState2[0],
1749
+ setClasses = _useState2[1];
1750
+ var _useState3 = React$1.useState(visible),
1751
+ _useState4 = _slicedToArray(_useState3, 2),
1752
+ renderable = _useState4[0],
1753
+ setRenderable = _useState4[1];
1754
+ React$1.useEffect(function () {
1755
+ var statusClassName = visible ? 'enter' : 'leave';
1756
+ var time = visible ? enterTime : leaveTime;
1757
+ if (visible && !renderable) {
1758
+ setRenderable(true);
1759
+ }
1760
+ setClasses("".concat(name, "-").concat(statusClassName));
1761
+
1762
+ // set class to active
1763
+ var timer = setTimeout(function () {
1764
+ setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
1765
+ clearTimeout(timer);
1766
+ }, time);
1767
+
1768
+ // remove classess when animation over
1769
+ var clearClassesTimer = setTimeout(function () {
1770
+ if (!visible) {
1771
+ setClasses('');
1772
+ setRenderable(false);
1773
+ }
1774
+ clearTimeout(clearClassesTimer);
1775
+ }, time + clearTime);
1776
+ return function () {
1777
+ clearTimeout(timer);
1778
+ clearTimeout(clearClassesTimer);
1779
+ };
1780
+ }, [visible, renderable]);
1781
+ if (! /*#__PURE__*/React$1.isValidElement(children) || !renderable) return null;
1782
+ var propsTransition = _objectSpread2(_objectSpread2({}, props), {}, {
1783
+ className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
1784
+ });
1785
+ return /*#__PURE__*/React$1.cloneElement(children, propsTransition);
1786
+ };
1787
+ CssTransition.displayName = 'CssTransition';
1788
+
1789
+ var tuple = function tuple() {
1790
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1791
+ args[_key] = arguments[_key];
1792
+ }
1793
+ return args;
1794
+ };
1795
+ tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
1796
+ tuple('default', 'secondary', 'success', 'warning', 'error');
1797
+ tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
1798
+ tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
1799
+ tuple('default', 'silent', 'prevent');
1800
+ tuple('hover', 'click');
1801
+ tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
1802
+ tuple('start', 'center', 'end', 'left', 'right');
1803
+
1804
+ var makeToastActions = function makeToastActions(actions, cancelHandle) {
1805
+ var handler = function handler(event, userHandler) {
1806
+ userHandler && userHandler(event, cancelHandle);
1807
+ };
1808
+ if (!actions || !actions.length) return null;
1809
+ return actions.map(function (action, index) {
1810
+ return /*#__PURE__*/React$1.createElement("button", {
1811
+ color: action.passive ? 'default' : 'secondary',
1812
+ key: "action-".concat(index),
1813
+ onClick: function onClick(event) {
1814
+ return handler(event, action.handler);
1815
+ }
1816
+ }, action.name);
1817
+ });
1818
+ };
1819
+ var getColors = function getColors(palette, type) {
1820
+ var colors = {
1821
+ "default": palette.background,
1822
+ secondary: palette.secondary,
1823
+ success: palette.success,
1824
+ warning: palette.warning,
1825
+ error: palette.error
1826
+ };
1827
+ var isDefault = !type || type === 'default';
1828
+ if (isDefault) return {
1829
+ bgColor: colors["default"],
1830
+ color: palette.foreground
1831
+ };
1832
+ /**
1833
+ * Prevent main color change in special types.
1834
+ * The color will only follow the theme when it is in the default type.
1835
+ */
1836
+ return {
1837
+ bgColor: colors[type],
1838
+ color: 'white'
1839
+ };
1840
+ };
1841
+ tuple('topLeft', 'topRight', 'bottomLeft', 'bottomRight');
1842
+ var isTopPlacement = function isTopPlacement(placement) {
1843
+ return "".concat(placement).toLowerCase().startsWith('top');
1844
+ };
1845
+ var isLeftPlacement = function isLeftPlacement(placement) {
1846
+ return "".concat(placement).toLowerCase().endsWith('left');
1847
+ };
1848
+ var getTranslateByPlacement = function getTranslateByPlacement(placement) {
1849
+ var translateInByPlacement = {
1850
+ topLeft: 'translate(-60px, -60px)',
1851
+ topRight: 'translate(60px, -60px)',
1852
+ bottomLeft: 'translate(-60px, 60px)',
1853
+ bottomRight: 'translate(60px, 60px)'
1854
+ };
1855
+ var translateOutByPlacement = {
1856
+ topLeft: 'translate(-50px, 15px) scale(0.85)',
1857
+ topRight: 'translate(50px, 15px) scale(0.85)',
1858
+ bottomLeft: 'translate(-50px, -15px) scale(0.85)',
1859
+ bottomRight: 'translate(50px, -15px) scale(0.85)'
1860
+ };
1861
+ return {
1862
+ enter: translateInByPlacement[placement],
1863
+ leave: translateOutByPlacement[placement]
1864
+ };
1865
+ };
1866
+
1867
+ var ToastItem = /*#__PURE__*/React$1.memo(function (_ref) {
1868
+ var toast = _ref.toast,
1869
+ layout = _ref.layout;
1870
+ var theme = useTheme();
1871
+ var _useMemo = React$1.useMemo(function () {
1872
+ return getColors(theme.palette, toast.type);
1873
+ }, [theme.palette, toast.type]),
1874
+ color = _useMemo.color,
1875
+ bgColor = _useMemo.bgColor;
1876
+ var isReactNode = typeof toast.text !== 'string';
1877
+ var padding = layout.padding,
1878
+ margin = layout.margin,
1879
+ maxHeight = layout.maxHeight,
1880
+ maxWidth = layout.maxWidth,
1881
+ width = layout.width,
1882
+ placement = layout.placement;
1883
+ var _useMemo2 = React$1.useMemo(function () {
1884
+ return getTranslateByPlacement(placement);
1885
+ }, [placement]),
1886
+ enter = _useMemo2.enter,
1887
+ leave = _useMemo2.leave;
1888
+ return /*#__PURE__*/React$1.createElement(CssTransition, {
1889
+ name: "toast",
1890
+ visible: toast.visible,
1891
+ clearTime: 350
1892
+ }, /*#__PURE__*/React$1.createElement("div", {
1893
+ key: toast.id,
1894
+ className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "toast"
1895
+ }, isReactNode ? toast.text : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", {
1896
+ className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "message"
1897
+ }, toast.text), /*#__PURE__*/React$1.createElement("div", {
1898
+ className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "action"
1899
+ }, makeToastActions(toast.actions, toast.cancel))), /*#__PURE__*/React$1.createElement(_JSXStyle, {
1900
+ id: "1407001838",
1901
+ dynamic: [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]
1902
+ }, ".toast.__jsx-style-dynamic-selector{width:".concat(width, ";max-width:").concat(maxWidth, ";max-height:").concat(maxHeight, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.foreground, ";background-color:").concat(bgColor, ";color:").concat(color, ";border:0;border-radius:").concat(theme.layout.radius, ";opacity:1;box-shadow:").concat(theme.expressiveness.shadowSmall, ";-webkit-transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);overflow:hidden;}.message.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;font-size:0.875em;display:-webkit-box;word-break:break-all;padding-right:").concat(theme.layout.gapHalf, ";overflow:hidden;max-height:100%;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.1rem;}.toast-enter.__jsx-style-dynamic-selector{opacity:0;height:0;padding:0;margin:0;-webkit-transform:").concat(enter, ";-ms-transform:").concat(enter, ";transform:").concat(enter, ";}.toast-enter-active.__jsx-style-dynamic-selector{opacity:1;height:auto;margin:").concat(margin, ";padding:").concat(padding, ";-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);}.toast-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);height:auto;margin:").concat(margin, ";padding:").concat(padding, ";}.toast-leave-active.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:").concat(leave, ";-ms-transform:").concat(leave, ";transform:").concat(leave, ";}"))));
1903
+ });
1904
+
1905
+ /* "use client" */
1906
+
1907
+ var classObjectToString = function classObjectToString(className) {
1908
+ var keys = Object.keys(className);
1909
+ var len = keys.length;
1910
+ var str = '';
1911
+ for (var index = 0; index < len; index++) {
1912
+ var key = keys[index];
1913
+ var val = className[keys[index]];
1914
+ if (!val) continue;
1915
+ str = str ? "".concat(str, " ").concat(String(key)) : String(key);
1916
+ }
1917
+ return str;
1918
+ };
1919
+ var isObjectClassName = function isObjectClassName(value) {
1920
+ return _typeof(value) === 'object' && !Array.isArray(value);
1921
+ };
1922
+ var useClasses = function useClasses() {
1923
+ var len = arguments.length;
1924
+ var classes = '';
1925
+ if (len === 0) return classes;
1926
+ for (var index = 0; index < len; index++) {
1927
+ var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
1928
+ if (!val) continue;
1929
+ if (isObjectClassName(val)) {
1930
+ classes += " ".concat(classObjectToString(val));
1931
+ } else {
1932
+ classes += " ".concat(String(val).trim());
1933
+ }
1934
+ }
1935
+ return classes.trim();
1936
+ };
1937
+
1938
+ var ToastContainer = function ToastContainer() {
1939
+ var theme = useTheme();
1940
+ var portal = usePortal('toast');
1941
+ var _useCurrentState = useCurrentState(false),
1942
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
1943
+ setHovering = _useCurrentState2[1],
1944
+ hoveringRef = _useCurrentState2[2];
1945
+ var _useHUIContext = useHUIContext(),
1946
+ toasts = _useHUIContext.toasts,
1947
+ updateToasts = _useHUIContext.updateToasts,
1948
+ toastLayout = _useHUIContext.toastLayout,
1949
+ lastUpdateToastId = _useHUIContext.lastUpdateToastId;
1950
+ var memoizedLayout = React$1.useMemo(function () {
1951
+ return toastLayout;
1952
+ }, [toastLayout]);
1953
+ var toastElements = React$1.useMemo(function () {
1954
+ return toasts.map(function (toast) {
1955
+ return /*#__PURE__*/React$1.createElement(ToastItem, {
1956
+ toast: toast,
1957
+ layout: memoizedLayout,
1958
+ key: toast._internalIdent
1959
+ });
1960
+ });
1961
+ }, [toasts, memoizedLayout]);
1962
+ var classNames = React$1.useMemo(function () {
1963
+ return useClasses('toasts', {
1964
+ top: isTopPlacement(toastLayout.placement),
1965
+ left: isLeftPlacement(toastLayout.placement)
1966
+ });
1967
+ }, [memoizedLayout]);
1968
+ var hoverHandler = function hoverHandler(isHovering) {
1969
+ setHovering(isHovering);
1970
+ if (isHovering) {
1971
+ return updateToasts(function (last) {
1972
+ return last.map(function (toast) {
1973
+ if (!toast.visible) return toast;
1974
+ toast._timeout && window.clearTimeout(toast._timeout);
1975
+ return _objectSpread2(_objectSpread2({}, toast), {}, {
1976
+ timeout: null
1977
+ });
1978
+ });
1979
+ });
1980
+ }
1981
+ updateToasts(function (last) {
1982
+ return last.map(function (toast, index) {
1983
+ if (!toast.visible) return toast;
1984
+ toast._timeout && window.clearTimeout(toast._timeout);
1985
+ return _objectSpread2(_objectSpread2({}, toast), {}, {
1986
+ _timeout: function () {
1987
+ var timer = window.setTimeout(function () {
1988
+ toast.cancel();
1989
+ window.clearTimeout(timer);
1990
+ }, toast.delay + index * 100);
1991
+ return timer;
1992
+ }()
1993
+ });
1994
+ });
1995
+ });
1996
+ };
1997
+ React$1.useEffect(function () {
1998
+ var index = toasts.findIndex(function (r) {
1999
+ return r._internalIdent === lastUpdateToastId;
2000
+ });
2001
+ var toast = toasts[index];
2002
+ if (!toast || toast.visible || !hoveringRef.current) return;
2003
+ var hasVisible = toasts.find(function (r, i) {
2004
+ return i < index && r.visible;
2005
+ });
2006
+ if (hasVisible || !hoveringRef.current) return;
2007
+ hoverHandler(false);
2008
+ }, [toasts, lastUpdateToastId]);
2009
+ React$1.useEffect(function () {
2010
+ var timeout = null;
2011
+ var timer = window.setInterval(function () {
2012
+ if (toasts.length === 0) return;
2013
+ timeout = window.setTimeout(function () {
2014
+ var allInvisible = !toasts.find(function (r) {
2015
+ return r.visible;
2016
+ });
2017
+ allInvisible && updateToasts(function () {
2018
+ return [];
2019
+ });
2020
+ timeout && clearTimeout(timeout);
2021
+ }, 350);
2022
+ }, 5000);
2023
+ return function () {
2024
+ timer && clearInterval(timer);
2025
+ timeout && clearTimeout(timeout);
2026
+ };
2027
+ }, [toasts]);
2028
+ if (!portal) return null;
2029
+ if (!toasts || toasts.length === 0) return null;
2030
+ return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React$1.createElement("div", {
2031
+ onMouseEnter: function onMouseEnter() {
2032
+ return hoverHandler(true);
2033
+ },
2034
+ onMouseLeave: function onMouseLeave() {
2035
+ return hoverHandler(false);
2036
+ },
2037
+ className: _JSXStyle.dynamic([["622610754", [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + (classNames || "")
2038
+ }, toastElements, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2039
+ id: "622610754",
2040
+ dynamic: [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]
2041
+ }, ".toasts.__jsx-style-dynamic-selector{position:fixed;width:auto;max-width:100%;right:".concat(theme.layout.gap, ";bottom:").concat(theme.layout.gap, ";z-index:2000;-webkit-transition:all 400ms ease;transition:all 400ms ease;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.top.__jsx-style-dynamic-selector{bottom:unset;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;top:").concat(theme.layout.gap, ";}.left.__jsx-style-dynamic-selector{right:unset;left:").concat(theme.layout.gap, ";}"))), portal);
2042
+ };
2043
+
2044
+ var HuiProvider = function HuiProvider(_ref) {
2045
+ var themes = _ref.themes,
2046
+ themeType = _ref.themeType,
2047
+ children = _ref.children;
2048
+ var _React$useState = React$1.useState(''),
2049
+ _React$useState2 = _slicedToArray(_React$useState, 2),
2050
+ lastUpdateToastId = _React$useState2[0],
2051
+ setLastUpdateToastId = _React$useState2[1];
2052
+ var _useCurrentState = useCurrentState([]),
2053
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
2054
+ toasts = _useCurrentState2[0],
2055
+ setToasts = _useCurrentState2[1],
2056
+ toastsRef = _useCurrentState2[2];
2057
+ var _useCurrentState3 = useCurrentState(defaultToastLayout),
2058
+ _useCurrentState4 = _slicedToArray(_useCurrentState3, 3),
2059
+ toastLayout = _useCurrentState4[0],
2060
+ setToastLayout = _useCurrentState4[1],
2061
+ toastLayoutRef = _useCurrentState4[2];
2062
+ var updateToasts = function updateToasts(fn) {
2063
+ var nextToasts = fn(toastsRef.current);
2064
+ setToasts(nextToasts);
2065
+ };
2066
+ var updateToastLayout = function updateToastLayout(fn) {
2067
+ var nextLayout = fn(toastLayoutRef.current);
2068
+ setToastLayout(nextLayout);
2069
+ };
2070
+ var updateLastToastId = function updateLastToastId(fn) {
2071
+ setLastUpdateToastId(fn());
2072
+ };
2073
+ var initialValue = React$1.useMemo(function () {
2074
+ return {
2075
+ toasts: toasts,
2076
+ toastLayout: toastLayout,
2077
+ updateToasts: updateToasts,
2078
+ lastUpdateToastId: lastUpdateToastId,
2079
+ updateToastLayout: updateToastLayout,
2080
+ updateLastToastId: updateLastToastId
2081
+ };
2082
+ }, [toasts, toastLayout, lastUpdateToastId]);
2083
+ return /*#__PURE__*/React$1.createElement(HUIContent.Provider, {
2084
+ value: initialValue
2085
+ }, /*#__PURE__*/React$1.createElement(ThemeProvider, {
2086
+ themes: themes,
2087
+ themeType: themeType
2088
+ }, children, /*#__PURE__*/React$1.createElement(ToastContainer, null)));
2089
+ };
2090
+
2091
+ // import flush from 'styled-jsx'
2092
+
2093
+ // export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
2094
+
2095
+ // export type FlushToHTML = (opts?: { nonce?: string }) => string
2096
+
2097
+ var CssBaseline = function CssBaseline(_ref) {
2098
+ var children = _ref.children;
2099
+ var theme = useTheme();
2100
+ return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2101
+ id: "3647548829",
2102
+ dynamic: [theme.palette.background, theme.palette.foreground, theme.palette.background, theme.font.sans, theme.font.sans, theme.palette.link, theme.expressiveness.linkStyle, theme.expressiveness.linkHoverStyle, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gap, theme.palette.foreground, theme.palette.code, theme.font.mono, theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.palette.accents_2, theme.layout.radius, theme.font.mono, theme.palette.foreground, theme.palette.accents_2, theme.palette.accents_1, theme.layout.gap, theme.layout.gap, theme.palette.accents_5, theme.palette.accents_1, theme.layout.radius, theme.palette.border, theme.palette.selection, theme.palette.foreground]
2103
+ }, "html,body{background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";}html{font-size:16px;--helpdice-icons-background:").concat(theme.palette.background, ";}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:").concat(theme.font.sans, ";}#__next{overflow-x:hidden;}*,*:before,*:after{box-sizing:inherit;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;font-family:").concat(theme.font.sans, ";}p{margin:1em 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875em;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.link, ";-webkit-text-decoration:").concat(theme.expressiveness.linkStyle, ";text-decoration:").concat(theme.expressiveness.linkStyle, ";}a:hover{-webkit-text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";}ul,ol{padding:0;list-style-type:none;margin:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";color:").concat(theme.palette.foreground, ";}ol{list-style-type:decimal;}li{margin-bottom:0.625em;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.7rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01em;-moz-letter-spacing:-0.01em;-ms-letter-spacing:-0.01em;letter-spacing:-0.01em;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005em;-moz-letter-spacing:-0.005em;-ms-letter-spacing:-0.005em;letter-spacing:-0.005em;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:").concat(theme.palette.code, ";font-family:").concat(theme.font.mono, ";font-size:0.9em;white-space:pre-wrap;}code:before,code:after{content:'\\`';}pre{padding:calc(").concat(theme.layout.gap, " * 0.9) ").concat(theme.layout.gap, ";margin:").concat(theme.layout.gap, " 0;border:1px solid ").concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";font-family:").concat(theme.font.mono, ";white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:14px;-webkit-overflow-scrolling:touch;}pre code{color:").concat(theme.palette.foreground, ";font-size:1em;line-height:1.25em;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:").concat(theme.palette.accents_2, ";}details{background-color:").concat(theme.palette.accents_1, ";border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::marker,summary::before,summary::-webkit-details-marker{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ").concat(theme.layout.gap, ") ").concat(theme.layout.gap, ";color:").concat(theme.palette.accents_5, ";background-color:").concat(theme.palette.accents_1, ";border-radius:").concat(theme.layout.radius, ";margin:1.5em 0;border:1px solid ").concat(theme.palette.border, ";}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:").concat(theme.palette.selection, ";color:").concat(theme.palette.foreground, ";}")));
2104
+ };
2105
+ var MemoCssBaseline = /*#__PURE__*/React$1.memo(CssBaseline);
2106
+
2107
+ var getElementOffset = function getElementOffset(el) {
2108
+ if (!el) return {
2109
+ top: 0,
2110
+ left: 0
2111
+ };
2112
+ var _el$getBoundingClient = el.getBoundingClientRect(),
2113
+ top = _el$getBoundingClient.top,
2114
+ left = _el$getBoundingClient.left;
2115
+ return {
2116
+ top: top,
2117
+ left: left
2118
+ };
2119
+ };
2120
+ var defaultRect$1 = {
2121
+ top: -1e3,
2122
+ left: -1e3,
2123
+ right: -1e3,
2124
+ width: 0,
2125
+ height: 0,
2126
+ elementTop: -1e3
2127
+ };
2128
+ var getRectFromDOMWithContainer = function getRectFromDOMWithContainer(domRect, getContainer) {
2129
+ if (!domRect) return defaultRect$1;
2130
+ var container = getContainer ? getContainer() : null;
2131
+ var scrollElement = container || document.documentElement;
2132
+ var _getElementOffset = getElementOffset(container),
2133
+ offsetTop = _getElementOffset.top,
2134
+ offsetLeft = _getElementOffset.left;
2135
+ return _objectSpread2(_objectSpread2({}, domRect), {}, {
2136
+ width: domRect.width || domRect.right - domRect.left,
2137
+ height: domRect.height || domRect.top - domRect.bottom,
2138
+ top: domRect.bottom + scrollElement.scrollTop - offsetTop,
2139
+ left: domRect.left + scrollElement.scrollLeft - offsetLeft,
2140
+ elementTop: domRect.top + scrollElement.scrollTop - offsetTop
2141
+ });
2142
+ };
2143
+ var isUnplacedRect = function isUnplacedRect(rect) {
2144
+ if (!rect) return true;
2145
+ return rect.top === defaultRect$1.top && rect.left === defaultRect$1.left;
2146
+ };
2147
+ var getRefRect = function getRefRect(ref, getContainer) {
2148
+ if (!ref || !ref.current) return defaultRect$1;
2149
+ var rect = ref.current.getBoundingClientRect();
2150
+ return getRectFromDOMWithContainer(rect, getContainer);
2151
+ };
2152
+ var getEventRect = function getEventRect(event, getContainer) {
2153
+ var _event$target;
2154
+ var rect = event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getBoundingClientRect();
2155
+ if (!rect) return defaultRect$1;
2156
+ return getRectFromDOMWithContainer(rect, getContainer);
2157
+ };
2158
+ var isRefTarget = function isRefTarget(eventOrRef) {
2159
+ return typeof (eventOrRef === null || eventOrRef === void 0 ? void 0 : eventOrRef.target) === 'undefined';
2160
+ };
2161
+ var useRect = function useRect(initialState) {
2162
+ var _useState = React$1.useState(initialState || defaultRect$1),
2163
+ _useState2 = _slicedToArray(_useState, 2),
2164
+ rect = _useState2[0],
2165
+ setRect = _useState2[1];
2166
+ var updateRect = function updateRect(eventOrRef, getContainer) {
2167
+ if (isRefTarget(eventOrRef)) return setRect(getRefRect(eventOrRef, getContainer));
2168
+ setRect(getEventRect(eventOrRef, getContainer));
2169
+ };
2170
+ return {
2171
+ rect: rect,
2172
+ setRect: updateRect
2173
+ };
2174
+ };
2175
+
2176
+ var defaultToast = {
2177
+ delay: 2000,
2178
+ type: 'default'
2179
+ };
2180
+ var useToasts = function useToasts(layout) {
2181
+ var _useHUIContext = useHUIContext(),
2182
+ updateToasts = _useHUIContext.updateToasts,
2183
+ toasts = _useHUIContext.toasts,
2184
+ updateToastLayout = _useHUIContext.updateToastLayout,
2185
+ updateLastToastId = _useHUIContext.updateLastToastId;
2186
+ React$1.useEffect(function () {
2187
+ if (!layout) return;
2188
+ updateToastLayout(function () {
2189
+ return layout ? _objectSpread2(_objectSpread2({}, defaultToastLayout), layout) : defaultToastLayout;
2190
+ });
2191
+ }, []);
2192
+ var _cancel = function cancel(internalId) {
2193
+ updateToasts(function (currentToasts) {
2194
+ return currentToasts.map(function (item) {
2195
+ if (item._internalIdent !== internalId) return item;
2196
+ return _objectSpread2(_objectSpread2({}, item), {}, {
2197
+ visible: false
2198
+ });
2199
+ });
2200
+ });
2201
+ updateLastToastId(function () {
2202
+ return internalId;
2203
+ });
2204
+ };
2205
+ var removeAll = function removeAll() {
2206
+ updateToasts(function (last) {
2207
+ return last.map(function (toast) {
2208
+ return _objectSpread2(_objectSpread2({}, toast), {}, {
2209
+ visible: false
2210
+ });
2211
+ });
2212
+ });
2213
+ };
2214
+ var findToastOneByID = function findToastOneByID(id) {
2215
+ return toasts.find(function (t) {
2216
+ return t.id === id;
2217
+ });
2218
+ };
2219
+ var removeToastOneByID = function removeToastOneByID(id) {
2220
+ updateToasts(function (last) {
2221
+ return last.map(function (toast) {
2222
+ if (toast.id !== id) return toast;
2223
+ return _objectSpread2(_objectSpread2({}, toast), {}, {
2224
+ visible: false
2225
+ });
2226
+ });
2227
+ });
2228
+ };
2229
+ var setToast = function setToast(toast) {
2230
+ var internalIdent = "toast-".concat(getId());
2231
+ var delay = toast.delay || defaultToast.delay;
2232
+ if (toast.id) {
2233
+ var hasIdent = toasts.find(function (t) {
2234
+ return t.id === toast.id;
2235
+ });
2236
+ if (hasIdent) {
2237
+ throw new Error('Toast: Already have the same key: "ident"');
2238
+ }
2239
+ }
2240
+ updateToasts(function (last) {
2241
+ var newToast = {
2242
+ delay: delay,
2243
+ text: toast.text,
2244
+ visible: true,
2245
+ type: toast.type || defaultToast.type,
2246
+ id: toast.id || internalIdent,
2247
+ actions: toast.actions || [],
2248
+ _internalIdent: internalIdent,
2249
+ _timeout: window.setTimeout(function () {
2250
+ _cancel(internalIdent);
2251
+ if (newToast._timeout) {
2252
+ window.clearTimeout(newToast._timeout);
2253
+ newToast._timeout = null;
2254
+ }
2255
+ }, delay),
2256
+ cancel: function cancel() {
2257
+ return _cancel(internalIdent);
2258
+ }
2259
+ };
2260
+ return [].concat(_toConsumableArray(last), [newToast]);
2261
+ });
2262
+ };
2263
+ return {
2264
+ toasts: toasts,
2265
+ setToast: setToast,
2266
+ removeAll: removeAll,
2267
+ findToastOneByID: findToastOneByID,
2268
+ removeToastOneByID: removeToastOneByID
2269
+ };
2270
+ };
2271
+
2272
+ tuple('xs', 'sm', 'md', 'lg', 'xl', 'mobile');
2273
+ tuple('up', 'down', 'default');
2274
+ var defaultResponsiveOptions = {
2275
+ match: 'default'
2276
+ };
2277
+ var makeQueries = function makeQueries(bp, up, down) {
2278
+ var queryString = function queryString(item) {
2279
+ var upQuery = "(min-width: ".concat(item.min, ")");
2280
+ var downQuery = "(max-width: ".concat(item.max, ")");
2281
+ return up ? upQuery : down ? downQuery : "".concat(upQuery, " and ").concat(downQuery);
2282
+ };
2283
+ var xs = queryString(bp.xs);
2284
+ return {
2285
+ xs: xs,
2286
+ mobile: xs,
2287
+ sm: queryString(bp.sm),
2288
+ md: queryString(bp.md),
2289
+ lg: queryString(bp.lg),
2290
+ xl: queryString(bp.xl)
2291
+ };
2292
+ };
2293
+ var useMediaQuery = function useMediaQuery(breakpoint) {
2294
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultResponsiveOptions;
2295
+ var _options$match = options.match,
2296
+ matchType = _options$match === void 0 ? 'default' : _options$match,
2297
+ _options$ssrMatchMedi = options.ssrMatchMedia,
2298
+ ssrMatchMedia = _options$ssrMatchMedi === void 0 ? null : _options$ssrMatchMedi;
2299
+ var supportMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
2300
+ var theme = useTheme();
2301
+ var mediaQueries = React$1.useMemo(function () {
2302
+ var up = matchType === 'up';
2303
+ var down = matchType === 'down';
2304
+ return makeQueries(theme.breakpoints, up, down);
2305
+ }, [theme.breakpoints, options]);
2306
+ var query = React$1.useMemo(function () {
2307
+ return mediaQueries[breakpoint];
2308
+ }, [mediaQueries, breakpoint]);
2309
+ var matchQuery = function matchQuery(q) {
2310
+ return window.matchMedia(q);
2311
+ };
2312
+
2313
+ /**
2314
+ * Do nothing in the server-side rendering.
2315
+ * If server match query fucntion is simulated, return user-defined value first.
2316
+ */
2317
+ var _useState = React$1.useState(function () {
2318
+ if (supportMedia) return matchQuery(query).matches;
2319
+ if (ssrMatchMedia && typeof ssrMatchMedia === 'function') {
2320
+ return ssrMatchMedia(query).matches;
2321
+ }
2322
+ return false;
2323
+ }),
2324
+ _useState2 = _slicedToArray(_useState, 2),
2325
+ state = _useState2[0],
2326
+ setState = _useState2[1];
2327
+ React$1.useEffect(function () {
2328
+ if (!supportMedia) return;
2329
+ var queryList = matchQuery(query);
2330
+ var update = function update() {
2331
+ return setState(matchQuery(query).matches);
2332
+ };
2333
+ update();
2334
+
2335
+ /**
2336
+ * addListener is deprecated. EventTarget.addEventListener is recommended.
2337
+ * But in some old browsers, MediaQueryList does not inherit from EventTarget.
2338
+ */
2339
+ queryList.addListener(update);
2340
+ return function () {
2341
+ queryList.removeListener(update);
2342
+ };
2343
+ }, [supportMedia]);
2344
+ return state;
2345
+ };
2346
+
2347
+ /* "use client" */
2348
+
2349
+ var usePrevious = function usePrevious(state) {
2350
+ var ref = React$1.useRef(null);
2351
+ React$1.useEffect(function () {
2352
+ ref.current = state;
2353
+ });
2354
+ return ref ? ref.current : null;
2355
+ };
2356
+
2357
+ var _excluded$1 = ["rect", "visible", "hoverHeightRatio", "hoverWidthRatio", "activeOpacity", "className"];
2358
+ var Highlight = function Highlight(_ref) {
2359
+ var rect = _ref.rect,
2360
+ visible = _ref.visible,
2361
+ _ref$hoverHeightRatio = _ref.hoverHeightRatio,
2362
+ hoverHeightRatio = _ref$hoverHeightRatio === void 0 ? 1 : _ref$hoverHeightRatio,
2363
+ _ref$hoverWidthRatio = _ref.hoverWidthRatio,
2364
+ hoverWidthRatio = _ref$hoverWidthRatio === void 0 ? 1 : _ref$hoverWidthRatio,
2365
+ _ref$activeOpacity = _ref.activeOpacity,
2366
+ activeOpacity = _ref$activeOpacity === void 0 ? 0.8 : _ref$activeOpacity,
2367
+ className = _ref.className,
2368
+ props = _objectWithoutProperties(_ref, _excluded$1);
2369
+ var theme = useTheme();
2370
+ var ref = React$1.useRef(null);
2371
+ var isFirstVisible = usePrevious(isUnplacedRect(rect));
2372
+ var position = React$1.useMemo(function () {
2373
+ var width = rect.width * hoverWidthRatio;
2374
+ var height = rect.height * hoverHeightRatio;
2375
+ return {
2376
+ width: "".concat(width, "px"),
2377
+ left: "".concat(rect.left + (rect.width - width) / 2, "px"),
2378
+ height: "".concat(height, "px"),
2379
+ top: "".concat(rect.elementTop + (rect.height - height) / 2, "px"),
2380
+ transition: isFirstVisible ? 'opacity' : 'opacity, width, left, top'
2381
+ };
2382
+ }, [rect, hoverWidthRatio, hoverHeightRatio]);
2383
+ return /*#__PURE__*/React$1.createElement("div", _extends({
2384
+ ref: ref
2385
+ }, props, {
2386
+ className: _JSXStyle.dynamic([["603024321", [theme.palette.accents_2, position.width, position.left, position.height, position.top, visible ? activeOpacity : 0, position.transition]]]) + " " + (props && props.className != null && props.className || useClasses('highlight', className) || "")
2387
+ }), /*#__PURE__*/React$1.createElement(_JSXStyle, {
2388
+ id: "603024321",
2389
+ dynamic: [theme.palette.accents_2, position.width, position.left, position.height, position.top, visible ? activeOpacity : 0, position.transition]
2390
+ }, ".highlight.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_2, ";position:absolute;border-radius:5px;width:").concat(position.width, ";left:").concat(position.left, ";height:").concat(position.height, ";top:").concat(position.top, ";opacity:").concat(visible ? activeOpacity : 0, ";-webkit-transition:0.15s ease;transition:0.15s ease;-webkit-transition-property:").concat(position.transition, ";transition-property:").concat(position.transition, ";}")));
2391
+ };
2392
+
2393
+ var Ellipsis = function Ellipsis(_ref) {
2394
+ var children = _ref.children,
2395
+ height = _ref.height;
2396
+ return /*#__PURE__*/React$1.createElement("span", {
2397
+ className: _JSXStyle.dynamic([["822089635", [height]]])
2398
+ }, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2399
+ id: "822089635",
2400
+ dynamic: [height]
2401
+ }, "span.__jsx-style-dynamic-selector{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:".concat(height, ";min-width:0;}")));
2402
+ };
2403
+ var ellipsis = /*#__PURE__*/React$1.memo(Ellipsis);
2404
+
2405
+ var getRealShape = function getRealShape(el) {
2406
+ var defaultShape = {
2407
+ width: 0,
2408
+ height: 0
2409
+ };
2410
+ if (!el || typeof window === 'undefined') return defaultShape;
2411
+ var rect = el.getBoundingClientRect();
2412
+ var _window$getComputedSt = window.getComputedStyle(el),
2413
+ width = _window$getComputedSt.width,
2414
+ height = _window$getComputedSt.height;
2415
+ var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
2416
+ if (!str) return 0;
2417
+ var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
2418
+ return Number.isNaN(+strVal) ? 0 : +strVal;
2419
+ };
2420
+ return {
2421
+ width: getCSSStyleVal("".concat(width), rect.width),
2422
+ height: getCSSStyleVal("".concat(height), rect.height)
2423
+ };
2424
+ };
2425
+ var useRealShape = function useRealShape(ref) {
2426
+ var _useState = React$1.useState({
2427
+ width: 0,
2428
+ height: 0
2429
+ }),
2430
+ _useState2 = _slicedToArray(_useState, 2),
2431
+ state = _useState2[0],
2432
+ setState = _useState2[1];
2433
+ var update = function update() {
2434
+ var _getRealShape = getRealShape(ref.current),
2435
+ width = _getRealShape.width,
2436
+ height = _getRealShape.height;
2437
+ setState({
2438
+ width: width,
2439
+ height: height
2440
+ });
2441
+ };
2442
+ React$1.useEffect(function () {
2443
+ return update();
2444
+ }, [ref.current]);
2445
+ return [state, update];
2446
+ };
2447
+
2448
+ var Expand = function Expand(_ref) {
2449
+ var _ref$isExpanded = _ref.isExpanded,
2450
+ isExpanded = _ref$isExpanded === void 0 ? false : _ref$isExpanded,
2451
+ _ref$delay = _ref.delay,
2452
+ delay = _ref$delay === void 0 ? 200 : _ref$delay,
2453
+ children = _ref.children;
2454
+ var _useState = React$1.useState(isExpanded ? 'auto' : '0'),
2455
+ _useState2 = _slicedToArray(_useState, 2),
2456
+ height = _useState2[0],
2457
+ setHeight = _useState2[1];
2458
+ var _useState3 = React$1.useState(isExpanded),
2459
+ _useState4 = _slicedToArray(_useState3, 2),
2460
+ selfExpanded = _useState4[0],
2461
+ setSelfExpanded = _useState4[1];
2462
+ var _useState5 = React$1.useState(isExpanded),
2463
+ _useState6 = _slicedToArray(_useState5, 2),
2464
+ visible = _useState6[0],
2465
+ setVisible = _useState6[1];
2466
+ var contentRef = React$1.useRef(null);
2467
+ var entryTimer = React$1.useRef();
2468
+ var leaveTimer = React$1.useRef();
2469
+ var resetTimer = React$1.useRef();
2470
+ var _useRealShape = useRealShape(contentRef),
2471
+ _useRealShape2 = _slicedToArray(_useRealShape, 2),
2472
+ state = _useRealShape2[0],
2473
+ updateShape = _useRealShape2[1];
2474
+ var classes = useClasses('container', {
2475
+ expanded: selfExpanded
2476
+ });
2477
+ React$1.useEffect(function () {
2478
+ return setHeight("".concat(state.height, "px"));
2479
+ }, [state.height]);
2480
+ React$1.useEffect(function () {
2481
+ // show element or reset height.
2482
+ // force an update once manually, even if the element does not change.
2483
+ // (the height of the element might be "auto")
2484
+ if (isExpanded) {
2485
+ setVisible(isExpanded);
2486
+ } else {
2487
+ updateShape();
2488
+ setHeight("".concat(state.height, "px"));
2489
+ }
2490
+
2491
+ // show expand animation
2492
+ entryTimer.current = window.setTimeout(function () {
2493
+ setSelfExpanded(isExpanded);
2494
+ clearTimeout(entryTimer.current);
2495
+ }, 30);
2496
+
2497
+ // Reset height after animation
2498
+ if (isExpanded) {
2499
+ resetTimer.current = window.setTimeout(function () {
2500
+ setHeight('auto');
2501
+ clearTimeout(resetTimer.current);
2502
+ }, delay);
2503
+ } else {
2504
+ leaveTimer.current = window.setTimeout(function () {
2505
+ setVisible(isExpanded);
2506
+ clearTimeout(leaveTimer.current);
2507
+ }, delay / 2);
2508
+ }
2509
+ return function () {
2510
+ clearTimeout(entryTimer.current);
2511
+ clearTimeout(leaveTimer.current);
2512
+ clearTimeout(resetTimer.current);
2513
+ };
2514
+ }, [isExpanded]);
2515
+ return /*#__PURE__*/React$1.createElement("div", {
2516
+ className: _JSXStyle.dynamic([["1918690829", [visible ? 'visible' : 'hidden', delay, height]]]) + " " + (classes || "")
2517
+ }, /*#__PURE__*/React$1.createElement("div", {
2518
+ ref: contentRef,
2519
+ className: _JSXStyle.dynamic([["1918690829", [visible ? 'visible' : 'hidden', delay, height]]]) + " " + "content"
2520
+ }, children), /*#__PURE__*/React$1.createElement(_JSXStyle, {
2521
+ id: "1918690829",
2522
+ dynamic: [visible ? 'visible' : 'hidden', delay, height]
2523
+ }, ".container.__jsx-style-dynamic-selector{padding:0;margin:0;height:0;overflow:hidden;visibility:".concat(visible ? 'visible' : 'hidden', ";-webkit-transition:height ").concat(delay, "ms ease;transition:height ").concat(delay, "ms ease;}.expanded.__jsx-style-dynamic-selector{height:").concat(height, ";visibility:visible;}")));
2524
+ };
2525
+ Expand.displayName = 'Expand';
2526
+
2527
+ /* "use client" */
2528
+
2529
+ var useResize = function useResize(callback) {
2530
+ var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
2531
+ React$1.useEffect(function () {
2532
+ var fn = function fn() {
2533
+ return callback();
2534
+ };
2535
+ if (immediatelyInvoke) {
2536
+ fn();
2537
+ }
2538
+ window.addEventListener('resize', fn);
2539
+ return function () {
2540
+ return window.removeEventListener('resize', fn);
2541
+ };
2542
+ }, []);
2543
+ };
2544
+
2545
+ /* "use client" */
2546
+
2547
+ var useClickAnyWhere = function useClickAnyWhere(handler) {
2548
+ React$1.useEffect(function () {
2549
+ var callback = function callback(event) {
2550
+ return handler(event);
2551
+ };
2552
+ document.addEventListener('click', callback);
2553
+ return function () {
2554
+ return document.removeEventListener('click', callback);
2555
+ };
2556
+ }, [handler]);
2557
+ };
2558
+
2559
+ /* "use client" */
2560
+
2561
+ var useDOMObserver = function useDOMObserver(ref) {
2562
+ var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
2563
+ var config = {
2564
+ attributes: false,
2565
+ childList: true,
2566
+ subtree: true
2567
+ };
2568
+ React$1.useEffect(function () {
2569
+ if (!ref || !ref.current) return;
2570
+ var unmount = false;
2571
+ var done = function done() {
2572
+ if (unmount) return;
2573
+ callback.apply(void 0, arguments);
2574
+ };
2575
+ var observer = new MutationObserver(done);
2576
+ observer.observe(ref.current, config);
2577
+ return function () {
2578
+ unmount = true;
2579
+ observer.disconnect();
2580
+ };
2581
+ }, [ref]);
2582
+ };
2583
+
2584
+ var warningStack = {};
2585
+ var useWarning = function useWarning(message, component) {
2586
+ var tag = ' ';
2587
+ var log = "[Helpdice UI]".concat(tag, ": ").concat(message);
2588
+ if (typeof console === 'undefined') return;
2589
+ if (warningStack[log]) return;
2590
+ warningStack[log] = true;
2591
+ if (process.env.NODE_ENV !== 'production') {
2592
+ return console.error(log);
2593
+ }
2594
+ console.warn(log);
2595
+ };
2596
+
2597
+ var defaultRect = {
2598
+ top: -1e3,
2599
+ left: -1e3,
2600
+ right: -1e3,
2601
+ width: 0
2602
+ };
2603
+ var Dropdown = /*#__PURE__*/React$1.memo(function (_ref) {
2604
+ var children = _ref.children,
2605
+ parent = _ref.parent,
2606
+ visible = _ref.visible,
2607
+ disableMatchWidth = _ref.disableMatchWidth,
2608
+ getPopupContainer = _ref.getPopupContainer;
2609
+ var el = usePortal('dropdown', getPopupContainer);
2610
+ var _useState = React$1.useState(defaultRect),
2611
+ _useState2 = _slicedToArray(_useState, 2),
2612
+ rect = _useState2[0],
2613
+ setRect = _useState2[1];
2614
+ var classes = useClasses('dropdown', disableMatchWidth ? 'disable-match' : 'width-match');
2615
+ if (!parent) return null;
2616
+
2617
+ /* istanbul ignore next */
2618
+ if (process.env.NODE_ENV !== 'production') {
2619
+ if (getPopupContainer && getPopupContainer()) {
2620
+ var _el = getPopupContainer();
2621
+ var style = window.getComputedStyle(_el);
2622
+ if (style.position === 'static') {
2623
+ useWarning('The element specified by "getPopupContainer" must have "position" set.');
2624
+ }
2625
+ }
2626
+ }
2627
+ var updateRect = function updateRect() {
2628
+ var _getRefRect = getRefRect(parent, getPopupContainer),
2629
+ top = _getRefRect.top,
2630
+ left = _getRefRect.left,
2631
+ right = _getRefRect.right,
2632
+ nativeWidth = _getRefRect.width;
2633
+ setRect({
2634
+ top: top,
2635
+ left: left,
2636
+ right: right,
2637
+ width: nativeWidth
2638
+ });
2639
+ };
2640
+ useResize(updateRect);
2641
+ useClickAnyWhere(function () {
2642
+ var _getRefRect2 = getRefRect(parent, getPopupContainer),
2643
+ top = _getRefRect2.top,
2644
+ left = _getRefRect2.left;
2645
+ var shouldUpdatePosition = top !== rect.top || left !== rect.left;
2646
+ if (!shouldUpdatePosition) return;
2647
+ updateRect();
2648
+ });
2649
+ useDOMObserver(parent, function () {
2650
+ updateRect();
2651
+ });
2652
+ React$1.useEffect(function () {
2653
+ if (!parent || !parent.current) return;
2654
+ parent.current.addEventListener('mouseenter', updateRect);
2655
+ /* istanbul ignore next */
2656
+ return function () {
2657
+ if (!parent || !parent.current) return;
2658
+ parent.current.removeEventListener('mouseenter', updateRect);
2659
+ };
2660
+ }, [parent]);
2661
+ var clickHandler = function clickHandler(event) {
2662
+ event.stopPropagation();
2663
+ event.nativeEvent.stopImmediatePropagation();
2664
+ event.preventDefault();
2665
+ };
2666
+ var mouseDownHandler = function mouseDownHandler(event) {
2667
+ event.preventDefault();
2668
+ };
2669
+ if (!el) return null;
2670
+ return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React$1.createElement(CssTransition, {
2671
+ visible: visible
2672
+ }, /*#__PURE__*/React$1.createElement("div", {
2673
+ onClick: clickHandler,
2674
+ onMouseDown: mouseDownHandler,
2675
+ className: _JSXStyle.dynamic([["1644673105", [rect.top + 2, rect.left, rect.width, rect.width]]]) + " " + (classes || "")
2676
+ }, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
2677
+ id: "1644673105",
2678
+ dynamic: [rect.top + 2, rect.left, rect.width, rect.width]
2679
+ }, ".dropdown.__jsx-style-dynamic-selector{position:absolute;top:".concat(rect.top + 2, "px;left:").concat(rect.left, "px;z-index:1100;}.width-match.__jsx-style-dynamic-selector{width:").concat(rect.width, "px;}.disable-match.__jsx-style-dynamic-selector{min-width:").concat(rect.width, "px;}")))), el);
2680
+ });
2681
+
2682
+ var _excluded = ["children", "onClick", "visible", "width", "onContentClick", "backdropClassName", "positionClassName", "layerClassName"];
2683
+ var Backdrop = /*#__PURE__*/React$1.memo(function (_ref) {
2684
+ var children = _ref.children,
2685
+ _ref$onClick = _ref.onClick,
2686
+ onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
2687
+ _ref$visible = _ref.visible,
2688
+ visible = _ref$visible === void 0 ? false : _ref$visible,
2689
+ width = _ref.width,
2690
+ _ref$onContentClick = _ref.onContentClick,
2691
+ onContentClick = _ref$onContentClick === void 0 ? function () {} : _ref$onContentClick,
2692
+ _ref$backdropClassNam = _ref.backdropClassName,
2693
+ backdropClassName = _ref$backdropClassNam === void 0 ? '' : _ref$backdropClassNam,
2694
+ _ref$positionClassNam = _ref.positionClassName,
2695
+ positionClassName = _ref$positionClassNam === void 0 ? '' : _ref$positionClassNam,
2696
+ _ref$layerClassName = _ref.layerClassName,
2697
+ layerClassName = _ref$layerClassName === void 0 ? '' : _ref$layerClassName,
2698
+ props = _objectWithoutProperties(_ref, _excluded);
2699
+ var theme = useTheme();
2700
+ var _useCurrentState = useCurrentState(false),
2701
+ _useCurrentState2 = _slicedToArray(_useCurrentState, 3),
2702
+ setIsContentMouseDown = _useCurrentState2[1],
2703
+ IsContentMouseDownRef = _useCurrentState2[2];
2704
+ var clickHandler = function clickHandler(event) {
2705
+ if (IsContentMouseDownRef.current) return;
2706
+ onClick && onClick(event);
2707
+ };
2708
+ var mouseUpHandler = function mouseUpHandler() {
2709
+ if (!IsContentMouseDownRef.current) return;
2710
+ var timer = setTimeout(function () {
2711
+ setIsContentMouseDown(false);
2712
+ clearTimeout(timer);
2713
+ }, 0);
2714
+ };
2715
+ return /*#__PURE__*/React$1.createElement(CssTransition, {
2716
+ name: "backdrop-wrapper",
2717
+ visible: visible,
2718
+ clearTime: 300
2719
+ }, /*#__PURE__*/React$1.createElement("div", _extends({
2720
+ onClick: clickHandler,
2721
+ onMouseUp: mouseUpHandler
2722
+ }, props, {
2723
+ className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (props && props.className != null && props.className || useClasses('backdrop', backdropClassName) || "")
2724
+ }), /*#__PURE__*/React$1.createElement("div", {
2725
+ className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses('layer', layerClassName) || "")
2726
+ }), /*#__PURE__*/React$1.createElement("div", {
2727
+ onClick: onContentClick,
2728
+ onMouseDown: function onMouseDown() {
2729
+ return setIsContentMouseDown(true);
2730
+ },
2731
+ className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses('position', positionClassName) || "")
2732
+ }, children), /*#__PURE__*/React$1.createElement(_JSXStyle, {
2733
+ id: "2021762493",
2734
+ dynamic: [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]
2735
+ }, ".backdrop.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;overflow:auto;z-index:1000;-webkit-overflow-scrolling:touch;box-sizing:border-box;text-align:center;}.position.__jsx-style-dynamic-selector{position:relative;z-index:1001;outline:none;max-width:90%;width:".concat(width, ";margin:20px auto;vertical-align:middle;display:inline-block;}.backdrop.__jsx-style-dynamic-selector:before{display:inline-block;width:0;height:100%;vertical-align:middle;content:'';}.layer.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;opacity:").concat(theme.expressiveness.portalOpacity, ";background-color:black;-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);pointer-events:none;z-index:1000;}.backdrop-wrapper-enter.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}.backdrop-wrapper-enter-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}"))));
2736
+ });
2737
+ Backdrop.displayName = 'Backdrop';
2738
+
2739
+ dist.Backdrop = Backdrop;
2740
+ dist.CssBaseline = MemoCssBaseline;
2741
+ dist.CssTransition = CssTransition;
2742
+ dist.Dropdown = Dropdown;
2743
+ dist.Ellipsis = ellipsis;
2744
+ dist.Expand = Expand;
2745
+ dist.Highlight = Highlight;
2746
+ dist.Themes = Themes;
2747
+ dist.UiProvider = HuiProvider;
2748
+ dist.useAllThemes = useAllThemes;
2749
+ dist.useClasses = useClasses;
2750
+ dist.useCurrentState = useCurrentState;
2751
+ dist.useMediaQuery = useMediaQuery;
2752
+ dist.useRect = useRect;
2753
+ dist.useTheme = useTheme;
2754
+ dist.useToasts = useToasts;
2755
+ return dist;
2756
+ }
2757
+
2758
+ var distExports = /*@__PURE__*/ requireDist();
940
2759
 
941
2760
  /* "use client" */
942
2761
 
@@ -1038,7 +2857,7 @@ var withScale = function withScale(Render) {
1038
2857
  var _ref2, _ref3, _ref4, _ref5, _ref6, _ref7, _ref8, _ref9, _ref0, _ref1, _ref10, _ref11, _ref12, _ref13, _ref14, _ref15, _ref16, _ref17, _ref18, _ref19, _ref20, _ref21, _ref22, _ref23, _ref24, _ref25, _ref26, _ref27, _ref28, _ref29, _ref30, _ref31;
1039
2858
  var children = _ref.children,
1040
2859
  props = _objectWithoutProperties(_ref, _excluded$1);
1041
- var _useTheme = useTheme(),
2860
+ var _useTheme = distExports.useTheme(),
1042
2861
  layout = _useTheme.layout;
1043
2862
  var paddingLeft = props.paddingLeft,
1044
2863
  pl = props.pl,
@@ -1120,39 +2939,6 @@ var withScale = function withScale(Render) {
1120
2939
  return ScaleFC;
1121
2940
  };
1122
2941
 
1123
- /* "use client" */
1124
-
1125
- var classObjectToString = function classObjectToString(className) {
1126
- var keys = Object.keys(className);
1127
- var len = keys.length;
1128
- var str = '';
1129
- for (var index = 0; index < len; index++) {
1130
- var key = keys[index];
1131
- var val = className[keys[index]];
1132
- if (!val) continue;
1133
- str = str ? "".concat(str, " ").concat(String(key)) : String(key);
1134
- }
1135
- return str;
1136
- };
1137
- var isObjectClassName = function isObjectClassName(value) {
1138
- return _typeof(value) === 'object' && !Array.isArray(value);
1139
- };
1140
- var useClasses = function useClasses() {
1141
- var len = arguments.length;
1142
- var classes = '';
1143
- if (len === 0) return classes;
1144
- for (var index = 0; index < len; index++) {
1145
- var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
1146
- if (!val) continue;
1147
- if (isObjectClassName(val)) {
1148
- classes += " ".concat(classObjectToString(val));
1149
- } else {
1150
- classes += " ".concat(String(val).trim());
1151
- }
1152
- }
1153
- return classes.trim();
1154
- };
1155
-
1156
2942
  var _excluded = ["title", "content", "className"];
1157
2943
  var DescriptionComponent = function DescriptionComponent(_ref) {
1158
2944
  var _ref$title = _ref.title,
@@ -1162,10 +2948,10 @@ var DescriptionComponent = function DescriptionComponent(_ref) {
1162
2948
  _ref$className = _ref.className,
1163
2949
  className = _ref$className === void 0 ? '' : _ref$className,
1164
2950
  props = _objectWithoutProperties(_ref, _excluded);
1165
- var theme = useTheme();
2951
+ var theme = distExports.useTheme();
1166
2952
  var _useScale = useScale(),
1167
2953
  SCALES = _useScale.SCALES;
1168
- var classes = useClasses('description', className);
2954
+ var classes = distExports.useClasses('description', className);
1169
2955
  return /*#__PURE__*/React.createElement("dl", _extends({}, props, {
1170
2956
  className: _JSXStyle.dynamic([["2323318745", [SCALES.font(1), SCALES.width(1, 'auto'), SCALES.height(1, 'auto'), SCALES.pt(0), SCALES.pr(0), SCALES.pb(0), SCALES.pl(0), SCALES.mt(0), SCALES.mr(0), SCALES.mb(0), SCALES.ml(0), theme.palette.accents_5, theme.palette.foreground]]]) + " " + (props && props.className != null && props.className || classes || "")
1171
2957
  }), /*#__PURE__*/React.createElement("dt", {