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